Post Reply 
Some old code samples for HP 50g
05-28-2017, 05:35 PM
Post: #1
Some old code samples for HP 50g
A long (long!) time ago I was working on a program to print from my HP 50g to a HP 990cxi inkjet printer though the printer's IRDA interface. Upon moving to a new house some dude placed the printer upside down, ruining it. So, the programming was cancelled as well.

I recently found some of the input form files, so, I'll post them here before I loose them. I tried to use graphics and text input as self-explanatory as posible, incorporating the data entry inside the graphic itself. Nothing fancy, but pretty. I hope someone here has some use for these examples.

First, the page configuration form:
   
Code:

%%HP: T(3)A(R)F(.);
"!NO CODE
!RPL
::
* Label definitions  
  GROB 0014E B1000F2000FFFFFFFFFF70100800000042108C1008004710080000004210880008004210080​0000042108800080042100C10000042108800080042555555555552108800080042100C100000425​0A800082052FF780000FF7250A800082052100800000042108800080042100800000042108800080​04210080000004210880008004210080000004230C800080042CC3B00C10730030C1C3EC8020000E​3003000000000000002
  (Page grob)     0 15
  \"Margins\"       8  9
  \"Lines/inch\->\"   0 42
  \"Paper Size:\"  64  9
  \"Orientation:\" 64 25
  \"Perf.skip mode?\" 72 41
  
* Paper size field   
  'DROPFALSE    (Message handler)
  72 17  58 6   (Position & size)
  BINT12        (Fld type: choose)
  MINUSONE      (Types allowed)
  BINT1         (Decomp as sm font)
  (Help text)
  \"Paper size installed in printer \"
  { \"Letter 8.5*11\\\"\"
    \"Legal 8.5*14\\\"\"
    \"A10 x*y\"
    \"Executive x*y\"
  }             (Options)
  BINT1         (ChooseDecomp, ignored)
  \"Letter 8.5*11\\\"\" (Initial value)
  DUP           (Reset value)

* Lines/inch field   
  'DROPFALSE    (Message handler)
  48 41  8 6    (Position & size)
  BINT3         (Fld type: combo)
  { 0 }         (Types allowed)
  BINT3         (Decomp as sm font)
  (Help text)
  \"Number of lines per inch\"
  { % 6  % 8
  }             (Options)
  BINT5         (ChooseDecomp, ignored)
  % 6           (Initial value)
  DUP           (Reset value)
  
* Top margin field   
  'DROPFALSE    (Message handler)
  19 17  8 6    (Position & size)
  BINT3         (Fld type: combo)
  { 0 }         (Types allowed)
  BINT3         (Decomp as sm font)
  (Help text)
  \"Number of lines for top margin\"
  { % 6  % 8
  }             (Options)
  BINT5         (ChooseDecomp, ignored)
  % 8           (Initial value)
  DUP           (Reset value)
  
* Left margin field
  'DROPFALSE    (Message handler)
  3 32  8 6     (Position & size)
  BINT3         (Fld type: combo)
  { 0 }         (Types allowed)
  BINT5         (Decomp as sm font)
  (Help text)
  \"Column number for left margin\"
  { % 6  % 8 
  }             (Options)
  BINT5         (ChooseDecomp, ignored)
  % 6           (Initial value)
  DUP           (Reset value)
  
* Text area field   
  'DROPFALSE    (Message handler)
  19 32  12 6   (Position & size)
  BINT3         (Fld type: combo)
  { 0 }         (Types allowed)
  BINT3         (Decomp as sm font)
  (Help text)
  \"# of lines, text (writable) area\"
  { % 6  % 8
  }             (Options)
  BINT5         (ChooseDecomp, ignored)
  % 52           (Initial value)
  DUP           (Reset value)
  
* Right margin field   
  'DROPFALSE    (Message handler)
  34 32  8 6    (Position & size)
  BINT3         (Fld type: combo)
  { 0 }         (Types allowed)
  BINT5         (Decomp as sm font)
  (Help text)
  \"Column number for right margin\"
  { % 6  % 8
  }             (Options)
  BINT5         (ChooseDecomp, ignored)
  % 8           (Initial value)
  DUP           (Reset value)
  
