Wednesday, December 27, 2023

🖥 Mouse Tester program

A little program primarily to test/demonstrate mouse-click handling and mouse-wheel handling.

Also demonstrated:
  • SCREEN _NEWIMAGE (to setup custom screen size for the specified mode)
  • CIRCLE
  • PAINT
  • PRESET
  • IFF
  • FOR NEXT
  • _DISPLAY (forces refresh of the screen; otherwise, the browser page locks up, going into an infinite loop)
  • XMAX and YMAX



Sunday, December 24, 2023

🖥 VC2023 Logiker

"Logiker" has a "Vintage Computing Christmas Challenge 2023" event aimed primarily at vintage computers.

I saw this is a fun coding exercise to do in a "Vintage Computer BASIC" style.




Saturday, December 23, 2023

🖥 GOTO Tester (Enhancements in the works)

(As of this writing, these are changes that exist only in the development version of BAM.)

Summary of enhancements to GOTO

  • ignore leading zeroes in line numbers
    • (this is a change to referenced line numbers referenced in GOTO statements and to declared line numbers (i.e. line numbers at the start of lines)
  • new "EVAL clause"
    • (can be used to evaluate either line numbers or line labels)

The test program

🖥 Which Weekday (Port and mod of an "80's BASIC" program)

Carlos Mencia shared a nice little "80's BASIC" program that takes an input date (day, month, year values) and returns the related weekday.  (See this Facebook post.)

Although this BAM port is a significant mod, you'll find the all-important smarts of the program left untouched.  This wee porting/modding task demonstrates one way of giving some good old BASIC code a new lease on life as a browser-based BASIC program, stored locally or hosted on the web, that should run on pretty much any modern device (even touch screen).





Wednesday, December 20, 2023

Monday, December 18, 2023

📚 Syntax for Line Numbers



Although leading zeroes are allowed in line numbers if desired, leading zeroes are ignored by BAM when the line numbers are referenced/resolved by statements:
  • GOTO and ON..GOTO
  • GOSUB and ON..GOSUB
  • RESTORE and ON...RESTORE
So the following all refer to the line "123": 123, 0123, 00123, 000123










Saturday, December 16, 2023

🖥 Festive Skull (A SpecBAS to GW-BASIC to BAM port and mod)

ron77 ported ZXDunny's skull program from SpecBAS to GW-BASIC.

At first, I ported ron77's program with no changes except for some things that BAM does not support:

  • DEF FN function identifiers that are the same as identifiers for variables
  • Array identifiers that are the same as identifiers for variables
Once I got that working in no time at all, I decided to make the following changes to the BAM version:
  • screen mode 23 for rgb colours
  • random colours
  • infinite loop to generate a new skull for every loop
  • animation: transitions between skulls (a skull is displayed for about 3 seconds before the transition to a new skull
The program's source code needs some refactoring to get it to my liking, but Saturday's Hockey Night in Canada is starting, so no more BASIC programming for this kid.

Festive Skull:


🎉 New release of BASIC Anywhere Machine

Summary

BASIC Language Updates
  • New KEYSTATE function
  • KEYCLEAR alternative to _KEYCLEAR
  • DEF FN Enhancement

Preprocessor Updates

  • Overriding TW WikiText Formatting
    • TEST PROGRAM
    • Consecutive apostrophes
    • Consecutive spaces
    • Consecutive forward slashes
    • Consecutive underscores
    • Consecutive carets
    • Consecutive commas
    • Consecutive tildes
    • Consecutive Backticks
    • Consecutive at signs
    • Consecutive dashes

Tuesday, December 5, 2023

🪲 Issue with ".prod.bas.json" export fixed

Fix in the latest version of BASIC Anywhere Machine.

Thanks to Al Williams for reporting the bug !

The 2023-05-31 Release of BAM (see notes) introduced several alternative ASCII character sets and several alternative extended character sets.

In the effort, I forgot to modify the ".prod.bas.json" export to include those character sets.  Without those character sets, BAM programs will not work in the host TiddlyWiki that imported the BAM programs.

i.e. this export option:


Now, the ascii character sets and extended character sets are included in the export process.

I've also added a note to let people know that BAM is only compatible with TiddlyWiki versions 5.2.3 and higher (earlier versions of TiddlyWiki are missing features that BAM depends on.)







Sunday, December 3, 2023

♞ Code challenge (BAM or your favourite BASIC): Create a simple quine

UPDATE 2023-12-10: Due to a family emergency today, I've had no time to properly "close" this challenge, so I'm extending this to December 17th.

NOTE: I've never done this kind of thing before and I do not know every BASIC out there.  So whatever I originally had in mind, this challenge is getting clarified/refactored a bit as questions come in, and as BASIC implementation-specific solutions (using fairly unique or unexpected features) roll in.   All in the hopes of clarity and making sure that you don't necessarily have too easy a time with the challenge !

From Wikipedia:

A quine is a computer program which takes no input and produces a copy of its own source code as its only output. The standard terms for these programs in the computability theory and computer science literature are "self-replicating programs", "self-reproducing programs", and "self-copying programs".

A story:

Back in the early 90's, our computer science "discrete structures" professor gave the class a bonus assignment: write a program that has no input and outputs itself such that the output can be run and that outputs the same result.  OR: write a proof that such a program cannot be created.

Do note: the program was required to have one or more variables, and the program had to completely contain itself.

Out of a class of about 60 students, only two of us completed the bonus assignment.  The other guy wrote a proof that such a program could not be written.  I wrote the program.

And we both got the same mark.  To this day, I'm still irritated that he got the same mark for a proof that I had totally invalidated.  Meh: I still think it was the coolest little program I've ever created.  Well, until this new version I just created a few hours ago, which inspired this code challenge.

 

The BASIC programming challenge:

With BAM or your favourite BASIC, code a program that has no input and, when run, creates output that exactly matches the program.

  • Printing to the screen is sufficient.
  • If your program has line numbers, the output must also have the line numbers
  • A solution specific to features and characteristics that aren't common/standard across all BASIC implementations is cool for that BASIC, but the best solutions will handle the greater problem of handling double-quotes with CHR$(34), or whatever ASCII code for double-quotes used for your BASIC
    • i.e. decently (if not completely) "cross-BASIC" solutions will be the best
    • "BASIC-specific" solutions are also cool
      • But let's be careful to not get into "this BASIC is better than some other BASIC(s)" silliness.
  • The only statements allowed: PRINT and LET
    • You can have as many PRINT statements as necessary
    • For variable assignments, if your BASIC requires LET (or you simply like using it), then by all means, you are allowed to use LET
  • The PRINT statement(s) must print one or more variables
  • The values assigned to the variables can only be the results of string expressions, limited to and having any combination of:
    • literal strings
    • other string variables
    • simple functions such as:
      • ASC
      • CHR$
      • SPACE$
      • LEFT$ / RIGHT$ / INSTR$ / REPLACE$
      • LEN
      • Any other function that can do nothing other than work with string literals or with string variables (putting literals in the variables, getting values from the variables)
  • The variables cannot be "system" variables; they must be end-user variables defined by the program.
The program must exclude:
  • "INCLUDE" directives!
  • BBC BASIC's "Page" variable (or equivalent in any BASIC); that variable gives the program code that is in whatever memory area, which is not the same as the program containing itself in a variable that the program sets with literals/variables and/or functions (limited to the ones allowed in this challenge).
  • Features/syntax that are not common across a large number of BASIC implementations.
    • If your program is very specific to your favourite BASIC implementation, that's cool and worth an honourable mention for sure.
    • Much better, though, if it is a program that can be run as-is on pretty much any BASIC out there (GW-BASIC, CBM BASIC, BBC BASIC, BASIC Anywhere Machine, SpecBAS, etc. etc. etc.)

Keep your code private/hidden until December 10th 17th !

Submit your solution (I'll be submitting mine too) anytime December 10th 17th !

Remember, the program must not have any input.  So no "LIST" statement (it uses input), no printing what is in memory (memory is input), no reading from a file.  In your program, you must hard-code the values that go into the variables.


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