Prev: $212A Up: Map Next: $2156
$213B: Centre the text in the text graphic buffer
Used by the routines at $2043, $2573, $2BB0 and $BFF5.
Input
($9D) Width (in character cells) of the target message box
($A2) Number of pixel columns already inserted into the buffer
$213B LDA $9D Pick up the width (in character cells) of the target message box from $9D and multiply by 8 to get the width in pixels.
$213D ASL A
$213E ASL A
$213F ASL A
$2140 SEC Subtract the number of pixel columns that have been inserted into the text graphic buffer.
$2141 SBC $A2
$2143 BMI $2155 Return if the buffer is already full (no centring required).
$2145 CMP #$02 Are there fewer than two free pixel columns remaining?
$2147 BCC $2155 Return if so (no centring required).
$2149 LSR A Divide A by 2 and store the result at $57. This is the number of pixel columns by which the message will be shifted in order to centre it.
$214A STA $57
$214C LDA #$00 Insert a blank pixel column into the text graphic buffer at $4500.
$214E JSR $20F5
$2151 DEC $57 Is the message centred yet?
$2153 BNE $214C Branch back if not.
$2155 RTS
Prev: $212A Up: Map Next: $2156