Prev: 812F Up: Map Next: 814A
8130: Convert a place in PLANES to an address in the render buffer
Used by the routines at DRAW_SPRITE, DRAW_BLOCK and DRAW_BLOCK_TURNED.
The 512 places in PLANES are 32 to a row, and each row is two half-rows of 16. The first half-row's places are every other byte across one row of the buffer; the second's are one byte across and four rows down. Each row of places is eight rows of the buffer. So the places tile the view like bricks, 16 pixels wide. Measured by running this for a range of places.
Input
HL On entry, an address in PLANES; on exit, the render buffer address of the top left of what is drawn there
PLANE_TO_BUFFER 8130 LD A,L
8131 RLA
8132 RL H
8134 RLA
8135 RL H
8137 RLA
8138 RL H
813A RLCA
813B RL L
813D RL L
813F RRA
8140 LD A,L
8141 RRA
8142 AND $9F
8144 LD L,A
8145 LD A,H
8146 SUB $08
8148 LD H,A
8149 RET
Prev: 812F Up: Map Next: 814A