![]() |
Routines |
| Prev: 99C6 | Up: Map | Next: 9A85 |
|
Used by the routine at CHARACTERS_ACT.
A random number, limited by the lesser of the operand and slot byte 1 picks from the start of the character's script table; this is how Gandalf and the others wander without a fixed route. SCRIPT_PICK picks entry E instead, and opcodes with no meaning of their own come in there with E = 0.
|
||||
| SCRIPT_RANDOM | 9A59 | LD A,(IX+$01) | The lesser of the operand and the character's own limit | |
| 9A5C | CP (IY+$01) | |||
| 9A5F | JR C,SCRIPT_RANDOM_0 | |||
| 9A61 | LD A,(IY+$01) | |||
| SCRIPT_RANDOM_0 | 9A64 | CALL RANDOM_POSITIVE | A random number within it | |
| 9A67 | LD E,A | |||
|
This entry point is used by the routine at CHARACTERS_ACT.
|
||||
| SCRIPT_PICK | 9A68 | LD A,(IY+$01) | No further than the character's own limit | |
| 9A6B | CP E | |||
| 9A6C | JR NC,SCRIPT_RANDOM_1 | |||
| 9A6E | LD E,A | |||
| SCRIPT_RANDOM_1 | 9A6F | LD L,(IY+$04) | The script its table has at that place | |
| 9A72 | LD H,(IY+$05) | |||
| 9A75 | LD D,$00 | |||
| 9A77 | ADD HL,DE | |||
| 9A78 | ADD HL,DE | |||
| 9A79 | ADD HL,DE | |||
| 9A7A | INC HL | |||
| 9A7B | LD E,(HL) | |||
| 9A7C | INC HL | |||
| 9A7D | LD D,(HL) | |||
| 9A7E | LD (IY+$02),E | |||
| 9A81 | LD (IY+$03),D | |||
| 9A84 | RET | |||
| Prev: 99C6 | Up: Map | Next: 9A85 |