https://www.youtube.com/watch?v=BC8ccp8HrIM
In X16 EDIT, use CTRL+O to OUTPUT (save) your file.
In CMDR-DOS (BASIC prompt), use SHIFT+HOME to clear the screen.
Remember that in CMDR-DOS, it doesn't work based on buffering what you recently just typed. Rather, when you press ENTER, it works by interpreting the whole line that you are currently on. So, if there is a bunch of left over "garbage" on that line (such as from a prior program runtime), you may want to cursor (arrow keys) around to a blank line, or just clear the screen entirely (SHIFT+HOME).
Other references:
BASLOAD manual:
https://github.com/stefan-b-jakobsson/b ... manual.pdf
X16 EDIT manual:
https://github.com/stefan-b-jakobsson/x ... manual.pdf
X16 BASIC Technical Reference (for notes on each of the supported BASIC keywords):
https://github.com/X16Community/x16-doc ... 20BASIC.md
SAMPLE1: This sample queries for a single keypress by the user. If a key is pressed, it shows the corresponding numeric value of that key. Often it is faster to just re-type this program from brain-memory rather than looking up the numeric table of all the keys. This helps for things like the key code for the F1-F10 keys (which aren't in numeric order) or other special keys (like the arrow keys, DEL, etc). You can then use these same codes in a more extensive program later. For example "IF A = 133 THEN ..." (where 133 corresponds to F1, but if you forget that, then this quick program can help verify that). Press the PAUSE/BREAK or CTRL+C key to stop the program and return to the CMDR-DOS BASIC prompt. You can also output the key code in other formats, such as by adding HEX$(A) or CHR$($80);CHR$(A) after the "PRINT A".
Code: Select all
ASK.AGAIN:
GET A$
A = ASC(A$)
IF A <> 0 THEN PRINT A
GOTO ASK.AGAIN
SAMPLE 2: In contrast to keyboard codes, this program shows "screen codes" (or display-codes). As inherited from the original Commodore (CBM) PET, the symbols on the text-mode display use a different set of symbols than the keyboard matrix. There are some benefits to understanding that difference, mainly in that you can generally get better performance by working directly with screen-codes rather than having the System ROM do a translation of character-codes. This sample demonstrates that by exercising the TILE keyword versus the LOCATE and PRINT keywords. You can adjust to different SCREEN modes, just be aware that TILE and LOCATE will give an error if you try to move outside of the current screen resolution. And note that CHR$($80);CHR$(i) is a special provision to print characters "verbatim" (as-is) rather than interpreted (some PETSCII codes are control-codes that get interpreted as special actions, like moving the cursor or changing colors, etc).
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 example expands on SAMPLE2, with two additions. First, the BASLOAD features of #SYMFILE, #REM, and #AUTONUM are demonstrated. In general, SYMFILE should always appears first if it is used. SYMFILE is a feature where BASLOAD will write to a file during its parsing a list of all your original variables and labels, and the corresponding X16 BASIC 2-character variables (or the line number of the branch labels). The REM and AUTONUM setting also help preserve much of what your original BASIC program would look like as a regular X16 BASIC listing. Second, the sample program is extended to use the TI variable for simple delta-time management (to show the number of jiffies the main loop of the program uses). You can adjust the program (for example REM or comment out the TILE line) and see the impact to the number of jiffies. Use PAUSE/BREAK or CTRL+C to end the program and return back to CMDR-DOS BASIC prompt.
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
SAMPLE 4: In addition to keyboard codes and screen codes, another table that I often forget is the color-chart. This sample produces that table, using both the COLOR keyword and also the 4th argument on the TILE command, just to demonstrate those alternative ways of controlling the color of content on the text-mode screen. This sample also shows how nested-loops are possible in BASIC.
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