]> git.sur5r.net Git - cc65/blob - libsrc/tgi/tgi_init.s
removed some duplicated GEOS conio stuff
[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         .importzp       ptr1
12
13 .proc   _tgi_init
14
15         jsr     _tgi_done               ; Switch off graphics if needed
16         jsr     tgi_init                ; Go into graphics mode
17         jsr     tgi_geterror            ; Get the error code
18         sta     _tgi_error              ; Save for later reference
19         cmp     #TGI_ERR_OK
20         bne     @L9                     ; Jump on error
21
22         inc     _tgi_gmode              ; Remember that graph mode is active
23
24 ; Do driver initialization. First set the default palette.
25
26         jsr     tgi_getdefpalette       ; Get the default palette into A/X
27         sta     ptr1
28         stx     ptr1+1
29         ora     ptr1+1                  ; Do we have a default palette?
30         beq     @L1                     ; Jump if no
31         jsr     tgi_setpalette          ; Set the default palette
32
33 ; Set the drawing color to the maximum color
34
35 @L1:    ldx     _tgi_colorcount
36         dex
37         txa
38         jsr     _tgi_setcolor           ; tgi_setcolor (tgi_getmaxcolor ());
39
40 ; Set the text style
41
42         lda     #TGI_TEXT_HORIZONTAL
43         sta     _tgi_textdir
44         ldx     #1
45         stx     _tgi_textmagx
46         ldy     #1
47         sty     _tgi_textmagy
48         jsr     tgi_textstyle           ; Tell the driver about the text style
49
50 ; Clear the screen
51
52         jmp     tgi_clear
53
54 ; Error exit
55
56 @L9:    rts
57
58 .endproc
59
60