Counting T states in Excel
- arkannoyed
- Manic Miner
- Posts: 438
- Joined: Mon Feb 05, 2018 9:56 am
- Location: Northamptonshire
Re: Counting T states in Excel
I seem to recall an ancient thread on WOS many years ago, where a useful utility that went by the name of 'Ticks' or something similar could be used to give accurate T-state timings for a piece of assembly code. Googling it though, I can't find it now.
Re: Counting T states in Excel
Is this it? ticks.0.15.zip
- Ast A. Moore
- Rick Dangerous
- Posts: 2641
- Joined: Mon Nov 13, 2017 3:16 pm
Re: Counting T states in Excel
Generally, true. The problem is mostly with branching and conditionals.
Most debuggers display the current number of T states elapsed since the beginning of the frame, anyway. Most of the time, that’s enough. If I optimize my routines, I simply put the number of T states for each instruction in square brackets in the code’s commentary and calculate them manually. However, I still mostly use my gut feeling and experience for optimization. Seems to work best.
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.
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.
- arkannoyed
- Manic Miner
- Posts: 438
- Joined: Mon Feb 05, 2018 9:56 am
- Location: Northamptonshire
Re: Counting T states in Excel
Thats the one, though I've not much of in idea for how to use it though?
Re: Counting T states in Excel
OK, I just found some basic instructions here:
https://github.com/z88dk/z88dk/wiki/Tool---ticks
Edit: I just read that apparently ticks does not support contention. So it may not be the best choice for accurate measurements.
https://github.com/z88dk/z88dk/wiki/Tool---ticks
Edit: I just read that apparently ticks does not support contention. So it may not be the best choice for accurate measurements.
- arkannoyed
- Manic Miner
- Posts: 438
- Joined: Mon Feb 05, 2018 9:56 am
- Location: Northamptonshire
Re: Counting T states in Excel
Ah yes, good find, those might help
Re: Counting T states in Excel
Contention makes things harder on the Speccy because it isn't just about what instruction you are executing, but when you are executing it. The same instruction within a loop might not always take the same length of time. I can't say I've ever entirely got my head around the various descriptions of it.
Contrast this with say the Amstrad CPC where contention is universally applied and highly predictable, then it is really just a case of having a slightly different list of instruction timings to check against.
Contrast this with say the Amstrad CPC where contention is universally applied and highly predictable, then it is really just a case of having a slightly different list of instruction timings to check against.
Re: Counting T states in Excel
The Zero emulator has an interesting trace feature (but it does make the emulator a bit slower), which allows you to track the instructions that are executing, while keeping a log of them.
This has proven useful to check timings of loop code, since you can check the T-State count, on start, during stepping and on exit.
This has proven useful to check timings of loop code, since you can check the T-State count, on start, during stepping and on exit.