Prev: $2043 Up: Map Next: $212A
$20F5: Insert a pixel column into the text graphic buffer
Used by the routines at $213B and $2156.
Input
A Pixel column
($9D) Width (in character cells) of the target message box
$20F5 LDX #$F8 Initialise the pixel counter at $56.
$20F7 STX $56
$20F9 LDY #$00 Now XY is $4500, the address of the text graphic buffer.
$20FB LDX #$45
$20FD STX $9F Store the MSB of this address at $9F.
$20FF LDX $9D Pick up the width of the target message box from $9D and copy it to $55.
$2101 STX $55
$2103 LDX $56 Pick up the pixel counter from $56 and copy it to $9E (the LSB of the text graphic buffer address).
$2105 STX $9E
$2107 ROL A Rotate a pixel from the pixel column into the carry flag.
$2108 PHA Save the remainder of the pixel column temporarily.
$2109 LDA ($9E),Y Rotate a byte in the text graphic buffer, bringing the new pixel into bit 0.
$210B ROL A
$210C STA ($9E),Y
$210E LDA #$00 Store the pixel that was rotated out of bit 7 of the text graphic buffer byte in bit 0 at $54 temporarily.
$2110 ROL A
$2111 STA $54
$2113 LDA $9E Subtract 8 from the text graphic buffer address at $9E. Now it points at the next graphic byte to the left.
$2115 SEC
$2116 SBC #$08
$2118 STA $9E
$211A DEC $55 Decrement the message box width counter at $55.
$211C BEQ $2124 Branch if we've just finished shifting an entire pixel row of the text graphic buffer left.
$211E LDA $54 Pick up the pixel that was rotated out of bit 7 of the last text graphic buffer byte and rotate it into the carry flag.
$2120 ROR A
$2121 JMP $2109 Jump back to rotate it into the next graphic byte to the left.
$2124 PLA Restore the remainder of the pixel column to A.
$2125 INC $56 Next pixel in the column.
$2127 BNE $20FF Branch back until all 8 pixels have been inserted.
$2129 RTS
Prev: $2043 Up: Map Next: $212A