diff --git a/cli/uxnvm/uxnvm.tal b/cli/uxnvm/uxnvm.tal index a329936..1ecdaf3 100644 --- a/cli/uxnvm/uxnvm.tal +++ b/cli/uxnvm/uxnvm.tal @@ -7,7 +7,6 @@ @src $40 @uxn &pc $2 &src $2 &dst $2 &err $1 &2 $1 - @emu &sleep $1 |0100 @@ -39,29 +38,26 @@ ;dict/bytes-free ! @run ( -- ) - [ LIT2 00 -emu/sleep ] STZ - #0000 - &w ( -- ) - - .uxn/err LDZ ?&err - #00 EQU ?&end - INC2 ORAk ?&w + + .uxn/err LDZ ?&err + ?run &end ( -- ) - POP2 JMP2r + ;/count LDA2 + ;dict/cycles + JMP2r &err ( opcode -- ) POP ! @halt ( opcode -- opcode ) - #01 .emu/sleep STZ JMP2r @send ( v* p* -- ) NIP ( | handlers ) DUP #0e NEQ ?&>no-debug - &>no-debug + ( TODO ) &>no-debug DUP #0f NEQ ?&>no-halt - &>no-halt + ( TODO ) &>no-halt DUP #18 NEQ ?&>no-out POP NIP #18 DEO JMP2r &>no-out @@ -70,7 +66,7 @@ JMP2r &>no-err ( | error ) ;dict/err-device - /b + /b #0a18 DEO POP2 JMP2r @@ -93,10 +89,10 @@ scap/ ROT #00 SWP2 STA2 JMP2r -@ ( short* -- ) - SWP /b +@ ( short* -- ) + SWP /b &b ( -- ) - DUP #04 SFT /c + DUP #04 SFT /c &c ( -- ) #0f AND DUP #09 GTH #27 MUL ADD LIT "0 ADD #18 DEO JMP2r @@ -122,6 +118,7 @@ @dict &usage "usage: 20 "uxnvm.rom 20 "game.rom 0a $1 &bytes-free 20 "bytes 20 "free. 0a $1 &err-device "Unsupported 20 "device: 20 $1 + &cycles 20 "cycles. 0a $1 ~vm.tal diff --git a/cli/uxnvm/vm.tal b/cli/uxnvm/vm.tal index 5f70796..22f4271 100644 --- a/cli/uxnvm/vm.tal +++ b/cli/uxnvm/vm.tal @@ -1,11 +1,11 @@ ( emulator ) @ ( -- ) - #00 .uxn/err STZ + [ LIT2 00 -uxn/err ] STZ #0100 .uxn/pc STZ2 #0000 ;wst/ptr STA2 #0000 ;rst/ptr STA2 - #0000 ;/cycles STA2 + #0000 ;/count STA2 JMP2r @ ( -- ok ) @@ -18,7 +18,7 @@ ( keep mode ) DUP #80 AND #00 NEQ ;pop/keep STA ( copy pop pointer ) .uxn/src LDZ2 #00fe ADD2 LDAk DUP SWP2 STA2 ( get routine ) #00 OVR #1f AND DUP2 ADD2 ;optbl ADD2 LDA2 JSR2 - ( incr time ) [ LIT2 &cycles $2 ] INC2 ,&cycles STR2 + ( incr time ) [ LIT2 &count $2 ] INC2 ,&count STR2 ( check err ) .uxn/err LDZ ?halt JMP2r