]> git.sur5r.net Git - cc65/blob - libsrc/tgi/tgi_init.s
e6716b99b6a945dda215edc3be13446f21fd43d1
[cc65] / libsrc / tgi / tgi_init.s
1 ;
2 ; Ullrich von Bassewitz, 21.06.2002
3 ;
4 ; void __fastcall__ tgi_init (unsigned char mode);
5 ; /* Initialize the given graphics mode. */
6
7
8         .include        "tgi-kernel.inc"
9         .include        "tgi-error.inc"
10
11         .import         _tgi_done
12         .export         _tgi_init
13
14 _tgi_init:
15         pha                             ; Save mode
16         jsr     _tgi_done               ; Switch off graphics if needed
17         pla
18         sta     _tgi_mode               ; Remember the mode
19         jsr     tgi_init                ; Go into graphics mode
20         jsr     tgi_fetch_error         ; Get the error code
21         beq     @L1                     ; Jump if no error
22         lda     #$00
23         sta     _tgi_mode               ; Clear the mode if init was not successful
24 @L1:    rts
25