I just wrote a chip8 emulator in JavaScript. Now I would like to write some kind of disassembler and debugger. The debugger should be able to run loaded program step by step and in any moment should show state of memeory and registers.
I've stumbled upon one problem which I'm not sure how to solve. My emulator performs cycles at 60Hz and in each cycles it executes 10 instructions. It's easy to execute instructions step by step but I don't know how to handle delay and sound timers which, as we all know, count down at 60Hz. Should they be updated at 60Hz interval regardless of whether emulator runs step by step or at normal speed? Or maybe when emulator runs step by step, timers should be updated after certain number of steps?
I've stumbled upon one problem which I'm not sure how to solve. My emulator performs cycles at 60Hz and in each cycles it executes 10 instructions. It's easy to execute instructions step by step but I don't know how to handle delay and sound timers which, as we all know, count down at 60Hz. Should they be updated at 60Hz interval regardless of whether emulator runs step by step or at normal speed? Or maybe when emulator runs step by step, timers should be updated after certain number of steps?