simple decode copper by Mark Cox */
| 3431 | |
| 3432 | /* simple decode copper by Mark Cox */ |
| 3433 | static uaecptr decode_copper_insn(FILE *file, uae_u16 mword1, uae_u16 mword2, uaecptr addr) |
| 3434 | { |
| 3435 | struct cop_rec *cr = NULL; |
| 3436 | uae_u32 insn_type, insn; |
| 3437 | TCHAR here = ' '; |
| 3438 | TCHAR record[] = _T(" "); |
| 3439 | |
| 3440 | if ((cr = find_copper_records(addr))) { |
| 3441 | _sntprintf(record, sizeof record, _T(" [%03x %03x]"), cr->vpos, cr->hpos); |
| 3442 | insn = (cr->w1 << 16) | cr->w2; |
| 3443 | } else { |
| 3444 | insn = (mword1 << 16) | mword2; |
| 3445 | } |
| 3446 | |
| 3447 | insn_type = insn & 0x00010001; |
| 3448 | |
| 3449 | if (get_copper_address(-1) >= addr && get_copper_address(-1) <= addr + 3) |
| 3450 | here = '*'; |
| 3451 | |
| 3452 | console_out_f (_T("%c%08x: %04x %04x%s\t;%c "), here, addr, insn >> 16, insn & 0xFFFF, record, insn != ((mword1 << 16) | mword2) ? '!' : ' '); |
| 3453 | |
| 3454 | switch (insn_type) { |
| 3455 | case 0x00010000: /* WAIT insn */ |
| 3456 | console_out(_T("Wait for ")); |
| 3457 | disassemble_wait(file, insn); |
| 3458 | |
| 3459 | if (insn == 0xfffffffe) |
| 3460 | console_out(_T(" \t; End of Copperlist\n")); |
| 3461 | |
| 3462 | break; |
| 3463 | |
| 3464 | case 0x00010001: /* SKIP insn */ |
| 3465 | console_out(_T("Skip if ")); |
| 3466 | disassemble_wait(file, insn); |
| 3467 | break; |
| 3468 | |
| 3469 | case 0x00000000: |
| 3470 | case 0x00000001: /* MOVE insn */ |
| 3471 | { |
| 3472 | int addr = (insn >> 16) & 0x1fe; |
| 3473 | int i = 0; |
| 3474 | while (custd[i].name) { |
| 3475 | if (custd[i].adr == addr + 0xdff000) |
| 3476 | break; |
| 3477 | i++; |
| 3478 | } |
| 3479 | if (custd[i].name && custd[i].name[0] && _tcscmp(custd[i].name, _T("-"))) { |
| 3480 | console_out_f(_T("%s := 0x%04x\n"), custd[i].name, insn & 0xffff); |
| 3481 | } else { |
| 3482 | console_out_f(_T("%04x := 0x%04x\n"), addr, insn & 0xffff); |
| 3483 | } |
| 3484 | } |
| 3485 | break; |
| 3486 | |
| 3487 | default: |
| 3488 | abort (); |
| 3489 | } |
| 3490 |
no test coverage detected