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

Function testJmpE32

source/test/testCPU.cpp:8532–8588  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8530}
8531
8532void testJmpE32() {
8533 for (int i = 0; i < 8; i++) {
8534 U8 rm = i | (4 << 3) | 0xC0;
8535
8536 newInstruction(0);
8537 memory->writed(cpu->seg[SS].address + 4092, DEFAULT);
8538
8539 cpu->reg[0].u32 = 0x104;
8540 cpu->reg[i].u32 = 0x104;
8541
8542 // call
8543 pushCode8(0xff);
8544 pushCode8(rm);
8545
8546 for (int i = 0; i < 0x102; i++) {
8547 pushCode8(0xcd);
8548 }
8549 // call will jump to here
8550 // add ax, 0x1
8551 pushCode8(0x83);
8552 pushCode8(0xc0);
8553 pushCode8(0x1);
8554
8555 runTestCPU();
8556
8557 assertTrue(EAX == 0x105);
8558 if (i == 4) {
8559 assertTrue(ESP == 0x104);
8560 } else {
8561 assertTrue(SP == 4096);
8562 }
8563 }
8564
8565 U8 rm = (4 << 3);
8566 if (cpu->big)
8567 rm += 5;
8568 else
8569 rm += 6;
8570 newInstructionWithRM(0xff, rm, 0);
8571 pushCode32(200);
8572
8573 for (int i = 0; i < 0x100; i++) {
8574 pushCode8(0xcd);
8575 }
8576 // call will jump to here
8577 // add ax, 0x1
8578 pushCode8(0x83);
8579 pushCode8(0xc0);
8580 pushCode8(0x1);
8581
8582 memory->writed(cpu->seg[DS].address + 200, 0x106);
8583 EAX = 0x10;
8584 runTestCPU();
8585
8586 assertTrue(EAX == 0x11);
8587 assertTrue(ESP == 4096);
8588}
8589

Callers 1

testGrp50x2ffFunction · 0.85

Calls 7

newInstructionFunction · 0.85
pushCode8Function · 0.85
runTestCPUFunction · 0.85
assertTrueFunction · 0.85
newInstructionWithRMFunction · 0.85
pushCode32Function · 0.85
writedMethod · 0.45

Tested by

no test coverage detected