I debugged this issue by investigating a problem with Trashman. Here are my notes:
Breaking on 0xB097 on the ‘enter your name screen’. Repeatedly breaking at this point, the value of DE starts to drift. Some instruction is setting this incorrectly.
I think this might be a debugger issue.
I can see if I break beyond this subroutine to 0xA84A that both emulators agree with the DE field.
Seems to be the NEG instruction.
On Fuse the value in A goes from 0x28 to 0xD8
On JRNZ it stays the same for some reason.
0x28 == 00101000
0xD8 == 11011000
So my 2’s complement is failing!
I see the problem. I’ve tried to replicate the NEG instruction by subtracting A from 0. However, I’ve got it the wrong way around.
So it has the operands the wrong way around I believe. I tried to be clever by using a SUB instruction. It might be simpler to just write a neg instruction to make it slightly clearer.
Fixed. There is an issue with half carry which I'll raise as a separate bug. I suspect none of my instructions are handling this properly at the moment.
I debugged this issue by investigating a problem with Trashman. Here are my notes:
So it has the operands the wrong way around I believe. I tried to be clever by using a SUB instruction. It might be simpler to just write a neg instruction to make it slightly clearer.