Back to Home Page

From Emmanuelcompes@aol.com Sun Apr 29 18:28:13 2001

(approximative translation - editor needed – have not any time to do this – jdd)

In 1979, when it was released, the HP-41 represented a great improvement in its field ; It was able to receive, to process, and to display alphabetical strings. A real dialog was now possible between the user and the calculator, this new flexibility was even improved by some sonorous possibilities.

In fact these advantages were only the most visible improvements. The alphanumeric keyboard induces other new and powerful capacities.

The first possibility is very useful in program mode. Instructions are not in code, but in plain language. Now "specialised machine language" is not adequated for the HP-41, "specialised assembly language" is better. In fact, for this calculator, HEWLETT-PACKARD has developed an advanced language, near FORTH, which places the HP-41 in a class of its own.

The comprehension of this potentialities induces the way one will use the HP-41.

THIS LANGUAGE IS AN INTERPRETED ONE.

The instructions inserted in the calculator memory are not directly intelligible to the microprocessor. Prior to execution they must be translated in a succession of micro-instructions, which are understandable to the HP-41 chip. This deciphering operation is the interpreting.

A SYMBOLIC LANGUAGE FOR THE HP-41.

A computer spends most of its time searching in its memory to transfer informations from one place to an other. This information can be transformed in the process, but it is not alway necessary. To execute these transfers the microprocessor must know the data origin and destination, both are absolute addresses.

There is two types of informations :

- data : numeric values or characters strings.

- instructions : which sequence represents a program.

At the machine language level these informations are all numerics. But the average users are very different from a microprocessor, they find it easier to remenber words than numbers or instructions sequences : programmmers prefer symbols to numbers. So the microprocessor must link, one way or another,
the symbol and the address to get a given information. It can use catalogs which can be compare to a directory, where a telephone number is found using
a surname. The advancement of a language can be measured by its degree of symbolism.

THE HP-41 IS MODULAR.

In the world of micro-computers the HP-41 is one of the few machines which can contain an undetermined number of programs. Every one of them can be created, modified, erased, and (if you own a mass storage device ) saved or loaded independently.

At this physical independence, is opposed a logical dependence. Any program
can call a group of instructions belonging to another program ; This sequence has only to begin by an alphabetical label : LBL "X..." and ends by RTN or END.

Therefore it is possible to divide a complicated program, in a sequence of easier ones ( and so on ) according to the valuable principles of ? ? ? ??(programmmation ascendante). The problems of data handling are left to lower levels subroutines, while the logical sequence of the program is clearly visible at the higher levels. This programming technic has numeros advantages :

- It becomes very difficult to do some mistakes while conceiving the different stages of a program. If it happens, it is easy to correct it because the
mistake is quickly located within a small number of instructions.

- It is also very easy to test each subroutine to see if the output is consistent with a given input.

- Finally, some subroutines happen to be so usefull that one wish to have anassembly language version of them. This module is a good illustration of it: Most functions included in the PANAME ROM, where first created as subroutines in user language and published in 1982. The conception of the array handling technics and of most functions, are from this period.

PROGRAMMING THE HP-41.

The HP-41 has three programming levels.

- Programs, are in fact a sequence of routines, eventually with tests in between. Always designed for a specific purpose, the program illustrates the stategical importance of the programmer ability. A program must be understandable when reading it, and it must include its documentation.

- Routines, represent the tactical side of programming. A routine should be
short, fast, memory saving, and modify as few variables as possible. It doesa specific task.

They are general enough to be used several times in a program, even in different programs. They are liable to stay permanently in memory. A standardisation of programming technics saves time and efforts. If a routine has all these conditions it can be considered as a new function for the HP-41 language
: an illustration of the last quality of this language : Its capacity of evolution.

- Assembly language functions. They are the elements of the language itself.A function should be general, even more than a routine. The two authors of
this module provide us with a coherent group of more than 120 new functions.

FIRST CONCEPT : PERIPHERALS HANDLING.

One should have used this module functions to realize what simplifications they procure when dealing with peripheral. Either using video or printer functions, a lot of time is saved when running a program or creating it. Plain language instructions instead of escape sequences, represents the same enhancement than reading "SIN" instead of "31 04". "CLEAR" is better than "27 ACCHR 69 ACCHR OUTA" : it is more intelligible, and it works in trace mode. From this point of view the "PANAME" rom is a great enhancment and it solves problems which had virtually no solution before.

=0CANOTHER CONCEPT : ARRAYS HANDLING.

How many times did we hear that the HP-41 was not designed for array handling. Now, every one will see how the utilisation of the stack, that we have recommended, prepared us to these new functions. The rise of the FORTH language will give another evidence of this conception. Those lucky enough to use RPN logic will be prepared for FORTH, which perhaps, will replace BASIC.

We hope that all those, who develope programms on the HP-41, will realize the great interest they have in acquiring the "PANAME" rom.




PHILIPPE DESCAMPS
=0CWARNING





The PANAME ROM includes new functions for the HP-41, and they induce lots ofdifferent applications. But, as for other functions of the HP-41, either original ones or added ones, Users with their wide range of applications, are
the only ones, who can show the interest of these functions.

This module creation would have been impossible without our PPC club, because it facilitates the exchange of solutions : it is very useful to share other other people knowledge and programming skills.

For the momemt the PANAME ROM as a user manual, which has been made as clearand precise as possible. But we realise our limits. Therefore we have decided to write, with everybody's help, a document following the spirit which was at the origin of the PPC module.

If you are interested by a Solution Book for the PANAME ROM, you can put your name down with J.J. DHENIN, BCMW=FF2=FFbis rue N. HOUEL 75005 PARIS. When
the solution book is ready you will be notified.

How do we intend to write this collective book ?

Everyone will find unclear points in the original manuel. We hope you will send us written questions. It will be better if a new redaction of these points is also proposed. As a matter of fact, we are so accustomed to these new
functions that we are unable to evaluate the difficulties faced by a new user. So you are the only ones who can help us to enhance this manuel.

Finaly, examples are the best explanation, especially when the manuel is notwritten in author native toungue language. So we hope you will send us yourown applications, short if possible.

According to your suggestions and to your work, we will be able to send you
a new and better document in the future.

Happy programming.
=0C- Accessory Identity -=09AID
__________________________________________________________________

AID returns the Accessory IDentity of the primary device. The Accessory Identity is an integer in the range 0 to 255 which identifies the device type.

For instance, the Accessory Identity of the HP82162A thermal printer is 32.
If the primary device is a HP82162A printer, the AID function returns 32 to
the X register.

AID INSTRUCTIONS

The AID function returns to the X register an integer, which represents for
the Acessory Identity of the primary device. To know the AID number of a device, refer to the description of the HPIL message "Send Accessory Identity"
in the device owner's manual.

If the primary device has no Accessory Identity, the error message NO RESPONSE is displayed.

Related functions

I/O ROM : FINDAID, ID
HPIL ROM : FINDID, SELECT, AUTOIO, MANIO
PANAME ROM : RCLSEL
=0CAppendix C=20





For every type of accessory, this list gives the name, identity range and number related to a device type. To search for a given accessory type, the accessory type number is put in the X register. this list can be used with FINDAID.=20




Type AID Type identifier=20

controller 0 to 15 - 1=20
mass storage 16 to 31 - 16=20
printer 32 to 47 - 32=20
display 48 to 63 - 48=20
interface 64 to 79 - 64=20
80 to 95 - 80=20
graphic device 96 to 111 - 96=20
112 to 127 -112=20
128 to 143 -128=20
144 to 159 -144=20
160 to 175 -160=20
176

to 191 -176=20
192 to 207 -192=20
208 to 239 -224=20
240 to 255 -240=20
=0C- Device Identity -=09ID

__________________________________________________________________

ID (Device IDentity) returns the Device Identity of the main device. The Device Identity is an alphanumeric string which identifies the device. Generally the ID string indicates the device manufacturer and reference.

For instance, the Device Identity of the HPIL-RS232 interface is "HP82164A".If the main device is the HPIL-RS232 interface, the ID function returns "HP82164A" to the ALPHA register.

INSTRUCTIONS FOR ID

The ID function returns the Device Identity of the main device to the ALPHA
register. To get the ID string of a device, refer to the description of the
HPIL message "Send Device Identity" in the device owner's manual.

If the main device has no device identity, the error message=20
NO RESPONSE is returned.

Related functions :

HPIL ROM : FINDID, SELECT, AUTOIO, MANIO
PANAME ROM : AID, FINDAID, RCLSEL
=0C- Input prefix for OUT functions - =09OUT

__________________________________________________________________

Easy keyboard input of functions beginning with OUT is possible thanks to the [OUT] function. This function is very useful when it is assigned to a key.For instance assigne OUT to the [LN] key.

Keystrokes : [ASN][ALPHA][O][U][T][ALPHA][1][5]\???? \Put the calculator in
USER mode, then execute or program a function which name begins with OUT, for instance OUTAX.

Keystrokes : [OUT]([LN] key)[ALPHA][A][X][ALPHA]

Without the OUT function the keystrokes would havee been [XEQ][ALPHA] [O][U][T][A][X][ALPHA], so you save 3 keystrokes every time you type a function beginning with OUT.

OUT INSTRUCTIONS

1) Assign OUT to a key and set the calculator to USER mode.

2) To execute or program a function beginning with OUT, strike=FF:

[OUT] (It is assigned to a key)

[ALPHA]

....characters of the function name without the first three one.

....(for instance YBX for the OUTYBX function).

[ALPHA]
=0C- OUTA with repetition acording to X -=09OUTAX
__________________________________________________________________

OUTAX performs one or several OUTAs functions, it sends the ALPHA register contents to the main device. The absolute value of the X register indicates the number of OUTA to be performed.

If flag 17 is cleared, an End Line sequence is added to the ALPHA string every time this one is send on the HPIL loop. (End Line : characters CR and LF,decimal code 13 and 10).

If Flag 17 is set, the ALPHA string is send several time without any separation character.

INSTRUCTIONS FOR OUTAX

The string to be send several times must be put in the ALPHA register, the number of repetitons in the X register, and Flag 17 must be set or cleared according to the required effect (as mentioned above ). Then execute OUTAX.

EXEMPLE :

To draw a line of 40 "_*" (stands for the SPACE character) strings on a HP82905B printer, use the following sequence. (The printer must be the main device)

"_*" SF 17 40 OUTAX ADV

Related functions :

Any function beginning with OUT.

HPIL ROM : MANIO, SELECT are used to select the device.
=0C- OUTput Carriage Return - =09OUTCR

__________________________________________________________________

OUTCR send a CR caracter to the main device. (Carriage Return=FF: decimal code 13).





- OUTput Line Feed -=09OUTLF
__________________________________________________________________

OUTLF sends a LF caracter to the main device. (Line Feed : decimal code 10).





- OUTput Line Feeds by X -=09OUTLFX
__________________________________________________________________

OUTLFX Sends one or several LF caracters to the main device. (Line Feed : decimal code 10 ). The number of caracters is specified by the absolute value
of the X register.
( 0<=3D X <=3D 999 ).

Instructions for OUTLFX.

Put the number of LF caracters to be sent in the X register and execute OUTLFX.
=0C- Output space characters -=09OUTSPX

__________________________________________________________________

OUTSPX (OUTput SPaces by X) sends the number of space characters (decimal code 32) specified by the absolute value of the X-register, (0<=3DX<=3D999),tothe primary device.

INSTRUCTIONS FOR OUTSPX

Put in the X-register the number of space characters to be sent to the primary device, and execute OUTSPX.

EXEMPLE

Numerous printers have no tabulation functions. The OUTSPX function replacesit quite well. For instance, the program OUTAT sends to the printer an alphabetical string of a given length L, representing the string in the ALPHA register followed, if necessary, by several space characters. If the string inthe ALPHA register is longer than L, it is shorten to the first L characters (1).

The string length is limited to 24 characters because of the size of the ALPHA register.

OUTAT use :

- Put the string lenght (L) in the X-register.

- Type the string in the ALPHA register.

- Execute OUTAT.

The OUTAT program destroys registers X, T, LASTX and sets flag 17.

Note : L must be a positive integer number.

Listing of OUTAT :

LBL "OUTAT" ALENG X>Y? GTO 01
- LBL 02 SF 17 OUTA OUTSPX RTN
LBL 01 DSE Y NOP CLX 1 E2 / SUB$
CLX GTO 02 END

N.B. : The text is left-justified. To print a text right=1F-justified just swap OUTAT and OUTSPX in OUTAT.

(1) : In this case, the ALPHA register is modified by OUTAT.
=0C- Send a character by its decimal code -=09OUTXB

__________________________________________________________________

OUTXB sends to the primary device, the character, which decimal code is specified by the absolute value of the X-register. This value must be in the range 0-255.

INSTRUCTIONS FOR OUTXB

Put the decimal code of the character in the X-register, and execute OUTXB.

EXEMPLE

To send to the printer the character "\" (Decimal code 92), use the sequence: 92 OUTXB.




- Send a character, several time, by its decimal code -=FF=09OUTYBX

__________________________________________________________________

OUTYBX sends to the primary device, one or several times, a character which
decimal code is specified by the absolute value of the Y-register. The absolute value of the X-register specifies the number of characters to send.

Restrictions : 0<=3DABS(X)<=3D999 and 0<=3DABS(Y)<=3D255.

INSTRUCTIONS FOR OUTYBX

Put in the Y-register the decimal code of the character and the character count in the X-register, then execute OUTYBX.

EXEMPLES

1) To send 20 "'" characters to the printer (Decimal code 39), use the sequence :

39 ENTER^ 20 OUTYBX.

2) "PRNBLZ" (PRint Number with Leading Zero )

This program prints numbers with leading zeroes. The entry conditions are :

- The X-register holds the number to be printed.

- The Y-register holds the length of the printing field (maximum number of digits) .

- Select the display format.

- Execute PRNBLZ.
=0CIf the printing field cannot hold the formatted number, it is field with
"*" characters.

After execution, registers X, Y, LASTX and ALPHA are lost.

Listing of PRNBLZ :

LBL "PRNBLZ" CLA ARCL X X<0? XEQ 00
CLX ALENG X>Y? GTO 01 - 48 X<>Y OUTYBX OUTA RTN
LBL 00 CLX ATOXL OUTXB RTN
LBL 01 CLX 42 X<>Y OUTYBX END

=0COUTA with 7th bit set -=09OUTa

__________________________________________________________________

OUTa works like OUTA except that the 7th bit of every character sent is set.Therefor 128 is added when the character code is smaller than 128; with twoimportant exceptions : LF and CR characters which are automatically sent after an ALPHA string when flag 17 is clear. (CR : carriage return, decimal code 13. LF : line feed decimal code 10).

INSTRUCTIONS FOR OUTa

Put in the ALPHA register the string to be sent, set or clear flag 17 (see above), execute OUTa.

EXEMPLES

1) To display a string in "inverse video" mode on the HP82163 video interface, you have to add 128 to each character code before sending the string to the interface.The OUTa function does it automatically. So to display a stringin inverse video, select the interface as the primary device, put the string in the ALPHA register and execute OUTa. Flag 17 enables or disables the sending of an "End-of-line" sequence.

2) Some printers can automatically underline if you add 128 to the code of the character code to be underline. The OUTa function makes this operation easier with such printers.

3) There are two ways to use special characters on the HP82905B :

- Using the secondary character set mode, which give new meanings to the codes 32 to 127.

- Using characters with codes higher than 127.

The second method is very easy to use with the OUTa function.
=0C- OUTa with repetion by X -=09OUTaX

__________________________________________________________________

OUTaX executes several times the OUTa function (refer to it). The absolute value of the X-register specifies the number of OUTas.to be performed.

If flag 17 is clear, an "End-of-line indicator (CR and LF, decimal codes 13
and 10 ) is sent after each string.

If flag 17 is set the string is send several times without any other character.

