mirror of
https://github.com/holub/mame
synced 2025-07-01 16:19:38 +03:00
z80pio: change an if/else block to switch/case,
dl1416: don't randomize ram at power on
This commit is contained in:
parent
f848229294
commit
c92ee7270b
@ -559,10 +559,24 @@ void z80pio_device::pio_port::write(uint8_t data)
|
|||||||
|
|
||||||
data &= mask;
|
data &= mask;
|
||||||
|
|
||||||
if ((m_icw & 0x60) == 0 && data != mask) match = true;
|
switch (m_icw & 0x60)
|
||||||
else if ((m_icw & 0x60) == 0x20 && data != 0) match = true;
|
{
|
||||||
else if ((m_icw & 0x60) == 0x40 && data == 0) match = true;
|
case 0x00:
|
||||||
else if ((m_icw & 0x60) == 0x60 && data == mask) match = true;
|
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)
|
if (!m_match && match && !m_ius)
|
||||||
{
|
{
|
||||||
|
@ -58,6 +58,7 @@ public:
|
|||||||
// construction/destruction
|
// construction/destruction
|
||||||
z80pio_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
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 out_int_callback() { return m_out_int_cb.bind(); }
|
||||||
auto in_pa_callback() { return m_in_pa_cb.bind(); }
|
auto in_pa_callback() { return m_in_pa_cb.bind(); }
|
||||||
auto out_pa_callback() { return m_out_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_pb_callback() { return m_out_pb_cb.bind(); }
|
||||||
auto out_brdy_callback() { return m_out_brdy_cb.bind(); }
|
auto out_brdy_callback() { return m_out_brdy_cb.bind(); }
|
||||||
|
|
||||||
|
|
||||||
// I/O line access
|
// I/O line access
|
||||||
int rdy(int which) { return m_port[which].rdy(); }
|
int rdy(int which) { return m_port[which].rdy(); }
|
||||||
void strobe(int which, bool state) { m_port[which].strobe(state); }
|
void strobe(int which, bool state) { m_port[which].strobe(state); }
|
||||||
@ -196,9 +196,9 @@ private:
|
|||||||
|
|
||||||
int m_mode; // mode register
|
int m_mode; // mode register
|
||||||
int m_next_control_word; // next control word
|
int m_next_control_word; // next control word
|
||||||
uint8_t m_input; // input latch
|
uint8_t m_input; // input latch
|
||||||
uint8_t m_output; // output latch
|
uint8_t m_output; // output latch
|
||||||
uint8_t m_ior; // input/output register
|
uint8_t m_ior; // input/output register
|
||||||
bool m_rdy; // ready
|
bool m_rdy; // ready
|
||||||
bool m_stb; // strobe
|
bool m_stb; // strobe
|
||||||
|
|
||||||
@ -206,14 +206,14 @@ private:
|
|||||||
bool m_ie; // interrupt enabled
|
bool m_ie; // interrupt enabled
|
||||||
bool m_ip; // interrupt pending
|
bool m_ip; // interrupt pending
|
||||||
bool m_ius; // interrupt under service
|
bool m_ius; // interrupt under service
|
||||||
uint8_t m_icw; // interrupt control word
|
uint8_t m_icw; // interrupt control word
|
||||||
uint8_t m_vector; // interrupt vector
|
uint8_t m_vector; // interrupt vector
|
||||||
uint8_t m_mask; // interrupt mask
|
uint8_t m_mask; // interrupt mask
|
||||||
bool m_match; // logic equation match
|
bool m_match; // logic equation match
|
||||||
};
|
};
|
||||||
|
|
||||||
// internal state
|
// internal state
|
||||||
pio_port m_port[2];
|
pio_port m_port[2];
|
||||||
devcb_write_line m_out_int_cb;
|
devcb_write_line m_out_int_cb;
|
||||||
|
|
||||||
devcb_read8 m_in_pa_cb;
|
devcb_read8 m_in_pa_cb;
|
||||||
|
@ -225,15 +225,6 @@ void dl1414_device::device_start()
|
|||||||
m_wr_in = true;
|
m_wr_in = true;
|
||||||
m_addr_in = 0x00;
|
m_addr_in = 0x00;
|
||||||
m_data_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()
|
void dl1416_device::device_start()
|
||||||
@ -261,7 +252,7 @@ void dl1414_device::device_reset()
|
|||||||
{
|
{
|
||||||
// push initial display state
|
// push initial display state
|
||||||
for (unsigned i = 0; 4 > i; ++i)
|
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)
|
if (m_digit_ram[offset] != data)
|
||||||
{
|
{
|
||||||
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])
|
if (state != m_cursor_state[offset])
|
||||||
{
|
{
|
||||||
m_cursor_state[offset] = state;
|
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);
|
||||||
|
}
|
||||||
|
@ -66,6 +66,8 @@ protected:
|
|||||||
private:
|
private:
|
||||||
devcb_write16 m_update_cb;
|
devcb_write16 m_update_cb;
|
||||||
|
|
||||||
|
void do_update(offs_t offset);
|
||||||
|
|
||||||
// internal state
|
// internal state
|
||||||
u8 m_digit_ram[4]; // holds the digit code for each position
|
u8 m_digit_ram[4]; // holds the digit code for each position
|
||||||
bool m_cursor_state[4]; // holds the cursor state for each position
|
bool m_cursor_state[4]; // holds the cursor state for each position
|
||||||
|
@ -9,7 +9,7 @@ It was also licensed to Nixdorf.
|
|||||||
Hardware notes:
|
Hardware notes:
|
||||||
- 3870 MCU (Motorola brand) @ 4MHz(2MHz internal)
|
- 3870 MCU (Motorola brand) @ 4MHz(2MHz internal)
|
||||||
- optional external ROM or RAM
|
- optional external ROM or RAM
|
||||||
- 4*Litronix DL 1414 (16*17segs total)
|
- 4*Litronix DL1414 (16*17segs total)
|
||||||
- 33-button keypad
|
- 33-button keypad
|
||||||
|
|
||||||
The CPU and memory is on the cartridge. In theory, any hardware configuration
|
The CPU and memory is on the cartridge. In theory, any hardware configuration
|
||||||
|
Loading…
Reference in New Issue
Block a user