Prev: A305 Up: Map Next: A33A
A314: Print Objects
Input
A 01 for inventory items, or room number for room objects
PrintObjects A314 PUSH HL Stash HL, DE and BC on the stack.
A315 PUSH DE
A316 PUSH BC
A317 LD HL,$9F88 HL=Table_ItemLocations.
A31A LD BC,($BBC7) BC=*Count_Objects_1.
FindObject_Loop A31E CPIR Search for matching objects.
A320 JR NZ,PrintObjects_Return Jump to PrintObjects_Return if no objects were found.
A322 PUSH HL Stash the current place in FindIndexOfItemFromItemGroupPresent on the stack.
A323 CALL ValidateObject Call ValidateObject.
A326 JR Z,FindObject_Next Jump to FindObject_Next if the object is invalid.
A328 PUSH AF Temporarily stash the object type and object counter on the stack.
A329 PUSH BC
A32A CALL PrintCompressedStringAndNewline Call PrintCompressedStringAndNewline.
A32D POP BC Restore the object counter and object type from the stack.
A32E POP AF
FindObject_Next A32F LD E,A Temporarily hold the object type in E.
A330 POP HL Restore the current place in Table_ItemLocations from the stack.
A331 LD A,B Test if all objects have been checked...
A332 OR C
A333 LD A,E Restore the object type to A.
A334 JR NZ,FindObject_Loop Jump to FindObject_Loop until all objects in the table have been checked.
PrintObjects_Return A336 POP BC Restore BC, DE and HL from the stack.
A337 POP DE
A338 POP HL
A339 RET Return.
View the equivalent code in;
Prev: A305 Up: Map Next: A33A