Prev: 6EC2 Up: Map Next: 6EDE
6ECB: Screen Address One Pixel Above
Used by the routines at PlotPixels, DrawPlayer, MaskSprite and DrawTwoBytes.
Calculates the new address for writing a sprite pixel, in an upward direction, taking into consideration the screen memory layout.
Input
HL Current position
Output
HL Address for new position
ScreenPosition1PixelAbove 6ECB DEC H Decrement H to move up one pixel on screen.
6ECC LD A,H Store the inverted result in A.
6ECD CPL
6ECE AND %00000111 Keep only bits 0-2.
6ED0 RET NZ If a character line has not been crossed then return.
6ED1 LD A,L Else subtract 20 from L.
6ED2 SUB $20
6ED4 LD L,A
6ED5 CPL Invert the bits in A.
6ED6 AND %11100000 Keep only bits 5-7.
6ED8 RET Z If a new section of the screen has not been crossed then return.
6ED9 LD A,H Else add 08 to H and return.
6EDA ADD A,$08
6EDC LD H,A
6EDD RET
View the equivalent code in;
Prev: 6EC2 Up: Map Next: 6EDE