Prev: 40522 Up: Map Next: 40595
40536: 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 40550 leaves out the text.
Before After Print_Depth
depth-before depth-after
Input
IX Object record of Sabreman
Print_Depth 40536 LD A,69 Set the attribute to cyan (69).
40538 LD (36584),A Store it in Current_MenuAttribute.
40541 LD DE,40603 Point at the text DEPTH (Status_Panel_Text_Depth).
40544 LD HL,2112 Set the position to x=64 y=8.
40547 CALL MenuWriteText Call MenuWriteText.
This entry point is used by the routine at Draw_Room.
Print_Depth_From_Object 40550 LD A,(IX+4) Fetch the room y of the object.
40553 RRA Move the high nibble down.
40554 RRA
40555 RRA
40556 RRA
40557 AND 15 Keep only the nibble.
40559 LD C,A Use the band number as the offset into the table of bases.
40560 LD B,0
40562 LD HL,40595 Point at the table of bases (Status_Panel_Data).
40565 ADD HL,BC Add the offset.
40566 LD C,(HL) Fetch the BCD base.
40567 LD A,(IX+4) Fetch the room y of the object again.
40570 AND 15 Keep only the low nibble.
40572 INC A Add one.
40573 LD B,A Store the number of rows in the band as the row counter.
40574 LD A,C Start from the BCD depth of the top of the band.
Print_Depth_Row_Loop 40575 INC A Add one to the depth, keeping it as a BCD value.
40576 DAA
40577 DJNZ Print_Depth_Row_Loop Repeat until the depth of the room has been counted up from the top of the band.
40579 LD (36591),A Store the depth in 36591.
40582 LD HL,2160 Set the screen position to x=112 y=8.
40585 CALL ScreenAddress Convert the position into a screen address.
40588 LD DE,36591 Point at the depth (Depth).
40591 LD B,1 Set the number of digits to print to 1.
40593 JR Print_Status_Panel_Digits Jump to Print_Status_Panel_Digits.
Prev: 40522 Up: Map Next: 40595