Challenge Understanding Clock Cycle Diagram

Building your first 6502-based project? We'll help you get started here.
User avatar
N2TheRed
Posts: 24
Joined: 11 May 2016
Location: Texas

Challenge Understanding Clock Cycle Diagram

Post by N2TheRed »

I'm a complete beginner and have started reading "An Introduction To Microcomputers" by Adam Osborne. I'm failing to understand the diagram in the attachment below.
Attachments
Diagram.png
User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: Challenge Understanding Clock Cycle Diagram

Post by GARTHWILSON »

I believe that's a book that I had and loaned out but never got back. I was hoping to be able to see what microprocessor it's talking about there. It is certainly not the 6502 which works a bit differently. The '02 starts each cycle with Φ2 low, not high, and ends the cycle with it high. When it's reading, the data is latched in on the falling edge of Φ2. Instead of a read\ line and a write\ line, the 6502 has a R/W\ line. (The trailing bar is supposed to be horizontal and go over the top of the "W", but there's no way to show it that way in the forum text. You pronounce it "read, write-not.") The address and R/W\ come out soon after the beginning of the Φ2-low time. There is time to set up memory or peripherals before the rising Φ2 edge which signals the actual read or write time. In the case of writing, you must ensure that no writing can be done while Φ2 is low, since that would require that the address be guaranteed to be valid and stable well before R/W\ goes down, which is not the case, and you could inadvertently corrupt other addresses on the way.

Documents that come to mind that would help you more are:
and there are many more but I don't want to overwhelm you. Do keep coming back and asking your questions though. There's a load of info to browse at the 6502.org website at http://6502.org/, not just the forum, and several of us have our own 6502 websites also—not to compete, but it's easier to add or edit things on our own sites. 6502.org is kind of the hub for all things 6502.
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
User avatar
N2TheRed
Posts: 24
Joined: 11 May 2016
Location: Texas

Re: Challenge Understanding Clock Cycle Diagram

Post by N2TheRed »

I bought "6502 Assembly Language Programming" by Lance A. Leventhal and the author assumes you've read the microcomputer book first.

What your describing, is that for the 6502 or for the what the diagram is showing? As far as the diagram goes, I'm not understanding why the criss-cros.
User avatar
barrym95838
Posts: 2056
Joined: 30 Jun 2013
Location: Sacramento, CA, USA

Re: Challenge Understanding Clock Cycle Diagram

Post by barrym95838 »

xXZexxMooreXx wrote:
... As far as the diagram goes, I'm not understanding why the criss-cros.
My amateur opinion: I think that the criss-crosses indicate potential transitions, and the areas between the horizontal lines indicate stable binary states. The idea is to show that there are potential instabilities near the clock edges, so any bus sampling performed during those criss-cross periods may be unreliable.

Mike B.
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: Challenge Understanding Clock Cycle Diagram

Post by BigEd »

[Oops, this response crossed in the post]

Crossed lines in a diagram like this is meant to show the points at which data changes, or in this case, the point at which data, having potentially changed, is now valid and stable.

Another convention is to use a series of crossed lines, or cross-hatching, to the left of the period of stability to show that the data could be changing during that time.

See also Jeff's animated timing diagrams - they might help you to get a sense of what is causing what and a sense of the freedoms in the system.
viewtopic.php?f=4&t=2909
User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: Challenge Understanding Clock Cycle Diagram

Post by GARTHWILSON »

Quote:
As far as the diagram goes, I'm not understanding why the criss-cros.
It's a graph of the signals, with time in the X axis and logic state in the Y for each signal. The fact is that the signals take a little time to transition from high to low and vice-versa, typically a few ns for the ICs we deal with here. There is a transition time in which the pin is not in a valid logic state. This is true of any processor, not just the '02.

The Leventhal book should be a good place to start; but I would recommend that you soon get into the 65c02 (ie, CMOS) for its many advantages including an expanded instruction set that makes it easier to do certain things. I have an article on all the differences between the original NMOS 6502 and the CMOS 65c02 at http://wilsonminesco.com/NMOS-CMOSdif/ . The reason not to use CMOS would be if you want to write for vintage computers which will not have been retrofitted with the CMOS version, especially the Commodore 64 which used the 6510 which never was made in CMOS.
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
User avatar
BigDumbDinosaur
Posts: 9425
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: Challenge Understanding Clock Cycle Diagram

Post by BigDumbDinosaur »

xXZexxMooreXx wrote:
I bought "6502 Assembly Language Programming" by Lance A. Leventhal and the author assumes you've read the microcomputer book first.

What your describing, is that for the 6502 or for the what the diagram is showing? As far as the diagram goes, I'm not understanding why the criss-cros.
The target audience for Dr. Leventhal's books is an assembly language programmer, not a hardware designer.

You should stop by Jeff Laughton's website and have a look at his page explaining timing diagrams. It could answer quite a few questions for you.
x86?  We ain't got no x86.  We don't NEED no stinking x86!
User avatar
N2TheRed
Posts: 24
Joined: 11 May 2016
Location: Texas

Re: Challenge Understanding Clock Cycle Diagram

Post by N2TheRed »

Thanks for all the replies.

My ultimate goal is to be game programmer. I've tried learning C# as a first language, but I spent too much time wondering what was really going on deep down. After searching the internet for the pros and cons of learning assembly as first language, I'm convinced this is the best route for me.

I choose 6502 to write a demo for the NES. Along the way I believe I will have a better understanding of how computers work so that learning a high level language will make more sense to me.

I'm nearing 34 with no college education and often times feel I'm too late for the party. I'm working on it a little everyday just to build up a habit of doing it while leaving room for the possibility that I'm taking the wrong route. There you go, just so that we're all on the same page.
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: Challenge Understanding Clock Cycle Diagram

Post by BigEd »

Sounds like a grand adventure in front of you - hope we can help you as and when you have questions. Welcome to our world!
User avatar
N2TheRed
Posts: 24
Joined: 11 May 2016
Location: Texas

Re: Challenge Understanding Clock Cycle Diagram

Post by N2TheRed »

BigEd wrote:
Sounds like a grand adventure in front of you - hope we can help you as and when you have questions. Welcome to our world!

Thanks BigEd.

If you guys have already put your time in, why are you so interested in helping others? What do you guys get out of it?
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: Challenge Understanding Clock Cycle Diagram

Post by BigEd »

I find helping people is its own reward. Hmm, that sounded terrible! But I mean it. (There might be an age element: when very young, you look after yourself. Later on, you look after your family. Later still, you look after anyone...)
Tor
Posts: 597
Joined: 10 Apr 2011
Location: Norway/Japan

Re: Challenge Understanding Clock Cycle Diagram

Post by Tor »

As Ed said. But there's a bit more. People (we and others) are learning things, but also collecting knowledge and working on making it accessible (see for example Garth's primer pages on http://wilsonminesco.com/). I work (elsewhere) with info and docu about older systems, and it's just much more fun to work with when somebody else actually makes use of it. Otherwise what we learn and do would kind of go into a black hole, which isn't very rewarding in the end. So we're all happy to see more folks joining in, and the 6502 is one of the most interesting and accessible microprocessors to work with (not the least because of this site, which is so active and has so much information).
User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: Challenge Understanding Clock Cycle Diagram

Post by GARTHWILSON »

BigEd wrote:
helping people is its own reward.
Yep. We also enjoy promoting our interest, for the sake of our interest. And with each newbie we dialog with, we get better at helping the next one. Every topic is a springboard for exchanging and developing more ideas too. I know I myself learn from helping others.
Quote:
I've tried learning C# as a first language, but I spent too much time wondering what was really going on deep down. After searching the internet for the pros and cons of learning assembly as first language, I'm convinced this is the best route for me.

I choose 6502 to write a demo for the NES. Along the way I believe I will have a better understanding of how computers work so that learning a high level language will make more sense to me.
I have an article about assembly language still being relevant today, at http://wilsonminesco.com/AssyDefense/ . From the links at the end:
Randall Hyde, author of "Write Great Code (No Starch)" has an essay online, "Why Learning Assembly Language Is Still a Good Idea" which has a lot of good comments about how knowledge of assembly helps you write more-efficient high-level-language code. He is an instructor at the University of California who laments the two decades of unwise "assembly-is-dead" teaching that has been in the schools.
Quote:
I'm nearing 34 with no college education and often times feel I'm too late for the party
There are plenty of others here who have not been stopped by that. Probably the majority of our most knowledgeable people here have no formal education in the field. Most real education happens outside of school. Computer engineering and computer science are particularly hard for schools to offer coursework in that's not outdated by the time the text books have been written and published and the curriculum developed. Besides, professors are as opinionated as we are here! :lol: You might as well get it here! :lol:
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
User avatar
N2TheRed
Posts: 24
Joined: 11 May 2016
Location: Texas

Re: Challenge Understanding Clock Cycle Diagram

Post by N2TheRed »

BigEd wrote:
I find helping people is its own reward. Hmm, that sounded terrible! But I mean it. (There might be an age element: when very young, you look after yourself. Later on, you look after your family. Later still, you look after anyone...)
The only reason I asked is because, before signing up, I was thinking this could be like an insiders club. Ignoring that thinking turned out to be a good decision.
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: Challenge Understanding Clock Cycle Diagram

Post by BigEd »

Glad that we surprised you in a good way!

Another thought - anyone aiming to teach someone (which several people here do, at least in the form of writing articles and explanations) needs to know what the stumbling blocks are, what it is that prevents someone from understanding something. So seeing a question from someone who is presently grappling with something can be very helpful to the would-be teacher - they need to find a way of illustrating or explaining or approaching that topic which will get the reader over the hump. And other people's helpful contributions are a sharing of tactics for the helpers, as well as being, hopefully, helpful to the person who asked the question.
Post Reply