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
|
|
|
;
|
|
|
|
|
|
|
|
|
2011-07-17 18:27:01 +00:00
|
|
|
.include "zeropage.inc"
|
2002-10-03 11:18:23 +00:00
|
|
|
.include "tgi-kernel.inc"
|
|
|
|
|
2011-07-17 18:27:01 +00:00
|
|
|
.import umul8x16r24
|
2009-11-02 22:29:49 +00:00
|
|
|
.import popa, popax
|
2009-10-30 21:26:35 +00:00
|
|
|
|
2011-07-17 18:27:01 +00:00
|
|
|
.macpack cpu
|
2009-10-30 21:26:35 +00:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2011-07-17 18:36:12 +00:00
|
|
|
; void __fastcall__ tgi_settextstyle (unsigned width, unsigned height,
|
|
|
|
; unsigned char dir, unsigned char font);
|
2009-11-02 22:29:49 +00:00
|
|
|
; /* Set the style for text output. The scaling factors for width and height
|
2014-06-30 09:10:35 +00:00
|
|
|
; ** 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
|
|
|
|
2011-07-17 18:36:12 +00:00
|
|
|
.proc _tgi_settextstyle
|
2003-02-11 12:37:46 +00:00
|
|
|
|
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
|
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2011-07-17 18:36:12 +00:00
|
|
|
; void __fastcall__ tgi_settextscale (unsigned width, unsigned height);
|
2009-11-02 22:29:49 +00:00
|
|
|
; /* Set the scaling for text output. The scaling factors for width and height
|
2014-06-30 09:10:35 +00:00
|
|
|
; ** are 8.8 fixed point values. This means that $100 = 1 $200 = 2 etc.
|
|
|
|
; */
|
2009-11-02 22:29:49 +00:00
|
|
|
|
2011-07-17 18:36:12 +00:00
|
|
|
.proc _tgi_settextscale
|
2009-11-02 22:29:49 +00:00
|
|
|
|
2011-07-17 18:27:01 +00:00
|
|
|
; Setup the height
|
2009-10-30 21:26:35 +00:00
|
|
|
|
2011-07-17 18:27:01 +00:00
|
|
|
ldy _tgi_fontheight ; Get height of bitmap font in pixels
|
|
|
|
sty ptr1 ; Save for later
|
|
|
|
ldy #6 ; Address the height
|
|
|
|
jsr process_onedim ; Process height
|
2002-10-03 11:18:23 +00:00
|
|
|
|
2011-07-17 18:27:01 +00:00
|
|
|
; Setup the width
|
2002-10-03 11:18:23 +00:00
|
|
|
|
2011-07-17 18:27:01 +00:00
|
|
|
jsr popax ; Get width scale into a/x
|
|
|
|
ldy _tgi_fontwidth ; Get width of bitmap font in pixels
|
|
|
|
sty ptr1 ; Save for later
|
|
|
|
ldy #0 ; Address the width
|
2002-10-03 11:18:23 +00:00
|
|
|
|
2011-07-17 18:27:01 +00:00
|
|
|
; Process one character dimension. That means:
|
|
|
|
;
|
|
|
|
; - Store the vector font dimension in 8.8 format
|
|
|
|
; - If necessary, round up/down to next integer
|
|
|
|
; - Store the bitmap font dimension in 8.8 format
|
|
|
|
; - Multiply by size of bitmap char in pixels
|
|
|
|
; - Store the bitmap font size in 8.8 format
|
|
|
|
;
|
2002-10-03 11:18:23 +00:00
|
|
|
|
2011-07-17 18:27:01 +00:00
|
|
|
process_onedim:
|
2002-10-03 11:18:23 +00:00
|
|
|
|
2011-07-17 18:27:01 +00:00
|
|
|
jsr store ; Store vector font scale factor
|
|
|
|
bit _tgi_flags ; Fine grained scaling support avail?
|
|
|
|
bmi @L2 ; Jump if yes
|
2002-10-03 11:18:23 +00:00
|
|
|
|
2011-07-17 18:27:01 +00:00
|
|
|
asl a ; Round to nearest full integer
|
|
|
|
bcc @L1
|
|
|
|
inx
|
|
|
|
@L1: lda #0
|
|
|
|
|
|
|
|
@L2: jsr store ; Store bitmap font scale factor
|
|
|
|
|
|
|
|
; The size of the font in pixels in the selected dimension is already in ptr1
|
|
|
|
; So if we call umul8x16r24 we get the size in pixels in 16.8 fixed point.
|
|
|
|
; Disallowing characters larger than 256 pixels, we just drop the high byte
|
|
|
|
; and remember the low 16 bit as size in 8.8 format.
|
|
|
|
|
|
|
|
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
|
|
|
phy ; Save Y
|
|
|
|
jsr umul8x16r24
|
|
|
|
ply ; Restore Y
|
|
|
|
.else
|
|
|
|
sty tmp1 ; Save Y
|
|
|
|
jsr umul8x16r24
|
|
|
|
ldy tmp1 ; Restore Y
|
|
|
|
.endif
|
|
|
|
|
|
|
|
store: sta _tgi_textscalew,y
|
|
|
|
iny
|
|
|
|
pha
|
|
|
|
txa
|
|
|
|
sta _tgi_textscalew,y
|
|
|
|
iny
|
|
|
|
pla
|
|
|
|
rts
|
2002-10-03 11:18:23 +00:00
|
|
|
|
2003-02-11 12:37:46 +00:00
|
|
|
.endproc
|
|
|
|
|
2009-11-02 22:29:49 +00:00
|
|
|
|