|
|
1.1.1.2 ! root 1: /* 1.1 root 2: * UAE - The Un*x Amiga Emulator 1.1.1.2 ! root 3: * ! 4: * cpp magic ! 5: * ! 6: * Copyright 1995, 1996 Bernd Schmidt, Ed Hanway 1.1 root 7: */ 8: 1.1.1.2 ! root 9: typedef enum { KBD_LANG_US, KBD_LANG_DE, KBD_LANG_SE, KBD_LANG_FR, KBD_LANG_IT } KbdLang; 1.1 root 10: 11: extern int framerate; 1.1.1.2 ! root 12: extern int produce_sound; ! 13: extern int dont_want_aspect; ! 14: extern int use_fast_draw; ! 15: extern int use_debugger; ! 16: extern int use_slow_mem; ! 17: extern int use_fast_mem; ! 18: extern int use_gfxlib; ! 19: extern int use_xhair; ! 20: extern int use_lores; ! 21: extern int automount_uaedev; ! 22: extern int fake_joystick; 1.1 root 23: extern KbdLang keyboard_lang; 1.1.1.2 ! root 24: extern int color_mode; ! 25: extern int screen_res; 1.1 root 26: 1.1.1.2 ! root 27: extern char df0[], df1[], df2[], df3[], romfile[], prtname[]; 1.1 root 28: 1.1.1.2 ! root 29: #ifndef __unix ! 30: extern void parse_cmdline(int argc, char **argv); 1.1 root 31: #endif 32: 1.1.1.2 ! root 33: #ifdef __mac__ ! 34: /* Apparently, no memcpy :-/ */ ! 35: static __inline__ void *memcpy(void *to, void *from, int size) ! 36: { ! 37: BlockMove(from, to, size); ! 38: } 1.1 root 39: #endif 40: 1.1.1.2 ! root 41: /* strdup() may be non-portable if you have a weird system */ ! 42: static char *my_strdup(const char*s) ! 43: { ! 44: /* The casts to char * are there to shut up the compiler on HPUX */ ! 45: char *x = (char*)malloc(strlen((char *)s) + 1); ! 46: strcpy(x, (char *)s); ! 47: return x; ! 48: } 1.1 root 49: 1.1.1.2 ! root 50: #undef REGPARAM ! 51: #define fast_memcmp memcmp ! 52: #define memcmpy generic_memcmpy 1.1 root 53: 1.1.1.2 ! root 54: static __inline__ int generic_memcmpy(void *foo, const void *bar, int len) ! 55: { ! 56: int res = memcmp(foo, bar, len); ! 57: if (res) ! 58: memcpy(foo, bar, len); ! 59: return res; ! 60: } 1.1 root 61: 1.1.1.2 ! root 62: #if defined(__GNUC_MINOR__) 1.1 root 63: 1.1.1.2 ! root 64: #ifdef __i386__ 1.1 root 65: 1.1.1.2 ! root 66: #define INTEL_FLAG_OPT 1.1 root 67: 1.1.1.2 ! root 68: #undef fast_memcmp ! 69: #undef memcmpy 1.1 root 70: 1.1.1.2 ! root 71: static __inline__ int fast_memcmp(const void *foo, const void *bar, int len) ! 72: { ! 73: int differs, baz; ! 74: __asm__ __volatile__ ("subl $4, %2\n" ! 75: "jc 2f\n" ! 76: "1:\n" ! 77: "movl (%0),%%ebx\n" ! 78: "cmpl (%1),%%ebx\n" ! 79: "jne 5f\n" ! 80: "addl $4, %0\n" ! 81: "addl $4, %1\n" ! 82: "subl $4, %2\n" ! 83: "jnc 1b\n" ! 84: "2:\n" ! 85: "addl $4, %2\n" ! 86: "jz 4f\n" ! 87: "3:\n" ! 88: "movb (%0),%%bl\n" ! 89: "cmpb (%1),%%bl\n" ! 90: "jne 5f\n" ! 91: "incl %0\n" ! 92: "incl %1\n" ! 93: "decl %2\n" ! 94: "jnz 3b\n" ! 95: "4:\n" ! 96: "movl $0, %3\n" ! 97: "jmp 6f\n" ! 98: "5:\n" ! 99: "movl $1, %3\n" ! 100: "6:\n" ! 101: : "=&r" (foo), "=&r" (bar), "=&rm" (len), "=rm" (differs), ! 102: "=&b" (baz) ! 103: : "0" (foo), "1" (bar), "2" (len), "3" (baz) : "cc"); ! 104: return differs; ! 105: } 1.1 root 106: 1.1.1.2 ! root 107: static __inline__ int memcmpy(void *foo, const void *bar, int len) ! 108: { ! 109: int differs, baz = 0, uupzuq = 0; ! 110: /* printf("%p %p %d\n", foo, bar, len);*/ ! 111: __asm__ __volatile__ ("subl %1, %2\n" ! 112: "movl $0, %0\n" ! 113: "subl $16, %3\n" ! 114: "jc 7f\n" ! 115: ! 116: "8:\n" ! 117: "movl (%1),%%ecx\n" ! 118: "movl (%2,%1),%%ebx\n" ! 119: "xorl %%ebx, %%ecx\n" ! 120: "movl %%ebx, (%1)\n" ! 121: "orl %%ecx, %0\n" ! 122: ! 123: "movl 4(%2,%1),%%ebx\n" ! 124: "movl 4(%1),%%ecx\n" ! 125: "xorl %%ebx, %%ecx\n" ! 126: "movl %%ebx, 4(%1)\n" ! 127: "orl %%ecx, %0\n" ! 128: ! 129: "movl 8(%2,%1),%%ebx\n" ! 130: "movl 8(%1),%%ecx\n" ! 131: "xorl %%ebx, %%ecx\n" ! 132: "movl %%ebx, 8(%1)\n" ! 133: "orl %%ecx, %0\n" ! 134: ! 135: "movl 12(%2,%1),%%ebx\n" ! 136: "movl 12(%1),%%ecx\n" ! 137: "xorl %%ebx, %%ecx\n" ! 138: "movl %%ebx, 12(%1)\n" ! 139: "orl %%ecx, %0\n" ! 140: ! 141: "addl $16, %1\n" ! 142: "subl $16, %3\n" ! 143: "jnc 8b\n" ! 144: ! 145: "7:\n" ! 146: "addl $16, %3\n" ! 147: "subl $4, %3\n" ! 148: "jc 2f\n" ! 149: ! 150: "1:\n" ! 151: "movl (%2,%1),%%ebx\n" ! 152: "movl (%1),%%ecx\n" ! 153: "xorl %%ebx, %%ecx\n" ! 154: "movl %%ebx, (%1)\n" ! 155: "orl %%ecx, %0\n" ! 156: "addl $4, %1\n" ! 157: "subl $4, %3\n" ! 158: "jnc 1b\n" ! 159: ! 160: "2:\n" ! 161: "addl $4, %3\n" ! 162: "jz 6f\n" ! 163: "xorl %%ecx, %%ecx\n" ! 164: ! 165: "3:\n" ! 166: "movb (%2,%1),%%bl\n" ! 167: "movb (%1),%%cl\n" ! 168: "xorl %%bl,%%cl\n" ! 169: "movb %%bl,(%1)\n" ! 170: "orl %%ecx, %0\n" ! 171: "incl %1\n" ! 172: "decl %3\n" ! 173: "jnz 3b\n" ! 174: ! 175: "6:\n" ! 176: : "=m" (differs) ! 177: : "r" (foo), "r" (bar), "r" (len), "b" (baz), "c" (uupzuq) : "cc", "memory"); ! 178: /* Now tell the compiler that foo, bar and len have been modified ! 179: * If someone finds a way to express all this cleaner in constraints that ! 180: * GCC 2.7.2 understands, please FIXME */ ! 181: __asm__ __volatile__ ("" : "=rm" (foo), "=rm" (bar), "=rm" (len) : : "ebx", "ecx", "edx", "eax", "esi", "memory"); ! 182: /* printf("bar\n");*/ ! 183: return differs; ! 184: } 1.1 root 185: #endif 186: 1.1.1.2 ! root 187: #if __GNUC__ > 2 || __GNUC_MINOR__ > 6 ! 188: ! 189: #if defined(__i386__) && !defined(USE_PROFILING) ! 190: #define REGPARAM __attribute__((regparm(3))) ! 191: #endif /* __i386__ */ ! 192: ! 193: #endif /* GCC version 2.7 or higher */ ! 194: #endif /* GCC 2 */ ! 195: ! 196: #ifndef REGPARAM ! 197: #define REGPARAM 1.1 root 198: #endif 199: 1.1.1.2 ! root 200: /*#define EMULATE_AGA*/ 1.1 root 201: 1.1.1.2 ! root 202: #ifndef EMULATE_AGA ! 203: #define AGA_CHIPSET 0 1.1 root 204: #else 1.1.1.2 ! root 205: #define AGA_CHIPSET 1 1.1 root 206: #endif 207: 1.1.1.2 ! root 208: #define SMART_UPDATE 1 1.1 root 209: 210: /* 1.1.1.2 ! root 211: * Disk accesses can be sped up. This isn't such a big win, though. ! 212: * It hasn't been extensively tested and is turned off by default. ! 213: * (It's broken currently, even if it appears to work for most programs) ! 214: */ ! 215: #define NO_FAST_DISK ! 216: ! 217: /* ! 218: * You can specify numbers from 0 to 5 here. It is possible that higher ! 219: * numbers will make the CPU emulation slightly faster, but if the setting ! 220: * is too high, you will run out of memory while compiling. ! 221: * Best to leave this as it is. ! 222: */ ! 223: #define CPU_EMU_SIZE 0 ! 224: ! 225: /* ! 226: * CPU level: 0 = 68000, 1 = 68010, 2 = sort of a 68020 ! 227: * If configured for 68020, the emulator will be a little slower. ! 228: * Don't touch this: Only 0 will work for now. ! 229: */ ! 230: #define CPU_LEVEL 0 ! 231:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.