Incorrect palette on Game Over screen

It relies on OUTI opcode to set some unexpected flags which are left over from the Z80 bus. Sean Young's "The Undocumented Z80 documented" explains how the flags are set in chapter 4.3:

First for the OUTI/OTIR/OUTD/OTDR instructions. At every iteration, a byte is read from memory and sent to an I/O port. Take that value (call it n), and add register L to it, after the HL register is increased (OUTI and OTIR) or decreased (OUTD and OTDR). If that calculation makes a carry (ie. it's larger than 255), both CF and HF are set. Otherwise CF and HF are reset.

Return to top