Prev: AC5A Up: Map Next: AC93
AC66: Translate stored x,y position into screen and attribute address.
Used by the routine at Bmp_BlitAtCharPos.
Input
IX Data Ptr {Y, X, ...}
EXIT HL DF(y,x)
EXIT DE ATTR(y,x)
Output
X,Y is aligned to nearest character position.
YX_toAddr AC66 LD A,(IX+$01) Get x position in pixels and convert into columns / bytes.
AC69 RRA
AC6A RRA
AC6B RRA
AC6C AND $1F
AC6E LD L,A
AC6F LD A,(IX+$00) Get y position and translate into character rows, scans etc to create address.
AC72 RLCA
AC73 RLCA
AC74 LD H,A
AC75 AND $E0
AC77 OR L
AC78 LD L,A
AC79 LD E,A
AC7A LD A,H
AC7B AND $03
AC7D LD H,A
AC7E RLA
AC7F RLA
AC80 RLA
AC81 LD D,A
AC82 LD A,(IX+$00)
AC85 AND $07
AC87 OR D
AC88 LD D,A
AC89 LD BC,$5800 Offset for attribute address.
AC8C ADD HL,BC
AC8D EX DE,HL
AC8E LD BC,$4000 Offset for screen adress.
AC91 ADD HL,BC
AC92 RET
Prev: AC5A Up: Map Next: AC93