BASLOAD Tutorial / Notes

Tutorials and help articles.

(Posts require approval. See pinned post.)
Forum rules
Post guides, tutorials, and other instructional content here.

This topic area requires approval, so please be patient while we review content to make sure it fits the expectations for this topic area.

Tech support questions should be asked in Hardware or Software support.
Post Reply
voidstar
Posts: 496
Joined: Thu Apr 15, 2021 8:05 am

BASLOAD Tutorial / Notes

Post 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).
voidstar
Posts: 496
Joined: Thu Apr 15, 2021 8:05 am

Re: BASLOAD Tutorial / Notes

Post 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
Last edited by voidstar on Sat Jul 27, 2024 3:40 pm, edited 1 time in total.
Post Reply