FB II Compiler

PG PRO

Debugging

Memory

System

Mathematics

Resources

Disk I/O

Windows

Controls

Menus

Mouse

Keyboard

Text

Fonts

Drawing

Sound

Clipboard

Printing

Communication

ASM

Made with FB

SYSTEM

Detect if the CPU can idle


It depends on the fact that powerbooks are able to cycle down their CPU speed, which as far as I know only power books can do.
'Gestalt FN from ArielMars@aol.com

LOCAL MODE
DIM selector&, gestaltResponse&
LOCAL FN scrollGestaltFN(selector&, gestaltResponse&)
  `  subq.l #2,sp
  ` move.l  ^selector&,-(sp)
  ` move.l  ^gestaltResponse&,-(sp)
  MACHLG &225F
  MACHLG &201F
  MACHLG &A1AD
  MACHLG &2288
  MACHLG &3E80
  ` move.w  (sp)+,D0
  ` ext.l   D0
END FN

isPowerBook% = _false
DIM gestaltResponse&
LONG IF FN scrollGestaltFN(_Gestaltpowermgrattr, @gestaltResponse&) = _noErr
  LONG IF (gestaltResponse& AND _GestaltPmgrExists) = _false
    REM Power manager Exists
    LONG IF (gestaltResponse& AND _GestaltPmgrCPUidle)  REM The CPU can idle
        isPowerBook% = _true
    END IF
  END IF
END IF
Pete