TI-58/59 SBR question
|
06-09-2024, 10:53 PM
Post: #1
|
|||
|
|||
TI-58/59 SBR question
Can a program invoke a subroutine right after a conditional test? Or one must ALWAYS jump to a label first???
Namir |
|||
06-10-2024, 12:49 AM
(This post was last modified: 06-10-2024 12:50 AM by toml_12953.)
Post: #2
|
|||
|
|||
RE: TI-58/59 SBR question
(06-09-2024 10:53 PM)Namir Wrote: Can a program invoke a subroutine right after a conditional test? Or one must ALWAYS jump to a label first??? A conditional test executes a one-step instruction if true so you can either follow it with either a label or a step address, both of which take one step. A SBR call takes two steps so you couldn't call a SBR if a condition was true. Tom L Cui bono? |
|||
06-10-2024, 01:53 AM
Post: #3
|
|||
|
|||
RE: TI-58/59 SBR question
Not quite correct ?
X=t 03 14 Would branch to step 0314 and takes two steps not one. ? On my emulator this works LBL A X=t B Inv SBR LBL B 2 R/s When you put 1 x<>t and then presss 1 A you see 2 in the display Press 33 A and you see 33 in the display. So appears subroutines would work for user defined keys Not sure for SBR 0114 after x=t |
|||
06-10-2024, 03:29 AM
Post: #4
|
|||
|
|||
RE: TI-58/59 SBR question
(06-10-2024 12:49 AM)toml_12953 Wrote:(06-09-2024 10:53 PM)Namir Wrote: Can a program invoke a subroutine right after a conditional test? Or one must ALWAYS jump to a label first??? Thanks Tom. You confirmed my suspision (and disapointment) in being forced to jump to a label if the tested condition is true. I was hoping that I had missed something in the TI-59 documentation that allowed SBRs after conditional tests. In this respect, programmable HP calculators are at a clear advantage! Namir |
|||
06-10-2024, 09:47 AM
(This post was last modified: 06-10-2024 09:51 AM by Maximilian Hohmann.)
Post: #5
|
|||
|
|||
RE: TI-58/59 SBR question
Hello!
I knew I had a kind of déjà-vu ;-) Not much as changed (*) during the last 12 years: https://archived.hpcalc.org/museumforum/...28938.html Reagrds Max (*) Apart, of course, the sad fact that Palmer Hanson has since passed away. |
|||
06-10-2024, 11:31 AM
Post: #6
|
|||
|
|||
RE: TI-58/59 SBR question
(06-10-2024 09:47 AM)Maximilian Hohmann Wrote: Hello! Max, you have a Sharp (or should I say Casio) memory. Thank you!!!! :-) Namir |
|||
06-10-2024, 11:35 AM
Post: #7
|
|||
|
|||
RE: TI-58/59 SBR question
Ah ! Dieters post in the linked thread shows how to do it. Reverse the conditional and ski over a subroutine call.
My emulator example is flawed ! |
|||
06-10-2024, 11:54 AM
(This post was last modified: 06-10-2024 12:11 PM by Maximilian Hohmann.)
Post: #8
|
|||
|
|||
RE: TI-58/59 SBR question
Hello!
(06-10-2024 11:35 AM)Gene Wrote: My emulator example is flawed ! I also had to try this out. Few people may know, but a person called Philippe Tiwolle created a compiler for the Ti 58/59. For input it takes a subset of C (that he calls "T" for Texas instruments) and generates ready-to-use programs for the calculator: https://ti59compiler.wixsite.com/ti59 (*) So I made a tiny tiny little program that calls two different subroutines as the result of a branch: Code:
The compiler translates it to some kind of metacode first: Code:
and finally to a sequence of keystrokes: Code:
It works by replacing the call to the subroutine with the call to a label from where the subroutine is called. I am not sure if this will work in all circumstances... Regads Max (*) For those who want to try it for themselves: in order to work on MacOS, after downloading and unzipping, the following change has to be made in the makefile: Replace -lfl with -ll in two places and rename the resulting programs ti59 and ti59b to ti59.exe and ti59b.exe (or otherwise modifiy the "compile.sh"). NB: This is not the only compiler written for the Ti 59. Google finds a master's thesis (> 600 pages!) about a "cross compiler and virtual memory management system for the Ti 59" here: https://archive.org/details/designndimpl...8/mode/2up |
|||
06-14-2024, 10:30 AM
Post: #9
|
|||
|
|||
RE: TI-58/59 SBR question
Hello,
I keep thinking about this problem and have called AI for help: "With the programmable calculator Ti-59, is it possible to call a subroutine from a conditional test"? This is the answer I got: Yes, it is possible to call a subroutine from a conditional test on the TI-59 programmable calculator. The TI-59 supports conditional branching and subroutines, which can be used together to create conditional subroutine calls. Here is a basic example to illustrate this concept: Conditional Test and Branching: The TI-59 allows for conditional tests using the DSZ (Decrement and Skip on Zero) and ISZ (Increment and Skip on Zero) instructions. These instructions can be used to perform tests and branch to different parts of the program based on the results. Calling Subroutines: The TI-59 supports calling subroutines using the GSB (Go to Subroutine) instruction, which can be combined with conditional tests to call a subroutine conditionally. Example Program Let's say we want to check if the value in register 00 is positive. If it is, we call a subroutine at step 50. If it is not, we continue with the main program. Main Program: Code: 00: RCL 00 // Recall the value from register 00 Subroutine: Code: 50: LBL 50 // Label for subroutine Steps Explanation Step 00: The program recalls the value from register 00. Step 01: The conditional test x>0? 05 checks if the value is greater than 0. If true, the program branches to step 05. Step 02: If the value is not greater than 0, the program jumps to step 10, skipping the subroutine call. Step 05: If the value is greater than 0, the program calls the subroutine at step 50 using the GSB instruction. Step 50 - 53: This is the subroutine code, which performs its tasks and then returns to the main program. This example demonstrates how conditional tests can be used to decide whether or not to call a subroutine, allowing for flexible and powerful program structures on the TI-59 calculator. <<<< End of AI generated answer This gets better and better, we are very close to the human solutions presented above. But also a bit scary. Yesterday I played with an AI music generator called "udio". I asked Chat GPT to write some song lyrics with different subjects and had udio turn them into music. The results I played to my wife who really couln't tell that this was completely artificial and made in less than 10 minutes. All we have to do is train AI with more keystroke programs for calculators and soon it will give us perfect code. Regards Max |
|||
06-14-2024, 02:34 PM
Post: #10
|
|||
|
|||
RE: TI-58/59 SBR question
(06-14-2024 10:30 AM)Maximilian Hohmann Wrote: Hello, I took the question to mean calling a subroutine directly from the conditional. We all know techniques that would be functionally equivalent but the original answer still stands, it's not possible directly from a conditional test. Tom L Cui bono? |
|||
06-15-2024, 09:13 AM
Post: #11
|
|||
|
|||
RE: TI-58/59 SBR question
(06-14-2024 10:30 AM)Maximilian Hohmann Wrote: This gets better and better, we are very close to the human solutions presented above. I don't see that. What I do see is that what is currently being hyped up as AI is completely lacking in intelligence. It is good at sounding smart, but only as long as you don't look too closely at what it spits out. In your example, the code isn't valid TI-59 code, the terms "step" and "label" are used as though they mean the same thing, and the line numbers make no sense. These aren't minor flaws that a bit of tweaking of the "AI" will overcome; they are bits of nonsense that demonstrate the complete lack of actual understanding in the system. |
|||
06-16-2024, 02:06 PM
Post: #12
|
|||
|
|||
RE: TI-58/59 SBR question
Quote:Yes, it is possible to call a subroutine from a conditional test on the TI-59 programmable calculator. NO NO NO !!! The TI58/58c/59 test instructions cannot use a return subroutine. GE, EQ, INV GE, INV EQ, DSZ, INV DSZ are systematically followed by either a step address or a label and the connection corresponds to a GTO and never to an SBR! Of course it is always possible to program solutions but the answer regarding the language itself is NO! Just because I can get out my house to get into my car doesn't mean I can conclude that my house can drive! http://ti58c.phweb.me http://clones.phweb.me http://www.instagram.com/ti58c "No! Do or Do not. There is no try!" [Master Yoda] |
|||
06-16-2024, 02:53 PM
(This post was last modified: 06-16-2024 02:54 PM by Maximilian Hohmann.)
Post: #13
|
|||
|
|||
RE: TI-58/59 SBR question
Hello!
(06-16-2024 02:06 PM)Pierre Wrote: NO NO NO !!! Of course. But this answer is boring an we don‘t visit this forum to get bored ;-) Also I, like many others here, are trained in engineering and it is part of our profession to get things working, even if the inventor had different ideas… Regards Max |
|||
06-16-2024, 03:22 PM
Post: #14
|
|||
|
|||
RE: TI-58/59 SBR question
Quote:this answer is boring Sorry Max, but I didn't mean to be boring! But Namir's question was simple and direct and not open to inventiveness. For my own ability to be inventive and humorous I wrote a TI-58/59 emulator that can work in RPN [*] ! (if that's not humor...) [*] At the time, around 10 years ago, this was already a request from Namir ! http://ti58c.phweb.me http://clones.phweb.me http://www.instagram.com/ti58c "No! Do or Do not. There is no try!" [Master Yoda] |
|||
06-17-2024, 06:20 AM
Post: #15
|
|||
|
|||
RE: TI-58/59 SBR question
If anyone knows programing the TI59/58 it is Pierre and he is a million percent correct. In fact the same conditional branching scheme appears in the TI-66 (I checked the manual for the subject).
Namir |
|||
06-17-2024, 07:55 AM
Post: #16
|
|||
|
|||
RE: TI-58/59 SBR question
(06-17-2024 06:20 AM)Namir Wrote: If anyone knows programing the TI59/58 it is Pierre and he is a million percent correct. In fact the same conditional branching scheme appears in the TI-66 (I checked the manual for the subject). Thanks Namir. I have spent several thousand hours with my TI-58C since 1983 but I am certainly not the best specialist. (and I still use my TI-58C sometimes) On the other hand, as a fan and collector I am happy as soon as I can make my modest contribution. For the TI-66 you are right, the operation is absolutely identical to the TI-58C, as for the rest of the programming except unfortunately the absence of modules and the impossibility of "cheating" like on the TI-58/58c/59. (I am referring to HIR which has disappeared and the DSZ command limited to registers 0 to 9) http://ti58c.phweb.me http://clones.phweb.me http://www.instagram.com/ti58c "No! Do or Do not. There is no try!" [Master Yoda] |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 8 Guest(s)