From 8c4c879a65bccae695f2d4983769a5991a826037 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Sun, 17 May 2020 11:04:08 -0400 Subject: [PATCH] avra: begin implementing forward label system --- blk/660 | 2 +- blk/661 | 1 + blk/668 | 8 ++++---- blk/669 | 10 ++++++++++ 4 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 blk/669 diff --git a/blk/660 b/blk/660 index dcc3342..dfa31f7 100644 --- a/blk/660 +++ b/blk/660 @@ -1 +1 @@ -1 8 LOADR+ +1 9 LOADR+ diff --git a/blk/661 b/blk/661 index 3fb6b14..448b789 100644 --- a/blk/661 +++ b/blk/661 @@ -1,4 +1,5 @@ VARIABLE ORG +VARIABLE L1 VARIABLE L2 VARIABLE L3 VARIABLE L4 : SPLITB 256 /MOD SWAP ; diff --git a/blk/668 b/blk/668 index f0d4735..46605ef 100644 --- a/blk/668 +++ b/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,, ; diff --git a/blk/669 b/blk/669 new file mode 100644 index 0000000..6f163af --- /dev/null +++ b/blk/669 @@ -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 ) ! ; +