Prev: 6186 Up: Map Next: 629D
6187: Describe Location
Used by the routines at GameLoop, ObeyCommand, OfferAnotherGame and RedrawLocation.
Prints where the player is, what is here, and which ways lead out. Bank 6 supplies the long text for rooms below 66, and it opens "welcome to Blizzard Pass by Alan Cox. This program is dedicated to Hawkwind. Any resemblance between the characters in the game and your mother in law is total coincidence". A dark room says so and lists nothing. The text is underlined before the cursor is put back for the prompt.
Remember the cursor, and choose a row. Pictures use row 0D so the text sits under the illustration.
DescribeLocation 6187 LD A,$FF The description pauses at the bottom of the picture.
6189 LD ($6186),A
618C LD A,$2E A full stop makes the first letter a capital.
618E LD ($5B9B),A
6191 LD HL,($5B89) Stash the cursor on the stack.
6194 PUSH HL
6195 LD HL,($5B87) Stash the print address on the stack.
6198 PUSH HL
Clear the text rows.
6199 CALL ClearLowerRows Call ClearLowerRows.
619C LD A,($66D6) Test whether pictures are on.
619F OR A
61A0 LD A,$0D Pictures on use row 0D.
61A2 JR NZ,DescribeLocation_Row
61A4 XOR A
Home the chosen row.
DescribeLocation_Row 61A5 LD ($5B89),A Write it to *PrintRow.
61A8 CALL HomeRow Call HomeRow.
61AB XOR A Write 00 to PrintColumn.
61AC LD ($5B8A),A
61AF LD A,($5D88) Jump to DescribeLocation_Text if *Darkness is zero.
61B2 OR A
61B3 JR Z,DescribeLocation_Text
Print "It is dark. You cannot see.".
61B5 LD A,$19 Print SystemMessage_19 using PrintSystemMessage.
61B7 CALL PrintSystemMessage
Underline the description.
61BA JP DescribeLocation_Rule Jump to DescribeLocation_Rule.
Rooms under 66 with pictures switched off are read from bank 6. Every other room uses the tokenised text at TokenisedLocations.
DescribeLocation_Text 61BD LD HL,$75CE The default text is the tokenised list at TokenisedLocations.
61C0 LD A,($5D87) Jump to DescribeLocation_Print if *CurrentRoom is at least 66.
61C3 CP $66
61C5 JR NC,DescribeLocation_Print
61C7 LD A,($66D6) Test whether pictures are on.
61CA OR A
61CB LD A,($5D87) Fetch CurrentRoom.
61CE JR NZ,DescribeLocation_Print Jump to DescribeLocation_Print if pictures are on.
Page in the long descriptions.
DescribeLocation_Page 61D0 PUSH AF Stash the room number on the stack.
61D1 LD A,$06 page RAM bank 06 in at C000, keeping the 48K ROM.
61D3 CALL PageBank
61D6 LD HL,$C000 Point HL at Picture_IcyThroneHall.
61D9 POP AF Restore the room number from the stack.
Print this room's text.
DescribeLocation_Print 61DA LD ($5B8F),A Write it to *MessageNumber.
61DD CALL PrintMessage Call PrintMessage.
61E0 XOR A page RAM bank 00 in at C000, keeping the 48K ROM.
61E1 CALL PageBank
61E4 XOR A Write 00 to SearchHit.
61E5 LD ($5B7A),A
61E8 LD HL,$5DCA Point HL at ObjectLocations.
61EB LD B,A Start with a zero count.
List every object whose location byte is this room. The first one is introduced with a colon.
DescribeLocation_Objects 61EC LD A,($5D87) Jump to DescribeLocation_Next if it is not *CurrentRoom.
61EF CP (HL)
61F0 JR NZ,DescribeLocation_Next
61F2 LD A,($5B7A) Jump to DescribeLocation_Seen if *SearchHit is set.
61F5 OR A
61F6 JR NZ,DescribeLocation_Seen
61F8 LD A,B An index below 46 is named without the introduction.
61F9 CP $46
61FB JR C,DescribeLocation_Name
Print ". You can see".
61FD XOR A Print SystemMessages using PrintSystemMessage.
61FE PUSH BC Call PrintSystemMessage.
61FF CALL PrintSystemMessage
6202 POP BC
6203 LD A,$20 Print a space.
6205 CALL PlotCharacter
6208 LD A,$3A Print a colon.
620A CALL PlotCharacter
620D LD A,$2D Print a dash.
620F CALL PlotCharacter
6212 LD A,$20 Print a space.
6214 CALL PlotCharacter
An object was listed.
DescribeLocation_Seen 6217 LD A,$01 Write 01 to *SearchHit.
6219 LD ($5B7A),A
Print this object's name.
DescribeLocation_Name 621C LD A,B Call PrintObjectName.
621D CALL PrintObjectName
Step to the next object.
DescribeLocation_Next 6220 LD A,($5D8D) Jump to DescribeLocation_Exits if B equals *ObjectTotal.
6223 CP B
6224 JR Z,DescribeLocation_Exits
6226 INC B The next location byte belongs to the next object.
6227 INC HL
6228 JR DescribeLocation_Objects Jump to DescribeLocation_Objects.
After the objects, list the directions that leave this room.
DescribeLocation_Exits 622A LD A,($5B7A) An empty list needs no tidy-up.
622D OR A
622E JR Z,DescribeLocation_Moves
6230 LD A,$0C Two backspaces remove the comma after the last object.
6232 CALL PlotCharacter
6235 LD A,$0C
6237 CALL PlotCharacter
List the ways out.
DescribeLocation_Moves 623A CALL FindExits Call FindExits.
623D INC HL Advance to the first exit.
623E BIT 7,(HL) Jump to DescribeLocation_Rule if bit 7 is set.
6240 JR NZ,DescribeLocation_Rule
Print ". You can go".
6242 LD A,$0D Print SystemMessage_0D using PrintSystemMessage.
6244 CALL PrintSystemMessage
Print one direction.
DescribeLocation_Exit 6247 LD A,(HL) Bit 7 ends the list of directions.
6248 BIT 7,A
624A JR NZ,DescribeLocation_Stop
624C CALL PrintSystemMessage Call PrintSystemMessage.
624F INC HL Advance to the next exit.
6250 INC HL
6251 JR DescribeLocation_Exit Jump to DescribeLocation_Exit.
Finish the exit list.
DescribeLocation_Stop 6253 LD A,$0C Rub out the last comma.
6255 CALL PlotCharacter
6258 LD A,$0C
625A CALL PlotCharacter
625D LD A,$2E Finish with a full stop.
625F CALL PlotCharacter
Underline the description and restore the cursor the caller had saved.
DescribeLocation_Rule 6262 XOR A The description is finished, so scrolling may resume.
6263 LD ($6186),A
6266 LD A,$0D Start the rule on a new line.
6268 CALL PrintCharacter
626B LD A,($66D6) Test whether pictures are on.
626E OR A
626F LD A,($5B89) Fetch PrintRow.
6272 JR NZ,DescribeLocation_Bottom Jump to DescribeLocation_Bottom if pictures are on.
6274 LD A,$0F Pictures off force row 0F.
6276 LD ($5B89),A
6279 XOR A Write 00 to PrintColumn.
627A LD ($5B8A),A
627D CALL HomeRow Call HomeRow.
6280 LD A,$0F Row 0F, ready for the rule.
Draw the underline.
DescribeLocation_Bottom 6282 INC A The rule sits on the row under the text.
6283 LD ($5B97),A
6286 LD B,$2A Forty-two underscores fill the row.
Print the rule.
DescribeLocation_Bar 6288 LD A,$5F Print this underscore.
628A CALL PlotCharacter
628D DJNZ DescribeLocation_Bar Jump to DescribeLocation_Bar until the row is filled.
628F LD A,$0D Close the rule with ENTER.
6291 CALL PrintCharacter
6294 POP HL Restore the print address from the stack.
6295 LD ($5B87),HL
6298 POP HL Restore the cursor from the stack.
6299 LD ($5B89),HL
629C RET Return.
Prev: 6186 Up: Map Next: 629D