com8116: Fixed frequency divisors. [Curt Coder]

(MESS) exp85: Fixed terminal. [Curt Coder]
(MESS) ob68k1a: Fixed terminal. [Curt Coder]
(MESS) super6: Fixed terminal. [Curt Coder]
This commit is contained in:
Curt Coder 2013-05-17 18:05:57 +00:00
parent 92a4a63789
commit 46e17cfdca
12 changed files with 113 additions and 58 deletions

View File

@ -83,6 +83,17 @@ void com8116_device::device_start()
}
//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------
void com8116_device::device_reset()
{
m_fr = 0;
m_ft = 0;
}
//-------------------------------------------------
// device_timer - handler timer events
//-------------------------------------------------
@ -110,13 +121,19 @@ void com8116_device::device_timer(emu_timer &timer, device_timer_id id, int para
// str_w -
//-------------------------------------------------
void com8116_device::str_w(UINT8 data)
{
m_fr = data & 0x0f;
int fr_clock = clock() / m_fr_divisors[m_fr];
if (LOG) logerror("COM8116 '%s' Receiver Divisor Select %01x: %u (%u Hz)\n", tag(), data & 0x0f, m_fr_divisors[m_fr], fr_clock);
m_fr_timer->adjust(attotime::from_nsec(3500), 0, attotime::from_hz(fr_clock));
}
WRITE8_MEMBER( com8116_device::str_w )
{
if (LOG) logerror("COM8116 '%s' Receiver Divider %01x\n", tag(), data & 0x0f);
m_fr = data & 0x0f;
m_fr_timer->adjust(attotime::zero, 0, attotime::from_hz(clock() / m_fr_divisors[m_fr] / 2));
str_w(data);
}
@ -124,11 +141,17 @@ WRITE8_MEMBER( com8116_device::str_w )
// stt_w -
//-------------------------------------------------
void com8116_device::stt_w(UINT8 data)
{
m_ft = data & 0x0f;
int ft_clock = clock() / m_ft_divisors[m_ft];
if (LOG) logerror("COM8116 '%s' Transmitter Divisor Select %01x: %u (%u Hz)\n", tag(), data & 0x0f, m_ft_divisors[m_ft], ft_clock);
m_ft_timer->adjust(attotime::from_nsec(3500), 0, attotime::from_hz(ft_clock));
}
WRITE8_MEMBER( com8116_device::stt_w )
{
if (LOG) logerror("COM8116 '%s' Transmitter Divider %01x\n", tag(), data & 0x0f);
m_ft = data & 0x0f;
m_ft_timer->adjust(attotime::zero, 0, attotime::from_hz(clock() / m_ft_divisors[m_ft] / 2));
stt_w(data);
}

View File

@ -42,6 +42,16 @@
const com8116_interface (name) =
#define COM8116_DIVISORS_16X_5_0688MHz \
{ 6336, 4224, 2880, 2355, 2112, 1056, 528, 264, 176, 158, 132, 88, 66, 44, 33, 16 }
#define COM8116_DIVISORS_16X_4_9152MHz \
{ 6144, 4096, 2793, 2284, 2048, 1024, 512, 256, 171, 154, 128, 85, 64, 43, 32, 16 }
#define COM8116_DIVISORS_32X_5_0688MHz \
{ 3168, 2112, 1440, 1177, 1056, 792, 528, 264, 132, 88, 66, 44, 33, 22, 16, 8 }
///*************************************************************************
// TYPE DEFINITIONS
@ -72,13 +82,16 @@ public:
// construction/destruction
com8116_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
void str_w(UINT8 data);
DECLARE_WRITE8_MEMBER( str_w );
void stt_w(UINT8 data);
DECLARE_WRITE8_MEMBER( stt_w );
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
virtual void device_timer(emu_timer &timer, device_timer_id id, int m_param, void *ptr);
private:

View File

@ -181,6 +181,11 @@ static I8085_CONFIG( exp85_i8085_config )
/* Terminal Interface */
static DEVICE_INPUT_DEFAULTS_START( terminal )
DEVICE_INPUT_DEFAULTS( "TERM_FRAME", 0x0f, 0x06 ) // 9600
DEVICE_INPUT_DEFAULTS( "TERM_FRAME", 0x30, 0x10 ) // 7E1
DEVICE_INPUT_DEFAULTS_END
static const serial_terminal_interface terminal_intf =
{
DEVCB_NULL
@ -227,7 +232,8 @@ static MACHINE_CONFIG_START( exp85, exp85_state )
MCFG_I8155_ADD(I8155_TAG, XTAL_6_144MHz/2, i8155_intf)
MCFG_I8355_ADD(I8355_TAG, XTAL_6_144MHz/2, i8355_intf)
MCFG_CASSETTE_ADD("cassette", exp85_cassette_interface)
MCFG_SERIAL_TERMINAL_ADD(TERMINAL_TAG, terminal_intf,9600)
MCFG_SERIAL_TERMINAL_ADD(TERMINAL_TAG, terminal_intf, 9600)
MCFG_DEVICE_INPUT_DEFAULTS(terminal)
/* internal ram */
MCFG_RAM_ADD(RAM_TAG)
@ -260,4 +266,4 @@ ROM_END
/* System Drivers */
/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */
COMP( 1979, exp85, 0, 0, exp85, exp85, driver_device, 0, "Netronics", "Explorer/85", GAME_NOT_WORKING )
COMP( 1979, exp85, 0, 0, exp85, exp85, driver_device, 0, "Netronics", "Explorer/85", 0 )

View File

@ -175,8 +175,8 @@ static COM8116_INTERFACE( kayproii_brg_intf )
DEVCB_NULL, /* fX/4 output */
DEVCB_NULL, // DEVCB_DEVICE_LINE("z80sio", rx_tx_a_w), z80sio implementation has no clock pin
DEVCB_NULL, // DEVCB_DEVICE_LINE("z80sio", rx_tx_b_w),
{ 101376, 67584, 46080, 37686, 33792, 16896, 8448, 4224, 2816, 2534, 2112, 1408, 1056, 704, 528, 264 }, /* receiver divisor ROM */
{ 101376, 67584, 46080, 37686, 33792, 16896, 8448, 4224, 2816, 2534, 2112, 1408, 1056, 704, 528, 264 }, /* transmitter divisor ROM */
COM8116_DIVISORS_16X_5_0688MHz, // receiver
COM8116_DIVISORS_16X_5_0688MHz // transmitter
};
static COM8116_INTERFACE( kaypro2x_brg_intf )
@ -184,8 +184,8 @@ static COM8116_INTERFACE( kaypro2x_brg_intf )
DEVCB_NULL, /* fX/4 output */
DEVCB_NULL,//DEVCB_DEVICE_LINE("z80sio", rx_tx_a_w),
DEVCB_NULL,//DEVCB_DEVICE_LINE("z80sio_2x", rx_tx_a_w),
{ 101376, 67584, 46080, 37686, 33792, 16896, 8448, 4224, 2816, 2534, 2112, 1408, 1056, 704, 528, 264 }, /* receiver divisor ROM */
{ 101376, 67584, 46080, 37686, 33792, 16896, 8448, 4224, 2816, 2534, 2112, 1408, 1056, 704, 528, 264 }, /* transmitter divisor ROM */
COM8116_DIVISORS_16X_5_0688MHz, // receiver
COM8116_DIVISORS_16X_5_0688MHz // transmitter
};

