From: cuz Date: Sun, 1 Dec 2002 18:06:57 +0000 (+0000) Subject: Replaced em_mapclean by em_commit X-Git-Tag: V2.12.0~1970 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=0c38839e7962959d29e3ba0b2a06a0cf56361fe0;p=cc65 Replaced em_mapclean by em_commit git-svn-id: svn://svn.cc65.org/cc65/trunk@1682 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/asminc/em-kernel.inc b/asminc/em-kernel.inc index 35d6b6166..ab17cc2cc 100644 --- a/asminc/em-kernel.inc +++ b/asminc/em-kernel.inc @@ -53,9 +53,9 @@ EMD_HDR_JUMPCOUNT = 7 ; Number of jump vectors ;------------------------------------------------------------------------------ ; Offsets into the em_copy structure -EM_COPY_PAGE = 0 +EM_COPY_BUF = 0 EM_COPY_OFFS = 2 -EM_COPY_BUF = 3 +EM_COPY_PAGE = 3 EM_COPY_COUNT = 5 ;------------------------------------------------------------------------------ @@ -70,7 +70,7 @@ EM_COPY_COUNT = 5 .global emd_deinstall .global emd_pagecount .global emd_map - .global emd_mapclean + .global emd_commit .global emd_copyfrom .global emd_copyto @@ -81,7 +81,7 @@ EM_COPY_COUNT = 5 .global _em_deinstall .global _em_pagecount .global _em_map - .global _em_mapclean + .global _em_commit .global _em_copyfrom .global _em_copyto diff --git a/include/em.h b/include/em.h index f77f9ae2a..dbeb41945 100644 --- a/include/em.h +++ b/include/em.h @@ -54,11 +54,15 @@ #define EM_ERR_INV_DRIVER 3 /* Invalid driver */ #define EM_ERR_NO_DEVICE 4 /* Device (hardware) not found */ -/* Parameters for the em_copy_... functions */ +/* Parameters for the em_copy_... functions. NOTE: The first seven bytes + * have the same order and alignment as needed for the Commodore REU, so + * don't change the order without changing the assembler file that defines + * the struct offsets and the code in the REU driver. + */ struct em_copy { - unsigned page; /* Starting page to copy from or to */ - unsigned char offs; /* Offset into page */ void* buf; /* Memory buffer to copy from or to */ + unsigned char offs; /* Offset into page */ + unsigned page; /* Starting page to copy from or to */ unsigned count; /* Number of bytes to copy */ unsigned char unused; /* Make the size 8 bytes */ }; @@ -82,16 +86,16 @@ unsigned em_pagecount (void); void* __fastcall__ em_map (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. + * a pointer to the location of the page in memory. Note: Without calling + * em_commit, the old contents of the memory window may be lost! */ -void* __fastcall__ em_mapclean (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! +void __fastcall__ em_commit (void); +/* Commit changes in the memory window to extended storage. If the contents + * of the memory window have been changed, these changes may be lost if + * em_map, em_copyfrom or em_copyto are called without calling em_commit + * first. Note: Not calling em_commit does not mean that the changes are + * discarded, it does just mean that some drivers will discard the changes. */ void __fastcall__ em_copyfrom (const struct em_copy* copy_data); diff --git a/libsrc/c64/c64-georam.s b/libsrc/c64/c64-georam.s index 288850acc..dee4eaa1e 100644 --- a/libsrc/c64/c64-georam.s +++ b/libsrc/c64/c64-georam.s @@ -29,7 +29,7 @@ .word DEINSTALL .word PAGECOUNT .word MAP - .word MAPCLEAN + .word COMMIT .word COPYFROM .word COPYTO @@ -81,8 +81,8 @@ PAGECOUNT: ; ------------------------------------------------------------------------ ; MAP: Map the page in a/x into memory and return a pointer to the page in -; a/x. The contents of the currently mapped page (if any) are assumed to be -; dirty and must be saved into secondary storage if this is necessary. +; a/x. The contents of the currently mapped page (if any) may be discarded +; by the driver. ; MAP: sta tmp1 @@ -100,16 +100,13 @@ MAP: sta tmp1 lda #GR_WINDOW - rts -; ------------------------------------------------------------------------ -; MAPCLEAN: Map the page in a/x into memory and return a pointer to the page -; in a/x. The contents of the currently mapped page (if any) are assumed to -; be clean, so if this is an advantage for the driver, the current contents -; may be discarded. +; Use the RTS from COMMIT below to save a precious byte of storage -MAPCLEAN = MAP ; Identical for GEORAM +; ------------------------------------------------------------------------ +; COMMIT: Commit changes in the memory window to extended storage. +COMMIT: rts ; ------------------------------------------------------------------------ ; COPYFROM: Copy from extended into linear memory. A pointer to a structure diff --git a/libsrc/em/Makefile b/libsrc/em/Makefile index 85efe2a1d..7766183c3 100644 --- a/libsrc/em/Makefile +++ b/libsrc/em/Makefile @@ -14,10 +14,10 @@ C_OBJS = em_load.o S_OBJS = em-kernel.o \ + em_commit.o \ em_copyto.o \ em_copyfrom.o \ em_map.o \ - em_mapclean.o \ em_pagecount.o \ em_unload.o \ diff --git a/libsrc/em/em-kernel.s b/libsrc/em/em-kernel.s index d7d29ce26..d2920b354 100644 --- a/libsrc/em/em-kernel.s +++ b/libsrc/em/em-kernel.s @@ -27,7 +27,7 @@ emd_install: jmp $0000 emd_deinstall: jmp $0000 emd_pagecount: jmp $0000 emd_map: jmp $0000 -emd_mapclean: jmp $0000 +emd_commit: jmp $0000 emd_copyfrom: jmp $0000 emd_copyto: jmp $0000 diff --git a/libsrc/em/em_commit.s b/libsrc/em/em_commit.s new file mode 100644 index 000000000..0b8590179 --- /dev/null +++ b/libsrc/em/em_commit.s @@ -0,0 +1,16 @@ +; +; Ullrich von Bassewitz, 2002-12-01 +; +; void __fastcall__ em_commit (void); +; /* Commit changes in the memory window to extended storage. If the contents +; * of the memory window have been changed, these changes may be lost if +; * em_map, em_copyfrom or em_copyto are called without calling em_commit +; * first. Note: Not calling em_commit does not mean that the changes are +; * discarded, it does just mean that some drivers will discard the changes. +; */ + + .include "em-kernel.inc" + + _em_commit = emd_commit ; Use driver entry + + diff --git a/libsrc/em/em_mapclean.s b/libsrc/em/em_mapclean.s deleted file mode 100644 index ead21e1d9..000000000 --- a/libsrc/em/em_mapclean.s +++ /dev/null @@ -1,17 +0,0 @@ -; -; Ullrich von Bassewitz, 2002-11-29 -; -; void* __fastcall__ em_mapclean (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! -; */ - - - .include "em-kernel.inc" - - _em_mapclean = emd_mapclean ; Use driver entry -