2002-10-03 11:18:23 +00:00
|
|
|
;
|
2009-11-02 22:29:49 +00:00
|
|
|
; Ullrich von Bassewitz, 2009-10-30
|
2002-10-03 11:18:23 +00:00
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
.include "tgi-kernel.inc"
|
|
|
|
|
2009-11-02 22:29:49 +00:00
|
|
|
.import popa, popax
|
2009-10-30 21:26:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
; Calculate either the total height or the total width of a bitmapped
|
|
|
|
; character, depending on the value in Y. On entry, X contains the scaling
|
|
|
|
; factor. Since it is usually small, we multiplicate by doing repeated adds.
|
|
|
|
; The function returns zero in X and the calculated value in A.
|
|
|
|
|
|
|
|
.proc charsize_helper
|
|
|
|
|
|
|
|
lda _tgi_fontwidth,y
|
|
|
|
jmp @L2
|
|
|
|
@L1: clc
|
|
|
|
adc _tgi_fontwidth,y
|
|
|
|
@L2: dex
|
|
|
|
bne @L1
|
|
|
|
sta _tgi_charwidth,y
|
|
|
|
rts
|
|
|
|
|
|
|
|
.endproc
|
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2009-11-02 22:29:49 +00:00
|
|
|
; void __fastcall__ tgi_textstyle (unsigned width, unsigned height,
|
|
|
|
; unsigned char dir, unsigned char font);
|
|
|
|
; /* Set the style for text output. The scaling factors for width and height
|
|
|
|
; * are 8.8 fixed point values. This means that $100 = 1 $200 = 2 etc.
|
|
|
|
; * dir is one of the TGI_TEXT_XXX constants. font is one of the TGI_FONT_XXX
|
|
|
|
; * constants.
|
|
|
|
; */
|
2009-10-30 21:26:35 +00:00
|
|
|
;
|
2002-10-03 11:18:23 +00:00
|
|
|
|
2003-02-11 12:37:46 +00:00
|
|
|
.proc _tgi_textstyle
|
|
|
|
|
2009-11-02 22:29:49 +00:00
|
|
|
sta _tgi_font ; Remember the font to use
|
|
|
|
jsr popa
|
2009-10-30 21:26:35 +00:00
|
|
|
sta _tgi_textdir ; Remember the direction
|
|
|
|
|
2009-11-02 22:29:49 +00:00
|
|
|
; Pop the height and run directly into tgi_textscale
|
|
|
|
|
|
|
|
jsr popax
|
|
|
|
|
|
|
|
.endproc
|
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
; void __fastcall__ tgi_textscale (unsigned width, unsigned height);
|
|
|
|
; /* Set the scaling for text output. The scaling factors for width and height
|
|
|
|
; * are 8.8 fixed point values. This means that $100 = 1 $200 = 2 etc.
|
|
|
|
; */
|
|
|
|
|
|
|
|
.proc _tgi_textscale
|
|
|
|
|
|
|
|
; The height value is in 8.8 fixed point. Store it and calculate a rounded
|
2009-10-30 21:26:35 +00:00
|
|
|
; value for scaling the bitmapped system font in the driver.
|
|
|
|
|
2009-11-02 22:29:49 +00:00
|
|
|
sta _tgi_textscaleh+0
|
|
|
|
stx _tgi_textscaleh+1
|
2009-10-30 21:26:35 +00:00
|
|
|
asl a ; Check value behind comma
|
|
|
|
bcc @L1
|
|
|
|
inx ; Round
|
2009-11-02 22:29:49 +00:00
|
|
|
@L1: stx _tgi_textscaleh+2 ; Store rounded value
|
2009-10-30 21:26:35 +00:00
|
|
|
|
|
|
|
; Calculate the total height of the bitmapped font and remember it.
|
|
|
|
|
|
|
|
ldy #1
|
|
|
|
jsr charsize_helper
|
2002-10-03 11:18:23 +00:00
|
|
|
|
2009-11-02 22:29:49 +00:00
|
|
|
; The width value is in 8.8 fixed point. Store it and calculate a rounded
|
2009-10-30 21:26:35 +00:00
|
|
|
; value for scaling the bitmapped system font in the driver.
|
2002-10-03 11:18:23 +00:00
|
|
|
|
2009-11-02 22:29:49 +00:00
|
|
|
jsr popax ; height
|
|
|
|
sta _tgi_textscalew+0
|
|
|
|
stx _tgi_textscalew+1
|
2009-10-30 21:26:35 +00:00
|
|
|
asl a ; Check value behind comma
|
|
|
|
bcc @L2
|
|
|
|
inx ; Round
|
2009-11-02 22:29:49 +00:00
|
|
|
@L2: stx _tgi_textscalew+2 ; Store rounded value
|
2002-10-03 11:18:23 +00:00
|
|
|
|
2009-10-30 21:26:35 +00:00
|
|
|
; Calculate the total width of the bitmapped font and remember it.
|
2002-10-03 11:18:23 +00:00
|
|
|
|
2009-10-30 21:26:35 +00:00
|
|
|
ldy #0
|
|
|
|
jsr charsize_helper
|
2002-10-03 11:18:23 +00:00
|
|
|
|
2009-10-30 21:26:35 +00:00
|
|
|
; Load values and call the driver, parameters are passed in registers
|
2002-10-03 11:18:23 +00:00
|
|
|
|
2009-11-02 22:29:49 +00:00
|
|
|
ldx _tgi_textscalew+2
|
|
|
|
ldy _tgi_textscaleh+2
|
2009-10-30 21:26:35 +00:00
|
|
|
lda _tgi_textdir
|
2002-10-03 11:18:23 +00:00
|
|
|
jmp tgi_textstyle
|
|
|
|
|
2003-02-11 12:37:46 +00:00
|
|
|
.endproc
|
|
|
|
|
2009-11-02 22:29:49 +00:00
|
|
|
|