![]() |
Routines |
| Prev: 74D8 | Up: Map | Next: 7541 |
| 7500 | LD HL,$7563 | Set the operand of the JP instruction at 750B (below) to 7563 (RET) | ||||||||||||||
| 7503 | LD ($750C),HL | |||||||||||||||
| 7506 | LD HL,$5FE0 | Point HL at the event table at 5FE0 | ||||||||||||||
| 7509 | LD A,(HL) | Collect the first byte of an entry | ||||||||||||||
| 750A | INC A | Set the zero flag if it's 0xFF | ||||||||||||||
|
The operand of the JP instruction that follows is changed (by this routine) using entries in the event table at 5FE0 during the game as follows:
|
||||||||||||||||
| 750B | JP Z,$7563 | Jump if we've reached the end of the event table | ||||||||||||||
| 750E | AND $02 | Is this event active? | ||||||||||||||
| 7510 | JR NZ,$7525 | Jump if not | ||||||||||||||
| 7512 | PUSH HL | Save the event table entry pointer | ||||||||||||||
| 7513 | INC HL | Point HL at the third byte of the entry | ||||||||||||||
| 7514 | INC HL | |||||||||||||||
| 7515 | LD B,(HL) | B=number of conditions to check | ||||||||||||||
| 7516 | INC HL | DE=address to check | ||||||||||||||
| 7517 | LD E,(HL) | |||||||||||||||
| 7518 | INC HL | |||||||||||||||
| 7519 | LD D,(HL) | |||||||||||||||
| 751A | INC HL | A=opcode of the 'JR' instruction to place at 7522 (below) | ||||||||||||||
| 751B | LD A,(HL) | |||||||||||||||
| 751C | INC HL | Point HL at the value to compare with (DE) | ||||||||||||||
| 751D | LD ($7522),A | Set the instruction at 7522 (below) to 'JR Z', 'JR NZ', 'JR C' or 'JR NC' as appropriate | ||||||||||||||
| 7520 | LD A,(DE) | Check the condition | ||||||||||||||
| 7521 | CP (HL) | |||||||||||||||
| 7522 | JR $752C | This instruction is set to 'JR Z', 'JR NZ', 'JR C' or 'JR NC' above | ||||||||||||||
| 7524 | POP HL | Restore the event table entry pointer to HL | ||||||||||||||
| 7525 | INC HL | Point HL at the second byte of the entry | ||||||||||||||
| 7526 | LD E,(HL) | Move HL along to the first byte of the next entry | ||||||||||||||
| 7527 | LD D,$00 | |||||||||||||||
| 7529 | ADD HL,DE | |||||||||||||||
| 752A | JR $7509 | Jump back to examine the next entry | ||||||||||||||
| 752C | DJNZ $7516 | Jump back to check the next condition in the entry | ||||||||||||||
|
If we get here, then every condition in the entry was satisfied.
|
||||||||||||||||
| 752E | INC HL | B=number of POKEs in the entry | ||||||||||||||
| 752F | LD B,(HL) | |||||||||||||||
| 7530 | INC HL | DE=address to POKE | ||||||||||||||
| 7531 | LD E,(HL) | |||||||||||||||
| 7532 | INC HL | |||||||||||||||
| 7533 | LD D,(HL) | |||||||||||||||
| 7534 | INC HL | A=byte to POKE | ||||||||||||||
| 7535 | LD A,(HL) | |||||||||||||||
| 7536 | LD (DE),A | Do the POKE | ||||||||||||||
| 7537 | DJNZ $7530 | Jump back until every POKE has been done | ||||||||||||||
|
The entry has been processed.
|
||||||||||||||||
| 7539 | POP HL | Restore the event table entry pointer to HL | ||||||||||||||
| 753A | BIT 6,(HL) | Should this entry be deactivated now? | ||||||||||||||
| 753C | JR NZ,$7525 | Move along to the next entry if not | ||||||||||||||
| 753E | INC (HL) | Otherwise deactivate the entry by setting bit 0 of the first byte | ||||||||||||||
| 753F | JR $7525 | Move along to the next entry | ||||||||||||||
| Prev: 74D8 | Up: Map | Next: 7541 |