Welcome, Guest. Please login or register.

Author Topic: What's the Amos CPU's Mhz procedure?  (Read 1720 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline AmiDudeTopic starter

  • Hero Member
  • *****
  • Join Date: Oct 2005
  • Posts: 903
    • Show only replies by AmiDude
What's the Amos CPU's Mhz procedure?
« 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:
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16881
  • Country: gb
  • Thanked: 5 times
    • Show only replies by Karlos
Re: What's the Amos CPU's Mhz procedure?
« Reply #1 on: November 06, 2006, 12:40:17 PM »
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.
int p; // A
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show only replies by Piru
    • http://www.iki.fi/sintonen/
Re: What's the Amos CPU's Mhz procedure?
« Reply #2 on: November 06, 2006, 01:40:32 PM »
Quote
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 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.
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16881
  • Country: gb
  • Thanked: 5 times
    • Show only replies by Karlos
Re: What's the Amos CPU's Mhz procedure?
« Reply #3 on: November 06, 2006, 02:55:40 PM »
@Piru

Quote
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?
int p; // A
 

Offline AmiDudeTopic starter

  • Hero Member
  • *****
  • Join Date: Oct 2005
  • Posts: 903
    • Show only replies by AmiDude
Re: What's the Amos CPU's Mhz procedure?
« Reply #4 on: November 07, 2006, 10:05:52 AM »
OK, thanks for your responce guys. I think I'm
gonna concentrate on other system related
procedures then.
 :-)