Author Topic: Let's hack the HP Prime!  (Read 128224 times)

0 Members and 4 Guests are viewing this topic.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Let's hack the HP Prime!
« Reply #150 on: November 18, 2013, 01:23:39 pm »
That is interesting. Regarding such OS change, however, would this affect compatibility with existing HP PPL programs?

Welcome to the forums, by the way :)
« Last Edit: November 18, 2013, 01:24:00 pm by DJ Omnimaga »

Offline Keoni29

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2466
  • Rating: +291/-16
    • View Profile
    • My electronics projects at 8times8
Re: Let's hack the HP Prime!
« Reply #151 on: November 18, 2013, 01:41:38 pm »
It's very cool to see new members jump on this forum with first posts like that. I am glad there are so many people exited for the prime!
If you like my work: why not give me an internet?








Offline quitte

  • LV2 Member (Next: 40)
  • **
  • Posts: 22
  • Rating: +1/-0
    • View Profile
Re: Let's hack the HP Prime!
« Reply #152 on: November 18, 2013, 02:22:11 pm »
Quote
That is interesting. Regarding such OS change, however, would this affect compatibility with existing HP PPL programs?

As there hardly are any the more important question first: "would this affect compatibility with programs preinstalled?"

Except for the Graphing variables and the settings variables I don't see why any are predefined. As far as I can tell they serve no purpose whatsoever. This is what the Manual has to say:
Quote
You use Home variables to store
data that is important to you, such as matrices, lists, real
numbers, etc.

I don't get why I would want to do that.

Would it affect PPL programs? Yes. If the program used the variables while assuming they are of their respective types. For example an assignment L1:=1 now results in a list containing one element: L1={1}. This behaviour would change. If the type of L1 was initially undefined the same assignment would result in a variable of type real (I think) L1=1

Imho this is the more often expected behaviour.

Of course renaming all those home variables to chinese characters would make them rather useless (which imho they already are). So if someone from HP is reading this: How about instead add a button to create new variables in the VARS view? So that I can define my own variables "that are important to me"?
Also: Why do only variables created in the home view appear in the VARS view (some don't - something about that dialogue popping up), while some can only be found in the mem view?

Offline SpiroH

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 729
  • Rating: +153/-23
    • View Profile
Re: Let's hack the HP Prime!
« Reply #153 on: November 18, 2013, 02:30:42 pm »
Welcome quitte!

...
It looks like the bootloader is a general purpose one that is capable of booting both PE and ELF format binaries from at least yaffs2 and fat filesystems. It seems to have support for the lcd, usb and serial.
I wouldn't be surprised if it provided an interface via the uart - but am not going to try myself since I need to resolve a minor hardware defecrt with hp first.
This seems to me as a very reasonable guess, indeed. They (HP) wouldn't spend time and money reinventing the wheel (as someone already has put it). If this guess happens to be true, then we should be able to get it replaced with our own 'custom' bootloader. That would a major step towards starting the hacking process. Unfortunately(?) this requires somebody with some knowledge and above all with some spare time to dig into it. Let's hope more hackers do arrive at omnimaga! ;)


Offline willrandship

  • Omnimagus of the Multi-Base.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2953
  • Rating: +98/-13
  • Insert sugar to begin programming subroutine.
    • View Profile
Re: Let's hack the HP Prime!
« Reply #154 on: November 18, 2013, 02:31:49 pm »
We wouldn't need to replace the bootloader if it takes standard ELFs. Just load linux with it.

Offline SpiroH

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 729
  • Rating: +153/-23
    • View Profile
Re: Let's hack the HP Prime!
« Reply #155 on: November 18, 2013, 02:35:21 pm »
We wouldn't need to replace the bootloader if it takes standard ELFs. Just load linux with it.
Yeah, maybe so?! I'm just playing on the safe side. We never know what's hidden inside a bootloader until we try to replace it.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Let's hack the HP Prime!
« Reply #156 on: November 18, 2013, 03:52:46 pm »
Quote
That is interesting. Regarding such OS change, however, would this affect compatibility with existing HP PPL programs?

As there hardly are any the more important question first: "would this affect compatibility with programs preinstalled?"

