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
15
votes
3answers
2k 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-...
10
votes
1answer
354 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 ...
37
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 ...
14
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 ...
23
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 "...
11
votes
1answer
706 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
538 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 ...
13
votes
3answers
471 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 ...
7
votes
4answers
482 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
239 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
231 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 ...
8
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 ...
7
votes
1answer
293 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
898 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 ...
2
votes
2answers
276 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 ...
31
votes
5answers
5k views

Why does the 6502 have the BIT instruction?

The 6502 has a bit instruction which copies two of the bits into the N and V flags, pretends to and the byte with the accumulator, but discards the result and only affects Z. I'm having a hard time ...
4
votes
1answer
167 views

65C816: Inputs TTL-compatible?

New 65C816 datasheets say that Vih (for the data bus in particular) is 0.8Vdd, i.e. not TTL-compaible. Old data sheets (for example, the one published in Apple IIgs Hardware Reference) say that at 5V ...
9
votes
1answer
768 views

Looking for a specific 6502 Assembler

I found some 6502 assembler code for a Commodore 64 program that uses meta commands like #include "foobar", define the address to be assembled to via *=$1234 and define labels without a colon. ...
0
votes
6answers
981 views

Can you compile 6502 assembly into a stand-alone PC application? [closed]

6502 assembly is a language meant for humans to write themselves, not compilers. It's an older Assembly that powered the olden days of computing and consoles such as the NES and Atari 2600. I want to ...
7
votes
2answers
328 views

Could a 6502 use different speeds of RAM in a single machine?

I'm not sure I've entirely formed the idea in my head, but I'll ask anyway... One of the things I learned here in RO is that the BBC gained speed by using faster RAM, thereby avoiding cycle stealing ...
9
votes
1answer
297 views

What's the purpose of HOLD command in 6502 stack pointer

In the Block Diagram the Stack Pointer Register (S) has a HOLD command in addition to the LOAD and BUS ENABLE commands. The HOLD command is linked to the S/S output of the Random Control Logic. What ...
3
votes
2answers
319 views

How to express hi/lo byte of a label in crasm

I am trying to move my project from xa (which I found rather buggy) to crasm, which is the other 6502 assembler that comes with debian. My project contains a lot of lines like ldx #<pname ldy #&...
15
votes
5answers
3k views

Why are different emulators needed to run platforms that use 6502 assembly code?

To my knowledge, an emulator turns machine code for a console into something that your computer can understand. For example, assembly code from a Gamecube game is not the same as from a .exe file. ...
9
votes
1answer
1k views

Why does this 6502 code push a function address onto the stack before calling?

I am learning how to program the Atari 800 by examining some tutorial code that came with the IDE/Assembler I am using. I am using the MADS assembler for this. putchar_ptr = $346 csrhinh = 752 ...
16
votes
2answers
5k views

What does “jmp *” mean in 6502 assembly?

Right now I am learning 6502 assembly. Currently I am using the MADS assembler to program for the Atari 800. This program is just a small tutorial program that came with the assembler zip file I ...
4
votes
1answer
302 views

What is the format of a TurboGrafX instruction (modified 6502 instruction set)?

What is the general format of TurboGrafX processor instructions? For example, and this is made up: one word for opcode + two words for flags + one word for every parameter listed under that ...
1
vote
2answers
509 views

Resource for 6502 assembly directives?

I am currently learning about 6502 assembly. One of the documents I am learning about it from is a super mario bros. disassembly document. When I was reading the code I noticed part of the code had ...
8
votes
3answers
3k views

6502 CMP instruction doesn't compare as expected

I am trying to code in 6502 assembly and for some reason the CMP instruction doesn't work. For example: CLD LDY #$03 LDA #$00 LDX #$05 CMP Y BEQ Equal STX $0200 Equal: BRK ...
1
vote
2answers
327 views

Acorn System 1 - is it a collectable? [closed]

I have one of these things gathering dust at home: Acorn System 1 I have the original manual (when I find it?) too. It did work, the last time I powered it up, 35 years ago. Should I throw it in ...
6
votes
2answers
507 views

Hardware multipliers on classic CPUs

