From cdddfdefaed6a14e973f2bfd9a4d0bf8484d9fe3 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Mon, 18 May 2020 19:45:30 -0400 Subject: [PATCH] avra: add a layer of indirection to FLBL! This will make it easier to fit BR* in there. --- blk/668 | 8 ++++---- blk/669 | 14 ++++++++------ recipes/sms/kbd/ps2ctl.fs | 4 ++-- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/blk/668 b/blk/668 index 46605ef..77f1b51 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 ; -0xc0 CONSTANT RJMPOP -0xd0 CONSTANT RCALLOP -: RJMP, _raddr12 RJMPOP 8 LSHIFT OR A,, ; -: RCALL, _raddr12 RCALLOP 8 LSHIFT OR A,, ; +: RJMP _raddr12 0xc000 OR ; +: RCALL _raddr12 0xd000 OR ; +: RJMP, RJMP A,, ; +: RCALL, RCALL A,, ; diff --git a/blk/669 b/blk/669 index 6f163af..0900c36 100644 --- a/blk/669 +++ b/blk/669 @@ -1,10 +1,12 @@ -( ex: L1 LBL! .. L1 @ RJMP, ) +( L1 LBL! .. L1 @ RJMP, ) : LBL! ( l -- ) PC SWAP ! ; -( ex: L1 FLBL, .. RJMPOP L1 FLBL! ) +( 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' ) +: FLBL! ( l opw -- ) ( warning: l is a PC offset, not a mem addr! ) - SWAP 2 * ORG @ + ( op' addr ) ! ; + SWAP @ 2 * ORG @ + PC 1- H@ ( opw addr tgt hbkp ) + ROT HERE ! ( opw tgt hbkp ) SWAP ROT EXECUTE H@ ! ( hbkp ) + HERE ! ; +: FRJMP! ( l -- ) ['] RJMP FLBL! ; +: FRCALL! ( l -- ) ['] RCALL FLBL! ; diff --git a/recipes/sms/kbd/ps2ctl.fs b/recipes/sms/kbd/ps2ctl.fs index b0cc45e..dd39d17 100644 --- a/recipes/sms/kbd/ps2ctl.fs +++ b/recipes/sms/kbd/ps2ctl.fs @@ -56,13 +56,13 @@ L2 FLBL, ( hdlINT0 ) ( Read DATA and set GPIOR0/0 if high. Then, set flag T. no SREG fiddling because no SREG-modifying instruction ) -RJMPOP L2 FLBL! ( hdlINT0 ) +L2 FRJMP! ( hdlINT0 ) PINB DATA SBIC, GPIOR0 0 SBI, SET, RETI, -RJMPOP L1 FLBL! ( main ) +L1 FRJMP! ( main ) 16 RAMEND 0xff AND LDI, SPL 16 OUT, 16 RAMEND 8 RSHIFT LDI,