![]() |
Routines |
| Prev: C0D2 | Up: Map | Next: C201 |
|
On the first visit, show the picture and the long description, then list what is here and which ways lead out.
|
||||
|
Clear the screen, then show the room picture on a first visit.
|
||||
| Handler_DisplayRoom | C0F9 | PUSH DE | Stash DE on the stack. | |
| C0FA | CALL ClearScreen | Call ClearScreen to clear the screen. | ||
| C0FD | POP DE | Restore DE from the stack. | ||
| C0FE | LD A,($BAFE) | Jump to Handler_DisplayRoom_PrintDescription when room descriptions are switched off. | ||
| C101 | OR A | |||
| C102 | JR Z,Handler_DisplayRoom_PrintDescription | |||
| C104 | LD A,($BA9B) | Search the picture list for this room. Jump to Handler_DisplayRoom_PrintDescription when it has no picture. | ||
| C107 | LD HL,($BAE4) | |||
| C10A | LD BC,($BAFE) | |||
| C10E | CPIR | |||
| C110 | JR NZ,Handler_DisplayRoom_PrintDescription | |||
| C112 | LD A,($BAFE) | Jump to Handler_DisplayRoom_FirstVisit when this visit should show the picture. | ||
| C115 | INC C | |||
| C116 | SUB C | |||
| C117 | LD C,A | |||
| C118 | XOR A | |||
| C119 | OR E | |||
| C11A | JR NZ,Handler_DisplayRoom_FirstVisit | |||
| C11C | LD HL,$BA30 | Find this room's visited flag. | ||
| C11F | LD A,C | |||
| Handler_DisplayRoom_Loop | C120 | CP $08 | ||
| C122 | JR C,Handler_DisplayRoom_Next | |||
| C124 | SUB $08 | This room's flag is in the next flag byte. | ||
| C126 | INC HL | |||
| C127 | JR Handler_DisplayRoom_Loop | |||
| Handler_DisplayRoom_Next | C129 | LD B,A | Turn that bit number into a flag mask. | |
| C12A | INC B | |||
| C12B | LD D,$00 | |||
| Handler_DisplayRoom_FlagBit | C12D | RL D | ||
| C12F | DJNZ Handler_DisplayRoom_FlagBit | |||
| C131 | LD A,(HL) | Jump to Handler_DisplayRoom_PrintDescription when this room has already been visited. | ||
| C132 | AND D | |||
| C133 | JR NZ,Handler_DisplayRoom_PrintDescription | |||
| C135 | LD A,(HL) | Mark this room as visited. | ||
| C136 | OR D | |||
| C137 | LD (HL),A | |||
| Handler_DisplayRoom_FirstVisit | C138 | LD A,$08 | Remember that the long description was shown, and set the text row to 08. | |
| C13A | LD ($BB40),A | |||
| C13D | LD HL,$BA2C | |||
| C140 | SET 0,(HL) | |||
| C142 | LD IX,($BAE6) | Call GetTableEntry to fetch this room's picture handler. | ||
| C146 | LD E,C | |||
| C147 | CALL GetTableEntry | |||
| C14A | LD DE,$C14F | Return to Handler_DisplayRoom_PrintDescription afterwards and jump to that handler. | ||
| C14D | PUSH DE | |||
| C14E | JP (HL) | |||
|
Print the room description and work out the exits.
|
||||
| Handler_DisplayRoom_PrintDescription | C14F | CALL SetScreenPosition | Call SetScreenPosition to move the cursor to the text line stored at LineNumber. | |
| C152 | LD A,$18 | Set the text row to 18, under the picture. | ||
| C154 | LD ($BB40),A | |||
| C157 | LD A,($BA9B) | Call GetTableEntry to fetch this room's long description. | ||
| C15A | LD IX,($BAE8) | |||
| C15E | LD E,A | |||
| C15F | CALL GetTableEntry | |||
| C162 | CALL PrintStringAndNewline | Call PrintStringAndNewline to print the room description and start a new line. | ||
| C165 | LD HL,$BA2C | Skip the key-wait unless the long description was just shown. | ||
| C168 | BIT 0,(HL) | |||
| C16A | JR Z,Handler_DisplayRoom_ListExits | |||
| C16C | RES 0,(HL) | Clear that flag and wait for a key. | ||
| C16E | CALL GetUserInput | |||
|
Count the number of exits in the room data.
|
||||
| Handler_DisplayRoom_ListExits | C171 | CALL GetRoomPointer | Call GetRoomPointer to fetch this room's six exits. | |
| C174 | LD D,H | Count how many of the six exits leave this room. | ||
| C175 | LD E,L | |||
| C176 | LD B,$06 | |||
| C178 | LD C,$00 | |||
| C17A | XOR A | |||
| Handler_DisplayRoom_CountExits | C17B | CP (HL) | ||
| C17C | JR Z,Handler_DisplayRoom_CountNext | |||
| C17E | INC C | |||
| Handler_DisplayRoom_CountNext | C17F | INC HL | ||
| C180 | DJNZ Handler_DisplayRoom_CountExits | |||
| C182 | OR C | Jump to Handler_DisplayRoom_ListObjects when there are no exits. | ||
| C183 | JR Z,Handler_DisplayRoom_ListObjects | |||
| C185 | LD A,C | Jump to Handler_DisplayRoom_ManyExits when more than one exit is open. | ||
| C186 | CP $01 | |||
| C188 | JR NZ,Handler_DisplayRoom_ManyExits | |||
| C18A | LD HL,$BBBC | Print " There is an exit ". | ||
| C18D | CALL PrintString | |||
| C190 | LD H,D | Point back at the exits and the direction names for the one way out. | ||
| C191 | LD L,E | |||
| C192 | LD IX,$BDB2 | |||
| C196 | XOR A | |||
| C197 | JR Handler_DisplayRoom_OneExit | |||
| Handler_DisplayRoom_SkipClosed | C199 | INC HL | Skip a closed exit and move on to the next way out. | |
| C19A | INC IX | |||
| C19C | INC IX | |||
| Handler_DisplayRoom_OneExit | C19E | CP (HL) | ||
| C19F | JR Z,Handler_DisplayRoom_SkipClosed | |||
| C1A1 | LD L,(IX+$00) | Call PrintString to print the direction name. | ||
| C1A4 | LD H,(IX+$01) | |||
| C1A7 | CALL PrintString | |||
| C1AA | JR Handler_DisplayRoom_FullStop | Jump to Handler_DisplayRoom_FullStop to finish the exit sentence. | ||
| Handler_DisplayRoom_ManyExits | C1AC | LD HL,$BBA9 | Print " There are exits:-". | |
| C1AF | CALL PrintStringAndNewline | |||
| C1B2 | LD H,D | Point back at the exits and the direction names. | ||
| C1B3 | LD L,E | |||
| C1B4 | LD IX,$BDB2 | |||
| C1B8 | XOR A | |||
| C1B9 | JR Handler_DisplayRoom_ExitOpen | |||
| Handler_DisplayRoom_NextExit | C1BB | EX DE,HL | Exchange the exit list back into HL and step to the next open way out. | |
| Handler_DisplayRoom_StepExit | C1BC | INC HL | ||
| C1BD | INC IX | |||
| C1BF | INC IX | |||
| Handler_DisplayRoom_ExitOpen | C1C1 | CP (HL) | ||
| C1C2 | JR Z,Handler_DisplayRoom_StepExit | |||
| C1C4 | EX DE,HL | Call PrintString to print the direction name. | ||
| C1C5 | LD L,(IX+$00) | |||
| C1C8 | LD H,(IX+$01) | |||
| C1CB | CALL PrintString | |||
| C1CE | DEC C | Jump to Handler_DisplayRoom_FullStop when no exits remain. | ||
| C1CF | LD A,C | |||
| C1D0 | CP $01 | |||
| C1D2 | JR C,Handler_DisplayRoom_FullStop | |||
| C1D4 | JR Z,Handler_DisplayRoom_And | Jump to Handler_DisplayRoom_And to join the last exit with "and". | ||
| C1D6 | LD A,$2C | Print a comma between the exits. | ||
| C1D8 | CALL PrintCharacter | |||
| C1DB | XOR A | Jump back to Handler_DisplayRoom_NextExit for the next exit. | ||
| C1DC | JR Handler_DisplayRoom_NextExit | |||
| Handler_DisplayRoom_And | C1DE | LD HL,$BBA5 | Print " & ". | |
| C1E1 | CALL PrintString | |||
| C1E4 | XOR A | Jump back to Handler_DisplayRoom_NextExit for the next exit. | ||
| C1E5 | JR Handler_DisplayRoom_NextExit | |||
| Handler_DisplayRoom_FullStop | C1E7 | LD HL,$BCF9 | Print ".". | |
| C1EA | CALL PrintStringAndNewline | |||
|
Are there any objects here?
|
||||
| Handler_DisplayRoom_ListObjects | C1ED | LD A,($BA9B) | Call IsObjectPresent to see whether this room holds anything. Return when it does not. | |
| C1F0 | CALL IsObjectPresent | |||
| C1F3 | RET NZ | |||
| C1F4 | LD HL,$BB96 | Print " You can see:-". | ||
| C1F7 | CALL PrintStringAndNewline | |||
| C1FA | LD A,($BA9B) | Call PrintObjects to list what is in this room. | ||
| C1FD | CALL PrintObjects | |||
|
The exits and objects for this room are done.
|
||||
| C200 | RET | Return. | ||
|
View the equivalent code in;
|
||||
| Prev: C0D2 | Up: Map | Next: C201 |