devcb: Add line hold capability [O. Galibert]

Whoever feels like saying that "HOLD does not exist in hardware", I
invite to admire the beautiful TTL circuit to the left of the 68000s
in the Over Drive schematics.
This commit is contained in:
Olivier Galibert 2017-06-06 18:57:46 +02:00
parent e1cbf35832
commit b29c4c4323
2 changed files with 30 additions and 1 deletions

View File

@ -267,6 +267,7 @@ void devcb_read_base::resolve()
case CALLBACK_INPUTLINE:
case CALLBACK_ASSERTLINE:
case CALLBACK_CLEARLINE:
case CALLBACK_HOLDLINE:
throw emu_fatalerror("Device read callbacks can't be connected to input lines\n");
}
}
@ -526,6 +527,11 @@ void devcb_write_base::resolve()
resolve_inputline();
m_adapter = &devcb_write_base::write_clearline_adapter;
break;
case CALLBACK_HOLDLINE:
resolve_inputline();
m_adapter = &devcb_write_base::write_holdline_adapter;
break;
}
}
catch (binding_type_exception &binderr)
@ -691,3 +697,14 @@ void devcb_write_base::write_clearline_adapter(address_space &space, offs_t offs
if (unshift_mask_xor(data) & 1)
m_target.device->execute().set_input_line(m_target_int, CLEAR_LINE);
}
//-------------------------------------------------
// write_clearline_adapter - write to a device's
// input line
//-------------------------------------------------
void devcb_write_base::write_holdline_adapter(address_space &space, offs_t offset, u64 data, u64 mask)
{
if (unshift_mask_xor(data) & 1)
m_target.device->execute().set_input_line(m_target_int, HOLD_LINE);
}

View File

@ -31,6 +31,7 @@
#define DEVCB_INPUTLINE(_tag, _line) devcb_base::inputline_desc(_tag, _line)
#define DEVCB_ASSERTLINE(_tag, _line) devcb_base::assertline_desc(_tag, _line)
#define DEVCB_CLEARLINE(_tag, _line) devcb_base::clearline_desc(_tag, _line)
#define DEVCB_HOLDLINE(_tag, _line) devcb_base::holdline_desc(_tag, _line)
#define DEVCB_VCC DEVCB_CONSTANT(1)
#define DEVCB_GND DEVCB_CONSTANT(0)
@ -104,7 +105,8 @@ protected:
CALLBACK_CONSTANT,
CALLBACK_INPUTLINE,
CALLBACK_ASSERTLINE,
CALLBACK_CLEARLINE
CALLBACK_CLEARLINE,
CALLBACK_HOLDLINE
};
// construction/destruction
@ -180,6 +182,14 @@ public:
int m_inputnum;
};
class holdline_desc
{
public:
holdline_desc(const char *tag, int inputnum) { m_tag = tag; m_inputnum = inputnum; }
const char *m_tag;
int m_inputnum;
};
// shared callback setters
devcb_base &set_callback(null_desc null) { reset(CALLBACK_NONE); return *this; }
devcb_base &set_callback(ioport_desc ioport) { reset(CALLBACK_IOPORT); m_target_tag = ioport.m_tag; return *this; }
@ -300,6 +310,7 @@ public:
devcb_base &set_callback(inputline_desc inputline) { reset(CALLBACK_INPUTLINE); m_target_tag = inputline.m_tag; m_target_int = inputline.m_inputnum; return *this; }
devcb_base &set_callback(assertline_desc inputline) { reset(CALLBACK_ASSERTLINE); m_target_tag = inputline.m_tag; m_target_int = inputline.m_inputnum; return *this; }
devcb_base &set_callback(clearline_desc inputline) { reset(CALLBACK_CLEARLINE); m_target_tag = inputline.m_tag; m_target_int = inputline.m_inputnum; return *this; }
devcb_base &set_callback(holdline_desc inputline) { reset(CALLBACK_HOLDLINE); m_target_tag = inputline.m_tag; m_target_int = inputline.m_inputnum; return *this; }
devcb_write_base &chain_alloc();
// resolution
@ -326,6 +337,7 @@ private:
void write_inputline_adapter(address_space &space, offs_t offset, u64 data, u64 mask);
void write_assertline_adapter(address_space &space, offs_t offset, u64 data, u64 mask);
void write_clearline_adapter(address_space &space, offs_t offset, u64 data, u64 mask);
void write_holdline_adapter(address_space &space, offs_t offset, u64 data, u64 mask);
// configuration
write_line_delegate m_writeline; // copy of registered line writer