| The Hobbit (v1.0) | Routines |
| Prev: 9921 | Up: Map | Next: 99E0 |
|
Picks a random entry (9BF4) from the character's reaction table (the address at offset 4 of its table entry) and makes it the character's current behaviour program. The range is the smaller of byte 1 of the instruction and byte 1 of the character's table entry. The entry at 99C3 selects entry E instead.
|
||||
| 99B4 | LD A,(IX+$01) | A = the range given in the instruction... | ||
| 99B7 | CP (IY+$01) | ...but no more than the character's own limit | ||
| 99BA | JR C,$99BF | |||
| 99BC | LD A,(IY+$01) | |||
| 99BF | CALL $9BF4 | Pick a random entry number | ||
| 99C2 | LD E,A | |||
|
This entry point is used by the routine at 976C.
|
||||
| 99C3 | LD A,(IY+$01) | (Entry point with E already set) Make sure it is within the limit | ||
| 99C6 | CP E | |||
| 99C7 | JR NC,$99CA | |||
| 99C9 | LD E,A | |||
| 99CA | LD L,(IY+$04) | HL = the reaction table | ||
| 99CD | LD H,(IY+$05) | |||
| 99D0 | LD D,$00 | |||
| 99D2 | ADD HL,DE | Three bytes per entry | ||
| 99D3 | ADD HL,DE | |||
| 99D4 | ADD HL,DE | |||
| 99D5 | INC HL | Skip the action byte | ||
| 99D6 | LD E,(HL) | DE = the program address | ||
| 99D7 | INC HL | |||
| 99D8 | LD D,(HL) | |||
| 99D9 | LD (IY+$02),E | Make it the character's program | ||
| 99DC | LD (IY+$03),D | |||
| 99DF | RET | |||
| Prev: 9921 | Up: Map | Next: 99E0 |