| 529 | bool break_on_unlogged_data = false; |
| 530 | |
| 531 | void LogCDData(uint8 *opcode, uint16 A, int size) |
| 532 | { |
| 533 | int i, j; |
| 534 | uint8 memop = 0; |
| 535 | bool newCodeHit = false, newDataHit = false; |
| 536 | |
| 537 | if ((j = GetPRGAddress(_PC)) != -1) |
| 538 | { |
| 539 | for (i = 0; i < size; i++) |
| 540 | { |
| 541 | if (cdloggerdata[j+i] & 1) continue; //this has been logged so skip |
| 542 | cdloggerdata[j+i] |= 1; |
| 543 | cdloggerdata[j+i] |= ((_PC + i) >> 11) & 0x0c; |
| 544 | cdloggerdata[j+i] |= ((_PC & 0x8000) >> 8) ^ 0x80; // 19/07/14 used last reserved bit, if bit 7 is 1, then code is running from lowe area (6000) |
| 545 | if (indirectnext)cdloggerdata[j+i] |= 0x10; |
| 546 | codecount++; |
| 547 | if (!(cdloggerdata[j+i] & 2))undefinedcount--; |
| 548 | newCodeHit = true; |
| 549 | } |
| 550 | } |
| 551 | |
| 552 | //log instruction jumped to in an indirect jump |
| 553 | if(opcode[0] == 0x6c) |
| 554 | indirectnext = 1; |
| 555 | else |
| 556 | indirectnext = 0; |
| 557 | |
| 558 | switch (optype[opcode[0]]) { |
| 559 | case 1: |
| 560 | case 4: memop = 0x20; break; |
| 561 | } |
| 562 | |
| 563 | if (((j = GetPRGAddress(A)) != -1) && (opcode[0] != 0x4C) && (opcode[0] != 0x6C)) |
| 564 | { |
| 565 | if (opwrite[opcode[0]] == 0) |
| 566 | { |
| 567 | if (!(cdloggerdata[j] & 2)) |
| 568 | { |
| 569 | cdloggerdata[j] |= 2; |
| 570 | cdloggerdata[j] |= (A >> 11) & 0x0c; |
| 571 | cdloggerdata[j] |= memop; |
| 572 | cdloggerdata[j] |= ((A & 0x8000) >> 8) ^ 0x80; |
| 573 | datacount++; |
| 574 | if (!(cdloggerdata[j] & 1))undefinedcount--; |
| 575 | newDataHit = true; |
| 576 | } |
| 577 | } |
| 578 | // Unclear why the write destination's access types gets reset for FDS... |
| 579 | // See: |
| 580 | // - https://github.com/TASEmulators/fceux/commit/a4fa6225a04b5ab8d3dfca3fc9abd7190bceec85 |
| 581 | // - https://github.com/TASEmulators/fceux/commit/b10b6254c3d5c9519a85cb4382cdb22846d2e394 |
| 582 | // - https://github.com/TASEmulators/fceux/commit/67942accc72149ae028d58f36419b64ea8651db9?diff=unified&w=1 |
| 583 | else if(GameInfo && GameInfo->type == GIT_FDS) |
| 584 | { |
| 585 | if (cdloggerdata[j] & 1) |
| 586 | { |
| 587 | codecount--; |
| 588 | } |
no test coverage detected