2 ; Ullrich von Bassewitz, 21.06.2002
4 ; void __fastcall__ tgi_init (unsigned char mode);
5 ; /* Initialize the given graphics mode. */
8 .include "tgi-kernel.inc"
9 .include "tgi-error.inc"
18 jsr _tgi_done ; Switch off graphics if needed
20 sta _tgi_mode ; Remember the mode
21 jsr tgi_init ; Go into graphics mode
22 jsr tgi_geterror ; Get the error code
23 sta _tgi_error ; Save for later reference
25 bne @L9 ; Jump on error
27 ; Do driver initialization. First set the default palette.
29 jsr tgi_getdefpalette ; Get the default palette into A/X
32 ora ptr1+1 ; Do we have a default palette?
34 jsr tgi_setpalette ; Set the default palette
36 ; Set the drawing color to the maximum color
38 @L1: ldx _tgi_colorcount
41 jsr _tgi_setcolor ; tgi_setcolor (tgi_getmaxcolor ());
45 lda #TGI_TEXT_HORIZONTAL
51 jsr tgi_textstyle ; Tell the driver about the text style
60 sta _tgi_mode ; Clear the mode if init was not successful