65f02 wrote:
Along the same lines, maybe it would work to fall back into slow mode whenever a disk I/O address is accessed, and stay there until an RTS is encountered?
Well, first of all you'd need to count JSRs and RTSs or risk mishandling timing-criticial code with subroutine calls in it (which sound as if it may be expensive), and second (as I can attest from personal experience) even counting doesn't always work. Since the 6502 doesn't have an indirect JSR (unlike the 6800), it's synthesized by pushing an address on to the stack and jumping, and even with a direct JSR the stack-push technique may be cleaner when programming in continuation passing style. And of course the developer may be using RTS tricks just because it happens to give him the exact timing he needs in the smallest number of bytes.
Quote:
Also, a good point about needing to access all addresses externally while in slow mode.
Yeah, I think that's something that escaped all of us at the start, for some reason. The "stack runs too fast" issue hadn't occured to me; I was just realizing that there must be writes of data to the sector buffer in RWTS, and the sector buffer was obviously not in the same page....
Quote:
That will need a new flavor of bus cycles in the replica, where data are fetched from internal RAM (where they may previously have been written by some fast code elsewhere), but nevertheless an external bus cycle is started to retain the timing. Which should, of course, be quite feasible.
Yup, that's exactly how I envisioned it. I was wondering if one should actually do the write, as well, or just do some random read cycle (from any address, basically) that avoids changing the external RAM. I guess whatever's easiest, since the the state of external RAM that's emulated internally is probably "undefined."
Though, thinking about that, it now occurs to me that on some systems different areas of memory will run at different speeds (e.g., ROM may have wait-states). So it probably makes sense to at least ensure that the address you're using externally is the actual address being read or written by the code.
Quote:
Had gotten sidetracked over the past days by the suggestion of a (dare I say in a 6502 forum?) CDP 1806 replica...
Oh, yeah, other processors get regular mentions in this forum. The 6800, for example, though mostly that seems to be in threads explaining how much faster the 6502 is over the 6800, poor thing. I have RCA1802 on my list, too, because I accidentally ordered ten of those instead of ten 6809s and they weren't worth returning so they went into the parts bin anyway. But since I have them, I must use them, right?