mirror of
https://github.com/mamedev/mame.git
synced 2024-11-16 07:48:32 +01:00
cpu/m68000: Stub out the Coprocesor Interface Registers found on '010-'030 so that Mac ROMs can detect if an FPU is present. [R. Belmont]
This commit is contained in:
parent
8ef27214fa
commit
15b7c421dd
3 changed files with 91 additions and 0 deletions
|
@ -656,6 +656,16 @@ inline u32 m68ki_read_8_fc(u32 address, u32 fc)
|
|||
m_mmu_tmp_fc = fc;
|
||||
m_mmu_tmp_rw = 1;
|
||||
m_mmu_tmp_sz = M68K_SZ_BYTE;
|
||||
// Check for reading the FPU's CIRs if this is an '020 or '030.
|
||||
// In CPU space (FC 7), addresses 0x0002xxxx are coprocessor interface registers.
|
||||
// Bits 15-13 are the coprocessor ID, and bits 0-4 are the register select.
|
||||
if ((fc == 7) && CPU_TYPE_IS_020_PLUS() && !CPU_TYPE_IS_040_PLUS())
|
||||
{
|
||||
if ((address & 0xffffeff0) == 0x00022000)
|
||||
{
|
||||
return m6888x_read_cir(address);
|
||||
}
|
||||
}
|
||||
return m_read8(address);
|
||||
}
|
||||
inline u32 m68ki_read_16_fc(u32 address, u32 fc)
|
||||
|
@ -667,6 +677,13 @@ inline u32 m68ki_read_16_fc(u32 address, u32 fc)
|
|||
m_mmu_tmp_fc = fc;
|
||||
m_mmu_tmp_rw = 1;
|
||||
m_mmu_tmp_sz = M68K_SZ_WORD;
|
||||
if ((fc == 7) && CPU_TYPE_IS_020_PLUS() && !CPU_TYPE_IS_040_PLUS())
|
||||
{
|
||||
if ((address & 0xffffeff0) == 0x00022000)
|
||||
{
|
||||
return m6888x_read_cir(address);
|
||||
}
|
||||
}
|
||||
return m_read16(address);
|
||||
}
|
||||
inline u32 m68ki_read_32_fc(u32 address, u32 fc)
|
||||
|
@ -678,6 +695,13 @@ inline u32 m68ki_read_32_fc(u32 address, u32 fc)
|
|||
m_mmu_tmp_fc = fc;
|
||||
m_mmu_tmp_rw = 1;
|
||||
m_mmu_tmp_sz = M68K_SZ_LONG;
|
||||
if ((fc == 7) && CPU_TYPE_IS_020_PLUS() && !CPU_TYPE_IS_040_PLUS())
|
||||
{
|
||||
if ((address & 0xffffeff0) == 0x00022000)
|
||||
{
|
||||
return m6888x_read_cir(address);
|
||||
}
|
||||
}
|
||||
return m_read32(address);
|
||||
}
|
||||
|
||||
|
@ -686,6 +710,14 @@ inline void m68ki_write_8_fc(u32 address, u32 fc, u32 value)
|
|||
m_mmu_tmp_fc = fc;
|
||||
m_mmu_tmp_rw = 0;
|
||||
m_mmu_tmp_sz = M68K_SZ_BYTE;
|
||||
if ((fc == 7) && CPU_TYPE_IS_020_PLUS() && !CPU_TYPE_IS_040_PLUS())
|
||||
{
|
||||
if ((address & 0xffffeff0) == 0x00022000)
|
||||
{
|
||||
m6888x_write_cir(address, value);
|
||||
return;
|
||||
}
|
||||
}
|
||||
m_write8(address, value);
|
||||
}
|
||||
inline void m68ki_write_16_fc(u32 address, u32 fc, u32 value)
|
||||
|
@ -697,6 +729,14 @@ inline void m68ki_write_16_fc(u32 address, u32 fc, u32 value)
|
|||
m_mmu_tmp_fc = fc;
|
||||
m_mmu_tmp_rw = 0;
|
||||
m_mmu_tmp_sz = M68K_SZ_WORD;
|
||||
if ((fc == 7) && CPU_TYPE_IS_020_PLUS() && !CPU_TYPE_IS_040_PLUS())
|
||||
{
|
||||
if ((address & 0xffffeff0) == 0x00022000)
|
||||
{
|
||||
m6888x_write_cir(address, value);
|
||||
return;
|
||||
}
|
||||
}
|
||||
m_write16(address, value);
|
||||
}
|
||||
inline void m68ki_write_32_fc(u32 address, u32 fc, u32 value)
|
||||
|
@ -708,6 +748,14 @@ inline void m68ki_write_32_fc(u32 address, u32 fc, u32 value)
|
|||
m_mmu_tmp_fc = fc;
|
||||
m_mmu_tmp_rw = 0;
|
||||
m_mmu_tmp_sz = M68K_SZ_LONG;
|
||||
if ((fc == 7) && CPU_TYPE_IS_020_PLUS() && !CPU_TYPE_IS_040_PLUS())
|
||||
{
|
||||
if ((address & 0xffffeff0) == 0x00022000)
|
||||
{
|
||||
m6888x_write_cir(address, value);
|
||||
return;
|
||||
}
|
||||
}
|
||||
m_write32(address, value);
|
||||
}
|
||||
|
||||
|
|
|
@ -2548,3 +2548,44 @@ void m68000_musashi_device::m68881_ftrap()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Read the FPU's Coprocessor Interface Registers (CIRs).
|
||||
// References: MC68881/68882 Coprocessor User's Manual 1st Edition,
|
||||
// pages 7-1 to 7-8 and M68030 User's Manual 3rd Edition page 7-69.
|
||||
u32 m68000_musashi_device::m6888x_read_cir(offs_t offset)
|
||||
{
|
||||
// If no FPU is present, reading any CIRs causes a bus error.
|
||||
// Pre-1992 Macintosh ROMs use this method to detect the presence
|
||||
// of an FPU. 1992 and later ROMs just execute FNOP and check for
|
||||
// an F-line trap, because this mechanism does not exist on the 68040.
|
||||
if (!m_has_fpu)
|
||||
{
|
||||
m68k_cause_bus_error();
|
||||
}
|
||||
|
||||
// TODO: actually try to return meaningful values?
|
||||
// offset function
|
||||
// 0x00 Response read-only 16 bit (value in D31-D16)
|
||||
// 0x02 Control write-only 16
|
||||
// 0x04 Save read 16
|
||||
// 0x06 Restore read/write 16
|
||||
// 0x08 Operation Word read/write 16
|
||||
// 0x0a Command write-only 16
|
||||
// 0x0c (reserved) N/A 16
|
||||
// 0x0e Condition write-only 16
|
||||
// 0x10 Operand read/write 32 bit
|
||||
// 0x14 Register Select read-only 16
|
||||
// 0x18 Instruction Address write-only 32
|
||||
// 0x1c Operand Address read/write 32
|
||||
return 0;
|
||||
}
|
||||
|
||||
void m68000_musashi_device::m6888x_write_cir(offs_t offset, u32 data)
|
||||
{
|
||||
if (!m_has_fpu)
|
||||
{
|
||||
m68k_cause_bus_error();
|
||||
}
|
||||
|
||||
// TODO: actually do something with these values?
|
||||
}
|
||||
|
|
|
@ -378,6 +378,8 @@ protected:
|
|||
void m68040_do_frestore(u32 addr, int reg);
|
||||
void m68040_fpu_op1();
|
||||
void m68881_ftrap();
|
||||
u32 m6888x_read_cir(offs_t offset);
|
||||
void m6888x_write_cir(offs_t offset, u32 data);
|
||||
};
|
||||
|
||||
#endif // MAME_CPU_M68000_M68KMUSASHI_H
|
||||
|
|
Loading…
Reference in a new issue