Remove "debug" opcode from all test roms.
AntonioND opened this issue · 2 comments
Please, remove it. The real behaviour of that pseudo-opcode (which, acording to wla-dx, is 0xED) is to hang the CPU forever. Most emulators show error messages when they try to execute that instruction. You should use "ld b,b", which is kind of a standard (no$gmb, bgb) and it doesn't hang emulators or real hardware. In fact, the only reason the test roms can work in real hardware is that just after that instruction there's an infinite loop, so the CPU would be trapped there anyway.
That's a good point, although the hang is perfectly intentional. The tests are supposed to hang after finishing, and I need a way to notify the acceptance test harness of the results. I've used the wla-dx -specific opcode, because I don't ever want to have any confusion between real instructions and normal instructions (like ld b, b). The infinite loop is for emulators which simply ignore undefined opcodes. So, having the undefined opcode and the infinite loop guarantees that the execution will not continue indefinitely.
However, the debug opcode is only useful in the acceptance test runs, so I'll move it behind a compilation flag so the test roms will by default be runnable on any emulator or real hardware without an automatic break on undefined opcode (like BGB does...).
In fact, the only reason I've said that is that the error messages are very annoying and sometimes they don't let you watch the output of the test rom. I supposed it was used for the auto tests, but any other useless opcode would work the same, and adding a comment next to the instruction will clarify its use.
Anyway, a compilation flag to disable it should be good enough, so it's ok.