~vdupras/duskos

604855a8a1945a0730be89bea3ed1336f26c00ca — Virgil Dupras 3 months ago 4072b5c
rpi: add "to" words and fix broken lblimmwr

It wouldn't write the "1" literal properly because the $10 from the "32" rotate
would leak into the Rd field.
2 files changed, 24 insertions(+), 2 deletions(-)

M fs/xcomp/arm/rpi/kernel.fs
M fs/xcomp/rpiboot.fs
M fs/xcomp/arm/rpi/kernel.fs => fs/xcomp/arm/rpi/kernel.fs +2 -1
@@ 493,7 493,8 @@ pc
  ( pc ) abs>rel b) z) ,)
  and) r3 rdn) $ff i) ,) \ r3=8b imm
  sub) r1 rd) rTOP rn) r3 rm) r2 rlsl) f) ,) \ r1=rest of n
  rsb) r2 rdn) 32 i) ,) \ rotate is to the *right*
  rsb) r2 rdn) 0 i) ,) \ rotate is to the *right*
  and) r2 rdn) $1e i) ,) \ 0-32, even numbers
  orr) rTOP rd) r3 rn) r2 rm) 7 lsl) ,) \ rTOP=rotate+imm
  exit,


M fs/xcomp/rpiboot.fs => fs/xcomp/rpiboot.fs +22 -1
@@ 157,7 157,28 @@ code (does) pushret, r> W>A, W) @, W<>A, CELLSZ W+n, branchA,
: does> r> ( exit current definition ) _ @ ! ;
: does' ( w -- 'data ) DOESSZ + ;

: test ( n ) dup 1+ >r >r V1 emit V2 emit 2rdrop ;
: _to doer ' , ' , immediate does> toptr ! ;
: _!, !, drop, ; :16b 16b) !, drop, ; :8b 8b) !, drop, ;
_to to ! _!,
: _+!, dup +, _!, ; :16b dup 16b) +, 16b _!, ; :8b dup 8b) +, 8b _!, ;
_to to+ +! _+!,
: _1+!, 1 swap [+n], ; :16b 1 swap 16b) [+n], ; :8b 1 swap 8b) [+n], ;
_to to1+ 1+! _1+!,
: _1-!, -1 swap [+n], ; :16b -1 swap 16b) [+n], ; :8b -1 swap 8b) [+n], ;
_to to1- 1-! _1-!,
_to to@! @! @!,
: _@@+, dup, dup [@], 4 swap [+n], ;
:16b dup, dup 16b) [@], 2 swap [+n], ;
:8b dup, dup 8b) [@], 1 swap [+n], ;
_to to@+ @@+ _@@+,
: _@!+, dup [!], 4 swap [+n], drop, ;
:16b dup 16b) [!], 2 swap [+n], drop, ;
:8b dup 8b) [!], 1 swap [+n], drop, ;
_to to!+ @!+ _@!+,
: _addr, dup, addr, ; :16b dup, addr, ; :8b dup, addr, ;
_to to' noop _addr,

: test ( n ) dup 1+ >r >r V1 emit V2 emit to1+ V2 V2 emit 2rdrop ;
: test2 doer , does> @ emit ;