Prev: 39553 Up: Map Next: 39653
39578: Print Magic Knight's current room's name at top of screen
The room name bar displayed on the 5th character row takes as its attribute the inverse of the attribute at (0, 0), i.e. INK and PAPER colours exchanged.
Used by the routine at 39393.
39578 LD A,(22528) Load B with attribute at (0, 0), i.e. top-left of display...
39581 LD B,A ...
39582 AND 192 Clear all but BRIGHT and FLASH flags...
39584 LD C,A ...and load into C
39585 LD A,B Load A with attribute at (0, 0)...
39586 AND 7 ...and clear all but INK bits
39588 ADD A,A Shift INK bit values into PAPER bits...
39589 ADD A,A ...i.e. set PAPER to colour previously in INK...
39590 ADD A,A ...
39591 ADD A,C Set BRIGHT and FLASH flags to values stored previously...
39592 LD C,A ...and load C with new attribute value
39593 LD A,B Load A with attribute at (0, 0)
39594 RRCA Shift PAPER bit values into INK bits...
39595 RRCA ...
39596 RRCA ...
39597 AND 7 ...and clear all but INK bits
39599 ADD A,C Add new INK value to existing attribute in A
39600 LD (23695),A Store attribute in A, which is now the inverse of attribute at (0, 0), at 23695
39603 LD HL,56843 Point HL at start of table of room names
39606 LD A,(23702) Load B with Magic Knight's current room...
39609 LD B,A ...
39610 CALL 63335 Advance HL to name entry for Magic Knight's current room
39613 LD A,(HL) Load first value (string length) into A
39614 OR A If string length value is zero (i.e. no room name defined)...
39615 RET Z ...then return
39616 INC HL Advance HL to first byte of string
39617 PUSH HL Store HL (pointer to first byte of room name string)
39618 ADD A,2 Add 2 to the string's length to accommodate space characters before and after...
39620 LD B,A ...and load value into B
39621 LD A,32 Load A with width of screen (characters) minus length of room name string and spaces...
39623 SUB B ...
39624 RRCA Divide value by two...
39625 AND 31 ...and cap at 31
39627 LD C,A Load this value (length of one half of room name string) into BC...
39628 LD B,0 ...
39630 LD HL,16512 Point HL at top pixel row of character block at coordinates (0, 4)
39633 ADD HL,BC Add value in BC as offset...
39634 LD (63018),HL ...and load this address into bitmap virtual text cursor
39637 LD HL,39653 Point HL at text code for SPACE
39640 CALL 46873 Print text at location HL to screen using full screen width
39643 POP HL Restore HL (pointer to first byte of room name string)
39644 CALL 46873 Print text at location HL to screen using full screen width
39647 LD HL,39653 Point HL at text code for SPACE
39650 JP 46873 Print text at location HL to screen using full screen width and return
Prev: 39553 Up: Map Next: 39653