DATAMATH CALCULATOR MUSEUM |
The SR-52 contains some undocumented features. Some of them are quite useful, some of them are just a curiosity.
AOS memory registers
Unused memory registers
Program step registers
• How a memory register is stored
• Undocumented use of program step memory
How keys are stored in the program step memory
Example
• Bugs
Bug #1, program execution disturbed when halted
Bug #2, disturbed display
The SR-52 is documented to have 20 memory registers accessible as memory addresses 00 to 19. What Texas Instruments did not document is that addresses above 19 can be used to access other registers inside the SR-52.
SR-52 memory registers | |
---|---|
Memory | Used for |
00 - 19 | Documented memory registers, cleared by CMs . |
60 - 69 | Direct access to AOS memory registers, cleared by CLR . |
70 - 97 | Direct access to program step registers. |
98 - 99 | Two unused memory registers, not cleared by CMs . |
Direct access to the AOS memory registers is just a curiosity and probably not very useful.
The inclusion of two unused memory registers is rather odd. Why waste two registers when everything else was shoehorned into the calculator? Why not 240 program steps? I have tried to find some function in the SR-52 that used these registers but found nothing.
Direct access to the program step registers can be used for two things
• More memory registers in programs not using all program steps.
• Taking advantage of undocumented program codes in the program step registers.
Placing constants for a program into a memory between 70 - 97 could potentially use fewer program steps than placing the constants inline.
More about undocumented program codes in the program step registers further down on this page.
The relationships between program step registers and memory registers are important as the programmer has to manually keep track of the partitioning between memory registers and program step registers. The following table shows the program steps and the equivalent memory register.
SR-52 program step vs. memory register | |
---|---|
Program step | Memory |
000 - 007 | 70 |
008 - 015 | 71 |
016 - 023 | 72 |
024 - 031 | 73 |
032 - 039 | 74 |
040 - 047 | 75 |
048 - 055 | 76 |
056 - 063 | 77 |
064 - 071 | 78 |
072 - 079 | 79 |
080 - 087 | 80 |
088 - 095 | 81 |
096 - 103 | 82 |
104 - 111 | 83 |
112 - 119 | 84 |
120 - 127 | 85 |
128 - 135 | 86 |
136 - 143 | 87 |
144 - 151 | 88 |
152 - 159 | 89 |
160 - 167 | 90 |
168 - 175 | 91 |
176 - 183 | 92 |
184 - 191 | 93 |
192 - 199 | 94 |
200 - 207 | 95 |
208 - 215 | 96 |
216 - 223 | 97 |
Numbers are stored in BCD (Binary Coded Decimal) format inside the SR-52. This information is important when we are going to take advantage of direct access to the program step registers.
SR-52 memory register format | ||
---|---|---|
Byte # | Contents | Explanation |
0 | E2 S | Exponent digit 1 and Sign digit |
1 | G3 E1 | Guard digit 3 and Exponent digit 1 |
2 | G1 G2 | Guard digit 1 and Guard digit 2 |
3 | M09 M10 | Mantissa digit 9 and Mantissa digit 10 |
4 | M07 M08 | Mantissa digit 7 and Mantissa digit 8 |
5 | M05 M06 | Mantissa digit 5 and Mantissa digit 6 |
6 | M03 M04 | Mantissa digit 3 and Mantissa digit 4 |
7 | M01 M02 | Mantissa digit 1 and Mantissa digit 2 |
Note that guard digits 1, 2, and 3 (least significant digits of the mantissa) are only used for memories and built in fuctions. Any calculation on the 13 digit result is truncated to 10 digits by discarding the guard digits. Why? This is the reason why the SR-52 has worse precision than the SR-51.
Comment 1: Actually only guard digit 3 is dropped leading to a 12 digits result for the display.
Comment 2: Fellow collector Palmer Hanson revealed in October 2009, almost 35 years after its introduction, the secrets of the SR-52. Don't miss the Story "Twelve or Thirteen Digits on the SR-52."
The sign digit has the following meaning.
SR-52 memory register sign digit | |
---|---|
Digit | Explanation |
0 | Mantissa and exponent are positive |
2 | Mantissa is negative |
4 | Exponent is negative |
6 | Mantissa and exponent are negative |
The following table shows how a number,
-1.234567890123-18
is stored
in a memory register.
SR-52 memory register example | ||
---|---|---|
Byte # | Contents | What |
000 | 86 | -1.234567890123-18 |
001 | 31 | -1.234567890123-18 |
002 | 12 | -1.234567890123-18 |
003 | 90 | -1.234567890123-18 |
004 | 78 | -1.234567890123-18 |
005 | 56 | -1.234567890123-18 |
006 | 34 | -1.234567890123-18 |
007 | 12 | -1.234567890123-18 |
Knowing that program step memory can either be used as programs or stolen eight at a time and used as memory registers one question immediately pops up; what would happen if unused key codes are stored in the program step memory?
How keys are stored in the program step memory
• Number keys • Immediate keys • Other keys |
05
.
Immediate keys are never stored as they perform something even in
programming mode.
These keys are
2nd
,
LRN
,
INS
,
del
,
SST
, and
bst
.
Other keys are stored using their coordinates (row-column) on the
keyboard, e.g.
sin
is stored as 32
and
SUM
is stored as 44
.
Keys prefixed with 2nd
are stored
with 5 (the number of columns) added to their column code, e.g.
PROD
(2nd
of SUM
)
is stored as 49
.
This leaves a number of key coordinates that we can not put into a program using normal methods. These coordinates correspond to the number keys and the immediate keys.
To use one of these unused coordinates we need to store it into the
program step memory by using a suitable memory register address.
As each memory register writes to eight program steps it is often
necessary to store the wanted coordinate close to its intended program
step and then use INS
and
del
to move it into the
intended program step.
Planning ahead is important.
Unused key coordinates | ||
---|---|---|
Code | Key | What does it do? |
21 | 2nd | ? |
26 | 2nd 2nd | ? |
27 | 2nd INV | ? |
31 | LRN | Execution stops on next program step and goes into programming mode. |
61 | INS | ? |
62 | 7 | Goes into EE mode without entering any exponent digits. |
63 | 8 | Some form of dsz? |
64 | 9 | ? |
66 | del | ? |
71 | SST | ? |
72 | 4 | Goes into EE mode without entering any exponent digits. |
73 | 5 | Same as GTO 0 0 0 . |
74 | 6 | ? |
76 | bst | ? |
82 | 1 | Goes into EE mode without entering any exponent digits. |
83 | 2 | Flashing |
84 | 3 | ? |
92 | 0 | ? |
The most useful of these is to be able to put
LRN
into a program.
An equation solving program could use
LRN
just before the free
program steps and then jumping to it, prompting the user to input
the equation.
To store the LRN
key at program
step 042
the following is done:
3
1
STO
7
5
.
The program step memory now contains the keycodes 01
,
00
, 00
, 00
, 00
,
00
, 00
, and 31
at program
step 040
.
Overwrite the program steps at program step 040
and
041
and then remove the unwanted program steps with
the following key presses:
GTO
0
4
2
del
del
del
del
del
.
As the SR-52 was, for its time, a complicated calculator some software bugs can be expected.
Bug #1, program execution disturbed when halted
If the SR-52 is executing a program and is halted using the
HLT
key then the execution
may be disturbed depending on what instruction was executed
when halted.
A small test program can be used to demonstrate the bug.
Test program for bug #1 | ||
---|---|---|
Step | Code | Key |
000 | 85 | + |
001 | 01 | 1 |
002 | 41 | GTO |
003 | 00 | 0 |
004 | 00 | 0 |
005 | 00 | 0 |
Enter the program and run it. While the program is running we halt the execution and investigate what happened.
Bug #1 | ||
---|---|---|
Key | Display | Note |
LRN |
||
+ |
||
1 |
||
GTO |
||
0 |
||
0 |
||
0 |
||
LRN |
When we run and halt this program it may halt on any of the program steps. Below is a couple of runs with different outcomes. In each run we figure out where we halted the program and what the consequences were.
Halt on 1 |
||
---|---|---|
Key | Display | Note |
rset |
||
RUN |
||
HLT |
Halt on 1 |
A halt on 1
does not show
any obvious problem.
Halt on GTO |
||
---|---|---|
Key | Display | Note |
rset |
||
RUN |
||
HLT |
||
SST |
GTO |
|
SST |
0 |
|
SST |
0 |
|
SST |
0 |
|
SST |
What happened here? | |
LRN |
Address 007 is outside our program! | |
LRN |
A halt on GTO
reveals that the
instruction is ignored and the program execution continues outside the
program area.
Halt on goto target address | ||
---|---|---|
Key | Display | Note |
rset |
||
RUN |
||
HLT |
||
SST |
What happened here? | |
LRN |
Address 005 is inside our program, but GTO has not been executed! |
|
LRN |
A halt on the goto target address reveals that the goto instruction is ignored and the program execution will continue outside the program area.
A number of other tests can be done that shows that the SR-52 does not properly
keept the state of the executed program if halted on program steps that are part
of an GTO
instruction.
Sometimes the key sequence HLT
LRN
results in a flashing error display.
under some conditions halting the program may even erase the whole program area and all
memory registers!
This simple program shows an odd display.
Test program for bug #2 | ||
---|---|---|
Step | Code | Key |
000 | 22 | INV |
001 | 80 | if pos |
002 | 34 | tan |
003 | 46 | LBL |
004 | 34 | tan |
Enter the program and step through it, observing the display.
Bug #2 | ||
---|---|---|
Key | Display | Note |
LRN |
||
INV |
||
if pos |
||
tan |
||
LBL |
||
tan |
||
LRN |
||
rset |
||
1 |
||
EE |
||
1 |
||
0 |
||
SST |
||
SST |
||
SST |
Odd | |
SST |
Odd | |
SST |
If you have additions to the above article please contact Göran Larsson or joerg@datamath.org.
© Göran Larsson and Joerg Woerner, July 27, 2002. No reprints without written permission.