diff options
Diffstat (limited to 'src/emu')
-rw-r--r-- | src/emu/cpu/cpu.mak | 10 | ||||
-rw-r--r-- | src/emu/cpu/m68000/m68000.h | 88 | ||||
-rw-r--r-- | src/emu/cpu/m68000/m68kcpu.c | 294 | ||||
-rw-r--r-- | src/emu/machine/68307.c | 300 | ||||
-rw-r--r-- | src/emu/machine/68307.h | 99 | ||||
-rw-r--r-- | src/emu/machine/68307bus.c (renamed from src/emu/cpu/m68000/68307bus.c) | 10 | ||||
-rw-r--r-- | src/emu/machine/68307bus.h (renamed from src/emu/cpu/m68000/68307bus.h) | 2 | ||||
-rw-r--r-- | src/emu/machine/68307ser.c (renamed from src/emu/cpu/m68000/68307ser.c) | 10 | ||||
-rw-r--r-- | src/emu/machine/68307ser.h (renamed from src/emu/cpu/m68000/68307ser.h) | 2 | ||||
-rw-r--r-- | src/emu/machine/68307sim.c (renamed from src/emu/cpu/m68000/68307sim.c) | 18 | ||||
-rw-r--r-- | src/emu/machine/68307sim.h (renamed from src/emu/cpu/m68000/68307sim.h) | 12 | ||||
-rw-r--r-- | src/emu/machine/68307tmu.c (renamed from src/emu/cpu/m68000/68307tmu.c) | 18 | ||||
-rw-r--r-- | src/emu/machine/68307tmu.h (renamed from src/emu/cpu/m68000/68307tmu.h) | 8 | ||||
-rw-r--r-- | src/emu/machine/machine.mak | 13 |
14 files changed, 479 insertions, 405 deletions
diff --git a/src/emu/cpu/cpu.mak b/src/emu/cpu/cpu.mak index 6dbf90e3cb1..5eb505b68e4 100644 --- a/src/emu/cpu/cpu.mak +++ b/src/emu/cpu/cpu.mak @@ -1354,10 +1354,6 @@ $(CPUOBJ)/mc68hc11/mc68hc11.o: $(CPUSRC)/mc68hc11/mc68hc11.c \ ifneq ($(filter M680X0,$(CPUS)),) OBJDIRS += $(CPUOBJ)/m68000 CPUOBJS += $(CPUOBJ)/m68000/m68kcpu.o $(CPUOBJ)/m68000/m68kops.o \ - $(CPUOBJ)/m68000/68307sim.o \ - $(CPUOBJ)/m68000/68307bus.o \ - $(CPUOBJ)/m68000/68307ser.o \ - $(CPUOBJ)/m68000/68307tmu.o \ $(CPUOBJ)/m68000/68340sim.o \ $(CPUOBJ)/m68000/68340dma.o \ $(CPUOBJ)/m68000/68340ser.o \ @@ -1400,12 +1396,10 @@ $(CPUOBJ)/m68000/m68kcpu.o: $(CPUOBJ)/m68000/m68kops.c \ # m68kcpu.h now includes m68kops.h; m68kops.h won't exist until m68kops.c has been made $(CPUSRC)/m68000/m68kcpu.h: $(CPUOBJ)/m68000/m68kops.c -$(CPUSRC)/m68000/68307sim.c: $(CPUOBJ)/m68000/m68kops.c -$(CPUSRC)/m68000/68307bus.c: $(CPUOBJ)/m68000/m68kops.c -$(CPUSRC)/m68000/68307ser.c: $(CPUOBJ)/m68000/m68kops.c -$(CPUSRC)/m68000/68307tmu.c: $(CPUOBJ)/m68000/m68kops.c $(CPUSRC)/m68000/68340sim.c: $(CPUOBJ)/m68000/m68kops.c + $(CPUSRC)/m68000/68340dma.c: $(CPUOBJ)/m68000/m68kops.c + $(CPUSRC)/m68000/68340ser.c: $(CPUOBJ)/m68000/m68kops.c $(CPUSRC)/m68000/68340tmu.c: $(CPUOBJ)/m68000/m68kops.c diff --git a/src/emu/cpu/m68000/m68000.h b/src/emu/cpu/m68000/m68000.h index b19319a8ecd..379093b6d84 100644 --- a/src/emu/cpu/m68000/m68000.h +++ b/src/emu/cpu/m68000/m68000.h @@ -4,10 +4,6 @@ #define __M68000_H__ -#include "68307sim.h" -#include "68307bus.h" -#include "68307ser.h" -#include "68307tmu.h" #include "68340sim.h" #include "68340dma.h" @@ -125,18 +121,17 @@ typedef void (*m68k_cmpild_func)(device_t *device, UINT32 data, UINT8 reg); typedef void (*m68k_rte_func)(device_t *device); typedef int (*m68k_tas_func)(device_t *device); -typedef UINT8 (*m68307_porta_read_callback)(address_space &space, bool dedicated, UINT8 line_mask); -typedef void (*m68307_porta_write_callback)(address_space &space, bool dedicated, UINT8 data, UINT8 line_mask); -typedef UINT16 (*m68307_portb_read_callback)(address_space &space, bool dedicated, UINT16 line_mask); -typedef void (*m68307_portb_write_callback)(address_space &space, bool dedicated, UINT16 data, UINT16 line_mask); unsigned int m68k_disassemble_raw(char* str_buff, unsigned int pc, const unsigned char* opdata, const unsigned char* argdata, unsigned int cpu_type); +class m68000_base_device; +extern UINT16 m68340_get_cs(m68000_base_device *device, offs_t address); + typedef int (*instruction_hook_t)(m68000_base_device *device, offs_t curpc); @@ -287,7 +282,6 @@ public: public: void init8(address_space &space); void init16(address_space &space); - void init16_m68307(address_space &space); void init32(address_space &space); void init32mmu(address_space &space); void init32hmmu(address_space &space); @@ -306,13 +300,6 @@ public: UINT16 read_immediate_16(offs_t address); UINT16 simple_read_immediate_16(offs_t address); - UINT16 simple_read_immediate_16_m68307(offs_t address); - UINT8 read_byte_m68307(offs_t address); - UINT16 read_word_m68307(offs_t address); - UINT32 read_dword_m68307(offs_t address); - void write_byte_m68307(offs_t address, UINT8 data); - void write_word_m68307(offs_t address, UINT16 data); - void write_dword_m68307(offs_t address, UINT32 data); UINT8 read_byte_32_mmu(offs_t address); void write_byte_32_mmu(offs_t address, UINT8 data); @@ -330,13 +317,15 @@ public: UINT32 readlong_d32_hmmu(offs_t address); void writelong_d32_hmmu(offs_t address, UINT32 data); - address_space *m_space; - direct_read_data *m_direct; // m68000_base_device *m_cpustate; // }; public: // m68k_memory_interface memory; + + address_space *m_space; + direct_read_data *m_direct; + offs_t encrypted_start; offs_t encrypted_end; @@ -371,17 +360,8 @@ public: UINT32 ic_address[M68K_IC_SIZE]; /* instruction cache address data */ UINT16 ic_data[M68K_IC_SIZE]; /* instruction cache content data */ - /* 68307 peripheral modules */ - m68307_sim* m68307SIM; - m68307_mbus* m68307MBUS; - m68307_serial* m68307SERIAL; - m68307_timer* m68307TIMER; - UINT16 m68307_base; - UINT16 m68307_scrhigh; - UINT16 m68307_scrlow; - - int m68307_currentcs; + int m68340_currentcs; /* 68340 peripheral modules */ m68340_sim* m68340SIM; @@ -392,16 +372,6 @@ public: UINT32 m68340_base; - DECLARE_READ16_MEMBER( m68307_internal_base_r ); - DECLARE_WRITE16_MEMBER( m68307_internal_base_w ); - DECLARE_READ16_MEMBER( m68307_internal_timer_r ); - DECLARE_WRITE16_MEMBER( m68307_internal_timer_w ); - DECLARE_READ16_MEMBER( m68307_internal_sim_r ); - DECLARE_WRITE16_MEMBER( m68307_internal_sim_w ); - DECLARE_READ8_MEMBER( m68307_internal_serial_r ); - DECLARE_WRITE8_MEMBER( m68307_internal_serial_w ); - DECLARE_READ8_MEMBER( m68307_internal_mbus_r ); - DECLARE_WRITE8_MEMBER( m68307_internal_mbus_w ); READ32_MEMBER( m68340_internal_base_r ); WRITE32_MEMBER( m68340_internal_base_w ); @@ -419,15 +389,9 @@ public: WRITE32_MEMBER( m68340_internal_timer_w ); - /* 68308 / 68340 internal address map */ + /* 68307 / 68340 internal address map */ address_space *internal; - /* callbacks for internal ports */ - m68307_porta_read_callback m_m68307_porta_r; - m68307_porta_write_callback m_m68307_porta_w; - m68307_portb_read_callback m_m68307_portb_r; - m68307_portb_write_callback m_m68307_portb_w; - /* external instruction hook (does not depend on debug mode) */ @@ -437,7 +401,6 @@ public: void init_cpu_common(void); void init_cpu_m68000(void); - void init_cpu_m68307(void); void init_cpu_m68008(void); void init_cpu_m68010(void); void init_cpu_m68020(void); @@ -476,6 +439,11 @@ public: // construction/destruction m68000_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + m68000_device(const machine_config &mconfig, const char *name, const char *tag, device_t *owner, UINT32 clock, + const device_type type, UINT32 prg_data_width, UINT32 prg_address_bits, address_map_constructor internal_map, const char *shortname, const char *source); + + + virtual UINT32 disasm_min_opcode_bytes() const { return 2; }; virtual UINT32 disasm_max_opcode_bytes() const { return 10; }; virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options); @@ -511,25 +479,7 @@ protected: }; -class m68307_device : public m68000_base_device -{ -public: - // construction/destruction - m68307_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - virtual UINT32 disasm_min_opcode_bytes() const { return 2; }; - virtual UINT32 disasm_max_opcode_bytes() const { return 10; }; - virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options); - - virtual UINT32 execute_min_cycles() const { return 4; }; - virtual UINT32 execute_max_cycles() const { return 158; }; - - virtual UINT32 execute_default_irq_vector() const { return -1; }; - - // device-level overrides - virtual void device_start(); -protected: -}; class m68008_device : public m68000_base_device { @@ -842,7 +792,6 @@ protected: extern const device_type M68000; extern const device_type M68301; -extern const device_type M68307; extern const device_type M68008; extern const device_type M68008PLCC; extern const device_type M68010; @@ -864,15 +813,6 @@ extern void m68k_set_cmpild_callback(m68000_base_device *device, m68k_cmpild_fun extern void m68k_set_rte_callback(m68000_base_device *device, m68k_rte_func callback); extern void m68k_set_tas_callback(m68000_base_device *device, m68k_tas_func callback); extern UINT16 m68k_get_fc(m68000_base_device *device); -extern void m68307_set_port_callbacks(m68000_base_device *device, m68307_porta_read_callback porta_r, m68307_porta_write_callback porta_w, m68307_portb_read_callback portb_r, m68307_portb_write_callback portb_w); -extern void m68307_set_duart68681(m68000_base_device* cpudev, device_t* duart68681); -extern UINT16 m68307_get_cs(m68000_base_device *device, offs_t address); -extern UINT16 m68340_get_cs(m68000_base_device *device, offs_t address); -extern void m68307_timer0_interrupt(m68000_base_device *cpudev); -extern void m68307_timer1_interrupt(m68000_base_device *cpudev); -extern void m68307_serial_interrupt(m68000_base_device *cpudev, int vector); -extern void m68307_mbus_interrupt(m68000_base_device *cpudev); -extern void m68307_licr2_interrupt(m68000_base_device *cpudev); extern void m68k_set_encrypted_opcode_range(m68000_base_device *device, offs_t start, offs_t end); extern void m68k_set_hmmu_enable(m68000_base_device *device, int enable); extern void m68k_set_instruction_hook(m68000_base_device *device, instruction_hook_t ihook); diff --git a/src/emu/cpu/m68000/m68kcpu.c b/src/emu/cpu/m68000/m68kcpu.c index 54f78c391ec..61d3ff52671 100644 --- a/src/emu/cpu/m68000/m68kcpu.c +++ b/src/emu/cpu/m68000/m68kcpu.c @@ -1008,14 +1008,7 @@ void m68000_base_device::reset_cpu(void) // disable instruction hook instruction_hook = NULL; - if (m68307SIM) m68307SIM->reset(); - if (m68307MBUS) m68307MBUS->reset(); - if (m68307SERIAL) m68307SERIAL->reset(); - if (m68307TIMER) m68307TIMER->reset(); - m68307_base = 0xbfff; - m68307_scrhigh = 0x0007; - m68307_scrlow = 0xf010; } @@ -1235,26 +1228,6 @@ void m68000_base_device::init16(address_space &space) write32 = m68k_write32_delegate(FUNC(address_space::write_dword), &space); } -/* todo: is it possible to calculate the address map based on CS when they change - and install handlers? Going through this logic for every memory access is - very slow */ - -int m68307_calc_cs(m68000_base_device *m68k, offs_t address) -{ - m68307_sim* sim = m68k->m68307SIM; - - for (int i=0;i<4;i++) - { - int br,amask,bra; - br = sim->m_br[i] & 1; - amask = ((sim->m_or[i]&0x1ffc)<<11); - bra = ((sim->m_br[i] & 0x1ffc)<<11); - if ((br) && ((address & amask) == bra)) return i+1; - } - return 0; -} - -/* see note above */ int m68340_calc_cs(m68000_base_device *m68k, offs_t address) { @@ -1282,65 +1255,6 @@ int m68340_calc_cs(m68000_base_device *m68k, offs_t address) -UINT16 m68000_base_device::simple_read_immediate_16_m68307(offs_t address) -{ -// m68307_currentcs = m68307_calc_cs(this, address); - return m_direct->read_decrypted_word(address); -} - -UINT8 m68000_base_device::read_byte_m68307(offs_t address) -{ -// m68307_currentcs = m68307_calc_cs(this, address); - return m_space->read_byte(address); -} - -UINT16 m68000_base_device::read_word_m68307(offs_t address) -{ -// m68307_currentcs = m68307_calc_cs(this, address); - return m_space->read_word(address); -} - -UINT32 m68000_base_device::read_dword_m68307(offs_t address) -{ -// m68307_currentcs = m68307_calc_cs(this, address); - return m_space->read_dword(address); -} - -void m68000_base_device::write_byte_m68307(offs_t address, UINT8 data) -{ -// m68307_currentcs = m68307_calc_cs(this, address); - m_space->write_byte(address, data); -} - -void m68000_base_device::write_word_m68307(offs_t address, UINT16 data) -{ -// m68307_currentcs = m68307_calc_cs(this, address); - m_space->write_word(address, data); -} - -void m68000_base_device::write_dword_m68307(offs_t address, UINT32 data) -{ -// m68307_currentcs = m68307_calc_cs(this, address); - m_space->write_dword(address, data); -} - - - - -void m68000_base_device::init16_m68307(address_space &space) -{ - m_space = &space; - m_direct = &space.direct(); - opcode_xor = 0; - - readimm16 = m68k_readimm16_delegate(FUNC(m68000_base_device::simple_read_immediate_16_m68307), this); - read8 = m68k_read8_delegate(FUNC(m68000_base_device::read_byte_m68307), this); - read16 = m68k_read16_delegate(FUNC(m68000_base_device::read_word_m68307), this); - read32 = m68k_read32_delegate(FUNC(m68000_base_device::read_dword_m68307), this); - write8 = m68k_write8_delegate(FUNC(m68000_base_device::write_byte_m68307), this); - write16 = m68k_write16_delegate(FUNC(m68000_base_device::write_word_m68307), this); - write32 = m68k_write32_delegate(FUNC(m68000_base_device::write_dword_m68307), this); -} /**************************************************************************** * 32-bit data memory interface @@ -1730,35 +1644,12 @@ UINT16 m68k_get_fc(m68000_base_device *device) return device->mmu_tmp_fc; } -void m68307_set_port_callbacks(m68000_base_device *device, m68307_porta_read_callback porta_r, m68307_porta_write_callback porta_w, m68307_portb_read_callback portb_r, m68307_portb_write_callback portb_w) -{ - device->m_m68307_porta_r = porta_r; - device->m_m68307_porta_w = porta_w; - device->m_m68307_portb_r = portb_r; - device->m_m68307_portb_w = portb_w; -} - -void m68307_set_duart68681(m68000_base_device* cpudev, device_t* duart68681) -{ - if (cpudev->m68307SERIAL) - cpudev->m68307SERIAL->m68307ser_set_duart68681(duart68681); -} - - - - -UINT16 m68307_get_cs(m68000_base_device *device, offs_t address) -{ - device->m68307_currentcs = m68307_calc_cs(device, address); - - return device->m68307_currentcs; -} UINT16 m68340_get_cs(m68000_base_device *device, offs_t address) { - device->m68307_currentcs = m68340_calc_cs(device, address); + device->m68340_currentcs = m68340_calc_cs(device, address); - return device->m68307_currentcs; + return device->m68340_currentcs; } /**************************************************************************** @@ -1813,155 +1704,6 @@ void m68000_base_device::define_state(void) } -/* 68307 specifics - MOVE */ - -void m68307_set_interrupt(device_t *device, int level, int vector) -{ - device->execute().set_input_line_and_vector(level, HOLD_LINE, vector); -} - -void m68307_timer0_interrupt(m68000_base_device *cpudev) -{ - int prioritylevel = (cpudev->m68307SIM->m_picr & 0x7000)>>12; - int vector = (cpudev->m68307SIM->m_pivr & 0x00f0) | 0xa; - m68307_set_interrupt(cpudev, prioritylevel, vector); -} - -void m68307_timer1_interrupt(m68000_base_device *cpudev) -{ - int prioritylevel = (cpudev->m68307SIM->m_picr & 0x0700)>>8; - int vector = (cpudev->m68307SIM->m_pivr & 0x00f0) | 0xb; - m68307_set_interrupt(cpudev, prioritylevel, vector); -} - -void m68307_serial_interrupt(m68000_base_device *cpudev, int vector) -{ - int prioritylevel = (cpudev->m68307SIM->m_picr & 0x0070)>>4; - m68307_set_interrupt(cpudev, prioritylevel, vector); -} - -void m68307_mbus_interrupt(m68000_base_device *cpudev) -{ - int prioritylevel = (cpudev->m68307SIM->m_picr & 0x0007)>>0; - int vector = (cpudev->m68307SIM->m_pivr & 0x00f0) | 0xd; - m68307_set_interrupt(cpudev, prioritylevel, vector); -} - -void m68307_licr2_interrupt(m68000_base_device *cpudev) -{ - int prioritylevel = (cpudev->m68307SIM->m_licr2 & 0x0007)>>0; - int vector = (cpudev->m68307SIM->m_pivr & 0x00f0) | 0x9; - cpudev->m68307SIM->m_licr2 |= 0x8; - - - m68307_set_interrupt(cpudev, prioritylevel, vector); -} - -void m68000_base_device::init_cpu_m68307(void) -{ - init_cpu_m68000(); - - /* basic CS logic, timers, mbus, serial logic - set via remappable register - */ - - init16_m68307(*program); - - m68307SIM = new m68307_sim(); - m68307MBUS = new m68307_mbus(); - m68307SERIAL = new m68307_serial(); - m68307TIMER = new m68307_timer(); - - m68307TIMER->init(this); - - m68307SIM->reset(); - m68307MBUS->reset(); - m68307SERIAL->reset(); - m68307TIMER->reset(); - - internal = &this->space(AS_PROGRAM); - m68307_base = 0xbfff; - m68307_scrhigh = 0x0007; - m68307_scrlow = 0xf010; - - m68307_set_port_callbacks(this, 0,0,0,0); -} - - - -READ16_MEMBER( m68000_base_device::m68307_internal_base_r ) -{ - m68000_base_device *m68k = this; - - int pc = space.device().safe_pc(); - logerror("%08x m68307_internal_base_r %08x, (%04x)\n", pc, offset*2,mem_mask); - - switch (offset<<1) - { - case 0x2: return m68k->m68307_base; - case 0x4: return m68k->m68307_scrhigh; - case 0x6: return m68k->m68307_scrlow; - } - - logerror("(read was illegal?)\n"); - - return 0x0000; -} - -WRITE16_MEMBER( m68000_base_device::m68307_internal_base_w ) -{ - m68000_base_device *m68k = this; - - int pc = space.device().safe_pc(); - logerror("%08x m68307_internal_base_w %08x, %04x (%04x)\n", pc, offset*2,data,mem_mask); - int base = 0; - //int mask = 0; - - switch (offset<<1) - { - case 0x2: - /* remove old internal handler */ - base = (m68k->m68307_base & 0x0fff) << 12; - //mask = (m68k->m68307_base & 0xe000) >> 13; - //if ( m68k->m68307_base & 0x1000 ) mask |= 7; - m68k->internal->unmap_readwrite(base+0x000, base+0x04f); - m68k->internal->unmap_readwrite(base+0x100, base+0x11f); - m68k->internal->unmap_readwrite(base+0x120, base+0x13f); - m68k->internal->unmap_readwrite(base+0x140, base+0x149); - - /* store new base address */ - COMBINE_DATA(&m68k->m68307_base); - - /* install new internal handler */ - base = (m68k->m68307_base & 0x0fff) << 12; - //mask = (m68k->m68307_base & 0xe000) >> 13; - //if ( m68k->m68307_base & 0x1000 ) mask |= 7; - m68k->internal->install_readwrite_handler(base + 0x000, base + 0x04f, read16_delegate(FUNC(m68000_base_device::m68307_internal_sim_r),this), write16_delegate(FUNC(m68000_base_device::m68307_internal_sim_w),this)); - m68k->internal->install_readwrite_handler(base + 0x100, base + 0x11f, read8_delegate(FUNC(m68000_base_device::m68307_internal_serial_r),this), write8_delegate(FUNC(m68000_base_device::m68307_internal_serial_w),this), 0xffff); - m68k->internal->install_readwrite_handler(base + 0x120, base + 0x13f, read16_delegate(FUNC(m68000_base_device::m68307_internal_timer_r),this), write16_delegate(FUNC(m68000_base_device::m68307_internal_timer_w),this)); - m68k->internal->install_readwrite_handler(base + 0x140, base + 0x149, read8_delegate(FUNC(m68000_base_device::m68307_internal_mbus_r),this), write8_delegate(FUNC(m68000_base_device::m68307_internal_mbus_w),this), 0xffff); - - - break; - - case 0x4: - COMBINE_DATA(&m68k->m68307_scrhigh); - break; - - case 0x6: - COMBINE_DATA(&m68k->m68307_scrlow); - break; - - default: - logerror("(write was illegal?)\n"); - break; - } -} - -static ADDRESS_MAP_START( m68307_internal_map, AS_PROGRAM, 16, m68000_base_device ) - AM_RANGE(0x000000f0, 0x000000ff) AM_READWRITE(m68307_internal_base_r, m68307_internal_base_w) -ADDRESS_MAP_END - /* 68340 specifics - MOVE */ READ32_MEMBER( m68000_base_device::m68340_internal_base_r ) @@ -2511,7 +2253,6 @@ CPU_DISASSEMBLE( dasm_coldfire ) offs_t m68000_base_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) { return CPU_DISASSEMBLE_NAME(dasm_m68000)(this, buffer, pc, oprom, opram, options); }; offs_t m68000_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) { return CPU_DISASSEMBLE_NAME(dasm_m68000)(this, buffer, pc, oprom, opram, options); }; offs_t m68301_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) { return CPU_DISASSEMBLE_NAME(dasm_m68000)(this, buffer, pc, oprom, opram, options); }; -offs_t m68307_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) { return CPU_DISASSEMBLE_NAME(dasm_m68000)(this, buffer, pc, oprom, opram, options); }; offs_t m68008_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) { return CPU_DISASSEMBLE_NAME(dasm_m68008)(this, buffer, pc, oprom, opram, options); }; offs_t m68008plcc_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) { return CPU_DISASSEMBLE_NAME(dasm_m68008)(this, buffer, pc, oprom, opram, options); }; offs_t m68010_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) { return CPU_DISASSEMBLE_NAME(dasm_m68010)(this, buffer, pc, oprom, opram, options); }; @@ -2756,24 +2497,13 @@ void m68000_base_device::clear_all() for (int i=0;i<M68K_IC_SIZE;i++) ic_data[i] = 0; - m68307SIM = 0; - m68307MBUS = 0; - m68307SERIAL = 0; - m68307TIMER = 0; - m68307_base = 0; - m68307_scrhigh = 0; - m68307_scrlow = 0; - m68307_currentcs = 0; m68340SIM = 0; m68340DMA = 0; m68340SERIAL = 0; m68340TIMER = 0; m68340_base = 0; internal = 0; - m_m68307_porta_r = 0; - m_m68307_porta_w = 0; - m_m68307_portb_r = 0; - m_m68307_portb_w = 0; + instruction_hook = 0; } @@ -2842,7 +2572,6 @@ const address_space_config *m68000_base_device::memory_space_config(address_spac const device_type M68000 = &device_creator<m68000_device>; const device_type M68301 = &device_creator<m68301_device>; -const device_type M68307 = &device_creator<m68307_device>; const device_type M68008 = &device_creator<m68008_device>; const device_type M68008PLCC = &device_creator<m68008plcc_device>; const device_type M68010 = &device_creator<m68010_device>; @@ -2870,6 +2599,14 @@ void m68000_device::device_start() init_cpu_m68000(); } +m68000_device::m68000_device(const machine_config &mconfig, const char *name, const char *tag, device_t *owner, UINT32 clock, + const device_type type, UINT32 prg_data_width, UINT32 prg_address_bits, address_map_constructor internal_map, const char *shortname, const char *source) + : m68000_base_device(mconfig, name, tag, owner, clock, type, prg_data_width, prg_address_bits, internal_map, shortname, source) +{ + +} + + @@ -2888,16 +2625,7 @@ void m68301_device::device_start() -m68307_device::m68307_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : m68000_base_device(mconfig, "M68307", tag, owner, clock, M68307, 16,24, ADDRESS_MAP_NAME(m68307_internal_map), "m68307", __FILE__) -{ - -} -void m68307_device::device_start() -{ - init_cpu_m68307(); -} /* m68008_device */ diff --git a/src/emu/machine/68307.c b/src/emu/machine/68307.c new file mode 100644 index 00000000000..ce82c7132fe --- /dev/null +++ b/src/emu/machine/68307.c @@ -0,0 +1,300 @@ +/* 68307 */ + +#include "68307.h" + +static ADDRESS_MAP_START( m68307_internal_map, AS_PROGRAM, 16, m68307cpu_device ) + AM_RANGE(0x000000f0, 0x000000ff) AM_READWRITE(m68307_internal_base_r, m68307_internal_base_w) +ADDRESS_MAP_END + + +m68307cpu_device::m68307cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : m68000_device(mconfig, "MC68307", tag, owner, clock, M68307, 16,24, ADDRESS_MAP_NAME(m68307_internal_map), "mc68307", __FILE__) +{ + m68307SIM = 0; + m68307MBUS = 0; + m68307SERIAL = 0; + m68307TIMER = 0; + m68307_base = 0; + m68307_scrhigh = 0; + m68307_scrlow = 0; + m68307_currentcs = 0; + + m_m68307_porta_r = 0; + m_m68307_porta_w = 0; + m_m68307_portb_r = 0; + m_m68307_portb_w = 0; +} + + + + + + +void m68307cpu_device::device_reset() +{ + m68000_device::device_reset(); + + if (m68307SIM) m68307SIM->reset(); + if (m68307MBUS) m68307MBUS->reset(); + if (m68307SERIAL) m68307SERIAL->reset(); + if (m68307TIMER) m68307TIMER->reset(); + + m68307_base = 0xbfff; + m68307_scrhigh = 0x0007; + m68307_scrlow = 0xf010; + +} + + +/* todo: is it possible to calculate the address map based on CS when they change + and install handlers? Going through this logic for every memory access is + very slow */ + +int m68307_calc_cs(m68307cpu_device *m68k, offs_t address) +{ + m68307_sim* sim = m68k->m68307SIM; + + for (int i=0;i<4;i++) + { + int br,amask,bra; + br = sim->m_br[i] & 1; + amask = ((sim->m_or[i]&0x1ffc)<<11); + bra = ((sim->m_br[i] & 0x1ffc)<<11); + if ((br) && ((address & amask) == bra)) return i+1; + } + return 0; +} + + + +UINT16 m68307cpu_device::simple_read_immediate_16_m68307(offs_t address) +{ +// m68307_currentcs = m68307_calc_cs(this, address); + return m_direct->read_decrypted_word(address); +} + +UINT8 m68307cpu_device::read_byte_m68307(offs_t address) +{ +// m68307_currentcs = m68307_calc_cs(this, address); + return m_space->read_byte(address); +} + +UINT16 m68307cpu_device::read_word_m68307(offs_t address) +{ +// m68307_currentcs = m68307_calc_cs(this, address); + return m_space->read_word(address); +} + +UINT32 m68307cpu_device::read_dword_m68307(offs_t address) +{ +// m68307_currentcs = m68307_calc_cs(this, address); + return m_space->read_dword(address); +} + +void m68307cpu_device::write_byte_m68307(offs_t address, UINT8 data) +{ +// m68307_currentcs = m68307_calc_cs(this, address); + m_space->write_byte(address, data); +} + +void m68307cpu_device::write_word_m68307(offs_t address, UINT16 data) +{ +// m68307_currentcs = m68307_calc_cs(this, address); + m_space->write_word(address, data); +} + +void m68307cpu_device::write_dword_m68307(offs_t address, UINT32 data) +{ +// m68307_currentcs = m68307_calc_cs(this, address); + m_space->write_dword(address, data); +} + + + + +void m68307cpu_device::init16_m68307(address_space &space) +{ + m_space = &space; + m_direct = &space.direct(); + opcode_xor = 0; + + readimm16 = m68k_readimm16_delegate(FUNC(m68307cpu_device::simple_read_immediate_16_m68307), this); + read8 = m68k_read8_delegate(FUNC(m68307cpu_device::read_byte_m68307), this); + read16 = m68k_read16_delegate(FUNC(m68307cpu_device::read_word_m68307), this); + read32 = m68k_read32_delegate(FUNC(m68307cpu_device::read_dword_m68307), this); + write8 = m68k_write8_delegate(FUNC(m68307cpu_device::write_byte_m68307), this); + write16 = m68k_write16_delegate(FUNC(m68307cpu_device::write_word_m68307), this); + write32 = m68k_write32_delegate(FUNC(m68307cpu_device::write_dword_m68307), this); +} + + + +void m68307_set_port_callbacks(m68307cpu_device *device, m68307_porta_read_callback porta_r, m68307_porta_write_callback porta_w, m68307_portb_read_callback portb_r, m68307_portb_write_callback portb_w) +{ + device->m_m68307_porta_r = porta_r; + device->m_m68307_porta_w = porta_w; + device->m_m68307_portb_r = portb_r; + device->m_m68307_portb_w = portb_w; +} + +void m68307_set_duart68681(m68307cpu_device* cpudev, device_t* duart68681) +{ + if (cpudev->m68307SERIAL) + cpudev->m68307SERIAL->m68307ser_set_duart68681(duart68681); +} + + + + +UINT16 m68307_get_cs(m68307cpu_device *device, offs_t address) +{ + device->m68307_currentcs = m68307_calc_cs(device, address); + + return device->m68307_currentcs; +} + + +/* 68307 specifics - MOVE */ + +void m68307_set_interrupt(device_t *device, int level, int vector) +{ + device->execute().set_input_line_and_vector(level, HOLD_LINE, vector); +} + +void m68307_timer0_interrupt(m68307cpu_device *cpudev) +{ + int prioritylevel = (cpudev->m68307SIM->m_picr & 0x7000)>>12; + int vector = (cpudev->m68307SIM->m_pivr & 0x00f0) | 0xa; + m68307_set_interrupt(cpudev, prioritylevel, vector); +} + +void m68307_timer1_interrupt(m68307cpu_device *cpudev) +{ + int prioritylevel = (cpudev->m68307SIM->m_picr & 0x0700)>>8; + int vector = (cpudev->m68307SIM->m_pivr & 0x00f0) | 0xb; + m68307_set_interrupt(cpudev, prioritylevel, vector); +} + +void m68307_serial_interrupt(m68307cpu_device *cpudev, int vector) +{ + int prioritylevel = (cpudev->m68307SIM->m_picr & 0x0070)>>4; + m68307_set_interrupt(cpudev, prioritylevel, vector); +} + +void m68307_mbus_interrupt(m68307cpu_device *cpudev) +{ + int prioritylevel = (cpudev->m68307SIM->m_picr & 0x0007)>>0; + int vector = (cpudev->m68307SIM->m_pivr & 0x00f0) | 0xd; + m68307_set_interrupt(cpudev, prioritylevel, vector); +} + +void m68307_licr2_interrupt(m68307cpu_device *cpudev) +{ + int prioritylevel = (cpudev->m68307SIM->m_licr2 & 0x0007)>>0; + int vector = (cpudev->m68307SIM->m_pivr & 0x00f0) | 0x9; + cpudev->m68307SIM->m_licr2 |= 0x8; + + + m68307_set_interrupt(cpudev, prioritylevel, vector); +} + +void m68307cpu_device::device_start() +{ + init_cpu_m68000(); + + /* basic CS logic, timers, mbus, serial logic + set via remappable register + */ + + init16_m68307(*program); + + m68307SIM = new m68307_sim(); + m68307MBUS = new m68307_mbus(); + m68307SERIAL = new m68307_serial(); + m68307TIMER = new m68307_timer(); + + m68307TIMER->init(this); + + m68307SIM->reset(); + m68307MBUS->reset(); + m68307SERIAL->reset(); + m68307TIMER->reset(); + + internal = &this->space(AS_PROGRAM); + m68307_base = 0xbfff; + m68307_scrhigh = 0x0007; + m68307_scrlow = 0xf010; + + m68307_set_port_callbacks(this, 0,0,0,0); +} + + + +READ16_MEMBER( m68307cpu_device::m68307_internal_base_r ) +{ + m68307cpu_device *m68k = this; + + int pc = space.device().safe_pc(); + logerror("%08x m68307_internal_base_r %08x, (%04x)\n", pc, offset*2,mem_mask); + + switch (offset<<1) + { + case 0x2: return m68k->m68307_base; + case 0x4: return m68k->m68307_scrhigh; + case 0x6: return m68k->m68307_scrlow; + } + + logerror("(read was illegal?)\n"); + + return 0x0000; +} + +WRITE16_MEMBER( m68307cpu_device::m68307_internal_base_w ) +{ + m68307cpu_device *m68k = this; + + int pc = space.device().safe_pc(); + logerror("%08x m68307_internal_base_w %08x, %04x (%04x)\n", pc, offset*2,data,mem_mask); + int base = 0; + //int mask = 0; + + switch (offset<<1) + { + case 0x2: + /* remove old internal handler */ + base = (m68k->m68307_base & 0x0fff) << 12; + //mask = (m68k->m68307_base & 0xe000) >> 13; + //if ( m68k->m68307_base & 0x1000 ) mask |= 7; + m68k->internal->unmap_readwrite(base+0x000, base+0x04f); + m68k->internal->unmap_readwrite(base+0x100, base+0x11f); + m68k->internal->unmap_readwrite(base+0x120, base+0x13f); + m68k->internal->unmap_readwrite(base+0x140, base+0x149); + + /* store new base address */ + COMBINE_DATA(&m68k->m68307_base); + + /* install new internal handler */ + base = (m68k->m68307_base & 0x0fff) << 12; + //mask = (m68k->m68307_base & 0xe000) >> 13; + //if ( m68k->m68307_base & 0x1000 ) mask |= 7; + m68k->internal->install_readwrite_handler(base + 0x000, base + 0x04f, read16_delegate(FUNC(m68307cpu_device::m68307_internal_sim_r),this), write16_delegate(FUNC(m68307cpu_device::m68307_internal_sim_w),this)); + m68k->internal->install_readwrite_handler(base + 0x100, base + 0x11f, read8_delegate(FUNC(m68307cpu_device::m68307_internal_serial_r),this), write8_delegate(FUNC(m68307cpu_device::m68307_internal_serial_w),this), 0xffff); + m68k->internal->install_readwrite_handler(base + 0x120, base + 0x13f, read16_delegate(FUNC(m68307cpu_device::m68307_internal_timer_r),this), write16_delegate(FUNC(m68307cpu_device::m68307_internal_timer_w),this)); + m68k->internal->install_readwrite_handler(base + 0x140, base + 0x149, read8_delegate(FUNC(m68307cpu_device::m68307_internal_mbus_r),this), write8_delegate(FUNC(m68307cpu_device::m68307_internal_mbus_w),this), 0xffff); + + + break; + + case 0x4: + COMBINE_DATA(&m68k->m68307_scrhigh); + break; + + case 0x6: + COMBINE_DATA(&m68k->m68307_scrlow); + break; + + default: + logerror("(write was illegal?)\n"); + break; + } +} diff --git a/src/emu/machine/68307.h b/src/emu/machine/68307.h new file mode 100644 index 00000000000..969138559cb --- /dev/null +++ b/src/emu/machine/68307.h @@ -0,0 +1,99 @@ +/* 68307 */ + + +#pragma once +#ifndef __M68307_H__ +#define __M68307_H__ + +#include "emu.h" +#include "cpu/m68000/m68000.h" + +#include "68307sim.h" +#include "68307bus.h" +#include "68307ser.h" +#include "68307tmu.h" + + + + +typedef UINT8 (*m68307_porta_read_callback)(address_space &space, bool dedicated, UINT8 line_mask); +typedef void (*m68307_porta_write_callback)(address_space &space, bool dedicated, UINT8 data, UINT8 line_mask); +typedef UINT16 (*m68307_portb_read_callback)(address_space &space, bool dedicated, UINT16 line_mask); +typedef void (*m68307_portb_write_callback)(address_space &space, bool dedicated, UINT16 data, UINT16 line_mask); + + + +class m68307cpu_device : public m68000_device { +public: + m68307cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + + UINT16 simple_read_immediate_16_m68307(offs_t address); + + + UINT8 read_byte_m68307(offs_t address); + UINT16 read_word_m68307(offs_t address); + UINT32 read_dword_m68307(offs_t address); + void write_byte_m68307(offs_t address, UINT8 data); + void write_word_m68307(offs_t address, UINT16 data); + void write_dword_m68307(offs_t address, UINT32 data); + + + /* 68307 peripheral modules */ + m68307_sim* m68307SIM; + m68307_mbus* m68307MBUS; + m68307_serial* m68307SERIAL; + m68307_timer* m68307TIMER; + + UINT16 m68307_base; + UINT16 m68307_scrhigh; + UINT16 m68307_scrlow; + + int m68307_currentcs; + + + DECLARE_READ16_MEMBER( m68307_internal_base_r ); + DECLARE_WRITE16_MEMBER( m68307_internal_base_w ); + DECLARE_READ16_MEMBER( m68307_internal_timer_r ); + DECLARE_WRITE16_MEMBER( m68307_internal_timer_w ); + DECLARE_READ16_MEMBER( m68307_internal_sim_r ); + DECLARE_WRITE16_MEMBER( m68307_internal_sim_w ); + DECLARE_READ8_MEMBER( m68307_internal_serial_r ); + DECLARE_WRITE8_MEMBER( m68307_internal_serial_w ); + DECLARE_READ8_MEMBER( m68307_internal_mbus_r ); + DECLARE_WRITE8_MEMBER( m68307_internal_mbus_w ); + + + /* callbacks for internal ports */ + m68307_porta_read_callback m_m68307_porta_r; + m68307_porta_write_callback m_m68307_porta_w; + m68307_portb_read_callback m_m68307_portb_r; + m68307_portb_write_callback m_m68307_portb_w; + + void init16_m68307(address_space &space); + void init_cpu_m68307(void); + + virtual UINT32 disasm_min_opcode_bytes() const { return 2; }; + virtual UINT32 disasm_max_opcode_bytes() const { return 10; }; + + virtual UINT32 execute_min_cycles() const { return 4; }; + virtual UINT32 execute_max_cycles() const { return 158; }; +protected: + + virtual void device_start(); + virtual void device_reset(); + +}; + +static const device_type M68307 = &device_creator<m68307cpu_device>; + +extern void m68307_set_port_callbacks(m68307cpu_device *device, m68307_porta_read_callback porta_r, m68307_porta_write_callback porta_w, m68307_portb_read_callback portb_r, m68307_portb_write_callback portb_w); +extern void m68307_set_duart68681(m68307cpu_device* cpudev, device_t* duart68681); +extern UINT16 m68307_get_cs(m68307cpu_device *device, offs_t address); +extern void m68307_timer0_interrupt(m68307cpu_device *cpudev); +extern void m68307_timer1_interrupt(m68307cpu_device *cpudev); +extern void m68307_serial_interrupt(m68307cpu_device *cpudev, int vector); +extern void m68307_mbus_interrupt(m68307cpu_device *cpudev); +extern void m68307_licr2_interrupt(m68307cpu_device *cpudev); + +#endif
\ No newline at end of file diff --git a/src/emu/cpu/m68000/68307bus.c b/src/emu/machine/68307bus.c index cb25a8bd9f7..8b7dc4cc54e 100644 --- a/src/emu/cpu/m68000/68307bus.c +++ b/src/emu/machine/68307bus.c @@ -2,12 +2,12 @@ /* all ports on this are 8-bit? */ #include "emu.h" -#include "m68kcpu.h" +#include "68307.h" -READ8_MEMBER( m68000_base_device::m68307_internal_mbus_r ) +READ8_MEMBER( m68307cpu_device::m68307_internal_mbus_r ) { - m68000_base_device *m68k = this; + m68307cpu_device *m68k = this; m68307_mbus* mbus = m68k->m68307MBUS; assert(mbus != NULL); UINT8 retval; @@ -53,9 +53,9 @@ READ8_MEMBER( m68000_base_device::m68307_internal_mbus_r ) return 0xff; } -WRITE8_MEMBER( m68000_base_device::m68307_internal_mbus_w ) +WRITE8_MEMBER( m68307cpu_device::m68307_internal_mbus_w ) { - m68000_base_device *m68k = this; + m68307cpu_device *m68k = this; m68307_mbus* mbus = m68k->m68307MBUS; assert(mbus != NULL); diff --git a/src/emu/cpu/m68000/68307bus.h b/src/emu/machine/68307bus.h index cee40b13880..6eb206ae9d8 100644 --- a/src/emu/cpu/m68000/68307bus.h +++ b/src/emu/machine/68307bus.h @@ -1,4 +1,4 @@ -#include "m68000.h" +#include "cpu/m68000/m68000.h" #define m68307BUS_MADR (0x01) #define m68307BUS_MFDR (0x03) diff --git a/src/emu/cpu/m68000/68307ser.c b/src/emu/machine/68307ser.c index c9edf508442..de919351d07 100644 --- a/src/emu/cpu/m68000/68307ser.c +++ b/src/emu/machine/68307ser.c @@ -10,12 +10,12 @@ */ #include "emu.h" -#include "m68kcpu.h" +#include "68307.h" -READ8_MEMBER( m68000_base_device::m68307_internal_serial_r ) +READ8_MEMBER( m68307cpu_device::m68307_internal_serial_r ) { - m68000_base_device *m68k = this; + m68307cpu_device *m68k = this; m68307_serial* serial = m68k->m68307SERIAL; assert(serial != NULL); @@ -90,9 +90,9 @@ READ8_MEMBER( m68000_base_device::m68307_internal_serial_r ) return 0x0000; } -WRITE8_MEMBER( m68000_base_device::m68307_internal_serial_w ) +WRITE8_MEMBER( m68307cpu_device::m68307_internal_serial_w ) { - m68000_base_device *m68k = this; + m68307cpu_device *m68k = this; m68307_serial* serial = m68k->m68307SERIAL; assert(serial != NULL); diff --git a/src/emu/cpu/m68000/68307ser.h b/src/emu/machine/68307ser.h index 0f0b42bce0c..ce007e568a6 100644 --- a/src/emu/cpu/m68000/68307ser.h +++ b/src/emu/machine/68307ser.h @@ -1,4 +1,4 @@ -#include "m68000.h" +#include "cpu/m68000/m68000.h" #include "machine/68681.h" #define m68307SER_UMR1_UMR2 (0x01) diff --git a/src/emu/cpu/m68000/68307sim.c b/src/emu/machine/68307sim.c index 8052b0387fd..2f18176e130 100644 --- a/src/emu/cpu/m68000/68307sim.c +++ b/src/emu/machine/68307sim.c @@ -1,12 +1,12 @@ /* 68307 SIM module */ #include "emu.h" -#include "m68kcpu.h" +#include "68307.h" -READ16_MEMBER( m68000_base_device::m68307_internal_sim_r ) +READ16_MEMBER( m68307cpu_device::m68307_internal_sim_r ) { - m68000_base_device *m68k = this; + m68307cpu_device *m68k = this; m68307_sim* sim = m68k->m68307SIM; assert(sim != NULL); @@ -41,9 +41,9 @@ READ16_MEMBER( m68000_base_device::m68307_internal_sim_r ) } -WRITE16_MEMBER( m68000_base_device::m68307_internal_sim_w ) +WRITE16_MEMBER( m68307cpu_device::m68307_internal_sim_w ) { - m68000_base_device *m68k = this; + m68307cpu_device *m68k = this; m68307_sim* sim = m68k->m68307SIM; assert(sim != NULL); @@ -149,7 +149,7 @@ void m68307_sim::write_paddr(UINT16 data, UINT16 mem_mask) } -UINT16 m68307_sim::read_padat(m68000_base_device* m68k, address_space &space, UINT16 mem_mask) +UINT16 m68307_sim::read_padat(m68307cpu_device* m68k, address_space &space, UINT16 mem_mask) { int pc = space.device().safe_pc(); @@ -175,7 +175,7 @@ UINT16 m68307_sim::read_padat(m68000_base_device* m68k, address_space &space, UI } -void m68307_sim::write_padat(m68000_base_device* m68k, address_space &space, UINT16 data, UINT16 mem_mask) +void m68307_sim::write_padat(m68307cpu_device* m68k, address_space &space, UINT16 data, UINT16 mem_mask) { int pc = space.device().safe_pc(); COMBINE_DATA(&m_padat); @@ -200,7 +200,7 @@ void m68307_sim::write_pbddr(UINT16 data, UINT16 mem_mask) COMBINE_DATA(&m_pbddr); } -UINT16 m68307_sim::read_pbdat(m68000_base_device* m68k, address_space &space, UINT16 mem_mask) +UINT16 m68307_sim::read_pbdat(m68307cpu_device* m68k, address_space &space, UINT16 mem_mask) { int pc = space.device().safe_pc(); @@ -226,7 +226,7 @@ UINT16 m68307_sim::read_pbdat(m68000_base_device* m68k, address_space &space, UI } -void m68307_sim::write_pbdat(m68000_base_device* m68k, address_space &space, UINT16 data, UINT16 mem_mask) +void m68307_sim::write_pbdat(m68307cpu_device* m68k, address_space &space, UINT16 data, UINT16 mem_mask) { int pc = space.device().safe_pc(); COMBINE_DATA(&m_pbdat); diff --git a/src/emu/cpu/m68000/68307sim.h b/src/emu/machine/68307sim.h index 315c650ed2b..2d480432f86 100644 --- a/src/emu/cpu/m68000/68307sim.h +++ b/src/emu/machine/68307sim.h @@ -1,8 +1,8 @@ /* 68307 SIM module */ -#include "m68000.h" +#include "cpu/m68000/m68000.h" -class m68000_base_device; +class m68307cpu_device; /* ports */ @@ -53,13 +53,13 @@ class m68307_sim void write_pacnt(UINT16 data, UINT16 mem_mask); void write_paddr(UINT16 data, UINT16 mem_mask); - UINT16 read_padat(m68000_base_device* m68k, address_space &space, UINT16 mem_mask); - void write_padat(m68000_base_device* m68k, address_space &space, UINT16 data, UINT16 mem_mask); + UINT16 read_padat(m68307cpu_device* m68k, address_space &space, UINT16 mem_mask); + void write_padat(m68307cpu_device* m68k, address_space &space, UINT16 data, UINT16 mem_mask); void write_pbcnt(UINT16 data, UINT16 mem_mask); void write_pbddr(UINT16 data, UINT16 mem_mask); - UINT16 read_pbdat(m68000_base_device* m68k, address_space &space, UINT16 mem_mask); - void write_pbdat(m68000_base_device* m68k, address_space &space, UINT16 data, UINT16 mem_mask); + UINT16 read_pbdat(m68307cpu_device* m68k, address_space &space, UINT16 mem_mask); + void write_pbdat(m68307cpu_device* m68k, address_space &space, UINT16 data, UINT16 mem_mask); diff --git a/src/emu/cpu/m68000/68307tmu.c b/src/emu/machine/68307tmu.c index 41bf3886ebf..5163d99c09b 100644 --- a/src/emu/cpu/m68000/68307tmu.c +++ b/src/emu/machine/68307tmu.c @@ -2,11 +2,11 @@ // 2x timers #include "emu.h" -#include "m68kcpu.h" +#include "68307.h" -READ16_MEMBER( m68000_base_device::m68307_internal_timer_r ) +READ16_MEMBER( m68307cpu_device::m68307_internal_timer_r ) { - m68000_base_device *m68k = this; + m68307cpu_device *m68k = this; m68307_timer* timer = m68k->m68307TIMER; assert(timer != NULL); @@ -32,9 +32,9 @@ READ16_MEMBER( m68000_base_device::m68307_internal_timer_r ) return 0x0000; } -WRITE16_MEMBER( m68000_base_device::m68307_internal_timer_w ) +WRITE16_MEMBER( m68307cpu_device::m68307_internal_timer_w ) { - m68000_base_device *m68k = this; + m68307cpu_device *m68k = this; m68307_timer* timer = m68k->m68307TIMER; assert(timer != NULL); @@ -101,7 +101,7 @@ WRITE16_MEMBER( m68000_base_device::m68307_internal_timer_w ) static TIMER_CALLBACK( m68307_timer0_callback ) { - m68000_base_device* m68k = (m68000_base_device *)ptr; + m68307cpu_device* m68k = (m68307cpu_device *)ptr; m68307_single_timer* tptr = &m68k->m68307TIMER->singletimer[0]; tptr->regs[m68307TIMER_TMR] |= 0x2; @@ -112,7 +112,7 @@ static TIMER_CALLBACK( m68307_timer0_callback ) static TIMER_CALLBACK( m68307_timer1_callback ) { - m68000_base_device* m68k = (m68000_base_device *)ptr; + m68307cpu_device* m68k = (m68307cpu_device *)ptr; m68307_single_timer* tptr = &m68k->m68307TIMER->singletimer[1]; tptr->regs[m68307TIMER_TMR] |= 0x2; @@ -127,7 +127,7 @@ static TIMER_CALLBACK( m68307_wd_timer_callback ) printf("wd timer\n"); } -void m68307_timer::init(m68000_base_device *device) +void m68307_timer::init(m68307cpu_device *device) { parent = device; @@ -161,7 +161,7 @@ void m68307_timer::write_ter(UINT16 data, UINT16 mem_mask, int which) void m68307_timer::write_tmr(UINT16 data, UINT16 mem_mask, int which) { - m68000_base_device* m68k = parent; + m68307cpu_device* m68k = parent; m68307_single_timer* tptr = &singletimer[which]; COMBINE_DATA(&tptr->regs[m68307TIMER_TMR]); diff --git a/src/emu/cpu/m68000/68307tmu.h b/src/emu/machine/68307tmu.h index 00712516f17..e973412c66f 100644 --- a/src/emu/cpu/m68000/68307tmu.h +++ b/src/emu/machine/68307tmu.h @@ -1,7 +1,7 @@ -#include "m68000.h" +#include "cpu/m68000/m68000.h" -class m68000_base_device; +class m68307cpu_device; #define m68307TIMER_TMR (0x0) @@ -27,13 +27,13 @@ class m68307_timer m68307_single_timer singletimer[2]; emu_timer *wd_mametimer; - m68000_base_device *parent; + m68307cpu_device *parent; void write_tmr(UINT16 data, UINT16 mem_mask, int which); void write_trr(UINT16 data, UINT16 mem_mask, int which); void write_ter(UINT16 data, UINT16 mem_mask, int which); UINT16 read_tcn(UINT16 mem_mask, int which); - void init(m68000_base_device *device); + void init(m68307cpu_device *device); void reset(void); }; diff --git a/src/emu/machine/machine.mak b/src/emu/machine/machine.mak index 1650d362116..8eb9a1c8e44 100644 --- a/src/emu/machine/machine.mak +++ b/src/emu/machine/machine.mak @@ -805,6 +805,19 @@ endif #------------------------------------------------- # +#@src/emu/machine/68307.h,MACHINES += M68307 +#------------------------------------------------- + +ifneq ($(filter M68307,$(MACHINES)),) +MACHINEOBJS += $(MACHINEOBJ)/68307.o +MACHINEOBJS += $(MACHINEOBJ)/68307sim.o +MACHINEOBJS += $(MACHINEOBJ)/68307bus.o +MACHINEOBJS += $(MACHINEOBJ)/68307ser.o +MACHINEOBJS += $(MACHINEOBJ)/68307tmu.o +endif + +#------------------------------------------------- +# #@src/emu/machine/mcf5206e.h,MACHINES += MCF5206E #------------------------------------------------- |