]> git.sur5r.net Git - cc65/blobdiff - libsrc/c64/c64-georam.s
fix comments
[cc65] / libsrc / c64 / c64-georam.s
index 288850acc2811cf9247538af2d78a187cd3838d5..0e33b8d94bddac61cabc669a57fb53b59a2707ee 100644 (file)
@@ -1,5 +1,6 @@
 ;
-; Extended memory driver for the GEORAM cartridge
+; Extended memory driver for the GEORAM cartridge. Driver works without
+; problems when statically linked.
 ;
 ; Ullrich von Bassewitz, 2002-11-29
 ;
 ; Driver signature
 
         .byte   $65, $6d, $64           ; "emd"
-        .byte   $00                     ; EM API version number
+        .byte   EMD_API_VERSION                ; EM API version number
 
 ; Jump table.
 
         .word   INSTALL
-        .word   DEINSTALL
+        .word   UNINSTALL
         .word   PAGECOUNT
         .word   MAP
-        .word   MAPCLEAN
+        .word   USE
+        .word   COMMIT
        .word   COPYFROM
         .word   COPYTO
 
@@ -59,14 +61,14 @@ pagecount:      .word   2048            ; Currently fixed
 INSTALL:
         lda     #<EM_ERR_OK
         ldx     #>EM_ERR_OK
-        rts
+;       rts                     ; Run into UNINSTALL instead
 
 ; ------------------------------------------------------------------------
-; DEINSTALL routine. Is called before the driver is removed from memory.
+; UNINSTALL routine. Is called before the driver is removed from memory.
 ; Can do cleanup or whatever. Must not return anything.
 ;
 
-DEINSTALL:
+UNINSTALL:
         rts
 
 
@@ -79,10 +81,17 @@ PAGECOUNT:
         ldx     pagecount+1
         rts
 
+; ------------------------------------------------------------------------
+; USE: Tell the driver that the window is now associated with a given page.
+; The GeoRAM cartridge does not copy but actually map the window, so USE is
+; identical to MAP.
+
+USE     = MAP            
+
 ; ------------------------------------------------------------------------
 ; 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 +109,13 @@ 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
@@ -219,7 +225,7 @@ setup:  sta     ptr1
 ; Get the page number from the struct and adjust it so that it may be used
 ; with the hardware. That is: lower 6 bits in tmp1, high bits in tmp2.
 
-        ldy     #EM_COPY_PAGE+1
+        ldy     #EM_COPY::PAGE+1
         lda     (ptr1),y
         sta     tmp2
         dey
@@ -234,7 +240,7 @@ setup:  sta     ptr1
 
 ; Get the buffer pointer into ptr2
 
-        ldy     #EM_COPY_BUF
+        ldy     #EM_COPY::BUF
         lda     (ptr1),y
         sta     ptr2
         iny
@@ -243,7 +249,7 @@ setup:  sta     ptr1
 
 ; Get the count, calculate -(count-1) and store it into ptr3
 
-        ldy     #EM_COPY_COUNT
+        ldy     #EM_COPY::COUNT
         lda     (ptr1),y
         eor     #$FF
         sta     ptr3
@@ -254,7 +260,7 @@ setup:  sta     ptr1
 
 ; Get the page offset into X and clear Y
 
-        ldy     #EM_COPY_OFFS
+        ldy     #EM_COPY::OFFS
         lda     (ptr1),y
         tax
         ldy     #$00