mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-27 12:28:06 +11:00
avra: begin implementing forward label system
This commit is contained in:
parent
212126d6d2
commit
8c4c879a65
1
blk/661
1
blk/661
@ -1,4 +1,5 @@
|
||||
VARIABLE ORG
|
||||
VARIABLE L1 VARIABLE L2 VARIABLE L3 VARIABLE L4
|
||||
: SPLITB
|
||||
256 /MOD SWAP
|
||||
;
|
||||
|
8
blk/668
8
blk/668
@ -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
10
blk/669
Normal 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 ) ! ;
|
||||
|
Loading…
Reference in New Issue
Block a user