Prev: 8822 Up: Map Next: 8852
8826: Collision : Get the screen address from a co-ordinate
Used by the routines at 86C4 and 8796.
Input
D Y co-ordinate
E X co-ordinate
HL On exit, holds the screen address
8826 LD E,$08
8828 LD HL,$4000
882B LD A,D
882C CP $40
882E JR C,$8839
8830 SUB $40
8832 LD D,A
8833 LD A,H
8834 ADD A,$08
8836 LD H,A
8837 JR $882B
8839 LD A,D
883A CP $08
883C JR C,$8847
883E SUB $08
8840 LD D,A
8841 LD A,L
8842 ADD A,$20
8844 LD L,A
8845 JR $8839
8847 LD A,D
8848 CP $00
884A JR Z,$8851
884C INC H
884D DEC D
884E DEC E
884F JR $8847
8851 RET
Prev: 8822 Up: Map Next: 8852