ppgc rom pogketdt guilrde - hpcalc.org

36
PPGC ROM POGKETDT GUILrDE

Upload: others

Post on 12-Nov-2021

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: PPGC ROM POGKETDT GUILrDE - hpcalc.org

PPGC ROM

POGKETDT

GUILrDE

Page 2: PPGC ROM POGKETDT GUILrDE - hpcalc.org
Page 3: PPGC ROM POGKETDT GUILrDE - hpcalc.org

PPC ROM POCKET GUIDE

This pocket guide is preliminary. A lack of time,and inadequate inputs did not permit a "fine tuned"pocket guide. For this reason, a preliminary versionis printed on paper. This will allow you to write innotes to serve as a reminder for you to send in yourinputs. We plan on reprinting this pocket guide ona high quality material that will make it durable forfield use. Pick your favorite routine and rewrite theshort form instructions for it. Make it short, comp-plete, and easy to use. If every ROM user carefullywrote up just one routine for the pocket guide wewould have a first class Pocket Guide in no time. Allimportant details should be included. Tables, charts,text, and special notations are suitable and should beused as required for a short write-up. Registers andFlags used, input formats, function, etc. should beincluded. Keep in mind to make it short and complete.The guideline for a pocket guide is short, short, short.

Each routine has an abbreviated Technical Details box.Abbreviations used in this box are:

SRL: Subroutines left C: Registers to copyI?: Interruptible? INP: If no printerF: Program file -: Variable

A/R: As Required

maLY - ADDITIONAL KEY ASSIGNMENTS

May be used after EEB(which will set flag 20 and clear07) or after ELB(which will set both flags 20 and07). The sequence prefixtpostfixtkeycode, XEQ EXJwill make the corresponding key assignment. If flag07 1is clear, it will then prompt for subsequent keyassignments; otherwise it returns_after making onlyone assignment. Both EC®and permit key assign-ments under program control. If in a program it ismore convenient not to use EIW , note that the sequenceCF 20, SF 07, XEQ #H® is completely equivalent to XEQ

. Do not use data registers 09-11 between uses of&n .

BROM: 10,03 SIZE: 012 SRL: 3 I? NO F: MK C: 6%]

B3 svore parT oF 1B

