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