Welcome to AddressOf.com Sign in | Join | Help

GW-BASIC

I've been working hard since I got back from England on all aspects of the interpreter.

Language

For the most part, I think I have most of the language covered.  I've added a few extra keywords; however, the primary purpose is the have as much compatibility with the original as possible.  Most of these have been implemented using the documentation as a reference; however, it has become apparent that the documentation might not be as accurate as actually running the code in the original.  So I'm constantly finding cases where tweaks are having to be done to accomidate the differences between what the documentation states and what the original version actually does.  With that said, everyday there seems to be less and less of these differences. 

Editor

Spent a bit of time working on the "editor' in an effort to have it work similarly to the original; including a few quirks since some samples seem to rely on these in order to accomplish animations.  I hear what your thinking; animations and the editor?  Yes, the last line (line 25) is treated as a special case in not only in edit mode but at runtime.  I had to do a bit of rework in order to accomidate this quirky behavior; but I think I've got a handle on it.  Tests I've managed to put together are producing similar results. 

DOS 1.1

I have the majority of the samples included with DOS 1.1 working; without sound.  More on this in a moment. 

Graphics

I think I have full support for CGA and EGA level graphics nearly completed.  This includes colors, palette, pcopy, get, put, etc.

File System

I've stepped back from the web service based file system and have since replaced it with isolated storage and applied this to both the Silverlight and Windows Phone versions. 

Improved Performance 

Thanks in part to my visit to Redgate, I've been able to use the ANTS Performance Profiler to narrow in on where some of the performance issues exist in my interpreter.  Using this information, I was able to increase the overall performance by about 50% in the Silverlight version.  Experimenting with the Windows Phone version, I found that the majority of the performance issues were with how the screen is being refreshed; not necessarily in the actual interpreter.  After discussing the issue with Chris Koenig; he offered a suggesstion that, after a bit of research and experimentation, took everything to a whole new level by splitting the drawing between two different phases.  This model has also been applied to the Silverlight version and seems to work pretty well.  In the end, if you haven't looked at the ANTS Performance Profiler... take a moment to do so.  It's an awesome product!   I have nothing but nice things to say about the product, the team members that work on it and shared their insights with me and thanks to Redgate for playing host while I was in England.

Windows Phone 7

I've built a basic UI for the Windows Phone that works to make the DOS interface more user friendly in a thumb based device while still holding true to the original.  There is definately more that I can do; however, for now it seems to be a good start.  It now includes pinching and movement on the display surface, a special keys panel for keys not included on the phone interface, a basic UI that sits on top of the interpreters built in commands for file management that allows you to browse and manage through a more modern touch friendly interface and common commands available through the application bar and menus, basic support for tombstoning, prompting against accidental closure, isolated storage used for virtual file system, landscape or portrait layout and, as already mentioned, significant performance improvements.  I think I'm going to try to submit it for publication in the marketplace this coming week.

Silverlight

Still using Silverlight 4 at this point; however, given a few recent developments, I may be moving this to Silverlight 5 very soon.  I'm hoping that the sound api's included in v5 will go a long way to remedy the shortcomings that I've experienced previously.  I think these api's also are available on the phone, however haven't had a chance to reallly dig in.  I've also added the ability to drag and drop a .BAS file directly onto the surface and the interpreter will load the script into memory and execute it immediately.  A real time saver for files that you may have available already (or download).  I'd like to get copy/paste support working; however, my initial attempts are a little disappointing due to the security protections in place making the process a little clunky.  I'm also going to look into adding a "Save As" feature and a "Open" feature that allow you to import/export .BAS files using the standard windows most people are already accustomed to.  One last addition is, which most likely change, the addition of a "speed up" poke.  By default the interpreter processes a batch of statements per cycle; which right now is around 60.  Using this POKE, it's possible to modify how many are being processed each pass from 1 to a little over 1000.  So the default setting is POKE 0, 15 where the 0 is the address used and 15 is 1/4th of the processed statements per cycle.  POKE 0,0 will process 1 statement per pass.  Really, really slow; however, great for debugging the interpreter.  The current setting seems to be pretty close to what DosBox is running GW-BASIC.

Sound

