mirror of
https://github.com/holub/mame
synced 2025-04-23 17:00:53 +03:00
This took a whole ten minutes to implement. What an undue burden. (nw)
This commit is contained in:
parent
6fc3fa1b78
commit
bc8f4e2bee
@ -26,6 +26,33 @@
|
||||
|
||||
#define FIFO_SIZE 512
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Serial number input kludge
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static INPUT_PORTS_START( pic_serial_adjust )
|
||||
PORT_START("SERIAL_DIGIT")
|
||||
PORT_DIPNAME( 0x0f, 0x06, "Serial Low Digit")
|
||||
PORT_DIPSETTING( 0x00, "0")
|
||||
PORT_DIPSETTING( 0x01, "1")
|
||||
PORT_DIPSETTING( 0x02, "2")
|
||||
PORT_DIPSETTING( 0x03, "3")
|
||||
PORT_DIPSETTING( 0x04, "4")
|
||||
PORT_DIPSETTING( 0x05, "5")
|
||||
PORT_DIPSETTING( 0x06, "6")
|
||||
PORT_DIPSETTING( 0x07, "7")
|
||||
PORT_DIPSETTING( 0x08, "8")
|
||||
PORT_DIPSETTING( 0x09, "9")
|
||||
PORT_BIT( 0xf0, 0x00, IPT_UNUSED )
|
||||
INPUT_PORTS_END
|
||||
|
||||
ioport_constructor midway_serial_pic_device::device_input_ports() const
|
||||
{
|
||||
return INPUT_PORTS_NAME(pic_serial_adjust);
|
||||
}
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Serial number encoding
|
||||
@ -38,8 +65,9 @@ void midway_serial_pic_device::generate_serial_data(int upper)
|
||||
uint32_t serial_number, temp;
|
||||
uint8_t serial_digit[9];
|
||||
|
||||
serial_number = 123456;
|
||||
serial_number = 123450;
|
||||
serial_number += upper * 1000000;
|
||||
serial_number += m_io_serial_digit->read() & 0x0f;
|
||||
|
||||
serial_digit[0] = (serial_number / 100000000) % 10;
|
||||
serial_digit[1] = (serial_number / 10000000) % 10;
|
||||
@ -119,6 +147,7 @@ midway_serial_pic_device::midway_serial_pic_device(const machine_config &mconfig
|
||||
|
||||
midway_serial_pic_device::midway_serial_pic_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) :
|
||||
device_t(mconfig, type, tag, owner, clock),
|
||||
m_io_serial_digit(*this, "SERIAL_DIGIT"),
|
||||
m_upper(0),
|
||||
m_buff(0),
|
||||
m_idx(0),
|
||||
@ -136,9 +165,12 @@ midway_serial_pic_device::midway_serial_pic_device(const machine_config &mconfig
|
||||
void midway_serial_pic_device::device_start()
|
||||
{
|
||||
serial_register_state();
|
||||
generate_serial_data(m_upper);
|
||||
}
|
||||
|
||||
void midway_serial_pic_device::device_reset()
|
||||
{
|
||||
generate_serial_data(m_upper);
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER(midway_serial_pic_device::reset_w)
|
||||
{
|
||||
|
@ -35,12 +35,17 @@ protected:
|
||||
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual ioport_constructor device_input_ports() const override;
|
||||
|
||||
void generate_serial_data(int upper);
|
||||
void serial_register_state();
|
||||
|
||||
required_ioport m_io_serial_digit;
|
||||
|
||||
uint8_t m_data[16]; // reused by other devices
|
||||
int m_upper;
|
||||
|
||||
private:
|
||||
uint8_t m_buff;
|
||||
uint8_t m_idx;
|
||||
|
Loading…
Reference in New Issue
Block a user