z80pio: change an if/else block to switch/case,

dl1416: don't randomize ram at power on
This commit is contained in:
hap 2023-09-22 15:58:06 +02:00
parent f848229294
commit c92ee7270b
5 changed files with 37 additions and 25 deletions

View File

@ -559,10 +559,24 @@ void z80pio_device::pio_port::write(uint8_t data)
data &= mask;
if ((m_icw & 0x60) == 0 && data != mask) match = true;
else if ((m_icw & 0x60) == 0x20 && data != 0) match = true;
else if ((m_icw & 0x60) == 0x40 && data == 0) match = true;
else if ((m_icw & 0x60) == 0x60 && data == mask) match = true;
switch (m_icw & 0x60)
{
case 0x00:
match = data != mask;
break;
case 0x20:
match = data != 0;
break;
case 0x40:
match = data == 0;
break;
case 0x60:
match = data == mask;
break;
}
if (!m_match && match && !m_ius)
{

View File

@ -58,6 +58,7 @@ public:
// construction/destruction
z80pio_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// configuration helpers
auto out_int_callback() { return m_out_int_cb.bind(); }
auto in_pa_callback() { return m_in_pa_cb.bind(); }
auto out_pa_callback() { return m_out_pa_cb.bind(); }
@ -66,7 +67,6 @@ public:
auto out_pb_callback() { return m_out_pb_cb.bind(); }
auto out_brdy_callback() { return m_out_brdy_cb.bind(); }
// I/O line access
int rdy(int which) { return m_port[which].rdy(); }
void strobe(int which, bool state) { m_port[which].strobe(state); }
@ -196,9 +196,9 @@ private:
int m_mode; // mode register
int m_next_control_word; // next control word
uint8_t m_input; // input latch
uint8_t m_output; // output latch
uint8_t m_ior; // input/output register
uint8_t m_input; // input latch
uint8_t m_output; // output latch
uint8_t m_ior; // input/output register
bool m_rdy; // ready
bool m_stb; // strobe
@ -206,14 +206,14 @@ private:
bool m_ie; // interrupt enabled
bool m_ip; // interrupt pending
bool m_ius; // interrupt under service
uint8_t m_icw; // interrupt control word
uint8_t m_vector; // interrupt vector
uint8_t m_mask; // interrupt mask
uint8_t m_icw; // interrupt control word
uint8_t m_vector; // interrupt vector
uint8_t m_mask; // interrupt mask
bool m_match; // logic equation match
};
// internal state
pio_port m_port[2];
pio_port m_port[2];
devcb_write_line m_out_int_cb;
devcb_read8 m_in_pa_cb;

View File

@ -225,15 +225,6 @@ void dl1414_device::device_start()
m_wr_in = true;
m_addr_in = 0x00;
m_data_in = 0x00;
// randomise internal RAM
for (unsigned i = 0; 4 > i; ++i)
{
m_digit_ram[i] = machine().rand() & 0x3f;
// TODO: only enable the following line if the device actually has a cursor (DL1416T and DL1416B), if DL1414 then cursor is always 0!
//m_cursor_state[i] = bool(BIT(device->machine().rand(), 7));
m_cursor_state[i] = false;
}
}
void dl1416_device::device_start()
@ -261,7 +252,7 @@ void dl1414_device::device_reset()
{
// push initial display state
for (unsigned i = 0; 4 > i; ++i)
m_update_cb(i, translate(m_digit_ram[i], m_cursor_state[i]), 0xffff);
do_update(i);
}
@ -325,7 +316,7 @@ void dl1414_device::bus_w(offs_t offset, u8 data)
if (m_digit_ram[offset] != data)
{
m_digit_ram[offset] = data;
m_update_cb(offset, translate(m_digit_ram[offset], m_cursor_state[offset]), 0xffff);
do_update(offset);
}
}
@ -336,6 +327,11 @@ void dl1414_device::set_cursor_state(offs_t offset, bool state)
if (state != m_cursor_state[offset])
{
m_cursor_state[offset] = state;
m_update_cb(offset, translate(m_digit_ram[offset], m_cursor_state[offset]), 0xffff);
do_update(offset);
}
}
void dl1414_device::do_update(offs_t offset)
{
m_update_cb(offset, translate(m_digit_ram[offset], m_cursor_state[offset]), 0xffff);
}

View File

@ -66,6 +66,8 @@ protected:
private:
devcb_write16 m_update_cb;
void do_update(offs_t offset);
// internal state
u8 m_digit_ram[4]; // holds the digit code for each position
bool m_cursor_state[4]; // holds the cursor state for each position

View File

@ -9,7 +9,7 @@ It was also licensed to Nixdorf.
Hardware notes:
- 3870 MCU (Motorola brand) @ 4MHz(2MHz internal)
- optional external ROM or RAM
- 4*Litronix DL 1414 (16*17segs total)
- 4*Litronix DL1414 (16*17segs total)
- 33-button keypad
The CPU and memory is on the cartridge. In theory, any hardware configuration