kosarev / z80

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

Request CMOS chip behaviour #27

Open simonowen opened 3 years ago

simonowen commented 3 years ago

The undocumented out (c),0 instruction is the original NMOS Z80 behaviour. On newer CMOS Z80 chips it writes 0xff instead. I have an emulator option to control the behaviour, so I can see the effects on software that uses that instruction. I've only just realised that since switching CPU core the option no longer has any effect.

In my local copy I've implemented a handler called on_is_cmos_z80, which returns true if it's CMOS, false if it's NMOS (the default). The core uses the return value to pick either 0xff or 0 for the instruction implementation and the disassembler output.

If you think that's how you'd implement it I can put up a small pull request with the changes. If you think there's a better way to do it could I please request it be supported in a future release?

kosarev commented 3 years ago

This a bit overlaps with #15, it probably should be implemented via introducing of CPU variants. I'm going play with the code a little to figure out a natural way to do this...