Uploaded November 2021 | Updated September 2026, 2 weeks ago
=[ 🔗 Links 🔗 ]=
🎥 Series Playlist: youtube.com/watch?v=ER7h4ZTe19A&list=PLP29wDx6QmW4sXTvFYgbHrLygqH8_oNEH
💌 Updates to your inbox: tinyletter.com/lowleveljavascript
🗣 Discord: discord.gg/FPWaVgk
⭐️ Patreon: patreon.com/lowleveljavascript
💻 Github Repo (emulator): github.com/LowLevelJavaScript/RISC-V-Emulator
=[ 🔗 Links 🔗 ]=
🎥 Series Playlist: youtube.com/watch?v=ER7h4ZTe19A&list=PLP29wDx6QmW4sXTvFYgbHrLygqH8_oNEH
💌 Updates to your inbox: tinyletter.com/lowleveljavascript
🗣 Discord: discord.gg/FPWaVgk
⭐️ Patreon: patreon.com/lowleveljavascript
💻 Github Repo (emulator): github.com/LowLevelJavaScript/RISC-V-Emulator
![Bootloader Packet Protocol Implementation :: Bare Metal Programming Series 7.2
In this episode of the bare metal programming series, were implementing the packet protocol we looked at in the previous video inside the bootloader.
This protocol is able to automatically process incoming packets, acknowledging or requesting retransmission (or retransmitting when requested), and stuffing the data into a buffer for the application logic to use.
=[ 🔗 Links 🔗 ]=
🎥 Series Playlist: https://www.youtube.com/playlist?list=PLP29wDx6QmW7HaCrRydOnxcy8QmW0SNdQ
🗣 Discord: https://discord.gg/FPWaVgk
⭐️ Patreon: https://www.patreon.com/lowleveljavascript
💻 Github Repo: https://github.com/lowbyteproductions/bare-metal-series Bootloader Packet Protocol Implementation :: Bare Metal Programming Series 7.2](https://i.ytimg.com/vi/RrUyS-gixWk/mqdefault.jpg)
![Interrupts and Memory Mapped I/O :: Bare Metal Programming Series 2
This is episode 2 of the bare metal programming series! In this video, were taking a deep dive into the memory-mapped I/O mechanism that underpins the CPUs communication with the peripherals on the chip. We also discuss and explore interrupts and the interrupt vector table, as well where to find the fundamental information related to your chip: datasheets and reference manuals.
=[ 🔗 Links 🔗 ]=
Bit Hacks (Beginner to Advanced) video by Creel: https://www.youtube.com/watch?v=ZRNO-ewsNcQ
Demystifying bitwise operations blog post by Andrei Ciobanu: https://www.andreinc.net/2023/02/01/demystifying-bitwise-ops
🎥 Series Playlist: https://www.youtube.com/playlist?list=PLP29wDx6QmW7HaCrRydOnxcy8QmW0SNdQ
🗣 Discord: https://discord.gg/FPWaVgk
⭐️ Patreon: https://www.patreon.com/lowleveljavascript
💻 Github Repo: https://github.com/lowbyteproductions/bare-metal-series Interrupts and Memory Mapped I/O :: Bare Metal Programming Series 2](https://i.ytimg.com/vi/S92ltJ0C59k/mqdefault.jpg)
![[stream] Writing a SPI SD-Card driver in TypeScript
=[ 🔗 Links 🔗 ]=
Awesome reference page: http://elm-chan.org/docs/mmc/mmc_e.html
Adafruit SD card library: https://github.com/arduino-libraries/SD/
Bunny Huangs SD card talk: https://www.youtube.com/watch?v=ruEn7TE4YMM
🎥 Stream Playlist: https://www.youtube.com/playlist?list=PLP29wDx6QmW7jg0LgRJYAmHLM6G_6NDw6
💌 Updates to your inbox: https://tinyletter.com/lowleveljavascript
🗣 Discord: https://discord.gg/FPWaVgk
⭐️ Patreon: https://www.patreon.com/lowleveljavascript
💻 Github Repo: [stream] Writing a SPI SD-Card driver in TypeScript](https://i.ytimg.com/vi/SIIde33EZrA/mqdefault.jpg)
![Rendering 3D Graphics On An Oscilloscope
In this video, were learning how to draw on an oscilloscope. By utilising the X-Y mode of the scope, combined with some clever firmware to generate the right signals, and a sprinkle of DIY digital-to-analog conversion, we can render animated 3D graphics on a scope in real time!
00:00:00 3D Animated Demo
00:01:36 Understanding X-Y Mode
00:05:00 Firmware Architecture Overview
00:09:52 PWM Digital-to-Analog Conversion
00:14:48 Manually creating images
00:21:57 Visualizing the signals
00:25:03 Writing the static image firmware
00:48:30 PWM signals on the scope
00:51:14 Building the low-pass filters
00:58:42 First 3D image
01:03:30 Reading the 3D renderer firmware code
01:17:15 Final demo
=[ 🔗 Links 🔗 ]=
⭐️ Become a patron and get bonus videos! https://www.patreon.com/lowleveljavascript
🗣 Discord: https://discord.gg/FPWaVgk
💻 Github Repo: https://github.com/lowbyteproductions/3d-oscilloscope-renderer Rendering 3D Graphics On An Oscilloscope](https://i.ytimg.com/vi/TAfWea21ooM/mqdefault.jpg)
![I wrote a GameBoy game in TypeScript (And it runs on real hardware!)
=[ 🔗 Links 🔗 ]=
💌 Updates to your inbox: https://tinyletter.com/lowleveljavascript
🗣 Discord: https://discord.gg/FPWaVgk
⭐️ Patreon: https://www.patreon.com/lowleveljavascript
💻 Github Repo (emulator): https://github.com/francisrstokes/tega
00:00:00 – Intro
00:05:23 – Demo on real hardware
00:06:48 – TEGA Overview
00:08:22 – Modules! No linker required
00:11:18 – Loads, Stores, and instruction representability
00:21:05 – Arithmetic and Logic
00:25:17 – Jumps, Labels, and Branches
00:29:45 – Macro abstraction examples
00:39:28 – Building a ROM
00:45:16 – The GameBoy Memory Map
00:56:58 – Block Jump Code Overview
01:05:39 – Tile graphics
01:12:26 – The DMA routine, and virtual symbol offsets
01:19:19 – Setting up the LCD screen
01:23:52 – Organising values in RAM
01:29:22 – Setting up OAM
01:33:34 – Setting up the player character and obstacle structs
01:35:26 – The main game loop
01:38:08 – Random Number Generation
01:42:26 – Game State Machine
01:53:23 – Jump Physics
02:05:43 – Compression: Encoding side
02:12:42 – Compression: Decoding side
02:17:59 – Running and Debugging in an emulator
02:30:50 – Outro I wrote a GameBoy game in TypeScript (And it runs on real hardware!)](https://i.ytimg.com/vi/TIlx5nBnx-o/mqdefault.jpg)
![Assembler Hacking: Inline Data And Constants (16-Bit VM in JavaScript 014)
In this episode, were going to implement 2 new features in the assembly language and assembler of the machine. The first is the ability to specify named, arbitrary data inline with the assembly code. And the second is the ability to specify named constants - whose values can be used meaningfully in the assembly code.
00:00 - Intro
01:23 - Parsing data directives
04:54 - Parsing constant directives
05:33 - Updating the main parser
06:03 - Writing a test program in assembly
07:03 - Refactoring the assembler
08:02 - Extracting constant and semantics in the assembler
08:58 - Encoding data blocks in the generated binary
10:17 - Testing the new assembler features
=[ ℹ About ℹ ]=
This series is all about building a powerful virtual machine in JavaScript with the following features:
- A flexible, extensible, register-based virtual machine
- Support for signed, unsigned and floating point operations
- A call stack
- Interrupt capabilities
- Ability to do memory mapping for IO
- An assembly language with macro and module support
- A higher level, C like language. Well use and expand the library from the parser combinators from scratch series
- And finally, to be able to take the whole thing into the browser and extend it to create a sort of fantasy console - an emulator for a machine that never existed
=[ 🔗 Links 🔗 ]=
- 💌 Updates to your inbox: https://tinyletter.com/lowleveljavascript
- ⭐️ Patreon: https://www.patreon.com/lowleveljavascript
- Assembly language tour (16-Bit VM ep 7) : https://youtu.be/ai63l4OUxSs
- Data directives: https://en.wikipedia.org/wiki/Assembly_language#Data_directives
- Series Playlist: https://www.youtube.com/playlist?list=PLP29wDx6QmW5DdwpdwHCRJsEubS5NrQ9b&playnext=1&index=1
- Github Repo: https://github.com/LowLevelJavaScript/16-Bit-Virtual-Machine Assembler Hacking: Inline Data And Constants (16-Bit VM in JavaScript 014)](https://i.ytimg.com/vi/TXSgQZsVW8w/mqdefault.jpg)
![Unsigned Numbers! [The Bits And Bytes Of Binary ep. 3]
This mini series is all about binary. Over the course of the series, well be building a library that gives us precise control of every bit and operation.
Youll learn how the logical and arithmetic operations work, how different kinds of numbers are encoded, how to set, clear and toggle bits, and how we can create representations of structured binary data.
1. Bits
2. Operations
3. Unsigned Numbers
4. Addition
5. Zero Extension
6. Twos complement
7. Overflow Addition and Sign Extension
8. Shifting
9. Setting, Clearing, and Toggling Bits
10. Endianness
11. Structures
=[ 🔗 Links 🔗 ]=
💌 Updates to your inbox: https://tinyletter.com/lowleveljavascript
⭐️ Patreon: https://www.patreon.com/lowleveljavascript
🎥 Playlist: https://www.youtube.com/watch?v=pOM86M1pGb4&list=PLP29wDx6QmW47oPsNBFNEi_SYTOLDJXqQ
💻 Github Repo: https://github.com/LowLevelJavaScript/The-Bits-And-Bytes-Of-Binary
=[ 🎶 Music 🎶 ]=
Game Plan - The Morning After Unsigned Numbers! [The Bits And Bytes Of Binary ep. 3]](https://i.ytimg.com/vi/TdPQ-1TEiNI/mqdefault.jpg)

![Fantasy Console Emulator: System Integration
In this installment of the Fantasy Game Console Series (an extension to the 16-Bit Virtual Machine Series), were integrating the system. Well be covering building out the memory mapped devices, integrating the CPU, taking and mapping input to the address space, and wiring in the graphics pipeline and execution model. We explore the data format for games by setting up all the required data and code in memory, including configuring the interrupt vector and handlers. As a bonus, we implement a caching solution for graphics which greatly improves the performance of drawing and thus of the entire fantasy game console!
The fantasy console serves as a very simple model for an emulator of a classic game console like the NES or the GameBoy, only without all the tricky real world details and limitations that come with such systems. It allows us to contextualise all the topics weve been learning about while building the VM, and gain some understanding about how it must have been to be a programmer in the days of true resource constraint!
00:00 - Improving graphics performance with caching
03:10 - Writing the caching code
09:00 - Testing the cache performance
09:40 - Discussing the offscreen changes
12:13 - Creating memory mapped devices
13:52 - Setting up tile memory
14:47 - Setting up background and foreground memory
16:12 - Setting up the sprite table
16:57 - Building the memory mapped controller input device
17:55 - Caching tiles
18:27 - Writing some assembly code to bootstrap the machine
19:48 - Setting up the interrupt vector
20:23 - Initialising a CPU instance
20:40 - Setting up the game loop and graphics pipeline
=[💻 Changes Made Offscreen 💻]=
New Instructions
A few new instructions were added to the VM, and all were to make it easier to move 8 bit values around, instead of the native 16 bit values. These are:
- move 8-bit literal value to register
- move 8-bit value in memory to register
- move low 8-bits of register to memory
- move high 8-bits of register to memory
- move 8-bit value, pointed to by register, to register
- move low 8-bits in register to address pointed to by register
CreateRAM / CreateROM
The old function `createMemory` has been replaced by 2 new functions: `createRAM` and `createROM`. `createRAM` is essentially the same as the older function, but adding more to the exposed interface (the interface being the DataView). Namely, it adds some new methods:
- load: which takes an array of bytes and places them into the memory buffer
- slice: which returns a continuous subset of the bytes contained in the memory buffer
The `createROM` function is like `createRAM` in every way, except that the exposed `setUint16` and `setUint8` methods do not actually set data - therefore a programmer writing assembly code for this system cannot alter what is in the memory. The emulator, however, can still use the `.load` method to set the initial value of the device. You can imagine that this will be done when the emulator decodes a cartridge ROM.
As mentioned in the video, the controller input data is also modeled as a ROM - though its not actually a ROM in the traditional sense. What were really doing is using the interface to stop the programmer writing to this protected memory space, while using the `.load` method to update the input values every frame.
Memory Mapper
A small change that allows us to provide a start address and a size, instead of a start address and an end address. Its a better interface, (a) because you tend to think of devices in terms of their size anyway, and (b) because youre never sure whether start/end arguments are inclusive of the final element!
Assembler
This one was pretty self explanatory: The functionality of the assembler was simply wrapped up in a function, which instead of finding its code directly in the file (which we did during testing), instead takes it from the argument. The offset argument (entry point is probably a better name), simply allows us to position the code in memory, by calculating the addresses of all labels and other symbols in reference to this initial offset.
=[ 🔗 Links 🔗 ]=
🎞 Series Playlist: https://www.youtube.com/playlist?list=PLP29wDx6QmW5DdwpdwHCRJsEubS5NrQ9b&playnext=1&index=1
💌 Updates to your inbox: https://tinyletter.com/lowleveljavascript
🗣 Discord: https://discord.gg/FPWaVgk
⭐️ Patreon: https://www.patreon.com/lowleveljavascript
💻 Github Repo: https://github.com/LowLevelJavaScript/16-Bit-Virtual-Machine/ Fantasy Console Emulator: System Integration](https://i.ytimg.com/vi/USvkqF6bMZ4/mqdefault.jpg)
![Frogger In Assembly: Fantasy Console Part 3
In this installment of the Fantasy Game Console Series (an extension to the 16-Bit Virtual Machine Series), were creating a game in assembly! Specifically, were trying to recreate the mechanics of frogger, a classic which should a bunch of interesting challenges and problems to solve.
The fantasy console serves as a very simple model for an emulator of a classic game console like the NES or the GameBoy, only without all the tricky real world details and limitations that come with such systems. It allows us to contextualise all the topics weve been learning about while building the VM, and gain some understanding about how it must have been to be a programmer in the days of true resource constraint!
=[ 🔗 Links 🔗 ]=
🎞 Series Playlist: https://www.youtube.com/playlist?list=PLP29wDx6QmW5DdwpdwHCRJsEubS5NrQ9b&playnext=1&index=1
💌 Updates to your inbox: https://tinyletter.com/lowleveljavascript
🗣 Discord: https://discord.gg/FPWaVgk
⭐️ Patreon: https://www.patreon.com/lowleveljavascript
💻 Github Repo: https://github.com/LowLevelJavaScript/16-Bit-Virtual-Machine/ Frogger In Assembly: Fantasy Console Part 3](https://i.ytimg.com/vi/UkPB1ukAgbI/mqdefault.jpg)
![Addition In Digital Logic [The Bits And Bytes Of Binary ep. 4]
This mini series is all about binary. Over the course of the series, well be building a library that gives us precise control of every bit and operation.
Youll learn how the logical and arithmetic operations work, how different kinds of numbers are encoded, how to set, clear and toggle bits, and how we can create representations of structured binary data.
1. Bits
2. Operations
3. Unsigned Numbers
4. Addition
5. Zero Extension
6. Twos complement
7. Overflow Addition and Sign Extension
8. Shifting
9. Setting, Clearing, and Toggling Bits
10. Endianness
11. Structures
=[ 🔗 Links 🔗 ]=
💌 Updates to your inbox: https://tinyletter.com/lowleveljavascript
⭐️ Patreon: https://www.patreon.com/lowleveljavascript
🎥 Playlist: https://www.youtube.com/playlist?list=PLP29wDx6QmW47oPsNBFNEi_SYTOLDJXqQ
💻 Github Repo: https://github.com/LowLevelJavaScript/The-Bits-And-Bytes-Of-Binary
=[ 🎶 Music 🎶 ]=
Game Plan - Bad Snacks Addition In Digital Logic [The Bits And Bytes Of Binary ep. 4]](https://i.ytimg.com/vi/VMOyiYRFm8A/mqdefault.jpg)