MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / Ed

Function Ed

source/test/testCPU.cpp:2019–2089  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2017}
2018
2019void Ed(int instruction, int which, struct Data* data, bool includeLock = false) {
2020 while (data->valid) {
2021 int ed;
2022 int rm;
2023 U32 result;
2024
2025 for (ed = 0; ed < 8; ed++) {
2026 Reg* reg;
2027
2028 rm = ed | (which << 3) | 0xC0;
2029 newInstructionWithRM(instruction, rm, data->flags);
2030 reg = &cpu->reg[ed];
2031 reg->u32 = data->var1;
2032 runTestCPU();
2033 assertResult(data, cpu, instruction, reg->u32, 0, ed, -1, 0, 32);
2034
2035 newInstructionWithRM(instruction, rm, data->flags);
2036
2037 // this will generate flags so the above code can ignore flag generation
2038 // cmp eax, 0
2039 pushCode8(0x83);
2040 pushCode8(0xf8);
2041 pushCode8(0);
2042
2043 reg = &cpu->reg[ed];
2044 reg->u32 = data->var1;
2045 runTestCPU();
2046 assertResult(data, cpu, instruction, reg->u32, 0, ed, -1, 0, 32, true);
2047 }
2048
2049 for (int lock = 0; lock < 3; lock++) {
2050 rm = (which << 3);
2051 if (cpu->big)
2052 rm += 5;
2053 else
2054 rm += 6;
2055 newInstructionWithRM(instruction, rm, data->flags, lock ? LOCK_PREFIX : 0);
2056 U16 addressOffset = lock == 2 ? 202 : 200;
2057
2058 if (cpu->big)
2059 pushCode32(addressOffset);
2060 else
2061 pushCode16(addressOffset);
2062 memory->writed(cpu->seg[DS].address + addressOffset, data->var1);
2063 runTestCPU();
2064 result = memory->readd(cpu->seg[DS].address + addressOffset);
2065 assertResult(data, cpu, instruction, result, 0, -1, -1, cpu->seg[DS].address + addressOffset, 32);
2066
2067 newInstructionWithRM(instruction, rm, data->flags, lock ? LOCK_PREFIX : 0);
2068 if (cpu->big)
2069 pushCode32(addressOffset);
2070 else
2071 pushCode16(addressOffset);
2072
2073 // this will generate flags so the above code can ignore flag generation
2074 // cmp eax, 0
2075 pushCode8(0x83);
2076 pushCode8(0xf8);

Callers 3

testGrp20x2d1Function · 0.85
testGrp30x2f7Function · 0.85
testGrp50x2ffFunction · 0.85

Calls 8

newInstructionWithRMFunction · 0.85
runTestCPUFunction · 0.85
assertResultFunction · 0.85
pushCode8Function · 0.85
pushCode32Function · 0.85
pushCode16Function · 0.85
writedMethod · 0.45
readdMethod · 0.45

Tested by

no test coverage detected