Starting emulator - help with basics of Z80 timing needed

Struggling with Fuse or trying to find an emulator with a specific feature. Ask your questions here.
Post Reply
User avatar
Stefan
Manic Miner
Posts: 809
Joined: Mon Nov 13, 2017 9:51 pm
Location: Belgium
Contact:

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

Post 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?
User avatar
Stefan
Manic Miner
Posts: 809
Joined: Mon Nov 13, 2017 9:51 pm
Location: Belgium
Contact:

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

Post 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.
User avatar
Woodster
Drutt
Posts: 48
Joined: Mon Nov 13, 2017 12:17 pm

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

Post 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.
User avatar
Stefan
Manic Miner
Posts: 809
Joined: Mon Nov 13, 2017 9:51 pm
Location: Belgium
Contact:

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

Post 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.
User avatar
DouglasReynholm
Manic Miner
Posts: 349
Joined: Wed Feb 20, 2019 8:38 pm

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

Post 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.
User avatar
Ast A. Moore
Rick Dangerous
Posts: 2641
Joined: Mon Nov 13, 2017 3:16 pm

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

Post 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.”
Every man should plant a tree, build a house, and write a ZX Spectrum game.

Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
User avatar
Pegaz
Dynamite Dan
Posts: 1210
Joined: Mon Nov 13, 2017 1:44 pm

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

Post 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. :)
User avatar
Zoran
Drutt
Posts: 18
Joined: Fri Aug 16, 2019 12:56 pm

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

Post 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!
Post Reply