The Museum of HP Calculators

HP Forum Archive 16

[ Return to Index | Top of Index ]

Getting input on 28S
Message #1 Posted by Bill (Dayton, OH) on 5 Nov 2006, 9:12 a.m.

I have used the "prompt ->" command on the 48 series for getting input on interactive programs. Is there an equivalent command on the 28S?

Thanks, Bill

      
Re: Getting input on 28S
Message #2 Posted by Marcus von Cube, Germany on 6 Nov 2006, 12:37 p.m.,
in response to message #1 by Bill (Dayton, OH)

Bill,

just a quick hint: The 28S Owner's Manual has a chapter "Interactive Programs" (pp 234-239)

What comes into my mind is 'HALT'ing the program, then let the user input a value into the stack and press CONT to continue. To make things clear, you can display a message to tell the user what you expect.

Marcus

            
Re: Getting input on 28S
Message #3 Posted by Marcus von Cube, Germany on 6 Nov 2006, 4:31 p.m.,
in response to message #2 by Marcus von Cube, Germany

Here is a simple example:

<< 0 0 0 -> a b c
  << { STO a b c } MENU 
     HALT
     a b c
  >>
>>
If you run this little program, you get a menu:
[ a ][ b ][ c ][   ][   ][   ]
You can now enter values like in the solver.

After you press Shift CONT, the values you have entered are displayed on the stack.

While a program is HALTed, its local variables are visible and can be manipulated by the user. Shift CONT resumes program execution where it left off.

Marcus

      
Re: Getting input on 28S
Message #4 Posted by James M. Prange (Michigan) on 6 Nov 2006, 8:02 p.m.,
in response to message #1 by Bill (Dayton, OH)

I don't think that anything like PROMPT or INPUT is built-in with the 28 series, but as Marcus noted, the HALT command seems to be the obvious choice for halting a program to allow user input.

Bill Wickes lists a PROMPT program in HP-28 Insights.

<< "Enter " SWAP +
  CLLCD 1 DISP
  HALT
>>
Of course, with the above program, the prompt string will always start with "Enter ".

If you want a program where you specify the complete prompt string, like the built-in PROMPT command in later RPL models, then simplify it to:

<<
  CLLCD 1 DISP
  HALT
>>
You could store either of the above in a global variable to be called by name in other programs, much like a built-in command, or you could include:
"prompt string" CLLCD 1 DISP HALT
as in-line code in other programs.

Regards,
James


[ Return to Index | Top of Index ]

Go back to the main exhibit hall