[comp.sys.handhelds] HP41CV Emulator Card Overview

sjthomas@cup.portal.com (Stephen J Thomas) (11/06/90)

The next article under this subject is a rather lengthy overview of the
HP82210A HP41CV Emulator Application Card for the HP48.  It is about 17.5K
and 350 lines.  I just read Jeremy Smith's review of the same product, but
don't have time to edit mine to remove any duplicate material.  Really,
Jeremy, it's not plagerized!  :-)
  
Stephen J Thomas
sjthomas@cup.portal.com

sjthomas@cup.portal.com (Stephen J Thomas) (11/06/90)

              HP82210A HP41CV EMULATOR APPLICATION CARD OVERVIEW

        At the end of October I received the HP41CV Emulator Card for the 
HP48SX from EduCALC (US$80, list price $100).  This card, designed by the 
English company Zengrange with support from HP, allows you to use 
programs written for the HP41 calculators on the HP48.  In addition, it 
provides a 41 Keyboard Emulation Mode where the 48 keyboard and display 
are redefined to function as a 41.  A keyboard overlay is provided to 
indicate the functions of the redefined keys. 

        There are three ways a 41 program can be loaded into the 48 for 
use by the emulator card:  by infrared transfer via the HP82242A Infrared 
Printer module, by manually typing in a program, or by downloading from a 
computer. 

        For IR transfer, the function CPTR (capture) in the emulator card 
receives the IR printer output from the 41 and then automatically 
translates this input into a tokenized form which displays as Library 
Data if recalled to the stack.  If desired, these steps can be separated 
into two separate steps using the INPRT and ->41 commands.  INPRT 
receives the printer output as a text string, and ->41 converts the text 
string into the tokenized form of the program.  

        There is no PRGM mode in the emulator.  Instead, the desired 
program is converted to a text string using the ->TXT command and edited 
using normal HP48 string editing procedures.  Programs are displayed in 
an easy to read format, with line numbers and only one command per line.
There is a lot of flexibility with regard to line numbering when editing 
or typing in a program as a string.  In fact, line numbers are not 
required at all and may be omitted if desired.  The ->TXT command will
insert them for display the next time the program is edited.  If you are 
inserting a line, you can just tag the new command to the end of the 
preceding line (separated by a SPACE).  If deleting a line, you do not 
have to worry about renumbering the remaining lines.

        When editing is completed, the string is converted back to 
tokenized form using the ->41 command.  A program can also be SST'd from 
the keyboard as on a 41 (in run mode).  Each step is displayed, and if 
you hold the SST key, it is replaced by NULL, just as all the other keys 
in the emulator mode.  

        To run a 41 program when in the 41 emulator, you can spell out 
the program name (as in  XEQ  ALPHA  S  A  M  P  L E  ALPHA) or you 
execute CAT 1 and press the menu key corresponding to the program name.

        The CATalogs show up to six programs or functions at a time 
associated with the 48's menu keys.  You can execute the program or 
function by pressing the appropriate menu key.  CAT 1 contains the user-
written global labels.  CAT 2 contains XROM functions (which can be 
written by the user to simulate functions provided by 41 plug-in ROMs and 
peripherals) and CAT 3 contains the built-in HP41 functions.  The 41CX 
CATalogs 4, 5 & 6 are not supported.  CAT 7 contains standard printer 
functions and several extended functions (CLKEYS, PASN, PSIZE, RCLFLAG, 
SIZE?, STOFLAG and sigmaREG?).  Several functions are not needed in the 
emulator and are not provided (COPY, DEL, PACK, GTO.., CLP and ON).  
Function names are the same as on the 41, not changed as in the HP 42S. 

        Several functions have been modified somewhat to take advantage 
