SuperBASIC: Difference between revisions

From F256 Foenix
Jump to navigationJump to search
No edit summary
No edit summary
Line 39: Line 39:
!Effect
!Effect
|-
|-
|<code>ctrl-c</code> or <code>RUN STOP</code> on the F256 K
|<code>ctrl-c</code> or <code>RUN STOP</code> on the F256K
|Stops a listing or a running program
|Stops a listing or a running program
|-
|-
Line 45: Line 45:
|Clears the screen
|Clears the screen
|-
|-
|<code>ctrl-a</code>
|<code>ctrl-a</code> or <code>CLR/HOME</code> on the F256K
|Move cursor to the first character in the current line
|Move cursor to the first character in the current line
|-
|-

Revision as of 02:56, 30 March 2024

SuperBASIC is inspired by BBC BASIC but offers quite a bit more.

An informal list of tips, "gotchas":

IF, THEN, ELSE
Source of this tip: Ernesto
  • A regular if then condition can't contain an else 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 an if else endif structure like in the following example, skipping the then 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 the if 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 an if 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 an end statement.

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
Behaviour of load and bload

The bload statement does not print Completed when loading is successfull whereas load does.