Prev: 28101 Up: Map Next: 28264
28172: Print Magic Knight's current room's name at top of screen
The room name bar displayed on the 7th character row defaults to an attribute value of 71 as per the instruction at 28172. However in cases where the current room has a name record defined in the table at 42765, the attribute defined in that record will override this default attribute. Therefore, the default attribute is only visible in rooms without names.
Used by the routine at 28101.
28172 LD A,71 Store 71 (white INK, black PAPER, BRIGHT) at 23695...
28174 LD (23695),A ...
28177 LD HL,16576 Load HL with display file address corresponding to (0, 6) (characters)...
28180 LD (54110),HL ...and move bitmap virtual text cursor here
28183 LD HL,32 Load HL (repeat counter) with 32
28186 LD A,93 Set character to be repeated to 93 (body of "room name bar")...
28188 LD (54235),A ...
28191 CALL 54231 Print the character 32 times across width of screen
28194 LD HL,42765 Point HL at start of table of room names
28197 LD A,(23701) Load B with Magic Knight's current room...
28200 LD B,A ...
28201 CALL 54269 Advance HL to name entry for Magic Knight's current room
28204 LD A,(HL) Load first value (attribute) into A
28205 OR A If attribute value is zero (i.e. no room name defined)...
28206 RET Z ...then return
28207 LD (23695),A Store required attribute value at 23695
28210 INC HL Advance HL to string length data...
28211 LD A,(HL) ...and load into A
28212 INC HL Advance HL to first byte of string
28213 PUSH HL Store HL (pointer to first byte of room name string)
28214 ADD A,4 Add 4 to the string's length to accommodate space, and "bar cap" characters (chars. 35 and 36) before and after...
28216 LD B,A ...and load value into B
28217 LD A,32 Load A with width of screen (characters) minus length of room name string, spaces and bar caps...
28219 SUB B ...
28220 RRCA Divide value by two...
28221 AND 31 ...and cap at 31
28223 LD C,A Load this value (length of one half of room name bar) into BC...
28224 LD B,0 ...
28226 LD HL,16576 Point HL at top pixel row of character block at coordinates (0, 6)
28229 ADD HL,BC Add value in BC as offset...
28230 LD (54110),HL ...and load this address into bitmap virtual text cursor
28233 LD HL,22720 Point HL at attribute file address for character coordinates (0, 6)
28236 LD DE,22721 Point DE at attribute file address for character coordinates (1, 6)
28239 LD BC,31 Set repeat count to 31
The value at 23695 is initially 71 (as set by instruction at 28174) and may have been changed to a new value as specified in room name entry in table at 42765
28242 LD A,(23695) Load A with attribute stored at 23695
28245 LD (HL),A Fill entire row in attribute file with this attribute value...
28246 LDIR ...
28248 LD HL,42160 Point HL at text code for SPACE followed by room name bar end cap (right)
28251 CALL 34733 Print text at location HL to screen using full screen width
28254 POP HL Restore HL (pointer to first byte of room name string)
28255 CALL 34733 Print text at location HL to screen using full screen width
28258 LD HL,42163 Point HL at text code for room name bar end cap (left) followed by SPACE
28261 JP 34733 Print text at location HL to screen using full screen width and return
Prev: 28101 Up: Map Next: 28264