Post Reply 
Speed of HP-49G Routine for Tektronix Vector Graphics Terminal
08-05-2020, 09:45 AM (This post was last modified: 08-05-2020 09:47 AM by Martin Hepperle.)
Post: #14
RE: Speed of HP-49G Routine for Tektronix Vector Graphics Terminal
With the SysRPL varsion I achieve a speedup of about 2.5 compared to the UserRPL version.
This is fine for me and avoids that I fall asleep whily watching a plot appear on the screen.

My demo program now uses the functions Y1(X) and Y2(X) and the scaling as set up in the HP 49G plot application.
Therefore I replaced the hardwired scaling factors by data derived from the plot parameter list PPAR.

An initializing program calculates the translation values and the scale factors and places them on the stack.
In my routines I now pick the scaling parameters from the stack and perform the Real transformations (x-X0)*sx and (y-y0)*sy before COERCing them into BINTS and composing the bytes in Tektronix format.
This seems to be the most efficient way to perform these transforms (except reverting to Assembler, of course).

The nice thing is that I can now reproduce the same graph on the HP 49G as well as on my Tektronix emulator.

Thank you again for your help, which also triggered me to learn more about SysRPL.

Martin

PS: I must figure out first how the assembler version works before I climb up (or is it down?) to that level...

[attachment=8664]

Code:
ASSEMBLE 
  NIBASC /HPHP49-C/
                                                   ( TEKXY.s )
                                                   ( Bring X and Y into Tektronix format. )
                                                   ( Stack also contains the transformation  )
                                                   ( parameters extracted from TEKPAR. )
                                                   ( These map from User space to device space, )
                                                   ( which is integer in 4096x3072. )
RPL                                                
::                                                 ( 1:Y         2:X         3:SY 4:SX 5:Y0 6:X0 )                                         
  CK2&Dispatch
  REALREAL                                         ( need at least 2 Reals on the stack )
  ::
    ( translate and scale Real X, Y values )
    5PICK %-                                       ( 1:Y-Y0      2:X         3:SY 4:SX 5:Y0 6:X0 )
    3PICK %*                                       ( 1:[Y-Y0]*SY 2:X         3:SY 4:SX 5:Y0 6:X0 )
    SWAP                                           ( 1:X         2:[Y-Y0]*SY 3:SY 4:SX 5:Y0 6:X0 )
    BINT6 PICK %-                                  ( 1:X-X0      2:[Y-Y0]*SY 3:SY 4:SX 5:Y0 6:X0 )
    4PICK %*                                       ( 1:[X-X0]*SX 2:[Y-Y0]*SY 3:SY 4:SX 5:Y0 6:X0 )
    ( now bring these 2 integer values IX, IY into Tektronix format: a 5-character string )
    COERCE2                                        ( convert IX, IY values to BINT )
                                                   ( note: #/ leaves r and q on stack )
    BINT128 #/ BINT32 #+ #>CHR CHR>$               ( C4: 0.0.1.X12.X11.X10.X9.X8, to string  )
    SWAP BINT4 #/ BINT64 #+ #>CHR ROTSWAP >T$      ( C5: 0.1.0.X7.X6.X5.X4.X3, append to C4: C4&C5 )
    ROT BINT128 #/ BINT32 #+ #>CHR 4UNROLL         ( C1: 0.0.1.Y12.Y11.Y10.Y9.Y8 )
    BINT4 #/ BINT96 #+ #>CHR ROTSWAP >H$           ( C3: 0.1.1.Y7.Y6.Y5.Y4.Y3, prepend to C4&C5: C3&C4&C5 )
    UNROT #2* #2* #+ BINT96 #+ #>CHR >H$           ( C2: 0.1.1.0.Y2.Y1.X2.X1, append to C1: C1&C2) 
    SWAP >H$                                       ( finally: C1&C2&C3&C4&C5 )
    ( leaves a concatenated string of 5 characters: )                                      
    ( C1: [0.0.1.Y12.Y11.Y10.Y9.Y8] )
    ( C2: & [0.1.1.0.Y2.Y1.X2.X1] )
    ( C3: & [0.1.1.Y7.Y6.Y5.Y4.Y3] )
    ( C4: & [0.0.1.X12.X11.X10.X9.X8] )
    ( C5: & [0.1.0.X7.X6.X5.X4.X3] )
  ;
;
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Speed of HP-49G Routine for Tektronix Vector Graphics Terminal - Martin Hepperle - 08-05-2020 09:45 AM



User(s) browsing this thread: 1 Guest(s)