Home
Categories
EXPLORE
True Crime
Comedy
Society & Culture
Business
Sports
Health & Fitness
Technology
About Us
Contact Us
Copyright
© 2024 PodJoint
Loading...
0:00 / 0:00
Podjoint Logo
US
Sign in

or

Don't have an account?
Sign up
Forgot password
https://is1-ssl.mzstatic.com/image/thumb/Podcasts115/v4/d2/01/2f/d2012f8d-2bba-b9b1-e0e7-14a686e6e019/mza_12162428384170880572.jpg/600x600bb.jpg
Jay's Commodore Podcast
Jay Versluis
16 episodes
8 months ago
Join Jay Versluis for tips and tricks on programming in BASIC and Assembly on vintage Commodore systems.
Show more...
Technology
RSS
All content for Jay's Commodore Podcast is the property of Jay Versluis and is served directly from their servers with no modification, redirects, or rehosting. The podcast is not affiliated with or endorsed by Podjoint in any way.
Join Jay Versluis for tips and tricks on programming in BASIC and Assembly on vintage Commodore systems.
Show more...
Technology
Episodes (16/16)
Jay's Commodore Podcast
Discovered: Commodore 64C used in an auto repair shop (2018)

I’ve recently discovered a tweet that showed a Commodore 64C complete with green monitor and 1541-II drive, heavily dust covered, but still working and being used in a Polish Auto Shop. The picture itself was fascinating enough, but I’ve also discovered that it was a screen grab from a video – which I’m including here as well (had to replace the music with something royalty free).
You can find the original article here: https://www.trojmiasto.pl/wiadomosci/Warszatat-samochodowy-zaslynal-dzieki-26-letniemu-komputerowi-Commodore-n106004.html
The tweet I found is here: https://twitter.com/HistoryToLearn/status/928821265783250945
Enjoy!!
Show more...
7 years ago
12 minutes 47 seconds

Jay's Commodore Podcast
How to write a text input routine in Commodore BASIC

In this screencast I’ll show you how to write your own INPUT routine in Commodore BASIC. This comes in handy when you want to reject certain keys from being used when asking users for keyboard input. In my example I’m going to allow all alpha characters (A-Z), as well as SPACE, RETURN and the DELETE key.
Here’s the code:
.gist table { margin-bottom: 0; }













This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters

Show hidden characters













5 print



10 w$=""



20 print "(greater than)_";



30 get a$:if a$="" then 30



40 a=asc(a$)



50 if a=13 then 200:rem return



60 if a=32 then 110:rem space



70 if a=20 then 300:rem backspace



100 if a<65 or a>90 then 30



110 print chr$(20);a$;"D";



115 w$=w$+a$



120 goto 30



200 rem handle return



210 print chr$(20)



215 if w$="" then print:print"you typed



nothing!":end



220 print:print"you typed:":print w$



230 end



300 rem handle backspace



305 if len(w$)=0 then 30



310 print chr$(20);chr$(20);"D";



320 w$=left$(w$,len(w$)-1)



330 goto 30






view raw

input.bas

hosted with ❤ by GitHub



Show more...
7 years ago
22 minutes 52 seconds

Jay's Commodore Podcast
Flashing Border Colors on the Commodore 128 in Machine Language

In this episode I’ll show you how to create the iconic flashing borders on Commodore machines. Back in the day, when the system was loading, this was a nice way to indicate that the computer is busy doing something rather than being dead.
I’ll show you the principle both in BASIC and in Machine Language on the C128. The VIC-II chip is the same on the C64 though, so this will also work on the Commodore 64.
The same approach can be used on the Plus/4, however the addresses for the border and background colours are different (decimal 65305, or hex $FF19).
The VIC-20 is another story, as the border and background colour are changed using the same address (decimal 36879, or hex $900F). This link may help though: http://www.sleepingelephant.com/ipw-web/bulletin/bb/viewtopic.php?t=5905
As always, enjoy 🙂
Show more...
7 years ago
8 minutes 21 seconds

