;------------------------------------------------------------------------------
; 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
;------------------------------------------------------------------------------
.global emd_deinstall
.global emd_pagecount
.global emd_map
- .global emd_mapclean
+ .global emd_commit
.global emd_copyfrom
.global emd_copyto
.global _em_deinstall
.global _em_pagecount
.global _em_map
- .global _em_mapclean
+ .global _em_commit
.global _em_copyfrom
.global _em_copyto
#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 */
};
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);
.word DEINSTALL
.word PAGECOUNT
.word MAP
- .word MAPCLEAN
+ .word COMMIT
.word COPYFROM
.word COPYTO
; ------------------------------------------------------------------------
; 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
lda #<GR_WINDOW
ldx #>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
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 \
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
--- /dev/null
+;
+; 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
+
+
+++ /dev/null
-;
-; 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
-