I was just wondering if someone made a complete T-state timing table yet for all Z80 instructions with timings for Sam ROM / external RAM, and internal RAM with and without contention?
Thanks for replying David, I read the article in Based on an Idea. when I searched for T-States on WorldOfSam. Nice mag. The accelerator artivle looks like a interesting read too. But the Table isnt isn't complete.
Also thanks for repying Stefan. I'd thought I ask first if there is a convenient table before diving into the Sim Coupe source ;)
Oops. Don't know what went wrong but the reply I posted didn't got posted. Maybe subject is mandatory? Hope this one gets through.
Thank you all for the replies.
@David. First thing I did before posting was searching WorldOfSam and found Based on an Idea. Nice magazine. Will have to read it thourougly later. However The T-States table there doesn't include the IO ports and contended timings.
@Stefan. I know. I just asked if there was a table before diving into sourcode. A table is so much more convenient ;)
I've got a program that can probably generate what you need, using the same CPU core and contention rules as SimCoupe. I started on something to use for SimCoupe unit testing, but there's no reason it couldn't generate a table instead.
There are actually quite a few combinations involved, but I suspect many are not be very useful. For example, the code can be running in ROM/IntRAM/ExtRAM, the data it's manipulating can be in ROM/IntRAM/ExtRAM, and the raster can be over Border/Screen during execution. Of the 18 possibilities I suspect the useful ones are:
- code in IntRAM, data in IntRAM, raster over Border
- code in IntRAM, data in IntRAM, raster over Screen
- code in ROM, data in IntRAM, raster in Border
- code in ROM, data in IntRAM, raster in Screen
- code in ExtRAM, data in IntRAM, raster over Border
- code in ExtRAM, data in IntRAM, raster over Screen
- code in ExtRAM, data in ExtRAM (no contention!)
So that would be 7 columns for each instruction group. Any others?
I've not included screen disabled or mode 1 as they're covered above. When the screen is disabled it's treated as Border (4T access rounding). The extra mode 1 contention stripes are treated as Screen (8T access rounding). You're on your own with instructions that span boundaries, though the SimCoupe debugger will help you there (and with timing in general).
I/O is contended for ports 0xf8 and above, but I'll include contended/uncontended figures in I/O instructions.
I'll ping you when I've got something to try, and once settled I can link it here.
Hopefully this should be pretty close: https://simonowen.com/sam/timings/
I've checked most of the Ext/Ext cases, which should match the official Z80 timings. Other values look reasonable, but I'd like to check some in more detail to be sure. If you suspect errors please let me know!
Ooo nice! Thanks for adding it to World of SAM. I see he also chose to use those 512K SRAMs and theres space for a EDDAC too :D Ahhh.. Seeing this wan't me work work on mycrazy but not so crazy 1MEG idea.
Back on T-states. I found my little T-state counter interface again and did some fun testing with it. Sometimes read and writes to asic ports don't get that extra delay depending if there is a multiple of 4 or 8 Tstates between them. Just as as Simon wrote on his Timing page ' I/O accesses to ASIC ports are always limited to 1 cycle in every 8. '
in a,(&F8)
in a,(&F8)
Takes the same 32 Tstates as:
nop
in a,(&F8)
nop
in a,(&F8)
and found out that doing a bunch of INI/OUTI or using just a INIR/OTIR takes the same amount of T-states when accessing an ASIC port 😂
Was there something of this…
Was there something of this nature in Based On An Idea? (Simon Cookes mag)
This?
https://www.worldofsam.org/products/based-idea-issue-2
See SimCoupe
Since SimCoupe handles memory contention perfectly, you can find it all in the code :-)
See for example https://github.com/simonowen/simcoupe/commit/d3a99f0b36a710da85aa897fbea2cacaf0ff1cba
Thanks for replying David, I…
In reply to Was there something of this… by David
Thanks for replying David, I read the article in Based on an Idea. when I searched for T-States on WorldOfSam. Nice mag. The accelerator artivle looks like a interesting read too. But the Table isnt isn't complete.
Also thanks for repying Stefan. I'd thought I ask first if there is a convenient table before diving into the Sim Coupe source ;)
Thanks but...
Oops. Don't know what went wrong but the reply I posted didn't got posted. Maybe subject is mandatory? Hope this one gets through.
Thank you all for the replies.
@David. First thing I did before posting was searching WorldOfSam and found Based on an Idea. Nice magazine. Will have to read it thourougly later. However The T-States table there doesn't include the IO ports and contended timings.
@Stefan. I know. I just asked if there was a table before diving into sourcode. A table is so much more convenient ;)
Watch this space
I've got a program that can probably generate what you need, using the same CPU core and contention rules as SimCoupe. I started on something to use for SimCoupe unit testing, but there's no reason it couldn't generate a table instead.
There are actually quite a few combinations involved, but I suspect many are not be very useful. For example, the code can be running in ROM/IntRAM/ExtRAM, the data it's manipulating can be in ROM/IntRAM/ExtRAM, and the raster can be over Border/Screen during execution. Of the 18 possibilities I suspect the useful ones are:
- code in IntRAM, data in IntRAM, raster over Border
- code in IntRAM, data in IntRAM, raster over Screen
- code in ROM, data in IntRAM, raster in Border
- code in ROM, data in IntRAM, raster in Screen
- code in ExtRAM, data in IntRAM, raster over Border
- code in ExtRAM, data in IntRAM, raster over Screen
- code in ExtRAM, data in ExtRAM (no contention!)
So that would be 7 columns for each instruction group. Any others?
I've not included screen disabled or mode 1 as they're covered above. When the screen is disabled it's treated as Border (4T access rounding). The extra mode 1 contention stripes are treated as Screen (8T access rounding). You're on your own with instructions that span boundaries, though the SimCoupe debugger will help you there (and with timing in general).
I/O is contended for ports 0xf8 and above, but I'll include contended/uncontended figures in I/O instructions.
I'll ping you when I've got something to try, and once settled I can link it here.
Hi Simon! Thanks for the…
Hi Simon!
Thanks for the reply.
Yes I'm looking for a table like that. Although the ROM and ExtRAM can be in the same column as they have identical timings, right?
Yes
You make a very good point! That's maybe just 5 columns then...
Timing table
Hopefully this should be pretty close: https://simonowen.com/sam/timings/
I've checked most of the Ext/Ext cases, which should match the official Z80 timings. Other values look reasonable, but I'd like to check some in more detail to be sure. If you suspect errors please let me know!
Brilliant!
Brilliant!
Thanks Simon for the…
Thanks Simon for the detailed info and the timing table. They will be of good use.
One thing is for sure: I'm gonna build a 1Meg ramdrive + extras :D
Adrian Brown is currently developing new 1-4Mb units with RTC
In reply to Thanks Simon for the… by Mr.Blinky
I think he's at final PCB layout now too.
Added a link to Simon's pages
https://www.worldofsam.org/products/memory-contention
Cool! is there any info…
In reply to Adrian Brown is currently developing new 1-4Mb units with RTC by Dan Dooré
Cool! is there any info about it available? Maybe I don't need to reinvent the wheel.
It's mostly on the SAM Facebook group:
In reply to Cool! is there any info… by Mr.Blinky
https://www.facebook.com/groups/20486797963/user/537387403
It's 4Mb and DALLAS RTC - he's re-doing the board was the last update.
That links results in a page…
That links results in a page unavailable error for me :/
Good to know he's using a dallas clock :)
Oh - and an onboard EDDAC/SamDAC too
https://www.worldofsam.org/products/external-memory-and-dac-and-rtc
:)
Ooo nice! Thanks for adding…
In reply to Oh - and an onboard EDDAC/SamDAC too by Dan Dooré
Ooo nice! Thanks for adding it to World of SAM. I see he also chose to use those 512K SRAMs and theres space for a EDDAC too :D Ahhh.. Seeing this wan't me work work on mycrazy but not so crazy 1MEG idea.
Back on T-states. I found my little T-state counter interface again and did some fun testing with it. Sometimes read and writes to asic ports don't get that extra delay depending if there is a multiple of 4 or 8 Tstates between them. Just as as Simon wrote on his Timing page ' I/O accesses to ASIC ports are always limited to 1 cycle in every 8. '
in a,(&F8)
in a,(&F8)
Takes the same 32 Tstates as:
nop
in a,(&F8)
nop
in a,(&F8)
and found out that doing a bunch of INI/OUTI or using just a INIR/OTIR takes the same amount of T-states when accessing an ASIC port 😂
Cool!
Can you add a quick page for the T-state counter interface on WoSAM please!
There you go. Made a T-State…
In reply to Cool! by Dan Dooré
There you go. Made a T-State-counter entry. :)
Thought I made some new pictures and scribbled up some info. I think this took me longer then to actually build it 🤣
\o/
Nice one! Always good to have the technical content up here :-)
Missing code in IntRAM, data in ExtRAM
In reply to Watch this space by Simon Owen
I was revisiting timing in the mod player and noticed that there are two combinations I need missing:
Could they be added?
Thanks!