Better device handlers
This commit is contained in:
parent
e65a4ecf69
commit
dc57fad045
|
@ -41,34 +41,32 @@
|
|||
<step>
|
||||
.uxn/err LDZ ?&err
|
||||
?run
|
||||
&end ( -- )
|
||||
;<step>/count LDA2 <print-dec>
|
||||
;dict/cycles <print-str>
|
||||
JMP2r
|
||||
;<step>/count LDA2 <print-dec>
|
||||
;dict/cycles <print-str>
|
||||
JMP2r
|
||||
&err ( opcode -- )
|
||||
POP !<reset>
|
||||
|
||||
@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 )
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue