Showing posts with label alpha register. Show all posts
Showing posts with label alpha register. Show all posts

Saturday, July 11, 2020

HP 42S/DM42/Free42: GETKEY Demonstration

HP 42S/DM42/Free42:  GETKEY Demonstration

Good day everyone, hope everything is well with you today!

How GETKEY Works

To find the GETKEY command:  PGM.FCN menu ( [ (shift) ] [  3  ] ), [ ↑ ], (GETK)

GETKEY puts the HP 42S on hold and awaits for you to press a key.  Whatever key you press returns a key code.   Shift+Key combinations are allowed.  Key codes start at the upper left hand corner [ Σ+ ] with key code 1, going right then down, to the bottom right hand corner [ + ] with key code 37.

Hence:
[ Σ+ ] has code 1
[ 1/x ] has code 2
[ √x ] has code 3
[ LOG ] has code 4
and so on.

Shift+Key combinations add 37 to the key code.
[ (shift) ] [ Σ+ ] has code 38
[ (shift) ] [ 1/x ] has code 39
[ (shift) ] [ √x ] has code 40
[ (shift) ] [ LOG ] has code 41
and so on.

There is no key code for the shift key alone.

The key code is returned to the X stack, which can be stored and analyzed.  Pretty simple.

HP 42S/DM42/Free 42 Program:  TABU 

Raw file:  tabulate.raw
Download:  tabulate.raw

Running TABU:

You will see a running total, starting with 0.   Press [ 1 ] to add 1,  [ 2 ] to add 2, or [ 3 ]  to add 3 to the total.   Any other key will exit the program. 

Key codes used:  [ 1 ]:  29,  [ 2 ]:  30,  [ 3 ]:  31

00 { 62-Byte Prgm }
01▸LBL "TABU"
02 0
03 STO 00
04▸LBL 10
05 GETKEY
06 STO 01
07 32
08 X<Y?
09 GTO 11
10 R↓
11 28
12 X>=Y?
13 GTO 11
14 R↓
15 28
16 -
17 STO+ 00
18 CLA
19 "TOTAL: "
20 ARCL 00
21 AVIEW
22 GTO 10
23▸LBL 11
24 CLA
25 "FINAL: "
26 ARCL 00
27 AVIEW
28 .END.

HP 42S/DM42/Free 42 Program:  BUILD

Raw file:  build.raw
Download:  build.raw

Running BUILD:   A mathematical statement is generated with two random integers between -100 and 100.   The RAN command uses the range 0 ≤ n < 1 with n ≠ 1 for all results.   To get the range wanted, I use the subroutine RAN 201 * 100 - IP  (integer(201*RAN) - 100) to get the range -100 ≤ n < 101. 

 Key codes used:  [ + ]:  37,  [ - ]:  32,  [ × ]:  27

Any other key repeats the cycle until one of the acceptable keys are pressed.

00 { 150-Byte Prgm }
01▸LBL "BUILD"
02 ALL
03 XEQ 00
04 STO 01
05 XEQ 00
06 STO 02
07 GTO 01
08▸LBL 00
09 RAN
10 201
11 ×
12 100
13 -
14 IP
15 RTN
16▸LBL 01
17 RCL 01
18 RCL+ 02
19 STO 03
20 RCL 01
21 RCL- 02
22 STO 04
23 RCL 01
24 RCL× 02
25 STO 05
26▸LBL 02
27 CLA
28 "+, -, ×?"
29 AVIEW
30 GETKEY
31 37
32 X=Y?
33 GTO 03
34 R↓
35 32
36 X=Y?
37 GTO 04
38 R↓
39 27
40 X=Y?
41 GTO 05
42 GTO 02
43▸LBL 03
44 CLA
45 ARCL 01
46 ├" + "
47 ARCL 02
48 ├" = "
49 ARCL 03
50 GTO 06
51▸LBL 04
52 CLA
53 ARCL 01
54 ├" - "
55 ARCL 02
56 ├" = "
57 ARCL 04
58 GTO 06
59▸LBL 05
60 CLA
61 ARCL 01
62 ├" × "
63 ARCL 02
64 ├" = "
65 ARCL 05
66 GTO 06
67▸LBL 06
68 AVIEW
69 END

Example results (results will vary):

-53 + -32 = -85
93 - 19 = 74
41 × -15 = -615

And that concludes the demonstration on GETKEY. 

Eddie

All original content copyright, © 2011-2020.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.

Friday, July 10, 2020

Retro Review: TI-95 Procalc

Retro Review:  TI-95 Procalc 





This review covers the calculator itself, not any of the optional accessories which includes a thermal printer and cassette interface. 


Quick Facts:

Model:  TI-95 Procalc
Company:  Texas Instruments
Type:  Scientific, Keystroke Programmable
Years:  1985-1987
Display:  10 digits for numerical answers, 16 alpha-numeric display
Batteries:  4 AAAs
Logic:  Algebraic (AOS)
Original Price:  $200.00.  I paid $60 I bought it on eBay.

Memory:
Registers:  26 alpha registers, up to 900 numeric registers (three digit registers)
Programming Steps: up to 7,200 steps, default set at 1,000 steps.
Storage Memory:  up to 8,000 bytes, set to 5,200 bytes by default.

A separate 8K RAM can be added for an additional 8,000 bytes of memory.

The QWERTY Keyboard and Other Unique Features

One look at the keyboard and one may mistake the TI-95 Procalc as a BASIC Programming calculator.  However, the TI-95 Procalc is a keystroke programmable calculator.   We'll talk about the programming later.

The TI-95 Procalc is one of the first calculators to contain function keys, F1 through F5.

In addition to the standard functions including trigonometry, logarithms, roots, powers, factorials, hyperbolic functions, and statistics including linear regression:

