From 7de61e351c5072c680a7f3b67cd6be5170a78560 Mon Sep 17 00:00:00 2001 From: uz Date: Fri, 11 Sep 2009 18:59:37 +0000 Subject: [PATCH] Define a standard driver and mode for tgi graphics and use it in the sample program. The standard driver and mode is the first one in the tgi_mode_table. git-svn-id: svn://svn.cc65.org/cc65/trunk@4153 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- include/tgi.h | 17 +++++++++++------ libsrc/apple2/tgi_mode_table.s | 3 ++- libsrc/c128/tgi_mode_table.s | 3 ++- libsrc/c64/tgi_mode_table.s | 3 ++- libsrc/cbm510/tgi_mode_table.s | 3 ++- libsrc/plus4/tgi_mode_table.s | 3 ++- libsrc/tgi/Makefile | 2 ++ libsrc/tgi/tgi_stddrv.s | 11 +++++++++++ libsrc/tgi/tgi_stdmode.s | 11 +++++++++++ samples/tgidemo.c | 7 +------ 10 files changed, 46 insertions(+), 17 deletions(-) create mode 100644 libsrc/tgi/tgi_stddrv.s create mode 100644 libsrc/tgi/tgi_stdmode.s diff --git a/include/tgi.h b/include/tgi.h index d43ebeecb..0ed472c58 100644 --- a/include/tgi.h +++ b/include/tgi.h @@ -6,10 +6,10 @@ /* */ /* */ /* */ -/* (C) 2002-2004 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ -/* D-70794 Filderstadt */ -/* EMail: uz@cc65.org */ +/* (C) 2002-2009, Ullrich von Bassewitz */ +/* Roemerstrasse 52 */ +/* D-70794 Filderstadt */ +/* EMail: uz@cc65.org */ /* */ /* */ /* This software is provided 'as-is', without any expressed or implied */ @@ -57,6 +57,12 @@ #define TGI_TEXT_HORIZONTAL 0 #define TGI_TEXT_VERTICAL 1 +/* The name of the standard tgi driver for a platform */ +extern const char tgi_stddrv[]; + +/* The default tgi mode for a platform */ +extern const unsigned char tgi_stdmode; + /*****************************************************************************/ @@ -74,8 +80,7 @@ void __fastcall__ tgi_load (unsigned char mode); void __fastcall__ tgi_load_driver (const char* name); /* 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. + * explicitly. */ void __fastcall__ tgi_unload (void); diff --git a/libsrc/apple2/tgi_mode_table.s b/libsrc/apple2/tgi_mode_table.s index f0f91483e..e347716f3 100644 --- a/libsrc/apple2/tgi_mode_table.s +++ b/libsrc/apple2/tgi_mode_table.s @@ -10,7 +10,8 @@ ;---------------------------------------------------------------------------- ; Mode table. Contains entries of mode and driver name, the driver name being -; null terminated. A mode with code zero terminates the list. +; null terminated. A mode with code zero terminates the list. The first entry +; defines also the default mode and driver for the system. ; BEWARE: The current implementation of tgi_map_mode does not work with tables ; larger that 255 bytes! diff --git a/libsrc/c128/tgi_mode_table.s b/libsrc/c128/tgi_mode_table.s index 4a61fcb10..84ebc37e3 100644 --- a/libsrc/c128/tgi_mode_table.s +++ b/libsrc/c128/tgi_mode_table.s @@ -10,7 +10,8 @@ ;---------------------------------------------------------------------------- ; Mode table. Contains entries of mode and driver name, the driver name being -; null terminated. A mode with code zero terminates the list. +; null terminated. A mode with code zero terminates the list. The first entry +; defines also the default mode and driver for the system. ; BEWARE: The current implementation of tgi_map_mode does not work with tables ; larger that 255 bytes! diff --git a/libsrc/c64/tgi_mode_table.s b/libsrc/c64/tgi_mode_table.s index 70d98b792..cb7740853 100644 --- a/libsrc/c64/tgi_mode_table.s +++ b/libsrc/c64/tgi_mode_table.s @@ -10,7 +10,8 @@ ;---------------------------------------------------------------------------- ; Mode table. Contains entries of mode and driver name, the driver name being -; null terminated. A mode with code zero terminates the list. +; null terminated. A mode with code zero terminates the list. The first entry +; defines also the default mode and driver for the system. ; BEWARE: The current implementation of tgi_map_mode does not work with tables ; larger that 255 bytes! diff --git a/libsrc/cbm510/tgi_mode_table.s b/libsrc/cbm510/tgi_mode_table.s index 2ed75a6b8..6267c382c 100644 --- a/libsrc/cbm510/tgi_mode_table.s +++ b/libsrc/cbm510/tgi_mode_table.s @@ -10,7 +10,8 @@ ;---------------------------------------------------------------------------- ; Mode table. Contains entries of mode and driver name, the driver name being -; null terminated. A mode with code zero terminates the list. +; null terminated. A mode with code zero terminates the list. The first entry +; defines also the default mode and driver for the system. ; BEWARE: The current implementation of tgi_map_mode does not work with tables ; larger that 255 bytes! diff --git a/libsrc/plus4/tgi_mode_table.s b/libsrc/plus4/tgi_mode_table.s index d7542200c..429f483fd 100644 --- a/libsrc/plus4/tgi_mode_table.s +++ b/libsrc/plus4/tgi_mode_table.s @@ -10,7 +10,8 @@ ;---------------------------------------------------------------------------- ; Mode table. Contains entries of mode and driver name, the driver name being -; null terminated. A mode with code zero terminates the list. +; null terminated. A mode with code zero terminates the list. The first entry +; defines also the default mode and driver for the system. ; BEWARE: The current implementation of tgi_map_mode does not work with tables ; larger that 255 bytes! diff --git a/libsrc/tgi/Makefile b/libsrc/tgi/Makefile index ad9737cc4..d753fcdfa 100644 --- a/libsrc/tgi/Makefile +++ b/libsrc/tgi/Makefile @@ -68,6 +68,8 @@ S_OBJS = tgi-kernel.o \ tgi_setpalette.o \ tgi_setpixel.o \ tgi_setviewpage.o \ + tgi_stddrv.o \ + tgi_stdmode.o \ tgi_textsize.o \ tgi_textstyle.o \ tgi_unload.o diff --git a/libsrc/tgi/tgi_stddrv.s b/libsrc/tgi/tgi_stddrv.s new file mode 100644 index 000000000..606474f06 --- /dev/null +++ b/libsrc/tgi/tgi_stddrv.s @@ -0,0 +1,11 @@ +; +; Name of the standard tgi driver +; +; Ullrich von Bassewitz, 2009-09-11 +; +; const char tgi_stddrv[]; +; + + .import _tgi_mode_table + .export _tgi_stddrv = _tgi_mode_table + 1 + diff --git a/libsrc/tgi/tgi_stdmode.s b/libsrc/tgi/tgi_stdmode.s new file mode 100644 index 000000000..5dcd17fad --- /dev/null +++ b/libsrc/tgi/tgi_stdmode.s @@ -0,0 +1,11 @@ +; +; Standard tgi mode +; +; Ullrich von Bassewitz, 2009-09-11 +; +; const unsigned char tgi_stdmode[]; +; + + .import _tgi_mode_table + .export _tgi_stdmode = _tgi_mode_table + diff --git a/samples/tgidemo.c b/samples/tgidemo.c index a2ed57a96..a8af78534 100644 --- a/samples/tgidemo.c +++ b/samples/tgidemo.c @@ -7,11 +7,6 @@ -#if defined(__APPLE2__) || defined(__APPLE2ENH__) -# define TGI_MODE TGI_MODE_280_192_8 -#else -# define TGI_MODE TGI_MODE_320_200_2 -#endif #define COLOR_BACK COLOR_BLACK #define COLOR_FORE COLOR_WHITE @@ -203,7 +198,7 @@ int main (void) DoWarning (); /* Load and initialize the driver */ - tgi_load (TGI_MODE); + tgi_load_driver (tgi_stddrv); CheckError ("tgi_load"); tgi_init (); CheckError ("tgi_init");