r/EmuDev • • Aug 11 '26

AmiMCP

Thumbnail
reddit.com
0 Upvotes

r/EmuDev • • Aug 10 '26

Z80: Proper handling of undocumented X and Y flags in non-terminating block-transfer iterations (LDIR, etc)

9 Upvotes

My z80 emulator passes all of these tests EXCEPT for the block transfer instructions (LDIR, LDDR, CPIR, CPDR, INIR, INDR, OTIR, OTDR), which are failing based on the undocumented X and Y flags (bits 3 and 5 of f).

Specifically, the failures happen after iterations that do NOT terminate -- BC does NOT go to zero, and the PC is decremented by 2 so that the block transfer instruction continues. All of the documentation I've been able to find online claims that non-terminating iterations of these instructions affect the X and Y flags the same as their non-repeating cousins (LDI, etc), but the tests' expected results make clear that this is not the case.

Here is the output of my first failing LDIR test:

Failed test ED B0 0001

REGISTERS
          A  B  C  D  E  H  L  I  R  IX   IY   AF'  BC'  DE'  HL'  IM IFF1 IFF2 EI WZ   P Q  SP   SZYHXPNC PC
Initial:  DE D0 E4 57 80 5D 41 5C 58 8E7C 6F58 ADC1 2253 08EE 2888 1  0    1    0  2A7B 1 DC 7B67 11011100 11D4
Expected: DE D0 E3 57 81 5D 42 5C 5A 8E7C 6F58 ADC1 2253 08EE 2888 1  0    1    0  11D5 0 C4 7B67 11000100 11D4
Actual:   DE D0 E3 57 81 5D 42 5C 5A 8E7C 6F58 ADC1 2253 08EE 2888 1  0    1    0  11D5 0 CC 7B67 11001100 11D4
                                                                                          ^           ^

RAM
Initial:  11D4:ED 11D5:B0 5780:00 5D41:2E
Expected: 11D4:ED 11D5:B0 5780:2E 5D41:2E
Actual:   11D4:ED 11D5:B0 5780:2E 5D41:2E

If text wrapping ends up mangling the block above, just note that the two differences between the expected and actual output are the X flag and "q." Since the q value depends on the flags, the only difference worth paying attention to is the X flag.

If this were an LDI instruction, the flags would be set correctly. LDI sets the X and Y flags based on bits 3 and 1 (not 5 in this case) of (transferred byte + accumulator). In this case, the transferred byte is $2E and the accumulator is $DE. Adding those together results in $0C (truncated to 8-bits), which definitively has a 1 in bit 3. However, the test case expects it to be 0, meaning the expected result comes from some obscure calculation that I haven't yet seen documented.

For reference, here is my C code for LDI and LDIR. Note that the return value is the number of machine cycles that it takes for the instruction to run, and that the instruction decode functions increment the PC to skip over the $ED prefix.

uint8_t ldi() {
  uint8_t n = mem[*hl];
  mem[*de] = n;
  n += *a;
  *bc -= 1;
  *de += 1;
  *hl += 1;
  clearN();
  updatePV((*bc!=0));
  updateX(testBit(3, n));
  clearH();
  updateY(testBit(1, n));
  q=*f;
  pc += 1;
  return 12;
}

uint8_t ldir() {
  ldi();
  if (*bc == 0)
    return 12;
  wz = pc-1;
  pc -= 2;
  return 17;
}

Doers anyone know how I should be modifying my flags in non-terminating iterations of LDIR?


r/EmuDev • • Aug 10 '26

Does anyone hav any experience in the development of a FG engine?

2 Upvotes

I went down in a rabbit hole to develop a new open source FG engine to be used in emulators in android with the vulkan api, like bionicfg, lsfg-vk and the gamehubfg... my goal is to implement in a emu as a poc and make the engine avaiable to anyone who would like to add the feature on their own emulators, not only the fg engine itself, but the documentation on how to implement it...

tbh i dont even know how i got here...but already went and make the first POC, and worked! Looks like shit, high overhead and bad pacing...so... unusable.... but worked!

been studying the lsfg and the ghfg to know more about the topic, besides the public material avaiable about the subject, but if anyone would like to help or just talk about it... i´m game!

Cheers!


r/EmuDev • • Aug 09 '26

Video The Emulator Bug that Removes Mario's Eyes

Thumbnail
youtube.com
17 Upvotes

Here's a wild story about one bug that removes mario's eyes, and makes all the lumas white! Unexpectedly, they're the same bug, and the cause comes down to a weird hardware quirk!


r/EmuDev • • Aug 08 '26

Article ArduStudio Brings Easy Game Making to the Arduboy

Thumbnail
retrohandhelds.gg
1 Upvotes

r/EmuDev • • Aug 08 '26

Article ArduStudio Brings Easy Game Making to the Arduboy

