Prev: E582 Up: Map Next: E5BA
E597: Draw a room from its record
Used by the routine at DRAW_CURRENT_ROOM.
The screen is cleared (CLEAR_ROOM_SCREEN) with black ink on black paper, so the drawing cannot be seen until ATTRI colours it; the record's first byte is kept as the room's colour (IY+$0E); and its commands are carried out one at a time by DO_ROOM_COMMAND, until the $E5 that ends them. The format is laid out command by command in each room's entry (room 1's is ROOM1).
The loop (RUN_ROOM_COMMANDS, after the colour byte) is also how a part is drawn: room codes $E0 and $E1 (MORE_ROOM_COMMANDS) find the part in the table at PART1 and run its commands through it, recursively. A part has no colour byte.
Input
IX The room's record, at its colour byte
DRAW_ROOM_RECORD E597 XOR A The attributes' byte 0, and the screen cleared.
E598 LD (WORK_SPRITE),A
E59B CALL CLEAR_ROOM_SCREEN
E59E LD A,(IX+$00) The room's colour.
E5A1 LD (ROOM_COLOUR),A
E5A4 INC IX
This entry point is used by the routine at MORE_ROOM_COMMANDS.
RUN_ROOM_COMMANDS E5A6 LD A,(IX+$00) The next command; $E5 ends the room, or the part.
E5A9 CP $E5
E5AB RET Z
E5AC LD D,(IY+MODE-V) Carry it out, with D the mode byte (IY+MODE-V).
E5AF CALL DO_ROOM_COMMAND
E5B2 LD IY,OBJECT_COUNT IY back at the variables after every command, though none of them moves it.
E5B6 INC IX On past the command's last byte.
E5B8 JR RUN_ROOM_COMMANDS
Prev: E582 Up: Map Next: E5BA