Prev: 757A Up: Map Next: 759A
7585: Calculate screen address one pixel above current position
Used by the routine at MaskSprite.
Input
HL Current position
Output
HL Address for new position
Calculates the new address for writing a sprite pixel, in an upward direction, taking into consideration the screen memory layout.
ScreenPos1PixelAbove 7585 DEC H Decrement H to move up one pixel on screen.
7586 LD A,H Store the result in A.
7587 AND %00000111 Keep only bits 0-2.
7589 CP $07 If a character line has not been crossed then return.
758B RET NZ
758C LD A,L Else subtract 20 from L.
758D SUB $20
758F LD L,A
7590 AND %11100000 Keep only bits 5-7.
7592 CP $E0 If a new section of the screen has not been crossed then return.
7594 RET Z
7595 LD A,H Else add 08 to H and return.
7596 ADD A,$08
7598 LD H,A
7599 RET
Prev: 757A Up: Map Next: 759A