jhallen / cpm

Run CP/M commands in Linux/Cygwin with this Z80 / BDOS / ADM-3A emulator.
Other
108 stars 26 forks source link

Fix bugs in carry, half carry and overflow flags handling #3

Closed ghost closed 6 years ago

ghost commented 6 years ago

This is a follow up for PR #2 where I fix a bug in overflow flag handling. This time, I've fixed bugs in the handling of the half carry flag, and even the carry flag for one instruction.

Here is a summary of the new fixes:

The emulator now pass all the ZEXDOC tests (the version in z80pack, without the undocumented instructions) with the exception of DAA, but, I think that is because the undocumented behaviours are not emulated.

jhallen commented 6 years ago

Nice! I'm taking your fixes. I had not tried any Z80 conformance tests. I wonder if it's worth emulating undocumented instructions? My impression is that they are not as widely used as say the 6502 ones were.

ghost commented 6 years ago

Ah, the undocumented instructions. We hear a lot about them but we do not see them often.

It could be worth to optimise the emulator. The test suite runs in ~3 minutes with cpm but only 1 with z80pack. I also feel the difference when assembling a 1500 lines program with M80, which take 2.5s against <1s.