trunk/src/emu/cpu/m68000/m68kcpu.h
| r243583 | r243584 | |
| 683 | 683 | |
| 684 | 684 | INLINE UINT32 m68ki_ic_readimm16(m68000_base_device *m68k, UINT32 address) |
| 685 | 685 | { |
| 686 | | /* if(CPU_TYPE_IS_EC020_PLUS(m68k->cpu_type) && (m68k->cacr & M68K_CACR_EI)) |
| 687 | | { |
| 688 | | UINT32 ic_offset = (address >> 1) % M68K_IC_SIZE; |
| 689 | | if (m68k->ic_address[ic_offset] == address) |
| 690 | | { |
| 691 | | return m68k->ic_data[ic_offset]; |
| 692 | | } |
| 693 | | else |
| 694 | | { |
| 695 | | UINT32 data = m68k->memory.readimm16(address); |
| 696 | | if (!m68k->mmu_tmp_buserror_occurred) |
| 697 | | { |
| 698 | | m68k->ic_data[ic_offset] = data; |
| 699 | | m68k->ic_address[ic_offset] = address; |
| 700 | | } |
| 701 | | return data; |
| 702 | | } |
| 703 | | } |
| 704 | | else*/ |
| 686 | if (m68k->cacr & M68K_CACR_EI) |
| 705 | 687 | { |
| 706 | | return m68k->/*memory.*/readimm16(address); |
| 688 | // 68020 series I-cache (MC68020 User's Manual, Section 4 - On-Chip Cache Memory) |
| 689 | if (m68k->cpu_type & (CPU_TYPE_EC020 | CPU_TYPE_020)) |
| 690 | { |
| 691 | UINT32 tag = (address >> 8) | (m68k->s_flag ? 0x1000000 : 0); |
| 692 | int idx = (address >> 2) & 0x3f; // 1-of-64 select |
| 693 | |
| 694 | // do a cache fill if the line is invalid or the tags don't match |
| 695 | if ((!m68k->ic_valid[idx]) || (m68k->ic_address[idx] != tag)) |
| 696 | { |
| 697 | m68k->ic_data[idx] = m68k->read32(address & ~3); |
| 698 | |
| 699 | // printf("m68k: doing cache fill at %08x (tag %08x idx %d)\n", address, tag, idx); |
| 700 | |
| 701 | // if no buserror occured, validate the tag |
| 702 | if (!m68k->mmu_tmp_buserror_occurred) |
| 703 | { |
| 704 | m68k->ic_address[idx] = tag; |
| 705 | m68k->ic_valid[idx] = true; |
| 706 | } |
| 707 | else |
| 708 | { |
| 709 | return m68k->readimm16(address); |
| 710 | } |
| 711 | } |
| 712 | |
| 713 | // at this point, the cache is guaranteed to be valid, either as |
| 714 | // a hit or because we just filled it. |
| 715 | if (address & 2) |
| 716 | { |
| 717 | return m68k->ic_data[idx] & 0xffff; |
| 718 | } |
| 719 | else |
| 720 | { |
| 721 | return m68k->ic_data[idx] >> 16; |
| 722 | } |
| 723 | } |
| 707 | 724 | } |
| 708 | 725 | |
| 709 | | // this can't happen, but Apple GCC insists |
| 710 | | // return 0; |
| 726 | return m68k->readimm16(address); |
| 711 | 727 | } |
| 712 | 728 | |
| 713 | 729 | /* Handles all immediate reads, does address error check, function code setting, |