Can anyone offer some back-of-envelope sort of estimates of what sort of gate count was needed to add a multiplier to 8-bit CPUs? I ask because I find it a bit odd that the 6809 had one, but none of ...
16
votes
2answers
1k views

6502 branch offset calculation

This question expands on How does the 6502 implement its branch instructions? I'm working on a cycle accurate VHDL implementation on an FPGA. I have much of the program logic already written, but I ...
7
votes
1answer
225 views

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 ...
5
votes
1answer
548 views

Fastest way to write 0x00 to a zero-page memory location? (6502, Atari 2600)

I have a kernel in my 6502 game that writes two dots to a sprite, so for example: ........ ........ .XX..XX. .XX..XX. ........ ........ Either 0, 1, or 2 dots can be on at a time. This is done one ...
8
votes
3answers
1k views

Why do they use CLI in an IRQ routine?

I am studying an FLI routine in http://codebase64.org/doku.php?id=base:fli_displayer and I noticed that the CLI instruction is being used in this IRQ routine: irq0: pha ... cli ; &...
5
votes
3answers
2k views

How can a Z80/8080/6502 use VGA?

I've come across a couple of projects that manage to get VGA working with the Z80 and similar CPUs: Veronica (6502 CPU, VGA signal generation by AVR) ZC160 (Z80 CPU, VGA signal generation by GAL) c-...
13
votes
7answers
1k views

New 6502 BASICs?

I sort of "have a thing for BASIC" right now, which has led to a couple of great exchanges here in RSE about the variations "back in the day". I'm wondering if anyone is aware of other modern BASICs ...
2
votes
3answers
947 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. ...
7
votes
3answers
726 views

Was there any particular reason the 6502's LDX#imm and LDY#imm aren't opcodes A8 and AA?

Parts of the 6502 opcode map are fairly regular, and parts of it aren't. One bit that strikes me as really weird is the decoding of LD_ instructions, in relation to the decoding of other ALU ...
9
votes
2answers
352 views

Can 6502 programs be transliterated to the SPC700?

The SPC700's instruction set is derived from the 6502's, but moves the instructions around and adds a few. But is it fully backwards compatible? Assuming that the program fully separates data and ...
10
votes
4answers
1k views

PDP-8 transistor count

https://en.wikipedia.org/wiki/Transistor_count provides some transistor count figures for early microprocessors, e.g. 8008 and 6502 both listed at around 3500. The PDP-8 was a 12-bit computer with a ...
19
votes
4answers
6k views

Z80 x 6502 raw performance

A lot have been said in the internet about the 6502 at 1MHz being roughly equivalent in performance to the Z80 at 4 MHz. Is said that the Z80 have a typical 4 clock ticks per instruction while the ...
4
votes
0answers
140 views

How does the 6502 check the negative flag internally? [duplicate]

I am currently developing a subset of the 6502 in LogiSim. One of my main resources is Hanson's Block Diagram. Currently I am developing opcodes for the processor, and my current task is the ...
7
votes
2answers
895 views

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 ...
7
votes
2answers
547 views

Unsigned addition on the 6502

I am currently playing around with pointer and indirect addressing on the C64 and I encountered a problem with the ADC opcode. I am trying to increment a number repeatedly and when it overflows (goes ...
10
votes
1answer
849 views

Why are some soft switches on the Apple II only triggered with a write?

The Apple II uses memory mapped I/O and soft switches to do many things. One thing has confused me though: why are some soft switches only activated when written to? For example, 80COLON ($C00D) and ...
20
votes
4answers
1k 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 ...
11
votes
5answers
2k views

Mapping more than 64kb of address space

I'm planning out a 6502 homebrew build but seem to be stuck in the issue of buying parts. My plan is to extend the addressing capabilities of the 6502 by giving myself 64kb of RAM, and another 64kb of ...
13
votes
4answers
1k views

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 ...
2
votes
1answer
228 views

Which material was used for the 6502/6510/8500 MOSFETs?

I know that in the 80s, there was a shift from aluminum gate material to polycrystalline silicon. I wonder because the 6502 was released in 1975 and there were a lot of different implementations and ...