of the 48's greater memory capacity.  For instance, SIZE prompts for a 
three-digit input.  If you press EEX, the prompt changes to four digits
(the first digit can be any reasonable value, not just 1 as on the 41 
[although the 41 couldn't handle a thousand main memory data registers 
anyway]).  The display functions allow a two-digit input.  The alpha 
register is normally completely displayed as two twelve-character lines.  
The normal stack display is as follows:

 
48 annunciators (generally not used)                ((*))
41 annunciators                         USER GRAD SHIFT 01234 PRGM ALPHA
                                      { HOME }                     HP41
41 stack                              T: 0.0000
                                      Z: 0.0000
                                      Y: 0.0000
                                      X: O.OOOO
LASTX & message display               L: o.oooo
Menu labels                           ***** ***** ***** ***** ***** *****
 

        The 41 annunciator lines and the LASTX line are in small 
typesize.  When a message or prompt is displayed, it is in medium-sized 
type in place of the LASTX line.  If the ticking clock is set to display 
on the 48, it replaces the HP41 annunciator.  Stack registers Y, Z and T 
are displayed in medium typesize.  The X register is displayed in large 
typesize.  Alternatively, the display can be set to show only the single-
line X or ALPHA register, more like the HP41, by setting a mode flag.

        Most 41 flags work as expected in the emulator.  Several have 
slight changes in their implementation (to work in the 48) or are not 
used (such as flags 14, 17 & 18, which are used by HP41 peripherals). The 
flag set is extended to include flags 56 through 87, most for the 
emulator's own use.  Flags 85 (special character control), 86 (stack 
display) and 87 (41 environment exiting) can be set or cleared by the 
user.  The remainder of the new flags, as well as standard 41 system 
flags 30 through 55, can only be tested.  

        The 160 page spiral-bound manual is very well-written and 
