Prev: 37212 Up: Map Next: 37278
37244: 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 37244 PUSH HL Stash the cell pointer and the screen address on the stack.
37245 PUSH DE
Work out the address of the graphic for the terrain cell.
37246 LD L,(HL) Fetch the terrain cell.
37247 LD H,0 H=0.
37249 ADD HL,HL Multiply the cell index by 8.
37250 ADD HL,HL
37251 ADD HL,HL
37252 LD DE,63086 DE=TerrainUDGs.
37255 ADD HL,DE Point HL at that graphic.
37256 LD B,8 Set a pixel row counter in B for 8 loops.
37258 POP DE Restore the screen address from the stack, but stash a copy of it on the stack again.
37259 PUSH DE
DrawTerrainColumn_Loop 37260 LD A,(HL) Copy the graphic byte to the screen.
37261 LD (DE),A
37262 INC HL Move onto the next graphic byte.
37263 INC D Move down one pixel row.
37264 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.
37266 POP DE Restore the screen column from the stack.
37267 LD A,E Advance the screen pointer by one character row.
37268 ADD A,32
37270 LD E,A
37271 LD A,D Add the carry into the high byte.
37272 ADC A,0
37274 LD D,A
37275 POP HL Restore the cell pointer from the stack.
37276 INC HL Move onto the next cell.
37277 RET Return.
Prev: 37212 Up: Map Next: 37278