Routines |
Prev: 670C | Up: Map | Next: 6780 |
Used by the routines at 5E45, 6791, 6880, 6FF2 and F100. If the character is not standing at a blackboard, the routine returns with the carry flag set. Otherwise the routine returns with the carry flag reset, B holding the blackboard identifier (the LSB of 7F54, 7F5A, 7F60, 7F66 or 7F6C), and DE holding the coordinates of the top left-hand square of the board.
|
||||||||
6755 | LD B,$03 | There are three blackboards on the top floors | ||||||
6757 | LD DE,$D337 | The table at D337 contains the x-coordinates of the left edges of the blackboards | ||||||
675A | LD L,$02 | Byte 0x02 of the character's buffer holds his y-coordinate | ||||||
675C | LD A,(HL) | Pick this up in A | ||||||
675D | DEC L | L=0x01 | ||||||
675E | CP B | Is the character on the top floor? | ||||||
675F | JR Z,$6768 | Jump if so | ||||||
6761 | LD E,$3A | DE=D33A | ||||||
6763 | DEC B | B=2 (two blackboards on the middle floors) | ||||||
6764 | CP $0A | Is the character on the middle floor? | ||||||
6766 | JR NZ,$6774 | Jump if not | ||||||
6768 | LD A,(DE) | A=x-coordinate of the left edge of a blackboard | ||||||
6769 | CP (HL) | Is the character to the left of this blackboard? | ||||||
676A | JR NC,$6774 | Jump if so | ||||||
676C | ADD A,$04 | Is the character no more than 4 (or 12, if coming from 6FF2) spaces to the right of the left edge of this blackboard? | ||||||
676E | CP (HL) | |||||||
676F | JR NC,$6776 | Jump if so | ||||||
6771 | INC E | Next blackboard | ||||||
6772 | DJNZ $6768 | |||||||
6774 | SCF | Signal: the character is not standing at a blackboard | ||||||
6775 | RET | |||||||
The character is standing close enough to the blackboard (to either write on it or start wiping it).
|
||||||||
6776 | EX DE,HL | Now HL points to the blackboard info table | ||||||
6777 | LD A,(HL) | A=x-coordinate of the left edge of the blackboard (from the table at D337) | ||||||
6778 | INC H | |||||||
6779 | LD B,(HL) | B=blackboard identifier (from the table at D437) | ||||||
677A | INC H | |||||||
677B | LD H,(HL) | H=y-coordinate of the top row of the blackboard (from the table at D537) | ||||||
677C | LD L,A | Pass the x-coordinate to L | ||||||
677D | AND A | Clear the carry flag to indicate success | ||||||
677E | EX DE,HL | DE=coordinates of the top-left corner of the blackboard | ||||||
677F | RET | |||||||
Prev: 670C | Up: Map | Next: 6780 |