Comments (3)
Thanks for the bug report! There's definitely a bug because MMU._prewrite
is never actually read.
From Understanding the Apple IIe by Jim Sather pp. 5-23 to 5-24:
Writing to high RAM is enabled when the HRAMWRT' soft switch is reset. The controlling MPU program must set the PRE-WRITE soft switch before it can reset HRAMWRT'. PRE-WRITE is set by odd read access in the *C08X range. It is reset by even read access or any write access in the $C08X range. HRAMWRT' is reset by odd read access in the $C08X range when PRE-WRITE is set. It is set by even access in the $C08X range. Any other type of access causes HRAMWRT' to hold its current state.
...
PRE-WRITE and WRITE can be thought of as a write counter which counts odd read accesses in the $C08X range. The counter is set to zero by even or write access in the $C08X range. If the write counter reaches the count of 2, writing to high RAM becomes enabled. From that point, writing will stay enabled until an even access is made in the $C08X range. This means there is a feature of RAM card control not documented by Apple: write access to an odd address in the $C08X range controls HRAMRD without affecting the state of HRAMWRT'.
Let's break that down into more manageable chunks:
PRE-WRITE
PRE-WRITE is set by odd read access in the *C08X range. It is reset by even read access or any write access in the $C08X range.
In the emulator, PRE-WRITE is MMU._prewrite
. So, MMU._prewrite
should be set when writeSwitch && readMode
and reset when (!writeSwitch && readMode) || !readMode
. The suggested code captures this intent with:
if (writeSwitch) { // 0xC081, 0xC083
if (readMode) {
if (this._prewrite) {
...
this._prewrite = false; // <-- incorrect ???
} else {
this._prewrite = true;
}
} else {
this._prewrite = false;
}
...
} else { // 0xC080, 0xC082
...
this._prewrite = false;
...
}
The one thing that I'm not sure about is the reset on read when PRE-WRITE is already set (commented line above). This appears to be an error if Sather is correct. According to figure 5.13a on p. 5-30, PRE-WRITE does not depend on anything but A0 and R/W', which supports not resetting PRE-WRITE when it's enabled. If you can find other evidence, one way or the other, I would be interested.
HRAMWRT'
HRAMWRT' is reset by odd read access in the $C08X range when PRE-WRITE is set. It is set by even access in the $C08X range. Any other type of access causes HRAMWRT' to hold its current state.
In the emulator, HRAMWRT' is MMU._writebsr
, but the emulator uses regular logic. So, MMU._writebsr
should be set when writeSwitch && readMode && MMU._prewrite
. It should be reset when !writeSwitch
. The suggested code captures this intent with:
if (writeSwitch) { // 0xC081, 0xC083
if (readMode) {
if (this._prewrite) {
this._writebsr = true;
...
}
...
} else { // 0xC080, 0xC082
this._writebsr = false;
...
}
This seems like it works fine.
I'll try to make a change tonight to fix this bug otherwise I'm sure that @whscullin will get to it before long.
from apple2js.
Probably need to verify that the fix do not cause any regression using the a2audit test from https://github.com/zellyn/a2audit
from apple2js.
Reopening the issue as only realized it is fixed in forked version at iflan/apple2js
from apple2js.
Related Issues (20)
- Apple II DeskTop's triggering DHR Mono mode fails HOT 2
- State saving and recovery is not good when using a smart drive HOT 4
- Mocking board emulation
- ThunderClock is not interrupting. HOT 2
- Option to slow acceleration during audio playback HOT 3
- Loading a disk into Drive 2 reloads the disk from Drive 1 HOT 1
- how to exit fullscreen HOT 10
- Saving self-written program to file/localStorage? HOT 3
- Disabling Mouse Joystick HOT 1
- Better Rendering HOT 2
- Virtual keyboard issue on Android hosted Chrome
- Merlin need Apple 2c or 2e-128 HOT 1
- Is there documentation, or a changelog, besides the commit comments?
- a bit more explanation on creating a static distribution HOT 1
- Save state, load no more? HOT 1
- README says sit instead of git HOT 1
- Memory size? HOT 3
- Apple IIgs support? HOT 2
- Accelerometer support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from apple2js.