![]() |
Routines |
| Prev: AE96 | Up: Map | Next: AF05 |
|
Used by the routine at ENTER_ROOM.
Called while a room is built (ENTER_ROOM), after the builder. Looks through the 36 places at PLACES for any in use (a graphic) whose current room (+8) is the one he is in, and builds an object record for each in records 2 and 3 (VALVES and VALVE_SECOND) -- the two kept for them: the graphic; U, V and Z from where it is now; the half-sizes 5 by 5 and the height 12; flags $14 (drawn, can be pushed); the room; nothing moving; and at +10 the address of the place, so that the record can be written back (UPDATE_SPECIAL_OBJS). Whatever is left of the two records is cleared.
Knight Lore's find_special_objs_here, instruction for instruction; only the addresses differ. As there, nothing here stops at two: a third place in one room would be built over record 4, the room's first, and the clearing after the loop would then never meet record 4 again and would run on through memory. The 36 places start in 36 different rooms, and a thing is put down only into an empty one of the two records (TAKE_OR_LEAVE), so it does not happen (read; inferred for every way a valve can travel).
|
||||||||
| FIND_SPECIAL_OBJS_HERE | AE99 | LD DE,VALVES | DE', the record being built, in the alternate set | |||||
| AE9C | EXX | |||||||
| AE9D | LD IY,PLACES | the first place; the room | ||||||
| AEA1 | LD B,(IX+$08) | |||||||
| FIND_SPECIAL_OBJS_HERE_0 | AEA4 | LD A,(IY+$00) | not in use: skip | |||||
| AEA7 | AND A | |||||||
| AEA8 | JR Z,FIND_SPECIAL_OBJS_HERE_1 | |||||||
| AEAA | LD A,(IY+$08) | in another room: skip | ||||||
| AEAD | CP B | |||||||
| AEAE | JR NZ,FIND_SPECIAL_OBJS_HERE_1 | |||||||
| AEB0 | PUSH IY | HL = the place; its address is kept on the stack | ||||||
| AEB2 | EXX | |||||||
| AEB3 | POP HL | |||||||
| AEB4 | PUSH HL | |||||||
| AEB5 | LD A,(HL) | the graphic | ||||||
| AEB6 | INC HL | |||||||
| AEB7 | LD (DE),A | |||||||
| AEB8 | INC DE | |||||||
| AEB9 | INC HL | U, V and Z from +5 to +7, where it is now | ||||||
| AEBA | INC HL | |||||||
| AEBB | INC HL | |||||||
| AEBC | INC HL | |||||||
| AEBD | LD BC,$0003 | |||||||
| AEC0 | LDIR | |||||||
| AEC2 | EX DE,HL | 5 by 5 by 12, flags $14 | ||||||
| AEC3 | LD (HL),$05 | |||||||
| AEC5 | INC HL | |||||||
| AEC6 | LD (HL),$05 | |||||||
| AEC8 | INC HL | |||||||
| AEC9 | LD (HL),$0C | |||||||
| AECB | INC HL | |||||||
| AECC | LD (HL),$14 | |||||||
| AECE | INC HL | |||||||
| AECF | EX DE,HL | |||||||
| AED0 | LD A,(HL) | the room | ||||||
| AED1 | INC HL | |||||||
| AED2 | LD (DE),A | |||||||
| AED3 | INC DE | |||||||
| AED4 | LD B,$07 | +9 to +F: no step, nothing met | ||||||
| AED6 | CALL ZERO_DE | |||||||
| AED9 | POP BC | +10 and +11: the place | ||||||
| AEDA | LD A,C | |||||||
| AEDB | LD (DE),A | |||||||
| AEDC | INC DE | |||||||
| AEDD | LD A,B | |||||||
| AEDE | LD (DE),A | |||||||
| AEDF | INC DE | |||||||
| AEE0 | LD B,$0E | +12 to +1F cleared | ||||||
| AEE2 | CALL ZERO_DE | |||||||
| AEE5 | EXX | back to the scan's registers | ||||||
| FIND_SPECIAL_OBJS_HERE_1 | AEE6 | LD DE,$0009 | nine bytes on, until the graphic table at GRAPHICS that follows the last place | |||||
| AEE9 | ADD IY,DE | |||||||
| AEEB | PUSH IY | |||||||
| AEED | POP HL | |||||||
| AEEE | LD DE,GRAPHICS | |||||||
| AEF1 | AND A | |||||||
| AEF2 | SBC HL,DE | |||||||
| AEF4 | JR C,FIND_SPECIAL_OBJS_HERE_0 | |||||||
| AEF6 | EXX | DE = the next record to build | ||||||
| FIND_SPECIAL_OBJS_HERE_2 | AEF7 | LD HL,ROOM_OBJECTS | up to record 4, ROOM_OBJECTS | |||||
| AEFA | AND A | |||||||
| AEFB | SBC HL,DE | |||||||
| AEFD | RET Z | |||||||
| AEFE | LD B,$20 | clear the rest of the two | ||||||
| AF00 | CALL ZERO_DE | |||||||
| AF03 | JR FIND_SPECIAL_OBJS_HERE_2 | |||||||
| Prev: AE96 | Up: Map | Next: AF05 |