[comp.sys.handhelds] HP 48SX GROB Format

billw@hpcvra.CV.HP.COM (William C Wickes) (03/13/90)

Many people seem interested in working with HP-48SX graphics objects (grobs)
on their PC's.  To save you some trouble, here is the binary format:

<prolog><length><height><width><data....>

where the first four are 5-nibble fields:

prolog = grob object identifier = 02B1E
length = distance in nibbles from start of length field to (just past) the
         object end = F + # of data nibbles
height = height in pixels
width = width in pixels

To make life more interesting, the fields are written backwards (this is
how the CPU reads memory), so e.g. the prolog is written E1B20.

The data starts at the upper left corner of the grob and proceeds
left-to-right, top-to-bottom.  But--each pixel row must be a integral
number of bytes (even number of pixels).  The data may therefore be
padded with garbage bits to satisy this.  And--each nibble is written
backwards compared to the LCD order, so the leftmost pixel in a group
of four is the least-significant bit of the stored nibble.

A blank screen-sized grob looks like this:

E1B20|F8800|04000|38000|000000.... (2176 0'S),

where the |'s are for legibility.  The width of 83h = 131d pixels needs
17 bytes or 34 nibbles, so 40h = 64d rows gives 34x64 = 2176 nibbles of
data. 2176 + 15 = 2191d = 88Fh, which is the length field content.
If the upper-left-most pixel was turned on, the first data nibble would
be a 1.