Page 1 of 1

Re: Starting emulator - help with basics of Z80 timing needed

Posted: Sun Aug 18, 2019 8:55 am
by Stefan
I am in the middle of looking at generating timing sensitive code (SAM MOD player) and am surprised by the pc:1 x 5 contention on the last 5 t-states.

Based on http://www.z80.info/z80ins.txt

JR e 2 OCF(4) OD(3) IO(5)

So that's
- 4 t-state opcode fetch (memory access -> contended)
- 3 t-state opcode data (memory access -> contended)
- 5 t-state internal operation.

I did not expect an internal operation on the z80 to be contended?

Re: Starting emulator - help with basics of Z80 timing needed

Posted: Sun Aug 18, 2019 9:01 am
by Stefan
And if I am reading what SimCoupe is doing correctly, https://github.com/simonowen/simcoupe/b ... e/Z80ops.h is simply adding 5 to the CycleCounter.

Re: Starting emulator - help with basics of Z80 timing needed

Posted: Sun Aug 18, 2019 9:45 am
by Woodster
Stefan wrote: Sun Aug 18, 2019 8:55 am I did not expect an internal operation on the z80 to be contended?
They're contended because the ULA doesn't look at the control bus for MREQ signals and the like and only respond to what it sees on the address bus which is the last address latched, or the address of the JR offset byte in this case.

The +2a/+3 does acknowledge these signals and those final 5 t-states are not contended.

Re: Starting emulator - help with basics of Z80 timing needed

Posted: Sun Aug 18, 2019 9:59 am
by Stefan
Woodster wrote: Sun Aug 18, 2019 9:45 am
Stefan wrote: Sun Aug 18, 2019 8:55 am I did not expect an internal operation on the z80 to be contended?
They're contended because the ULA doesn't look at the control bus for MREQ signals and the like and only respond to what it sees on the address bus which is the last address latched, or the address of the JR offset byte in this case.

The +2a/+3 does acknowledge these signals and those final 5 t-states are not contended.
Aha - it's an (old) Speccy thing, so I am going to assume that the SAM Coupé is also sensible enough to leave them uncontended.

Thank you for clearing that up.

Re: Starting emulator - help with basics of Z80 timing needed

Posted: Sun Aug 18, 2019 10:45 am
by DouglasReynholm
R-Tape wrote: Fri Aug 16, 2019 2:37 pm The first step should be thinking of a cool name
Mustering my best Douglas Reynholm/Matt Berry voice:

Spectrum
Emulator
'X'
You
Think
I
Might
Enjoy

Best I can do at short notice, take it or leave it.

Re: Starting emulator - help with basics of Z80 timing needed

Posted: Sun Aug 18, 2019 11:11 am
by Ast A. Moore
DouglasReynholm wrote: Sun Aug 18, 2019 10:45 am Best I can do at short notice, take it or leave it.
“You’ve got spunk and balls, and I like that in a woman.”

Re: Starting emulator - help with basics of Z80 timing needed

Posted: Sun Aug 25, 2019 5:53 pm
by Pegaz
Zoran wrote: Fri Aug 16, 2019 1:50 pm Hello,

I am planning to start my own Spectrum emulator (yes, another one is just what is needed :) )
Dobro došao Zorane.
Glad to see some ex-yu Spectrum fans here and look forward to your future emulator.
Once again, welcome to this great forum. :)

Re: Starting emulator - help with basics of Z80 timing needed

Posted: Tue Aug 27, 2019 7:39 am
by Zoran
Pegaz wrote: Sun Aug 25, 2019 5:53 pm
Zoran wrote: Fri Aug 16, 2019 1:50 pm Hello,

I am planning to start my own Spectrum emulator (yes, another one is just what is needed :) )
Dobro došao Zorane.
Glad to see some ex-yu Spectrum fans here and look forward to your future emulator.
Once again, welcome to this great forum. :)
Thank you!