From: Veli-Pekka Nousiainen on

"John H Meyers" <jhmeyers(a)nomail.invalid> wrote in message
news:op.tlcyrce9nn735j(a)w2kjhm.ia.mum.edu...
> Other tidbits:
>
> :&:0. EVAL TYPE is non-zero in 48 series, zero in 49/50 series
> (this is a historic original "bug"
> which was intentionally never "fixed" in 48 series,
> since it provided a simple way to create "bints")

I forgot that...

> Also, RCLF SIZE 3. > is true for 49/50 series, false for 48 series.

Haa! That I remembered!

> However, what is the goal of knowing what exact model
> a program is running on?

To practice programming skills? :-D

One could also use
BYTES
on commands that have changed their CRC
from 48S-series to 48G-series to 49-series


From: Bruce Horrocks on
TW wrote:

> Ok. Here's mine:
>
> << "Choose Calculator" { { "48S" 0 } { "48G" 1 } { "49G-" 2 } { "49G"
> 3 } { "49G+" 4 } { "50G" } } 1 CHOOSE >>
>
> I think that would work. . . as long as you don't lie. Rules didn't say
> you couldn't have manual entry. ;-)

Dear Mr. Wessman,

You are too clever for your own good. I hereby order Katie to withhold
peanut butter privileges for one week.

;-)


--
Bruce Horrocks
Surrey
England
<firstname>@<surname>.plus.com -- fix the obvious for email
From: GaaK on

Bruce Horrocks wrote:
> GaaK wrote:
>
> > IF LCD-> SIZE NIP #64d == THEN (48Gii or 49G)
> >
> > ... using 1 PVARS (48Gii error - 49G ok)
>
> #64d will only work if the word size is sufficiently large to
> accommodate it. So you would have to save, change and then restore it.
> makes a big difference to the program size. :-(
yes, uhm... replace it:
IF LCD-> BYTES NIP 1098 == THEN (48Gii or 49G)
.... this is ok!

- GaaK -

From: Veli-Pekka Nousiainen on

"Bruce Horrocks" <news(a)horrocks.plus.com> wrote in message
news:4vn30pF1chmumU1(a)mid.individual.net...
> TW wrote:
>
>> Ok. Here's mine:
>>
>> << "Choose Calculator" { { "48S" 0 } { "48G" 1 } { "49G-" 2 } { "49G"
>> 3 } { "49G+" 4 } { "50G" } } 1 CHOOSE >>
>> I think that would work. . . as long as you don't lie. Rules didn't say
>> you couldn't have manual entry. ;-)

And (the unbelievers) schemed and planned, and Allahchemed also,
and the best of Schemers is Allah. S. 3:54

> Dear Mr. Wessman,
> You are too clever for your own good. I hereby order Katie to withhold
> peanut butter privileges for one week.
> ;-)
Yoo bad :-(


From: James M. Prange on
Bruce Horrocks wrote:
> GaaK wrote:
>
>> IF LCD-> SIZE NIP #64d == THEN (48Gii or 49G)
>>
>> ... using 1 PVARS (48Gii error - 49G ok)
>
> #64d will only work if the word size is sufficiently large to
> accommodate it. So you would have to save, change and then restore it.
> makes a big difference to the program size. :-(

A good point, so I added code to my program to force the wordsize.
The code to save and restore it was already present for flag -55,
which I forced for the sake of IFERR. I also made a relatively
minor change that saved 3 bytes elsewhere. Here's the information
about my code as it currently is:

@ Program for determining model.
@ Arguments: None
@ Returns:
@ 0 for 48SX/S
@ 1 for 48GX/G/G+
@ 2. for 49G
@ 3. for 49g+
@ 4. for 48gII
@ 5. for 50g
@ For 49 series, download or enter in exact mode.
@ Results from the BYTES command:
@ 48SX/S:
@ Checksum: # 1C81h
@ Size: 234.5
@ 48GX/G/G+:
@ Checksum: # 8C3Ah
@ Size: 226.5
@ 49 series:
@ Checksum: # 6B95h
@ Size: 203.5
@ Approximate execution times in seconds:
@ Average of 10 trials each model.
@ 48SX: .1961
@ 48GX: .1772
@ 49G (ROM 2.09): .6417
@ 49g+ (ROM 2.09): .1827
@ 48gII (Emulated, ROM 2.09): .3221
@ 50g (Emulated, ROM 2.09): .1416
@ Approximate Time*Bytes values:
@ 48SX: 45.98
@ 48GX: 40.13
@ 49G (ROM 2.09): 130.6
@ 49g+ (ROM 2.09): 37.18
@ 48gII (Emulated, ROM 2.09): 65.54
@ 50g (Emulated, ROM 2.09): 28.81

Note that although which model the code is running on affects the
speed, that's not the whole story; how much code has to be
executed for a particular model also has a big effect on the
execution time. My code detects the models in the order 48SX/S,
48GX/G/G+, 50g, 48gII, 49G, thus the least code is actually
executed for a 48SX/S and the most for a 49G.

Veli-Pekka, should I post my code now?

Actually, I'm a bit disappointed that this mini-challenge doesn't
seem to have generated much interest.

Surely being able to determine which hardware a program is running
on can be useful, and this demonstrates that the current models
can be distinguished even by UserRPL source code. One could branch
to run different code depending on the model, or simply error out
with a user-defined error string like "wrong model" if it's run on
a model that it's not intended for.

The differences between the 48SX and 48S, and among the 48GX, 48G,
and 48G+, are a matter of available memory, which can be
determined by MEM, and sometimes of available free ports, which
can be determined by PVARS. Except for the 48SX/S, which ROM
version/revision a model has can be determined with the VERSION
command.

As far as I know, the easiest way to determine the ROM version on
the 48SX/S is \<< #30794h SYSEVAL \>> (SysRPL VERSTRING command),
which returns a string of the form "HPHP48-x", where x is the ROM
version letter from A through J on a 48SX/S or K through R on a
48GX/G/G+ (but note that some versions were never released).

*Caution*, note that the entry point for VERSTRING on a 49 series
is #2F389 instead, but it seems somewhat less useful for
determining the ROM there, returning a string of the form
"HPHP49-x", where x represents C for "Commercial" (official HP
releases), B for "Beta" releases, G for Bernard's CAS release (at
least the current one), or whatever else a developer may have
chosen for a release.

--
Regards,
James