From 11249a9e52172cc9f8f14a24aeeec0c01b3b67f4 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Thu, 13 Jul 2023 10:57:48 -0700 Subject: [PATCH] Added device support error --- cli/uxnvm/uxnvm.tal | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/cli/uxnvm/uxnvm.tal b/cli/uxnvm/uxnvm.tal index 68d7967..a329936 100644 --- a/cli/uxnvm/uxnvm.tal +++ b/cli/uxnvm/uxnvm.tal @@ -13,7 +13,7 @@ @on-reset ( -> ) .Console/type DEI ?&>has-arg - ;dict/usage &err + ;dict/usage #010f DEO BRK &>has-arg ;on-waitsrc .Console/vector DEO2 @@ -42,16 +42,14 @@ [ LIT2 00 -emu/sleep ] STZ #0000 &w ( -- ) - POP + .uxn/err LDZ ?&err - .emu/sleep LDZ ?&end + #00 EQU ?&end INC2 ORAk ?&w - &end POP2 - ( TODO: Catch too long ) JMP2r - &err ( -- ) - POP2 #00 ;wst/ptr STA - #00 ;rst/ptr STA - JMP2r + &end ( -- ) + POP2 JMP2r + &err ( opcode -- ) + POP ! @halt ( opcode -- opcode ) #01 .emu/sleep STZ @@ -65,18 +63,16 @@ DUP #0f NEQ ?&>no-halt &>no-halt DUP #18 NEQ ?&>no-out - POP #18 DEO - POP JMP2r &>no-out + POP NIP #18 DEO + JMP2r &>no-out DUP #19 NEQ ?&>no-err - POP #19 DEO - POP JMP2r &>no-err + POP NIP #19 DEO + JMP2r &>no-err ( | error ) - LIT "! #18 DEO + ;dict/err-device /b - #2018 DEO - #0a18 DEO - JMP2r + POP2 JMP2r ( @|stdlib ) @@ -125,6 +121,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 ~vm.tal