Better device handlers

This commit is contained in:
Devine Lu Linvega 2023-07-13 11:40:44 -07:00
parent e65a4ecf69
commit dc57fad045
2 changed files with 11 additions and 17 deletions

View File

@ -41,34 +41,32 @@
<step> <step>
.uxn/err LDZ ?&err .uxn/err LDZ ?&err
?run ?run
&end ( -- ) ;<step>/count LDA2 <print-dec>
;<step>/count LDA2 <print-dec> ;dict/cycles <print-str>
;dict/cycles <print-str> JMP2r
JMP2r
&err ( opcode -- ) &err ( opcode -- )
POP !<reset> POP !<reset>
@halt ( opcode -- opcode ) @halt ( opcode -- opcode )
JMP2r JMP2r
@send ( v* p* -- ) @emu-deo ( v p -- )
NIP
( | handlers ) ( | handlers )
DUP #0e NEQ ?&>no-debug DUP #0e NEQ ?&>no-debug
( TODO ) &>no-debug POP2 JMP2r &>no-debug
DUP #0f NEQ ?&>no-halt DUP #0f NEQ ?&>no-halt
( TODO ) &>no-halt POP2 JMP2r &>no-halt
DUP #18 NEQ ?&>no-out DUP #18 NEQ ?&>no-out
POP NIP #18 DEO DEO
JMP2r &>no-out JMP2r &>no-out
DUP #19 NEQ ?&>no-err DUP #19 NEQ ?&>no-err
POP NIP #19 DEO DEO
JMP2r &>no-err JMP2r &>no-err
( | error ) ( | error )
;dict/err-device <print-str> ;dict/err-device <print-str>
<print-hex>/b <print-hex>/b
#0a18 DEO #0a18 DEO
POP2 JMP2r POP JMP2r
( (
@|stdlib ) @|stdlib )

View File

@ -71,13 +71,9 @@
DUP #7f GTH #ff MUL SWP .uxn/pc LDZ2 ADD2 JMP2r DUP #7f GTH #ff MUL SWP .uxn/pc LDZ2 ADD2 JMP2r
@devw ( v* p* -- ) @devw ( v* p* -- )
DUP #10 AND ?&console
.uxn/2 LDZ ?&16 .uxn/2 LDZ ?&16
&8 NIP DEO &8 NIP ROT POP !emu-deo
POP JMP2r &16 NIP STHk emu-deo STHr INC !emu-deo
&16 NIP DEO2
JMP2r
&console !send
@devr ( p* -- ) @devr ( p* -- )
.uxn/2 LDZ ?devr/16 .uxn/2 LDZ ?devr/16