Print cycles count
This commit is contained in:
parent
11249a9e52
commit
40adea4936
|
@ -7,7 +7,6 @@
|
|||
|
||||
@src $40
|
||||
@uxn &pc $2 &src $2 &dst $2 &err $1 &2 $1
|
||||
@emu &sleep $1
|
||||
|
||||
|0100
|
||||
|
||||
|
@ -39,29 +38,26 @@
|
|||
;dict/bytes-free !<print-str>
|
||||
|
||||
@run ( -- )
|
||||
[ LIT2 00 -emu/sleep ] STZ
|
||||
#0000
|
||||
&w ( -- )
|
||||
<step>
|
||||
.uxn/err LDZ ?&err
|
||||
#00 EQU ?&end
|
||||
INC2 ORAk ?&w
|
||||
<step>
|
||||
.uxn/err LDZ ?&err
|
||||
?run
|
||||
&end ( -- )
|
||||
POP2 JMP2r
|
||||
;<step>/count LDA2 <print-dec>
|
||||
;dict/cycles <print-str>
|
||||
JMP2r
|
||||
&err ( opcode -- )
|
||||
POP !<reset>
|
||||
|
||||
@halt ( opcode -- opcode )
|
||||
#01 .emu/sleep STZ
|
||||
JMP2r
|
||||
|
||||
@send ( v* p* -- )
|
||||
NIP
|
||||
( | handlers )
|
||||
DUP #0e NEQ ?&>no-debug
|
||||
&>no-debug
|
||||
( TODO ) &>no-debug
|
||||
DUP #0f NEQ ?&>no-halt
|
||||
&>no-halt
|
||||
( TODO ) &>no-halt
|
||||
DUP #18 NEQ ?&>no-out
|
||||
POP NIP #18 DEO
|
||||
JMP2r &>no-out
|
||||
|
@ -70,7 +66,7 @@
|
|||
JMP2r &>no-err
|
||||
( | error )
|
||||
;dict/err-device <print-str>
|
||||
<phex>/b
|
||||
<print-hex>/b
|
||||
#0a18 DEO
|
||||
POP2 JMP2r
|
||||
|
||||
|
@ -93,10 +89,10 @@
|
|||
scap/ ROT #00 SWP2 STA2
|
||||
JMP2r
|
||||
|
||||
@<phex> ( short* -- )
|
||||
SWP <phex>/b
|
||||
@<print-hex> ( short* -- )
|
||||
SWP <print-hex>/b
|
||||
&b ( -- )
|
||||
DUP #04 SFT <phex>/c
|
||||
DUP #04 SFT <print-hex>/c
|
||||
&c ( -- )
|
||||
#0f AND DUP #09 GTH #27 MUL ADD LIT "0 ADD #18 DEO
|
||||
JMP2r
|
||||
|
@ -122,6 +118,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
|
||||
&cycles 20 "cycles. 0a $1
|
||||
|
||||
~vm.tal
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
( emulator )
|
||||
|
||||
@<reset> ( -- )
|
||||
#00 .uxn/err STZ
|
||||
[ LIT2 00 -uxn/err ] STZ
|
||||
#0100 .uxn/pc STZ2
|
||||
#0000 ;wst/ptr STA2
|
||||
#0000 ;rst/ptr STA2
|
||||
#0000 ;<step>/cycles STA2
|
||||
#0000 ;<step>/count STA2
|
||||
JMP2r
|
||||
|
||||
@<step> ( -- ok )
|
||||
|
@ -18,7 +18,7 @@
|
|||
( keep mode ) DUP #80 AND #00 NEQ ;pop/keep STA
|
||||
( copy pop pointer ) .uxn/src LDZ2 #00fe ADD2 LDAk DUP SWP2 STA2
|
||||
( get routine ) #00 OVR #1f AND DUP2 ADD2 ;optbl ADD2 LDA2 JSR2
|
||||
( incr time ) [ LIT2 &cycles $2 ] INC2 ,&cycles STR2
|
||||
( incr time ) [ LIT2 &count $2 ] INC2 ,&count STR2
|
||||
( check err ) .uxn/err LDZ ?halt
|
||||
JMP2r
|
||||
|
||||
|
|
Loading…
Reference in New Issue