made device flags const (nw)

This commit is contained in:
mahlemiut 2018-07-14 00:14:41 +12:00
parent a53816282c
commit 7b42461543
2 changed files with 19 additions and 25 deletions

View File

@ -260,8 +260,11 @@ inline int i8255_device::port_c_upper_mode()
// i8255_device - constructor // i8255_device - constructor
//------------------------------------------------- //-------------------------------------------------
i8255_device::i8255_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) i8255_device::i8255_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, bool is_ams40489)
: device_t(mconfig, type, tag, owner, clock), : device_t(mconfig, type, tag, owner, clock),
m_force_portb_in(is_ams40489),
m_force_portc_out(is_ams40489),
m_dont_clear_output_latches(is_ams40489),
m_in_pa_cb(*this), m_in_pa_cb(*this),
m_in_pb_cb(*this), m_in_pb_cb(*this),
m_in_pc_cb(*this), m_in_pc_cb(*this),
@ -275,7 +278,7 @@ i8255_device::i8255_device(const machine_config &mconfig, device_type type, cons
m_control = 0; m_control = 0;
} }
i8255_device::i8255_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) i8255_device::i8255_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, bool is_ams40489)
: i8255_device(mconfig, I8255, tag, owner, clock) : i8255_device(mconfig, I8255, tag, owner, clock)
{ {
} }
@ -306,10 +309,6 @@ void i8255_device::device_start()
save_item(NAME(m_inte1)); save_item(NAME(m_inte1));
save_item(NAME(m_inte2)); save_item(NAME(m_inte2));
save_item(NAME(m_intr)); save_item(NAME(m_intr));
m_force_portb_in = false;
m_force_portc_out = false;
m_dont_clear_output_latches = false;
} }
@ -662,17 +661,17 @@ void i8255_device::set_mode(uint8_t data)
{ {
m_control = data; m_control = data;
if(m_force_portb_in) if (m_force_portb_in)
m_control = m_control | CONTROL_PORT_B_INPUT; m_control = m_control | CONTROL_PORT_B_INPUT;
if(m_force_portc_out) if (m_force_portc_out)
{ {
m_control = m_control & ~CONTROL_PORT_C_UPPER_INPUT; m_control = m_control & ~CONTROL_PORT_C_UPPER_INPUT;
m_control = m_control & ~CONTROL_PORT_C_LOWER_INPUT; m_control = m_control & ~CONTROL_PORT_C_LOWER_INPUT;
} }
// group A // group A
if(!m_dont_clear_output_latches) if (!m_dont_clear_output_latches)
m_output[PORT_A] = 0; m_output[PORT_A] = 0;
m_input[PORT_A] = 0; m_input[PORT_A] = 0;
m_ibf[PORT_A] = 0; m_ibf[PORT_A] = 0;
@ -699,7 +698,7 @@ void i8255_device::set_mode(uint8_t data)
LOG("I8255 Port C Lower Mode: %s\n", (port_c_lower_mode() == MODE_OUTPUT) ? "output" : "input"); LOG("I8255 Port C Lower Mode: %s\n", (port_c_lower_mode() == MODE_OUTPUT) ? "output" : "input");
// group B // group B
if(!m_dont_clear_output_latches) if (!m_dont_clear_output_latches)
m_output[PORT_B] = 0; m_output[PORT_B] = 0;
m_input[PORT_B] = 0; m_input[PORT_B] = 0;
m_ibf[PORT_B] = 0; m_ibf[PORT_B] = 0;
@ -716,7 +715,7 @@ void i8255_device::set_mode(uint8_t data)
m_out_pb_cb((offs_t)0, m_tri_pb_cb(0)); m_out_pb_cb((offs_t)0, m_tri_pb_cb(0));
} }
if(!m_dont_clear_output_latches) if (!m_dont_clear_output_latches)
m_output[PORT_C] = 0; m_output[PORT_C] = 0;
m_input[PORT_C] = 0; m_input[PORT_C] = 0;
@ -1027,17 +1026,10 @@ WRITE_LINE_MEMBER( i8255_device::pc6_w )
// AMS40489 (Amstrad Plus/GX4000 ASIC PPI implementation) // AMS40489 (Amstrad Plus/GX4000 ASIC PPI implementation)
ams40489_ppi_device::ams40489_ppi_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) ams40489_ppi_device::ams40489_ppi_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: i8255_device(mconfig,AMS40489_PPI,tag,owner,clock) : i8255_device(mconfig,AMS40489_PPI,tag,owner,clock,true)
{ {
} }
void ams40489_ppi_device::device_reset() { i8255_device::device_reset(); } void ams40489_ppi_device::device_reset() { i8255_device::device_reset(); }
void ams40489_ppi_device::device_start() { i8255_device::device_start(); }
void ams40489_ppi_device::device_start()
{
i8255_device::device_start();
m_force_portb_in = true;
m_force_portc_out = true;
m_dont_clear_output_latches = true;
}

View File

@ -74,7 +74,7 @@ class i8255_device : public device_t
{ {
public: public:
// construction/destruction // construction/destruction
i8255_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); i8255_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, bool is_ams40489 = false);
template <class Object> devcb_base &set_in_pa_callback(Object &&cb) { return m_in_pa_cb.set_callback(std::forward<Object>(cb)); } template <class Object> devcb_base &set_in_pa_callback(Object &&cb) { return m_in_pa_cb.set_callback(std::forward<Object>(cb)); }
template <class Object> devcb_base &set_in_pb_callback(Object &&cb) { return m_in_pb_cb.set_callback(std::forward<Object>(cb)); } template <class Object> devcb_base &set_in_pb_callback(Object &&cb) { return m_in_pb_cb.set_callback(std::forward<Object>(cb)); }
@ -107,15 +107,15 @@ public:
DECLARE_WRITE_LINE_MEMBER( pc6_w ); DECLARE_WRITE_LINE_MEMBER( pc6_w );
protected: protected:
i8255_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); i8255_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, bool is_ams40489 = false);
// device-level overrides // device-level overrides
virtual void device_start() override; virtual void device_start() override;
virtual void device_reset() override; virtual void device_reset() override;
bool m_force_portb_in; const bool m_force_portb_in;
bool m_force_portc_out; const bool m_force_portc_out;
bool m_dont_clear_output_latches; const bool m_dont_clear_output_latches;
private: private:
inline void check_interrupt(int port); inline void check_interrupt(int port);
@ -172,6 +172,8 @@ public:
ams40489_ppi_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); ams40489_ppi_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected: protected:
// ams40489_ppi_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides // device-level overrides
virtual void device_start() override; virtual void device_start() override;
virtual void device_reset() override; virtual void device_reset() override;