Post Reply 
First python project : HP41 emulator + hints of workflow
05-16-2021, 01:14 PM (This post was last modified: 05-19-2021 07:01 AM by Oulan.)
Post: #1
First python project : HP41 emulator + hints of workflow
While beeing disapointed due to large cpu throttle in HPPL, when python came on the Prime I could not resist ...

So I ported my HP41 emulator on the Prime in Python ... see at LINK

Some nice results :
- python is at least 10 times faster than HPPL for casual stuff
- no cpu throttling
- very deep and well done integration of python with prime firmware
- hpprime module very well done (some small bugs ...)
- python is robust on the prime, very few calc reset/reboot
- if you play too long with the emu, when you leave it the prime shut off due to auto off function not taking python execution into account

Only tested on a G2 model ... for G1 you can change some timing in (near line 790 : adjust 0.30 in hpprime.eval('WAIT(.030)'))

HP PRIME development workflow in micro-python:
  • all is at 2.1.14575 (2021 4 28) level (calc is at 2021 5 5 firmware)
  • only tested on a pure micro-python app, no use of HPPL wrapper
  • v/calc is either physical calculator (connected on the pc) or virtual calculator.
  • An important directory on the PC is 'HP Connectivy Kit/Content/app.hpappdir/' in your 'Documents' when developing the app named 'app'. This directory is important because you do not have sync problem with the v/calc. Using directly 'HP Connectivy Kit/Calaculators/app.hpappdir' can lead to sync problem if you use the v/calc and an external editor even one after the other. Try yourself and you will see ... I loose some editing due to this.
  • See this directory as a very safe scratchpad Smile and make your copies from/to v/calc yourself. If you want to be secure: always delete the destination to avoid an erasing when copying. Doing this I never had any problem. But it's only my way and opinion.
I use Calculator, Dev Kit, Emulator and a text editor (I use notepad++ and/or Vs Code) as follow:
  • Set your editor to use LF only as end of line, UTF8 and to expand TABs as spaces.
  • I never edit directly program on the v/calc with the editor in the dev kit. (It works for HPPL progs, at least in the previous releases, but for python, it is too dangerous).
  • I work with 'Content' which is local to the Pc : edit files from here either with the integrated editor or external editor from the file explorer.
  • When testing, delete the whole app in the v/calc, then copy from 'Content' to v/calc.
  • If you made some change in the v/calc, back up the previous app.hpappdir:
    - First do a 'Sync' from the contextual menu of the v/calc.
    - I use an 'archives' directory, I move the app.hpappdir from 'Content' to 'Content/archives' and replace.
    - Copy back the whole app from v/calc to 'Content' ... edit at leisure ...
  • Generally I create in the PC in the 'HP Connectivy Kit/Content/app.hpappdir/' directory.
To add binary file:
You can do it in the 'HP Connectivy Kit/Content/app.hpappdir/' directory
You can also use in the devKit contextual menu 'add a file' in the v/calc. (be sure to 'Sync' before and after).

I make minor changes in v/calc without troubles, editor seems robust. I just does not succeed in using 'signets/marks'. 'goto' lines sometimes does not refresh the display, moving the cursor with arrows sometimes correct this (perhaps 1000 lines is too much ?).

I sometime edit large parts in the virtual calc directly: PC keyboard and mouse are nice at this job.
Only gripes is the lack of 'SHIFT-arrows' to select text.

Actually sometimes the dev kit takes some seconds to react ... just wait.

When in trouble (shadow apps, strange apps...):
As seen somewhere in this forum I do the following:
  • connect to the dev kit
  • make the cleaning (from contextual menu, delete or init)
  • disconnect the calc (do not shut off)
  • on the calc, make a backup (MEM/Backups,Sauvegardes)
  • still on the calc, restore it at once
Do not shut off the calc between those steps.
Find all posts by this user
Quote this message in a reply
Post Reply 

Messages In This Thread
First python project : HP41 emulator + hints of workflow - Oulan - 05-16-2021 01:14 PM
RE: First python project - Vincent Weber - 05-16-2021, 01:17 PM
RE: First python project - - 05-16-2021, 05:23 PM
RE: First python project - tcab - 05-17-2021, 12:00 AM

User(s) browsing this thread: