![]() |
Routines |
| Prev: 99C6 | Up: Map | Next: 9A85 |
|
Used by the routine at Turn_GateTheMessage.
Takes the smaller of the script limit and the special-object limit, rolls below that, and stores the script pointer from the chosen entry.
|
||||
| Turn_PickAScriptEntry | 9A59 | LD A,(IX+$01) | Read the limit from this script byte. | |
| 9A5C | CP (IY+$01) | Jump to Turn_PickAScriptEntry_RollBelowTheLimit if that limit is below the special-object limit. | ||
| 9A5F | JR C,Turn_PickAScriptEntry_RollBelowTheLimit | |||
| 9A61 | LD A,(IY+$01) | Use the special-object limit instead. | ||
|
Roll a random number.
|
||||
| Turn_PickAScriptEntry_RollBelowTheLimit | 9A64 | CALL GetRandomNumber | Call GetRandomNumber to roll a number from the limit in A. | |
| 9A67 | LD E,A | Keep the roll in E. | ||
|
This entry point is used by the routine at Turn_GateTheMessage.
|
||||
| Turn_PickAScriptEntry_0 | 9A68 | LD A,(IY+$01) | Read the special-object limit. | |
| 9A6B | CP E | Jump to Turn_PickAScriptEntry_Store if the special-object limit is not below the roll. | ||
| 9A6C | JR NC,Turn_PickAScriptEntry_Store | |||
| 9A6E | LD E,A | Keep the special-object limit in E. | ||
| Turn_PickAScriptEntry_Store | 9A6F | LD L,(IY+$04) | Read the low byte of the table pointer. | |
| 9A72 | LD H,(IY+$05) | Read the high byte of the table pointer. | ||
| 9A75 | LD D,$00 | The record offset's high byte is zero. | ||
| 9A77 | ADD HL,DE | Add the roll in DE. | ||
| 9A78 | ADD HL,DE | Add the roll in DE again. | ||
| 9A79 | ADD HL,DE | Add the roll in DE a third time. Each entry is three bytes. | ||
| 9A7A | INC HL | Step to the next byte. | ||
| 9A7B | LD E,(HL) | Read the low byte of the chosen script pointer. | ||
| 9A7C | INC HL | Step to the next byte. | ||
| 9A7D | LD D,(HL) | Read the high byte of the chosen script pointer. | ||
| 9A7E | LD (IY+$02),E | Store the chosen script pointer in bytes 2 and 3 of the special-object record. | ||
| 9A81 | LD (IY+$03),D | |||
| 9A84 | RET | Return. | ||
| Prev: 99C6 | Up: Map | Next: 9A85 |