From 6d8e386281782570abe2da5eb8ae531539434b68 Mon Sep 17 00:00:00 2001 From: AJR Date: Sat, 6 May 2023 13:15:37 -0400 Subject: kaypro.cpp: Add RTC to '84-type systems --- src/mame/kaypro/kaypro.cpp | 78 ++++++++++++++++++++++++++++++++------------ src/mame/kaypro/kaypro.h | 9 +++++ src/mame/kaypro/kaypro_m.cpp | 19 +++++++++++ 3 files changed, 85 insertions(+), 21 deletions(-) diff --git a/src/mame/kaypro/kaypro.cpp b/src/mame/kaypro/kaypro.cpp index 9a801b26c2b..7aab1830922 100644 --- a/src/mame/kaypro/kaypro.cpp +++ b/src/mame/kaypro/kaypro.cpp @@ -8,6 +8,8 @@ telephone cord, complete with modular plug on each end. The keyboard carries its own Intel 87C51 processor and is an intelligent device. + Non-Linear Systems changed its name to Kaypro Corporation in July 1983. + Kaypro 5 notes: The Kaycomp Kay Pro V / Non-Linear Systems Kaypro 5: https://retrocmp.de/kaypro/kay-p1_vers.htm#kay-5, a version of the Kaypro II, but with a 5MB harddisk instead of one of the floppy drives, was announced @@ -40,7 +42,7 @@ - Hard Disk not emulated. The controller is a WD1002-HD0 (original version, for Winchester drives), HD is 10MB, e.g. Shugart 712 - - RTC type MM58167A to be added. Modem chips TMS99531, TMS99532 to be developed. + - Modem chips TMS99531, TMS99532 to be developed. - Once everything works, sort out parent and compat relationships. @@ -87,7 +89,7 @@ void kaypro_state::kayproii_io(address_map &map) map(0x1c, 0x1f).rw(m_pio_s, FUNC(z80pio_device::read_alt), FUNC(z80pio_device::write_alt)); } -void kaypro_state::kaypro484_io(address_map &map) +void kaypro_state::kaypro10_io(address_map &map) { map.global_mask(0xff); map.unmap_value_high(); @@ -103,9 +105,7 @@ void kaypro_state::kaypro484_io(address_map &map) map(0x1f, 0x1f).rw(FUNC(kaypro_state::kaypro484_videoram_r), FUNC(kaypro_state::kaypro484_videoram_w)); /* The below are not emulated */ -/* map(0x20, 0x23).rw("z80pio", FUNC(z80pio_device::kaypro484_pio_r), FUNC(z80pio_device::kaypro484_pio_w)) - for RTC and Modem - map(0x24, 0x27) communicate with MM58167A RTC. Modem uses TMS99531 and TMS99532 chips. - map(0x80, 0x80) Hard drive controller card I/O port - 10MB hard drive only fitted to the Kaypro 10 +/* map(0x80, 0x80) Hard drive controller card I/O port - 10MB hard drive only fitted to the Kaypro 10 map(0x81, 0x81) Hard Drive READ error register, WRITE precomp map(0x82, 0x82) Hard Drive Sector register count I/O map(0x83, 0x83) Hard Drive Sector register number I/O @@ -117,6 +117,13 @@ void kaypro_state::kaypro484_io(address_map &map) map(0x87, 0x87).r(FUNC(kaypro_state::kaypro484_87_r)); } +void kaypro_state::kaypro484_io(address_map &map) +{ + kaypro10_io(map); + map(0x20, 0x23).rw("z80pio", FUNC(z80pio_device::read), FUNC(z80pio_device::write)); + map(0x24, 0x24).mirror(3).rw(FUNC(kaypro_state::rtc_r), FUNC(kaypro_state::rtc_w)); +} + static INPUT_PORTS_START(kaypro) // everything comes from the keyboard device @@ -176,8 +183,16 @@ static const z80_daisy_config kayproii_daisy_chain[] = { nullptr } }; +static const z80_daisy_config kaypro10_daisy_chain[] = +{ + { "sio_1" }, /* sio for RS232C and keyboard */ + { "sio_2" }, /* sio for serial printer and inbuilt modem */ + { nullptr } +}; + static const z80_daisy_config kaypro484_daisy_chain[] = { + { "z80pio" }, { "sio_1" }, /* sio for RS232C and keyboard */ { "sio_2" }, /* sio for serial printer and inbuilt modem */ { nullptr } @@ -247,7 +262,7 @@ void kaypro_state::kayproii(machine_config &config) serial.cts_handler().set("sio", FUNC(z80sio_device::ctsa_w)); serial.dcd_handler().set("sio", FUNC(z80sio_device::dcda_w)); - com8116_device &brg(COM8116(config, "brg", XTAL(5'068'800))); // WD1943, SMC8116 + com8116_device &brg(COM8116(config, "brg", 5.0688_MHz_XTAL)); // WD1943, SMC8116 brg.ft_handler().set("sio", FUNC(z80sio_device::rxca_w)); brg.ft_handler().append("sio", FUNC(z80sio_device::txca_w)); brg.fr_handler().set("sio", FUNC(z80sio_device::rxtxcb_w)); @@ -359,7 +374,7 @@ void kaypro_state::kaypro484(machine_config &config) sio_2.out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); // FIXME: use a combiner sio_2.out_txda_callback().set("serprn", FUNC(rs232_port_device::write_txd)); - com8116_device &brg(COM8116(config, "brg", XTAL(5'068'800))); // WD1943, SMC8116 + com8116_device &brg(COM8116(config, "brg", 5.0688_MHz_XTAL)); // WD1943, SMC8116 brg.fr_handler().set("sio_1", FUNC(z80sio_device::rxca_w)); brg.fr_handler().append("sio_1", FUNC(z80sio_device::txca_w)); brg.ft_handler().set("sio_2", FUNC(z80sio_device::rxca_w)); @@ -372,11 +387,20 @@ void kaypro_state::kaypro484(machine_config &config) FLOPPY_CONNECTOR(config, "fdc:0", kaypro_floppies, "525dd", kaypro_state::floppy_formats).enable_sound(true); FLOPPY_CONNECTOR(config, "fdc:1", kaypro_floppies, "525dd", kaypro_state::floppy_formats).enable_sound(true); SOFTWARE_LIST(config, "flop_list").set_original("kaypro").set_filter("C"); + + z80pio_device &pio(Z80PIO(config, "z80pio", 16_MHz_XTAL / 4)); + pio.out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + pio.out_pa_callback().set(FUNC(kaypro_state::rtc_address_w)); + + MM58167(config, m_rtc, 32.768_kHz_XTAL); + m_rtc->irq().set("z80pio", FUNC(z80pio_device::pa6_w)); } void kaypro_state::kaypro4x(machine_config &config) { kaypro484(config); + m_fdc->set_clock(16_MHz_XTAL / 8); + m_fdc->set_force_ready(false); SOFTWARE_LIST(config.replace(), "flop_list").set_original("kaypro").set_filter("F"); } @@ -387,6 +411,18 @@ void kaypro_state::kaypro1(machine_config &config) } void kaypro_state::kaypro10(machine_config &config) +{ + kaypro484(config); + m_maincpu->set_addrmap(AS_IO, &kaypro_state::kaypro10_io); + m_maincpu->set_daisy_config(kaypro10_daisy_chain); + config.device_remove("z80pio"); + config.device_remove("rtc"); + config.device_remove("fdc:1"); // only has 1 floppy drive + // need to add hard drive & controller + SOFTWARE_LIST(config.replace(), "flop_list").set_original("kaypro").set_filter("E"); +} + +void kaypro_state::kaypro1084(machine_config &config) { kaypro484(config); config.device_remove("fdc:1"); // only has 1 floppy drive @@ -671,18 +707,18 @@ ROM_END /* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */ -COMP( 1982, kayproii, 0, 0, kayproii, kaypro, kaypro_state, init_kaypro, "Non Linear Systems", "Kaypro II - 2/83", MACHINE_SUPPORTS_SAVE ) -COMP( 1983, kayproiv, kayproii, 0, kayproiv, kaypro, kaypro_state, init_kaypro, "Non Linear Systems", "Kaypro IV - 4/83", MACHINE_SUPPORTS_SAVE ) // model 81-004 -COMP( 1983, kaypro10, 0, 0, kaypro10, kaypro, kaypro_state, init_kaypro, "Non Linear Systems", "Kaypro 10 - 1983", MACHINE_SUPPORTS_SAVE ) -COMP( 1983, kayproiip88, kayproii, 0, kayproii, kaypro, kaypro_state, init_kaypro, "Non Linear Systems", "Kaypro 4 plus88 - 4/83" , MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // model 81-004 with an added 8088 daughterboard and rom -COMP( 1984, kaypro484, 0, 0, kaypro484, kaypro, kaypro_state, init_kaypro, "Non Linear Systems", "Kaypro 4/84", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // model 81-015 -COMP( 1984, kaypro284, kaypro484, 0, kaypro284, kaypro, kaypro_state, init_kaypro, "Non Linear Systems", "Kaypro 2/84", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // model 81-015 -COMP( 1984, kaypro484p88, kaypro484, 0, kaypro484, kaypro, kaypro_state, init_kaypro, "Non Linear Systems", "Kaypro 4/84 plus88", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // model 81-015 with an added 8088 daughterboard and rom -COMP( 1984, kaypro1084, kaypro10, 0, kaypro10, kaypro, kaypro_state, init_kaypro, "Non Linear Systems", "Kaypro 10", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // model 81-005 -COMP( 1984, robie, 0, 0, kaypro4x, kaypro, kaypro_state, init_kaypro, "Non Linear Systems", "Kaypro Robie", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) -COMP( 1985, kaypro2x, kaypro484, 0, kaypro484, kaypro, kaypro_state, init_kaypro, "Non Linear Systems", "Kaypro 2x", MACHINE_SUPPORTS_SAVE ) // model 81-025 -COMP( 1985, kaypronew2, 0, 0, kaypronew2, kaypro, kaypro_state, init_kaypro, "Non Linear Systems", "Kaypro New 2", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) -COMP( 1985, kaypro4x, robie, 0, kaypro4x, kaypro, kaypro_state, init_kaypro, "Non Linear Systems", "Kaypro 4x", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) -COMP( 1986, kaypro1, kaypro484, 0, kaypro1, kaypro, kaypro_state, init_kaypro, "Non Linear Systems", "Kaypro 1", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) -COMP( 198?, omni2, kayproii, 0, omni2, kaypro, kaypro_state, init_kaypro, "Non Linear Systems", "Omni II Logic Analyzer", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) +COMP( 1982, kayproii, 0, 0, kayproii, kaypro, kaypro_state, init_kaypro, "Non-Linear Systems", "Kaypro II - 2/83", MACHINE_SUPPORTS_SAVE ) +COMP( 1983, kayproiv, kayproii, 0, kayproiv, kaypro, kaypro_state, init_kaypro, "Non-Linear Systems", "Kaypro IV - 4/83", MACHINE_SUPPORTS_SAVE ) // model 81-004 +COMP( 1983, kaypro10, 0, 0, kaypro10, kaypro, kaypro_state, init_kaypro, "Non-Linear Systems", "Kaypro 10 - 1983", MACHINE_SUPPORTS_SAVE ) +COMP( 1983, kayproiip88, kayproii, 0, kayproii, kaypro, kaypro_state, init_kaypro, "Kaypro Corporation", "Kaypro 4 plus88 - 4/83" , MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // model 81-004 with an added 8088 daughterboard and rom +COMP( 1984, kaypro484, 0, 0, kaypro484, kaypro, kaypro_state, init_kaypro, "Kaypro Corporation", "Kaypro 4/84", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // model 81-015 +COMP( 1984, kaypro284, kaypro484, 0, kaypro284, kaypro, kaypro_state, init_kaypro, "Kaypro Corporation", "Kaypro 2/84", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // model 81-015 +COMP( 1984, kaypro484p88, kaypro484, 0, kaypro484, kaypro, kaypro_state, init_kaypro, "Kaypro Corporation", "Kaypro 4/84 plus88", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // model 81-015 with an added 8088 daughterboard and rom +COMP( 1984, kaypro1084, kaypro10, 0, kaypro1084, kaypro, kaypro_state, init_kaypro, "Kaypro Corporation", "Kaypro 10", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // model 81-005 +COMP( 1984, robie, 0, 0, kaypro4x, kaypro, kaypro_state, init_kaypro, "Kaypro Corporation", "Kaypro Robie", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) +COMP( 1985, kaypro2x, kaypro484, 0, kaypro484, kaypro, kaypro_state, init_kaypro, "Kaypro Corporation", "Kaypro 2x", MACHINE_SUPPORTS_SAVE ) // model 81-025 +COMP( 1985, kaypronew2, 0, 0, kaypronew2, kaypro, kaypro_state, init_kaypro, "Kaypro Corporation", "Kaypro New 2", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) +COMP( 1985, kaypro4x, robie, 0, kaypro4x, kaypro, kaypro_state, init_kaypro, "Kaypro Corporation", "Kaypro 4x", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) +COMP( 1986, kaypro1, kaypro484, 0, kaypro1, kaypro, kaypro_state, init_kaypro, "Kaypro Corporation", "Kaypro 1", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) +COMP( 198?, omni2, kayproii, 0, omni2, kaypro, kaypro_state, init_kaypro, "Kaypro Corporation", "Omni II Logic Analyzer", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) COMP( 198?, omni4, kaypro484, 0, kaypro1, kaypro, kaypro_state, init_kaypro, "Omni Logic Inc.", "Omni 4 Logic Analyzer", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/kaypro/kaypro.h b/src/mame/kaypro/kaypro.h index c46ac1e6fea..740ab1b0a2d 100644 --- a/src/mame/kaypro/kaypro.h +++ b/src/mame/kaypro/kaypro.h @@ -13,6 +13,7 @@ #include "imagedev/snapquik.h" #include "sound/beep.h" #include "video/mc6845.h" +#include "machine/mm58167.h" #include "machine/wd_fdc.h" #include "machine/timer.h" #include "emupal.h" @@ -35,6 +36,7 @@ public: , m_floppy1(*this, "fdc:1") , m_crtc(*this, "crtc") , m_beep(*this, "beeper") + , m_rtc(*this, "rtc") , m_bankr(*this, "bankr") , m_bankw(*this, "bankw") , m_bank3(*this, "bank3") @@ -48,6 +50,7 @@ public: void kaypronew2(machine_config &config); void kaypro484(machine_config &config); void kaypro10(machine_config &config); + void kaypro1084(machine_config &config); void kaypro284(machine_config &config); void kaypro4x(machine_config &config); void kaypro1(machine_config &config); @@ -59,6 +62,7 @@ protected: virtual void machine_reset() override; private: + void kaypro10_io(address_map &map); void kaypro484_io(address_map &map); void kaypro_map(address_map &map); void kayproii_io(address_map &map); @@ -78,6 +82,9 @@ private: void kayproiv_pio_system_w(u8 data); DECLARE_WRITE_LINE_MEMBER(fdc_intrq_w); DECLARE_WRITE_LINE_MEMBER(fdc_drq_w); + void rtc_address_w(u8 data); + u8 rtc_r(); + void rtc_w(u8 data); u8 kaypro_videoram_r(offs_t offset); void kaypro_videoram_w(offs_t offset, u8 data); static void floppy_formats(format_registration &fr); @@ -103,6 +110,7 @@ private: u8 m_system_port = 0U; u16 m_mc6845_video_address = 0U; floppy_image_device *m_floppy = nullptr; + u8 m_rtc_address = 0U; required_device m_palette; required_device m_screen; @@ -116,6 +124,7 @@ private: optional_device m_floppy1; optional_device m_crtc; required_device m_beep; + optional_device m_rtc; required_memory_bank m_bankr; required_memory_bank m_bankw; required_memory_bank m_bank3; diff --git a/src/mame/kaypro/kaypro_m.cpp b/src/mame/kaypro/kaypro_m.cpp index 7b308c5bbd6..d9879ea7321 100644 --- a/src/mame/kaypro/kaypro_m.cpp +++ b/src/mame/kaypro/kaypro_m.cpp @@ -213,6 +213,22 @@ WRITE_LINE_MEMBER( kaypro_state::fdc_drq_w ) } +void kaypro_state::rtc_address_w(u8 data) +{ + m_rtc_address = data & 0x1f; +} + +u8 kaypro_state::rtc_r() +{ + return m_rtc->read(m_rtc_address); +} + +void kaypro_state::rtc_w(u8 data) +{ + m_rtc->write(m_rtc_address, data); +} + + /*********************************************************** Machine @@ -237,6 +253,9 @@ void kaypro_state::machine_start() save_item(NAME(m_system_port)); save_item(NAME(m_mc6845_video_address)); + if (m_rtc.found()) + save_item(NAME(m_rtc_address)); + m_framecnt = 0; } -- cgit v1.2.3