INSTRUCTIONS FOR OUTaX

Put the string in the ALPHA register, the number of OUTAs to be performed inthe X-register, set or clear flag 17 (see above), then execute OUTaX.

EXEMPLE

To display a line of 16 "-*" strings in "inverse video" on the HP82163 videointerface (which has to be the primary device), use the following sequence
:

"-*" SF 17 16 OUTaX
=0C- Recall primary device address -=09RCLSEL

__________________________________________________________________

RCLSEL (ReCaLl SELected address) returns in the X-register, after

stack liftif it is enabled, the HP-IL address of the primary device. This address is
an integer number. The RCLSEL function also checks the loop integrity (for device with a standby mode it has the same effect as the PWRUP function, refer to the HP82160A HPIL ROM manuel). There is a difference between the "EXTENDED I/O ROM" RCLSEL function and the "PANAME ROM" one : The "PANAME ROM" RCLSEL function can return a value, which is different from the last address specified by the SELECT function .This happens when the SELECT function has been executed with an address greater than the number of devices on the loop ;in this case the address returned by RCLSEL is 1. This caracteristic is usefull in programs with a routine executed once for every device on the loop.
A test between the SELECT address and the address returned by RCLSEL will check if all devices have been tested. Refer to the programs LOOP in the Example section of AID and ID, and FNDAIDN in the Example section of FINDAID, to
see how this method is used.

INSTRUCTIONS FOR RCLSEL

Execute RCLSEL ; an integer number, which represents the address of the primary device is returnrd to the X-register as specified above.

EXAMPLE

RCLSEL can be used to saved the primary device selection at the beginning ofa program, which might modify it, and to restore it upon program termination. Use RCLSEL STO=FFnn at the beginning and RCL=FFnn SELECT at the end.
=0C82163 FUNCTIONS GROUP





This group of functions will make the HP 826163 video easier to use. A full
control of the video interface is possible without escape sequences or control characters. For instance to clear the screen or to move the cursor down,
CLEAR and CRSDN (CuRSor DowN) are used.

For all these functions the primary device must be the video interface. For
the different ways to select a device refer to the functions FINDAID (in this manuel) and FINDID (in the HPIL ROM HP82160A owners manual).

In AUTOIO mode, if the primary device has a device identity other than 48 (standard video interface) an AID ERR error message is displayed.

However in MANIO mode, this error checking is not performed. So one can use
these functions with video interfaces, such as the Mountain Computer MC00701A (AID 50), PAC-TEXT (AID=FF48)????, or KRISTAL(*) MINITEL interface (AID 48).

For further informations on escape sequences, refer to Appendix V.





















* KRISTAL, Chemin des Clos Zirst 38240 MEYLAN (FRANCE), is an HP ICC.
=0C- Clear the display -=09CLEAR

__________________________________________________________________

CLEAR clears the display, sets the cursor to position (0,0) and selects the
replacement cursor.(*)

INSTRUCTIONS FOR CLEAR

Execute CLEAR.

EXAMPLE

ESC E, which is sent by the function CLEAR, is the reset sequence of the HP82905B printer. So CLEAR can be used to reinitialize this printer, but it must be performed in MANIO mode because the Accessory identity of the HP 82905Bis 33.




- Clear the display from the cursor -=09CLEARO

__________________________________________________________________

CLEARO clears the display, starting from the cursor and down to the end of the display. Cursor type and position are unchanged.

INSTRUCTIONS FOR CLEARO

Execute CLEARO.

(*) This is not true for every non-HP video interface.
=0C- Move cursor down -=09CSRDN

__________________________________________________________________

CSRDN (CurSoR DowN) moves the cursor one position down. If the cursor is on
the bottom line of the display, the cursor is not moved.



- Move cursor Horizontally by X -=09CSRHX

__________________________________________________________________

CSRHX (move CurSoR Horizontaly by X) moves the cursor horizontally. The absolute value of X specifies the number of characters of the move and its sign
the direction: - For X<0, CSRHX performs (-X) CSRLs ( moves the cursor left
by (-X) characters). - For X>=3D0, CSRHX performs X CSRRs ( moves the cursorright by X characters). For instance -1 CSRHX is equivalent to CSRL and 1 CSRHX is equivalent to CSRR.

INSTRUCTIONS FOR CSRHX

Put in X the number corresponding to the desired move, then execute CSRHX.



- Move the cursor to the left -=09CSRL

__________________________________________________________________

CSRL (CurSoR Left) moves the cursor one position to the left. If the cursor
is at position (0,0), it is not moved.



- Suppress the cursor -=09CSROFF

__________________________________________________________________

CSROFF (CurSoR OFF) suppresses the cursor. The cursor is not visible until the next execution of CLEAR or CSRON or the next interface initialization (Power on or HPIL message -DCL- or -SDC-).



- Display the cursor -=09CSRON

__________________________________________________________________

CSRON (CurSoR ON) switches the cursor on. It can be swiched off using CSROFF..



=0C- Move the cursor to the right -=09CSRR

__________________________________________________________________

CSRR (CurSoR Right) moves the cursor one position to the right. If the cursor is at the end of a line, the cursor is sent to the beginning of the next line, except if it is at the end of the last line, in which case it is not moved.



- Move the cursor down according to X -=09CSRVX

__________________________________________________________________

CSRVX (move CurSoR Vertically by X) move the cursor vertically.The absolute
value of X specifies the number of lines of the move and its sign the direction : - For X<0, CSRVX performs (-X) CSRUPs ( moves the cursor up by (-=FFX)lines). - For X>=3D0, CSRVX performs X CSRDNs (Moves the cursor down by X lines).

INSTRUCTIONS FOR CSRVX

Put in X, the number corresponding to the desired move, then execute CSRVX.



- Move the cursor up -=09CSRUP

__________________________________________________________________

CSRUP (CurSoR UP) moves the cursor one position up. If the cursor is on the
first line of the display, it is not moved.

- Select the type of cursor -=09CTYPE

__________________________________________________________________

CTYPE (Cursor TYPE) selects the type of cursor acording to the value of X :

- For X=3D0, selects the "insertion" cursor (blinking arrow) ;

- For X=3D1 or -1, selects the "replacment" cursor (blinking block).

INSTRUCTIONS FOR CTYPE

Put in X the value specifing the desired type of cursor and execute CTYPE. Beware that when using the Video interface =09Mountain Computer MC00701A, theselection of the insertion cursor (Blinking underline) selects neither "character insertion" mode nor "line insertion" mode.

- Put the cursor at the upper left position of the display -=09HOME

__________________________________________________________________

HOME moves the cursor to position (0,0).

- Scroll the display down -=09SCRLDN

__________________________________________________________________


SCRLDN (SCRolL DowN) scroll the display on line down. (So the bottom line disappears and a new line appears at the display top.)

- Scroll the display one line up -=09SCRLUP

__________________________________________________________________


SCRLUP (SCRolL UP) scroll up the display by one line. (So the top line of the display disappears and a new line appears at the bottom of the screen.)

- Scroll the display acording to X -=09SCRLX

__________________________________________________________________


SCRLX (SCRolL as specified by X) the display is scroll according to X. The absolute value of X specifies the number of lines of the scroll, and its signthe direction.

- For X<0 SCRLX performs (-X) SCRLUPs. (Scrolls the display up by (-X) lines..)

- For X>=3D0, SCRLX performs X SCRLDNs. (Scrolls the display down by X lines..)

INSTRUCTIONS FOR SCRLX

Put in X, the number corresponding to the desired scrolling, and execute SCRLX.

- Move the cursor to position (X,Y) -=09XYTAB

__________________________________________________________________


XYTAB ((X,Y) TABulate) moves the cursor to position (x,y), The column numberis specified by the absolute value of X and the line number by that of Y.

INSTRUCTIONS FOR XYTAB

Put in X the column number, in Y the line number and execute XYTAB.
=0CAppendice V





Sequences sent to the primary device by the HP82163 FCNS group.


"ESC" represents the escape character, decimal code 27.




Fonction(s) Sequence Characters codes

CLEAR ESC E 27 69
CLEARO ESC J 27 74
CSRDN, CSRVX for X>=3D0 ESC B 27 66
CSRL, CSRHX for X<0 BS 08
CSROFF ESC < 27 60
CSRON ESC > 27 62
CSRR, CSRHX for X>=3D0 ESC C 27 67
CSRUP, CSRVX for X<0 ESC A 27 65
CTYPE for X=3D0 ESC Q 27 81
CTYPE for X=3D1 or -1 ESC R 27 82
HOME ESC H 27 72
SCRLDN, SCRLX for X>=3D0 ESC T 27 84
SCRLUP, SCRLX for X<0 ESC S 27 83
XYTAB ESC % {c} {l} 27 37 col ln
=0C82162 FUNCTIONS GROUP=20





This group of functions makes easier the operation of the HP82162A Thermal Printer. You will be able to use every features of this printer, even the onenot described in the manual.

These features are :

- Two different sets of characters ;

- A "parse" mode ;

- A absolute dot-level tabulation function, independent from any data yet inthe printer buffer ;

- The possibility to obtain status information from the printer.

These functions work on the first HP82162A printer on the loop starting fromthe primary device. If no HP82162A printer

is found on the loop, the error
message "NO 82162" is displayed. The STATUS function of the "PANAME ROM" is
the only exception to this rule; refer to this function for futher details.
=0C- Select "8 bit mode" -=098BIT

__________________________________________________________________

8BIT selects "8 bit mode", which validates the HP41 character set. This modeis automatically selected when a specific printer function is used. (One ofthe -PRINTER 2E functions of the HP-IL rom.) This function is usefull only
if the HP82162A printer is used with non-specific printer functions, such asOUTA or OUTYBX.



- Select "Escape" mode -=09ESCAPE

__________________________________________________________________

ESCAPE selects the "escape" mode, which activates the ASCII (not-HP41) character set . In this mode, you cannot use specific printing functions to send
characters to the printer because they automatically select the "8 bits mode". However some applications may requiered the use of the ASCII character set. The ESCAPE function enables the utilsation of this set, but printing mustbe done with the OUTA function, or related functions, which only send characters to the primary device. Beware that in this case, the primary device must be the printer, even though this is not necessary with specific printer functions such as PRA.



-Select "Line feed on space" mode -=09PARSE

__________________________________________________________________

PARSE selects parse mode, which enables automatic word-wrap at the end of the lines. A line feed is performed by the printer on the space, when the nextword cannot be printed completely on the current line.=20



- Clear the buffer -=09CLBUF

__________________________________________________________________

CLBUF returns the printer to power on status :



- The printer head is at the right ;

- The printer buffer is empty ;

- selected modes are : "escape", single width, uppercase letters, left justification, line-feed on the 24th character.

This function is mainly used to clear the printer buffer of any data, it is
the only way to do it.



- select the "line-feed on the 24th character mode" -=09UNPARSE

__________________________________________________________________

UNPARSE disables the special mode selected by UNPARSE.



- Column tabulation - =09TABCOL
__________________________________________________________________

TABCOL enables an absolute tabulation on the dot level as opposed to SKYCOL,which permits a relative tabulation.

Using TABCOL, it is easy to print a output with several columns (Only two columns with FMT !).

INSTRUCTION FOR TABCOL

Put the column number (0 to 167) in X and execute TABCOL.

EXEMPLE

To print the following chart :


A=3D 123.00 FF
B=3D 23.95 FS
C=3D 1115.70 FB


You can use the following sequence :

FIX 2 CLBUF "A=3D" ACA 28 TABCOL 123 ACX TABCOL "FF" ACA PRBUF
"B=3D" ACA 28 TABCOL 23.95 ACX 91 TABCOL "FS" ACA PRBUF
"C=3D" ACA 28 TABCOL 1115.7 ACX 91 TABCOL "FB" ACA
PRBUF
=0C82905 Functions Group





These group of functions will make the HP82905B 80-column printer much easier to use. Thanks to them you can completly control the printer without knowing escape sequences or control characters normally needed to perform a specific task. These functions permits an easier writing or reading of programs using the various modes of the HP82905B.

For all these functions the printer must be the primary device. Refer to FINDAID (in this manuel) or to FINDID (in the HP82160A HPIL ROM manual) to findhow to select a given device.

In AUTOIO mode, if the primary device does not have an AID of 33, the error
message AID ERR is displayed.

However, this check is not performed in MANIO mode. So they can be used withother printers using the same escape sequences or control characters.

For more informations on sequences sent by these functions, refer to Appendix P.
=0C- Beep signal - =09BELL

__________________________________________________________________

BELL rings the "bell" of the printer for one second. This function can be used to call the attention.of the user



- Character set selection - =09CHARSET

__________________________________________________________________

CHARSET selects the primary character set if X=3D0, and the secondary one ifX=3D1. Refer to the HP82905B printer User's Manual for informations on bothcharacter sets.



- Form feed - =09FFEED

__________________________________________________________________

FFEED sends to the printer a "form feed" command, which sets the printer to
the top of the next page. Beware that you must position the paper correctly
and set the number of lines per page (using FORMLEN) prior to using FFEED.



- Page lenght - =09FORMLEN

__________________________________________________________________

FORMLEN defines the number of lines per page (It is related to the paper's physical form length and line spacing selected with VSPAC).

The absolute value of X indicates the number of lines, which must be in the
range 1-128. At power on or after reinitialization with the CLEAR function (refer to this function for futher information) the default line count is 66.



- Graphic output - =09GRAPHX

__________________________________________________________________

GRAPHX indicates to the printer that the next X bytes received are binary data, not characters, each value representing a dot column. Refer to the printer User's Manuel to find the relations between data sent and printer output
(Graphic mode paragraph).

The absolute value of X represents the number of bytes to be considered as graphic data.



=0C- Printing mode - =09MODE

__________________________________________________________________

MODE selects the printing mode according to the absolute value of X :

X value : Mode : Nb char./line :
0 Normal 80
1 Expand 40
2 Comprime 132
3 Bold-expand 66
9 Bold 80

You can mixed modes "0" and "1" or "2" and "3" ; other mixing give strange results.

If X has other values than "0", "1", "2", "3", or "9", the error message DATA ERROR is displayed.



- Cancel perforations skip - =09SKIPOFF

__________________________________________________________________

SKIPOFF cancels the SKIPON function.



- Set skip of perforation - =09SKIPON

__________________________________________________________________

SKIPON sets perforations skip mode on the printer. When this mode is on, theprinting of the last text line of a page generates a form feed : the paper
is set to the begining of thhe next page. (the number of text line per page
is selected with the TEXTLEN function). So nothing is printed on the perforations.

Perforations skip mode is off, at power on or after using the CLEAR function.. (Refer to this function for other informations).



- Text lenght - =09TEXTLEN

__________________________________________________________________

TEXTLEN sets the number of text line per page according to the absolute value of X. This number must be in the range 1 to the number of line per page (selected with FORMLEN ). At power on or with FORMLEN ). At power on or after
using the CLEAR function, the default lines number per page is 60.



=0C- Vertical space - =09VSPAC

__________________________________________________________________

VSPAC selects the vertical space in line per inch according to the absolute
value of X.

This number must be 6,8,9,12,18,24,36 or 72. Any other value will return DATA ERROR.
=0CAppendice P





Sequences send to the primary device by the 82905 FNCS group of functions.


