Z80 timing

صفحة 1/5
| 2 | 3 | 4 | 5

بواسطة pitpan

Prophet (3152)

صورة pitpan

20-05-2005, 12:56


I have been trying to calculate the exact time that a routine takes to be fully executed on a regular Z80 at 3.5 MHz, but I haven't managed to do it accurately. What I do is just add the T-states that every instruction takes and then convert it to microseconds, knowing that 1 T-states takes 1/3.5M (of course, I am using more precise values).

What am I doing wrong? Of course, interrupts are disabled to prevent further problems. Is there an additional T-state to be added somewhere? I am using the T-state values calculated by Sean Young in his excellent "Z80 undocumented documented".


Login أوregister لوضع تعليقاتك

بواسطة Sonic_aka_T

Enlighted (4130)

صورة Sonic_aka_T

20-05-2005, 13:23

dunno, waitstates, like you said, and perhaps refresh also affects the timing?

بواسطة Edwin

Paragon (1182)

صورة Edwin

20-05-2005, 15:10

Sean Young's document gives the standard z80 timings. For MSX, you need to add 1 T-state for every M1 cycle (for memory refresh).

بواسطة Grauw

Ascended (10605)

صورة Grauw

20-05-2005, 16:27

It is documented on the MSX Assembly Page

بواسطة Tanni

Hero (556)

صورة Tanni

20-05-2005, 16:33

The conditional jumps need to be distinguished if the condition fails or not. If it fails, it needs less
clock cycles than if the jump is performed. Also be carefully if you use block instructions, their execution
time depends on the size of the block moved or searched.

بواسطة aoineko

Champion (489)

صورة aoineko

12-02-2022, 01:51

Do you know an online tool that automatically calculates the timing of a piece of MSX assembler code? And also, as a bonus, its size.
It's a pain to do it by hand, especially when you are testing code generated by a C compiler.

بواسطة ARTRAG

Enlighted (6846)


12-02-2022, 05:13

This is the best

بواسطة aoineko

Champion (489)

صورة aoineko

12-02-2022, 10:24

Thanks, but it doesn't recognize the assembler generated by SDCC (sdasz80). :-/

بواسطة jltursan

Prophet (2619)

صورة jltursan

12-02-2022, 10:44

No idea if it fully works with sdasz80; but you can try with VSCode and its plugin Z80 Assembly Meter. It has some nice tuning parameters and I'm sure theNestruo can help you to make it work :)

بواسطة aoineko

Champion (489)

صورة aoineko

12-02-2022, 11:10

SDCC is listed on the description page, I guess it is supported.
Thanks, I'll give it a try.

بواسطة Manuel

Ascended (18879)

صورة Manuel

12-02-2022, 11:14

What you can also do in openMSX:
- set a break point at point X
- set a break point at point Y
- when you're in point X type in the console: set timex [machine_info time]
- then run until you're in break point Y, then type: set diff [expr [machine_info time] - $timex]]
And you know how much time (in seconds) was passed between the two breakpoints.

صفحة 1/5
| 2 | 3 | 4 | 5