HP Forums
Emu48 detection - 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: Emu48 detection (/thread-20923.html)



Emu48 detection - Marco Polo - 11-29-2023 02:16 PM

I would like to customize my STARTUP in order to properly set TOFF variable.
Is there any way for a program in HP48/50 to detect if it is running in a real calculator or in EMU48?

Thank you


RE: Emu48 detection - Eric Rechlin - 11-29-2023 03:15 PM

A couple ideas:

1. On the 49/50 you can check the serial number. If it's bogus (something like "COYWWXXXXX") it's probably running in an emulator. You can use #10001Dh LIBEVAL to get the serial information.

2. You could check how long a test command takes to run (with TEVAL on the 49/50 or by manually calculating the time elapsed on a 48). If it's fast, it must be on an emulator. If it's slow, it's either on a real calculator or an emulator running at "real speed".


RE: Emu48 detection - DavidM - 11-29-2023 04:08 PM

(11-29-2023 03:15 PM)Eric Rechlin Wrote:  1. On the 49/50 you can check the serial number. If it's bogus (something like "COYWWXXXXX") it's probably running in an emulator. You can use #10001dh LIBEVAL to get the serial information.

I previously used this method for a similar purpose (setting TOFF, but also my preferred contrast setting). Unfortunately, it stopped working when iHP48 was introduced. Trying to get the serial number using these means with that app on my iPhone causes the program to crash or lock up when I try it. Yes, I reported it to the developer many months ago, but it's never been fixed.

(11-29-2023 03:15 PM)Eric Rechlin Wrote:  2. You could check how long a test command takes to run (with TEVAL on the 49/50 or by manually calculating the time elapsed on a 48). If it's fast, it must be on an emulator. If it's slow, it's either on a real calculator or an emulator running at "real speed".

I remember trying to time the "SLOW" command (SysRPL) along these lines, but found the results varied quite a bit under different conditions. Enough so that it didn't seem feasible to use that command. There's almost certainly better commands to use, though, but I never got back to that particular experiment to come up with a solution. I'm sure there's a reliable way to do this.

Another possibility might be to use a known Saturn opcode that behaves differently on Emu48 than on real hardware -- that would potentially be much faster and also more reliable. Anyone know of a Saturn opcode that behaves differently in the Emu48 environment than on real hardware? This would be similar to how the 50g ROM determines which hardware platform it's running on.


RE: Emu48 detection - DavidM - 11-29-2023 05:00 PM

(11-29-2023 04:08 PM)DavidM Wrote:  Another possibility might be to use a known Saturn opcode that behaves differently on Emu48 than on real hardware -- that would potentially be much faster and also more reliable. Anyone know of a Saturn opcode that behaves differently in the Emu48 environment than on real hardware? This would be similar to how the 50g ROM determines which hardware platform it's running on.

The ML entry point for clkspd might hold some promise. Interestingly, its result is in the same range regardless of the Emu48 "Authentic Calculator Speed" setting. I've only tested that on a single emulated system, though. clkspd's result seems to be fairly consistent in repeated invocations as well.

More to come...


RE: Emu48 detection - DavidM - 11-30-2023 07:02 PM

(11-29-2023 05:00 PM)DavidM Wrote:  The ML entry point for clkspd might hold some promise.

Everything continued to be encouraging as I checked a 50g, 49g+, 49G, 48GX, 48g, 48sx, and two separate Windows-based computers set up with Emu48.

Then I tried iHP48 on my iPhone. It seems that the result given by clkspd with that configuration is meaningless, or perhaps simply too unstable to discern anything useful.

Back to the drawing board.


RE: Emu48 detection - Marco Polo - 12-01-2023 06:17 AM

(11-29-2023 03:15 PM)Eric Rechlin Wrote:  A couple ideas:

1. On the 49/50 you can check the serial number. If it's bogus (something like "COYWWXXXXX") it's probably running in an emulator. You can use #10001Dh LIBEVAL to get the serial information.

2. You could check how long a test command takes to run (with TEVAL on the 49/50 or by manually calculating the time elapsed on a 48). If it's fast, it must be on an emulator. If it's slow, it's either on a real calculator or an emulator running at "real speed".
I tried (and definitively used) method 1. It works perfectly for my purpose (TOFF set at restart and selective planned program execution (clock adjust) by alarms)
Thank you