+;----------------------------------------------------------------------------
+; Set an invalid driver error
+
+tgi_inv_drv:
+ lda #TGI_ERR_INV_DRIVER
+ sta _tgi_error
+ rts
+
+;----------------------------------------------------------------------------
+; Load the pointer to the tgi driver into ptr1.
+
+tgi_set_ptr:
+ lda _tgi_drv
+ sta ptr1
+ lda _tgi_drv+1
+ sta ptr1+1
+ rts
+
+;----------------------------------------------------------------------------
+; void __fastcall__ tgi_uninstall (void);
+; /* Uninstall the currently loaded driver but do not unload it. Will call
+; * tgi_done if necessary.
+; */
+
+_tgi_uninstall:
+ jsr _tgi_done ; Switch off graphics
+
+ jsr tgi_uninstall ; Allow the driver to clean up
+
+ lda #$60 ; RTS opcode
+ sta tgi_irq ; Disable IRQ entry point
+
+; Clear driver pointer and error code
+
+ lda #$00
+ sta _tgi_drv
+ sta _tgi_drv+1
+ sta _tgi_error
+
+ rts
+
+