Thursday, April 27, 2023

🆕 _GETCHR$ to get a string representation of the 8x8 pixels for the character assigned to an ascii code

 The _GETCHR$ function does the reverse of the recently added _LETCHR$ statement.

Checkout a sample application:


The _GETCHR$ statement returns the string representation of the 8x8 pixel definition for a character that matches the specified ascii code.

Syntax

_GETCHR$( ASCII_code%)

  • return value: a 64-character string representing 8x8 pixels
    • an "X" represents an "on" pixel
    • a "." represents an "off" pixel

  • ASCII_code%
    • An integer number that represents an ASCII character.
    • As simple as a literal number, a constant/variable number, or a numeric expression of any complexity.
  • characterTemplate$

Wednesday, April 26, 2023

💩 Oh poop. Screen mode changes done 3 months ago.

About three months ago, I made changes to BASIC Anywhere Machine's screen modes, rolling out the update and completely forgetting to make any kind of heads-up announcement about it.

And I forgot to update a whole bunch of programs to use the new screen modes.

Surprise?

The previous screen modes were the as-is screen modes as implemented in wwwBASIC (as found on Github Dec 27, 2020.  I wanted something more to my liking, so I adjusted them to the ones described in this post.

You can still access the last version of BASIC Anywhere Machine with the old screen modes here (and the documentation for that version here.)

You can compare with the current version of BASIC Anywhere Machine here (and the current version of the documentation here.)  If you had noticed any programs not working: I updated these programs in BASIC Anywhere Machine yesterday to use the new screen modes.  (list of those further down below.)

Also, for your convenience, you can compare the previous screen modes (info below) to the current screen modes in this post.


ModeScreen
Width
Screen
Height
ColumnsRowsScreen
Aspect
Font
Height
Colour
Scheme
Bits
Per
Pixel

064020080252.48rgba4
Alternative width: 40(See the  statement)
132020040251.28screen12
264020080252.48monochrome1
732020040251.28rgba4
64020080252.48rgba4
6403508025480/35014rgba4
6403508025480/35014monochrome2
116404808030116monochrome2
126404808030116rgba4
13320200251.28undefined24
1432024015116undefined24
1540030018116undefined24
1651238424116undefined24
1764040080251.216undefined24
186404808030116undefined24
1980060010037116undefined24
20102476812848116undefined24
211280102416064116undefined24

List of programs updated with new screen modes (or simply checked to make sure they still work correctly):

2023-04-25
  • Barnsley Fern (Fractal)
  • Based on PRINT CHR$(205.5+RND(1)); : GOTO 10
  • Bouncing Circle and Square Screen Painter
  • BouncingBall
  • BouncingBall 2
  • Bubble Universe
  • CALCULATOR
  • Cannoneer
  • Catch 88
  • Chaotic Scatter
  • CIRCLE to Draw Pie Charts
  • Curve Stitching in a Circle
  • Cute 40-line-ish game
  • Cute 50-line-ish game
  • donkey.bas
  • Easy Spiral
  • Ever-Changing Mandala II (less CPU intensive)
  • File Open, Print, Close Tester
  • Flower Wheel
  • LINE remembers the last pen position
  • Mouse testing 1
  • Munching Squares
  • Pendulum
  • Rotating Lorenz Attractor
  • Semi-random PSET art
  • Ski Slope Challenge (Charlie's Version)
  • Snowflake
  • Sound Tester
  • Spheres
  • Tank
  • Tester: _DISPLAY and _AUTODISPLAY
  • Tester: DRAW commands A and TA
  • Tester: Logical Operators
  • Tester: PRINT, WRITE, PRINT#, WRITE#, OPEN, CLOSE
  • Tester: Screen Scrolling (Mirage Maker?)
  • Wumpus
  • Yahtzee

2023-04-24
  • Akalabeth
  • Akalabeth (BAM!)
  • Archimedean spiral
  • ASCII Character Set
  • Background Generator
  • Box Color Varied
  • circles
  • Conway's Game of Life
  • Diagonals on SCREEN 2
  • draw graphics test
  • DrawSquare
  • Easter Egg Decorating
  • Easter Egg Decorating 2
  • Ever-Changing Mandala
  • Fedora Hat
  • FLIPPER
  • Fractal Tree
  • GW-BASIC (Amiga) Get + Put Sample
  • GW-BASIC-3D
  • Hailstone sequence
  • Hello World Horizontal Marquis
  • INSTR tester
  • Julia set (GW-BASIC)
  • Julia set (Locomotive)
  • Julia set (QBasic)
  • line graphics test
  • lines.bas
  • Mandelbrot set
  • Mesmerizer 1
  • MID$ (statement) tester
  • mishka's clock
  • Polar Grapher.bas
  • Put - Get
  • PUT color action sample
  • PUT color action sample II
  • Qb64 Draw Example
  • Regeya's CIRCLES
  • Rotating Circle
  • Rotating Pyramid
  • Simple Animation XOR test
  • SimpleRandomHillsMaker
  • Sine Art 1
  • Spinny Cube
  • Summation of primes
  • Sunshine
  • Tester _width _height
  • Tester DRAW

Tuesday, April 25, 2023

📚 The SCREEN modes

ModeWidth
X Height
(Pixels)
Columns
X Rows
(Characters)
Screen
Aspect
Font
Height
Colour
Mode
Bits
Per
Pixel
0640 X 20080 X 252.48p164
1320 X 20040 X 251.28p42
2640 X 20080 X 252.48p21
7320 X 20040 X 251.28p164
8640 X 20080 X 252.48p164
9640 X 35080 X 25480/35014p164
10640 X 35080 X 25480/35014p21
11640 X 48080 X 30116p21
12640 X 48080 X 30116p164
13320 X 20040 X 251.28p2568
14320 X 20040 X 2518p2568
15320 X 20040 X 252.48p2568
16320 X 20040 X 251.216p2568
17320 X 20040 X 25116p2568
23640 X 40080 X 251.28pRGB24
24640 X 40080 X 2518pRGB24
25640 X 40080 X 252.48pRGB24
26640 X 40080 X 251.216pRGB24
27640 X 40080 X 25116pRGB24
ModeNumber
of
Colour
Attributes
Bits
Per
Pixel
p221
p442
p16164
p25625616
pRGBundefined24
  • Note: p2, p4, p16 and p256: references to colour attributes allow "Colour attribute looping".

About Colour Attribute Looping

In BASIC Anywhere Machine, when working with colour modes that have colour attributes, we normally refer to those attributes as attributes zero to whatever maximum for that colour mode. (For example, attributes 0 to 15 in colour mode p16.)

When we refer to attributes with numbers outside of the range, BASIC Anywhere Machine loops around (treating the list of attributes like a circle.) So in colour mode p16, attribute 16 means attribute 0, and attribute 17 means attribute 1.

The same works in the other direction. In colour mode p16, attribute -1 means attribute 15, and attribute -2 means attribute 14.

The following statements and functions have been tested to make sure that works:

  • COLOR
  • CIRCLE
  • LINE
  • PAING
  • PSET

Monday, April 24, 2023

🆕 _LETCHR$ to redefine 8x8 characters assigned to ascii codes

 The _LETCHR$ statement redefines the 8x8 character assigned to an ASCII code.

Syntax

_LETCHR$( ASCII_code%, characterTemplate$ )

  • ASCII_code%
    • An integer number that represents an ASCII character.
    • As simple as a literal number, a constant/variable number, or a numeric expression of any complexity.
  • characterTemplate$
    • A 64-character string that represents the "on" pixels of an 8x8 character
      • any "X" (must be uppercase) represents an "on" pixel
      • any other characters in the string represent "off" pixels
    • As simple as a literal string, a constant/variable number, or a numeric expression of any complexity.




A chess piece "knight" ?
A chess piece "knight" ?



Monday, April 17, 2023

Experimenting with Unicode Characters in Identifiers and Line Labels

Finding emojis useful for sporadic "grab-you by the jugular" icons, I'm now experimenting with Unicode characters for more numerous things I want grabbing my attention without doing so obnoxiously.

Note: I am experimenting with these as a way to help folk with cognitive/visual disabilities, to make it easier to locate/identify sections of code.

Emojis are pretty quick to access, at least on my Chromebook: right-click and click on emojis to access them in a dialog.

Unicode character access was requiring too many steps, so I've added a section for Unicode characters in the Lookups Window (in the menu: Tools - Lookups).  This brings up the List of Unicode characters Wikipedia page, and provides a field in which you can copy/paste frequently used Unicode characters.  (IF IT IS SOMETHING YOU WANT TO EXPERIMENT WITH TOO !!!)



EDIT:

A big reason I'm using GOTO's in this sample: getting old non-structured BASIC programs working in BASIC Anywhere Machine is a ton of fun, especially when exported programs can be shared as small HTML files on the web.

I see Unicode characters and emojis as a way to help see parts of these old BASIC programs in order to create structured versions of them.

The arrows make it a little easier to find/identify branching/flow, and that "STOP" character makes it really easy to pinpoint the END of the program.




Thursday, April 13, 2023

📚 Using emojis in identifiers

Although I generally do not do well with symbols to convey information (I do much better with words), I do find symbols helpful as attention-getters and visual cues to convey very simple information.

For example, in the code below, the emoji's help me quickly identify/locate colour constants in my code.


CONST 🎨brick_red = &HC62D42, _

      🎨electric_lime = &HCCFF00, _

      🎨metalic_sunburst = &H9C7C38


SCREEN 23 : COLOR ,&HFFFFFF : CLS

LINE (10, 10)-(100, 100), 🎨electric_lime, BF

LINE (200, 200)-(300, 300), 🎨brick_red, BF

CIRCLE (200, 100), 50, 🎨metalic_sunburst, , , , F



📚 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...