Prev: E8E3 Up: Map Next: E909
E8F1: Convert a room co-ordinate to a screen address
Used by the routines at E87A, E897, E8D2, E96B and EEF1.
Input
DE On entry, holds the x and y co-ordinates. On return, holds the screen address.
E8F1 LD A,E Get the Y co-ordinate.
E8F2 AND $18 Keep bits 3 and 4, which hold the correct third of the screen to use.
E8F4 ADD A,$40 Add a base address of 40 to the the high byte of a screen address.
E8F6 PUSH AF Remember this.
This entry point is used by the routine at E8E3.
E8F7 LD A,E Get the Y co-ordinate.
E8F8 AND $07 Take the bottom 3 bits and multiply them by 32 to get the correct offset for this line (ie: 20 40 60 80 A0 E0)
E8FA SLA A
E8FC SLA A
E8FE SLA A
E900 SLA A
E902 SLA A
E904 ADD A,D Add the X co-ordinate to get the right low byte of a screen address.
E905 LD E,A
E906 POP AF Restore the high byte into D.
E907 LD D,A
E908 RET Return.
Prev: E8E3 Up: Map Next: E909