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 - lda #BASE + sta ptr1+1 ; To + + ldy #EM_COPY::BUF + lda (ptr3),y + sta ptr2 + iny + lda (ptr3),y + sta ptr2+1 ; From + + 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 #