HP Forums
Newbie Questions - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Newbie Questions (/thread-365.html)



Newbie Questions - The Shadow - 01-08-2014 11:05 AM

Hello, I'm a HP calc user from way back. Can't afford the physical Prime just now, but I've been messing around a fair bit with the emulator... and in the process have gathered some questions.

1. Is there any way for a program to return more than one value to the stack in RPN entry mode? I'm not seeing one, but maybe I'm missing it.

If not, a suggestion might be to add two new commands: One to turn the RPN stack into a list, and vice versa. Then it would be easy to add as many things to the list as you like, then transform it.

Or even just re-add the DEPTH, ->LIST, and LIST-> commands. (A version of EXPR that works nicely with RPN would be wonderful too, but let's not get too greedy. :)

2. Is there any way to retrieve the number of arguments a program is expecting?

3. Is there any equivalent for the old KEYEVAL command? (For those who might not know, it simulates the press of a particular key.) Key reassignment really comes into its own with this ability.

4. How would one go about storing a value in a variable name INPUT'ed by the user? Is this even possible?

5. How does one insert a line feed? I can't find it in the CHARS menu.

There will probably be more later, but that'll do for now! Thanks in advance for your help. Oh, and I guess there's one more:

6. Any plans to make another calculator that's basically the 50g with the Prime hardware and the new Prime commands? 'Cause I will break the sound barrier ordering one if so. :)


RE: Newbie Questions - Eddie W. Shore - 01-08-2014 02:46 PM

I can answer a couple of questions:

1. The best way to return multiple answers is to use a list or vector. Example:

RETURN [A,B,C...];

RETURN {A,B,C...};

Not sure about 2 and 3.

4. Using the INPUT command will automatically store the value. So INPUT(A); will prompt for A and store its value in A.

5. Good question regarding the line feed, I can't find it either.


RE: Newbie Questions - eried - 01-08-2014 03:53 PM

(01-08-2014 11:05 AM)The Shadow Wrote:  3. Is there any equivalent for the old KEYEVAL command? (For those who might not know, it simulates the press of a particular key.) Key reassignment really comes into its own with this ability.
Any example when you need this? The scripts are pretty "sandboxed" in my opinion so I don't think there is a direct way (you can call views and other things)

(01-08-2014 11:05 AM)The Shadow Wrote:  5. How does one insert a line feed? I can't find it in the CHARS menu.
Code:
char(10)

example

Code:
msgbox("hello"+char(10)+"cruel world");

(01-08-2014 11:05 AM)The Shadow Wrote:  There will probably be more later, but that'll do for now! Thanks in advance for your help. Oh, and I guess there's one more:

6. Any plans to make another calculator that's basically the 50g with the Prime hardware and the new Prime commands? 'Cause I will break the sound barrier ordering one if so. Smile
I think this might happen with the current device, if is "rooted" some day.


RE: Newbie Questions - The Shadow - 01-08-2014 04:45 PM

Thank you both for taking the time to reply!

(01-08-2014 02:46 PM)Eddie W. Shore Wrote:  I can answer a couple of questions:

1. The best way to return multiple answers is to use a list or vector. Example:

RETURN [A,B,C...];

RETURN {A,B,C...};

Granted, but I meant put A, B, and C on separate levels of the stack. There doesn't seem to be any way to take a list apart, RPN-style.

Quote:4. Using the INPUT command will automatically store the value. So INPUT(A); will prompt for A and store its value in A.

I guess I didn't make myself clear. I meant being able to store a value in a variable specified by the user. So a program could store a value in MyNewVariable, named by the user on the spot.

eried Wrote:Any example when you need this? The scripts are pretty "sandboxed" in my opinion so I don't think there is a direct way (you can call views and other things)

I'd like to be able to create key reassignments that, for example, activate when the key is held down for half a second, or with another key held down simultaneously, while leaving its ordinary behavior unchanged. I use this *all the time* on my 50g, it's made it immensely more functional.

Quote:char(10)

Thank you!

Quote:I think this might happen with the current device, if is "rooted" some day.

I sincerely hope you are right! Though the keyboard will still leave a lot to be desired, IMO - the more so if repurposed as a "51g". I'll gladly live with it, though!


RE: Newbie Questions - Michael de Estrada - 01-08-2014 05:04 PM

The problem is that PPL programming does not support RPN stack operations and RPN is only available in Home view, where direct keystroke programming is not available. To me the Prime is more akin to an HP 71B than one of the RPL calculators like the HP 50g. The Prime is basically designed to be an algebraic entry type machine with very limited RPN capabilities, and that's how I am using mine. Like you, I'd love to see an updated HP 51g with an improved backlit screen and better keyboard.


