Prev: 5E24 Up: Map Next: 5E92
5E72: Command 04: Switch Tile Set
Used by the routine at PopulateRoomBuffer.
Command 04: Switch the tile set.
The following byte selects which tile set to use; 01 for the default set at TileSet_Default, 02 for the alternate set at TileSet_Alternate.
Input
DE Tile counter
HL The room data pointer
Command04_SwitchTileSet 5E72 INC HL Increment the room data pointer by one.
5E73 LD A,(HL) Fetch the tile set byte.
5E74 INC HL Increment the room data pointer by one to move past the command byte.
5E75 CP $01 Jump to Set_DefaultTileSet if the tile set byte is equal to 01.
5E77 JR Z,Set_DefaultTileSet
5E79 CP $02 Jump to Raise_Table_Error if the tile set byte is not equal to 02.
5E7B JP NZ,Raise_Table_Error
Tile set 02: switch to the alternate tile set.
5E7E PUSH HL Stash the room data pointer on the stack temporarily.
5E7F LD HL,$A36A Write TileSet_Alternate to *PointerActiveTileSet.
5E82 LD ($5FC1),HL
5E85 POP HL Restore the room data pointer from the stack.
5E86 JR PopulateRoomBuffer_ParseByte Jump back to PopulateRoomBuffer_ParseByte to continue parsing.
Tile set 01: switch back to the default tile set.
Set_DefaultTileSet 5E88 PUSH HL Stash the room data pointer on the stack temporarily.
5E89 LD HL,$9BAA Write TileSet_Default to *PointerActiveTileSet.
5E8C LD ($5FC1),HL
5E8F POP HL Restore the room data pointer from the stack.
5E90 JR PopulateRoomBuffer_ParseByte Jump back to PopulateRoomBuffer_ParseByte to continue parsing.
Prev: 5E24 Up: Map Next: 5E92