mirror of
https://github.com/holub/mame
synced 2025-04-25 01:40:16 +03:00
bw12: Use modern SIO and LS259 devices; correct FDC clock (nw)
This commit is contained in:
parent
0e2731b0fd
commit
044d50a98b
@ -73,54 +73,8 @@ void bw12_state::bankswitch()
|
||||
membank("bank1")->set_entry(m_bank);
|
||||
}
|
||||
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(bw12_state::floppy_motor_off_tick)
|
||||
void bw12_state::floppy_motor_on_off()
|
||||
{
|
||||
if (m_motor0 || m_motor1)
|
||||
return;
|
||||
m_floppy0->mon_w(1);
|
||||
m_floppy1->mon_w(1);
|
||||
|
||||
m_motor_on = 0;
|
||||
}
|
||||
|
||||
void bw12_state::write_ls259(int address, int data)
|
||||
{
|
||||
switch (address)
|
||||
{
|
||||
case 0: /* LS138 A0 */
|
||||
m_bank = (m_bank & 0x02) | data;
|
||||
bankswitch();
|
||||
break;
|
||||
|
||||
case 1: /* LS138 A1 */
|
||||
m_bank = (data << 1) | (m_bank & 0x01);
|
||||
bankswitch();
|
||||
break;
|
||||
|
||||
case 2: /* not connected */
|
||||
break;
|
||||
|
||||
case 3: /* _INIT */
|
||||
break;
|
||||
|
||||
case 4: /* CAP LOCK */
|
||||
m_led = data ? 1 : 0;
|
||||
break;
|
||||
|
||||
case 5: /* MOTOR 0 */
|
||||
m_motor0 = data;
|
||||
break;
|
||||
|
||||
case 6: /* MOTOR 1 */
|
||||
m_motor1 = data;
|
||||
break;
|
||||
|
||||
case 7: /* FDC TC */
|
||||
m_fdc->tc_w(data);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (m_motor0 || m_motor1)
|
||||
{
|
||||
m_motor_on = 1;
|
||||
@ -132,17 +86,48 @@ void bw12_state::write_ls259(int address, int data)
|
||||
m_floppy_timer->adjust(attotime::from_msec(170));
|
||||
}
|
||||
|
||||
WRITE8_MEMBER( bw12_state::ls259_w )
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(bw12_state::floppy_motor_off_tick)
|
||||
{
|
||||
int d = BIT(offset, 0);
|
||||
int a = (offset >> 1) & 0x07;
|
||||
if (m_motor0 || m_motor1)
|
||||
return;
|
||||
m_floppy0->mon_w(1);
|
||||
m_floppy1->mon_w(1);
|
||||
|
||||
write_ls259(a, d);
|
||||
m_motor_on = 0;
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER(bw12_state::ls138_a0_w)
|
||||
{
|
||||
m_bank = (m_bank & 0x02) | state;
|
||||
bankswitch();
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER(bw12_state::ls138_a1_w)
|
||||
{
|
||||
m_bank = (state << 1) | (m_bank & 0x01);
|
||||
bankswitch();
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER(bw12_state::init_w)
|
||||
{
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER(bw12_state::motor0_w)
|
||||
{
|
||||
m_motor0 = state;
|
||||
floppy_motor_on_off();
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER(bw12_state::motor1_w)
|
||||
{
|
||||
m_motor1 = state;
|
||||
floppy_motor_on_off();
|
||||
}
|
||||
|
||||
READ8_MEMBER( bw12_state::ls259_r )
|
||||
{
|
||||
ls259_w(space, offset, 0);
|
||||
if (!machine().side_effects_disabled())
|
||||
m_latch->write_bit(offset >> 1, BIT(offset, 0));
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -159,12 +144,12 @@ void bw12_state::bw12_mem(address_map &map)
|
||||
void bw12_state::bw12_io(address_map &map)
|
||||
{
|
||||
map.global_mask(0xff);
|
||||
map(0x00, 0x0f).rw(FUNC(bw12_state::ls259_r), FUNC(bw12_state::ls259_w));
|
||||
map(0x00, 0x0f).r(FUNC(bw12_state::ls259_r)).w(m_latch, FUNC(ls259_device::write_a0));
|
||||
map(0x10, 0x10).mirror(0x0e).w(m_crtc, FUNC(mc6845_device::address_w));
|
||||
map(0x11, 0x11).mirror(0x0e).rw(m_crtc, FUNC(mc6845_device::register_r), FUNC(mc6845_device::register_w));
|
||||
map(0x20, 0x21).mirror(0x0e).m(m_fdc, FUNC(upd765a_device::map));
|
||||
map(0x30, 0x33).mirror(0x0c).rw(m_pia, FUNC(pia6821_device::read), FUNC(pia6821_device::write));
|
||||
map(0x40, 0x43).mirror(0x0c).rw(m_sio, FUNC(z80sio0_device::ba_cd_r), FUNC(z80sio0_device::ba_cd_w));
|
||||
map(0x40, 0x43).mirror(0x0c).rw(m_sio, FUNC(z80sio_device::ba_cd_r), FUNC(z80sio_device::ba_cd_w));
|
||||
map(0x50, 0x50).mirror(0x0f).w("dac", FUNC(dac_byte_interface::data_w));
|
||||
map(0x60, 0x63).mirror(0x0c).rw(m_pit, FUNC(pit8253_device::read), FUNC(pit8253_device::write));
|
||||
}
|
||||
@ -408,12 +393,6 @@ WRITE_LINE_MEMBER( bw12_state::pia_cb2_w )
|
||||
|
||||
/* PIT8253 Interface */
|
||||
|
||||
WRITE_LINE_MEMBER( bw12_state::pit_out0_w )
|
||||
{
|
||||
m_sio->txca_w(state);
|
||||
m_sio->rxca_w(state);
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER( bw12_state::pit_out2_w )
|
||||
{
|
||||
m_pit_out2 = state;
|
||||
@ -460,8 +439,6 @@ WRITE_LINE_MEMBER( bw12_state::ay3600_data_ready_w )
|
||||
|
||||
void bw12_state::machine_start()
|
||||
{
|
||||
m_led.resolve();
|
||||
|
||||
/* setup memory banking */
|
||||
membank("bank1")->configure_entry(0, m_rom->base());
|
||||
membank("bank1")->configure_entry(1, m_ram->pointer());
|
||||
@ -485,10 +462,6 @@ void bw12_state::machine_start()
|
||||
|
||||
void bw12_state::machine_reset()
|
||||
{
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
write_ls259(i, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void bw12_floppies(device_slot_interface &device)
|
||||
@ -533,10 +506,20 @@ GFXDECODE_END
|
||||
void bw12_state::common(machine_config &config)
|
||||
{
|
||||
/* basic machine hardware */
|
||||
Z80(config, m_maincpu, XTAL(16'000'000)/4);
|
||||
Z80(config, m_maincpu, 16_MHz_XTAL / 4);
|
||||
m_maincpu->set_addrmap(AS_PROGRAM, &bw12_state::bw12_mem);
|
||||
m_maincpu->set_addrmap(AS_IO, &bw12_state::bw12_io);
|
||||
|
||||
LS259(config, m_latch); // IC18
|
||||
m_latch->q_out_cb<0>().set(FUNC(bw12_state::ls138_a0_w)); // LS138 A0
|
||||
m_latch->q_out_cb<1>().set(FUNC(bw12_state::ls138_a1_w)); // LS138 A1
|
||||
// Q2 not connected
|
||||
m_latch->q_out_cb<3>().set(FUNC(bw12_state::init_w)); // _INIT
|
||||
m_latch->q_out_cb<4>().set_output("led0"); // CAP LOCK
|
||||
m_latch->q_out_cb<5>().set(FUNC(bw12_state::motor0_w)); // MOTOR 0
|
||||
m_latch->q_out_cb<6>().set(FUNC(bw12_state::motor1_w)); // MOTOR 1
|
||||
m_latch->q_out_cb<7>().set(m_fdc, FUNC(upd765a_device::tc_line_w)); // FDC TC
|
||||
|
||||
/* video hardware */
|
||||
screen_device &screen(SCREEN(config, SCREEN_TAG, SCREEN_TYPE_RASTER, rgb_t::amber()));
|
||||
screen.set_refresh_hz(60);
|
||||
@ -548,7 +531,7 @@ void bw12_state::common(machine_config &config)
|
||||
GFXDECODE(config, "gfxdecode", m_palette, gfx_bw12);
|
||||
PALETTE(config, m_palette, palette_device::MONOCHROME);
|
||||
|
||||
MC6845(config, m_crtc, XTAL(16'000'000)/8);
|
||||
MC6845(config, m_crtc, 16_MHz_XTAL / 8);
|
||||
m_crtc->set_screen(SCREEN_TAG);
|
||||
m_crtc->set_show_border_area(true);
|
||||
m_crtc->set_char_width(8);
|
||||
@ -563,7 +546,7 @@ void bw12_state::common(machine_config &config)
|
||||
|
||||
/* devices */
|
||||
TIMER(config, FLOPPY_TIMER_TAG).configure_generic(FUNC(bw12_state::floppy_motor_off_tick));
|
||||
UPD765A(config, m_fdc, 8'000'000, false, true);
|
||||
UPD765A(config, m_fdc, 16_MHz_XTAL / 4, false, true);
|
||||
|
||||
PIA6821(config, m_pia, 0);
|
||||
m_pia->readpa_handler().set(FUNC(bw12_state::pia_pa_r));
|
||||
@ -573,7 +556,7 @@ void bw12_state::common(machine_config &config)
|
||||
m_pia->irqa_handler().set_inputline(Z80_TAG, INPUT_LINE_IRQ0);
|
||||
m_pia->irqb_handler().set_inputline(Z80_TAG, INPUT_LINE_IRQ0);
|
||||
|
||||
Z80SIO0(config, m_sio, XTAL(16'000'000)/4);
|
||||
Z80SIO(config, m_sio, 16_MHz_XTAL / 4); // SIO/0
|
||||
m_sio->out_txda_callback().set(RS232_A_TAG, FUNC(rs232_port_device::write_txd));
|
||||
m_sio->out_dtra_callback().set(RS232_A_TAG, FUNC(rs232_port_device::write_dtr));
|
||||
m_sio->out_rtsa_callback().set(RS232_A_TAG, FUNC(rs232_port_device::write_rts));
|
||||
@ -582,12 +565,15 @@ void bw12_state::common(machine_config &config)
|
||||
m_sio->out_rtsb_callback().set(RS232_B_TAG, FUNC(rs232_port_device::write_rts));
|
||||
m_sio->out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0);
|
||||
|
||||
PIT8253(config, m_pit, 0);
|
||||
m_pit->set_clk<0>(XTAL(1'843'200));
|
||||
m_pit->out_handler<0>().set(FUNC(bw12_state::pit_out0_w));
|
||||
m_pit->set_clk<1>(XTAL(1'843'200));
|
||||
m_pit->out_handler<1>().set(m_sio, FUNC(z80dart_device::rxtxcb_w));
|
||||
m_pit->set_clk<2>(XTAL(1'843'200));
|
||||
PIT8253(config, m_pit);
|
||||
m_pit->set_clk<0>(1.8432_MHz_XTAL);
|
||||
m_pit->out_handler<0>().set(m_sio, FUNC(z80sio_device::rxca_w));
|
||||
m_pit->out_handler<0>().append(m_sio, FUNC(z80sio_device::txca_w));
|
||||
m_pit->out_handler<0>().append(RS232_A_TAG, FUNC(rs232_port_device::write_etc));
|
||||
m_pit->set_clk<1>(1.8432_MHz_XTAL);
|
||||
m_pit->out_handler<1>().set(m_sio, FUNC(z80sio_device::rxtxcb_w));
|
||||
m_pit->out_handler<1>().append(RS232_B_TAG, FUNC(rs232_port_device::write_etc));
|
||||
m_pit->set_clk<2>(1.8432_MHz_XTAL);
|
||||
m_pit->out_handler<2>().set(FUNC(bw12_state::pit_out2_w));
|
||||
|
||||
AY3600(config, m_kbc, 0);
|
||||
@ -605,14 +591,14 @@ void bw12_state::common(machine_config &config)
|
||||
m_kbc->data_ready().set(FUNC(bw12_state::ay3600_data_ready_w));
|
||||
|
||||
rs232_port_device &rs232a(RS232_PORT(config, RS232_A_TAG, default_rs232_devices, nullptr));
|
||||
rs232a.rxd_handler().set(m_sio, FUNC(z80dart_device::rxa_w));
|
||||
rs232a.dcd_handler().set(m_sio, FUNC(z80dart_device::dcda_w));
|
||||
rs232a.cts_handler().set(m_sio, FUNC(z80dart_device::ctsa_w));
|
||||
rs232a.rxd_handler().set(m_sio, FUNC(z80sio_device::rxa_w));
|
||||
rs232a.dcd_handler().set(m_sio, FUNC(z80sio_device::dcda_w));
|
||||
rs232a.cts_handler().set(m_sio, FUNC(z80sio_device::ctsa_w));
|
||||
|
||||
rs232_port_device &rs232b(RS232_PORT(config, RS232_B_TAG, default_rs232_devices, nullptr));
|
||||
rs232b.rxd_handler().set(m_sio, FUNC(z80dart_device::rxb_w));
|
||||
rs232b.dcd_handler().set(m_sio, FUNC(z80dart_device::dcdb_w));
|
||||
rs232b.cts_handler().set(m_sio, FUNC(z80dart_device::ctsb_w));
|
||||
rs232b.rxd_handler().set(m_sio, FUNC(z80sio_device::rxb_w));
|
||||
rs232b.dcd_handler().set(m_sio, FUNC(z80sio_device::dcdb_w));
|
||||
rs232b.cts_handler().set(m_sio, FUNC(z80sio_device::ctsb_w));
|
||||
|
||||
/* printer */
|
||||
CENTRONICS(config, m_centronics, centronics_devices, "printer");
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "machine/ram.h"
|
||||
#include "formats/bw12_dsk.h"
|
||||
#include "imagedev/floppy.h"
|
||||
#include "machine/74259.h"
|
||||
#include "machine/6821pia.h"
|
||||
#include "bus/centronics/ctronics.h"
|
||||
#include "machine/kb3600.h"
|
||||
@ -16,7 +17,7 @@
|
||||
#include "machine/rescap.h"
|
||||
#include "machine/timer.h"
|
||||
#include "machine/upd765.h"
|
||||
#include "machine/z80dart.h"
|
||||
#include "machine/z80sio.h"
|
||||
#include "video/mc6845.h"
|
||||
#include "emupal.h"
|
||||
|
||||
@ -42,6 +43,7 @@ public:
|
||||
bw12_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag)
|
||||
, m_maincpu(*this, Z80_TAG)
|
||||
, m_latch(*this, "latch")
|
||||
, m_pia(*this, PIA6821_TAG)
|
||||
, m_sio(*this, Z80SIO_TAG)
|
||||
, m_fdc(*this, UPD765_TAG)
|
||||
@ -58,14 +60,21 @@ public:
|
||||
, m_char_rom(*this, "chargen")
|
||||
, m_video_ram(*this, "video_ram")
|
||||
, m_modifiers(*this, "MODIFIERS")
|
||||
, m_led(*this, "led0")
|
||||
{ }
|
||||
|
||||
void bw14(machine_config &config);
|
||||
void bw12(machine_config &config);
|
||||
|
||||
private:
|
||||
void bankswitch();
|
||||
void write_ls259(int address, int data);
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER( ls138_a0_w );
|
||||
DECLARE_WRITE_LINE_MEMBER( ls138_a1_w );
|
||||
DECLARE_WRITE_LINE_MEMBER( init_w );
|
||||
DECLARE_WRITE_LINE_MEMBER( motor0_w );
|
||||
DECLARE_WRITE_LINE_MEMBER( motor1_w );
|
||||
|
||||
DECLARE_READ8_MEMBER( ls259_r );
|
||||
DECLARE_WRITE8_MEMBER( ls259_w );
|
||||
DECLARE_READ8_MEMBER( pia_pa_r );
|
||||
DECLARE_WRITE_LINE_MEMBER( pia_cb2_w );
|
||||
DECLARE_WRITE_LINE_MEMBER( pit_out2_w );
|
||||
@ -74,8 +83,8 @@ public:
|
||||
DECLARE_WRITE_LINE_MEMBER( ay3600_data_ready_w );
|
||||
MC6845_UPDATE_ROW( crtc_update_row );
|
||||
|
||||
void floppy_motor_on_off();
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(floppy_motor_off_tick);
|
||||
DECLARE_WRITE_LINE_MEMBER(pit_out0_w);
|
||||
DECLARE_FLOPPY_FORMATS( bw12_floppy_formats );
|
||||
DECLARE_FLOPPY_FORMATS( bw14_floppy_formats );
|
||||
|
||||
@ -84,8 +93,6 @@ public:
|
||||
DECLARE_WRITE_LINE_MEMBER(write_centronics_perror);
|
||||
|
||||
void common(machine_config &config);
|
||||
void bw14(machine_config &config);
|
||||
void bw12(machine_config &config);
|
||||
void bw12_io(address_map &map);
|
||||
void bw12_mem(address_map &map);
|
||||
|
||||
@ -94,8 +101,9 @@ protected:
|
||||
virtual void machine_reset() override;
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<ls259_device> m_latch;
|
||||
required_device<pia6821_device> m_pia;
|
||||
required_device<z80sio0_device> m_sio;
|
||||
required_device<z80sio_device> m_sio;
|
||||
required_device<upd765a_device> m_fdc;
|
||||
required_device<ay3600_device> m_kbc;
|
||||
required_device<mc6845_device> m_crtc;
|
||||
@ -110,7 +118,6 @@ protected:
|
||||
required_memory_region m_char_rom;
|
||||
required_shared_ptr<uint8_t> m_video_ram;
|
||||
required_ioport m_modifiers;
|
||||
output_finder<> m_led;
|
||||
|
||||
/* memory state */
|
||||
int m_bank;
|
||||
|
Loading…
Reference in New Issue
Block a user