HP Forums
Yet another HP simulator (using C + X11) - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: Not HP Calculators (/forum-7.html)
+--- Forum: Not quite HP Calculators - but related (/forum-8.html)
+--- Thread: Yet another HP simulator (using C + X11) (/thread-17536.html)

Pages: 1 2


Yet another HP simulator (using C + X11) - Mike T. - 10-01-2021 10:28 PM

Some how I've managed to write a simulator for the HP 35, HP 80, HP 45, HP 70, HP 21, HP 22, HP 25C, HP 27, HP 29C, HP 31E, HP 32E, HP 33C, HP 34C, HP 37E, HP 38C and HP 67 in C using only X11.

For more details see this article, or the source code repository on GitHub.

Many thanks to those whose original works and encouragement have helped me get this far including Jacques LAPORTE, David HICKS, Greg SYDNEY-SMITH, Eric SMITH, and in particular Bernhard EMESE and Tony NIXON.

I can't believe quite how far I've come with their help.

If you get it working on your system please post the details below (OS version, gcc version and architecture).

18 Jan 22 - Edited to update list of models and include link to article on this site.


RE: Yet another HP simulator (using C + X11) - STOX - 10-04-2021 07:30 AM

Great work. Could you give a list of the keyboard shortcuts?


RE: Yet another HP simulator (using C + X11) - Mike T. - 10-04-2021 11:18 AM

(10-04-2021 07:30 AM)STOX Wrote:  Great work. Could you give a list of the keyboard shortcuts?

Most should be 'obvious', but I really should document them in the README!

Look for an update later today (or tomorrow depending on where you are)...

It would be useful to know what version of Linux and gcc you used.


RE: Yet another HP simulator (using C + X11) - vaklaff - 10-04-2021 12:56 PM

(10-04-2021 11:18 AM)Mike T. Wrote:  It would be useful to know what version of Linux and gcc you used.

Looks very nice, Mike!

Compiled and ran in Fedora 34, GCC is "gcc version 11.2.1 20210728 (Red Hat 11.2.1-1) (GCC)". Had to add "-fcommon" to FLAGS in makefile, otherwise quite a few "multiple definition of ..." linker errors popped up. Please try to add "-fno-common" on your machine to see them for yourself. If I understand correctly, GCC defaults to "-fno-common" in the newest versions so you'd probably want to clean up the code and avoid those multiple definitions.

And one runtime nitpick: the programs looks to be consuming 100% of CPU power even when not being used.

Overall it's a great start, I love the looks!


RE: Yet another HP simulator (using C + X11) - Mike T. - 10-04-2021 11:15 PM

(10-04-2021 12:56 PM)vaklaff Wrote:  And one runtime nitpick: the programs looks to be consuming 100% of CPU power even when not being used.

The compiler should detect that you are building on linux and use the usleep() function instead of a generic busy loop.

However, it turns out you also need to add '-std=gnu99' to the compiler flags for this to work. Something else I didn't notice when I upgraded!

I've updated the make file and added in '-fcommon' as well!

(10-04-2021 12:56 PM)vaklaff Wrote:  Overall it's a great start, I love the looks!

So do I, particularly the button animations! :-)


RE: Yet another HP simulator (using C + X11) - agarza - 10-08-2021 01:35 PM

I just tied it on ubuntu.
Works great! Loved the graphics.
May I suggest adding an icon to suggest that the letters are buttons. (ON, OFF, PRGM and RUN buttons).


RE: Yet another HP simulator (using C + X11) - Mike T. - 10-08-2021 09:20 PM

(10-08-2021 01:35 PM)agarza Wrote:  I just tied it on ubuntu.
Works great! Loved the graphics.
May I suggest adding an icon to suggest that the letters are buttons. (ON, OFF, PRGM and RUN buttons).

I quite like the minimal approach, but I know what you mean. I tried out a couple of ideas but I've not come up with anything I like yet.

Do you mind posting the Ubuntu and gcc versions, and the machine type x86, x64, or arm etc?


RE: Yet another HP simulator (using C + X11) - agarza - 10-11-2021 02:52 PM

(10-08-2021 09:20 PM)Mike T. Wrote:  
(10-08-2021 01:35 PM)agarza Wrote:  I just tied it on ubuntu.
Works great! Loved the graphics.
May I suggest adding an icon to suggest that the letters are buttons. (ON, OFF, PRGM and RUN buttons).

