![]() |
Routines |
| 1 | Left study door | 2 | Right study door | 4 | Science lab storeroom door | 8 | Boys' skool door | 16 | Skool gate | 32 | Drinks cabinet door | 64 | Top floor window | 128 | Middle floor window |
| A | Door identifier (see table above) |
| B | 0 (close door) or 1 (open door) |
| 28736 | PUSH HL | |
| 28737 | LD HL,32756 | 32756 holds the doors flags |
| 28740 | LD C,A | Copy the door identifier to C |
| 28741 | LD A,(HL) | Pick up the doors flags in A |
| 28742 | OR C | |
| 28743 | DEC B | Are we opening the door/window? |
| 28744 | JR Z,28747 | Jump if so |
| 28746 | XOR C | |
| 28747 | LD (HL),A | Restore the doors flags with the appropriate bit set or reset |
| 28748 | LD A,C | A=door identifier |
| 28749 | LD HL,57685 | Point HL at the appropriate entry in the doors and windows table at 57686 (see below) |
| 28752 | INC L | |
| 28753 | INC L | |
| 28754 | RRCA | |
| 28755 | JR NC,28752 | |
| 28757 | LD A,(HL) | Pick up the MSB of the entry in A |
| 28758 | ADC A,B | Add 1 if opening the door/window |
| 28759 | DEC L | Point HL at the LSB of the entry |
| 28760 | LD L,(HL) | Pick this up in L |
| 28761 | LD H,A | Now HL=address from the doors and windows table (+256 if opening) |
| 28762 | CALL 27672 | Alter UDG references in play area and update SRB for the newly opened/closed door/window |
| 28765 | POP HL | |
| 28766 | RET |
| Address | Contents | Door/window | 57686 | 56637 | Left study door | 57688 | 57088 | Right study door | 57690 | 56576 | Science lab storeroom door | 57692 | 57149 | Boys' skool door | 57694 | 63744 | Skool gate | 57696 | 56064 | Drinks cabinet door | 57698 | 55040 | Top floor window | 57700 | 55552 | Middle floor window |
|---|