Questions tagged [6502]

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

Filter by
Sorted by
Tagged with
3
votes
3answers
2k views

Reading both keyboard and joystick with non-KERNAL code on C64

I'm implementing non-KERNAL joystick and keyboard controls for my Commodore 64 game. I used to use the KERNAL SCNKEY routine earlier to read keyboard and it worked well with my joystick port 2 code. ...
29
votes
1answer
3k views

What is the relative code density of 8-bit microprocessors?

When RAM is at a premium, as it was in the old days, a greater code density of an instruction set can be a substantial advantage. (Click saver: Code density refers loosely to how many microprocessor ...
19
votes
4answers
3k views

How did integer multiplication work in 8-bit BASIC without CPU support

I've recently been teaching my 11 year old binary multiplication, which is on the UK maths syllabus at secondary school. We have used long multiplication, eg shift and add. This has made me wonder ...
18
votes
1answer
2k views

How did the 6502 ALU perform a decrement?

Assuming that this diagram is correct: Instructions like INC, INX, and INY can easily perform increment using ALU sum with data on B input, 0 on A input and carry_in set. But how do instructions ...
6
votes
3answers
1k views

What is the MOS 6502 doing on each cycle of an instruction?

So, first off, I am kind of a noob with emulators and the 6502. Summarise the problem If we for example take the instruction ADC Immediate ($69) which adds the accumulator to an immediate value and ...
31
votes
3answers
3k views

How did Elite do vertex transformation?

In 3D graphics, vertex transformation is the process of converting x,y,z coordinates in 3D space, to x,y coordinates on the screen. According to https://www.khronos.org/opengl/wiki/...
16
votes
3answers
4k views

How much did the 6502 and Z80 cost?

It is said that the 6502 was cheaper than the Z80. As of 1978, what were the actual prices of the two chips, in wholesale quantity?
28
votes
2answers
2k views

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 ...
25
votes
3answers
4k views

What are uses of the byte after BRK instruction on 6502?

The BRK instruction on the MOS 6502 seems to be one of the more ill-documented features of the processor. The 1976 preliminary data sheet from MOS indicates that it's a 1-byte instruction using the &...
34
votes
2answers
2k views

Can the two CPUs in a Commodore 128 run at the same time?

The Commodore 128 has two CPUs. One is some variant of the 6502, and the other is a Z80. One CPU is there for compatibility with the Commodore 64 and the other is there presumably to give basic ...
8
votes
1answer
282 views

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, ...
8
votes
1answer
786 views

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 ...
6
votes
1answer
504 views

Putting code into two different memory areas with cc65/ca65

According to cc65 / ca65 documentation, the .org directive does not affect the placement of the code unlike with other 6502 assemblers. The docs suggest defining a memory segment with the intended ...
3
votes
2answers
876 views

How exactly do all control signals in 6502 work?

I'm trying to make a 6502 replica in Logisim. I want to know what exactly each control signal in 6502, how the clock cycles work and additionally I would like to see an example of these control ...
21
votes
4answers
2k views

Was the design of MS-BASIC for 6502 based on MS-BASIC for 8080?

Looking through the source code of the 6502 MS-BASIC, certain parts of it seem more reminiscent of how things would be done on the 8080, then on how they should be done on the 6502. Code to find a ...
13
votes
1answer
2k views

What is the relationship between the Ricoh 2A03 and the MOS 6502?

The Ricoh 2A03 (and the 2A07) is the CPU in the well-known Nintendo Entertainment System. Apparently, the die is very similar indeed, as the slides in this video suggest https://www.youtube.com/watch?...