Prev: 915C Up: Map Next: 919E
917C: Draw Terrain Column
Used by the routines at LocateTerrainCell and DrawTerrain.
Copy eight bytes of terrain graphic from TerrainUDGs into the screen column in DE.
Input
HL Terrain cell pointer
DE Screen address
Copy eight bytes of terrain graphic into the screen column.
DrawTerrainColumn 917C PUSH HL Stash the cell pointer and the screen address on the stack.
917D PUSH DE
Work out the address of the graphic for the terrain cell.
917E LD L,(HL) Fetch the terrain cell.
917F LD H,$00 H=00.
9181 ADD HL,HL Multiply the cell index by 08.
9182 ADD HL,HL
9183 ADD HL,HL
9184 LD DE,$F66E DE=TerrainUDGs.
9187 ADD HL,DE Point HL at that graphic.
9188 LD B,$08 Set a pixel row counter in B for 08 loops.
918A POP DE Restore the screen address from the stack, but stash a copy of it on the stack again.
918B PUSH DE
DrawTerrainColumn_Loop 918C LD A,(HL) Copy the graphic byte to the screen.
918D LD (DE),A
918E INC HL Move onto the next graphic byte.
918F INC D Move down one pixel row.
9190 DJNZ DrawTerrainColumn_Loop Decrease the row counter by one and loop back to DrawTerrainColumn_Loop until the column is drawn.
Advance to the next screen row and the next terrain cell.
9192 POP DE Restore the screen column from the stack.
9193 LD A,E Advance the screen pointer by one character row.
9194 ADD A,$20
9196 LD E,A
9197 LD A,D Add the carry into the high byte.
9198 ADC A,$00
919A LD D,A
919B POP HL Restore the cell pointer from the stack.
919C INC HL Move onto the next cell.
919D RET Return.
Prev: 915C Up: Map Next: 919E