Handle brk in op-imm

This commit is contained in:
Devine Lu Linvega 2023-07-13 12:03:28 -07:00
parent dc57fad045
commit 9ee28d3cd2
1 changed files with 9 additions and 6 deletions

View File

@ -9,9 +9,8 @@
JMP2r JMP2r
@<step> ( -- ok ) @<step> ( -- ok )
( get opcode ) .uxn/pc LDZ2 ;rom ADD2 LDA ( incr pointer ) .uxn/pc LDZ2 INC2k .uxn/pc STZ2
( exit on BRK ) DUP #00 EQU ?halt ( get opcode ) ;rom ADD2 LDA
( move PC ) .uxn/pc LDZ2k INC2 ROT STZ2
( short mode ) DUP #20 AND #00 NEQ .uxn/2 STZ ( short mode ) DUP #20 AND #00 NEQ .uxn/2 STZ
( return mode ) DUP #40 AND #00 NEQ STH ;rst ;wst STHr [ JMP SWP2 ] .uxn/dst STZ2 ( return mode ) DUP #40 AND #00 NEQ STH ;rst ;wst STHr [ JMP SWP2 ] .uxn/dst STZ2
.uxn/src STZ2 .uxn/src STZ2
@ -83,11 +82,13 @@
( (
@|library ) @|library )
@op-lit @op-imm
DUP #00 EQU ?&op-brk
DUP #20 EQU ?&op-jci DUP #20 EQU ?&op-jci
DUP #40 EQU ?&op-jmi DUP #40 EQU ?&op-jmi
DUP #60 EQU ?&op-jsi DUP #60 EQU ?&op-jsi
.uxn/pc LDZ2 DUP2 peek push #0001 .uxn/2 LDZ ADD ADD2 !warp/16 &op-lit ( -- )
.uxn/pc LDZ2 peek push #0001 .uxn/2 LDZ ADD !warp/8
&op-jci ( -- ) &op-jci ( -- )
;wst .uxn/src STZ2 ;wst .uxn/src STZ2
pop/8 NIP ?&op-jmi pop/8 NIP ?&op-jmi
@ -99,6 +100,8 @@
( fall ) ( fall )
&op-jmi ( -- ) &op-jmi ( -- )
.uxn/pc LDZ2 DUP2 peek/16 ADD2 INC2 INC2 !warp/16 .uxn/pc LDZ2 DUP2 peek/16 ADD2 INC2 INC2 !warp/16
&op-brk ( -- )
JMP2r
@lib ( non immediate opcodes ) @lib ( non immediate opcodes )
&inc pop INC2 !push &inc pop INC2 !push
@ -138,7 +141,7 @@
@optbl @optbl
[ [
=op-lit =lib/inc =lib/pop =lib/nip =op-imm =lib/inc =lib/pop =lib/nip
=lib/swp =lib/rot =lib/dup =lib/ovr =lib/swp =lib/rot =lib/dup =lib/ovr
=lib/equ =lib/neq =lib/gth =lib/lth =lib/equ =lib/neq =lib/gth =lib/lth
=lib/jmp =lib/jcn =lib/jsr =lib/sth =lib/jmp =lib/jcn =lib/jsr =lib/sth