Prev: 9E4A Up: Map Next: 9E93
9E58: Print Depth
Used by the routine at Print_Status_Panel.
Prints the text DEPTH and the depth of the room that Sabreman is in. The depth is worked out from the room y by adding one to the BCD base held in Status_Panel_Data for each row in the band. The entry at 9E66 leaves out the text.
Before After Print_Depth
depth-before depth-after
Input
IX Object record of Sabreman
Print_Depth 9E58 LD A,$45 Set the attribute to cyan (45).
9E5A LD ($8EE8),A Store it in Current_MenuAttribute.
9E5D LD DE,$9E9B Point at the text DEPTH (Status_Panel_Text_Depth).
9E60 LD HL,$0840 Set the position to x=40 y=08.
9E63 CALL MenuWriteText Call MenuWriteText.
This entry point is used by the routine at Draw_Room.
Print_Depth_From_Object 9E66 LD A,(IX+$04) Fetch the room y of the object.
9E69 RRA Move the high nibble down.
9E6A RRA
9E6B RRA
9E6C RRA
9E6D AND $0F Keep only the nibble.
9E6F LD C,A Use the band number as the offset into the table of bases.
9E70 LD B,$00
9E72 LD HL,$9E93 Point at the table of bases (Status_Panel_Data).
9E75 ADD HL,BC Add the offset.
9E76 LD C,(HL) Fetch the BCD base.
9E77 LD A,(IX+$04) Fetch the room y of the object again.
9E7A AND $0F Keep only the low nibble.
9E7C INC A Add one.
9E7D LD B,A Store the number of rows in the band as the row counter.
9E7E LD A,C Start from the BCD depth of the top of the band.
Print_Depth_Row_Loop 9E7F INC A Add one to the depth, keeping it as a BCD value.
9E80 DAA
9E81 DJNZ Print_Depth_Row_Loop Repeat until the depth of the room has been counted up from the top of the band.
9E83 LD ($8EEF),A Store the depth in 8EEF.
9E86 LD HL,$0870 Set the screen position to x=70 y=08.
9E89 CALL ScreenAddress Convert the position into a screen address.
9E8C LD DE,$8EEF Point at the depth (Depth).
9E8F LD B,$01 Set the number of digits to print to 01.
9E91 JR Print_Status_Panel_Digits Jump to Print_Status_Panel_Digits.
Prev: 9E4A Up: Map Next: 9E93