Handyboard Resources

The handyboards run Interactive C. IC runs interactively on a host machine, where it compiles C functions into bytecodes called Pcode. The Handyboards are initialized with a Pcode interpreter (written in assembly language) at boot time; new Pcode can be downloaded to the interpreter repeatedly during run time. The Pcode interpreter contains several errors and shortcomings. This page addresses some of them.

Where to get IC. There are currently two versions of IC available. Fred Martin freely distributes version 2.8x of IC. This server seems to have more up-to-date contributions. Newton Research Labs sells version 3.x; we don't use it because it is not open source, and thus cannot be repaired and extended.

Improved motor control. The library included with the Handyboards has a very coarse motor() function that only produces eight discrete levels of motor power. This makes motor control fairly difficult. We recommend the drop-in replacement motor control routine from this page (local copy) that provides much higher resolution motor control. It is installed in /usr/contrib/share/ic/lib_hb_smooth.c. (I'm not sure why, but I don't think we had to install the replacement pcode_hb.asm to use this, even though the web page suggests it.)

Getting as11 First, you need to build as11 (Motorola's 6811 assembler). Then install the as11_cpp wrapper, used for assembling pcode.asm). While you're at it, you may as well install the as11_ic wrapper, used for assembling .icb modules. That will let you build IC functions written in 6811 assembly language.

Assemble pcode_hb.s19. It would be best to try building an unmodified version of the interpreter first to verify that it runs correctly on your Handyboard. I believe we began with version 2.81 with HANDYBOARD mods. Then assemble IC with:

as11_cpp pcode.asm -DHANDYBOARD -DLCD_ROWS=2 -DLCD_COLS=16 -I../libs > pcode_hb.s19

Floating point divide patch. This patch to motorola/floating_point/math11routines.asm replaces the quite buggy divide routine. I found the replacement routine somewhere on Motorola's site, and modified it to deal with IEEE-style exponents. Apply it with patch. [I found this link to Motorola in my stuff; perhaps you can find original as11 and/or 6811 floating point code here if you wish.]

Floating point compare patch. Jon Bredin's patch to motorola/floating_point/math11routines.asm causes 0.0 and -0.0 to compare correctly to each other with ==, <, and >. (IEEE floating point has two zeroes; they should compare to be equal).

Multiply underflow patch. (optional) This patch to motorola/floating_point/math11routines.asm replaces underflow errors in floating-point multiplies with a successful result of zero. For my code, I preferred the value to round to zero, rather than halting my process with a run-time error. This patch should be used with caution; it causes nonstandard behavior. (Not that the math11routines.asm are very standard to begin with.)

Floating point to integer error supression. (optional) I also didn't want to see any errors when converting floating point numbers to integers. Here are manual instructions for making this patch to pcode.asm. Look for the block of code labeled Pfl2int. Replace the
JMP pcode_error_exit

line with:

Extended memory access. (you probably don't need this.) I retrofitted Serial Killer (a Rug Warrior) with another 24K of RAM. This involved installing a 32K chip (with 8K not mapped), and moving our I/O extension from 0x7000 to somewhere in low memory that I forget. This way, the 24K of ram was mapped from 0x2000 - 0x7fff, contiguous with the old start of PCode space at 0x8000. To use that memory, I had to make these interpreter changes:

This same trick may not work for Handyboards if they actually have the DIGINPUT and DIGOUTPUT latches, mapped to 0x7000. One would have to somehow remap them in hardware, or at least disable them (by cutting a trace and pulling the appropriate chip enable line high).

After applying the desired patches to the floating point routines, reassemble pcode.s19 as above, and test it out.