Prev: 34484 Up: Map Next: 34567
34512: Create list of characters in room A and load A with number of characters
The list is created at 23404.
Used by the routine at 34122.
A Room index
A Number of characters in room
F Zero flag set if no characters in room, reset otherwise
34512 LD (34541),A Modify instruction at 34540 with room index
34515 PUSH HL Store HL
34516 PUSH BC Store BC
34517 PUSH DE Store DE
34518 PUSH IX Store IX
34520 LD A,255 Set A to 255 (end marker)
34522 LD HL,23419 Point HL at end of table of characters in room of interest
34525 LD B,15 Load B with 15 (as we are clearing 15 entries in the list)
34527 LD (HL),A Set value at address in HL to 255
34528 DEC HL Move HL back one byte
34529 DJNZ 34527 Loop back to 34527
34531 LD IX,25244 Point IX at start of table of characters' current positions at 25244
34535 LD D,0 Set D (index of current character) to zero
34537 LD C,D Set C (count of characters in room of interest) to zero
34538 LD B,12 Load B with 12 (as there are 12 characters in the game)
The operand of the instruction at 34540 represents a room index. This is modified by the instruction at 34512.
34540 LD A,0 Load A with room index
34542 CP (IX+0) If current character's current room is not the room of interest...
34545 JR NZ,34550 ...then skip ahead to 34550
34547 INC C Increase C (count of number of characters in room of interest)
34548 LD (HL),D Load index of current character into address in HL
34549 INC HL Advance HL by one byte
34550 INC IX Advance IX to next character's position data...
34552 INC IX ...
34554 INC IX ...
34556 INC D Increase index of current character (i.e. advance to next character)
34557 DJNZ 34540 Loop back to 34540
34559 LD A,C Load number of characters in room of interest into A
34560 OR A Set zero flag is there are no characters in room, otherwise reset
34561 POP IX Restore IX
34563 POP DE Restore DE
34564 POP BC Restore BC
34565 POP HL Restore HL
34566 RET Return
Prev: 34484 Up: Map Next: 34567