Prev: BC0E Up: Map Next: BC52
BC37: Adjust Screen Address at Row Boundary
Used by the routines at Draw_3Wide_Sprite_Column and Draw_2Wide_Sprite_Column.
Adjusts the screen buffer address in HL when a pixel row crosses a character cell boundary.
Input
HL Screen buffer address
Output
HL Adjusted Screen buffer address
Adjust_Screen_Address BC37 LD A,L Load the low byte of the screen address.
BC38 DEC H Undo the previous row increment and test if the next character row would cross into the next screen third.
BC39 CPL
BC3A AND %11100000
BC3C JR Z,Next_Screen_Third Jump to Next_Screen_Third if crossing into the next screen third.
BC3E LD A,L Add 20 to L to move to the next character row.
BC3F ADD A,$20
BC41 LD L,A
BC42 LD A,H Mask H to reset the pixel row bits.
BC43 AND %11111000
BC45 LD H,A
BC46 RET Return.
Next_Screen_Third BC47 LD A,L Mask L to keep only the column bits.
BC48 AND %00011111
BC4A LD L,A
BC4B LD A,H Mask H and add 08 to advance to the next screen third.
BC4C AND %11111000
BC4E ADD A,$08
BC50 LD H,A
BC51 RET Return.
Prev: BC0E Up: Map Next: BC52