From: uz Date: Thu, 4 Feb 2010 18:28:56 +0000 (+0000) Subject: Moved the extended RAM driver to c128-ram2.emd and restored the old one. X-Git-Tag: V2.13.2~26 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=44bb5c62e6f2b54d4997d2f261250fadf0c68e1e;p=cc65 Moved the extended RAM driver to c128-ram2.emd and restored the old one. Machines with RAM in pages 2+3 are quite rare, so it's better to have the additional code+features in a separate driver. git-svn-id: svn://svn.cc65.org/cc65/trunk@4575 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/doc/c128.sgml b/doc/c128.sgml index 41e026e13..f30286439 100644 --- a/doc/c128.sgml +++ b/doc/c128.sgml @@ -195,6 +195,15 @@ missing on VDC and are translated to the two colors missing from VIC palette. An extended memory driver for the RAM in page 1. The common memory area is excluded, so this driver supports 251 pages of 256 bytes each. + + + An extended memory driver for the RAM in pages 1-3. The common memory area + is excluded, so this driver supports up to 731 pages of 256 bytes each. The + driver can be used as a full replacement for A driver for the RamCart 64/128 written and contributed by Maciej Witkowiak. Will test the hardware for the available RAM. diff --git a/libsrc/c128/Makefile b/libsrc/c128/Makefile index ee176650b..248c36fd2 100644 --- a/libsrc/c128/Makefile +++ b/libsrc/c128/Makefile @@ -73,15 +73,24 @@ OBJS = _scrsize.o \ #-------------------------------------------------------------------------- # Drivers -EMDS = c128-georam.emd c128-ram.emd c128-ramcart.emd c128-reu.emd c128-vdc.emd +EMDS = c128-georam.emd \ + c128-ram.emd \ + c128-ram2.emd \ + c128-ramcart.emd \ + c128-reu.emd \ + c128-vdc.emd -JOYS = c128-ptvjoy.joy c128-stdjoy.joy +JOYS = c128-ptvjoy.joy \ + c128-stdjoy.joy -MOUS = c128-1351.mou c128-joymouse.mou c128-potmouse.mou +MOUS = c128-1351.mou \ + c128-joymouse.mou \ + c128-potmouse.mou -SERS = c128-swlink.ser +SERS = c128-swlink.ser -TGIS = c128-640-200-2.tgi c128-640-480-2.tgi +TGIS = c128-640-200-2.tgi \ + c128-640-480-2.tgi #-------------------------------------------------------------------------- # Targets diff --git a/libsrc/c128/c128-ram.s b/libsrc/c128/c128-ram.s index 6b384392c..1211c444d 100644 --- a/libsrc/c128/c128-ram.s +++ b/libsrc/c128/c128-ram.s @@ -1,11 +1,8 @@ ; -; Extended memory driver for the C128 RAM in banks #1, #2 and #3. Driver works without +; Extended memory driver for the C128 RAM in bank #1. Driver works without ; problems when statically linked. ; ; Ullrich von Bassewitz, 2002-12-04 -; -; Updated to use banks 2 and 3 as well by -; Marco van den Heuvel, 2010-01-21 ; .include "zeropage.inc" @@ -43,19 +40,17 @@ ; Constants BASE = $400 +TOPMEM = $FF00 +PAGES = (TOPMEM - BASE) / 256 ; ------------------------------------------------------------------------ ; Data. .bss -curpage: .res 2 ; Current page number -curbank: .res 1 ; Current bank number -copybank: .res 2 ; temp bank number +curpage: .res 1 ; Current page number window: .res 256 ; Memory "window" -pagecount: .res 2 ; Number of available pages - .code ; ------------------------------------------------------------------------ @@ -66,46 +61,12 @@ pagecount: .res 2 ; Number of available pages ; INSTALL: - ldx #0 - stx ptr1 - ldx #4 - stx ptr1+1 - ldx #PAGES rts ; ------------------------------------------------------------------------ @@ -131,25 +92,21 @@ PAGECOUNT: ; by the driver. ; -MAP: sei - sta curpage +MAP: sta curpage stx curpage+1 ; Remember the new page - jsr calculate_bank_and_correct_page - stx curbank - clc - adc #>BASE - sta ptr1+1 - ldy #$00 - sty ptr1 + adc #>BASE + sta ptr1+1 + ldy #$00 + sty ptr1 + lda #window ; Return the window address - cli rts ; ------------------------------------------------------------------------ @@ -174,19 +130,15 @@ USE: sta curpage ; ------------------------------------------------------------------------ ; COMMIT: Commit changes in the memory window to extended storage. -COMMIT: sei - lda curpage ; Get the current page +COMMIT: lda curpage ; Get the current page ldx curpage+1 bmi done ; Jump if no page mapped - jsr calculate_bank_and_correct_page - stx curbank - clc adc #>BASE sta ptr1+1 ldy #$00 - sty ptr1 + sty ptr1 lda #BASE + sta ptr1+1 ; From + + ldy #EM_COPY::BUF + lda (ptr3),y + sta ptr2 + iny + lda (ptr3),y + sta ptr2+1 ; To + + lda #BASE + sta ptr1+1 ; To ldy #EM_COPY::BUF - lda (ptr1),y + lda (ptr3),y sta ptr2 iny - lda (ptr1),y - sta ptr2+1 + lda (ptr3),y + sta ptr2+1 ; From -; Get the count, calculate -(count-1) and store it into ptr3 + lda #BASE + sta ptr1+1 + ldy #$00 + sty ptr1 + lda #window ; Return the window address + cli + rts + +; ------------------------------------------------------------------------ +; USE: Tell the driver that the window is now associated with a given page. + +USE: sta curpage + stx curpage+1 ; Remember the page + lda #window ; Return the window + rts + +; ------------------------------------------------------------------------ +; COMMIT: Commit changes in the memory window to extended storage. + +COMMIT: sei + lda curpage ; Get the current page + ldx curpage+1 + bmi done ; Jump if no page mapped + + jsr calculate_bank_and_correct_page + stx curbank + + clc + adc #>BASE + sta ptr1+1 + ldy #$00 + sty ptr1 + + lda #