Editing
SuperBASIC
From F256 Foenix
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
SuperBASIC is inspired by BBC BASIC but offers quite a bit more. * [https://github.com/FoenixRetro/f256-superbasic/blob/main/reference/source/f256jr_basic_ref.pdf SuperBASIC Reference Manual]. * [[SuperBASIC Memory Map]] * Watch EMWhite's excellent intro series on YouTube: [https://www.youtube.com/playlist?list=PLeHjTvk7NPiSqGz4REMH-S4hjYpLS2YNR Full Playlist]. === An informal list of tips, "gotchas": === ===== IF, THEN, ELSE ===== ====== Source of this tip: Ernesto ====== * A regular <code>if then</code> condition can't contain an <code>else</code> statement, as in this example: <code>10 if a=0 then x=10</code> * If you need to do an <code>if then else</code> structure, you actually have to do an <code>if else endif</code> structure like in the following example, skipping the <code>then</code> statement. <code>10 if a=0<br /> 20 x=1<br /> 30 else<br /> 40 x=2<br /> 50 endif</code> * If you do it in one line it needs to have some colons added, making it look weird like this: <code>10 if a=0:x=1:else:x=2:endif</code> * if you dare to omit the <code>endif</code> thinking that the <code>if</code> statement won't need it, (mmm.., everything is in one line, so no need, right?) -Nope...all hell breaks loose!- <code>10 if a=0:x=1:else:x=2: REM "<-- Error, omited the endif"</code> * be careful not to add an extra <code>then</code> statement by mistake to an <code>if else endif</code> structure, if you do -All hell breaks loose again!!- <code>10 if a=0 then : rem "<-- Error, THEN is not needed!!!" <br /> 20 x=1 <br /> 30 else <br /> 40 x=2 <br /> 50 endif</code> ''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.'' ===== Evaluating multiple conditions in IF statements ===== SUPERBASIC doesn't have the dedicated keywords AND , OR so you have to use the bitwise operators to evaluate multiple conditions, please consider the following examples: * AND <code>if (a=1)&(b=2) then c=1</code> * OR <code>if (a=1)^(b=2) then c=1</code> This should work as long as you use parenthesis in all evaluated expressions (Since parenthesis makes bitwise operators behave like logical operators). ===== Using procedures ===== * The <code>proc</code> keyword is only valid if it appears after an <code>end</code> 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 ===== {| class="wikitable" |+ !Key combination !Effect |- |<code>ctrl-c</code> or <code>RUN STOP</code> on the F256K |Stops a listing or a running program |- |<code>ctrl-l</code> |Clears the screen |- |<code>ctrl-a</code> or <code>CLR/HOME</code> on the F256K |Move cursor to the first character in the current line |- |<code>ctrl-e</code> |Move cursor to the last character in the current line |- |<code>ctrl-i</code> |Move cursor 8 characters to the right |} ===== Behaviour of load and bload ===== * The <code>bload</code> statement does not print <code>Completed</code> when loading is successfull whereas <code>load</code> 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 <code>print</code> to control the cursor position and colours on the screen. {| class="wikitable" !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 |} {| class="wikitable" !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 |}
Summary:
Please note that all contributions to F256 Foenix are considered to be released under the Creative Commons Zero (Public Domain) (see
F256 Foenix:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Page actions
Page
Discussion
Read
Edit
Edit source
History
Page actions
Page
Discussion
More
Tools
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Search
Tools
What links here
Related changes
Special pages
Page information