summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/m6502/m6510.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/m6502/m6510.cpp')
-rw-r--r--src/devices/cpu/m6502/m6510.cpp118
1 files changed, 29 insertions, 89 deletions
diff --git a/src/devices/cpu/m6502/m6510.cpp b/src/devices/cpu/m6502/m6510.cpp
index b045d4423f5..c54965a2f04 100644
--- a/src/devices/cpu/m6502/m6510.cpp
+++ b/src/devices/cpu/m6502/m6510.cpp
@@ -2,7 +2,7 @@
// copyright-holders:Olivier Galibert
/***************************************************************************
- m6510.c
+ m6510.cpp
6502 with 6 i/o pins, also known as 8500
@@ -15,8 +15,8 @@
#include "m6510.h"
#include "m6510d.h"
-DEFINE_DEVICE_TYPE(M6510, m6510_device, "m6510", "MOS Technology M6510")
-DEFINE_DEVICE_TYPE(M6508, m6508_device, "m6508", "MOS Technology M6508")
+DEFINE_DEVICE_TYPE(M6510, m6510_device, "m6510", "MOS Technology 6510")
+DEFINE_DEVICE_TYPE(M6508, m6508_device, "m6508", "MOS Technology 6508")
m6510_device::m6510_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
m6510_device(mconfig, M6510, tag, owner, clock)
@@ -25,8 +25,9 @@ m6510_device::m6510_device(const machine_config &mconfig, const char *tag, devic
m6510_device::m6510_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) :
m6502_device(mconfig, type, tag, owner, clock),
- read_port(*this),
- write_port(*this), dir(0), port(0), drive(0)
+ read_port(*this, 0),
+ write_port(*this),
+ dir(0), port(0), drive(0)
{
pullup = 0x00;
floating = 0x00;
@@ -45,9 +46,6 @@ std::unique_ptr<util::disasm_interface> m6510_device::create_disassembler()
void m6510_device::init_port()
{
- read_port.resolve_safe(0);
- write_port.resolve_safe();
-
save_item(NAME(pullup));
save_item(NAME(floating));
save_item(NAME(dir));
@@ -57,10 +55,7 @@ void m6510_device::init_port()
void m6510_device::device_start()
{
- if(cache_disabled)
- mintf = std::make_unique<mi_6510_nd>(this);
- else
- mintf = std::make_unique<mi_6510_normal>(this);
+ mintf = std::make_unique<mi_6510>(this);
init();
init_port();
@@ -69,9 +64,9 @@ void m6510_device::device_start()
void m6510_device::device_reset()
{
m6502_device::device_reset();
- dir = 0x00;
- port = 0x00;
- drive = 0x00;
+ dir = 0xff;
+ port = 0xff;
+ drive = 0xff;
update_port();
}
@@ -109,14 +104,14 @@ void m6510_device::port_w(uint8_t data)
}
-m6510_device::mi_6510_normal::mi_6510_normal(m6510_device *_base)
+m6510_device::mi_6510::mi_6510(m6510_device *_base)
{
base = _base;
}
-uint8_t m6510_device::mi_6510_normal::read(uint16_t adr)
+uint8_t m6510_device::mi_6510::read(uint16_t adr)
{
- uint8_t res = program->read_byte(adr);
+ uint8_t res = program.read_byte(adr);
if(adr == 0x0000)
res = base->dir_r();
else if(adr == 0x0001)
@@ -124,9 +119,9 @@ uint8_t m6510_device::mi_6510_normal::read(uint16_t adr)
return res;
}
-uint8_t m6510_device::mi_6510_normal::read_sync(uint16_t adr)
+uint8_t m6510_device::mi_6510::read_sync(uint16_t adr)
{
- uint8_t res = scache->read_byte(adr);
+ uint8_t res = csprogram.read_byte(adr);
if(adr == 0x0000)
res = base->dir_r();
else if(adr == 0x0001)
@@ -134,9 +129,9 @@ uint8_t m6510_device::mi_6510_normal::read_sync(uint16_t adr)
return res;
}
-uint8_t m6510_device::mi_6510_normal::read_arg(uint16_t adr)
+uint8_t m6510_device::mi_6510::read_arg(uint16_t adr)
{
- uint8_t res = cache->read_byte(adr);
+ uint8_t res = cprogram.read_byte(adr);
if(adr == 0x0000)
res = base->dir_r();
else if(adr == 0x0001)
@@ -144,39 +139,15 @@ uint8_t m6510_device::mi_6510_normal::read_arg(uint16_t adr)
return res;
}
-void m6510_device::mi_6510_normal::write(uint16_t adr, uint8_t val)
+void m6510_device::mi_6510::write(uint16_t adr, uint8_t val)
{
- program->write_byte(adr, val);
+ program.write_byte(adr, val);
if(adr == 0x0000)
base->dir_w(val);
else if(adr == 0x0001)
base->port_w(val);
}
-m6510_device::mi_6510_nd::mi_6510_nd(m6510_device *_base) : mi_6510_normal(_base)
-{
-}
-
-uint8_t m6510_device::mi_6510_nd::read_sync(uint16_t adr)
-{
- uint8_t res = sprogram->read_byte(adr);
- if(adr == 0x0000)
- res = base->dir_r();
- else if(adr == 0x0001)
- res = base->port_r();
- return res;
-}
-
-uint8_t m6510_device::mi_6510_nd::read_arg(uint16_t adr)
-{
- uint8_t res = program->read_byte(adr);
- if(adr == 0x0000)
- res = base->dir_r();
- else if(adr == 0x0001)
- res = base->port_r();
- return res;
-}
-
m6508_device::m6508_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
m6510_device(mconfig, M6508, tag, owner, clock)
@@ -185,10 +156,7 @@ m6508_device::m6508_device(const machine_config &mconfig, const char *tag, devic
void m6508_device::device_start()
{
- if(cache_disabled)
- mintf = std::make_unique<mi_6508_nd>(this);
- else
- mintf = std::make_unique<mi_6508_normal>(this);
+ mintf = std::make_unique<mi_6508>(this);
init();
init_port();
@@ -198,14 +166,14 @@ void m6508_device::device_start()
}
-m6508_device::mi_6508_normal::mi_6508_normal(m6508_device *_base)
+m6508_device::mi_6508::mi_6508(m6508_device *_base)
{
base = _base;
}
-uint8_t m6508_device::mi_6508_normal::read(uint16_t adr)
+uint8_t m6508_device::mi_6508::read(uint16_t adr)
{
- uint8_t res = program->read_byte(adr);
+ uint8_t res = program.read_byte(adr);
if(adr == 0x0000)
res = base->dir_r();
else if(adr == 0x0001)
@@ -215,9 +183,9 @@ uint8_t m6508_device::mi_6508_normal::read(uint16_t adr)
return res;
}
-uint8_t m6508_device::mi_6508_normal::read_sync(uint16_t adr)
+uint8_t m6508_device::mi_6508::read_sync(uint16_t adr)
{
- uint8_t res = scache->read_byte(adr);
+ uint8_t res = csprogram.read_byte(adr);
if(adr == 0x0000)
res = base->dir_r();
else if(adr == 0x0001)
@@ -227,9 +195,9 @@ uint8_t m6508_device::mi_6508_normal::read_sync(uint16_t adr)
return res;
}
-uint8_t m6508_device::mi_6508_normal::read_arg(uint16_t adr)
+uint8_t m6508_device::mi_6508::read_arg(uint16_t adr)
{
- uint8_t res = cache->read_byte(adr);
+ uint8_t res = cprogram.read_byte(adr);
if(adr == 0x0000)
res = base->dir_r();
else if(adr == 0x0001)
@@ -239,9 +207,9 @@ uint8_t m6508_device::mi_6508_normal::read_arg(uint16_t adr)
return res;
}
-void m6508_device::mi_6508_normal::write(uint16_t adr, uint8_t val)
+void m6508_device::mi_6508::write(uint16_t adr, uint8_t val)
{
- program->write_byte(adr, val);
+ program.write_byte(adr, val);
if(adr == 0x0000)
base->dir_w(val);
else if(adr == 0x0001)
@@ -250,33 +218,5 @@ void m6508_device::mi_6508_normal::write(uint16_t adr, uint8_t val)
base->ram_page[adr & 0x00ff] = val;
}
-m6508_device::mi_6508_nd::mi_6508_nd(m6508_device *_base) : mi_6508_normal(_base)
-{
-}
-
-uint8_t m6508_device::mi_6508_nd::read_sync(uint16_t adr)
-{
- uint8_t res = sprogram->read_byte(adr);
- if(adr == 0x0000)
- res = base->dir_r();
- else if(adr == 0x0001)
- res = base->port_r();
- else if(adr < 0x0200)
- res = base->ram_page[adr & 0x00ff];
- return res;
-}
-
-uint8_t m6508_device::mi_6508_nd::read_arg(uint16_t adr)
-{
- uint8_t res = program->read_byte(adr);
- if(adr == 0x0000)
- res = base->dir_r();
- else if(adr == 0x0001)
- res = base->port_r();
- else if(adr < 0x0200)
- res = base->ram_page[adr & 0x00ff];
- return res;
-}
-
#include "cpu/m6502/m6510.hxx"