Prev: 58751 Up: Map Next: 58811
58782: 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 24 plus the column.
Input
H The row
L The pixel column
Output
HL The address
GetBufferAddress 58782 PUSH DE Remember the registers in DE.
58783 LD A,L Shift the pixel column down by three.
58784 RRA
58785 RRA
58786 RRA
58787 AND %00011111 Use the low five bits as the byte column.
58789 PUSH AF Remember the byte column.
58790 LD L,H The row is the high byte, in a word of its own.
58791 LD H,0
58793 ADD HL,HL Multiply the row by 24.
58794 ADD HL,HL
58795 ADD HL,HL
58796 LD E,L
58797 LD D,H
58798 ADD HL,HL
58799 ADD HL,DE
58800 POP AF Add the byte column.
58801 LD E,A
58802 LD D,0
58804 ADD HL,DE
58805 LD DE,58811 Add the screen buffer base.
58808 ADD HL,DE
58809 POP DE Restore the registers.
58810 RET Return.
Prev: 58751 Up: Map Next: 58811