csc: update pia0 ca1/cb1 before writing to pia0,

elite,eag68k: remove m_rotate variable
This commit is contained in:
hap 2024-01-12 17:26:54 +01:00
parent 79afb8d9e5
commit 66836da683
3 changed files with 32 additions and 30 deletions

View File

@ -280,11 +280,13 @@ protected:
// I/O handlers
u16 read_inputs();
void update_inputs();
void update_display();
void update_sound();
u8 speech_r(offs_t offset);
u8 pia0_read(offs_t offset);
void pia0_write(offs_t offset, u8 data);
void pia0_pa_w(u8 data);
void pia0_pb_w(u8 data);
u8 pia0_pa_r();
@ -366,6 +368,16 @@ u16 csc_state::read_inputs()
return ~data;
}
void csc_state::update_inputs()
{
// PIA 0 CA1/CB1: button row 6/7
if (!machine().side_effects_disabled())
{
m_pia[0]->ca1_w(BIT(read_inputs(), 6));
m_pia[0]->cb1_w(BIT(read_inputs(), 7));
}
}
void csc_state::update_display()
{
// 7442 0-8: led select (also input mux)
@ -389,16 +401,16 @@ u8 csc_state::speech_r(offs_t offset)
u8 csc_state::pia0_read(offs_t offset)
{
// CA1/CB1: button row 6/7
if (!machine().side_effects_disabled())
{
m_pia[0]->ca1_w(BIT(read_inputs(), 6));
m_pia[0]->cb1_w(BIT(read_inputs(), 7));
}
update_inputs();
return m_pia[0]->read(offset);
}
void csc_state::pia0_write(offs_t offset, u8 data)
{
update_inputs();
m_pia[0]->write(offset, data);
}
u8 csc_state::pia0_pa_r()
{
// d0-d5: button row 0-5
@ -495,7 +507,7 @@ void csc_state::csc_map(address_map &map)
map(0x0000, 0x07ff).mirror(0x4000).ram();
map(0x0800, 0x0bff).mirror(0x4400).ram();
map(0x1000, 0x1003).mirror(0x47fc).rw(m_pia[1], FUNC(pia6821_device::read), FUNC(pia6821_device::write));
map(0x1800, 0x1803).mirror(0x47fc).w(m_pia[0], FUNC(pia6821_device::write)).r(FUNC(csc_state::pia0_read));
map(0x1800, 0x1803).mirror(0x47fc).rw(FUNC(csc_state::pia0_read), FUNC(csc_state::pia0_write));
map(0x2000, 0x3fff).mirror(0x4000).rom();
map(0xa000, 0xafff).mirror(0x1000).rom();
map(0xc000, 0xffff).rom();

View File

@ -273,7 +273,6 @@ protected:
required_device<dac_bit_interface> m_dac;
optional_ioport_array<3> m_inputs;
bool m_rotate = true;
u8 m_select = 0;
u8 m_7seg_data = 0;
u8 m_led_data = 0;
@ -288,6 +287,7 @@ protected:
void update_dsr();
void mux_w(offs_t offset, u8 data);
u8 input_r(offs_t offset);
virtual u8 board_r() { return m_board->read_rank(m_select, true); }
void leds_w(offs_t offset, u8 data);
void digit_w(offs_t offset, u8 data);
};
@ -391,9 +391,7 @@ class excel68k_state : public eag_state
public:
excel68k_state(const machine_config &mconfig, device_type type, const char *tag) :
eag_state(mconfig, type, tag)
{
m_rotate = false;
}
{ }
// machine configs
void fex68k(machine_config &config);
@ -407,6 +405,9 @@ private:
void fex68km2_map(address_map &map);
void fex68km3_map(address_map &map);
void fex68km4_map(address_map &map);
// I/O handlers
virtual u8 board_r() override { return m_board->read_file(m_select); }
};
@ -455,13 +456,7 @@ u8 eag_state::input_r(offs_t offset)
// a1-a3,d7: multiplexed inputs (active low)
// read chessboard sensors
if (m_select < 8)
{
// EAG chessboard is rotated 90 degrees
if (m_rotate)
data = m_board->read_rank(m_select, true);
else
data = m_board->read_file(m_select);
}
data = board_r();
// read button panel
else if (m_select == 8)

View File

@ -136,7 +136,6 @@ protected:
required_region_ptr<u8> m_language;
required_ioport_array<2> m_inputs;
bool m_rotate = false;
u8 m_led_data = 0;
u8 m_7seg_data = 0;
u8 m_inp_mux = 0;
@ -152,6 +151,7 @@ protected:
void segment_w(offs_t offset, u8 data);
void led_w(offs_t offset, u8 data);
u8 input_r();
virtual u8 board_r() { return m_board->read_file(m_inp_mux, true); }
void ppi_porta_w(u8 data);
u8 ppi_portb_r();
void ppi_portc_w(u8 data);
@ -182,9 +182,7 @@ class eag_state : public elite_state
public:
eag_state(const machine_config &mconfig, device_type type, const char *tag) :
elite_state(mconfig, type, tag)
{
m_rotate = true;
}
{ }
// machine configs
void eag(machine_config &config);
@ -199,6 +197,9 @@ private:
// address maps
void eag_map(address_map &map);
void eag2100_map(address_map &map);
// I/O handlers
virtual u8 board_r() override { return m_board->read_rank(m_inp_mux); }
};
void eag_state::init_eag2100()
@ -256,13 +257,7 @@ u8 elite_state::input_r()
// multiplexed inputs (active low)
// read chessboard sensors
if (m_inp_mux < 8)
{
// EAG chessboard is rotated 90 degrees
if (m_rotate)
data = m_board->read_rank(m_inp_mux);
else
data = m_board->read_file(m_inp_mux, true);
}
data = board_r();
// read button panel
else if (m_inp_mux == 8)