r/EmuDev • • 1h ago

Readable Game Boy code base

1 Upvotes

Please suggest me some readable Game Boy emulator code bases.

I'm planning to make a DMG-01 emulator and I would like to read some good code.

Since I'm learning here, the primary objective is for the code to be understandable.

The programming language should not be an issue.

Just to give you some idea of my current emulation experience:

I've done a Chip-8 emulator some time ago:

https://github.com/netb258/clj8

I've also done this Master System / Game Gear project:

https://github.com/netb258/defn-system

However, this one uses an external Z80 CPU library.

I'm hoping to go full circle with a DMG-01 emulator.


r/EmuDev • • 22h ago

a DS emulator in python (is bad)

Post image
2 Upvotes

i switching to c++

is very bad


r/EmuDev • • 1d ago

r64m: an x86-64 → arm64 user-mode emulator in Rust, with every instruction checked against a real Ivy Bridge

Thumbnail
reddit.com
0 Upvotes

r/EmuDev • • 1d ago

Virtual arcade machine from the 80s

Thumbnail 1981.games
0 Upvotes

Common 1981 graphics hardware emulation (tiles, sprites, hardware scrolling). For writing new games in a simple environment. 4 examples running in the website, adding multiplayer to my favorite 1981 games. Compiled to webassembly and webgpu, but it also compiles natively for Linux, Windows, MacOS, iOS and Android.
RooRoo.Racing graphics are still from the 8088 CGA PC version that I was working on.


r/EmuDev • • 2d ago

I'm building an 8-bit / 16-bit hybrid computer emulator with its own custom architecture and language, called Oblivion64.

9 Upvotes

Written in pure C using the Windows API with no external libraries, and because I like the palette, it uses the Gruvbox palette.


r/EmuDev • • 3d ago

Added sound to my GameBoy Color emulator I wrote in pure Python

15 Upvotes

AI disclaimer: This project is fully handwritten. AI was only used for debugging and disassembly of ROM's.

Hello fellow emu devs, today I wanted to showcase my GBC emulator I wrote with pygame. Although I must admit that it is not complete, sound continuities are present along with some pops but it generally works. To achieve real time sound with the GBC, especially at double speed mode took some optimizations (and using the pypy JIT 😋). Firstly, my emulator is not cycle accurate. It is instruction stepped. I took this further and used lazy sync for the APU. Basically APU is "flushed" only at a fixed number of batches like 215 cpu cycles or when anything is written to the sound registers. This is my first serious emulator project and honestly the architecture cheats a lot but seems to be functional at the moment. I plan on trying to emulate RTC cartridges with batteries (RTC ticking when the cartridge is off) then serial linking via LAN! It has been an awesome project though. I have learned enormous amount of stuff. Oh and the source is at https://github.com/atifcodesalot/hazelnut-gb-emu, inspect the source or clone it and play some GBC! Enjoy!


r/EmuDev • • 6d ago

Emulation on Roblox

Thumbnail
reddit.com
2 Upvotes

r/EmuDev • • 8d ago

Gameboy DMG01 HALT bug explained

0 Upvotes

I've ran into the halt bug while developing a web based game boi emulator in Rust. I don't understand AI's explanation:

Right now execute_halt (src/cpu/operations/control.rs:111) treats "IME clear + interrupt already pending" as a plain NOP. On hardware that combination triggers the HALT bug: the CPU doesn't halt, and PC fails to increment after fetching the next opcode — so that byte gets read twice. HALT; INC A runs INC A twice. For a multi-byte instruction it's nastier: in HALT; LD A,$14 (bytes 3E 14), the operand fetch re-reads the stuck 3E, so you get LD A,$3E and execution resumes at the 14 byte, which is decoded as a fresh opcode.

The clean fix in your architecture (operand reads are all pc + 1-relative) is a one-byte PC rewind at fetch time:

with PC rewound by one, every operand read (pc + 1) lands back on the opcode byte — exactly the hardware's duplicated read — and next_pc = pc + length resumes one byte early, which is also what hardware does. It even gets the HALT; CB .. case right (the CB byte doubles, decoding as SET 1,E). One thing to update when you do this: the test at tests/cpu/control.rs:729 currently asserts the NOP approximation, so it will need to assert the double-execution instead. No urgency — Blargg's cpu_instrs doesn't need it; only the dedicated halt_bug.gb ROM does

