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

View File

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