suzukiplan / z80

Single header Z80 emulator for C++ (C++11 or later)
MIT License
55 stars 9 forks source link

Callback on each instruction #40

Closed JulienNevo closed 2 years ago

JulienNevo commented 2 years ago

One feature I'd like would be a callback called every time an instruction is read, with a least the opcode. If the values could be shown too (if relevant), the better.

My use-case is as follows:

One problem I see in the current implementation is that, for IX/IY instructions, only the prefix (0xdd, 0xed, 0xfd...) is transmitted (in the BreakOperand callback for example), the rest of the opcode is "lost", so this would have to be corrected first.

suzukiplan commented 2 years ago

Thank you for your report.

I'm aware of the need for addBreakOperand support for multibyte instructions. I took action on commit https://github.com/suzukiplan/z80/pull/39/commits/c833329e24cb5f2ce2069c802a4c0e8890b906c2.

I will also consider the opcode callback. I already have an idea, but it will take a bit of time and will be addressed in another commit.