Earlier quoted context omitted.
The Register source has this comment: // Registers can't be a record type because the values need to be truncated to 8 bits when writing, so setters are needed // This is for the web renderer as Fable transpiles uint8 to Number (more than 8 bits) in JS and doesn't apply any truncation // Known non-standard behaviour in Fable (https://fable.io/docs/javascript/compatibility.html#numeric-types) So, I think, it's just co…
Oof, thanks for pointing that out, I hadn't noticed and I've only ever used F# on .NET. That's terrible on Fable's part, the least they could do is truncate. I wasn't aware Fable's translation is so naive.
I built a Game Boy emulator in F#
41–50 of 84 posts
Re: I built a Game Boy emulator in F#
#42I'm actually starting a new project to create a gba emulator in zig, and also starting with chip8. I'm going to skip nand to tetris because I played Turing complete. Cool to see I'm on the right track!
Re: I built a Game Boy emulator in F#
#43Very cool. Makes me want to build something with F*
Re: I built a Game Boy emulator in F#
#44Cool 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…
Re: I built a Game Boy emulator in F#
#45Re: I built a Game Boy emulator in F#
#46I'm actually starting a new project to create a gba emulator in zig, and also starting with chip8. I'm going to skip nand to tetris because I played Turing complete. Cool to see I'm on the right track!
Yes, CHIP-8 is kind of the standard "I want to get into emulators" first project. In my latest book Computer Science from Scratch we go CHIP-8 -> NES in chapters 5 to 6. GBA is quite a step up from CHIP-8. I would suggest doing NES or GameBoy next, but of course with today's LLM help GBA is very reasonable if you are going that route.
Re: I built a Game Boy emulator in F#
#47Finally 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.
Re: I built a Game Boy emulator in F#
#48Re: I built a Game Boy emulator in F#
#49Building emulators is cool but everyone does it, and the end result is more or less the same. Is there some things that could be done during the process to perhaps make an emulator a little more unique instead of a perfect replica?