Routines

26453: Collect information about a blackboard


Used by routines at 24133, 26513, 26752, 28658 and 61696. If the character is not standing at a blackboard, the routine returns with the carry flag set. Otherwise the routine returns with B holding the blackboard identifier (84, 90, 96, 102, 108) and DE holding the coordinates of the top left-hand square of the board.

H Number of character interested in the board

26453 0603 LD B,3 Three blackboards on the top floors
26455 1137D3 LD DE,54071 Point DE at the blackboard info table (see below)
26458 2E02 LD L,2
26460 7E LD A,(HL) A=character's y-coordinate
26461 2D DEC L
26462 B8 CP B Is the character on the top floor?
26463 2807 JR Z,26472 Jump if so
26465 1E3A LD E,58
26467 05 DEC B B=2 (two blackboards on the middle floor)
26468 FE0A CP 10 Is the character on the middle floor?
26470 200C JR NZ,26484 Jump if not
26472 1A LD A,(DE) A=x-coordinate of left end of a blackboard
26473 BE CP (HL) Is the character to the left of this blackboard?
26474 3008 JR NC,26484 Jump if so
26476 C6n 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 BE CP (HL)
26479 3005 JR NC,26486 Jump if so
26481 1C INC E Next blackboard
26482 10F4 DJNZ 26472
26484 37 SCF Signal: character not standing at a blackboard
26485 C9 RET
26486 EB EX DE,HL Now HL points to the blackboard info table
26487 7E LD A,(HL) A=x-coordinate of left end of blackboard
26488 24 INC H
26489 46 LD B,(HL) B=blackboard identifier (84, 90, 96, 102 or 108)
26490 24 INC H
26491 66 LD H,(HL) H=y-coordinate of top row of blackboard
26492 6F LD L,A Pass the x-coordinate to L
26493 A7 AND A Clear carry flag to indicate success
26494 EB EX DE,HL
26495 C9 RET

The contents of the blackboard info table are as follows:
x ID y
D=211 D=212 D=213 Room
E=55 3 84 3 Blue room
E=56 41 90 3 Yellow room
E=57 161 96 3 Top-floor room in girls' skool
E=58 32 102 9 Science lab
E=59 161 108 9 Middle-floor room in girls' skool