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.

Leave a Reply

%d bloggers like this:

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close