HP Forums

Full Version: Help wanted SR-52
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

i try to convert a little program (http://www.datamath.net/Manuals/PPX-V2N2_US.pdf , page 4, "learning nimb") from the ti sr-52 to hp 15c.

despite some strange things like not existing int (lbl c' line 130), or ran#, i am struggling over the command tupel DSZ 0 (line 098 or 142), which makes no sense to me, because dsz requires a label or an address for jumping.

maybe somebody can help me to clear that point.

Sorry, can't help you. That are questions to the other side of the wall, i.e. the ... ummh ... most honorable TI users ;-)

Edited: 8 May 2012, 11:40 a.m.

Hi.

I must confess I saw the program listing (a TI-59, as it is said), but I could not identify some keycodes and their mnemonics. Chances are they are synthetic and not documented (I'm just guessing). As I am not a TI regular user, although I have two working TI59 calculators (thanks, M.M.), I felt like a newbie somehow.

There is one remark about the TI58/59 programming: a mnemonic will not act as a valid executable code after a conditional, I mean, if you have a sequence

IFF
DSZ
it actually means that the DSZ after the IFF (F? in the HP15C) is actually a GTO (DSZ), and the program must have a LBL DSZ somewhere.

Considering that the listing refers to a TI59 program equivalent to the SR52, I did not get the following keycodes:

80 IF+
90 IFZ
91 HLT (stop, or R/S, I guess)
97 LST
Yep, this is for the TI guys, indeed...

Sorry not to be of any help.

Success!

Luiz (Brazil)


Edited: 8 May 2012, 12:15 p.m.

It looks like some dirty trick to just decrement R00. I don't know exactly what happens if R00 is 1 when the command is executed. The 'address' is certainly not valid. On the TI-59 the parser checks if the first step after a branch is a digit and takes the next step as the next two digits. On the 52, this should be similar but the next two steps are parsed as digits. What happens if one of these isn't a digit remains unclear. I would need to power up my 52 to check this.

Luiz, it's not a 59, it's a 52 with a different set of commands.

Hallo, Marcus;

thanks for clarifying. I just red:

Quote:
Listing produced with a TI59/PC100 using the program "SR-52 Program Listing"
and I ended up (wrongly) concluding the program was loaded and ran in a TI-59. Instead, the "SR-52 Program Listing" seems to be a SR-52 emulator for printing purposes, is that correct?

Danke Schöen!

Luiz (Brasilien)

Edited: 8 May 2012, 12:54 p.m.

Hi.

The original text of this follow-up was:

Quote:
Isn't there any other version of this program that might ease the job of converting to the HP15C?

Just a guess...


Indeed, I found this. If you actually want the NIMB to run in your HP15C, it is no longer a problem. If you want to delve into translating the original SR-52, now you can also compare versions and functionality.

What do we know?

Luiz (Brazil)

Edited: 8 May 2012, 1:06 p.m.

Well, there are Nimb versions from HP-25 days and I've seen those in HP-33 and HP-34C application books or, is Learning Nimb an entirely different variation?

You've got a point...

Edited: 8 May 2012, 1:17 p.m.

I guess this is a special program running on a TI-59 which is fed the SR-52 key codes and spits out a listing.

Hi,

DSZ 0 is indeed a way to decrement R00, until it becomes zero then it will stay zero.

This way you only need two program steps instead of 5 (1 INV SUM 0 0).
Only it stops at zero.

Marc.

Luiz wrote

Quote:
What do we know?

Well, we know quite a bit. ;-)

First of all, the program in question obviously does something completely different that the well-known simple Nimb programs that came with the 34C and other HPs. According to the program info this SR-52 version is intended as an "experiment in artificial intelligence" - the description claims that the calculator will somehow learn "on the basis of past experience". I did not take a closer look at this, but I can say that the HP Nimb versions I know of just implement the usual winning strategy. ;-)

The essential problem here seems to be the somewhat ..."creative" transcription of the original SR-52 program, obviously done with a TI59 utility called "SR52 program listing". This leads to a program listing that here and there looks a bit strange:

  • The DSZ command in the SR52 always uses R00. So the command will not show up as DSZ 0, but simply DSZ. So indeed "DSZ 0" in line 98 and 142 makes no sense, just as Nina said. I first thought of something like DSZ followed by a line number, but this does not seem to be the solution here.
  • The SR-52 had 20 data registers. However, the program uses register addresses up to 99. Maybe some kind of self-modifying code or another undocumented feature? I'll leave it to the TI experts to explain this. ;-)
Dieter

There are more than the official 20 registers. Some map to program space but some are freely available. I don't know exactly which are which. You can create self modifying code.

I doubt your DSZ explanation is valid because the 0 is on a line of its own. I'm pretty sure it's some trick.

I could be wrong, but I think it has to do with he limited program size of the SR-52, 224 steps.

If you want to decrement a register and stop decrementing at zero you need a lot more program steps than using 'DSZ 0'. ( If there is no valid label or address after DSZ, it just decrements R00 until it is zero, I've tested this on a SR-52)

The program uses 215 steps, using the normal way would make it larger than 224 steps.

Marc.

Since he is the DataMath curator and (I presume) TI authority, you might want to contact Joerg Woerner. I would believe he'd know TI programming dialects of all sorts. I think he's a member here or connect with him through the Datamath site.

There were many capabilities of the SR-52 which were not covered in the manual. Some were in an appendix to the workbook which was made available as a training aid. More can be found under the "Undocumented Features" listing in the Datamath museum's discussion of the SR-52. Even more can be found in the pages of "52 Notes" which are available at Viktor Toth's site.

thank you for the hint.

in 52-notes V2N2 i found:

Quote:
A Decrement-Only dsz (52): Larry has found the sequence ... *dsz 0 op ... (where op is any non-numeral instruction) to work whenever Reg 00 is to be decremented without a zero-test for transfer.

problem solved :)

Edited: 12 May 2012, 4:30 p.m. after one or more responses were posted

Can you give an example of what that instruction block does? I'd like to know so I can understand more about the SR-52 and its programming. thanks

Hi.

It is something like the

i--;
found in C/C++. Every time the
i--;
is found in a C/C++ program, 'i' contents are decremented by one and nothing else happens. If you have the sequence
dsz
0
'any operation code BUT a numeric one'
in your SR52, it would do the same with register R00 contents. Kinda
R00--;
if the SR52 is programmed in C/C++ fashion...

Cheers.

Luiz (Brazil)

Edited: 12 May 2012, 3:42 p.m.

From what I understand the whole thing works this way:
The DSZ command normally decrements R00 and, if the result is not
zero, then jumps to the target that is specified directly afterwards. This target may be a line number or a label. So what
the SR-52 expects is a keycode sequence like this:

Decrement R00 and test the result. If not zero, jump to...
...line 175 ...label "LST" ...label "3'"
 
58 DSZ 58 DSZ 58 DSZ
01 1 97 LST 89 3'
07 7
05 5
So after a DSZ command the SR-52 expects either a sequence of
three keycodes 00..09 (=> jump to that line number) or a single
keycode 10..99 (=> jump to that label).

We now have a third case here: The first keycode following DSZ is
00, but the next one is greater than 09, so this cannot be a line
number to jump to. Obviously the SR-52 interprets such a sequence
in a special way: it decrements R00 but does *not* jump to a line
number or label afterwards. It just decrements R00, ignores the
next keycode 00 and continues with the next step afterwards:

   58  DSZ   R00 := R00-1
00 0 ignore this, no test for zero
50 STF continue
01 1 ...
.. ... ...
So this is a simple way to decrement R00 without any further
tests or branching. TI seemed to know that such a command is
quite useful and provided OP 30 ... OP 39 in the TI-58/59 that
followed. Also the WP34s has a DEC command for the same purpose
(and useable for any register).

Now I wonder what the SR-52 will do if the keycode directly after
DSZ is 01...09 but the next one is not. ;-)

