BASIC Archives

Programmatic Loops in Commodore BASIC

In this episode I’ll demonstrate how to use programmatic loops in Commodore BASIC. I’ll show you how to use the FOR/NEXT loop (available in all versions of Commodore BASIC), as well as the DO/WHILE loops (available on the Plus/4 and C128). Enjoy! https://wpguru.co.uk/wp-content/uploads/2018/08/Loops-in-Commodore-BASIC.mp3Podcast: Download (Duration: 11:33 — 10.6MB)

Flow Control in Commodore BASIC

In this episode I’ll explain the concept of Flow Control in Commodore BASIC. It’s kind of a video update of a post I did a while ago. In essence, it means that we can tell the programme to take a different route in the code depending on a condition that’s met. We’ll explore the IF/THEN … Read more

How to run Commodore BASIC as a Scripting Language on macOS

Did you know you can run Commodore BASIC v2 on your Mac and Linux systems as a scripting language? It’s true – thanks to the marvellous efforts of Michael Steil and James Abbatiello. They’ve adapted the original BASIC v2 as featured on the VIC-20 and C64 with additional routines so that it works natively on … Read more

Lottery Statistics in Commodore BASIC

In this episode I’m adding statistics support to my previous lottery generator on the Commodore 64. I’ll add an array that is updated if my supplied numbers have been matched, and how many times over how many draws this has happened. I’ll also add an option to pause the programme and display the statistics before … Read more

Matching Lottery Numbers on the Commodore 64

In this episode I’m amending my previous lottery number generator to take six lucky numbers from the user to match against the randomly drawn numbers from the Commodore 64. This will allow us to compare what the computer has drawn to the user’s input, as well as keep drawing numbers until the user input comes … Read more

Working with Keyboard Input in Commodore BASIC

In this episode I’ll show you three ways to take user input from the keyboard in Commodore BASIC. The INPUT and GET commands work on all systems, while the GETKEY command only works on the Plus/4 and C128. I’ll demonstrate how to use all of them. This will come in handy for our little lottery … Read more

How to print numbers as columns in Commodore BASIC

In this episode I’m demonstrating how to print numbers in evenly spaced columns in Commodore BASIC.

On the C128 and the Plus/4 we can use a nifty little function called PRINT USING for this, with which we can format the output of any printed text or variable.

On the C64 and VIC-20 that function doesn’t exist, so we’ll have to convert a numeric value into a string (using the STR$ function), and then determine how long our string is. Following that we’ll have to manually pad our string value with as many spaces as are required.

Read more

How to build a Word Splitter on the C64 in Commodore BASIC

In this episode I’m demonstrating how to build a word splitter on the Commodore 64. We’ll use string functions to parse a sentence and split each word off into an array of words so that they can be analysed later (for example, as part of an adventure game). Here’s the code I’m building: 20 input … Read more