I don't understand the nature of the bug and I defo don't understand why decrementing the PC fixes it. HELP!


r/EmuDev • • 10d ago

GBA Can't call subroutine from a linked in object file in GBA assembly

Thumbnail reddit.com
3 Upvotes

r/EmuDev • • 10d ago

A New C/C++ SDK for the NEC PC Engine

2 Upvotes

I've been working on PCE SDK, a development environment designed to make homebrew development for the NEC PC Engine easier.

The idea is to provide a complete C/C++ development workflow, bringing together compilation, graphics tools and music integration.

Some of the features include:

  • C/C++ development for PC Engine.
  • PNG and Aseprite graphics support.
  • Tiled integration for maps and levels.
  • Furnace integration for music.
  • HuCard, SuperGrafx and CD-ROM² support.
  • Playable examples directly in the browser.

I'm building this project because I enjoy retro console development and wanted to make creating new games for this hardware more accessible.

You can explore the SDK and try the examples here:

https://anatagawa.fr/pce/

I'm curious to hear from other PC Engine developers.

Feedback and suggestions are very welcome!


r/EmuDev • • 11d ago

Five years later: _something_ works in my IIgs

9 Upvotes

The title isn't hyperbole; I first started my IIgs in October 2020.

It's always been a bit of a back-burner task though: documentation on the memory layout and some of the other Apple-specific decisions is ambiguous enough that when you combine that with a brand-new implementation of the 65816 and with the fact that nothing is high-level emulated even down to the keyboard sitting across a wire-by-wire ADB bus, every minor issue always had a long candidate list.

So it's been a case of an occasional minor fix here, an occasional minor fix there, and finally a first mostly-working piece of software more than half a decade later. Even now I've naturally picked one of the flattering titles. Quite a lot of the rest doesn't work.

Some fun recent fixes that helped to move the needle:

  • timers weren't actually advancing on my ADB microcontroller, so it was collecting keypresses but not passing them on to the CPU;
  • the sound GLU and Ensoniq DOC, which I've implemented as a single thing and which is used by the system both for audio and for timers, were counting too quickly and hence over-interrupting the CPU; and
  • yet more of the usual 65816 stuff where e.g. being in emulation mode causes some instructions to stick to the 6502 rules about stack addressing but not others.

As an aside, all known outstanding issues with the 65816 test corpus have been fixed in the meantime. So jump on that if you have any interest.

Also part of my reason for doing the IIgs was to build out my ADB support in pursuit of doing higher-order Macs than the Mac Plus that I currently top out at. So it'll be nice to feel unblocked there.

The emulator itself though still have a multitude of issues so it'll remain an unpublished machine for the time being. Especially:

  • to do an accurate reproduction of the standard IIgs monitor you need to apply a 2d lowpass filter, which I do not currently have any support for;
  • the IWM loads very slowly for reasons as yet undiagnosed; and
  • it's still probably 50:50 on whether software will load, so clearly many other system-level bugs remain.

Regardless, for now now I'm going to enjoy being where I probably expected to be on this machine in early 2021...


r/EmuDev • • 12d ago

[Release] Virtual Infocom

Thumbnail reddit.com
2 Upvotes

r/EmuDev • • 13d ago

CHIP-8 Don’t delegate the fun away.

Post image
85 Upvotes

Got inspired by Gabe Sampson, thank you; Wasn't sure if I should post this, but I shared it in a small Discord server and got a few DMs from people who appreciated it. So here I am boring the rest of you with my "achievement".

The last few years have felt like constantly grieving. Something I fell in love with as a kid, spent most of my life getting good at, and was lucky enough to make a living from has lost so much of its value in just a few years. I know this might sound stupid to some, but it feels like losing a loved one.

I’ve accepted using AI for work, and I’m grateful I got to earn a living doing something I loved for so many years. It’s a privilege most people never had in the first place.

But this stupid AI era has made doing what I once loved feel like a waste of time. I no longer felt accomplished and never really understood why I kept pressing the “easy button” to solve the hard (fun) problems the moment this button was shoved in my face.

If you feel even remotely the same, please try this. Have a project where you don’t use AI. Not for autocomplete, not for brainstorming, nothing at all.

And if you have no idea what the fuck I’m talking about, I’m genuinely happy for you.

