Re: [cc65] how to write a driver

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2006-08-03 09:56:38
Good morning.

On Wed, Aug 02, 2006 at 03:03:56AM +0200, Johannes Braun wrote:
> i would like to provide an extended memory driver for 32k of the retro
> replay ram. now i have written the source code (i used the c64-reu.emd
> source as "template") and it should work fine but how do i actually make
> a loadable driver out of it. Does it _have_ to be an o65 format file?!

Yes, drivers must be in o65 format, because this format is relocatable (= can
be loaded at any address).

> if yes, how do i produce such a file??

The easiest way is to use the existing source tree. Place your driver in the
platform directory (libsrc/c64 in your case), add it to the EMDS stanza of the
makefile and then run "make c64lib" in the libsrc directory. Your driver will
then be built as any other driver.

The harder way is to assemble and link the driver manually. In this case you
do need the zeropage.s module from the source tree:

        ca65 -t c64 zeropage.s
        ca65 -t c64 -I /path/to/asminc/dir mydriver.s
        ld65 -t module -o mydriver.emd mydriver.o zeropage.o

> i found nothing in the docs concerning this.

This is true, because the information can be easily retrieved from the
existing Makefiles.

> the driver code offers routines for INSTALL, UNINSTALL, USE, MAP,
> COMMIT, COPYFROM and COPYTO complying to the prototypes in em.h

There's a test program for emd drivers: testcode/lib/em-test.c It runs a few
minutes (depending on the size and speed of the external memory), and finds
quite a few errors. At least it did in the drivers I wrote:-)

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz@musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Thu Aug 3 09:56:48 2006

This archive was generated by hypermail 2.1.8 : 2006-08-03 09:56:51 CEST