1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-27 12:29:33 +00:00

Added option to build samples with statically linked drivers - and have the targets use it by default which don't support dynamically loaded drivers.

git-svn-id: svn://svn.cc65.org/cc65/trunk@5913 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
ol.sc 2012-11-04 22:01:51 +00:00
parent 895779d612
commit ca2ba14bbe
6 changed files with 155 additions and 112 deletions

View File

@ -98,6 +98,13 @@
#define CH_LIRA 95
#define CH_ESC 27
/* No support for dynamically loadable drivers */
#define DYN_DRV 0
void __fastcall__ atmos_load(const char* name);
/* Load Atmos tape. */
@ -108,6 +115,3 @@ void __fastcall__ atmos_save(const char* name, const void* start, const void* en
/* End of atmos.h */
#endif

View File

@ -87,7 +87,8 @@
#define TGI_COLOR_LIGHTBLUE COLOR_LIGHTBLUE
#define TGI_COLOR_WHITE COLOR_WHITE
/* No support for dynamically loadable drivers */
#define DYN_DRV 0
@ -194,6 +195,3 @@ unsigned __fastcall__ lynx_eewrite (unsigned cell, unsigned val);
/* End of lynx.h */
#endif

View File

@ -64,7 +64,6 @@
#define CH_LRCORNER 0x08
#define CH_PI 0x05
/* Color defines */
#define COLOR_BLACK 0x00
#define COLOR_WHITE 0x01
@ -88,6 +87,9 @@
#define TV_PAL 1
#define TV_OTHER 2
/* No support for dynamically loadable drivers */
#define DYN_DRV 0
void waitvblank (void);
@ -100,6 +102,3 @@ unsigned char get_tv (void);
/* End of nes.h */
#endif

View File

@ -33,6 +33,11 @@
# define CLK_TCK 1
#endif
/* Use dynamically loaded driver by default */
#ifndef DYN_DRV
# define DYN_DRV 1
#endif
/* Use static local variables for speed */
#pragma static-locals (1);
@ -90,9 +95,14 @@ int main (void)
clrscr ();
#if DYN_DRV
/* Load the graphics driver */
cprintf ("initializing... mompls\r\n");
tgi_load_driver (tgi_stddrv);
#else
/* Install the graphics driver */
tgi_install (tgi_static_stddrv);
#endif
err = tgi_geterror ();
if (err != TGI_ERR_OK) {
cprintf ("Error #%d initializing graphics.\r\n%s\r\n",
@ -132,5 +142,4 @@ int main (void)
/* Done */
return EXIT_SUCCESS;
}

View File

@ -56,6 +56,12 @@ static const unsigned char MouseSprite[64] = {
#endif /* __C64__ or __C128__ */
/* Dynamically loaded driver by default */
#ifndef DYN_DRV
# define DYN_DRV 1
#endif
#define max(a,b) (((a) > (b)) ? (a) : (b))
#define min(a,b) (((a) < (b)) ? (a) : (b))
@ -133,12 +139,18 @@ int main (void)
#endif
#if DYN_DRV
/* Output a warning about the driver that is needed */
DoWarning ();
/* Load and install the mouse driver */
CheckError ("mouse_load_driver",
mouse_load_driver (&mouse_def_callbacks, mouse_stddrv));
#else
/* Install the mouse driver */
CheckError ("mouse_install",
mouse_install (&mouse_def_callbacks, mouse_static_stddrv));
#endif
/* Get the initial mouse bounding box */
mouse_getbox (&full_box);
@ -210,8 +222,13 @@ int main (void)
}
#if DYN_DRV
/* Uninstall and unload the mouse driver */
CheckError ("mouse_unload", mouse_unload ());
#else
/* Uninstall the mouse driver */
CheckError ("mouse_uninstall", mouse_uninstall ());
#endif
/* Say goodbye */
clrscr ();

View File

@ -9,6 +9,10 @@
#ifndef DYN_DRV
# define DYN_DRV 1
#endif
#define COLOR_BACK TGI_COLOR_BLACK
#define COLOR_FORE TGI_COLOR_WHITE
@ -180,12 +184,19 @@ int main (void)
{
unsigned char Border;
#if DYN_DRV
/* Warn the user that the tgi driver is needed */
DoWarning ();
/* Load and initialize the driver */
tgi_load_driver (tgi_stddrv);
CheckError ("tgi_load_driver");
#else
/* Install the driver */
tgi_install (tgi_static_stddrv);
CheckError ("tgi_install");
#endif
tgi_init ();
CheckError ("tgi_init");
tgi_clear ();
@ -204,8 +215,13 @@ int main (void)
DoDiagram ();
DoLines ();
#if DYN_DRV
/* Unload the driver */
tgi_unload ();
#else
/* Uninstall the driver */
tgi_uninstall ();
#endif
/* Reset the border */
(void) bordercolor (Border);