I've already touched on this a little.  It seems that all of the best examples have sound to one degree or another.  I've got a lot of work in this aready to get done, which starts with the simple BEEP statement.  What is implemented at this point is close, but I need to modify it to be a square wave.  The SOUND statement plays sound; however, does not incude the blocking async behavior of the original which appears to be utilized by many samples as a means of CPU throttling in loops.  Finally, the last known issue is that sounds less than 2/10ths of a second appear to not produce any noise in Silverlight.  Once I solve these issues, I'll be able to work on implementing the Music Programming Language in order to finish the PLAY statement and the associated ON related functionality. 

Where can you start playing with the work in progress?

http://www.addressof.com/basic/

Enjoy!

Published Sunday, April 29, 2012 7:32 AM by CorySmith
Filed under:

Comments

# re: GW-BASIC

Tuesday, May 01, 2012 4:29 PM by azuckerman

It looks good so far!  Will this be something that can be downloaded for inclusion into other projects?

# re: GW-BASIC

Wednesday, May 02, 2012 9:36 AM by Clumpco

Hi, great project!

I tried it on my French computer and the keyboard mapping appears very strange, a mixture of US and French. For example the " appears on the shifted ² key (under the Esc key).

Usually the M keye is : and ; when using a FR k/b with a US interface, but it still does "m" in this case (a&q are not swapped either, nor z&w).

The !/§ key gives an "alt-code not supported".

Etc...

Keep up the good work!

# re: GW-BASIC

Wednesday, May 02, 2012 11:06 AM by CorySmith

azuckerman, thanks for the feedback.  Right now the focus is on getting the interpreter a compatible as possible with regards to the original GW-BASIC; once that is done, I have a lot of ideas what might come next and your suggestion is on the possibles list.

# re: GW-BASIC

Wednesday, May 02, 2012 11:09 AM by CorySmith

Clumpco, thanks for the feedback.  I've published v0.01.3 that includes a modification to the SYSTEM keyword so that it will display system information that might be able to be utilized to handle different regional configurations, specifically with regards to the keyboard layout.  Unfortunately, Silverlight does not do this automatically, so I'll have to handle this on a case by case basis.  If you could, please put together a "when I press key suchandsuch, the interpreter reacts with suchandsuch" and send that, with the SYSTEM information to me via email.  I can then see what I can do to accommodate the differences as much as possible.

# re: GW-BASIC

Thursday, May 03, 2012 5:41 PM by Clumpco

Mail sent with the keyboard mappings.

Now the next problem...

Silverlight respects the French convention of using a comma for the decimal point.

Print 10/3

3,3333333

OK

Print 10 * 0.5

Illegal function call

OK

Print 10 * 0,5

0       5

OK

Not so OK really :-)

# re: GW-BASIC

Thursday, May 03, 2012 11:17 PM by CorySmith

Thanks for bringing this to my attention.  I've managed to modify 0.1.5 so that it "forces" en-US so that, at the very least, the results are going to be what is expected given that the interpreter is being written by an english speaking American. ;-) I can say that I would like to find a better answer, however, for the time being I think this is the quickest solution.  I'd be interested in finding a localized version of GW-BASIC if it is available in languages other than US English to do some additional testing.

# re: GW-BASIC

Friday, May 04, 2012 7:45 AM by Clumpco

Thanks for the quick fix!

As far as I can remember GWBasic did not worry about localisation and always used the . for decimals. However I have no idea what happened with dates.

I used to have a French version of GWBasic, a short-lived attempt by Microsoft to satisfy the requirements of the French Academy that everything should be in French. The resulting mutant was horrible...

SI x<0 ALORS Y=2 SINON Y=4 FINSI

IIRC they decided that PRINT wasn't correct and used the French for "show" instead (AFFICHER)

We still have to suffer this today in Office/VBA.

# Odkazy z prohlížeče – 5.5.2012

Saturday, May 05, 2012 1:56 PM by .NET i jiné ...

CodeProject Grid960 Layout for Silverlight – 12-sloupcový layout, zajímavá koncepce Hex Grids and Hex

# Odkazy z prohlížeče – 11.5.2012

Friday, May 11, 2012 1:44 PM by .NET i jiné ...

CodeProject A WPF Font Picker (with Color) Roboti, HW, Lego NXT Introducing FEZ Cerbuino Bee, an Arduino

Anonymous comments are disabled