frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Open in hackernews

Writing a Game Boy Emulator in OCaml

https://linoscope.github.io/writing-a-game-boy-emulator-in-ocaml/
137•ibobev•5h ago

Comments

le-mark•3h ago
This is a very nice write up of not only Ocaml but also gameboy emulator implementation. Great job and thank you to the author!

As an aside I’ve always thought it would be awesome to create a single page app with an assembler editor and assembler/linker/loader to enable doing gameboy homebrew in the browser. I think it would be a great, accessible embedded development teaching opportunity.

noobcoder•2h ago
ah nice ! great use of functors, GADTs

I wanna compare a CHIP 8 or NES emulator or port CAMLBOY to WASM using ocaml-wasm

droolboy•1h ago
I know it’s a long shot, but does anyone know of a tutorial for the sound of a game boy emulator? Most of these tutorials never cover that piece and when I try it on my own I find it hard to properly implement or even understand the reference material well enough to implement on my own.
jofzar•1h ago
https://youtu.be/a52p6ji1WZs maybe?
wez470•1h ago
https://nightshade256.github.io/2021/03/27/gb-sound-emulatio... is pretty good
t0mek•56m ago
Not a tutorial per-se, but here are 2 slides describing how I've done it:

https://www.slideshare.net/slideshow/emulating-game-boy-in-j...

Essentially, there are 4 channels, each providing a number 0-15 on every tick. Emulator should mix them together (arithmetic average), scale up to 0-255 and feed to the sound buffer, adjusting the tick rate (4.19MHz) to the sound output rate (e.g.: 22 kHz) - taking every ~190 value (4.19MHz / 22 kHz) is a good start.

Now the 0..15 value that should be produced by each channel depends on its characteristics, but it's well documented:

https://gbdev.gg8.se/wiki/articles/Gameboy_sound_hardware

Channels 1 and 2 produce square waves, so a bunch of low (0) and high (15) values, with optional volume envelope (gradually going down from 15 to 0 on the "high" part of the square) and frequency sweep (alternating 0s and 15s slower or faster).

Channel 3 allows an arbitrary waveform, read from the memory.

Channel 4 is a random noise, generated by the LSFR.

See SoundModeX.java for the reference:

https://github.com/trekawek/coffee-gb/tree/master/src/main/j...

brunojppb•45m ago
Beautiful write-up! Thanks for sharing this. I want to write a game boy emulator in Rust and your blogpost really inspired me to kick this off. I’m bookmarking this.
mtlynch•21m ago
Excellent writeup and cool project.

Needs a (2022).

Why I left my tech job to work on chronic pain

https://sailhealth.substack.com/p/why-i-left-my-tech-job-to-work-on
73•glasscannon•2h ago•46 comments

I want to leave tech: what do I do?

https://write.as/conjure-utopia/lets-say-youre-working-in-tech-and-you-have-a-technical-role-youre-a
54•todsacerdoti•51m ago•34 comments

Writing a Game Boy Emulator in OCaml

https://linoscope.github.io/writing-a-game-boy-emulator-in-ocaml/
137•ibobev•5h ago•8 comments

Show HN: BunkerWeb – the open-source and cloud-native WAF

https://docs.bunkerweb.io/latest/
29•bnkty•2h ago•10 comments

Larry (cat)

https://en.wikipedia.org/wiki/Larry_(cat)
87•dcminter•5h ago•25 comments

Show HN: I AI-coded a tower defense game and documented the whole process

https://github.com/maciej-trebacz/tower-of-time-game
43•M4v3R•2h ago•15 comments

A Rust-TypeScript integration

https://github.com/beeeeep54/rust-typescript
23•wreedtyt•3h ago•28 comments

Lens: Lenses, Folds and Traversals

https://hackage.haskell.org/package/lens
24•hyperbrainer•3d ago•5 comments

Show HN: Fast Thermodynamic Calculations in Python

https://dlr-institute-of-future-fuels.github.io/gaspype/
20•Saloc•3h ago•4 comments

Can Large Language Models Play Text Games Well?

https://arxiv.org/abs/2304.02868
15•willvarfar•3h ago•7 comments

Serving 200M requests per day with a CGI-bin

https://jacob.gold/posts/serving-200-million-requests-with-cgi-bin/
39•feep•1h ago•10 comments

Enhanced Radar (YC W25) is hiring a founding engineer

1•EricButton•2h ago

Kepler.gl

https://kepler.gl/
5•9woc•52m ago•0 comments

Is an Intel N100 or N150 a better value than a Raspberry Pi?

https://www.jeffgeerling.com/blog/2025/intel-n100-better-value-raspberry-pi
88•transpute•2h ago•93 comments

Introducing tmux-rs

https://richardscollin.github.io/tmux-rs/
804•Jtsummers•23h ago•272 comments

Wind Knitting Factory

https://www.merelkarhof.nl/work/wind-knitting-factory
171•bschne•18h ago•50 comments

DRM Panic QR code generator

https://rust-for-linux.com/drm-panic-qr-code-generator
43•weinzierl•7h ago•20 comments

Zig breaking change – initial Writergate

https://github.com/ziglang/zig/pull/24329
116•Retro_Dev•10h ago•134 comments

Killer whales groom each other with pieces of kelp

https://www.science.org/content/article/killer-whales-groom-each-other-pieces-kelp
48•noleary•3d ago•26 comments

phkmalloc

https://phk.freebsd.dk/sagas/phkmalloc/
26•fanf2•3d ago•3 comments

Rust and WASM for Form Validation

https://sebastian.lauwe.rs/blog/rust-wasm-form-validation/
4•slau•2h ago•0 comments

Flounder Mode – Kevin Kelly on a different way to do great work

https://joincolossus.com/article/flounder-mode/
277•latentnumber•23h ago•63 comments

Developing with GitHub Copilot Agent Mode and MCP

https://austen.info/blog/github-copilot-agent-mcp/
75•miltonlaxer•3d ago•43 comments

LooksMapping

https://looksmapping.com/
78•elsewhen•10h ago•46 comments

Launch HN: K-Scale Labs (YC W24) – Open-Source Humanoid Robots

204•codekansas•22h ago•87 comments

Raphael discovery emerges from Vatican museum restoration

https://news.artnet.com/art-world/raphael-rooms-restoration-discovery-2662624
41•andsoitis•3d ago•7 comments

AV1@Scale: Film Grain Synthesis, The Awakening

https://netflixtechblog.com/av1-scale-film-grain-synthesis-the-awakening-ee09cfdff40b
237•CharlesW•22h ago•192 comments

How often is the query plan optimal?

https://vondra.me/posts/how-often-is-the-query-plan-optimal/
21•eatonphil•3d ago•16 comments

Context Engineering for Agents

https://rlancemartin.github.io/2025/06/23/context_engineering/
79•0x79de•3d ago•22 comments

Peasant Railgun

https://knightsdigest.com/what-exactly-is-the-peasant-railgun-in-dd-5e/
265•cainxinth•1d ago•181 comments