I wonder why STA instruction takes five clock cycles when it DOES NOT cross the page boundary. If invalid address shows from crossing the page boundary on the address bus, then R/W signal is ALWAYS read only during clock cycle 4 before it is switched to write only during clock cycle 5. It is good!
However, I believe that 6502 designers made their decision to reduce thousands of transistors to 3510. Unfortunately, they were unwilling to implement four clock cycles for STA instruction from NOT crossing the page boundary while R/W signal is switched to write only during clock cycle 4. If they did, they required to add hundreds of more transistors in order to save more clock cycles.
Why didn't 6502 designers leave reserved instructions as unimplement by adding protection such as exception handler? This allowed to cause 6502 microprocessor to behave minor bugs prior crashes such as HLT instruction. They wanted to reduce the number of transistors or few gates.
Perhaps, they did not have time to draw their complete schematic in handwriting before they released 6502 microprocessor to the customers.
Are you willing to build extra number of transistors from scratch to revise 6502D?
Do you have idea why ASL, LSR, ROL, and ROR instructions do not use indexed indirect addressing and indirect indexed addressing which takes total 8 clock cycles?
Bryan
Extra cycle in crossing page boundary question
- GARTHWILSON
- Forum Moderator
- Posts: 8773
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: Extra cycle in crossing page boundary question
Quote:
However, I believe that 6502 designers made their decision to reduce thousands of transistors to 3510.
Quote:
I wonder why STA instruction takes five clock cycles when it DOES NOT cross the page boundary.
Quote:
Why didn't 6502 designers leave reserved instructions as unimplement by adding protection such as exception handler? This allowed to cause 6502 microprocessor to behave minor bugs prior crashes such as HLT instruction. They wanted to reduce the number of transistors or few gates.
Perhaps, they did not have time to draw their complete schematic in handwriting before they released 6502 microprocessor to the customers.
Perhaps, they did not have time to draw their complete schematic in handwriting before they released 6502 microprocessor to the customers.
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?
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
Re: Extra cycle in crossing page boundary question
Hi Bryan. There's a two-page article here that talks about some of the early 6502 design decisions.
You mentioned indexed STA taking 5 cycles, and I guess it's the absolute, X and absolute, Y indexed modes you mean. It sounds like you maybe already have the answer, but just in case...
The potential for page crossings creates uncertainty about how soon the complete, proper address will become available. The address presented in cycle 4 may or may not be correct, which would mean problems if writes were allowed then. So they're not. A dummy read occurs instead, simply because we're forced to wait, and with 6502 all cycles not writes must be reads -- there's no control pin that can tell the bus to do nothing. Then the write occurs on cycle 6, when the address is sure to be correct.
An absolute indexed read such as LDA can sometimes omit cycle 6. By the end of cycle 5 it'll be known whether that cycle's read had the complete, valid address. If it did, there's no reason to re-run the cycle.
This and some of your other comments have light shed upon them by the article. For instance Chuck Peddle mentions that, for economy reasons, the design was purposely limited to seven states, meaning an 8-cycle instruction would be impossible. [Edit: relating states directly to cycles was overly simplistic of me. See Ed's comments below.]
cheers,
Jeff
You mentioned indexed STA taking 5 cycles, and I guess it's the absolute, X and absolute, Y indexed modes you mean. It sounds like you maybe already have the answer, but just in case...
The potential for page crossings creates uncertainty about how soon the complete, proper address will become available. The address presented in cycle 4 may or may not be correct, which would mean problems if writes were allowed then. So they're not. A dummy read occurs instead, simply because we're forced to wait, and with 6502 all cycles not writes must be reads -- there's no control pin that can tell the bus to do nothing. Then the write occurs on cycle 6, when the address is sure to be correct.
An absolute indexed read such as LDA can sometimes omit cycle 6. By the end of cycle 5 it'll be known whether that cycle's read had the complete, valid address. If it did, there's no reason to re-run the cycle.
Quote:
Do you have idea why ASL, LSR, ROL, and ROR instructions do not use indexed indirect addressing and indirect indexed addressing which takes total 8 clock cycles?
cheers,
Jeff
Last edited by Dr Jefyll on Mon Apr 20, 2015 5:35 pm, edited 1 time in total.
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
https://laughtonelectronics.com/Arcana/ ... mmary.html
Re: Extra cycle in crossing page boundary question
Dr Jefyll wrote:
The potential for page crossings creates uncertainty about how soon the complete, proper address will become available. The address presented in cycle 4 may or may not be correct, which would mean problems if writes were allowed then. So they're not.
Some good info here on the history and benefit of ever-increasing wafer sizes (which is the converse of trying to make a given design in the smallest die size)
So, for a chip designer, it's all about die size. That acts as a constraint on several things:
- number of pins
- number and connectivity of on-chip busses
- design style of logic (structured or unstructured)
- amount of complexity (number of transistors)
- speed (size of transistors)
On the subject of transistor count:
Quote:
Quote:
However, I believe that 6502 designers made their decision to reduce thousands of transistors to 3510.
Cheers
Ed
- barrym95838
- Posts: 2056
- Joined: 30 Jun 2013
- Location: Sacramento, CA, USA
Re: Extra cycle in crossing page boundary question
BigEd wrote:
... it's useful to picture how many complete rectangular die you can fit on such a wafer, and to realise that a small change in die size can make a big difference ...
http://www2.stetson.edu/~efriedma/squincir/
Mike B.
Re: Extra cycle in crossing page boundary question
Dr Jefyll wrote:
Quote:
Do you have idea why ASL, LSR, ROL, and ROR instructions do not use indexed indirect addressing and indirect indexed addressing which takes total 8 clock cycles?
Re: Extra cycle in crossing page boundary question
I think Bryan's point is that the 6502 has RMW instructions, and indirect addressing modes, but it doesn't off the combination of an RMW instruction in an indirect addressing mode, and he wonders why.
Jeff's linked article says that the 6502 instruction sequencer goes up to 7 states, and not to 8, because to go to 8 would have made the chip too big.
Jeff's linked article says that the 6502 instruction sequencer goes up to 7 states, and not to 8, because to go to 8 would have made the chip too big.
Re: Extra cycle in crossing page boundary question
But the 6502 does have 8 cycle RMW indirect instructions - just not documented ones. So it doesn't seem to be a limitation per se.
The state machine description here states that RMW instructions have an extra two cycles (named SD1 and SD2) which always perform the two stores and which don't require state logic from the PLA. So I assume there could have been a way to implement the regular RMW instructions with indirect addressing.
The state machine description here states that RMW instructions have an extra two cycles (named SD1 and SD2) which always perform the two stores and which don't require state logic from the PLA. So I assume there could have been a way to implement the regular RMW instructions with indirect addressing.
Re: Extra cycle in crossing page boundary question
Ah - I've never studied the unsupported/illegal/undocumented instructions. But indeed you're right, according to
http://www.visual6502.org/wiki/index.ph ... 56_Opcodes
we have DCP, SLO, RLA, ISC, RRA, SLE, all of which do an RMW in both indirect addressing modes. The instructions are described at
http://www.ataripreservation.org/websit ... lopc31.txt
I wonder if the 6502 people got as far as fully implementing more useful versions of these before they had to hack the chip size down. (For example, DCP is like a DECrement on memory, but it doesn't set the flags properly)
As we see in Segher's document you linked, the 6502 state machine isn't a simple linear sequence, so it's a simplification to say that it's a 7-step machine but not an 8-step machine. It's a machine with a certain graph of states, and to make it more complex (and correct) would take more chip area.
http://www.visual6502.org/wiki/index.ph ... 56_Opcodes
we have DCP, SLO, RLA, ISC, RRA, SLE, all of which do an RMW in both indirect addressing modes. The instructions are described at
http://www.ataripreservation.org/websit ... lopc31.txt
I wonder if the 6502 people got as far as fully implementing more useful versions of these before they had to hack the chip size down. (For example, DCP is like a DECrement on memory, but it doesn't set the flags properly)
As we see in Segher's document you linked, the 6502 state machine isn't a simple linear sequence, so it's a simplification to say that it's a 7-step machine but not an 8-step machine. It's a machine with a certain graph of states, and to make it more complex (and correct) would take more chip area.