]> git.sur5r.net Git - cc65/blob - libsrc/tgi/tgi_init.s
5aab06a8391c91ad93480941ca4f977d78402f76
[cc65] / libsrc / tgi / tgi_init.s
1 ;
2 ; Ullrich von Bassewitz, 21.06.2002
3 ;
4 ; void __fastcall__ 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
12         .importzp       ptr1
13
14 .proc   _tgi_init
15
16         jsr     _tgi_done               ; Switch off graphics if needed
17         jsr     tgi_init                ; Go into graphics mode
18         jsr     tgi_geterror            ; Get the error code
19         sta     _tgi_error              ; Save for later reference
20         cmp     #TGI_ERR_OK
21         bne     @L9                     ; Jump on error
22
23         inc     _tgi_gmode              ; Remember that graph mode is active
24
25 ; Do driver initialization. Set draw and view pages.
26
27         lda     #0
28         jsr     tgi_setviewpage
29         lda     #0
30         jsr     tgi_setdrawpage
31
32 ; Set the default palette.
33
34         jsr     tgi_getdefpalette       ; Get the default palette into A/X
35         sta     ptr1
36         stx     ptr1+1                  ; Save it
37         jsr     tgi_setpalette          ; Set the default palette.
38         jsr     tgi_geterror            ; Clear a possible error code
39
40 ; Set the drawing color to white
41
42 @L1:    lda     #TGI_COLOR_WHITE
43         jsr     _tgi_setcolor           ; tgi_setcolor (TGI_COLOR_WHITE);
44
45 ; Set the text style
46
47         lda     #<$100
48         ldx     #>$100
49         jsr     pushax                  ; Width scale
50         jsr     pushax                  ; Heigh scale
51         jsr     _tgi_textstyle          ; A = Direction = TEXT_VERTICAL
52
53 ; Clear the screen
54
55         jmp     tgi_clear
56
57 ; Error exit
58
59 @L9:    rts
60
61 .endproc
62
63