Jay's Commodore Podcast
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!
Show more...
7 years ago
11 minutes 33 seconds

Jay's Commodore Podcast
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 and ON… GOTO/GOSUB statements (available on all versions of Commodore BASIC), as well as the expanded IF/THEN/ELSE version (available on the C128 and Plus/4 only).
In addition, I’ll also show you how to use the BEGIN and BEND clauses that were introduced with the C128.
Show more...
7 years ago
14 minutes 4 seconds

Jay's Commodore Podcast
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 modern machines. It’s ingenious!
You can get the full source code on GitHub – it works a treat!
For those who don’t quite know what to do with it, here are some instructions that’ll help you get CBM BASIC up and running on macOS.
Download
GitHub provides a convenient way to either clone a repository on your local machine if you have GitHub for Desktop installed, or you can download a ZIP file and unZIP it somewhere on your system. Once done, you should see a directory structure that looks exactly like the repo on GitHub.
Compile
You need a few utilities installed your your Mac to be able to compile files. Downloading Xcode will ptovide you with an excellent (and free) IDE as well as the command line tools needed to do that (gcc, make and several other goodies). You might be able to bring those components in using the Homebrew package manager.
Using your Terminal app, navigate to your unZIPped folder. It includes a MAKEFILE so there’s no need to mess with any parameters. Enter “make” at the command prompt, and after a few moments you should have a file called “cbmbasic” without an extension in the same directory. That’s the binary for your Mac.
To make it executable, we’ll have to tweak the file permissions – otherwise our operating system won’t be able to run it. We’ll do it using the chmod command:
chmod +x ./cbmbasic
You can test if it works by calling the binary without any parameters like this:
./cbmbasic
If all goes well you should see something like this:

For easy access, copy the binary over to your /usr/bin directory. That’s where common command line utilities are installed on Mac and Linux systems. The added benefit is that the path to that folder is already in your local $PATH variable, and as such you can simply type “cbmbasic” from any location when you’re on the command line.
Here’s how to copy the binary over (this will ask for your administrator password):
sudo cp ./cbmbasic /usr/bin
Using Direct Mode
When you run the binary it will bring up something like the standard BASIC command prompt we’re used to seeing on the Commodore 64. There are however a few important differences between a C64 emulator and this implementation:

* this is NOT an emulator
* cursor keys DO NOT work
* all commands typed in must be CAPITALISED

Other than that, you can start typing like on a real machine. Be careful with certain POKE commands though as those may call system routines that might not be implemented.
LOAD and SAVE commands have been tweaked to reference the command line structure. They work just fine, but will load and save files in Commodore file format (which is not clear text ASCII – more on that later). For example:
LOAD"$"

LIST

0 "/Users/versluis/Desktop/cbmbasic" 00 2A
4    "."                PRG  
2    ".."               PRG  
2    ".git"             PRG  
567  "cbmbasic"         PRG  
7350 "cbmbasic.c"       PRG  
593  "cbmbasic.o"       PRG  
19   "cbmbasic.vcproj"  PRG  
20   "console.c"        PRG  
3    "console.h"        PRG  
8    "console.o"        PRG  
4    "glue.h"           PRG   
Show more...
7 years ago
18 minutes 51 seconds

Jay's Commodore Podcast
Writing HELLO WORLD in Machine Language on the Commodore 128


