Questions tagged [6502]

The 6502, developed by MOS Technology, is an 8-bit microprocessor that was in common use as a microcomputer and video-game CPU from the late 1970s through to the early 1990s, notably powering products from Commodore, Apple, Atari, Acorn and Nintendo.

The 6502, developed by MOS Technology (later CSG, Commodore Semiconductor Group) and subsequently licensed to Rockwell and Synertek, is an 8-bit microprocessor with a 16-bit address bus that was in common use as a microcomputer CPU from the late 1970s through to the early 1990s. Typical clock speed implementations drove the CPU at either 1MHz or 2MHz, though the device was not locked to these speeds and could be over/under-clocked to a degree.

Commodore, Apple, Atari, Acorn and Nintendo notably featured the device in numerous microcomputers and video-game consoles during that time. Variant models include the 6507 and 6510, whilst later revisions include the 65C02 and 65C816. These models either lacked some functionality (6507) or enhanced the original design.

231 questions
8
votes
2 answers

Writing a disk file using assembly on Commodore 64

I'm trying to learn how to write disk files using kernal routines following this Codebase64 Tutorial. I have copied my routine, written in Acme Crossassembler, below. It failed to open file and gives error message: "FILE NOT OPENED" ;…
wizofwor
  • 917
  • 8
  • 25
8
votes
3 answers

NMI and IRQ interruptions

I am trying to find information about how the 6502 proccesor handles interruptions, but I am very confuse. I have seen some examples about it, but It is like a normal subrutine. I have some experiences with the 8086 processor, and I remember that…
quindimildev
  • 1,280
  • 8
  • 21
8
votes
11 answers

Classic assembly language texts not using x86?

I'm looking for texts that give detailed treatment of assembly programming principles and don't use x86 as the target architecture. I haven't found any recent books like that, but I would expect that there were some good ones written in the 1970s…
wrp
  • 81
  • 2
8
votes
1 answer

How can I test my homebrew Nintendo Entertainment System software on real hardware?

A few years ago, I implemented an NES game as a class project, written in 6502 assembly. I only ever ran it on an NES emulator, but I would like to see it run on the real hardware. Is there any development board to do this? I understand it is…
Adam Goode
  • 7,380
  • 3
  • 29
  • 33
8
votes
2 answers

Why is the initial state of the interrupt flag of the 6502 a 1?

I'm emulating the 6502 processor, and I'm nearly finished (in the testing phase right now) and I'm using some NES test from the nesdev site, and it's telling me that both the interrupt flag and the unused 5th flag are supposed to be set to 1…
ZimZim
  • 3,291
  • 10
  • 49
  • 67
7
votes
4 answers

What exactly is an interrupt?

I want to understand what exactly an interrupt is for my 6502 work-alike processor project in Logisim. I know that an interrupt does the following steps: Stops the current program from processing Saves all unfinished data into the stack Does…
Senijs
  • 83
  • 8
6
votes
1 answer

I'm failing to understand how the stack works

I'm building an emulator for the MOS6502 processor, and at the moment I'm trying to simulate the stack in code, but I'm really failing to understand how the stack works in the context of the 6502. One of the features of the 6502's stack structure is…
user9436253
6
votes
1 answer

Better way to dynamically update tile data on Commodore 64

I'm planning to use software sprites in multicolor char mode for my new C64 project. My idea is to use superimpose 'bullet' sprite data to tile data. I think I can have tileset data at address 'TILESET', sprite data at address 'SPRITE'. And I can…
wizofwor
  • 917
  • 8
  • 25
6
votes
1 answer

Basic NES Emulation theory - I'm stuck

In advance, I apologize for the open endedness, and general wishy-washiness of this question, because to be honest my knowledge of the topic is very patchy and I'm finding it hard to even describe my problem. I really didn't want to post, but I'm…
Dominic Bou-Samra
  • 14,799
  • 26
  • 100
  • 156
6
votes
1 answer

6502 emulator in C/C++: how to separate addressing mode code from actual instruction code

In the spare time I'm starting writing a very simple C++ emulator for the 6502 CPU. I used to write down a lot of assembly code for this CPU so all the opcodes, addressing modes and other stuff are not a big deal. The 6502 has 56 different…
Gianluca Ghettini
  • 11,129
  • 19
  • 93
  • 159
5
votes
1 answer

ca65: Include Guard generates "Error: Identifier expected"

Trying to learn how to use the ca65 assembler, I've been battling with making include guards work. Googling and reading the ca65 Users Guide didn't help. Here's a minimal example that produces the error. $ ls -l total 16 -rw-r--r-- 1 me staff 60…
Quester
  • 81
  • 7
5
votes
1 answer

Modified C64 PRG BASIC header?

I recently bought a c64 mini and been trying to code some assembly using Turbo Macro Pro v1.2. While working on the hello world program I found a tutorial where an auto run BASIC header was used. I tried to also include a PRINT CHR$(147) to clear…
Dacobi
  • 417
  • 4
  • 14
5
votes
1 answer

Is there a way to call 6502 assembly code from C file?

I am using cc65 6502 simulator, which compiles code for 6502. I wish to link the 6502 code and C code and produce a binary file that I can execute. My C code "main.c": #include extern void foo(void); int main() { foo(); return…
5
votes
2 answers

Advantages of arrays of structures over parallel arrays in 6502 assembly language?

My understanding from writing a lot of 6502 back in the day is that parallel arrays are better than structures for storing data. Imagine you want to have a table of monster stats that in C would be defined something like this struct Monster { …
gman
  • 100,619
  • 31
  • 269
  • 393
5
votes
3 answers

Exercise in self modifying memory copy routine, 6502 ASM

Below is my self modifying routine for memory copy on Commodore 64. I wrote char codes and number of repeats in a table and filled the screen_ram the with this routine. I'm looking for suggestions for optimization. My priority is memory in this…
wizofwor
  • 917
  • 8
  • 25
1
2
3
15 16