[comp.sys.handhelds] HP28--->HP48 CHARACTER STRING CONVERSIONS

rayde@hpcvia.CV.HP.COM (ray_depew) (05/26/90)

> I'm trying to write a program to convert an hp28 graphic character
> string into an hp48 GROB.  I understand how the 28s CHR string works
> but I don't know much about the 48's GROB (the manual doesn't help
> much).

> DELANO,ANDREW DOUGLAS

(I didn't invent them, I just like playing with them.)

Bill W. posted a great bit-level explanation of grobs in here a little 
while ago.  But if you want to play with them on your own, here's an easier
way to think of them. 

If you put a grob in Level 1 and press [Darrow], you will see something in
the command line like

     GROB 131 64 nnnnnnn....

(assuming you have enough memory and the grob's not too big).  
The first number is the width, or number of pixel columns in the grob.
The second number is the height, or number of pixel rows.
The nnnnnnn.... is the hex bitmap representing the picture.

The pixel values in the hex bitmap are reversed from what you think they
should be.  For example, if you had a row like this (1 is "on", 0 is "off")

1 1 0 0 1 0 0 0
  
you would think that the bit values should go from MSB on the left to LSB
on the right, like this:


bit value   8 4 2 1 8 4 2 1
------------------------------
hex value   A       8
------------------------------
status      1 1 0 0 1 0 0 0         and therefore hex "A8"


but the bit values actually go from LSB on the left, to MSB on the right:

Bit value   1 2 4 8 1 2 4 8
------------------------------
Hex value   3       1
------------------------------
status      1 1 0 0 1 0 0 0         and therefore hex "31".


In addition, the HP48SX likes to pretend that each row is a multiple of 8
pixels.  It makes internal bookkeeping easier.  In other words, a 3-pixel
row will take up as much memory as an 8-pixel row.  If you only use 3 pixelsm
what happens to the other 5 digits in the number?  The HP-48SX *usually*
zeroes them out, but I would guess they're free for you to play with.

You can enter grobs directly via the command line.  Sometimes I find this
easier than going through the menus.  Examples follow.  Type everything
as shown on one line and without quotes.

To create a blank 3x3 grob, type
   
     GROB 3 3 0 [ENTER]

You will see "Graphic 3x3" on Level 1.  Press [Darrow] to review it, and
you will see that the HP48SX has filled in the rest of the grob for you.
You should see 
 
     GROB 3 3 000000

on the command line.  (Press [ATTN] to get out of the CL)

To create a # symbol, type

     GROB 5 5 A0F1A0F1A0 [ENTER]

You will see "Graphic 5x5" on Level 1.  Press [PRG] |DSPL| |PICT| [STO]
[Larrow] to see your creation.  

$DRIFT ON

I use graphics so much that I keep an
automated version of this in my home directory.  The program is
  
     \<< PICT STO GRAPH \>> 

and I store it as 'SEE'.  That's easy to type in, and I can get at it from
any directory.  A variation on it is

     \<< PICT STO { } PVIEW \>>

I think John Peterson at BYU came up with that one?  It works nicely too,
especially with really big grobs that you have to scan around.  He calls it
'PVER', and it comes with the gorgeous BYU grob offerings on the HP BBS.

$DRIFT OFF

When you transfer grobs between a PC and the HP48SX, if you use ASCII mode,
the 48 has to translate the grob into a string.  Grobs do use up a ton of
memory.  Binary uses up much less, but I haven't figured out how much yet.
                    
You needn't restrict yourself to grobs <= 131x64.  Think of the 48's
display as a window onto a much bigger bitmap.  You can create grobs as
big as your 48's memory can handle (bring on the 128K RAM cards, for which
there was supposed to be "no demand"!).  WHen I do serious plotting on my
48, I create 200x200 and 200x300 grobs on the command line, then I get 
into the PLOT application and draw/annotate a decent graph, not the default
low-res ones you got on the HP28, HP42 and 131x64 HP48SX.
They look especially impressive when you upload them to your PC or Mac,
convert them to the proper format and paste them into your MSWord document.

(Note to ChemE's:  unit ops labs will NEVER be the same!)

This should be enough information to help you write your 28-to-48 graphics
conversion program.  When you finish it, please post it on the BBS.  I 
think many people will find it extremely useful.

Ray Depew
HP InkJet Components Operation
rayde@hpcvia.cv.HP.COM
---------------------------------------------------------------
disclaimers:
I've never used a 28C/S, but I was glad they included the graphics "string".
I did write a nice DRAW program on my HP42S.
I don't work in calculators; I just use them, same as you.
I don't speak officially for HP.
----------------------------------------------------------------






----------