Announcing a real home for the BASIC SIG meetings; this means that the meetings will actually happen every month starting August 4th (every first Tuesday)!!!!
What makes this announcement even more AWESOME is where it actually is going to be...
Thanks to a grant from the U.S. Institute of Museum and Library Services and the Texas State Library and Archives Commission, the North Richland Hills Public Library has created a very special place for people like you and I... the hobbyist! As part of this project, they've also set aside a portion of this space for meetings just like the BASIC SIG and, with a huge smile, I can say that the BASIC SIG is the first regularly scheduled meeting that will be taking place in this new space!!!! To read more about this awesome new space, please visit http://themakerspot.org.
Yes, this means that the meetings will no longer be taking place at my home. I sigh, however, my wife rejoices. ;-) This does mean that more people can attend and that, as a whole, the thing is more real.
The August 4th, 2015 meeting will be:
Programming devices that cost less than $50
In this session we will cover various devices that cost less than $50 ranging from Arduino, Netduino, Galileo, Rasberry Pi 2 and Windows Phone...
Pizza will be provided, please RSVP so we know how much to order.
Yes, the meetings up to this point have been hit and miss, so I want to share part of this has because we needed a location and that location has been a long time coming since it was "literally being built". Also, as a requirement to meet at this location, I also have to state: This event is not sponsored or endorsed by the by the North Richland Hills Library, The Maker Spot or the City of North Richland Hills.
The source code for Checkers Solitaire is now available on http://GitHub.com/DualBrain/CheckersSolitaire; go check it out, fork it, play with it, contribute, share, give me a pull request!
Lack of ideas as to what you can do to contribute... how about helping get it to work on Mono or separating the UI from the rest of the code in order to port to XAML and possibly WinRT.
Hmmm... not sure I really ever thought that I'd ever be the person saying those words, however, the day has finally come... hell has frozen over... open source is now in my vocabulary and I am embracing it wholeheartedly. I'm definitely still a newb in the OSS space, very unfamiliar with the vernacular, tools are foreign, approach is "odd"; but I'm sure I'll get the hang of it over time. In order to get started, I've resurrected a project that I made available here almost a decade ago (really, it's been that long?!?!?!) and published it to GitHub.
I have several other projects, some older, some newer that might be making their way to GitHub; most likely using the MIT license. These include:
I'm also still weighing the pros/cons of making my tribute to GW-BASIC available as OSS.
Why the hesitation? Well, you know, although it's not something new, it's new to me. I'm going to start with things that I've already made available (with possible updates) since, ultimately, I've already "exposed my soul" with those projects anyway. As for other projects, I'm definitely experiencing feelings of fear, uncertainty and doubt regarding how things will be received and responded to; however, it's something that I think it's time to do. There are also huge upsides to going OSS, especially for "code sample" type of projects. Key of those advantages are that people can collaborate and contribute, something that really isn't all that straight forward using any other approach. Additionally, the potential for reach is pretty astounding (which is one of those things that also adds FUD). So we'll see where this goes from here.
I do have to admit that this move on my part is definitely inspired in no small part to Microsoft's recent move with .NET in general toward OSS...
Arduino *AND* Raspberri Pi (Oh My!)
After discussing with several people, I came to the realization that since the format of this group is different than the typical presentation style meeting, we can easily handle BOTH! Remember, this is a BASIC-themed hackerspace. It's not really about "presentations", more about being hands on. Instead of "watching", it's about doing. The only "rule" (if you want to call it that), is "if it can be done with BASIC, it should be done basic BASIC". ;-)
On one side of the room, we will be working on getting VB.NET through Mono working on a Raspberry Pi.
On the other side of the room, we will be getting an introduction to BCX to build for the Arduino along with everything that needs to be done to get an environment setup to do so. We will also be learning more about what the Arduino is, playing with some simple electronics projects (along with covering some of the basics of electronics). Even if you don't have an Arduino, we will be looking at ways that you can still experiment (and learn) even without actual hardware. If you do have the hardware, be sure to bring it along. If you don't, just bring a laptop and you can still be involved.
There are also a few BASIC SIG group related things to discuss, so we'll knock those out at the start of the meeting so we can get to the fun.
I'll be ordering pizza once everyone has arrived (or I know you are definitely coming), so please RSVP (location, date, time, etc. included in the RSVP link).
See you there.
I'm writing more so as a reminder to myself...
What I am trying to do is transition an older machine, one that is "semi-retired" but still contains some stuff that I need every once and a while for work purposes and I'd rather not muck up my new installation with these tools.
So enter virtualization technology... wouldn't it be nice to somehow convert the physical machine to a virtual machine that can be stored and utilized from any newer machine that I choose... when and if the need should arise?
The tools that I've used thus far are:
I used the Disk2vhd tool to convert the physical disk to a VHDX formatted virtual disk; the nice thing about this tool is it is designed to be run on an active system utilizing "Windows' Volume Snapshot" capabilities. What this really means is that it's smart enough to be able to image the drive even though files are in-use.
I then downloaded and installed VirtualBox on the target machine that I'd like to get this up and running on. I then created a new virtual machine and hit my first problem... thanks to Visual Studio 2012+... Hyper-V is enabled by default in order to facilitate development and testing on Windows Phone devices. Because of this, VirtualBox does not allow me to create a virtual machine that is 64-bit; which, of course, the original machine was. The first step was to disable Hyper-V. To do so, you could either go to Enable/Disable Windows Features and do it using a mouse... our, use the following command line (requires Administrator elevation)...
bcdedit /set hypervisorlaunchtype off
(Note: To enable later, use "bcdedit /set hypervisorlaunchtype auto".)
Once you have successfully executed the above command line, a reboot is required. Now that this has been completed... of course, as you can probably guess, yet another "speed bump"...
In order for 64-bit virtualization technology to be leveraged, the BIOS (most likely culprit) needs to be entered and Intel Virtualization needs to be enabled. On the target machine, a newer model Windows 8 Sony VAIO® Fit 15A / Flip PC, I had to press the "Assist" button pressing the "Power" button from a powered off state. Now that this has been completed, YEAH!, I can finally create a 64-bit Windows 7 virtual machine in VirtualBox.
OK, I create a new machine, set the memory to what the original was (4GB) and leave the HD until later... as it turns out, I was not yet prepared to "use an existing disk".
Apparently the VHDX formatted virtual disk is not compatible with VirtualBox; here's where Windows PowerShell and Convert-VHD come into play. The following command line can be executed to easily (albeit slowly depending on the size of the disk) convert between VHDX to VHD (or the other way around if you have the need)...
Convert-VHD nameofdisk.vhdx nameofdisk.vhd -Passthru
(and wait for this to complete)
Once done, I can then modify the settings of the virtual machine and connect the disk image with success. In my case, the original machine was SATA, so I chose the SATA path instead of IDE.
I then started the virtual machine... after a bit of chugging along and several Windows updates... I now have a virtual machine that appears to match the original physical machine.
Here's the situation, you want to be able to build a console application and still take advantage of the asynchronous programming model available in the latest versions of VB (2012/2013).
No matter the reason behind why you may want to do this, the answer I give will still be the same; however, I'll provide my real-world reasoning behind my desire to have Async/Await from a Console Application... TESTING. Many times it is a lot easier to do testing of API's from a Console Application; however, if your API's are Async/Await... thus the problem.
To do so, you may be tempted to start by modifying the Sub Main() based on the tons of examples you've seen for several other types of projects.
Async Sub Main()
Dim result = Await WebUtilities.FetchUrlAsync("http://addressof.com")
This, however, will not work. Visual Studio will quickly alert you to this situation and you are left scratching your head. You then will proceed (most likely) to search the web for a possible solution. There are several out there that state that you need to setup some sort of synchronization context or some such and that you'll need to either use one that someone else has made or build one yourself. There sure seems like there's got to be a simpler solution...
Async Function MainAsync() As Task
Dim result = Await WebUtilities.FetchUrlAsync("http://addressof.com")
Hmmm... that seems to do the trick.
The Task.Run method has several overloads, one of which takes the address of an Async/Await style method. This actually kicks off the process of running that method asynchronously; however, if left to just calling this Run() method, the application would then exit immediately as nothing is keeping the Main method from completing. To work around this problem, the Wait() method is executed upon the return of the Run() method.
To keep things straight, I named the target method MainAsync(). This is where I will place all of my code that would have normally been in the original Main() method. From this point, anything I want to test; whether it be Async/Await or not, it "just works".
A couple of side notes:
It does have to be a function, but since I'm not actually needing to return a "result", we will be returning Task. This is necessary for the Async/Await functionality to work. The rule is either to return Task(Of [type]) or just Task. Whenever you add the Async keyword to an existing Sub in other project types, this is only allowed on events and only in projects that have an understanding of this concept. There is a ton of behind the scenes compiler magic that occurs and the only place where this should be done is where it's been "blessed" by the platform/compiler teams. For all code that you write, stick to Function with either a result of Task or Task(Of [type]); keep it simple.
The return of the Run method occurs as soon as the first Await is encountered in the target method; so in the above example, it happens immediately. The Wait() method will pause the execution of the Main() method until the total completion of the target method.
Working with WinRT, well, I'm just going to say it... sucks! I'm past the "who moved my cheese" phase; so that's not why I'm making that statement. It sucks because it is not completely thought out, requires that you have to jump through hoops that were solved by many other API stacks many years ago, and contains way too many conflicting stories, requires crossing too many API layers... in other words, it's either incomplete or not very well thought out. With that said, there's not much I can do about it; if I want to target the Windows Store, I have no choice but to roll up my sleeves and attempt to trudge through the mess to accomplish the task at hand.
These adventures will be done in a scenario(s) / solution format. So let's get started.
It doesn't matter if we have a desktop, tablet, Intel machine, ARM machine or even a Windows Phone 8 device; storage space is limited. As an application author, I want to be a good citizen. It's bad form to write to the storage device(s) blindly without regard to the amount of storage space that is left. Windows, as a whole, (to the best of my knowledge) does not work very well when it runs out of space (temp files anyone). A Windows server is nearly impossible to log into remotely if the disk free space has reached 0. This should never happen and the authors of software should play nice.
So we want to write something to the storage device. We want to be a good citizen; so let's see if we actually have enough storage space without risk of bringing the system to it's knees. How do we do this?
As a .NET developer using a framework that has been around for over a decade, the following "just works".
Dim drive = New System.IO.DriveInfo(driveName)
Dim available = drive.TotalFreeSpace
Sorry... not available in WinRT. After doing a bit of research, I was unable to determine any way of any kind to accomplish this task using the WinRT API.
WinRT is also "sandboxed"; meaning that it does a tremendous (or hideous depending on your view) job of isolating what can and cannot be leveraged on your device without your permission. Even given permission, there is only so much that a WinRT application can do; which means that there is a ton of things that it can't.
So if it isn't in the WinRT API, your screwed... or are you?
As it turns out there appears to be a few "blessed" Windows API's that are allowed to be P/Invoked from a WinRT .NET application. One of these is the Kernel32 GetDiskFreeSpaceEx function. To utilize it, you'll need to create a "reference" to it by adding the following to a class.
Declare Auto Function GetDiskFreeSpaceEx Lib "kernel32.dll" (
ByVal lpDirectoryName As String,
ByRef lpFreeBytesAvailable As ULong,
ByRef lpTotalNumberOfBytes As ULong,
ByRef lpTotalNumberOfFreeBytes As ULong) As Boolean
So one way to get the free space is to use a reference to your application folder...
Dim available, total, totalFree As ULong
Dim appFolder = Windows.Storage.ApplicationData.Current.LocalFolder
If GetDiskFreeSpaceEx(appFolder.Path, available, total, totalFree) Then
Dim err = Marshal.GetLastWin32Error
If err = 5 Then
' Access Denied
Seems relatively straight forward and painless (once you figure out the Kernel32 declaration, understand how p/invoke, marshaling and the different method that "error handling" works in the Windows API --- or you just blindly copy/paste what someone else does and hope for the best). Also, even though it's pretty obvious, you can see that it takes a few more lines of code to accomplish the same task compared to the .NET BCL (Base Class Libraries); appears to be one of those "one step forward, two steps back" kind of days.
Here's the problem, what if your documents folder isn't on the same storage device as your application? Even if your application has been given permission to read/write to the documents location, you can not pass the path to the documents location to get a result.. instead, you get an Access Denied message.
So I experimented further and found that passing "D:\" also fails.
I then attempted, as last ditch effort, "D:"... it works. WTF?!?!?!
Is this documented anywhere? Not that I could find. What a wonderful (WinRT) time we live in. At least I can get done what I need to get done, moving on.
See you in the next adventure.
The following is a list of samples that I've found helpful as I continue to work on my first WinRT application:
XAML AppBar control sample
Demonstrates how to use the AppBar control to present navigation, commands and tools to users. Of interest is the information on using Page.TopBar and Page.BottomBar (versus doing it as a Grid segment) and how to configure a global AppBar so you don't have to add these to every page.
Sharing content source app sample
Demonstrates how an app can share content with another app using classes from Windows.ApplicationModel.DataTransfer namespace. This provides the ability to share Text, URIs, Files, Images and custom content between multiple applications through a common UI experience.
I'll continue to add to this list as I find more...
Disclaimer: Let me be clear in that I am ***not recommending*** doing what I'm about to discuss except for the specific scenarios where it is ***needed***. With that said...
When working with platforms that do not have full support for the Visual Basic .NET runtime; it can sometimes be difficult to get things working and you may even decide to purchase a tool to convert the project to C# and ditch VB. (Again, ***not recommended***.)
One way to get around this is to build your project in such a way that you are pretty much guaranteed that the code will execute regardless of the target platform. This can be done, using VB (or C#), with relative ease in VS 2012 (and VS2010 SP1 with a free add-in) by leveraging Portable Class Libraries and choosing to target every platform on the list. This will provide you an environment that comes pretty close to enforcing that you only use features and functionality that is available across all of the selected platforms.
With regards to Portable Class Libraries and Microsoft specific platforms, this is a great solution. However, if you want to target non-Microsoft related platforms (Android, iOS, Linux, etc.), these platforms may not have the same level of support. However, all is not lost. Microsoft, with the release of Visual Studio 2010 SP1, has accepted this to be the reality and provide for functionality to support these scenarios.
There are three different features available to support these scenarios:
1. Completely remove the Visual Basic runtime; forcing that you use only the functionality made available as part of the Framework. (/vbruntime-)
2. The ability to reference a replacement version of the Visual Basic runtime; one from a third party or even one that you create in order to cover the functionality that you would typically utilize when the runtime is normally available. (/vbruntime path)
3. Include the most basic functionality available through the Visual Basic runtime by embedding it within the assembly; thus removing the external reference. (/vbruntime*)
Of these options, I believe that the 3rd option provides the best of both worlds. All of the essential conversion functions, attributes, additional support for Try/Catch When, For Each, string comparison, Chr, Asc and a few "useful" (aka common) constants are included.
This functionality is exposed through the command line compilers switches. There is nothing in the Visual Studio IDE that provides access to this switch.
This is all fine except for one significant problem. For any project of significant size, compiling your project from the command line to utilize these switches can be a very daunting task. To complicate matters further, there is no way to specify this switch on the msbuild command line. If only there was a way that this could be done.
As it turns out, there is, in fact, no switch on the msbuild command line to handle this; however, you can modify the .proj file to include this support. To do so, from within Visual Studio:
1. Load your solution.
2. Right click on the project in the Solution Explorer.
3. Select the Unload Project menu item.
4. Right click on the unloaded project and choose the Edit menu item.
5. In the editor, find the first <PropertyGroup> section.
6. Create a new line to this section and enter <VBRuntime>Embed</VBRuntime>.
7. Save the file.
8. Right click on the unloaded project and choose the Reload menu item.
At this point, you may see a ton of errors related to functionality that is now missing. It appears that the IDE is also able to handle this flag; making it a bonus. (Disclaimer: I'm not sure as to how well it does this.)
Now when you build your project, it will no longer include an external reference to the VB Runtime. This, of course, means that you will not be able to leverage many of the features that it provides; however, it does provide a means to use VB to target more platforms.
I've made a few enhancements to the interpreter..
- There is now a branding/navigation bar across the top. This provides the ability to visit this website and access to additional functionality.
- The files button (in the navigation bar) provides for a more modern UI over the 1980's era GW-BASIC commands FILES, CHDIR, RMDIR, LOAD, RUN and KILL. Folders are in bold where files are normal. The .. (period period) entry provides a means to easily CHDIR up one level. This is essentially a direct port of the work I'm doing for the Window Phone version.
- CTRL+V and CTRL+X in direct mode will interact with the OS clipboard for copy/paste support. CTRL+V (paste) will pipe whatever is in the clipboard into the interactive interpreter; in other words, it will emulate typing in the characters into direct mode of the interpreter. CTRL+X (transfer to clipboard) will take the in memory source code and copy it to the clipboard.
- Thanks to feedback, someone has provided me with several key codes that are used on OSX; so I think I'm getting a lot closer to having the keybindings working correctly on Macintosh machines.
- The SYSTEM keyword has been modified so that it will PRINT various environment information so that globalization and localization can be handled going forward.
- On systems that have different keyboard scan codes, the interpreter will print acknowledge this key being pressed with the associated key code. This is used to assist in creating the appropriate keybindings; so keep sending in the feedback.
- Adam Zuckerman pointed out issues with RENUM and LINE INPUT. LINE INPUT has been resolved and the RENUM one is "sort of" resolved. It "works", however, I'd like to spend more time on this in the future. He also brought up the copy/paste idea; which I thought about previously but set aside since it wasn't within scope. However, he sent in several code snippets via email and lack of having the ability to copy from email and paste into the interpreter was a right royal pain... so problem had to be solved. ;-)
Additionally, several people pointed out that couldn't find where to join this site; as it turns out, it was turned off. Doh! This has been corrected and you can join by using the link in the upper right hand corner of the screen.
Thanks to the amazing number of emails; please keep the feedback going. It's amazing how many people have had positive things to say.
I've been working hard since I got back from England on all aspects of the interpreter.
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.
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.
I have the majority of the samples included with DOS 1.1 working; without sound. More on this in a moment.
I think I have full support for CGA and EGA level graphics nearly completed. This includes colors, palette, pcopy, get, put, etc.
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.
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.
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.
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?
Next Monday, I'll be headed to the UK (Cambridge) for a "vacation". As it turns out, this is also the home of Red Gate software, makers of SQL Toolbelt, ANTS Profiler and .NET Reflector.
I'll be spending some time with them while there; so if you have any questions / comments you'd like me to pass along, feel free to send them my direction.
I'm not, in the slightest, embarrased to admit that I'm pretty excited to hang out with the team now responsible for .NET Reflector.
I'm currently in the planning stages to rebuild this site. I've delayed doing this for a long time since I didn't want to "break links"; however, one reason why I don't contribute as much as I used to is the fact that I enjoy the comment interaction. Thanks to blog spam, I had to disable anonymous comments and, since that time, my posts have slowed way down. (Yes, CAPTCHA controls exist; however, it's not that straight forward to implement on this now aging copy of community server.) So, I've made the decision that it is time to do whatever is necessary to kick start things back into full gear and if this means that web links are broken in the process... so be it. I'll investigate ways to accommodate the change; however, at the end, it's time to get'r'done.
For those following along (for a while), I have another pet project that I built for my own purposes and have enjoyed the fruits of since that time. I have four 400 disc DVD players connected to Media Center that allow me to choose among 1600 movies at the press of a button; and the overall cost of the hardware is amazingly small in comparison to other options. I was recently approached by a long time friend regarding his desire to attempt to market the project and we made our first sale last week! It's officially a product now!!!! For full disclosure, I did have to address a few issues that I was ignoring (I knew what I was doing after all) and made a few enhancements to actually productize it for a v1.0 release.
Fort Worth .NET Users Group
I've been knee deep in working to get the FWDNUG on track now that I'm the acting president. Let's just say that it's been an adventure up to this point; however, I think things are starting to really come together and 2012 is starting to look like a very good year for the members of the group!
I also want to say how much fun the end-of-year party was; how often can one say that thanks to a .NET users group I got to shoot an AR-15, an AK-47 and a Colt .45! :-D
VB6 -> VB10 Comparison
Look for additional entries on this to come in the first part of January. Additionally, once VB11 is made available, I'll be sure to do a follow up for any items that are appropriate.
The pet project is still moving nicely along.
I think I've pretty much gotten the parsing and interpreter where I'd like to see it; at least for this project. The performance is pretty good and works pretty well on Windows Phone 7.
My decision to switch to the portable library project was, as far as I'm concerned, a very good one. It does force me to have to think through how I'm going to implement portions of the project so that implementation can be segmented across different platforms, which at times can be a bit daunting in the midst of "just getting it done". However, even with the additional work that is involved, I do believe that the results are paying off.
The "IDE" portions is pretty much 100% as well as most of the ANSI style "graphics". Additionally, CGA mode is mostly complete (except for my new arch enemy... CIRCLE). As a follow up to the last post, the "last line issue" has been resolved by no longer trying to reproduce the behavior of the original GW-BASIC... which is something that seems to be impossible because two different versions of GW-BASIC did it two different ways... so I decided to "fix the bug" and move on.
Working pretty well; however, I think I'm going to re-address this at a later time so that it is based on "scan codes" at a lower level and works across the various keyword appropriately.
The file system over web services idea is working pretty well; however, there are significant issues that I've encountered due to a budget host environment. Since my last post, I am now interested in attempting to build this over SkyDrive... so we'll see where this goes as we move into the new year.
Silverlight 5 has been released, so now I can see if the improvements to low-level sound will help solve some of the issues I was facing. I'll update once I know more.
As of this writing, 176 keywords have been implemented. For the most part, the majority of these keywords is pretty complete.
All of the code that I've attempted to execute from the BASIC Computer Games - Microcomputer Edition book (c. 1979) works great. I've been playing Hunt the Wumpus; that sure brings back a few memories. ;-)
One of my original stated goals was to get this to the point where the original, unmodified, DONKEY.BAS code would execute as close to the original as possible. As of this writing, the game can execute with only one minor modification to the original code; the culprit at this point is the SOUND statement, of which I've already mentioned I'm having to get a bit creative to solve. The issue is not whether or not it can play sound; the SOUND statement was used as a means to throttle the game loop, which means I need to get my sound statement working the same. In a world (Silverlight) where everything seems to want to be async, it's proves to be a little bit of a problem but I think I've got a solution worked out. Once done, the goal is to get all the original .BAS files included with DOS version 1.1 working.
Another interesting tidbit is that modifications had to be made to accommodate the actual sample code instead of relying 100% on the official documentation which neglects to mention a few quirks that I knew all those years ago but have since forgotten; such as the "optional" end quotation on string literals. If it's in the documentation, I couldn't find it by scanning over it.
I'm still having a blast working on this project and can't wait to see where it will lead. It's so much more fun now that it's to the the point where the original code comes to life.
Be sure, I have a few other tidbits that I'm working on and a ton of ideas that I'm working through with regards to this site; so stay tuned. Let's just say if 2012 is the year the world comes to an end... I've got a lot of stuff on my plate that I want to accomplish before hand. ;-) In all seriousness, I look forward to 2012 and hope that everyone enjoys success and prosperity in the new year.
Wow! It's been a month since my last update regarding this pet project. To be fair, I did go on vacation for a week, so it's really only been about 3 weeks of spare time effort on this. With that said, I think it's moving along at a rather excellent pace.
Additional work done to the parser. Decided to remove a lot of the validation and treat this layer as more of a tokenizer that can then be further validated at the interpreter level.
After getting everything working in Silverlight and continuing the project for several weeks, I recently attempted to get the interpreter working in Windows Phone 7. I created a new project and copied over the code. Tons of errors. Several VB language features not available, more .NET Framework elements MIA and slight differences with Silverlight implementation on both devices. I remembered a discussion about a relatively new project call the Portable Library Project. After getting the correct service packs and such, was able to create a Portable Library version of the interpreter which required that I split several pieces out (and up) to a platform specific layer. The portions are labeled as Display, Keyboard, Sound and File System. Once done, I now have a core assembly that is capable of being leveraged across .NET 4, Silverlight 4, Windows Phone 7 and Xbox 360 (in theory).
A lot of work was still to be done since the last update in order to fully handle the "IDE" aspects; mostly related to what I'm calling "last line issues".
OK, I thought Silverlight was limited with regards to intercepting and working with the keyboard. Wow! Windows Phone 7... you're my new worst enemy. Why do you have a KeyUp/KeyDown event yet never can tell me the state of the Shift key? I had to work a serious hack that takes 50+ lines of code to do what should realistically be less than 3.
I also had to handle the concept of a key buffer so that "type ahead" would work while a pending task was executing (file system).
One goal that I had in mind was I wanted to support the file system functionality in such a way that it was not "local storage". I'd like to make it so that people can share content among one another, so it was necessary to create a file system that would work over the wire. All of the "IDE" functionality is fully supported. Eventually this layer will have to handle random access file functionality necessary to implement various file I/O keywords (which are not completed as yet).
The 5th keyword in the GW-BASIC manual is BEEP. Since BEEP is an 800 Hz for 1/4th of a second tone, it made sense to tackle two keywords at once since SOUND 800, 4.55 produces the same result. A fortune would have it, Silverlight 3+ has the ability for me to fiddle with the PCM stream. It does have it's problems and, apparently, Silverlight 5 might be able to provide some solutions to the "lag" that I'm experiencing. I have not tried this code yet on WP7; however, what is coming to Silverlight 5 is already supported on the phone implementation of Silverlight.
As of this writing, 114 keywords have been implemented. This is not to say they are 100% completed, but they are implemented enought to start testing and tweaking. Additionally, definable functions, arrays, nested for loops, etc. are all working. I've also implemented a few useful keywords that are not part of GW-BASIC which include OLD, LBOUND, UBOUND, LCASE$, and UCASE$. LBOUND and UBOUND have been very helpful in working with getting arrays working.
As you can see, a lot of work for three weeks of spare time. To put things into perspective, I think I have all keywords implemented based on documentation for the Dartmouth Oct'64 version as well as all of the listed keywords necessary for both BASIC Computer Games - Microcomputer Edition books (c. 1979) which is based on Microsoft Basic, Revision 4.0. I have not done any testing of the programs included as a lot of them are kind of long. However, I've also been working my way through "A Bit of IBM BASIC" and all code samples up to page 90 are working. There's still a potential for a lot of bugs, so testing...testing...testing...
So far this has been an awesome side project and there is still a ton of things to complete. I'm having a lot of opportunity to experience several technologies that I have not been able to play with in my "day job"; so this alone is worth the time and energy going into this project. Who knows where it will end up; however, I have to remind myself to not focus on the destination, otherwise I'll miss out on the splendor that is the journey.
AddressOf.com is the place for the Visual Basic developer. All topics at all levels are touched upon here. One of the main goals of AddressOf.com and its members is to promote Visual Basic as the tool for choice for all developers; yet understands that sometimes other tools better suited to specific tasks and, as such, have an open acceptance to all products that allow us, the developer, to get the job done in a timely and efficient manner.