5 ms·
I want to write an emulator as a learning experience. Any tips how should I start?
by dbancajas 13y ago
I want to write an emulator as a learning experience. Any tips how should I start?
- JoshTriplett 13y agoThere are two sensible approaches: interpretation or dynamic translation. If you want to write one as a learning experience for how the platform you're emulating works and how an emulator could work in principle, you probably want to write an interpreter: find out how the platform boots, build something to start reading and interpreting instructions, start adding emulated hardware devices, and you'll get an increasingly functional interpreter. For a start, you could ignore emulation of devices, and just write a CPU core that interprets instructions. If you want to learn how modern (but still non-hardware-assisted) emulation works, read about how qemu's dynamic code translator and other JIT compilers work, and build a CPU emulator based on that.
- ghewgill 13y agoCanonical place to start: http://stackoverflow.com/questions/448673/how-do-emulators-work-and-how-are-they-written http://stackoverflow.com/questions/448673/how-do-emulators-w...
- dave84 13y agoI'm not the OP but check out the book: "The Elements of Computing Systems: Building a Modern Computer from First Principles" It's quite comprehensive, not exactly about writing an emulator, but it should give you what you need.
- joelanders 13y agohttps://practicingruby.com/articles/low-level-computing?u=64aa43222f https://practicingruby.com/articles/low-level-computing?u=64...
- revelation 13y agoYou want to write an emulator, but you probably don't want to write one for x86. A nice architecture would be 8 bit AVR microprocessors, for example.
- g3 13y agohttp://codegolf.stackexchange.com/questions/4732/emulate-an-intel-8086-cpu http://codegolf.stackexchange.com/questions/4732/emulate-an-...
- awy 13y agoI recently posted about emulating the NES with JavaScript. http://blog.alexanderdickson.com/javascript-nes-emulator-part-1 http://blog.alexanderdickson.com/javascript-nes-emulator-par... Part 2 will be posted when it's done. :) If you want to get something done much quicker, have a go at emulating the Chip-8 VM. I also have a post, but it's less hand-holding than the first. http://blog.alexanderdickson.com/javascript-chip-8-emulator http://blog.alexanderdickson.com/javascript-chip-8-emulator Good luck!
- vinhboy 13y agoI really like your tutorial. I been trying to learn assembly and your tutorial is really helping me put the big picture together. I hope you continue to work on making it better.
- awy 13y agoI have a heap on my plate right now but will hope to do part 2 before the end of the year. Glad you enjoyed it.
- n1ghtmare_ 13y agoI'd like to think of myself as an experienced programmer, but I still loved your tutorial ! Brilliant ! Keep up the good work.