View File

@ -51,7 +51,6 @@ Notes:
TODO:
- COM8116 dividers are wrong
- interrupts
- configuration switches
- PIA odd/even byte access
@ -73,8 +72,8 @@ Notes:
WRITE8_MEMBER( ob68k1a_state::com8116_w )
{
m_dbrg->stt_w(space, 0, data & 0x0f);
m_dbrg->str_w(space, 0, data >> 4);
m_dbrg->stt_w(data & 0x0f);
m_dbrg->str_w(data >> 4);
}
@ -205,19 +204,20 @@ static const ptm6840_interface ptm_intf =
DEVCB_NULL
};
//-------------------------------------------------
// ACIA6850_INTERFACE( acia0_intf )
//-------------------------------------------------
static ACIA6850_INTERFACE( acia0_intf )
{
9600*16, // HACK for terminal
9600*16, // HACK for terminal
0,
0,
DEVCB_DEVICE_LINE_MEMBER(RS232_A_TAG, serial_port_device, rx),
DEVCB_DEVICE_LINE_MEMBER(RS232_A_TAG, serial_port_device, tx),
DEVCB_LINE_GND, // HACK for terminal
DEVCB_DEVICE_LINE_MEMBER(RS232_B_TAG, rs232_port_device, cts_r),
DEVCB_DEVICE_LINE_MEMBER(RS232_A_TAG, rs232_port_device, rts_w),
DEVCB_LINE_GND, // HACK for terminal
DEVCB_DEVICE_LINE_MEMBER(RS232_B_TAG, rs232_port_device, dcd_r),
DEVCB_NULL
};
@ -260,8 +260,8 @@ static COM8116_INTERFACE( dbrg_intf )
DEVCB_NULL, /* fX/4 output */
DEVCB_DRIVER_LINE_MEMBER(ob68k1a_state, rx_tx_0_w),
DEVCB_DRIVER_LINE_MEMBER(ob68k1a_state, rx_tx_1_w),
{ 101376, 67584, 46080, 37686, 33792, 16896, 8448, 4224, 2816, 2534, 2112, 1408, 1056, 704, 528, 264 }, /* receiver divisor ROM */
{ 101376, 67584, 46080, 37686, 33792, 16896, 8448, 4224, 2816, 2534, 2112, 1408, 1056, 704, 528, 264 }, /* transmitter divisor ROM */
COM8116_DIVISORS_16X_5_0688MHz, // receiver
COM8116_DIVISORS_16X_5_0688MHz // transmitter
};
@ -322,15 +322,12 @@ void ob68k1a_state::machine_start()
void ob68k1a_state::machine_reset()
{
address_space &program = m_maincpu->space(AS_PROGRAM);
// initialize COM8116
com8116_w(program, 0, 0xee);
// m_dbrg->stt_w(program, 0, 0x01);
// m_dbrg->str_w(program, 0, 0x01);
m_dbrg->stt_w(0x0e);
m_dbrg->str_w(0x0e);
// set reset vector
void *ram = program.get_write_ptr(0);
void *ram = m_maincpu->space(AS_PROGRAM).get_write_ptr(0);
UINT8 *rom = memregion(MC68000L10_TAG)->base();
memcpy(ram, rom, 8);

View File

@ -255,8 +255,8 @@ WRITE8_MEMBER( super6_state::baud_w )
*/
m_brg->str_w(space, 0, data & 0x0f);
m_brg->stt_w(space, 0, data >> 4);
m_brg->str_w(data & 0x0f);
m_brg->stt_w(data >> 4);
}
@ -305,7 +305,7 @@ ADDRESS_MAP_END
static INPUT_PORTS_START( super6 )
PORT_START("J7")
PORT_DIPNAME( 0x0f, 0x0e, "SIO Channel A Baud Rate" ) PORT_DIPLOCATION("J7:1,2,3,4")
PORT_DIPNAME( 0x0f, 0x0f, "SIO Channel A Baud Rate" ) PORT_DIPLOCATION("J7:1,2,3,4")
PORT_DIPSETTING( 0x00, "50" )
PORT_DIPSETTING( 0x01, "75" )
PORT_DIPSETTING( 0x02, "110" )
@ -460,8 +460,8 @@ static COM8116_INTERFACE( brg_intf )
DEVCB_NULL,
DEVCB_DRIVER_LINE_MEMBER(super6_state, fr_w),
DEVCB_DEVICE_LINE(Z80DART_TAG, z80dart_rxtxcb_w),
{ 6336, 4224, 2880, 2355, 2112, 1056, 528, 264, 176, 158, 132, 88, 66, 44, 33, 16 }, // from WD1943-00 datasheet
{ 6336, 4224, 2880, 2355, 2112, 1056, 528, 264, 176, 158, 132, 88, 66, 44, 33, 16 },
COM8116_DIVISORS_16X_5_0688MHz, // receiver
COM8116_DIVISORS_16X_5_0688MHz // transmitter
};
@ -505,6 +505,11 @@ static const z80_daisy_config super6_daisy_chain[] =
// GENERIC_TERMINAL_INTERFACE( terminal_intf )
//-------------------------------------------------
static DEVICE_INPUT_DEFAULTS_START( terminal )
DEVICE_INPUT_DEFAULTS( "TERM_FRAME", 0x0f, 0x08 ) // 19200
DEVICE_INPUT_DEFAULTS( "TERM_FRAME", 0x30, 0x00 ) // 8N1
DEVICE_INPUT_DEFAULTS_END
WRITE8_MEMBER( super6_state::dummy_w )
{
// handled in Z80DART_INTERFACE
@ -547,6 +552,11 @@ void super6_state::machine_reset()
m_bank0 = m_bank1 = 0;
bankswitch();
UINT8 baud = m_j7->read();
m_brg->str_w(baud & 0x0f);
m_brg->stt_w((baud >> 4) & 0x07);
}
@ -576,7 +586,8 @@ static MACHINE_CONFIG_START( super6, super6_state )
MCFG_COM8116_ADD(BR1945_TAG, XTAL_5_0688MHz, brg_intf)
MCFG_FLOPPY_DRIVE_ADD(WD2793_TAG":0", super6_floppies, "525dd", NULL, floppy_image_device::default_floppy_formats)
MCFG_FLOPPY_DRIVE_ADD(WD2793_TAG":1", super6_floppies, NULL, NULL, floppy_image_device::default_floppy_formats)
MCFG_SERIAL_TERMINAL_ADD(TERMINAL_TAG, terminal_intf, 4800)
MCFG_SERIAL_TERMINAL_ADD(TERMINAL_TAG, terminal_intf, 19200)
MCFG_DEVICE_INPUT_DEFAULTS(terminal)
// internal ram
MCFG_RAM_ADD(RAM_TAG)

