Saturday, May 2, 2026

🖥 Animated "100 Doors"

This program is an animated version of the "100 Doors" programming task described on the Rosetta Code website.

Other than the tackling the task and enhancing it with some simple animation (to visualize the process), I also wanted to showcase a few features of BAM's BASIC implementation:

  • Using expressions in GOSUB statements
  • Using emojis to facilitate finding/noticing program sections and identifiers/labels 
  • Using the IFF function
  • Using the BETWEEN function
  • Pausing the program with help from the _MOUSEBUTTON function
My primary interest in this exercise (other than giving the old sponge a workout) revolved around the design of this loop and setting it up for multiple purposes:

FOR y% = 0 TO 4
  FOR x% = 1 TO 20
    GOSUB (DoorAction$)
    IF _MOUSEBUTTON THEN WHILE _MOUSEBUTTON : WEND
    SLEEP IFF(BETWEEN(pass%,1,30) AND (pass% < 5 OR pass% MOD 10 = 0), 0.025, 0.001)
  NEXT x%
NEXT y%

The program:



Thursday, April 30, 2026

📚 A BAM Use-Case: Giving a New Lease on Life to Old BASIC Programs

One BAM's top goals is to make it fairly easy to port old BASIC programs so that they can be shared via the web for running in any web browser.

Is there a better/easier way to keep old gems around for posterity?

Anyway, I just  discovered this website by Michael Coorlim via which he shares his refactors and adaptations of type-in listings from the 80's books and magazines.  Some of these programs (ones that are not machine-specific) were refactored and adapted for  BASIC Anywhere Machine in order to share the running programs.

The list of programs are in the link provided above, with mention of BASIC Anywhere Machine on the About page.

For folk like me who grew up in the age of the home computer revolution, Michael Coorlim's efforts are really cool.

Tuesday, April 28, 2026

🪲 PAINT issue fixed

It's funny how a little extra time can bring about a change of mind, especially when the solution materializes in one's sponge while having a hard time falling asleep...

The issue (and workaround) I described in my previous post, I decided to build that into PAINT's implementation, so it isn't anything we have to think about while programming whatever fun stuff in BASIC.

So, as per the following screenshot, the examples that were not working are now working just fine:



Monday, April 27, 2026

📚 TIP: PAINT: Clearing an area before painting it

Edit 2026-04-28: The issue with PAINT described below, I changed the implementation of PAINT so that the issue no longer exists.  Please refer to this post.



Please keep this in mind when using the PAINT statement:

Although painting will not go beyond a pixel coordinate with the specified area edge color, painting will also not go beyond a screen coordinate with the specified paint color.

It is easier to explain and understand the behaviour via some code.

The goal is to create two overlapping circles, and to fill the right-most circle with the same color as the edge color of the left-most circle.  So we want code that will create:



The following three snippets of code demonstrate the behaviour of PAINT, as implemented in BASIC Anywhere Machine:

' the center of the second circle
' is exactly on the right-side edge of the first circle

CIRCLE( 20, 20 ), 20, 63
CIRCLE( 40, 20 ), 20, 62
PAINT( 40, 20 ), 63, 62 ' paint on the edge

CIRCLE( 82, 20 ), 20, 63
CIRCLE( 102, 20 ), 20, 62
PAINT( 101, 20 ), 63, 62 'paint just left of the edge

CIRCLE( 144, 20 ), 20, 63
CIRCLE( 164, 20 ), 20, 62
PAINT( 165, 20 ), 63, 62 'paint just right of the edge