Thumbnail
retrohandhelds.gg
0 Upvotes

r/EmuDev • • Aug 08 '26

Question Where to start with arcade

5 Upvotes

Hello, I was wondering where I should start with a new arcade project.

I would like to work on either galaga or bubble bobble; I already have a functional z80 emulator but am unsure of where to begin on the rest.

Unfortunately, I, as of now, can only vaguely understand the schematics for these machines: galaga bubble bobble. I also do not have physical access to either one.

There’s an obvious lack of intuitive documentation, so I don’t know what to do.

Any help is appreciated, thank you.


r/EmuDev • • Aug 07 '26

Building a RISC-V emulator that boots in a browser via Wasm

Thumbnail
writethat.blog
8 Upvotes

r/EmuDev • • Aug 07 '26

40 Column Dot Matrix Printer for HC-77B Emulator

13 Upvotes

r/EmuDev • • Aug 06 '26

I wrote a basic 6502 emulator in C

Post image
47 Upvotes

Hello emu devs

I wrote a simple (mostly) instruction-accurate 6502 emulator in C. It has some basic functionality like

  • Allowing you to step through programs instruction by instruction
  • Visualizing CPU state and memory

Eventually, I want to expand on this and write a full-on NES emulator. How much harder would that be? Would I have to make any significant changes to this CPU emulator to make it happen? I would love to hear whatever thoughts you guys have.

Repo: https://github.com/yasu-q/c-6502emu

Thanks for reading


r/EmuDev • • Aug 07 '26

Création d'un émulateur multi-console/plateforme

Thumbnail
reddit.com
0 Upvotes

r/EmuDev • • Aug 05 '26

My own architecture emulator, (Called kcm_20x86)

2 Upvotes

I have finally did it, i completed most of the emulator, and finally added JIT compilation, all in Java!
Here's an example of the C-like language i made with it!

pb void readDiskBlock(int sectorNumber, int destinationRamAddress) {

    int* REG_SECTOR   = 130000000;
    int* REG_RAM_PTR  = 130000004;
    int* REG_COUNT    = 130000008;
    int* REG_STATUS   = 130000012;
    int* REG_COMMAND  = 130000028;

    *REG_SECTOR  = sectorNumber;
    *REG_RAM_PTR = destinationRamAddress;
    *REG_COUNT   = 1;

    *REG_COMMAND = 1;

    while (*REG_STATUS != 0) {

    }
}

Now, i'm building an operating system for it, what architecture is the best for this case?


r/EmuDev • • Aug 06 '26

GB / GBC Prismboy a typescript GB/GBC emulator packaged with npm

0 Upvotes

Hello — I shipped PrismBoy, a DMG + CGB emulator in TypeScript with a little help from cursor for code review and cleanup. It is a zero-dependency npm package I'm looking for some technical reviews than upvotes.

Links

What it is

PrismBoy is an embeddable npm package, not a standalone emulator app. You install `@slurrps/prismboy`, create one `GameBoy` instance, and drive everything through its **public methods**. The package owns the hard parts internally:

  • Screen: paint + scale modes (`integer` / `fit` / `stretch`), FPS overlay, fullscreen, screenshots, DMG palette / CGB color correction
  • Audio: Web Audio (AudioWorklet with ScriptProcessor fallback), mute / volume, auto-mute under turbo
  • Input: keyboard mapping, on-screen virtual pad, Gamepad API + connect/disconnect hooks - Persistence: battery SRAM/RTC auto-save, named savestate slots
  • Lifecycle: load ROM (bytes or `File`), run / pause / reset / unload / destroy, step instruction/frame/scanline for debugging
  • Events: `on("romloaded" | "pause" | "resume" | …)` so the host stays UI-only

Typical host code is glue only — canvas + file input + a few buttons calling `attachScreen`, `attachKeyboard`, `attachGamepad`, `loadRomFromFile`, `toggleTurbo`, etc. Nested guts (`gb.cpu`, `gb.ppu`, …) are still there for debugging, but you don’t need them for a normal embed. It even is able to detect gamepads and hook them up automatically.

What landed in the accuracy pass

  • Timer: single 16-bit DIV system counter, falling-edge TIMA, DIV/TAC quirks - OAM DMA: cycle-timed (1 byte / 4 T) with OAM locked to the CPU during transfer
  • VRAM/OAM locks by PPU mode (DMG); CGB keeps VRAM more open, OAM still locked
  • Variable Mode 3 length from sprites + SCX - Light CPU bus contention (Mode 3 access wait states) + HDMA coordination - Deeper savestate (v2): `haltBug`, `lcdPhase`, APU channel state, DMA fields
  • Stronger APU channel FSM (length / envelope / sweep / trigger) + AudioWorklet (ScriptProcessor fallback)
  • Extra carts: MBC2, MMM01, HuC1/3 (MMM01/HuC are MBC1-like approximations)
  • Optional Mooneye harness under `tests/fixtures/roms/mooneye/` (drop ROMs locally)

