X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Frbench.c;h=8836f672b66be96a46644f2c38a4c6ade46b6731;hb=HEAD;hp=3d8eace66f9005185c98cec65b701532e45853fa;hpb=21d237fda9d909bb9588d877f244431989917af7;p=retrobench diff --git a/src/rbench.c b/src/rbench.c index 3d8eace..8836f67 100644 --- a/src/rbench.c +++ b/src/rbench.c @@ -1,9 +1,9 @@ #include #include -#include #include #include "rbench.h" #include "treestor.h" +#include "util.h" #define DEF_WIDTH 640 #define DEF_HEIGHT 480 @@ -19,8 +19,47 @@ unsigned int fb_rmask, fb_gmask, fb_bmask; void *framebuf; unsigned int time_msec; +static const char *cpufeat[] = { + "fpu", "vme", "dbgext", "pse", "tsc", "msr", "pae", "mce", "cx8", "apic", 0, + "sep", "mtrr", "pge", "mca", "cmov", "pat", "pse36", "psn", "clf", 0, + "dtes", "acpi", "mmx", "fxsr", "sse", "sse2", "ss", "htt", "tm1", "ia64", "pbe" +}; + +static const char *cpufeat2[] = { + "sse3", "pclmul", "dtes64", "monitor", "dscpl", "vmx", "smx", "est", "tm2", + "ssse3", "cid", 0, "fma", "cx16", "etprd", "pdcm", 0, "pcide", "dca", "sse4.1", + "sse4.2", "x2apic", "movbe", "popcnt", 0, "aes", "xsave", "osxsave", "avx" +}; + int init(void) { + int i; + struct cpuid_info cpu; + + if(read_cpuid(&cpu) != -1) { + printf("CPUID information:\n"); + printf(" cpuid blocks: %d\n", (int)cpu.maxidx); + printf(" CPU vendor: "); + for(i=0; i<12; i++) { + putchar(cpu.vendor[i]); + } + putchar('\n'); + printf(" stepping: %u, model: %u, family: %u\n", CPUID_STEPPING(cpu.id), + CPUID_MODEL(cpu.id), CPUID_FAMILY(cpu.id)); + printf(" features:"); + for(i=0; i> 2; \ + (g) = xor >> 1; \ + (b) = xor; \ + } while(0) +#else +#define XORRGB(x, y, dx, dy, zoom, r, g, b) \ do { \ - int xor = (((x) - fb_width/2) * (zoom) >> 10) ^ (((y) - fb_height/2) * (zoom) >> 10); \ + int xor = ((((x) - fb_width/2) * (zoom) >> 16) + (dx)) ^ ((((y) - fb_height/2) * (zoom) >> 16) + (dy)); \ (r) = xor >> 2; \ (g) = xor >> 1; \ (b) = xor; \ } while(0) +#endif void redraw(void) { - int i, j, r, g, b, xoffs, yoffs, zoom; + int i, j, r, g, b, xoffs, yoffs; +#ifndef NOZOOM + int zoom; +#endif unsigned char *fbptr; uint16_t *fbptr16; uint32_t *fbptr32; - float t = (float)time_msec / 1000.0f; - xoffs = cos(t * 0.5f) * DEF_WIDTH * 2; - yoffs = sin(t) * DEF_HEIGHT; - zoom = (sin(t * 0.75f) * 0.5f + 1.0f) * 1024.0f; + xoffs = COS(time_msec >> 2) * fb_width >> 14; + yoffs = SIN(time_msec >> 1) * fb_height >> 15; +#ifndef NOZOOM + zoom = (SIN(time_msec >> 3) << 1) + 0x18000; +#endif switch(fb_bpp) { case 15: @@ -57,7 +110,7 @@ void redraw(void) fbptr16 = framebuf; for(i=0; i> 3) << fb_rshift) & fb_rmask) | (((g >> 2) << fb_gshift) & fb_gmask) | (((b >> 3) << fb_bshift) & fb_bmask); @@ -70,7 +123,7 @@ void redraw(void) fbptr = framebuf; for(i=0; i