![]() |
Routines |
| Prev: 72CE | Up: Map | Next: 7340 |
|
Nearly everything the game says goes through here, as a compact bytecode rather than text. A byte with bit 7 set starts a two-byte word reference, high byte first: twelve bits of offset into the dictionary and a flag nibble, of which 2, 3 and 6 end the message. A byte from $60 to $7F is one of the COMMON_WORDS; from $20 to $5F, a literal character; below $20, a control code, dispatched through CONTROL_CODES -- below $14 as a subroutine that returns to the message, from $14 up as the end of it.
Checked against the screen, not only read: location 4's description decodes to exactly the words the game printed on arriving there, and so does Bag End's. The v1.0 disassembly credited in build_hobbit.py describes the same bytecode, and pointed at where to look.
The messages are stored end to end from MSG_BUT_FALL_AND_HIT, straight after COMMON_WORDS, and a few are entered part-way through another: five at an element boundary, sharing its tail -- the last is the two banks of the black river, one description entered at two places -- and one on the second byte of the word that ends the message before, which it reads as a control code.
|
||||||||
| RUN_MESSAGE | 72D3 | LD A,(IS_ORDER) | Inside a quotation, clear DOING_IT first | |||||
| 72D6 | AND A | |||||||
| 72D7 | JR Z,RUN_MESSAGE_HL | |||||||
| 72D9 | XOR A | |||||||
| 72DA | LD (DOING_IT),A | |||||||
|
This entry point is used by the routines at START, CANNOT_DO, QUOTE_LEFT_OPEN, DO_HELP, SHOW_SCORE, LOAD_BLOCK, DO_SAVE, VERIFY_BLOCK, DO_LOOK, MUST_CARRY, DO_DROP, DO_TAKE_OUT, CAN_LIFT, DO_TAKE, MOVE, LOOK_THROUGH, DO_FOLLOW, DO_TALK, DO_SHOOT, PLAYER_DIES, DO_INVENTORY, DO_ATTACK, DO_PUT_IN, DO_EAT, DO_GIVE, DO_EXAMINE, INTO_THE_RIVER, DO_ACTION, DESCRIBE_LOCATION, DESCRIPTION_OR_NAME, CARRIED_BY_ANOTHER, NARRATE_LINE, CHARACTERS_ACT, ANNOUNCE_ARRIVAL, EMPTY_OUT, YOU_SEE, LIST_HERE, CONTENTS_INTRO, PLACED_WORD, EXITS_THROUGH, VISIBLE_EXITS, SAY_STATE, SAYS, DO_TIE, DO_UNTIE, SWIM_BLACK_RIVER, NO_KEY_FITS, WEB_BROKEN, TAKE_OFF_RING, GOBLIN_RETURNS, DO_CLIMB_INTO, BARREL_REACHES_LAKE, TRAP_DOOR_OPEN_CLOSE, DRAGON_FOLLOWS, DRAGON_HUNTS, MAGIC_DOOR_EXAMINED, THORIN_KILLED, WINDOW_OPEN_CLOSE, WINDOW_OTHERS, SINKING_IN_BOG, THROW_ROPE_ACROSS, PULL_ROPE, GOLLUM_HEARS_ANSWER, TROLLS_TURN_TO_STONE, CHECK_WON, JUMP_ONTO_BARREL, SIDE_DOOR_VANISHES, SIDE_DOOR_APPEARS, AT_MAGIC_DOOR, WEB_SMOTHERS, EYES_WARNING, EYES_STING and AT_FOREST_RIVER.
|
||||||||
| RUN_MESSAGE_HL | 72DD | LD (MESSAGE_DE),DE | Keep DE, IX and A to put back at the end | |||||
| 72E1 | LD (MESSAGE_IX),IX | |||||||
| 72E5 | LD (MESSAGE_A),A | |||||||
| 72E8 | LD A,(DOING_IT) | Clear SUCCEEDED unless DOING_IT is set | ||||||
| 72EB | AND A | |||||||
| 72EC | JR NZ,RUN_SUBMESSAGE | |||||||
| 72EE | LD (SUCCEEDED),A | |||||||
|
This entry point is used by the routine at MC_SUBMESSAGE.
|
||||||||
| RUN_SUBMESSAGE | 72F1 | PUSH HL | IX walks the message | |||||
| 72F2 | POP IX | |||||||
| RUN_MESSAGE_0 | 72F4 | LD A,(IX+$00) | Bit 7 set: a word reference | |||||
| 72F7 | BIT 7,A | |||||||
| 72F9 | JR Z,RUN_MESSAGE_2 | |||||||
| 72FB | AND $7F | DE = the reference: flags and offset from the first byte, low byte from the second | ||||||
| 72FD | LD D,A | |||||||
| 72FE | LD E,(IX+$01) | |||||||
| 7301 | INC IX | |||||||
| 7303 | AND $F0 | Ending flags 3, 2 or 6: print it and end the message | ||||||
| 7305 | CP $30 | |||||||
| 7307 | JR Z,WORD_AND_END | |||||||
| 7309 | CP $20 | |||||||
| 730B | JR Z,WORD_AND_END | |||||||
| 730D | CP $60 | |||||||
| 730F | JR Z,WORD_AND_END | |||||||
|
This entry point is used by the routine at COMMON_WORD.
|
||||||||
| MESSAGE_WORD | 7311 | CALL PRINT_WORD_DE | Print it, and on to the next byte | |||||
| RUN_MESSAGE_1 | 7314 | INC IX | ||||||
| 7316 | JR RUN_MESSAGE_0 | |||||||
| RUN_MESSAGE_2 | 7318 | CP $20 | $60 and up: one of the COMMON_WORDS | |||||
| 731A | JR C,RUN_MESSAGE_3 | |||||||
| 731C | CP $60 | |||||||
| 731E | JP NC,COMMON_WORD | |||||||
| 7321 | CALL PRINT_LITERAL | $20-$5F: print it as it is | ||||||
| 7324 | JR RUN_MESSAGE_1 | |||||||
| RUN_MESSAGE_3 | 7326 | PUSH DE | Below $20: HL = its handler from CONTROL_CODES | |||||
| 7327 | LD E,A | |||||||
| 7328 | LD D,$00 | |||||||
| 732A | LD HL,CONTROL_CODES | |||||||
| 732D | ADD HL,DE | |||||||
| 732E | ADD HL,DE | |||||||
| 732F | LD E,(HL) | |||||||
| 7330 | INC HL | |||||||
| 7331 | LD D,(HL) | |||||||
| 7332 | EX DE,HL | |||||||
| 7333 | POP DE | |||||||
| 7334 | CP $14 | $14 and up ends the message: jump to it | ||||||
| 7336 | JR NC,RUN_MESSAGE_4 | |||||||
| 7338 | CALL RUN_MESSAGE_4 | Below $14: call it; Z to carry on, NZ to print the word it left in DE | ||||||
| 733B | JR Z,RUN_MESSAGE_1 | |||||||
| 733D | JR MESSAGE_WORD | |||||||
| RUN_MESSAGE_4 | 733F | JP (HL) | ||||||
| Prev: 72CE | Up: Map | Next: 7340 |