Author Topic: ASM arrives on the HP Prime!  (Read 27416 times)

0 Members and 1 Guest 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
ASM arrives on the HP Prime!
« on: July 06, 2014, 06:33:47 pm »
Partially due to lack of interest from the TI and especially HP community, it will have taken more time than on the Casio PRIZM, but due to HP not having declared war against the community, it will have taken much less time than on the TI-Nspire series. The day where ASM is now possible on the HP Prime has finally arrived!

Quote from: Lionel Debroux
After recently buying a Prime, I've now spent several hours making my own armfir.elf. The result is attached.
The code fills one third of the screen with red, one third with green, and the last third with blue (with some glitches...), then enters an infinite loop. Yeah, this PoC sucks, I know - it sucks just as much as my Nspire DummyOS did, more than three years ago.

Usage: copy the armfir.elf file into APPSDISK.DAT. Firmware transfer, enter recovery mode by pressing the Reset button in the hole on the back, pressing the Symb key, releasing the Reset button, and holding Symb until the Recovery mode screen appears. Then, use usbtool (Windows only).

As usual: works for me, but use at your own risk

Right now, no exploit has been found in the official HP Prime OS by the TI and HP communities, so unlike with Ndless on Nspire OS 3.1 and 3.6, the only current way to run assembly language on the HP Prime is to send a third-party OS to the calculator.

You can download the proof of concept file here.

Although it doesn't do anything much, it still demonstrates how you can install any modified OS on your HP Prime then execute any kind of assembly code in it. Could a patch that can alter the official firmware via Lunar IPS, for example, eventually be made so that ASM launching commands get added? Could the community also be the ones who will fix all the firmware bugs like what happened with the HP 50g? In any case, if anybody decides to learn ARM assembly or C to create advanced softwares for this calculator, remember to stick to recreational, educational and development softwares: programs that can tamper with the HP Prime's exam mode will result into HP blocking third-party and modified firmwares like TI does with Ndless and such programs are against Omnimaga forum rules.

Source:
http://www.hpmuseum.org/forum/thread-1789.html
http://tiplanet.org/forum/viewtopic.php?t=14939

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: ASM arrives on the HP Prime!
« Reply #1 on: July 06, 2014, 08:15:56 pm »
This pretty much convinced me to buy a Prime. :3 Great work by debrouxl again.
I'm not a nerd but I pretend:

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: ASM arrives on the HP Prime!
« Reply #2 on: July 06, 2014, 11:28:38 pm »
So, what I'm getting from this:

There's no built-in native coding tools, but they have done nothing to stop us from making our own OS with such features built in, even so far as replacing it with an entirely new system.

That is just about the best case scenario.

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: ASM arrives on the HP Prime!
« Reply #3 on: July 07, 2014, 05:31:44 am »
Yes, this is totally awesome. Now I don't just want a Prime, I need a Prime. :P

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: ASM arrives on the HP Prime!
« Reply #4 on: July 07, 2014, 11:01:50 am »
So, what I'm getting from this:

There's no built-in native coding tools, but they have done nothing to stop us from making our own OS with such features built in, even so far as replacing it with an entirely new system.

That is just about the best case scenario.
IIRC, they told that as long as we play nice, they'll play nice too. Basically, we need to avoid making programs that can mess around with the calculator teacher mode (eg programs entirely dedicated to cheating in math exams) and we need to ensure that our ASM/C programs cannot easily permanently damage or brick the calculator (but again, the official firmware isn't any better <_<).

In other words, they don't officially support assembly, but they'll give us the freedom to use it as long as we don't tamper with anti-cheating protections. Kinda the same stance as Casio with the PRIZM.

Offline ordelore

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 168
  • Rating: +7/-0
  • Genius and Friend
    • View Profile
    • ordelore8x