The number menu [ NUM ] has functions including integer part (INT), fractional part (FRC), random numbers between 0 and 1 (R#), round the number displayed to fix number settings (RND), sign function (SGN), lowest common multiple (LCM), prime factors (PF), and absolute value (ABS).

The LCM soft key has two functions:

(LCM) :   lowest common multiple. 
 Example:  4 [ x~t ] 6 (LCM) returns LCM = 12.

(LCM) [ x~t ]: greatest common divisor.
Example:  25 [ x~t ] 40 (LCM) [ x~t ] returns 5   (GCD(25, 40) = 5)

(PF) returns the biggest prime factor of an integer.  To get additional prime factors, repeat the keystrokes [ x~t ] (PF).

Example:  28
28 [ NUM ] [ --> ] ( PF ) returns  f = 2
[ x~t ] ( PF ) returns f = 2
[ x~t ] ( PF ) returns f = 1  (When you reach f = 1, press [ x~t ] to get the last prime factor, 7)
28 = 2 * 2 * 7 = 2^2 * 7

The conversions menu [CONV] contain several types of conversions:

MET (Metric):
(F - C)  °F -> °C  (left to right),  [INV] (F - C) does °C -> °F  (right to left)
All of the conversions follow this pattern.
(G - L)  gallon and litre
(# - K)  pounds (#) and kilograms (kg)
(i - m)  inches (i) and millimetres (m)
(f - M)  feet and meters

DMS:  convert to D.MMSSS from degrees
INV DMS:  convert degrees to D.MMSSSS

ANG:  convert between Degrees (D), Radians (R), and Grads (G)

P-R:
r [ x~t ] θ [ P-R ] results:  y [ x~t ] x  (polar to rectangular)
x [ x~t ] y [ INV ] [P-R] results: θ [ x~t ] r   (rectangular to polar)

BAS:  (Bases)
DEC: convert to base 10 and set the TI-95 Procalc to Decimal Mode
HEX:  convert to base 16 and set the TI-95 Procalc to Hexadecimal Mode
OCT:  convert to base 8 and set the TI-95 Procalc to Octal Mode
2sC:  convert to 2's complement format
UNF:  convert to un-formatted display mode

Two things to note:
1.  Hexadecimal numbers A-F are accessed with the [ 2nd ] key.
2.  There are no conversions to binary integers

The FUNC key has three operations:

QAD:  Find the roots, real or complex, of the quadratic equation a*x^2 + b*x + c = 0

CUB:  Find the roots of the cubic equation a*x^3 + b*x^2 + c*x + d = 0

SYS:  This is not a solver for system of equations.  Instead, it allows the user to turn system protection on or off.  With system protection off, the user can edit specific bytes of memory.  The aim for unprotected system memory mode is to assist the user in assembly programming.

Fun Fact:  FIX 9 sets the TI-95 Procalc to floating mode.

One more fun fact:  The factorial functions accepts arguments of both integers and integers in the form of n + 1/2.   The latter can include negative numbers.  You will not see this in any other standard scientific calculator (outside the CAS-enabled factorials).

Help: But Not What You Expect

The HELP key does not give help on the specific functions.   Instead, the HELP key asks the user "SET NORMAL MODE?".  Yes resets the TI-95 to decimal mode, floating standard mode (removes Fix settings), degree mode, and sets memory partition to default (1000 program steps, 125 numeric registers, and 5200 bytes for files).  A No asks the user whether to reset any specific mode that is set to default.

Files, Files, and More Files

The FILES key is where you would store, load, and delete program and data files.  Files have three characters (fixed so the file "A   " has A followed by two spaces).  FILES is also where you access the 8K RAM or additional RAM cartridges.   It's pretty neat how the FILES system works once it is learned.

The ALPHA Register

Similar to the HP 41C and HP 42S, the TI-95 Procalc has a 16 character ALPHA register.  The ALPHA register is used to display results and prompt messages.  Numeric registers call be recalled into the ALPHA register.

Example:  11 is stored in register A.  ANSWER = is in the ALPHA register.  Pressing (COL) 16, moves the cursor to column 16.   (MRG) A places 11 at the 16th space justified right.

ALPHA register:   ANSWER =     11.

MRG = recalls the number from the display/last answer.

The ALPHA register can contain lower case letters and ASCII characters simular to the TI-58/59 family.

Keystroke Programming

The TI-95 Procalc has algebraic keystroke programming with labels, tests against numeric registers, increase and decrease by 1 (INCR and INV INCR, respectively) functions, define menus (DEF), the use of ALPHA register.

Unique is the YES/NO function.  Y/N creates a two function menu (F1: YES, F2: NO) and works like the rest of the test commands.

Y/N
(do if YES is pressed)
(skip to here if NO is pressed)

Labels are two characters which can contain both numbers and letters.  Go to and subroutines to labels are use the commands GTL and SBL.

The halt command, HLT, stops program execution.  While the break command, BRK temporarily stops the program execution to display the current result and sets F1 to GO.

Storage arithmetic is permitted.

Example program:  PRF which automates the prime factors of an integer.

TI-95 Procalc Program: Prime Factors


STO A
'NUMBER?' 
BRK
LBL 00
PF 
'FACTOR = '
COL 16 
MRG =
BRK
IF= A
GTL 01
x~t
GTL 00
LBL 01
x~t
'FINAL = '
COL 16
MRG =
HLT  

(50 steps)

Example: 158
'NUMBER?' 158 (GO)
'FACTOR=        2.'  (GO)
'FACTOR=        1.'  (GO)
'FINAL=        79.'

158 = 2 * 79

The TI-95 Procalc comes with a har dcase and a gray help card.

Verdict

I like this calculator, having a solid set of functions with adjustable programming space.   Having the 8K RAM card, which came with the calculator when I bought it, allows me store programs on the card without having to worry about storage space as much.

There are several things I have to get used to: the program steps scroll horizontally instead of vertically, and both the break (BRK) and halt (HLT) operate differently from the modern definition.  Thankfully both the operating and programming manuals are still available online through the Datamath website.

The price point is pretty high at $200.00, as the TI-95 Procalc was set as Texas Instruments' high end programmable keystroke programmable.

The Datamath page has an emulator:  http://www.datamath.org/Graphing/TI-95.htm

Eddie

Source:

Woerner, Joerg.  "Texas Instruments TI-95 PROCALC"  Datamath  http://www.datamath.org/Graphing/TI-95.htm  Last Edited December 5, 2001.  Accessed June 22, 2020.

All original content copyright, © 2011-2020.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.

DM42 and HP 42S: Quadratic Equation, Characteristic Polynomial, and Eigenvalues

DM42 and HP 42S: Quadratic Equation, Characteristic Polynomial, and Eigenvalues The programs are listed for the Swiss Micros DM42 an...