Tech Note 20: Using the Palm OS Emulator (POSE)

October 19, 2007


There is also a good tutorial on Palmsource's web site.



(adapted from "NS Basic Programming for Palm OS", by Michael J. Verive)

NS Basic doesn't contain its own embedded Palm emulator or debugger, but instead uses the Palm OS Emulator, commonly known as POSE. By using POSE, NS Basic allows you to test your applications using a wide variety of OS versions.

If you want to experiment with different device ROM's, you will need to either download your own device's ROM (using a serial cable and the "ROM Transfer" app that comes with POSE) or get ROM's from Palm, Inc. (or your device's manufacturer). From Palm, Inc.'s web site at www.palmos.com/dev/tools/emulator/:

"For legal reasons, you must sign an agreement with Palm Inc. to download ROM images. To obtain the agreement, you must be a member of the Palm OS Developer Program. After joining that program, we recommend that you also join the Developer Seeding Program, which requires that you return a signed agreement to us. This allows you to access pre-release ROM images and other valuable tools. If you are based in the USA, you may also obtain images using a "clickwrap" agreement that does not require a signed agreement."

I couldn't have said it any better.

If you're using an AlphaSmart Dana, you'll need a special version of POSE. You can download it from http://www.bridgingthedisconnects.org/support/downloads.htm

Installing POSE

POSE is normally installed with the NSBasic for Palm installation, and should exist in your NSBasic Tools directory (by default at c:\nsbasic\tools). If you are installing POSE from the zipped archive, extract the emulator files into a new directory (I'd call it "POSE", but you can use whatever name you'd like). Create a subdirectory named "Skins" within this directory, and extract the skin files here. This directory MUST be named "Skins", and the skin files MUST be in this directory, in order for POSE to find them. Note that when you attempt to extract the skins, they will go to their previously stored directory names unless you tell your uninstaller (I use WinZip ñ you can get the latest version at www.winzip.com) to ignore the directory names. If you forget this step, and POSE always starts with the default "generic" skin, look at the "Skins" directory, and you'll probably see another directory within it that contains the skins. Move the skins to the "Skins" directory, and everything should work appropriately.

These skins aren't merely close approximations ñ they have the exact look and feel of the real Palm devices, like this PalmIIIc:

OK ñ I lied ñ the skins don't really make POSE feel like the actual device. But they do look impressive!

Using POSE with your device's ROM

As previously mentioned, POSE doesn't ship with any ROMs. However, it does come with a ROM Transfer app that you can load to your Palm device, and use it to transfer a copy of your ROM to your hard drive (currently this only works with devices with a serial cradle, but as more and more devices use USB, this may change by the time you read this).

To transfer the ROM, start POSE on your desktop computer, then with POSE running, right-click on POSE, and select "Transfer ROM". Follow the directions step by step, and within a few minutes you should have your ROM downloaded and ready to use.

Using POSE with NS Basic

Although you can run POSE from within NS Basic, and have NS Basic automatically load and run your applications after they are compiled, I personally prefer to have POSE running in one window, the NS Basic IDE in a second window, and a third window open to the NS Basic download directory. I set the compile options to neither download to POSE nor install to device ñ I prefer to install the applications into POSE myself. Navigating among the windows is only a few keystrokes or mouse clicks away, and loading an app into POSE is easily accomplished by dragging its PRC into POSE (as long as POSE isn't currently running the app).

That's enough talking about POSE ñ let's walk through the steps and get POSE running. If you haven't installed POSE yet, now would be a good time to do so.

Running POSE for the first time

To make running POSE as simple as possible, I prefer to have a shortcut to POSE on my desktop. You can do this easily by locating the Emulator.exe file (again, usually in the c:\nsbasic\tools directory), then right-clicking on the file, and dragging it to the desktop. Windows will ask you if you want to copy, move, or create a shortcut ñ choose the shortcut. Then, when you want to run POSE, just double-click on the shortcut, and you're in business.

Before POSE will actually run, you'll need to give it a ROM. The first time you attempt to run POSE, you will be asked to select a few different options, including starting a new session.

Click "New", and select a Palm ROM (the ROM from your device, if you used the ROM Transfer application, or a ROM from Palm, Handspring, or other manufacturer) for your POSE session. You should see POSE display the Palm startup screen, then the Prefs screen. Click on the application launcher "silk screen" button, and you should see the familiar Palm screen with application icons. You're in business!

You don't really want to go through all these steps each time, do you? Before going any further, right click on POSE, select "Save", and save your POSE session (as an Emulator Session File, with a .psf extension). You can then directly run POSE with this ROM by selecting this session file. Later, when you have applications installed into POSE, you can save additional session files, effectively saving different Palm "devices", each with different applications installed.

Installing applications and databases into POSE

As I briefly mentioned earlier, you can install applications and databases into POSE by dragging them into POSE while it's running, or by right-clicking on POSE, and selecting the "Install Application/Database" option (remember, these PRC and PDB files must be in Palm format ñ don't just drag an Access database or Word document into POSE and expect them to load).

