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:

🖥 Geometric Mandalas

As a coding exercise, I wanted to make use of DRAW statements to get plot points for regular polygons repeated around an axis to create geom...