[cc65] Extended memory API

Date view Thread view Subject view

From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2002-11-28 22:44:29


Hi!

I have written together a draft of the new extended memory API and would like
to hear a few comments. I've tried to keep it as minimalistic as possible to
make it fast, easy to use and to implement. So I got away with just 6
functions.

There is no error checking once the driver is successfully loaded, and no
memory management. If these things are a problem in the future, it should be
easy to add an exception vector or layer a memory management module on top of
the extended memory API.

The em_map... functions do return a pointer to the page, which means that I've
abolished the old concept with just one 256 byte window. Pages are still fixed
size (256 bytes), but it's up to the driver if it will keep more than one page
in memory.

Since the API is really short, I will post it here for review:

----------------------------------------------------------------------------
unsigned char em_load (unsigned char driver);
/* Load the extended memory driver and return an error code. */

unsigned char em_load_driver (const char* driver);
/* Load an extended memory driver and return an error code */

unsigned char em_unload (void);
/* Unload the currently loaded driver. */

unsigned em_page_count (void);
/* Return the total number of 256 byte pages available in extended memory. */

void* em_map_page (unsigned page);
/* Unmap the current page from memory and map a new one. The function returns
 * a pointer to the location of the page in memory.
 */

void* em_map_page_clean (unsigned page);
/* Unmap the current page from memory and map a new one. The function returns
 * a pointer to the location of the page in memory. This function differs from
 * em_map_page() in that it will discard the contents of the currently mapped
 * page, assuming that the page has not been modified or that the modifications
 * are no longer needed, if this leads to better performance. NOTE: This does
 * NOT mean that the contents of currently mapped page are always discarded!
 */
----------------------------------------------------------------------------

A full copy of the proposed header file is available on the web server:

        http://www.cc65.org/em.h

Please let me know what you think about it. Do you see any problems on
specific platforms?

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz_at_musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2002-11-28 22:44:42 CET