This is an Atari 2600 emulator currently under development in C.
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
, whereXXX
is the name of the command andnn
is the OpCode in hexadecimal.
This will greatly improve the overall readability of the OpCode functions.
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
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
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.
sudo pacman -S sdl2
sudo apt-get install libsdl2-dev
sudo yum install SDL2
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.
make
./debug ./test/test0.bin