- ESC represents the escape character, decimal code 27.
- {#} symbolises the ASCII representation of a number and {par} the related
character codes .


Fonction(s) Sequence Codes Thinkjet

BELL BEL 07
CHARSET for X=3D0 SI 15 Normal
CHARSET for X=3D1 or -1 SO 14 Bold
FFEED FF 12 FF
FORMLEN ESC &l {#} P 27 38 108 {par} FL
80
GRAPHX ESC *b {#} G 27 42 98 {par}
71
MODE ESC &k {#} S 27 38 107 {par}
83
0 Normal (80c/l)
1 expanded (40 c/l)
2 compressed(142 c/l)
3 expansed-compressed (71 c/l)
SKIPOFF ESC &l0L 27 38 108 48 76 skipoff
SKIPON ESC &l1L 27 38 108 49 76 skipon
TEXTLEN ESC &l {#} F 27 38 108 {par} textlen
70
VSPAC ESC &l {#} D 27 38 108 {par} vspac
68

=0CMINIPLOTTER





Several Miniplotters can be used with the HP-41. TANDY, CANON=FF... have thesame mecanics and the same command set. Of course, the miniplotter should be interfaced with the HP-IL loop with the HP82166A GP IO interface.

Several firms commercialize HP-IL interfaced miniplotters, or a converter and parrallel interface, which can be used with such miniplotters.

These

miniplotters main characteristics are :

- 4 colors . The printhead is in fact a set of 4 mini ball pen. The color can be changed, either by program or by a switch, during plotting.

- 11.4 cm paper, in roll. It is possible to draw, or plot on the lenght of the paper, so one can print large charts. refer to the exemple.

- Horizontally you can print 80 c/l.

- Of course, these miniplotters can be used with other HP-IL controlers suchas the HP-75, HP-85, HP-71. So these devices will not be outdated too quickly.
=0C- Axis drawing - =09AXIS
__________________________________________________________________

AXIS draws several kind of axis on the mini-plotter.

-\- -|-
-\- |
-\- |
-\- -|-
-\- |
-\- |
-\- -|-
-\- |
-\- |
-\--|-
-\-|
-\|
-\___|___|___|___|___|___|___|___|___|
| | | | | | | | | |



INSTRUCTIONS FOR AXIS

AXIS uses four parameters, which must be on the stack before executing the function:
T: half-lenght of a dash
Z: vertical distance between two dashes
Y: horizontal distance between two dashes
X: number of dashes

The axis is drawn from the current pen position, and the direction depends of the values in the Y and Z registers.
However, dashes are always either vertical or horizontal according to the axis inclination from the horizontal (X direction) : under 45 degres, dashes are vertical, over they are horizontal.


The parameter in T makes the drawing of charts easier. For instance with arrays.

Exemple : The following program draws a chart with 2 lines and C columns. Each column has a width of W and each line an height of H. To use it, only type XEQ'CHART' and answer the questions. (Input the value and R/S).



01 LBL "CHART"
02 "HP82166" GP-IO Converter identification.
03 FINDID Search the addres of the mini-plotter.
O4 SELECT Select the miniplotter.
05 RESET Reinitialization.
06 "Nb. COL. ?"
07 PROMPT Input the number of columns (C).
08 STO 00 R00=3D Number of columns.
09 "COL. WIDTH ?"
10 PROMPT Input the columns width.
11 STO 01 R01=3D Columns width.
12 * First chart dimension.
13 "HT. LINE ?"
14 PROMPT Input the line height.
15 STO 02 R02=3D Height of each line.
16 ST+ X There are 2 lines, the 2nd dimension is 2*X.
17 CHS The displacement will be down !
18 X<>Y
19 0
20 ENTER^
21 BOX BOX uses the 4 parameters T, Z, Y and X.
22 RCL 02
23 CHS
24 0
25 *MOVE Starting position.
26 RCL 02
27 0
28 RCL 01
29 RCL 00
30 AXIS Drawing of inside lines.
31 END

XEQ "CHART"
Nb. COL. ? Will print:
4.0000 RUN
COL. WIDTH ?
100.0000 RUN
HT. LINE ?
50.0000 RUN
=0C- Writing direction in graphic mode - =09*LDIR
__________________________________________________________________

*LDIR specifies the writing direction for *LABEL. There are four possibilities :

0 to the right, 1 down, 2 to the left, 3 up.



- Line Type - =09*LTYPE
__________________________________________________________________


*LTYPE (*Line TYPE) specifies one of the 16th possible line types of the miniplotter.

The value of the X-register is considered modulo 16. The line type will be used with the DRAW and RDRAW functions.



- Move pen up - =09*MOVE
__________________________________________________________________

*MOVE moves the pen, without plotting, to the (X,Y) coordinates.



- Broken line plotting - =09*PLREGX
__________________________________________________________________

*PLREGX (PLot REGisters by X) joins the points, which coordinates are specified by successive registers.

The X-register contains a bbb,eee pointer; the integer part (bbb) specifies
the register storing the first coordinate of the first point, the fractionalpart (eee) specifies the register storing the second coordinate of the lastpoint. If in the succession of data the calculator finds oneor several ALPHA strings the pen go to the next cordinate (numeric data) without plotting (*MOVE), there it resumes plotting (DRAW).



- Relative Drawing - =09RDRAW
__________________________________________________________________

RDRAW (Relative DRAWing) draws a line up to the position (x,y) relative to the current position of the pen.



- Reinitialization - =09RESET
__________________________________________________________________

RESET moves the pen to the left margin and selects Text mode.



- Reverse line feed - =09REVLF
__________________________________________________________________

REVLF (REVerse Line Feed) moves the pen one line upward.



- Reverse line feed by X - =09REVLFX
__________________________________________________________________

REVLFX (REVerse Line Feed by X) moves the pen upward of the number of lines
specifies by the absolute value of the X-register.



- Relative MOVEment - =09RMOVE
__________________________________________________________________

RMOVE (Reltive MOVEment) moves to the (x,y) position relative to the currentpen position.



- Set origin - =09SETORG
__________________________________________________________________

SETORG (SET ORiGin) sets the current pen position has the origin (0,0).

=0C- BACKSPACE - =09BACKSP
__________________________________________________________________

BACKSP moves the pen one character backward.



- BACKSPACE BY X - =09BACKSPX
__________________________________________________________________

BACKSPX moves the pen backward by the number of characters specified by the
absolute value of the integer part of the X-register.



- Box drawing - =09BOX
__________________________________________________________________

BOX draws a rectangle, which 2 opposite angles have the coordinates :

(x1,y1) and (x2,y2), with T=3Dy2, Z=3Dx2, Y=3Dy1, X=3Dx1.



- Color selection - =09*COLOR
__________________________________________________________________

*COLOR selects one of the four colors according to the value of the X-register.



- Character size - =09*CSIZE
__________________________________________________________________

*CSIZE (Character SIZE) selects the character size. The value of the X-register must be in the range 0-63.



- Draw a segment - =09*DRAW
__________________________________________________________________

*DRAW draws a line segment from the current pen position to the (X,Y) coordinates.



- Send pen to origin - =09*HOME
__________________________________________________________________

*HOME sends pen to (0,0) coordinates.



=0C- Print the ALPHA register - =09*LABEL
__________________________________________________________________

*LABEL prints the ALPHA register. This function is useful because the drawing can be done in four directions in text mode: these four directions are specified with the *LDIR function.

=0C- Recall printer status - =09STATUS
__________________________________________________________________

STATUS returns to the Y-register an integer, which specifies the printer first status bit, and in the X-register an integer, which specifies the printer second status bit. The effect of STATUS on the stack depends whether stacklift is enable or not when the function is performed :

- If stack lift is enable :

Before After

T: t T: y
Z: z Z: x
Y: y Y: 1st status bit
X: x X: 2nd status bit

- If stack lift is not enable:

Before After

T:t T: z
Z: z Z: y
Y: y Y: 1st status bit
X: x X: 2nd status bit

However, the LASTX-register is not modified.

The STATUS function has a specific characteristic : in MANIO mode, it returns to the X and Y registers two numbers, which specifies the primary device status.

- If the primary device has no status bits, STATUS returns 97 to the X and Yregisters;

- If the primary device has only one status bit, STATUS returns the decimalrepresentation of this bit to Y register, and returns 64 to the X-register;

- If the primary device has, at least, two status bits, STATUS works with the primary device, as with the HP82162A printer in AUTOIO mode.
Status bits after the second one are ignored.

To know the number, and definition of the status bits of a device, refer to
the description of the HP-IL message "SEND STATUS" in the device manual.

The S1 appendix gives the detailed definition of the two status bits of the
HP82162A printer.
=0CAPPENDICE T2



Minimum function set needed to use a 4 color mini-plotter with the PLOT FCNSfunctions group.

Refer to JPC n15 june 1984 for a description of the mini-plotter.

Representation convention :

- # represents a numeric character string, eventually with a sign and no more than 4 digits (For instance : -230; 0024);

The syntax column specifies the signification of each parameters;

Control characters (Decimal values) :

17: Select TEXT mode
18: Select "GRAPH" mode
11: Reverse line feed (Text mode only)
08: Backspace (Text mode only)

GRAPHIC mode instructions

Syntaxe Format Action

A A Initialization
H H Home (Position (0,0))
Mx,y M#,# Move to position (x,y)
Dx,y D#,# Drawing

to position (x,y)
Rx,y R#,# Relative move of (x,y)
Jx,y J#,# Relative drawing of (x,y)
Pstring Pstring Printing of the characters string "string"
Lx L# Select line type x
Cx C# Select pen x (Change color)
Sx S# Select character size x
Qx Q# Select printing direction x (For P=FFinstruction only).

GRAPHIC mode functions

The mini-plotter instructions, which correspond to these functions, need the Graphic mode. So these functions set Graphic mode before executing the operation, and leave the mini-plotter in this mode after execution.

Unspecific mode functions

These mini-plotter instructions must be executed in Graphic mode. So these functions set Graphic mode before executing the instruction. However these functions are oftenly used in Text mode. The user can control in which mode the mini-plotter is left after execution.
=0CUTILITIES





This functions group has a wide range of applications :

- Character string manipulation :

- Manipulation of numeric and alphanumeric arrays (one or two dimensions :

- Numeric or alphanumeric sorting ;

- Extended memory management (HP822180A XFUNCTIONS and HP822181A XMEMORY) ;

-=FFWide range of other applications...!
=0C- Euclidian division -=09/MOD
__________________________________________________________________

/MOD (Divide MOD) calculates the modulo and the quotient of an Euclidian division, that is to say with integers. It is an extension of the [MOD] function of catalog 3.

EXEMPLE

- Calculation of the modulo and quotient of the division of 13 by 3.

Input Display

13 13_ Dividend input.
[ENTER^] 3 3_ Divisor input.
[XEQ] "/MOD" 1,0000 Modulo.
[X<>Y] 4,0000 Division quotient.
[LASTX] 3,0000 The divisor is saved in the L-register.

INSTRUCTIONS FOR /MOD

1) To calculate the modulo and quotient of the division of Y by X.

2) [XEQ] "/MOD". The quotient and modulo of the division are return respectively to the Y and X registers. The divisor is saved in the L-register, the dividend is lost. T and Z registers are unchanged.

3) If the X-register contains 0, the calculator displays DATA ERROR.

STACK

Input: Output:

T: t T: t
Z: z Z: z
Y: Dividend Y: quotient
X: Divisor X: Modulo
L:l L: Divisor

Application programs for /MOD

1) A fairly quick way to calculate the decimals of the division of A by B when A<B and the last digit of B is 9 :

LBL "DIV9" 10 / INT 1 + STO 01 RDN SF 21 LBL 01 RCL 01 /MOD VIEWY 10 * + GTO 01 END

So to divide 153 by 209

153/209=3D0,732057...

2) [/MOD] can be used in a short subprogram as a small base conversion ! This short program, "YBX", gives the digits of the new number; but in reverse.
X and Y must be integers.

For instance 1103 [ENTER^] 8 [XEQ] "YBX" returns 7 [R/S] 1 [R/S] 1 [R/S] 2 [R/S] 0. That means : 1103 (DEC) =3D 2117 (OCT). This results can be check with the DEC and OCT functions.

N.B : If it is possible to get the divisor back with X<>Y LASTX * + for aquotient >0 and with X<>Y X<0? DSE X NOP * LASTX * + for a quotient<0, it is impossible for a quotient equal to 0.
=0C- ADRRESS LINE COLUMN -=09AD-LC
__________________________________________________________________

AD-LC returns the coordinates (line,column) of an array element from its address (Rnn) and the array pointer.

Exemple : Calculate the coordinates of register 36 in the array A (Below), which array pointer 25,04405 is in R00. R25=3D first array element, R44=3D last aray element.

column n=F81 n=F82 n=F83 n=F84 n=F85
_____ _____ _____ _____ _____
| R25 | R26 | R27 | R28 | R29 |
line n=F81 |_____|_____|_____|_____|_____|
| R30 | R31 | R32 | R33 | R34 |
line n=F82 |_____|_____|_____|_____|_____|
| R35 | R36 | R37 | R38 | R39 | ARRAY A
line n=F83 |_____|_____|_____|_____|_____|
| R40 | R41 | R42 | R43 | R44 |
line n=F84 |_____|_____|_____|_____|_____|

Input : Display :
36 [ENTER^] 36,0000 Input register n=F8 .
[RCL] 00 25,04405 Recall the array pointer.
[XEQ] "AD-LC" 2,00000 Column n=F82.
[RDN] 3,00000 Line n=F83.
[LAST X] 25,04405 The pointer is saved in L.

- INSTRUCTIONS FOR AD-LC

To get the line,column coordinates of an array element when you know the array pointer and the register address of this element : Input the register number, [ENTER^], array pointer, [XEQ] "AD-LC". The column number is returned in the X-register and the line number in the Y-register. The array pointer issaved in L, registers Z and T are unchanged.

STACK

Input : Output :
T: t T: t
Z: z Z: z
Y: Register n=F8 Y: line n=F8=20
X: Array pointer X: Column n=F8=20
L: L L: Array pointer

NOTA : This function does not check if the register is part of the array.
If registers X or Y contains an Alpha string, ALPHA DATA is displayed.

=0C - Alpha LENGth -=09ALENG
__________________________________________________________________

[ALENG] returns to the X-register the length of the current string in the ALPHA register.

Example 1: In a program, the HP-41 stops and waits for an ALPHA input.
The string length is needed to store the string in several registers. An other solution is the RGAX function which is described in this manual.


Instruction for ALENG

Place in ALPHA the string, [ALENG] returns in the X-register the string length and the stack is lift, if it is enable.

THE STACK

Input: Output:

T: t T: z
Z: z Z: y
Y: y Y: x
X: x X: String length.

L: l L: l


Application program for ALENG.

Exemple 2 : The following routine capitalizes any lowercase letters found inthe ALPHA register. It uses [ALENG] to provide a loop counter equal initially to the number of caracters in the string (which must not contain null characters).

01 LBL "CAP"
02 ALENG counts characters in ALPHA register.
03 LBL 00
04 ATOXL Places codes of leading characters into X.
05 97 The lower case letters are in the range 97 to 122.
06 X>Y?
07 GTO 01
08 CLX
09 122
10 X<Y?
11 GTO 01 If not lower case character, go to [LBL] 01
12 CLX The character codes for upper case letters=20
13 32 are determined by substracting 32 from their
14 - lower case counterparts.
15 R^
16 LBL 01
17 RDN
18 XTOAR restores capitalized letter to ALPHA.
19 RDN
20 DSE X
21 GTO 00 branches if their is characters remaining.
22 AON
23 .END.
=0C- Search number in ALPHA - =09ANUM
__________________________________________________________________

[ANUM] (Alpha to NUMber) searches the ALPHA register, from left to right, for a number. The first number found is returned to the X-register.

Exemple : The ALPHA register contains the string : "PRICE: 1.234,50" read from an extended memory ASCII file. To extract the numeric value for futher use: [XEQ] "ANUM" and the number is returned to the X-register.

INSTRUCTIONS FOR ANUM

1) The ANUM function searches a numeric value in the ALPHA register string.
If a number is found, it is returned to the X-register and flag 22 is set. If a number is not found, the X-register and flag 22 are unchanged.

2) Numbers in the ALPHA register are considered according to the status of flags 28 and 29. If a number in the ALPHA register has a "-" sign, a negativenumber is returned to the X-register, when the function is executed. Suppose that the ALPHA register contains the exemple 1 string :


