~vdupras/duskos

dc3754235c32a4155e24836839f9c9ad291ab2bd — Virgil Dupras 1 year, 4 months ago bb31039
rpi: add [+n],

This gets us to 1+! and 1-!.
2 files changed, 22 insertions(+), 6 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 +16 -6
@@ 49,9 49,9 @@ $44 const UART0_ICR
: xconst ( n -- ) pc swap le, xcode xdup, rTOP pc@>reg, exit, ;

: values ( n -- ) for 0 value next ;
12 values lblcurword lblsysdict lblhere lblnextmeta lblcompiling lblbootptr
          lblhbank
          lblcwrite lbldwrite lblwriterange lblerrmsg lblmain
13 values lblcurword lblsysdict lblhere lblnextmeta lblcompiling lblbootptr
          lblhbank lblcwrite lbldwrite lblwriterange lblimmwr
          lblerrmsg lblmain
$8000 to binstart
binstart const RSTOP
RSTOP $1000 - const PSTOP


@@ 437,7 437,7 @@ pc to L1 ( operand -- ) \ r0=base instr
  xdrop,
  lbldwrite abs>rel b) ,)

pc to L2 ( n -- ) \ r0=base instr
pc to lblimmwr ( n -- ) \ r0=base instr
  tst) rTOP rn) $80000000 i) ,)
  eor) ne) r0 rdn) $00c00000 i) ,) \ add) to sub)
  rsb) ne) rTOP rdn) 0 i) ,) \ negate rTOP


@@ 446,11 446,11 @@ pc to L2 ( n -- ) \ r0=base instr

pc add) rSP rdn) 0 i) ,)
xcode rs+, ( n -- )
  ( pc ) r0 pc@>reg, L2 abs>rel b) ,)
  ( pc ) r0 pc@>reg, lblimmwr abs>rel b) ,)

pc add) rPSP rdn) 0 i) ,)
xcode ps+, ( n -- )
  ( pc ) r0 pc@>reg, L2 abs>rel b) ,)
  ( pc ) r0 pc@>reg, lblimmwr abs>rel b) ,)

pc mov) rTOP rd) 0 i) ,)
xcode LIT>W, ( n -- )


@@ 509,6 509,16 @@ xcode +, ( operand -- )
  ( pc ) r0 pc@>reg,
  lbldwrite abs>rel b) ,)

pc add) r0 rdn) 0 i) ,)
xcode [+n], ( n operand -- )
  pushret,
  bic) rTOP rdn) $f000 i) ,) \ Rd=r0
  xdup, wcall, @,
  ( pc ) r0 pc@>reg,
  swp) rTOP rd) rPSP rn) rTOP rm) ,) ( operand n )
  lblimmwr abs>rel bl) ,)
  popret, wjmp, !,

pc pushret,
xcode pushret,
  ( pc ) r0 pc@>reg, lbldwrite abs>rel b) ,)

M fs/xcomp/rpiboot.fs => fs/xcomp/rpiboot.fs +6 -0
@@ 26,6 26,12 @@ code w! branch, drop
code +! W>A, drop, A) +, A) !, drop, exit,
code16b W>A, drop, A) 16b) +, A) 16b) !, drop, exit,
code8b W>A, drop, A) 8b) +, A) 8b) !, drop, exit,
code 1+! 1 W) [+n], drop, exit,
code16b 1 W) 16b) [+n], drop, exit,
code8b 1 W) 8b) [+n], drop, exit,
code 1-! -1 W) [+n], drop, exit,
code16b -1 W) 16b) [+n], drop, exit,
code8b -1 W) 8b) [+n], drop, exit,

uartinit prompt interactive!