Prev: 8ACC Up: Map Next: 8AE4
8AD3: Move an attribute address up a row
Subtracts 32 from HL, unless that would move it above the attribute file ($5800), in which case HL is unchanged. Used when painting colours (8985).
8AD3 PUSH AF Save AF and DE
8AD4 PUSH DE
8AD5 LD DE,$0020 DE = 32, the width of one attribute row
8AD8 AND A
8AD9 SBC HL,DE Move HL up a row
8ADB LD A,H Did that go above the top of the attribute file?
8ADC CP $57
8ADE JR NZ,$8AE1
8AE0 ADD HL,DE If so, undo the move: stay on the top row
8AE1 POP DE Restore DE and AF
8AE2 POP AF
8AE3 RET
Prev: 8ACC Up: Map Next: 8AE4