duskos

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

commit 560e913605e94480ef708c21911497ba745734de
parent af1e9820a0c0c744eeeceefca118701808dd3167
Author: Virgil Dupras <hsoft@hardcoded.net>
Date:   Thu,  9 Mar 2023 14:57:35 -0500

HAL: make "to" operations width-aware

Diffstat:
Mfs/xcomp/bootlo.fs | 16+++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/fs/xcomp/bootlo.fs b/fs/xcomp/bootlo.fs @@ -116,7 +116,7 @@ code (cell) r> exit, \ execword param: addr \ compileword param: HAL operand create toptr 0 , \ pointer to 8b struct [execword, compileword] -: _@, ( operand -- ) dup, @, ; +: _@, ( operand -- ) dup, @, ; :16b dup, 16b @, ; :8b dup, 8b @, ; create toptrdef ' @ , ' _@, , : toptr@ ( -- w ) toptr @ 0 toptr ! ?dup not if toptrdef then @@ -132,15 +132,21 @@ code (does) r> W>A, W) @, W<>A, CELLSZ W+n, branchA, : does' ( w -- 'data ) CALLSZ + CELLSZ + ; : _to doer ' , ' , immediate does> toptr ! ; -: _!, !, drop, ; _to to ! _!, -: _+!, dup +, _!, ; _to to+ +! _+!, -: _lea, dup, lea, ; _to to' noop _lea, +: _!, !, drop, ; :16b 16b !, drop, ; :8b 8b !, drop, ; +_to to ! _!, +: _+!, dup +, _!, ; :16b dup 16b +, 16b _!, ; :8b dup 8b +, 8b _!, ; +_to to+ +! _+!, +: _lea, dup, lea, ; :16b dup, lea, ; :8b dup, lea, ; +_to to' noop _lea, : _toexec ( a -- ) compiling if i) then toptr@ execute ; : value doer , immediate does> _toexec ; : here HERE _toexec ; immediate -here dbg bye : alias ' code branch, drop ; +42 value foo +: bar $1234 8b to+ foo ; bar +foo dbg foo dbg bye + alias @ llnext : llend ( ll -- lastll ) begin dup llnext ?dup while nip repeat ( ll ) ; : llappend ( elem ll -- ) llend ! ;