| 961 | } |
| 962 | |
| 963 | void Ew(int instruction, int which, struct Data* data, bool includeLock = false) { |
| 964 | while (data->valid) { |
| 965 | int ew; |
| 966 | int rm; |
| 967 | U32 result; |
| 968 | |
| 969 | for (ew = 0; ew < 8; ew++) { |
| 970 | Reg* reg; |
| 971 | |
| 972 | rm = ew | (which << 3) | 0xC0; |
| 973 | newInstructionWithRM(instruction, rm, data->flags); |
| 974 | reg = &cpu->reg[E(rm)]; |
| 975 | reg->u32 = DEFAULT; |
| 976 | reg->u16 = data->var1; |
| 977 | runTestCPU(); |
| 978 | assertResult(data, cpu, instruction, reg->u16, 0, E(rm), -1, 0, 16); |
| 979 | |
| 980 | newInstructionWithRM(instruction, rm, data->flags); |
| 981 | |
| 982 | // this will generate flags so the above code can ignore flag generation |
| 983 | // cmp eax, 0 |
| 984 | pushCode8(0x83); |
| 985 | pushCode8(0xf8); |
| 986 | pushCode8(0); |
| 987 | |
| 988 | reg = &cpu->reg[E(rm)]; |
| 989 | reg->u32 = DEFAULT; |
| 990 | reg->u16 = data->var1; |
| 991 | runTestCPU(); |
| 992 | assertResult(data, cpu, instruction, reg->u16, 0, E(rm), -1, 0, 16, true); |
| 993 | } |
| 994 | |
| 995 | for (int lock = 0; lock < 3; lock++) { |
| 996 | rm = (which << 3); |
| 997 | if (cpu->big) |
| 998 | rm += 5; |
| 999 | else |
| 1000 | rm += 6; |
| 1001 | newInstructionWithRM(instruction, rm, data->flags, lock ? LOCK_PREFIX : 0); |
| 1002 | U16 offset = lock == 2 ? 201 : 200; |
| 1003 | |
| 1004 | if (cpu->big) |
| 1005 | pushCode32(offset); |
| 1006 | else |
| 1007 | pushCode16(offset); |
| 1008 | memory->writed(cpu->seg[DS].address + offset, DEFAULT); |
| 1009 | memory->writew(cpu->seg[DS].address + offset, data->var1); |
| 1010 | runTestCPU(); |
| 1011 | result = memory->readw(cpu->seg[DS].address + offset); |
| 1012 | assertResult(data, cpu, instruction, result, 0, -1, -1, cpu->seg[DS].address + offset, 16); |
| 1013 | |
| 1014 | newInstructionWithRM(instruction, rm, data->flags, lock ? LOCK_PREFIX : 0); |
| 1015 | if (cpu->big) |
| 1016 | pushCode32(offset); |
| 1017 | else |
| 1018 | pushCode16(offset); |
| 1019 | |
| 1020 | // this will generate flags so the above code can ignore flag generation |
no test coverage detected