Anyway, here’s my least favorite Chinese e-waste drawing a zero, one of its first signs of life. I did that, because I wanted to do it. It’s the least impressive thing I’ve built in over a decade, yet it gave me a sense of accomplishment I haven’t felt in four years.

It’s a pure AArch64 Linux assembly (GNU as syntax, AAPCS64) CHIP-8 interpreter for this piece of junk named an R36S (or any other RK3326 e-waste)

TLDR: Don’t delegate the fun away, that’s your job.


r/EmuDev • • 14d ago

Pippin emulation on RPI4 and RP5

4 Upvotes

Hi Everyone - I've been working on getting the Bandai Pippin emulated on a RaspberryPi 4 with my Retropie setup.

Specifically, I'm using a combination of DingusPPC and SheepShaver's JIT with modifications to get this running full speed. Right now it works on my Pi-4 based RetroPie setup, and I'm working on RaspberryPi 5 support.

It works beautifully so far, with my testing. Work continues, but if anyone wants to give this a try, below is the link to my fork.

https://github.com/mathan416/dingusppc-pippin/


r/EmuDev • • 14d ago

I built an emulator for my cyberdeck

Thumbnail reddit.com
1 Upvotes

Since emudev is all about emulators, I should not that this is technically a simulator and not an emulator. The apps for this platform are built around a high level interface, so that they can run efficiently on other platforms. The simulators can support this higher level interface, without needing to emulate specifics of the hardware (armv7a in this case).

I'll probably build a proper emulator in the future to more faithfully recreate timing and other hardware peripherals.

I thought folks here might find it interesting, let me know what you think.


r/EmuDev • • 15d ago

NES Emulator, WEB / ANDROID ...saves compatible between devices

0 Upvotes

Hey guys,

Project started in 2023.

www.vajnes.com

There is an android version on the playstore, i will try and get an iOS version out ASAP.

Would appreciate feedback on adjustments to the UI, bugs etc. etc.

Being an older bloke at 38, and having grown up on this system and owning and using it through multiple generations (upgraded to a toploader when the side loader was too far gone) I've been around in regards to emulators and so forth, so I've tried to make it the best emulator possible.

Try the web version with a custom retro effects set up, then fullscreen with aspect ratio maintained.
I am sure you'll be impressed.

Project was hand coded up until around 80%, I started losing interest in sometimes spending hours upon hours debugging failing ROM tests, I was on 99 passes in accuracy coin and could probably have had more debugged and passing manually.

In the end AI became advanced (July this year) and I tested it out.
I told it I didn't want the audio in javascript and to use webasm / C++ and it nailed it straight away.

The audio was already there to process, without an actual output engine.

In the end all my bandaids on the PPU weren't quite enough to have 100% of PPU accuracy and when checking the code astra seems to have changed that quite extensively, though it still uses my scanline LUT and all my variables and architecturally runs the same.

For people asking how to start on an emulator, I started (and stopped) a mini series on my next EMU

https://www.youtube.com/watch?v=7YJJClK9BkU&list=PLU-a7KxRv5ao&pp=sAgC

I will try and get back into this eventually.
Thing is the Z80 becomes an audio co processor in the next generation (MD / Genny), so upon completion, it simply becomes 'part' of a megadrive emulator.


r/EmuDev • • 15d ago

Video I've been working on a Vectrex emulator for iOS and Android, with a special surprise: Star Wars arcade with gyro controls!

Thumbnail
youtu.be
5 Upvotes

Hello everyone!

I've been developing Vactrex Emulator, a mobile emulator dedicated to the Vectrex. It supports the Vectrex game library, and I've also been creating original games for it.But there's something else I think this community might appreciate.

I've implemented the original 1985 Atari Star Wars arcade game and The Empire Strikes Back, using the phone's gyroscope as the flight controller.

You physically tilt your phone to control the ship. It actually works surprisingly well and makes these classic vector arcade games feel right at home on a mobile device.

Current availability:

  • iOS: Available now on the Apple App Store as Vactex Emulator.
  • Android: Currently in testing.

I'm giving awa 100 codes for free to this comunity. If you're interested, send me a private message with your email address and I'll add you to the testing list and give you your free code.

This is an independent project, and I'd appreciate feedback from people who actually know and love vector gaming.

NO ROMS ARE PROVIDED AT ALL YOU NEED TO PROVIDE YOUR OWN ROM.

Thanks for checking it out!


r/EmuDev • • 15d ago

Nintendo 64 finally running on Symbian s60v3!

