![]() |
Routines |
| Prev: E89B | Up: Map | Next: EB1A |
|
Used by the routine at MORE_ROOM_COMMANDS.
Walks the whole object table (OBJECTS) and makes a record (PLACE_OBJECT) for every entry whose room is ROOM, in the table's order, from FREE_RECORD on. First every record from there to the end of the area (RECORDS; the clean copy begins where it ends) is cleared.
An entry is a room, a type and four more bytes for a type below $46 -- the things, which can be moved and carried from room to room -- or nine for the rest (doors, walls and the like); $FF ends the table. A thing's record also gets its number in the table, counting from 1, at +19: the code that moves a thing to another room or into the knight's hands writes its new room into its entry by that number (SET_THING_ROOM). The number is a byte, which is enough because the 163 things come first.
Called once in each drawing of a room, by MORE_ROOM_COMMANDS's $E4 $04 or $E4 $05. The most records a room's drawing makes is 30 (room 71), besides the knight's and the five carried; the area has room for 43 (measured, in rooms 1-80).
|
||||
| PLACE_ROOM_OBJECTS | EACC | LD IX,(FREE_RECORD) | clear the records from the next free one to the end of the area | |
| EAD0 | LD HL,(FREE_RECORD) | |||
| EAD3 | LD (HL),$00 | |||
| EAD5 | LD DE,(FREE_RECORD) | |||
| EAD9 | INC DE | |||
| EADA | PUSH HL | |||
| EADB | LD HL,LOADING_TUNE | |||
| EADE | AND A | |||
| EADF | SBC HL,DE | |||
| EAE1 | PUSH HL | |||
| EAE2 | POP BC | |||
| EAE3 | POP HL | |||
| EAE4 | LDIR | |||
| EAE6 | LD HL,(OBJECT_TABLE_AT) | from the start of the table, numbering the entries | ||
| EAE9 | LD (IY+PLACED_NUMBER-V),$00 | |||
| PLACE_ROOM_OBJECTS_0 | EAED | LD A,(HL) | the entry's room; $FF ends the table | |
| EAEE | INC HL | |||
| EAEF | CP $FF | |||
| EAF1 | RET Z | |||
| EAF2 | INC (IY+PLACED_NUMBER-V) | count it; this room? | ||
| EAF5 | CP (IY+ROOM-V) | |||
| EAF8 | JR Z,PLACE_ROOM_OBJECTS_2 | |||
| EAFA | LD DE,$0005 | no: past it, six bytes or eleven by its type | ||
| EAFD | LD A,(HL) | |||
| EAFE | CP $46 | |||
| EB00 | JR C,PLACE_ROOM_OBJECTS_1 | |||
| EB02 | LD DE,$000A | |||
| PLACE_ROOM_OBJECTS_1 | EB05 | ADD HL,DE | ||
| EB06 | JR PLACE_ROOM_OBJECTS_0 | |||
| PLACE_ROOM_OBJECTS_2 | EB08 | CALL PLACE_OBJECT | yes: make its record | |
| EB0B | LD A,(PLACED_TYPE) | a thing: its number in the table at +19 | ||
| EB0E | CP $46 | |||
| EB10 | JR NC,PLACE_ROOM_OBJECTS_0 | |||
| EB12 | LD A,(PLACED_NUMBER) | |||
| EB15 | LD (IX+OBJ_NUMBER-OBJ_SIZE),A | |||
| EB18 | JR PLACE_ROOM_OBJECTS_0 | |||
| Prev: E89B | Up: Map | Next: EB1A |