6502.org
http://forum.6502.org/

[173] understanding 6502 addressing modes
http://forum.6502.org/viewtopic.php?f=7&t=428
Page 1 of 1

Author:  dagger_ri [ Sun Oct 05, 2003 11:48 pm ]
Post subject:  [173.1] understanding 6502 addressing modes

Hi
Can anyone tell me what actually happens when an instruction like LDA is given at each cycle?After the opcode is fetched and decoded will it directly do the Internal operation?

Author:  GARTHWILSON [ Tue Dec 09, 2003 6:00 pm ]
Post subject:  [173.2] understanding 6502 addressing modes

Hi,

If it seems pretty dead here it's because the discussions have moved to the forum that is now part of www.6502.org. I just came here to look at something in the archives. The 6502.org forum is doing well and growing, and the website has a lot of exciting additions in the works.

Western Design Center, who is still advancing the 65 family, has a table of several pages showing what happens in each cycle of any given instruction. Their website is www.westerndesigncenter.com . Edit, years later: The site they're mostly focusing on now is https://wdc65xx.com/ . The 6502 has minor pipelining that allows it to do several things in one clock cycle, so it takes few cycles to complete an instruction. In the case of LDA# for example, the op code is fetched in the first clock. The next byte is fetched in the second clock while the op code is being decoded. By the third clock, the processor knows that the second byte was an operand for the first byte and that it needs to put it in the accumulator, so it does that while fetching the op code for the next instruction. IOW, the LDA# only takes two clocks' time. In the case of LDA ZP, the op code is fetched in the first clock, the operand (which is the address in ZP) is fetched in the second, and the content of that ZP address is fetched in the third. The op code of the next instruction is fetched in the following clock. For absolute addresses with 16-bit operands, you add another clock. If it's indexed, the addition to the low byte takes place while the high byte is being fetched. (This is partly why it's low-byte-first.) If a carry out of the low byte does not require incrementing the high byte, no extra time is taken before the effective address is read. Indirects add another operation requiring an additional fetch before they're done.

We're glad to be able to answer questions; but if you have more, you'll get much faster response by just going directly to the forum at http://forum.6502.org/.

Garth

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/