Post Reply 
First python project : HP41 emulator + hints of workflow
06-11-2021, 12:28 AM
Post: #41
RE: First python project : HP41 emulator + hints of workflow
(06-11-2021 12:12 AM)Steve Simpkin Wrote:  I would recommend the original HP-41C Owner's Handbook and Programming Guide. It assumes you know nothing about HP calculators and is a great example of the friendly, well written calculator manuals that HP used to write.

https://literature.hpcalc.org/community/...hpg-en.pdf

I endorse Steve's recommendation! The later CX manuals cover more of the functions, but the original 41C manual is in many ways the peak of the great old-school HP manuals, even including some of the semi-goofy little cartoons. Starting with the 41CX manual, they took on an ever-increasing tendency towards reference books, simply explaining how the functions work (parameters, stack use, results) but not explaining how to use them.

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
06-12-2021, 10:36 PM
Post: #42
RE: First python project : HP41 emulator + hints of workflow
New to the hp41c review and the pyhp41e emulator.

I was able to figure out the fast/slow switch, the roll down, xyzt rpn, rpn stack
and the trig/log/square/square root functions. ( I used the monkey typing on a
keyboard method without using any docs) I also figured out the virtual paper
tape printer.

Programming it will have to wait for now.

The emulator is a great rpn trainer for those who do not have any of the
classic hp calculators.

Thanks
Find all posts by this user
Quote this message in a reply
06-13-2021, 03:29 AM (This post was last modified: 06-13-2021 01:22 PM by gfbci.)
Post: #43
RE: First python project : HP41 emulator + hints of workflow
First I would like to thank Olivier and this group for their generously shared knowledge.

Py41.e can work on G1 by editing lines 74-75 values of the py41.py file with something like:

...
aof=100 if k==-1 else 1
if aof>=500:
...

This apparently prevents the simulator from going into sleep mode when a key is released.
Don't trust my explanation, but it works!

Gianfranco

edit: Please disregard the values, what matters is to stop the increment of aof
Find all posts by this user
Quote this message in a reply
06-13-2021, 02:00 PM
Post: #44
RE: First python project : HP41 emulator + hints of workflow
(06-13-2021 03:29 AM)gfbci Wrote:  First I would like to thank Olivier and this group for their generously shared knowledge.

Py41.e can work on G1 by editing lines 74-75 values of the py41.py file with something like:

...
aof=100 if k==-1 else 1
if aof>=500:
...

This apparently prevents the simulator from going into sleep mode when a key is released.
Don't trust my explanation, but it works!

Gianfranco

edit: Please disregard the values, what matters is to stop the increment of aof

That's not working for me...
Can I check exactly what you have:
py41.py lines 74-75
And
nut.py line 893 (since Olivier advised changing delay here for G1)
Thanks
Find all posts by this user
Quote this message in a reply
06-13-2021, 02:51 PM
Post: #45
RE: First python project : HP41 emulator + hints of workflow
(06-13-2021 02:00 PM)Stevetuc Wrote:  
(06-13-2021 03:29 AM)gfbci Wrote:  First I would like to thank Olivier and this group for their generously shared knowledge.

Py41.e can work on G1 by editing lines 74-75 values of the py41.py file with something like:

...
aof=100 if k==-1 else 1
if aof>=500:
...

This apparently prevents the simulator from going into sleep mode when a key is released.
Don't trust my explanation, but it works!

Gianfranco

edit: Please disregard the values, what matters is to stop the increment of aof

That's not working for me...
Can I check exactly what you have:
py41.py lines 74-75
And
nut.py line 893 (since Olivier advised changing delay here for G1)
Thanks

Forgive me for the confusion, maybe I wasn't clear in editing the first post. No values need to be changed, just edit:

(74) aof+=300 if k==-1 else 1
to:
(74) aof=300 if k==-1 else 1

The file nut.py has not been touched.
Unfortunately I don't have a Windows machine at the moment to download the changed file, I would gladly send it.

