diff --git a/libsrc/tgi/tgi-kernel.s b/libsrc/tgi/tgi-kernel.s index efef42095..dbb5a5c0e 100644 --- a/libsrc/tgi/tgi-kernel.s +++ b/libsrc/tgi/tgi-kernel.s @@ -18,7 +18,7 @@ _tgi_drv: .res 2 ; Pointer to driver _tgi_error: .res 1 ; Last error code -_tgi_mode: .res 1 ; Graphics mode or zero +_tgi_gmode: .res 1 ; Flag: Graphics mode active _tgi_curx: .res 2 ; Current drawing cursor X _tgi_cury: .res 2 ; Current drawing cursor Y _tgi_color: .res 1 ; Current drawing color diff --git a/libsrc/tgi/tgi_done.s b/libsrc/tgi/tgi_done.s index e3abf53fd..816567341 100644 --- a/libsrc/tgi/tgi_done.s +++ b/libsrc/tgi/tgi_done.s @@ -10,14 +10,14 @@ .export _tgi_done _tgi_done: - lda _tgi_mode ; Is a graphics mode active? + lda _tgi_gmode ; Is a graphics mode active? beq @L1 ; Jump if not jsr tgi_done ; Call the driver routine jsr tgi_geterror ; Get the error code sta _tgi_error ; Save it for reference cmp #TGI_ERR_OK bne @L1 ; Jump if we had an error - sta _tgi_mode ; Reset the current mode (A = 0) + sta _tgi_gmode ; Reset the graph mode flag (A = 0) @L1: rts diff --git a/libsrc/tgi/tgi_init.s b/libsrc/tgi/tgi_init.s index c21b669da..81f784bce 100644 --- a/libsrc/tgi/tgi_init.s +++ b/libsrc/tgi/tgi_init.s @@ -1,8 +1,8 @@ ; ; Ullrich von Bassewitz, 21.06.2002 ; -; void __fastcall__ tgi_init (unsigned char mode); -; /* Initialize the given graphics mode. */ +; void __fastcall__ tgi_init (void); +; /* Initialize the already loaded graphics driver */ .include "tgi-kernel.inc" @@ -14,16 +14,15 @@ .export _tgi_init _tgi_init: - pha ; Save mode jsr _tgi_done ; Switch off graphics if needed - pla - sta _tgi_mode ; Remember the mode jsr tgi_init ; Go into graphics mode jsr tgi_geterror ; Get the error code sta _tgi_error ; Save for later reference cmp #TGI_ERR_OK bne @L9 ; Jump on error + inc _tgi_gmode ; Remember that graph mode is active + ; Do driver initialization. First set the default palette. jsr tgi_getdefpalette ; Get the default palette into A/X @@ -56,7 +55,5 @@ _tgi_init: ; Error exit -@L9: lda #$00 - sta _tgi_mode ; Clear the mode if init was not successful - rts +@L9: rts