Dieter

Yes, this makes more sense as per my understanding. As I remembered it, addressing & test instructions in the 56 & 52 took a single digit per step if you are branching to a line number. So, as I looked at the code originally in Nina's 'Learning Nim' post, the instruction:

98 DSZ

99 0

100 IND

101 RCL

102 98

Since the steps following the '0' were not coded as single digit keycodes, I hunched that DSZ would decrement R0 BUT, since the steps at 99-101 can't be parsed as a three-digit program location nor a label, it seemed to me that, after DSZ decrements R0 by 1, the '0' at location 99 served as a No OPeration so that the Indirect Recall 98 would just run its course.


Edited: 12 May 2012, 9:51 p.m.

@dieter,

maybe you consider this post from marcus: Re: HP-67 and TI SR-52 compared

so a single digit becomes a label, two digits becomes an address, if followed by a non digit entry. so we get 5 possibillities:

DSZ 0		; go to label 0, create no error
DSZ 9 ; go to label 9, create error if not exist (unknown)
DSZ 99 ; go to line 99, create error if not exist
DSZ 999 ; go to line 999, create error if not exist
DSZ X ; go to label X, create error if not exist


Edited: 13 May 2012, 8:03 a.m.

Hi Nina,

Quote:
maybe you consider this post from marcus: Re: HP-67 and TI SR-52 compared so a single digit becomes a label, two digits becomes an address, if followed by a non digit entry.

