![]() |
Routines |
| Prev: A6D2 | Up: Map | Next: A702 |
|
Reads how many alternatives follow, picks one at random with GetRandomNumber, prints that one through ProcessTextCommand and skips the rest.
Control code 0A in the table at JumpTable_ControlCharacters.
Used by the routine at DispatchTextControlHandler.
|
||||||||
| PrintRandomAlternative | A6D3 | INC IX | Read how many alternatives follow and keep that count. | |||||
| A6D5 | LD A,(IX+$00) | |||||||
| A6D8 | LD ($A6D1),A | |||||||
| A6DB | DEC A | Pick one of them at random with GetRandomNumber. | ||||||
| A6DC | CALL GetRandomNumber | |||||||
| A6DF | INC A | Put that choice back in the range and remember it. | ||||||
| A6E0 | LD ($A6D2),A | |||||||
| A6E3 | INC IX | Step on to the first alternative. | ||||||
| PrintRandomAlternative_0 | A6E5 | LD A,($A6D2) | Read the choice and point HL at the count still left. | |||||
| A6E8 | LD HL,$A6D1 | |||||||
| A6EB | CP (HL) | Jump ahead to PrintRandomAlternative_Next if the choice differs from the alternatives left. | ||||||
| A6EC | JR NZ,PrintRandomAlternative_Next | |||||||
| A6EE | PUSH IX | Call ProcessTextCommand to print this alternative. | ||||||
| A6F0 | CALL ProcessTextCommand | |||||||
| A6F3 | POP IX | |||||||
|
Skip this alternative.
|
||||||||
| PrintRandomAlternative_Next | A6F5 | CALL SkipTextTokenBasedOnType | Call SkipTextTokenBasedOnType to skip this alternative. | |||||
| A6F8 | LD HL,$A6D1 | Count one fewer alternative. | ||||||
| A6FB | DEC (HL) | |||||||
| A6FC | JR NZ,PrintRandomAlternative_0 | Jump back to PrintRandomAlternative_0 until none remain. | ||||||
| A6FE | DEC IX | Step the record back one byte. | ||||||
| A700 | XOR A | Clear A. | ||||||
| A701 | RET | Return. | ||||||
| Prev: A6D2 | Up: Map | Next: A702 |