Questions tagged [6502]

For questions about the 6502 series of processors, including hardware and assembly language questions. For questions about the hardware interface also use the "hardware" tag.

Filter by
Sorted by
Tagged with
6
votes
2answers
369 views

Labels in cc65 inline assembler with #define macro

In general, it is possible to use inline assembler statements within C macros, for example #define toscreencode(C) (__AX__ = (C), \ asm("cmp #$60"),\ ...
8
votes
3answers
1k views

Why did decimal arithmetic slow down VisiCalc?

There is an excellent article about VisiCalc that goes into all the details about what happened and why, highly recommended if you are interested in that part of computing history. I was reading this ...
3
votes
2answers
209 views

Could the 6502 have worked with an Altair-style front panel?

I have fond memories of programming the 6502, though I never did any hardware hacking with it. I notice that the Altair, with its iconic front panel, was based on the Intel 8080, and from then on, ...
17
votes
1answer
1k views

Why did the 6502 handle BCD with a special mode?

The 6502 had special support for BCD arithmetic, because it was widely used in those days; this much, it had in common with other CPUs. But the 8080 and 6800 implemented this in the form of a 'decimal ...
10
votes
5answers
3k views

Why were there no 32-bit or 64-bit versions of the m68k & 65xx lines of CPUs?

I don't understand why Western Design Center made the 65816 a 16-bit upgrade to the 6502 but Commodore Semiconductor Group/MOS Technology didn't make their own variant & why neither company made ...
0
votes
4answers
156 views

How did graphics processing for old 8/16bit consoles work & what are the differences between an FPU/maths co processor & a graphics card? [closed]

When looking on the internet at information about old consoles it's pretty easy to find out information on CPUs like the 6502, 65816, 68000 & Z80 used in retro computers & consoles like the ...
23
votes
6answers
6k views

Why are old CPUs like MOS Technology 6502 and Motorola 68000 considered better for real time systems applications than modern x86 based CPUs?

