TEGA: Typescript Embedded Game Boy (Macro) Assembler

[Francis Stokes] has a real love for the original Game Boy, suggesting that owning this machine pushed him along a certain path that many of us would recognize. Developing Game Boy games isn’t particularly difficult from a hardware point of view, as you can easily buy special cartridges that have an SD card slot, allowing custom code. [Francis] had the idea of easy software development by producing a typescript hardware abstraction library, TEGA (or TypeScript Embedded Game Boy Macro Assembler). This provides a safe environment in which to play with the code, which can then be run inside an emulator such as BGB, before being deployed onto actual hardware.

The video embedded below — which we warn you now is a long one — goes into extensive justification and technical explanation of how [Francis] leverages typescript to create lots of nice features to produce safe code, whilst handling many of the Game Boy’s architectural restrictions, as well as the weirdness of the Sharp SM83 processor that powers it. We particularly liked the built-in support for on-the-fly asset compression, since every byte matters in the meager 32 Kb system, it’s nice not to have to think about it all the time! After discussing TEGA, the Game Boy hardware, the ins and outs of a demo game Block Jump, and then how to debug with BGB, we’re pretty confident many of you will be in a strong position to bust out a Game Boy application in the future!

As an aside, we did also stumble upon a new hardware guide provided by Finnish programmer and Game Boy superfan [Joonas Javanainen] which will help frame some of the topics [Francis] was talking about.

You may recall a little while back, the same author targeted the RISC-V using code written in typescript. After all, when you’re comfortable with a tool, you can shape it to do practically anything.

2 thoughts on “TEGA: Typescript Embedded Game Boy (Macro) Assembler

  1. If I’m not mistaken, this basically is abusing the typescript support in VS Code to implement a macroassembler+IDE. Quite a hack!
    Although, other options exist for that. There’s even a VS Code extension that supports several macroassemblers for the Z80 and related CPUs.

    1. I wouldn’t call it an abuse – rather building on the ecosystem of tooling to provide a good experience. There isn’t anything special about VSCode here; Any editor with LSP support could provide the same real-time feedback.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.