Prev: 9F70 Up: Map Next: A008
A002: Wrap World X
Add BC to a world X and keep bits 0-4 of the high byte.
Input
HL World X
BC Offset
Output
HL Wrapped world X
Add the offset and wrap the high byte to bits 0-4.
MaskWorldX A002 ADD HL,BC Add the offset.
A003 LD A,H Fetch the high byte.
A004 AND %00011111 Keep only bits 0-4.
A006 LD H,A Write it back.
A007 RET Return.
Prev: 9F70 Up: Map Next: A008