duskos

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

commit 1a78aa47ba30324deb05001cb787ca455101f04d
parent 4eaa915505b169cfedaee7e92716ba4240e97ee5
Author: Virgil Dupras <hsoft@hardcoded.net>
Date:   Fri, 18 Nov 2022 09:26:22 -0500

cc/vm/forth: consolidate

Diffstat:
Mfs/cc/vm/forth.fs | 24+++++++++---------------
1 file changed, 9 insertions(+), 15 deletions(-)

diff --git a/fs/cc/vm/forth.fs b/fs/cc/vm/forth.fs @@ -144,10 +144,10 @@ UNOPMUTCNT >> wordtbl _tbl8 vmop :&loc vmop :compile vmop :*arisz rot 1 and if ( -- ) neg then litn ( w ) execute, ; -ARIOPCNT wordtbl _tbl +ARIOPCNT 1+ ( for = ) wordtbl _tbl 'w + 'w - 'w * 'w / 'w mod 'w and 'w or 'w xor -'w lshift 'w rshift +'w lshift 'w rshift 'w nip : _binop, ( opid tbl -- ) vmop :compile \ op1 is TOS @@ -167,22 +167,16 @@ ARIOPCNT wordtbl _tbl @+ litn compile swap over sz! compile !+ next compile drop PS- ( sz a ) 2drop vmop^ :init ; -: _=, - vmop^ :hasop# vmop^ loc VM_CONSTARRAY = if _movarray, else - vmop^ :compile \ op2 is TOS - vmop :TOS? if compile over PS+ then - vmop :keep vmop :&loc vmop :compile vmop :forgetTOS vmop :popNoChk - vmop :typesz! vmop^ :forgetTOS compile ! PS- PS- then ; - \ an assignop, is like a unop in the sense that it operates directly on op1, but \ with the participation of op2. : assignop, ( opid -- ) - dup 10 = if drop _=, exit then \ "=" is special - vmop^ :?>reg - vmop type typesize vmop :compile& vmop :&loc ( opid sz ) \ op1 is TOS - compile dup PS+ dup sz! compile @ vmop^ :compile ( opid sz ) \ op2 is TOS - swap _tbl swap wexec, PS- vmop^ :forgetTOS ( sz ) \ result on TOS - compile swap sz! compile ! vmop :forgetTOS PS- PS- ; + vmop^ loc VM_CONSTARRAY = if drop _movarray, exit then + vmop^ :?>reg vmop type typesize ( opid sz ) + vmop :TOS? if compile dup PS+ then + vmop :keep vmop :&loc vmop :compile vmop :forgetTOS vmop :popNoChk + compile dup PS+ dup sz! compile @ vmop^ :compile vmop^ :forgetTOS ( opid sz ) + swap _tbl swap wexec, PS- ( sz ) \ result on TOS + compile swap sz! compile ! PS- PS- ; : _s $80000000 + swap $80000000 + swap ; : _&& bool swap bool and ;