Previous: Other Asm Functionality, Up: Inline Assembler

D.7 A Complete Example

This section contains a complete program illustrating a realistic usage of GNAT's Inline Assembler capabilities. It comprises a main procedure Check_CPU and a package Intel_CPU. The package declares a collection of functions that detect the properties of the 32-bit x86 processor that is running the program. The main procedure invokes these functions and displays the information.

The Intel_CPU package could be enhanced by adding functions to detect the type of x386 co-processor, the processor caching options and special operations such as the SIMD extensions.

Although the Intel_CPU package has been written for 32-bit Intel compatible CPUs, it is OS neutral. It has been tested on DOS, Windows/NT and GNU/Linux.