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

Function testJumpCmp

source/test/testCPU.cpp:5519–5551  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5517}
5518
5519void testJumpCmp(U8 instruction, U32 value1, U32 value2, bool jumped) {
5520 // cmp eax, value2
5521 newInstructionWithRM(0x81, 0xf9, 0);
5522 EAX = 0;
5523 ECX = value1;
5524 if (cpu->big) {
5525 pushCode32(value2);
5526 } else {
5527 pushCode16(value2);
5528 }
5529
5530 if (instruction > 0xFF) {
5531 pushCode8(0x0F);
5532 }
5533 pushCode8(instruction & 0xFF);
5534 pushCode8(2); // jmp over next add
5535
5536 // add al, 0x2
5537 pushCode8(0x04);
5538 pushCode8(0x02);
5539
5540 // add al, 0x3
5541 pushCode8(0x04);
5542 pushCode8(0x03);
5543
5544 runTestCPU();
5545
5546 if (jumped) {
5547 assertTrue(AL == 3);
5548 } else {
5549 assertTrue(AL == 5);
5550 }
5551}
5552
5553void testJO(U8 instruction) {
5554 testJ(instruction, OF, true);

Callers 14

testJOFunction · 0.85
testNJOFunction · 0.85
testJBFunction · 0.85
testNJBFunction · 0.85
testJZFunction · 0.85
testJNZFunction · 0.85
testJBEFunction · 0.85
testJNBEFunction · 0.85
testJSFunction · 0.85
testJNSFunction · 0.85
testJLFunction · 0.85
testJNLFunction · 0.85

Calls 6

newInstructionWithRMFunction · 0.85
pushCode32Function · 0.85
pushCode16Function · 0.85
pushCode8Function · 0.85
runTestCPUFunction · 0.85
assertTrueFunction · 0.85

Tested by

no test coverage detected