* Page area field   
  'DROPFALSE    (Message handler)
  48 32  12 6   (Position & size)
  BINT3         (Fld type: combo)
  { 0 }         (Types allowed)
  BINT3         (Decomp as sm font)
  (Help text)
  \"# of lines for logical page area\"
  { % 6  % 8
  }             (Options)
  BINT5         (ChooseDecomp, ignored)
  % 66          (Initial value)
  DUP           (Reset value)
  
* Orientation field   
  'DROPFALSE    (Message handler)
  72 32  36 6   (Position & size)
  BINT12        (Fld type: choose)
  MINUSONE      (Types allowed)
  BINT1         (Decomp as sm font)
  (Help text)
  \"Physical page orientation\"
  { \"Portrait\" \"Landscape\"
  }             (Options)
  BINT1         (ChooseDecomp, ignored)
  \"Portrait\"    (Initial value)
  DUP           (Reset value)
  
* Perforation skip field   
  'DROPFALSE    (Message handler)
  65 41 ZEROZERO (Position & size)
  BINT32        (Fld type: check)
  MINUSONE      (Types allowed)
  DUP           (Decomp: n/a )
  (Help text)
  \"Load paper if txt overflows\"
  MINUSONE      (Options)
  DUP           (ChooseDecomp, ignored)
  TrueTrue      (Initial & Reset value)
  
* xHALT 
  6 9           (Labels & fields)
  'DROPFALSE
  \"hp 990Cxi Page Setup\"
  FPTR2 ^IfMain
;
@"


This is the simpler font selection form:
   
Code:

%%HP: T(3)A(R)F(.);
"!NO CODE
!RPL
::
* Label definitions:
  GROB 0013C 900003800020000000000000000000000000000000201000000000000000000000000000000​04020000000000000000000000000000000201000000000000000000000000000000040200000000​00000000000000000000000201000000000000000000000000000000040200000000000000000000​00000000000205555555555555555555555555555555550AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA2​0
  (TitleBar ext GROB)  0   7
  \"Character set:\"     4   8   
  \"Spacing:\"           1  19
  \"\019\002\019Italic\019\002\019\"            77  19
  GROB 00028 500002100070C020BCC83076DC20B6DC207C8930
  (Bold label GROB)  112  19
  \"Typeface:\"          1  30
  \"Pitch:\"             1  41
  \"Point Size:\"       60  41

* Field definitions:

* TitleBar extention GROB: n/a

