Jump to content
  • Advertisement
Sign in to follow this  

Allegro cpu problem

This topic is 3713 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I wondering if anyone else using Allegro can help me with my program here:
#define ALLEGRO_USE_CONSOLE /* needed to run console projects with allegro! */
#include <allegro.h>
#include <stdio.h>

char * OSName(int number)
    switch (number)
        case OSTYPE_UNKNOWN: return "Unknown or MS-DOS";
        case OSTYPE_WIN3:    return "Windows";
        case OSTYPE_WIN95:   return "Windows 95";
        case OSTYPE_WIN98:   return "Windows 98";
        case OSTYPE_WINME:   return "Windows ME";
        case OSTYPE_WINNT:   return "Windows NT";
        case OSTYPE_WIN2000: return "Windows 2000";
        case OSTYPE_WINXP:   return "Windows XP";
		case OSTYPE_WIN2003: return "Windows 2003";
		case OSTYPE_WINVISTA:return "Windows Vista";
        case OSTYPE_OS2:     return "OS/2";
        case OSTYPE_WARP:    return "OS/2 Warp 3";
        case OSTYPE_DOSEMU:  return "Linux DOSEMU";
        case OSTYPE_OPENDOS: return "Caldera OpenDOS";
        case OSTYPE_LINUX:   return "Linux";
        case OSTYPE_FREEBSD: return "FreeBSD";
        case OSTYPE_QNX:     return "QNX";
        case OSTYPE_UNIX:    return "Unix variant";
        case OSTYPE_BEOS:    return "BeOS";
        case OSTYPE_MACOS:   return "MacOS";
    return "";

char * YesNo(int number)
    if (number==0)
        return "No";
        return "Yes";

int main()
    //initialize Allegro
    //display version info
	printf("Allegro version    = %s\n", allegro_id);
	printf("Operating system   = %s\n", OSName(os_type));
	printf("OS version         = %i.%i\n", os_version, os_revision);
	printf("Multitasking       = %s\n", YesNo(os_multitasking)); 
	//display system info
    int width, height;
    if (get_desktop_resolution(&width, &height) != 0)
        printf("Error reading desktop resolution\n");
	printf("Desktop resolution = %i x %i\n", width, height);
    printf("Color depth        = %i bits\n", desktop_color_depth());
	//check_cpu(); not necessary since called by allegro_init()
    printf("Processor vendor   = %s\n", cpu_vendor);
    printf("Processor family   = %i\n", cpu_family);
    printf("Processor model    = %i\n", cpu_model);
    //display processor capabilities
    int caps = cpu_capabilities;
    printf("Processor ID       = %s\n", 
        YesNo((caps & CPU_ID)==CPU_ID));
    printf("x87 FPU            = %s\n", 
        YesNo((caps & CPU_FPU)==CPU_FPU));
    printf("MMX                = %s\n", 
        YesNo((caps & CPU_MMX)==CPU_MMX));
    printf("MMX+               = %s\n", 
        YesNo((caps & CPU_MMXPLUS)==CPU_MMXPLUS));
    printf("SSE                = %s\n", 
        YesNo((caps & CPU_SSE)==CPU_SSE));
    printf("SSE2               = %s\n", 
        YesNo((caps & CPU_SSE2)==CPU_SSE2));
    printf("SSE3               = %s\n", 
        YesNo((caps & CPU_SSE3)==CPU_SSE3));
    printf("3DNOW              = %s\n", 
        YesNo((caps & CPU_3DNOW)==CPU_3DNOW));
    printf("Enhanced 3DNOW     = %s\n", 
        YesNo((caps & CPU_ENH3DNOW)==CPU_ENH3DNOW));

if ((cpu_capabilities & (CPU_FPU | CPU_MMX)) ==
          (CPU_FPU | CPU_MMX)) {
         printf("CPU has both an FPU and MMX instructions!\n");

	printf("\nPress any key...\n");
	return 0;     

It actually compiles and runs but everything after the processor vendor line returns 0 on my system. I also ran it on virtualpc and the processor is also returned unknown so everything from then on returns 0 or no. Compiled with a 4.0 version of Allegro is seemed to work fine. Is there something that changed from 4.0 to 4.2.2 ,which I'm using now, that is causing my problem?

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!