Monday, July 29, 2024

📚 DIM Syntax Diagram

This is a complex diagram.  To condense it a little bit, some details have been moved into smaller detail diagrams further below.


(Click on the image to enlarge)

(Click on the image to enlarge)



Saturday, July 27, 2024

Friday, July 26, 2024

📚 SUB definition syntax diagrams

A subroutine (of the "structured BASIC" kind) is defined with a "SUB definition block", as per the following syntax diagram:

(Click on the image to enlarge)

(/EOL/ means "end of line.")

Details below for "SUB statement", "statement", and "statement exclusion list".

SUB statement syntax diagram:
(Click on the image to enlarge)


"Legal" statements that can be used in a SUB definition block can be any statement found in this list of BASIC statements with the exception of the following statements (illegal in SUB definition blocks):
  • DECLARE FUNCTION
  • DECLARE SUB
  • DEFDV
  • DEFINT
  • DEFLNG
  • DEFSNG
  • DEFSTR
  • END FUNCTION
  • END RECORD
  • END STRUCT
  • END STRUCTURE
  • END SUB
  • END TYPE
  • FUNCTION
  • RECORD
  • STRUCT
  • STRUCTURE
  • SUB
  • TYPE




Thursday, July 18, 2024

📚 Syntax diagram: BASIC Program Line Format

Second version (July 18):

Click on the image to view full size

First version (July 17):

Click on the image to view full size




Wednesday, July 17, 2024

📚 CIRCLE Study: The "aspect" argument

The aspect argument will cause the CIRCLE statement to generate an oval ellipse instead of a circle, in either a horizontal or vertical orientation. (I should not be writing past my bedtime.  Thanks to Richard Russell for pointing out that the word should be "ellipse" and not "oval".)

Run the following program and take a look at the source code to see how the aspect argument works:

Click here for info about the CIRCLE statement.





Sunday, July 14, 2024

🪲 Fixed: ByVal and ByRef keywords not working beyond the first argument

The recently added ByVal and ByRef keywords were only working of the first argument of a function/subroutine.

This new version of BAM now allows ByVal and ByRef on arguments beyond the first one.

Saturday, July 13, 2024

📚 A Summary of Conditionals in BAM

Page Contents:

  • Conditional Single-Line Structures
  • Conditional Block Structures
  • Conditional Functions
  • References

Conditional Single-Line Structures

  • IF...THEN LineIdentifier 
Example: 
25 PRINT "howdy";
SLEEP 0.5
IF TRUE THEN 25
  • IF...GOTO LineIdentifier
Example: 
25 PRINT "howdy";
SLEEP 0.5
IF TRUE GOTO 25
  • IF...THEN SingleStatement
Example: 
IF TRUE THEN PRINT "Howdy"
  • IF...THEN MultiStatement
Example: 
IF TRUE THEN PRINT "Howdy"; : PRINT " There"
  • IF...THEN...ELSE SingleStatements
Example: 
IF TRUE THEN PRINT "Yup" ELSE PRINT "Nope"
  • ON GOTO
Example:
1 v% = VAL( RIGHT$( STR$( INT( TIMER * 10 ) ), 1) ) + 1
2 ON v% GOTO 10,11,12
3 GOTO 1
10 COLOR 15 : PRINT "0 "; : GOTO 20
11 COLOR 14 : PRINT "1 "; : GOTO 20
12 COLOR 13 : PRINT "2 "; : GOTO 20
20 SLEEP 0.001 : GOTO 1
  • ON GOSUB
  • ON RESTORE
  • GOTO "EVAL" Clause
Example:
FUNCTION WhereToGo%(v%)
  SELECT CASE v%
    CASE 2    : WhereToGo% = 140
    CASE 5    : WhereToGo% = 190
    CASE 9    : WhereToGo% = 250
    CASE ELSE : WhereToGo% = 300
  END SELECT
END FUNCTION
  1 v% = VAL( RIGHT$( STR$( INT( TIMER * 10 ) ), 1) )
    GOTO EVAL( WhereToGo%(v%) )
140 COLOR 15 : PRINT "2 "; : GOTO 300
190 COLOR 14 : PRINT "5 "; : GOTO 300
250 COLOR 13 : PRINT "9 "; : GOTO 300
300 SLEEP 0.001 : GOTO 1
  • GOSUB "EVAL" Clause
  • RESTORE "EVAL" Clause

Conditional Block Structure

  • IF...THEN Block
Example:
1 v% = VAL( RIGHT$( STR$( INT( TIMER * 10 ) ), 1) )
  IF     v% = 0 THEN : COLOR 15 : PRINT "0 ";
  ELSEIF v% = 1 THEN : COLOR 14 : PRINT "1 ";
  ELSEIF v% = 2 THEN : COLOR 13 : PRINT "2 ";
  ELSE               : COLOR 12 : PRINT "? ";
  END IF
  SLEEP 0.21
  GOTO 1
  • SELECT CASE Block
