// Get information about the Windows system and memory configuration
// Bit 1: Set if running in protected mode
// Bit 2: Set if 286 CPU
// Bit 3: Set if 386 CPU
// Bit 4: Set if 486 CPU
// Bit 6: Set if running in enhanced mode
// Bit 11: Set if system has an Intel math coprocessor
// Bit 12: Set if Windows is running on a system with paged memory

// Windows API function call
declare pfunc GetWinFlags returning long in dll kernel.exe

// Get system information
lRetVal = GetWinFlags()

// Split long return value into 2 bytes, in order to use TESTAND() function
nLoByte = int(lRetVal % 256)
nHiByte = int(lRetVal / 256)

if (testand(nLoByte, 8))
	? '486 CPU'
elseif (testand(nLoByte, 4))
	? '386 CPU'
elseif (testand(nLoByte, 2))
	? '286 CPU'
endif

if (testand(nLoByte, 1))
	? 'Protected mode'
endif

if (testand(nLoByte, 32))
	? 'Enhanced mode'
endif

if (testand(nHiByte, 4))
	? 'Math coprocessor present'
endif

if (testand(nHiByte, 8))
	? 'Paged memory used'
endif

wait 