____________ ____________ ____________
| Flag | Flag | Display |
| 28 | 29 | |
|____________|____________|____________|
| set | set | 1,234.5000 |
|____________|____________|____________|
| set | clear | 1,0000 |
|____________|____________|____________|
| clear | set | 1,2345 |
|____________|____________|____________|
| clear | clear | 1,2340 |
|____________|____________|____________|

STACK

Input : Output :
T: t T: z
Z: z Z: y
Y: y Y: x
X: x X: number found in ALPHA.

L: l L: l


=1A=0C-Search ALPHA number and delete -=09ANUMDEL

__________________________________________________________________

ANUMDEL searches the current string in the ALPHA register, form left to right, for a number (represented in numerals) and returns to the X-register the
value of the number. It also deletes all characters in the string from the start of the string to the last numerical character used.

Exemple 1 : Suppose that the ALPHA register contains the string "PRICE: $1,234.5XYZ", to extract the numeric value for futher use, [XEQ] "ANUMDEL" puts
this number in the X-register; The ALPHA string is deleted up to "5" included.

INSTRUCTIONS

FOR ANUMDEL

1) ANUMDEL searches a numeric value in the string in the ALPHA register. If
a number is found, it is put in the X-register and the string is deleted up
to the last numerical character of the number.

2) If the ALPHA string contains more than one number separated by non-numeric characters, ANUMDEL uses only the first number. ANUMDEL is identical in operation to the ANUM function, except that the ANUM function does not alter the string. The HP-41 considers execution of ANUMDEL as a numeric entry, and
sets flag 22, if a number is returned to the X-register. If the ALPHA stringcontains no numeric characters, ANUMDEL clears the ALPHA register but has no effect on the stack.

3) The characters "+", "-", ".", ",", "E" (for exponent) are interpreted by
ANUMDEL as numeric or non-numeric characters according to their context in the ALPHA string. An isolated "+", is not treated as a numeric character. A "+" or "-" symbol immediately preceding, embedded in, or following a sequenceof number digits will be interpreted exactly as if the symbols and numbers
had been keyed into the X-register (with [CHS] representing "-" and [CHS][CHS] representing "+".) For instance, ANUMDEL returns the value -3425 if executed when the ALPHA register contains the string "34-2+5".

The status of the numeric display control flags (flags 28 and 29) determineshow the Alpha string is interpreted by ANUMDEL. For example, if both, flag
28 and flag 29 are set, commas are treated as digit separators. But commas are considered as non-numeric if flag 28 is set and flag 29 is clear. Supposethat the Alpha register contains the exemple 1 : "PRICE: $1,234.5XYZ". Set
FIX 4 and execute ANUMDEL; the following table shows the result according tothe setting of flags 28 and 29.

________________________________________________________=20
| Flag 28 | Flag 29 | X-Register | Modified Alpha String |=20
________________________________________________________
| set | set | 1,234.5000 | XYZ |
________________________________________________________
| set | clear | 1,0000 | ,234.5XYZ |
________________________________________________________
| clear | set | 1,2345 | XYZ |=20
________________________________________________________
| clear | clear | 1,2340 | .5XYZ |=20
|________________________________________________________|=20


=0CSTACK =20

Input : Output :=20

T: t T: z=20
Z: z Z: y=20
Y: y Y: x=20
X: x X: First numeric value found in ALPHA.=20

L: l L: l=20

Application program for ANUMDEL=20

Example 2 : The HP 7470A Graphics Plotter can send on HP-IL an ASCII character string that describes the current pen position. The string contains three integer numbers separated by commas : X,Y,P. X is the pen's x-coordinate;
Y is the pen's y-coordinate; P has a value of 1 if the pen is down, or 0 ifthe pen is up.
Suppose that the plotter has sent the string "123,456,1" to the HP-41's ALPHA register. You could use the following keystrokes to decipher the string
:=20

Keystrokes Display=20

[SF 28] Ensures that a comma is not interpreted as a radix.=20
[ANUMDEL] 123.0000 X-coordinate.=20
[ANUMDEL] 456.0000 Y-coordinate.=20
[ANUMDEL] 1.0000 Pen is down.=20

Exemple 3 : ALPHA has the string "34/-2/5"=20

[CF 28]=20
[ANUMDEL] 34.0000=20
[ALPHA] /-2/5=20
[ALPHA][ANUMDEL] -2.0000=20
[ALPHA] /5=20
[ALPHA][ANUMDEL] 5.0000=20

This example shows that "/" and "*" are neither considered as "+", nor as "-", nor as ".".
=0C- Append the integer part of X to ALPHA - =09APPX

__________________________________________________________________

APPX (APPend X) appends the integer part of the X-register to the left of the ALPHA register string.

Exemple : The result of an area calculation is in the X-register: 1,225.7 ,
and the message "AREA: " is in the ALPHA register, the APPX function appendsthe X-register value after the message, without integer part rounding: ALPHA =3D "AREA: 1,225"

INSTRUCTIONS FOR APPX

1) [APPX] appends the integer part of the X-register to the left of the ALPHA register. [APPX] results depends on flags 28 and 29. The number is writtenhas in FIX 0 mode, except that the decimal separator is not appended, and the number is not rounded. As for [ARCL] [APPX] does not beep, when its execution overflows the ALPHA register capacity.

2) If at the execution of [APPX], the X-register contains an alpha string, ALPHA DATA is displayed.
=0C- ALPHA Rotation - =09AROT
__________________________________________________________________

AROT (Alpha ROTate) rotates the ALPHA register string of the number of characters specified by the X-register.

Exemple : The ALPHA register contains the string "AROT". To display "TARO" then "ROTA".

Input : Display :

[ALPHA] AROT AROT_
[ALPHA] 1 [CHS] -1_
[XEQ] "AROT" [ALPHA] TARO
[ALPHA] 2 2_
[XEQ] "AROT" [ALPHA] ROTA=20


INSTRUCTIONS FOR AROT

[AROT] rotates the ALPHA register string of the number of characters specified by the value, modulo 24, of the X-register. The rotation is done to the left, if the X-register contains a positive number, and to the right if it isnegative. (Cf. refer to the annex for futher information on the effect of [AROT] on null characters).
The execution of [AROT] does not modified the stack.


APPLICATION PROGRAMS FOR AROT

1) The [AROT] function can be used with the [ANUM] and [POSA] functions to get the number of repetition of a given string, or character, in the ALPHA register without destruction.

An operation on a device returns to the ALPHA register the following string
"68.2 69.88" (a number, a space, a number). To extract separately two numbers to use then in a program, the following sequence can be used :


Input : Display :

[CF] 28
[XEQ] "ANUM" 68.2000 Return the first number to the X-register.
[STO] 20 68.2000 Store for futur use.
32 32_ Space code.
[XEQ] "XTOAR" 32.0000 Add a space to the right of the ALPHA string.
[XEQ] "POSA" 4.0000 Search the first space in the ALPHA register.
[XEQ] "AROT" 4.0000 Rotate the string; ALPHA contains 69.88 68..2;
Without a space ALPHA would contain 69.8868.2.
[XEQ] "ANUM" 69.8800 Return 69.88 to the X-register. =20
=0C- Character transfer between ALPHA and X=20


- Transfer leftmost character of ALPHA to X -=09ATOXL

__________________________________________________________________

[ATOXL] (Alpha-TO-X Left) deletes the first character of ALPHA and returns its decimal code to the X-register.

- Transfer rightmost character of ALPHA to X -=09ATOXR

__________________________________________________________________

[ATOXR] (Alpha-TO-X Right) deletes the last character of ALPHA and returns its decimal code to the X-register.

- Transfer specified character of ALPHA to X -=09ATOXX

__________________________________________________________________

[ATOXX] (Alpha-TO-X by X) returns to the X-register the character of ALPHA specified by the value of the X-register. The ALPHA register is unmodified.


INSTRUCTIONS FOR ATOXL, ATOXR, ATOXX

1) [ATOXL] deletes the leftmost character of the ALPHA register string and returns its decimal code to the X-register. If the first character is followed by one, or several, null characters, the string is moved, to the left, up
to the first non null character. If the ALPHA register is empty, [ATOXL] returns -1 to the X-register.

2) [ATOXR] deletes the rightmost character of the ALPHA register string, andreturns its decimal code to the X-register. If the ALPHA register is empty,-1 is returned to the X-register.

3) [ATOXX] returns to the X-register the decimal code of the character, which position in the string, is specified in the X-register. The ALPHA registeris unmodified.

A positive value in the X-register specifies a position in the ALPHA register string, starting form the first no null character at the right. This firstcharacter is in position 0. This convention is the one used for the POSA function in the XFUNCTION rom.

On the contrary, a negative number specifies an absolute position in the ALPHA register, it is independant from the string. Positions are considered from right to left, -1 for the rightmost position and -24 for the left most position. The following chart illustrates the [ATOXX] interpretation of the character positions.
=0C______________________________________________________________________=20
| Character position | character |
|________________________________________|_____________________________|
| n > 23 ou r >=3D string lenght | DATA ERROR |
| 0 <=3D n < string lenght | Nth character after the |
| | leftmost |
| n =3D 0 | Fist character starting |
| | from the left |
| -24 <=3D n < 0 | Nth character starting |
| | from the right and up to |
| | the register end |
| n < -24 | DATA ERROR |
|________________________________________|_____________________________|


If the

X-register contains an Alpha string ,ALPHA DATA is displayed.


Exemple :

In this exemple, the ALPHA register is completly represented, null characters at the left of the register are represented with horizontal marks , but they cannot be displayed by the calculator.

Input : Display
[ALPHA] DECAMETRE [ALPHA] DECAMETRE
0 [XEQ] "ATOXX" 68.0000 Code of "D"
4 [XEQ] "ATOXX" 77.0000 Code of "M"
6 [CHS] [XEQ] "ATOXX" 65.0000 Code of "A"
10 [CHS] [XEQ] "ATOXX" 0.0000 Null character

=0C- Build a pointer -=09BLDPT
__________________________________________________________________

[BLDPT] (BuiLD PoinTer) builds a pointer bbb.eeeii if X>0 or an array pointer if X<0.

Exemple 1 : A program has left in the Z-register the number of the first register of a set of data, in the Y-register the number of the last register ofthe set, and in the X-register the number of registers between two data. Z=3D25 Y=3D40 X=3D5

To calculate the pointer: [XEQ] "BLDPT", [FIX] 5. X=3D 25.04005 will give the address of R25, R30, R35, R40.

Exemple 2 : A previous program has left, in the Z-register the first register nb of an array, in the Y-register the number of lines, in the X-register the number of columns : Z=3D25 Y=3D4 X=3D5.
To get the array pointer, [CHS] [XEQ] "BLDPT", X=3D25.04405

column n=F81 n=F82 n=F83 n=F84 n=F85
_____ _____ _____ _____ _____=20
| R25 | R26 | R27 | R28 | R29 |
line n=F81 |_____|_____|_____|_____|_____|
| R30 | R31 | R32 | R33 | R34 |
line n=F82 |_____|_____|_____|_____|_____|
| R35 | R36 | R37 | R38 | R39 | ARRAY A
line n=F83 |_____|_____|_____|_____|_____|
| R40 | R41 | R42 | R43 | R44 |
line n=F84 |_____|_____|_____|_____|_____| =20


INSTRUCTIONS FOR BLDPT

1) To build a bbb.eeeii pointer :

- Put bbb in the Z-register;
- Put eee in the Y-register;
- Put ii in the X-register;
- Execute [BLDPT].
=0C2) To build a bbb.eeecc array pointer; where bbb specifies the address ofthe first register used by the array, eee specifies the last register used
by the array and cc the number of columns :

- Put bbb in the Z-register;
- Put the number of lines lll of the array in the Y-register;
- Put the number of columns cc of the array in the X-register, with a negative sign;
- Execute [BLDPT].

NOTA : If either the X, Y, Z register contains an Alpha string, ALPHA DATA is displayed.
The pointer is build with the absolute values of bbb and eee.


STACK :
for X>0 For X<0

Input : Output : Input : Output :
T: t T: t T: t T: t
Z: bbb Z: t Z: bbb Z: t
Y: eee Y: t Y: lll Y: t
X: ii X: bbb.eeeii X: cc X: bbb.eeecc L: l
L: eee L: l L: lll =20
=0C- Break pointer - =09BRKPT
__________________________________________________________________

[BRKPT] (BReaK oinTer) breaks a bbb.eeeii pointer if X>0, or an array pointer if X<0.

EXEMPLES :

1) A program needs the elements of a bbb.eeeii pointer, where bbb is the first register of a set of data, eee is the last one and ii the number of valuebetween two data in the set.
X=3D 25.04005 specifies registers R25, R30, R35, R40 [XEQ] "BRKPT" returns Z=3D25, Y=3D40, X=3D5.

2) The array pointer is 25.04405, it specifies that the array begins at R25, ends at R44, and has 5 columns. The array number of lines is returned by :[CHS] [XEQ] "BRKPT". So Z=3D25 (1st register), Y=3D4 (number of lines), X=3D-5( number of columns).

column n=F81 n=F82 n=F83 n=F84 n=F85
_____ _____ _____ _____ _____
| R25 | R26 | R27 | R28 | R29 |
line n=F81 |_____|_____|_____|_____|_____|
| R30 | R31 | R32 | R33 | R34 |
line n=F82 |_____|_____|_____|_____|_____|
| R35 | R36 | R37 | R38 | R39 | ARRAY=20
line n=F83 |_____|_____|_____|_____|_____|
| R40 | R41 | R42 | R43 | R44 |
line n=F84 |_____|_____|_____|_____|_____|=20


INSTRUCTIONS FOR BRKPT

1) To break a bbb.eeeii pointer, where bbb, in the range 0-999, is the firstelement of a loop or a vector; where eee, in the same range, is the last element; and where ii is the increment. One must check that the number in the
X-register is positive, for instance with [XEQ] "ABS"; then [XEQ] "BRKPT" will return the integer part of the X-register to the Z-register, the first 3
digits of the decimal part to the Y-register, and the 4th and 5th digits ofthe decimal part to the Z-register.
The pointer is saved in LASTX.

2) To break a bbb.eeecc array pointer, where bbb is the register of the first element of the array, eee is its last register, and cc is the number of columns. One must check that the number in the X-register is negative, for instance with [ABS] [CHS]; then [XEQ] "BRKPT" returns the first register (bbb)
to the Z-register, the number of lines lll=3D(eee+1-bbb)/ccc to the Y-register, and the number of columns (cc) to the X-register.
The array pointer is saved in LASTX.
=0CNota : If there is an Alpha string in the X-register, ALPHA DATA is displayed.

STACK :
for X>0 For X<0
Input : Output : Input : Output :
T: t T: x T: t T: x
Z: z Z: bbb Z: z Z: bbb
Y: y Y: eee Y: y Y: ll
X: bbb.eeeii X: ii X: bbb.eeecc X: cc

L: l L: bbb.eeeii L: l L: bbb.eeecc where eee=3D(ll*|cc|)-1+bbb =20
=0C- Load flag set - =09CHFLAG

__________________________________________________________________

[CHFLAG] (CHarge FLAGs) sets the flag set that was current when the CHFLAG function was written in the program.

Exemple : At the begining of a program, you want to be in DEGree mode, 3 digits ENG and with the 5 first flags ( 0-4) set.

While in RUN mode (PRGM indicator off) initialize the calculator as needed,
then in PRGM mode [XEQ] "CHFLAG". It writes two lines in the program : the first line is CHFLAG, the second one is a 7 character string. When the program is executed the calculator is initialize to the needed state.

INSTRUCTIONS FOR CHFLAG

1) In RUN mode, initialize the calculator to the state needed by the program..

