TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

I wrote a GameBoy emulator for my hobby OS (2022)

282 点作者 codyd51大约 2 年前

8 条评论

Andrex大约 2 年前
I always upvote everything GB-related on HN. Keep it coming!<p>GB Studio, upvote.<p>Cool people writing their own emus, upvote.<p>Analogue Pocket, upvote.<p>My sincere wish is that one day Nintendo somehow, someway, open up legitimate Game Boy publishing for third-parties again. Release the patents, allow developers the use of the Nintendo logo in the one very very specific place it&#x27;s necessary to allow GB games to boot, etc. Maybe open sourcing schematics and internal docs.<p>But that&#x27;s as likely as them releasing a (new) Mario game on PC...<p>For me, the GB is that perfect middle ground between too arcane&#x2F;simple and too modern&#x2F;complex (both the design of the games and in the programming required). If the platform were opened, it would be kind of a &quot;forever console.&quot; It would obviously not compete with new systems or anything like that, so it would always be pretty niche.<p>It would be a fantastic educational tool to get kids into programming and game design at various levels.<p>Maybe in another 20-30 years...
评论 #36010580 未加载
评论 #36011855 未加载
评论 #36011191 未加载
评论 #36013976 未加载
grishka大约 2 年前
A few months ago I also built a GameBoy emulator with the intent of educating myself. It&#x27;s in Java and uses Swing for the GUI. It also supports sound but its implementation is definitely not ideal.<p>While most of the games I tested are playable, I couldn&#x27;t get SBC and ADC instructions to work correctly for all cases. I especially have no idea whatsoever how they&#x27;re supposed to affect the carry flags. Test ROMs aren&#x27;t very helpful either because the ones I used just ran the instruction with all possible combinations of input parameters, checksummed the results, compared the checksum to the expected value, and said &quot;duh, your thing is wrong&quot;. And Googling around wasn&#x27;t any more helpful. Since most of my childhood games ran fine anyway, I gave up. I&#x27;d still like to fix it eventually though.<p>That said, writing a video game system emulator is a tedious but rewarding experience. You just move bytes around and do an unhealthy amount of bit operations, and a game comes out. IMO every software developer should try writing an emulator at some point.
评论 #36012908 未加载
评论 #36017986 未加载
评论 #36010512 未加载
codyd51大约 2 年前
Hi HN, author here! The GameBoy emulator written up in this post runs on axle, which is a message-passing microkernel-based OS I’ve been working on for a very long time. dang suggested that I put together a Show HN for axle, which I’d love to do once I have a bit more time to get things into a working-out-of-the-box state!<p>axle is a really fun project for me, and serves as the testing grounds for all kinds of technical experiments. The bore-you-with-features spiel goes something like: x86_64, SMP, UEFI bootloader, TTF rendering, compositing window manager, TCP&#x2F;IP stack, AHCI driver, custom assembler&#x2F;linker, and, of course, a GameBoy Emulator!<p>When working on axle, the level of yak shaving can get pretty extreme. For example, when I got around to writing axle’s first network card driver, I was puzzled when my driver could transmit packets fine, but failed to receive any packets. I dug around for quite a while before considering that it might be a QEMU bug, and tracked it all the way to macOS’s incomplete implementation of poll(), which QEMU was relying on! I ended up writing a patch for QEMU to work around it, and, several layers up, was finally able to progress on the network card driver and network stack. This was back in 2021, but I wrote up the journey recently here: <a href="https:&#x2F;&#x2F;axleos.com&#x2F;adding-vmnet-support-to-qemu&#x2F;" rel="nofollow">https:&#x2F;&#x2F;axleos.com&#x2F;adding-vmnet-support-to-qemu&#x2F;</a><p>axle was mostly C-based for a lot of its history, which can get pretty gnarly both in kernel-space and when trying to write higher-level productivity software in userspace. Recently, I’ve been writing a lot more of in Rust, but for the past couple of years that’s been confined to userspace only. When adding SMP support to the kernel, though, I added Rust to the kernel too. It’s really nice.<p>One other fun thing I’ve been working on semi-recently is a homegrown IDE with an assembler&#x2F;ELF-linker that runs under axle. I found the linker pretty difficult to get right, because a lot of the ELF data need to know the size and locations of other bits of data in the binary, and it’s tough to shake everything into place in a way that has serial data dependencies! It’s immensely gratifying, though, to write some assembly, generate an ELF at runtime, and execute it. I also added some process-monitoring hooks into the kernel while working on this, so the IDE application can monitor the output of the assembler&#x2F;linker, and show the output of the generated program, all within the GUI. I uploaded a quick demo video of this IDE here: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=YG9XyzSBUNg">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=YG9XyzSBUNg</a>. This whole shebang (IDE + assembler + linker&#x2F;ELF binary-packer) is written in Rust.<p>Thanks for reading — I hope you enjoy the post, and let me know if you have any questions!
评论 #36008657 未加载
评论 #36008905 未加载
评论 #36008137 未加载
评论 #36008820 未加载
评论 #36008406 未加载
评论 #36010354 未加载
Gunax大约 2 年前
About 10 years ago I tried to write a gameboy emulator based on a pdf document i found on the internet somewhere.<p>I ended up finding the documentation wrong in a handful of places, which made the project tedious. Did you find that document reliable?
评论 #36009038 未加载
legendofbrando大约 2 年前
This is light years beyond any coding ability I have and was deeply enjoyable to read.
auselen大约 2 年前
Anyone has a project for converting GB roms to something intermediate like llvm-ir or directly to another isa?
DotaFan大约 2 年前
Congratz OP, you persistence is admirable.
anthk大约 2 年前
There&#x27;s a GB emu for Emacs too.