|
|
1.1.1.3 ! root 1: /* 1.1.1.2 root 2: * UAE - The Un*x Amiga Emulator 1.1.1.3 ! root 3: * 1.1.1.2 root 4: * MC68000 emulation - machine dependent bits 5: * 6: * Copyright 1997 Bernd Schmidt 7: */ 1.1.1.3 ! root 8: 1.1.1.2 root 9: struct flag_struct { 10: unsigned int c:1; /* first byte */ 11: int :5; 12: unsigned int z:1; 13: unsigned int n:1; 14: int :3; /* second, third & fourth byte */ 1.1.1.3 ! root 15: unsigned int v:1; 1.1.1.2 root 16: int :20; 17: unsigned int x:1; /* fifth */ 18: int :31; 19: }; 20: 21: extern struct flag_struct regflags; 22: 23: #define ZFLG (regflags.z) 24: #define NFLG (regflags.n) 25: #define CFLG (regflags.c) 26: #define VFLG (regflags.v) 27: #define XFLG (regflags.x) 28: 29: static __inline__ int cctrue(const int cc) 30: { 31: switch(cc){ 32: case 0: return 1; /* T */ 33: case 1: return 0; /* F */ 34: case 2: return !CFLG && !ZFLG; /* HI */ 35: case 3: return CFLG || ZFLG; /* LS */ 36: case 4: return !CFLG; /* CC */ 37: case 5: return CFLG; /* CS */ 38: case 6: return !ZFLG; /* NE */ 39: case 7: return ZFLG; /* EQ */ 40: case 8: return !VFLG; /* VC */ 41: case 9: return VFLG; /* VS */ 42: case 10:return !NFLG; /* PL */ 43: case 11:return NFLG; /* MI */ 44: case 12:return NFLG == VFLG; /* GE */ 45: case 13:return NFLG != VFLG; /* LT */ 46: case 14:return !ZFLG && (NFLG == VFLG); /* GT */ 47: case 15:return ZFLG || (NFLG != VFLG); /* LE */ 48: } 49: abort(); 50: return 0; 51: } 52: 53: void x86_flag_testl (uae_u32 v); 54: void x86_flag_testw (uae_s16 v); 55: void x86_flag_testb (uae_s8 v); 56: void x86_flag_cmpl (uae_u32 s, uae_s32 d); 57: void x86_flag_cmpw (uae_s16 s, uae_s16 d); 58: void x86_flag_cmpb (uae_s8 s, uae_s8 d); 59: uae_u32 x86_flag_doaddl (uae_u32 s, uae_s32 d); 60: uae_u32 x86_flag_doaddw (uae_s16 s, uae_s16 d); 61: uae_u32 x86_flag_doaddb (uae_s8 s, uae_s8 d); 62: uae_u32 x86_flag_dosubl (uae_u32 s, uae_s32 d); 63: uae_u32 x86_flag_dosubw (uae_s16 s, uae_s16 d); 64: uae_u32 x86_flag_dosubb (uae_s8 s, uae_s8 d); 65: 66: #define x86_flag_addl(v,s,d) do { v = x86_flag_doaddl(s,d); } while (0) 67: #define x86_flag_addw(v,s,d) do { v = x86_flag_doaddw(s,d); } while (0) 68: #define x86_flag_addb(v,s,d) do { v = x86_flag_doaddb(s,d); } while (0) 69: #define x86_flag_subl(v,s,d) do { v = x86_flag_dosubl(s,d); } while (0) 70: #define x86_flag_subw(v,s,d) do { v = x86_flag_dosubw(s,d); } while (0) 71: #define x86_flag_subb(v,s,d) do { v = x86_flag_dosubb(s,d); } while (0) 72: 73: #pragma aux x86_flag_testl = \ 74: "test edx,edx" \ 75: "pushfd" \ 76: "pop ecx" \ 77: "mov DWORD [regflags],ecx" \ 78: parm [edx] \ 79: modify [ecx] 80: 81: #pragma aux x86_flag_testw = \ 82: "test dx,dx" \ 83: "pushfd" \ 84: "pop ecx" \ 85: "mov DWORD [ regflags],ecx" \ 86: parm [dx] \ 87: modify [ecx] 88: 89: #pragma aux x86_flag_testb = \ 90: "test dl,dl" \ 91: "pushfd" \ 92: "pop ecx" \ 93: "mov DWORD [ regflags],ecx" \ 94: parm [dl] \ 95: modify [ecx] 96: 97: #pragma aux x86_flag_doaddl = \ 98: "add edx,ecx" \ 99: "pushfd" \ 100: "pop ecx" \ 101: "mov DWORD [ regflags],ecx" \ 102: "mov DWORD [ regflags + 4],ecx" \ 103: parm [ecx] [edx] \ 104: value [edx] \ 105: modify [ecx] 106: 107: #pragma aux x86_flag_doaddw = \ 108: "add dx,cx" \ 109: "pushfd" \ 110: "pop ecx" \ 111: "mov DWORD [ regflags],ecx" \ 112: "mov DWORD [ regflags + 4],ecx" \ 113: parm [cx] [dx] \ 114: value [edx] \ 115: modify [ecx] 116: 117: #pragma aux x86_flag_doaddb = \ 118: "add dl,cl" \ 119: "pushfd" \ 120: "pop ecx" \ 121: "mov DWORD [ regflags],ecx" \ 122: "mov DWORD [ regflags + 4],ecx" \ 123: parm [cl] [dl] \ 124: value [edx] \ 125: modify [ecx] 126: 127: #pragma aux x86_flag_dosubl = \ 128: "sub edx,ecx" \ 129: "pushfd" \ 130: "pop ecx" \ 131: "mov DWORD [ regflags],ecx" \ 132: "mov DWORD [ regflags + 4],ecx" \ 133: parm [ecx] [edx] \ 134: value [edx] \ 135: modify [ecx] 136: 137: #pragma aux x86_flag_dosubw = \ 138: "sub dx,cx" \ 139: "pushfd" \ 140: "pop ecx" \ 141: "mov DWORD [ regflags],ecx" \ 142: "mov DWORD [ regflags + 4],ecx" \ 143: parm [cx] [dx] \ 144: value [edx] \ 145: modify [ecx] 146: 147: #pragma aux x86_flag_dosubb = \ 148: "sub dl,cl" \ 149: "pushfd" \ 150: "pop ecx" \ 151: "mov DWORD [ regflags],ecx" \ 152: "mov DWORD [ regflags + 4],ecx" \ 153: parm [cl] [dl] \ 154: value [edx] \ 155: modify [ecx] 156: 157: #pragma aux x86_flag_cmpl = \ 158: "cmp edx,ecx" \ 159: "pushfd" \ 160: "pop ecx" \ 161: "mov DWORD [ regflags],ecx" \ 162: parm [ecx] [edx] \ 163: modify [ecx] 164: 165: #pragma aux x86_flag_cmpw = \ 166: "cmp dx,cx" \ 167: "pushfd" \ 168: "pop ecx" \ 169: "mov DWORD [ regflags],ecx" \ 170: parm [cx] [dx] \ 171: modify [ecx] 172: 173: #pragma aux x86_flag_cmpb = \ 174: "cmp dl,cl" \ 175: "pushfd" \ 176: "pop ecx" \ 177: "mov DWORD [ regflags],ecx" \ 178: parm [cl] [dl] \ 179: modify [ecx] 180:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.