mirror of
https://github.com/mamedev/mame.git
synced 2024-11-16 07:48:32 +01:00
heathkit/h89.cpp, heathkit/intr_cntrl.cpp, heathkit/z37_fdc.cpp: Cleaned up singal line handlers. (#11460)
* Got rid of inappropriate use of ASSERT_LINE/CLEAR_LINE. * Cleaned up member names. * Avoid implicit integer/Boolean conversions.
This commit is contained in:
parent
49e959e044
commit
a868c1568d
5 changed files with 57 additions and 59 deletions
|
@ -379,19 +379,19 @@ void h89_state::raise_NMI_w(uint8_t)
|
|||
|
||||
void h89_state::console_intr(uint8_t data)
|
||||
{
|
||||
if (data == CLEAR_LINE)
|
||||
if (bool(data))
|
||||
{
|
||||
m_intr_cntrl->lower_irq(3);
|
||||
m_intr_cntrl->raise_irq(3);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_intr_cntrl->raise_irq(3);
|
||||
m_intr_cntrl->lower_irq(3);
|
||||
}
|
||||
}
|
||||
|
||||
void h89_state::reset_line(int data)
|
||||
{
|
||||
if (data == ASSERT_LINE)
|
||||
if (bool(data))
|
||||
{
|
||||
reset();
|
||||
}
|
||||
|
@ -461,7 +461,7 @@ void h89_state::h89(machine_config & config)
|
|||
|
||||
HEATH_Z37_FDC(config, m_h37);
|
||||
m_h37->drq_cb().set(m_intr_cntrl, FUNC(z37_intr_cntrl::set_drq));
|
||||
m_h37->irq_cb().set(m_intr_cntrl, FUNC(z37_intr_cntrl::set_intrq));
|
||||
m_h37->irq_cb().set(m_intr_cntrl, FUNC(z37_intr_cntrl::set_irq));
|
||||
m_h37->block_interrupt_cb().set(m_intr_cntrl, FUNC(z37_intr_cntrl::block_interrupts));
|
||||
|
||||
// H-88-3 3-port serial board
|
||||
|
|
|
@ -13,14 +13,14 @@
|
|||
DEFINE_DEVICE_TYPE(HEATH_INTR_CNTRL, heath_intr_cntrl, "heath_intr_cntrl", "Heath H/Z-89 Interrupt Controller");
|
||||
DEFINE_DEVICE_TYPE(HEATH_Z37_INTR_CNTRL, z37_intr_cntrl, "heath_z37_intr_cntrl", "Heath H/Z-89 with Z-37 Interrupt Controller");
|
||||
|
||||
heath_intr_cntrl::heath_intr_cntrl(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: heath_intr_cntrl(mconfig, HEATH_INTR_CNTRL, tag, owner, clock)
|
||||
heath_intr_cntrl::heath_intr_cntrl(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock):
|
||||
heath_intr_cntrl(mconfig, HEATH_INTR_CNTRL, tag, owner, clock)
|
||||
{
|
||||
}
|
||||
|
||||
heath_intr_cntrl::heath_intr_cntrl(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
|
||||
: device_t(mconfig, type, tag, owner, 0)
|
||||
, m_irq_line(*this)
|
||||
heath_intr_cntrl::heath_intr_cntrl(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock):
|
||||
device_t(mconfig, type, tag, owner, 0),
|
||||
m_irq_line(*this)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ void heath_intr_cntrl::device_reset()
|
|||
void heath_intr_cntrl::update_intr_line()
|
||||
{
|
||||
|
||||
m_irq_line(m_intr_lines == 0 ? CLEAR_LINE : ASSERT_LINE);
|
||||
m_irq_line((m_intr_lines == 0) ? 0 : 1);
|
||||
}
|
||||
|
||||
void heath_intr_cntrl::raise_irq(uint8_t level)
|
||||
|
@ -99,21 +99,19 @@ IRQ_CALLBACK_MEMBER(heath_intr_cntrl::irq_callback)
|
|||
return get_instruction();
|
||||
}
|
||||
|
||||
z37_intr_cntrl::z37_intr_cntrl(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: heath_intr_cntrl(mconfig, HEATH_Z37_INTR_CNTRL, tag, owner, clock)
|
||||
z37_intr_cntrl::z37_intr_cntrl(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock):
|
||||
heath_intr_cntrl(mconfig, HEATH_Z37_INTR_CNTRL, tag, owner, clock)
|
||||
{
|
||||
m_interrupts_blocked = false;
|
||||
m_intr_blocked = false;
|
||||
m_drq_raised = false;
|
||||
m_fd_irq_raised = false;
|
||||
m_irq_raised = false;
|
||||
}
|
||||
|
||||
void z37_intr_cntrl::update_intr_line()
|
||||
{
|
||||
|
||||
m_irq_line(
|
||||
m_fd_irq_raised ||
|
||||
m_drq_raised ||
|
||||
(!m_interrupts_blocked && (m_intr_lines != 0)) ? ASSERT_LINE : CLEAR_LINE);
|
||||
(m_irq_raised || m_drq_raised ||
|
||||
(!m_intr_blocked && (m_intr_lines != 0))) ? 1 : 0);
|
||||
}
|
||||
|
||||
uint8_t z37_intr_cntrl::get_instruction()
|
||||
|
@ -125,34 +123,34 @@ uint8_t z37_intr_cntrl::get_instruction()
|
|||
return 0xfb;
|
||||
}
|
||||
|
||||
if (m_fd_irq_raised)
|
||||
if (m_irq_raised)
|
||||
{
|
||||
// RST 20H (Interrupt 4)
|
||||
return 0xe7;
|
||||
}
|
||||
|
||||
|
||||
if (!m_interrupts_blocked)
|
||||
if (!m_intr_blocked)
|
||||
{
|
||||
return heath_intr_cntrl::get_instruction();
|
||||
}
|
||||
|
||||
// shouldn't get here - NO-OP?
|
||||
logerror("Warning: z37 intr get_instruction: fd: %d dr: %d ib: %d\n", m_fd_irq_raised, m_drq_raised, m_interrupts_blocked);
|
||||
logerror("Warning: z37 intr get_instruction: fd: %d dr: %d ib: %d\n", m_irq_raised, m_drq_raised, m_intr_blocked);
|
||||
return 0x00;
|
||||
}
|
||||
|
||||
void z37_intr_cntrl::set_drq(uint8_t data)
|
||||
void z37_intr_cntrl::set_drq(int state)
|
||||
{
|
||||
m_drq_raised = (data != CLEAR_LINE);
|
||||
m_drq_raised = bool(state);
|
||||
|
||||
update_intr_line();
|
||||
}
|
||||
|
||||
|
||||
void z37_intr_cntrl::set_intrq(uint8_t data)
|
||||
void z37_intr_cntrl::set_irq(int state)
|
||||
{
|
||||
m_fd_irq_raised = (data != CLEAR_LINE);
|
||||
m_irq_raised = bool(state);
|
||||
|
||||
update_intr_line();
|
||||
}
|
||||
|
@ -161,13 +159,13 @@ void z37_intr_cntrl::device_start()
|
|||
{
|
||||
heath_intr_cntrl::device_start();
|
||||
|
||||
save_item(NAME(m_interrupts_blocked));
|
||||
save_item(NAME(m_intr_blocked));
|
||||
save_item(NAME(m_drq_raised));
|
||||
save_item(NAME(m_fd_irq_raised));
|
||||
save_item(NAME(m_irq_raised));
|
||||
|
||||
m_interrupts_blocked = false;
|
||||
m_intr_blocked = false;
|
||||
m_drq_raised = false;
|
||||
m_fd_irq_raised = false;
|
||||
m_irq_raised = false;
|
||||
}
|
||||
|
||||
void z37_intr_cntrl::device_reset()
|
||||
|
@ -177,7 +175,7 @@ void z37_intr_cntrl::device_reset()
|
|||
|
||||
void z37_intr_cntrl::block_interrupts(uint8_t data)
|
||||
{
|
||||
m_interrupts_blocked = (data != CLEAR_LINE);
|
||||
m_intr_blocked = bool(data);
|
||||
|
||||
update_intr_line();
|
||||
}
|
||||
|
|
|
@ -52,8 +52,8 @@ class z37_intr_cntrl : public heath_intr_cntrl
|
|||
public:
|
||||
z37_intr_cntrl(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
|
||||
|
||||
virtual void set_drq(uint8_t data);
|
||||
virtual void set_intrq(uint8_t data);
|
||||
virtual void set_drq(int state);
|
||||
virtual void set_irq(int state);
|
||||
virtual void block_interrupts(uint8_t data);
|
||||
|
||||
protected:
|
||||
|
@ -65,9 +65,9 @@ protected:
|
|||
virtual void device_reset() override;
|
||||
|
||||
private:
|
||||
bool m_interrupts_blocked;
|
||||
bool m_intr_blocked;
|
||||
bool m_drq_raised;
|
||||
bool m_fd_irq_raised;
|
||||
bool m_irq_raised;
|
||||
};
|
||||
|
||||
DECLARE_DEVICE_TYPE(HEATH_INTR_CNTRL, heath_intr_cntrl)
|
||||
|
|
|
@ -36,7 +36,7 @@ DEFINE_DEVICE_TYPE(HEATH_Z37_FDC, heath_z37_fdc_device, "heath_z37_fdc", "Heath
|
|||
|
||||
heath_z37_fdc_device::heath_z37_fdc_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock):
|
||||
device_t(mconfig, HEATH_Z37_FDC, tag, owner, 0),
|
||||
m_fd_irq_cb(*this),
|
||||
m_irq_cb(*this),
|
||||
m_drq_cb(*this),
|
||||
m_block_interrupt_cb(*this),
|
||||
m_fdc(*this, "z37_fdc"),
|
||||
|
@ -49,21 +49,21 @@ void heath_z37_fdc_device::ctrl_w(u8 val)
|
|||
{
|
||||
bool motor_on = bool(BIT(val, ctrl_MotorsOn_c));
|
||||
|
||||
m_intrq_allowed = bool(BIT(val, ctrl_EnableIntReq_c));
|
||||
m_irq_allowed = bool(BIT(val, ctrl_EnableIntReq_c));
|
||||
m_drq_allowed = bool(BIT(val, ctrl_EnableDrqInt_c));
|
||||
m_fdc->dden_w(BIT(val, ctrl_SetMFMRecording_c) ? CLEAR_LINE : ASSERT_LINE);
|
||||
m_fdc->dden_w(BIT(~val, ctrl_SetMFMRecording_c));
|
||||
|
||||
LOGREG("%s: motor on: %d, intrq allowed: %d, drq allowed: %d\n",
|
||||
FUNCNAME, motor_on, m_intrq_allowed, m_drq_allowed);
|
||||
FUNCNAME, motor_on, m_irq_allowed, m_drq_allowed);
|
||||
|
||||
if (m_drq_allowed)
|
||||
{
|
||||
m_block_interrupt_cb(ASSERT_LINE);
|
||||
m_block_interrupt_cb(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_block_interrupt_cb(CLEAR_LINE);
|
||||
m_drq_cb(CLEAR_LINE);
|
||||
m_block_interrupt_cb(0);
|
||||
m_drq_cb(0);
|
||||
}
|
||||
|
||||
if (BIT(val, ctrl_Drive_0_c))
|
||||
|
@ -176,24 +176,24 @@ u8 heath_z37_fdc_device::read(offs_t reg)
|
|||
|
||||
void heath_z37_fdc_device::device_start()
|
||||
{
|
||||
save_item(NAME(m_intrq_allowed));
|
||||
save_item(NAME(m_irq_allowed));
|
||||
save_item(NAME(m_drq_allowed));
|
||||
save_item(NAME(m_access_track_sector));
|
||||
|
||||
m_intrq_allowed = false;
|
||||
m_irq_allowed = false;
|
||||
m_drq_allowed = false;
|
||||
m_access_track_sector = false;
|
||||
}
|
||||
|
||||
void heath_z37_fdc_device::device_reset()
|
||||
{
|
||||
m_intrq_allowed = false;
|
||||
m_irq_allowed = false;
|
||||
m_drq_allowed = false;
|
||||
m_access_track_sector = false;
|
||||
|
||||
m_fd_irq_cb(CLEAR_LINE);
|
||||
m_drq_cb(CLEAR_LINE);
|
||||
m_block_interrupt_cb(CLEAR_LINE);
|
||||
m_irq_cb(0);
|
||||
m_drq_cb(0);
|
||||
m_block_interrupt_cb(0);
|
||||
}
|
||||
|
||||
static void z37_floppies(device_slot_interface &device)
|
||||
|
@ -224,16 +224,16 @@ void heath_z37_fdc_device::device_add_mconfig(machine_config &config)
|
|||
m_floppies[3]->enable_sound(true);
|
||||
}
|
||||
|
||||
void heath_z37_fdc_device::set_irq(u8 data)
|
||||
void heath_z37_fdc_device::set_irq(int state)
|
||||
{
|
||||
LOGLINES("set irq, allowed: %d data: %d\n", m_intrq_allowed, data);
|
||||
LOGLINES("set irq, allowed: %d state: %d\n", m_irq_allowed, state);
|
||||
|
||||
m_fd_irq_cb(m_intrq_allowed ? data : CLEAR_LINE);
|
||||
m_irq_cb(m_irq_allowed ? state : 0);
|
||||
}
|
||||
|
||||
void heath_z37_fdc_device::set_drq(u8 data)
|
||||
void heath_z37_fdc_device::set_drq(int state)
|
||||
{
|
||||
LOGLINES("set drq, allowed: %d data: %d\n", m_intrq_allowed, data);
|
||||
LOGLINES("set drq, allowed: %d state: %d\n", m_irq_allowed, state);
|
||||
|
||||
m_drq_cb(m_drq_allowed ? data : CLEAR_LINE);
|
||||
m_drq_cb(m_drq_allowed ? state : 0);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public:
|
|||
|
||||
void write(offs_t reg, u8 val);
|
||||
u8 read(offs_t reg);
|
||||
auto irq_cb() { return m_fd_irq_cb.bind(); }
|
||||
auto irq_cb() { return m_irq_cb.bind(); }
|
||||
auto drq_cb() { return m_drq_cb.bind(); }
|
||||
|
||||
auto block_interrupt_cb() { return m_block_interrupt_cb.bind(); }
|
||||
|
@ -43,18 +43,18 @@ protected:
|
|||
void data_w(u8 val);
|
||||
u8 data_r();
|
||||
|
||||
void set_irq(u8 data);
|
||||
void set_drq(u8 data);
|
||||
void set_irq(int state);
|
||||
void set_drq(int state);
|
||||
|
||||
private:
|
||||
devcb_write_line m_fd_irq_cb;
|
||||
devcb_write_line m_irq_cb;
|
||||
devcb_write_line m_drq_cb;
|
||||
devcb_write_line m_block_interrupt_cb;
|
||||
|
||||
required_device<fd1797_device> m_fdc;
|
||||
required_device_array<floppy_connector, 4> m_floppies;
|
||||
|
||||
bool m_intrq_allowed;
|
||||
bool m_irq_allowed;
|
||||
bool m_drq_allowed;
|
||||
bool m_access_track_sector;
|
||||
|
||||
|
|
Loading…
Reference in a new issue