2) In PRGM mode, [XEQ] "CHFLAG" writes two lines, the first one is CHFLAG, the second one contains a seven character string, which represents the givenflag set. This string begins with a configuration indicator. If this string is destroyed or replaced by a wrong one, CHFLAG execution will halt program execution and CHFLAG ERR will be displayed.

STACK :

[CHFLAG] execution does not affect the stack.

N.B : The ALPHA register is not changes by [CHFLAG]. The character string represents a set of flags, it is not for the ALPHA register.

One must not put a test instruction before CHFLAG as ISG or X=3DY?.

Ex : FS? 01 If the flag is set

CHFLAG Reinitializes the calculator.

'-----' Initializsation string.

If the test is negative (Flag 01 clear) the ALPHA register is destroyed by the configuration string.

[CHFLAG] only saves flags 00 to 43.
=0CF00 to F10 : user's flags.

F11 : Automatic execution of current program, at power on; or after reading
one from mass memory.

F12 to F20 : External device commands.

F12 Double width.
F13 Lower case letters.
F15 F16 Printing mode of HP-IL printer.
0 0 Manuel
0 1 Normal
1 0 Trace
1 1 Trace and stack printing.

F16
F17 CR-LF ignored
F18
F19
F20
F21 Printing possible
F22 set by a numeric input.
F23 set by an alphanumeric input
F24 Out of range ignored.
F25 Error ignored
F26 Beep on
F27 User mode
F28 Decimal separator type.
F29 Three digit groups separator.
F31 DMY mode of TIME rom.
F32 MANIO mode on HP-IL rom.
F34 ADROFF mode on EXTENDED I/O.
F35 Auto start enable (AUTOSTART/DUPLICATION rom).
F36 to F39 Number of digits for FIX, SCI, ENG.
F40 and F41 Display mode.
F42 and F43 Angular mode.
=0C- Clear Increment -=09CLINC
__________________________________________________________________

[CLINC] (CLear INCrement) truncates the number in the X-register from the 4th digit of the decimal part.

Exemple : You want to know the first and last registers of an array.
The array pointer is saved in R00. Use the following sequence=FF:

Keystrokes : Display

[RCL] 00 25.04405 Recall the array pointer
[XEQ] "CLINC" 25.04400
[XEQ] "INT" 25.00000 1st register
[LASTx] 25.04400
[XEQ] "FRC" 0.04400
[EEX] 3 [*] 44.00000 Last register


INSTRUCTIONS FOR CLINC

[CLINC] replaces, in the X-register, any decimal digits after the 3rd one by 0. The old value is saved in LASTX. registre L.

STACK

Input : Output :

T: t T: t
Z: z Z: z
Y: y Y: y
X: bbb.eeeii X: bbb.eee

L: l L: bbb.eeeii


NOTA : If the X-register contains an Alpha string, ALPHA DATA is dispayed.

=0CCreate column pointer -=09COLPT
________________________________________________

[COLPT] (COLumn

PoinTer) returns a column pointer to the X-register, from the column number in the Y-register, and the array pointer in the X-register.

Exemple : to gets the second column numbers of the array A, which pointer isin register 00.

Keystrokes : Display :

2 2_ Column number.
[RCL] 00 25.04405 Recall pointer.
[XEQ] "COLPT" 26.04105 2nd column pointer.

column n=F81 n=F82 n=F83 n=F84 n=F85
_____ _____ _____ _____ _____
| R25 | R26 | R27 | R28 | R29 |
line n=F81 |_____|_____|_____|_____|_____|
| R30 | R31 | R32 | R33 | R34 |
line n=F82 |_____|_____|_____|_____|_____|
| R35 | R36 | R37 | R38 | R39 | ARRAY A
line n=F83 |_____|_____|_____|_____|_____|
| R40 | R41 | R42 | R43 | R44 |
line n=F84 |_____|_____|_____|_____|_____|

INSTRUCTIONS FOR COLPT

1) Input the column number.

2) Put the array pointer in the X-register.

3) [XEQ] "COLPT" returns the column pointer to the X-register, and saves thearray pointer in LASTX.

STACK :

Input : Output :

T: t T: t
Z: z Z: t
Y: Column N=F8 Y: z
X: bbb.eeeii X: b'b'b'.e'e'e'i'i'

L: l L: bbb.eeeii

N.B. : i'i'=3Dii
=0C- Recal registers from X-memory - =09GETRGX
__________________________________________________________________

[GETRGX] (GET ReGisters by X) copies in the registers specified by the X-register, the data of the current file (file where the pointer is), starting from pointer position, and according to the increment in the X-register.

Exemple : The pointer in the curent file is on 10, 25.0440510 [XEQ] "GETRGX"copies register 10, 20, 30,... from the X-Memory file, to registers 25, 30,35,... in main memory.

INSTRUCTIONS FOR GETRGX

1) Set the current file pointer to the right position with [SEEKPT] or [SEEKPTA].

2) The number in the X register is a bbb.eeeiijj pointer, where bbb is the first main memory register, eee the last main memory register where you want
to copy the X-Memory data set, ii is the increment for the main memory registers, and jj the increment for the X-Memory registers.

3) [XEQ] "GETRGX" copies the registers from the X-Memory current file to themain memory registers as specified by the pointer in the X-register.

STACK :

The stack is unchanged by [GETRGX].

APPLICATION PROGRAMS

The drawings below represents two arrays, the left one is in main memory, the right one is in X-Memory. In each square is indicated the register number,and its value (a letter).

Set the X-Memory pointer to the first register to copy, with 12 [SEEKPT].

To copy the second column of the array B, in X-Memory to the 3rd column of array A in main memory, put in the X-register the pointer of the 3rd column of array A (27,04205), and add the increment for the X-Memory registers (03)
as 6th and 7th decimal digits :

X=3D 27,0420503 .

27 =3D bbb 1st register in main memory.
42 =3D eee last register in main memory.
05 =3D ii increment for main memory registers.
03 =3D jj increment for X-Memory registers.

[XEQ] "GETRGX" copies the registers as specified by the pointer in the X-register; the result is represented on the second drawing.

=0C Array A main Array B
memory X-Memory =20

col n=F81 n=F82 n=F83 n=F84 n=F85 col n=F81 n=F82 n=F83
_____ _____ _____ _____ _____ _____ _____
_____
ln 1 | R25 | R26 | R27 | R28 | R29 | ln n=F81 | R11 | R12| R13 |
| A | B | C | D | E | | a | b |c |
|_____|_____|_____|_____|_____| |_____|_____|_____|
ln 2 | R30 | R31 | R32 | R33 | R34 | ln n=F82 | R14 | R15| R16 |
| F | G | H | I | J | | d | e |f |
|_____|_____|_____|_____|_____| |_____|_____|_____|
ln 3 | R35 | R36 | R37 | R38 | R39 | ln n=F83 | R17 | R18| R19 |
| K | L | M | N | O | | g | h |i |
|_____|_____|_____|_____|_____| |_____|_____|_____|
ln 4 | R40 | R41 | R42 | R43 | R44 | ln n=F84 | R20 | R21| R22 |
| Q | R | S | T | U | | j | k |l |
|_____|_____|_____|_____|_____| |_____|_____|_____|




AFTER [GETRGX]


Array A main Array B
memory X-Memory

col n=F81 n=F82 n=F83 n=F84 n=F85 col n=F81 n=F82 n=F83
_____ _____ _____ _____ _____ _____ _____
_____
ln 1 | R25 | R26 | R27 | R28 | R29 | ln n=F81 | R11 | R12| R13 |
| A | B | b | D | E | | a | b |c |
|_____|_____|_____|_____|_____| |_____|_____|_____|
ln 2 | R30 | R31 | R32 | R33 | R34 | ln n=F82 | R14 | R15| R16 |
| F | G | e | I | J | | d | e |f |
|_____|_____|_____|_____|_____| |_____|_____|_____|
ln 3 | R35 | R36 | R37 | R38 | R39 | ln n=F83 | R17 | R18| R19 |
| K | L | h | N | O | | g | h |i |
|_____|_____|_____|_____|_____| |_____|_____|_____|
ln 4 | R40 | R41 | R42 | R43 | R44 | ln n=F84 | R20 | R21| R22 |
| Q | R | k | T | U | | j | k |l |
|_____|_____|_____|_____|_____| |_____|_____|_____|

=0C- Line-column to address - =09LC-AD

__________________________________________________________________

[LC-AD] (Line-Column-ADDress) returns the register number of an array element from its line number, column number, and array pointer.

Exemple : Register number of the element on line 2 and column 3 of array A,
which array pointer (25.04405) is saved in R00.$


column n=F81 n=F82 n=F83 n=F84 n=F85
_____ _____ _____ _____ _____
| R25 | R26 | R27 | R28 | R29 |
line n=F81 |_____|_____|_____|_____|_____|
| R30 | R31 | R32 | R33 | R34 |
line n=F82 |_____|_____|_____|_____|_____|
| R35 | R36 | R37 | R38 | R39 | ARRAY A=20
line n=F83 |_____|_____|_____|_____|_____|
| R40 | R41 | R42 | R43 | R44 |
line n=F84 |_____|_____|_____|_____|_____|

Keystrokes : Display :

[2] [ENTER^] 2.0000 Input line number.
[3] 3_ Input column number.
[RCL] 00 25.04405 Recall array pointer.
[XEQ] "LC-AD" 32.00000 Register N=F8.


INSTRUCTIONS FOR LC-AD

To calculate the register number of an array element, when you know its linenumber, column number, and array pointer : Input line number, [ENTER^], Column number, [ENTER^], array pointer. [XEQ] "LC-AD" returns the register number to the X-register, and sales the pointer in LASTX.

STACK :

Input : Output :

T: T T: T
Z: line n=F8 Z: T
Y: column n=F8 Y: T
X: Array Pointer X: register n=F8
L: L L: Array pointer
=0C- Create line pointer - =09LINPT
__________________________________________________________________

[LINPT] (LINe PoinTer) returns a line pointer to the X-register, given the line number in the Y-register and the array pointer in the X-register.

Exemple : To know the registers used by the 2nd line of array A, which arraypointer is saved in register R00 :

Keystrokes : Display :

[2] 2_ Line number.
[RCL] [0] [0] 25.04405 Recall array pointer.
[XEQ] "LINPT" 30.03400 2nd line pointer.

column n=F81 n=F82 n=F83 n=F84 n=F85
_____ _____ _____ _____ _____
| R25 | R26 | R27 | R28 | R29 |
line n=F81 |_____|_____|_____|_____|_____|
| R30 | R31 | R32 | R33 | R34 |
line n=F82 |_____|_____|_____|_____|_____|
| R35 | R36 | R37 | R38 | R39 | ARRAY A=20
line n=F83 |_____|_____|_____|_____|_____|
| R40 | R41 | R42 | R43 | R44 |
line n=F84 |_____|_____|_____|_____|_____|=20


INSTRUCTIONS FOR LINPT

1) Input the line number, which pointer is needed.

2) Put the array pointer in the X-register.

3) [XEQ] "LINPT" returns the line pointer to the X-register and saves the array pointer in LASTX.

STACK :

Input : Output :

T: t T: t
Z: z Z: t
Y: line N=F8 Y: z
X: bbb.eeeii X: b'b'b'.e'e'e'i'i'

L: l L: bbb.eeeii
=0C- No Operation -=09NOP
__________________________________________________________________

[NOP] (No OPeration) is used after a test, when the conditional goto

is not
used.

Exemple : In a loop one wants to increment the X and Y registers.

The following sequence will do it :

ISG Y Increment the Y-register.
NOP No OPeration.
ISG X Increment the X-register,
GTO 03 and looped if higher.
=1A=0C-Position of an string in ALPHA -=09POSA
__________________________________________________________________

[POSA] (POSition in Alpha) searches the ALPHA register, from left to right,
for the character or string specified in the X-register.

Exemple 1 : The string "ABCDEFGHIJ" is in the ALPHA register, what is the position of the 1st "D" character ?

Keystrokes : Display :

68 68_ "D" character code.
[XEQ] "POSA" 3.0000 1st "D" character position.

Exemple 2 : [ALPHA] [CLA] DEF [ASTO] . X ABCDEFGHIJ [ALPHA]
[XEQ] "POSA" X=3D3.00


INSTRUCTIONS FOR POSA

1)[POSA] searches the ALPHA register, from left to right, for the character
or string specified in the X-register. The string can be specified either bygiving a character code, or by putting the string or character in the X-register with [ASTO] [.] [X]. If the calculator finds the string in the ALPHA register, it returns the 1st character position to the X-register.

2) Positions are considered from left to right and start with position 0. If the string or character appears several time in the ALPHA register, the calculator returns only the first position. If the string or the character does not exist in the ALPHA register, -1 is returned.

3) The string or character code is saved in LASTX.

STACK :
=20
Input : Output :

T: t T: t
Z: z Z: z
Y: y Y: y
X: code or string X: position in ALPHA

L: l L: code or string
=0C- MEMORY ALLOCATION FUNCTIONS -

- Programmable SIZE - =09PSIZE
__________________________________________________________________

[PSIZE] (Programmable SIZE) allocates the number of data registers specifiedby the X-register.



- Number of data registers - =09SIZE?

__________________________________________________________________

[SIZE?] returns to the X-register the number of data registers.

[SIZE?] and [PSIZE] can be used in the same program to change the number of
data registers without loosing any data.

Exemple :

01 ....
02 ....
..... Your program
.....
07 SIZE? Return to the X-register the number of data registers.
08 125 The new program needs 125 data registers.
The current number of data registers is in the Y-register.
09 X>Y? Does the program needs more data registers ?
10 PSIZE Change if necessary.
=1A=0C-Read all extended memory from mass memory -=09READEM

__________________________________________________________________

[READEM] (READ Extended Memory) copies from a mass memory file (HP82161A tape drive for instance) the whole of X-Memory, which was previously saved in the file with the WRTEM function.

Exemple : To load the file "MAT3" from the tape.

Keystrokes : Display :

[XEQ] "EMDIR" DIR EMPTY Checks that the X-Memory is empty.
If two XMEMORY are plug
in, there are 600 registers available.=20
[ALPHA] "MAT 3" [ALPHA] 600.0000 File name in ALPHA.
[XEQ] "READEM"
600.0000 the files are loaded into X-Memory.
[XEQ] "EMDIR" MATRP P012
A D100 All these files have been read
TEXTE A040 by READEM.
....


INSTRUCTIONS FOR READEM

1) After putting the file name in the ALPHA register, [XEQ] "READEM" copies
this file from the mass memory medium to X-Memory.

2)If there is no HP-IL rom, NO HPIL is displayed.

3) If the file is not on the medium, FL NOT FOUND is displayed.

4) If there is not enough space in X-Memory, NO ROOM is displayed. In this case add one or two XMEMORY rom.

5)If the HP-IL rom is plug in, but there is no mass memory device on the loop, "NO DRIVE" is displayed.

6)If the file specified was not created by [WRTEM], "FLTYPE ERR" is displayed.

NOTA : Before loading a set of files, [READEM] purges the X-Memory.

STACK :

The stack is unaffected by [READEM].

INVERSE FUNCTION : WRTEM.

=0C- RG prefix - =09RG

__________________________________________________________________

[RG] is a function, which makes easier the entry of functions beginings with"RG". This function should be assigned to a key. For instance, assigne [RG]to the [LN] key.

ASN "RG" 15=20

Keystrokes : [ ] [ASN] [ALPHA] [R] [G] [ALPHA] [LN]. Put the calculator in USER mode. Now to execute or program a function begining with "RG", for instance "RGVIEW", stroke the following keys :

[RG] (LN key) [ALPHA] [V] [I] [E] [W] [ALPHA]

This sequence is equivalent to :

[XEQ] [ALPHA] [R] [G] [V] [I] [E] [W] [ALPHA]

So you save 2 keystrokes, every time you use a function begining with "RG".

