Prev: 7CD4 Up: Map Next: 7CFC
7CE9: Next scanline down
This returns the same position on the next scanline down.
Given a screen address, this returns the same horizontal position but on the next scanline down.
Input
HL Original screen address.
Output
HL Updated screen address.
next_scanline_down 7CE9 INC H Incrementing H moves us to the next minor row
7CEA LD A,H
7CEB AND $07 Unless we hit an exact multiple of eight - in which case we stepped to the next third of the screen
7CED RET NZ Just return if we didn't
7CEE PUSH DE Borrow DE for scratch
7CEF LD DE,$F820 Step back by a third ($F8), then to the next major row ($20)
7CF2 LD A,L Unless we will hit a boundary in doing that
7CF3 CP $E0
7CF5 JR C,next_scanline_down_0 Skip, if we won't
7CF7 LD D,$FF If we will then step back by a minor row, then to the next major row
next_scanline_down_0 7CF9 ADD HL,DE Step
7CFA POP DE Restore
7CFB RET Return
Prev: 7CD4 Up: Map Next: 7CFC