Prev: 64106 Up: Map Next: 64254
64158: Fill Tiles
Used by the routines at JumpTable_FillTiles and Move_Entity.
Fills a rectangle of tiles from the room buffers.
Fill_Tiles 64158 PUSH AF Stash AF, BC, DE and HL.
64159 PUSH BC
64160 PUSH DE
64161 PUSH HL
64162 LD HL,(23606) Switch *CHARS to *Pointer_ActiveFont.
64165 PUSH HL
64166 LD HL,(25614)
64169 LD (23606),HL
Clip the fill rectangle.
64172 LD A,E Store the width in *Print_Width.
64173 LD (25622),A
64176 CALL Next_PrintCell Call Next_PrintCell.
64179 XOR A Jump to Fill_Tiles_Skip if the clipped size is zero.
64180 CP E
64181 JP Z,Fill_Tiles_Skip
64184 CP D
64185 JP Z,Fill_Tiles_Skip
64188 LD A,C Store the starting column in *25621.
64189 LD (25621),A
Fill_Tiles_Target 64192 LD A,(25622) E=*Print_Width.
64195 LD E,A
64196 LD A,(25621) C=*25621.
64199 LD C,A
64200 CALL Set_PrintPosition Call Set_PrintPosition.
Fill_Tiles_Continue 64203 PUSH BC Advance *Print_BufferOffset and point HL at that Buffer_RoomTiles tile.
64204 LD HL,(25618)
64207 INC HL
64208 LD (25618),HL
64211 LD BC,24013
64214 ADD HL,BC
64215 LD A,(HL)
64216 CALL Print_Character Call Print_Character with the stored tile.
64219 LD BC,800 Copy the matching Buffer_RoomAttributes attribute to the screen.
64222 ADD HL,BC
64223 LD A,(HL)
64224 LD BC,22527
64227 LD HL,(25618)
64230 ADD HL,BC
64231 LD (HL),A
64232 POP BC Move left one column and loop back to Fill_Tiles_Continue.
64233 DEC C
64234 DEC E
64235 JR NZ,Fill_Tiles_Continue
64237 DEC D Decrease the remaining height.
64238 JR Z,Fill_Tiles_Skip Jump to Fill_Tiles_Skip if it is zero.
64240 PUSH DE Copy DE to DE (using the stack).
64241 POP DE
64242 DEC B Move up one row.
64243 JR Fill_Tiles_Target Jump to Fill_Tiles_Target.
Fill_Tiles_Skip 64245 POP HL Restore *CHARS from the stack.
64246 LD (23606),HL Write it back to *CHARS.
64249 POP HL Restore the stashed registers from the stack.
64250 POP DE
64251 POP BC
64252 POP AF
64253 RET Return.
Prev: 64106 Up: Map Next: 64254