Skip to main content

Posts

Showing posts with the label Liberty Basic

Liberty Basic in 2010

This past year has seen some modest progress in the world of Liberty Basic: Carl published a book titled Beginning Programming with Liberty BASIC . This is a great book -- I read it from cover to cover. Even if you're an experienced programmer, it is a fast way to get the gist of the language and you may even pick up a few new things along the way. Liberty Basic 4.04. This release offers better compatibility with Windows Vista and 7. It also fixes some bugs. I think it will be the last release of the 4.x version. Liberty Basic Pro. This is just 4.04 and Assist combined into a single product. Hopefully 2011 will be the year of Run Basic.

Tiny Basic 1.2 Progress

I'm working on the next release of Tiny Basic. Here's the latest list of enhancements: Added GOSUB/RETURN statements. Added TITLEBAR statement for the interpreter console. Increased program lines from 100 to 1024. Rewrote the MEM code. Added runtime error handling in the interpreter. It trys to recover to the READY prompt. Created test program for the interpreter (i.e. primitive unit testing). Granted that some of these changes are behind the scenes, but I'm trying to increase the robustness of the interpreter without refactoring it into something completely different. Before I release Tiny Basic 1.2, I still want to add these features: String variables (i.e. a$ -- z$). FOR/NEXT loops Fix known bugs in current version. The work continues...

Carl Gundel Interviews

Over the past month, I've found several audio interviews with Carl Gundel. If you are interested in a behind-the-scenes look at Liberty Basic and Run Basic, then these are recommended listening: Industry Misinterpretations 22: Liberty Basic with Carl Gundel ( mp3 ). Shareware Radio Podcast: Interview with Carl Gundel ( mp3 ). Enjoy!

Tiny Basic Sieve Benchmark

Compared to the Sieve benchmarks in previous posts, Tiny Basic is very slow. In fact, it's much slower than I anticipated. I ran Tiny Basic on both the Run Basic public server and Liberty Basic 4.03 on my laptop. Here are the numbers: After 5000, the Run Basic program exceeded the allowable time on the public server. The following is the Sieve program. I had to use IF statements because Tiny Basic doesn't have a FOR/NEXT loop yet. 10 REM sieve2 20 REM ported to Tiny Basic from Liberty Basic by David den Haring 30 REM last updated: 8-14-07 40 REM s -- size, a() -- flags array, a -- start time, z -- end time 50 REM i -- loop counter, p -- prime, c -- prime count, k -- temp 60 s = 7000 : i = 1 70 a = ms 80 IF a(i) > 0 THEN GOTO 300 90 p = (i + i + 3) 100 k = i + p 110 IF k > s THEN GOTO 290 120 a(k) = 1 130 k = k + p 140 GOTO 110 290 c = c + 1 300 i = i + 1 310 IF i > s THEN GOTO 400 320 GOTO 80 400 z = ms 410 PRINT c; 420 PRINT...

Tiny Basic v1.1 Released

I posted a new version of Tiny Basic in both the Run Basic and Liberty Basic wikispaces. Here's a list of new features: Added a fixed array accessible from the interpreter -- a(1) to a(7001). The size of the array can be adjusted by changing the ArraySize variable in the code. Added the functions seconds and ms (or milliseconds ) for benchmarking purposes. (LB4 only). Fixed LOAD and SAVE commands. The argument that these commands take is a number. For example, " LOAD 1 ". The file saved in the working directory will be "TinyBas1". (LB4 only). Fixed AutoRun feature. If a file exists in the working directory called "TinyBas0", it will load and run automatically when the interpreter starts up. (LB4 only). Added KILL and DIR commands to round out file management. KILL takes the same numeric argument as LOAD and SAVE. The DIR command has no arguments. It will display a list of Tiny Basic files and the time stamp. Known Issues: There is no file managem...

Tiny Basic tinkering

