duskos

dusk os fork
git clone git://git.alexwennerberg.com/duskos
Log | Files | Refs | README | LICENSE

commit c9f285edd953641dfc16317fa9d0d5ade4e37e30
parent 010be3325a22e2cd340099fe0ac0c6023de10f63
Author: Virgil Dupras <hsoft@hardcoded.net>
Date:   Sun,  4 Jun 2023 08:37:44 -0400

rpi: hello, this is a comment!

Diffstat:
Mfs/xcomp/arm/rpi/kernel.fs | 39+++++++++++++++++++++++++++++++++++++++
Mfs/xcomp/bootlo.fs | 2+-
Mfs/xcomp/rpiboot.fs | 30++++++++++++++++++++++++++++--
3 files changed, 68 insertions(+), 3 deletions(-)

diff --git a/fs/xcomp/arm/rpi/kernel.fs b/fs/xcomp/arm/rpi/kernel.fs @@ -631,6 +631,45 @@ pc to L2 ( a -- a ) \ r2=base instr sub) rTOP rdn) 4 i) ,) exit, +xcode branchC, ( a cond -- a ) + mov) r2 rd) $0a000000 i) ,) + orr) r2 rdn) rTOP rm) ,) + xdrop, + L2 abs>rel b) ,) + +pc mov) rPC rd) rA rm) ,) +xcode branchA, + ( pc ) r0 pc@>reg, lbldwrite abs>rel b) ,) + +xcode branch! ( tgt a -- ) + r1 ppop, \ r1=tgt + sub) r0 rd) r1 rn) rTOP rm) ,) \ r0=displacement + mov) r0 rd) r0 rm) 2 lsr) ,) + sub) r0 rdn) 2 i) ,) + bic) r0 rn) $ff000000 i) ,) \ r0=24-bit offset + ldr) r1 rd) rTOP rn) ,) + and) r1 rdn) $ff000000 i) ,) + orr) r0 rdn) r1 rm) ,) + str) r0 rd) rTOP rn) ,) + xdrop, exit, + +pc cmp) rTOP rn) 0 i) ,) +xcode W=0>Z, + ( pc ) r0 pc@>reg, lbldwrite abs>rel b) ,) + +pc cmp) rA rn) 0 i) ,) +xcode A=0>Z, + ( pc ) r0 pc@>reg, lbldwrite abs>rel b) ,) + +pc mov) rTOP rd) 0 i) ,) add) z) ( 0 cond ) rTOP rdn) 1 i) ,) +xcode C>W, ( cond -- ) + dup ( pc ) r0 pc@>reg, + pushret, lbldwrite abs>rel bl) ,) popret, + ( pc ) 4 + r0 pc@>reg, + orr) r0 rdn) rTOP rm) ,) + xdrop, + lbldwrite abs>rel b) ,) + pc xdup, xcode dup, ( pc ) r0 pc@>reg, lbldwrite abs>rel b) ,) diff --git a/fs/xcomp/bootlo.fs b/fs/xcomp/bootlo.fs @@ -73,7 +73,7 @@ code 1- -1 W+n, exit, code execute W>A, drop, branchA, code not W=0>Z, Z) C>W, exit, code bool W=0>Z, NZ) C>W, exit, -: if 0 W>A, drop, A=0>Z, Z) branchC, ; immediate +: if W>A, drop, A=0>Z, 0 Z) branchC, ; immediate : ahead 0 branch, ; immediate : then HERE @ swap branch! ; immediate code ?dup W=0>Z, 0 Z) branchC, dup, then exit, diff --git a/fs/xcomp/rpiboot.fs b/fs/xcomp/rpiboot.fs @@ -70,5 +70,31 @@ code 1- -1 W+n, exit, : , HERE @!+ ; :16b HERE 16b @!+ ; :8b HERE 8b @!+ ; : c, 8b , ; -uartinit prompt interactive! - +code execute W>A, drop, branchA, +code not W=0>Z, Z) C>W, exit, +code bool W=0>Z, NZ) C>W, exit, +: if W>A, drop, A=0>Z, 0 Z) branchC, ; immediate +: ahead 0 branch, ; immediate +: then HERE @ swap branch! ; immediate +code ?dup W=0>Z, 0 Z) branchC, dup, then exit, +: ' word sysdict @ find dup not if (wnf) then ; +: ['] ' litn ; immediate +: compile ' litn ['] execute, execute, ; immediate +: [compile] ' execute, ; immediate +: allot HERE +! ; +: else [compile] ahead HERE @ rot branch! ; immediate +: begin HERE @ ; immediate +: again branch, drop ; immediate +: until W>A, drop, A=0>Z, Z) branchC, drop ; immediate +: = - not ; +: \ begin in< $0a = until ; immediate +uartinit \ see the (wnf) if comment is mishandled +\ hello, this is a comment! +\ This type of comment won't work in UART because we don't get a LF, only a CR +: exit exit, ; immediate +: ( begin + word dup c@ 1 = if + 1+ c@ ')' = if exit then else drop then + again ; immediate +\ TODO: this comment type doesn't work, debug +prompt interactive!