Prev: 38295 Up: Map Next: 39032
38966: Populate primary display buffer with layout data for current character's current room
Used by the routine at GameStart.
PopulatePrimaryDisplay_LayoutData 38966 LD HL,(28102) Self-modifying code; alter the value for the LD HL instruction at 39112 with the address at PrimaryDisplayBuffer.
38969 LD (39113),HL
38972 LD A,(28063) Load C with TempStore_RoomDimension_Depth.
38975 LD C,A
38976 LD A,(28042) Load B with CurrentRoomIndex.
38979 LD B,A
38980 LD D,0 Load D with 0.
Start drawing simple entities.
DrawSimpleEntities 38982 LD IX,(28015) Load IX with the start address of StateData_SimpleEntities.
38986 LD E,6 Load DE with 6 (as simple state data entries are 6 bytes wide).
DrawSimpleEntities_Loop 38988 LD A,(IX+0) Load first byte of current simple state data entry into A.
38991 CP 255 If this is 255 (end marker for complex state data) then skip ahead to DecreaseDepth.
38993 JR Z,DecreaseDepth
38995 CP 254 If it is not 254 (end marker for simple state data) then skip ahead to PopulatePrimaryDisplay_LayoutData_0.
38997 JR NZ,PopulatePrimaryDisplay_LayoutData_0
38999 SLA E
39001 INC IX Advance IX to start of complex state data block.
39003 LD A,(IX+0) Load A with entity's room index.
At this point, A holds the index of the room to which the simple or complex entity belongs.
PopulatePrimaryDisplay_LayoutData_0 39006 CP B If entity's room is not the same as the current character's current room then skip ahead to PrimaryDisplay_NextData.
39007 JR NZ,PrimaryDisplay_NextData
39009 LD A,C If entity's depth is not the same as current depth in C then skip ahead to PrimaryDisplay_NextData.
39010 CP (IX+1)
39013 JR NZ,PrimaryDisplay_NextData
39015 EXX Switch to the shadow registers.
39016 PUSH IX Stash IX on the stack.
39018 CALL 39032 Call 39032.
39021 POP IX Restore IX from the stack.
39023 EXX Switch back to the normal registers.
PrimaryDisplay_NextData 39024 ADD IX,DE Advance IX to next entity's state data.
39026 JR DrawSimpleEntities_Loop Loop back to DrawSimpleEntities_Loop.
DecreaseDepth 39028 DEC C Decrease current depth (i.e. closer to screen).
39029 JR NZ,DrawSimpleEntities If depth is not zero (i.e. still depth levels to process) then loop back to DrawSimpleEntities.
39031 RET Return.
Prev: 38295 Up: Map Next: 39032