2 ; Ullrich von Bassewitz, 21.06.2002
4 ; void __fastcall__ tgi_outtext (const char* s);
5 ; /* Output text at the current graphics cursor position. */
8 .include "tgi-kernel.inc"
9 .include "tgi-vectorfont.inc"
10 .include "zeropage.inc"
16 ;----------------------------------------------------------------------------
20 font := regbank ; Same as text
23 ;----------------------------------------------------------------------------
28 ldy _tgi_font ; Bit or vectorfont?
31 ; Handle bitmapped font output
34 stx ptr3+1 ; Pass s in ptr3 to driver
37 pha ; Save s on stack for later
39 jsr tgi_curtoxy ; Copy curx/cury into ptr1/ptr2
40 jsr tgi_outtext ; Call the driver
45 jsr _tgi_textwidth ; Get width of text string
47 ; Move the graphics cursor by the amount in a/x
50 ldy _tgi_textdir ; Horizontal or vertical text?
51 beq @L1 ; Jump if horizontal
53 ; Move graphics cursor for vertical text
56 ldy #2 ; Point to _tgi_cury
58 ; Move graphics cursor for horizontal text
68 ; Handle vector font output. First, check if we really have a registered
69 ; vector font. Bail out if this is not the case.
73 lda _tgi_vectorfont ; Do we have a vector font?
75 beq Done ; Bail out if not
77 ; Check if the font in the given size is partially out of the screen. We
78 ; do this in vertical direction here, and in horizontal direction before
79 ; outputting a character.
83 ; Save zero page variable on stack and save
95 stx text+1 ; Store pointer to string
99 adc #<(TGI_VECTORFONT::WIDTHS - TGI_VF_FIRSTCHAR)
101 lda _tgi_vectorfont+1
102 adc #>(TGI_VECTORFONT::WIDTHS - TGI_VF_FIRSTCHAR)
105 ; Output the text string
108 lda (text),y ; Get next character from string
110 jsr _toascii ; Convert to ascii
112 jsr _tgi_vectorchar ; Output it
115 ; Move the graphics cursor by the width of the char
118 lda (widths),y ; Get width of this char
123 ldx _tgi_textscalew+1 ; Get scale factor
124 jsr tgi_imulround ; Multiplcate and round
125 jsr MoveCursor ; Move the graphics cursor
127 ; Next char in string
134 ; Done. Restore registers and return