News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_Bryce

CPC Z80 Commands and how long they take...

Started by Bryce, 10:50, 07 January 15

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Bryce

Hi all,
     it's rare that I even read the threads in this section, so it's even rarer for me to start a thread here... (I'm trying to get back into Z80 programming :)).

Is there a file anywhere that lists all the Z80 commands and how how long each one takes on a CPC in real time (ie: in µs not in Cycles or whatever)?

Bryce.

opqa

http://www.cpcwiki.eu/forum/programming/craving-for-speed-a-visual-cheat-sheet-to-help-optimizing-your-code-to-death/?action=dlattach;attach=10666

1 NOP = 1 us

Take in account that those are the valid timings for and only for the CPC, you might find other generic timings for the Z80 widespread all over the Internet, but they are not valid for the CPC as the GA uses the WAIT pin of the Z80 in a regular basis and alters the duration of the instructions.

Bryce

Yes, I already have the standard Z80 timings, it was the CPC specific ones that I was after (due to the GA etc), thanks.

Bryce.

opqa

Not at all, if only you had for software half the talent you have for hardware then we can expect great things within the next few months.  :D

arnoldemu

Quote from: Bryce on 11:13, 07 January 15
Yes, I already have the standard Z80 timings, it was the CPC specific ones that I was after (due to the GA etc), thanks.

Bryce.
http://quasar.cpcscene.net/doku.php?id=iassem:timings

The timings alter slightly for some instructions if an interrupt request is performed at the end of them (e.g. INC BC).
But for general coding use the table above.

EDIT: I see opqa has added a link to an equally good document.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Bryce

Quote from: opqa on 13:48, 07 January 15
Not at all, if only you had for software half the talent you have for hardware then we can expect great things within the next few months.  :D

I can assure you that I have absolutely no talent in software :)

@Arnoldemu: Thanks. I'm working on very basic stuff at the moment, a loooong way away from experimenting with interrupts.

Bryce.

TFM

Quote from: Bryce on 14:13, 07 January 15
I can assure you that I have absolutely no talent in software :)


Well, if you need help, just PM me. IMHO it's good to work on things we're best in, that's the most efficient way. But of course it's always great to learn something new.  :)
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

Ast

opqa : i enjoy your pdf document. Have. You other thing like that ?
For example, ppi, fdc, ay....etc
_____________________

Ast/iMP4CT. "By the power of Grayskull, i've the power"

http://amstradplus.forumforever.com/index.php
http://impdos.wikidot.com/
http://impdraw.wikidot.com/

All friends are welcome !

Bryce

Quote from: TFM on 18:35, 07 January 15

Well, if you need help, just PM me. IMHO it's good to work on things we're best in, that's the most efficient way. But of course it's always great to learn something new.  :)

I don't intend dropping hardware for software. But understanding the possibilities (and limits) of the software can help when developing hardware.

Bryce.

TFM

TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

opqa

#10
Quote from: Ast on 19:17, 07 January 15
opqa : i enjoy your pdf document. Have. You other thing like that ?
For example, ppi, fdc, ay....etc
:o No, it isn't mine! Please don't give me merit for other's work. I also enjoy this document a lot but I found it searching on the internet. Credits are inside the pdf, the authors are two members of this forum, they made it based on data posted in the wonderful web cpctech, which in turn is based on real measures someone else made long time ago...

To get information on the CPC I use to search over different sources, the cpcwiki, cpctech, grimware, cantrell.org... depending on what I'm looking for. Some things are better explained in some sites and some else in others.

For a quick reference on the z80 instructions and flag affection I also like to check this table:
Z80 instruction set - ClrHome
And for more detailed explanation of the instructions there are many other sites like the z80heaven wiki for instance.

AMSDOS

Quote from: Bryce on 14:13, 07 January 15
I can assure you that I have absolutely no talent in software :)




Is this for your little hardware device that tells you how long each Z80 Command takes.  8)
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Bryce

No, but I am writing (trying to write) a piece of software that is time critical (at least in the 1ms region). So I want to calculate how much time my routines/loops take.

I regularaly write PIC machine code, so the code isn't all that different, I just need to understand the registers a bit better now. In University we "only" learnt 6800, not Z80 :(

Bryce.

MaV

Quote from: Bryce on 09:48, 08 January 15I can assure you that I have absolutely no talent in software :)
QuoteI regularaly write PIC machine code, so the code isn't all that different, I just need to understand the registers a bit better now.

I'm beginning to wonder how you define talent. When you regularly write PIC machine code, you can obviously program. Writing time critical software implies a certain talent.
Black Mesa Transit Announcement System:
"Work safe, work smart. Your future depends on it."

Bryce

Writing code and writing good code are two completely different things :D

Quote from my professor on one of my assignments:
"Very well documented, it's such a pity that the code doesn't do what the comments claim"

Bryce.

MaV

Well, I hope he tried to give you suggestions where your code fails, otherwise he'd be a lousy teacher (but TBH all of them were, and my nephew claims that all of them still are. ;) )

Black Mesa Transit Announcement System:
"Work safe, work smart. Your future depends on it."

Bryce

Quote from: MaV on 14:01, 08 January 15
Well, I hope he tried to give you suggestions where your code fails, otherwise he'd be a lousy teacher (but TBH all of them were, and my nephew claims that all of them still are. ;) )

As a friend of mine says: "If they were good they'd have a proper job" :D

Bryce.

Optimus

Well, that PDF is great!
I used to have another list in my HD, that I can't find on the internet.
But the PDF has better table to see overview.

TFM

Quote from: Bryce on 10:52, 08 January 15
Writing code and writing good code are two completely different things :D


What is good code? How do you define that?
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

remax

Quote from: Bryce on 14:03, 08 January 15
As a friend of mine says: "If they were good they'd have a proper job" :D

Bryce.


Hum...  >:(














:D
Brain Radioactivity

Nich

Quote from: Bryce on 14:03, 08 January 15
As a friend of mine says: "If they were good they'd have a proper job" :D

Or alternatively, "Those who can, do; those who can't, teach."

TFM

Quote from: Nich on 22:19, 08 January 15
Or alternatively, "Those who can, do; those who can't, teach."


Best saying of 2015 - you get the CPC literature nobel price!  :)
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

Nich

Quote from: TFM on 22:31, 08 January 15
Best saying of 2015 - you get the CPC literature nobel price!  :)

It's not 'my' quote, though! ;) Actually, I don't know who originally said it, even after a fairly thorough search on DuckDuckGo (although there are several variations of this quote that can be attributed to various people).

TFM

Well, probably most of the "Doing folks" throw something like that at the "talking folks".  :laugh:


Never mind, you can keep the CPC nobel price for literature!  :) :) :)
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

Bryce

Quote from: TFM on 19:27, 08 January 15

What is good code? How do you define that?

Good code is neat, very efficient and well documented. My code manages 1 out of those 3 :D

Bryce.

Powered by SMFPacks Menu Editor Mod