Prev: 30074 Up: Map Next: 30106
30085: 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 30085 DEC H Decrement H to move up one pixel on screen.
30086 LD A,H Store the result in A.
30087 AND %00000111 Keep only bits 0-2.
30089 CP 7 If a character line has not been crossed then return.
30091 RET NZ
30092 LD A,L Else subtract 32 from L.
30093 SUB 32
30095 LD L,A
30096 AND %11100000 Keep only bits 5-7.
30098 CP 224 If a new section of the screen has not been crossed then return.
30100 RET Z
30101 LD A,H Else add 8 to H and return.
30102 ADD A,8
30104 LD H,A
30105 RET
Prev: 30074 Up: Map Next: 30106