Better HN
topnewbestaskshowjobs
Log inSign up

cwslowcay

1 karma · joined Jul 5, 2025 (1y ago) · 1 submissions

Submissions

comment 1y ago · link · parent

I wrote a GBC emulator in Haskell (https://github.com/CLowcay/hgbc/tree/master). It's nice for modelling the instruction set, decoding and dispatching instructions. Optimization is tough though. To achieve playable performance, everything has to go into the IO monad. Haskell is famous for lazy evaluation. I found that occasionally useful, but mostly a source of performance problems.

Ultimately, the hard thing in emulation was not decoding instructions. It was synchronization, timing, and faithfully reproducing all the hardware glitches (because many games will not work without certain hardware bugs). Haskell doesn't help much for those things. If I was doing another emulation project I'd choose rust.