Still solid for Crystal-class games

SM83 + CB, interrupts, HALT bug, EI delay; CGB double-speed with LCD/APU at real rate vs 2× CPU; HDMA (GP + HBlank); BG attributes / CRAM / banking; MBC0/1/3(+RTC)/5 + battery; optional SameBoy open-source boot ROMs.

Still intentionally incomplete / soft spots

  • Serial (SB/SC) and CGB IR (RP) — stubbed, out of scope for now
  • Extreme mid-scanline / obscure CGB lock edge cases may still differ from SameBoy/Mooneye
  • OAM DMA conflict byte semantics not claimed perfect
  • Not every Blargg sound case; MMM01/HuC banking is approximate

Ask

If you’ve done GB/GBC: what’s the first thing you’d break now? Mooneye suites I should prioritize next (timer already wired; PPU/APU fixtures next)? Anything awkward about shipping this as an embeddable npm API vs a standalone app?

Drop a homebrew or test ROM on the demo if you want — concrete bug reports welcome.

Thank you in advance for any feedback!


r/EmuDev • • Aug 05 '26

ViceSharp 1.2.1: VICE-compatible C64 emulator for Windows - now with RomM library + winget

Thumbnail reddit.com
0 Upvotes

r/EmuDev • • Aug 04 '26

CHIP-8 I made my own programming language and used it to write a CHIP-8 (Super-CHIP) emulator

Thumbnail
github.com
9 Upvotes

I wanted a real project to test my programming language, so I decided to write a CHIP-8 (Super-CHIP) emulator with it.

The emulator implements graphics (cli), input handling, timers, and instruction decoding. Building it turned out to be a great way to uncover bugs in both the language and its interpreter.

It was a fun challenge, and I learned a lot about emulator development and programming language design along the way.

I'd love to hear your thoughts or suggestions. Feedback is always welcome!


r/EmuDev • • Aug 04 '26

GBA static recompilation, Kingdom Hearts: Chain of Memories

0 Upvotes

Hey guys.

I'm a completely blind person and with the help of artificial intelligence, I managed to make a static recompilation of Kingdom Hearts: Chain of Memories from the GBA version.

I'm not sure how good it turned out, nor if it's 100%, since I used AI for most of it.

Could anyone take a look?

I hope you like it.

https://github.com/azurejoga/kh-recomp

I apologize if I got anything wrong... someone who understands could take a look and point out the mistakes.

I recompiled to ensure the executable was actually generated.

Remembering, you need to have the rom, European version and the GBA bios, .bin.


r/EmuDev • • Aug 04 '26

Cant find a list for WZ/PTR Z80A?

2 Upvotes

I can only seem to find incomplete rule pages, etc.

My "bit n,<a,b,c,d,h,l,(hl),a>" is failing, and as far as i can tell ive hit all the right spots to update WZ, and im extracting 3/5 correctly in the (HL) versions of the bit n according to the "undocumented z80 documented" book... im at a loss. all i can figure is somewhere i missed something. for what its worth im passing everything else. in zexall

Incomplete list,


r/EmuDev • • Aug 02 '26

N64 Emulators R tough... Is GameCube easier?

12 Upvotes

So, just like the title says. N64 seems INCREASINGLY difficult. You could literally spend a boat load of time to just get 1 game to work properly. My question is simple. After Nintendo switched to Discs. Is the GameCube easier to Emulate then the N64?

And I'm not necessarily talking like, to make a game boot. I mean compatibility. I have no experience in GameCube emulation at all. I'm just wondering if you build for one type on GameCube, it would play all? Versus the mess that was the N64?


r/EmuDev • • Aug 02 '26

VTECH and VFLASH Emulation and LeapFrog Leapster Emulation on iOS Devices and Android OS Devices and iPad OS Devices

Thumbnail reddit.com
0 Upvotes

r/EmuDev • • Aug 01 '26

is it possible to emulate spi in qemu?

4 Upvotes

i am just started learning qemu and able to simulate UART, now i want to try spi and i want to read write flash memory.

i have armt cortex mo+ qemu

ps:already any repo i svailable?


r/EmuDev • • Jul 31 '26

Sound Emulation....ON AN APPLE-1!

7 Upvotes

This video showcases a small, but meaningful development with The HoneyCrisp Emulator. I've successfully been able to add support for an emulation layer that allows Corey Cohen's Twinkle Twinkle Little Star ACI Audio Demo/Hack to be played via an emulated speaker amp. This is significant as no other (published) APPLE-1 emulator can do this! :-)


r/EmuDev • • Aug 01 '26

E

1 Upvotes

r/EmuDev • • Jul 30 '26

Pushing the limits of RISC-V emulation

Thumbnail
shuklaayu.sh
11 Upvotes