Except for the Graphing variables and the settings variables I don't see why any are predefined. As far as I can tell they serve no purpose whatsoever. This is what the Manual has to say:
Quote
You use Home variables to store
data that is important to you, such as matrices, lists, real
numbers, etc.

I don't get why I would want to do that.

Would it affect PPL programs? Yes. If the program used the variables while assuming they are of their respective types. For example an assignment L1:=1 now results in a list containing one element: L1={1}. This behaviour would change. If the type of L1 was initially undefined the same assignment would result in a variable of type real (I think) L1=1

Imho this is the more often expected behaviour.

Of course renaming all those home variables to chinese characters would make them rather useless (which imho they already are). So if someone from HP is reading this: How about instead add a button to create new variables in the VARS view? So that I can define my own variables "that are important to me"?
Also: Why do only variables created in the home view appear in the VARS view (some don't - something about that dialogue popping up), while some can only be found in the mem view?
The issue though is that if the calculator gets popular next school year when it comes out in brick and mortar stores (if ever), then many people who get or make programs will not ever know that there is a modified OS that no longer supports variables the way the official OS did and then share their programs. At the same time, some hardcore programmers who use the OS will release their own programs, flooding the web with programs compatible with only one OS at once. It doesn't matter if there aren't many HP PPL programs right now, as there could be many in the future. Basically, people will have to constantly install back and forth the unnoficial OS and official one in order to run everything they want.

I am personally making large programs for the HP Prime right now and I definitively don't want to have to re-write everything in one year when custom OSes start coming out. I already have one game out, HP Prime Tunnel, that uses L1 and A-Z variables. There are already around 20 programs on Hpcalc.org.

I think it would be best if there was some sort of emulator released that changes the behavior of the HP PPL interpreter or compiler or at least a program allowing you to dual boot. Even better: An OS that supports both syntaxes/type of vars.
« Last Edit: November 18, 2013, 03:55:46 pm by DJ Omnimaga »

Offline quitte

  • LV2 Member (Next: 40)
  • **
  • Posts: 22
  • Rating: +1/-0
    • View Profile
Re: Let's hack the HP Prime!
« Reply #157 on: November 18, 2013, 04:05:58 pm »
Quote
I am personally making large programs for the HP Prime right now and I definitively don't want to have to re-write everything in one year when custom OSes start coming out. I already have one game out, HP Prime Tunnel, that uses L1 and A-Z variables. There are already around 20 programs on Hpcalc.org.

I think it would be best if there was some sort of emulator released that changes the behavior of the HP PPL interpreter or compiler or at least a program allowing you to dual boot. Even better: An OS that supports both syntaxes/type of vars.

This means you are making large programs that overwrite variables that contain - according to the manual - data that is important to the user. You shouldn't do that. If however you use local lists you can continue to do so - but you'd have to make sure to initialize it with the data type you end up using.

Seeing as how much mistakes I make when I try to pick variable names to circumvent the limitations while entering formulas into CAS I consider it a huge mistake to have those home variables in the first place. I don't see removing them causing any big issues.
« Last Edit: November 18, 2013, 04:06:19 pm by quitte »

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Let's hack the HP Prime!
« Reply #158 on: November 18, 2013, 04:09:31 pm »
Aren't those variables cleared on calculator shutdown, though?

Else, I guess that would be a good idea, assuming that this doesn't drastically increase my program file size. On the 84+ it was common practice to overwrite those predefined vars, though, since that's all we had, and nobody complained except a small minority. The issue right now is that almost every HP Prime program released so far are made by TI programmers and a lot of TI coders planned to get the calc to program it. Inevitably, a lot of programs will use those vars, since it's not considered bad practice on lower end TI models. Programmers will most likely carry those habits on the HP Prime.

That reminds me, is it possible to create permanent variables and lists that won't get deleted on program exit? I am asking, since I would like to make an adventure game with save feature.
« Last Edit: November 18, 2013, 04:16:16 pm by DJ Omnimaga »

Offline willrandship

  • Omnimagus of the Multi-Base.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2953
  • Rating: +98/-13
  • Insert sugar to begin programming subroutine.
    • View Profile
Re: Let's hack the HP Prime!
« Reply #159 on: November 18, 2013, 04:10:32 pm »
quitte, they do it that way because it's much easier on the OS's end. No namespacing, no reserving room for a growing set of variables, no tracking data and reassigning it. I'm not saying it's ideal, but it's much faster. In a compiled language like C, all this work is done before the program ever launches. The same is true for most of the other languages, like Java or Python. They consolidate all the memory storage before they run. However, this is a completely interpreted language, so these calculations would have to be done in real time, every time you want to enter a new variable namespace.

On an embedded environment like this, the CPU time and RAM used for this process are not negligible.

Also, DJ_O, your point about compatibility is very important.

If you want a better variable stack, just implement a better language and ignore the on-calc programming.
« Last Edit: November 18, 2013, 04:13:56 pm by willrandship »

Offline quitte

  • LV2 Member (Next: 40)
  • **
  • Posts: 22
  • Rating: +1/-0
    • View Profile
Re: Let's hack the HP Prime!
« Reply #160 on: November 18, 2013, 04:30:05 pm »
Quote
is it possible to create permanent variables and lists that won't get deleted on program exit?

I read somewhere a couple of hours ago that matrices are indestructible and survive even resets

Quote
In a compiled language like C, all this work is done before the program ever launches

I recall Tim Wessmann talking about how the PPL is compiled before running and how the compiler is fast enough for there not being a point in saving the binaries. PPL is not an interpreted language.

My problem with the variables appears when using this calculator to do calculations. If it was just for programming it wouldn't be much of a problem since then I can just use long variable names - I'm typing on a PC anyways.

In CAS Mode however every character of the output counts because a line of the screen fills quickly. I can't just opt for R_n instead of Rn.And when you have both uppercase and lowercase variables should be used in the given task? I have to make up weird rules for picking variable names _all the damn time_ just because they are sitting there containing 0 {0}
  • etc. in the Home Vars for no reason I can tell. At least all lowercase letters and their combinations with indices can be used. The uppercase letters however...


I'm not the only one complaining. Here's a post from hpmuseum: http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/forum.cgi?read=256099#256099
Quote
HP: you've stolen my variables. By restricting where I can use lower or upper case variables, you've DESTROYED my work-flow. Equations require a combination of upper and lower case variables... what were you thinking?
« Last Edit: November 18, 2013, 04:33:25 pm by quitte »

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Let's hack the HP Prime!
« Reply #161 on: November 18, 2013, 10:52:22 pm »
Wow, if PPL is compiled, then I guess that might explain why it's so fast lol.

EDIT: Typo
« Last Edit: November 18, 2013, 11:40:30 pm by DJ Omnimaga »

Offline timwessman

  • LV3 Member (Next: 100)
  • ***
  • Posts: 94
  • Rating: +32/-0
    • View Profile
Re: Let's hack the HP Prime!
« Reply #162 on: November 18, 2013, 11:35:16 pm »
Advanced users have no problems with "i am in charge of creating a variable". However, we have very strong feedback from lower end users and educators that having a set of predefined variables is very important and useful to them for many reasons.

Prime in its first release is not targeted directly at high end users. What was and wasn't in the first release was not targeted at the top 1% of users. If that messes up "your workflow" as was posted in that thread, and even the fact that someone is posting about calculators, pretty much by definition means they fall in that tiny power user minority.

Wow, if PPL is interpreted, then I guess that might explain why it's so fast lol.

Interpeted mean *slower*, not faster unless something is strangely wrong.

What happens is that since the compiler is so fast, the first time you use it then things are compiled for execution and will remain around until a power cycle.
« Last Edit: November 18, 2013, 11:39:06 pm by timwessman »
TW

Although I work for the HP calculator group, the comments and opinions I post here are my own.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Let's hack the HP Prime!
« Reply #163 on: November 18, 2013, 11:40:10 pm »
Erm sorry, I meant compiled. My bad lol XD
« Last Edit: November 18, 2013, 11:40:17 pm by DJ Omnimaga »

Offline willrandship

  • Omnimagus of the Multi-Base.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2953
  • Rating: +98/-13
  • Insert sugar to begin programming subroutine.
    • View Profile
Re: Let's hack the HP Prime!
« Reply #164 on: November 18, 2013, 11:56:56 pm »
It makes sense to have a system set of variables that can be transferred from program to program, but it would also be nice to have local-program variables. It seems like having both should be an option.