Pause in WP34s
|
11-25-2015, 12:41 PM
Post: #1
|
|||
|
|||
Pause in WP34s
Hi,
I encounter a little issue in one of mine program, it is : Assume in a program you put a PAUSE instruction to have time for enter a numeric value, if it is no value do this, if it is value do that... Well, during PAUSE, I type value 8 to be substracted, ok in HP67 it is ok, but here 34s, don't run. It seems the value 8 is not taken ?! Not appears onto stack in X register ? I've try with ENTRY?, no run too. I ask your help Thanks in advance. Gérard. |
|||
11-25-2015, 01:19 PM
(This post was last modified: 11-25-2015 01:35 PM by Dieter.)
Post: #2
|
|||
|
|||
RE: Pause in WP34s
(11-25-2015 12:41 PM)ggauny@live.fr Wrote: Assume in a program you put a PAUSE instruction to have time for enter a numeric value, if it is no value do this, if it is value do that... Using PAUSE or PSE for this can only be done with a few calculators, for instance the HP67/97 and the HP41. In both cases checking for entry can be done by testing flag 3 resp. flag 22/23. But this will not work with most other HP calculators. For instance the HP34C simply stops as soon as any key is pressed, and the 35s ignores keystrokes during PSE. So do others. However, on the 34s keystrokes during a PSE statement are registered. They can be checked by using the KEY? test. There is a special section on input and output in the manual. Note that KEY? does not return a numeric value but the code of the key that has been pressed. Here is an example: Code: CLX Note that the step after KEY? is executed if no (!) key has been pressed. Run the program and see 1 ... 2 ... 3 ... Press a key, for instance ENTER, and see its keycode (here 31) returned by the program. (11-25-2015 12:41 PM)ggauny@live.fr Wrote: I've try with ENTRY?, no run too. ENTRY? is similar (but not identical) to testing flag 3 or 22/23 on the 67/97/41. So you can check whether something has been entered, e.g. after a PROMPT where the program stopped. Another example: Code: CLalpha HTH, Dieter |
|||
11-25-2015, 01:45 PM
Post: #3
|
|||
|
|||
RE: Pause in WP34s
Gérard,
You will find the respective information in your manual on pp. 115ff. HTH d:-) |
|||
11-25-2015, 02:40 PM
Post: #4
|
|||
|
|||
RE: Pause in WP34s
Also, studying the source code of some wp34s library programs can help. Matrixedit.wp34s & tvm.wp34s are good examples.
|
|||
11-25-2015, 03:47 PM
Post: #5
|
|||
|
|||
RE: Pause in WP34s
Thanks
Gérard. |
|||
11-25-2015, 04:47 PM
Post: #6
|
|||
|
|||
RE: Pause in WP34s
(11-25-2015 02:40 PM)emece67 Wrote: Also, studying the source code of some wp34s library programs can help. Matrixedit.wp34s & tvm.wp34s are good examples. Yes very instructives routines, even a little bit complicated for me for the moment ! But with patience and longer of time.... Gérard. |
|||
11-25-2015, 04:58 PM
Post: #7
|
|||
|
|||
RE: Pause in WP34s
Hi Dieter,
I understand well what you say, KEY? return the *code* of the key, not her value numeric AND it is just my problem ! Passionant problem that I have to solve. Translate the code key in his numeric value. Another issue : if I run with BST, the code appears in X but no in RUN ? Well, Well, a white night in perspective ! Gérard. |
|||
11-25-2015, 05:16 PM
(This post was last modified: 11-25-2015 05:16 PM by Didier Lachieze.)
Post: #8
|
|||
|
|||
RE: Pause in WP34s
(11-25-2015 04:58 PM)ggauny@live.fr Wrote: I understand well what you say, KEY? return the *code* of the key, not her value numeric AND it is just my problem ! Try with KTP? you'll get the numeric value, but only for a single digit: Code: PSE 10 'wait 1 second You can also use PUTK instead of KTP? which will allow you to enter several digits but it will halt the program and you will have to press R/S to continue execution after entering your numeric value. |
|||
11-25-2015, 05:43 PM
Post: #9
|
|||
|
|||
RE: Pause in WP34s
Yes I was triyed KTP? but no worked, surely I have do a error, I will retry immediately
BTW thanks, I am not enough good programmer but may-I suggest to install in future firmware : First : DIVMOD of Dieter Second : PSE that give numbers in X, for ex : 5 or 23 or 1935 (!).... Surely will be usefull, helpfull as built-in fonction IMHO, Gérard. |
|||
11-25-2015, 06:22 PM
Post: #10
|
|||
|
|||
RE: Pause in WP34s
Pardonnais moi. The WP 34S project is closed - all we do is eliminating bugs as soon as you find one. Thus, I'm afraid new commands will hardly be implemented anymore.
PSE works as advertized, so it won't be changed. These statements hold unless something dramatic will happen, like a new hardware. d:-/ |
|||
11-25-2015, 06:38 PM
Post: #11
|
|||
|
|||
RE: Pause in WP34s
Hi Didier,
Yes it run pretty well, me I put 30 for 3 seconds to have time to answer (!). Of course I have see in manual for only digits up to 9, so I'm obliged to changes the rules of the game MOON ROCKET LANDER to put only 9 for fuel. No it is a issue, in hp 25 we had 120 of fuel, in hp 67 only 60 of fuel, them too change rules then me too (LOL). I think my transportation of the program is in good way, in some days I will submit to forum critisisums, I think it will be the first game in WP34s ! Proud as a cucuriku ! Gérard. |
|||
11-25-2015, 06:41 PM
Post: #12
|
|||
|
|||
RE: Pause in WP34s
(11-25-2015 06:22 PM)walter b Wrote: Pardonnais moi. The WP 34S project is closed - all we do is eliminating bugs as soon as you find one. Thus, I'm afraid new commands will hardly be implemented anymore. Hi Dear Sir, I understand the reason you advance, may be in the HP43s that all wait for ! Have a good night and thanks for your explaination. Gérard. |
|||
11-25-2015, 07:01 PM
(This post was last modified: 11-25-2015 07:19 PM by Dieter.)
Post: #13
|
|||
|
|||
RE: Pause in WP34s
(11-25-2015 04:58 PM)ggauny@live.fr Wrote: I understand well what you say, KEY? return the *code* of the key, not her value numeric AND it is just my problem ! Simple. As already mentioned you can use KEY? followed by KTP? Code: PSE 99 If you like you can also manually calculate the numeric value from the key code. Reminds me of the days when TI58/59 users had to translate numeric values to printer codes. And these were not continuous... Here is a formula for the WP34s where c is the key code: value = (c mod 10) – 3 * (c idiv 10) + 17 BTW this would be another nice application for DIVMOD. *gg* The only exception is the 0 key (code 72), this yields –2. Add x<0? CLX and you're done. ;-) But I'd prefer KTP?. Applications like these are the reason why this command exists. (11-25-2015 04:58 PM)ggauny@live.fr Wrote: Another issue : if I run with BST, the code appears in X but no in RUN ? BST does not run anything. It simply steps back in program memory. And single-stepping through the code (with the down-arrow key) of course will not work as this returns the key code of that key, i.e. 61. #-) (11-25-2015 04:58 PM)ggauny@live.fr Wrote: Well, Well, a white night in perspective ! No nuits blanches required. All you need to know takes just a few minutes. Dieter |
|||
11-25-2015, 07:15 PM
(This post was last modified: 11-25-2015 07:30 PM by Dieter.)
Post: #14
|
|||
|
|||
RE: Pause in WP34s
(11-25-2015 06:38 PM)ggauny@live.fr Wrote: Yes it run pretty well, me I put 30 for 3 seconds to have time to answer (!). You can jump back to the PSE statement if no key was pressed, so that the program does not continue until the user entered something. (11-25-2015 06:38 PM)ggauny@live.fr Wrote: Of course I have see in manual for only digits up to 9, so I'm obliged to changes the rules of the game MOON ROCKET LANDER to put only 9 for fuel. Using PSE for entering data is a nice feature for games like this – the user has to enter a value in that very second when the 0 appears. But this is not mandatory. The "moon rocket lander" game has been ported to many calculators, most of which do not have this enter-data-during-a-pause-statement feature. For instance, this game also came with my 34C's program collection. Here you simply entered the amount of fuel after the 0 appeared and pressed R/S afterwards. If nothing was entered the program continued with the 0 in X, i.e. don't burn any fuel. #-) Finally take a look here and see how the lunar lander has been ported even to present day calculators. ;-) (11-25-2015 06:38 PM)ggauny@live.fr Wrote: Proud as a cucuriku ! A what ?-) Dieter |
|||
11-25-2015, 07:47 PM
Post: #15
|
|||
|
|||
RE: Pause in WP34s
Yes Dieter,
It was also the way in hp25, we puted fuel to consum and R/S, but I was thinking the hp67 given more difficult and excitation (?). Thank for the link, it is the way of hp25. But I want try do as in hp67, may be I will finish to find ? May be. I was thinking of a "coq, fier comme un coq", it is the emblem of the France, and I was thinking it is the name in english because in designs animated they call it "cukuriku", but my wife that I asked say it is rooster in sens of fawl, I was do a mistake. Gérard. |
|||
11-25-2015, 08:32 PM
(This post was last modified: 11-26-2015 01:37 PM by Dieter.)
Post: #16
|
|||
|
|||
RE: Pause in WP34s
(11-25-2015 07:47 PM)ggauny@live.fr Wrote: It was also the way in hp25, we puted fuel to consum and R/S, but I was thinking the hp67 given more difficult and excitation (?). Of course having to enter the fuel within a second is more challenging. But you can have the same kind of thrill with the 34s. Here is a sample routine: Code: ALL 03 // or FIX 0 if you prefer This routine accepts numeric input during the PSE with up to three digits (i.e. 0...999). If only one or two digits are entered (or nothing at all) that's fine either. The BACK 007 line ingnores illegal keys (everything except 0...9) and allows the user to enter a valid digit. Replacing this by SKIP 003 also ignores invalid keys, but counts them as one of the three allowed keystrokes. And if SKIP 005 is used instead, any non-numeric key directly cancels fuel input. Try it. You see "3"..."2"..."1"..."0". Now enter a digit within the second the 0 is displayed. If you do, you may continue with a another and/or a third digit, thus building a two- and then three-digit number. Type [1], then [5], finally [3] and get fuel=153. Type [4] and get fuel=4. Enter nothing and fuel is 0. So the whole look and feel is much like the original HP67 version. ;-) I am sure this can be done without using any data registers, but this way the code becomes more clear. Dieter |
|||
11-25-2015, 08:54 PM
Post: #17
|
|||
|
|||
RE: Pause in WP34s
(11-25-2015 08:32 PM)Dieter Wrote: Dieter - I read and appreciate your almost daily contributions, always teaching me little tricks, space and time saving techniques, stuff I didn't know the 34S could even do, and on the odd occasion I even learn some math. Just wanted to comment that this little routine solves a frequent problem, elegantly using several non-obvious 34S commands, all documented very clearly. Just a small thanks for all you teach me (and I presume, many others). Happy Thanksgiving --Bob Prosperi |
|||
11-26-2015, 06:49 AM
Post: #18
|
|||
|
|||
RE: Pause in WP34s
(11-25-2015 08:54 PM)rprosperi Wrote:(11-25-2015 08:32 PM)Dieter Wrote: I agree with you ! Him and a few others greats programmers have always the solution that miss us ! Yes we good learn with thoses teatchers ! Gérard. |
|||
11-26-2015, 01:24 PM
(This post was last modified: 11-26-2015 01:40 PM by Dieter.)
Post: #19
|
|||
|
|||
RE: Pause in WP34s
(11-25-2015 08:54 PM)rprosperi Wrote: Dieter - I read and appreciate your almost daily contributions, always teaching me little tricks, space and time saving techniques, stuff I didn't know the 34S could even do, and on the odd occasion I even learn some math. (11-26-2015 06:49 AM)ggauny@live.fr Wrote: I agree with you ! Him and a few others greats programmers have always the solution that miss us ! Bob and Gérard: thank you very much for your kind words. But teaching is learning, and it also shows in this thread: I knew the KEY? function but I was not aware of what KTP? can do until I read Didier's post. And finally that's what this forum is all about. BTW, although the posted code works I'd recommend replacing the SKIP 010 following KEY? X with SKIP 009 (jump to "RCL 00" at the end), so I updated the original listing. Dieter |
|||
11-27-2015, 10:26 PM
Post: #20
|
|||
|
|||
RE: Pause in WP34s
I very much appreciate the contributions in this thread. It shows that the work we've put into the WP 34S command set is paying off. In particular, the interactive commands, such as KEY?, KTP? and PUTK, have been added to allow the creation of a program such as 'MED', the matrix editor or a lunar landing game Gérard is about to write. I had a hard time to convince Walter and Pauli that my ideas were worth being included in the official release of the software. I'm glad they made it.
Marcus von Cube Wehrheim, Germany http://www.mvcsys.de http://wp34s.sf.net http://mvcsys.de/doc/basic-compare.html |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 3 Guest(s)