Post Reply 
Emulators / Simulators available as a library?
06-06-2019, 03:08 AM
Post: #1
Emulators / Simulators available as a library?
Are any of the HP calculator emulators/simulators available in C or C++ library form - so that the core functionality (minus UI) could be easily invoked from another application?

I am experimenting with a general purpose system for program synthesis from examples and was thinking it would be fun to experiment with automatically generating programs for classic HP calculators (since I'm a fan). To minimize the work on my part (because I am lazy and have a real job) the easiest path to such an experiment would be to find an HP calculator "vm" in library form that I could adapt to provide the set of available operators to the program synthesis system.

Thanks in advance for any useful pointers.
Find all posts by this user
Quote this message in a reply
06-06-2019, 07:23 PM
Post: #2
RE: Emulators / Simulators available as a library?
Maybe you could readapt the free42 and newRPL code. I am not sure they are meant as library so it is not a free lunch.

It i unlikely that you can access the code from the emulate ROM files as library, unless you go rewrite the emulator as interface for another program. Again, no free lunch.

Wikis are great, Contribute :)
Find all posts by this user
Quote this message in a reply
06-06-2019, 08:09 PM
Post: #3
RE: Emulators / Simulators available as a library?
(06-06-2019 07:23 PM)pier4r Wrote:  Maybe you could readapt the free42 and newRPL code. I am not sure they are meant as library so it is not a free lunch.

Free42 isn't meant as a library, but all the "outside world" stuff goes through a bunch of "shell" functions implemented by whatever interface is being used.

— Ian Abbott
Find all posts by this user
Quote this message in a reply
06-30-2019, 06:43 PM
Post: #4
RE: Emulators / Simulators available as a library?
The TRURL project contains a free RPN Engine. It is for Object Pascal rather than C/C++ and it is an independent implementation from scratch not intending to copy HP calculators, but it may be interesting anyway:

*http://trurl.sf.net
*https://sourceforge.net/projects/trurl/
Visit this user's website Find all posts by this user
Quote this message in a reply
07-01-2019, 10:27 PM
Post: #5
RE: Emulators / Simulators available as a library?
(06-06-2019 03:08 AM)obrash Wrote:  Are any of the HP calculator emulators/simulators available in C or C++ library form - so that the core functionality (minus UI) could be easily invoked from another application?

I am experimenting with a general purpose system for program synthesis from examples and was thinking it would be fun to experiment with automatically generating programs for classic HP calculators (since I'm a fan). To minimize the work on my part (because I am lazy and have a real job) the easiest path to such an experiment would be to find an HP calculator "vm" in library form that I could adapt to provide the set of available operators to the program synthesis system.

Thanks in advance for any useful pointers.

newRPL is not exactly available as a library you can link to, but the code can be included directly in your application (it's plain C, and compiles fine with either gcc or clang), and yes, the GUI can be completely disregarded (though much of the code needs to be included due to some commands interacting with it, like WAIT, COPYCLIP, etc.). But other than taking space it doesn't affect functionality, just provide some memory for the GUI and forget it's even there.
As a matter of fact, newRPL uses the exact same codebase for the standalone newRPL-comp compiler that is a command line tool using the RPL compiler from C, no GUI there. If you start from that example you'll get to run RPL code in no time.
Once you get it to compile, using newRPL is quite easy:
  1. Call rplInit() to setup the newRPL execution environment (only once at the beginning).
  2. Compile some text with rplCompile() to get a pointer to an RPL object.
  3. Pass the object you received to rplSetEntryPoint(), and then call rplRun().
  4. Once rplRun returns, you have either the results on the data stack or an error condition.
  5. Repeat 2, 3 and 4 until you get tired.
  6. Extract results from the stack using rplPeekData() or rplPopData()/rplPushData() to take objects from the data stack. Once you have an object, call rplDecompile() to get its text representation.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: