Saturday, October 29, 2022

🆕 _R2D

Late follow-up to September 28th's "🆕 _D2R".

The _R2D function converts a radian value into a degree value.



Wednesday, October 26, 2022

❇ FOR NEXT: multiple controlVariables.

BAM supports (with nested FOR loops) multiple controlVariables in one NEXT statement for all of the FOR statements.

So now, we are not limited to:

for i = 1 to 2

    for j = 1 to 21 step 20

        locate i, j

        print "hello world!"

    next j

next i

We can instead do this:

for i = 1 to 2

    for j = 1 to 21 step 20

        locate i, j

        print "hello world!"

next j, i


Although it is not necessary to specify controlVariables with the NEXT statement, be aware that each FOR statement then requires a dedicated NEXT.  For example:

for i = 1 to 2

    for j = 1 to 21 step 20

        locate i, j

        print "hello world!"

    next

next

OR:

for i = 1 to 2

    for j = 1 to 21 step 20

        locate i, j

        print "hello world!"

next : next

Personally, I prefer the approach in the first example.  A little bit verbose but very clear.

Tuesday, October 25, 2022

Monday, October 24, 2022

🆕 Logical Operators XOR, EQV, and IMP

Now BASIC Anywhere Machine's logical operators (AND, OR, XOR, EQV, IMP) should match GW-BASIC.  (See page 59 of the Commodore PC Personal Computer GW-BASIC Interpreter User's Guide.

That said, loads of testing to do: we have to check and see if there are any discrepancies in the operator's order of precedence.

Regardless, one should never rely on any language implementation's order of precedence, which could be different from language to language and from one implementation of a language to another implementation of the same language.  So: best to make use of parentheses to explicitly define order of operations.

❇ CIRCLE: Pen position after the statement

In Today's version of BASIC Anywhere Machine:

The CIRCLE statement, upon completion, sets the pen position (i.e. the X and Y coordinates) to the centre coordinates of the drawn CIRCLE.

Before today's change, the CIRCLE statement, although positioning the centre of the circle as expected,  did not adjust the pen position.

Friday, October 21, 2022

❇ _AUTODISPLAY and _DISPLAY

Both statements in BASIC Anywhere Machine should now behave just like the same functions in QB64.

BAM documentation in the works.  In the meantime, refer to the QB64pe documentation:

If you are so inclined, please give the "Tester: _DISPLAY and _AUTODISPLAY" application a try and let me know if you find any bugs or mistakes in the implementation directly in the BASIC Anywhere Machine IDE or via the exported program:


Sunday, October 16, 2022

🆕 Alternative ("thin") character font.

The character font that comes with wwwBASIC is "thick" (a little bit like the Commodore 64 font).

I've recently updated BASIC Anywhere Machine with a second alternative font that is "thin" (a little bit like the Commodore PET font.)

Combined with the smoothing property, the font property now gives us an option (on which to build on!) for the appearance of BAM applications.


wwwBASIC Font, smoothing enabled

wwwBASIC Font, smoothing disabled

wwwBASIC Font - Thin, smoothing enabled

wwwBASIC Font - Thin, smoothing disabled










🆕 Enable/Disable Image Smoothing (Program Execution Property)

By design, wwwBASIC  uses image smoothing, an algorithm that smooths the pixel edges as the screen console (which is a "canvas" HTML element) is scaled up and down.

Although this seems to generally be good for graphics, text can appear blurry.

In the latest version of BASIC Anywhere Machine, the customised version of wwwBASIC has been modified to enable/disable image smoothing for a program depending on the program's "Enable Image Smoothing" property (a new option in the Program Execution Properties viewer.

See the differences the setting makes with the Wumpus game (put them side-by-each to compare):


Next on my radar: I'm not in love with the character fonts in wwwBASIC.  I'm thinking of setting up an alternative font that looks like the fonts on Commodore PET computers.






Saturday, October 15, 2022

🪲 _WIDTH and _HEIGHT when _NEWIMAGE

 When I added the _NEWIMAGE keyword in early April (blog entry), I overlooked the need to modify the _WIDTH and _HEIGHT functions added just previously in March (blog entry).

Since April, _WIDTH and _HEIGHT did not handle custom screen widths and heights setup via _NEWIMAGE.

Today's new version of BAM fixes things so that, with an added bonus: a very small simplification to the code (nothing wrong with that!)

Friday, October 14, 2022

🆕 _PI

As per QB64pe documentation:

The _PI function returns π as a _FLOAT value with an optional multiplier parameter.


See the function in action in the "Flower Wheel" program:

Monday, October 10, 2022

🆕 CSRLIN

 The CSRLIN function returns the current line position of the screen cursor.

🖥 Fan Dance

This is a port and mod of a SpecBAS program by ZXDunny. Run the program View the source code And, a "less is more?" version: Run t...