1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-30 21:58:05 +11:00

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 ; : _r7ffc DUP 0x7ff > IF _oor THEN ;
: _raddr12 : _raddr12
PC - DUP 0< IF 0x800 + _r7ffc 0x800 OR ELSE _r7ffc THEN ; PC - DUP 0< IF 0x800 + _r7ffc 0x800 OR ELSE _r7ffc THEN ;
0xc0 CONSTANT RJMPOP : RJMP _raddr12 0xc000 OR ;
0xd0 CONSTANT RCALLOP : RCALL _raddr12 0xd000 OR ;
: RJMP, _raddr12 RJMPOP 8 LSHIFT OR A,, ; : RJMP, RJMP A,, ;
: RCALL, _raddr12 RCALLOP 8 LSHIFT OR 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 ! ; : LBL! ( l -- ) PC SWAP ! ;
( ex: L1 FLBL, .. RJMPOP L1 FLBL! ) ( L1 FLBL, .. RJMPOP L1 FLBL! )
: FLBL, ( l -- ) LBL! 0 A,, ; : FLBL, ( l -- ) LBL! 0 A,, ;
: FLBL! ( op l -- ) : FLBL! ( l opw -- )
@ DUP PC -^ 1- ( op l off )
ROT 8 LSHIFT OR ( l op' )
( warning: l is a PC offset, not a mem addr! ) ( 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. ( Read DATA and set GPIOR0/0 if high. Then, set flag T.
no SREG fiddling because no SREG-modifying instruction ) no SREG fiddling because no SREG-modifying instruction )
RJMPOP L2 FLBL! ( hdlINT0 ) L2 FRJMP! ( hdlINT0 )
PINB DATA SBIC, PINB DATA SBIC,
GPIOR0 0 SBI, GPIOR0 0 SBI,
SET, SET,
RETI, RETI,
RJMPOP L1 FLBL! ( main ) L1 FRJMP! ( main )
16 RAMEND 0xff AND LDI, 16 RAMEND 0xff AND LDI,
SPL 16 OUT, SPL 16 OUT,
16 RAMEND 8 RSHIFT LDI, 16 RAMEND 8 RSHIFT LDI,