Routines |
Prev: 7040 | Up: Map | Next: 708C |
Used by the routines at 64F3 and 708E. Returns with the carry flag set if the character is facing a closed door, and C holding the door identifier:
|
||||||||||||||||||||
705F | LD L,$00 | Pick up the character's animatory state in A | ||||||||||||||||||
7061 | LD A,(HL) | |||||||||||||||||||
7062 | RLCA | Set A=-1 if the character is facing left, 1 if facing right | ||||||||||||||||||
7063 | CCF | |||||||||||||||||||
7064 | SBC A,A | |||||||||||||||||||
7065 | ADD A,A | |||||||||||||||||||
7066 | INC A | |||||||||||||||||||
7067 | INC L | Byte 0x01 of the character's buffer holds his x-coordinate | ||||||||||||||||||
7068 | ADD A,(HL) | Add this to A | ||||||||||||||||||
7069 | LD E,A | E=x-coordinate of the location directly in front of the character | ||||||||||||||||||
706A | INC L | L=0x02 | ||||||||||||||||||
706B | LD D,(HL) | Pick up the character's y-coordinate in D | ||||||||||||||||||
706C | PUSH HL | |||||||||||||||||||
706D | LD HL,$B93E | B93E is the address of the door location table | ||||||||||||||||||
7070 | LD BC,$0501 | B=5 (there are 5 doors), C=1 (the left study door is the first one) | ||||||||||||||||||
7073 | LD A,E | A=x-coordinate of the location directly in front of the character | ||||||||||||||||||
7074 | CP (HL) | Compare this with the x-coordinate of the door | ||||||||||||||||||
7075 | INC HL | |||||||||||||||||||
7076 | JR NZ,$707C | Jump if the x-coordinates don't match | ||||||||||||||||||
7078 | LD A,D | A=character's y-coordinate | ||||||||||||||||||
7079 | CP (HL) | Compare this with the y-coordinate of the door | ||||||||||||||||||
707A | JR Z,$7084 | Jump if they match (the character is standing at this door) | ||||||||||||||||||
707C | INC HL | |||||||||||||||||||
707D | RLC C | Move the set bit in C one place to the left | ||||||||||||||||||
707F | DJNZ $7073 | Jump back to consider the remaining doors | ||||||||||||||||||
7081 | POP HL | |||||||||||||||||||
7082 | XOR A | Reset the carry flag: there is no door in front of the character | ||||||||||||||||||
7083 | RET | |||||||||||||||||||
The character is standing in front of a door.
|
||||||||||||||||||||
7084 | LD A,($7FF4) | Pick up the doors flags from 7FF4 | ||||||||||||||||||
7087 | AND C | Check the bit corresponding to the door | ||||||||||||||||||
7088 | POP HL | |||||||||||||||||||
7089 | RET NZ | Return with the carry flag reset if the door is open | ||||||||||||||||||
708A | SCF | Set the carry flag: the door is closed | ||||||||||||||||||
708B | RET |
Prev: 7040 | Up: Map | Next: 708C |