As most of you probably have already noticed, Binary Clock for Palm OS now supports the WristPDA. When creating the WristPDA frontend, I decided to add a cool new feature that shows the battery status permanentely(not only if low).

Recreating the Palm OS battery gadget is not too difficult, however, the program simply didn’t work. I managed to track the bug down to a line like this one:


A bit of research made me find out that most Palm OS compilers need globals to execute this operation – multiplication was no option, and division wasnt either. However, as you can see in the image below, the battery gadget works. But why?
DSC00017 Dont multiply when in non globals mode

I decided to substitute the multiplication with a lookup table. Here is the new code:

UInt8 coord[101]={0,0,0,0,1,1,1,2,2,2,3,3,3,3,4,4,4,5,5,5,6,6,6,

Obviously, lookup tables don’t work for very big ranges of numbers – however, when you have less than a few hundred values, they make for a very good way around the problem.

Ever had such a problem?

Related posts:

  1. Globals in DAs
  2. Attention to all GMAIL users-DONT FOLLOW THE GMAIL HACK
  3. Drive Mode / MS Import in background
  4. Switch-Mode power supplies explained
  5. Binary Clock 3.0 is here…and it supports the Watch Face mode of the WristPDA!

5 Responses to “Don’t multiply when in non-globals mode”

  1. Floating point multiplication and division need globals, I believe because they resolve into calls to the FloatMgr. But if you wrote something like

    that should be just fine, since it’ll end up as integer division, which doesn’t need the FloatMgr…


  2. Why do you need float for such a task at all? Come on and think before posting…

  3. Hi,
    I used no float here…just a plain C multiplication….

    Best regards
    Tam Hanna

  4. I’m not very familiar with C (Java fan), but 0.3 seems to be a float value, isn’t it? I think Blake Winton was right.

  5. surly no need for floats as someone pointed out. also if you call float point manager directly using the sysTrap FlmEm, you need no globals. try it….

Leave a Reply



You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe without commenting

© 2013 TamsPalm - the Palm OS / web OS Blog Suffusion theme by Sayontan Sinha