Prev: 47682 Up: Map Next: 47741
47709: Print half of a double-height text character
The most significant byte of the attribute file address starts off as 88 for the top third of the screen. In the middle third it becomes 89 and in the lower third it reaches 90. The most significant byte of the display file address (for the top pixel row of each character row) is 64 in the top third, 72 in the middle third and 80 in the lower third. Generally speaking, therefore, the most significant byte in the display file address increases by eight for every increase of one in the attribute address most significant byte, so multiplying the latter by eight (giving 192, 200 or 208, values roll over 255-0 boundary with excess truncated) would put it on the same scale as the former (64, 72 or 80).
Performing an AND 91 removes the most significant bit, converting the possible values to 64, 72 or 80, so the most significant byte of the attribute file address has been transformed into the most significant byte of the corresponding display file address. However, after the multiplication by eight, there is no way that the lowest two bits could be set, so there is no need to mask these with the AND command, so AND 88 would be just as effective (and probably more correct) than an AND 91.
See also code at 54170-54176.
Used by the routine at 47682.
Input
DE 15360 + 8 × character index [+4 for second run-through] (i.e. points to ROM graphic data for the character of interest)
HL Attribute file address at which to print character
47709 PUSH HL Store HL
47710 PUSH BC Store BC
47711 LD A,(34269) Load stored attribute into A
47714 LD (HL),A Write this to attribute file
47715 LD A,H Multiply the most significant byte (MSB) of the attribute file address by eight...
47716 ADD A,A ...to put it on the same scale as the MSB of the display file address MSB (see notes)...
47717 ADD A,A ...
47718 ADD A,A ...
47719 AND 91 Drop the most significant bit to point to the correct location in display file
47721 LD H,A Load back into HL (L is unaffected, as it should be)
47722 LD B,4 Set B to 4 (loop counter)
47724 LD A,(DE) Load a byte from the graphic data into C...
47725 LD C,A ...
47726 SRL C Shift bitmap data left one pixel in C
47728 OR C Merge this into bitmap data already in A to give a "bold" typeface appearance
47729 AND 127 Drop the leftmost bit to prevent one character touching the next (space between letters)
47731 LD (HL),A Load the bitmap data into two consecutive rows to provide double-height (2 chars) text...
47732 INC H ...
47733 LD (HL),A ...
47734 INC H ...
47735 INC DE Advance to next byte of graphic data
47736 DJNZ 47724 Repeat for next row of graphic data
47738 POP BC Restore BC
47739 POP HL Restore HL
47740 RET Return
Prev: 47682 Up: Map Next: 47741