![]() |
Routines |
| Prev: 40879 | Up: Map | Next: 41040 |
|
Used by the routine at Message_ListWithASeparator.
Remembers the separator at 34463 and walks the objects here, skipping any with no copies left.
|
||||
| Message_RememberTheSeparator | 40903 | PUSH HL | Save HL and keep the id in L. | |
| 40904 | LD L,A | |||
| 40905 | LD A,(34463) | Read the space count. | ||
| 40908 | LD H,A | Keep the space count. | ||
| 40909 | LD A,D | Store D in the space count. | ||
| 40910 | LD (34463),A | |||
| 40913 | LD A,L | Take the id back into A. | ||
| 40914 | EX (SP),HL | Swap the id and the saved separator with HL on the stack. | ||
| 40915 | PUSH IX | Point IX at the slot before the object table. | ||
| 40917 | LD IX,49248 | |||
| Message_RememberTheSeparator_Loop | 40921 | CALL Table_FindTheRecord | Call Table_FindTheRecord to find the record. | |
| 40924 | JR Z,Message_RememberTheSeparator_RestoreTheSeparator | Jump to Message_RememberTheSeparator_RestoreTheSeparator when the object search returns with the zero flag set. | ||
| 40926 | CP (IY+1) | Jump back to Message_RememberTheSeparator_Loop unless this object is inside the one in A. | ||
| 40929 | JR NZ,Message_RememberTheSeparator_Loop | |||
| 40931 | PUSH AF | Save A, then increment it (the zero flag is set if it was 255). | ||
| 40932 | INC A | |||
| 40933 | LD E,(IY+0) | Read the copy count from the object record. | ||
| 40936 | JR NZ,Message_RememberTheSeparator_TestTheLocation | Jump to Message_RememberTheSeparator_TestTheLocation unless A was 255. | ||
| 40938 | LD A,1 | Jump to Message_RememberTheSeparator_FindTheRecord unless this object has one copy. | ||
| 40940 | CP E | |||
| 40941 | JR NZ,Message_RememberTheSeparator_FindTheRecord | |||
| Message_RememberTheSeparator_TestTheLocation | 40943 | LD A,(IY+16) | Read the location from IY. | |
| 40946 | CP B | Jump to Message_RememberTheSeparator_TestWhoseTurn if the object is at the location in B. | ||
| 40947 | JR Z,Message_RememberTheSeparator_TestWhoseTurn | |||
| 40949 | DEC E | Jump to Message_RememberTheSeparator_FindTheRecord if the copy count has run out. | ||
| 40950 | JR Z,Message_RememberTheSeparator_FindTheRecord | |||
| 40952 | LD A,(IY+17) | Read byte +17 from IY. | ||
| 40955 | CP B | Jump to Message_RememberTheSeparator_FindTheRecord if byte 17 of this record is not the object's location. | ||
| 40956 | JR NZ,Message_RememberTheSeparator_FindTheRecord | |||
| Message_RememberTheSeparator_TestWhoseTurn | 40958 | LD A,(46826) | Read *CurrentCharacter. | |
| 40961 | CP (IX+0) | Jump to Message_RememberTheSeparator_TestTheObjectHere if the character whose turn it is is not this object's id. | ||
| 40964 | JR NZ,Message_RememberTheSeparator_TestTheObjectHere | |||
| 40966 | LD A,4 | Jump to Message_RememberTheSeparator_FindTheRecord if the separator in D is 4. | ||
| 40968 | CP D | |||
| 40969 | JR Z,Message_RememberTheSeparator_FindTheRecord | |||
| Message_RememberTheSeparator_TestTheObjectHere | 40971 | LD A,(IX+0) | Read the id from the index entry. | |
| 40974 | CALL ConditionTheObjectIsHere | Call ConditionTheObjectIsHere to test whether the object is here. | ||
| 40977 | JR Z,Message_RememberTheSeparator_FindTheRecord | Jump to Message_RememberTheSeparator_FindTheRecord if ConditionTheObjectIsHere did not find the object here. | ||
| 40979 | INC C | Count one more object. | ||
| 40980 | SUB A | Take zero for the two flags below. | ||
| 40981 | LD (46852),A | Clear the capitalise-the-next-letter flag before the object's name. | ||
| 40984 | LD (46851),A | Update *46851. | ||
| 40987 | CALL MessageNameAnObject | Call MessageNameAnObject to print the object's name. | ||
| 40990 | LD A,(46826) | Read *CurrentCharacter. | ||
| 40993 | CP (IX+0) | Jump to Message_RememberTheSeparator_PrintANewline if the character whose turn it is is this object's id. | ||
| 40996 | JR Z,Message_RememberTheSeparator_PrintANewline | |||
| 40998 | LD A,46 | Use the character '.'. | ||
| 41000 | CALL Print_Character | Call Print_Character to print one character. | ||
| 41003 | LD A,(IX+0) | Read the id from the index entry. | ||
| 41006 | CALL TableListWhatIsHere | Call TableListWhatIsHere to list what is here. | ||
| 41009 | JR C,Message_RememberTheSeparator_FindTheRecord | Jump to Message_RememberTheSeparator_FindTheRecord if TableListWhatIsHere returned with carry set. | ||
| 41011 | LD A,(IX+0) | Read the id from the index entry. | ||
| 41014 | PUSH DE | Save DE and step the separator on. | ||
| 41015 | INC D | |||
| 41016 | INC D | Step the separator on once more. | ||
| 41017 | CALL Message_RememberTheSeparator | Call Message_RememberTheSeparator to remember the separator and walk the objects, then restore DE. | ||
| 41020 | POP DE | |||
| Message_RememberTheSeparator_FindTheRecord | 41021 | POP AF | Jump back to Message_RememberTheSeparator_Loop to find the record. | |
| 41022 | JP Message_RememberTheSeparator_Loop | |||
| Message_RememberTheSeparator_PrintANewline | 41025 | CALL Print_LineBreak | Call Print_LineBreak to print a newline. | |
| 41028 | JR Message_RememberTheSeparator_FindTheRecord | Jump back to Message_RememberTheSeparator_FindTheRecord to find the record. | ||
| Message_RememberTheSeparator_RestoreTheSeparator | 41030 | POP IX | Restore IX from the stack and swap HL with the address on the stack. | |
| 41032 | EX (SP),HL | |||
| 41033 | LD A,H | Put the saved separator back at 34463. | ||
| 41034 | LD (34463),A | |||
| 41037 | LD A,L | Take the id back into A. | ||
| 41038 | POP HL | Restore HL from the stack. | ||
| 41039 | RET | Return. | ||
| Prev: 40879 | Up: Map | Next: 41040 |