Prev: AC6F Up: Map Next: AD29
ACFC: Zoombox: draw tile
This draws a single zoombox border tile.
Used by the routine at zoombox_draw_border.
Input
A Index of tile to draw.
BC Preserved.
HL Destination address.
zoombox_draw_tile ACFC PUSH BC Preserve
ACFD PUSH AF Preserve
ACFE PUSH HL Preserve
ACFF EX DE,HL Move destination address into DE
AD00 LD L,A Widen the tile index from A into HL
AD01 LD H,$00
AD03 ADD HL,HL Then multiply the tile index by eight
AD04 ADD HL,HL
AD05 ADD HL,HL
AD06 LD BC,$AF5E Point BC at zoombox_tiles
AD09 ADD HL,BC Combine to form a pointer to the required tile in HL
AD0A LD B,$08 8 iterations / 8 rows
Start loop
zoombox_draw_tile_0 AD0C LD A,(HL) Copy a byte
AD0D LD (DE),A
AD0E INC D Next destination byte is 8 * 32 (=256) bytes ahead
AD0F INC HL Next source byte is adjacent
AD10 DJNZ zoombox_draw_tile_0 ...loop
AD12 LD A,D Shunt D into A and undo the earlier INC D
AD13 DEC A
AD14 LD H,$58 Point HL at the attributes bank
AD16 LD L,E
AD17 CP $48 Was the tile on the middle or later third of the screen?
AD19 JR C,zoombox_draw_tile_1 If not, jump to writing the attribute
AD1B INC H If so, increment the attribute bank pointer
AD1C CP $50 Was the tile on to the final third of the screen?
AD1E JR C,zoombox_draw_tile_1 If not, jump to writing the attribute
AD20 INC H If so, increment the attribute bank pointer
zoombox_draw_tile_1 AD21 LD A,($AB6A) Read our current game_window_attribute
AD24 LD (HL),A Write it to the attribute byte
AD25 POP HL Restore
AD26 POP AF Restore
AD27 POP BC Restore
AD28 RET Return
Prev: AC6F Up: Map Next: AD29