]> git.sur5r.net Git - cc65/blob - libsrc/tgi/tgi_init.s
Removed (pretty inconsistently used) tab chars from source code base.
[cc65] / libsrc / tgi / tgi_init.s
1 ;
2 ; Ullrich von Bassewitz, 21.06.2002
3 ;
4 ; void tgi_init (void);
5 ; /* Initialize the already loaded graphics driver */
6
7
8         .include        "tgi-kernel.inc"
9         .include        "tgi-error.inc"
10
11         .import         pushax, pusha, decax1
12         .importzp       ptr1
13
14
15 ;----------------------------------------------------------------------------
16
17 .code
18 .proc   _tgi_init
19
20         jsr     _tgi_done               ; Switch off graphics if needed
21         jsr     tgi_init                ; Go into graphics mode
22         jsr     tgi_geterror            ; Get the error code
23         sta     _tgi_error              ; Save for later reference
24         cmp     #TGI_ERR_OK
25         bne     @L9                     ; Jump on error
26
27         inc     _tgi_gmode              ; Remember that graph mode is active
28
29 ; Get the maximum X and Y coordinate
30
31         jsr     _tgi_getxres
32         jsr     decax1
33         sta     _tgi_xmax
34         stx     _tgi_xmax+1
35
36         jsr     _tgi_getyres
37         jsr     decax1
38         sta     _tgi_ymax
39         stx     _tgi_ymax+1
40
41 ; Do driver initialization. Set draw and view pages.
42
43         lda     #0
44         jsr     tgi_setviewpage
45         lda     #0
46         jsr     tgi_setdrawpage
47
48 ; Set the default palette.
49
50         jsr     tgi_getdefpalette       ; Get the default palette into A/X
51         sta     ptr1
52         stx     ptr1+1                  ; Save it
53         jsr     tgi_setpalette          ; Set the default palette.
54         jsr     tgi_geterror            ; Clear a possible error code
55
56 ; Set the drawing color to white
57
58 @L1:    lda     #tgi_color_white
59         jsr     _tgi_setcolor           ; tgi_setcolor (TGI_COLOR_WHITE);
60
61 ; Set the text style
62
63         lda     #<$100
64         ldx     #>$100
65         jsr     pushax                  ; Width scale = 1.0
66         jsr     pushax                  ; Heigh scale = 1.0
67         jsr     pusha                   ; Text direction = TGI_TEXT_HORIZONTAL
68         jmp     _tgi_settextstyle       ; A = Font = TGI_FONT_BITMAP
69
70 ; Error exit
71
72 @L9:    rts
73
74 .endproc