I quite like the minimal approach, but I know what you mean. I tried out a couple of ideas but I've not come up with anything I like yet.

Do you mind posting the Ubuntu and gcc versions, and the machine type x86, x64, or arm etc?

Ubuntu desktop v20.04.02 (Focal) AMD64


RE: Yet another HP simulator (using C + X11) - Mike T. - 10-16-2021 04:56 PM

Added continuous memory and HP29C simulation...!


RE: Yet another HP simulator (using C + X11) - Mike T. - 10-18-2021 11:08 PM

I've finally been able to add simulators for the HP31. HP32 and HP33C, which means I've finally completed the goals I set myself when I started this project way back in 2013 (see old article).

In the end I gave up trying to use a decimal arithmetic library and GTK2 and eventually opted for the much more ambitions goal of simulating the actual hardware as it was just too hard to get a modern decimal math library to compile on VMS or Tru64 UNIX (a retro project needs to be properly retro so being able to run the simulator on these platforms was one of my goals).

Fortunately there is a LOT more information available now than when I started and thanks to that and some encouragement I've actually done it. There are a couple issues I need to sort but basically it works!

Hopefully I will be able to add the HP34 to my collection as well, however a bit of a major keyboard/button redesign is needed to accommodate all those labels. I might even be able to add one of the Voyagers like the HP10C, if the processor is not too different - more research needed!

Thanks again to everyone that helped me get this far - I'm still pinching myself.


RE: Yet another HP simulator (using C + X11) - agarza - 10-18-2021 11:48 PM

(10-18-2021 11:08 PM)Mike T. Wrote:  I've finally been able to add simulators for the HP31. HP32 and HP33C, which means I've finally completed the goals I set myself when I started this project way back in 2013 (see old article).

In the end I gave up trying to use a decimal arithmetic library and GTK2 and eventually opted for the much more ambitions goal of simulating the actual hardware as it was just too hard to get a modern decimal math library to compile on VMS or Tru64 UNIX (a retro project needs to be properly retro so being able to run the simulator on these platforms was one of my goals).

Fortunately there is a LOT more information available now than when I started and thanks to that and some encouragement I've actually done it. There are a couple issues I need to sort but basically it works!

Hopefully I will be able to add the HP34 to my collection as well, however a bit of a major keyboard/button redesign is needed to accommodate all those labels. I might even be able to add one of the Voyagers like the HP10C, if the processor is not too different - more research needed!

Thanks again to everyone that helped me get this far - I'm still pinching myself.

Bravo!

Hope you can get the HP34c working. It was my first HP calculator.


RE: Yet another HP simulator (using C + X11) - Mike T. - 11-03-2021 10:54 PM

(10-18-2021 11:48 PM)agarza Wrote:  
(10-18-2021 11:08 PM)Mike T. Wrote:  I've finally been able to add simulators for the HP31. HP32 and HP33C, which means I've finally completed the goals I set myself when I started this project way back in 2013 (see old article).

In the end I gave up trying to use a decimal arithmetic library and GTK2 and eventually opted for the much more ambitions goal of simulating the actual hardware as it was just too hard to get a modern decimal math library to compile on VMS or Tru64 UNIX (a retro project needs to be properly retro so being able to run the simulator on these platforms was one of my goals).

Fortunately there is a LOT more information available now than when I started and thanks to that and some encouragement I've actually done it. There are a couple issues I need to sort but basically it works!

Hopefully I will be able to add the HP34 to my collection as well, however a bit of a major keyboard/button redesign is needed to accommodate all those labels. I might even be able to add one of the Voyagers like the HP10C, if the processor is not too different - more research needed!

Thanks again to everyone that helped me get this far - I'm still pinching myself.

Bravo!

Hope you can get the HP34c working. It was my first HP calculator.

I need to tidy up a few loose ends and may try adding a couple of useful new features (like allowing the size of the window to be changed) first.

The most obvious difficulty with the HP34C is finding enough space for the additional function labels, without changing the existing code too much, so it may take a while sort out but it is on my to do list!


RE: Yet another HP simulator (using C + X11) - Mike T. - 11-26-2021 12:48 AM

(10-18-2021 11:48 PM)agarza Wrote:  Bravo!

Hope you can get the HP34c working. It was my first HP calculator.

You might like the latest screenshot I just added...


RE: Yet another HP simulator (using C + X11) - Mike T. - 11-28-2021 07:24 PM