INSTRUCTIONS FOR RG

1) Assign [RG] to a key and set USER mode.

2) To execute or input a function begining with "RG" :

[RG] (Assigned previously)

[ALPHA]

....function name without the 1st two letters.

....(ex. SUM for RGSUM).

[ALPHA]

=0C- OPERATIONS BETWEEN REGISTERS -

- Addition or substraction of two vectors - =09RG+-

__________________________________________________________________

[RG+-] (ReGisters + or -) adds or substracts, element to element, two vectors which pointers are in registers X and Y. The sign of the X register specifies the kind of operation.

- Multiplication of two vectors, element to element - =09RG*
__________________________________________________________________

[RG*] (ReGisters *) multiplies the two vectors, element to element, which pointers are in registers X and Y.

- Divide two vectors, element to element - =09RG/

__________________________________________________________________

[RG/] (ReGisters /) divises, element to element, the two vectors, which pointers are in the X and Y registers.

Exemple : in the Array below :

- replace the 1st column by the addition, element to element, of the 3rd and1st column ;

- then calculate the square of the 4th column elements;

- finaly, divide each of this square by the 4 first elements of the first line.

The array pointer is saved in register R00.

Array before execution :

N.B. In each square is indicated the register number and its initial value.

column n=F81 n=F82 n=F83 n=F84 n=F85
_____ _____ _____ _____ _____
| R25 | R26 | R27 | R28 | R29 |
line n=F8 1 | 142 | 20 | 857 | 40 | 1 |
|_____|_____|_____|_____|_____|
| R30 | R31 | R32 | R33 | R34 |
line n=F8 2 | 285 | 12 | 714 | 14 | 2 |
|_____|_____|_____|_____|_____|
| R35 | R36 | R37 | R38 | R39 | ARRAY B=20
line n=F8 3 | 428 | 22 | 571 | 24 | 3 |
|_____|_____|_____|_____|_____|
| R40 | R41 | R42 | R43 | R44 |
line n=F8 4 | 714 | 32 | 285 | 34 | 4 |
|_____|_____|_____|_____|_____|

=0CKeystrokes : Display :

[CF] 28 [FIX] 5
[1] [RCL] 00 25.04405
[COLPT] 25.04005 First column pointer.
[3] [RCL] 00 25.04405
[COLPT] 27.04205 3rd column pointer.
[XEQ] "RG+-" 25.04005 Pointer of the output vector.

Now, you can check that registers R25, R30, R35, and R40, which represent the first column, are equal to 999.


[4] [RCL] 00 25.04405
[COLPT] [ENTER] 28.04305 X and Y contains the 4th column pointer.
[RG] "*" 28.04305

Now, the elements of the 4th column are :

R28=3D 1600 R33=3D 196 R38=3D 576 R43=3D 1.156

[1] [RCL] 00 25.04405
[LINPT] 25.02900 First line pointer.
[XEQ] "RG/" 28.04305

Finaly, the 4th column contains the result of the division, and the array isthe following.

column n=F81 n=F82 n=F83 n=F84 n=F85
_____ _____ _____ _____ _____
| R25 | R26 | R27 | R28 | R29 |
line n=F81 | 999 | 20 | 857 | 1.60| 1 |
|_____|_____|_____|_____|_____|
| R30 | R31 | R32 | R33 | R34 |
line n=F82 | 999 | 12 | 714 | 9.80| 2 |
|_____|_____|_____|_____|_____|
| R35 | R36 | R37 | R38 | R39 | ARRAY C=20
line n=F83 | 999 | 22 | 571 | 0.67| 3 |
|_____|_____|_____|_____|_____|
| R40 | R41 | R42 | R43 | R44 |
line n=F84 | 999 | 32 | 285 | 722 | 4 |
|_____|_____|_____|_____|_____|


INSTRUCTIONS FOR RG+- RG* RG

1) Functions [RG+-], [RG*] and [RG/] need two pointers. The operand pointer
must be in the Y-register and the operator pointer in the X-register.

2) The results are saved according to the pointer in the Y-register.

3) After execution, the X-register contains the output vector pointer.

=0CSTACK :

Input : Output :

T: t T: t
Z: z Z: t
Y: pointer n=F81 Y: z
X: pointer n=F82 X: pointer n=F81

L: l L: pointer n=F82

=0C- SCALAR TO REGISTERS OPERATIONS -

- Add constant to registers - =09RG+Y
__________________________________________________________________

[RG+Y] (ReGisters + Y) adds the Y-register value to the registers specifies
by the X-register.


-

Multiply registers by constant - =09RG*Y
__________________________________________________________________

[RG*Y] (ReGisters * Y) multiplies the registers specified by the X-register,by the Y-register value.


- Divide registers by constant - =09RG/Y
__________________________________________________________________

[RG/Y] (ReGisters / by Y) divides the registers specified by the X-register,by the Y-register value.

Exemple : In the Array B :

- Substract 5 to the first column ;
- multiply by 2 the 3rd line;
- divide by 6 the 5th column.

The array pointer is saved in register R00.

column n=F81 n=F82 n=F83 n=F84 n=F85
_____ _____ _____ _____ _____
| R25 | R26 | R27 | R28 | R29 |
line n=F81 | 1 | 2 | 3 | 4 | 5 |
|_____|_____|_____|_____|_____|
| R30 | R31 | R32 | R33 | R34 |
line n=F82 | 6 | 7 | 8 | 9 | 10 |
|_____|_____|_____|_____|_____|
| R35 | R36 | R37 | R38 | R39 | ARRAY B=20
line n=F83 | 11 | 12 | 13 | 14 | 15 |
|_____|_____|_____|_____|_____|
| R40 | R41 | R42 | R43 | R44 |
line n=F84 | 16 | 17 | 18 | 19 | 20 |
|_____|_____|_____|_____|_____|

Keystrokes : Display :

[CHS] [ENTER^] -5.00000 Input the constant.
1 [RCL] 00 25.04405
[COLPT] 25.04005 First column pointer.
[RG] "+Y" 25.04405 Pointer of result vector.

=0CYou can check that R25, R30, R35, R40 contains respectively =1F4, 1, 6, and 11 ; it is the first column of the array.

2 [ENTER^] 2.00000 Input the constant.
3 [RCL] 00 25.04405
[LINPT] 35.03900 3rd column pointer.
[RG] "*Y" 35.03900

Now the 3rd line values have been multiply by 2. R35=3D 12, R36=3D 24, R37=3D 26, R38=3D 28, R39=3D 30.

6 [ENTER^] 6.00000 Input constant.
5 [RCL] 00 25.04405
[COLPT] 29.04405 5th column pointer.
[RG] "/Y" 29.04405=20

After all these transformations, array B is :

column n=F81 n=F82 n=F83 n=F84 n=F85
_____ _____ _____ _____ _____
| R25 | R26 | R27 | R28 | R29 |
line n=F81 | -4 | 2 | 3 | 4 | 0.83|
|_____|_____|_____|_____|_____|
| R30 | R31 | R32 | R33 | R34 |
line n=F82 | 1 | 7 | 8 | 9 | 1.66|
|_____|_____|_____|_____|_____|
| R35 | R36 | R37 | R38 | R39 | ARRAY B=20
line n=F83 | 12 | 24 | 26 | 28 | 5 |
|_____|_____|_____|_____|_____|
| R40 | R41 | R42 | R43 | R44 |
line n=F84 | 11 | 17 | 18 | 19 | 3.33|
|_____|_____|_____|_____|_____|

INSTRUCTIONS FOR RG+Y RG*Y RG/Y

1) [RG+Y], [RG*Y], [RG/Y], need a constant in the Y-register, and a pointer
in the X-register.

2) Operations are directly perform on the register value, so results replaceinitial values.

STACK :

Input : Output :

T: t T: t
Z: z Z: z
Y: scalar Y: scalar
X: pointer X: pointer

L: l L: l


The stack is unchanged by [RG+Y], [RG*Y], [RG/Y].

=0C- Registers to ALPHA or ALPHA to registers - =09RGAX
__________________________________________________________________

[RGAX] (ReGisters-Alpha by X) performs two functions :

1)If X<0, it copies the ALPHA register to the registers specified by the register pointer in the X-register;

2) If X>=3D0, it happends the registers specified by the register pointer inthe X-register, to the ALPHA register.

Exemple : The string "ABCDEFGHIJKLMNOPQRSTUVWX" is in the ALPHA register. Tosave it in even registers, starting from R10, use the following sequence :

Keystrokes : Display :
10.00002 [CHS] -10.00002_ Pointer. The negative value indicatesthat
it stores ALPHA to registers.
[RG] "AX" -17.00002 The pointer specified the register following
the last one used by [RGAX].
[RCL] 10 ABCDEF first 6 characters.
[RCL] 12 GHIJKL next 6 characters.
[RCL] 14 MNOPQR next 6 characters.
[RCL] 16 STUVWX last 6 characters.

Now, you want to send, registers R12 and R16, to the ALPHA register :

12.00004 12.00004 Register pointer to recall the string..
[XEQ] "CLA" 12.00004 clear the ALPHA register.
[RG] "AX" 17.00004 Indicate next register.
[ALPHA] GHIJKLSTUVWX Recall ends, when the last character
of the
string is found.


INSTRUCTIONS FOR RGAX

1) The [RGAX] function can be used, to saved all the ALPHA register to the registers specified by the register pointer in the X-register. In this case the pointer must be negative. When the calculator saves a string, it happendsan end string indicator to the last register used. This indicator is used when the string is recall; it is invisible, but a modification of the last register destroys the indicator.

2) The [RGAX] function can also be used to recall a string that was previously saved in a set of registers. In this case, the pointer should be positive.. The string is appended to the ALPHA register string. If the new string
is
more than 24 characters long, only the last 24 ones remains in the ALPHA register. The leftmost characters are lost. Loading stops when an end string indicator is recalled, or if there is no indicator, when a numeric value is found. In this case, the numeric value is appended, in the current format, to
the ALPHA register, as it would be with [ARCL].

3) In both case, [RGAX] saves the initial pointer in LASTX, and leaves a
=F1 bbb,eeeii pointer in the X-register. bbb is the last register used +1, eeeii is the eeeii part of the initial pointer. The first three decimal digits of the initial pointer can be anything, because [RGAX] does not use them.

=0CSTACK :

Input : Output :

T: t T: t
Z: z Z: z
Y: y Y: y
X: Initial pointer X: New pointer
L:l L: Initial pointer
=0C- Copy or exchange registers - =09RGCOPY
__________________________________________________________________

[RGCOPY] (ReGisters COPY) performs two kinds of operations :=20

If X>=3D0, [RGCOPY] copies the registers specified by the X-register pointer, to the registers specified by the Y-register pointer.

If X<0, [RGCOPY] swaps the registers specified in the X-register, and the one specified in the Y-register.

Exemple : In the array B, copy the first column to the 3rd one, then swap the 1st and 2nd columns.

column n=F81 n=F82 n=F83 n=F84 n=F85
_____ _____ _____ _____ _____
| R25 | R26 | R27 | R28 | R29 |
line n=F81 | 1 | 2 | 3 | 4 | 5 |
|_____|_____|_____|_____|_____|
| R30 | R31 | R32 | R33 | R34 |
line n=F82 | 6 | 7 | 8 | 9 | 10 |
|_____|_____|_____|_____|_____|
| R35 | R36 | R37 | R38 | R39 | ARRAY B=20
line n=F83 | 11 | 12 | 13 | 14 | 15 |
|_____|_____|_____|_____|_____|
| R40 | R41 | R42 | R43 | R44 |
line n=F84 | 16 | 17 | 18 | 19 | 20 |
|_____|_____|_____|_____|_____|

Suppose that the array pointer is in register R00.=20

Keystrokes : Display :

3 [RCL] 00 [COLPT] 27.04205 Destination pointer.
1 [LAST X] [COLPT] 25.04005 Origin pointer.
[XEQ] "RGCOPY" 27.04205 Destination pointer.
[RGVIEW] list the 3rd column R27=3D 1,..., R42=3D 16.
1 [RCL] 00 [LINPT] 25.02900 1st Pointer.
2 [LAST X] [COLPT] [CHS] -26.04105 2nd pointer.
[RG] "COPY" 25.02900 The stack moved down.

=0CThe final array is :

column n=F81 n=F82 n=F83 n=F84 n=F85
_____ _____ _____ _____ _____
| R25 | R26 | R27 | R28 | R29 |
line n=F81 | 2 | 7 | 12 | 17 | 5 |
|_____|_____|_____|_____|_____|=20
| R30 | R31 | R32 | R33 | R34 |
line n=F82 | 6 | 1 | 6 | 9 | 1O |
|_____|_____|_____|_____|_____|
| R35 | R36 | R37 | R38 | R39 | ARRAY B
line n=F83 | 11 | 1 | 11 | 14 | 15 |
|_____|_____|_____|_____|_____|
| R40 | R41 | R42 | R43 | R44 |
line n=F84 | 16 | 4 | 16 | 19 | 20 |
|_____|_____|_____|_____|_____|

INSTRUCTIONS FOR RGCOPY

1) The sign of the pointer in the X-register specifies if the registers haveto be copied ( X>=3D0) or swapped ( X<0).

2) Copy is performed from the registers specified by the pointer in the X-register to the registers specified by the pointer in the Y-register.
At the end the stack moves down.=20

3) Swap is done between the registers specified in the X and Y registers.
If there is no overlapping, swap begins with the lower register number.
If there is overlapping, the calculator begins, one way or another, so that
no

information is lost.

STACK :

Input : Output :

T: t T: t
Z: z Z: t
Y: Destination pointer Y: z
X: Origin pointer X: Destination pointer

L: l L: Origin pointer
=0CInitialization of registers by X -=09RGINIT
__________________________________________________________________

[RGINIT] (ReGisters INITialize) performs two kinds of initializations :

If X>=3D0 [RGINIT] puts zero in all the registers specified by the pointer in the X-register.

If X<0 [RGINIT] puts integers, from 1 to N, in the registers specified by the pointer in the X-register.

Exemple : In the array B, which pointer is saved in register R00, columns 3
and 5 will be zeroed, then the columns will be numbered from 1 to 5, throught the first line.

column n=F81 n=F82 n=F83 n=F84 n=F85
_____ _____ _____ _____ _____
| R25 | R26 | R27 | R28 | R29 |
line n=F81 | a | b | c | d | e |
|_____|_____|_____|_____|_____|
| R30 | R31 | R32 | R33 | R34 |
line n=F82 | f | g | h | i | j |
|_____|_____|_____|_____|_____|
| R35 | R36 | R37 | R38 | R39 | ARRAY B
line n=F83 | k | l | m | n | o |
|_____|_____|_____|_____|_____|
| R40 | R41 | R42 | R43 | R44 |
line n=F84 | p | q | r | s | t |
|_____|_____|_____|_____|_____|

Keystrokes : Display :
3 [RCL] 00 [COLPT] 27.04205 3rd column pointer.
[XEQ] "RGINIT" 27.04205 Initialize 3rd column to zero.
5 [LASTx] [COLPT] 29.04405 5th column pointer.
[XEQ] "RGINIT" 29.04405 Initialize 5th column to zero.
1 [LASTx] [LINPT] [CHS] -25.02900 Negative sign to indicate an
[XEQ] "RGINIT" -25.02900 initialization with integers 1 to
N.

column n=F81 n=F82 n=F83 n=F84 n=F85
_____ _____ _____ _____ _____
| R25 | R26 | R27 | R28 | R29 |
line n=F81 | 1 | 2 | 3 | 4 | 5 |
|_____|_____|_____|_____|_____|
| R30 | R31 | R32 | R33 | R34 |
line n=F82 | f | g | =ED | i | =ED |
|_____|_____|_____|_____|_____|
| R35 | R36 | R37 | R38 | R39 | ARRAY B
line n=F83 | k | l | =ED | n | =ED |
|_____|_____|_____|_____|_____|
| R40 | R41 | R42 | R43 | R44 |
line n=F84 | p | q | =ED | s | =ED |
|_____|_____|_____|_____|_____|

