| 345 | #define G8(rm) (G(rm) % 4) |
| 346 | |
| 347 | void Eb(int instruction, int which, struct Data* data, bool includeLock = false) { |
| 348 | while (data->valid) { |
| 349 | int eb; |
| 350 | int rm; |
| 351 | U32 result; |
| 352 | |
| 353 | for (eb = 0; eb < 8; eb++) { |
| 354 | U8* reg; |
| 355 | |
| 356 | rm = eb | (which << 3) | 0xC0; |
| 357 | newInstructionWithRM(instruction, rm, data->flags); |
| 358 | reg = cpu->reg8[E(rm)]; |
| 359 | cpu->reg[E8(rm)].u32 = DEFAULT; |
| 360 | *reg = (U8)data->var1; |
| 361 | runTestCPU(); |
| 362 | assertResult(data, cpu, instruction, *reg, 0, E8(rm), -1, 0, 8); |
| 363 | |
| 364 | newInstructionWithRM(instruction, rm, data->flags); |
| 365 | |
| 366 | // this will generate flags so the above code can ignore flag generation |
| 367 | // cmp eax, 0 |
| 368 | pushCode8(0x83); |
| 369 | pushCode8(0xf8); |
| 370 | pushCode8(0); |
| 371 | |
| 372 | reg = cpu->reg8[E(rm)]; |
| 373 | cpu->reg[E8(rm)].u32 = DEFAULT; |
| 374 | *reg = (U8)data->var1; |
| 375 | runTestCPU(); |
| 376 | assertResult(data, cpu, instruction, *reg, 0, E8(rm), -1, 0, 8, true); |
| 377 | } |
| 378 | |
| 379 | for (int lock = 0; lock < 3; lock++) { |
| 380 | rm = (which << 3); |
| 381 | if (cpu->big) |
| 382 | rm += 5; |
| 383 | else |
| 384 | rm += 6; |
| 385 | newInstructionWithRM(instruction, rm, data->flags, lock ? LOCK_PREFIX : 0); |
| 386 | U16 offset = lock == 2 ? 201 : 200; |
| 387 | |
| 388 | if (cpu->big) |
| 389 | pushCode32(offset); |
| 390 | else |
| 391 | pushCode16(offset); |
| 392 | memory->writed(cpu->seg[DS].address + offset, DEFAULT); |
| 393 | memory->writeb(cpu->seg[DS].address + offset, data->var1); |
| 394 | runTestCPU(); |
| 395 | result = memory->readb(cpu->seg[DS].address + offset); |
| 396 | assertResult(data, cpu, instruction, result, 0, -1, -1, cpu->seg[DS].address + offset, 8); |
| 397 | |
| 398 | newInstructionWithRM(instruction, rm, data->flags, lock ? LOCK_PREFIX : 0); |
| 399 | if (cpu->big) |
| 400 | pushCode32(offset); |
| 401 | else |
| 402 | pushCode16(offset); |
| 403 | |
| 404 | // this will generate flags so the above code can ignore flag generation |
no test coverage detected