| 8472 | } |
| 8473 | |
| 8474 | void testJmpE16() { |
| 8475 | for (int i = 0; i < 8; i++) { |
| 8476 | U8 rm = i | (4 << 3) | 0xC0; |
| 8477 | |
| 8478 | newInstruction(0); |
| 8479 | memory->writed(cpu->seg[SS].address + 4092, DEFAULT); |
| 8480 | |
| 8481 | cpu->reg[0].u32 = 0x102; |
| 8482 | cpu->reg[i].u16 = 0x102; |
| 8483 | |
| 8484 | // call |
| 8485 | pushCode8(0xff); |
| 8486 | pushCode8(rm); |
| 8487 | |
| 8488 | for (int i = 0; i < 0x100; i++) { |
| 8489 | pushCode8(0xcd); |
| 8490 | } |
| 8491 | // will jump to here |
| 8492 | // add ax, 0x1 |
| 8493 | pushCode8(0x83); |
| 8494 | pushCode8(0xc0); |
| 8495 | pushCode8(0x1); |
| 8496 | |
| 8497 | runTestCPU(); |
| 8498 | |
| 8499 | assertTrue(AX == 0x103); |
| 8500 | if (i == 4) { |
| 8501 | assertTrue(SP == 0x102); |
| 8502 | } else { |
| 8503 | assertTrue(SP == 4096); |
| 8504 | } |
| 8505 | } |
| 8506 | |
| 8507 | U8 rm = (4 << 3); |
| 8508 | if (cpu->big) |
| 8509 | rm += 5; |
| 8510 | else |
| 8511 | rm += 6; |
| 8512 | newInstructionWithRM(0xff, rm, 0); |
| 8513 | pushCode16(200); |
| 8514 | |
| 8515 | for (int i = 0; i < 0x100; i++) { |
| 8516 | pushCode8(0xcd); |
| 8517 | } |
| 8518 | // call will jump to here |
| 8519 | // add ax, 0x1 |
| 8520 | pushCode8(0x83); |
| 8521 | pushCode8(0xc0); |
| 8522 | pushCode8(0x1); |
| 8523 | |
| 8524 | memory->writew(cpu->seg[DS].address + 200, 0x104); |
| 8525 | EAX = 0x10; |
| 8526 | runTestCPU(); |
| 8527 | |
| 8528 | assertTrue(AX == 0x11); |
| 8529 | assertTrue(SP == 4096); |
| 8530 | } |
| 8531 |
no test coverage detected