I've done a few experiments into the INput and OUTput timings on the Sam. I
used a program by Ian called "Z-States" which gives a visual indication of
how long a short sequence of instructions has taken, both on and off the
screen.
Now, readers of Based On An Idea will recall that you can consider the
Sam's clock in terms of "uncontended t-states" (there are four uncontended
t-states for every 8 t-states in the contended screen area). Most
instructions will take the same number of uncontended t-states in the
screen or border areas (intructions which which do not access memory during
contention may appear to save 4 uncontended t-states and are denoted *).
So... I've tested various types of IN and OUT instruction against various
Sam ports: VMPR, HMPR, CLUT, SOUND, MIDI, KEYBOARD. In short, their timings
are all equivalent. 16* uncontended t-states for an IN a,(n) or OUT (n),a;
20** uts for an IN a,(c) or OUT (c),a.
Question: Does SimCoupe currently use those values for the instruction time?
What other ports should I try, which might not involve the added ASIC delay?
Andrew
Detailed results follow...
Instruction. Z-80 raw timing. Expected Sam timings.
OUT (n),a 11 12(+4) *
OUT (c),a 12 12(+4) *
IN a,(n) 11 12(+4) *
IN a,(c) 12 12(+4) *
* Reality Check
Mnemonic M/Code
LD a,n 62 n Always takes 8 uts.
LD bc,nn 1 n n Always takes 12 uts. So far, so good.
* VMPR ----------------------------------------------------
LD a,254 62 254 8 uts
OUT (VMPR),a 211 252 12 uts on-screen, 16 uts off-screen
LD bc,VMPR 1 252 0 12 uts
LD a,254 62 254 8 uts
OUT (c),a 237 121 12 uts in-screen, 20 uts off-screen
IN a,(VMPR) 219 252 12 uts in-screen, 16 uts off-screen
LD bc,VMPR 1 252 0 12 uts
IN a,(c) 237 120 12 uts in-screen, 20 uts off-screen
* HMPR ----------------------------------------------------
IN a,(HMPR) 219 251 12 uts in-screen, 16 uts off-screen
LD bc,HMPR 1 251 0 12 uts
IN a,(c) 237 120 12 uts in-screen, 20 uts off-screen
* CLUT ----------------------------------------------------
LD a,127 62 127 8 uts
OUT (CLUT),a 211 248 12 uts on-screen, 16 uts off-screen
LD bc,CLUT 1 248 0 12 uts
LD a,127 62 127 8 uts
OUT (c),a 237 121 12 uts in-screen, 20 uts off-screen
* SOUND ---------------------------------------------------
LD a,28 62 28 8 uts
OUT (255),a 211 255 12 uts on-screen, 16 uts off-screen
LD bc,511 1 255 1 12 uts
LD a,28 62 28 8 uts
OUT (c),a 237 121 12 uts in-screen, 20 uts off-screen
* MIDI ----------------------------------------------------
LD a,123 62 123 8 uts
OUT (MIDI),a 211 253 12 uts on-screen, 16 uts off-screen
LD bc,MIDI 1 253 0 12 uts
LD a,123 62 123 8 uts
OUT (c),a 237 121 12 uts in-screen, 20 uts off-screen
IN a,(MIDI) 219 253 12 uts in-screen, 16 uts off-screen
LD bc,MIDI 1 253 0 12 uts
IN a,(c) 237 120 12 uts in-screen, 20 uts off-screen
* KEYBOARD ------------------------------------------------
IN a,(KEYBOARD) 219 254 12 uts in-screen, 16 uts off-screen
LD bc,KEYBOARD 1 254 254 12 uts
IN a,(c) 237 120 12 uts in-screen, 20 uts off-screen
**
Summary:
OUT (n),a OUT (c),a IN a,(n) IN a,(c)
VMPR 16 * 20 ** 16 * 20 **
HMPR 16 * 20 **
CLUT 16 * 20 ** - -
SOUND - - 16 * 20 **
MIDI 16 * 20 ** 16 * 20 **
KEYBOARD - - 16 * 20 **
--
-- Andrew Collier ([EMAIL PROTECTED]) -- My other
-- http://mnemotech.ucam.org -- .sig is a
-- Part 3 Materials Science, Cambridge -- PDF file
--