![]() |
DevelopmentSega Master System / Mark III / Game Gear |
Home - Forums - Games - Scans - Maps - Cheats |
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:
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.