Prev: F209 Up: Map Next: F257
F20B: Plot static tiles
This draws static tiles to the screen - the tiles used by the morale flag, score, etc.
Used by the routine at plot_static_tiles_horizontal.
Input
A Plot direction: 0 => horizontal, $FF => vertical.
DE Pointer to destination screen address.
HL Pointer to remainder of static graphic bytes [flags_and_length, tile indices...].
plot_static_tiles F20B LD ($F075),A Save a copy of the plot direction
F20E LD A,(HL) Load flags_and_length
F20F AND $7F Mask off length
F211 LD B,A Set B for loop iterations
F212 INC HL Advance to tile indices
F213 PUSH DE Preserve the pointer to screen address
F214 EXX Bank
F215 POP DE Restore the pointer to screen address
F216 EXX Unbank
Start loop (once for each tile)
plot_static_tiles_0 F217 LD A,(HL) Read a tile index
F218 EXX Bank
Point HL at static_tiles[tileindex]
F219 LD C,A Multiply the tile index by 9
F21A LD B,$00
F21C LD L,A
F21D LD H,$00
F21F ADD HL,HL
F220 ADD HL,HL
F221 ADD HL,HL
F222 ADD HL,BC
F223 LD BC,$7F00 Point BC at static_tiles[0]
F226 ADD HL,BC Combine
F227 LD B,$08 Set B for 8 iterations
Plot a tile.
Start loop (once for each byte/row)
plot_static_tiles_1 F229 LD A,(HL) Copy a byte of tile
F22A LD (DE),A
F22B INC D Advance DE to the next screen row
F22C INC HL
F22D DJNZ plot_static_tiles_1 ...loop
F22F DEC D Step DE back so it's still in the right block
F230 PUSH DE Preserve screen pointer
Calculate screen attribute address of tile.
F231 LD A,D Get screen pointer high byte
F232 LD D,$58 Set the attribute pointer to $58xx by default
F234 CP $48 If the screen pointer is $48xx... set the attribute pointer to $59xx
F236 JR C,plot_static_tiles_2
F238 INC D
F239 CP $50 If the screen pointer is $50xx... set the attribute pointer to $5Axx
F23B JR C,plot_static_tiles_2
F23D INC D
plot_static_tiles_2 F23E LD A,(HL) Copy the attribute byte which follows the tile data
F23F LD (DE),A
F240 POP HL Restore screen pointer
F241 LD A,($F075) Fetch static_tiles_plot_direction
F244 AND A Is it vertical?
F245 JR NZ,plot_static_tiles_3 Jump if so
Horizontal
Reset and advance the screen pointer
F247 LD A,H Rewind the screen pointer by 7 rows
F248 SUB $07
F24A LD H,A
F24B INC L Advance to the next character
F24C JR plot_static_tiles_4 (else)
Vertical
plot_static_tiles_3 F24E CALL next_scanline_down Get the same position on the next scanline down
plot_static_tiles_4 F251 EX DE,HL Move new scanline pointer into DE
F252 EXX Unbank
F253 INC HL Advance to the next input byte
F254 DJNZ plot_static_tiles_0 ...loop
F256 RET Return
Prev: F209 Up: Map Next: F257