Routines| A | Door identifier (see table below) |
| B | 0 (close door) or 1 (open door) |
| 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 |
| 28736 | E5 | PUSH HL | |
| 28737 | 21F47F | LD HL,32756 | |
| 28740 | 4F | LD C,A | |
| 28741 | 7E | LD A,(HL) | Pick up the doors flags |
| 28742 | B1 | OR C | |
| 28743 | 05 | DEC B | |
| 28744 | 2801 | JR Z,28747 | Jump if we're opening the door |
| 28746 | A9 | XOR C | |
| 28747 | 77 | LD (HL),A | Restore the doors flags with appropriate bit set/reset |
| 28748 | 79 | LD A,C | A=door identifier (see 29052) |
| 28749 | 2155E1 | LD HL,57685 | |
| 28752 | 2C | INC L |
Point HL at the appropriate place in the table at 57686 |
| 28753 | 2C | INC L | |
| 28754 | 0F | RRCA | |
| 28755 | 30FB | JR NC,28752 | |
| 28757 | 7E | LD A,(HL) | |
| 28758 | 88 | ADC A,B | Add 1 if opening the door/window |
| 28759 | 2D | DEC L | |
| 28760 | 6E | LD L,(HL) | |
| 28761 | 67 | LD H,A | Now HL=address from table at 57686 (+256 if opening) |
| 28762 | CD186C | CALL 27672 | Alter UDG references in play area and update SRB for newly opened/closed door/window |
| 28765 | E1 | POP HL | |
| 28766 | C9 | 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 |