Programming Using NSBasicCE
ARTICLE 1--The Package and Installation
All content (c)1999, 2002 Serg Koren.
All rights reserved.
If you know BASIC and you've already gotten and successfully installed your copy of NSBasic, congratulations! You can skip the rest of this article and check back next time. However, if you're a total newbie at things-computer, this is for you. We'll step you through getting NSBasic installed on your Casio E105 and working. First, however, we'll start with a brief description of BASIC in general (NSBasic specifically) and what you get.
BASIC
BASIC is one of the older computer languages, and exists on pretty much every computer platform available. It's called BASIC because it is--basic that is. It's usually the first language people learn when they want to learn programming. When it first came out the only other languages available on pcs (which were new then) were assembly and machine language. Machine language is just that--its the language the machine (hardware) understands. Just 0s and 1s, and you programmed by toggling physical switches. Each switch when on represented a 1 and when off a 0. So a bunch of switches on the front panel of your pc might be set to:
01101010
which meant something simple to the computer (like remember a 2 because I want to add something to it). No fooling! Programming was hard and tedious. Assembly language was a big step forward. Somebody got smart and figured out how to hook up a keyboard to the pc. But you could still only program at a very low level. Assembly language was easier to program, but it was difficult to read and understand. For instance the switches (bit pattern) was replaced with:
MOV A,2
which meant, MOVe 2 into the Accumulator. Accumulator? An accumulator holds a single number to be accumulated (added to) with another. You can only do addition when you come right down to it. To subtract you'd add a negative number...but that's another story. Multiplication and division were done via multiple adds (or adds of negative numbers).
Then someone thought, hey wouldn't it be neat if we could program in something closer to English? And BASIC was born. BASIC used simple understandable English words to denote commands to the computer. Additionally, simple math was born via the normal school symbols +,-,/,* (well keyboards don't have a multiplication symbol, so they replaced it with an asterisk.)
And everyone loved it (and pretty much still do); but as new computers and companies started up, each wanted to make their own BASIC, and they wanted it to be better (or at least different from) than other BASICs out there. So BASIC begat BASIC begat sort-ofBASIC begat well its close to BASIC. A plethora (I've always wanted to use that word in an article) of BASICs emerged. All were similar, but few would run on each other's machines. Babylon reborn!
Well it didn't quite work like that, and it's not quite that bad, but close enough. If you're at all familiar with computers you've probably heard of "Standards" or "Standard Committees". Standards are a set of rules that make something consistent. It's a big thing now. Computer stuff needs to be "standard" so that you can buy a copy of X-BASIC and it will run on Y-Hardware. You don't have to pay big bucks for Y's version of BASIC that ONLY runs on Y-Hardware. The problem is, is that BASIC has a fairly weak standards committee (a bunch of people who make up the standard), so you still see X-BASIC that ONLY runs on X-Hardware.
So what does all of this have to do with NSBasic? Well in one word, Microsoft. Microsoft is well known (and infamous) for having an ego. They are so big, they feel that their way IS (or at least should be) a standard. I won't start here, but you get the point. The problem is, is that WindowsCE uses a version of BASIC built-in that is similar (although not identical to) BASIC (VisualBasic) on the desktop. Both have similar guts, but not identical. NSBasic uses the guts to do what it has to do to get your program to run. So if you're new to WindowsCE, but familiar with VisualBasic on the desktop, you'll be somewhat surprised (I hope) to hear that NSBasic isn't VisualBasic. NSBasic/CE is a version of BASIC. There are tons of BASIC and VisualBasic books out there (just check your local Amazon.com). The problem is, is that although NSBasic/CE is similar to BASIC, you can't just pick up a BASIC book type in the code you find and hope it runs on your Casio.
Hopefully, the above will save you some hassles in terms of running out and buying a ton of VisualBasic books and wondering why the code you typed in doesn't run. The books are useful, they give you ideas and ways of doing things, but save your money. If you don't already know BASIC (any flavour), then you're better off without them. The books will only confuse you. Which brings us to the NSBasic/CE package...
The Package
NSBasic/CE comes in two pieces. You get a CD-ROM full of NSBasic, sample programs, "goodies", and other stuff. The second piece is the compact manual. If you're new to NSBasic/CE, this is your best friend. It doesn't tell you how to program, but it tells you what you can do and how you can do it. It's a reference manual, meaning that it describes each of the commands that NSBasic has. It's a good exercise (and no not boring) to just sit down and read the manual cover to cover when you first get it (one of the few manuals I suggest you do this with). It's well written and even if you don't know anything about BASIC, you'll pick up a lot just by going through it once. Don't try to memorize everything or learn it all. Just read it like a novel. That way you get a feel for the language, and what you can do. So, when you say "gee I wish I could do..." you'll remember that you saw something like that in the manual. Basically, if you don't know what's in the manual, you don't know that you can do it easily.
The manual isn't perfect. It doesn't have a few things which are part of NSBasic/CE, but it has most of it. The missing pieces you can get from the website's support page. These pieces are a bit more advanced usually, but you should check out the support page and browse through the downloads and tech notes pages. Also, you should make it a habit to visit the web message board that NSBasic has set up. This is your 2nd line of defense. Here you can see what others are doing, what problems they are having, and what solutions are offered. You can also post your own problems, questions, and suggestions. Don't be shy. Even total newbies are welcome. And, the people of NSBasic Corporation watch the board regularly and post useful stuff. The board may be a bit intimidating because there is so much stuff there (and it's not well organized) but its a wonderful resource. Ok, you've opened up your box from NSB and have stared at the CD and read the manual, and browsed the board. Time to install...
Installation
Ok, first things first. If you haven't done so already, make sure you have Windows Services (now known as ActiveSync 3.0...PLEASE upgrade your WindowsCE Services to this if you haven't done so...it's lots slicker and faster and fixes a lot of problems). You can find ActiveSync at: http://www.microsoft.com/windowsce/products/highlights/activesync.asp
Make sure you can successfully sync your Casio to your desktop. (Yes I know this is very basic, but if you can't do this you can't do anything else.)
Ok, now pop your NSBasic CD into your drive, and double-click the Readme document you find in it to launch the installer. The installer is set up to run from within the Readme document. Read (or at least browse) the readme document to see what's new, what known problems exist in NSBasicCE, etc.
Here's the confusing bit. The Readme document and the CD let you install NSBasic on a bunch of different types of hardware. HP Jornadas, Casios, Mobilons, etc. You must make sure you install the correct version of NSBasic for the hardware you have, or nothing will work and you'll wonder why. I once in a rush installed NSBasic and it didn't run until I realized I'd made the wrong choice during the installation. Be careful.
Since this article is about Casios, we'll walk through the Casio installation. The Casio E105 is a Palm-size PC. Luckily, this installation option is the first one found on the Readme document. "Palm-size PC Installation Instructions." This consists of seven steps (6 if you're not upgrading). Do these in order to avoid problems. Here's the second complicated bit--this is as complicated as it gets...which isn't very. Click on each link in turn and make sure you choose the Run this program from its current location option. Otherwise nothing will install and you'll wonder what happened. Each step will bring up your Active Sync (or WindowsCE services) installation dialog. Just follow the prompts and make sure you answer Yes to install in current directory. You may be wondering what gets installed. The first step, Basic Setup installs the NSBasic editor, help files, pretty much the guts of NSBasic/CE. Goodies Setup installs sample files. The Scripting Engine setup installs the Microsoft "guts" we mentioned earlier. The last step, System Files, installs various add on pieces that either NSBasic uses directly or you can use from your own programs.
Don't' forget to enter your serial number into the Installer application on your Casio when done.
That's it. Uh no not really. There's one step that you need to do (which isn't documented). Once you've installed NSBasic/CE on your Casio, log onto the NSBasic website and download any upgrades/updates to your version from the support page. Make sure you get the latest version if you didn't get it on the CD. Install any updates (you may not need to).
That's it. Now you're done.
I'm sure you're antsy to program, so we'll quickly run a test program to make sure everything is installed ok. This is your typical (and highly boring) "Hello world" program that always gets written when you first start learning a language...don't ask why, it's pretty stupid, but it works.
Start NSBasic from the Start menu of the Casio. You'll find it under Programs, labeled BASIC. This will bring up the NSBasic editor. For now ignore everything and just type or copy/paste in the following line into the blank area of the editor:
MSGBOX "Hello there. This is NSBasic/CE"
Double-check for typos. Then in the menubar hit the right-arrow button. This will run your program. If everything works properly you should get a new window pop up with the message "Hello there. This is NSBasic/CE". If you get the message "Microsoft VBScript compilation error - line 0, char 10 Unterminated string constant" (or something similar) you probably typed a ' instead of a " (or forgot one of the quotes). Fix the typo and try again by hitting the arrow button. If you get the message "Microsoft VBScript runtime error - line 0, char 0 Type Mismatch: " (or similar) that means you misspelled MSGBOX. Fix the typo and try again.
You should at this point have the dialog with "Hello there. This is NSBasic/CE". If you fixed the typos and you still get an error message you probably skipped an installation step somewhere. You should reinstall and try again. If after reinstalling and trying the above program you still have problems, you probably have a real problem with NSBasic or your setup and you should post a message on the webboard explaining the problem and the exact message you get.
Hopefully, and in most cases you'll get the above program to run. As I said, it's not exciting but it proves you've got a good installation of NSBasic. We won't explain what the program does right now. Just believe me, you wrote your first program. You can close the dialog using the close or Ok button. This will leave you at a blank screen. Close this screen using the close box and you should be back at the NSBasic editor with your program as you typed it. You can quit now. You don't have to save the program, if you don't want.
Well, that's it for this installment. Hopefully, you're still here. Next time, we'll go over the NSBasic editor, and describe what all the menus do, and do some more interesting programming for the beginner.


