| 5517 | } |
| 5518 | |
| 5519 | void 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 | |
| 5553 | void testJO(U8 instruction) { |
| 5554 | testJ(instruction, OF, true); |
no test coverage detected