avra: add a layer of indirection to FLBL!

This will make it easier to fit BR* in there.
This commit is contained in:
Virgil Dupras 2020-05-18 19:45:30 -04:00
parent 63dec372ce
commit cdddfdefae
3 changed files with 14 additions and 12 deletions

View File

@ -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,, ;

14
blk/669
View File

@ -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! ;

View File

@ -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,