Z80 timing

Pagina 1/5
| 2 | 3 | 4 | 5

Door pitpan

Prophet (3155)

afbeelding van 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!!!?

Aangemeld of registreer om reacties te plaatsen

Van Sonic_aka_T

Enlighted (4130)

afbeelding van Sonic_aka_T

20-05-2005, 13:23

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

Van Edwin

Paragon (1182)

afbeelding van 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).

Van Grauw

Ascended (10768)

afbeelding van Grauw

20-05-2005, 16:27

It is documented on the MSX Assembly Page

Van Tanni

Hero (556)

afbeelding van 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.

Van aoineko

Paladin (1002)

afbeelding van 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.

Van ARTRAG

Enlighted (6935)

afbeelding van ARTRAG

12-02-2022, 05:13

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

Van aoineko

Paladin (1002)

afbeelding van aoineko

12-02-2022, 10:24

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

Van jltursan

Prophet (2619)

afbeelding van 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 :)

Van aoineko

Paladin (1002)

afbeelding van 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.

Van Manuel

Ascended (19463)

afbeelding van 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.

Pagina 1/5
| 2 | 3 | 4 | 5