Amiga.org
Amiga computer related discussion => Amiga Software Issues and Discussion => Topic started by: AmiDude on November 06, 2006, 12:26:08 PM
-
I'm doing some Amos programming and having fun with it!
The following code is for detecting and printing the type of CPU/FPU on your Amiga's system:
CPU=Peek(Leek(4)+$129)
CPU_68010=Btst(0,CPU)
CPU_68020=Btst(1,CPU)
CPU_68030=Btst(2,CPU)
CPU_68040=Btst(3,CPU)
CPU_68060=Btst(7,CPU)
CP$="68000"
If CPU_68010
CP$="68010"
End If
If CPU_68020
CP$="68020"
End If
If CPU_68030
CP$="68030"
End If
If CPU_68040
CP$="68040"
End If
If CPU_68060
CP$="68060"
End If
K68881=Btst(4,CPU)
K68882=Btst(5,CPU)
K_W=Btst(6,CPU)
FP$=" "
If CPU_68040
If K_W
FP$="68040"
End If
End If
If CPU_68060
If K_W
FP$="68060"
End If
End If
If K68881
FP$="68881"
End If
If K68882
FP$="68882"
End If
Print CP$
Print FP$
What I'd like to know is what the code/procedure is for printing out the CPU's/FPU's speed in Mhz (if it's possible with Amos programming). Does anyone know and
want to share it?
:idea:
-
No idea about AMOS, but a common trick is to simply time how long it takes to perform a loop of NOP instructions. Each CPU has different timings for NOP (and the loop timing itself will differ from CPU to CPU but in a quantifiable way) and use that to estimate the speed. You'll have to study the actual performance timings for each CPU to know exactly how long your loop ought to take and time a sufficiently large number of iterations.
I'm sure there are better ways.
-
what the code/procedure is for printing out the CPU's/FPU's speed in Mhz (if it's possible with Amos programming)
There is no such procedure, nor is it possible to measure the system speed even remotely reliably with AMOS itself.
WhichAmiga.lha (http://www.iki.fi/sintonen/sw/WhichAmiga.lha) has some code that measures CPU frequency, it should be reliable on 020, 030, 040 and 060 at least. On 68000 and 68010 other parts of the system can slow down the execution of the timing loop, and thus give unreliable results.
-
@Piru
On 68000 and 68010 other parts of the system can slow down the execution of the timing loop, and thus give unreliable results.
Let me guess - lack of instruction cache and subsequent dependency on accessing the memory bus to read the instructions, right?
-
OK, thanks for your responce guys. I think I'm
gonna concentrate on other system related
procedures then.
:-)