Prev: FBFC Up: Map Next: FC3C
FC18: Convert a co-ordinate to an attribute address.
Used by the routines at FBB4 and FBED.
Input
H Y co-ordinate
L X co-ordinate
HL On exit, holds an attribute address
FC18 LD A,H Get the Y co-ordinate.
FC19 SRL A Convert it to a screen address and put it in D.
FC1B SRL A
FC1D SRL A
FC1F SUB $17
FC21 NEG
FC23 LD D,A
FC24 LD A,L Get the X co-ordinate.
FC25 SRL A Convert it to a screen address and put it in E.
FC27 SRL A
FC29 SRL A
FC2B LD E,A
FC2C LD H,$00 Put the Y co-ordinate screen address in HL.
FC2E LD L,D
FC2F ADD HL,HL Multiply by 16 to get an appropriate offset to the attributes buffer.
FC30 ADD HL,HL
FC31 ADD HL,HL
FC32 ADD HL,HL
FC33 ADD HL,HL
FC34 LD D,$00 Add the X co-ordinate screen offset.
FC36 ADD HL,DE
FC37 LD DE,$5800 Add the base of the attribute buffer and return.
FC3A ADD HL,DE
FC3B RET
Prev: FBFC Up: Map Next: FC3C