=0CINSTRUCTIONS FOR RGINIT

1) When the register pointer, in the X-register, is positive, the specified
registers are initialized to zero.

2) When the register pointer in the X-register is negative, the specified registers are initialized with integers, starting with 1 and incrementing it of 1 for each register, up to the last one.

STACK :

The stack is unchanged by the execution of [RGINIT].
=0C- Number of register by pointer - =09RGNb
__________________________________________________________________

[RGNb] (ReGisters, NumBer of) returns the number of registers specified by the pointer in the X-register.

Exemple : To know the number of elements of an array, which pointer is savedin register R00; then to know the number of register per line.

Keystrokes : Display :

[RCL] 00 [CLINC] 25.04400 Registers pointer.
[XEQ] "RGNb" 20.00000 The array contains 20 registers.
1 [RCL] 00 [LINPT] 25.02900 Line pointer.
[XEQ] "RGNb" 5.00000 There are 5 registers per line.

INSTRUCTIONS FOR RGNb

[RGNb] returns to the X-register, the number of registers specified by a bbb..eeeii pointer in the X-register. The pointer is saved in LASTX.

STACK

Input : Output :

T: t T: t
Z: z Z: z
Y: y Y: y
X: Pointer X: Number of elements

L: l L: Pointer
=0C - Sum of registers - =09RGSUM
__________________________________________________________________

[RGSUM] (ReGisters, SUM of) returns to the X-register the sum of the registers specified by the pointer in the X-register.
If the pointer is negative, [RGSUM] performs the sum of the absolute values
of the specified registers.=20

Exemple : In the array F, which pointer is saved in register R00, one wants
the total of the 1st column, and the sum of the 4th column, but considering
the absolute value of the elements.=20

column n=F81 n=F82 n=F83 n=F84 n=F85
_____ _____ _____ _____ _____
| R25 | R26 | R27 | R28 | R29 |
line n=F81 | -14 | 15 | 21 | 2 | 8 |
|_____|_____|_____|_____|_____|
| R30 | R31 | R32 | R33 | R34 |
line n=F82 | 7 | 13 | 19 | -20 | 1 |
|_____|_____|_____|_____|_____|
| R35 | R36 | R37 | R38 | R39 |
line n=F83 | 0 | 6 | 12 | 18 | 24 | ARRAY F=20
|_____|_____|_____|_____|_____|
| R40 | R41 | R42 | R43 | R44 |
line n=F84 | 23 | 4 | 5 | 11 | 17 |
|_____|_____|_____|_____|_____|
| R45 | R46 | R47 | R48 | R49 |
line n=F85 | 16 | 22 | 3 | 9 | 10 |
|_____|_____|_____|_____|_____|

Keystrokes : Display :

1 [RCL] 00 [COLPT] 25.04505 1st column pointer.
[RG] "SUM" 32.00000 Sum of elements.
4 [RCL] 00 [COLPT] 28.04805 4th column pointer.
[CHS] -28.04805 Negative. It specifies a sum of absolute values.
[XEQ] "RGSUM" 60.00000 Sum of absolute values.

INSTRUCTIONS FOR RGSUM=20

[RGSUM] returns to the X-register, the sum of the registers specified in theX-register. If the pointer in the X-register is negative, [RGSUM] performs
the sum of the absolute values of the registers.=20

STACK :=20

Input : Output :

T: t T: t
Z: z Z: z
Y: y Y: y
X: Pointer X: Sum

L: l L: Pointer=20

APPLICATION PROGRAMS FOR RGSUM=20

1) In the array F, one wants to put in the 3rd column, the percentage of thevalues of the 4th column, related to its sum.=20

Keystrokes :: Display :

3 [RCL] 00 [COLPT] 27.04705 Destination pointer.
2 [LAST X] [COLPT] 26.04605 Origin pointer.
[RGCOPY] 27.04705 Copy the 2nd column to the 3rd one.
[XEQ] "RGSUM" 60.00000 Sum of elements.
[LAST X] [X<>Y] 60.00000 Save the pointer.
100 [/] 0.60000 To calculate the percentage.
[X<>Y] [RG/Y] 27.04705 End.

Now array F is :=20

column n=F81 n=F82 n=F83 n=F84 n=F85
_____ _____ _____ _____ _____
| R25 | R26 | R27 | R28 | R29 |
line n=F81 | -14 | 15 | 25 | 2 | 8 |
|_____|_____|_____|_____|_____|
| R30 | R31 | R32 | R33 | R34 |
line n=F82 | 7 | 13 | 21.6| -20 | 1 | ARRAY F=20
|_____|_____|_____|_____|_____|
| R35 | R36 | R37 | R38 | R39 |
line n=F83 | 0 | 6 | 10 | 18 | 24 |
|_____|_____|_____|_____|_____|
| R40 | R41 | R42 | R43 | R44 |
line n=F84 | 23 | 4 | 6.6 | 11 | 17 |
|_____|_____|_____|_____|_____|
| R45 | R46 | R47 | R48 | R49 |
line n=F85 | 16 | 22 | 36.6| 9 | 10 |
|_____|_____|_____|_____|_____|

The 3rd column holds the percentages !=20
=0C- Registers input or catalog - =09RGVIEW
__________________________________________________________________

[RGVIEW] (ReGisters VIEW) is a multi-mode function to view, or/and modify registers.

Exemple : the following sequence performs several viewing of the array I. In some case, registers are modified.

column n=F81 n=F82 n=F83 n=F84 n=F85
_____ _____ _____ _____ _____
| R25 | R26 | R27 | R28 | R29 |
line n=F81 | 1 | 2 | 3 | 4 | 5 |
|_____|_____|_____|_____|_____|
| R30 | R31 | R32 | R33 | R34 |
line n=F82 | 6 | 7 | 8 | 9 | 10 |
|_____|_____|_____|_____|_____|
| R35 | R36 | R37 | R38 | R39 |
line n=F83 | 11 | 12 | 13 | 14 | 15 | ARRAY I=20
|_____|_____|_____|_____|_____|
| R40 | R41 | R42 | R43 | R44 |
line n=F84 | 16 | 17 | 18 | 19 | 20 |
|_____|_____|_____|_____|_____|

Keystrokes : Display :

[CF] 28 [FIX] 6 [<-] 0.000000
[RCL] 00 [RGVIEW] 25=3D 1.000000
30=3D 6.000000 View the first column.
[R/S] 35=3D 11.00000 Halt the catalog.
[SST] 40=3D 16.00000 Single stepping is
[BST] 35=3D 11.00000 possible in both direction.
[<-]

25.044050 End the catalog.
[CLINC] 25.044000 Register pointer.
[RGVIEW] 25=3D 1.000000
26=3D 2.000000 Automatic stepping in the
27=3D 3.000000 registers and visualization
28=3D 4.000000 of them.
[ON] Switch off the calculator.
[ON] [CHS] -25.044000 Pointer to stop at the first value.
[RGVIEW] 25=3D 1.000000
15 25=3D 15_ Input directly
[CHS] 25=3D -15_ in the register,
[EEX] 25=3D -15 _ exactly as normal keyboard
2 [CHS] 25=3D -15 -2_ input.
[R/S] 26=3D 2.000000 Validate data.
[BST] 25=3D -0.15000 verification.
[SST] [ALPHA] 26=3D 2.000000 Set ALPHA mode.
ABCDEF 26=3D ABCDEF_ Up to 6 characters=20
=0CG 26=3D BCDEFG_ are allowed.
[<-] 26=3D BCDEF_ It is possible to correct.
[R/S] [BST] 26=3D BCDEF Validation and verification.
[SST] A 27=3D A_ The ALPHA mode is still on.
[ALPHA] 27=3D 3.000000 Numeric mode.
[EEX] 2 27=3D 1 2_
[SST] [BST] 27=3D 3.000000 Unchanged : no validation with [R/S].
[<-] -25.044000 Exit.

2 [EEX] 6 [CHS] 2 -6
[RCL] 00 [+] 25.044052 Array pointer.
[ALPHA] RIEN A RIEN A_ Array name.
[ALPHA] [RGVIEW] A1.1=3D -0.150000 Only the last character is used as
the array name.
A1.2=3D BCDEF stepping in the array,
A1.3=3D 3.000000 is automatic.
[R/S] A1.4=3D 4.000000 [R/S] halts it.
[SST] [SST] A2.1=3D 6.000000 The element coordinates
[BST] A1.5=3D 5.000000 are displayed on the left.
19.5 A1.5=3D 19.5_ Quick and clear array
[R/S] . A2.1=3D ._ input is possible.
[R/S] A2.2=3D 7.000000
[BST] A2.1=3D 0.000000
[<--] 6 [EEX] 6 [CHS] 6 -6_
[RCL] 00 [CHS] -25.044056 Vector pointer.
[RGVIEW] A1=3D -0.1500000 1st element of the 1st column..
[SST] A2=3D 0.000000 2nd element (R30).
[<--] 3 [RCL] 00 [COLPT] 27.042050 3rd column pointer.
6 [EEX] 6 [CHS] [+] 27.042056
[CHS] [RGVIEW] A1=3D 3.000000 1st element (R27).
[ALPHA] LUNDI A1=3D LUNDI_
[R/S] MARDI A2=3D MARDI_ Input the column,
[R/S] MERCR. A3=3D MERCR._ element per element.
[R/S] JEUDI [R/S] [ALPHA] -27.042056 End input and clear ALPHA mode
4 [EEX] 6 [CHS] [ENTER] 0.000004 Creation of a new
3 [RCL] 00 [COLPT] [+] 27.042054 pointer.
[CHS] [RGVIEW] LUNDI=3D In this mode, [RGVIEW]
29 LUNDI=3D 29_ allows inputs while the former
[R/S] 12 MARDI=3D 12_ value or string=20
[R/S] [BST] 12.000000=3D is still displayed.
[<--] 1 [EEX] 6 [CHS] 1 -6
[RCL] 00 [+] [RGVIEW] 25=3D -0.150000 In this catalog mode,
35=3D 11.000000 zeros are ignored.
40=3D 16.000000 =20
25.044051

=0CINSTRUCTIONS FOR RGVIEW=20

1) [RGVIEW] is a general purpose display, input, and print function, for main memory registers.=20

2) The X-register pointer specifies registers and [RGVIEW] mode. It is a bbb..eeeiij pointer.=20

If X>0 : View in sequence the registers specified , up to the end of then, or up to an interruption with the [R/S] key.=20

If X<0 : View and stop on the 1st register specified. Use [SST] to acces thenext register. The [R/S] key resumes the listing.=20

When j is an odd number, REGisters equal to 0 are ignored.=20

If j=3D 0 or 1, it is a standard catalog : the register number and its valueare displayed.=20

If j=3D 2 or 3, [RGVIEW] displays the array elements to the right and the array name and elements coordinates to the left.=20

If j=3D 4 or 5 [RGVIEW] displays the register value, followed by "=3D". Input is performed with the old value still in the display.=20

Exemple : Display LUNDI=3D
Input LUNDI=3D 10_=20

If j=3D6 or 7 [RGVIEW] displays the vector name (1 dimension), the element coordinate, and its value.=20

In ALPHA mode, only the last six characers inputed are kept.=20

A printer in NORMal or TRACE mode prints the register catalog output by [RGVIEW].=20

3) [RGVIEW] works like a CATalog ([SST] and [BST] are allowed).=20

STACK :=20

Input : Output :

T: t T: t
Z: z Z: z
Y: y Y: y
X: pointer X: pointer

L: l L: previous pointer
=0C- Sort numeric and/or alphanumeric data - =09SORT
__________________________________________________________________

[SORT] (SORTer) sorts the registers specified in the X-register.=20

Exemple : In the array A below :

1) Sort in increasing order, the 2nd column values.=20

2) Sort in decreasing order, the 3rd column values.=20

column n=F81 n=F82 n=F83 n=F84 n=F85
_____ _____ _____ _____ _____
| R25 | R26 | R27 | R28 | R29 |
line n=F81 | 14 | B | 21 | 2 | 8 |
|_____|_____|_____|_____|_____|
| R30 | R31 | R32 | R33 | R34 |
line n=F82 | 7 | 13 | 19 | 20 | 1 |
|_____|_____|_____|_____|_____|
| R35 | R36 | R37 | R38 | R39 | ARRAY A=20
line n=F83 | 0 | A | -12 | 18 | 24 |
|_____|_____|_____|_____|_____|
| R40 | R41 | R42 | R43 | R44 |
line n=F84 | 23 | 99 | 50 | 11 | 17 |
|_____|_____|_____|_____|_____|

Keystrokes : Display :

2 [RCL] 00 [COLPT] 26.04105 Build 2nd column pointer.
[XEQ] "SORT" SORTING Sort is performed.
26.04105 Done.
3 [LASTx] [COLPT] [CHS] -27.04205 3rd column pointer; the negative pointer indicates a
decreasing order.
[XEQ] "SORT" SORTING Sort is performed.
-27.04205 Done.

column n=F81 n=F82 n=F83 n=F84 n=F85
_____ _____ _____ _____ _____
| R25 | R26 | R27 | R28 | R29 |
line n=F81 | 14 | 13 | 50 | 2 | 8 |
|_____|_____|_____|_____|_____|
| R30 | R31 | R32 | R33 | R34 |
line n=F82 | 7 | 99 | 21 | 20 | 1 |
|_____|_____|_____|_____|_____|
| R35 | R36 | R37 | R38 | R39 | ARRAY A=20
line n=F83 | 0 | A | 19 | 18 | 24 |
|_____|_____|_____|_____|_____|
| R40 | R41 | R42 | R43 | R44 |
line n=F84 | 23 | B | -12 | 11 | 17 |
|_____|_____|_____|_____|_____|

=0CINSTRUCTIONS FOR SORT=20

1) [SORT] sorts either numeric values, or alpha strings. Strings are sorted
according to their ASCII code and they are considered as being higher than numeric values.=20

2) The pointer in the X-register specifies the registers to sort.=20

3) If X>=3D0 values are sorted in increasing order.=20

4) If X<0 registers values are sorted in decreasing order.=20

5) While sort is done, if there is no message in the display, "SORTING" is displayed.=20

STACK :=20

[SORT] leaves the stack unmodified.=20

=0C- Store by L-register - =09STO>L
__________________________________________________________________

[STO>L] (STOre by L ) stores the X-register value, into the register specified by the integer part of the L-register pointer. It also increments this pointer ; stack lift is not done.

Exemple : To input all the elements of the 1st line, of a 4 line, 5 column array, begining with register R25.

Keystrokes : Display :

1 1_
[RCL] 00 25.04405 Recall the pointer.
[LINPT] 25.02900 Calculate 1st line pointer.
[STO] [.] [L] 25.02900 Store it in the L-register.
50 50_ 1st line, 1st element.
[XEQ] "STO>L" 50.00000 Store it in R25.
[VIEW] [.] [L] 26.02900 Pointer has been incremented.
60 60_ 2nd element.
[XEQ] "STO>L" 60.0000 Store 2nd element.
70 70_
[XEQ] "STO>L" 70.0000
80 80_
[XEQ] "STO>L" 80.0000
90 90_
[XEQ] "STO>L" 90.0000
[LASTx] 30.0290

INSTRUCTIONS FOR STO>L

[STO>L] uses the L-register, as an address pointer to store the X-register
value.

[STOL>L] transfers the X-register value, to the register specified by the L-register. Stack lift is not done, so several values can be input, without altering registers Y, Z, T. Futhermore, The pointer in the L-register is automaticly incremented, so programs need less memory.

STACK :

Input :

Output :

T: t T: t
Z: z Z: z
Y: y Y: y
X: value to store X: value stored