Example: 
1 v% = VAL( RIGHT$( STR$( INT( TIMER * 10 ) ), 1) )
  SELECT CASE v%
    CASE    0 : COLOR 15 : PRINT "0 ";
    CASE    1 : COLOR 14 : PRINT "1 ";
    CASE    2 : COLOR 13 : PRINT "2 ";
    CASE ELSE : COLOR 12 : PRINT "? ";
  END SELECT
  SLEEP 0.21
  GOTO 1

  • WHILE...WEND

Example: 
WHILE i% < 25
  i% = i% + 1
  PRINT i%
  SLEEP 0.1
WEND
END

Alternative Keyword Delimiters: 

    • DO WHILE...WEND
    • WHILE...LOOP
    • DO WHILE...LOOP
  • DO...LOOP

Example: 
DO
  i% = i% + 1
  PRINT i%
  SLEEP 0.1
  IF i% = 25 THEN END
LOOP

  • DO...LOOP WHILE

Example: 
DO
  i% = i% + 1
  PRINT i%
  SLEEP 0.1
LOOP WHILE i% < 25
END

  • DO...LOOP UNTIL

Example: 
DO
  i% = i% + 1
  PRINT i%
  SLEEP 0.1
LOOP UNTIL i% = 25
END

Conditional Functions

  • IFF
Example:
PRINT IFF( TRUE, "Yup", "Nope")
  • CHOOSE
Example:
1 v% = VAL( RIGHT$( STR$( INT( TIMER * 10 ) ), 1) ) + 1
  PRINT CHOOSE( v%, "Zero ", "One  ", "Two  " );
  SLEEP 0.21 : GOTO 1
  • NVL$
Example:
1 v% = VAL( RIGHT$( STR$( INT( TIMER * 10 ) ), 1) ) + 1
  PRINT NVL$( CHOOSE( v%,"Zero ","One  ","Two  " ), "???  " );
  SLEEP 0.21 : GOTO 1
  • MAX
Example:
a% = 5 : b% = 10
PRINT MAX( a%, b% )
  • MIN
Example:
a% = 5 : b% = 10
PRINT MIN( a%, b% )

 

References:

Wednesday, July 10, 2024

🖥 Cursive Text Sample

This program was reversed-engineered from input (DATA statements) and program output shared by Arnold Kramer in the "BASIC Programming Language" Facebook group.

Well, I then enhanced the program just to demonstrate looping, animation, and colour randomness.




Sunday, July 7, 2024

🆕 IDE Config Backet-Matching Options

The 2024-07-01 Release of BAM added the two following features to the editor:

  • Auto insertion of closing brackets
  • Highlighting of matching brackets

Today's new version of BAM provides options to turn off one or both of the features.

Via the "Tools" menu, click on the "IDE Config" menu item.  This will open the "IDE Config" window.

Expand the "Coding Editor Configuration" details, and you'll find "Bracket-Matching Options" at the bottom of the group, where you can turn on/off the features via check boxes.



Saturday, July 6, 2024

📚 Reminder: When you download BAM, make it your own !

Just a reminder that when you download BAM (and save it to a local storage device, or host your copy of BAM online with TiddlyHost.com or some other service), you can then make it your own.

Under the "Tools" menu, you'll find an "IDE Config" menu item that lets you alter the look of your copy of (i.e. your personal instance of) BASIC Anywhere Machine.

Put the "IDE Config" window side-by-side with your open instance of BAM, and experiment with the various configuration choices available.

Here's a screenshot of the "me playing around" results:


Although dated, you might find the following video useful:




🪲 IDE Editor scrolling via keyboard up/down keys: Issue fixed

Latest version of BAM

This was an issue in BAM right from the outset (i.e. since December of 2021).

When programs get so long as to not fit the height of the editor, requiring scrolling up/down, the caret in the text editor would go up/down past the border of the editor to a line above/below the editor's border, requiring some extra presses of up/down keys before (or mouse-wheel, or click on scrollbar) to bring the desired part of the program into view.

I finally figured out today the CSS override needed for the editor to properly and automatically scroll when trying to move the caret past the top/bottom visible line of text in the editor.

To compare the before and after behaviour, put the opened latest version of BAM next to any previous version (like the archived 2024-02-05 version of BAM) and see how caret navigation (up and down keys) past the top/bottom lines of a long program works.


🖥 Pongy game

This program is a port (and slight mod) of the QB64pe program by SierraKen.  (SierraKen's program shared with the QB64pe community in th...