Language cards, disable write on softswitches writes.

This commit is contained in:
Ivan Izaguirre 2019-10-20 13:31:57 +02:00 committed by Iván Izaguirre
parent 3f7e3b3013
commit 61dae23726
2 changed files with 16 additions and 11 deletions

View File

@ -57,15 +57,11 @@ func (c *cardLanguage) assign(a *Apple2, slot int) {
for i := 0x0; i <= 0xf; i++ { for i := 0x0; i <= 0xf; i++ {
iCopy := i iCopy := i
c.ssr[iCopy] = func(*ioC0Page) uint8 { c.ssr[iCopy] = func(*ioC0Page) uint8 {
c.ssAction(iCopy) c.ssAction(iCopy, false)
return 0 return 0
} }
c.ssw[iCopy] = func(*ioC0Page, uint8) { c.ssw[iCopy] = func(*ioC0Page, uint8) {
c.ssAction(iCopy) c.ssAction(iCopy, true)
// Writing shoud reset write count per A2AUDIT
// but doing that makes ProDos to not load.
// c.writeState = lcWriteDisabled
} }
} }
@ -73,7 +69,7 @@ func (c *cardLanguage) assign(a *Apple2, slot int) {
c.applyState() c.applyState()
} }
func (c *cardLanguage) ssAction(ss int) { func (c *cardLanguage) ssAction(ss int, write bool) {
c.activeBank = (ss >> 3) & 1 c.activeBank = (ss >> 3) & 1
action := ss & 0x3 action := ss & 0x3
switch action { switch action {
@ -99,6 +95,11 @@ func (c *cardLanguage) ssAction(ss int) {
c.writeState = lcWriteEnabled c.writeState = lcWriteEnabled
} }
// Writing to the softswtich disables writes.
if write {
c.writeState = lcWriteDisabled
}
c.applyState() c.applyState()
} }

View File

@ -48,19 +48,18 @@ func (c *cardSaturn) assign(a *Apple2, slot int) {
for i := 0x0; i <= 0xf; i++ { for i := 0x0; i <= 0xf; i++ {
iCopy := i iCopy := i
c.ssr[iCopy] = func(*ioC0Page) uint8 { c.ssr[iCopy] = func(*ioC0Page) uint8 {
c.ssAction(iCopy) c.ssAction(iCopy, false)
return 0 return 0
} }
c.ssw[iCopy] = func(*ioC0Page, uint8) { c.ssw[iCopy] = func(*ioC0Page, uint8) {
// Writing does not reset write count c.ssAction(iCopy, true)
c.ssAction(iCopy)
} }
} }
c.cardBase.assign(a, slot) c.cardBase.assign(a, slot)
c.applyState() c.applyState()
} }
func (c *cardSaturn) ssAction(ss int) { func (c *cardSaturn) ssAction(ss int, write bool) {
switch ss { switch ss {
case 0: case 0:
// RAM read, no writes // RAM read, no writes
@ -124,6 +123,11 @@ func (c *cardSaturn) ssAction(ss int) {
c.writeState = lcWriteEnabled c.writeState = lcWriteEnabled
} }
// Writing to the softswtich disables writes.
if write {
c.writeState = lcWriteDisabled
}
c.applyState() c.applyState()
} }