Prev: 31658 Up: Map Next: 31960
31922: pxy2saddr
Calculate the address of the display file byte and the pixel within it of the x,y pixel coords in C and B.
Used by the routines at pixel_set, pixel_clear and pixel_clearbyte.
Input
B ypos in pixels,
C xpos in pixels
Output
HL display file byte address
A display file byte's pixel
pxy2saddr 31922 LD HL,_PXY2SADDR_DATA Table of clever values
31925 LD E,B DE is 8 bit y pos
31926 LD D,0
31928 ADD HL,DE Add offset to the table
31929 LD H,(HL) H comes from that table location
31930 LD L,C L is xpos
31931 AND A Clear carry
31932 RR H HL = HL / 2
31934 RR L
31936 SCF Set carry, this primes the 0x40.. display file address
31937 RR H HL = HL /2
31939 RR L
31941 AND A Clear carry
31942 RR H HL = HL / 2
31944 RR L
31946 EX DE,HL Result into DE for the moment
31947 LD HL,_PIXEL_DATA Divisor table
31950 LD A,C xpos
31951 AND 7 Bottom 3 bits - 0 to 7
31953 LD C,A BC = offset into divisor table
31954 LD B,0
31956 ADD HL,BC Find divisor table location
31957 LD A,(HL) A = pixel in the byte
31958 EX DE,HL Restore display file address into HL
31959 RET
Prev: 31658 Up: Map Next: 31960