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

@@ -20,11 +20,11 @@
/* Address of data for sprite 0 */
#if defined(__C64__)
# define SPRITE0_DATA 0x0340
# define SPRITE0_PTR 0x07F8
# define SPRITE0_DATA 0x0340
# define SPRITE0_PTR 0x07F8
#elif defined(__C128__)
# define SPRITE0_DATA 0x0E00
# define SPRITE0_PTR 0x07F8
# define SPRITE0_DATA 0x0E00
# define SPRITE0_PTR 0x07F8
#endif
/* The mouse sprite (an arrow) */
@@ -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 ();