From ca9d802d1e8d0e4c38aeb628399fe56310a54b0d Mon Sep 17 00:00:00 2001 From: uz Date: Sun, 10 Jul 2011 14:59:29 +0000 Subject: [PATCH] Fix width calculation for bitmap font output. Use new 8x16 multiplication routines to save some cycles. git-svn-id: svn://svn.cc65.org/cc65/trunk@5080 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- libsrc/tgi/tgi_textwidth.s | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/libsrc/tgi/tgi_textwidth.s b/libsrc/tgi/tgi_textwidth.s index 477510d8e..8564b18a1 100644 --- a/libsrc/tgi/tgi_textwidth.s +++ b/libsrc/tgi/tgi_textwidth.s @@ -8,7 +8,7 @@ .include "zeropage.inc" .import _strlen, _toascii - .import umul16x16r32 + .import umul8x16r16 ;----------------------------------------------------------------------------- ; Aliases for zero page locations @@ -36,12 +36,13 @@ Text := ptr3 ; Return the width of the string for the bitmap font - jsr _strlen + ldy _tgi_charwidth sta ptr1 - stx ptr1+1 - lda _tgi_charwidth - ldx #0 - jmp umul16x16r32 + jsr _strlen + jsr umul8x16r16 + ldy _tgi_textscalew+2 ; Get rounded scale factor + sta ptr1 + jmp umul8x16r16 ; Return the width of the string for the vector font. To save some code, we ; will add up all the character widths and then multiply by the scale factor. @@ -77,7 +78,7 @@ Text := ptr3 tay lda (WTab),y ; Get width of this char clc - adc Width + adc Width sta Width bcc @L3 inc Width+1