Categories
C64

Oddities of C64 BASIC

1 BORDER=1

Can you tell me why the very short BASIC programme above has a syntax error?

1 BRDER=1

But then the one with a slightly renamed variable name is perfectly ok?

It turns out it’s one of the limitations of Commodore BASIC V2. As explained here:

Variable names were limited to two letters. Or, specifically, any variable name longer than two characters was truncated, so that MARKUP and MAINTOTAL would both point to a single variable named MA.

Can somebody confirm this? IIRC, the C64 could handle longer variable names, but it’s a long time ago so I could be wrong.

Correct, the first two letters of a variable name must be unique. Also, your example variable MAINTOTAL contains the reserved word INT which would produce a ?SYNTAX ERROR.CarstenKlapp

http://wiki.c2.com/?CommodoreBasic

The word BORDER contains the BASIC command OR that cannot be used in a variable name!

I have no idea if I knew this back in the 90s. I presume I did but it had me scratching my head for 10 minutes last tonight trying to figure out why my BASIC programme wasn’t running.

The (re)discovery that variable names shouldn’t be longer than 2 characters long also explains the terse variable names I used in the BASIC portion of DMSREADER. We’re spoiled these days.

I also discovered that petcat doesn’t like uppercase BASIC commands but I have a nice Makefile now to compile BASIC and ASM portions of Disk Masher and copy them into a D64 for testing so it was a productive night.

Comments

comments

By Donncha

Donncha Ó Caoimh is a software developer at Automattic and WordPress plugin developer. He posts photos at In Photos and can also be found on Google+ and Twitter.

Leave a Reply