To paint everything within a bounded area, you should first "clear" the area (including the area's edges) via a reserved color (one color from whatever palette applicable to the screen mode you are using) that is only ever used as a temporary color for a process of painting)

After you've cleared the area, go ahead and draw the shape with the intended color, then paint the shape with the intended color.  We get the results we are looking for with the following code:

CIRCLE( 20, 62 ), 20, 63
' clean/prepare the area for the second circle
CIRCLE( 40, 62 ), 20, 61
PAINT( 39, 62 ), 61, 61
' now, create the second circle
CIRCLE( 40, 62 ), 20, 62
PAINT( 39, 62 ), 63, 62

CIRCLE( 82, 62 ), 20, 63
' clean/prepare the area for the second circle
CIRCLE( 102, 62 ), 20, 61
PAINT( 101, 62 ), 61, 61
' now, create the second circle
CIRCLE( 102, 62 ), 20, 62
PAINT( 101, 62 ), 63, 62

CIRCLE( 144, 62 ), 20, 63
' clean/prepare the area for the second circle
CIRCLE( 164, 62 ), 20, 61
PAINT( 165, 62 ), 61, 61
' now, create the second circle
CIRCLE( 164, 62 ), 20, 62
PAINT( 165, 62 ), 63, 62

All three examples give the exact same result.  Here is the result after each CIRCLE and each PAINT statement:






Saturday, April 25, 2026

🖥 Swirling Circles

This strange animation is the result of me wondering:

  • What if I drew circles at each end of a piston, and that piston moved up and down a fixed point on the screen.
  • And then made that piston go up and down.
  • Then, what if I made the fixed point the center of a circle, and then drew similar pistons at different angles in that circle.
  • And then made all the pistons go "up and down".
  • And then rotated the circle of pistons around the axis of that circle.

And then I went down the rabbit hole of "what kind of randomness can I add to this thing?"



Friday, April 24, 2026

🎉 New version of BASIC Anywhere Machine

 

Changes / Enhancements

Summary

  • Rename NVL$ to FNEV
  • "EVAL" clause removed from GOTO, GOSUB and RESTORE statements
  • INPUT now allows expressions as the prompt argument

Details

Rename NVL$ to FNEV

I don't know what I was thinking.  "NVL" is a proprietary function name originating from Oracle SQL.  I've got no business, I think, calling my function that.

So, I've decided to rename NVL$ (which I was using to mean "No VaLue") to FNEV (First Non-Empty Value).

This function can be used with strings and with numbers.  (That's why the function name does not have a "$" suffix.)

For the immediate future, this function accepts two parameters.  If the first parameter is not empty ( "" is an empty string; 0 is an empty number), then the first parameter is returned.  Otherwise, the second parameter is returned.

Someday, I will change this function to allow more parameters, and set it up so that it returns the first "non-empty" value found.


"EVAL" clause removed from GOTO, GOSUB and RESTORE statements

The EVAL keyword was intended to indicate a parameter that is an expression and not a line identifier/number.

Really, parentheses are enough to indicate an expression is being provided instead of a line identifier/number.


(The syntax diagrams for GOSUB and RESTORE are the same.)

INPUT now allows expressions as the prompt argument




Saturday, April 18, 2026

🖥 Orbs

EDIT 2026-04-19

Apparently, there are many "very similar" versions of this program "out there."

I think it would be a stretch to believe that all of these programs ought to be attributed to one person.  Anybody, at any time, can have an "original thought" that is completely independent from an identical "original thought" by somebody else in a different place and a different time.

When somebody shares a program, I assume it is their original code, and any port/mod of mine will give credit to the author of the source code I ported.  I'm not going to spend time investigating the origins of any program I find on the web.  (Well, if it is easy for me to give credit to all the shoulders on which I'm standing tall, I'll do that because I do enjoy doing that.) 

Some may believe that all programs similar to this one should be attributed to Jan Vibe as author of a similar program written in BBC BASIC.  I leave it up to you:  credit Jan Vibe for my port/mod if you wish.  Regardless, it would seem Jan Vibe made some significant contributions, which you might find worth researching.


This program is a port and mod of a BazzBasic program by EkBass, shared by EkBass via the GotBASIC discord server.

Note that I've setup some random "color randomness" to each drawing cycle loop (which generates a finite number of orbs each loop to create interesting patterns because of small empty spaces with no orbs.)























🖥 Animated "100 Doors"

This program is an animated version of the "100 Doors" programming task described on the Rosetta Code website . Other than the tac...