Prev: C0B1 Up: Map Next: C157
C115: Draw tile(n) at character position (char_y, char_x).
Input
A Tile(n)
C Colour
DE Position(char_y, char_x)
Output
TileDraw C115 PUSH AF Store registers.
C116 PUSH HL
C117 PUSH BC
C118 PUSH DE
C119 EX DE,HL Store position.
C11A PUSH HL
C11B LD D,$58 Convert P(y,x) in attribute address.
C11D LD E,L
C11E LD L,H
C11F LD H,$00
C121 ADD HL,HL
C122 ADD HL,HL
C123 ADD HL,HL
C124 ADD HL,HL
C125 ADD HL,HL
C126 ADD HL,DE
C127 LD (HL),C Set to colour(C)
C128 POP HL Get P(y,x)
C129 LD L,H
C12A LD D,$00
C12C LD H,D
C12D PUSH DE
C12E ADD HL,HL Convert Y into pixels.
C12F ADD HL,HL
C130 ADD HL,HL
C131 ADD HL,HL
C132 LD DE,DF_lookup Add start address of row on screen.
C135 ADD HL,DE
C136 LD E,(HL)
C137 INC HL
C138 LD D,(HL)
C139 EX DE,HL
C13A DEC HL DF -= 2 (Left two columns)
C13B DEC HL
C13C POP DE
C13D ADD HL,DE
C13E PUSH HL
C13F LD L,A Work out address for the bitmap of tile(n)
C140 LD H,$00
C142 ADD HL,HL
C143 ADD HL,HL
C144 ADD HL,HL
C145 DEFB $11 LD DE,nn (modified code.)
TileStartPtr C146 DEFB $A0,$C1,$19,$D1 The address loaded into the above LD DE is modified to dictate the address of the first tile to use.
C14A LD B,$08 Height of a tile in pixels.
TileDraw_0 C14C LD A,(HL) Copy tile bitmap row onto screen row.
C14D LD (DE),A
C14E INC HL
C14F INC D
C150 DJNZ TileDraw_0
C152 POP DE
C153 POP BC
C154 POP HL
C155 POP AF
C156 RET
Prev: C0B1 Up: Map Next: C157