Vision BASIC - A New C64 BASIC Compiler

in Retro Technology14 days ago

Screen Shot 2022-06-21 at 14.44.04.png

Vision BASIC is the latest in a long, long line of tools intended to speed up the execution of C64 BASIC code.

Seems odd in 2022 to be talking about C64 programming tools, let alone NEW tools for the platform, but here we are!

What is Vision BASIC?

You can get all the official information at the website and there is an intro video by the author, Dennis Osborn, here:

In a nutshell, you can think of Vision BASIC as being three things:

  1. A compiler that accepts C64 BASIC code (mostly) and outputs a C64 standalone binary.
  2. New C64 BASIC language features and commands (more on that in a moment).
  3. An extensible system of modules and libraries to allow the community to contribute to the capabilities of the system.

If that wasn't already a LOT, in fact there is another facet of Vision BASIC that makes it incredibly powerful in the right hands. You can in-line assembly code, or even essentially use Vision's compiler as a 6510 assembly compiler.

While that is obviously not the entire goal of the package, it is worth highlighting because one of the main complaints about BASIC, and BASIC compilers, is that there are some things that are always going to be faster in pure assembly no matter how great your compiler's optimizations are. This basically says to the programmer ... ok, go right ahead!

Challenges with Vision BASIC

Sound perfect? Well, it is very, very good but not 100% perfect, and nor should you expect it to be!

First, your vanilla C64 breadbin is not able to run Vision unaided. You will need at least 256K of extra RAM in order to run Vision BASIC, which means you need either an original or emulated REU/SuperCPU.

If like me you have an Ultimate 64 or TheC64, or you have something like an Ultimate II+, you are golden. Otherwise modern C64 emulators such as VICE support REU emulation and you can simply compile your code on your development computer and then run it on any C64 after compilation as you ordinarily would do.

TheC64 Maxi is perfect for working with Vision BASIC as it has REU emulation AND all the lovely PETSCII keys!

Even without the memory requirements, you would probably want to compile anything quite beefy on emulation or with hardware acceleration anyway as code compilation on an 8-bit processor is quite a lengthy process.

Vision BASIC Code Differences

While Vision has excellent compatibility with C64 BASIC, there are some differences to be aware of.

I am sure many quirks will pop up as I dig in and start coding once I have the manual in my hands (I purchased the physical box set to be shipped to England but I do already have access to the digital download), but for now it seems the major pitfalls are where it comes to math, and in particular the order of operations.

Vision processes math equations from left to right, and does not like parentheses. It also can not do the calculations in-line and return the value to a function.

This means if you have something like:

10 PRINT 1+2*3

... instead of doing the multiplication first and the result coming back printing the answer as 7, it would throw a code formatting error asking you to split out the calculation, and then regardless it would figure out the answer as 9 instead.

Vision BASIC Extra Abilities

As mentioned above, Vision provides plenty of extra features not present in the original C64 BASIC.

Screen Shot 2022-06-21 at 15.59.52.png

Of course, some are visual, as the name would suggest, allowing drawing, characterset redefinition, and sprites to be much more easily performed. There are also commands for sound and music, interupts, and joysticks etc.

Less initially impressive, but something I am very grateful for, is you can add your own subroutines and even share them with other programmers. These are called Add-on Packs.

Future Updates

Dennis seems very receptive to ideas around his creation, and has a forum on his website for interacting with him and other users.

I would love for the use of external code editors to be made easier so that you do not have to edit on the C64 (or emulator), and given the escape from the C64 code editor, to do away with line numbers.

Of course, I am writing all of this without having my Vision package in my hands, I am sure there will be many more ideas after I get coding for real!