Prev: A826 Up: Map Next: A8CF
A8A2: Plot all tiles
This renders the complete screen by plotting all vertical columns in turn.
Used by the routines at pick_up_item and reset_outdoors.
Note: Exits with banked registers active.
plot_all_tiles A8A2 LD DE,$F0F8 Point DE at the 24x17 visible tiles array ("tile_buf")
A8A5 EXX Bank
A8A6 LD HL,$FF58 Point HL' at the 7x5 supertile indices buffer ("map_buf")
A8A9 LD DE,$F290 Point DE' at the 24x17x8 screen buffer ("window_buf")
A8AC LD A,($81BB) Get map X position
A8AF LD B,$18 Set 24 iterations (screen columns)
Start loop
plot_all_tiles_0 A8B1 PUSH BC Preserve the loop counter
A8B2 PUSH DE Preserve the screen buffer pointer
A8B3 PUSH HL Preserve the supertile indices pointer
A8B4 PUSH AF Preserve the map X position
A8B5 EXX Unbank
A8B6 PUSH DE Preserve the visible tiles pointer
A8B7 EXX Bank
A8B8 CALL plot_vertical_tiles_common Plot a complete column of tiles
A8BB EXX Unbank
A8BC POP DE Restore and advance the visible tiles pointer
A8BD INC DE
A8BE EXX Bank
A8BF POP AF Restore the map X position
A8C0 POP HL Restore the supertile indices pointer
A8C1 INC A Advance the map X position
A8C2 LD C,A Save the result in C
A8C3 AND $03 If the X position hits a multiple of 4 advance to the next supertile
A8C5 JR NZ,plot_all_tiles_1
A8C7 INC HL
plot_all_tiles_1 A8C8 LD A,C Restore the map X position
A8C9 POP DE Restore and advance the screen buffer pointer to the next column
A8CA INC DE
A8CB POP BC Restore the loop counter
A8CC DJNZ plot_all_tiles_0 ...loop
A8CE RET Return
Prev: A826 Up: Map Next: A8CF