Share via


Small Basic: Instructions to Graduate and Debug with Visual Studio

This article shows step by step instructions about [Graduate] and debugging with Visual Studio for Microsoft Small Basic program language. The following versions of programs are used:

  • Small Basic v1.0
  • Small Basic v1.2
  • Visual Studio Community 2013
  • Visual Studio Express 2013 for Windows Desktop

 

Install Visual Studio Community 2013

Visit http://www.visualstudio.com/en-us/downloads , select [Visual Studio 2013] and push [Download] button.

Push [Run] button.

Check I agree to the License Terms and Privacy Policy and push [Next] button.

Push [INSTALL] button.

Push [Yes] to allow installing in UAC (User Account Control) popup.

After installation you can see this popup.  In my case, it took about 24 hours to install.  Click [LANUCH].

Push [Sign in] button.

Enter your Microsoft account, password and push [Sign In] button. 

Push [Start Visual Studio] button.

Then you can see Visual Studio Community 2013 Start Page.  Click [x] button to close this program once.

Graduate

In the Small Basic Environment, with your program to be graduated, push [Graduate] button.

Export to Visual Basic

Type full path for Visual Basic program folder or select it from [...] button.  You can choose the same folder which your Small Basic program is in it.  Then, push [continue] button.

Push [OK] button when you see One-way upgrade popup as below.

You can get following screen.  Select XXXModule.vb in Solution Explorer window.

Select .NET Framework

For Small Basic v1.2, you should select .NET Framework 4.5 from [PROJECT] [XXX Properties] [Application] [Target framework].

Add Reference

For the first time of the solution, you need to add Small Basic dynamic link library as the reference.  Following picture shows that the object GraphicsWindow is not recognized because Small Basic library is not setup yet.

Select [PROJECT] > [Add Reference] from menu bar.

Push [Browse] button.

Select SmallBasicLibrary.dll and push [Add] button.  This library file is in your Small Basic program folder or in c:\Program Files(x86)\Microsoft\Small Basic .

Push [OK].

Scope (for VS Express)

This action is needed for Visual Studio Express 2013 (possibly and before).  But no need for Visual Studio Community 2013.

For control variable will cause warning about for it's scope.  To avoid that declare module name before the variable replace For statements as follows.  We don't need to change variables inside block.  Only in For statement.

Select [EDIT] > [Find and Replace] > [Quick Replace] from menu bar. 

Enter "For " (be careful that this contains trailing space) as search term and "For XXXModule." as replacement term and click [Match case] icon.

Click right arrow button so that the found search term is showed with gray marker.

Then push [Replace next] button.

Repeat the action above until you can see following popup.

Cast (for VS Express)

This action is needed for Visual Studio Express 2013 (possibly and before).  But no need for Visual Studio Community 2013.

Sometime you will see following overload resolution failed error.  Then click the error message.

So the error line in source code will appear and selected the condition.

In this case, replace "0.5" with "CType(0.5, Primitive)" to cast.  To cast means to convert variable type.  This sample changes type real (0.5) to Primitive (for all Small Basic variables).

Debug with Visual Studio

This chapter introduces about instructions for debugging.  Actually, this contents was written about real debugging of Small SVG Editor 1.98b before I setup Visual Studio Community 2013.  Because 1.97b has a bug "#16 Color palette doesn't work properly".  So, most of these pictures are with Visual Studio Express 2013.

Find Symbol

Click mouse right button so that you can see following popup.  Select [Find All References] to find all references in the program.

Result of [Find All References] will be shown in bottom Find Symbol Results window.  Click a line to show the source code. 

Break Point

Most popular usage of debugger is setting break points to pause the program and check some values of variables.  To set a break point, click left of the source code line to pause.  Then you can see read circle on the line.  Or you can pause the program by pushing [Break All] button.

Then push [Start] button to start debugging.  Your program will be started.  After some operation, the program will stop at the break point. as follows.

To continue the program, push one of following buttons.  The most left one is [Show Next Statement].  This is just moving cursor to break point.  The next one is [Step Into] to run one step even in subroutines.  The next one is [Step Over] to run one step but not stop in subroutines .  The last one is [Step Out] to return from current subroutine. 

Watch

While program pause, you can watch the values of variables when you enter the names of variables in Watch 1 window.  To set watch, click [Watch 1] tab, click a line below [Name] and enter the variable name.

Without setting watch, just hover mouse on the variable name in source code.

Following picture is the screen when I found a bug.  The array palette[3]["color"] contains lowercase color.  That was a bug.

Autos

Autos is a new feature of Visual Studio Community 2013.  Variables are automatically added to Autos tab as well as Watch.

Save Changes

At the first closing solution (or Visual Studio), following popup will appear.  Then push [Yes] button to save changes such like library reference of this solution.

Push [Save].


See Also