1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-27 09:48:05 +11:00

avra: begin implementing forward label system

This commit is contained in:
Virgil Dupras 2020-05-17 11:04:08 -04:00
parent 212126d6d2
commit 8c4c879a65
4 changed files with 16 additions and 5 deletions

View File

@ -1 +1 @@
1 8 LOADR+
1 9 LOADR+

View File

@ -1,4 +1,5 @@
VARIABLE ORG
VARIABLE L1 VARIABLE L2 VARIABLE L3 VARIABLE L4
: SPLITB
256 /MOD SWAP
;

View File

@ -2,7 +2,7 @@
: _r7ffc DUP 0x7ff > IF _oor THEN ;
: _raddr12
PC - DUP 0< IF 0x800 + _r7ffc 0x800 OR ELSE _r7ffc THEN ;
: RJMP ( a -- op ) _raddr12 0xc000 OR ;
: RCALL ( a -- op ) _raddr12 0xd000 OR ;
: RJMP, RJMP A,, ;
: RCALL, RCALL A,, ;
0xc0 CONSTANT RJMPOP
0xd0 CONSTANT RCALLOP
: RJMP, _raddr12 RJMPOP 8 LSHIFT OR A,, ;
: RCALL, _raddr12 RCALLOP 8 LSHIFT OR A,, ;

10
blk/669 Normal file
View File

@ -0,0 +1,10 @@
( ex: L1 LBL! .. L1 @ RJMP, )
: LBL! ( l -- ) PC SWAP ! ;
( ex: L1 FLBL, .. RJMPOP L1 FLBL! )
: FLBL, ( l -- ) LBL! 0 A,, ;
: FLBL! ( op l -- )
@ DUP PC -^ 1- ( op l off )
ROT 8 LSHIFT OR ( l op' )
( warning: l is a PC offset, not a mem addr! )
SWAP 2 * ORG @ + ( op' addr ) ! ;