From 61dae23726a482742ed9a080306636c2fc12d889 Mon Sep 17 00:00:00 2001 From: Ivan Izaguirre Date: Sun, 20 Oct 2019 13:31:57 +0200 Subject: [PATCH] Language cards, disable write on softswitches writes. --- cardLanguage.go | 15 ++++++++------- cardSaturn.go | 12 ++++++++---- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/cardLanguage.go b/cardLanguage.go index 15b708d..4578798 100644 --- a/cardLanguage.go +++ b/cardLanguage.go @@ -57,15 +57,11 @@ func (c *cardLanguage) assign(a *Apple2, slot int) { for i := 0x0; i <= 0xf; i++ { iCopy := i c.ssr[iCopy] = func(*ioC0Page) uint8 { - c.ssAction(iCopy) + c.ssAction(iCopy, false) return 0 } c.ssw[iCopy] = func(*ioC0Page, uint8) { - c.ssAction(iCopy) - - // Writing shoud reset write count per A2AUDIT - // but doing that makes ProDos to not load. - // c.writeState = lcWriteDisabled + c.ssAction(iCopy, true) } } @@ -73,7 +69,7 @@ func (c *cardLanguage) assign(a *Apple2, slot int) { c.applyState() } -func (c *cardLanguage) ssAction(ss int) { +func (c *cardLanguage) ssAction(ss int, write bool) { c.activeBank = (ss >> 3) & 1 action := ss & 0x3 switch action { @@ -99,6 +95,11 @@ func (c *cardLanguage) ssAction(ss int) { c.writeState = lcWriteEnabled } + // Writing to the softswtich disables writes. + if write { + c.writeState = lcWriteDisabled + } + c.applyState() } diff --git a/cardSaturn.go b/cardSaturn.go index 4d8f491..e76cd73 100644 --- a/cardSaturn.go +++ b/cardSaturn.go @@ -48,19 +48,18 @@ func (c *cardSaturn) assign(a *Apple2, slot int) { for i := 0x0; i <= 0xf; i++ { iCopy := i c.ssr[iCopy] = func(*ioC0Page) uint8 { - c.ssAction(iCopy) + c.ssAction(iCopy, false) return 0 } c.ssw[iCopy] = func(*ioC0Page, uint8) { - // Writing does not reset write count - c.ssAction(iCopy) + c.ssAction(iCopy, true) } } c.cardBase.assign(a, slot) c.applyState() } -func (c *cardSaturn) ssAction(ss int) { +func (c *cardSaturn) ssAction(ss int, write bool) { switch ss { case 0: // RAM read, no writes @@ -124,6 +123,11 @@ func (c *cardSaturn) ssAction(ss int) { c.writeState = lcWriteEnabled } + // Writing to the softswtich disables writes. + if write { + c.writeState = lcWriteDisabled + } + c.applyState() }