| Routines

717C: Make a character open or close a door

Used by command lists 0x16, 0x18, 0x1A, 0x1C, 0x4C and 0x4E. This routine works on two parameters. First the door identifier:
ID | Door | Command lists
--- | --- | ---
0x08 | Boys' skool door | 0x4C, 0x4E
0x10 | Skool gate | 0x4C, 0x4E
0x20 | Drinks cabinet door | 0x16, 0x18, 0x1A, 0x1C
And then the action identifier:
0 | Close it
1 | Open it
Input
H | 0xCC (MISS TAKE) or 0xCD (ALBERT)
717C | LD L,$03 | Replace the address of this routine in bytes 0x03 and 0x04 of the character's buffer with 7185 (below)
717E | LD (HL),$85
7180 | LD L,$13 | Copy the door identifier and open/close parameter from the command list into bytes 0x13 and 0x14 of the character's buffer
7182 | CALL $6264
7185 | LD L,$13 |
7187 | LD A,(HL) | A=door identifier
7188 | CP $08 | Is it the boys' skool door?
718A | JR NZ,$71AD | Jump if not
718C | LD A,($D301) | A=x-coordinate of the bike
718F | CP $5E | Is the bike in the boys' skool?
7191 | JR C,$719F | Jump if so
7193 | LD DE,$1160 | (E,D)=(96,17)
This entry point is used by the routine at 71AD with (E,D)=(136,17):
7196 | CP E | Set the carry flag if the bike is blocking the way
7197 | LD A,($D300) | A=bike's animatory state
719A | CALL C,$6780 | Move the bike to the location in DE if it's blocking the boys' skool door or the skool gate
719D | LD H,$CD | 0xCD=ALBERT
This entry point is used by the routine at 71AD.
719F | LD L,$04 | Remove the address of this routine from bytes 0x03 and 0x04 of the character's buffer
71A1 | LD (HL),$00
71A3 | JP $70A8 | Open or close the door