New community dev tool uploaded: BASLOAD

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

New community dev tool uploaded: BASLOAD

Post by Stefan »




BASLOAD




View File






BASLOAD lets you write BASIC programs without line numbers in the editor of your choosing.

BASLOAD runs natively on the X16. As it's name implies, BASLOAD loads BASIC programs stored on the SD card into RAM. While loading a file, it's tokenized so that it can be run by the X16's built-in BASIC interpreter.

Source files are stored as plain text that can be edited in almost any editor on the X16 or on a modern computer. There are, however, special bindings for the text editor X16 Edit making the programming workflow more convenient.

Instructions on how to use BASLOAD and source code may be found here:

https://github.com/stefan-b-jakobsson/basload






 
Ender
Posts: 220
Joined: Sat May 09, 2020 9:32 pm

New community dev tool uploaded: BASLOAD

Post by Ender »


This is pretty handy! Although, I seem to have run in to a bug where it gets stuck loading forever.  I stepped through the code and it looks like, with my file, the last character is 13, so it keeps reading that and treating it as EOL, but never reaching the EOF part of the code.  I've attached it in case you're curious.  It's basically just the three-line example you gave in the original post.

TEST.BAS

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

New community dev tool uploaded: BASLOAD

Post by Stefan »



1 hour ago, Ender said:




This is pretty handy! Although, I seem to have run in to a bug where it gets stuck loading forever.  I stepped through the code and it looks like, with my file, the last character is 13, so it keeps reading that and treating it as EOL, but never reaching the EOF part of the code.  I've attached it in case you're curious.  It's basically just the three-line example you gave in the original post.



TEST.BAS 37 B · 1 download



Thanks.

I also noticed that bug. I think I have fixed it in version 0.0.2 now available on the download page.

The 0.0.1 version did not call READST to test EOF condition if the last char was LF or CR. It seems that you get only one shot at reading the EOF condition. If you miss that and read one more character, you will never get an EOF.

Source code  available at https://github.com/stefan-b-jakobsson/basload

Unless no more critical bugs are found, I will continue looking at performance issues. Without analyzing it a lot, I guess that the program's function to test for presence of a BASIC token is called a lot.

The label search already uses a checksum to speed up the search.

I think I could calculate the checksum of the tokens as well on program startup, and use these to speed up the token search.

Version 0.0.2 takes about 1 second to load a source file of 70 lines. That corresponds to 1,000 lines per 14.3 seconds. I'm sure it could be made to run a lot faster.

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

New community dev tool uploaded: BASLOAD

Post by Stefan »


I converted a small number guessing game to the source code format accepted by the BASLOAD tokenizer.

Original code found at: https://retrogamestart.com/answers/learn-commodore-64-basic-programming-type-text-based-games

 


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

New community dev tool uploaded: BASLOAD

Post by Stefan »


I've now got a test reimplementation of the token search function that uses a table of token metadata (lengths, checksums and pointers to start of token name).

This seems to have cut the time in half from version 0.0.2 at least for small programs, now using about 0.007 seconds per line of source code, corresponding to 7 seconds to load a source file of 1,000 lines.

Needs a bit of cleanup before publishing. Hopefully I find some time this weekend, but they are promising very nice weather where I live.

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

New community dev tool uploaded: BASLOAD

Post by Stefan »


Version 0.0.3 now published. It contains:


  • performance improvements,


  • support for ON ... GOTO N1, N2, N3


  • support for labels after THEN without preceding GOTO/GOSUB


  • code cleanup


Please let me know if you use it and find bugs.

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

New community dev tool uploaded: BASLOAD

Post by Stefan »


Published version 0.0.5 just now.

This version adds support for BASIC source code in ISO mode lower case.

On reading the source file, ISO mode lower case text is converted to upper case. The content of strings is, however, left untouched. This should make it possible to program conveniently in ISO mode as well.

Apart from that a few bug fixes. The function that was reading the Kernal version number on startup was still not working properly in all circumstances, which caused some "random" loading failures.

Available in the download section, and on Github.

mobluse
Posts: 177
Joined: Tue Aug 04, 2020 2:16 pm
Location: Lund, Sweden
Contact:

New community dev tool uploaded: BASLOAD

Post by mobluse »


It says "support for ON ... GOTO N1, N2, N3", but does it also support "ON ... GOSUB N1, N2, N3"?

X16&C64 Quiz: Try It Now! Huge Char Demo: Try It Now! DECPS: Try It Now! Aritm: Try It Now!
Stefan
Posts: 465
Joined: Thu Aug 20, 2020 8:59 am

New community dev tool uploaded: BASLOAD

Post by Stefan »



7 hours ago, mobluse said:




It says "support for ON ... GOTO N1, N2, N3", but does it also support "ON ... GOSUB N1, N2, N3"?



Yes, it also supports the ON ... GOSUB N1, N2, ... construct.

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

New community dev tool uploaded: BASLOAD

Post by Stefan »


Version 0.0.6 published now.

This version makes BASLOAD + X16 Edit = True.

As before, type SYS $9000 to load a BASIC source file. A new feature is that the program remembers the last loaded file, and you may select to reload that file without typing its name.

Another new feature is that you by typing SYS $9003 may load and start the text editor X16 Edit.

BASLOAD expects the X16 Edit executable to be stored in the root folder of the SD Card. The actual CBM DOS path is "//:X16EDIT*.PRG".

If BASLOAD has been used to load a BASIC source file, that file is automatically opened in the editor.

The purpose of these changes is to make the edit-save-load-test cycle more convenient.

A more thorough description of the BASLOAD usage is found on Github: https://github.com/stefan-b-jakobsson/basload

For an illustration of the BASLOAD+X16 Edit workflow, see the attached short video.



Post Reply