Thursday, May 12, 2022

🆕 The "two-chracter" relational operators (<>, >=,<=) now allow spaces between the characters

To be compatible with GW-BASIC and QB64, BASIC Anywhere Machine now allows one or more spaces between the characters in two-character relational operators, for example:

a <> b and a <  > b are both valid

Wednesday, May 11, 2022

🆕 Adjustable fill colour for iframe containing the BASIC console window

 When whatever container (browser window, <div>) is resized, that will cause the iframe to get resized to whatever new 100% of the height and 100% of the width of the container.

And when the iframe resizes, the BASIC console window will also get resized, but the console will maintain scaled proportions for width and height based on whatever screen settings for the console window.

Whatever extra space exists between the iframe and the console window, that space normally gets filled with a gray colour (#aaaaaa).

Now, you can customise that colour via a BASIC program's File Properties.


The primary purpose for this feature: embedding BASIC Anywhere Machine programs in web pages (and TiddlyWiki) in way that fits the target colour-wise.  

🪲 BAM fixes issue with PSET and PRESET not accepting decimals (causing end of programs)

 During transpilation (i.e. converting a BASIC program to javascript), the process now rounds PSET and PRESET parameters to the nearest integer.

Sunday, May 8, 2022

🪲 BAM now allows blank lines between lines of code

I am really happy to have finally solved this problem.

It has existed in BASIC Anywhere Machine from day 1.

Nothing related to wwwBASIC, but rather a problem in the "wikification" process, the process of taking a BASIC program in a tiddler, and translating it into plain text that gets inserted into the dynamically created HTML page (HTML, javascript, and the BASIC program).

At the end of the process, the dynamically generated HTML page is fed into an iframe that displays the BASIC console.

It all boiled down to my misunderstanding of TiddlyWiki's "wikify" widget.

This is a huge relief to this kid.  I like loads of blank lines to make a complex program easier to understand.

Saturday, May 7, 2022

🆕 REPLACE$ function

The REPLACE$ function takes a source string resulting from an expression, searches for every occurrence of a search string resulting from an expression, and replaces every one of those occurrences with a replacement string resulting from an expression.

Syntax

REPLACE$(Source_strExpr, Search_strExpr, Replacement_strExpr )

Return Value = Modified_String

Turn Any TiddlyWiki into a Lightweight BASIC Anywhere Machine

AND:  Add a "Clock" BASIC program to the TiddlyWiki Sidebar.




🆕 FIX function

The FIX function truncates a real number resulting from a numeric expression into a whole number.

🪲Fix to DRAW and LINE

Back on April 25th and without posting about it, I uploaded a new version of BASIC Anywhere Machine that fixed a problem with the LINE statement, and did not realize until today that the fix to LINE had broken DRAW.

Yesterday, I uploaded a new version of BASIC Anywhere Machine to fix the problem I caused with DRAW, so that now both LINE and DRAW seem to be behaving correctly.

I need to take some time and thoroughly test everything having to do with graphics statements.


Details:

The problem fixed with LINE

A bug in wwwBASIC causes it to not apply last known Graphics Pen Position when a graphics statement calls for it.

Example: LINE - (x2,y2)

Normally, that is supposed to create a line starting at the last known pen position.  However, wwwBASIC will always start the line at x1 = 0 and y1 = 0.  (And: wwwBASIC does not attempt to remember pen position at the end of a LINE statement.)

BASIC Anywhere Machine fixes this issue.  (And:  BASIC Anywhere Machine does record the end coordinates of a LINE statement as last known graphics pen position as the potential starting point for the next line statement. )

The problem with DRAW

After the change to LINE behaviour described above, each starting pen movement within a chain of them in one DRAW comment was not starting at the end position of the previous movement.

I had not realized that LINE and DRAW were using some common code, and the change in that code to fix LINE was messing things up for DRAW.  So I've duplicated the common code, one version for LINE and what it needed, and one for DRAW as per the wwwBASIC version of that code.

Now all seems well.

Friday, May 6, 2022

🪲 Fix to CINT Function

 CINT was behaving like INT.


INT truncates a number to the the next lowest integer.  CINT was doing the same thing. 

CINT is supposed to round numbers, which it now does.


📚 FUNCTION (and SUB): variable arguments, by default, are "passed by reference"

Preamble A primer on "call-by-reference" vs "call-by-value" BAM HOWTO (BTW:  "call-by-reference" aka "pas...