There oughta be a Game Boy capture cartridge
there.oughta.be
there.oughta.be
This is probably my favourite link this year.
I should probably set aside more of my time to waste on something pleasurable and useless.
Particularly Reverse Emulating the NES and Harder Drives are good examples of this.
I like that he takes something familiar - and goes sideways with it such that you could have thought of that, but probably wouldn't have "explored that space" mentally.
I'm surprised that it apparently works so well (most of the time, for many games) without knowing the state of inputs, just relying on conditional branching. I would have expected a lot of code to just manipulate registers based on inputs and use those to send different PPU commands.
I wonder if you could achieve 100% parity (and audio) without modification of the console by doing all the emulation in the capture card. Send some pre-built ROM to the console which just reads inputs, sends them back to the "cartridge" and then reads back video output from the emulator.
The same author already made https://there.oughta.be/a/wifi-game-boy-cartridge and https://there.oughta.be/gta5-for-the-game-boy so it seems technically feasible :)
Edit: Ah I see the video stream cartridge runs at 20fps, but gameboy games can run up to 60fps. I suppose that wouldn't work for the original purpose of streaming tournaments.
However, I guess that is a problem for arbitrary video where you have to be able to completely swap out the tile map on each frame (actually 2x/frame). For a GB game you could only swap the tiles/sprites that have actually updated and send over info what to redraw.
So potentially possible I guess? Someone should do the instruction count / bus bandwidth math.
Maybe some games don't have time for that, but I'd guess most do. If you have execution bandwidth for that, you probably have execution bandwidth for straight line code that only does the PPU per frame work, because the emulator did all the cpu work and ran ahead (hopefully)... Of course, when PPU work happens midframe, timing gets real important and that may be tricky.
Anyway, sounds pretty fun.
So it's a software RNG, and the user input is pretty much the only "random" thing coming in from outside. This is very common for games. It still is: Games like Civilization often let you specify the seed to initialize their software RNG with, so you or someone else can replay the exact same game.
I worked on a Game Boy related project recently and, similar to you, was surprised at how heavily the Game Boy uses the cartridge ROM. If I remember correctly, it makes on the order of thousands of requests to the ROM per frame.
So every single instruction being executed, you will see on that bus. And every instruction hopefully serves to either build up the current frame, or do game logic for later on.
Nothing stopping a developer temporally copying code out of ROM to minimise bank switches or because they want to implement an algorithm with self-modifying code.
But that isn't actually a problem for this approach, because the CPU still puts the address on the cartridge bus even when it's accessing internal RAM, and you can still monitor which addresses it accesses to tell which way it's branching, even when executing from RAM.
- video passthrough (like this one, obviously)
- serial console debug output (framerate ? CPU ? sprite count ?)
- secondary video output of sprites - perhaps with a palette of all sprites and an array of sprites actually on-screen ?
- tertiary video output ???
I make no claim that any of the above would actually be useful.
I'm thinking about this as a development tool from an alternative timeline that never existed here ... and specifically, a standalone development tool that doesn't require a PC tied to it with a SCSI cable like the SN Systems and (other carts) did.
You're much less likely to be in this situation today, because (as you said) modern emulators are very accurate. But this is only because people spend enormous amounts of time reverse-engineering the original hardware and running test cases to find the weird quirks and obscure corner cases. For these investigations, some kind of debug cartridge could be invaluable.
Another reason for debugging on original hardware is simple convenience. Speedrunners usually prefer original hardware (or FPGA recreations) because emulators introduce input latency (which is very noticeable and makes a huge difference for high-level players). I speedrun Super Metroid for the SNES, and I often load the game into a debugging emulator to investigate strange behaviors or glitches. It's kind of annoying to have to switch from my nice FPGA setup that I use most of the time, to my laggy computer emulator that I use when I want to investigate something. But the community has already developed hardware and software that supports reading and writing the console's memory in realtime over USB, and this functionality is available on the most widely-used flashcarts. Adding support for simple breakpoints and a hex memory editor/disassembler would be a fun and relatively straightforward software project, and a nice quality-of-life improvement, so it's something I'm hoping to work on when I have the time.
I just want a SNES with serial console output and a dedicated sprite monitor ... just for the sake of it.
> This together with the overhead of emulating an 8-bit CPU on a 32-bit CPU made it necessary to overclock the rp2040 from its default 125 MHz5 to 225 MHz. The rp2040 can usually handle this without any problems, but still I would love to see if someone can improve the efficiency of my code to dial this back a bit.
It wasn't clear to me if this was because of the code, or because of the environment.
For the latter it helps to have a dedicated chip doing the emulation, without being burdened by a multitasking OS that rudely interrupts you at all times. Does not have to be an FPGA implementing the Gameboy CPU, could also be a normal boring CPU that dedicatedly does the emulation (it has to be fast enough, but >200MHz seems overkill).
Alternatively, maybe proper use of realtime threads helps already.
Was this used in a tournament? How was it received by the competitors?
I want a floppy disk form factor with a storage chip inside. As an added bonus, it should have an e-ink screen for labeling.
https://www.ibm.com/products/3592-tape-cartridge
https://www.ibm.com/docs/en/ts11xx-tape-drive?topic=STPRH6/c...
getting a single company to produce hard-drive docks / adapters that stack together for 10+ years consistently is another story...
Would your device work with a Game Boy Camera?
I have an unrelated question. I was never very good at the physical hardware part of things (i.e. enclosures, plastic, etc), and I noticed for example in the video you appeared to be "sinking" a little screw nut into plastic. What is this process and how did you learn how to do it? If anyone can ELI5 because I'm a total newb at this.
"A few months ago a Tetris enthusiast got in touch with me about this problem: An online Tetris tournament during which the contestants stream their gameplay."
I don't see how an online Tetris tournament during which the contestants stream their gameplay is a problem.
I know what they're saying, it's just worded strangely. The actual problem is that didn't know how to stream the game, but that's actually not a problem either; they just wanted to stream their game, which is a desire.
The fit and finish of the video is wonderful. Please make a meta-video-video OP!
I think this should be "Links Awakening".
Side note, something like this could _almost_ be used to implement multiplayer gaming for things like multi-world randomizers (see https://www.youtube.com/watch?v=2VJ21rQ4L2U for an example on SNES).
I would love to see a possibility to record / dump the whole datastream as such in a file. This way it would be possible to improve the video emulation afterwards and it would be a gold mine for emulator developers analysing these dumps to fix bugs and understand the process of data transfer.
That said though, emulating it on the pi is way more impressive.
Sure, USB and a typical desktop-class CPU are easily fast enough to handle the bandwidth requirements, but I don't think you could safely uphold the latency requirements in order for the emulation to run well. There I said it, now some crazy h4cK3r can prove me wrong, and everyone wins! :)
[1]: https://en.wikipedia.org/wiki/Real-time_computing#Criteria_f...
To do what you propose, you'd have to open it up and add hardware hooked in to the connection that goes to the LCD. Someone's probably done that somewhere; it's a different scope than the project here.
Probably not though. For starters, the interface to the LCD is most likely parallel, and you have to be really lucky for them to be discernible over unintentional coupling.
For example, it could still work if the individual digital signals have slightly different phase and amplitude, in which case what you get from the cartridge pins is "just" quadrature amplitude modulated multiplexing of all pins. And you'd need some high quality test equipment to sample that...
I envy the hardware skills