The Commodore 128 has a built-in machine language monitor which makes it ideal for ML development. However, most (or pretty much all) documentation on this subject is geared towards the Commodore 64, making it slightly difficult to get a head start in writing ML code for the 128.
Before I forget how to do it, here are a few pointers – courtesy of Jim Butterfield’s book “Machine Language – Expanded Edition”.
Getting Started
Let’s begin by typing MONITOR in C128 mode. It’ll take us to the machine language monitor. We’ll start our programme at $0B00. To begin assembling our code, we’ll type A 0B00 (A for Assemble), followed by these lines:
LDX #$00
LDA $0C10,X
JSR $FFD2
INX
CPX #$2B
BNE $0B02
RTS
The MONITOR will turn this text into the output you’ll see in the screenshot above (the lines starting with a . dot). Here’s what this code will do when called:
First we’ll load the X register with a value of zero. We’ll use this register as a counter. In the next line we’ll load the accumulator with whatever is stored in address $0C10 plus whatever is stored in the X register. So if X has a value of zero, then the contents of $0C10 will be loaded. If X was 1, then the value in $0C11 would be loaded, and so forth.
We’re using this as ASCII representation of our text (Hello World in a box in this case). With JSR $FFD2 we’ll call a Kernal routine that prints a single character onto the screen. Now we’re incrementing X by one and ask if it’s 45 yet (CPX #$2D). This would indicate that we’ve printed all the characters we need. If that’s not the case, we’ll return to line 2 and keep printing. Otherwise, we’ll stop the programme.
Storing ASCII characters
You’d think it was possible to simply type in text in the MONITOR. But of course that would be too easy. Instead we need to grab one of those massive tables and hack in each character’s ASCII code in hex. How convenient!
Type M 0C10 (or whichever location in memory you’d like to store your text string at) and overtype the numbers at the start of the line, each one representing a single byte of our ASCII text. At the end of each line you’ll see what those characters look like when converted.

In my case it’s a total of 45 characters, beginning with a return, followed by the top of the box, HELLO WORLD, and the bottom of the box.
Running from the MONITOR
To start the programme from the monitor, we’ll type G F0B00. We’ll end up with a SYNTAX ERROR and back on the BASIC screen though due to the RTS command at the end of the listing. If we replace it with a BRK command instead, we’ll end up back in the MONITOR.
The important thing to remember is the five digit addressing mode on the C128 (i.e. G for GO, followed by F0B00). Our programme starts at $0B00 in memory, but to make it run properly we’ll have to specify which BANK it should be called from. Anything other than BANK 0 or BANK 1 is fine, otherwise we won’t reach the print routine at $FFD2. In my example I’m choosing F, but E would work fine too (as we’ll see in a moment).
Running from BASIC
Type X to exit the monitor and go back into the land of BASIC. First we’ll need to choose a BANK. We’ll have 16 to choose from (0 to 15), so perhaps let’s try BANK 15. Now we’ll need to type the start of our programme in decimal:
BANK 15
SYS 2816
or we can use the DEC command to convert hex to decimal on the fly:
BANK 15
SYS DEC("0B00")

Saving the programme
From the MONITOR, we can save the programme using the S command. It needs to be followed by a name (in double quotes), followed by the drive number,
Show more...
7 years ago
21 minutes 57 seconds

Jay's Commodore Podcast
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 random draws can continue.
When this app is run continuously it will collect statistical data on how many lottery draws are necessary to match all supplied numbers.
PS: By the time the video had uploaded, my emulator had drawn over one million sets, and none of them have matched my numbers 🙁
Show more...
7 years ago
13 minutes 30 seconds

Jay's Commodore Podcast
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 up. It’ll be an interesting experiment to see how many draws that will take…
Enjoy!
Show more...
7 years ago
16 minutes 20 seconds

Jay's Commodore Podcast
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 programme we’ve been working on, so that we can prompt the user for some numbers to compare against later.
Enjoy!
Show more...
7 years ago
9 minutes 31 seconds

Jay's Commodore Podcast
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.
BASIC 3.5 / BASIC 7
Here’s the full code for the C128 and Plus/4, which is based on my earlier Lottery Number generator listing. PRINT USING appears in line 120:
10 x=rnd(-ti)
20 for i=1 to 6
30 rn=int(rnd(1)*49)+1
40 for j=1 to i
50 if n(j)=rn then 30
60 next j
70 n(i)=rn
80 next i
100 print:gosub 200
110 for i=1 to 6
120 print using "#####";n(i);
130 next
140 print
199 goto 20
200 rem bubble sort
210 for i=5 to 1 step -1
220 for j=1 to i
230 x=n(j):y=n(j+1)
240 if x>y then n(j)=y:n(j+1)=x
250 next:next
299 return
BASIC 2.0
And here’s the same listing without PRINT USING for the C64 and VIC-20. The string formatting happens in the subroutine in line 300:
10 x=rnd(-ti)
20 for i=1 to 6
30 rn=int(rnd(1)*49)+1
40 for j=1 to i
50 if n(j)=rn then 30
60 next j
70 n(i)=rn
80 next i
100 print:gosub 200
110 for i=1 to 6
120 gosub 300:print a$;
130 next
140 print
199 goto 20
200 rem bubble sort
210 for i=5 to 1 step -1
220 for j=1 to i
230 x=n(j):y=n(j+1)
240 if x>y then n(j)=y:n(j+1)=x
250 next:next
299 return
300 rem space the numbers
310 a$=str$(n(i))
320 if len(a$)=2 then a$=" "+str$(n(i))
399 return
Any questions, please let me know. Happy retro hacking!
PS: It got a bit dark there at the end on my webcam. Help me get some lights by supporting me on Patreon 😉
Show more...
7 years ago
8 minutes 48 seconds

Jay's Commodore Podcast
Sorting an Array on the Commodore 64

In this episode I’ll demonstrate how to sort a numeric array on the Commodore 64. The same principle works for string arrays, and of course on all other Commodore BASIC computers.
The technique I’m using here is called Bubble Sort: in effect we’re comparing the first two items in the array, and if the left one is larger than the right one, the values are swapped around. This loop continues until all items in the array have been compared and sorted (hence the smallest items “bubble” to the front of the array, much like the smallest bubbles in a soda float to the top first).
Here’s the full code I’m building, including the lottery portion. The Bubble Sort code starts in line 200.
10 x=rnd(-ti)
20 for i=1 to 6
30 rn=int(rnd(1)*49)+1
40 for j=1 to i
50 if n(j)=rn then 30
60 next j
70 n(i)=rn
80 next i
100 print:gosub 200
110 for i=1 to 6
120 print n(i);
130 next
140 print
199 goto 20
200 rem bubble sort
210 for i=5 to 1 step -1
220 for j=1 to i
230 x=n(j):y=n(j+1)
240 if x>y then n(j)=y:n(j+1)=x
250 next:next
299 return
I’ve explained how to build the lottery generator in this code here: https://wpguru.co.uk/2018/03/how-to-generate-lottery-numbers-on-the-commodore-64/
Happy retro hacking!
Show more...
7 years ago
6 minutes 46 seconds

Jay's Commodore Podcast
How to generate Lottery Numbers on the Commodore 64

In this episode I’ll demonstrate how to draw random lottery numbers on a Commodore 64. The secret sauce here is not only the RND function to generate random numbers, but also two loops inside each other that prevent the same number from coming up more than once.
Here’s the lottery generator code:
10 x=rnd(-ti)
20 for i=1 to 6
30 rn=int(rnd(1)*49)+1
40 for j=1 to i
50 if n(j)=rn then 30
60 next j
70 n(i)=rn
80 next i
100 print
110 for i=1 to 6
120 print n(i);
130 next
140 print
199 end
To adapt this listing to match your local lottery, change line 20 to the amount of numbers to be drawn from your pool (6 in my example), and change the value in line 30 to match the size of your pool (49 in my example).
Any questions, please let me know below.
Happy retro hacking!
Show more...
7 years ago
10 minutes 41 seconds

Jay's Commodore Podcast
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 a$
30 gosub 100
40 print:print wd;" words:"
50 for i=1 to wd
60 print wd$(i)
70 next
99 end
100 rem word splitter
110 lt$="":wd=1
120 for i=1 to len(a$)
130 lt$=mid$(a$,i,1)
140 if lt$=" " then wd=wd+1:next
150 wd$(wd)=wd$(wd)+lt$
160 next
199 return
The interesting part starts in line 100 and onwards, where I’m building a subroutine that deals with the string functions. In line 110 I’m resetting/initialising two of the three important variables: LT$ holds a single letter from the phrase we’re getting in A$, while WD is counting each word we’re splitting out.
The FOR loop in line 120 parses each letter of the phrase, and if it finds a space character (line 140), the word count is increased. If the letter is not a space, then it’s added to the current word held in WD$(WD). The current word is assembled character by character.
Apologies for the audio quality, I did this on my laptop while sitting on the balcony, hence sea planes flying overhead can be heard (as well as the neighbours dog and kids).
Happy hacking 🙂
Show more...
7 years ago
10 minutes 26 seconds

Jay's Commodore Podcast
How to build a time of day clock on the Commodore 64

In this video I’ll demonstrate how to build a simple clock on the C64. We’ll go through this process step by step, including the built-in TI and TI$ variables, string formatting with LEFT$, RIGHT$ and MID$, as well as screen formatting.
Here’s the code I’m writing – works in Commodore BASIC v2 and above:
5 input "qwhat is the current time (hhmm
ss) ";ti$
10 print chr$(147):print chr$(5)
20 a$ = left$(ti$,2)
25 a$ = a$ +":"
30 a$ = a$ + mid$(ti$,3,2)
35 a$ = a$ +":"
40 a$ = a$ +right$(ti$,2)
50 gosub 200
60 print chr$(19)
70 print "qqqqqqqqqqq]]]]]]]]]]]]]]curre
nt time"
80 print "]]]]]]]]]]]]]]]]";
90 print a$
100 goto 20
200 rem print a box
210 print chr$(19)
220 print "qqqqqqqqqq]]]]]]]]]]]]]UCCCCC
CCCCCCCI"
230 print "]]]]]]]]]]]]]B]]]]]]]]]]]]B"
240 print "]]]]]]]]]]]]]B]]]]]]]]]]]]B"
250 print "]]]]]]]]]]]]]JCCCCCCCCCCCCK"
299 return
Many of the characters that appear in this listing are cursor control characters and appear in reverse in the video. They either position the cursor or print PETSCII graphics.
Inspired by David’s video, in which he connects an LCD screen to his C64’s User Port: https://www.youtube.com/watch?v=vV8FbwobrKY
Show more...
7 years ago
30 minutes 24 seconds

