Prev: E57F Up: Map Next: E5BB
E59E: Get Buffer Address
Used by the routines at ShowEnding, ConvertEntityPosition and DrawWipeStep.
Finds the address in the screen buffer of a position, which is the buffer address plus the row times 18 plus the column.
Input
H The row
L The pixel column
Output
HL The address
GetBufferAddress E59E PUSH DE Remember the registers in DE.
E59F LD A,L Shift the pixel column down by three.
E5A0 RRA
E5A1 RRA
E5A2 RRA
E5A3 AND %00011111 Use the low five bits as the byte column.
E5A5 PUSH AF Remember the byte column.
E5A6 LD L,H The row is the high byte, in a word of its own.
E5A7 LD H,$00
E5A9 ADD HL,HL Multiply the row by 18.
E5AA ADD HL,HL
E5AB ADD HL,HL
E5AC LD E,L
E5AD LD D,H
E5AE ADD HL,HL
E5AF ADD HL,DE
E5B0 POP AF Add the byte column.
E5B1 LD E,A
E5B2 LD D,$00
E5B4 ADD HL,DE
E5B5 LD DE,$E5BB Add the screen buffer base.
E5B8 ADD HL,DE
E5B9 POP DE Restore the registers.
E5BA RET Return.
Prev: E57F Up: Map Next: E5BB