[cc65] Improved Static Driver Support

From: Oliver Schmidt <ol.sc1web.de>
Date: 2012-11-09 23:13:52
Hi,

cc65 comes with the co65 tool that allows to convert loadable drivers
into assembler source files, which can be statically linked to
applications. Three targets (atmos, lynx, nes) "depend" on that tool
as they don't offer file i/o and thus don't support driver loading.

However the workflow for co65 isn't exactly easy to understand for
inexperienced users so I went for improving the experience:

- All loadable drivers coming with cc65 are converted and included in
the target's standard C libraries.

- The symbols to be used to reference the static drivers in the C
libraries are declared in the target's header files and named in the
target's documentation.

- Three symbols 'tgi_static_stddrv', 'mouse_static_stddrv' and
'joy_static_stddrv' are introduced to allow for cross-target static
driver linking (similiar to 'tgi_stddrv', 'mouse_stddrv' and
'joy_stddrv' allowing for cross-target driver loading).

- All samples and user contributions that load drivers are extended to
alternatively link drivers statically using #ifdef's allowing to
switch easily to static driver linking with -DDYN_DRV=0. Maybe this
evolves to a best practice...

#ifndef DYN_DRV
#  define DYN_DRV 1
#endif
....
#if DYN_DRV
  tgi_load_driver (tgi_stddrv);
#else
  tgi_install (tgi_static_stddrv);
#endif

- The atmos, lynx and nes header files contain declarations setting
DYN_DRV to 0.

Enjoy, Oliver

P.S.: I added a remark to
http://wiki.cc65.org/doku.php?id=cc65:reminders that the Atari
documentation lacks infos on the TGI and EMD drivers.
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Fri Nov 9 23:15:00 2012

This archive was generated by hypermail 2.1.8 : 2012-11-09 23:15:04 CET