Jay's Commodore Podcast
How to create random YouTube URLs in Commodore BASIC v2

In this episode I’ll demonstrate how to create those seemingly random YouTube Video IDs using a Commodore 64.
Here’s the code I’m writing – works in BASIC v2 and above:
10 print chr$(14)
20 gosub 100:x=rnd(-ti):cn=1
30 a$="https://youtu.be/"
40 for i=1 to 11
50 rn=int(rnd(0)*62)+1
60 a$=a$+yt$(rn)
70 next
80 print:print cn;" : ";a$
85 cn=cn+1
90 goto 30
85 cn=cn+1
90 goto 30

100 rem populate array
110 dim yt$(62)
120 i=1
130 for j=65 to 90
140 yt$(i)=chr$(j)
150 i=i+1
160 next j
170 for j=193 to 218
180 yt$(i)=chr$(j)
190 i=i+1
200 next j
210 for j=48 to 57
220 yt$(i)=chr$(j)
230 i=i+1
240 next j
299 return
The first line switches to lower case letters (I forgot to show that in the video).
NOTE: In addition to the upper case and lower case alphabet, and the numbers 0-9, YouTube also use two special characters that I forgot to mention in the video. One is the standard minus sign (-), and the other one is the underscore (_). The Commodore machines cannot produce the latter. For simplicity’s sake, I’ve left both of those out (just though I’d mention it here).
Inspired by Tom Scott’s video “Will YouTube ever run out of Video IDs” – watch it here: https://www.youtube.com/watch?v=gocwRvLhDf8
Show more...
7 years ago
16 minutes 58 seconds

Jay's Commodore Podcast
Join Jay Versluis for tips and tricks on programming in BASIC and Assembly on vintage Commodore systems.