Routines
| Prev: AFFA | Up: Map | Next: B0AC |
B01C: Handlers for BUT, ALL and a quote mark
|
B01C (BUT, after ALL) and B033 (ALL) set A01A to 2 and 1 for 'all but' and 'all'. B049 (a quote mark): the words that follow are speech; their position is added to the list at 9FEC and the parser skips to the closing quote, marking it as the end of a sentence. B86A hands them on when SAY TO / TALK TO runs. B09A (PAUSE) waits (C415). B0A3 (LOAD, and QUIT too) goes to B0AC: the game asks for a saved-game tape.
QUIT and LOAD both print 'PLAY SAVED GAME TAPE TO BE LOADED' and set $A0DA to 1; PAUSE and NOPRINT are accepted with no message.
A line that is only a quotation, "HELLO", is taken as TALK (the word at $088B): 'You talk to Watson.' and Watson's good morning, the same as SAY "HELLO". TO WATSON "HELLO" gets WHAT ?.
Each quotation in a SAY TO / TALK TO is added to the list at 9FEC (B049) whether or not the command later succeeds; B86A hands on the first node. A SAY that failed (I SEE NO ... THAT YOU CAN TALK TO, no answer) therefore leaves a stale quotation in front of the next one, and the next person spoken to hears the old words. TALK TO <person> with no quotation empties the list.
|
||||||||||||||
| B01C | LD A,($A01A) | Read A01A in "Game variables" into A - BUT: only straight after ALL (A01A = 1) | ||||||||||||
| B01F | CP $01 | Compare A with $01 | ||||||||||||
| B021 | JP NZ,$AF67 | If A differs from $01, go back to the routine "Not a special word: NZ" (AF67) | ||||||||||||
| B024 | LD A,$02 | Load A with $02 - 'All but' (A01A = 2) | ||||||||||||
| B026 | LD ($A01A),A | Store A in A01A in "Game variables" | ||||||||||||
| B029 | CALL $AE6A | Call the routine "Add a new node to the end of the sentence list" (AE6A) - A new sentence node for the things after BUT, marked with bit 6 of +1 | ||||||||||||
| B02C | SET 6,(IY+$01) | Set bit 6 of byte +1 of the record at IY | ||||||||||||
| B030 | JP $AB52 | Go on parsing | ||||||||||||
| B033 | CALL $AFE8 | Call AFE8 (inside "Handler guards: only at the start of a...") - ALL: only at the start of a sentence, and only once | ||||||||||||
| B036 | LD A,($A01A) | Read A01A in "Game variables" into A | ||||||||||||
| B039 | AND A | Test A for zero (this leaves A as it was and clears carry) | ||||||||||||
| B03A | JP NZ,$AF67 | If A is not zero, go back to the routine "Not a special word: NZ" (AF67) | ||||||||||||
| B03D | LD A,$01 | Load A with $01 - 'All' (A01A = 1), and bit 7 of +1 on the node | ||||||||||||
| B03F | LD ($A01A),A | Store A in A01A in "Game variables" | ||||||||||||
| B042 | SET 7,(IY+$01) | Set bit 7 of byte +1 of the record at IY | ||||||||||||
| B046 | JP $AB52 | Go back to AB52 | ||||||||||||
| B049 | BIT 1,E | Test bit 1 of E - A quote mark with no verb yet (E bit 1)? Then it becomes TALK ($088B) | ||||||||||||
| B04B | JR Z,$B058 | If bit 1 of E is clear, skip ahead to B058 | ||||||||||||
| B04D | LD HL,$088B | Load HL with $088B | ||||||||||||
| B050 | LD (IY+$00),L | Store L in the first byte of the record at IY | ||||||||||||
| B053 | LD (IY+$01),H | Store H in byte +1 of the record at IY | ||||||||||||
| B056 | RES 1,E | Clear bit 1 of E | ||||||||||||
| B058 | PUSH HL | Save HL on the stack - Add the quote's position in the word list ($A02B) to the list at 9FEC | ||||||||||||
| B059 | PUSH DE | Save DE on the stack | ||||||||||||
| B05A | PUSH IY | Save IY on the stack - Save IY, IX | ||||||||||||
| B05C | PUSH IX | Save IX on the stack | ||||||||||||
| B05E | LD IY,$9FEC | The list headed at 9FEC... | ||||||||||||
| B062 | LD DE,$0000 | Load DE with $0000 - ...find its last node: the one whose link is 0 (A104) | ||||||||||||
| B065 | CALL $A104 | Call the routine "Find the node before node DE in the list at IY" (A104) | ||||||||||||
| B068 | LD A,$02 | Load A with $02 - Get a 2-byte heap node (A11C) | ||||||||||||
| B06A | CALL $A11C | Call the routine "Allocate A + 3 bytes from the free list, cleared" (A11C) | ||||||||||||
| B06D | LD HL,($A02B) | Read $A02B in "Game variables" into HL - Store the token position $A02B in it | ||||||||||||
| B070 | LD (IX+$00),L | Store L in the first byte of the record at IX | ||||||||||||
| B073 | LD (IX+$01),H | Store H in byte +1 of the record at IX | ||||||||||||
| B076 | PUSH IX | Save IX on the stack - Link it after the last node | ||||||||||||
| B078 | POP HL | Restore HL from the stack | ||||||||||||
| B079 | LD (IY-$02),L | Store L in byte -2 of the record at IY | ||||||||||||
| B07C | LD (IY-$01),H | Store H in byte -1 of the record at IY | ||||||||||||
| B07F | POP IX | Restore IX from the stack - Restore the registers | ||||||||||||
| B081 | POP IY | Restore IY from the stack | ||||||||||||
| B083 | POP DE | Restore DE from the stack - (and DE, HL) | ||||||||||||
| B084 | POP HL | Restore HL from the stack | ||||||||||||
| B085 | CALL $AE7F | Call the routine "Read the next token of the typed line" (AE7F) - Skip tokens up to the closing quote (class $90, no value) | ||||||||||||
| B088 | CP $90 | Compare A with $90 | ||||||||||||
| B08A | JR NZ,$B085 | If A differs from $90, go back to B085 | ||||||||||||
| B08C | LD A,B | Copy B into A | ||||||||||||
| B08D | AND $0F | Keep only bits 0, 1, 2, 3 of A (mask $0F) | ||||||||||||
| B08F | OR C | Set in A the bits that are set in C | ||||||||||||
| B090 | JR NZ,$B085 | If the result is not zero, go back to B085 | ||||||||||||
| B092 | LD HL,($A029) | Read $A029 in "Game variables" into HL - Mark it as the end of a sentence (class $C0) | ||||||||||||
| B095 | LD (HL),$C0 | Store $C0 at the address HL points to | ||||||||||||
| B097 | JP $AB52 | Go back to AB52 | ||||||||||||
| B09A | CALL $AFE1 | Call the routine "Handler guards: only at the start of a sentence (not..." (AFE1) - PAUSE: wait for a key (C415) | ||||||||||||
| B09D | CALL $C415 | Call the routine "GET-KEY, but block until a key is actually pressed" (C415) | ||||||||||||
| B0A0 | JP $B015 | Go back to B015 | ||||||||||||
| B0A3 | CALL $AFE1 | Call the routine "Handler guards: only at the start of a sentence (not..." (AFE1) - LOAD (and QUIT): load a saved game (B0AC) | ||||||||||||
| B0A6 | CALL $B0AC | Call the routine "After a game-over message: get ready to load a saved..." (B0AC) | ||||||||||||
| B0A9 | JP $B015 | Go back to B015 | ||||||||||||
| Prev: AFFA | Up: Map | Next: B0AC |