One of the examples on the Run Basic website is a port of Tiny Basic . It's fun to play with and is very much like the interactive, command line Basics found on early personal computers. In fact, I think Tiny Basic was the dialect used on the TRS-80 Model 1. I'm currently working on modifying Tiny Basic to run the Sieve benchmark. Tiny Basic needs two things: profiling and array support . I've already added profiling support for the RUN command. Tiny Basic now displays the running time of a program in milliseconds. The last step is to add array support. Tiny Basic only supports the numeric variables 'a' to 'z'. I'm adding a single array to the environment in order to port the Sieve program. The array will be called a(). I will post the modified Tiny Basic code to the Run Basic Programming Wiki when finished. The whole point of this exercise, however, is to see how fast the Tiny Basic interpreter runs the Sieve benchmark and compare it to the others i...

Sieve benchmarks

After comparing the performance of Run Basic (Beta) and Liberty Basic 4.03 using the Sieve sample program, I wanted to expand the comparison to include a few other languages. I ported the Sieve program as directly as possible. Here are the test results sorted from low to high: Find primes from 0 to 7000 (10-run average in milliseconds) Visual Basic 6.0 ( 0.0 ) Run Basic ( 28.8 ) REBOL ( 35.9 ) Runtime Revolution ( 63.7 ) Liberty Basic 3.03 ( 146.8 ) Liberty Basic 4.04 ( 170.3 ) Find primes from 0 to 1000000 (10-run average in milliseconds) Visual Basic 6.0 ( 273.5 ) Run Basic ( 4164.4 ) REBOL ( 4767.2 ) Runtime Revolution ( 12421.5 ) Liberty Basic 3.03 ( 20381.1 ) Liberty Basic 4.04 ( 27732.9 ) I ran the 0-1000000 benchmark to get VB off of zero milliseconds for a better comparison.

Run Basic much faster than Liberty Basic 4.03

Just for fun, I ran the sieve2.bas example that ships with LB4. I was a little shocked to find that Run Basic finished about 5-7 times faster than LB4 running on my 1-year-old Dell laptop. The Run Basic time varied between 23-35ms -- and that's on a public server. LB4 on my Dell Inspiron 9600 laptop varied between 156-172ms . The Dell is running XP and has an Intel Core Duo (T2300 @1.66GHz) with 1 gig of RAM. I mentioned this on the Liberty Basic Community Forum and Carl had this to say: "Run BASIC and LB5 are not only using a new development tool, but their design is fundamentally different than older versions." Run Basic and LB5 will be worthwhile upgrades if only for the speed improvements.

Moving forward

