added emudbg.cpu_cycles() and emudbg.reset_cpu_cycles()

This commit is contained in:
Irmen de Jong 2024-09-13 21:23:35 +02:00
parent cf551d2cc7
commit 0cb378ca31

View File

@ -62,4 +62,25 @@ emudbg {
if is_emulator()
EMU_DBGOUT2 = value
}
sub reset_cpu_cycles() {
if is_emulator()
EMU_CPUCLK_L = 0
}
asmsub cpu_cycles() -> uword @R0, uword @R1 {
; -- returns the 32 bits cpu clock counter in R1:R0,
; returns lower 16 bits in R0, upper 16 bits in R1.
%asm {{
lda p8v_EMU_CPUCLK_L
sta cx16.r0L
lda p8v_EMU_CPUCLK_M
sta cx16.r0H
lda p8v_EMU_CPUCLK_H
sta cx16.r1L
lda p8v_EMU_CPUCLK_U
sta cx16.r1H
rts
}}
}
}