Re: ASM arrives on the HP Prime!
« Reply #5 on: July 07, 2014, 11:37:53 am »
So we just need to apply the lessons we learned with the Nspires, and then we have a good time with assembly.
I am a friend.
I mine Bitcoins.

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: ASM arrives on the HP Prime!
« Reply #6 on: July 07, 2014, 11:51:14 am »
Indeed, but even then we really need to be careful. Omnimaga forum has rules against cheating tools (assuming they're entirely devoted to cheating) and dangerous programs and I assume it's the same on certain other forums too. It doesn't stop anyone from sneaking such program through torrent trackers, though, either by not caring or purposely wanting to destroy the HP community (eg that one PTTKiller clone program on Github that literally described itself as "community killer"). But again, maybe HP would just force schools to force students to use the latest OS during tests but still allow downgrading for personal use?

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: ASM arrives on the HP Prime!
« Reply #7 on: July 07, 2014, 12:02:20 pm »
So we just need to apply the lessons we learned with the Nspires, and then we have a good time with assembly.
There is no lesson to get from what happens on Nspires. They are not closed because of a move from the community, they were always closed. Now, I don't say that a program against TI's interest is a good idea, just that even if it contributes to nothing good, it did not start the whole thing either.

Just a question about the HP Prime, would it be possible to "patch" an OS, kind of like what Ndless does ? Because I don't really like the idea of having to choose between HP's OS and the "Ndless" OS.
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: ASM arrives on the HP Prime!
« Reply #8 on: July 07, 2014, 12:04:04 pm »
Well, it is definitely possible. Kind of a romhack actually. :P

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: ASM arrives on the HP Prime!
« Reply #9 on: July 07, 2014, 12:06:46 pm »
So we just need to apply the lessons we learned with the Nspires, and then we have a good time with assembly.
There is no lesson to get from what happens on Nspires. They are not closed because of a move from the community, they were always closed. Now, I don't say that a program against TI's interest is a good idea, just that even if it contributes to nothing good, it did not start the whole thing either.

Just a question about the HP Prime, would it be possible to "patch" an OS, kind of like what Ndless does ? Because I don't really like the idea of having to choose between HP's OS and the "Ndless" OS.
Well, I think we still learned a lesson in a way, because the Nspire was closed because of past experiences on the 84+/89 calcs. IIRC, a TI representative mentionned something about MirageOS programs being at risk of bricking the calc (which is impossible with any ticalc program) and cheating (PTTKiller comes to mind). As a result they locked the Nspire down. However, their stupid move was to continue trying to keep it locked down even after the community started playing nice.

I don't know if the OS can be modified directly on-calc. I don't see the issue with an Ndless OS, though, because the author can just make it identical but with an extra ASM command. If HP updates the firmware, then he can apply his changes on the new firmware instead and we're all set. No compatibility issues will occur. The only problem is that the modded OS would need to be an IPS patch that you manually apply to a real OS, to avoid redistributing copyrighted material.


It would be nice if we could dual-boot, though, especially if Linux gets ported to the HP Prime.
« Last Edit: July 07, 2014, 12:09:45 pm by DJ Omnimaga »

Offline Juju

  • Incredibly sexy mare
  • Coder Of Tomorrow
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 5730
  • Rating: +500/-19
  • Weird programmer
    • View Profile
    • juju2143's shed
Re: ASM arrives on the HP Prime!
« Reply #10 on: July 07, 2014, 01:23:15 pm »
Yeah, I remember stumbling upon a armfir.elf file when disassembling the OS files, which is probably a standard ELF executable like the ones Linux uses. As I see, Lionel merely replaced it with his own one and it worked. So theorically you can easily replace it with a new third-party OS shell or even the Linux kernel (with the right drivers for the screen, keyboard and such, if they aren't in the kernel already).

Lionel should probably share how he did that (edit: wait, he did! :3), this will surely allow third-party OSes and a C library to be developed like we have on the Casio Prizm. I bet he used a simple GCC compiler for an ARM target, which is easy, but he also figured out how to draw on screen, which I guess is not an easy task.

I can probably try messing up with this, but I have no HP Prime, sadly.
« Last Edit: July 07, 2014, 01:25:17 pm by Juju »

Remember the day the walrus started to fly...

I finally cleared my sig after 4 years you're happy now?
THEGAME
This signature is ridiculously large you've been warned.

The cute mare that used to be in my avatar is Yuki Kagayaki, you can follow her on Facebook and Tumblr.

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: ASM arrives on the HP Prime!
« Reply #11 on: July 07, 2014, 01:28:17 pm »
Yeah that Cyrille guy from HP explicitly stated it is a standard elf that you can swap for your own. Also, since it's just that, a custom loader could be made that is run instead of the OS and then runs whatever elf you want it to. Instant multiboot boom. :P

Offline Juju

  • Incredibly sexy mare
  • Coder Of Tomorrow
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 5730
  • Rating: +500/-19
  • Weird programmer
    • View Profile
    • juju2143's shed
Re: ASM arrives on the HP Prime!
« Reply #12 on: July 07, 2014, 01:35:50 pm »
Exactly. I'm kind of surprised nobody really bothered to do that until Lionel did, but yeah the hard thing is to figure out the screen and keyboard drivers, that's probably why.

So yeah, as I said, porting the Linux kernel would probably be easy once those drivers figured out and written.

Remember the day the walrus started to fly...

I finally cleared my sig after 4 years you're happy now?
THEGAME
This signature is ridiculously large you've been warned.

The cute mare that used to be in my avatar is Yuki Kagayaki, you can follow her on Facebook and Tumblr.

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: ASM arrives on the HP Prime!
« Reply #13 on: July 07, 2014, 01:37:13 pm »
There's even some ground work laid out for that already. The soc is a publicly documented Samsung chip.

Offline bb010g

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 428
  • Rating: +22/-1
  • I do stuff
    • View Profile
    • elsewhere on the net
Re: ASM arrives on the HP Prime!
« Reply #14 on: July 07, 2014, 01:55:39 pm »
AWWW YEAH.  ;D

I am so getting Haskell working on this.
Arch Linux user
Haskell newbie | Warming up to Lua | Being dragged into C++
Calculators: HP 50g, HP 35s, Casio Prizm, TI-Nspire CX CAS, HP 28s, HP Prime, Mathematica 9 (if that counts)
π: 3.14...; l: 108; i: 105; e: 101; l+i+e: 314
THE CAKE IS A LIE IS A PIE