Compared to the rest of the computer world, Liberty Basic moves forward at a slow pace. Glacially slow. But it moves. Since my last post almost two years ago, here are the most interesting developments: Liberty Basic 4.03 was released. Version 4.04 is in the works and will run better on Vista. Assist for Liberty Basic was released. This is an add-on to the IDE that adds profiling, version control, automatic formatting and a few other goodies for professional developers. Carl now has a partner who is also an active developer. The newsletter is finished. New content is now on a wiki ( http://lbpe.wikispaces.com ). Run Basic is online ( http://runbasic.com ). It is a Liberty Basic dialect that runs in your web browser. In fact, it sports the new LB5 syntax. Speaking of that... Liberty Basic 5 is in development and is late due to problems with Carl's tool vendor. Finally, Alyce Watson has a new book: API's for Liberty Basic  ( http://www.alycerestaurant.com/apilb/index.htm ). After...
Carl released a minor update to Liberty Basic: 4.02 . New features (pulled right from the release notes): Added a new Create Application feature to the Run menu. This is only enabled for GOLD license users. Added support for the MOD operator. For example: print 15 mod 4 Added support for scientific notation in code. For example: print 1.2345e-4 Updated the toolbar icons in the editor and debugger for a fresh looking UI. Improved the parser making it tolerant of spaces between identifiers and a ( characters. For example, some other BASIC's allow the following: print mid$ ("hey!", 4). Now Liberty BASIC also allows this kind of formatting. We did this to make it easier for people coming from other dialects of BASIC. Reworked the External Programs dialog to make it easier to use. When run or debug is invoked and there is a selection in the editor a popup notice now asks if you really want to run only the selected code. Answering no runs the entire...
I know, I know. This blog has been dormant a long time. Life happens -- new wife, baby on the way. Life is good. Liberty Basic continues to evolve slowly -- version 4.01 is the current release. Carl is busy at work on a new more interactive Basic. I don't think it will be backwards compatible with Liberty Basic, but my forum research is incomplete and Carl does not seem to be telling. This new Basic may also be cross-platform. He believes strongly in a small core language that remains close to the roots of the language. In a .NET world, this is a refreshing direction but it is not without its consequences. Namely, lack of readily available power. I continue to use Liberty Basic for small projects, but the language presents roadblocks to COM, database and Internet technologies. Thanks to LB's DLL access, intrepid programmers have been working around these limitations and publishing their work in the monthly online newsletter . The problem is that it's much easier to use ano...
All of the Liberty Basic newsletters are now in one convenient location . The May edition ( NL108 ) of the newsletter has been published. This edition and many of the old ones can be viewed online. This is a first for the Liberty Basic newsletter. They used to be published as a text file.
The latest edition ( NL107 ) of the Liberty Basic Newsletter is on the virtual newsstand. It's free and a great resource for all levels of programmers. The previous 106 newsletters are also available at no cost.
Liberty Basic 4 is now in Alpha testing. It looks like it's going to be a big step forward for the language. Here's a brief list of the new features: True global variables. (declared using the new global keyword) Passing arguments to a sub or function by reference. (I complained about the lack of this feature in LB3 about 4 posts ago.) Handle variables and the new maphandle command. (liberation from static handles to windows, controls and files) Dynamic evaluation of Liberty Basic code inside of a running program. ( eval returns a numeric value and eval$ returns a string value) Subroutines can now be used for event handlers. (a better choice over branch labels for large programs) There are many other enhancements, but these are the big ones. The IDE also has a new feature that lets you create tutorials or lessons using a three-pane window. On the left pane is the outline of the lesson. On the upper right pane is the lesson text. On the lower right pane is LB code...
Yesterday, Carl released the first alpha of Liberty Basic 4! Those interested in helping Carl test LB4 should go to the Liberty Basic Forum . Join the Liberty Basic 4 Alpha Testing forum. There is a link to download LB4 in Carl's first message. More to come on LB4's new features!
The latest edition ( NL106 ) of the Liberty Basic Newsletter has just been published. Two articles really peaked my interest: Using SQLite Database Manager in LB by Colin McMurchie. Unbelievably simple API access to the SQLite database. This embeddable database is in the public domain, and after a first look it seems to be a good fit for the Liberty Basic programming world. What I Did With The !Locate Command On My Summer Vacation by Tom Nally. Tom creates a Hypercard -like stack using Liberty Basic's !Locate command. Basically, controls are located off-window and moved into place when needed. Doing this type of GUI work by hand is tedious, but a "stack creation" tool could automate most of the drudgery. I wonder if this idea could be used for FreeForm. Building a GUI with real controls is better than FreeForm's graphically drawn controls.
Despite the fairly recent addition of real functions and subs to the language, Liberty Basic still pushes you to use the old gosub/return construct. This pressure is not obvious until you're actually writing programs. Let's see how the pressure builds: Parameters passed to a function or sub are "by value". This means that a copy is made and no changes can be made to original variable in the function call. Global variables are not visible in a function or sub with the exception of arrays, structs, handles and system variables. Sometimes you need to return more than one value. Using single-dimensioned, 1-element arrays as global variables is ugly. The cleanest solution is to make the code global as a chunk of gosub/return code. This might be a partial answer to the question I had about why so many Liberty Basic programmers keep on using this construct instead of switching entirely to functions and subs. There are a few things that require functions -...
The purpose of this blog is to talk about Liberty Basic in particular and computer science in general. Liberty Basic is an easy to use Windows dialect of the BASIC programming language. It's written in Smalltalk by Carl Gundel. Liberty Basic 3.02 can be downloaded as shareware at the official website . There is no expiration, but programs can't be larger than 250 lines of code and they can't run outside of the LB editor. It's a reasonable limitation. The Silver registration ($29.95) removes the code size limit and popup reminders. The Gold registration ($49.95) adds the ability to create standalone applications that run outside of the editor. Future posts will both praise and bash this venerable tool. It has been around for 10 years, first as a 16-bit language and now as a 32-bit language. As a computer professional, its limits can sometimes be frustrating, but even so it remains the most "fun" language in my tool chest.