Routines |
Prev: 6AB5 | Up: Map | Next: 6B79 |
This routine expands all of the tile indices in the visible tiles array to the screen buffer. It's only ever used when drawing interior scenes (rooms).
Used by the routines at enter_room, pick_up_item, process_player_input, wake_up, end_of_breakfast, select_room_and_plot, screen_reset, choose_game_window_attributes and action_shovel.
|
||||
plot_interior_tiles | 6B42 | LD HL,$F290 | Point HL at the screen buffer's start address | |
6B45 | LD DE,$F0F8 | Point DE at the visible tiles array | ||
6B48 | LD C,$10 | Set row counter to 16 | ||
For every row
|
||||
row_loop | 6B4A | LD B,$18 | Set column counter to 24 | |
For every column
|
||||
column_loop | 6B4C | PUSH HL | Stack screen buffer pointer while we form a tile pointer | |
6B4D | LD A,(DE) | Load a tile index | ||
6B4E | EXX | Bank outer registers | ||
6B4F | LD L,A | Point HL at interior_tiles[tile index] | ||
6B50 | LD H,$00 | |||
6B52 | ADD HL,HL | |||
6B53 | ADD HL,HL | |||
6B54 | ADD HL,HL | |||
6B55 | LD DE,$9768 | |||
6B58 | ADD HL,DE | |||
6B59 | POP DE | Unstack screen buffer pointer | ||
6B5A | LD BC,$0818 | Simultaneously set B for eight iterations and C for a 24 byte stride | ||
tile_loop | 6B5D | LD A,(HL) | Transfer a byte (a row) of tile across | |
6B5E | LD (DE),A | |||
6B5F | LD A,C | Advance the screen buffer pointer by the stride | ||
6B60 | ADD A,E | |||
6B61 | JR NC,plot_interior_tiles_0 | |||
6B63 | INC D | |||
plot_interior_tiles_0 | 6B64 | LD E,A | ||
6B65 | INC L | |||
6B66 | DJNZ tile_loop | ...loop for each byte of the tile | ||
End of column
|
||||
6B68 | EXX | Unbank outer registers | ||
6B69 | INC DE | Move to next input tile | ||
6B6A | INC HL | Move to next screen buffer output | ||
6B6B | DJNZ column_loop | ...loop for each column | ||
End of row
|
||||
6B6D | LD A,$A8 | Move to the next screen buffer row (seven rows down) | ||
6B6F | ADD A,L | |||
6B70 | JR NC,plot_interior_tiles_1 | |||
6B72 | INC H | |||
plot_interior_tiles_1 | 6B73 | LD L,A | ||
6B74 | DEC C | ...loop for each row | ||
6B75 | JP NZ,row_loop | |||
End
|
||||
6B78 | RET | Return |
Prev: 6AB5 | Up: Map | Next: 6B79 |