Page 1 of 1

BASLOAD Tutorial / Notes

Posted: Sat Jul 27, 2024 3:27 pm
by voidstar
Here is a sample of a few simple programs being done using BASLOAD. The intent is to just show the workflow of using on-system EDIT and BASLOAD, and the samples are some useful examples on polling key-strokes, using TILE vs LOCATE+PRINT, and showing the text-mode color chart (time offsets in the Description).

https://www.youtube.com/watch?v=BC8ccp8HrIM

Not yet a full blown tutorial (no narration), but a starting point on using BASLOAD.

I did forget to show using the "PROGRAMMING TOOLBOX" feature of EDIT -- where you can invoke BASLOAD (CTRL+F then B). Useful for quickly finding any syntax errors in your BASLOAD (since the error messages relay back the line number of the issue and show right up in EDIT). Since EDIT is in ROM and uses resources "out of BASIC", when you invoke BASLOAD in this way, then you just exit EDIT and do LIST and your "raw BASIC" program is right here the internal BASIC expects it to be.


I've always felt that BASLOAD is one of the most amazing features of the X16 and deserves a grand introduction, being a fairly novel approach on using BASIC that is built into the system. I don't think any other system has a feature like this, to wrap the existing on-system tokenized BASIC with a more "plain text" approach. This allows both long variable names and symbolic branching, giving a more "QuickBASIC" feel, right on the system itself (no external or "mainframe" tools needed).

Re: BASLOAD Tutorial / Notes

Posted: Sat Jul 27, 2024 3:31 pm
by voidstar
The video in the link mentioned above shows the writing (input) and running of the following examples:

SAMPLE1:

If you forget what keyboard code is associated with what key, use this code to quickly discover and verify those codes. Some "modifier keys" (SHIFT, ALT, CTRL) will need a different approach.

Code: Select all

ASK.AGAIN:
GET A$
A = ASC(A$)
IF A <> 0 THEN PRINT A
GOTO ASK.AGAIN


SAMPLE2:

Likewise, if you forget what "screen code" (or display code) is needed to get a certain symbol on the screen, this program can show what is needed depending on whether you are using TILE or just PRINT CHR$. When using PRINT, certain characters will impact the system behavior, so prefixing the output with a PRINT CHR$($80) avoids that and forces just showing the symbol always. Can try removing CHR$($80); part to see what happens (basically index 0-31 and 128-159 induce some screen effect; that is, the first 32 characters in the two halves between 0 to 255).

Code: Select all

SCREEN 9
COLOR 1,6
CLS

X=2
Y=2

FOR I = 0 TO 255

  TILE X,Y,I

  LOCATE Y+10,X
  PRINT CHR$($80);CHR$(I);

  X=X+1
  IF X > 35 THEN X=2:Y=Y+1

NEXT I


SAMPLE3:

This is same as the prior example, but shows some special BASLOAD directives (to add a symbol-file output, and some output adjustments such as to keep existing comments/reminders and to auto-number in increments of 10 instead of the default of 1).

Code: Select all

#SYMFILE "@:SAMPLE3.SYM"
#REM 1
#AUTONUM 10

SCREEN 9 : REM SET SCREEN RESOLUTION

GO.AGAIN:
X=2
Y=2
START.TIME=TI
FOR I = 0 TO 255

  TILE X,Y,I

  LOCATE Y+10,X
  PRINT CHR$($80);CHR$(I);

  X=X+1
  IF X > 35 THEN X=2:Y=Y+1

NEXT I

FOR I = 1 TO 38:TILE I,21,160
LOCATE 22,1:PRINT TI-START.TIME
GOTO GO.AGAIN
SAMPLE4:

I often forget what values result in which color combinations between foreground (FG) and background (BG). So this program makes a chart to quickly remind about that.
 

Code: Select all

COLOR 1,6
SCREEN 1

FOR BG = 0 TO 15
  FOR FG = 0 TO 15

    COLOR FG,BG

    LOCATE BG+2,FG*4+2
    PRINT HEX$(FG*16+BG);

    TILE FG*4+2+1,BG+2-1,160,FG*16+BG

  NEXT FG
NEXT BG

COLOR 1,6
LOCATE 20,1