![]() |
Routines |
| H | Number of character interested in the board |
| 26453 | LD B,3 | Three blackboards on the top floors |
| 26455 | LD DE,54071 | Point DE at the blackboard info table (see below) |
| 26458 | LD L,2 | Byte 2 holds the character's y-coordinate |
| 26460 | LD A,(HL) | Pick this up in A |
| 26461 | DEC L | L=1 |
| 26462 | CP B | Is the character on the top floor? |
| 26463 | JR Z,26472 | Jump if so |
| 26465 | LD E,58 | |
| 26467 | DEC B | B=2 (two blackboards on the middle floor) |
| 26468 | CP 10 | Is the character on the middle floor? |
| 26470 | JR NZ,26484 | Jump if not |
| 26472 | LD A,(DE) | A=x-coordinate of the left end of a blackboard |
| 26473 | CP (HL) | Is the character to the left of this blackboard? |
| 26474 | JR NC,26484 | Jump if so |
| 26476 | ADD A,n | Is the character within n character spaces (n=4 usually, or 12 if coming from 28658) of the left of this blackboard? |
| 26478 | CP (HL) | |
| 26479 | JR NC,26486 | Jump if so |
| 26481 | INC E | Next blackboard |
| 26482 | DJNZ 26472 | |
| 26484 | SCF | Signal: the character is not standing at a blackboard |
| 26485 | RET |
| 26486 | EX DE,HL | Now HL points to the blackboard info table |
| 26487 | LD A,(HL) | A=x-coordinate of the left end of the blackboard |
| 26488 | INC H | |
| 26489 | LD B,(HL) | B=blackboard identifier (84, 90, 96, 102 or 108) |
| 26490 | INC H | |
| 26491 | LD H,(HL) | H=y-coordinate of the top row of the blackboard |
| 26492 | LD L,A | Pass the x-coordinate to L |
| 26493 | AND A | Clear the carry flag to indicate success |
| 26494 | EX DE,HL | DE=coordinates of the top-left corner of the blackboard |
| 26495 | RET |