Prog8 Number Guessing Tutorial

167

In this second episode of the series, CommodoreSam and Andrew continue their exploration of Prog8 number guessing. This time, they go beyond the “Hello World” introduction and convert a BASIC program from the Commodore 64 User’s Guide into a fully compiled Prog8 version. The tutorial highlights how Prog8 modernizes 8-bit development without losing its low-level performance edge.

Prog8 is a compiled programming language targeting the 8-bit 6502 CPU family. It provides many conveniences over raw assembly code while still allowing precise hardware control. Supported targets include the Commodore 64, C128, PET, OtterX, Commander X16, and more. It’s designed for developers who want to write clean, efficient, high-performance programs without the verbosity of traditional assembly.

Exploring the Conversion

Andrew begins by cloning a GitHub repository containing both the BASIC and Prog8 versions of the classic number guessing game. The BASIC original randomly selects a number for the player to guess, while Prog8’s version introduces structured syntax, modern flow control, and explicit variable types.

The tutorial explains how Prog8’s modules and subroutines replace BASIC’s line-numbered logic. Viewers see how to define unsigned byte variables, handle string-to-number conversion, and use conditionals and loops for control flow. Andrew also demonstrates importing libraries for math operations and text input, along with the option to use inline assembly for critical routines.

Why It Matters

By recreating the number guessing game in Prog8, the video illustrates how developers can enjoy modern coding practices on vintage 8-bit hardware. It bridges the gap between high-level convenience and raw hardware performance. Andrew and CommodoreSam wrap up by inviting suggestions for future lessons, teasing topics like graphics, sprites, and Tetris clones. The Prog8 number guessing example proves how approachable and powerful 6502 programming can be with this modern compiler-based language.

Subscribe
Notify of
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments