duskos

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

commit adf4d049fd0dd475605209af1c2ea7d029311146
parent 7eb4d73505ffef517297e1522eca15bb4cdfd121
Author: Virgil Dupras <hsoft@hardcoded.net>
Date:   Thu,  9 Mar 2023 10:26:45 -0500

HAL: make local variables work

(only with default "to" ptr...)

Diffstat:
Mfs/xcomp/bootlo.fs | 10+++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/fs/xcomp/bootlo.fs b/fs/xcomp/bootlo.fs @@ -104,16 +104,20 @@ code (cell) r> exit, : const code litn exit, ; 4 const CELLSZ +\ execword param: addr +\ compileword param: HAL operand create toptr 0 , \ pointer to 8b struct [execword, compileword] -create toptrdef ' @ , ' @, , +: _@, ( operand -- ) dup, @, ; +create toptrdef ' @ , ' _@, , : toptr@ ( -- w ) toptr @ 0 toptr ! ?dup not if toptrdef then compiling if CELLSZ + then @ findmod ; -: var, ( off -- ) RSP) [rcnt] @ neg CELLSZ - -^ +) toptr@ execute ; +: var, ( off -- ) RSP) swap [rcnt] @ neg -^ +) toptr@ execute ; : V1 0 var, ; immediate : V2 4 var, ; immediate : V3 8 var, ; immediate : V4 12 var, ; immediate dbg -: foo 'A' CELLSZ + (emit) ; foo bye +: foo 42 >r dbg V1 dbg drop r> dbg drop ; +'X' (emit) foo dbg bye \ Compiling words create _ 0 , : doer code compile (does) HERE @ _ ! CELLSZ allot ;