Gianfranco
Find all posts by this user
Quote this message in a reply
06-13-2021, 02:58 PM
Post: #46
RE: First python project : HP41 emulator + hints of workflow
(06-13-2021 02:51 PM)gfbci Wrote:  
(06-13-2021 02:00 PM)Stevetuc Wrote:  That's not working for me...
Can I check exactly what you have:
py41.py lines 74-75
And
nut.py line 893 (since Olivier advised changing delay here for G1)
Thanks

Forgive me for the confusion, maybe I wasn't clear in editing the first post. No values need to be changed, just edit:

(74) aof+=300 if k==-1 else 1
to:
(74) aof=300 if k==-1 else 1

The file nut.py has not been touched.
Unfortunately I don't have a Windows machine at the moment to download the changed file, I would gladly send it.

Gianfranco
Thanks Gianfranco you were clear, but I wanted to double check as unfortunately I tried this and it doesn't work on my G1.. not sure why
Find all posts by this user
Quote this message in a reply
06-13-2021, 08:41 PM
Post: #47
RE: First python project : HP41 emulator + hints of workflow
(06-13-2021 02:58 PM)Stevetuc Wrote:  
(06-13-2021 02:51 PM)gfbci Wrote:  Forgive me for the confusion, maybe I wasn't clear in editing the first post. No values need to be changed, just edit:

(74) aof+=300 if k==-1 else 1
to:
(74) aof=300 if k==-1 else 1

The file nut.py has not been touched.
Unfortunately I don't have a Windows machine at the moment to download the changed file, I would gladly send it.

Gianfranco
Thanks Gianfranco you were clear, but I wanted to double check as unfortunately I tried this and it doesn't work on my G1.. not sure why

The only action I had to take besides the mentioned change was the removal of all downloaded or copied apps, the reset of the native apps and the calculator itself. This was necessary after the installation of fimware 2021 05 05 to normalize its behavior.
Hardware version is "C".
I redid all the indicated procedure starting from scratch: it works!
I hope it helps.

Gianfranco
Find all posts by this user
Quote this message in a reply
06-13-2021, 09:06 PM
Post: #48
RE: First python project : HP41 emulator + hints of workflow
(06-13-2021 08:41 PM)gfbci Wrote:  
(06-13-2021 02:58 PM)Stevetuc Wrote:  Thanks Gianfranco you were clear, but I wanted to double check as unfortunately I tried this and it doesn't work on my G1.. not sure why

The only action I had to take besides the mentioned change was the removal of all downloaded or copied apps, the reset of the native apps and the calculator itself. This was necessary after the installation of fimware 2021 05 05 to normalize its behavior.
Hardware version is "C".
I redid all the indicated procedure starting from scratch: it works!
I hope it helps.

Gianfranco

Thanks. It's now working but a slightly different way. I stopped the program using the "On" key and it invited me to edit py41.py
I found that even though I thought I had sent the edited file previously, line 74 still contained
aof+=300 if ... etc
I removed the + and restarted. Now it works!
Find all posts by this user
Quote this message in a reply
06-24-2021, 10:25 PM
Post: #49
RE: First python project : HP41 emulator + hints of workflow
Is it possible to switch the py41e simulator into radians mode and back to degrees
mode? And of course how would I do it?

Thanks
Find all posts by this user
Quote this message in a reply
08-05-2021, 07:29 PM (This post was last modified: 08-06-2021 06:13 PM by Guenter Schink.)
Post: #50
RE: First python project : HP41 emulator + hints of workflow
Edit:
I did of course forget something IMPORTANT.
in py41.py line 24 or so, after "def loop():" and before "k=0"add proper indented a line "global addonState" I've added that to the description below.
/EDIT


The HP41 emulator certainly is pretty cool. It is however not so easy to remember the assignments of the keys. One solution is to have some notes handy, but that's not really cool.

I tinkered around a little bit to have something available right away, by using the unused estate left and right of the printout. The display of this is toggled on/off by <SHIFT><VIEW>. Have a look at the picture.

In order to make it work you have to manually do some editing yourself. Please use an editor (e.g. notepad++) that is is suitable to edit text files.

