Late follow-up to September 28th's "🆕 _D2R".
The _R2D function converts a radian value into a degree value.
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.
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.
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.
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:
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.
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):
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!)
As per QB64pe documentation:
The _PI function returns π as a _FLOAT value with an optional multiplier parameter.
This program is a port (and slight mod) of the QB64pe program by SierraKen. (SierraKen's program shared with the QB64pe community in th...