duskos

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

commit 257710b3454eb0144428843f40b0b8f9996fa44f
parent db0722451449a030945ad1fe447c0a80d9f875f9
Author: Virgil Dupras <hsoft@hardcoded.net>
Date:   Thu, 16 Mar 2023 22:02:25 -0400

hal i386: comments are working

EAX=36 at bye

Diffstat:
Mfs/xcomp/bootlo2.fs | 16++++++++++++++--
Mfs/xcomp/i386/kernel.fs | 11+++++++----
2 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/fs/xcomp/bootlo2.fs b/fs/xcomp/bootlo2.fs @@ -77,9 +77,21 @@ code bool W=0>Z, Z>W, 1 xorn, exit, code ?dup W=0>Z, 0 Z) branchC, dup, then exit, : ' word sysdict @ find dup not if (wnf) then ; : ['] ' litn ; immediate -: foo if 54 + then bye ; -$12345678 , 42 0 foo : 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 +\ hello, this is a comment! +: exit exit, ; immediate +: ( begin + word dup c@ 1 = if + 1+ c@ ')' = if exit then else drop then + again ; immediate +( hello, another comment! ) +: foo if 42 else 54 then bye ; 1 not foo diff --git a/fs/xcomp/i386/kernel.fs b/fs/xcomp/i386/kernel.fs @@ -315,10 +315,13 @@ xcode orn, ( n -- ) \ ax XX i) or, xcode xorn, ( n -- ) \ ax XX i) xor, $35 i) cwrite, ax dwrite, xdrop, ret, -xcode Z=0>Z, $c085 i) wwrite, ret, \ ax ax test, +xcode W=0>Z, $c085 i) wwrite, ret, \ ax ax test, xcode A=0>Z, $ff85 i) wwrite, ret, \ di di test, +pc 8 nc, $b8 0 0 0 0 $0f $94 $c0 \ ax 0 i) mov, al setz, +xcode Z>W, + ( pc ) 8 movewrite, ret, -xcode branch, +xcode branch, ( a -- a ) $e9 ( jmp ) i) cwrite, pc to L1 bx ax mov, @@ -334,8 +337,8 @@ xcode branchC, ( a cond -- a ) xcode branchA, $e7ff i) wwrite, ret, \ di jmp, -xcode branch! - bx si 0 d) mov, xnip, \ ax=a bx=n +xcode branch! ( tgt a -- ) + bx si 0 d) mov, xnip, \ ax=a bx=tgt bx ax sub, \ displacement bx 4 i) sub, \ ... from *after* call/jmp op ax 0 d) bx mov,