1. Unzip the attached AddOn.zip and add the file AddOn.py to your P41e.hpappdir
2. open nuts.py to edit as text file, goto line 918 "def infos(self,c)" add as next line (proper indented) "return" it should look like
PHP Code:
def infos(self,c):
    return
    
col=(0xFF0000,0x00FF00,0x0000FF)[c]
    if 
self.theme==1:
      
hpprime.fillrect(0,0,20,50,13,0xffffff,0xffffff)
    else:
      
hpprime.fillrect(0,0,20,50,13,0x181818,0x181818)
    
hpprime.textout(0,0,20,hex(self.stack[0]),col
3. save nuts.py
4. open Py41.py to edit as text file
5. on top, right after "import hpprime" add a line "import AddOn"
5a.At line 24 or so, after "def loop():" and before "k=0"add proper indented a line "global addonState"
6. at bottom, after "config.init(cpu) add a line "addonState=False"
7. look upwards and find line 68 "elif k==4:" followed by "pass"
6 after that line insert a new line "elif k==9 and display.lE&0x0080:" folowed by "addonState=AddOn.addon(addonState)" followed by "cpu.togshift()" observe the indentation as in the lines already there. That now should look like:
PHP Code:
###           
      
elif k==4:    # Esc key
        
pass
      elif k
==and display.lE&0x0080:
        
addonState=AddOn.addon(addonState)
        
cpu.togShift()
      
elif k==10:   # Cas key 

8. save Py41e.hpappdir and send it to your real and virtual Prime.

I hope I haven't forgotten anything. And remember this help is invoked (toggled) by <SHIFT><VIEW>

I must admit that's not as elegant as the fine art of Olivier, but may be of great help using the 41cx emulator on the Prime.

Olivier, if you read this perhaps it motivates you to include something like this in your distribution.

Günter


Attached File(s) Thumbnail(s)
   

.zip  AddOn.zip (Size: 628 bytes / Downloads: 13)
Find all posts by this user
Quote this message in a reply
08-06-2021, 12:39 AM
Post: #51
RE: First python project : HP41 emulator + hints of workflow
I still need some kind of documentation to use the hp41 emulator.

Does a user really need to do a line by line review of the source code to
use the HP41 emulator to its fullest extent? Should this emulator be
reguarded as a basic rpn toy?

I looked at the key.py file and see a list of binary MOD files with no docs on
how to use them.

A short internal help file may be of help to a small number of potential users.

I would really like to reguard the HP41 emulator as a usefull tool.

Thanks.
Find all posts by this user
Quote this message in a reply
08-06-2021, 02:32 AM
Post: #52
RE: First python project : HP41 emulator + hints of workflow
(08-06-2021 12:39 AM)Liamtoh Resu Wrote:  I looked at the key.py file and see a list of binary MOD files with no docs on
how to use them.

The ROM modules for an HP-41 are generally well-known in the community, and manuals for many of the modules HP sold are included in the MoHPC Document set.

Other manuals can also be found on the 41-specific site:

http://www.ho41.org (substitute a "p" for the "o" - the actual url can't be used here for historical reasons)

And still other modern modules, from Angel Martin, Håkan Thörngren, and a few others can be found on the HP-41CL site here:

http://www.systemyde.com/hp41/documents.html

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
08-06-2021, 09:06 PM
Post: #53
RE: First python project : HP41 emulator + hints of workflow
Thanks for your response and information, rprosperi.

I seem to have problems mapping some of the HP41 emulator keys to the real calculator key functions and vice versa.

For instance I still can't work with radians on the emulator. If you had an example
of accessing one of the modules, I could figure outhow to access the rest.

I will check hout the "ho41,org" site.

I have looked at the docs at "literature.hpcalc.org"

Thanks.
Find all posts by this user
Quote this message in a reply
08-06-2021, 10:35 PM
Post: #54
RE: First python project : HP41 emulator + hints of workflow
(08-06-2021 09:06 PM)Liamtoh Resu Wrote:  I seem to have problems mapping some of the HP41 emulator keys to the real calculator key functions and vice versa.
That's what my extension above is for. Alternatively go back to the download site of P41, at the bottom of that page is a layout that shows the key assignments.

Quote:re: radians - as long as you don't familiarize yourself with the HP41 itself the emulator is almost useless " XEQ RAD"

All the necessary references were given above.
Günter
Find all posts by this user
Quote this message in a reply
08-07-2021, 03:10 AM
Post: #55
RE: First python project : HP41 emulator + hints of workflow
The closest thing to HP41 calculator is the V41 emulator by Warren Furlow etc.

I admit I will have spend more time with documents that are available.

I was hoping someone from the Prime/HP41 communities could give me
some mentoring help besides "read the manual".

I looked at the "help" screen and I could not map it so I could use
the PY41e emulator with the shifted keys.

For a beginning, how do I access " XEQ RAD" with the PY41e emulator.

It would be usefull to post even a little bit of tips to help other users
who want to make dual use of the HP Prime calculator. The number
of current experienced HP41 users are not getting any younger.

Thanks.
Find all posts by this user
Quote this message in a reply
08-07-2021, 03:47 AM (This post was last modified: 08-07-2021 03:49 AM by Liamtoh Resu.)
Post: #56
RE: First python project : HP41 emulator + hints of workflow
Ok Thanks Guenter for the "XEQ RAD" tip.

I used the V41 as a trainer.

So on the Py41e emulator:

[toolbox/Mem] brings up XEQ

[Alpha] puts the Py41e in ALPHA mode.

I typed [R] [A] [D]

I pressed the [Alpha] to take the Py41e emulator out of Alpha mode.

I pressed [ENTER] to put the Py41e into radian mode :)