L: bbb L: bbb+1

Remark : The decimal part of the L-register is ignored.

NOTA : If there is an alpha string in the L-register, ALPHA DATA is displayed.


=0CAPPLICATION PROGRAM FOR STO>L

1) [STO>L] was designed, to input register values, in the middle of a program. So to input, the 1st colonne of the array B, which pointer is in registerR00, use the following sequence :

1 RCL 00 COLPT STO L 50 STO>L 60 STO>L 70 STO>L 80 STO>L

column n=F81 n=F82 n=F83 n=F84 n=F85
_____ _____ _____ _____ _____
| R25 | R26 | R27 | R28 | R29 |
line n=F8 1 | 50 | | | | |
|_____|_____|_____|_____|_____|
| R30 | R31 | R32 | R33 | R34 |
line n=F8 2 | 60 | | | | |
|_____|_____|_____|_____|_____|
| R35 | R36 | R37 | R38 | R39 | ARRAY A=20
line n=F8 3 | 70 | | | | |
|_____|_____|_____|_____|_____|
| R40 | R41 | R42 | R43 | R44 |
line n=F8 4 | 80 | | | | |
|_____|_____|_____|_____|_____|
=1A=0C- Extraction or justification of a substring - =09SUB$
__________________________________________________________________

[SUB$] (SUB string) extracts a substring from the ALPHA register, or it right or left justificates a string, adding spaces to the string.=20

Exemple : To extract 7 characters, starting with "C", from the string 'ABCDEFGHIJKLMNOPQRSTUVW', which is in the ALPHA register :=20

Keystrokes : Display :
2.08 2.08 2 is the position of "C".
8 is the position of the 7th caracter
to extract.
[XEQ] "SUB$" 2.0800 Extract the string.
[ALPHA] CDEFGHI Substring.

To right justificate in a 10 space field :=20

[ALPHA]
10 10_ Justification field lenght.
[CHS] -10_ Specifies right justification.
[XEQ] "SUB$" -10.0000
[ALPHA] CDEFGHI Three space have been inserted to
right justificate the string.

To put 5 spaces at the right of the string :=20

[ALPHA] -10.0000
15 15_ New justification field lenght.
[XEQ] "SUB$" 15.0000 Left justifiction because the X-register is positive.
[ALPHA] CDEFGHI
[APPEND] DEFGHI _ The ALPHA register scrolls to the leftand the
cursor is displayed after the 5 spaces..

INSTRUCTIONS FOR SUB$=20

[SUB$] modifies the ALPHA register as specified in the X-register.=20

- If the X-register number is an integer, the calculator extracts the |X| left characters of the initial string. If the initial string has less than |X|characters, spaces are added to get a |X| character string; spaces are added to the left if X<0, to the right if X>0.=20

- If the number in the X-register has a decimal part (bb,ee), the calculatorextracts the substring formed of the characters from the bb position to theee one=20
(The first character is in position 0). If ee is higher than the position ofthe last character of the string, the extract string is the initial string,with spaces added to have a ee-bb+1 character string. Spaces are added to the left if X<0, to the right if X>0. Beware that the sign of the X-register
is ignored if ee is not higher than the position of the last character in the ALPHA register.=20

If bb is higher than the position of the last character of the initial string, [SUB$] puts a ee-bb+1 space character string in the ALPHA register.=20

=0CSTACK :=20

The stack is unmodified by [SUB$].=20

NOTA : if the ALPHA register string is 24 character long, the calculator puts in the front of the string, characters with code 0, which are displayed assmall dots before the string.=20
=0C- Toggle printer flag - =09TF55

__________________________________________________________________

[TF55] (Toggle Flag 55) toggles flag 55, which indicates that a printer is connected to the HP41. This flag cannot be modified by the user without the PANAME rom. The TF55 function :

1) Sets flag 55 when there is no printer attached to the HP41; this makes easier the use of some programs (for instance in application pacs), which mustbe executed with flag 21 set (Printing possible). So you can use them as subprogram, because when flag 55 is cleared, those programs halts at every VIEW or AVIEW instructions. So with [TF55] there is no interruption.

2) Clear flag 55, when a printer is attached to the HP41, which speed up programs when the printer is not used. Another [TF55] puts the printer back to
use.

INSTRUCTIONS FOR TF55

1) To set flag 55, when it is cleared, execute [TF55].

2) To clear flag 55, when it is set, execute [TF55].
=0C- View key assignations - =09VKEYS

__________________________________________________________________

[VKEYS] (View KEYS) lists the key assignations. For instance, if the PROMPT
function is assigned to the "ENG" key (Yellow key and [3], key code -74), the calculator will display :

-74 PROMPT=20

Key listing can be :

- Halted for a while if you press any other key than [R/S] or [ON];

- Ended with the [ON] or [R/S] key. [ON] also switch off the calculator.

Nota : [VKEYS] is not programmable.

=0C- Write Extended Memory file - =09WRTEM
__________________________________________________________________

[WRTEM] (WRiTe Extended Memory) copies all the extended memory to a mass medium (HP82161A Tape drive or HP9114 ).=20

Exemple :=20

Keystrokes : Display :
[XEQ] "EMDIR" MATRP P012
A D100 All these files
TEXTE A040 were read with READEM.

[ALPHA] "MAT3" [ALPHA] 600.00 Put the file name in ALPHA
[XEQ] "WRTEM" 600.00 All the X-Memory files have been written onthe mass medium.

INSTRUCTION FOR WRTEM=20

1) Put in the ALPHA register the file name in which all the X-Memory should
be saved; then [XEQ] "WRTEM" copie all the X-Memory to this file.=20

2) If there is no HP-IL rom, NO HPIL is displayed.=20

3) If there is a file with the same name on the mass medium, it is replaced
by the new one.=20

STACK :=20

The stack is unchanged by [WRTEM].=20

INVERSE FUNCTION : READEM.=20
=0C- Swap the X-register and flags 0-7 - =09X<>F
__________________________________________________________________

The X<>F function swaps the X-register and a imaginary register F, which represents the status of flags 0-7. This repesentation is an integer, in the range 0-255, which is the sum of the values related to the flags set :

Flag Value
0 1
1 2
2 4
3 8
4 16
5 32
6 64
7 128

For instance, if flags 0, 1, and 3 are set, and flags 2, 4, 5, 6, and 7 are
cleared, the "F" register value is :

1 (value of flag 0)
+2 (value of flag 1)
+8 (value of flag 3)
=3D11

INSTRUCTIONS FOR X<>F

To swap the current status of flags 0-7, with a new one :

1) Calculate (cf. above), the number related to the new status of flags 0-7
and put it in the X-register;

2) Execute X<>F.
Now, the X-register number specified the old status of flags 0-7, and flags
0-7 are set to the new status.

APPLICATION PROGRAM FOR X<>F

The XFLAGS program gives up to 80 new flags. With these extended-flags (0-79) one can :

- Set the Nth X-flag : Put N in the X-register and XSF.

- Clear the Nth X-flag : Put N in the X-register and execute XCF.

- Test the Nth X-flag : Put N in the X-register and execute XFS?.
After XFS?, flag 08 reflects the status of the X-flag.

XSF . XCF and XFS? programs uses the stack and registers R00 to R09. XFS? also uses flag 08.

=0CXFLAGS program listing :

LBL "XFLAGS" .009 RGINIT RDN RTN
LBL "XSF" XEQ 00 SF IND Y GTO 01
LBL "XCF" XEQ 00 CF IND Y GTO 01
LBL "XFS?" XEQ 00 CF 08 FS? IND Y SF 08
LBL 01 X<>F STO IND Z R^ RTN
LBL 00 STO Y 8 /MOD RCL IND Y X<>F .END.

Note : XEQ "XFLAGS" clears all X-flags 00 to 79.
=0C- Compare X and a register - =09X...NN?
__________________________________________________________________

Fonctions X#NN?. X<=3DNN?, X<NN?. X<=3DNN?, X>=3DNN? et X>NN? works as the normal test functions (ex: X=3DY?) of the HP-41, but they works, not between the X-register and other stack registers, but between the X-register and
any register specified in the Y-register.

Futher more these functions also compare alphanumeric strings.

INSTRUCTIONS FOR X...NN?

To compare the X-register and a data register r, put in Y the following :

If the r register is : Put in Y :

- a data register Rnnn - the number nnn
- le Z-register - the string 'Z'
('Z' ASTO.Y)
- the T-register - the string 'T'
- the L-register - the string 'L'

then compare them.

In calcul mode, the calculator displays YES or NO according to the result ofthe test.=20

In a program, X...NN? behaves like any normal test function. The line following the test is executed if the test is true, or it is ignored if the test is false.

These functions compare numeric and alphanumeric functions, following these
conditions

:

1) A number is always inferior to a string.

2) Strings are compare from the code of their characters
(ex : 'AB0' < 'ABA' because the code of '0' is 48 and the 'A' one is 65.

3) A short string identical to the begining of a larger one is considered asbeing inferior. (ex. "ABC" < "ABCD").
=0C- Question Yes/No -=09Y/N

__________________________________________________________________

[Y/N] is useful in programs, which ask for an answer Yes or No.

Exemple : The following sequence displays the question :

FIN Y/N?

If the user answer Yes (Y key), the program resumes execution at label 00, if the user answer NO (N key) the program resumes execution at label 01:

"FIN" 1,000
Y/N=20
GTO 00=20
GTO 01

INSTRUCTIONS FOR Y/N

The Y/N function can only be used in a program.

1a) To ask a question :

message Y/N?

Put the message (max. 7 characters) in the ALPHA register and execute Y/N;

1b) To ask another kind of question (for instance : FIN O/N) put the message in the ALPHA register, execute AVIEW then Y/N.

2)However, when the Y/N function is executed, the calculator halts program execution and waits for a keystroke :

- If the key stroked is ON, the calculator is switch off:

- If the key stroked is R/S, program execution is stopped and the program pointer is set to the line following Y/N ;

- If the key stroked is Y (Yes) or O (Oui), program execution resumes at theline following directly Y/N ;

- If the key stroked is N (No), the line following Y/N is ignored, and the program resumes execution at the second line after Y/N (As for a false test;
cf the X=3DY? function in the HP41 user manuel).

- Any other key is ignored.

=0CAppendix ON=20



Now, MEMORY LOST is not the only special switch on function ! With the PANAME rom, 6 new functions are possible when you switch on the HP-41.

Notation : ON/+ represents the function performed when you stroke the [ON],
while the + key is down. Also you must release [ON] before +.
For instance, with ON/[<-] you get a MEMORY LOST.




ON/.=20

Change the mumeric display format : from the "American" one (1,234.25), to the "European" one (1.234,25). This function is built in the HP-1x calculators.
In fact ON/. toggles flag 28.

ON/K.=20

Clear all user key assignations.

ON/A.=20

Set the "A key assignation set",to the top rows. If one key was assigned, its assignation is not modified.

-----------------------------------------------------------------------------
| ATOXL | ALENG | ATOXX | ANUMDEL | ATOXR
|
-----------------------------------------------------------------------------
| XTOAL | AROT | YTOAX | ANUM | XTOAR
|
-----------------------------------------------------------------------------


ON/M.=20

Like ON/A, but with the following "B key assignations set".


-----------------------------------------------------------------------------
| STO>L | BRKPT | COLPT | AD-LC | RGVIEW
|
-----------------------------------------------------------------------------
| RG | BLDPT | LINPT | LC-AD | CLINC
|
-----------------------------------------------------------------------------


=0CON/T.=20

Like ON/A, but with the following "T key assignations set".


-----------------------------------------------------------------------------
| AXIS | BOX | SETORG | RMOVE | *CSIZE
|
-----------------------------------------------------------------------------
| *HOME | RESET | *LABEL | *MOVE | *LDIR
|
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
| *PLREGX | REVLFX | BACKSPX | RDRAW | *LTYPE
|
-----------------------------------------------------------------------------
| | | OUT | *DRAW | COLOR
|
-----------------------------------------------------------------------------


ON/V.=20

Like ON/A, but with the following "V key assignations set".

-----------------------------------------------------------------------------
| | SCRLUP | CLEAR | XYTAB | CTYPE
| =20
-----------------------------------------------------------------------------
| HOME | SCRLDN | CLEARO | CSRL | CSRR
|
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
| | SCRLX | CSRVX | CSRUP | CSROFF
|
-----------------------------------------------------------------------------
| | | CSRHX | CSRDN | CSRON
|
-----------------------------------------------------------------------------
=0CANNEXE




The HP-41 uses the "Reverse Polish Notation" (RPN), to solve complex problems, without parenthesis and with a minimun of keystrokes. This system was created by a famous polish mathematician, Lukasiewicz, and not by the Hewlett-Packard company. It is sure that this system demands a few hours of practice
for a new user, but it is also sure that its easiness and time saving qualities are worth tenfold these few hours :

- A TIME SAVING SYSTEM : the access to memory registers is quicker in the stack with any memory partition, than on any other type of calculator ;=20

- A SPACE SAVING SYSTEM : an intermediary result, which does not use a register, leaves it free for something else ;=20

- but futhermore the STACK avoid a COMPLEX MEMORY MANAGEMENT=FF: one can usea subprogram without modifiing it, because of the memory implantation of the variables in the calling program.

So, subprograms parameters are past throught the stack, calculations are done in the stack, and results are return to the stack : a subprogram is general, and easy to use.

In general any arithmetic treatment, with up to 4 values, can be performed in the stack.

Exemple 1 : roots of a ax^2 + bx + c =3D 0 equation.

To use the program given below :

c ENTER^ b ENTER^ a XEQ "ROOTS" .
LBL "ROOTS" ST/ Z CHS ST+ X / ENTER^ X^2
RCL Z - SQRT RCL Y SIGN * + ST/ Y .END.=20

For instance to solve the following equation set :

x^2 + x -6 =3D 0 and
3x^2 + 2x -1 =3D0 -6
ENTER^ 1 ENTER^ XEQ "ROOTS" .
x'=3D -3 and RDN x"=3D 2

For the second one -1 ENTER^ 2 ENTER^ 3 XEQ "ROOTS"
x'=3D -1 and RDN x"=3D 0,3333=20

This example illustrates the easiness given by the arithmetic done directly
in the stack.

Exemple 2 : HCD (Higher Commun Divider) of 2 numbers.

01 LBL "HCD" LBL 02 MOD LASTX X<>Y X#0? GTO 02 + .END.
91 ENTER^ 65 XEQ "HCD" . X =3D 13,00=20

In this example, you must put the two numbers in the X and Y registers, and
the result is returned to the X-register.

=0CExemple 3 : reducted fraction.

The calcul of the HCD is normaly done, to get the reducted form of a fraction. Also with the HCD of a fraction it is easy to get the SCM (Smaller CommunMultiplier).

01 LBL "RF" STO Z X<>Y STO T XEQ "HCD" ST/ Z ST/ Y RDN ST* Z .END.=20

Application : 91 ENTER^ 65 XEQ "RF" returns X=3D 5 and Y=3D7 so 91/65 =3D 7
/ 5 ; the HCD and the SCM of 91 and 65 are Z =3D 455 and T =3D 13

Exemple 4 : calculation with two fractions.

The general rule, given above, is verificated here because this operation uses four numbers.

LBL "F/" X<>Y LBL "F*" ST* Z RDN ST* Z RDN GTO "RF" 09 LBL "F-" CHS LBL "F+"ST* T X<> Z ST* Z * RCL Z + X<>Y GTO "RF" .END.=20

Application : Which resistance should be put in parrallel with a 100 ohms one to get a result of 80 ohms ?

1 ENTER^ 80 ENTER^ 1 ENTER^ 100 XEQ "F-" . So it is a 400 ohms one.

These examples illustrate, quite well, the powerful capacities of the stack.

--part1_cf.5dcacb5.281d9b1d_boundary--