How would someone begin to work on something like this?
Goboy: Multi-Platform Nintendo Game Boy Color Emulator Written in Go
11–20 of 34 posts
Re: Goboy: Multi-Platform Nintendo Game Boy Color Emulator Written in Go
#12I’ve often thought of writing my own emulator for the NES or GB/GBC to learn a little about how emulation works on a more fundamental level. I understand a lot of it is the process of translating machine code from, say, the GB processor to x86, but I’d love to learn more!
> I understand a lot of it is the process of translating machine code from, say, the GB processor to x86, but I’d love to learn more! You don't really need to translate to x86 per se. You can start off with an interpreter that takes in the 6502 or Z80 instructions (as represented by the binary data in the input ROM), then immediately perform operations based on those instructions. For example, if you're holding onto…
Re: Goboy: Multi-Platform Nintendo Game Boy Color Emulator Written in Go
#13Earlier quoted context omitted.
> I understand a lot of it is the process of translating machine code from, say, the GB processor to x86, but I’d love to learn more! You don't really need to translate to x86 per se. You can start off with an interpreter that takes in the 6502 or Z80 instructions (as represented by the binary data in the input ROM), then immediately perform operations based on those instructions. For example, if you're holding onto…
I have a question there. CPU instructions and what they do are highly documented and easy to replicate, but I'm guessing that timing is significantly less slo. How do you get that right?
Beyond that, you have to worry about hardware peculiarities that happen to affect maybe a few games, and at that point, you might start reverse engineering the behavior of those games!
Take a look at this article talking about exactly those thinking issues: https://www.tested.com/tech/gaming/2712-why-perfect-hardware...
Re: Goboy: Multi-Platform Nintendo Game Boy Color Emulator Written in Go
#14I’ve often thought of writing my own emulator for the NES or GB/GBC to learn a little about how emulation works on a more fundamental level. I understand a lot of it is the process of translating machine code from, say, the GB processor to x86, but I’d love to learn more!
Most people suggest working on a "toy" system, such as Chip-8 first. It is a mythical processor, rather than based upon real hardware. That said there are only a handful of opcodes to implement, and it does support graphics.
https://en.wikipedia.org/wiki/CHIP-8
There are ROMs out there for pong / space-invaders / etc, so you can play real games pretty quickly.
Of course there is nothing stopping you jumping straight into NES/GB/whatever. NES is easy to get started with, the others less so because of bank-switching, etc. But if you're patient you can manage it :)
Re: Goboy: Multi-Platform Nintendo Game Boy Color Emulator Written in Go
#15How would someone begin to work on something like this?
Or you can just cheat, design a "toy" instruction set, and write something to process it. A couple of years ago I did that, in C/Perl:
* https://github.com/skx/simple.vm
Later I rewrote the interpreter/emulator in go:
* https://github.com/skx/go.vm
The downside with my approach here is that I ignored graphcs, sound, & I/O.
These days I'd recommend you write an emulator for the Chip-8 system..
Re: Goboy: Multi-Platform Nintendo Game Boy Color Emulator Written in Go
#16Who the hell cares?
Re: Goboy: Multi-Platform Nintendo Game Boy Color Emulator Written in Go
#17> written in Go Who the hell cares?
Re: Goboy: Multi-Platform Nintendo Game Boy Color Emulator Written in Go
#18Re: Goboy: Multi-Platform Nintendo Game Boy Color Emulator Written in Go
#19I’ve often thought of writing my own emulator for the NES or GB/GBC to learn a little about how emulation works on a more fundamental level. I understand a lot of it is the process of translating machine code from, say, the GB processor to x86, but I’d love to learn more!
For me the GB was a great entry point in learning about emulators as is is fairly simple compared with some other consoles. Even if you're not going to make an emulator some of them are still great reads - I've put a few resources I used on the GoBoy page: https://github.com/Humpheh/goboy#resources
Re: Goboy: Multi-Platform Nintendo Game Boy Color Emulator Written in Go
#20Earlier quoted context omitted.
My recommendation is to start with the CPU emulation. The CPU in the Gameboy has decent documentation and there are plenty of implementations to look at if you're stumped. (One I like particular is the core in Higan, a multisystem emulator written in C++.)
I remember seeing some people recommend starting with the NES rather than the Gameboy - any ideas on this?