Best way to detect CPU program is running on?

Page 2/2
1 |

By Grauw

Ascended (8456)

Grauw's picture

03-09-2018, 15:45

Big smile

By gdx

Prophet (3037)

gdx's picture

03-09-2018, 15:53

luppie wrote:

Because he want's to the detect the CPU type, not the CPU speed. Since there is 3.57Mhz - 6 Mhz - 7Mhz and in case of Gr8bit the speed can be 4 ~ 20 Mhz. The loop counter doesn't say anything about the CPU type only about it's speed.

Yes, CPU speed gives approximately the CPU type but it work and I don't know any alternate method.

luppie wrote:

You’re doing the wrong kind of optimisation.

No because I haven't used these methods yet. Wink
More seriously, the standard method is probably the best for the majority of cases but the method with the undocumented instruction deserves to be known. It can be useful.

By Grauw

Ascended (8456)

Grauw's picture

03-09-2018, 17:13

gdx wrote:

More seriously, the standard method is probably the best for the majority of cases but the method with the undocumented instruction deserves to be known. It can be useful.

If you put it that way I can only agree Smile.

As for the Panasonic MSX2+ turbo (not sure if the OP cares about that, but while we're on the topic), perhaps the extended I/O register can be read to determine the mode...

By luppie

Paladin (854)

luppie's picture

03-09-2018, 19:52

gdx wrote:
luppie wrote:

You’re doing the wrong kind of optimisation.

I never wrote that oO

By PingPong

Prophet (3448)

PingPong's picture

03-09-2018, 21:54

what about trying to execute a MUL instruction? if on r800 the result will be what one expect , otherwise not.....

By RetroTechie

Paragon (1563)

RetroTechie's picture

07-09-2018, 00:03

That would only tell you it's a MUL capable cpu, not at what speed it's running which might be the thing you're more interested in. For example some Z180 based MSX clone or FPGA implementation might pass that MUL test, but not support anything else the R800 or Turbo R might.

General rule: test for the feature(s) you need. If it's fast multiplication you need, test if R800 and MUL instruction works. If it's just a fast Z80 you want, maybe try some kind of loop counter to see how much work can be done in an interrupt cycle.

By PingPong

Prophet (3448)

PingPong's picture

07-09-2018, 20:33

RetroTechie wrote:

That would only tell you it's a MUL capable cpu, not at what speed it's running which might be the thing you're more interested in. For example some Z180 based MSX clone or FPGA implementation might pass that MUL test, but not support anything else the R800 or Turbo R might.

In that case, the rule is the same. probe for others r800 features to identify the CPU.
And even if all test pass and you are on a clone it simply does not matter: If a device act as R800 in all relevant aspects, i does not matter at all if it's the original or a FPA clone. ;-)

Quote:

try some kind of loop counter to see how much work can be done in an interrupt cycle.

this does not identify the cpu and is worse than probing. I can have a z80 cpu clocked @ 100Mhz working faster than R800. But if the problem is to identify the CPU type, it's only a z80 no matter on how can fast can compute.

Page 2/2
1 |