![]() |
Routines |
| Prev: 39980 | Up: Map | Next: 40179 |
|
Used by the routines at 35367, 37191, 37210, 37221, 37256, 37293, 37328, 37341, 40179, 40240, 40254, 40334, 40362, 40370, 40461, 40490, 40497, 40504, 40522, 40557, 40586, 40615, 40632, 40658, 40684, 40733, 40787, 41035, 41041, 41047, 41053, 42057, 42125, 42664, 42961, 43054, 46449, 46688, 46765, 46857, 47309, 47412, 47595, 47618, 47625, 47632, 49446, 49469, 49663, 49686, 50215, 51598, 52094, 52144, 52179, 53097, 53120, 53252, 54462, 54952, 55058, 55075, 55142 and 55191.
|
||||||||||||
| AdvanceScriptInstruction | 40142 | INC HL | Advance script data pointer by two bytes. | |||||||||
| 40143 | INC HL | |||||||||||
|
This entry point is used by the routines at 35367, 40529, 40545, 40557, 40574, 40586, 40603, 40615, 42057, 42664, 43054, 46449, 46765, 46857, 47309, 47412, 47632, 49469, 50215, 51598, 53120, 53252, 54462, 54952 and 55039.
|
||||||||||||
| ScriptInstruction | 40144 | INC HL | Advance script data pointer by one byte. | |||||||||
| 40145 | LD A,(HL) | Load A with the byte at this location. | ||||||||||
| 40146 | DEC HL | Move HL back one byte. | ||||||||||
| 40147 | OR A | If byte loaded into A was zero (i.e. a script instruction) then skip ahead to ExecuteScript. | ||||||||||
| 40148 | JR Z,ExecuteScript | |||||||||||
|
HL pointing to a graphic layout data address, rather than a script instruction.
|
||||||||||||
| 40150 | LD (28100),HL | Store current position in script at CurrentScript. | ||||||||||
| 40153 | LD A,(HL) | Load word at location HL into graphic layout address in current entity's complex state data entry (IX). | ||||||||||
| 40154 | LD (IX+2),A | |||||||||||
| 40157 | INC HL | |||||||||||
| 40158 | LD A,(HL) | |||||||||||
| 40159 | LD (IX+3),A | |||||||||||
| 40162 | RET | Return. | ||||||||||
|
HL pointing to a script instruction.
|
||||||||||||
| ExecuteScript | 40163 | LD A,(HL) | Load A with script "instruction". | |||||||||
| 40164 | PUSH HL | Stash HL (pointer to current position in script data) on the stack. | ||||||||||
| 40165 | LD HL,39980 | Point HL at TableScriptHandlers. | ||||||||||
| 40168 | ADD A,A | Load BC with double index of script instruction and add as offset in HL to point to start address of required script routine. | ||||||||||
| 40169 | LD C,A | |||||||||||
| 40170 | LD B,0 | |||||||||||
| 40172 | ADD HL,BC | |||||||||||
| 40173 | LD C,(HL) | Load BC with address at this location. | ||||||||||
| 40174 | INC HL | |||||||||||
| 40175 | LD B,(HL) | |||||||||||
| 40176 | POP HL | Restore HL (pointer to current position in script data) from the stack. | ||||||||||
| 40177 | PUSH BC | Push address in BC onto stack and "return" to this address. | ||||||||||
| 40178 | RET | |||||||||||
| Prev: 39980 | Up: Map | Next: 40179 |