Routines
| Prev: A6D1 | Up: Map | Next: A702 |
A6D3: Code $0A: one of the next n elements, at random
|
||||||||||||||||
| A6D3 | INC IX | Step IX on to the next byte - The count n that follows the code | ||||||||||||||
| A6D5 | LD A,(IX+$00) | Read the first byte of the record at IX into A | ||||||||||||||
| A6D8 | LD ($A6D1),A | Store A in "Code $0A: the count, then the choice" (A6D1) - A6D1 counts the elements down from n | ||||||||||||||
| A6DB | DEC A | Subtract one from A | ||||||||||||||
| A6DC | CALL $D2A4 | Call the routine "A random number from 0 to A" (D2A4) - A random number from 0 to n - 1 (D2A4), plus one: the element to print ($A6D2) | ||||||||||||||
| A6DF | INC A | Add one to A | ||||||||||||||
| A6E0 | LD ($A6D2),A | Store A in $A6D2 in "Code $0A: the count, then the choice" | ||||||||||||||
| A6E3 | INC IX | Step IX on to the next byte | ||||||||||||||
| A6E5 | LD A,($A6D2) | Read $A6D2 in "Code $0A: the count, then the choice" into A - Is this the chosen element? | ||||||||||||||
| A6E8 | LD HL,$A6D1 | Point HL at "Code $0A: the count, then the choice" (A6D1) | ||||||||||||||
| A6EB | CP (HL) | Compare A with the byte at "Code $0A: the count, then the choice" (A6D1) | ||||||||||||||
| A6EC | JR NZ,$A6F5 | If A differs from the byte at "Code $0A: the count, then the choice" (A6D1), skip ahead to A6F5 | ||||||||||||||
| A6EE | PUSH IX | Save IX on the stack | ||||||||||||||
| A6F0 | CALL $A5CD | Call the routine "Interpret one message element at IX" (A5CD) - Yes: print it (the interpreter, A5CD) | ||||||||||||||
| A6F3 | POP IX | Restore IX from the stack | ||||||||||||||
| A6F5 | CALL $A6BB | Call the routine "Skip one message element at IX" (A6BB) - Either way skip over it (A6BB) | ||||||||||||||
| A6F8 | LD HL,$A6D1 | Point HL at "Code $0A: the count, then the choice" (A6D1) | ||||||||||||||
| A6FB | DEC (HL) | Subtract one from the byte at "Code $0A: the count, then the choice" (A6D1) - Until all n have been passed | ||||||||||||||
| A6FC | JR NZ,$A6E5 | If the byte at "Code $0A: the count, then the choice" (A6D1) is not zero, go back to A6E5 | ||||||||||||||
| A6FE | DEC IX | Step IX back one byte - Back one byte, ready for the next token | ||||||||||||||
| A700 | XOR A | Set A to zero, which sets the zero flag for the caller | ||||||||||||||
| A701 | RET | Return to the caller | ||||||||||||||
| Prev: A6D1 | Up: Map | Next: A702 |