- Timestamp:
- 07/21/2017 01:24:57 AM (7 years ago)
- Branches:
- master
- Children:
- de65155
- Parents:
- 4c71d39
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
emu/cpu.c
r4c71d39 r9674f1a 262 262 if (addr <= APP_START - 2) { 263 263 return 264 ((uint32_t)ram_data[addr -0] << 8) |265 ((uint32_t)ram_data[addr -1] << 0);264 ((uint32_t)ram_data[addr + 0] << 8) | 265 ((uint32_t)ram_data[addr + 1] << 0); 266 266 } 267 267 … … 277 277 addr += ROM_START; 278 278 } 279 280 279 else if (addr == 4) { 281 280 addr += ROM_START; … … 439 438 } 440 439 440 static void inst_cb(void) 441 { 442 uint32_t pc = m68k_get_reg(NULL, M68K_REG_PC); 443 uint32_t op = m68k_read_memory_16(pc); 444 445 if (op == 0x4e4d) { 446 uint32_t sp = m68k_get_reg(NULL, M68K_REG_SP); 447 uint32_t fun = m68k_read_memory_16(sp); 448 449 switch (fun) { 450 case 1: 451 ver2("BIOS B_RDAV %u", m68k_read_memory_16(sp + 2)); 452 break; 453 454 case 2: 455 ver2("BIOS B_GETC %u", m68k_read_memory_16(sp + 2)); 456 break; 457 458 case 3: 459 ver2("BIOS B_PUTC %u %u", 460 m68k_read_memory_16(sp + 2), 461 m68k_read_memory_16(sp + 4)); 462 break; 463 464 case 4: 465 ver2("BIOS B_RDWR %u 0x%08x %u %u %u", 466 m68k_read_memory_16(sp + 2), 467 m68k_read_memory_32(sp + 4), 468 m68k_read_memory_16(sp + 8), 469 m68k_read_memory_16(sp + 10), 470 m68k_read_memory_16(sp + 12)); 471 break; 472 473 case 5: 474 ver2("BIOS B_SETV %u 0x%08x", 475 m68k_read_memory_16(sp + 2), 476 m68k_read_memory_32(sp + 4)); 477 break; 478 479 case 7: 480 ver2("BIOS B_GBPB %u", m68k_read_memory_16(sp + 2)); 481 break; 482 483 case 8: 484 ver2("BIOS B_THRE %u", m68k_read_memory_16(sp + 2)); 485 break; 486 487 case 9: 488 ver2("BIOS B_MCHG %u", m68k_read_memory_16(sp + 2)); 489 break; 490 491 case 10: 492 ver2("BIOS B_DMAP"); 493 break; 494 495 default: 496 fail("invalid function: BIOS %d", fun); 497 } 498 } 499 else if (op == 0x4e4e) { 500 uint32_t sp = m68k_get_reg(NULL, M68K_REG_SP); 501 uint32_t fun = m68k_read_memory_16(sp); 502 503 switch (fun) { 504 case 0: 505 ver2("XBIOS X_PIOREC %u", m68k_read_memory_16(sp + 2)); 506 break; 507 508 case 1: 509 ver2("XBIOS X_SETPRT %u 0x%02x 0x%02x 0x%02x 0x%02x", 510 m68k_read_memory_16(sp + 2), 511 m68k_read_memory_16(sp + 4), 512 m68k_read_memory_16(sp + 6), 513 m68k_read_memory_16(sp + 8), 514 m68k_read_memory_16(sp + 10)); 515 break; 516 517 case 2: 518 ver2("XBIOS X_FLOPRD 0x%08x 0x%08x %u %u %u %u %u", 519 m68k_read_memory_32(sp + 2), 520 m68k_read_memory_32(sp + 6), 521 m68k_read_memory_16(sp + 10), 522 m68k_read_memory_16(sp + 12), 523 m68k_read_memory_16(sp + 14), 524 m68k_read_memory_16(sp + 16), 525 m68k_read_memory_16(sp + 18)); 526 break; 527 528 case 3: 529 ver2("XBIOS X_FLOPWR 0x%08x 0x%08x %u %u %u %u %u", 530 m68k_read_memory_32(sp + 2), 531 m68k_read_memory_32(sp + 6), 532 m68k_read_memory_16(sp + 10), 533 m68k_read_memory_16(sp + 12), 534 m68k_read_memory_16(sp + 14), 535 m68k_read_memory_16(sp + 16), 536 m68k_read_memory_16(sp + 18)); 537 break; 538 539 case 4: 540 ver2("XBIOS X_FORMAT 0x%08x 0x%08x %u %u %u %u %u 0x%08x %u", 541 m68k_read_memory_32(sp + 2), 542 m68k_read_memory_32(sp + 6), 543 m68k_read_memory_16(sp + 10), 544 m68k_read_memory_16(sp + 12), 545 m68k_read_memory_16(sp + 14), 546 m68k_read_memory_16(sp + 16), 547 m68k_read_memory_16(sp + 18), 548 m68k_read_memory_32(sp + 20), 549 m68k_read_memory_16(sp + 24)); 550 break; 551 552 case 5: 553 ver2("XBIOS X_VERIFY 0x%08x 0x%08x %u %u %u %u %u", 554 m68k_read_memory_32(sp + 2), 555 m68k_read_memory_32(sp + 6), 556 m68k_read_memory_16(sp + 10), 557 m68k_read_memory_16(sp + 12), 558 m68k_read_memory_16(sp + 14), 559 m68k_read_memory_16(sp + 16), 560 m68k_read_memory_16(sp + 18)); 561 break; 562 563 case 6: 564 ver2("XBIOS X_PRBOOT 0x%08x %u %u %u", 565 m68k_read_memory_32(sp + 2), 566 m68k_read_memory_16(sp + 6), 567 m68k_read_memory_16(sp + 8), 568 m68k_read_memory_16(sp + 10)); 569 break; 570 571 case 7: 572 ver2("XBIOS X_RANDOM"); 573 break; 574 575 case 8: 576 ver2("XBIOS X_ANALOG"); 577 break; 578 579 case 9: 580 ver2("XBIOS X_CLRAFI"); 581 break; 582 583 case 10: 584 ver2("XBIOS X_APICHK"); 585 break; 586 587 case 11: 588 ver2("XBIOS X_MTDEFS "); 589 break; 590 591 default: 592 fail("invalid function: XBIOS %d", fun); 593 } 594 } 595 } 596 441 597 void cpu_loop(const char *bios) 442 598 { … … 447 603 m68k_init(); 448 604 m68k_set_cpu_type(M68K_CPU_TYPE_68000); 605 m68k_set_instr_hook_callback(inst_cb); 449 606 m68k_pulse_reset(); 450 607
Note:
See TracChangeset
for help on using the changeset viewer.