![]() |
Routines |
| Prev: 75F6 | Up: Map | Next: 76BC |
| 7603 | LD HL,$E601 | Point HL at byte 0x01 of Sam's buffer | ||
| 7606 | LD C,(HL) | C=Sam's x-coordinate | ||
| 7607 | INC L | L=0x02 | ||
| 7608 | LD B,(HL) | B=Sam's y-coordinate | ||
| 7609 | LD HL,$7D1C | Point HL at the object location table at 7D1C | ||
| 760C | LD A,(HL) | Collect the first byte of an entry | ||
| 760D | INC A | Have we reached the end of the table? | ||
| 760E | JR Z,$763C | Jump if so | ||
| 7610 | INC HL | Move HL to the second byte of the entry | ||
| 7611 | AND $02 | Is this entry active? | ||
| 7613 | JR NZ,$761F | Proceed to the next entry if not | ||
| 7615 | LD A,(HL) | A=x-coordinate of the object | ||
| 7616 | CP C | Is Sam's x-coordinate the same? | ||
| 7617 | JR NZ,$761F | Jump if not | ||
| 7619 | INC HL | Move HL to the third byte of the entry | ||
| 761A | LD A,(HL) | A=y-coordinate of the object | ||
| 761B | CP B | Set the zero flag if Sam's y-coordinate is the same | ||
| 761C | DEC HL | Move HL back to the second byte of the entry | ||
| 761D | JR Z,$7624 | Jump if Sam's coordinates match the object's | ||
| 761F | INC HL | Point HL at the first byte of the next entry | ||
| 7620 | INC HL | |||
| 7621 | INC HL | |||
| 7622 | JR $760C | Jump back to check the next entry | ||
|
Sam's coordinates match those of the object. Is it the hook or the budgie?
|
||||
| 7624 | DEC HL | Move HL back to the first byte of the entry | ||
| 7625 | BIT 6,(HL) | Is this entry for an object that can be picked up (i.e. the hook or the budgie)? | ||
| 7627 | JR Z,$763F | Jump if not | ||
| 7629 | LD A,($E600) | A=Sam's animatory state | ||
| 762C | AND $7F | Discard bit 7 (the direction bit) | ||
| 762E | CP $06 | 0x06: Is Sam bending his knees? | ||
| 7630 | JR NZ,$763E | Jump if not | ||
| 7632 | INC (HL) | Increment the first byte of the entry (thus deactivating it) | ||
| 7633 | INC HL | Point HL at the fourth byte of the entry | ||
| 7634 | INC HL | |||
| 7635 | INC HL | |||
| 7636 | LD A,(HL) | Pick up the fourth byte of the entry | ||
| 7637 | LD HL,$7FE9 | Set the appropriate bit at 7FE9 to give Sam the object | ||
| 763A | OR (HL) | |||
| 763B | LD (HL),A | |||
| 763C | JR $7683 | Jump forward to update the icon panel | ||
| 763E | DEC (HL) | Decrement the first byte of the entry | ||
| 763F | INC (HL) | Increment the first byte of the entry (thus deactivating it if it's not the hook or the budgie) | ||
| 7640 | LD A,(HL) | A=first byte of the entry | ||
| 7641 | INC HL | Point HL at the fourth byte of the entry | ||
| 7642 | INC HL | |||
| 7643 | INC HL | |||
| 7644 | PUSH HL | Save the object table entry pointer | ||
| 7645 | PUSH BC | Save Sam's coordinates | ||
| 7646 | BIT 6,A | Is this entry for an object that can be picked up (i.e. the hook or the budgie)? | ||
| 7648 | JR Z,$7654 | Jump if not | ||
| 764A | LD A,(HL) | A=fourth byte of the entry | ||
| 764B | LD HL,$7FA8 | Store the object ID at 7FA8 for now | ||
| 764E | LD (HL),A | |||
| 764F | POP BC | Restore Sam's coordinates to BC | ||
| 7650 | POP HL | Restore the object table entry pointer to HL | ||
| 7651 | INC HL | Point HL at the first byte of the next entry | ||
| 7652 | JR $760C | Jump back to check the next entry | ||
|
It's not the hook or the budgie. Does a message need to be displayed?
|
||||
| 7654 | BIT 5,A | Is this entry for a message that needs to be displayed? | ||
| 7656 | JR Z,$765E | Jump if not | ||
| 7658 | LD A,(HL) | A=message number | ||
| 7659 | CALL $6EC5 | Queue the message | ||
| 765C | JR $764F | Jump back to check the next entry | ||
|
It's not the hook, the budgie or a message. Is it a key?
|
||||
| 765E | BIT 4,A | Is this entry for a key? | ||
| 7660 | JR Z,$7671 | Jump if not | ||
| 7662 | LD A,(HL) | A=key identifier (0x08, 0x10, 0x20 or 0x40) | ||
| 7663 | LD HL,$7FEA | Set the appropriate bit at 7FEA, thus giving Sam the key | ||
| 7666 | OR (HL) | |||
| 7667 | LD (HL),A | |||
| 7668 | LD A,$64 | $100 to add to Sam's cash supply | ||
| 766A | JR $7672 | |||
| 766C | INC D | This block of code is never executed | ||
| 766D | LD D,$02 | |||
| 766F | JR $767C | |||
|
If it's not the hook, the budgie, a message or a key, it must be cash.
|
||||
| 7671 | LD A,(HL) | A=number of bucks | ||
| 7672 | CALL $6E92 | Add this to Sam's total | ||
| 7675 | LD HL,$1406 | Prepare the cash bonus sound effect parameters | ||
| 7678 | LD C,$90 | |||
| 767A | LD D,$01 | |||
| 767C | LD A,$02 | |||
| 767E | CALL $7565 | Make a sound effect | ||
| 7681 | JR $764F | Jump back to check the next entry | ||
|
Now we set the attribute bytes for the budgie and hook in the icon panel.
|
||||
| 7683 | LD HL,$7FA8 | 7FA8 holds the ID of the object Sam is standing next to (if any) | ||
| 7686 | LD A,(HL) | A=object ID | ||
| 7687 | LD (HL),$00 | Reset 7FA8 to 0 | ||
| 7689 | LD L,$E9 | HL=7FE9 (object inventory) | ||
| 768B | LD H,(HL) | H=object inventory flags | ||
| 768C | LD L,A | L=ID of the object Sam is standing next to (if any) | ||
| 768D | LD E,$B0 | 0xB0 is the LSB of 5AB0 (the attribute file address for the top-left tile of the budgie icon) | ||
| 768F | LD BC,$0602 | B=6, C=2 (2 objects: budgie and hook) | ||
| 7692 | RL L | Move an object ID bit (if any) into bit 0 of H, and an object inventory flag into the carry flag | ||
| 7694 | RL H | |||
| 7696 | LD A,$30 | 0x30=PAPER 6: INK 0 | ||
| 7698 | JR C,$76A0 | Jump if Sam already has this object | ||
| 769A | ADD A,B | A=0x38 (INK 6: PAPER 6) | ||
| 769B | BIT 0,H | Is Sam standing next to this object? | ||
| 769D | JR Z,$76A0 | Jump if not | ||
| 769F | LD A,B | A=0x06 (INK 6: PAPER 0) | ||
| 76A0 | CALL $7025 | Set the attribute bytes for the object in the icon panel | ||
| 76A3 | LD E,$B2 | 0xB2 is the LSB of 5AB2 (the attribute file address for the top-left tile of the hook icon) | ||
| 76A5 | DEC C | Have we dealt with both objects yet? | ||
| 76A6 | JR NZ,$7692 | Jump back to deal with the second object if not | ||
|
Now we display the keys Sam has found.
|
||||
| 76A8 | LD A,($7FEA) | Pick up the key inventory flags from 7FEA | ||
| 76AB | ADD A,A | Move bits 3-6 into bits 4-7 (thus discarding bit 7, which corresponds to the key to no. 19) | ||
| 76AC | LD BC,$0430 | B=4 (there are 4 keys), C=0x30 (INK 6: PAPER 0) | ||
| 76AF | LD HL,$5AF0 | Point HL at the attribute byte for the leftmost key in the icon panel | ||
|
This entry point is used by the routine at 7414 with HL=5AE8 (attribute byte for the leftmost first aid kit in the icon panel) and C=0x32 (INK 2: PAPER 6).
|
||||
| 76B2 | LD (HL),$36 | Set the attribute byte to 0x36 (INK 6: PAPER 6) by default | ||
| 76B4 | ADD A,A | Should there be a first aid kit or key displayed here? | ||
| 76B5 | JR NC,$76B8 | Jump if not | ||
| 76B7 | LD (HL),C | Otherwise reveal the first aid kit or key by setting the attribute byte to 0x32 (INK 2: PAPER 6) or 0x30 (INK 6: PAPER 0) | ||
| 76B8 | INC L | Move HL to the attribute byte for the next first aid kit or key | ||
| 76B9 | DJNZ $76B2 | Jump back until all the first aid kits or keys have been done | ||
| 76BB | RET | |||
| Prev: 75F6 | Up: Map | Next: 76BC |