* Character set field
  'DROPFALSE    (Msg handler)
  62 8    67 6  (Pos & size)
  BINT12        (Fld type: chs)
  MINUSONE      (Types, n/a here)
  BINT17        (Dcomp  sm font)
  (Help text)
  \"Select character set\"
  { { \"ECMA-94 Latin 1\" \"\027(0N\" }
    { \"PC-8\" \"\027(10N)\" }
    { \"hp Roman-8\" \"\027(8U\" }
    { \"ANSI ASCII\" \"\027(0U)\" }
  }             (Options)
  BINT1         (ChsDcmp,ignored)
  (Initial value)
  { \"ECMA-94 Latin 1\" \"\027(0N\" }
  DUP           (Reset value)

* Spacing field
  (Msg handler, pushed to stack)
  ' ::
    5 OVER#=case ::
      DROP      (Drop msg bint)
      DUP
      { \"Proportional\" \"\027(s1P\" }
      EQUALcase
      (If so, hide Pitch fld...)
      ::
        5 TrueFalse
        FPTR2 ^IfSetFieldVisible
        (... & hide Pitch: lbl)
        6 FalseFalse
        FPTR2 ^IfSetFieldVisible
        \"Review Size,\\0A please.\"
        (ROMPTR 151 B=xStErr)
        ::
        
          $>grobCR
          ROMPTR B0 86
          BINT14
          BINT131
          MAKEGROB
          SWAPOVER
          #ZERO#ONE
          GROB!
          SWAPOVER
          BINT11
          BINT1
          GROB!
          PTR 2F3CF
          SWAPOVER
          ZEROZERO
          GROB!
          PTR 2F3D0
          SetDA1Temp
          ERRBEEP
        ;
        DispStsBound
        TRUE    (Required)
        ClrDAsOK
      ;
      (Else, unhide Pitch fld & lbl)
      5 TrueTrue
      FPTR2 ^IfSetFieldVisible
      6 FalseTrue
      FPTR2 ^IfSetFieldVisible
      TRUE
    ;
    1 OVER#=case ::
      ?DispStatus (Clear warnings)
      DROPTRUE
    ;
   DROPFALSE
  ;             (End of msghndlr)
  34 19   32 6  (Pos & size)
  BINT12        (Fld type: Chs)
  MINUSONE      (Types, n/a here)
  BINT17         (Dcmp: sm font)
  (Help text)
  \"Type of spacing between chars.\"
  (Choose options)
  { { \"Fixed\" \"\027(s0P)\" }
    { \"Proportional\" \"\027(s1P\" }
  }
  BINT1         (ChooseDecomp, ignored)
  (Initial value)
  { \"Fixed\" \"\027(s0P)\" }
  DUP           (Reset value)
  
* Pitch field
  'DROPFALSE    (Msg handler)
  26 40   30 8  (Pos. & size)
  BINT2         (Fld type: cmb)
  { 0 }         (Types, n/a here)
  BINT4         (Dcmp sm font)
  (Help text)
  \"Fixed font's Characters per inch\"
  { %7 %9 %11
  }             (Options)
  BINT4         (ChsDcmp,ignored)
  %11 DUP       (Initial & reset)

* Point size field
  'DROPFALSE    (Msg handler)
  105 40   25 8 (Pos. & size)
  BINT12        (Fld type: chs)
  MINUSONE      (Types, n/a here)
  BINT4         (Dcmp sm font)
  (Help text)
  \"Fixed font's point size\"
  { %6 %8 %10 %12
  }             (Options)
  BINT4         (ChsDcmp,ignored)
  %12 DUP       (Initial & reset)

* Italic field (Style)
  'DROPFALSE    (Msg handler)
  70 19 ZEROZERO (Pos & size)
  BINT32        (Fld type: chk)
  MINUSONE      (Types, n/a here)
  DUP           (Dcmp n/A)
  (Help text)
  \"Italic font style?\"
  MINUSONE      (Opts, n/a)
  DUP           (ChsDcmp,ignored)
  FalseFalse    (Init&reset values)

* Bold field (Weight)
  'DROPFALSE    (Msg handler)
  105 19 ZEROZERO (Pos. & size)
  BINT32        (Fld type: chk)
  MINUSONE      (Types, n/a here)
  DUP           (Dcmp N/A)
  (Help text)
  \"Bold font weight?\"
  MINUSONE      (Opts, n/a)
  DUP           (ChsDcmp,ignored)
  FalseFalse    (Initial & reset)

* Typeface field
  'DROPFALSE    (Msg handler)
  40 29   90 8  (Pos. & size)
  BINT12        (Fld type: chs)
  MINUSONE      (Types, n/a here)
  BINT16        (Dcmp sm font)
  (Help text)
  \"Select typeface\"
  { { \"Courier\" \"\027(s3T\" }
    { \"CG Times\" \"\027s4101T\" }
    { \"Letter Gothic\" \"\027(s6T\" }
    { \"Univers\" \"\027(s52T\" }
  }             (Options)
  BINT0         (ChsDcmp,ignored)
  (Initial & reset)
  { \"Courier\" \"\027(s3T\" } DUP

* Print Quality: in other form

* Form parameters
  8 7           (Lbls & flds)
  ' ::          (Form msghndlr)
    7     (IfMsgSetFirstField)
    OVER#=case ::
      2DROP 6   (Typeface field)
      TRUE
    ;
     DROPFALSE
     ;
  (Title)
  \"hp 990Cxi Printer Setup\"
  FPTR2 ^IfMain
;
@"

NOTE: the GROB definitions must be continuous, no line breaks.
These are in System RPL. Assemble and EVAL (run)...
Find all posts by this user
Quote this message in a reply
05-28-2017, 09:40 PM
Post: #2
RE: Some old code samples for HP 50g
Very pretty.

Sometimes picture is worth thousand words. I think config forms with graphics visualizing some parameters is a really nice touch and shows that programmer cared.

I wish there was more of those.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: