diff --git a/README.md b/README.md index f4a25e1..eeffbb5 100644 --- a/README.md +++ b/README.md @@ -241,7 +241,8 @@ The available cards are: mouse: Mouse card implementation, does not emulate a real card, only the firmware behaviour multirom: Multiple Image ROM card parallel: Card to dump to a file what would be printed to a parallel printer - prodosrom: A bootable 1 MB solid state disk + prodosromcard3: A bootable 4 MB ROM card by Ralle Palaveev + prodosromdrive: A bootable 1 MB solid state disk by Terence Boldt saturn: RAM card with 128Kb, it's like 8 language cards smartport: SmartPort interface card softswitchlogger: Card to log softswitch accesses diff --git a/cardBuilder.go b/cardBuilder.go index b131335..dc07c35 100644 --- a/cardBuilder.go +++ b/cardBuilder.go @@ -51,7 +51,8 @@ func getCardFactory() map[string]*cardBuilder { cardFactory["mouse"] = newCardMouseBuilder() cardFactory["multirom"] = newMultiRomCardBuilder() cardFactory["parallel"] = newCardParallelPrinterBuilder() - cardFactory["prodosrom"] = newCardProDOSRomDriveBuilder() + cardFactory["prodosromdrive"] = newCardProDOSRomDriveBuilder() + cardFactory["prodosromcard3"] = newCardProDOSRomCard3Builder() cardFactory["saturn"] = newCardSaturnBuilder() cardFactory["smartport"] = newCardSmartPortStorageBuilder() cardFactory["swyftcard"] = newCardSwyftBuilder() diff --git a/cardProDOSRomCard3.go b/cardProDOSRomCard3.go new file mode 100644 index 0000000..8a98da5 --- /dev/null +++ b/cardProDOSRomCard3.go @@ -0,0 +1,79 @@ +package izapple2 + +import "fmt" + +/* +Ralle Palaveev's ProDOS-Romcard3 + +See: + https://github.com/rallepaqlaveev/ProDOS-Romcard3 + +Note that this card disables the C800-CFFF range only on writes to CFFF, not as most other cards that disable on reads and writes. + +*/ + +// CardProDOSRomCard3 is a Memory Expansion card +type CardProDOSRomCard3 struct { + cardBase + bank uint16 + data []uint8 +} + +func newCardProDOSRomCard3Builder() *cardBuilder { + return &cardBuilder{ + name: "ProDOS ROM Card 3", + description: "A bootable 4 MB ROM card by Ralle Palaveev", + defaultParams: &[]paramSpec{ + {"image", "ROM image with the ProDOS volume", "https://github.com/rallepalaveev/ProDOS-Romcard3/raw/main/ProDOS-ROMCARD3_4MB_A2D.v1.4_v37.po"}, + }, + buildFunc: func(params map[string]string) (Card, error) { + image := paramsGetPath(params, "image") + if image == "" { + return nil, fmt.Errorf("image required for the ProDOS ROM drive") + } + + data, _, err := LoadResource(image) + if err != nil { + return nil, err + } + + var c CardProDOSRomCard3 + c.data = data + c.loadRom(data[0x200:0x300]) + c.romC8xx = &c + return &c, nil + }, + } +} + +func (c *CardProDOSRomCard3) assign(a *Apple2, slot int) { + + // Set pointer position + c.addCardSoftSwitchW(0, func(value uint8) { + c.bank = uint16(value) | c.bank&0xff00 + }, "BANKLO") + c.addCardSoftSwitchW(1, func(value uint8) { + c.bank = uint16(value)<<8 | c.bank&0xff + }, "BANKHI") + + c.cardBase.assign(a, slot) +} + +func (c *CardProDOSRomCard3) translateAddress(address uint16) int { + // An address from 0xC800 to 0xCFFF is mapped to the corresponding bank of the ROM + // There are 0x800 (2048) banks with 0x0800 (2048) bytes each + offset := address - 0xC800 + pageAddress := int(c.bank&0x7FF) * 0x0800 + + //fmt.Printf("CardProDOSRomCard3.translateAddress: address=%04X, bank=%04X, offset=%04X, pageAddress=%08X\n", address, c.bank, offset, pageAddress) + + return pageAddress + int(offset) +} + +func (c *CardProDOSRomCard3) peek(address uint16) uint8 { + return c.data[c.translateAddress(address)] +} + +func (c *CardProDOSRomCard3) poke(address uint16, value uint8) { + // Do nothing +} diff --git a/cardProDOSRomDrive.go b/cardProDOSRomDrive.go index ed984a6..cc457d3 100644 --- a/cardProDOSRomDrive.go +++ b/cardProDOSRomDrive.go @@ -3,7 +3,7 @@ package izapple2 import "fmt" /* -ProDOS-ROM-Drive: A bootable 1 MB solid state disk for Apple ][ computers +Terence Boldt's ProDOS-ROM-Drive: A bootable 1 MB solid state disk for Apple ][ computers Emulates version 4.0+ @@ -25,10 +25,10 @@ const proDOSRomDriveMask = 0xf_ffff // 1 MB mask func newCardProDOSRomDriveBuilder() *cardBuilder { return &cardBuilder{ name: "ProDOS ROM Drive", - description: "A bootable 1 MB solid state disk", + description: "A bootable 1 MB solid state disk by Terence Boldt", defaultParams: &[]paramSpec{ - //∫{"image", "ROM image with the ProDOS volume", "https://github.com/tjboldt/ProDOS-ROM-Drive/raw/v4.0/Firmware/GamesWithFirmware.po"}, - {"image", "ROM image with the ProDOS volume", "https://github.com/Alex-Kw/ProDOS-ROM-Drive-Images/raw/main/ProDOS242_Beta5.po"}, + //{"image", "ROM image with the ProDOS volume", "https://github.com/tjboldt/ProDOS-ROM-Drive/raw/v4.0/Firmware/GamesWithFirmware.po"}, + {"image", "ROM image with the ProDOS volume", "https://github.com/Alex-Kw/ProDOS-ROM-Drive-Images/raw/main/ProDOS_2.4.3_TJ.po"}, }, buildFunc: func(params map[string]string) (Card, error) { image := paramsGetPath(params, "image") diff --git a/configs/2e.cfg b/configs/2e.cfg index e6a9456..51e1127 100644 --- a/configs/2e.cfg +++ b/configs/2e.cfg @@ -4,6 +4,4 @@ board: 2e rom: /Apple2e.rom charrom: /Apple IIe Video Unenhanced.bin s0: language -s2: vidhd -s3: fastchip s6: diskii,disk1=/dos33.dsk \ No newline at end of file diff --git a/doc/usage.txt b/doc/usage.txt index c3def2d..8445192 100644 --- a/doc/usage.txt +++ b/doc/usage.txt @@ -66,7 +66,8 @@ The available cards are: mouse: Mouse card implementation, does not emulate a real card, only the firmware behaviour multirom: Multiple Image ROM card parallel: Card to dump to a file what would be printed to a parallel printer - prodosrom: A bootable 1 MB solid state disk + prodosromcard3: A bootable 4 MB ROM card by Ralle Palaveev + prodosromdrive: A bootable 1 MB solid state disk by Terence Boldt saturn: RAM card with 128Kb, it's like 8 language cards smartport: SmartPort interface card softswitchlogger: Card to log softswitch accesses diff --git a/memoryManager.go b/memoryManager.go index c455e9e..5d40917 100644 --- a/memoryManager.go +++ b/memoryManager.go @@ -104,7 +104,14 @@ func (mmu *memoryManager) accessCArea(address uint16) memoryHandler { // Extra slot area reset if address == ioC8Off { // Reset extra slot area owner - mmu.activeSlot = 0 + + // There is not really an activeSlot in c8xx, any card could be active + // we should check all of them and maybe have conflicts. As I don't do that I won't disable and + // just track teh last active card. + // This code is disabled because cards could have different logic for disabling. Most cards disable + // on access to 0xCFFF, but the ProDOS ROM card 3 disables only on writes and not on reads. + // mmu.activeSlot = 0 + mmu.intC8ROMActive = false }