Tech Note 29: NS Basic/Palm Goes Native!

December 22, 2003

© 2022 NSB Corporation. All rights reserved.

The Palm OS was originally written for the Motorola 68000 processor, often referred to as the 68K. With Palm OS 5, the operating system moved to the StrongARM processor, available from a number of manufacturers. The new processor has a number of features that make it much, much faster than the 68K chip could ever be.

To maintain compatibility with the huge base of software for the Palm OS, PalmSource created a 68k emulator that could run on the StrongARM processors, called PACE ("Palm Application Compatibility Environment"). The result is that apps written for the 68K could run, without modification, on the new devices. The speed of the new processors was so good that software (including programs written in NS Basic/Palm) ran faster on the new device even while emulating a 68K.

This left an opportunity to get some dramatic speed improvements if the 68K emulation could be eliminated. NS Basic/Palm 4.1 is fully ARM Native, meaning that programs written in NS Basic will run in native ARM code and not in PACE.

The speed improvement is dramatic - up to 25 times faster. NS Basic is now practical to use for all kinds of applications that would have been too slow before.

Speed is not the only benefit. There is a corresponding savings in battery usage, making NS Basic much more efficient in that respect as well.

Using ARM Native NS Basic/Palm

Any NS Basic/Palm program that works in 68K mode will work in ARM Native mode, with no changes to your code. The only difference is which version of the Runtime you use. You'll have to compile your program using NS Basic/Palm 4.0 or later, otherwise the program will only run in 68K mode.

You can control which runtime is used by installing the appropriate one on your device, or by selecting which version to include as a Fat App in Tools...Options...Compile/Download in the NS Basic/Palm IDE.

ARM Native code is larger than 68k code. Instructions are 32 bit instead of 16, and alignment must be on 4 byte boundaries. The result is that the ARM Native Runtime is substantially larger. NS Basic programs themselves remain the same size.

There are 2 options you can choose from:

Benchmarks

We compared the 68K runtime to the ARM Native Runtime in a variety of tests. Be sure to read the notes at the end to understand the results fully.

68k Results - using NSBRuntime

Device Bench1 Bench2 Bench3 FormBench
Palm IIIx 453 492 112 268
Tungsten T 137 153 458 41
Zire 71 125 132 539 38
Zire 21 141 150 454 33
Sony NX70 82 88 867 21
Zodiac2 66 70 1065 32
Tungsten T3 41 154 1731 15

ARM Native Results - using NSBRuntimeARM68K

Device Bench1 Bench2 Bench3 FormBench
Palm IIIx 488 533 102 270
Tungsten T 5 24 5040 31
Zire 71 5 23 5574 29
Zire 21 6 27 5821 22
Sony NX70 5 18 9876 17
Zodiac2 4 13 14099 29
Tungsten T3 2 8 23138 13

Notes vital to understanding these results

How much faster will your app run? It depends. NS Basic code, system calls and screen updates are each affected differently in ARM Native code. The mix wil determine what the net gain will be.