Thumbnail gallery
4 Upvotes

r/EmuDev • • 17d ago

Extended my GB emulator built in pygame, python to GBC

13 Upvotes

AI disclaimer: AI was used only for debugging and disassembly, no AI generated code was used ever, and no agentic code as well

Hello everyone, today I wanted to showcase my GBC emulator that I derived from my earlier GB implementation: https://github.com/atifcodesalot/hazelnut-gb-emu. It was a fun (and buggy) experience. The pypy runtime gracefully shouldered the double speed mode! It is also backwards compatible with the GameBoy. Did you know that the DMG compatibility mode introduces actual three new palettes for the original DMG games? Anyways it currently supports MBC 1, 2, 3 and 5. I have no idea how to implement MBC7 for the Kirby Tilt 'n' Tumble 😭 not because of the EEPROM but also the accelerometer emulation. Also, still working on the sound! I also plan on implementing serial functions for LAN play (hopefully). What do you think? Would love to discuss technical stuff and implementation details! Enjoy. Oh, and don't forget to clone the repo and play some stuff yourself I recommend Pokemon Yellow


r/EmuDev • • 17d ago

GB Getting Past Intense Burnout

21 Upvotes

Hello, I have been working on a Game Boy emulator in C for about 3 months now. This was my first largescale project in C, as before I did all my projects in C++ and really enjoy C++, specifically for graphics which is my other interest. However, having just graduated college and being more practical, my other passion is low level systems/computer architecture/embedded systems (I kind of lump them all together). Thinking that an emulator would be a good project, and deciding C would be a good language to do it in as I have a bit of exp (not near as much as C++) and is more useful in embedded which is a more practical career field than graphics and another one of my interests, i hit the ground running.

for about a month or 2 i did nothing but code on this emulator. Getting the instructions to execute correctly was my main thing at first, then setting up the bus, connecting the CPU and the Bus, and once I passed all of Blargg's test roms for almost all CPU instructions, I switched gears to the timers and interrupts so that I could pass test 02-interrupts, the only one that wasnt passing (because its timers and interrupts).

However, having feeling very accomplished already, I decided to take 2 weeks off before Halloween to play resident evil and chill and watch horror movies. The day after halloween I went to work and on my lunch break opened up my laptop to do some coding. But I just couldn't get anywhere! I was trying to remember what all my code was, and I guess I am just so used to programming in C++ where its easier to structure code with classes that I was just lost, even though my code honestly isn't that bad ( i dont think). Same thing the next day, and the next. 4 weeks later and I just cannot get anything done now and I have completely lost my momentum. I dont know if I am just really bad at structuring code in C or if this is normal in C, or if maybe im just at a very difficult part in the emulator (failing on HALT), but I have lost any and all momentum.

Anyways, here is the repo:

Arden-Stanley/game-boy-emulator: Implementation of my own GameBoy emulator

If anyone has any tips on how to prevent burnout or just how to do better with my structure in general, please let me know because I feel like im losing my mind.


r/EmuDev • • 19d ago

Elppa: An Apple I Emulator that Runs in your Browser

Post image
2 Upvotes

Earlier this year, I developed an instruction-level accurate MOS 6502 CPU emulator in C# called Velutia as a learning project. A few months ago, I decided to use it as the basis for Elppa, an Apple I emulator.

Using Blazor WebAssembly for the front-end, Elppa is hosted on Azure Static Web Apps and supports both desktop and mobile. It comes pre-loaded with some games, and you can also write your own programs in either Integer BASIC or machine code.

Give it a try here:

https://elppa.markjames.dev


r/EmuDev • • 20d ago

Video Diablo running on a real Nintendo 64 — DevilutionX port (kestrel64-sdk)

Thumbnail
youtu.be
6 Upvotes

Hi! This is DevilutionX (the open-source Diablo engine) ported to the N64 with kestrel64-sdk, a bare-metal SDK I'm writing from scratch (own RSP microcode, no libultra/libdragon).

Filmed off the TV on a stock N64 + Expansion Pak, booting from a flashcart. Tristram, the cathedral and the first fights, with music and sound.

It's work in progress. No ROMs or game data are distributed: you need your own copy of Diablo.

Happy to answer technical questions!


r/EmuDev • • 21d ago

Open Source - Sega Model 1&2 emulator

Thumbnail
github.com
5 Upvotes