Prev: E834 Up: Map Next: E864
E849: Find the screen byte of a pixel
Used by the routines at FILL_NEXT_SEED and SCREEN_PIXEL.
The screen address of the pixel at column C, row B, with the rows counted up from the bottom: row 191 is the top line of the screen. It is the arithmetic of the ROM's PIXEL-ADD, over 192 lines rather than BASIC's 176 and without the ROM's check.
Input
B Row (0 the bottom line, 191 the top)
C Column (0-255)
Output
HL The screen byte
PIXEL_ADDRESS E849 LD A,$BF the line, counted down from the top of the screen
E84B SUB B
E84C LD L,A
E84D AND A H: the third of the screen and the line within the character row
E84E RRA
E84F SCF
E850 RRA
E851 AND A
E852 RRA
E853 XOR L
E854 AND $F8
E856 XOR L
E857 LD H,A
E858 LD A,C L: the character row within the third, and the column over 8
E859 RLCA
E85A RLCA
E85B RLCA
E85C XOR L
E85D AND $C7
E85F XOR L
E860 RLCA
E861 RLCA
E862 LD L,A
E863 RET
Prev: E834 Up: Map Next: E864