Prev: 35887 Up: Map Next: 35993
35931: Get number of characters in room A and load their indices into list
Used by the routine at 35141.
Input
A Room number
Output
A number of characters in room A (input)
C number of characters in room A (input)
F Zero flag reset if characters are present in room, set otherwise
35931 LD (35967),A Store room index in instruction at 35966
35934 PUSH HL Store HL
35935 PUSH BC Store BC
35936 PUSH DE Store DE
35937 PUSH IX Store IX
35939 LD A,255 Load A with 255
35941 LD HL,23466 Clear list of indices of characters in current room...
35944 LD (HL),A ...
35945 DEC HL ...
35946 LD (HL),A ...
35947 DEC HL ...
35948 LD (HL),A ...
35949 LD IX,25440 Point IX at characters' current positions table
35953 LD D,0 Set D to zero
35955 LD BC,1792 Set B to 7 (as we have seven characters, excluding Banshee so loop back seven times) and C to 0
35958 LD A,(23467) If Banshee has not been released, then...
35961 BIT 0,A ...
35963 JR Z,35966 ...skip ahead to 35966...
35965 INC B ...else increase B by one to take into account presence of Banshee
The operand of the instruction at 35966 represents the appropriate room index. This is modified by the instruction at 35931.
35966 LD A,0 Load A with room number
35968 CP (IX+0) Compare to room number of current character...
35971 JR NZ,35976 ...and if not the same, then jump to 35976 (i.e. move onto next character)
35973 INC C Increase C (number of characters in current room) by one
35974 LD (HL),D Store character index in list at 23464
35975 INC HL
35976 INC IX Advance IX by three bytes, to next character's entry...
35978 INC IX ...
35980 INC IX ...
35982 INC D Increase D (index of current character)
35983 DJNZ 35966 Loop back for next character
35985 LD A,C Load A with number of characters in current room
35986 OR A Set zero flag if no characters present
35987 POP IX Restore IX
35989 POP DE Restore DE
35990 POP BC Restore BC
35991 POP HL Restore HL
35992 RET Return
Prev: 35887 Up: Map Next: 35993