I always like to read (when I can find the time) different ways of programming since it helps you think differently when approaching new problems for normal programming task.
Since programming an emulator is not what I would call "traditional business programming", there must be some concept or approach used that could be interesting to read or to learn from it.
There as been a surge of aspiring emulator authors these days and it got me in the mood to read some code related to this but with no intention to built an emulator myself (no time for that). Any specific emulator code that would make and interesting read? I want to see approach done procedurally or in OO, if that's can be applied for this (but cannot see how yet, one of the many reason I want to read some code).
- Well, mine would be the best choice for a single reason: it's easy to read, more human readable. It's compact and not cryptic like many others around. Anyway, be clear: that's my opinion. Perhaps it's quite different.
If you provide your code under some kind of
NDA (since it's not open source), I will be more than happy to read it
When I read the code to Loopynes, I saw that it looked very similar to PocketNES.
Dwedit wrote:
When I read the code to Loopynes, I saw that it looked very similar to PocketNES.
- Loopy & Flubba work together. ^_^;;
I guess I will take as an answer that none of the existing code is really worth to read. Oh well. Will browse some of them when I can find some time.
You can try nestopia for a full blown OOP based design. Everything is in a namespaces and in classes or so. In fact, so much it's basically a fortress in trying to figure out what some stuff do
Banshaku wrote:
I guess I will take as an answer that none of the existing code is really worth to read. Oh well. Will browse some of them when I can find some time.
- PM me with an e-mail and I'll send it.
Whenever I've needed to know what PPU events happen at which PPU cycle, I look at Nintendulator's source code first. Its PPU source code is arranged so that you can very clearly tell which cycle the scroll increments at, which cycles have memory accesses, etc.
I would look at Sega Li/FCEU/Nintendulator/LoopyNES (/there's another I forget written entirely in assembly for Win32!) which are all light emulators and mostly straight forward. I worked on an emulator that would have been great for this because it was <1000 lines of C, but I delete things out of perfectionism :)
I find Nestopias source extremely well written, but its architecture may occasionally be rather complex. Certain parts make use of advanced C++ features, making it difficult to comprehend at first, at least for someone with my humble C++ experience.
Nintendulator, virtuanes and fceu are all pretty straight forward and should be easy to read.
kyuusaku wrote:
there's another I forget written entirely in assembly for Win32
That sounds like mine:
http://nessie.emubase.de
It uses special asm syntax, people around here seem to be more familiar with C++
But if you prefer something other than C++, how about javascript?
http://benfirshman.com/projects/jsnes/
Nessie wrote:
That sounds like mine:
http://nessie.emubase.deIt uses special asm syntax, people around here seem to be more familiar with C++
Exactly! :D
Nessie wrote:
That sounds like mine:
http://nessie.emubase.deIt uses special asm syntax, people around here seem to be more familiar with C++
Little bit off-topic here: I tried your emu and it eats 100% CPU when running (50% on dual core of course). You probably want to look in to that.
thefox wrote:
Little bit off-topic here: I tried your emu and it eats 100% CPU when running
Some game programming libraries spin-wait for vertical blank instead of releasing the CPU.
Nessie wrote:
I find Nestopias source extremely well written, but its architecture may occasionally be rather complex. /
For Nestopia, I did a quick peek in the code and it's quite overwhelming at first. I don't really know C++ but know some other language that use OOP and the sheer amount of files inside makes it hard to check were to start.
The code is well write for the form but there seems to be no comment at all inside the code, just in the header files. But the no comments part seems very common to many source I saw.
@kyuusaku:
I will give them a look once I can find some time.
thefox wrote:
Nessie wrote:
That sounds like mine:
http://nessie.emubase.deIt uses special asm syntax, people around here seem to be more familiar with C++
Little bit off-topic here: I tried your emu and it eats 100% CPU when running (50% on dual core of course). You probably want to look in to that.
Yeah, I know. It calls Sleep(0) in a loop while waiting for the sound buffer to become available. That should probably be Sleep(10) instead.