Skip to content

6502Toolkit: Disassembler, Emulator, Debugger & Assembler foundation for 6502 CPU. Portable and modular architecture for learning and extending

License

Notifications You must be signed in to change notification settings

0xilovebits/6502Toolkit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

6502Toolkit – Disassembly, Emulation, and More

License: MIT

6502Toolkit is my first disassembler.

It is designed with a portable and modular architecture.
The goal is to provide a solid foundation that can be reused to build multiple tools (disassembler, assembler, emulator, debugger) without rewriting the core logic.


Core Modules

  • CPU
    Contains the full instruction set architecture definitions: registers, opcodes, addressing modes.

  • Memory
    Provides a simple memory interface (read, write, load_file).

  • Stack
    Implemented for future use in the emulator.


Tools

  • Disassembler → Disassembler for 6502 machine code, implemented using the linear sweep algorithm.
  • Emulator, Debugger, Assembler → Planned, but not implemented yet.

In this project, I created a Python script (op_gen/main) to automate scraping and generating the C opcode table directly.
So instead of copying everything one by one, I can automate the process and finish this step in just one second.

Why this Design?

  • Portability → Any tool can reuse the same CPU, Memory, and Stack implementations.
  • Single Responsibility → Each module is responsible for one thing only, which helps when improving, adding, or refactoring code.
  • Extensibility → Easy to add new tools on top of the foundation.

This architecture makes the project scalable, allowing it to grow from a simple disassembler into a full 6502 toolkit.


References


Notes

Right now, some modules are very simple. For example:

  • The CPU module is not yet fully portable.
  • A proper CPU execution pipeline (fetch → decode → execute) is not implemented inside the CPU module itself, but instead directly in the disassembler tool.

This is temporary — the plan is to move the pipeline into the CPU module in the future so that it can be reused across the emulator, debugger, and assembler.


Build & Usage

Make sure you have GCC, CMake, and Make installed.

# Create a separate build folder (to keep source code clean)
mkdir build
cd build

# Configure the project with CMake
cmake ..

# Build the project
make

# The executables will be available in: build/bin

My Blog

👉 https://0xilovebits.github.io


Note

This README was originally written by me.
Since my English level is not very strong, I used AI assistance to correct grammar and spelling mistakes only.
All the content, design decisions, and ideas are my own.

About

6502Toolkit: Disassembler, Emulator, Debugger & Assembler foundation for 6502 CPU. Portable and modular architecture for learning and extending

Topics

Resources

License

Stars

Watchers

Forks