(Il and @ permit construction of programs that canwrite (create) other programs. See regarding

PPC ROM POCKET GUIDE 1

Page 4: PPGC ROM POGKETDT GUILrDE - hpcalc.org

initialization of the byte-loading process. With adecimal code of the byte to be loaded in X, the in-struction XROM B3 will Toad the corresponding byteinto the next location of the prepared area. Execution

of such a 'program-writing' program will terminate withthe prompts for the terminating 'clean-up' operations

as with &8 .

I;(?OM: 10,24 SIZE: 012 SRL: 4 I? YES F: LB C: 71]

m- FIRST KEY ASSIGNMENT

This non-prompting program is suitable for making a key

assignment under program control. The sequence prefix+tpostfixtkeycode, XEQ E@will check registers and add

the desired key assignment. Subsequent key assignmentscan be made using @3 , providing data registers 09-11

are not used in the meantime. See for more infor-mation on making key assignments under program control.

[XROM: 10,02 SIZE: 012 SRL: 3 I? NO F: MK C: Hl

m- DECODE 2 BYTES TO DECIMAL

Evaluates the decimal equivalents for the last twobytes in X. Returns the decimal equivalents for thenext-to-last byte in X, for the last byte in M. (UseX<>M to view.) Y, Z preserved; X, T Tlost.

[XROM: 10,55 SIZE: 000 SRL: 6 I? YES F: IF C: 60]

J.Wall - ASSIGNMENT REGISTER FINDER

Returns the number of assignment registers used. Ifthe top assignment register contains only a singleassignment (in the left half of the register), thefractional part of the result in X is 0.5.

@OM: 10,10 SIZE: 000 SRL: 3 I? YES F: LF C: 5q

m- ALPHA DELETE LAST CHARACTER

Removes the last (rightmost) character from the alpharegister. X, Y, Z, and T are lost, but L is preserved.

IXROM: 10,18 SIZE: 000 SRL: 6 I? YES F: ML C: sfl

VoYM - ALPHABETIZE X AND Y

Sorts two alpha strings in X and Y: X and Y in

2 PPC ROM POCKET GUIDE

Page 5: PPGC ROM POGKETDT GUILrDE - hpcalc.org

alphabetic order upon return (lTowest value in X). IfX and Y are numeric, they are regarded as pointers totwo data registers which are to be sorted, the Towestvalue to the register designated by X. Flag 10 is left

set or clear, depending on whether an interchange wasperformed or not.

bROM: 10,37 SIZE: 000 SRL: 4 I? YES F: VK C: 63

EXYD- AceHa 1o MEMORY

This routine alpha stores (ASTO, ASHF, ASTO, etc.) thecontents of the ALPHA register into data registers

using a control number in X of the form bbb.eeeii.Example. Store ALPHA in RO1 thru RO4. 1.004 XEQ XD .Inverse operation is Q3.

[XROM: 20,53 SIZE: 005 SRL: 5 I? YES F: NS C: 16]

M- ALPHA STORE b

In ROM the mode of interpreting the last two bytes ofstatus register b (which comprise the current locationof the program pointer) is different than when in RAM.In ROM all 4 nybbles specify the current address. 1InRAM the first nybble (mod 8) specifies a byte within aregister specified by the last 3 nybbles (mod 1024).X3 provides an ASTO b with the ROM-mode interpreta-

tion, permitting ultra-fast ROM entry as an alternativeto B3 .

[XROM: 10,61 SIZE: 000 SRL: 0 I? YES F: IF C: 60]

XY- zercove ANALYZER

XEQ EX3. See SCAN prompt. Use wand, scan any barcode.

Requires printer. Prints tabular analysis of barcodeincluding type, every byte in binary, hex and decimal.Computes checksum to verify if it read the barcodecorrectly.

XROM: 20,30 SIZE: 019 SRL: 4 I? YES F: BA C: 491

- BLOCK CLEAR

Stores 0's ln defined block.Input: Output:—

O<N-H

bb.eeel |

X<N

ro<N

r—><-<N-|

: final control word

PPC ROM POCKET GUIDE 3

Page 6: PPGC ROM POGKETDT GUILrDE - hpcalc.org

[XROM: 20,43 SIZE: var. SRL: 5 1? yes F: M2 C: 6{]

BET)- o0se & 10 BasE pECIMAL

Store base b in R06 (2<=b<=25). Key digits of base bnumber in alpha and XEQ "ER". Up to 14 digits maybe input in alpha where each digit is in the rangefrom 0 to b-1 inclusive. The base 10 result is leftIn X and alpha is left cleared. The Inverse routineis EEB.

(XROM: 20,17 SIZE: 007 SRL: 5 1? yes F: BD C: 5?]

m— BLOCK EXCHANGE

Store two block control words bbb.eeell In X and Yand XEQ "IEB". When the two blocks are of the samesize the order of the inputs in Y and X is notImportant. Otherwise only the block control word in Y

is tested and controls the loop.

Ifiom: 20,34 SIZE: var. SRL: 5 12 yes F: M2 C: 6fl

TsLock 1ncrement

This routine is a register block storing routine thatwill store numerical data in a sequence, as a constantor zero. Three inputs are required: bbb.eeeii ENTERstart value ENTER increment value XEQ BI . X showslast value stored when routine stops, Y contains ISGvalue, Z and T are cleared, LASTX contains increment

value.

IXROM: 10,44 SIZE: A/R SRL: 5 I? YES F: BL C: 46J

2]M- BLDSPEC INPUTS FOR X3

This routine converts BLDSPEC numbers into HP-41 memorybytes for a synthetic text line. Key first BLDSPECnumber, XEQ . See first of seven bytes in X. (0-255). Key second BLDSPEC number, R/S, see second byte.Continue with R/S until all seven bytes are obtained.

To use EEPstart with 247, followed by seven bytes.To print: Text line, RCL M, ACSPEC, PRBUF. Related

routines are FL and XL . These are not intendedto be used as subroutines.

kROM: 10,42 SIZE: 000 SRL: 4 I? YES F: BL C: 46

4 PPC ROM POCKET GUIDE

Page 7: PPGC ROM POGKETDT GUILrDE - hpcalc.org

CIMD - ook move

Applies only to a block of consecutive registers.Input: T: T

Z: 1st register in source blockY: 1st register in destination blockX: number of registers in source block

[XROM: 20,39 SIZE: var. SRL: 5 1? yes F: M2 C: 61

-5oroate

Applies only to a block of consecutive registers.Input: T: T

Z: ZY: 1st register in source blockX: * number of registers in source block

If X>0 the majority of block shifts to higher numberedregisters. |f X<0 the majority of block shifts tolower numbered registers. Amount of shift is by oneregister for each call to 3.

[;fiOM: 20,40 SIZE: var. SRL: 5 1? yes F: M2 C: 61]

SAVAN - BLOCK VIEW

This routine uses a defined block input in X (bbb.eeeii)to view the non-zero contents of the defined registersin the format R: NNN...N. Prints if printer is con-nected and on. For PSE at each register set flag 09.Set flag 10 to stop at each register.

kROM: 20,07 SIZE: A/R SRL: 4 1I? YES F: SR C: 40]

X8 - srock extrema

Input bbb.eeeil In X. If flag 10 is set the blockwill be considered non-negative. |f flag 10 Is clear

X8 may return negative values as extrema. Output:M: register number of max value = INT part of M

: register number of min value = INT part of N0: bbb.eeell = original block control wordY: maximum value In blockX: minimum value in block

[XROM: 20,41 SIZE: var. SRL: 5 I? yes F: M2 C: fl

E— BLOCK STATISTICS

Assign appropriate location of the I-registers.

PPC ROM POCKET GUIDE 5

Page 8: PPGC ROM POGKETDT GUILrDE - hpcalc.org

Enter two block control words of the form bbb.eeeiliIn X and Y. When the two blocks are of the same sizethe order of the Inputs in X and Y is not important.Otherwise only the block control word In Y is testedand controls the loop. Output in E-registers:

Ix zxz Ly Zyz L xy n=# reg. in block

[XROM: 20,42 SIZE: var. SRL: 5 1? yes F: M2 C: gq

(0Pl - CURTAIN FINDER

Returns the absolute decimal address of ROO (curtainlocation). X, Y preserved in Y, Z; Z, T, L lost.

IXROM: 10,16 SIZE: 000 SRL: 6 I? YES F: ML C: 64]

(0 .\ - COMPLEX ARITHMETIC

SIZE 018 minimum. GTO "E " and XEQ 06 to Initialziethe complex stack. The following functions are on the

top two rows of keys.

X . o2a: XC<>Yc b: Yc c c: Pop d: LAST Z e: e

A: + B: - C: * D: + E: LN(2)

Initial ize H: sin(z) 1: cos(z) J: Push(XEQ 06)

Store call # in R0O6 and XEQ " [I3"1:+ 2:- 3:% 4:/ 5:In(z) 6:init. stack7:cosh(y),sinh(y) 8:sin(z) 9:cos(z) 10: PUSH11:X<>Y 12:YIX 13:POP 14:LAST Z 15:elz

16:POP(save LASTz)

[XROM: 20,23 SIZE: 018 SRL: 4 [1? yes F: CA C: 3%

(od;- COUNT BYTES

Counts bytes between any two instructions in RAM.Position program pointer to beginning of sequence(first instruction in display). In RUN mode do aRCL b. Position program pointer to end of sequence

(first instruction after the sequence in the display)and a second RCL b in RUN mode. Then XEQ yieldsthe byte count. When counting bytes in a program(first instruction to END) it may be more convenientto do the 2nd RCL b at the END of the program.In this case, add 3 to the byte count returned by [XY¥.Note that total byte count for a program divided by

6 PPC ROM POCKET GUIDE

Page 9: PPGC ROM POGKETDT GUILrDE - hpcalc.org

112 and rounded up to the nearest integer yields thenumber of tracks required to record the segment on

magnetic cards. (RCL b = 144, 124, k)

[XROM: 10,50 SIZE: 000 SRL: 4 1? YES F: IF C: 60]

Ke5) - craracter o pECTMAL

Decodes last byte of alpha register (rightmost char-acter displayed) into a decimal number returned in X.Up to 14 characters (the rightmost 14) will be pre-served in the alpha register, including the decodedcharacter if Flag 10 is set. Otherwise the decodedcharacter is deleted. X, Y, Z preserved in Y, Z, T;

in X; X, Z, T, and L are Tost.

hROM: 10,35 SIZE: 000 SRL: 6 I? YES F: VM C: 60}

(o ll - CALENDAR DATE TO JULIAN DAY NUMBER

Clear flag 10 for Gregorian (modern) calendar. Setflag 10 for Julian calendar. Input date In format:

Z: year The JDN Is returned in X.Y: month DOW = (JDN + 1) MOD 7X: day The Inverse routine Is EE.

[;;bM: 20,21 SIZE: 000 SRL: 5 |? yes F: BD C: 53]

8- cerr ey assianvents

A11USER mode assignments revert to the standard key-board. Assignment registers are returned to the poolof unused registers without any need to PACK. Globallabel assignments are dormant until the next programcard is read in.

|XROM: 10,06 SIZE: 000 SRL: 4 I? YES F: LF C: 59|

m- COMBINATIONS

To compute C(n,k) key n enTERY K XEQ """, Thenumber of combinations of n objects taken k at a time

Is left in X.

[XROM: 20,20 SIZE: 000 SRL: 5 1? yes F: BD C: 53

(o4 =B - COLUMN PRINT FORMATTING

Aligns numeric values for printing columns of data.

PPC ROM POCKET GUIDE 7

Page 10: PPGC ROM POGKETDT GUILrDE - hpcalc.org

A skip index in R06 keeps decimal points in place. In-

dex is calculated as (Max # digits left of dec. pt.)-1 for F29 clear, and (Max # digits...) -1 + (No. com-mas in largest number in the column) for F29 set. Setdisplay mode, status of F29, place skip index in RO06,place the number in X and XEQ @&@. The number will thenbe added to the buffer in the correct column position.

bROM: 20,27 SIZE: 007 SRL: 5 I? YES F: LG C: 29

- CURTAIN UP

Adds the integer value (including sign) of the contentsof X to the pointer in status register c to registerROO. The sequence 10, XEQ raises the curtain 10registers. Then the sequence -10, XEQ Towers itto its previous position. Y, Z preserved in X, Y; X,T, L Tost.

[XROM: 10,34 SIZE: 000 SRL: 6 I? INP F: VM C: 6(?]

[OAVE - CURVE FIT

SIZE 027. GTO "B " and the following functions areon the top row of keys.

a: I- A A e: InitiallizeA: Z+ B: Solve Type j C: Y D: X E: Solve Best

Curve Types: 1. Linear y = bx + a

2. Exponential vy = a*ebx (a>0)3. Logarithmic y = b*In(x) + a

4. Power y = a*xb (a>0)

Key x ENTER? y and press A for each data pair.Key B returns: - X: b Y: a Z: rKey E returns: X: j Y: b Z: a T: r

Registers used:

RO6: fct. # R13: Ix, R20: I In(x)?RO7: cv type R14: Ix R21: len(y)2RO8: b, x R15: Zyz R22: I lIn(y)R09: a, y R16: Ty R23: ZIn(x)*In(y)R10: r R17: I xy R24: nR11: Z x¥*In(y) R18: In R25: best rR12: Z y*|n(x) R19: I In(x) R26: best cv type

Store call # In RO6 and XEQ " ="

O:clear/init. 1: r+ 2:solve type | 3: Y 4: X5:Solve Best Type 6: I-(when F10 set) 9:stop in CV

XROM: 20,08 SIZE: 027 SRL: 4 1? yes F: CV C: 42]

8 PPC ROM POCKET GUIDE

Page 11: PPGC ROM POGKETDT GUILrDE - hpcalc.org

m- CURTAIN TO ABSOLUTE DECIMAL LOCATION IN X

Places hex version of x into the appropriate 3-nybble slot (the pointer to RO0) in status register c.Values 17 through 192 (mod 1024) or greater than 512(mod 1024) will result in "MEMORY LOST". Y preserved

in X; X, Z, T, and L are lost.

XROM: 10,33 SIZE: 000 SRL: 5 I? INP F: VM C: 60]

EX3) - oecimaL TO CHARACTERAppends to alpha contents the character correspondingto the decimal integer (mod 256) in X. Y, Z preserved

in X, Y; X, T, L lost.

[;fiOM: 10,11 SIZE: 000 SRL: 6 I? YES F: LF C: 55]

I3- oecima 1o EracTion

SIZE 011. Store display setting (0-9) in RO7. Setflag 10 to display fraction in alpha or clear flag 10

for no display. Enter decimal In X and XEQ "@ ".Reduced fraction Is left in Y (numerator) and X(denominator) and In addition, If flag 10 was set thefraction is displayed In alpha.

[;ECM: 20,13 SIZE: 011 SRL: 4 1? yes F: FR C: i;]

m- DECIMAL TO PROGRAM POINTER

The inverse to @ . Converts a decimal byte addressin X to a program pointer that via a STO b can resumeprogram operation where desired. See Ab regarding

program pointers. Byte addresses begin with 0 atthe bottom of status register memory through 111; this

is followed by a 'hole' from 112 to 1343; then followsuser memory from 1344 to 3583 (for the full complementof user registers). Among possibilities offeredby B3 (but requiring great care) are execution ofprograms set up in data registers or the stack. Only

Y is preserved; X, Z, T, L are lost.

[;ECM: 10,53 SIZE: 000 SRL: 5 I? YES F: IF C: 60]

mDELETE RECORD

RO7: 1st register of entire fileRO8: number of registers per recordRO9: number of records in the file

PPC ROM POCKET GUIDE 9

Page 12: PPGC ROM POGKETDT GUILrDE - hpcalc.org

To delete the kth record key In k and XEQ "GI3".RO9 Is automatically updated. Inverse routine Is UGB

LXROM: 20,38 SIZE: var. SRL: 5 7 yes F: M2 C: zfl

m= DISPLAY SET

8 provides a capability similar to the HP-67/97DSP function, which sets the number of decimal placesto be displayed without changing the display modetype (FIX, ENG, or SCI). If FIX, SCl or ENG n is setthen keying m XEQ "EB " changes the display mode toFIX, SCI, or ENG m.

[{?OM: 10,29 SIZE: 000 SRL: 6 I? YES F: VM C: 66]

(RN DISPLAY TEST

Turns on all 12 commas for 1 second (execution can beinterrupted at this point), then all display segmentsand annunciators except for the comma tails. Reviewthe display, then push the PRGM switch and R/S toclean up. X, Y, and Z are preserved.

[EEOM: 10,17 SIZE: 000 SRL: 6 I? NO F: ML C: 64

B33 oo ookReturns the absolute decimal address of the register

containing .END. in its last 3 bytes (bytes 02-00).This is done by decoding the appropriate pointer

digits in status register c. X, Y preserved in Y, Z;Z, T, L lost.

[;ROM: 10,62 SIZE: 000 SRL: 5 I? YES F: IF C: 66]

m- ERASE PROGRAM MEMORY

As Tong as Flag 14 is clear and there is a programlabeled '//' (as described below) in RAM, XEQ Gwill clear programs following that labeled '//'.

LBL '//'

RCL b

END or RTN

(followed by at least 6 bytes before .END.)If Flag 14 is set or if there is no program '//' asdescribed, all programs will be erased. XEQ IE3should be followed by PACK to reinstate Catalog 1.

[EBOM: 10,31 SIZE: 000 SRL: O I? YES F: VM C:?ifl

10 PPC ROM POCKET GUIDE

Page 13: PPGC ROM POGKETDT GUILrDE - hpcalc.org

23 eonent ox

Replaces X by its exponent portion, -99 to +99. The

old X is saved in L; Y, Z, and T are preserved

’XROM: 10,27 SIZE: 000 SRL: 6 I? YES F: VM C: 60

- FREE REGISTER FINDER

Returns the number of free (available) registers be-tween the last used assignment register and the .END.

register; there will be a non-zero fractional part 0.5whenever the top assignment register contains only asingle assignment in the left half of the register.See 3.

IXROM: 10,04 SIZE: 000 SRL: 3 I? YES F: MK C: 6Tl

E2)- 5 irst oerivaTivE

SIZE 018. Calculates f'(a). Program function f(x).@) uses R10-R17. Store the following:R10: function global label nameR11: polinter to register containing xR12: step sizeStore a in register pointed to by R11.Flag FO9 set selects quick approximation. FO09 clearselects adaptive procedure. |f FO09 Is clear then F10controls a display option. Set F10 to viewconvergence of optimal step size. Estimate of firstderivative is left in X and In addition, if FO9 Isclear an error estimate Is left in Y.

[XROM: 20,11 SIZE: 018 SRL: 4 1? yes F: IG C: 43]

m- FINANCIAL CALCULATIONS

SIZE 010. GTO "WER" and the following functions areon the top two rows of keys:

a: 12x b: 12+ c: C/D? d: B/E? e: ClearA: n B: %1 C: PV D: PMT E: FV

H: CF l: PF J: Status

FO8 set/clear = C/D. F09 set/clear = B/E. Set F10(optional) to view convergence when solving for %I.

Store call # in R0O6 and XEQ " IZM"O:clear/Init. 1:solve n 2:solve §1 3:solve PV4:solve PMT 5:solve FV 12:stop in FI

[XROM: 10,63 SI7E: 010 SRL: 4 1? yes F: FI C: 47

PPC ROM POCKET GUIDE 11

Page 14: PPGC ROM POGKETDT GUILrDE - hpcalc.org

-6 veuts Forem

This routine provides the P bytes for a synthetictext Tine from the flags set inputs. To use XEQ IEW,key first flag set, R/S. If X is negative, key nextflag, R/S. If TONE sounds, record byte number. Keyflags set in order of lTowest to highest. Seven bytesare needed. Use 56 as last input if required. Touse start with 247, followed by seven bytes. In

a program use sequence: Text line, RCL M, STO d.Related routines are BL and XL .

XROM: 10,43 SIZE: 000 SRL: 4 I? YES F: BL C: 4a

m= FRACTIONS

GTO "EZB". The following functions are on the toprow of keys:

a: 3 b: [ c: gcd d: B3 e: M3A: + B: - C: * D: = E: Reduce

Set F10 to display fractional forms in alpha. Use FIX0 and clear flag 29.

Store call # In R06 and XEQ " ETGB"1:+ 2:-= 3:% 4:/ 5:Reduce Y/X 6:GCD(x,y)

[XROM: 20,12 SIZE: 000 SRL: 4 1? yes F: FR C: ZEI

K3-0 o0 ePlaces program pointer at line 00 of the last programfile in memory (the one that contains the .END. ofprogram memory). If you switch to PGM mode, thenumber of available registers is displayed (as whenGTO.. is executed). (B provides a handy way tomove out of ROM back to RAM.

[XROM: 10,60 SIZE: 000 SRL: O I? YES F: IF C: 60]

m- GAUSSIAN RANDOM NUMBER GENERATOR

Use any data register to hold the seeds, say reglisterk. Store Initial seed In Rk. Store mean in R06 andstore standard deviation = s in RO7. 68% +1s 95% +2s99.7% + 3s. Use DEGREES mode. Enter k in X and XEQ "D" to generate two random numbers, one In X and oneIn Y. Pointer k is returned In Z and T. @@ callsthe related routine IB.

[XROM: 20,15 SIZE: 001 SRL: 4 |? yes F: FR C: 361

12 PPC ROM POCKET GUIDE

Page 15: PPGC ROM POGKETDT GUILrDE - hpcalc.org

G} hiGH RESOLUTION HISTOGRAM WITH AXIS

Prints a bar-chart bar whose height is proportional tothe input in X where X is between Ymin (stored in R0O)and Ymax (stored in RO1). Plot width (1 to 168 col-umns) is integer part and column position of the axis(1 to 168) is fractional part of R02. Bar is printedfrom axis to value, either up or down. Character(ACCHR #) to print the bar is stored in R03. Partialcharacter (ACCOL #) to print portion of bar is storedin RO5. Store values in ROO to RO3 and R0O5, place thenumber in X, XEQEE and a bar is added to the printbuffer.

hROM: 20,25 SIZE: 006 SRL: 5 I? YES F: LG C: 2%J

BT) - Hioc oata ReGisTERsIf size > k+6, the sequence k, XEQ GBIraises the cur-tain by k registers, and places in former Rk (ROO after

the curtain is raised) an alpha constant used by O3

to easily reinstate the curtain position before the?hift by GBY . Y, Z, T preserved in X, Y, Z; X, Lost.

XROM: 10,20 SIZE: X+6 SRL: 6 I? INP F: ML C: E;q

G- sex oConverts up to 14 hex characters in alpha to an NNN inX. Leading zeros need not be entered, and the spacecharacter can be used instead of zero. There aretwo acceptable characters for each hex digit greaterthan 9: 'A' is equivalent to ':'; 'B' to ';'; 'C' to'<'5'D' to '='; 'E' to '>'; 'F' to '?'. Unlike theinverse function QED, the status of Flag 10 is irrele-vant. X, Y, Z are preserved inY, Z, T.

XROM: 10,41 SIZE: 000 SRL: 6 I? YES F: NH C: 33]

mg HIGH RESOLUTION PLOT

Plots 1 to 9 user RAM functions simultaneously in highresolution in the X direction (7 plot points perprinted line). Store Ymin in R00, Ymax in ROl, plotwidth (1 to 168 columns) in R02, Xmin in R0O8, Xmax inR09, X increment in R10. Function names (global la-bels 6 char's or less) are stored in R15 to R23.Place the number of functions in X and XEQ G, SeeC@Awriteup for flag usage and other options.

XROM: 20,29 SIZE: 040 SRL: 3 1? YES F: MP c:a

PPC ROM POCKET GUIDE 13

Page 16: PPGC ROM POGKETDT GUILrDE - hpcalc.org

GE) - i6H ResoLUTION HIsTOGRAM

Prints a bar-chart bar whose height is proportional tothe input in X where 0 < X < 1. Plot width (1 to 168columns) is stored in RO4. Character (ACCHR #) toprint bar is stored in R03. Partial character (ACCOL#) to print portion of the bar is stored in RO05.Store values in RO3 to R05, place the number in X, XEQ

CEBand a bar is added to the print buffer.

[XROM: 20,26 SIZE: 006 SRL: 5 I? YES F: LG C: Eg]

B3 vk riac

Toggles flag (changes state: clear to set or viceversa) specified in X (0 through 55). Y, Z preservedin X, Y; X, T, L lost.

&ROM: 10,49 SIZE: 000 SRL: 6 I? YES F: IF C: éa]

m- INTEGRATE

SIZE 030. Program function f(x). [uses R10-R29

and flag 09. Store global label function name in R10.Set flag 10 to display,iterations. Set display mode.Key In IImits a ENTERT b and XEQ "M". Integralapproximation is returned in X.

R10: function label name R15: Sk

R11: counter k R16: (b-a)/4R12: u R17: (a+b)/2

RI3: 1 - u,? R18: M(k,0)R14: 217K R19: M(k,1)

.

.

IXROM: 20,09 SIZE: 030 SRL: 4 1? yes F: IG C: 43

Bl vomreze paeeStore information from status register c in absolutelocation 256 (decimal), the bottom register of theexternal portion of memory. This stored informationwill be used by B to restore the proper pointerswhen the page is switched back on line. If you decidenot to switch the page off line immediately after ex-ecuting UG, execute G (without actually switchingpages--just R/S in response to the switching prompt)to clear Tlocation 256.

[XROM: 10,45 SIZE: 000 SRL: 3 I? YES F: BL C: 46J

14 PPC ROM POCKET GUIDE

Page 17: PPGC ROM POGKETDT GUILrDE - hpcalc.org

m- INSERT RECORD

RO7: 1st register of entire fileRO8: number of registers per record

RO9: number of records in the file

To make room to Insert a new kth record, key in k andXEQ "UEM". RO9 Is updated. Inverse routine is I3

{XROM: 20,37 SIZE: var. SRL: 5 1? yes F: M2 C: 61

-JULIAN DAY NUMBER TO CALENDAR DATE

Clear flag 10 for Gregorian (modern) calendar. Setflag 10 for Julian calendar. Key JDN in X and XEQ"E". Date Is returned In stack as:

Z: yearY: month

X: day of month Inverse routine Is

[fFOM: 20,22 SIZE: 000 SRL: 5 1? yes F: BD C: ;;]

O-Lom0 kT oF L8

(8 and & permit construction of programs than canwrite (create) other programs. Prepare the programarea (1den1;ified by LBL '++') as for . In theprogram-writing program place the instruction XEQ (@to initialize the byte-loading process and returnwithout prompting for bytes. See B3 for the loadingof individual bytes.

[XROM: 10,23 SIZE: 012 SRL: 4 1? YES F: LB C: 7£]

)- LoByEsPermits the loading of arbitrary bytes into programmemory, to facilitate synthetic coding. At Tocationin program where bytes are to be loaded, key in LBL"+4+", 4+, +, +, ... , XROM @B . The number of +'sshould be at least n+6, where n is the smallestmultiple of 7 not less than the number of bytes youintend to load using . With the program pointersomewhere in this keyed-in sequence, switch to RUN

mode and press R/S. The prompt 'HEX/DEC INPUT' whichprecedes the prompt for byte #1 reminds you that eitherhex or decimal input is acceptable, depending only uponwhether the mode is ALPHA or not, at the time you keyin an input. You can change the mode at will during

the sequence. Press R/S after each entry. Pressing

PPC ROM POCKET GUIDE 15

Page 18: PPGC ROM POGKETDT GUILrDE - hpcalc.org

FUNCTIONAL GROUPING

ALPHA REGISTERAV ADB viAB nCI SUJ

BLOCK OPERATIONS

MG d M oDM E DD0 B B

CURTAIN

e cu C ol uo)

DISPLAY

G mom e

KEY ASSIGNMENTS

©G N 3 m+ =

< =

LOAD BYTES

x [

Hb iY i - -}

MATHMATICS

i

N

2] >

S-]

AEEBBE

] =

Ho

3]

3B

oEEEEEBE

BEEEEA

— N

OF ROM ROUTINES

MATRIX

BN

MEMORY

P =

cm(5w

1][ad

\

MISCELLANEQUS

@G o E;Eca

NON-NORMALIZED NUMBERS

G @O @o @

PERIPHERALS

C

[X¢j

PROGRAM POINTER

MO G ;@D B Ǥm

RETURN STACK

o &8

SORTS

DG &3 |

PPC ROM POCKET GUIDE

Page 19: PPGC ROM POGKETDT GUILrDE - hpcalc.org

HP-41C STATUS REGISTER USEAGE (0 tHrRu 15 ABSOLUTE)

6 | 5 | 4 | 3 |2 | 1 | 0 e—BYTET r 1 NUMBER

scr- LINE. ‘SHIFTED KEY ASSIGN. arcn no. 015

oot sysTen FLags 014d USER FLAGS (0-29) !| (02 1| Goss) |l COLD 1] 013c TREG sTaRT REG 00 END.

T

ADDRESSb 309 2nd ReTurn|1st ReTurn pornTer 012

a |6th ReTuRN 5th ReTURN ath reTuRY 35S 012| | |[ l

oF UNSHIFTED KEY ASSIGN. SCRATCH 010= l | | |= | l |z Q TEMPORARY ALPHA SCRATCH 009

: s i=p SCRATCH FOR ALPHA REGISTER= ALPHA 25-28 2024 008< | ] |& l | l&0 ALPHA REGISTER 15-21 CHAR. 007~ I | |z l l | ls N ALPTA REG{STER ?-14 CTAR. 006

e [ I | |M ALPHA REGISTER 1-7 CHAR. 005

4 |1 I

L STACKIREGISEER L 004

| IX STACfi REGISEER X 003

| IY STACKIREGISFER Y 002

| IZ STACfi REGI%TER z 001

| |T STACfi REGISEER T 000

REG.(%] w

5"‘— mantissa —————— 3| €XP NO.> >

PPC ROM POCKET GUIDE 17

Page 20: PPGC ROM POGKETDT GUILrDE - hpcalc.org

R/S without an entry tells the program you're through.

You can back up a byte by XEQ 03 (even if you've toldthe program you're through, providing you haven't begunto carry out the terminating instructions).

The prompt "SST, MORE +'S" indicates you don't haveenough +'s to load even one byte. Pushing SST once

will get you to LBL "++", where in PRGM mode you caninsert more +'s and restart.

The terminating procedure is prompted. The SST is inRUN mode. The DEL is in PRGM mode. Following yourloaded bytes, there may be some final +'s (at most6).The X-register contains a number of the form p.00q.The termination prompt called for DEL 00p. Positionedat the first of any final +'s in PRGM mode, DEL 00qwill remove these excess +'s and the XROMinstruction.

MOM: 10,22 SIZE: 012 SRL: 0 I? YES F: LB C: 71

(W2l -OCATE FREE REGISTER BLOCKAdd 16.016 to returned value to get bbb.eee where

bbb and eee are the absolute decimal addresses ofunused registers between the last used assignmentregister (if any) and the register containing .END.If flag 10 is set on completion of , the left halfof the bbb register is occupied by a key assignment.

IXROM: 10,05 SIZE: 000 SRL: 4 I? YES F: LF C: 59

(el PPC LOGO

XEQEXS, ADV or PRBUF to print PPC Logo. SF12 for dou-ble wide. 21 columns. Use to identify PPC materials,

business cards, "MEMBER PPC" with PPC being the LOGO,etc.

IXROM: 20,24 SIZE: 000 SRL: 5 I? YES F: LG C: 29

A LevctHen RETURN STACKStores <5 return pointers (calls prior to that on 3 )in data registers Rx and Rx+1 in a format permitting

reinstatement by E@. Allows call depths as deep asavailable data storage space permits, providing thatsuccessive calls on are separated by no more than5 levels of subroutine nesting. For example, callsat the 5th and 10th Tevels of nesting (together withthe associated calls on ED) would permit successfulreturn from calls nested 16 deep (and would use only

18 PPC ROM POCKET GUIDE

Page 21: PPGC ROM POGKETDT GUILrDE - hpcalc.org

4 data registers). Y, Z, T preserved in X, Y, Z; X,L lost.

F(ROM: 20,02 SIZE: 002 SRL: « I? YES F: SR C: 4q

LD- v+7Rix, INTERCHANGE THO ROWS

RO7: start. reg. of matrix RO08: # columns in matrix

To Interchange rows 1 and jJ, key | ENTERT J XEQ"m".

XROM: 20,33 SIZE: var. SRL: 4 1? yes F: M2 C: 61]

m-— MATRIX, MULTIPLY ROW BY CONSTANT

See B . To multiply row ] by the constant k, keyk ENTER} j xEQ " gm@".

[XROM: 20,31 SIZE: var. SRL: 4 1? yes F: M2 C:i{l

m— MATRIX, ADD MULTIPLE OF ROW TO ANOTHER

See B . To,add k times row | to row J» key |enTER} 1 ENTER} XEQ "WHE". Row J will change. RowI will not change.

[XROM: 20,32 SIZE: var. SRL: 4 1? yes F: M2 C: 61

m- MATRIX, REGISTER ADDRESS TO (i, ])

See @H. Key In register r and XEQ " LEB". Rownumber | Is returned in Y, column number j Is returned

In X. Inverse routine is @8.

EROM: 20,35 SIZE: var. SRL: 4 1? yes F: M2 C: GTJ

m- MATRIX, (1,j) TO REGISTER ADDRESS

See I} . Key 1 enTEr} j and XEQ " @B". Registernumber r is returned in X. Inverse routine is OIB.

XROM: 20,36 SIZE: var. SRL: 5 1? yes F: M2 C: 61]

(Y- revory 10 ALPHA

This routine alpha recalls the contents of a block ofdata registers using a control number in X of the formbbb.eeeii. Inverse of B . Using the CXDexample:

PPC ROM POCKET GUIDE 19

Page 22: PPGC ROM POGKETDT GUILrDE - hpcalc.org

1.004 XEQ GX¥"brings back" the previously stored alpha

register contents.

&EBM: 20,54 SIZE: 005 SRL: 5 I? YES F: NS C: 161

m- MAKE MAKE MULTIPLE KEY ASSIGNMENTS

XEQ @@ first reports the number of registers availablefor assignments. (Should "NO ROOM" be reported, take

corrective action before continuing, by pressing R/S ifyour corrective action did not move the programpointer.) Then the program prompts "PRE+POST4KEY".Key in decimal equivalent of the first byte (prefix),ENTER*, decimal equivalent of the second byte (post-fix), ENTER+, user keycode, R/S. After each successfulassignment, the program will either prompt for anotherassignment or indicate no more available room with themessage "DONE, NO MORE". (In the latter case, proceedas with the "NO ROOM" message.) If you don't wish tomake any more assignments, there is no terminationprocedure; simply go on to whatever subsequent taskyou intended.

The messages "KEY TAKEN" followed by "KEYCODE?" issuggesting you select another keycode, since the oneyou specified is already in use. Your options are:

(1) enter another keycode and press R/S; (2) enterzero, indicating your desire to restart the assignment

in process, and press R/S; (3) delete the previousassignment to the key you want to use and press R/S.

The messages "NO SUCH KEY" followed by "KEYCODE?"

indicate that your keycode entry is illegal. Options(1) and (2) in the preceding paragraph apply to theseerror messages.

At times (whenever Flag 20 is clear) the EI3programwill recount key-assignment registers to ensure nooverlaps or gaps occur.

bROM: 10,01 SIZE: 012 SRL: 3 I? NO F: MK C: 61'

I8 - vevory Loss resize o 017LM should only be executed immediately after MASTER

CLEAR, when the curtain and .END. are at their MEMORYLOST positions. XEQ EWis essentially equivalentto XEQ SIZE 017, making more registers available forToading in Tong programs.

XROM: 10,12 SIZE: - SRL: O I? YES F: ML C: 611

20 PPC ROM POCKET GUIDE

Page 23: PPGC ROM POGKETDT GUILrDE - hpcalc.org

m- MULTIPLE VARIABLE PLOT (1-9)

Plots 1 to 9 user RAM functions or numerical valuessimultaneously in standard resolution (1 plot pointper printed Tine). Store Ymin in R0OO, Ymax in RO1,plot width (1 to 168 columns) in R02, Xmin in RO8, Xmax in R09, X increment in R10. Function names (glo-bal Tabels 6 char's or less) are stored in R15 to R23.Place the number of functions in X and XEQ @. See I3writeup for flag usage and other options.

hROM: 20,28 SIZE: 035 SRL: 3 I? YES F: MP C: 8g1

MY- remory 1o sTACK

This routine recalls five data registers in sequence

and stores them in X, Y, Z, T, and L. R06 must containthe lowest register of the five register block. Touse: N STO 06, XEQ T.

[XROM: 10,48 SIZE: 005 SRL: 5 1I? YES F: BL C: gg]

(VLI - MANTISSA OF X

Replaces X by its mantissa. 01d X to L; Y, Z, Tpreserved.

BROM: 10,28 SIZE: 000 SRL: 6 I? YES F: VM C: 60]

[\'[o -NTH CHARACTERExtracts the Nth character (1<N<10) from the right endof alpha register. This extracted character becomesthe new contents of X and the alpha register. 01d Xpreserved in L; Y, Z preserved; T, L lost.

[XROM: 10,38 SIZE: 000 SRL: 6 I? YES F: VK C: 631

- NNN TO HEXDecodes an NNN in X to 14 hex characters in alpha. X,

Y, Z are preserved; T, L lost. The characters forhexadecimal digits greater than 9 depend upon whetheror not Flag 10 is set. See table below. The conver-sion is much faster when Flag 10 is set.

Flag 10: Set Clear

: A

5 B

< C

= D

PPC ROM POCKET GUIDE 21

Page 24: PPGC ROM POGKETDT GUILrDE - hpcalc.org

> E

? F

|XROM: 10,40 SIZE: 000 SRL: 6 I? YES F: HN C: 35]

Irexr erive

Key Integer n In Y and starting trial divisor d In X.d=2 or d is an odd number greater than 2. XEQ "@IE@"n is returned in Y and next divisor p Is returned InX. Press R/S for the next factor.

EROM: 20,14 SIZE: 000 SRL: 5 I? yes F: FR C: 36]

LY- vrecact

Recalls NNN stored by @B in Rx and Rx+1' The NNN

replaces the contents of X. Y, Z, T, L are preserved.

[XROM: 20,50 SIZE: 002 SRL: 6 I? YES F: NS C: 16

(NSB NNN_ STOREStores Y in RX and RX+1 in a format that allows recall

by G of the NNN in Y. Y, Z, T preserved in X, Y, Z;X, L Tost.

BROM: 20,49 SIZE: 002 SRL: 6 I? YES F: NS C: 16]

XY - open memoryPlaces curtain at absolute decimal address 16 (justabove the status registers). Used by various ROMroutines to permit access to key assignments andprogram memory. @Areturns with the formercontents of status register c in X. Former X, Y,Z, L preserved inY, Z, T, L; T lost.

IXROM: 10,58 SIZE: 000 SRL: 5 I? YES F: IF C: 66]

m-PROGRAM POINTER ADVANCE@Xis a selectable byte jumper. In PRGM mode

position the program pointer to the line from which youwant to byte jump. In RUN mode fetch the pointer witha RCL b. With this pointer in Y and an integer decre-ment in X (a negative integer would be an increment--i.e., backward in program memory), XEQ Eyields apointer in X moved the specified number of bytes in

the specified direction: a plus integer in X moves

22 PPC ROM POCKET GUIDE

Page 25: PPGC ROM POGKETDT GUILrDE - hpcalc.org

the pointer downward in user memory--i.e., forward in

the program. In RUN mode a STO b on the output of I3will then effect the actual byte jump. Switch to PRGMmode and see a line 00 display. Press SST to seewhere the pointer is located. (This SST from line 00does not advance the program pointer: the HP-41merely displays what it believes to be Tine 01.)A GTO.. (any line) or a BST will re-establish correctline numbers. Only the original X (the decrement) ispreserved in Y; X, Z, T, L are lost.

XROM: 10,59 SIZE: 000 SRL: O I? YES F: IF C: 60

G2- Procram PornTER TO DECIMALConverts a program pointer (from the last 2 bytesof status register b in RAM format) to a decimal byteaddress. See inverse [regarding byte addresses.

IXROM: 10,52 SIZE: 000 SRL: 5 I? YES F: IF C: 60

- PACK KEY ASSIGNMENT REGISTERS

If key assignments deleted leave a number of assignmentregisters with only one active key assignment, PACKingwill not merge two half-registers into one. To recoveras many registers as possible, XEQ E@after severalassignment deletions.

[XROM: 10,09 SIZE: 000 SRL: 4 I? YES F: LK C: 59

G- PervuTaTiONS

P(n,k) = number of permutations of n objJects taken k

at a time. Key n ENTER} k and XEQ "&@@". P(n,k) Is

returned in X.

[ihOM: 20,19 SIZE: 000 SRL: 5 1? yes F: BD C: 53]

m- PACK REGISTER

R10: base b R11: register pointer |

To store the number n in position k in register Rj,key n enTEr} K XEQ "". Inverse routine is @.

Data Range Base b Position Numbers

0-1 2 1-300-2 3 1-190-3 4 1-15

PPC ROM POCKET GUIDE 23

Page 26: PPGC ROM POGKETDT GUILrDE - hpcalc.org

0-4 5 1-130-6 7 1-110-9 10 1-100-13 14 1-80-20 21 1-7

0-36 37 1-60-99 100 1-50-214 215 1-40-1413 1414 1-30-99999 100000 1-2

l;ROM: 20,45 SIZE: var. SRL: 4 I? yes F: M2 C: 61]

Y- procer our

This routine advances the paper in the 82153A Printerfive times. When printer is not connected and on itmay be used as a delay of about 1/5 second.

IXROM: 20,51 SIZE: 000 SRL: 5 I? YES F: NS C: 16]

LB- pace swrrcenWith flag 10 clear, put the name of the destinationprogram in ALPHA, and place the two page numbers inY and X, then XEQ EEBfrom the keyboard or in aprogram. @ implements a switch from page Y to

page X as follows. @@ first stores informationfrom status register ¢ into absolute location 256(decimal) of page Y, the bottom register of theswitchable part of memory. The program then promptsfor the user to switch page Y off and page X on. WhenE&is restarted location 256 of page X, which was

previously initialized by Wor K&, is recalledand placed in status register c. Execution is thentransferred to the destination program.

{XROM: 10,46 SIZE: 000 SRL: O I? YES F: BL C: 4;1

m- QUOTIENT REMAINDER

Replaces Y and X by (Y-Y mod X) /X (the quotient)and Y mod X (the remainder). Z, T are preserved;old X to L; L lost. Also, up to 14 characters inalpha will be preserved.

[XROM: 10,54 SIZE: 000 SRL: 6 I? YES F: IF C: 26]

m- RECALL DISPLAY MODE

Restores an earlier display mode stored in RX by E3).

24 PPC ROM POCKET GUIDE

Page 27: PPGC ROM POGKETDT GUILrDE - hpcalc.org

(Actually restores the earlier state of flags 16through 55.) X, Y, Z, T preserved in L, X, Y, Z;L Tost.

[XROM: 20,05 SIZE: 001 SRL: 6 I? YES F: SR C: 40]

LIreser ruacsStores hex 00 00 00 2C 02 80 00 in status registerd; this resets flags to Master Clear status (except

(except for FIX 2, rather than FIX 4). X, Y, Z, T,L are unchanged.

[XROM: 10,13 SIZE: 000 SRL: 6 I? YES F: ML C: 6%]

G- R« - REACTIVATE KEY ASSIGNMENTS

Transfers assignment bit maps stored in Rx and RX+1

(py Ed ) into status registers t and E. This reac-tivates the suspended assignments. Y, z, T preservedin X, Y, Z; X, L lost (L contains original X incre-mented by 1).

IXROM: 20,06 SIZE: 002 SRL: 6 I? YES F: SR C: 40]

m— RANDOM NUMBER GENERATOR

Use any data register to hold seeds, say register k.Store Initial seed In Rk. To generate next random

number r, 0<r<1, key in k and XEQ " GID".

[%ROM: 20,16 SIZE: 001 SRL: 5 1? yes F: FR C: 3§J

A4 - RETURN ADDRESS TO DECIMAL

Converts a RAM return address (first return address:bytes 03 and 02--third and fourth from the end-of-status register b) placed in X (by a RCL b, forexample) to a decimal byte address. See EI3 regardinglegal byte addresses.

[gfiOM: 10,51 SIZE: 000 SRL: 5 I? YES F: IF C: 66]

m- RECALL FROM ABSOLUTE ADDRESS IN )_(-

Only valid decimal addresses are 192 to 511. Contentof register accessed is normalized (so USE WITH CARE)and that is the form returned in X. WARNING: if"NONEXISTENT" occurs, the alpha constant in X mustbe stored in status register c to regain the former

PPC ROM POCKET GUIDE 25

Page 28: PPGC ROM POGKETDT GUILrDE - hpcalc.org

curtain position. Avoid using EX3with flag 25 set.Y, Z preserved; X, T, L Tost; L will contain the oldX - 16.

kROM: 10,57 SIZE: 000 SRL: 4 I? YES F: IF C: 60]

LDy reca vYields an address in the PPC ROM permitting identifica-tion of the port it is plugged into. XEQ EI®, XEQG ; the last 4 nybbles will be xF12, where x = 9,

B, D, F for ports 1 through 4, respectively.

BBOM: 20,52 SIZE: 000 SRL: 6 I? YES F: NS C: 151

m-STACK SORT

This routine arranges (sorts) the stack registers, X,

Y, Z, and T in numerical order, lowest value in T,highest in X. If Flag 10 is set, the lowest value

will be placed in X, highest in T.

[;EGM: 20,46 SIZE: 000 SRL: 5 I? YES F: S1 C: 42]

m- SMALL ARRAY SORT (< 32)

This routine sorts any block of registers in memory

into ascending order (lowest numerical value in Towestregister) using a block control number in X of theform bbb.eeeii. Optimum time is obtained if block is< 32. For larger arrays use E¥B. Routine finisheswith block control number in X. No ALPHA allowed.

[KROM: 20,48 SIZE: A/R SRL: 5 I? NO F: S1 C: 47]

m- LARGE ARRAY SORT (> 32)

This routine sorts a block of registers in memory

from RO3 up,into ascending order (lowest numericalvalue in lowest register) using a block control numberin X of the form bbb.eee. For arrays of 32 or lessuse . No ALPHA allowed.

XROM: 20,47 SIZE: A/R SRL: 4 1I? YES F: S1 C: 47[

- SIZE FINDER

Returns # of data registers (above curtain) in X. X,Y, preserved in Y, Z

PROM: 10,15 SIZE: 000 SRL 5 I? YES F: ML C: 64,

26 PPC ROM POCKET GUIDE

Page 29: PPGC ROM POGKETDT GUILrDE - hpcalc.org

EX2)- srore pispuay mooe

Saves a display mode in RX (actually the status of

flags 16 through 55). If display mode (any of flags16 through 55) 1is then altered, the earlier mode canbe restored via G. Y, Z, T preserved in X, Y, Z;X, L Tost.

IXROM: 20,03 SIZE: 001 SRL: 6 I? YES F: SR C: 40]

m— SELECTION WITHOUT REPLACEMENT

Applies only to block of consecutive registers. Firststore the following:

R06: 1st register of selection blockRO7: number of reglisters in block

As with GIB , use any data register to hold seeds, sayregister k. Initialize Rk with starting seed. Tomake next selection key in k and XEQ "E3". RO7counts number of items remaining.

XROM: 20,56 SIZE: var. SRL: 4 |? yes F: SM C: Zé]

m- SUSPEND KEY ASSIGNMENTS

Stores assignment bit maps from status registers + ande into RX and Rx+1’ respectively, and clears both of

these status registers. Without these bit maps, the

HP-41 assumes no user key assignments are in effect.Y, Z, T preserved in X, Y, Z; X, L Tost (L containsoriginal X incremented by 1).

kEQM: 20,04 SIZE: 002 SRL: 5 I? YES F: SR C: 40

B0 - sreck 1o Memory

This routine stores the stack registers X, Y, Z, T,and L into a continuous block of five registers, the

lowest register number being stored in R06. To storethe stack into RO1-R05: 1 STO 06, XEQ Em@. Theinverse routine is.

{EROM: 20,55 SIZE: 005 SRL: 5 I? YES F: SM C: 26]

m- SHORTEN RETURN STACK

Recalls 5 return pointers stored in RX and R

x+1by UM, combining them in status registers a and bwith the return to the routine calling EGB. Every

PPC ROM POCKET GUIDE 27

Page 30: PPGC ROM POGKETDT GUILrDE - hpcalc.org

call on E@must be preceded (in time) by a call on

0. Y, Z, T preserved in X, Y, Z; X, L lost (Lcontains old X plus 1).

kROM: 20,00 SIZE: 002 SRL: « I? YES F: SR C: 60l

m- SUBSTITUTE CHARACTER

With a single character in Y and an integer in the

range of 1 through 10 in X (and with at most 13characters in alpha), XEQ EWreplaces the x-thcharacter (counting from the right) of alpha by the$haracter inY. X, Y, Z preserved in L, X, Y; T, Lost.

kROM: 10,39 SIZE: 000 SRL: 6 I? YES F: VK C: 6EJ

m- SOLVE

SI1ZE 010 minimum. Program f(x) function. usesR06-R09. Store f(x) global label name in R0O6. Selectdisplay setting. Set flag 10 to view Iterations. Key

stepsize ENTERY guess XEQ " EB".

R06: function label name R08: f(x.)RO7: x, RO9: dxl'

[XROM: 20,10 SIZE: 010 SRL: 4 1? yes F: IG C: 43

m- STORE Y IN ABSOLUTE ADDRESS X

Only valid decimal addresses are 192 to 511. Contentof register accessed is replaced by content of X.WARNING: If 'NONEXISTENT' occurs, the code in Z mustbe stored in status register c to regain the formercurtain position.

IXROM: 10,56 SIZE: 000 SRL: 4 I? YES F: IF C: 661

Y- sorepProvides a STO b with the ROM-mode interpretation.This permits ultra-fast ROM entry. See

XROM: 20,01 SIZE: 000 SRL:A/RI? YES F: SR C: 401

- BEEP ALTERNATIVE

This routine may be used in place of BEEP to produce ashort sound burst to be used as an audio prompt.

[XROM: 10,47 SIZE: 000 SRL: 5 I? YES F: BL C: 46]

28 PPC ROM POCKET GUIDE

Page 31: PPGC ROM POGKETDT GUILrDE - hpcalc.org

E)- oese en o BAse B

Store base b in R06 (2<=b<=19). Key base 10 number inX and XEQ "EE". Base b result is limited to 13digits in alpha and will automatically be displayed ifflag 10 is set. The stack is left cleared. Inverse

routine is EX .

PROM: 20,18 SIZE: 007 SRL: 4 1? yes F: BD C: 53J

LI - TONE N (0-127)

This routine is effectively a TONE IND instructionwhich will produce all 128 synthetic tones. Place

the TONE number in X, XEQ EL0B. Valid inputs: 0-127for TONE, 128-255 for TONE IND, 256-383 TONE, etc.

is most suitable for quick test/Demo. purposes.

IXROM: 10,32 SIZE: 000 SRL: 3 I? YES F: VM C: 60!

m— UNCOVER EATA REGISTERS

XEQ @@uses the contents of ROO established by the

last call on @I to lower the curtain to its previousposition. Every call on @@must be preceded (intime) by a call on EEM. Otherwise you'll get MEMORYLOST. (See EB®.) X, Y, Z, T, L preserved.

BROM: 10,08 SIZE: A/R SRL: 6 I? YES F: LF C: 59]

m- UNPACK REGISTER

R10: base b R11: register pointer = j

To recall the number stored in position k in registerJ» key k in X and XEQ "@EB". The unpacked number isreturned in X. See also G for list of bases anddata ranges. Inverse routine is 3.

[XROM: 20,44 SIZE: var. SRL: 5 1? yes F: M2 C: 61]

KLY - viev AehaLike AVIEW, but EIdnever causes the program to stop.If the printer is plugged in, turned on, and enabledby Flag 21 being set, then the alpha register is alsoprinted. The status of Flag 21 remains unchanged andno stack registers are used.

[fiOM: 10,07 SIZE: 000 SRL: 6 I? YES F: LF C: 59

PPC ROM POCKET GUIDE 29

Page 32: PPGC ROM POGKETDT GUILrDE - hpcalc.org

m- VIEW FLAGS

XEQ W@ displays the numbers of those flags which areset in groups of four (although the last group may

contain less than four). X and Y are preserved, Z, T,L are Tost.

hROM: 20,58 SIZE: 000 SRL: 4 1I? YES F: SM C: 26

\VAI@- VIEW KEY ASSIGNMENTS

Defaults to 82143A Printer function PRKEYS if printeris connected. Otherwise, displays keycodes assigned,key by key from top to bottom, and from left to rightof the keyboard. The consecutive displays show eitherone number or two for a single key: negative numberscorrespond to shifted keys. On completion of EIdthestack is cleared.

BEbM: 10,36 SIZE: 000 SRL: 2 1? YES F: VK C: 6%J

VA ViEW MANTISSA

Views full mantissa of number in X. Leaves stackintact, but alters L and alpha register.

&%OM: 10,26 SIZE: 000 SRL: 5 I? NO F: VM C: 60]

m- VERIFY SIZE

Insert the sequence n, XROM EEB, FC?C 25, PROMPT in aprogram to verify that the SIZE is at Teast n. If itis not, the message "RESIZE>=n" will be displayedfollowing a quick tone. X, Y, Z, and T are preservedin L, X, Y, and Z. Alpha is not disturbed if SIZE is

sufficient.

&fiOM: 10,30 SIZE: 000 SRL: 6 I? YES F: VWM C: QQJ

EG) - Hex 1o DECTMALConvert two hex digits--no more, no less--from thealpha register to the decimal equivalent (0 through255). X is preserved in Y, Z, and T.

hROM: 10,25 SIZE: 000 SRL: 5 I? YES F: LB C: 7i1

m- XROM ENTRY

This routine first constructs a local return pointer(to the PPC ROM) between (in status register b) theprogram pointer in E@and the return to the RAM

30 PPC ROM POCKET GUIDE

Page 33: PPGC ROM POGKETDT GUILrDE - hpcalc.org

routine calling E@. It then proceeds to replacethis return with what were the last two bytes inalpha register M at the time of entry to EX.These two bytes constitute a pointer to any ROMprogram line, set up by the user prior to calling E&.A RTN activates this ROM entry address, and any sub-sequent END or RTN in the ROM program returns thepointer to the RAM program which called E&R.

To set up the pointer in alpha register M, prior toprogram execution, position the pointer at the desiredROM Tine entry and manually perform the sequence (in

RUN mode) CLA, RCL b, STO M, ASTO n, where Rn is any

data register you want to use. In the RAM program

which is to enter the specified ROM line place thesequence CLA, ARCL n, XEQ EX®. X, Y, Z, T and L arepreserved and alpha is cleared.

[XROM: 10,19 SIZE: 000 SRL: 5 I? YES F: ML C: 64]

P AT - XROM INPUTS FOR B

This routine provides the EEBor O3 bytes for use insynthetic instructions or synthetic key assignments.An XROM number of the form AA, BB is converted by AENTER B XEQ EI@ . The Y register will contain the Bbyte, the X register the A byte. Example. Assign

PRA to key 31. PRA = XROM 29,08. el 167, 72.Assign with 167, ENTER, 72, ENTER, 31, XEQ &L® .The printer is not required.

h(ROM: 20,57 SIZE: 000 SRL: 4 I? YES F: SM C: 26]

=? B ZREG FINDER

XEQ €3 yields the number of the first register of thestatistical block of 6 registers. If the result isnegative, the statistical block lies below the curtain,

but is subject to statistical commands (at the user'srisk).

‘;ROM: 10,14 SIZE: 000 SRL: 5 I? YES F: ML C: 64]

E - LREG CURTAIN EXCHANGE

Interchanges pointers in status register c to the

statistical register block and to R0O0. ProvidedSIZE > k+6, the sequence IREG k, XEQ EBmakes theformer Rk now ROO, (but statistical registers commands

should not be used: EEByields -k). A second XEQ E3

PPC ROM POCKET GUIDE 31

Page 34: PPGC ROM POGKETDT GUILrDE - hpcalc.org

re-establishes the former position of the curtain (ROOagain becomes Rk). X, Y, Z preserved; T lost.

XROM: 10,21 SIZE: A/R SRL: 6 1I? INP F: ML C: 64]

NOTES

32 PPC ROM POCKET GUIDE

Page 35: PPGC ROM POGKETDT GUILrDE - hpcalc.org
Page 36: PPGC ROM POGKETDT GUILrDE - hpcalc.org