Dumonu / Atari2600Emu

An Atari 2600 Emulator written in C

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Atari 2600 Emulator

This is an Atari 2600 emulator currently under development in C.

Refactoring

I was someone silly when I first wrote the code for the OpCodes. From here, I'm going to refactor the opcode functions in the following ways:

  • No more multiple instances of functions in the OpCode array.
  • No more silly switch statement on the OpCode.
  • Remove the OpCode itself from the function parameters, we won't need it because it'll be a unique function for each OpCode.
  • New function name format: XXX_nn, where XXX is the name of the command and nn is the OpCode in hexadecimal.

This will greatly improve the overall readability of the OpCode functions.

Currently Implemented:

6502 CPU Registers

  • A - Accumulator
  • X - Index Register
  • Y - Index Register
  • PC - Program Counter
  • S - Stack Pointer
  • P - Process Status Register
    • Bit 0 - C - Carry
    • Bit 1 - Z - Zero
    • Bit 2 - I - IRQ Disable
    • Bit 3 - D - Decimal Mode
    • Bit 4 - B - Break Flag
    • Bit 5 - 1 - Not used
    • Bit 6 - V - Overflow
    • Bit 7 - N - Negative/Sign

tick() function to handle the discrepancy between 1.19Mhz 6502 processor and several Ghz modern processors.

Handles illegal and undefined opcodes.

Opcode matrix declaration.

2-byte memory addressing with read() and write() functions to allow properly handled memory-mapped I/O devices.

The following opcodes:

  • CPU Memory and Register Transfers
  • CPU Arithmetic/Logical Operations

To be Implemented:

The rest of the opcodes. - Add dummy read/write cycles on page crossing. <- I think I've done this, but I'm not sure. I'll check at some point.

Memory and I/O Map

Memory Mirrors

Video

Interval Timer

Audio

Input

Reading from a ROM File

(optional) Actual programming of illegal opcodes

Usage and Compilation

As of right now, the Atari 2600 Emulator is in an extremely early stage of development. The debug.c main() will read in a binary file used to test the opcode development.

NEW

The SDL2 library has now been linked into the project. If you do not have SDL2 installed, you must install it before compiling this project.

Arch Linux:

sudo pacman -S sdl2

Ubuntu Linux:

sudo apt-get install libsdl2-dev

Red Hat-based Linux:

sudo yum install SDL2

Gentoo Linux:

sudo emerge libsdl2

Disclaimer: I run Arch Linux, so I do not guarantee that I put the correct packages for other distributions. When in doubt, if I did not list your distribution here, check your distribution's package manager/wiki.

To compile:

make

To use:

./debug ./test/test0.bin

About

An Atari 2600 Emulator written in C


Languages

Language:C 99.0%Language:Makefile 0.6%Language:C++ 0.4%