]> git.sur5r.net Git - cc65/blob - libsrc/tgi/tgi_init.s
Package additional linker configs for the apple2enh
[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. Set draw and view pages.
25
26         lda     #0
27         jsr     tgi_setviewpage
28         lda     #0
29         jsr     tgi_setdrawpage
30
31 ; Set the default palette.
32
33         jsr     tgi_getdefpalette       ; Get the default palette into A/X
34         sta     ptr1
35         stx     ptr1+1                  ; Save it
36         jsr     tgi_setpalette          ; Set the default palette.
37         jsr     tgi_geterror            ; Clear a possible error code
38
39 ; Set the drawing color to the maximum color
40
41 @L1:    ldx     _tgi_colorcount
42         dex
43         txa
44         jsr     _tgi_setcolor           ; tgi_setcolor (tgi_getmaxcolor ());
45
46 ; Set the text style
47
48         lda     #TGI_TEXT_HORIZONTAL
49         sta     _tgi_textdir
50         ldx     #1
51         stx     _tgi_textmagx
52         ldy     #1
53         sty     _tgi_textmagy
54         jsr     tgi_textstyle           ; Tell the driver about the text style
55
56 ; Clear the screen
57
58         jmp     tgi_clear
59
60 ; Error exit
61
62 @L9:    rts
63
64 .endproc
65
66