]> git.sur5r.net Git - cc65/blobdiff - libsrc/c128/c128-ramcart.s
remove superfluous ".code" line
[cc65] / libsrc / c128 / c128-ramcart.s
index 194fec87150c6227ce2d22f33d05ec90c42c8619..ad76b4965f44e82dd98bc402f74b5b7d6acba58c 100644 (file)
@@ -1,9 +1,10 @@
 ;
-; Extended memory driver for the RamCart 64/128KB cartridge
-; (based on GEORAM code by Ullrich von Bassewitz)
+; Extended memory driver for the RamCart 64/128KB cartridge. Driver works
+; without problems when statically linked.
+; Code is based on GEORAM code by Ullrich von Bassewitz.
 ; Maciej 'YTM/Elysium' Witkowiak <ytm@elysium.pl>
 ; 06,22.12.2002
-; 
+;
 
 
        .include        "zeropage.inc"
 ; 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   USE
 ; ------------------------------------------------------------------------
 ; Constants
 
-RAMC_WINDOW       = $DF00                 ; Address of RamCart window
-RAMC_PAGE_LO      = $DE00                 ; Page register low
-RAMC_PAGE_HI      = $DE01                 ; Page register high (only for RC128)
+RAMC_WINDOW       = $DF00               ; Address of RamCart window
+RAMC_PAGE_LO      = $DE00               ; Page register low
+RAMC_PAGE_HI      = $DE01               ; Page register high (only for RC128)
 
 ; ------------------------------------------------------------------------
 ; Data.
 
-.data
+.bss
 
-pagecount:      .word   512              ; default for RC128
+pagecount:      .res    2               ; Number of pages available
 
 .code
 
@@ -99,14 +100,14 @@ INSTALL:
 @readonly:
        lda     #<EM_ERR_NO_DEVICE
        ldx     #>EM_ERR_NO_DEVICE
-       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
 
 
@@ -251,7 +252,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
@@ -260,7 +261,7 @@ setup:  sta     ptr1
 
 ; Get the buffer pointer into ptr2
 
-        ldy     #EM_COPY_BUF
+        ldy     #EM_COPY::BUF
         lda     (ptr1),y
         sta     ptr2
         iny
@@ -269,7 +270,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
@@ -280,7 +281,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