(10-18-2021 11:48 PM)agarza Wrote:  Hope you can get the HP34c working. It was my first HP calculator.

Needs more testing but I think I've got the HP34C simulation working now. (Solve, register arithmetic, and a short pseudo random number generator program all seem to work).

I'm very pleased to have been able met my stretch target after so long, and I think I can now claim to at least understand the basics of the 'C' language and X11.


RE: Yet another HP simulator (using C + X11) - ijabbott - 11-28-2021 09:33 PM

I must admit, I'm a little curious about the choice of X11 when everyone has been trying to get rid of it for the last decade!


RE: Yet another HP simulator (using C + X11) - Thomas Okken - 11-28-2021 09:43 PM

How is that going, anyway? When I migrated Free42 from GTK 2 to GTK 3, I tested it under Wayland to see how that worked with the Wayland support in GTK 3, and it was usable but glitchy, not really something you'd want to use on a daily basis.

Of course even if and when Wayland ever becomes the default graphics environment on Linux, there will probably still be support for true X clients, just like you can use the Cygwin X server on Windows or XQuartz on the Mac...


RE: Yet another HP simulator (using C + X11) - Mike T. - 11-29-2021 09:33 AM

(11-28-2021 09:33 PM)ijabbott Wrote:  I must admit, I'm a little curious about the choice of X11 when everyone has been trying to get rid of it for the last decade!

One of my goals was to produce an application that was as portable as possible, and even if Wayland had existed when I started I would not have chosen it is as it isn't supported on legacy (non PC) architectures.

X11 applications are not going away and backward compatibility is provided by XWayland so I have no plans to upgrade at the moment!!

That said I did almost give up on trying to get my code to compile using VAXC more then once! However, using a C compiler that old did actually teach me a lot (and not just not to avoid old compilers!) .


RE: Yet another HP simulator (using C + X11) - ijabbott - 12-01-2021 09:48 PM

(11-29-2021 09:33 AM)Mike T. Wrote:  
(11-28-2021 09:33 PM)ijabbott Wrote:  I must admit, I'm a little curious about the choice of X11 when everyone has been trying to get rid of it for the last decade!

One of my goals was to produce an application that was as portable as possible, and even if Wayland had existed when I started I would not have chosen it is as it isn't supported on legacy (non PC) architectures.

Yes, that's a perfectly reasonable reason. I hadn't considered that fans of HP calculators would want to emulate their delights on legacy systems. Smile

Quote:X11 applications are not going away and backward compatibility is provided by XWayland so I have no plans to upgrade at the moment!!

I'm not sure what the best modern cross-platform windowing/widget toolkit is to use. GTK's C interface seems to be trying too hard to be OO, and Qt does not support C. I haven't used any of them in anger though.

Quote:That said I did almost give up on trying to get my code to compile using VAXC more then once! However, using a C compiler that old did actually teach me a lot (and not just not to avoid old compilers!) .

It works the other way too when newer versions of GCC complain about things that seem perfectly reasonable!


RE: Yet another HP simulator (using C + X11) - Thomas Okken - 12-01-2021 11:11 PM

(12-01-2021 09:48 PM)ijabbott Wrote:  I'm not sure what the best modern cross-platform windowing/widget toolkit is to use. GTK's C interface seems to be trying too hard to be OO, and Qt does not support C. I haven't used any of them in anger though.

I haven't used Qt, but GTK isn't bad. It's not particularly elegant, but it gets the job done without the developer having to tie themselves in knots. Coming from Motif, it was positively delightful, and porting Free42 to GTK was one of the easiest ports I've done (the absolute easiest was porting the Windows version to Windows Mobile, but that doesn't really count).

(12-01-2021 09:48 PM)ijabbott Wrote:  It works the other way too when newer versions of GCC complain about things that seem perfectly reasonable!

You can tell a legacy project by the steadily growing list of -Wno-yada-yada-yada options it needs to get the compiler to shut up. Big Grin


RE: Yet another HP simulator (using C + X11) - cdmackay - 12-02-2021 01:07 AM

Very nice, thanks; they look wonderful.

I compiled on Linux Debian unstable, gcc 11.2.0-12, then displayed over X to my Mac laptop, via XQuartz.

It's a shame the kdb shortcuts then don't work. And it's quite small, and can't be enlarged.

But the real problem was that many mouse-clicks on the keys are missed. More than half.

This could well be a fault with XQuartz, of course; although I don't recall seeing it with other apps. But I don't use it all that much.

thanks again.