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/
161•ibobev•6h ago

Comments

le-mark•4h 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.

binji•26m ago
rgbds-live is more-or-less this same idea, with an embedded version of RGBDS: https://gbdev.io/rgbds-live/
noobcoder•3h 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

hydroxideOH-•25m ago
It should already be possible to run CAMLBOY on WASM because of the new WASM backend of js_of_ocaml (wasm_of_ocaml).
droolboy•2h 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•2h ago
https://youtu.be/a52p6ji1WZs maybe?
wez470•2h ago
https://nightshade256.github.io/2021/03/27/gb-sound-emulatio... is pretty good
t0mek•2h 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•1h 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•1h ago
Excellent writeup and cool project.

Needs a (2022).

numlock86•44m ago
Cool. The demo runs way too fast, though. The throttle checkbox doesn't really change it. Unchecking it, if anything, makes it run slower. It runs at 240 fps with throttle and at 180 fps without. With the throttle checbox active one second are already about four seconds in the emulator. I suspect this is related to the screen refresh rate, which is 240Hz in my case.
chickenzzzzu•21m ago
probably they are calling requestAnimationFrame() and then not accounting for deltaTime?

Interim Order in the Matter of Index Manipulation by Jane Street Group

https://www.sebi.gov.in/enforcement/orders/jul-2025/interim-order-in-the-matter-of-index-manipulation-by-jane-street-group_95040.html
1•alpark3•46s ago•0 comments

Gaming on ARM with FEX: Translating x86_64 Syscalls for Fun and Pain

https://interfacinglinux.com/2025/06/30/fex-emu-gaming-on-the-on-the-orion-o6/
1•MaiSck•59s ago•0 comments

I built a wrapper and why it works

https://shaicreative.ai/ai-storyboard-generator/
1•leonardopiumi•6m ago•1 comments

Temp Mails

https://tmpmails.com/en
1•devmcfly•6m ago•0 comments

RemoveBg: A Advanced AI Tools

https://www.converters.pro
1•pikaiqiu•8m ago•0 comments

Bad prompting is the new bad engineering

https://ryanperry.io/post/cost-of-poor-prompting
1•Rperry2174•10m ago•0 comments

Show HN: Quick and Simple A11y Checker

https://github.com/be-lenka/be-a11y
3•beledev•11m ago•0 comments

Why Tesla's Robotaxi Launch Needed Human Babysitters

https://www.wired.com/story/this-is-why-teslas-robotaxi-launch-needed-human-babysitters/
1•almost-exactly•12m ago•0 comments

Business Tax Updates in the One Big Beautiful Bill

https://natlawreview.com/article/business-tax-updates-one-big-beautiful-bill
1•rufus_foreman•12m ago•1 comments

Almost no one jumps on rainy days

https://www.latimes.com/world/asia/la-fg-japan-suicide-20180222-story.html
2•joebig•12m ago•0 comments

Ingram Micro Down

https://old.reddit.com/r/msp/comments/1lqyayw/ingram_micro_down/
1•bretpiatt•13m ago•0 comments

Browser Engine Benchmark

https://github.com/techinz/browsers-benchmark
1•handfuloflight•19m ago•0 comments

Few-Shot Learning for Industrial Time Series: Screw-Fastening Process Monitoring

https://arxiv.org/abs/2506.13909
1•PaulHoule•20m ago•0 comments

Ask HN: Does it still make sense to learn AI(fundamentals), if so, how?

1•shadowjones•22m ago•1 comments

Endgame Open Chess Platform

https://endgame.ai/
2•thinkingemote•22m ago•0 comments

We Hired Soham Parekh

https://blog.digger.dev/how-we-hired-soham-parekh/
4•igorzij•22m ago•1 comments

Paper Shaders: Zero-dependency canvas shaders

https://github.com/paper-design/shaders
1•nateb2022•26m ago•0 comments

Phone Trips

http://www.wideweb.com/phonetrips/#explain
2•wizardforhire•26m ago•0 comments

Fast Java Web Front-ends: Flavour 0.3.2 released

https://sourceforge.net/p/flavour/groups/announce/thread/c272317a94/
1•TeaVMFan•26m ago•1 comments

Ask HN: Small Repairable Phone in 2025?

1•marto1•28m ago•0 comments

How does the Data Council conference keep finding future $1B companies?

https://quesma.com/blog-detail/how-does-the-data-council-conference-keep-finding-future-billion-dollar-companies
1•jakozaur•29m ago•0 comments

Plakar: Effortless, scalable, encrypted backups with instant recovery UI

https://github.com/PlakarKorp/plakar
1•kadrek•29m ago•0 comments

A SwiftData Alternative with SQLite and CloudKit

https://www.pointfree.co/blog/posts/179-a-swiftdata-alternative-with-sqlite-cloudkit-private-alpha
1•wahnfrieden•31m ago•0 comments

Why billing engineers are underrated and invisible

https://getlago.substack.com/p/how-dries-vints-keeps-laravels-billing
1•FinnLobsien•33m ago•0 comments

Playwright Model Context Protocol Server – Tool to Automate Browsers and APIs

https://github.com/executeautomation/mcp-playwright
3•Bluestein•33m ago•0 comments

Show HN: DarkIntel – Dark Web Scan Tool with No Signup or Payment

https://darkintel.store
1•balbaks•33m ago•0 comments

The principles of extreme fault tolerance

https://planetscale.com/blog/the-principles-of-extreme-fault-tolerance
1•samlambert•35m ago•0 comments

Incomplete List of Mistakes in the Design of CSS

https://wiki.csswg.org/ideas/mistakes
1•busymom0•37m ago•0 comments

Time MCP Server

https://github.com/modelcontextprotocol/servers/tree/main/src/time
4•Bluestein•37m ago•0 comments

Mini NASes marry NVMe to Intel's efficient chip

https://www.jeffgeerling.com/blog/2025/mini-nases-marry-nvme-intels-efficient-chip
10•ingve•40m ago•2 comments