thorough.  This may be the best manual I've seen come through HP [thanks 
Wlodek]. Following are headings from the table of contents (hope this 
isn't a copyright violation): 

                Foreword
                Getting started
                The HP 41 Environment
                Capturing HP 41 Programs
                Modifying HP 41 Programs
                Extending the Environment
                Support and Service
                Bibliography
                Tables of Flags and XROM Identifiers
                Advanced Applications
                Error Messages and Other Messages
                Index



        Only the leftshift key is used in the keyboard emulator for the 
41 SHIFT key.

        In ALPHA mode, pressing SHIFT ALPHA produces a two-digit 
(hexidecimal) prompt, allowing you to enter the character code for any 
character, which is then appended to the ALPHA register string.  This 
facilitates the easy entry of characters not found on the keyboard. This 
feature is similar to that found on the ZENROM.  

        The emulator's 41 keyboard is very similar in layout to a real 
41 keyboard.  Several groups of functions have been assigned to menus: 
statistics, MODES, ANGular functions, FLAGS, xTESTS, LOGS, PRINT and 
PARTS.

        The emulator allows keys to be reassigned by the user.  In fact,
multiple sets of key assignments can be maintained.  The function of any 
key can be previewed by holding the key down.  Continuing to hold the key 
results in the message NULL being displayed and the key's function is not 
activated, as on the 41. 

        You can use the pre-HP28 stack lift enable and disable features 
by using the ENTER key as the separator.  Using the SPaCe key as the 
separator terminates data entry and enables stack lift without pushing a 
copy of the X register into the Y register.  For example, starting with a 
cleared stack:
  
    starting stack           6 ENTER       or       6 SPC
 
     T: 0.00                  0.00                  0.00  
     Z: 0.00                  0.00                  0.00
     Y: 0.00                  6.00                  0.00  
     X: 0.00                  6.00                  6.00
             stack lift:     disabled              enabled

        I don't think synthetic program instructions are going to be very 
easy to implement -- if at all -- unless Zengrange has left a back door 
in the emulator card.  Note that when transferring a 41 program to the 
emulator via IR, the emulator is NOT receiving the bytes which correspond 
to the internal storage of the functions, but is receiving the character 
representations of the functions as they would be sent to the printer.  
This is why the translation step is necessary.  If you try to send a STO 
M for example, the translator rejects it.  This is also true if you enter 
synthetic-appearing programs steps directly into a program string. 

        It would seem that the only possible way of creating synthetic 
program steps would be to create them on a PC (or modify a file, like 
synthetics were created on the 41 before wonderful inventions like the 
ZENROM and CCD ROM) in tokenized form, and download that directly to the 
48.  Having examined several 41 programs in the emulator's tokenized 
format on my PC, it _appears_ that they are NOT stored using the same hex 
codes as they would be on a 41.  I did manage to change a RCL X into a 
RCL K, but at run-time the emulator rejected it (I know K is not a valid 
register, but it was pretty much pot luck whatever replaced the X). 

        Any short form exponents (such as E5 or E-12) are flagged and 
must be manually fixed.  Although they can be generated "non-
synthetically" on the 41 using the card reader's HP 67/97 translating
function, because of their byte structure, the emulator could confuse 
them with XROM instructions.
  
        Of course, the whole concept of these synthetic instructions may 
be moot if the internal storage of the 41 emulator status registers does 
not correspond with the memory layout of the 41.  The emulator stores the 
stack in an HP 48 variable named HP41STACK.  Recalling the contents to 
the stack displays the contents as Library Data.  I have not attempted to 
go digging into the contents of this object.  As with USER mode key 
assignments, multiple copies of the stack (and presumably other status 
registers) can be maintained by renaming the 48 variable containing the 
stack data.

        In addition to transferring programs by IR, blocks of data 
registers may also be sent to the emulator from a 41 using PRREG or
PRREGX.  Certain status information can also be transferred using PRFLAGS 
(SIZE, sigmaREG, angular mode, display format, status of flags 00 through 
43).

        From inside the 41 emulator environment (including running 41 
programs), you can execute 48 commands and access the 48 stack.  From 
outside the 41 emulator environment, you can execute 41 functions from 
the 48 keyboard or from 48 programs, as well as access the X and ALPHA 
registers.

        The functionality of the 41 environment command set can be 
extended by the creation of user-written XROM and other programs.

        All of the functions of the 82242A IR Printer Module for the 41 
are provided, except for the user-code plotting routines, which can be
transferred over from the 41, and TESTP.

        Programs and data can be transferred to the emulator from an 
HP42S, but may require additional editing or XROM creation.

        When you plug the emulator card into an HP48, four directories 
(1402, 1403, 1404 and 2046) are attached to the HOME directory.  Library 
#1405 is reserved for possible future extension of the emulator.

        The range of valid values in the emulator is the same as for the
HP48 -- with exponents between -499 and +499.  This is different from the
valid exponent range in the 41, between -99 and +99.  Also, the emulator 
uses 12 mantissa digits while the 41 uses only 10.

        Extended memory is not supported by the emulator, but it can 
access a much larger number of main memory data registers -- limited by 
amount of available MERGEd memory in the 48.  Unfortunately, data 
registers numbered greater than 99 must still be accessed indirectly.  
Since the emulator has improved several 41 functions, I would like to 
have seen implemented the ability to directly access high-numbered 
registers -- at least from the keyboard.  For example, to recall the 
contents of register number 245, press RCL EEX 245, where the EEX changes 
the prompt from two digits to three.  Similarly, to store into register 
#1234, STO EEX EEX 1234 would have been nice. 
          
        The HP48 variable HP41PAR contains a list of the names of other 
48 variables which contain data used by the emulator.  The default names 
are:
                     PRG41 - program directory
                     HP41XROM - XROM function directory
                     HP41KEYS - key assignments
                     HP41REGS - 41 data registers
                     HP41STACK - stack registers

The user can change the name of the 48 variable containing the above 
data, as long as the current name is stored in the appropriate position 
in the list contained in HP41PAR.  This way, different sets of data 
registers, for instance, can be maintained.  When taken to the extreme, 
you can configure multiple entire 41 environments by adapting all of 
these variables.

        The emulator, like the 41, allows six pending subroutine returns.

        The top two rows of keys can be used to supply postfix values --
usually from 1 through 12.  Sometimes the rightmost key on the second row 
supplies zero.  They can also be used to access local alpha labels A 
through L and a through f.

        Since the emulator's data registers are 8 bytes long (compared to
7 on the 41), each register can contain up to 7 alpha characters.  But 
for compatibility, alpha operations store 6 characters in data registers. 

        The jump distances for GTOs and XEQs are compiled after a program 
