Z80 timing

Page 1/5
| 2 | 3 | 4 | 5

Par pitpan

Prophet (3152)

Portrait de pitpan

20-05-2005, 12:56

Hi!

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".

Help!!!?

!login ou Inscrivez-vous pour poster

Par Sonic_aka_T

Enlighted (4130)

Portrait de Sonic_aka_T

20-05-2005, 13:23

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

Par Edwin

Paragon (1182)

Portrait de 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).

Par Grauw

Ascended (10623)

Portrait de Grauw

20-05-2005, 16:27

It is documented on the MSX Assembly Page

Par Tanni

Hero (556)

Portrait de 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.

Par aoineko

Hero (542)

Portrait de 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.

Par ARTRAG

Enlighted (6865)

Portrait de ARTRAG

12-02-2022, 05:13

This is the best
http://msx.jannone.org/bit/

Par aoineko

Hero (542)

Portrait de aoineko

12-02-2022, 10:24

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

Par jltursan

Prophet (2619)

Portrait de 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 :)

Par aoineko

Hero (542)

Portrait de 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.

Par Manuel

Ascended (18958)

Portrait de 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.

Page 1/5
| 2 | 3 | 4 | 5