Yes, that's exactly how I think it works. But this does not quite match what you wrote: ;-)
Quote:
DSZ 0		; go to label 0, create no error
DSZ 9 ; go to label 9, create error if not exist (unknown)

The labels are not named 0, 1, 2, ... 9 but 0', 1', 2' etc. Yes, the number keys can be used for labels, but they have to be entered with a preceding "2nd". This makes the difference between numbers and labels. So the stored code for label 1 is not 01, but 87 (key in row 8, column 7 = shifted column 2). This way the calculator can distinguish between a number 1 (code 01) and label 1' (code 87).

To make things clear, first let's take a look at the way it usually works. Let's assume the SR-52 comes along the code sequence 58 97. This in unambiguous:

   58  => DSZ command.
Decrement R00 and, if not zero, branch to the target that follows.
97 => code > 09, so this is a label. Jump to label "LST".
That was easy. Another possible case: 58 01 07 05
   58  => DSZ command.
Decrement R00 and, if not zero, branch to the target that follows.
01 => code in the range 00 to 09 => must be part of a line number.
Next code will be the second digit of line # 1xx.
07 => code in the range 00 to 09 => second digit.
Next code will be the third digit of line # 17x.
05 => code in the range 00 to 09 => third digit.
Now jump to line # 175.
And now for the essential point: Consider the code sequence 58 01 50 02. What will the SR-52 do now?
   58  => DSZ command.
Decrement R00 and, if not zero, branch to the target that follows.
01 => code in the range 00 to 09 => must be part of a line number.
Next code will be the second digit of line # 1xx.
50 => oops... that's not within 00...09. So there is no three-digit
line number in the three steps following the DSZ command.
What will happen in this case?

In the message you linked Marcus says:
Quote:
If the command (SBR, GTO, if ...) is followed by a digit, two more digits are read and interpreted as an absolute address.

Fine. But what happens if the first code after DSZ (or SBR or GTO) is a digit 01...09, but the next one or two are not?

So my question is: how does the SR-52 react if, after the DSZ command, the first code that follows is within 01...09 (=> no label, must be part of a three-digit line number), but the second and/or third code is > 09, so that there are no three valid codes 01...09 that can form a three-digit line number

Final question:

Quote:
DSZ 99		; go to line 99, create error if not exist

Is it really possible to enter line numbers with just two digits? If so, what happens if the two digits are, say, 1 and 2? How does the calculator know it has to branch to line 12 and not 123 or 129 or whatever code follows next?

Dieter

hi dieter,

i don't have a sr-52. my assumption depends on the post from marcus and of the 52-notes and the ti ppc notes.

when a single number is interpreted as label and the label exist (and is possible) branching takes place.

0 ... 9 is not a valid label as you stated. but what happens with that jump target? with 0 the jump is omitted.

maybe the target 0 is a special case, maybe the 1 ... 9 are as well, but i don't know.

I assume that the SR-52 simply stops parsing when an invalid code is found and continues execution. I need to power up my 52 to make sure.

My vague recollection was that it stops parsing, but that it uses the digits it has already collected (right-justified) as the branch address. I could easily be mistaken, though.

I know that the 59 does allow shorthand addressing in manual mode. I'm not aware of such a feature on the 52 but I may be mistaken.

It also packs the last two digits of a three digit address in one program step. But the SR52 didn't.

Yep, the TI58/59 does that, but only if the program step right after GTO, SBR or any other 'jump to' instruction contains a '0x' (X= 0 to 9). The other step may be of any value.

I also have a TI66, have not tested it for that yet.

Edited: 15 May 2012, 7:54 p.m.

Well, if the first step of the branch address isn't 0X, then it's a branch for a label, and thus there is no more step to add for the address.
That's how it tells the difference between label and numeric addressing.