Question to TI-58/59 Programmers



#2

Hello Joerg and all other TI-58/59 Programmers!

I am looking at the programming manual for the TI 58/59. I read that when you perform a relational test you place the name of a label (and TI-58/59 has a weird system of labels that uses the names of various key!!). When the test is true, program execution resumes at that label.

My question is, "Can you invoke a subroutine if a test is true?" Meaning, if you place an SBR after the test, does the program treat the SBR as a special case and trigger a subroutine call? Or does the program simply jump to the label SBR?

Here is an example of what I LIKE TO DO:

LBL A
...
x=t
SBR
=
...
INV SBR

LBL =
...
INV SBR

In the above code snippet, I would like to execute the code after label = (equal) when the test x=t is true. Is that possible?

Thanks,

Namir


#3

It's a conditional branch. No subroutine.

You would have to do something like this:

x=t?
Lnx
LBL
TAN
...


LBL
Lnx
SBR
COS
GTO
TAN


#4

Gene,

Thanks for the explanation!!! Too bad the TI-59 does not support double-digit labels like our beloved HP-41C.

Namir


#5

The TI-58 and 59 do not even support single-digit labels. ;-)

On the other hand they do not require one- or two-digit labels at all since most of their function keys can be used to define a label. So you can have LBL +, LBL -, LBL x, LBL /, LBL =, LBL SIN, LBL D.MS, LBL INV, LBL PRT, etc. etc. etc. In addition to this you can jump to any line number directly.

I would consider these two features as least as flexible as the option to use LBL 00 ... LBL 99.

Dieter


#6

Dieter,

You are correct in that numeric labels of any kind are NOT supported by the TI-58/59. I think jumping to labels that are mapped to keys is weird.

Jumping to line numbers means you have to know your program lines numbers very well. I feel this feature belongs to the heresy of spaghetti code.

Namir

Edited: 9 Aug 2012, 8:28 p.m.


#7

Quote:
Jumping to line numbers means you have to know your program lines numbers very well. I feel this feature belongs to the heresy of spaghetti code.

That is EXACTLY what one does if one wants to save the limited number of labels for use elsewhere as on a machine such as the HP-35s. It really isn't all that hard if that is what you are used to. And, on a machine such as the HP-35s the assembler automatcally (most of the time, but not always) adjusts the line numbers as you modify the program.

On the TI-59 the other advantage of using line numbers is an increase in speed as the machine goes directly to the line number. If a label is used the machine searches for the label starting at the beginning of the program.


#8

Palmer,

You make a good argument for using step numbers to jump to!

The advantage I have in porting a non-trivial program to the TI-58/59 is that I am using a French TI-58C emulator. This means that I can type in the program commands in a text editor and have the emulator read it. I can then tweak the program in the emulator's memory where I can see the step numbers very easily and clearly.

I just finished porting the same program to the TI-NSpire. I had to work with the code and deal with a few erroneous keywords I had. The TI-NSpire emulator allows you to paste the code for different functions and programs. Syntax checking is good but not flawless. I had to do some detective work to catch a runtime error generated by using a wrong keyword that the syntax checker did not catch.

Namir

#9

Hi there.

A few months ago, I posted a Q about this. The HP-35S trick is that the branch location !!must not be!! the first step of the label (i.e XEQ E001 instead of XEQ E002). Why? Because, if the LBL E (step E001) instruction is removed, then the XEQ branch location does not update to reflect the revised code.


Edited: 13 Aug 2012, 4:26 p.m.

#10

No way. All the TI-58/59 can do after a conditional test is a jump to the specified label or program step. Period. Every program line following the test is considered a label (or a line number) that the 58/59 will jump to.

But you can do something like this:

    ...
020 INV
021 x=t? // test if x does NOT equal t
022 00 // in this case skip the next two lines, continue at 026
023 26
024 SBR // otherwise, i.e. x=t, execute the desired subroutine
025 =
026 ... // program continues here
This should do the trick.

Dieter

Edited: 9 Aug 2012, 6:31 p.m.


#11

Thanks for the tip and the example!!

Namir

#12

Nah, that's MUCH too efficient for an AOS program. :-)

(Sorry Palmer! ... speaking of which, Palmer, are you going to be able to come to Nashville for HHC 2012?)


#13

Quote:
Palmer, are you going to be able to come to Nashville for HHC 2012?)

You should have received my registration. My computer hangs up every time I try to make a reservation at the hotel. I will try to contact Harmoni by telephone on Monday.
#14

Hi.

Just to remind that after any conditional test, flags included, the next step will address a program step number - not a label - if the step contents is 0X, 0<=X<=9. In this case, next step composes the program step number wihtout the first '0'. This is consistent because maximum step # is 959(*) (TI59, 479(*) in TI58/58C) and there is no keycode starting with 0, so there is no code conflict. Also, in this particular case, step number must be keyed in with three or four digits (I never liked it).

Cheers.

Luiz (Brazil)

(*)Edited to correct these figures


Edited: 10 Aug 2012, 3:24 a.m.


Possibly Related Threads...
Thread Author Replies Views Last Post
  "HexZombie - a tool for real programmers" Thomas Chrapkiewicz 8 405 11-16-2013, 12:46 AM
Last Post: Kiyoshi Akima
  OT TI-59 for the iPhone Matt Agajanian 10 431 09-04-2013, 08:57 AM
Last Post: Eddie W. Shore
  The dark side (Ti-59) Cristian Arezzini 18 611 01-12-2013, 08:52 PM
Last Post: ClausB
  Many Ignorant TI-59 Sellers!!! Namir 4 221 06-09-2012, 12:36 AM
Last Post: Namir
  OT: Not your everyday TI-59 Joerg Woerner 12 451 01-17-2012, 01:12 PM
Last Post: Joerg Woerner
  TI 58 / 59 Master Library Survival Guide booklet Gene Wright 13 385 10-15-2011, 12:31 AM
Last Post: Eddie W. Shore
  TI-58 Slimline ClausB 13 445 07-05-2010, 02:38 PM
Last Post: Michael Meyer
  TI Selling new TI NSpire Touchpad Namir 9 350 04-20-2010, 06:20 PM
Last Post: Bart (UK)
  TI-58/9 Case Bottom ClausB 1 117 03-19-2010, 11:25 AM
Last Post: Michael Meyer
  TI-59 LED intensity Michael Meyer 15 527 01-21-2010, 05:36 PM
Last Post: Michael Meyer

Forum Jump: