Live data from Hacker News

I built a Game Boy emulator in F#

nickkossolapov.github.io

51–60 of 84 posts

Re: I built a Game Boy emulator in F#

#51
post #27
post #18

Earlier quoted context omitted.

Yes! That's exactly how you should do it while working with a language that doesn't have a compiler that will aggressively analyze, and rewrite and optimize your code for you. (So, most languages with "heavy runtimes" that support a bunch of dynamic stuff and JITs) There are basically two points to programming with immutable-first data. One, eliminate certain classes of data race concurrency bugs. Two, less mutable s…

Yeah, and even if you need concurrency/parallelism within the function, it can be forgivable to use ConcurrentDictionary or ConcurrentBag or one of the many, many other thread safe mutable data structures built directly into .NET. I will personally almost always prefer the pretty functional versions of things, and that's almost always what I start with. I like immutable data structures, and they are usually more than…

I find algo performance is a consideration, but so is overall system performance especially in the face of concurrency, staleness, update rate, data processing size, consistency of data, etc. I think persistent collections are just another tool which is sometimes appropriate; and it has saved me over the standard Concurrent collections in some interesting cases. There are significantly faster immutable collection libraries than the standard F# Map class though online you can use if I recall from awhile back - still not quite mutable perf though. It tends to be appropriate to use for almost the opposite case than a single thread in a tight loop which is the usual benchmark I guess. As usual YMMV/depends on problem at hand.

Re: I built a Game Boy emulator in F#

#52
post #17

Earlier quoted context omitted.

It's always going to exist. People still build things with hand tools in the year 2026. Let's call it Artisanal Coding.

trad coding

I feel like trad coding would be more along the lines of 'I work 10 hours a day coding for minimum wage because that's a worker's place in life, and I love it!'

Re: I built a Game Boy emulator in F#

#53
post #23

Earlier quoted context omitted.

My guess is you're thinking of no$gmb, a very early Game Boy emulator: https://gbatemp.net/threads/no-gmb-2-5-dos-full-version.6039... I've got fond memories of using this to get a preview of Pokemon Gold before it was released in NA!

Found it MetalNES, transistor level NES emulation https://github.com/iaddis/metalnes While searching I also found a new one, VisualNES https://kaiokendev.github.io/nes/about There is also one for GB https://github.com/aappleby/MetroBoy

See also Higan, formerly BSNES, which among other things is a cycle-accurate emulation of the SNES hardware and its enhancement chips (like the SuperFX used in StarFox/StarWing):

https://en.wikipedia.org/wiki/Higan_(emulator)

Re: I built a Game Boy emulator in F#

#55

Finally someone putting in actual human effort to learn something, and not a LLM helped me build X in Y minutes. There is some hope for humanity after all I suppose.

Eh you should have give up hope in humanity sometime around when the soviet union fell

Emulators are cool as hell though, and GBA ones are a nice one to tackle yourself

Re: I built a Game Boy emulator in F#

#57
Interesting, enjoyable post. Like the bit about data modeling. I've been dabbling in some OCaml and that kind of modeling is the best part. Also interesting to learn of CAMLBOY. Feedback to the author: Skip the AI edit step. I'd have preferred grammar errors or inelegance to what we have here, which is a bit stale.

Re: I built a Game Boy emulator in F#

#58
post #44

Cool to see F# here! Emulators are a great way to learn a language. On first sight you chose well between more or less idiomatic F# for each job. Some low hanging fruit to reduce allocations: the discriminated unions in Instructions.fs could be [ ], reusing field names to reuse internal fields. Also, minor nitpick but I'm confused about some of the registers. They are already of type byte, the setters with `a &&& 0xF…

It's actually discussed in the article in the part where he ports it to fable (he also tried blazor)

I admit I skimmed from there on because I don't find web dev exciting, but you're right, it is. That's a terribly naive translation on Fable's part.

Re: I built a Game Boy emulator in F#

#59
Ah F#, my greatest love. How I wish the C# guys and girls would see this instead of further bastardizing (don't hate me) C# into being everything but poorly.

Don't you see that if you would use F# instead, creating projects with C# and F#, that you would get what is being added to C# but actually working and ergonomically? Interop is great!

Post reply on HN