kosarev / z80

Fast and flexible Z80/i8080 emulator with C++ and Python APIs
MIT License
63 stars 10 forks source link

Should on_handle_active_int check is_hl_iregp()? #20

Closed simonowen closed 3 years ago

simonowen commented 3 years ago

In my emulator I'm finding I need to check that an index prefix is not active before calling on_handle_active_int, otherwise interrupts can be accepted mid-instruction. The function itself performs other checks before accepting, so should it also include a && is_hl_iregp() in the condition?

simonowen commented 3 years ago

Sorry, my mistake -- I hadn't seen disable_int_on_index_prefix!

kosarev commented 3 years ago

Yeah, so on_handle_active_int() is supposed to be called for as long as the ~INT line is actually active, which being an input line does not depend on the internal state of the CPU. And it is indeed perfectly possible with real Z80 that an interrupt is not even initiated despite the active level on that line.