SpecBAS 0.775 released!

SpecBAS 0.775 released!

Postby ZXDunny » Thu May 23, 2013 3:48 pm

Hi all - me again :)

SpecBAS has been updated again, and a whole load of new stuff has been added. Not many bugs fixed (none reported, and I only found one) so we're definitely moving towards a 1.0 release soon...

Here's what's new:

Code: Select all


  Inline IF support - IIF(condition,true-expr,false-expr) will return the correct expression's result based on the condition. Also, IIF$ for strings
  SORT array() or array$() will sort a one-dimensional array
  INCLUDE "myfile1","myfile2"... to add procedures from other files into your program at runtime
  RENUMBER now respects RESTORE and RUN when used with a numeric parameter
  CASE structure - CASE, WHEN, WHEN IN, OTHERWISE and END CASE - See documentation for details
  Music files can now be stored in and played from a memory bank
  WINDOW MERGE id can now be used to close a window and copy its contents to the display - specify ALL instead of an id to merge all open windows
  MUSICPOS function - returns the position of the currently playing music in seconds
  MUSICLEN function - returns the length of the current music in seconds
  Auto-arrays: for simple one-dimensional arrays, you can DIM a=1,2,3,4,5 to automatically fill the array
  BASE$(value,base) returns a string of the number converted to the chosen base. 2 = Binary, 16 = Hex etc.
  SEARCH(array() FOR value) will return the first item in the array that contains the value specified (or string). SEARCH(array() NEXT) will return the value of the next item, assuming that SEARCH has already been called.


  Fixed an /old/ bug which inappropriately truncated arrays when LISTed

Of particular importance are the INCLUDE and CASE statements.

10 INPUT a
20 CASE a
30 WHEN 1 : PRINT "ONE!"
40 WHEN 2 : PRINT "TWO!"

Which should be self-explanatory... hopefully. You can also check your value (a above) with a range, using WHEN IN:

60 WHEN IN [4 TO 10] : PRINT "Hoorah!"

Again, should be easy enough to figure out. It's quite abusable too:

20 CASE 1
30 WHEN a>2 : PRINT "A Is Bigger!"
40 WHEN a<2 : PRINT "A Is Miserably small!"

...You can see that the value in the CASE statement is evaluated - so 1, being TRUE, is matched to the corresponding WHEN statement. Fun :)

And then there's INCLUDE - does exactly what it says on the tin. Adds procedures and functions from an external file, making them available to your code. It goes a bit further - the code inside those functions and procedures can wander around their code to their hearts' content, but your code is off-limits. Similarly, your code cannot wander into their operating space.

INCLUDEd code is accessible only so long as your program is not changed in the editor, so this command is really intended as a runtime-only system, though you can call from the direct command line so long as you've not edited your code beforehand.

Have fun!

10 PRINT "SCUNTHORPE"(2 TO 5);" ";: GOTO 10
Posts: 538
Joined: Fri Oct 01, 2010 9:53 am
Location: Scunthorpe, North Lincolnshire, UK

Return to SpecBAS

Who is online

Users browsing this forum: No registered users and 2 guests