<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>F# on AI VOID</title><link>https://ai-blog.noorshomelab.dev/tags/f%23/</link><description>Recent content in F# on AI VOID</description><generator>Hugo</generator><language>en</language><lastBuildDate>Tue, 05 May 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://ai-blog.noorshomelab.dev/tags/f%23/index.xml" rel="self" type="application/rss+xml"/><item><title>Setting Up Your Emulator Development Environment</title><link>https://ai-blog.noorshomelab.dev/game-boy-emulator-fsharp/setup-emulator-dev-environment/</link><pubDate>Tue, 05 May 2026 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/game-boy-emulator-fsharp/setup-emulator-dev-environment/</guid><description>&lt;p&gt;Building a Game Boy emulator from scratch is a deeply rewarding project that takes you into the heart of computer architecture and low-level system design. This journey begins by establishing a robust and efficient development environment. In this chapter, we&amp;rsquo;ll set up everything you need: the F# language, the .NET SDK, and a powerful cross-platform graphics library to bring your emulator to life.&lt;/p&gt;
&lt;p&gt;By the end of this chapter, you&amp;rsquo;ll have a fully configured F# project, ready to accept the intricate logic of Game Boy hardware. You&amp;rsquo;ll also confirm that your graphics setup is functional, providing the visual canvas for the pixels your Picture Processing Unit (PPU) will eventually render. This foundational step is critical; a well-prepared environment ensures you can focus on the complex emulation logic without fighting your tools.&lt;/p&gt;</description></item><item><title>The CPU Core: Registers, Flags, and Basic Instructions</title><link>https://ai-blog.noorshomelab.dev/game-boy-emulator-fsharp/cpu-core-registers-flags-basic-instructions/</link><pubDate>Tue, 05 May 2026 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/game-boy-emulator-fsharp/cpu-core-registers-flags-basic-instructions/</guid><description>&lt;h2 id="introduction"&gt;Introduction&lt;/h2&gt;
&lt;p&gt;Welcome to the foundational stage of our Game Boy emulator! In this chapter, we&amp;rsquo;re going to construct the very brain of our system: the Central Processing Unit (CPU). The Game Boy uses a custom 8-bit CPU, often referred to as the &amp;ldquo;SM83,&amp;rdquo; which is a hybrid between a Zilog Z80 and Intel 8080. Understanding and accurately emulating its behavior is paramount to running any Game Boy software.&lt;/p&gt;
&lt;p&gt;This milestone is critical because every single action within a Game Boy game—from moving a character to calculating damage—is ultimately a sequence of CPU instructions. Building the CPU core correctly is non-negotiable for a functional emulator. By the end of this chapter, you will have a functional, albeit minimal, CPU core capable of storing its state (registers and flags) and executing a few fundamental instructions. This forms the bedrock upon which we&amp;rsquo;ll build memory access, graphics, and more complex logic.&lt;/p&gt;</description></item><item><title>Memory Management Unit (MMU) and Basic Memory Access</title><link>https://ai-blog.noorshomelab.dev/game-boy-emulator-fsharp/mmu-basic-memory-access/</link><pubDate>Tue, 05 May 2026 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/game-boy-emulator-fsharp/mmu-basic-memory-access/</guid><description>&lt;p&gt;The CPU you started building in the last chapter is blind without memory. It can execute instructions, but it can&amp;rsquo;t load programs, store data, or interact with any of the Game Boy&amp;rsquo;s peripherals like the screen or sound chip. This is where the Memory Management Unit (MMU) comes in.&lt;/p&gt;
&lt;p&gt;This chapter guides you through creating the Game Boy&amp;rsquo;s core memory system, the &lt;strong&gt;Memory Management Unit (MMU)&lt;/strong&gt;. You&amp;rsquo;ll learn about the Game Boy&amp;rsquo;s memory map, how to model different memory regions, and implement the fundamental &lt;code&gt;readByte&lt;/code&gt; and &lt;code&gt;writeByte&lt;/code&gt; operations crucial for any emulator. By the end, your emulator will be able to load a Game Boy ROM into its virtual memory, a significant step towards running actual games.&lt;/p&gt;</description></item><item><title>Loading ROMs and Initial Boot Sequence</title><link>https://ai-blog.noorshomelab.dev/game-boy-emulator-fsharp/loading-roms-boot-sequence/</link><pubDate>Tue, 05 May 2026 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/game-boy-emulator-fsharp/loading-roms-boot-sequence/</guid><description>&lt;p&gt;In this chapter, we transition from a theoretical CPU to a system capable of loading and preparing a Game Boy game for execution. This is the pivotal moment where your emulator begins to take on a tangible form, moving from abstract concepts to processing actual game data. We&amp;rsquo;ll implement the crucial functionality of loading a Game Boy ROM file into our Memory Management Unit (MMU) and setting up the initial state of the CPU, mirroring what happens after the Game Boy&amp;rsquo;s internal boot ROM completes.&lt;/p&gt;</description></item><item><title>CPU Control Flow: Jumps, Calls, and Conditional Logic</title><link>https://ai-blog.noorshomelab.dev/game-boy-emulator-fsharp/cpu-control-flow-jumps-calls/</link><pubDate>Tue, 05 May 2026 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/game-boy-emulator-fsharp/cpu-control-flow-jumps-calls/</guid><description>&lt;p&gt;In this chapter, we&amp;rsquo;re going to give our Game Boy CPU the ability to make decisions and reuse code. We&amp;rsquo;ll implement the crucial control flow instructions: &lt;code&gt;JP&lt;/code&gt; (Jump), &lt;code&gt;JR&lt;/code&gt; (Jump Relative), &lt;code&gt;CALL&lt;/code&gt;, and &lt;code&gt;RET&lt;/code&gt; (Return), along with their conditional variants. These instructions are fundamental to how programs execute, allowing them to branch, loop, and call subroutines.&lt;/p&gt;
&lt;p&gt;By the end of this milestone, your emulator will be able to follow more complex program paths, enabling it to execute actual Game Boy program logic beyond simple linear instruction sequences. This is a significant step towards running real Game Boy ROMs, as it unlocks the ability for programs to react to different states and organize their code efficiently.&lt;/p&gt;</description></item><item><title>Interrupts and the Main CPU Execution Loop</title><link>https://ai-blog.noorshomelab.dev/game-boy-emulator-fsharp/interrupts-cpu-execution-loop/</link><pubDate>Tue, 05 May 2026 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/game-boy-emulator-fsharp/interrupts-cpu-execution-loop/</guid><description>&lt;h3 id="introduction"&gt;Introduction&lt;/h3&gt;
&lt;p&gt;In the previous chapters, we laid the groundwork for our Game Boy emulator by implementing the CPU&amp;rsquo;s core instruction set and a basic Memory Management Unit. However, a real system isn&amp;rsquo;t just a CPU executing instructions sequentially. Hardware components like the display, timer, and input devices need to signal the CPU when an event occurs, and the CPU needs a way to respond. This is where &lt;strong&gt;interrupts&lt;/strong&gt; come in.&lt;/p&gt;</description></item><item><title>Picture Processing Unit (PPU) Part 1: VRAM and Background Rendering</title><link>https://ai-blog.noorshomelab.dev/game-boy-emulator-fsharp/ppu-part1-vram-background/</link><pubDate>Tue, 05 May 2026 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/game-boy-emulator-fsharp/ppu-part1-vram-background/</guid><description>&lt;h2 id="introduction"&gt;Introduction&lt;/h2&gt;
&lt;p&gt;So far, our Game Boy emulator can execute CPU instructions and manage memory, but it&amp;rsquo;s a silent, black box. This chapter changes that. We&amp;rsquo;re about to bring the Game Boy to life by tackling the Picture Processing Unit (PPU) – the hardware responsible for all the visuals. This is a significant milestone, as seeing actual graphics from a ROM is incredibly rewarding and validates much of our prior work.&lt;/p&gt;</description></item><item><title>Picture Processing Unit (PPU) Part 2: Sprites, Scrolling, and LCD Control</title><link>https://ai-blog.noorshomelab.dev/game-boy-emulator-fsharp/ppu-part2-sprites-scrolling/</link><pubDate>Tue, 05 May 2026 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/game-boy-emulator-fsharp/ppu-part2-sprites-scrolling/</guid><description>&lt;p&gt;This chapter builds upon our foundational Picture Processing Unit (PPU) work, where we established background tile rendering. Now, we&amp;rsquo;ll introduce the dynamic elements that bring games to life: sprites (movable objects), background scrolling, and the crucial LCD Control Register, which dictates how the display operates. By the end of this milestone, your emulator will be able to render basic sprites, scroll the background, and respond to fundamental display settings, making it capable of running more visually complex Game Boy ROMs.&lt;/p&gt;</description></item><item><title>Input Handling: Connecting Keyboard to Game Boy Buttons</title><link>https://ai-blog.noorshomelab.dev/game-boy-emulator-fsharp/input-handling-keyboard-buttons/</link><pubDate>Tue, 05 May 2026 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/game-boy-emulator-fsharp/input-handling-keyboard-buttons/</guid><description>&lt;p&gt;Handling user input is crucial for any interactive application, especially an emulator. In this chapter, we&amp;rsquo;ll bridge the gap between your physical keyboard and the Game Boy&amp;rsquo;s virtual buttons. You&amp;rsquo;ll learn how to capture keyboard events, map them to the Game Boy&amp;rsquo;s specific input registers, and integrate this into your emulator&amp;rsquo;s main loop. By the end, your emulator will respond to your key presses, allowing you to control Game Boy games.&lt;/p&gt;</description></item><item><title>Advanced MMU: Memory Bank Controllers (MBCs)</title><link>https://ai-blog.noorshomelab.dev/game-boy-emulator-fsharp/advanced-mmu-mbcs/</link><pubDate>Tue, 05 May 2026 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/game-boy-emulator-fsharp/advanced-mmu-mbcs/</guid><description>&lt;h2 id="introduction"&gt;Introduction&lt;/h2&gt;
&lt;p&gt;So far, our Game Boy emulator has a basic Memory Management Unit (MMU) that can handle the fixed 64KB memory map. This is sufficient for very small ROMs, but most commercial Game Boy games exceed this limit, often by megabytes. How did the original hardware manage this? Through a clever piece of hardware called a &lt;strong&gt;Memory Bank Controller (MBC)&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;In this chapter, we&amp;rsquo;ll extend our MMU to support MBCs. This is a critical milestone because it unlocks the ability to load and run a vast majority of Game Boy ROMs. We&amp;rsquo;ll focus on implementing the &lt;strong&gt;MBC1&lt;/strong&gt; type, which is one of the most common and fundamental MBCs. By the end of this chapter, your emulator will be able to dynamically switch between different ROM and external RAM banks, allowing it to access much larger cartridge data.&lt;/p&gt;</description></item><item><title>Audio Processing Unit (APU) Basics: Square Wave Channels</title><link>https://ai-blog.noorshomelab.dev/game-boy-emulator-fsharp/apu-basics-square-waves/</link><pubDate>Tue, 05 May 2026 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/game-boy-emulator-fsharp/apu-basics-square-waves/</guid><description>&lt;p&gt;In this chapter, we&amp;rsquo;re diving into the fascinating world of sound emulation for our Game Boy project. While often overlooked, a truly accurate emulator needs to replicate the distinct chiptune sounds that define the Game Boy experience. We&amp;rsquo;ll start by tackling the foundational elements of the Audio Processing Unit (APU), specifically focusing on its two square wave channels.&lt;/p&gt;
&lt;p&gt;This milestone is critical because it brings our emulator to life in a new dimension. Hearing the familiar bleeps and boops of a Game Boy game validates our CPU and MMU work in a very tangible way. By the end of this chapter, you&amp;rsquo;ll have a basic APU implementation capable of generating square wave sounds, hooked into your emulator&amp;rsquo;s main loop, and outputting audio via SDL2&amp;rsquo;s direct audio queuing API.&lt;/p&gt;</description></item><item><title>Synchronization, Debugging, and Verifying with Test ROMs</title><link>https://ai-blog.noorshomelab.dev/game-boy-emulator-fsharp/synchronization-debugging-test-roms/</link><pubDate>Tue, 05 May 2026 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/game-boy-emulator-fsharp/synchronization-debugging-test-roms/</guid><description>&lt;h2 id="introduction"&gt;Introduction&lt;/h2&gt;
&lt;p&gt;Building a Game Boy emulator is a complex dance of interacting hardware components. The CPU, Picture Processing Unit (PPU), and Audio Processing Unit (APU) all operate at different speeds and rely on precise timing to function correctly. In this chapter, we&amp;rsquo;ll tackle the critical challenge of &lt;strong&gt;synchronization&lt;/strong&gt;, ensuring these components work together harmoniously.&lt;/p&gt;
&lt;p&gt;Beyond just making things &lt;em&gt;run&lt;/em&gt;, we need to know &lt;em&gt;why&lt;/em&gt; they run or, more importantly, &lt;em&gt;why they fail&lt;/em&gt;. This is where &lt;strong&gt;debugging&lt;/strong&gt; becomes indispensable. We&amp;rsquo;ll implement practical debugging tools—from logging to conditional breakpoints—to help us peer into the emulator&amp;rsquo;s internal state.&lt;/p&gt;</description></item><item><title>Build a Game Boy Emulator with F#</title><link>https://ai-blog.noorshomelab.dev/game-boy-emulator-fsharp/</link><pubDate>Tue, 05 May 2026 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/game-boy-emulator-fsharp/</guid><description>&lt;p&gt;This comprehensive guide walks developers through the intricate process of creating a Game Boy emulator from the ground up using F#. Explore fundamental concepts like CPU emulation, memory mapping, graphics rendering, input handling, and sound synthesis. Delve into low-level system design and practical F# implementation details to truly understand retro console architecture.&lt;/p&gt;</description></item><item><title>Building a Game Boy Emulator with F#</title><link>https://ai-blog.noorshomelab.dev/projects-v2/game-boy-emulator-fsharp-guide/</link><pubDate>Tue, 05 May 2026 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/projects-v2/game-boy-emulator-fsharp-guide/</guid><description>&lt;p&gt;Building a Game Boy emulator from the ground up is a deeply rewarding project that takes you into the heart of computer architecture and low-level system design. This guide will walk you through constructing a functional Game Boy emulator using F#, focusing on a modular, functional approach to replicate the original hardware&amp;rsquo;s behavior.&lt;/p&gt;
&lt;h2 id="why-build-an-emulator"&gt;Why Build an Emulator?&lt;/h2&gt;
&lt;p&gt;Emulators are more than just software; they are digital time capsules that preserve computing history and provide a unique window into how hardware and software truly interact. By building one, you&amp;rsquo;ll gain an unparalleled understanding of:&lt;/p&gt;</description></item></channel></rss>