SuperBASIC: Difference between revisions
From F256 Foenix
Jump to navigationJump to search
(Better colour table fit) |
|||
Line 98: | Line 98: | ||
|} | |} | ||
{| class="wikitable" | {| class="wikitable" | ||
!Colour code | |||
!Colour | |||
!Colour code | !Colour code | ||
!Colour | !Colour | ||
Line 103: | Line 105: | ||
|0 | |0 | ||
|Black | |Black | ||
|8 | |||
|Dark grey | |||
|- | |- | ||
|1 | |1 | ||
|Grey | |Grey | ||
|9 | |||
|Light grey (default foreground) | |||
|- | |- | ||
|2 | |2 | ||
|Dark blue (default background colour) | |Dark blue (default background colour) | ||
|10 | |||
|Blue | |||
|- | |- | ||
|3 | |3 | ||
|Green | |Green | ||
|11 | |||
|Light green | |||
|- | |- | ||
|4 | |4 | ||
|Purple | |Purple | ||
|12 | |||
|Light purple | |||
|- | |- | ||
|5 | |5 | ||
|Brown | |Brown | ||
|13 | |||
|Red | |||
|- | |- | ||
|6 | |6 | ||
|Orange | |Orange | ||
|14 | |||
|Yellow | |||
|- | |- | ||
|7 | |7 | ||
|Light blue | |Light blue | ||
|15 | |15 | ||
|White | |White | ||
|} | |} |
Revision as of 11:13, 30 March 2024
SuperBASIC is inspired by BBC BASIC but offers quite a bit more.
- SuperBASIC Reference Manual.
- SuperBASIC Memory Map
- Watch EMWhite's excellent intro series on YouTube: Full Playlist.
An informal list of tips, "gotchas":
IF, THEN, ELSE
Source of this tip: Ernesto
- A regular
if then
condition can't contain anelse
statement, as in this example:
10 if a=0 then x=10
- If you need to do an
if then else
structure, you actually have to do anif else endif
structure like in the following example, skipping thethen
statement.
10 if a=0
20 x=1
30 else
40 x=2
50 endif
- If you do it in one line it needs to have some colons added, making it look weird like this:
10 if a=0:x=1:else:x=2:endif
- if you dare to omit the
endif
thinking that theif
statement won't need it, (mmm.., everything is in one line, so no need, right?) -Nope...all hell breaks loose!-
10 if a=0:x=1:else:x=2: REM "<-- Error, omited the endif"
- be careful not to add an extra
then
statement by mistake to anif else endif
structure, if you do -All hell breaks loose again!!-
10 if a=0 then : rem "<-- Error, THEN is not needed!!!"
20 x=1
30 else
40 x=2
50 endif
Debugging hint: If you encounter an error like "open structure" or "endproc without a proc": do not trust the line number that you are given. The root of the problem is probably in a structure earlier on in the code.
Using procedures
- The
proc
keyword is only valid if it appears after anend
statement. - When calling a procedure use the procedure name followed by parenthesis (), even if the procedure has no parameters.
- Avoid any space between the procedure name and the parenthesis, else it will produce an error.
Keyboard shortcuts
Key combination | Effect |
---|---|
ctrl-c or RUN STOP on the F256K
|
Stops a listing or a running program |
ctrl-l
|
Clears the screen |
ctrl-a or CLR/HOME on the F256K
|
Move cursor to the first character in the current line |
ctrl-e
|
Move cursor to the last character in the current line |
ctrl-i
|
Move cursor 8 characters to the right |
Behaviour of load and bload
- The
bload
statement does not printCompleted
when loading is successfull whereasload
does. - bload can load anywhere on memory not just under the first 64k
- An exception is that bload can't load I/O parameters that reside in $C000 - $DFFF
Control characters for cursor and colour control
In BASIC the following character codes can be used with print
to control the cursor position and colours on the screen.
Code | Effect |
---|---|
chr$(12) | Clear screen and set cursor to upper left corner |
chr$(16) | Cursor up |
chr$(14) | Cursor down |
chr$(2) | Cursor left |
chr$(6) | Cursor right |
chr$(1) | Set cursor to leftmost position in current line |
chr$(5) | Set cursor to righmost position in current line |
chr$(128) - chr$(143) | Set foreground color. Code 128 is black 143 is white. The rest follows the sequence given below |
chr$(144) - chr$(159) | Set background color. Code 144 is black 159 is white. The rest follows the sequence given below |
Colour code | Colour | Colour code | Colour |
---|---|---|---|
0 | Black | 8 | Dark grey |
1 | Grey | 9 | Light grey (default foreground) |
2 | Dark blue (default background colour) | 10 | Blue |
3 | Green | 11 | Light green |
4 | Purple | 12 | Light purple |
5 | Brown | 13 | Red |
6 | Orange | 14 | Yellow |
7 | Light blue | 15 | White |