RE: Newbie Questions - The Shadow - 01-08-2014 05:48 PM

(01-08-2014 05:04 PM)Michael de Estrada Wrote:  The problem is that PPL programming does not support RPN stack operations and RPN is only available in Home view, where direct keystroke programming is not available.

Right now, it appears to be so, yes. But give me the ability to make lists from the stack and vice versa, and I can recreate a large chunk of those operations right now.


RE: Newbie Questions - debrouxl - 01-08-2014 08:05 PM

The Prime is an open device, as shown by the fact modified firmware upgrades just work ( http://tiplanet.org/hpwiki/index.php?title=HP_Prime/Firmware_files , http://tiplanet.org/forum/viewtopic.php?f=55&t=13329&lang=en - maybe replacing armfir.elf embedded into the FAT16 filesystem would just work ?), so it's bound to be rooted Wink

As a newcomer to the HP community (I'm an old-timer of the TI community, where people are definitely interested in low-level tinkering with calculators), it's quite disappointing to see the HP community showing so little love to the powerful Prime... That can be explained by facts such as the low number of Prime calculators in users' hands, and the wide availability of devices even more open, much more powerful, and cheaper than the Prime - but still, it's currently the most powerful calculator on the market, it's an open platform, and it's virgin territory, perfect for tinkerers Wink

Although it took years, and despite the fact that the hardware is undocumented (no public datasheet), Linux was eventually ported to the Nspire. Another page of TI-Planet's hpwiki contains links to Linux and QEMU-based emulators which support the same SoC as the one used by the prime.


RE: Newbie Questions - Han - 01-08-2014 08:22 PM

(01-08-2014 05:48 PM)The Shadow Wrote:  
(01-08-2014 05:04 PM)Michael de Estrada Wrote:  The problem is that PPL programming does not support RPN stack operations and RPN is only available in Home view, where direct keystroke programming is not available.

Right now, it appears to be so, yes. But give me the ability to make lists from the stack and vice versa, and I can recreate a large chunk of those operations right now.

If you are really inclined, you think can re-implement RPN using the user keyboard and writing your own display routine. Everything else can be saved in lists. If you want a key-press to be handled by the built-in system routines, then just have your custom keys return the key-value that you wish the system to evaluate.


RE: Newbie Questions - The Shadow - 01-08-2014 11:29 PM

(01-08-2014 08:22 PM)Han Wrote:  If you are really inclined, you think can re-implement RPN using the user keyboard and writing your own display routine. Everything else can be saved in lists.

I've actually thought about it, though it would be a huge project. I can already see how to do the directories and variables. What I can't figure out is how to refresh the display while still handling keypresses. See below.

Quote:If you want a key-press to be handled by the built-in system routines, then just have your custom keys return the key-value that you wish the system to evaluate.

This was one of my questions in the first post - I'm not clear on how to do this exact thing.


RE: Newbie Questions - The Shadow - 01-11-2014 02:57 AM

Okay, I'm feeling really stupid here, but I keep seeing references to "CAS programs" and don't know what they are. I know what CAS commands are, but the programs are clearly something beyond just PPL programs that use the commands.

Judging by the PDQ program, they use a slightly different syntax, for one. And when I tried entering it in the program editor, it threw errors.

So what am I missing here, and how can I find out more?


RE: Newbie Questions - Helge Gabert - 01-11-2014 03:46 AM

There are some good posts by Joe Horn about his a while back. Just search the archives.

You can create a dummy CAS program by entering some like this in CAS view

g(x):=x^2

Then, g shows up in the program catalog as a CAS program.

Now, you can edit this dummy program by inserting a BEGIN and END; statement

(x) -> BEGIN

//your code here (assuming you want to pass along one parameter, but you can change that as well)

END;

That's it in a nutshell.


RE: Newbie Questions - Michael de Estrada - 01-11-2014 03:57 AM

(01-11-2014 03:46 AM)Helge Gabert Wrote:  There are some good posts by Joe Horn about his a while back. Just search the archives.

You can create a dummy CAS program by entering some like this in CAS view

g(x):=x^2

Then, g shows up in the program catalog as a CAS program.

The confusing part is that it shows up in CAS on Home view in the Vars CAS Vars menu, rather than in the Toolbox CAS menu, even though it is a program/function, not a variable.


RE: Newbie Questions - Helge Gabert - 01-11-2014 04:06 AM

I agree, I also think that is confusing. But it does show up in the Vars CAS Program menu!