6 ms·
How do people design emulators? Is there a good resource on how you can learn to do this?
by max_ 2y ago
How do people design emulators? Is there a good resource on how you can learn to do this?
- ranza 2y agohttps://rylev.github.io/DMG-01/public/book/ https://rylev.github.io/DMG-01/public/book/ this is a good read
- max_ 2y agoThanks. This looks beautiful
- mbivert 2y agoIf you want to learn, I guess look for something well-documented and comparatively simple, like an old Game Boy emulator
- stevekemp 2y agoI think if you're new to emulation it's generally a good idea to start with something even simpler - the chip-8 system http://www.emulator101.com/introduction-to-chip-8.html http://www.emulator101.com/introduction-to-chip-8.html An average programmer can probably get an emulator for that running in a weekend, and there are lots of guides and documetnation out there for the opcodes and similar. NES / Gameboy / GameGear / similar are probably well-documented, but they will be harder at least because the processors have more opcodes you have to care about.
- badsectoracula 2y agoYeah CHIP8 is a simple enough system that i even made two emulators (one in DOS and one in Windows) and an assembler back in 1999-2000 or so when i was in highschool and could barely put eight bits together to form a byte. Also somehow for some reason i was convinced back then that mobile phones in the future will have a CHIP8 emulator to play games :-P. Sadly(?) they got Java instead.
- qingcharles 2y agoI would say this is a good place to start. I did a Game Gear emulator in a single night with a buddy, having never written one before, just for the lulz. You are bound to have an awesome game you can find on an 8-bit system and it's really fun trying to get to the point where you can play the game: getting the logo to appear, getting the title screen up, getting the sprites working, adding controls etc.
- ultimaweapon 2y agoIt is really depend on the hardware you want to make the emulator. Usually there are 2 kind: 1. Emulate the whole system. 2. Emulate the system API. The first one you write the code to emulate the CPU of target system like OP code interpreter (e.g. NES). The second one you write the code to re-implement the API of the target system (e.g. Wine). For the second one you may need to write a JIT compiler if the target system use a different CPU architecture (e.g. PS3). Most modern console emulator are the later one because how the modern console work is similar to how the PC work. It have an OS kernel and a user-mode libraries for applications. For the latter one there are 2 kind of it. The first one is emulate the user-mode libraries and the second one is re-implement the console kernel and reuse the system libraries from the console itself.
- delta_p_delta_x 2y ago> Most modern console emulator are the later one because how the modern console work is similar to how the PC work. It have an OS kernel and a user-mode libraries for applications. And additionally because the past couple of console generations have had x86-64 CPUs, there's no need to do full instruction translation/emulation—something like Wine would suffice.
- gambiting 2y agoThere are loads of resources online on how to write a gameboy emulator, these use a straightforward enough architecture that it's pretty easy to follow. I'd recommend starting there in your language of choice.
- dangsux 2y ago[dead]
- gambiting 2y agoWell no, I said there are loads of tutorials in the language of your choice - I have no idea what language OP is proficient in - my personal preference is for C++, but would that be useful here? No idea. >>The way you go about writing a N64 emulator is vastly different from GB I specifically said "There are loads of resources online on how to write a gameboy emulator", what does N64 has to do with this?
- rkaid 2y agojavidx9 (aka OneLoneCoder) on youtube did a pretty good series on how to write a NES emulator from scratch: https://www.youtube.com/watch?v=nViZg02IMQo&list=PLrOv9FMX8xJHqMvSGB_9G9nZZ_4IgteYf&pp=iAQB https://www.youtube.com/watch?v=nViZg02IMQo&list=PLrOv9FMX8x...
- hggh 2y agoThe simplest emulator in the world by Oscar Toledo G.: https://news.ycombinator.com/item?id=39774932 https://news.ycombinator.com/item?id=39774932
- amy-petrik-214 2y agoHave a data structure for CPU registers. Have a data structure for memory. Have a data structure for i/o. Read a series of instructions that are being emulated. Create a series of rules as to how those instructions interact with CPU, memory, i/o, in a mutable fashion. A long if/then/elif/elif/elif/elif/else type loop, or switch case type loop, if you will. Create bridges between particular pieces of memory and system output: video, sound, controllers. That's most of it in the classic case at least. Now you have an emulator. The "big league" emulators work differently. They may be simple compilers. Instead of compiling C code or java code, they compile machine code from system A to system B. A transpiler. This affords speed beyond the simple case. Speed, however, is only necessary if the machine running the emulator is weak, or if the machine being emulated is strong.