diff --git a/scripts/src/cpu.lua b/scripts/src/cpu.lua index 3223db4a0ad..159a1090519 100644 --- a/scripts/src/cpu.lua +++ b/scripts/src/cpu.lua @@ -1136,6 +1136,7 @@ end --@src/devices/cpu/m6502/r65c02.h,CPUS["M6502"] = true --@src/devices/cpu/m6502/m65sc02.h,CPUS["M6502"] = true --@src/devices/cpu/m6502/m6504.h,CPUS["M6502"] = true +--@src/devices/cpu/m6502/m6507.h,CPUS["M6502"] = true --@src/devices/cpu/m6502/m6509.h,CPUS["M6502"] = true --@src/devices/cpu/m6502/m6510.h,CPUS["M6502"] = true --@src/devices/cpu/m6502/m6510t.h,CPUS["M6502"] = true @@ -1164,6 +1165,8 @@ if (CPUS["M6502"]~=null) then MAME_DIR .. "src/devices/cpu/m6502/m65sc02.h", MAME_DIR .. "src/devices/cpu/m6502/m6504.c", MAME_DIR .. "src/devices/cpu/m6502/m6504.h", + MAME_DIR .. "src/devices/cpu/m6502/m6507.c", + MAME_DIR .. "src/devices/cpu/m6502/m6507.h", MAME_DIR .. "src/devices/cpu/m6502/m6509.c", MAME_DIR .. "src/devices/cpu/m6502/m6509.h", MAME_DIR .. "src/devices/cpu/m6502/m6510.c", diff --git a/src/devices/cpu/m6502/m6507.c b/src/devices/cpu/m6502/m6507.c new file mode 100644 index 00000000000..0f561b17e62 --- /dev/null +++ b/src/devices/cpu/m6502/m6507.c @@ -0,0 +1,61 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert +/*************************************************************************** + + m6507.c + + Mostek 6502, NMOS variant with reduced address bus + +***************************************************************************/ + +#include "emu.h" +#include "m6507.h" + +const device_type M6507 = &device_creator; + +m6507_device::m6507_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + m6502_device(mconfig, M6507, "M6507", tag, owner, clock, "m6507", __FILE__) +{ + program_config.m_addrbus_width = 13; + sprogram_config.m_addrbus_width = 13; +} + +void m6507_device::device_start() +{ + if(direct_disabled) + mintf = new mi_6507_nd; + else + mintf = new mi_6507_normal; + + init(); +} + +UINT8 m6507_device::mi_6507_normal::read(UINT16 adr) +{ + return program->read_byte(adr & 0x1fff); +} + +UINT8 m6507_device::mi_6507_normal::read_sync(UINT16 adr) +{ + return sdirect->read_byte(adr & 0x1fff); +} + +UINT8 m6507_device::mi_6507_normal::read_arg(UINT16 adr) +{ + return direct->read_byte(adr & 0x1fff); +} + +void m6507_device::mi_6507_normal::write(UINT16 adr, UINT8 val) +{ + program->write_byte(adr & 0x1fff, val); +} + +UINT8 m6507_device::mi_6507_nd::read_sync(UINT16 adr) +{ + return sprogram->read_byte(adr & 0x1fff); +} + +UINT8 m6507_device::mi_6507_nd::read_arg(UINT16 adr) +{ + return program->read_byte(adr & 0x1fff); +} diff --git a/src/devices/cpu/m6502/m6507.h b/src/devices/cpu/m6502/m6507.h new file mode 100644 index 00000000000..a83a02cfa16 --- /dev/null +++ b/src/devices/cpu/m6502/m6507.h @@ -0,0 +1,49 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert +/*************************************************************************** + + m6507.h + + Mostek 6502, NMOS variant with reduced address bus + +***************************************************************************/ + +#ifndef __M6507_H__ +#define __M6507_H__ + +#include "m6502.h" + +class m6507_device : public m6502_device { +public: + m6507_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + +protected: + class mi_6507_normal : public memory_interface { + public: + virtual ~mi_6507_normal() {} + virtual UINT8 read(UINT16 adr); + virtual UINT8 read_sync(UINT16 adr); + virtual UINT8 read_arg(UINT16 adr); + virtual void write(UINT16 adr, UINT8 val); + }; + + class mi_6507_nd : public mi_6507_normal { + public: + virtual ~mi_6507_nd() {} + virtual UINT8 read_sync(UINT16 adr); + virtual UINT8 read_arg(UINT16 adr); + }; + + virtual void device_start(); +}; + + +enum { + M6507_IRQ_LINE = m6502_device::IRQ_LINE, + M6507_NMI_LINE = m6502_device::NMI_LINE, + M6507_SET_OVERFLOW = m6502_device::V_LINE +}; + +extern const device_type M6507; + +#endif diff --git a/src/mame/drivers/a2600.c b/src/mame/drivers/a2600.c index 29d950ed7fd..ca65c12feb4 100644 --- a/src/mame/drivers/a2600.c +++ b/src/mame/drivers/a2600.c @@ -12,7 +12,7 @@ TODO: #include "emu.h" #include "machine/mos6530n.h" -#include "cpu/m6502/m6502.h" +#include "cpu/m6502/m6507.h" #include "sound/tiaintf.h" #include "video/tia.h" #include "bus/vcs/vcs_slot.h" @@ -70,7 +70,7 @@ protected: required_device m_tia; unsigned long detect_2600controllers(); - required_device m_maincpu; + required_device m_maincpu; required_device m_screen; required_ioport m_swb; required_device m_riot; @@ -85,8 +85,7 @@ protected: static const UINT16 supported_screen_heights[4] = { 262, 312, 328, 342 }; -static ADDRESS_MAP_START(a2600_mem, AS_PROGRAM, 8, a2600_state ) - ADDRESS_MAP_GLOBAL_MASK(0x1fff) +static ADDRESS_MAP_START(a2600_mem, AS_PROGRAM, 8, a2600_state ) // 6507 has 13-bit address space, 0x0000 - 0x1fff AM_RANGE(0x0000, 0x007f) AM_MIRROR(0x0f00) AM_DEVREADWRITE("tia_video", tia_video_device, read, write) AM_RANGE(0x0080, 0x00ff) AM_MIRROR(0x0d00) AM_RAM AM_SHARE("riot_ram") AM_RANGE(0x0280, 0x029f) AM_MIRROR(0x0d00) AM_DEVICE("riot", mos6532_t, io_map) @@ -541,7 +540,7 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_START( a2600, a2600_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6502, MASTER_CLOCK_NTSC / 3) /* actually M6507 */ + MCFG_CPU_ADD("maincpu", M6507, MASTER_CLOCK_NTSC / 3) MCFG_M6502_DISABLE_DIRECT() MCFG_CPU_PROGRAM_MAP(a2600_mem) @@ -581,7 +580,7 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_START( a2600p, a2600_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", M6502, MASTER_CLOCK_PAL / 3) /* actually M6507 */ + MCFG_CPU_ADD("maincpu", M6507, MASTER_CLOCK_PAL / 3) MCFG_CPU_PROGRAM_MAP(a2600_mem) MCFG_M6502_DISABLE_DIRECT()