I tested the Py41e with
3.1415926535 [Enter] 6 /

The Py41e gave the expected 0.5 result.

I was then able to switch the Py41e back to degrees mode.

Thanks again.
Find all posts by this user
Quote this message in a reply
10-07-2021, 11:15 PM (This post was last modified: 10-10-2021 09:06 AM by Peet.)
Post: #57
RE: First python project : HP41 emulator + hints of workflow
Amazing program, makes the Prime an almost perfect HP-41clone. I only miss the BEEP a bit, HP should give the Prime sound output Big Grin

If I see that correctly, to load a .mod or .raw currently only works via the config.py? Does anyone already have an idea for an easy way to load a .raw?

With the current routine, it reloads the .raw(s) every time I start it and fills up the memory.

"if '<PRG>' not in focal.listPrgms(cpu):" seems not to work. Maybe because of an type-error since focal.listPrgms(cpu) isn't a string?

My calculators - former: CBM PR100, HP41CV, HP11C, HP28S - current: HP48G, HP35S, Prime, DM41X, DM42, HP12C
Find all posts by this user
Quote this message in a reply
10-16-2021, 11:31 PM
Post: #58
RE: First python project : HP41 emulator + hints of workflow
(06-11-2021 12:28 AM)rprosperi Wrote:  
(06-11-2021 12:12 AM)Steve Simpkin Wrote:  I would recommend the original HP-41C Owner's Handbook and Programming Guide. It assumes you know nothing about HP calculators and is a great example of the friendly, well written calculator manuals that HP used to write.

https://literature.hpcalc.org/community/...hpg-en.pdf

I endorse Steve's recommendation! The later CX manuals cover more of the functions, but the original 41C manual is in many ways the peak of the great old-school HP

As a fan of HP manuals myself, as I learned a lot of programming on the HP28s thick manuals, I find it really funny on such excerpts:

"Should you see MEMORY LOSTin the display the first time you turn the HP-41C on, do not
worry —it means that power to the continuous memory of the calculator has been inter-
rupted at some time. Merely press (5 (the correction key) to clearthe error, then continue.
When power to continuous memory is interrupted, all information you placed into the
HP-41C is lost."

Yeah, do not worry. Everything you programmed and your data is gone forever if you did not export it someway Smile

No need to say I'm reading hp41c manual for the first time, I never had the chance to own this beast.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 2 Guest(s)