z80 icon indicating copy to clipboard operation
z80 copied to clipboard

Does a method exist to query if interrupts are disabled (python)

Open mortenjc opened this issue 1 year ago • 2 comments

Hey

Thanks for the project!

As you know by now, I use the python bindings.

I've come to the point where I need to emulate keyboard interrupts to progress further. So far I do it in a crude way: periodically i do a 'kbhit()' call. If a key was pressed I store the key value in a variable, save the current PC on the stack and set the PC to 0x38.

This barely works: I have been somewhat successful in getting resposes from the OS but it is vary flaky. I suspect that I might trigger 'interrupts' while already in a interrupt or when interrupts are disabled.

Do you have a suggestion for how to query for the ei/di status? Or any other good ideas for how to do this?

Best Morten

mortenjc avatar Jul 18 '24 06:07 mortenjc

9577ae87d042b1262c15b22a530170ee790e0389 added Z80State.int_disabled and Z80State.halted properties. I guess to do it properly you would also need to use on_handle_active_int() which takes a flag that is raised if interrupt is initiated?

kosarev avatar Jul 18 '24 17:07 kosarev

Thanks. For now I am happy. I am sure I will get into new problems along the road. But first - holiday!

mortenjc avatar Jul 19 '24 18:07 mortenjc

Sounds like this one is done.

kosarev avatar Aug 17 '24 13:08 kosarev