Questions tagged [6502]

For 6502 series of processors, including hardware and assembly language questions. Use with [hardware] for the hardware interface in particular.

This tag may be used for the MOS Technology 6502 and close derivatives, such as the 65C02. For questions about the chip's hardware (i.e. pins) also use the tag.

177 questions
29
votes
2 answers

Why does 6502 indexed LDA take an extra cycle at page boundaries?

On the 6502 CPU, this instruction: LDA $0380,Y takes either 4 or 5 cycles, depending on whether the indexing crosses a page boundary. But this instruction: STA $0380,Y takes 5 cycles regardless of page boundaries. Why is one fixed and the other…
fadden
  • 9,040
  • 1
  • 30
  • 84
22
votes
3 answers

Where to buy a 6502 chip

I want to purchase a 6502 40 pin CPU in order to verify if my 6502 is faulty, I've seen I can buy from Hong Kong but would prefer closer (to the UK), RS and CPC don’t seen to have any. Most answers suggest trying a 65c02 processor but these all seem…
Bigmalc40
  • 337
  • 1
  • 2
  • 5
16
votes
3 answers

Can the 6502 clock be changed on the fly?

I was wondering if the original NMOS 6502 has any timing limitations on changing the clock rate during operation? I ask, because the CSG 8502 version could "run at double the clock rate of the C64", which sounds like a normal 6502B. But it did…
Maury Markowitz
  • 19,803
  • 1
  • 47
  • 138
16
votes
1 answer

How did the 6502 CPU get its name?

I am interested in the etymology of the name for the 6502 CPU. How were those numbers arrived at by the designers? Do they refer to anything specific? Is there some sort of origin story? I found some explanations for the similarly named 8008 and…
lookaside
  • 501
  • 3
  • 9
15
votes
3 answers

How are 6502 and 65C02 JMP(abs) processed internally

An infamous "feature" of the 6502 is that the JMP(abs) opcode will fetch the lower byte of the jump target from the address in the instruction, and fetch the upper byte of the jump target from the address whose lower byte is one higher than the…
supercat
  • 35,993
  • 3
  • 63
  • 159
14
votes
4 answers

6502: What does the Predecode Register exactly do?

When you look at this block diagram you can see a 'Predecode Register' I suppose that the Opcode is already a 8-bit Number (D0-D7). So what was the purpose of the Predecode Register. Did it really decode something?
user6734
14
votes
4 answers

Modulus arithmetic on the 6502

I have a very simple problem with is turning out to be surprisingly complex to solve. I wish to add two bytes using modulus arithmetic, where the modulus is known at compile time. e.g. given modulus 5, 3+3 = 1. The specific number I have currently…
David Given
  • 1,330
  • 8
  • 20
12
votes
1 answer

Were there 6502 revisions B and C, and what were they like?

The first 6502 was the 6502 revision A, which famously does not include the ROR instruction (this is sometimes described as a hardware bug, but that's apparently a myth). Then, some time later, there's a 6502 revision D. This has the ROR…
Omar and Lorraine
  • 38,883
  • 14
  • 134
  • 274
11
votes
4 answers

Did the 6502 need both ADC immediate and SBC immediate?

The 6502 uses the carry bit system (over a borrow bit). On such machines, the bitwise NOT is applied to the subtrahend before it is "subtracted" (really, added, taking advantage of two's complement) from the minuend. Since obviously when you're…
junius
  • 648
  • 4
  • 15
10
votes
1 answer

6502 double store and copy protection?

I was watching a video on netlist simulation of the 6502. The presenter mentions how the 6502 has a double store upon using INCY, and then offhandedly mentions that this can be used for copy protection. How does a double write to a spot in memory…
b degnan
  • 1,099
  • 7
  • 17
10
votes
1 answer

When did the 65C02 become available?

The Wikipedia article on the 65C02 is missing an introduction date for any of the mentioned models. I did a bit of poking about with no success. Does anyone know when they were introduced?
Maury Markowitz
  • 19,803
  • 1
  • 47
  • 138
9
votes
1 answer

DEX: How does a 2-Cycle instruction affect RCL outputs AFTER it completes?

I (as so many people before me) am developing a software simulation of the 6502, mostly based on the often cited block diagrams and several other sources of information. Basically all the components are done and I am in the process of configuring…
9
votes
1 answer

Why does the 6502 read from the stack before writing it?

I am building a W65C02S based computer for fun, and I try to build basically all the tools myself. Including the assembler (yes, I know they exist, I just want to make everything from scratch myself, for fun). When working on the JSR opcode…
Bart Friederichs
  • 1,107
  • 7
  • 13
8
votes
2 answers

Which order does the 6502 read its vectors in?

I'm looking at gianlucag/mos6502 and Mike Chambers' fake6502. They have observable differences in the way that they read the reset vector. Rubbermallet reads the $fffc first, and then $fffd. I'm inclined to think that's what the real deal does too.…
Omar and Lorraine
  • 38,883
  • 14
  • 134
  • 274
7
votes
2 answers

Is there a place where I can find 6502 instruction lines by opcode?

I am currently designing a watered-down version of the 6502 in Logisim. I am working off of Hanson's Block Diagram to build my subset. I have fully built the processor using the diagram and other resources as a reference in logisim, with the one…
Clink123
  • 113
  • 1
  • 5
1
2