]> git.sur5r.net Git - cc65/blob - libsrc/tgi/tgi_outtext.s
remove superfluous ".code" line
[cc65] / libsrc / tgi / tgi_outtext.s
1 ;
2 ; Ullrich von Bassewitz, 21.06.2002
3 ;
4 ; void __fastcall__ tgi_outtext (const char* s);
5 ; /* Output text at the current graphics cursor position. */
6
7
8         .include        "tgi-kernel.inc"
9         .include        "tgi-vectorfont.inc"
10         .include        "zeropage.inc"
11
12         .import         popax, negax
13
14
15 ;----------------------------------------------------------------------------
16 ; Data
17
18 text    := regbank
19
20 ;----------------------------------------------------------------------------
21 ;
22
23 .proc   _tgi_outtext
24
25         ldy     _tgi_font       ; Bit or vectorfont?
26         bne     VectorFont
27
28 ; Handle bitmapped font output
29
30         sta     ptr3
31         stx     ptr3+1          ; Pass s in ptr3 to driver
32         pha
33         txa
34         pha                     ; Save s on stack for later
35
36         jsr     tgi_curtoxy     ; Copy curx/cury into ptr1/ptr2
37         jsr     tgi_outtext     ; Call the driver
38
39         pla
40         tax
41         pla                     ; Restore s
42         jsr     _tgi_textwidth  ; Get width of text string
43         ldy     _tgi_textdir    ; Horizontal or vertical text?
44         beq     @L1             ; Jump if horizontal
45
46 ; Move graphics cursor for vertical text
47
48         jsr     negax
49         ldy     #2              ; Point to _tgi_cury
50
51 ; Move graphics cursor for horizontal text
52
53 @L1:    clc
54         adc     _tgi_curx,y
55         sta     _tgi_curx,y
56         txa
57         adc     _tgi_curx+1,y
58         sta     _tgi_curx+1,y
59         rts
60
61 ; Handle vector font output
62
63 VectorFont:
64         tay
65         lda     _tgi_vectorfont         ; Do we have a vector font?
66         ora     _tgi_vectorfont+1
67         beq     Done                    ; Bail out if not
68
69         lda     text                    ; Save zero page variable on stack
70         pha
71         lda     text+1
72         pha
73
74         sty     text
75         stx     text+1                  ; Store pointer to string
76
77 ; Output the text string
78
79 @L1:    ldy     #0
80         lda     (text),y                ; Get next character from string
81         beq     EndOfText
82         jsr     _tgi_vectorchar         ; Output it
83         inc     text
84         bne     @L1
85         inc     text+1
86         bne     @L1
87
88 ; Done. Restore registers and return
89
90 EndOfText:
91         pla
92         sta     text+1
93         pla
94         sta     text
95 Done:   rts
96
97 .endproc
98