1
0
mirror of https://github.com/cc65/cc65.git synced 2025-08-08 22:25:28 +00:00

Renamed ..._deinstall -> ..._uninstall.

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
This commit is contained in:
cuz
2003-02-11 12:37:46 +00:00
parent 6410c0d55a
commit 8ecdf9d6b7
41 changed files with 265 additions and 168 deletions

View File

@@ -6,10 +6,10 @@
;* */ ;* */
;* */ ;* */
;* */ ;* */
;* (C) 2002 Ullrich von Bassewitz */ ;* (C) 2002-2003 Ullrich von Bassewitz */
;* Wacholderweg 14 */ ;* R<EFBFBD>merstrasse 52 */
;* D-70597 Stuttgart */ ;* D-70794 Filderstadt */
;* EMail: uz@musoftware.de */ ;* EMail: uz@cc65.org */
;* */ ;* */
;* */ ;* */
;* This software is provided 'as-is', without any expressed or implied */ ;* 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_JUMPTAB = 16
TGI_HDR_INSTALL = TGI_HDR_JUMPTAB+0 ; INSTALL routine 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_INIT = TGI_HDR_JUMPTAB+4 ; INIT routine
TGI_HDR_DONE = TGI_HDR_JUMPTAB+6 ; DONE routine TGI_HDR_DONE = TGI_HDR_JUMPTAB+6 ; DONE routine
TGI_HDR_GETERROR = TGI_HDR_JUMPTAB+8 ; GETERROR routine TGI_HDR_GETERROR = TGI_HDR_JUMPTAB+8 ; GETERROR routine
@@ -100,7 +100,7 @@ TGI_TEXT_VERTICAL = 1
; Driver entry points ; Driver entry points
.global tgi_install .global tgi_install
.global tgi_deinstall .global tgi_uninstall
.global tgi_init .global tgi_init
.global tgi_done .global tgi_done
.global tgi_geterror .global tgi_geterror
@@ -127,10 +127,51 @@ TGI_TEXT_VERTICAL = 1
.global tgi_emu_bar .global tgi_emu_bar
.global tgi_getset .global tgi_getset
.global tgi_inv_arg .global tgi_inv_arg
.global tgi_inv_drv
.global tgi_linepop .global tgi_linepop
.global tgi_set_ptr .global tgi_set_ptr
.global tgi_popxy .global tgi_popxy
.global tgi_popxy2 .global tgi_popxy2
.global tgi_curtoxy .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

View File

