Author Topic: HP Prime Emulator  (Read 33654 times)

0 Members and 2 Guests are viewing this topic.

Offline Jean-Baptiste Boric

  • LV2 Member (Next: 40)
  • **
  • Posts: 21
  • Rating: +1/-0
    • View Profile
Re: HP Prime Emulator
« Reply #30 on: May 03, 2018, 01:37:17 pm »
By combining the data part of your image with the firmware bits of an old update file I got something that booted to this:

Code: [Select]
$ dd if=flash_dump of=dat.raw bs=1024 skip=$((256+1024+4096+32768)) seek=$((256+1024+4096+32768))
It's not responding to the keyboard and the clock on the upper right is hung. The firmware doesn't seem to be hung after a quick look with GDB, but obviously something prevents it from fully ticking. The UART has a whole bunch of yaffs logs, I assume the firmware got stuck because homemade images don't have a yaffs filesystem. I do wonder if the "Format Disk C" option in the diagnostic tools would've fixed that.

Do you happen to know on what pin is the reset switch on the prime?

I assume nRESET. I remember being able to boot the calculator straight into recovery mode by holding the SYMB button down and hooking an USB cable without the battery, so I would expect to be able to drop into the diagnostic tools by holding down C-F-O the same way.

With the emulator, I seem to be able to drop into the recovery (which just hangs with a black screen), but not into the diagnostics program. Odd...
We're gonna have a geeky Christmas,
That is what we'll do.
We're gonna have a geeky Christmas,
Hope you'll have one too.

Offline gigi1237

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 17
  • Rating: +0/-0
    • View Profile
Re: HP Prime Emulator
« Reply #31 on: May 03, 2018, 01:55:11 pm »
Tried pressing C-F-O on my calc while powering up from usb, no dice. Needs to press the reset button. Would you be able to implement it in qemu? So we can then get into the diag utility.

The recovery doesn't work because it sets up the graphics buffer in a different way, one that isn't really supported by the datasheet. I'll try to implement that mode too soon.

Offline Jean-Baptiste Boric

  • LV2 Member (Next: 40)
  • **
  • Posts: 21
  • Rating: +1/-0
    • View Profile
Re: HP Prime Emulator
« Reply #32 on: May 03, 2018, 03:54:09 pm »
I tried prodding the obvious (GPIO data registers, RSTSTAT) with no results. I'll need to take a closer look at the reset circuit on the hardware and see if I can spot something of interest (once I'm back from vacation 'cause I left the calculator back in my flat). Depending on how HP implemented the C-F-O thing, this may end up being a royal pain to figure out.
We're gonna have a geeky Christmas,
That is what we'll do.
We're gonna have a geeky Christmas,
Hope you'll have one too.

Offline Jean-Baptiste Boric

  • LV2 Member (Next: 40)
  • **
  • Posts: 21
  • Rating: +1/-0
    • View Profile
Re: HP Prime Emulator
« Reply #33 on: May 03, 2018, 04:46:00 pm »


Turns out there's an easy way to trigger the diagnostics tool: replace the FirstRunApp key value inside FIRSTRUN.INI with \\.\DIAGNOSE.ROM. This file is located inside the PRIME_APP.DAT's FAT32 partition, offset 8192 bytes.

Still no response to keyboard input. The firmware doesn't seem to scan the keypad matrix once booted.
We're gonna have a geeky Christmas,
That is what we'll do.
We're gonna have a geeky Christmas,
Hope you'll have one too.

Offline gigi1237

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 17
  • Rating: +0/-0
    • View Profile
Re: HP Prime Emulator
« Reply #34 on: May 03, 2018, 04:52:12 pm »
Sweet, great solution! I theorize lack of input is probably due to a missing external interrupt triggered by keypresses.

Offline gigi1237

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 17
  • Rating: +0/-0
    • View Profile
Re: HP Prime Emulator
« Reply #35 on: May 18, 2018, 10:11:49 am »
I checked and input is definitley not interrupt based. Looking at the BESTAARM code it appears that it runs in a separate thread. I think this is the problem, thread scheduling is likley based on on of the internal timers (likley timer2 as it is the only unmasked one), the RTC tick timer does not appear to be relevant to this. The thing is that the current exynos implementation is broken and the timers are not firing. I tried to fix it but it appears they're still not working. I'll commit it to github in a few hours, could you take a look at it boricj?

Edit: I'm a dumbass I never actually tired to fix the timers, just the RTC tick. So yeah... Ignore that
« Last Edit: May 18, 2018, 11:40:01 am by gigi1237 »

Offline gigi1237

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 17
  • Rating: +0/-0
    • View Profile
Re: HP Prime Emulator
« Reply #36 on: November 17, 2018, 02:39:42 pm »
Well I was a bit bored for the past week so I took another stab at the emulator and finally got it mostly working(tm) :w00t::w00t:



And by mostly working I mean it can run the official firmware (version 20130808) relatively well, you can interact with is and most functionality is working, although there is no touch support
whatsoever yet. There is also no GUI keyboard so we have to use the keyboard's physical keys to control it and the key bindings are quite weird. RTC is also not fully working either.

There are also some small screen refresh issues but nothing too serious. Here's a little demo video https://gfycat.com/LikelyDecisiveKite.

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: HP Prime Emulator
« Reply #37 on: November 17, 2018, 10:35:44 pm »
Oh, nice work! I wish I knew the HP Prime better so that I could offer some real input :P

Offline CYBERESPIA

  • LV0 Newcomer (Next: 5)
  • Posts: 1
  • Rating: +0/-0
    • View Profile
Re: HP Prime Emulator
« Reply #38 on: February 12, 2023, 11:43:05 pm »
Any news with this project?