get rid of active_safe (nw)

This commit is contained in:
Wilbert Pol 2015-08-12 10:04:36 +02:00
parent 48dee177af
commit 0448566a4c
3 changed files with 33 additions and 17 deletions

View File

@ -1200,7 +1200,6 @@ public:
const char *tag() const { return m_tag.c_str(); }
int modcount() const { return m_modcount; }
ioport_value active() const { return m_active; }
ioport_value active_safe(ioport_value defval) const { return (this == NULL) ? defval : active(); }
ioport_port_live &live() const { assert(m_live != NULL); return *m_live; }
// read/write to the port

View File

@ -74,14 +74,14 @@ void dc_controller_device::fixed_status(UINT32 *dest)
{
dest[0] = 0x20000000; // Controller
dest[1] =
((ioport(port_tag[2]) != NULL) ? 0x010000 : 0) |
((ioport(port_tag[3]) != NULL) ? 0x020000 : 0) |
((ioport(port_tag[4]) != NULL) ? 0x040000 : 0) |
((ioport(port_tag[5]) != NULL) ? 0x080000 : 0) |
((ioport(port_tag[6]) != NULL) ? 0x100000 : 0) |
((ioport(port_tag[7]) != NULL) ? 0x200000 : 0) |
(ioport(port_tag[0])->active_safe(0) << 8) |
ioport(port_tag[1])->active_safe(0); // 1st function - controller
((port[2] != NULL) ? 0x010000 : 0) |
((port[3] != NULL) ? 0x020000 : 0) |
((port[4] != NULL) ? 0x040000 : 0) |
((port[5] != NULL) ? 0x080000 : 0) |
((port[6] != NULL) ? 0x100000 : 0) |
((port[7] != NULL) ? 0x200000 : 0) |
((port[0] ? port[0]->active() : 0) << 8) |
(port[1] ? port[1]->active() : 0); // 1st function - controller
dest[2] = 0; // No 2nd function
dest[3] = 0; // No 3rd function
dest[4] = 0x00ff; // Every region, no expansion
@ -99,13 +99,24 @@ void dc_controller_device::read(UINT32 *dest)
{
dest[0] = 0x21000000; // Controller
dest[1] =
ioport(port_tag[0])->read_safe(0xff) |
(ioport(port_tag[1])->read_safe(0xff) << 8) |
(ioport(port_tag[2])->read_safe(0x00) << 16) |
(ioport(port_tag[3])->read_safe(0x00) << 24);
(port[0] ? port[0]->read() : 0xff) |
((port[1] ? port[1]->read() : 0xff) << 8) |
((port[2] ? port[2]->read() : 0) << 16) |
((port[3] ? port[3]->read() : 0) << 24);
dest[2] =
ioport(port_tag[4])->read_safe(0x80) |
(ioport(port_tag[5])->read_safe(0x80) << 8) |
(ioport(port_tag[6])->read_safe(0x80) << 16) |
(ioport(port_tag[7])->read_safe(0x80) << 24);
(port[4] ? port[4]->read() : 0x80) |
((port[5] ? port[5]->read() : 0x80) << 8) |
((port[6] ? port[6]->read() : 0x80) << 16) |
((port[7] ? port[7]->read() : 0x80) << 24);
}
void dc_controller_device::device_start()
{
maple_device::device_start();
for (int i = 0; i < 8; i++)
{
port[i] = ioport(port_tag[i]);
}
}

View File

@ -38,6 +38,10 @@ public:
void maple_w(const UINT32 *data, UINT32 in_size);
protected:
// device-level overrides
virtual void device_start();
private:
void fixed_status(UINT32 *dest);
void free_status(UINT32 *dest);
@ -45,6 +49,8 @@ private:
const char *port_tag[8];
const char *id, *license, *versions;
ioport_port *port[8];
};
extern const device_type DC_CONTROLLER;