Load BASIC programs from text

All aspects of programming on the Commander X16.
Post Reply
Stefan
Posts: 465
Joined: Thu Aug 20, 2020 8:59 am

Load BASIC programs from text

Post by Stefan »


Hello everyone!

The last week I've been working on a program that loads a BASIC program from a text file.

After some (or a lot of) fiddling I finally got it to work.

Some notes on the source file format:


  • There are no line numbers in the source file


  • Instead you define labels on lines you want to jump to with GOTO or GOSUB


  • Labels must be defined at the start of a line, but it's OK to have leading blank spaces


  • A label must start with one of the letters A-Z. The following characters may be A-Z or numbers 0-9


  • The symbol table stores the first 12 letters of a label


  • Line breaks are marked by a single LF or CR


The work flow:


  • You edit the source file on the X16 using X16Edit or any other available editor


  • Store the source file on the SDCARD


  • Load the BASIC loader program, and run it


  • Enter the source file name


  • Type RUN to run the loaded BASIC program


Enclosed is a video showing this work flow.

I need to do some more work on this before publishing.


Scott Robison
Posts: 952
Joined: Fri Mar 19, 2021 9:06 pm

Load BASIC programs from text

Post by Scott Robison »


Seems very similar to my BASIC Preprocessor project.

Stefan
Posts: 465
Joined: Thu Aug 20, 2020 8:59 am

Load BASIC programs from text

Post by Stefan »


True.

I forgot that you had made that program. I must look at your solution again.

There are some differences as far as I can tell:


  • Source format is different


  • My program does not support long variable names


  • My program outputs BASIC code directly to RAM


Scott Robison
Posts: 952
Joined: Fri Mar 19, 2021 9:06 pm

Load BASIC programs from text

Post by Scott Robison »


Right. I understand it's not identical, just similar. That's no reason *not* to do it though. Just commenting. ?

Stefan
Posts: 465
Joined: Thu Aug 20, 2020 8:59 am

Load BASIC programs from text

Post by Stefan »


I did now publish a first version of my loader.

You find it here: https://www.commanderx16.com/forum/index.php?/files/file/192-load-basic-programs-from-text-files/

 

Post Reply