View File

@ -502,8 +502,8 @@ static COM8116_INTERFACE( com8116_intf )
DEVCB_NULL, /* fX/4 output */
DEVCB_NULL, /* fR output */
DEVCB_NULL, /* fT output */
{ 101376, 67584, 46080, 37686, 33792, 16896, 8448, 4224, 2816, 2534, 2112, 1408, 1056, 704, 528, 264 }, /* receiver divisor ROM */
{ 101376, 67584, 46080, 37686, 33792, 16896, 8448, 4224, 2816, 2534, 2112, 1408, 1056, 704, 528, 264 }, /* transmitter divisor ROM */
COM8116_DIVISORS_16X_5_0688MHz, // receiver
COM8116_DIVISORS_16X_5_0688MHz // transmitter
};
WRITE8_MEMBER( xerox820_state::kbd_w )

View File

@ -149,8 +149,8 @@ READ8_MEMBER( xor100_state::prom_disable_r )
WRITE8_MEMBER( xor100_state::baud_w )
{
m_dbrg->str_w(space, 0, data & 0x0f);
m_dbrg->stt_w(space, 0, data >> 4);
m_dbrg->str_w(data & 0x0f);
m_dbrg->stt_w(data >> 4);
}
WRITE8_MEMBER( xor100_state::i8251_b_data_w )
@ -378,8 +378,8 @@ static COM8116_INTERFACE( com5016_intf )
DEVCB_NULL, /* fX/4 output */
DEVCB_DRIVER_LINE_MEMBER(xor100_state, com5016_fr_w), /* fR output */
DEVCB_DRIVER_LINE_MEMBER(xor100_state, com5016_ft_w), /* fT output */
{ 101376, 67584, 46080, 37686, 33792, 16896, 8448, 4224, 2816, 2534, 2112, 1408, 1056, 704, 528, 264 }, // WRONG?
{ 101376, 67584, 46080, 37686, 33792, 16896, 8448, 4224, 2816, 2534, 2112, 1408, 1056, 704, 528, 264 }, // WRONG?
COM8116_DIVISORS_16X_5_0688MHz, // receiver
COM8116_DIVISORS_16X_5_0688MHz // transmitter
};
/* Printer 8251A Interface */
@ -590,7 +590,7 @@ static MACHINE_CONFIG_START( xor100, xor100_state )
MCFG_I8251_ADD(I8251_B_TAG, /*XTAL_8MHz/2,*/ terminal_8251_intf)
MCFG_I8255A_ADD(I8255A_TAG, printer_8255_intf)
MCFG_Z80CTC_ADD(Z80CTC_TAG, XTAL_8MHz/2, ctc_intf)
MCFG_COM8116_ADD(COM5016_TAG, 5000000, com5016_intf)
MCFG_COM8116_ADD(COM5016_TAG, XTAL_5_0688MHz, com5016_intf)
MCFG_FD1795x_ADD(WD1795_TAG, XTAL_8MHz/4)
MCFG_FLOPPY_DRIVE_ADD(WD1795_TAG":0", xor100_floppies, "8ssdd", NULL, floppy_image_device::default_floppy_formats)
MCFG_FLOPPY_DRIVE_ADD(WD1795_TAG":1", xor100_floppies, "8ssdd", NULL, floppy_image_device::default_floppy_formats)