Automatically loading applications and databases into POSE

If there are PDB's or PRC's that you always want to load each time you run POSE or the NS Basic emulator, create a subdirectory named AutoLoad in the directory that contains POSE or the NS Basic emulator (this will usually be c:\NS Basic\tools). Any PDB or PRC file in this AutoLoad directory will be loaded automatically.

This can be a blessing or a curse, since you can easily forget to include these files with your applications for distribution!

Exporting applications and databases from POSE

Exporting databases and applications from POSE is a different story, however - you can't simply drag databases and applications from POSE to your Windows desktop. Instead, to export from POSE, right click on POSE while it's running, and select the "Export database" option. You can export any of the existing Palm applications or databases. This makes it easy for you to use your NS Basic applications to create databases within POSE, then you can export the databases to share with other users.

You can also use the POSE dbexport application (load the posedbexport.prc file into the emulator) to export any of the RAM-based databases on the emulator.

POSE Error messages and debugging options

POSE is a great tool, and you'll be tempted to assume that an application that runs on POSE will run on the actual Palm device. While I haven't found many exceptions to this, it's always possible that the actual device will behave differently than POSE. Actually, POSE is much more strict and unforgiving that the actual Palm devices, and will surprise you from time to time with very strange error messages. While many of these messages can be ignored, it's essential to test your applications on real devices before distributing them.

With POSE 3.4, you have considerable control over just how strict POSE is with how applications behave, and can tailor the error reporting to your needs. Right click on POSE, select "Settings", "Debugging...", and you'll see numerous Debug Options:

For most NS Basic applications, you can safely avoid common, "ignorable" errors by unchecking the "MemMgr Data Access", "Offscreen Form Object", and "UIMgr Data Access" options. These errors don't occur on the actual Palm OS devices, so having POSE ignore these errors can speed up your debugging process considerably, allowing you to focus on "real" errors.

Letting POSE be your first beta tester

When you get around to experimenting with POSE, you'll come upon gremlins. I swear to you that I didn't make this up! Right click on POSE, and you'll see "Gremlins". Basically, Gremlins are best thought of as tireless users who try to enter any kind of information in any field, tap and scroll anywhere ñ in short, really nasty beta testers. If you select "Gremlins", "New" you'll be given the chance to create a New Gremlin Horde (POSE's nomenclature, not mine!) that will run any application or group of applications. You can also determine how many times to run each app, and how to log the different events, errors, and activities that might occur.

I strongly suggest that you use Gremlins to test your software ñ not in place of beta testers, but to complement them. POSE has many, many options ñ so many that you can easily get overwhelmed. Relax, only try one new technique at a time, and you'll do just fine.

HotSyncing POSE

You can even HotSync your POSE session as though it were a really device, although it's a little tricky (and slow!). Here's one method, using two serial ports on your Windows machine that's running POSE. One should be already set up to run HotSync. In order to allow POSE to HotSync on this machine, right click on POSE, select "Settings", "Properties", and under "Serial Port", select the other serial port for POSE to use. Connect the two ports through the use of a null modem, and with HotSync and POSE both running, select "HotSync" from the "System" group on POSE. You should see the familiar HotSync dialog, and will be prompted for the user name if you haven't already wet it up through the same "Settings", "Properties" option in POSE. HotSync will be much slower when running on the same machine as POSE, but you can speed it up by making sure that POSE is the "foreground" application, with HotSync running in the background.

Quitting your POSE session

Before I go, I should probably tell you how to exit POSE, since it doesn't have the same Windows interface that you're accustomed to. To exit your POSE session, right click on POSE, and select "Exit".

Experiment with POSE, and learn to use it well. However, I must stress this again: don't rely on POSE for the final testing of your applications. There's no substitute for the real thing!