string is translated into tokenized form, rather than computed at run 
time as in the 41.

        User programs can be stored in the current directory, or in a 
directory named PRG41 where they compose a "library" of 41 programs.  
Programs, including those in the library, may be made PRIVATE.

        The manual includes several good examples of extending the 
functionality of the emulator, including implementation of the user-
defined XROM functions.  One example, CRFLD, corresponds to the the 
41 extended function of the same name (CReate FiLe - Data, XROM 25,11) 
and uses HP 48 lists to emulate 41 extended memory registers.

        Following is the layout of the 41 emulator keyboard.  Names in 
[brackets] represent menus.  If two names are listed, the top name is the 
SHIFTed function;  if three names are listed, the bottom name is an ALPHA 
mode function or shifted special character.  The first row (the 48 menu 
keys) are not listed below. 


 
                             ASN     SIZE                 PREV
    [LOGS]      [PRGM]      USER      RCL     [PRINT]      NXT


                                                R-UP
     GTO         STO         XEQ     X<>       R-DOWN     X<>Y


    ASIN        ACOS        ATAN      X^2       %CH      [xTESTS]
     SIN         COS         TAN     SQRT       Y^X        1/X


        CATALOG              ISG      RTN        %        [CLEAR]
         ENTER               CHS      EEX     'unused'      <-
   |- append   ^                                 %


     CHR         [sigma]        [ANG]      [MODES]     [FLAGS]
    ALPHA          7              8          9            /
                  sigma         angle        :          ASTO


                 BEEP           P->R       R->P        [PARTS]
    SHIFT          4              5          6            x
                   $              <          >          ARCL


    HP48          FIX            SCI        ENG          BST
                   1              2          3            -
                  =/=             =          ?


    OFF           PI            LASTX       VIEW         SST
    R/S            0              .          SPC          +
                 ASHF             ,         AVIEW


        In ALPHA mode, the upper-case characters are the same as on the 
48 keyboard (not shown above).  Lower-case are entered by pressing the 
SHIFT key, followed by the upper-case letter. 

        The emulator card function VERS41 returns the following string:
                "0A
                Copyright 1990
                Zengrange Inc
                900928 0133
                Design & code:
                FCW,IM,RWJ,DRC
                Manual:WACM-J,MHJ,TJW
                for Terra Pacific
                HELP: TWB,CB,SB,DKB,
                JAD,DLE,SRL,VKL,RM,
                RJN,CP,GP,GS,JS,BGS,
                BAS,ELV,WCW,RSW,DY,RY
                Patience:SHC,HG,PK"

        Overall, this is an excellent application card for the 48.  Its
usefulness will vary from user to user, depending on the amount of 41 
software one still desires to use.  I was pleasantly surprised at the 
functionality provided by the emulator card -- it contains much more than 
I had expected.  The manual also earns top marks.  For some reason, this
card has also proven to be fun.  I wholeheartedly recommend the HP 41CV
Emulator Card for those with a significant investment in HP 41 software, 
and to those HP groupies who love to play with this stuff, even if they 
don't have a lot of practical uses for it.


        Other than having a significant investment in hardware and 
software from Hewlett-Packard and Zengrange, I have no affiliation with 
either company (although all job offers are given serious consideration). 
:-)   This review was unsolicited.  If you have specific questions about 
the emulator, email to sjthomas@cup.portal.com and I'll do my best to 
reply. 

Stephen J. Thomas