View File

@ -15,7 +15,8 @@ public:
m_terminal(*this, TERMINAL_TAG),
m_cassette(*this, "cassette"),
m_speaker(*this, "speaker"),
m_rom(*this, I8085A_TAG)
m_rom(*this, I8085A_TAG),
m_tape_control(0)
{ }
required_device<cpu_device> m_maincpu;

View File

@ -41,7 +41,8 @@ public:
m_floppy0(*this, WD2793_TAG":0"),
m_floppy1(*this, WD2793_TAG":1"),
m_terminal(*this, TERMINAL_TAG),
m_rom(*this, Z80_TAG)
m_rom(*this, Z80_TAG),
m_j7(*this, "J7")
{ }
required_device<cpu_device> m_maincpu;
@ -56,6 +57,7 @@ public:
required_device<floppy_connector> m_floppy1;
required_device<serial_terminal_device> m_terminal;
required_memory_region m_rom;
required_ioport m_j7;
virtual void machine_start();
virtual void machine_reset();

View File

@ -69,8 +69,8 @@ static COM8116_INTERFACE( brg_intf )
DEVCB_NULL,
DEVCB_NULL, // S1602 RRC/TRC
DEVCB_NULL,
{ 6336, 4224, 2880, 2355, 2112, 1056, 528, 264, 176, 158, 132, 88, 66, 44, 33, 16 }, // from WD1943-00 datasheet
{ 6336, 4224, 2880, 2355, 2112, 1056, 528, 264, 176, 158, 132, 88, 66, 44, 33, 16 },
COM8116_DIVISORS_16X_5_0688MHz, // receiver
COM8116_DIVISORS_16X_5_0688MHz // transmitter
};

View File

@ -483,6 +483,18 @@ void serial_terminal_device::device_start()
INPUT_CHANGED_MEMBER(serial_terminal_device::update_frame)
{
device_reset();
}
void serial_terminal_device::device_reset()
{
generic_terminal_device::device_reset();
m_rbit = 1;
if(m_slot)
m_owner->out_rx(m_rbit);
else
m_out_tx_func(m_rbit);
UINT8 val = m_io_term_frame->read();
set_tra_rate(rates[val & 0x0f]);
set_rcv_rate(rates[val & 0x0f]);
@ -499,16 +511,6 @@ INPUT_CHANGED_MEMBER(serial_terminal_device::update_frame)
}
}
void serial_terminal_device::device_reset()
{
generic_terminal_device::device_reset();
m_rbit = 1;
if(m_slot)
m_owner->out_rx(m_rbit);
else
m_out_tx_func(m_rbit);
}
void serial_terminal_device::send_key(UINT8 code)
{
if(is_transmit_register_empty())