Prev: E8BA Up: Map Next: E8E3
E8D2: Convert a room co-ordinate to a screen address rounded to the nearest 8x8 cell
Used by the routines at C8FF, CD24, D1CE, D550, D655 and E909.
Input
DE On entry, holds the x and y co-ordinates. On return, holds the screen address.
E8D2 LD A,E Get the Y co-ordinate.
E8D3 AND $07 Put the bottom 3 bits in B.
E8D5 LD B,A
E8D6 SRL E Divide the Y co-ordinate by 8 to get an appropriate offset for screen data.
E8D8 SRL E
E8DA SRL E
E8DC CALL $E8F1 Convert this to an attribute address in DE.
E8DF LD A,B Add the low 3 bits to the X co-ordinate to get the appropriate screen address.
E8E0 ADD A,D
E8E1 LD D,A
E8E2 RET Return with a screen address in DE.
Prev: E8BA Up: Map Next: E8E3