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

Function testCallE16

source/test/testCPU.cpp:8281–8340  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8279}
8280
8281void testCallE16() {
8282 for (int i = 0; i < 8; i++) {
8283 U8 rm = i | (2 << 3) | 0xC0;
8284
8285 newInstruction(0);
8286 memory->writed(cpu->seg[SS].address + 4092, DEFAULT);
8287
8288 cpu->reg[0].u32 = 0x102;
8289 cpu->reg[i].u16 = 0x102;
8290
8291 // call
8292 pushCode8(0xff);
8293 pushCode8(rm);
8294
8295 for (int i = 0; i < 0x100; i++) {
8296 pushCode8(0xcd);
8297 }
8298 // call will jump to here
8299 // add ax, 0x1
8300 pushCode8(0x83);
8301 pushCode8(0xc0);
8302 pushCode8(0x1);
8303
8304 runTestCPU();
8305
8306 assertTrue(AX == 0x103);
8307 if (i == 4) {
8308 assertTrue(memory->readw(cpu->seg[SS].address + 0x100) == 0x2); // eip after calljw
8309 assertTrue(SP == 0x100);
8310 } else {
8311 assertTrue(memory->readw(cpu->seg[SS].address + 4094) == 0x2); // eip after calljw
8312 assertTrue(SP == 4094);
8313 }
8314 }
8315
8316 U8 rm = (2 << 3);
8317 if (cpu->big)
8318 rm += 5;
8319 else
8320 rm += 6;
8321 newInstructionWithRM(0xff, rm, 0);
8322 pushCode16(200);
8323
8324 for (int i = 0; i < 0x100; i++) {
8325 pushCode8(0xcd);
8326 }
8327 // call will jump to here
8328 // add ax, 0x1
8329 pushCode8(0x83);
8330 pushCode8(0xc0);
8331 pushCode8(0x1);
8332
8333 memory->writew(cpu->seg[DS].address + 200, 0x104);
8334 EAX = 0x10;
8335 runTestCPU();
8336
8337 assertTrue(AX == 0x11);
8338 assertTrue(memory->readw(cpu->seg[SS].address + 4094) == 0x4); // eip after calljw

Callers 1

testGrp50x0ffFunction · 0.85

Calls 9

newInstructionFunction · 0.85
pushCode8Function · 0.85
runTestCPUFunction · 0.85
assertTrueFunction · 0.85
newInstructionWithRMFunction · 0.85
pushCode16Function · 0.85
writedMethod · 0.45
readwMethod · 0.45
writewMethod · 0.45

Tested by

no test coverage detected