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) Save the cursor so it can be restored under the rule.
6194 PUSH HL
6195 LD HL,($5B87)
6198 PUSH HL
6199 CALL ClearLowerRows Call ClearLowerRows to clear the text rows.
619C LD A,($66D6) Pictures off forces row 0.
619F OR A
61A0 LD A,$0D Pictures on use row 0D.
61A2 JR NZ,DescribeLocation_Row
61A4 XOR A
DescribeLocation_Row 61A5 LD ($5B89),A Remember that row.
61A8 CALL HomeRow Call HomeRow and home the cursor.
61AB XOR A
61AC LD ($5B8A),A
61AF LD A,($5D88) Darkness skips the description.
61B2 OR A
61B3 JR Z,DescribeLocation_Text
61B5 LD A,$19 Message 19: it is dark, you cannot see.
61B7 CALL PrintSystemMessage
61BA JP DescribeLocation_Rule Jump to DescribeLocation_Rule to underline the description.
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) Rooms at or above 66 have no long description.
61C3 CP $66
61C5 JR NC,DescribeLocation_Print
61C7 LD A,($66D6) Pictures on also keep the short text.
61CA OR A
61CB LD A,($5D87)
61CE JR NZ,DescribeLocation_Print
DescribeLocation_Page 61D0 PUSH AF page RAM bank 06 in at C000, keeping the 48K ROM.
61D1 LD A,$06
61D3 CALL PageBank
61D6 LD HL,$C000 The long description starts at C000.
61D9 POP AF
DescribeLocation_Print 61DA LD ($5B8F),A Store the room as the message number.
61DD CALL PrintMessage Call PrintMessage to print that description.
61E0 XOR A page RAM bank 00 in at C000, keeping the 48K ROM.
61E1 CALL PageBank
61E4 XOR A No object has been listed yet. Start the scan at ObjectLocations.
61E5 LD ($5B7A),A
61E8 LD HL,$5DCA
61EB LD B,A
List every object whose location byte is this room. The first one is introduced with a colon.
DescribeLocation_Objects 61EC LD A,($5D87) This object is in the current room.
61EF CP (HL)
61F0 JR NZ,DescribeLocation_Next
61F2 LD A,($5B7A) Another object in the same room skips the introduction.
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
61FD XOR A Message 0: ". You can see ".
61FE PUSH BC
61FF CALL PrintSystemMessage
6202 POP BC
6203 LD A,$20 Print a space and a colon.
6205 CALL PlotCharacter
6208 LD A,$3A
620A CALL PlotCharacter
620D LD A,$2D Print a dash and a space.
620F CALL PlotCharacter
6212 LD A,$20
6214 CALL PlotCharacter
DescribeLocation_Seen 6217 LD A,$01 Remember that an object was listed.
6219 LD ($5B7A),A
DescribeLocation_Name 621C LD A,B Call PrintObjectName to print this object's name.
621D CALL PrintObjectName
DescribeLocation_Next 6220 LD A,($5D8D) Stop at the object total.
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
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
DescribeLocation_Moves 623A CALL FindExits Call FindExits to find this room's exits.
623D INC HL No exits means no "you can go" line.
623E BIT 7,(HL)
6240 JR NZ,DescribeLocation_Rule
6242 LD A,$0D Message 0D: ". You can go".
6244 CALL PrintSystemMessage
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 Print the direction and step to the next exit.
624F INC HL
6250 INC HL
6251 JR DescribeLocation_Exit
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) Pictures on keep the row the text already reached.
626E OR A
626F LD A,($5B89)
6272 JR NZ,DescribeLocation_Bottom
6274 LD A,$0F Pictures off force row 0F.
6276 LD ($5B89),A
6279 XOR A Home the cursor and keep that row.
627A LD ($5B8A),A
627D CALL HomeRow
6280 LD A,$0F
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.
DescribeLocation_Bar 6288 LD A,$5F Print one underscore.
628A CALL PlotCharacter
628D DJNZ DescribeLocation_Bar
628F LD A,$0D Close the rule with ENTER.
6291 CALL PrintCharacter
6294 POP HL Restore the cursor saved before the description from the stack.
6295 LD ($5B87),HL
6298 POP HL
6299 LD ($5B89),HL
629C RET Return.
Prev: 6186 Up: Map Next: 629D