src/emu/cpu/i86/instr286.c
| r9481 | r9482 | |
| 17 | 17 | 7 p present 0 gives trap when accessed |
| 18 | 18 | UINT16 reserved (should be zero) |
| 19 | 19 | */ |
| 20 | | #define WRITEABLE(a) ((a&0xa)==2) |
| 21 | | #define READABLE(a) ( ((a&0xa)==0xa)|| ((a&8)==0) ) |
| 20 | #define IS_PRESENT(a) ( ( (a) & 0x80 ) == 0x80 ) |
| 21 | #define IS_WRITEABLE(a) ( ( (a) & 0xa ) == 2 ) |
| 22 | #define IS_READABLE(a) ( ( ( (a) & 0xa ) == 0xa ) || ( ( (a) & 8 ) == 0 ) ) |
| 22 | 23 | |
| 23 | 24 | static void i80286_trap2(i80286_state *cpustate,int number) |
| 24 | 25 | { |
| r9481 | r9482 | |
| 205 | 206 | if (!PM) i80286_trap2(cpustate,ILLEGAL_INSTRUCTION); |
| 206 | 207 | tmp=GetRMWord(ModRM); |
| 207 | 208 | if (tmp&4) { |
| 208 | | cpustate->ZeroVal=( ((tmp&~7)<cpustate->ldtr.limit) |
| 209 | | && READABLE( ReadByte(cpustate->ldtr.base+(tmp&~7)+5)) ); |
| 209 | cpustate->ZeroVal=! ( ((tmp&~7)<cpustate->ldtr.limit) |
| 210 | && IS_READABLE( ReadByte(cpustate->ldtr.base+(tmp&~7)+5)) ); |
| 210 | 211 | } else { |
| 211 | | cpustate->ZeroVal=( ((tmp&~7)<cpustate->gdtr.limit) |
| 212 | | && READABLE( ReadByte(cpustate->gdtr.base+(tmp&~7)+5)) ); |
| 212 | cpustate->ZeroVal=! ( ((tmp&~7)<cpustate->gdtr.limit) |
| 213 | && IS_READABLE( ReadByte(cpustate->gdtr.base+(tmp&~7)+5)) ); |
| 213 | 214 | } |
| 214 | 215 | break; |
| 215 | 216 | case 0x28: /* verw */ |
| 216 | 217 | if (!PM) i80286_trap2(cpustate,ILLEGAL_INSTRUCTION); |
| 217 | 218 | tmp=GetRMWord(ModRM); |
| 218 | 219 | if (tmp&4) { |
| 219 | | cpustate->ZeroVal=( ((tmp&~7)<cpustate->ldtr.limit) |
| 220 | | && WRITEABLE( ReadByte(cpustate->ldtr.base+(tmp&~7)+5)) ); |
| 220 | cpustate->ZeroVal=! ( ((tmp&~7)<cpustate->ldtr.limit) |
| 221 | && IS_WRITEABLE( ReadByte(cpustate->ldtr.base+(tmp&~7)+5)) ); |
| 221 | 222 | } else { |
| 222 | | cpustate->ZeroVal=( ((tmp&~7)<cpustate->gdtr.limit) |
| 223 | | && WRITEABLE( ReadByte(cpustate->gdtr.base+(tmp&~7)+5)) ); |
| 223 | cpustate->ZeroVal=! ( ((tmp&~7)<cpustate->gdtr.limit) |
| 224 | && IS_WRITEABLE( ReadByte(cpustate->gdtr.base+(tmp&~7)+5)) ); |
| 224 | 225 | } |
| 225 | 226 | break; |
| 226 | 227 | default: |
| r9481 | r9482 | |
| 268 | 269 | case 2: /* LAR */ |
| 269 | 270 | ModRM = FETCHOP; |
| 270 | 271 | tmp=GetRMWord(ModRM); |
| 271 | | cpustate->ZeroVal=i80286_selector_okay(cpustate,tmp); |
| 272 | | if (cpustate->ZeroVal) { |
| 273 | | RegWord(ModRM)=tmp; |
| 272 | if ( i80286_selector_okay(cpustate,tmp) ) |
| 273 | { |
| 274 | cpustate->ZeroVal = 0; |
| 275 | RegWord(ModRM) = ReadByte( i80286_selector_to_address(cpustate,tmp) + 5 ) << 8; |
| 274 | 276 | } |
| 277 | else |
| 278 | { |
| 279 | cpustate->ZeroVal = 1; |
| 280 | } |
| 275 | 281 | break; |
| 276 | 282 | case 3: /* LSL */ |
| 277 | 283 | if (!PM) i80286_trap2(cpustate,ILLEGAL_INSTRUCTION); |
| 278 | 284 | ModRM = FETCHOP; |
| 279 | 285 | tmp=GetRMWord(ModRM); |
| 280 | | cpustate->ZeroVal=i80286_selector_okay(cpustate,tmp); |
| 281 | | if (cpustate->ZeroVal) { |
| 286 | if ( i80286_selector_okay(cpustate,tmp) ) |
| 287 | { |
| 288 | cpustate->ZeroVal = 0; |
| 282 | 289 | addr=i80286_selector_to_address(cpustate,tmp); |
| 283 | 290 | RegWord(ModRM)=ReadWord(addr); |
| 284 | 291 | } |
| 292 | else |
| 293 | { |
| 294 | cpustate->ZeroVal = 1; |
| 295 | } |
| 285 | 296 | break; |
| 286 | 297 | case 6: /* clts */ |
| 287 | 298 | if (PM&&(CPL!=0)) i80286_trap2(cpustate,GENERAL_PROTECTION_FAULT); |
| r9481 | r9482 | |
| 295 | 306 | |
| 296 | 307 | static void PREFIX286(_arpl)(i8086_state *cpustate) /* 0x63 */ |
| 297 | 308 | { |
| 298 | | if (PM) { |
| 299 | | UINT16 ModRM=FETCHOP, tmp=GetRMWord(ModRM); |
| 309 | if (PM) |
| 310 | { |
| 311 | UINT16 ModRM=FETCHOP, tmp=GetRMWord(ModRM), source=RegWord(ModRM); |
| 300 | 312 | |
| 301 | | cpustate->ZeroVal=i80286_selector_okay(cpustate,RegWord(ModRM)) |
| 302 | | &&i80286_selector_okay(cpustate,RegWord(ModRM)) |
| 303 | | &&((tmp&3)<(RegWord(ModRM)&3)); |
| 304 | | if (cpustate->ZeroVal) PutbackRMWord(ModRM, (tmp&~3)|(RegWord(ModRM)&3)); |
| 305 | | } else { |
| 313 | if ( i80286_selector_okay(cpustate,tmp) &&i80286_selector_okay(cpustate,source) &&((tmp&3)<(source&3)) ) |
| 314 | { |
| 315 | cpustate->ZeroVal = 0; |
| 316 | PutbackRMWord(ModRM, (tmp&~3)|(source&3)); |
| 317 | } |
| 318 | else |
| 319 | { |
| 320 | cpustate->ZeroVal = 1; |
| 321 | } |
| 322 | } |
| 323 | else |
| 324 | { |
| 306 | 325 | i80286_trap2(cpustate,ILLEGAL_INSTRUCTION); |
| 307 | 326 | } |
| 308 | 327 | } |
| 328 | |
| 329 | static void i80286_check_permission(i8086_state *cpustate, UINT8 check_seg, UINT16 offset, i80286_size size, i80286_operation operation) |
| 330 | { |
| 331 | if (PM) |
| 332 | { |
| 333 | /* Is the segment physically present? */ |
| 334 | if ( ! IS_PRESENT( cpustate->rights[check_seg] ) ) |
| 335 | throw GENERAL_PROTECTION_FAULT; |
| 336 | |
| 337 | /* Would we go past the segment boundary? */ |
| 338 | if ( offset + size > cpustate->limit[check_seg] ) |
| 339 | { |
| 340 | throw GENERAL_PROTECTION_FAULT; |
| 341 | } |
| 342 | |
| 343 | switch(operation) |
| 344 | { |
| 345 | case I80286_READ: |
| 346 | /* Is the segment readable? */ |
| 347 | if ( ! IS_READABLE( cpustate->rights[check_seg] ) ) |
| 348 | throw GENERAL_PROTECTION_FAULT; |
| 349 | break; |
| 350 | |
| 351 | case I80286_WRITE: |
| 352 | /* Is the segment writeable? */ |
| 353 | if ( ! IS_WRITEABLE( cpustate->rights[check_seg] ) ) |
| 354 | throw GENERAL_PROTECTION_FAULT; |
| 355 | break; |
| 356 | |
| 357 | case I80286_EXECUTE: |
| 358 | /* TODO */ |
| 359 | break; |
| 360 | } |
| 361 | /* TODO: Mark segment as accessed? */ |
| 362 | } |
| 363 | } |
| 364 | |
src/emu/cpu/i86/instr86.c
| r9481 | r9482 | |
| 391 | 391 | switch(next) |
| 392 | 392 | { |
| 393 | 393 | case 0x26: /* ES: */ |
| 394 | | cpustate->seg_prefix=TRUE; |
| 395 | | cpustate->prefix_base=cpustate->base[ES]; |
| 394 | cpustate->seg_prefix = TRUE; |
| 395 | cpustate->prefix_seg = ES; |
| 396 | 396 | if (!cpustate->rep_in_progress) |
| 397 | 397 | ICOUNT -= timing.override; |
| 398 | 398 | PREFIX(rep)(cpustate, flagval); |
| 399 | 399 | break; |
| 400 | 400 | case 0x2e: /* CS: */ |
| 401 | | cpustate->seg_prefix=TRUE; |
| 402 | | cpustate->prefix_base=cpustate->base[CS]; |
| 401 | cpustate->seg_prefix = TRUE; |
| 402 | cpustate->prefix_seg = CS; |
| 403 | 403 | if (!cpustate->rep_in_progress) |
| 404 | 404 | ICOUNT -= timing.override; |
| 405 | 405 | PREFIX(rep)(cpustate, flagval); |
| 406 | 406 | break; |
| 407 | 407 | case 0x36: /* SS: */ |
| 408 | | cpustate->seg_prefix=TRUE; |
| 409 | | cpustate->prefix_base=cpustate->base[SS]; |
| 408 | cpustate->seg_prefix = TRUE; |
| 409 | cpustate->prefix_seg = SS; |
| 410 | 410 | if (!cpustate->rep_in_progress) |
| 411 | 411 | ICOUNT -= timing.override; |
| 412 | 412 | PREFIX(rep)(cpustate, flagval); |
| 413 | 413 | break; |
| 414 | 414 | case 0x3e: /* DS: */ |
| 415 | | cpustate->seg_prefix=TRUE; |
| 416 | | cpustate->prefix_base=cpustate->base[DS]; |
| 415 | cpustate->seg_prefix = TRUE; |
| 416 | cpustate->prefix_seg = DS; |
| 417 | 417 | if (!cpustate->rep_in_progress) |
| 418 | 418 | ICOUNT -= timing.override; |
| 419 | 419 | PREFIX(rep)(cpustate, flagval); |
| r9481 | r9482 | |
| 958 | 958 | |
| 959 | 959 | static void PREFIX86(_es)(i8086_state *cpustate) /* Opcode 0x26 */ |
| 960 | 960 | { |
| 961 | | cpustate->seg_prefix=TRUE; |
| 962 | | cpustate->prefix_base=cpustate->base[ES]; |
| 961 | cpustate->seg_prefix = TRUE; |
| 962 | cpustate->prefix_seg = ES; |
| 963 | 963 | ICOUNT -= timing.override; |
| 964 | 964 | PREFIX(_instruction)[FETCHOP](cpustate); |
| 965 | 965 | } |
| r9481 | r9482 | |
| 1034 | 1034 | |
| 1035 | 1035 | static void PREFIX86(_cs)(i8086_state *cpustate) /* Opcode 0x2e */ |
| 1036 | 1036 | { |
| 1037 | | cpustate->seg_prefix=TRUE; |
| 1038 | | cpustate->prefix_base=cpustate->base[CS]; |
| 1037 | cpustate->seg_prefix = TRUE; |
| 1038 | cpustate->prefix_seg = CS; |
| 1039 | 1039 | ICOUNT -= timing.override; |
| 1040 | 1040 | PREFIX(_instruction)[FETCHOP](cpustate); |
| 1041 | 1041 | } |
| r9481 | r9482 | |
| 1111 | 1111 | |
| 1112 | 1112 | static void PREFIX86(_ss)(i8086_state *cpustate) /* Opcode 0x36 */ |
| 1113 | 1113 | { |
| 1114 | | cpustate->seg_prefix=TRUE; |
| 1115 | | cpustate->prefix_base=cpustate->base[SS]; |
| 1114 | cpustate->seg_prefix = TRUE; |
| 1115 | cpustate->prefix_seg = SS; |
| 1116 | 1116 | ICOUNT -= timing.override; |
| 1117 | 1117 | PREFIX(_instruction)[FETCHOP](cpustate); |
| 1118 | 1118 | } |
| r9481 | r9482 | |
| 1182 | 1182 | |
| 1183 | 1183 | static void PREFIX86(_ds)(i8086_state *cpustate) /* Opcode 0x3e */ |
| 1184 | 1184 | { |
| 1185 | | cpustate->seg_prefix=TRUE; |
| 1186 | | cpustate->prefix_base=cpustate->base[DS]; |
| 1185 | cpustate->seg_prefix = TRUE; |
| 1186 | cpustate->prefix_seg = DS; |
| 1187 | 1187 | ICOUNT -= timing.override; |
| 1188 | 1188 | PREFIX(_instruction)[FETCHOP](cpustate); |
| 1189 | 1189 | } |
| r9481 | r9482 | |
| 3165 | 3165 | #ifdef I80286 |
| 3166 | 3166 | i80286_trap2(cpustate,ILLEGAL_INSTRUCTION); |
| 3167 | 3167 | #else |
| 3168 | | /* makes the cpu loops forever until user resets it */ |
| 3169 | | /*{ debugger_break(Machine); } */ |
| 3170 | | logerror("illegal instruction %.2x at %.5x\n",PEEKBYTE(cpustate->pc), cpustate->pc); |
| 3171 | | cpustate->pc--; |
| 3168 | /* i8086/i8088 ignore an invalid opcode. */ |
| 3169 | /* i80186/i80188 probably also ignore an invalid opcode. */ |
| 3170 | logerror("illegal instruction %.2x at %.5x\n",PEEKBYTE(cpustate->pc-1), cpustate->pc); |
| 3172 | 3171 | ICOUNT -= 10; |
| 3173 | 3172 | #endif |
| 3174 | 3173 | } |
src/emu/cpu/i86/modrm286.h
| r0 | r9482 | |
| 1 | static struct |
| 2 | { |
| 3 | struct |
| 4 | { |
| 5 | WREGS w[256]; |
| 6 | BREGS b[256]; |
| 7 | } reg; |
| 8 | struct |
| 9 | { |
| 10 | WREGS w[256]; |
| 11 | BREGS b[256]; |
| 12 | } RM; |
| 13 | } Mod_RM; |
| 14 | |
| 15 | #define RegWord(ModRM) cpustate->regs.w[Mod_RM.reg.w[ModRM]] |
| 16 | #define RegByte(ModRM) cpustate->regs.b[Mod_RM.reg.b[ModRM]] |
| 17 | |
| 18 | #define GetRMWord(ModRM) \ |
| 19 | ((ModRM) >= 0xc0 ? cpustate->regs.w[Mod_RM.RM.w[ModRM]] : ( (*GetEA[ModRM])(cpustate), i80286_check_permission(cpustate, cpustate->ea_seg, cpustate->eo, I80286_WORD, I80286_READ), ReadWord( cpustate->ea ) )) |
| 20 | |
| 21 | #define PutbackRMWord(ModRM,val) \ |
| 22 | { \ |
| 23 | if (ModRM >= 0xc0) cpustate->regs.w[Mod_RM.RM.w[ModRM]]=val; \ |
| 24 | else \ |
| 25 | { \ |
| 26 | i80286_check_permission(cpustate, cpustate->ea_seg, cpustate->eo, I80286_WORD, I80286_WRITE); \ |
| 27 | WriteWord(cpustate->ea,val); \ |
| 28 | } \ |
| 29 | } |
| 30 | |
| 31 | #define GetnextRMWord \ |
| 32 | ( \ |
| 33 | i80286_check_permission(cpustate, cpustate->ea_seg, cpustate->ea + 2 - cpustate->base[cpustate->ea_seg], I80286_WORD, I80286_READ), \ |
| 34 | ReadWord(cpustate->ea+2) \ |
| 35 | ) |
| 36 | |
| 37 | #define GetRMWordOffset(offs) \ |
| 38 | ( \ |
| 39 | i80286_check_permission(cpustate, cpustate->ea_seg, (UINT16)(cpustate->eo+offs), I80286_WORD, I80286_READ), \ |
| 40 | ReadWord(cpustate->ea-cpustate->eo+(UINT16)(cpustate->eo+offs)) \ |
| 41 | ) |
| 42 | |
| 43 | #define GetRMByteOffset(offs) \ |
| 44 | ( \ |
| 45 | i80286_check_permission(cpustate, cpustate->ea_seg, (UINT16)(cpustate->eo+offs), I80286_BYTE, I80286_READ), \ |
| 46 | ReadByte(cpustate->ea-cpustate->eo+(UINT16)(cpustate->eo+offs)) \ |
| 47 | ) |
| 48 | |
| 49 | #define PutRMWord(ModRM,val) \ |
| 50 | { \ |
| 51 | if (ModRM >= 0xc0) \ |
| 52 | cpustate->regs.w[Mod_RM.RM.w[ModRM]]=val; \ |
| 53 | else { \ |
| 54 | (*GetEA[ModRM])(cpustate); \ |
| 55 | i80286_check_permission(cpustate, cpustate->ea_seg, cpustate->eo, I80286_WORD, I80286_WRITE); \ |
| 56 | WriteWord( cpustate->ea ,val); \ |
| 57 | } \ |
| 58 | } |
| 59 | |
| 60 | #define PutRMWordOffset(offs, val) \ |
| 61 | i80286_check_permission(cpustate, cpustate->ea_seg, (UINT16)(cpustate->eo+offs), I80286_WORD, I80286_WRITE); \ |
| 62 | WriteWord( cpustate->ea-cpustate->eo+(UINT16)(cpustate->eo+offs), val) |
| 63 | |
| 64 | #define PutRMByteOffset(offs, val) \ |
| 65 | i80286_check_permission(cpustate, cpustate->ea_seg, (UINT16)(cpustate->eo+offs), I80286_BYTE, I80286_WRITE); \ |
| 66 | WriteByte( cpustate->ea-cpustate->eo+(UINT16)(cpustate->eo+offs), val) |
| 67 | |
| 68 | #define PutImmRMWord(ModRM) \ |
| 69 | { \ |
| 70 | WORD val; \ |
| 71 | if (ModRM >= 0xc0) \ |
| 72 | FETCHWORD(cpustate->regs.w[Mod_RM.RM.w[ModRM]]) \ |
| 73 | else { \ |
| 74 | (*GetEA[ModRM])(cpustate); \ |
| 75 | i80286_check_permission(cpustate, cpustate->ea_seg, cpustate->eo, I80286_WORD, I80286_WRITE); \ |
| 76 | FETCHWORD(val) \ |
| 77 | WriteWord( cpustate->ea , val); \ |
| 78 | } \ |
| 79 | } |
| 80 | |
| 81 | #define GetRMByte(ModRM) \ |
| 82 | ((ModRM) >= 0xc0 ? cpustate->regs.b[Mod_RM.RM.b[ModRM]] : ( (*GetEA[ModRM])(cpustate), i80286_check_permission(cpustate, cpustate->ea_seg, cpustate->eo, I80286_BYTE, I80286_READ), ReadByte( cpustate->ea )) ) |
| 83 | |
| 84 | #define PutRMByte(ModRM,val) \ |
| 85 | { \ |
| 86 | if (ModRM >= 0xc0) \ |
| 87 | cpustate->regs.b[Mod_RM.RM.b[ModRM]]=val; \ |
| 88 | else \ |
| 89 | { \ |
| 90 | (*GetEA[ModRM])(cpustate); \ |
| 91 | i80286_check_permission(cpustate, cpustate->ea_seg, cpustate->eo, I80286_BYTE, I80286_WRITE); \ |
| 92 | WriteByte( cpustate->ea,val); \ |
| 93 | } \ |
| 94 | } |
| 95 | |
| 96 | #define PutImmRMByte(ModRM) \ |
| 97 | { \ |
| 98 | if (ModRM >= 0xc0) \ |
| 99 | cpustate->regs.b[Mod_RM.RM.b[ModRM]]=FETCH; \ |
| 100 | else { \ |
| 101 | (*GetEA[ModRM])(cpustate); \ |
| 102 | i80286_check_permission(cpustate, cpustate->ea_seg, cpustate->eo, I80286_BYTE, I80286_WRITE); \ |
| 103 | WriteByte( cpustate->ea , FETCH ); \ |
| 104 | } \ |
| 105 | } |
| 106 | |
| 107 | #define PutbackRMByte(ModRM,val) \ |
| 108 | { \ |
| 109 | if (ModRM >= 0xc0) \ |
| 110 | cpustate->regs.b[Mod_RM.RM.b[ModRM]]=val; \ |
| 111 | else \ |
| 112 | { \ |
| 113 | i80286_check_permission(cpustate, cpustate->ea_seg, cpustate->eo, I80286_BYTE, I80286_WRITE); \ |
| 114 | WriteByte(cpustate->ea,val); \ |
| 115 | } \ |
| 116 | } |
| 117 | |
| 118 | #define DEF_br8(dst,src) \ |
| 119 | unsigned ModRM = FETCHOP; \ |
| 120 | unsigned src = RegByte(ModRM); \ |
| 121 | unsigned dst = GetRMByte(ModRM) |
| 122 | |
| 123 | #define DEF_wr16(dst,src) \ |
| 124 | unsigned ModRM = FETCHOP; \ |
| 125 | unsigned src = RegWord(ModRM); \ |
| 126 | unsigned dst = GetRMWord(ModRM) |
| 127 | |
| 128 | #define DEF_r8b(dst,src) \ |
| 129 | unsigned ModRM = FETCHOP; \ |
| 130 | unsigned dst = RegByte(ModRM); \ |
| 131 | unsigned src = GetRMByte(ModRM) |
| 132 | |
| 133 | #define DEF_r16w(dst,src) \ |
| 134 | unsigned ModRM = FETCHOP; \ |
| 135 | unsigned dst = RegWord(ModRM); \ |
| 136 | unsigned src = GetRMWord(ModRM) |
| 137 | |
| 138 | #define DEF_ald8(dst,src) \ |
| 139 | unsigned src = FETCHOP; \ |
| 140 | unsigned dst = cpustate->regs.b[AL] |
| 141 | |
| 142 | #define DEF_axd16(dst,src) \ |
| 143 | unsigned src = FETCHOP; \ |
| 144 | unsigned dst = cpustate->regs.w[AX]; \ |
| 145 | src += (FETCH << 8) |
src/emu/cpu/i86/ea.h
| r9481 | r9482 | |
| 1 | | static unsigned EA_000(i8086_state *cpustate) { cpustate->icount-=7; cpustate->eo=(WORD)(cpustate->regs.w[BX]+cpustate->regs.w[SI]); cpustate->ea=DefaultBase(DS)+cpustate->eo; return cpustate->ea; } |
| 2 | | static unsigned EA_001(i8086_state *cpustate) { cpustate->icount-=8; cpustate->eo=(WORD)(cpustate->regs.w[BX]+cpustate->regs.w[DI]); cpustate->ea=DefaultBase(DS)+cpustate->eo; return cpustate->ea; } |
| 3 | | static unsigned EA_002(i8086_state *cpustate) { cpustate->icount-=8; cpustate->eo=(WORD)(cpustate->regs.w[BP]+cpustate->regs.w[SI]); cpustate->ea=DefaultBase(SS)+cpustate->eo; return cpustate->ea; } |
| 4 | | static unsigned EA_003(i8086_state *cpustate) { cpustate->icount-=7; cpustate->eo=(WORD)(cpustate->regs.w[BP]+cpustate->regs.w[DI]); cpustate->ea=DefaultBase(SS)+cpustate->eo; return cpustate->ea; } |
| 5 | | static unsigned EA_004(i8086_state *cpustate) { cpustate->icount-=5; cpustate->eo=cpustate->regs.w[SI]; cpustate->ea=DefaultBase(DS)+cpustate->eo; return cpustate->ea; } |
| 6 | | static unsigned EA_005(i8086_state *cpustate) { cpustate->icount-=5; cpustate->eo=cpustate->regs.w[DI]; cpustate->ea=DefaultBase(DS)+cpustate->eo; return cpustate->ea; } |
| 7 | | static unsigned EA_006(i8086_state *cpustate) { cpustate->icount-=6; cpustate->eo=FETCHOP; cpustate->eo+=FETCHOP<<8; cpustate->ea=DefaultBase(DS)+cpustate->eo; return cpustate->ea; } |
| 8 | | static unsigned EA_007(i8086_state *cpustate) { cpustate->icount-=5; cpustate->eo=cpustate->regs.w[BX]; cpustate->ea=DefaultBase(DS)+cpustate->eo; return cpustate->ea; } |
| 1 | static unsigned EA_000(i8086_state *cpustate) { cpustate->icount-=7; cpustate->eo=(WORD)(cpustate->regs.w[BX]+cpustate->regs.w[SI]); cpustate->ea_seg=DefaultSeg(DS); cpustate->ea=DefaultBase(DS)+cpustate->eo; return cpustate->ea; } |
| 2 | static unsigned EA_001(i8086_state *cpustate) { cpustate->icount-=8; cpustate->eo=(WORD)(cpustate->regs.w[BX]+cpustate->regs.w[DI]); cpustate->ea_seg=DefaultSeg(DS); cpustate->ea=DefaultBase(DS)+cpustate->eo; return cpustate->ea; } |
| 3 | static unsigned EA_002(i8086_state *cpustate) { cpustate->icount-=8; cpustate->eo=(WORD)(cpustate->regs.w[BP]+cpustate->regs.w[SI]); cpustate->ea_seg=DefaultSeg(SS); cpustate->ea=DefaultBase(SS)+cpustate->eo; return cpustate->ea; } |
| 4 | static unsigned EA_003(i8086_state *cpustate) { cpustate->icount-=7; cpustate->eo=(WORD)(cpustate->regs.w[BP]+cpustate->regs.w[DI]); cpustate->ea_seg=DefaultSeg(SS); cpustate->ea=DefaultBase(SS)+cpustate->eo; return cpustate->ea; } |
| 5 | static unsigned EA_004(i8086_state *cpustate) { cpustate->icount-=5; cpustate->eo=cpustate->regs.w[SI]; cpustate->ea_seg=DefaultSeg(DS); cpustate->ea=DefaultBase(DS)+cpustate->eo; return cpustate->ea; } |
| 6 | static unsigned EA_005(i8086_state *cpustate) { cpustate->icount-=5; cpustate->eo=cpustate->regs.w[DI]; cpustate->ea_seg=DefaultSeg(DS); cpustate->ea=DefaultBase(DS)+cpustate->eo; return cpustate->ea; } |
| 7 | static unsigned EA_006(i8086_state *cpustate) { cpustate->icount-=6; cpustate->eo=FETCHOP; cpustate->eo+=FETCHOP<<8; cpustate->ea_seg=DefaultSeg(DS); cpustate->ea=DefaultBase(DS)+cpustate->eo; return cpustate->ea; } |
| 8 | static unsigned EA_007(i8086_state *cpustate) { cpustate->icount-=5; cpustate->eo=cpustate->regs.w[BX]; cpustate->ea_seg=DefaultSeg(DS); cpustate->ea=DefaultBase(DS)+cpustate->eo; return cpustate->ea; } |
| 9 | 9 | |
| 10 | | static unsigned EA_100(i8086_state *cpustate) { cpustate->icount-=11; cpustate->eo=(WORD)(cpustate->regs.w[BX]+cpustate->regs.w[SI]+(INT8)FETCHOP); cpustate->ea=DefaultBase(DS)+cpustate->eo; return cpustate->ea; } |
| 11 | | static unsigned EA_101(i8086_state *cpustate) { cpustate->icount-=12; cpustate->eo=(WORD)(cpustate->regs.w[BX]+cpustate->regs.w[DI]+(INT8)FETCHOP); cpustate->ea=DefaultBase(DS)+cpustate->eo; return cpustate->ea; } |
| 12 | | static unsigned EA_102(i8086_state *cpustate) { cpustate->icount-=12; cpustate->eo=(WORD)(cpustate->regs.w[BP]+cpustate->regs.w[SI]+(INT8)FETCHOP); cpustate->ea=DefaultBase(SS)+cpustate->eo; return cpustate->ea; } |
| 13 | | static unsigned EA_103(i8086_state *cpustate) { cpustate->icount-=11; cpustate->eo=(WORD)(cpustate->regs.w[BP]+cpustate->regs.w[DI]+(INT8)FETCHOP); cpustate->ea=DefaultBase(SS)+cpustate->eo; return cpustate->ea; } |
| 14 | | static unsigned EA_104(i8086_state *cpustate) { cpustate->icount-=9; cpustate->eo=(WORD)(cpustate->regs.w[SI]+(INT8)FETCHOP); cpustate->ea=DefaultBase(DS)+cpustate->eo; return cpustate->ea; } |
| 15 | | static unsigned EA_105(i8086_state *cpustate) { cpustate->icount-=9; cpustate->eo=(WORD)(cpustate->regs.w[DI]+(INT8)FETCHOP); cpustate->ea=DefaultBase(DS)+cpustate->eo; return cpustate->ea; } |
| 16 | | static unsigned EA_106(i8086_state *cpustate) { cpustate->icount-=9; cpustate->eo=(WORD)(cpustate->regs.w[BP]+(INT8)FETCHOP); cpustate->ea=DefaultBase(SS)+cpustate->eo; return cpustate->ea; } |
| 17 | | static unsigned EA_107(i8086_state *cpustate) { cpustate->icount-=9; cpustate->eo=(WORD)(cpustate->regs.w[BX]+(INT8)FETCHOP); cpustate->ea=DefaultBase(DS)+cpustate->eo; return cpustate->ea; } |
| 10 | static unsigned EA_100(i8086_state *cpustate) { cpustate->icount-=11; cpustate->eo=(WORD)(cpustate->regs.w[BX]+cpustate->regs.w[SI]+(INT8)FETCHOP); cpustate->ea_seg=DefaultSeg(DS); cpustate->ea=DefaultBase(DS)+cpustate->eo; return cpustate->ea; } |
| 11 | static unsigned EA_101(i8086_state *cpustate) { cpustate->icount-=12; cpustate->eo=(WORD)(cpustate->regs.w[BX]+cpustate->regs.w[DI]+(INT8)FETCHOP); cpustate->ea_seg=DefaultSeg(DS); cpustate->ea=DefaultBase(DS)+cpustate->eo; return cpustate->ea; } |
| 12 | static unsigned EA_102(i8086_state *cpustate) { cpustate->icount-=12; cpustate->eo=(WORD)(cpustate->regs.w[BP]+cpustate->regs.w[SI]+(INT8)FETCHOP); cpustate->ea_seg=DefaultSeg(SS); cpustate->ea=DefaultBase(SS)+cpustate->eo; return cpustate->ea; } |
| 13 | static unsigned EA_103(i8086_state *cpustate) { cpustate->icount-=11; cpustate->eo=(WORD)(cpustate->regs.w[BP]+cpustate->regs.w[DI]+(INT8)FETCHOP); cpustate->ea_seg=DefaultSeg(SS); cpustate->ea=DefaultBase(SS)+cpustate->eo; return cpustate->ea; } |
| 14 | static unsigned EA_104(i8086_state *cpustate) { cpustate->icount-=9; cpustate->eo=(WORD)(cpustate->regs.w[SI]+(INT8)FETCHOP); cpustate->ea_seg=DefaultSeg(DS); cpustate->ea=DefaultBase(DS)+cpustate->eo; return cpustate->ea; } |
| 15 | static unsigned EA_105(i8086_state *cpustate) { cpustate->icount-=9; cpustate->eo=(WORD)(cpustate->regs.w[DI]+(INT8)FETCHOP); cpustate->ea_seg=DefaultSeg(DS); cpustate->ea=DefaultBase(DS)+cpustate->eo; return cpustate->ea; } |
| 16 | static unsigned EA_106(i8086_state *cpustate) { cpustate->icount-=9; cpustate->eo=(WORD)(cpustate->regs.w[BP]+(INT8)FETCHOP); cpustate->ea_seg=DefaultSeg(SS); cpustate->ea=DefaultBase(SS)+cpustate->eo; return cpustate->ea; } |
| 17 | static unsigned EA_107(i8086_state *cpustate) { cpustate->icount-=9; cpustate->eo=(WORD)(cpustate->regs.w[BX]+(INT8)FETCHOP); cpustate->ea_seg=DefaultSeg(DS); cpustate->ea=DefaultBase(DS)+cpustate->eo; return cpustate->ea; } |
| 18 | 18 | |
| 19 | | static unsigned EA_200(i8086_state *cpustate) { cpustate->icount-=11; cpustate->eo=FETCHOP; cpustate->eo+=FETCHOP<<8; cpustate->eo+=cpustate->regs.w[BX]+cpustate->regs.w[SI]; cpustate->ea=DefaultBase(DS)+(WORD)cpustate->eo; return cpustate->ea; } |
| 20 | | static unsigned EA_201(i8086_state *cpustate) { cpustate->icount-=12; cpustate->eo=FETCHOP; cpustate->eo+=FETCHOP<<8; cpustate->eo+=cpustate->regs.w[BX]+cpustate->regs.w[DI]; cpustate->ea=DefaultBase(DS)+(WORD)cpustate->eo; return cpustate->ea; } |
| 21 | | static unsigned EA_202(i8086_state *cpustate) { cpustate->icount-=12; cpustate->eo=FETCHOP; cpustate->eo+=FETCHOP<<8; cpustate->eo+=cpustate->regs.w[BP]+cpustate->regs.w[SI]; cpustate->ea=DefaultBase(SS)+(WORD)cpustate->eo; return cpustate->ea; } |
| 22 | | static unsigned EA_203(i8086_state *cpustate) { cpustate->icount-=11; cpustate->eo=FETCHOP; cpustate->eo+=FETCHOP<<8; cpustate->eo+=cpustate->regs.w[BP]+cpustate->regs.w[DI]; cpustate->ea=DefaultBase(SS)+(WORD)cpustate->eo; return cpustate->ea; } |
| 23 | | static unsigned EA_204(i8086_state *cpustate) { cpustate->icount-=9; cpustate->eo=FETCHOP; cpustate->eo+=FETCHOP<<8; cpustate->eo+=cpustate->regs.w[SI]; cpustate->ea=DefaultBase(DS)+(WORD)cpustate->eo; return cpustate->ea; } |
| 24 | | static unsigned EA_205(i8086_state *cpustate) { cpustate->icount-=9; cpustate->eo=FETCHOP; cpustate->eo+=FETCHOP<<8; cpustate->eo+=cpustate->regs.w[DI]; cpustate->ea=DefaultBase(DS)+(WORD)cpustate->eo; return cpustate->ea; } |
| 25 | | static unsigned EA_206(i8086_state *cpustate) { cpustate->icount-=9; cpustate->eo=FETCHOP; cpustate->eo+=FETCHOP<<8; cpustate->eo+=cpustate->regs.w[BP]; cpustate->ea=DefaultBase(SS)+(WORD)cpustate->eo; return cpustate->ea; } |
| 26 | | static unsigned EA_207(i8086_state *cpustate) { cpustate->icount-=9; cpustate->eo=FETCHOP; cpustate->eo+=FETCHOP<<8; cpustate->eo+=cpustate->regs.w[BX]; cpustate->ea=DefaultBase(DS)+(WORD)cpustate->eo; return cpustate->ea; } |
| 19 | static unsigned EA_200(i8086_state *cpustate) { cpustate->icount-=11; cpustate->eo=FETCHOP; cpustate->eo+=FETCHOP<<8; cpustate->eo+=cpustate->regs.w[BX]+cpustate->regs.w[SI]; cpustate->ea_seg=DefaultSeg(DS); cpustate->ea=DefaultBase(DS)+(WORD)cpustate->eo; return cpustate->ea; } |
| 20 | static unsigned EA_201(i8086_state *cpustate) { cpustate->icount-=12; cpustate->eo=FETCHOP; cpustate->eo+=FETCHOP<<8; cpustate->eo+=cpustate->regs.w[BX]+cpustate->regs.w[DI]; cpustate->ea_seg=DefaultSeg(DS); cpustate->ea=DefaultBase(DS)+(WORD)cpustate->eo; return cpustate->ea; } |
| 21 | static unsigned EA_202(i8086_state *cpustate) { cpustate->icount-=12; cpustate->eo=FETCHOP; cpustate->eo+=FETCHOP<<8; cpustate->eo+=cpustate->regs.w[BP]+cpustate->regs.w[SI]; cpustate->ea_seg=DefaultSeg(SS); cpustate->ea=DefaultBase(SS)+(WORD)cpustate->eo; return cpustate->ea; } |
| 22 | static unsigned EA_203(i8086_state *cpustate) { cpustate->icount-=11; cpustate->eo=FETCHOP; cpustate->eo+=FETCHOP<<8; cpustate->eo+=cpustate->regs.w[BP]+cpustate->regs.w[DI]; cpustate->ea_seg=DefaultSeg(DS); cpustate->ea=DefaultBase(SS)+(WORD)cpustate->eo; return cpustate->ea; } |
| 23 | static unsigned EA_204(i8086_state *cpustate) { cpustate->icount-=9; cpustate->eo=FETCHOP; cpustate->eo+=FETCHOP<<8; cpustate->eo+=cpustate->regs.w[SI]; cpustate->ea_seg=DefaultSeg(DS); cpustate->ea=DefaultBase(DS)+(WORD)cpustate->eo; return cpustate->ea; } |
| 24 | static unsigned EA_205(i8086_state *cpustate) { cpustate->icount-=9; cpustate->eo=FETCHOP; cpustate->eo+=FETCHOP<<8; cpustate->eo+=cpustate->regs.w[DI]; cpustate->ea_seg=DefaultSeg(DS); cpustate->ea=DefaultBase(DS)+(WORD)cpustate->eo; return cpustate->ea; } |
| 25 | static unsigned EA_206(i8086_state *cpustate) { cpustate->icount-=9; cpustate->eo=FETCHOP; cpustate->eo+=FETCHOP<<8; cpustate->eo+=cpustate->regs.w[BP]; cpustate->ea_seg=DefaultSeg(SS); cpustate->ea=DefaultBase(SS)+(WORD)cpustate->eo; return cpustate->ea; } |
| 26 | static unsigned EA_207(i8086_state *cpustate) { cpustate->icount-=9; cpustate->eo=FETCHOP; cpustate->eo+=FETCHOP<<8; cpustate->eo+=cpustate->regs.w[BX]; cpustate->ea_seg=DefaultSeg(DS); cpustate->ea=DefaultBase(DS)+(WORD)cpustate->eo; return cpustate->ea; } |
| 27 | 27 | |
| 28 | 28 | static unsigned (*const GetEA[192])(i8086_state *cpustate)={ |
| 29 | 29 | EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007, |