| Routines

35090: Initialise the current room

Used by the routines at 35591 (to teleport into a room), 35841 (to reinitialise the room after Willy has lost a life), 38026 (when Willy has entered the room from the right), 38046 (when Willy has entered the room from the left), 38064 (when Willy has entered the room from below) and 38098 (when Willy has entered the room from above). The routine at 35068 also continues here.
35090 | LD A,(33824) | Pick up the current room number from 33824
35093 | OR 192 | Point HL at the first byte of the room definition
35095 | LD H,A
35096 | LD L,0
35098 | LD DE,32768 | Copy the room definition into the game status buffer at 32768
35101 | LD BC,256
35104 | LDIR
35106 | LD IX,33008 | Point IX at the first byte of the first entity specification for the current room at 33008
35110 | LD DE,33024 | Point DE at the first byte of the first entity buffer at 33024; this instruction is redundant, since DE already holds 33024
35113 | LD A,8 | There are at most eight entities in a room
35115 | LD L,(IX+0) | Pick up the first byte of the entity specification
35118 | RES 7,L | Point HL at the corresponding entry in the table of entity definitions at 40960
35120 | LD H,20
35122 | ADD HL,HL
35123 | ADD HL,HL
35124 | ADD HL,HL
35125 | LD BC,2 | Copy the first two bytes of the entity definition into the entity buffer
35128 | LDIR
35130 | LD C,(IX+1) | Copy the second byte of the entity specification into the third byte of the entity definition
35133 | LD (HL),C
35134 | LD BC,6 | Copy the remaining six bytes of the entity definition into the entity buffer
35137 | LDIR
35139 | INC IX | Point IX at the first byte of the next entity specification
35141 | INC IX
35143 | DEC A | Have we copied all eight entity definitions into the entity buffers yet?
35144 | JR NZ,35115 | If not, jump back to copy the next one
35146 | LD HL,34255 | Copy the seven bytes that define Willy's state (position, animation frame etc.) on entry to this room from 34255-34261 to 34263
35149 | LD DE,34263
35152 | LD BC,7
35155 | LDIR
35157 | CALL 36147 | Draw the current room to the screen buffer at 28672 and the attribute buffer at 24064
35160 | LD HL,20480 | Clear the bottom third of the display file
35163 | LD DE,20481
35166 | LD BC,2047
35169 | LD (HL),0
35171 | LDIR
35173 | LD IX,32896 | Print the room name (see 32896) at (16,0)
35177 | LD C,32
35179 | LD DE,20480
35182 | CALL 38528
35185 | LD IX,34132 | Print "Items collected 000 Time 00:00 m" (see 34132) at (19,0)
35189 | LD DE,20576
35192 | LD C,32
35194 | CALL 38528
35197 | LD A,(32990) | Pick up the border colour for the current room from 32990
35200 | LD C,254 | Set the border colour
35202 | OUT (C),A
35204 | XOR A | Initialise the rope status indicator at 34262 to 0
35205 | LD (34262),A
35208 | JP 35245 | Enter the main loop