@@ -6,10 +6,10 @@
/* */ /* */
/* */ /* */
/* */ /* */
/* (C) 2002 Ullrich von Bassewitz */ /* (C) 2002-2003 Ullrich von Bassewitz */
/* Wacholderweg 14 */ /* R<EFBFBD>merstrasse 52 */
/* D-70597 Stuttgart */ /* D-70794 Filderstadt */
/* EMail: uz@musoftware.de */ /* EMail: uz@cc65.org */
/* */ /* */
/* */ /* */
/* This software is provided 'as-is', without any expressed or implied */ /* This software is provided 'as-is', without any expressed or implied */
@@ -66,24 +66,38 @@
void __fastcall__ tgi_load (unsigned char mode); void __fastcall__ tgi_load (unsigned char mode);
/* Install the matching driver for the given mode. Will just load the driver /* Load and install the matching driver for the given mode. Will just load
* and check if loading was successul. Will not switch to gaphics mode. * the driver and check if loading was successul. Will not switch to gaphics
* mode.
*/ */
void __fastcall__ tgi_load_driver (const char* name); void __fastcall__ tgi_load_driver (const char* name);
/* Install the given driver. This function is identical to tgi_load with the /* Load and install the given driver. This function is identical to tgi_load
* only difference that the name of the driver is specified explicitly. You * with the only difference that the name of the driver is specified
* should NOT use this function in most cases, use tgi_load() instead. * explicitly. You should NOT use this function in most cases, use tgi_load()
* instead.
*/ */
void __fastcall__ tgi_unload (void); 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); void __fastcall__ tgi_init (void);
/* Initialize the already loaded graphics driver */ /* Initialize the already loaded graphics driver. */
void __fastcall__ tgi_done (void); 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); unsigned char __fastcall__ tgi_geterror (void);
/* Return the error code for the last operation. This will also clear the /* Return the error code for the last operation. This will also clear the

View File

@@ -6,10 +6,10 @@
/* */ /* */
/* */ /* */
/* */ /* */
/* (C) 2002 Ullrich von Bassewitz */ /* (C) 2002-2003 Ullrich von Bassewitz */
/* Wacholderweg 14 */ /* R<EFBFBD>merstrasse 52 */
/* D-70597 Stuttgart */ /* D-70794 Filderstadt */
/* EMail: uz@musoftware.de */ /* EMail: uz@cc65.org */
/* */ /* */
/* */ /* */
/* This software is provided 'as-is', without any expressed or implied */ /* 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 /* A structure that describes the header of a graphics driver loaded into
* memory. * memory.
*/ */
typedef struct { typedef struct {
/* Data that describes the capabilities of the driver */ /* Data that describes the capabilities of the driver */
@@ -60,7 +60,7 @@ typedef struct {
/* Jump vectors. Note that these are not C callable */ /* Jump vectors. Note that these are not C callable */
void* install; /* INSTALL routine */ void* install; /* INSTALL routine */
void* deinstall; /* DEINSTALL routine */ void* uninstall; /* UNINSTALL routine */
void* init; /* INIT routine */ void* init; /* INIT routine */
void* done; /* DONE routine */ void* done; /* DONE routine */
void* geterror; /* GETERROR 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); const char* __fastcall__ tgi_map_mode (unsigned char mode);
/* Map a tgi mode to a driver name. Returns NULL if no driver available. */ /* 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 */ /* End of tgi-kernel.h */

View File

@@ -7,7 +7,7 @@
.include "tgi-kernel.inc" .include "tgi-kernel.inc"
.include "tgi-error.inc" .include "tgi-error.inc"
.export _tgi_setup .export tgi_clear_ptr
.importzp ptr1 .importzp ptr1
@@ -42,7 +42,7 @@ tgi_driver_var_size = * - tgi_driver_vars
; Jump table for the driver functions. ; Jump table for the driver functions.
tgi_install: jmp $0000 tgi_install: jmp $0000
tgi_deinstall: jmp $0000 tgi_uninstall: jmp $0000
tgi_init: jmp $0000 tgi_init: jmp $0000
tgi_done: jmp $0000 tgi_done: jmp $0000
tgi_geterror: jmp $0000 tgi_geterror: jmp $0000
@@ -63,21 +63,31 @@ tgi_circle: jmp $0000
tgi_textstyle: jmp $0000 tgi_textstyle: jmp $0000
tgi_outtext: 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); ; void __fastcall__ tgi_install (void* driver);
; /* Setup the driver and graphics kernel once the driver is loaded */ ; /* Install an already loaded driver. */
copy: lda (ptr1),y _tgi_install:
sta tgi_install,x sta _tgi_drv
iny sta ptr1
inx stx _tgi_drv+1
rts stx ptr1+1
; Check the driver signature
_tgi_setup: ldy #tgi_sig_len-1
jsr tgi_set_ptr ; load _tgi_drv into ptr1 @L0: lda (ptr1),y
cmp tgi_sig,y
bne tgi_inv_drv
dey
bpl @L0
; Copy the jump vectors ; Copy the jump vectors
@@ -125,14 +135,12 @@ _tgi_setup:
rts rts
;---------------------------------------------------------------------------- ; Copy one byte from the jump vectors
; Load the pointer to the tgi driver into ptr1.
tgi_set_ptr: copy: lda (ptr1),y
lda _tgi_drv sta tgi_install,x
sta ptr1 iny
lda _tgi_drv+1 inx
sta ptr1+1
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
@@ -143,3 +151,42 @@ tgi_inv_arg:
sta _tgi_error sta _tgi_error
rts 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

View File

@@ -9,10 +9,10 @@
.importzp ptr1, ptr2, ptr3, ptr4 .importzp ptr1, ptr2, ptr3, ptr4
.import popax .import popax
.import _tgi_getmaxx, _tgi_getmaxy
.export _tgi_bar
_tgi_bar:
.proc _tgi_bar
sta ptr4 ; Y2 sta ptr4 ; Y2
stx ptr4+1 stx ptr4+1
@@ -130,4 +130,4 @@ _tgi_bar:
@L9: rts @L9: rts
.endproc

View File

@@ -8,12 +8,12 @@
.import popax .import popax
.importzp tmp1 .importzp tmp1
.export _tgi_circle
_tgi_circle: .proc _tgi_circle
sta tmp1 ; Get the coordinates sta tmp1 ; Get the coordinates
jsr popax jsr popax
jsr tgi_popxy ; Pop X/Y into ptr1/ptr2 jsr tgi_popxy ; Pop X/Y into ptr1/ptr2
jmp tgi_circle ; Call the driver jmp tgi_circle ; Call the driver
.endproc

View File

@@ -6,8 +6,6 @@
.include "tgi-kernel.inc" .include "tgi-kernel.inc"
.export _tgi_clear
_tgi_clear = tgi_clear ; Call the driver _tgi_clear = tgi_clear ; Call the driver

View File

@@ -7,9 +7,8 @@
.include "tgi-kernel.inc" .include "tgi-kernel.inc"
.include "tgi-error.inc" .include "tgi-error.inc"
.export _tgi_done .proc _tgi_done
_tgi_done:
lda _tgi_gmode ; Is a graphics mode active? lda _tgi_gmode ; Is a graphics mode active?
beq @L1 ; Jump if not beq @L1 ; Jump if not
jsr tgi_done ; Call the driver routine jsr tgi_done ; Call the driver routine
@@ -20,5 +19,5 @@ _tgi_done:
sta _tgi_gmode ; Reset the graph mode flag (A = 0) sta _tgi_gmode ; Reset the graph mode flag (A = 0)
@L1: rts @L1: rts
.endproc

View File

@@ -7,9 +7,9 @@
.include "tgi-kernel.inc" .include "tgi-kernel.inc"
.importzp ptr1, ptr2, ptr3, ptr4 .importzp ptr1, ptr2, ptr3, ptr4
.export tgi_emu_bar
tgi_emu_bar: .proc tgi_emu_bar
lda ptr4 lda ptr4
sta Y2 sta Y2
lda ptr4+1 lda ptr4+1
@@ -63,6 +63,8 @@ tgi_emu_bar:
@L4: rts @L4: rts
.endproc
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; Data ; Data

View File

@@ -6,10 +6,11 @@
.include "tgi-kernel.inc" .include "tgi-kernel.inc"
.export _tgi_getcolor
_tgi_getcolor: .proc _tgi_getcolor
lda _tgi_color ; Get the current drawing color lda _tgi_color ; Get the current drawing color
ldx #0 ; Clear high byte ldx #0 ; Clear high byte
rts rts
.endproc

View File

@@ -5,11 +5,12 @@
; /* Get the number of available colors */ ; /* Get the number of available colors */
.include "tgi-kernel.inc" .include "tgi-kernel.inc"
.export _tgi_getcolorcount
.proc _tgi_getcolorcount
_tgi_getcolorcount:
lda _tgi_colorcount lda _tgi_colorcount
ldx #0 ldx #0
rts rts
.endproc

View File

@@ -8,7 +8,6 @@
; ;
.include "tgi-kernel.inc" .include "tgi-kernel.inc"
.export _tgi_getdefpalette
_tgi_getdefpalette = tgi_getdefpalette ; Call the driver _tgi_getdefpalette = tgi_getdefpalette ; Call the driver

View File

@@ -8,9 +8,8 @@
.include "tgi-kernel.inc" .include "tgi-kernel.inc"
.export _tgi_geterror .proc _tgi_geterror
_tgi_geterror:
lda _tgi_drv ; Check if we have a driver lda _tgi_drv ; Check if we have a driver
ora _tgi_drv+1 ora _tgi_drv+1
beq @L1 beq @L1
@@ -22,3 +21,5 @@ _tgi_geterror:
stx _tgi_error ; Clear high level error code stx _tgi_error ; Clear high level error code
@L2: rts @L2: rts
.endproc

View File

@@ -4,19 +4,18 @@
; unsigned char __fastcall__ tgi_getmaxcolor (void); ; unsigned char __fastcall__ tgi_getmaxcolor (void);
; /* Return the maximum supported color number (the number of colors would ; /* Return the maximum supported color number (the number of colors would
; * then be getmaxcolor()+1). ; * then be getmaxcolor()+1).
; */ ; */
; ;
.include "tgi-kernel.inc" .include "tgi-kernel.inc"
.export _tgi_getmaxcolor
.proc _tgi_getmaxcolor
_tgi_getmaxcolor:
ldx _tgi_colorcount ldx _tgi_colorcount
dex dex
txa txa
ldx #0 ldx #0
rts rts
.endproc

View File

@@ -7,14 +7,15 @@
; */ ; */
.include "tgi-kernel.inc" .include "tgi-kernel.inc"
.export _tgi_getmaxx
.import _tgi_getxres
.import decax1 .import decax1
_tgi_getmaxx: .proc _tgi_getmaxx
jsr _tgi_getxres jsr _tgi_getxres
jmp decax1 jmp decax1
.endproc

View File

@@ -7,13 +7,12 @@
; */ ; */
.include "tgi-kernel.inc" .include "tgi-kernel.inc"
.export _tgi_getmaxy
.import _tgi_getyres
.import decax1 .import decax1
.proc _tgi_getmaxy
_tgi_getmaxy:
jsr _tgi_getyres jsr _tgi_getyres
jmp decax1 jmp decax1
.endproc

View File

@@ -6,11 +6,12 @@
; ;
.include "tgi-kernel.inc" .include "tgi-kernel.inc"
.export _tgi_getpagecount
.proc _tgi_getpagecount
_tgi_getpagecount:
lda _tgi_pagecount lda _tgi_pagecount
ldx #0 ldx #0
rts rts
.endproc

View File

@@ -8,10 +8,7 @@
; ;
.include "tgi-kernel.inc" .include "tgi-kernel.inc"
.export _tgi_getpalette
_tgi_getpalette = tgi_getpalette ; Call the driver _tgi_getpalette = tgi_getpalette ; Call the driver

View File

@@ -6,13 +6,15 @@
.include "tgi-kernel.inc" .include "tgi-kernel.inc"
.import return0
.export _tgi_getpixel
_tgi_getpixel: .import return0
.proc _tgi_getpixel
jsr tgi_getset ; Pop args, check range jsr tgi_getset ; Pop args, check range
bcs @L9 bcs @L9
jmp tgi_getpixel ; Call the driver jmp tgi_getpixel ; Call the driver
@L9: jmp return0 ; Assume bg color @L9: jmp return0 ; Assume bg color
.endproc

View File

@@ -11,7 +11,8 @@
.importzp ptr1, ptr2 .importzp ptr1, ptr2
tgi_getset: .proc tgi_getset
jsr tgi_popxy ; Pop X/Y into ptr1/ptr2 jsr tgi_popxy ; Pop X/Y into ptr1/ptr2
; Are the coordinates out of range? First check if any coord is negative. ; Are the coordinates out of range? First check if any coord is negative.
@@ -36,4 +37,5 @@ tgi_getset:
sbc _tgi_yres+1 sbc _tgi_yres+1
@L9: rts @L9: rts
.endproc

View File

@@ -6,12 +6,12 @@
.include "tgi-kernel.inc" .include "tgi-kernel.inc"
.export _tgi_getxres
.proc _tgi_getxres
_tgi_getxres:
lda _tgi_xres lda _tgi_xres
ldx _tgi_xres+1 ldx _tgi_xres+1
rts rts
.endproc

View File

@@ -6,13 +6,12 @@
.include "tgi-kernel.inc" .include "tgi-kernel.inc"
.export _tgi_getyres
.import ldaxidx
.proc _tgi_getyres
_tgi_getyres:
lda _tgi_yres lda _tgi_yres
ldx _tgi_yres+1 ldx _tgi_yres+1
rts rts
.endproc

View File

@@ -8,9 +8,9 @@
.include "tgi-kernel.inc" .include "tgi-kernel.inc"
.import popax .import popax
.export _tgi_gotoxy
_tgi_gotoxy: .proc _tgi_gotoxy
sta _tgi_cury ; Y sta _tgi_cury ; Y
stx _tgi_cury+1 stx _tgi_cury+1
jsr popax jsr popax
@@ -18,5 +18,5 @@ _tgi_gotoxy:
stx _tgi_curx+1 stx _tgi_curx+1
rts rts
.endproc

View File

@@ -9,11 +9,9 @@
.include "tgi-error.inc" .include "tgi-error.inc"
.importzp ptr1 .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_done ; Switch off graphics if needed
jsr tgi_init ; Go into graphics mode jsr tgi_init ; Go into graphics mode
jsr tgi_geterror ; Get the error code jsr tgi_geterror ; Get the error code
@@ -57,3 +55,6 @@ _tgi_init:
@L9: rts @L9: rts
.endproc

View File

@@ -8,12 +8,14 @@
.include "tgi-kernel.inc" .include "tgi-kernel.inc"
.import popax .import popax
.export _tgi_line
_tgi_line: .proc _tgi_line
jsr tgi_linepop ; Pop/store Y2/X2 jsr tgi_linepop ; Pop/store Y2/X2
jsr popax jsr popax
jsr tgi_popxy ; Pop/store X1/Y1 into ptr1/ptr2 jsr tgi_popxy ; Pop/store X1/Y1 into ptr1/ptr2
jmp tgi_line ; Call the driver jmp tgi_line ; Call the driver
.endproc

View File

@@ -9,7 +9,8 @@
.import popax .import popax
.importzp ptr3, ptr4 .importzp ptr3, ptr4
tgi_linepop: .proc tgi_linepop
sta ptr4 ; Y2 sta ptr4 ; Y2
stx ptr4+1 stx ptr4+1
sta _tgi_cury sta _tgi_cury
@@ -21,4 +22,5 @@ tgi_linepop:
stx _tgi_curx+1 stx _tgi_curx+1
rts rts
.endproc

View File

@@ -9,11 +9,12 @@
.include "tgi-kernel.inc" .include "tgi-kernel.inc"
.import popax .import popax
.export _tgi_lineto
_tgi_lineto: .proc _tgi_lineto
jsr tgi_curtoxy ; Copy curx/cury into ptr1/ptr2 jsr tgi_curtoxy ; Copy curx/cury into ptr1/ptr2
jsr tgi_linepop ; Pop x2/y2 into ptr3/ptr4 and curx/cury jsr tgi_linepop ; Pop x2/y2 into ptr3/ptr4 and curx/cury
jmp tgi_line ; Call the driver jmp tgi_line ; Call the driver
.endproc

View 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. * 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 = { static struct mod_ctrl ctrl = {
read /* Read from disk */ read /* Read from disk */
}; };
@@ -78,38 +76,24 @@ void __fastcall__ tgi_load_driver (const char* name)
/* Now open the file */ /* Now open the file */
ctrl.callerdata = open (name, O_RDONLY); ctrl.callerdata = open (name, O_RDONLY);
if (ctrl.callerdata < 0) { if (ctrl.callerdata >= 0) {
tgi_error = TGI_ERR_CANNOT_LOAD;
return;
}
/* Load the module */ /* Load the module */
Res = mod_load (&ctrl); Res = mod_load (&ctrl);
/* Close the input file */ /* Close the input file */
close (ctrl.callerdata); close (ctrl.callerdata);
/* Check the return code */ /* Check the return code */
if (Res == MLOAD_OK) { if (Res == MLOAD_OK) {
/* Get a pointer to the loaded driver */ /* Check the driver signature, install the driver */
tgi_drv = (tgi_drv_header*) ctrl.module; 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;
} }

View File

@@ -16,7 +16,8 @@
.code .code
_tgi_map_mode: .proc _tgi_map_mode
sta tmp1 ; Save mode sta tmp1 ; Save mode
ldy #$00 ldy #$00
@@ -48,4 +49,6 @@ Found: tya
inx inx
@L1: rts @L1: rts
.endproc

View File

@@ -9,12 +9,13 @@
.import popax .import popax
.importzp ptr3 .importzp ptr3
.export _tgi_outtext
_tgi_outtext: .proc _tgi_outtext
sta ptr3 sta ptr3
stx ptr3+1 ; Save s stx ptr3+1 ; Save s
jsr tgi_curtoxy ; Copy curx/cury into ptr1/ptr2 jsr tgi_curtoxy ; Copy curx/cury into ptr1/ptr2
jmp tgi_outtext ; Call the driver jmp tgi_outtext ; Call the driver
.endproc

View File

@@ -9,13 +9,14 @@
.import popax .import popax
.importzp ptr3 .importzp ptr3
.export _tgi_outtextxy
_tgi_outtextxy: .proc _tgi_outtextxy
sta ptr3 sta ptr3
stx ptr3+1 ; Save s stx ptr3+1 ; Save s
jsr popax ; get y from stack jsr popax ; get y from stack
jsr tgi_popxy ; Pop x/y into ptr1/ptr2 jsr tgi_popxy ; Pop x/y into ptr1/ptr2
jmp tgi_outtext ; Call the driver jmp tgi_outtext ; Call the driver
.endproc

View File

@@ -9,7 +9,8 @@
.import popax .import popax
.importzp ptr1, ptr2 .importzp ptr1, ptr2
tgi_popxy: .proc tgi_popxy
sta ptr2 ; Y sta ptr2 ; Y
stx ptr2+1 stx ptr2+1
jsr popax jsr popax
@@ -17,4 +18,5 @@ tgi_popxy:
stx ptr1+1 stx ptr1+1
rts rts
.endproc

View File

@@ -9,7 +9,8 @@
.import popax .import popax
.importzp ptr3, ptr4 .importzp ptr3, ptr4
tgi_popxy2: .proc tgi_popxy2
sta ptr4 ; Y sta ptr4 ; Y
stx ptr4+1 stx ptr4+1
jsr popax jsr popax
@@ -17,3 +18,6 @@ tgi_popxy2:
stx ptr3+1 stx ptr3+1
rts rts
.endproc

View File

@@ -6,13 +6,14 @@
.include "tgi-kernel.inc" .include "tgi-kernel.inc"
.export _tgi_setcolor
_tgi_setcolor: .proc _tgi_setcolor
cmp _tgi_colorcount ; Compare to available colors cmp _tgi_colorcount ; Compare to available colors
bcs @L1 bcs @L1
sta _tgi_color ; Remember the drawing color sta _tgi_color ; Remember the drawing color
jmp tgi_setcolor ; Call the driver jmp tgi_setcolor ; Call the driver
@L1: jmp tgi_inv_arg ; Invalid argument @L1: jmp tgi_inv_arg ; Invalid argument
.endproc

View File

@@ -6,13 +6,13 @@
.include "tgi-kernel.inc" .include "tgi-kernel.inc"
.export _tgi_setdrawpage
_tgi_setdrawpage: .proc _tgi_setdrawpage
cmp _tgi_pagecount ; Compare to available pages cmp _tgi_pagecount ; Compare to available pages
bcs @L1 bcs @L1
jmp tgi_setdrawpage ; Call the driver jmp tgi_setdrawpage ; Call the driver
@L1: jmp tgi_inv_arg ; Invalid argument @L1: jmp tgi_inv_arg ; Invalid argument
.endproc

View File

@@ -10,12 +10,12 @@
.include "tgi-kernel.inc" .include "tgi-kernel.inc"
.importzp ptr1 .importzp ptr1
.export _tgi_setpalette
.proc _tgi_setpalette
_tgi_setpalette:
sta ptr1 sta ptr1
stx ptr1+1 stx ptr1+1
jmp tgi_setpalette ; Call the driver jmp tgi_setpalette ; Call the driver
.endproc

View File

@@ -7,13 +7,13 @@
.include "tgi-kernel.inc" .include "tgi-kernel.inc"
.export _tgi_setpixel .proc _tgi_setpixel
_tgi_setpixel:
jsr tgi_getset ; Pop args, check range jsr tgi_getset ; Pop args, check range
bcs @L9 bcs @L9
jmp tgi_setpixel ; Call the driver jmp tgi_setpixel ; Call the driver
@L9: rts @L9: rts
.endproc

View File

@@ -7,12 +7,13 @@
.include "tgi-kernel.inc" .include "tgi-kernel.inc"
.export _tgi_setviewpage
_tgi_setviewpage: .proc _tgi_setviewpage
cmp _tgi_pagecount ; Compare to available pages cmp _tgi_pagecount ; Compare to available pages
bcs @L1 bcs @L1
jmp tgi_setviewpage ; Call the driver jmp tgi_setviewpage ; Call the driver
@L1: jmp tgi_inv_arg ; Invalid argument @L1: jmp tgi_inv_arg ; Invalid argument
.endproc

View File

@@ -1,4 +1,4 @@
; ;
; Ullrich von Bassewitz, 22.06.2002 ; Ullrich von Bassewitz, 22.06.2002
; ;
@@ -6,8 +6,6 @@
.include "tgi-kernel.inc" .include "tgi-kernel.inc"
.import _strlen, pushax, tosumulax .import _strlen, pushax, tosumulax
.export _tgi_textwidth
.export _tgi_textheight
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; unsigned __fastcall__ tgi_textwidth (const char* s); ; unsigned __fastcall__ tgi_textwidth (const char* s);
@@ -17,6 +15,7 @@
_tgi_textwidth: _tgi_textwidth:
ldy _tgi_textdir ; Get text direction ldy _tgi_textdir ; Get text direction
bne height bne height

View File

@@ -9,9 +9,9 @@
.include "tgi-kernel.inc" .include "tgi-kernel.inc"
.import popax, incsp2 .import popax, incsp2
.export _tgi_textstyle
_tgi_textstyle: .proc _tgi_textstyle
pha pha
jsr popax ; Get magx/magy in one call jsr popax ; Get magx/magy in one call
tay tay
@@ -39,3 +39,5 @@ DirOk: cpy #$00
jmp tgi_textstyle jmp tgi_textstyle
.endproc

View File

@@ -8,25 +8,18 @@
.include "tgi-kernel.inc" .include "tgi-kernel.inc"
.include "modload.inc" .include "modload.inc"
.import _tgi_done .import tgi_clear_ptr
.export _tgi_unload
.proc _tgi_unload
_tgi_unload:
jsr _tgi_done ; Switch off graphics 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 lda _tgi_drv
ldx _tgi_drv+1 ldx _tgi_drv+1
jsr _mod_free ; Free the driver jsr _mod_free ; Free the driver
; Clear variables jmp tgi_clear_ptr ; Clear the driver pointer and exit
lda #$00
sta _tgi_drv
sta _tgi_drv+1
sta _tgi_error
rts
.endproc