Reading the Wikipedia article about real-time computing, I found written that: Once when the MOS Technology 6502 (used in the Commodore 64 and Apple II), and later when the Motorola 68000 (used in ...
3
votes
2answers
339 views

How were games and programs written for the C64 in assembler in the 80s? [duplicate]

Were developers using monitors like e.g. "Supermon+64", "Merlin 64" or "Monitor$C000" and cartridges like "Final Cartridge", "Action Replay" (both of ...
3
votes
1answer
257 views

When did the faster versions of the NMOS 6502 become commercially available?

The 6502 was released in 1975 with an advertised speed of about 1mhz but I can't find reliable information on what year faster versions became available (was 2mhz possible at launch?) or what the true ...
2
votes
1answer
229 views

Does the 6502's TXS and TSX affect flags or not?

Title says it all really. Some documentation claims that the S and Z flags are affected by both TXS and TSX, just as with all other transfer commands. Other documentation suggests that neither TXS nor ...
3
votes
2answers
448 views

Why don't all Absolute,X instructions take an extra cycle to cross page boundaries?

The question is about 6502 instructions that take an extra cycle when address calculation carries over into the high byte of the address. This affects addressing modes Absolute,X, Absolute,Y, Indirect,...
55
votes
8answers
13k views

Could you reverse engineer silicon just by looking at it?

I was interested in a recent interview of Masayuki Uemura, one of the engineers who designed the Nintendo Famicom in the early 80s. During initial design phase of the Famicom, one of the first things ...
18
votes
3answers
3k views

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 ...
41
votes
12answers
6k views

What languages are better fit for generating efficient code for 8-bit CPU's than C?

I found Why do C to Z80 compilers produce poor code? very interesting as it pointed out that C (which was designed to be an abstraction of a CPU for porting Unix) was not a very easy language to ...
4
votes
4answers
383 views

Would having the console's CPU help in emulation hypothetically?

If I had a hypothetical computer just like nowaday's computers, but it had an NMOS 6502, would it provide me with a better emulation experience than if I were to emulate the 6502 inside software? Also,...
8
votes
3answers
447 views

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) ...
11
votes
3answers
358 views

Do any 6502 assemblers have better support for self-modifying code?

I find I keep on doing things like this: raster_interrupt: bgnd_color = * + 1 lda #$00 sta $d021 ; rest of interrupt handler so that I can do this kind of thing elsewhere in my ...
9
votes
1answer
261 views

6502 False Reads and Apple II I/O

The 6502 series of CPUs has an interesting quirk: indexed loads and stores may perform a "false read", reading from the target address or a different address on a previous page. There are situations, ...
15
votes
3answers
1k views

For how long can you safely stop the clock on an NMOS 6502?

As with most NMOS processors, the NMOS versions of the 6502 (and even earlier CMOS versions) do not have a static core. Thus, if you run the clock too slowly or stop the clock for too long while doing ...
2
votes
3answers
168 views

How can I get cl65 to include its subroutines, like pushax and tosmulax?

This question is about cc65, which is a toolkit including a C compiler, assembler, linker, etc. All targeting various 6502 computers, like the various 8 bit commodores, the Apple II and whatever else. ...
3
votes
3answers
446 views

How to transfer the address of a data block into zero page using the Merlin 8 assembler on my Apple //e?

I've been fooling around with the Merlin 8 (v2.58) assembler on my Apple IIe and ran into a small snag. Basically, I would like to load the address of a block of data into a two-byte pair in zero ...
15
votes
1answer
2k views

Why did the Apple IIe use a 2 MHz-rated 6502, even though it ran at only 1 MHz?

The Apple IIe was designed to be timing-compatible with the Apple II+ so that timing-depndent software (such games and copy-protection systems) and hardware designed for the Apple II and II+ would, ...
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 ...
12
votes
0answers
492 views

Why did some MOS 6502 packages have holes in them?

Someone was recently selling an early MOS 6502 CPU on Ebay (date code 0277) in a ceramic package that had a couple of holes in it. You can see them clearly (under the tape, which presumably was not ...
4
votes
4answers
1k views

Why use an ADC or SBC with immediate zero on a 6502?

I'm perusing the Apple I version of BASIC, later known as Integer BASIC on the II. In several places I see... ADC #$00 or SBC #$00 Unless I'm mistaken, these mean add/subtract zero. What ...
7
votes
2answers
506 views

How to pass data pointer to subroutine to use with Absolute,Y addressing?

I may be going about this the wrong way, so sorry if it is wrong, I'm coming to 6502 after 32 years (when I was 8 years old !) I want to pass a pointer to some data, either data1 or data2 to a sub ...
4
votes
1answer
775 views

6502 - AND instruction updates flags differently than other logic operations

Why AND instruction updates flags in the fetch step? Others logic instructions like ORA and EOR update flags in the same step that they update accumulator, in the decode step. Is it a bug of ...
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/...
11
votes
3answers
2k views

6502 reset pin: always needed on power on?

The 6502 pinout has a reset pin, which presumably would be used if a reset button is pressed on the machine containing the CPU. But the 6507 contains the same pin. The 6507 was designed at the ...
4
votes
2answers
205 views

6502 interrupts when RDY is low

If the NMI line goes from high to low when the RDY is low, is the NMI detected, so that when RDY goes high, NMI is performed ? Or is the NMI discarded when it occurs when RDY is low ? (In case of ...
4
votes
2answers
800 views

Adding a register to the accumulator in 6502

In the past, the only assembly programming I've done has been a tiny bit of ARM, and then a larger game project in 68k. In 68k I was used to being able to do things like add.l d0, d1 to add the ...
5
votes
3answers
873 views

Indirect addressing using address bits as marker (tagged address)

After reading about the Signetics 2650, and being a bit familiar with the HP2100's, I'm curious how common the style of "indirect addressing via the address value" instruction was at the time? CPUs ...
19
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
1answer
417 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 ...
22
votes
2answers
3k views

Why didn't the 6502 have increase/decrease opcodes for A?

In 6502 Assembly, we can use INX and INY to increase the value stored in X and Y. They can be decreased with DEX and DEY. However, it seems that there are no such instructions for A, like INA or DEA. ...
19
votes
4answers
3k views

Why are branches relative in many 8-bit CPUs?

I was looking over an old article on the 6809 and was perusing the opcodes and noticed that the branch instructions came in two flavors, long and short. That sparked a memory about one of the 6502-...
11
votes
1answer
487 views

Why didn't Wozniak's interrupts work on the Apple I monitor program?

In his autobiography, Steve Wozniak recounts[1] his difficulty getting interrupts working on the 6502 microprocessor: The next step was to debug the 256-byte monitor program on the PROMs. I spent ...
41
votes
3answers
5k views

What happened to the SEV instruction on the 6502?

The 6502 has a group of opcodes which copy bit 5 from the opcode into one of the status flags. (I know it's not implemented this way, but it looks as though the bit fields are: 2 bits to select the ...
15
votes
6answers
5k views

How slow was the 6502 BASIC compared to Assembly

Imagine a modern computer, where let's say Python is a high level programming language and needs to be interpreted in order to execute a piece of code. You could write some code in C, compile it, ...
14
votes
12answers
4k views

Late 1970s and 6502 chip facilities for operating systems

I'm quite unfamiliar with how operating systems used to be written but its clear to me that operating systems were clearly written for these systems. I'm particularly interested in how operating ...
25
votes
3answers
3k 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 &...
13
votes
1answer
890 views

Does the Commodore CDTV-CR contain a 65C02 for some reason?

Browsing around the FS-UAE source code I discovered a 65(S)C02 emulation core, which appears to not be referenced anywhere outside of some CDTV-CR related source file. Apparently, a CDTV is ...
5
votes
4answers
798 views

6502: is BCD *fundamentally* the same performance as non-BCD?

Furthering my reading of MS BASIC and Woz's FP code and comparing the two leads to another question specific to the 6502... From what I can see looking over the 6502 instruction guides, it appears ...
15
votes
3answers
700 views

Did any micros use the 6502 BCD mode in their OS?

I know the Atari's FP package used BCD for rather dubious reasons, but does anyone know of other examples of basic "operating system" level code on common platforms that used BCD? I suspect BCD was ...
9
votes
4answers
818 views

How is PETSCII used by assembly-language programs?

First, a bit of context. I wrote an interactive disassembler for 6502 code that, among other things, attempts to identify ASCII strings automatically. Appropriate source code for different assemblers ...
3
votes
3answers
375 views

Interrupt pin type on the 6502

I have a really basic question. I have to design an 65C02-based personal computer for a school project. I have to draw my own footprint for the 65C02. My question is what type of pin is the IRQB (...
9
votes
1answer
345 views

SYNC and the 65CE02 instruction timing

From the Wikipedia's 65CE02 page: Internally, the pipeline of the 65CE02 was redesigned to reduce the number of cycles required to execute an instruction. The 65CE02 can recover faster from ...
10
votes
3answers
1k views

Behavior of the zero and negative/sign flags on classic instruction sets

It seems to me that there's effectively two ways that the zero bit could work. Z is set iff the result of a computation is mathematically equal to 0. Z is set iff a bit pattern consisting entirely of ...
9
votes
1answer
330 views

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?
22
votes
1answer
1k views

How good was Woz's FP code?

I just came across this amazing 1976 article by Woz. In it he describes a relatively complete floating-point system for the 6502 with a 32-bit format (similar to earlier MS code). I understand the ...