]> git.sur5r.net Git - cc65/commitdiff
Renamed ..._deinstall -> ..._uninstall.
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Tue, 11 Feb 2003 12:37:46 +0000 (12:37 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Tue, 11 Feb 2003 12:37:46 +0000 (12:37 +0000)
Rename tgi_setup to tgi_install.
Make tgi_install and tgi_deinstall user callable.
More cosmetic changes.

git-svn-id: svn://svn.cc65.org/cc65/trunk@1966 b7a2c559-68d2-44c3-8de9-860c34a00d81

41 files changed:
asminc/tgi-kernel.inc
include/tgi.h
include/tgi/tgi-kernel.h
libsrc/tgi/tgi-kernel.s
libsrc/tgi/tgi_bar.s
libsrc/tgi/tgi_circle.s
libsrc/tgi/tgi_clear.s
libsrc/tgi/tgi_done.s
libsrc/tgi/tgi_emu_bar.s
libsrc/tgi/tgi_getcolor.s
libsrc/tgi/tgi_getcolorcount.s
libsrc/tgi/tgi_getdefpalette.s
libsrc/tgi/tgi_geterror.s
libsrc/tgi/tgi_getmaxcolor.s
libsrc/tgi/tgi_getmaxx.s
libsrc/tgi/tgi_getmaxy.s
libsrc/tgi/tgi_getpagecount.s
libsrc/tgi/tgi_getpalette.s
libsrc/tgi/tgi_getpixel.s
libsrc/tgi/tgi_getset.s
libsrc/tgi/tgi_getxres.s
libsrc/tgi/tgi_getyres.s
libsrc/tgi/tgi_gotoxy.s
libsrc/tgi/tgi_init.s
libsrc/tgi/tgi_line.s
libsrc/tgi/tgi_linepop.s
libsrc/tgi/tgi_lineto.s
libsrc/tgi/tgi_load.c
libsrc/tgi/tgi_map_mode.s
libsrc/tgi/tgi_outtext.s
libsrc/tgi/tgi_outtextxy.s
libsrc/tgi/tgi_popxy.s
libsrc/tgi/tgi_popxy2.s
libsrc/tgi/tgi_setcolor.s
libsrc/tgi/tgi_setdrawpage.s
libsrc/tgi/tgi_setpalette.s
libsrc/tgi/tgi_setpixel.s
libsrc/tgi/tgi_setviewpage.s
libsrc/tgi/tgi_textsize.s
libsrc/tgi/tgi_textstyle.s
libsrc/tgi/tgi_unload.s

index fb6939c9bd61a06a261f86d3a392a2e14cac66c6..a299d921a65ef3dc2d95aa3bddc765a78841fe54 100644 (file)
@@ -6,10 +6,10 @@
 ;*                                                                           */
 ;*                                                                           */
 ;*                                                                           */
-;* (C) 2002      Ullrich von Bassewitz                                       */
-;*               Wacholderweg 14                                             */
-;*               D-70597 Stuttgart                                           */
-;* EMail:        uz@musoftware.de                                            */
+;* (C) 2002-2003 Ullrich von Bassewitz                                       */
+;*               Römerstrasse 52                                             */
+;*               D-70794 Filderstadt                                         */
+;* EMail:        uz@cc65.org                                                 */
 ;*                                                                           */
 ;*                                                                           */
 ;* This software is provided 'as-is', without any expressed or implied       */
@@ -48,7 +48,7 @@ TGI_HDR_RES             = 12            ; Reserved for extensions
 
 TGI_HDR_JUMPTAB         = 16
 TGI_HDR_INSTALL         = TGI_HDR_JUMPTAB+0     ; INSTALL routine
-TGI_HDR_DEINSTALL       = TGI_HDR_JUMPTAB+2     ; DEINSTALL routine
+TGI_HDR_UNINSTALL       = TGI_HDR_JUMPTAB+2     ; UNINSTALL routine
 TGI_HDR_INIT            = TGI_HDR_JUMPTAB+4     ; INIT routine
 TGI_HDR_DONE            = TGI_HDR_JUMPTAB+6     ; DONE routine
 TGI_HDR_GETERROR       = TGI_HDR_JUMPTAB+8     ; GETERROR routine
@@ -100,7 +100,7 @@ TGI_TEXT_VERTICAL       = 1
 ; Driver entry points
 
         .global tgi_install
-        .global tgi_deinstall
+        .global tgi_uninstall
         .global tgi_init
         .global tgi_done
        .global tgi_geterror
@@ -127,10 +127,51 @@ TGI_TEXT_VERTICAL       = 1
         .global tgi_emu_bar
         .global tgi_getset
         .global tgi_inv_arg
+        .global tgi_inv_drv
         .global tgi_linepop
         .global tgi_set_ptr
         .global tgi_popxy
         .global tgi_popxy2
         .global tgi_curtoxy
 
+;------------------------------------------------------------------------------
+; C callable functions
+
+        .global _tgi_load
+        .global _tgi_load_driver
+        .global _tgi_unload
+        .global _tgi_install
+        .global _tgi_uninstall
+        .global _tgi_init
+        .global _tgi_done
+        .global _tgi_geterror
+        .global _tgi_clear
+        .global _tgi_getpagecount
+        .global _tgi_setviewpage
+        .global _tgi_setdrawpage
+        .global _tgi_getcolorcount
+        .global _tgi_getmaxcolor
+        .global _tgi_setcolor
+        .global _tgi_getcolor
+        .global _tgi_setpalette
+        .global _tgi_getpalette
+        .global _tgi_getdefpalette
+        .global _tgi_getxres
+        .global _tgi_getmaxx
+        .global _tgi_getyres
+        .global _tgi_getmaxy
+        .global _tgi_getpixel
+        .global _tgi_setpixel
+        .global _tgi_gotoxy
+        .global _tgi_line
+        .global _tgi_lineto
+        .global _tgi_circle
+        .global _tgi_bar
+        .global _tgi_textstyle
+        .global _tgi_textwidth
+        .global _tgi_textheight
+        .global _tgi_outtext
+        .global _tgi_outtextxy
+
+
 
index b30286e3d000d92c66ddd36be8405aef54387cc3..bb4a9564461d5f8ea8efa46c9ee1680e0f84f047 100644 (file)
@@ -6,10 +6,10 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 2002      Ullrich von Bassewitz                                       */
-/*               Wacholderweg 14                                             */
-/*               D-70597 Stuttgart                                           */
-/* EMail:        uz@musoftware.de                                            */
+/* (C) 2002-2003 Ullrich von Bassewitz                                       */
+/*               Römerstrasse 52                                             */
+/*               D-70794 Filderstadt                                         */
+/* EMail:        uz@cc65.org                                                 */
 /*                                                                           */
 /*                                                                           */
 /* This software is provided 'as-is', without any expressed or implied       */
 
 
 void __fastcall__ tgi_load (unsigned char mode);
-/* Install the matching driver for the given mode. Will just load the driver
- * and check if loading was successul. Will not switch to gaphics mode.
+/* Load and install the matching driver for the given mode. Will just load
+ * the driver and check if loading was successul. Will not switch to gaphics
+ * mode.
  */
 
 void __fastcall__ tgi_load_driver (const char* name);
-/* Install the given driver. This function is identical to tgi_load with the
- * only difference that the name of the driver is specified explicitly. You
- * should NOT use this function in most cases, use tgi_load() instead.
+/* Load and install the given driver. This function is identical to tgi_load
+ * with the only difference that the name of the driver is specified
+ * explicitly. You should NOT use this function in most cases, use tgi_load()
+ * instead.
  */
 
 void __fastcall__ tgi_unload (void);
-/* Unload the currently loaded driver. Will call tgi_done if necessary. */
+/* Uninstall, then unload the currently loaded driver. Will call tgi_done if
+ * necessary.
+ */
+
+void __fastcall__ tgi_install (void* driver);
+/* Install an already loaded driver. */
+
+void __fastcall__ tgi_uninstall (void);
+/* Uninstall the currently loaded driver but do not unload it. Will call
+ * tgi_done if necessary.
+ */
 
 void __fastcall__ tgi_init (void);
-/* Initialize the already loaded graphics driver */
+/* Initialize the already loaded graphics driver. */
 
 void __fastcall__ tgi_done (void);
-/* End graphics mode, switch back to text mode. Will NOT unload the driver! */
+/* End graphics mode, switch back to text mode. Will NOT uninstall or unload
+ * the driver!
+ */
 
 unsigned char __fastcall__ tgi_geterror (void);
 /* Return the error code for the last operation. This will also clear the
index d2e23f40dec515d8af0e175e012f5f29fbd99c51..e8982d1995b896a9c15174a6edb6b96f9788303a 100644 (file)
@@ -6,10 +6,10 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 2002      Ullrich von Bassewitz                                       */
-/*               Wacholderweg 14                                             */
-/*               D-70597 Stuttgart                                           */
-/* EMail:        uz@musoftware.de                                            */
+/* (C) 2002-2003 Ullrich von Bassewitz                                       */
+/*               Römerstrasse 52                                             */
+/*               D-70794 Filderstadt                                         */
+/* EMail:        uz@cc65.org                                                 */
 /*                                                                           */
 /*                                                                           */
 /* This software is provided 'as-is', without any expressed or implied       */
@@ -46,7 +46,7 @@
 
 /* A structure that describes the header of a graphics driver loaded into
  * memory.
- */
+ */                                          
 typedef struct {
 
     /* Data that describes the capabilities of the driver */
@@ -60,7 +60,7 @@ typedef struct {
 
     /* Jump vectors. Note that these are not C callable */
     void*               install;        /* INSTALL routine */
-    void*               deinstall;      /* DEINSTALL routine */
+    void*               uninstall;      /* UNINSTALL routine */
     void*               init;           /* INIT routine */
     void*               done;           /* DONE routine */
     void*              geterror;       /* GETERROR routine */
@@ -106,9 +106,6 @@ extern unsigned char    tgi_pagecount;  /* Number of available screens */
 const char* __fastcall__ tgi_map_mode (unsigned char mode);
 /* Map a tgi mode to a driver name. Returns NULL if no driver available. */
 
-void __fastcall__ tgi_setup (void);
-/* Setup the driver and graphics kernel once the driver is loaded */
-
 
 
 /* End of tgi-kernel.h */
index dbb5a5c0e898f0d38e93cb97078c21801ccd9dc6..0fce818b1f6afc4aad45e39cd07cf2dabb6ceff8 100644 (file)
@@ -7,7 +7,7 @@
         .include        "tgi-kernel.inc"
         .include        "tgi-error.inc"
 
-        .export         _tgi_setup
+        .export         tgi_clear_ptr
         .importzp       ptr1
 
 
@@ -42,7 +42,7 @@ tgi_driver_var_size     = * - tgi_driver_vars
 ; Jump table for the driver functions.
 
 tgi_install:               jmp     $0000
-tgi_deinstall:             jmp     $0000
+tgi_uninstall:             jmp     $0000
 tgi_init:           jmp     $0000
 tgi_done:           jmp     $0000
 tgi_geterror:      jmp     $0000
@@ -63,21 +63,31 @@ tgi_circle:         jmp     $0000
 tgi_textstyle:      jmp     $0000
 tgi_outtext:        jmp     $0000
 
+; Driver header signature
+.rodata
+tgi_sig:        .byte   $74, $67, $69, $00      ; "tgi", version
+tgi_sig_len     = * - tgi_sig
+
 
 ;----------------------------------------------------------------------------
-; void __fastcall__ tgi_setup (void);
-; /* Setup the driver and graphics kernel once the driver is loaded */
+; void __fastcall__ tgi_install (void* driver);
+; /* Install an already loaded driver. */
 
 
-copy:   lda     (ptr1),y
-        sta     tgi_install,x
-        iny
-        inx
-        rts
+_tgi_install:
+               sta     _tgi_drv
+       sta     ptr1
+       stx     _tgi_drv+1
+       stx     ptr1+1
 
+; Check the driver signature
 
-_tgi_setup:
-       jsr     tgi_set_ptr             ; load _tgi_drv into ptr1
+        ldy     #tgi_sig_len-1
+@L0:    lda     (ptr1),y
+        cmp     tgi_sig,y
+        bne     tgi_inv_drv
+        dey
+        bpl     @L0
 
 ; Copy the jump vectors
 
@@ -125,14 +135,12 @@ _tgi_setup:
 
        rts
 
-;----------------------------------------------------------------------------
-; Load the pointer to the tgi driver into ptr1.
+; Copy one byte from the jump vectors
 
-tgi_set_ptr:
-               lda     _tgi_drv
-       sta     ptr1
-       lda     _tgi_drv+1
-       sta     ptr1+1
+copy:   lda     (ptr1),y
+        sta     tgi_install,x
+        iny
+        inx
         rts
 
 ;----------------------------------------------------------------------------
@@ -143,3 +151,42 @@ tgi_inv_arg:
         sta     _tgi_error
         rts
 
+;----------------------------------------------------------------------------
+; 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
+
+; Clear driver pointer and error code
+
+tgi_clear_ptr:                          ; External entry point
+        lda     #$00
+        sta     _tgi_drv
+        sta     _tgi_drv+1
+        sta     _tgi_error
+
+        rts
+
+
index 1b6ffb0e74a739c6084fee3849cf7e83f130474a..476f9d7a4eb4ea5f5e242310f9e8f6ee9659c560 100644 (file)
@@ -9,10 +9,10 @@
 
         .importzp       ptr1, ptr2, ptr3, ptr4
         .import         popax
-        .import         _tgi_getmaxx, _tgi_getmaxy
-        .export         _tgi_bar
 
-_tgi_bar:
+
+.proc   _tgi_bar
+
         sta     ptr4            ; Y2
         stx     ptr4+1
 
@@ -130,4 +130,4 @@ _tgi_bar:
 
 @L9:    rts
 
-
+.endproc
index 4908000c9bb290d7859ab9cefd703239eb13f5c6..ab79a1d2b4b6bea80195d41397994d31bd4e4e5c 100644 (file)
@@ -8,12 +8,12 @@
 
         .import         popax
         .importzp       tmp1
-        .export         _tgi_circle
 
-_tgi_circle:
+.proc   _tgi_circle
+
         sta     tmp1            ; Get the coordinates
         jsr     popax
         jsr     tgi_popxy       ; Pop X/Y into ptr1/ptr2
         jmp     tgi_circle      ; Call the driver
 
-
+.endproc
index 558f4ca0989211cb2c2bfa1eb5a546ccbcb4f45c..65fe4b341df5fb328fe35dd5c2c7bcec895f1ef3 100644 (file)
@@ -6,8 +6,6 @@
 
         .include        "tgi-kernel.inc"
 
-        .export         _tgi_clear
-
 _tgi_clear      = tgi_clear               ; Call the driver
 
 
index 816567341544cc30af600cd9bd55229e2ec1cb87..e3d37b373f5f4c701fa293c91324b895e20a79bd 100644 (file)
@@ -7,9 +7,8 @@
         .include        "tgi-kernel.inc"
         .include        "tgi-error.inc"
 
-        .export         _tgi_done
+.proc   _tgi_done
 
-_tgi_done:
         lda     _tgi_gmode              ; Is a graphics mode active?
         beq     @L1                     ; Jump if not
         jsr     tgi_done                ; Call the driver routine
@@ -20,5 +19,5 @@ _tgi_done:
         sta     _tgi_gmode              ; Reset the graph mode flag (A = 0)
 @L1:    rts
 
-
+.endproc
 
index 048f10bee9ab795cf706343d3682dabccfd1ec65..e8a06a1ed495e70f2d541f38021de772b7cface3 100644 (file)
@@ -7,9 +7,9 @@
         .include        "tgi-kernel.inc"
 
         .importzp       ptr1, ptr2, ptr3, ptr4
-        .export         tgi_emu_bar
 
-tgi_emu_bar:
+.proc   tgi_emu_bar
+
         lda     ptr4
         sta     Y2
         lda     ptr4+1
@@ -63,6 +63,8 @@ tgi_emu_bar:
 
 @L4:    rts
 
+.endproc
+
 ;-----------------------------------------------------------------------------
 ; Data
 
index 32efd551131125b3129ce608ebcd5d6ccfd4b274..9169b5423623e4c9b44450afe8cd7b54f56c99d1 100644 (file)
@@ -6,10 +6,11 @@
 
 
         .include        "tgi-kernel.inc"
-        .export         _tgi_getcolor
 
-_tgi_getcolor:
+.proc   _tgi_getcolor
+
         lda     _tgi_color      ; Get the current drawing color
         ldx     #0              ; Clear high byte
         rts
 
+.endproc
index 0661a43f0288a3a5d0f61b53ed9e7ef646f72c1e..ae34220fdd881956f7862a3cf8c0f2e270b2eb3d 100644 (file)
@@ -5,11 +5,12 @@
 ; /* Get the number of available colors */
 
         .include        "tgi-kernel.inc"
-        .export         _tgi_getcolorcount
 
+.proc   _tgi_getcolorcount
 
-_tgi_getcolorcount:
         lda     _tgi_colorcount
         ldx     #0
         rts
 
+.endproc
+
index f1bf1c99961dbb521e156b6c1bcd8ecc459bdb00..8b0325728b7734de5d79aa48976807985c3ec2e5 100644 (file)
@@ -8,7 +8,6 @@
 ;
 
         .include        "tgi-kernel.inc"
-        .export         _tgi_getdefpalette
 
 _tgi_getdefpalette      =       tgi_getdefpalette       ; Call the driver
 
index 569d6c27675ba5b0c42f52d2ddeaaaa6c5bcd223..c2426158bf514f312254b800811273f93decd156 100644 (file)
@@ -8,9 +8,8 @@
 
         .include        "tgi-kernel.inc"
 
-        .export         _tgi_geterror
+.proc   _tgi_geterror
 
-_tgi_geterror:
         lda     _tgi_drv                ; Check if we have a driver
         ora     _tgi_drv+1
         beq     @L1
@@ -22,3 +21,5 @@ _tgi_geterror:
         stx     _tgi_error              ; Clear high level error code
 @L2:    rts
 
+.endproc
+
index 67931192041de49d4ad19f72142ebb7c051cda5c..2e2b2ad0e8332cb092a81f559e60dbfa963d9a33 100644 (file)
@@ -4,19 +4,18 @@
 ; unsigned char __fastcall__ tgi_getmaxcolor (void);
 ; /* Return the maximum supported color number (the number of colors would
 ;  * then be getmaxcolor()+1).
-;  */                          
+;  */
 ;
 
         .include        "tgi-kernel.inc"
-        .export         _tgi_getmaxcolor
 
+.proc   _tgi_getmaxcolor
 
-_tgi_getmaxcolor:
         ldx     _tgi_colorcount
         dex
         txa
         ldx     #0
         rts
 
-
+.endproc
 
index bbfa3d6382549b6297321cc7da9b62059cd821e2..7762993e88a953993d947871adab3ae2d1f17383 100644 (file)
@@ -7,14 +7,15 @@
 ;  */
 
         .include        "tgi-kernel.inc"
-        .export         _tgi_getmaxx
-        .import         _tgi_getxres
+
         .import         decax1
 
 
-_tgi_getmaxx:
+.proc   _tgi_getmaxx
+
         jsr     _tgi_getxres
         jmp     decax1
 
+.endproc
 
 
index 56e186b18bb1451c48c92dbf090ba34198f44754..d54675ff5ac9b0c733c2a9b407dae93564b71f56 100644 (file)
@@ -7,13 +7,12 @@
 ;  */
 
         .include        "tgi-kernel.inc"
-        .export         _tgi_getmaxy
-        .import         _tgi_getyres
         .import         decax1
 
+.proc   _tgi_getmaxy
 
-_tgi_getmaxy:
         jsr     _tgi_getyres
         jmp     decax1
 
+.endproc
 
index de59e9b58e4fed48ff34519e81e34744de1383ac..7c8f480b865639102a22b02caa40d12d31e248b2 100644 (file)
@@ -6,11 +6,12 @@
 ;
 
         .include        "tgi-kernel.inc"
-        .export         _tgi_getpagecount
 
+.proc   _tgi_getpagecount
 
-_tgi_getpagecount:
         lda     _tgi_pagecount
         ldx     #0
         rts
 
+.endproc
+
index 46eaa30d9ddd5d1c37ce948f667e51256f991b68..ec64ffbc41107265089cb1a3fe212bcf7f58427e 100644 (file)
@@ -8,10 +8,7 @@
 ;
 
         .include        "tgi-kernel.inc"
-        .export         _tgi_getpalette
-
 
 _tgi_getpalette         =       tgi_getpalette          ; Call the driver
 
 
-
index 1806d9c167adc74992bf4427e43ed4ddaf186743..770757a7426391384dd62631c6c68219d5ead1a8 100644 (file)
@@ -6,13 +6,15 @@
 
 
         .include        "tgi-kernel.inc"
-                       
+
         .import         return0
-        .export         _tgi_getpixel
 
-_tgi_getpixel:
+.proc   _tgi_getpixel
+
         jsr     tgi_getset      ; Pop args, check range
         bcs     @L9
         jmp     tgi_getpixel    ; Call the driver
 @L9:    jmp     return0         ; Assume bg color
 
+.endproc
+
index 4ebabaa9615d0e94e5ef8daf5260f3a4b884bd74..aded19d718e59ecfd333672fc81e5f6b81e90211 100644 (file)
@@ -11,7 +11,8 @@
         .importzp       ptr1, ptr2
 
 
-tgi_getset:
+.proc   tgi_getset
+
         jsr     tgi_popxy       ; Pop X/Y into ptr1/ptr2
 
 ; Are the coordinates out of range? First check if any coord is negative.
@@ -36,4 +37,5 @@ tgi_getset:
         sbc     _tgi_yres+1
 @L9:    rts
 
+.endproc
 
index 2a85205c8cc20fcc5c2d52cfefe9b0e81c3ce8ee..62f828c609168a4bd5a5fa9249a8aff1afa7e958 100644 (file)
@@ -6,12 +6,12 @@
 
 
         .include        "tgi-kernel.inc"
-        .export         _tgi_getxres
 
+.proc   _tgi_getxres
 
-_tgi_getxres:
         lda     _tgi_xres
         ldx     _tgi_xres+1
         rts
 
+.endproc
 
index 172d64f12d1812ddd76eb9d53b046bd1d014b8df..d018a39285a8bd36c04a6cbf87423b0855b34f98 100644 (file)
@@ -6,13 +6,12 @@
 
 
         .include        "tgi-kernel.inc"
-        .export         _tgi_getyres
-        .import         ldaxidx
 
+.proc   _tgi_getyres
 
-_tgi_getyres:
         lda     _tgi_yres
         ldx     _tgi_yres+1
         rts
 
+.endproc
 
index c363242854bb8d1f6989af89dc2a4af95880f7b1..d02f0ab3d693582bf98e0898b0e20c1e0343b54a 100644 (file)
@@ -8,9 +8,9 @@
         .include        "tgi-kernel.inc"
 
         .import         popax
-        .export         _tgi_gotoxy
 
-_tgi_gotoxy:
+.proc   _tgi_gotoxy
+
         sta     _tgi_cury               ; Y
         stx     _tgi_cury+1
         jsr     popax
@@ -18,5 +18,5 @@ _tgi_gotoxy:
         stx     _tgi_curx+1
         rts
 
+.endproc
 
index 81f784bce944afb07cc4c4584807cde038bf685c..4c521afba50a6cf8b611e1b7095351589f474a66 100644 (file)
@@ -9,11 +9,9 @@
         .include        "tgi-error.inc"
 
         .importzp       ptr1
-        .import         _tgi_done
-        .import         _tgi_setcolor
-        .export         _tgi_init
 
-_tgi_init:
+.proc   _tgi_init
+
         jsr     _tgi_done               ; Switch off graphics if needed
         jsr     tgi_init                ; Go into graphics mode
         jsr     tgi_geterror            ; Get the error code
@@ -57,3 +55,6 @@ _tgi_init:
 
 @L9:    rts
 
+.endproc
+
+
index 24295eed287706aff24e9b4b1ed4df629a5ed1d7..d895dc533bcac46e456663d456e2ed5fc6f12958 100644 (file)
@@ -8,12 +8,14 @@
         .include        "tgi-kernel.inc"
 
         .import         popax
-        .export         _tgi_line
 
-_tgi_line:
+.proc   _tgi_line
+
         jsr     tgi_linepop     ; Pop/store Y2/X2
         jsr     popax
         jsr     tgi_popxy       ; Pop/store X1/Y1 into ptr1/ptr2
         jmp     tgi_line        ; Call the driver
 
+.endproc
+
 
index 8871f9c3615fb52182bb0e0d3744615d0d3cb6fc..8cc3dff89ba42e92a72a8b49b447424fd6c6437c 100644 (file)
@@ -9,7 +9,8 @@
         .import         popax
         .importzp       ptr3, ptr4
 
-tgi_linepop:
+.proc   tgi_linepop
+
         sta     ptr4            ; Y2
         stx     ptr4+1
         sta     _tgi_cury
@@ -21,4 +22,5 @@ tgi_linepop:
         stx     _tgi_curx+1
         rts
 
+.endproc
 
index 4799d793a4ce0fc3b86bbf84b6f57ea2ac1fe386..2cf4a9a1d9768397fd2d62208750d395d2afa591 100644 (file)
@@ -9,11 +9,12 @@
         .include        "tgi-kernel.inc"
 
         .import         popax
-        .export         _tgi_lineto
 
-_tgi_lineto:
+.proc   _tgi_lineto
+
         jsr     tgi_curtoxy     ; Copy curx/cury into ptr1/ptr2
         jsr     tgi_linepop     ; Pop x2/y2 into ptr3/ptr4 and curx/cury
         jmp     tgi_line        ; Call the driver
 
+.endproc
 
index d11084b2b7385f6eab40ef4d85df7ff80115c06c..17a8de02edeedbca670993a58a07de1a353fdeda 100644 (file)
@@ -64,8 +64,6 @@ void __fastcall__ tgi_load_driver (const char* name)
  * should NOT use this function in most cases, use tgi_load() instead.
  */
 {
-    static const unsigned char marker[4] = { 0x74, 0x67, 0x69, 0x00 };
-
     static struct mod_ctrl ctrl = {
         read            /* Read from disk */
     };
@@ -78,38 +76,24 @@ void __fastcall__ tgi_load_driver (const char* name)
 
     /* Now open the file */
     ctrl.callerdata = open (name, O_RDONLY);
-    if (ctrl.callerdata < 0) {
-        tgi_error = TGI_ERR_CANNOT_LOAD;
-        return;
-    }
+    if (ctrl.callerdata >= 0) {
 
-    /* Load the module */
-    Res = mod_load (&ctrl);
+        /* Load the module */
+        Res = mod_load (&ctrl);
 
-    /* Close the input file */
-    close (ctrl.callerdata);
+        /* Close the input file */
+        close (ctrl.callerdata);
 
-    /* Check the return code */
-    if (Res == MLOAD_OK) {
+        /* Check the return code */
+        if (Res == MLOAD_OK) {
 
-        /* Get a pointer to the loaded driver */
-        tgi_drv = (tgi_drv_header*) ctrl.module;
+            /* Check the driver signature, install the driver */
+            tgi_install (ctrl.module);
+            return;
 
-        /* Check the header */
-        if (memcmp (tgi_drv, marker, sizeof (marker)) != 0) {
-            /* Invalid driver */
-            mod_free (tgi_drv);
-            tgi_drv = 0;
-            tgi_error = TGI_ERR_INV_DRIVER;
-        } else {
-            /* Driver is ok do setup */
-            tgi_setup ();
         }
-
-    } else {
-
-        /* Error loading the driver */
-        tgi_error = TGI_ERR_CANNOT_LOAD;
-
     }
+
+    /* Error loading the driver */
+    tgi_error = TGI_ERR_CANNOT_LOAD;
 }
index 11af5f622e2730f76ca2f9cc4a8c3a57089ca876..d6a5f64dcc7198880d11ceecdc260d9432e6c962 100644 (file)
@@ -16,7 +16,8 @@
 
 .code
 
-_tgi_map_mode:
+.proc   _tgi_map_mode
+
         sta     tmp1                    ; Save mode
         ldy     #$00
 
@@ -48,4 +49,6 @@ Found:  tya
         inx
 @L1:    rts
 
-    
+.endproc
+
+
index 4c087bc95c6db18af5a0f5f1896d7a376bcefeff..f66cc0086febe05d3b00610a30685a9df2945288 100644 (file)
@@ -9,12 +9,13 @@
 
         .import         popax
         .importzp       ptr3
-        .export         _tgi_outtext
 
-_tgi_outtext:
+.proc   _tgi_outtext
+
         sta     ptr3
         stx     ptr3+1          ; Save s
         jsr     tgi_curtoxy     ; Copy curx/cury into ptr1/ptr2
         jmp     tgi_outtext     ; Call the driver
 
+.endproc
 
index c9b2092610091cc7f0b1e132f913cc12b6519a75..efc3e80d59a63dce6f31a00f6f5462bf08fa3d1a 100644 (file)
@@ -9,13 +9,14 @@
 
         .import         popax
         .importzp       ptr3
-        .export         _tgi_outtextxy
 
-_tgi_outtextxy:
+.proc   _tgi_outtextxy
+
         sta     ptr3
         stx     ptr3+1          ; Save s
        jsr     popax           ; get y from stack
         jsr     tgi_popxy       ; Pop x/y into ptr1/ptr2
         jmp     tgi_outtext     ; Call the driver
 
+.endproc
 
index 3e2900328b9c6d60f8a6c9725d7cb53e04b8b4d3..55b259dab8921c868d2cc4071c95c0c311dc0a6c 100644 (file)
@@ -9,7 +9,8 @@
         .import         popax
         .importzp       ptr1, ptr2
 
-tgi_popxy:
+.proc   tgi_popxy
+
         sta     ptr2            ; Y
         stx     ptr2+1
         jsr     popax
@@ -17,4 +18,5 @@ tgi_popxy:
         stx     ptr1+1
         rts
 
+.endproc
 
index d74c8e9babde668359e73596732d21b4fc1964a3..8ef17f92bb1e7395cddf93588090ea715060426c 100644 (file)
@@ -9,7 +9,8 @@
         .import         popax
         .importzp       ptr3, ptr4
 
-tgi_popxy2:
+.proc   tgi_popxy2
+
         sta     ptr4            ; Y
         stx     ptr4+1
         jsr     popax
@@ -17,3 +18,6 @@ tgi_popxy2:
         stx     ptr3+1
         rts
 
+.endproc
+
+
index 242f07826c8cb2b2d88454b59bb57b5e2c7c25a3..8e6fdc55554bb3eaadbd470c605e89fc2609cf44 100644 (file)
@@ -6,13 +6,14 @@
 
 
         .include        "tgi-kernel.inc"
-        .export         _tgi_setcolor
 
-_tgi_setcolor:
+.proc   _tgi_setcolor
+
         cmp     _tgi_colorcount ; Compare to available colors
         bcs     @L1
         sta     _tgi_color      ; Remember the drawing color
         jmp     tgi_setcolor    ; Call the driver
 @L1:    jmp     tgi_inv_arg     ; Invalid argument
 
+.endproc
 
index 90522580e71d96c510b95f68633bf43c1378b9cd..b1568ff16e92b74f7456083241fad6fac3f14714 100644 (file)
@@ -6,13 +6,13 @@
 
 
         .include        "tgi-kernel.inc"
-        .export         _tgi_setdrawpage
 
-_tgi_setdrawpage:
+.proc   _tgi_setdrawpage
+
         cmp     _tgi_pagecount  ; Compare to available pages
         bcs     @L1
         jmp     tgi_setdrawpage ; Call the driver
 @L1:    jmp     tgi_inv_arg     ; Invalid argument
 
-
+.endproc
 
index baa572b2166e0b255b9681a3f26c4b34c8fff929..b8f269b9e8b28a6532782bebf1c126f26ea4ef0c 100644 (file)
         .include        "tgi-kernel.inc"
 
         .importzp       ptr1
-        .export         _tgi_setpalette
 
+.proc   _tgi_setpalette
 
-_tgi_setpalette:
         sta     ptr1
         stx     ptr1+1
         jmp     tgi_setpalette          ; Call the driver
 
+.endproc
 
index d72c05dfc23d4d29cfe7d1f2164ad52a248f8f44..cd2df6891ddcef3f17f05a1950b9e957c5e4e5eb 100644 (file)
@@ -7,13 +7,13 @@
 
         .include        "tgi-kernel.inc"
 
-        .export         _tgi_setpixel
+.proc   _tgi_setpixel
 
-_tgi_setpixel:
         jsr     tgi_getset      ; Pop args, check range
         bcs     @L9
         jmp     tgi_setpixel    ; Call the driver
 @L9:    rts
 
+.endproc
 
 
index d8fdb54ba37ecfdde6df1e68654db156abb16c51..a287344cac7ad6a5e64b1e117413709620056df3 100644 (file)
@@ -7,12 +7,13 @@
 
 
         .include        "tgi-kernel.inc"
-        .export         _tgi_setviewpage
 
-_tgi_setviewpage:
+.proc   _tgi_setviewpage
+
         cmp     _tgi_pagecount  ; Compare to available pages
         bcs     @L1
         jmp     tgi_setviewpage ; Call the driver
 @L1:    jmp     tgi_inv_arg     ; Invalid argument
 
+.endproc
 
index 1ed4d225c6a3b9a7ce6a92dad362ea3f079d8207..24c0d4a75864a13003b5e648d739a303230b7bc6 100644 (file)
@@ -1,4 +1,4 @@
-;                
+;
 ; Ullrich von Bassewitz, 22.06.2002
 ;
 
@@ -6,8 +6,6 @@
         .include        "tgi-kernel.inc"
 
         .import         _strlen, pushax, tosumulax
-        .export         _tgi_textwidth
-        .export         _tgi_textheight
 
 ;-----------------------------------------------------------------------------
 ; unsigned __fastcall__ tgi_textwidth (const char* s);
@@ -17,6 +15,7 @@
 
 
 _tgi_textwidth:
+
         ldy     _tgi_textdir            ; Get text direction
         bne     height
 
index ddb1aa698694ce405ba5575d47c2bb75ca37c277..2f7c2bcface5c219ac4d46f3f2a740df491b8679 100644 (file)
@@ -9,9 +9,9 @@
         .include        "tgi-kernel.inc"
 
         .import         popax, incsp2
-        .export         _tgi_textstyle
 
-_tgi_textstyle:
+.proc   _tgi_textstyle
+
         pha
         jsr     popax                   ; Get magx/magy in one call
         tay
@@ -39,3 +39,5 @@ DirOk:  cpy     #$00
 
         jmp     tgi_textstyle
 
+.endproc
+
index fba835ed18d579df36035bf1fabecfe83ac83634..69171de321bcf696c04534feb13b7e7907ac7ebc 100644 (file)
@@ -8,25 +8,18 @@
         .include        "tgi-kernel.inc"
         .include        "modload.inc"
 
-        .import         _tgi_done
-        .export         _tgi_unload
+        .import         tgi_clear_ptr
 
+.proc   _tgi_unload
 
-_tgi_unload:
         jsr     _tgi_done               ; Switch off graphics
-        jsr     tgi_deinstall           ; Allow the driver to clean up
+        jsr     tgi_uninstall           ; Allow the driver to clean up
 
         lda     _tgi_drv
         ldx     _tgi_drv+1
         jsr     _mod_free               ; Free the driver
 
-; Clear variables
-
-        lda     #$00
-        sta     _tgi_drv
-        sta     _tgi_drv+1
-        sta     _tgi_error
-        
-        rts
+        jmp     tgi_clear_ptr           ; Clear the driver pointer and exit
 
+.endproc