4 ms·
Exactly this. I wrote an Apple ][ emulator, so I started by writing a 6502 emulator, and this is the only approach. Start with a giant switch, implement a few o
by hota_mazi 5y ago
Exactly this. I wrote an Apple ][ emulator, so I started by writing a 6502 emulator, and this is the only approach. Start with a giant switch, implement a few opcodes, run a program, wait until it reaches the not implemented case, implement it, repeat.
It is a surprisingly satisfying activity.
- toast0 5y agoOn topic, I had tremendous fun writing the CPU emulation for my maybe 1/3rd done NES emulator (that I likely won't finish, but who knows). Off topic, I wouldn't do a 6502 as a giant switch, you'll likely miss out on a lot of the shared logic. If you decode the instructions differently, you can easily reuse logic for addressing modes and what not. I really like how the opcodes are laid out in the table on this wiki http://wiki.nesdev.com/w/index.php/CPU_unofficial_opcodes http://wiki.nesdev.com/w/index.php/CPU_unofficial_opcodes
- hota_mazi 5y agoMy giant switch leverages the bit patterns :) My emulator passes the Klaus2m functional suite and my Apple ][ emulator is able to run quite a few protected games.