Posts GW-BASIC
Post
Cancel

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!

This post is licensed under CC BY 4.0 by the author.