]> git.sur5r.net Git - cc65/blob - libsrc/tgi/tgi_init.s
a43bf9d04c8a9f7190bfe7e43faffdfa5c0b2397
[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         jsr     tgi_init                ; Initialize the mode
18         jsr     tgi_fetch_error         ; Get the error code
19         pla                             ; Restore the mode
20         ldx     _tgi_error              ; Did we have an error before?
21         bne     @L1                     ; Jump if yes
22         sta     _tgi_mode               ; Set the current mode if not
23 @L1:    rts
24