HP67 Programmable Calculator Emulator -- Instruction Set Instruction Code # Description CLX -128 Clear X register, disables stack lift on next numeric entry. CLSTK -127 Clears entire stack. CLREG -126 Clears all registers. ^ -125 Pushes X register into Y register. RU -124 Rolls stack up; X to Y...Z to X. RD -123 Rolls stack down; T to Z...X to T. >< -122 Interchange X and Y registers on stack. LSTX -121 Moves contents of LAST X register to X lifting rest of stack registers. STK -120 Displays current stack contents. CHS -119 Changes sign of # in X register. ABS -118 Replaces # in X with absolute value of # in X. INT -117 Truncates # in X to integer. FRAC -116 Replaces # in X with fractional portion of # in X. PI -115 Places pi (3.1415...) in X register. + -114 Adds X and Y registers. - -113 Subtracts X from Y register. * -112 Multiplies X and Y registers. / -111 Divides Y by X register. % -110 Replaces # in X with X percent of Y register. %CH -109 Computes percent of change from # in Y register to # in X register ( (X-Y)*100/Y ). N! -108 Computes factorial of integer portion of # in X register. /X -107 Computes reciprocal of # in X register. SQRE -106 Computes square of # in X register. SQRT -105 Computes square root of # in X register. Y^X -104 Raise # in Y register to power of # in X register. ^X -103 Raise 10 to power of # in X register; common anti-logarithm. E^X -102 Raise "e" to power of # in X register; natural anti-logarithm. LN -101 Computes natural (base "e") logarithm of # in X register. LOG -100 Computes common (base 10) logarithm of # in X register. DEG -99 Sets calculator to degree mode; all angular operands assumed to be in decimal degrees. RAD -98 Sets calculator to radians mode; all angular operands assumed to be in radians. GRD -97 Sets calculator to grads mode; all angular operands assumed to be in grads. COS -96 Computes cosine of # in X register. SIN -95 Computes sine of # in X register. TAN -94 Computes tangent of # in X register. ACOS -93 Computes arccosine of # in X register. ASIN -92 Computes arcsine of # in X register. ATAN -91 Computes arctangent of # in X register. >HMS -90 Converts decimal hours or degrees to hours, minutes, seconds in form HH.MMSSSS. >DMS -89 Identical to ">HMS". HMS+ -88 Adds Y register to X register assuming both registers are in form of HH.MMSSSS. DMS+ -87 Identical to "HMS+". >R -86 Converts # in X register from degrees to radians. D< -85 Converts # in X register from radians to degrees. H< -84 Converts # in X register from "HH.MMSSS" form to decimal degrees. >P -83 Converts x,y coordinates in X and Y registers to polar magnitude (r in X) and angle (theta in Y). R< -82 Converts polar magnitude and angle in X and Y registers to rectangular x,y coordinates. Following relational tests are only executed when under program control. NEY -81 Executes next program step if # in X register is not equal to # in Y register; otherwise next program step is skipped. NE0 -80 Executes next program step if X not equal to 0; else skip step. EQY -79 Executes next program step if X = Y; else skip step. EQ0 -78 Executes next program step if X = 0; else skip step. GTY -77 Executes next program step if X > Y; else skip step. GT0 -67 Executes next program step if X > 0; else skip step. GEY -75 Executes next program step if X > or = Y; else skip step. GE0 -74 Executes next program step if X > or = 0; else skip step. LTY -73 Executes next program step if X < Y; else skip step. LT0 -72 Executes next program step if X < 0; else skip step. LEY -71 Executes next program step if X < or = Y; else skip step. LE0 -70 Executes next program step if X < or = 0; else skip step. -69 to -21 Currently unassigned Following instructions only accepted when in "programming" mode. CLPRGM -20 "Clears" program memory; sets all steps to R/S instruction. BST -19 Backsteps program to previous step. DEL -18 Deletes current program step, moves all remaining steps up, bringing in R/S instructions at end of memory. INS -17 Inserts a "NOP" instruction by pushing current and trailing steps down, losing last instruction (currently force a R/S to be last program step). RUN -16 Exits programming mode, returns to normal keyboard control, i.e. run mode. Following instruction only accepted when in "run" mode. PRGM -15 Places calculator into programming mode. -14 to -6 Currently unassigned Following instructions accepted at all times. SST -5 When in run mode, executes next step from program memory and returns control to keyboard. When in program mode, skips over current program step and displays next program step. -4 Currently unassigned. PAUSE -3 When executed from keyboard, acts as "NOP". When executed from program memory, displays current # in X register, then resumes execution. NOP -2 No operation. RTN -1 When executed from the keyboard, resets program counter to program step #1. When encountered during program execution as the result of a "GSB" instruction, program execution resumes at step immediately following the GSB instruction; otherwise, program counter is set to step # 1 and control returned to keyboard. R/S 0 When encountered during program execution, returns control to the keyboard. When entered from the keyboard, resumes program execution at current program step. LBLa 1 Alphabetic (A-Z, a-z) label designator, defines beginning of a program section. LBLn 2 Numeric (0-255) label designator, defines beginning of a program section. 3 Reserved for future use. DSPn 4 Selects display of n digits to right of decimal point. Program automatically shifts to scientific notation for numbers which can not be represented with n decimal digits. DSP(n) 5 Uses the absolute value of integer portion of contents of register n (0-255) to select # displayed digits to right of decimal point. CFn 6 Clear flag # n (0-3). SFn 7 Set flag # n (0-3). TFn 8 Test flag # n (0-3). When encountered as program step, program execution continues with next sequential step if flag n is set, otherwise, next step is skipped. TF2 and TF3 automatically clear flag 2 or 3 after execution. Flag 3 is set following each numeric entry. Executes as NOP when entered from keyboard. DSZn 9 Decrement register n (0-255) and skip if 0. Subtracts 1 from register n and skips 1 program step if contents = 0. DSZ(n) 10 Indirect decrement and skip if 0. Subtracts 1 from register pointed to by contents of register n and skips 1 program step if result is 0. ISZn 11 Increment register n and skip if 0. Adds 1 to contents of register n and skips 1 program step if contents = 0. ISZ(n) 12 Indirect increment and skip if 0. Adds 1 to register pointed to by contents of register n and skips 1 program step if result is 0. GTOa 13 Go to alpha (A-Z, a-z) label designator. If executed from keyboard, positions program counter to program step immediately following the "LBLa" instruction, and returns control to keyboard. If executed as program step, finds "LBLa" instruction, and resumes execution with next program step. GTOn 14 Go to numeric (0-255) label designator. If executed from keyboard, positions program counter to program step immediately following the "LBLn" instruction, and returns control to the keyboard. If executed as a program step, finds "LBLn" instruction, and resumes execution with next program step. GTO(n) 15 Indirect go to numeric label. Searches for numeric label entry corresponding to contents of register n, then proceeds as GTOn. GSBa 16 Go to subroutine labeled "a". Executes as GTOa when entered from keyboard. When executed as a program step, program counter of next sequential step is loaded into a subroutine return point register, and program control is transfered to the program step immediately following "LBLa" instruction. GSBn 17 Go to subroutine labeled "n". Executes as GTOn when entered from keyboard. When executed as a program step, program counter of next sequential step is loaded into a subroutine return point register, and program control is transfered to the program step immediately following "LBLn" instruction. GSB(n) 18 Indirect go to subroutine. Executes as GTO(n) when entered from keyboard. When encountered as a program step, program counter of next sequential step is loaded into a subroutine return point register, and program control is transferred to the program step immediately following a numeric label entry corresponding to the contents of register n. 19 Currently unassigned. REGn 20 Displays current contents of register n. REG(n) 21 Displays current contents of register pointed to by contents of register n. CLREGn 22 Clears register n. CLREG(n) 23 Clears register pointed to by contents of register n. ><(n) 25 Interchanges contents of stack register X with contents of register pointed to by contents of register n. RCLn 26 Recalls contents of register n to stack register X, lifting previous stack elements. RCL(n) 27 Recalls contents of register pointed to by contents of register n to stack register X. Previous stack elements are lifted. STOn 28 Stores contents of stack register X in register n; stack remains unchanged. STO(n) 29 Stores contents of stack register X in register pointed to by contents of register n; stack remains unchanged. STO+n 30 Adds contents of stack register X to register n; stack remains unchanged. STO+(n) 31 Adds contents of stack register X to register pointed to by contents of register n; stack remains unchanged. STO-n 32 Subtracts contents of stack register X from register n; stack remains unchanged. STO-(n) 33 Subtracts contents of stack register X from register pointed to by contents of register n; stack remains unchanged. STO*n 34 Multiplies contents of stack register X by register n; stack remains unchanged. STO*(n) 35 Multiplies contents of stack register X by register pointed to by contents of register n; stack remains unchanged. STO/n 36 Divides register n by contents of stack register X, result placed in register n; stack remains unchanged. STO/(n) 37 Divides register pointed to by contents of register n by contents of stack register X; stack remains unchanged. 38 to 63 Currently unassigned. Following instruction only allowed under "programming" mode GTO.i 64 Steps program to absolute step # i (1-1000). Program steps do not necessarily correlate to program memory locations, e.g. LBLa instruction requires 2 memory locations. 65 to 119 Currently unassigned. d 120 Dummy instruction used for storing constants in program memory. When in programming mode, any numeric string not associated with an instruction is interpretted as a constant and prefixed by this code #. When executed as a program step, lifts stack and loads stack register X from program memory. 121-123 Currently unassigned. "prompt" 123 Types the character string enclosed by "'s for programmed prompting of user. LOADfilespec 124 When entered from keyboard, loads program memory from "filespec" and returns to keyboard control pointing at first program step. When encountered as a program step, loads program memory from "filespec" and begins execution at first program step. Following instruction only valid in "programming" mode SAVEfilespec 125 From programming mode, starts decoding current program memory into analogous character instructions and writing to "filespec". Control returns to keyboard in programming mode. GETREGfilespec 126 Loads registers 0 to 224 from specified file using list directed read format. PUTREGfilespec 127 Writes current contents of registers 0-224 to specified file, 3 #'s per line separated by commas in "E24.17" format. a = alphabetic character A-Z, a-z n = unsigned integer number in range 0-255 i = integer number (optionally signed) in range -32768 to 32767 d = double precision floating point number in range .29E-38 to .17E39 filespec = valid operating system file specification prompt = any valid ASCII string