From 21cf0bf1382fbabe36a53bc503c51810af09b0e1 Mon Sep 17 00:00:00 2001 From: shattered Date: Tue, 12 Dec 2023 13:56:55 +0000 Subject: bus/multibus/robotron_k7070.cpp, robotron/a7150.cpp: Made Robotron K7070 KGS a Multibus card. (#11647) --- scripts/src/bus.lua | 2 + src/devices/bus/multibus/robotron_k7070.cpp | 423 +++++++++++++++++++++++++ src/devices/bus/multibus/robotron_k7070.h | 77 +++++ src/mame/robotron/a7150.cpp | 470 +++------------------------- 4 files changed, 550 insertions(+), 422 deletions(-) create mode 100644 src/devices/bus/multibus/robotron_k7070.cpp create mode 100644 src/devices/bus/multibus/robotron_k7070.h diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index a7e855801b8..0240f1a5038 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -5161,6 +5161,8 @@ if (BUSES["MULTIBUS"]~=null) then MAME_DIR .. "src/devices/bus/multibus/labtam_vducom.h", MAME_DIR .. "src/devices/bus/multibus/labtam_z80sbc.cpp", MAME_DIR .. "src/devices/bus/multibus/labtam_z80sbc.h", + MAME_DIR .. "src/devices/bus/multibus/robotron_k7070.cpp", + MAME_DIR .. "src/devices/bus/multibus/robotron_k7070.h", } end diff --git a/src/devices/bus/multibus/robotron_k7070.cpp b/src/devices/bus/multibus/robotron_k7070.cpp new file mode 100644 index 00000000000..301b2ec48c3 --- /dev/null +++ b/src/devices/bus/multibus/robotron_k7070.cpp @@ -0,0 +1,423 @@ +// license:BSD-3-Clause +// copyright-holders:Sergey Svishchev + +/* + * Robotron K7070 and K7072 combo + * + * K7070 KGS - graphics terminal (K7070.10 model) + * K7072 ABG - dumb grayscale framebuffer + * + * Reference: http://www.tiffe.de/Robotron/MMS16/ + * Internal test of KGS -- in KGS-K7070.pdf, pp. 19-23 + * + * To do: + * - palette + * - vertical raster split and text mode + */ + +#include "emu.h" +#include "robotron_k7070.h" + +#define VERBOSE 0 +#include "logmacro.h" + +enum kgs_st : u8 +{ + KGS_ST_OBF = 0x01, + KGS_ST_IBF = 0x02, + KGS_ST_INT = 0x04, + KGS_ST_ERR = 0x80, +}; + +DEFINE_DEVICE_TYPE(ROBOTRON_K7070, robotron_k7070_device, "robotron_k7070", "Robotron K7070 KGS") + +robotron_k7070_device::robotron_k7070_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock) + : device_t(mconfig, ROBOTRON_K7070, tag, owner, clock) + , device_multibus_interface(mconfig, *this) + , m_cpu(*this, "cpu") + , m_ctc(*this, "ctc") + , m_sio(*this, "sio") + , m_serial(*this, "serial%u", 0U) + , m_palette(*this, "palette") + , m_ram(*this, "vram0") + , m_dsel(*this, "DSEL%u", 0U) + , m_view_lo(*this, "view_lo") + , m_view_hi(*this, "view_hi") +{ + m_abg_msel = m_kgs_iml = 0; + m_abg_func = m_abg_split = 0; + m_abg_addr = 0; + m_kgs_datao = m_kgs_datai = m_kgs_ctrl = 0; + m_nmi_enable = 0; +} + +ROM_START(robotron_k7070) + ROM_REGION(0x2000, "eprom", ROMREGION_ERASEFF) + ROM_DEFAULT_BIOS("152") + + ROM_SYSTEM_BIOS(0, "152", "Version 152") // ROM from A7100 + ROMX_LOAD("kgs7070-152.bin", 0x0000, 0x2000, CRC(403f4235) SHA1(d07ccd40f8b600651d513f588bcf1ea4f15ed094), ROM_BIOS(0)) + + ROM_SYSTEM_BIOS(1, "153", "Version 153") + ROMX_LOAD("kgs7070-153.rom", 0x0000, 0x2000, CRC(a72fe820) SHA1(4b77ab2b59ea8c3632986847ff359df26b16196b), ROM_BIOS(1)) + + ROM_SYSTEM_BIOS(2, "154", "Version 154") + ROMX_LOAD("kgs7070-154.rom", 0x0000, 0x2000, CRC(2995ade0) SHA1(62516f2e1cb62698445f80fd823d39a1a78a7807), ROM_BIOS(2)) +ROM_END + +static INPUT_PORTS_START(robotron_k7070) + PORT_START("DSEL0") + PORT_DIPNAME(0x01, 0x01, "Codepoint 0x24") + PORT_DIPSETTING(0x00, "Currency sign" ) + PORT_DIPSETTING(0x01, "Dollar sign" ) + PORT_DIPNAME(0x02, 0x02, "Perform I/O test") + PORT_DIPSETTING(0x00, DEF_STR(No) ) + PORT_DIPSETTING(0x02, DEF_STR(Yes) ) + PORT_DIPNAME(0x04, 0x00, "Perform VRAM test") + PORT_DIPSETTING(0x00, DEF_STR(Yes) ) + PORT_DIPSETTING(0x04, DEF_STR(No) ) + + PORT_START("DSEL1") + PORT_DIPNAME(0x03, 0x02, "V.24 Parity") + PORT_DIPSETTING(0x00, "No parity" ) + PORT_DIPSETTING(0x01, "Odd" ) + PORT_DIPSETTING(0x02, "No parity" ) + PORT_DIPSETTING(0x03, "Even" ) + PORT_DIPNAME(0x04, 0x04, "V.24 Character size") + PORT_DIPSETTING(0x00, "7 bits") + PORT_DIPSETTING(0x04, "8 bits") + PORT_DIPNAME(0x38, 0x38, "V.24 Baud rate") + PORT_DIPSETTING(0x38, "19200") + PORT_DIPSETTING(0x30, "9600") + PORT_DIPSETTING(0x28, "4800") + PORT_DIPSETTING(0x20, "2400") + PORT_DIPSETTING(0x18, "1200") + PORT_DIPSETTING(0x10, "600") + PORT_DIPSETTING(0x08, "300") + PORT_DIPNAME(0x40, 0x40, "IFSS Parity") + PORT_DIPSETTING(0x00, "Odd" ) + PORT_DIPSETTING(0x40, "Even" ) + PORT_DIPNAME(0x80, 0x80, "IFSS Baud rate") + PORT_DIPSETTING(0x00, "9600") + PORT_DIPSETTING(0x80, "Same as V.24") +INPUT_PORTS_END + +const tiny_rom_entry *robotron_k7070_device::device_rom_region() const +{ + return ROM_NAME(robotron_k7070); +} + +ioport_constructor robotron_k7070_device::device_input_ports() const +{ + return INPUT_PORTS_NAME(robotron_k7070); +} + +void robotron_k7070_device::device_start() +{ + save_item(NAME(m_start)); + save_item(NAME(m_abg_msel)); + save_item(NAME(m_kgs_iml)); + save_item(NAME(m_kgs_datao)); + save_item(NAME(m_kgs_datai)); + save_item(NAME(m_kgs_ctrl)); + save_item(NAME(m_nmi_enable)); + + m_bus->space(AS_IO).install_readwrite_handler(0x200, 0x203, read16s_delegate(*this, FUNC(robotron_k7070_device::io_r)), write16s_delegate(*this, FUNC(robotron_k7070_device::io_w))); +} + +void robotron_k7070_device::device_reset() +{ + m_start = 0; + m_kgs_ctrl = KGS_ST_IBF | KGS_ST_OBF; + m_kgs_datao = m_kgs_datai = 0; + m_kgs_iml = m_abg_msel = 0; + m_nmi_enable = false; + kgs_memory_remap(); +} + +static const z80_daisy_config k7070_daisy_chain[] = +{ + { "sio" }, + { "ctc" }, + { nullptr } +}; + +void robotron_k7070_device::device_add_mconfig(machine_config &config) +{ + Z80(config, m_cpu, XTAL(16'000'000) / 4); + m_cpu->set_addrmap(AS_PROGRAM, &robotron_k7070_device::cpu_mem); + m_cpu->set_addrmap(AS_IO, &robotron_k7070_device::cpu_pio); + m_cpu->set_daisy_config(k7070_daisy_chain); + + Z80CTC(config, m_ctc, 16_MHz_XTAL / 3); + m_ctc->intr_callback().set_inputline(m_cpu, INPUT_LINE_IRQ0); + m_ctc->set_clk<0>(1230750); + m_ctc->set_clk<1>(1230750); + m_ctc->set_clk<2>(1230750); + m_ctc->set_clk<3>(1230750); + m_ctc->zc_callback<0>().set(m_sio, FUNC(z80sio_device::rxca_w)); + m_ctc->zc_callback<0>().append(m_sio, FUNC(z80sio_device::txca_w)); + m_ctc->zc_callback<1>().set(m_sio, FUNC(z80sio_device::rxtxcb_w)); + + Z80SIO(config, m_sio, XTAL(16'000'000) / 4); + m_sio->out_int_callback().set_inputline(m_cpu, INPUT_LINE_IRQ0); + m_sio->out_txda_callback().set(m_serial[0], FUNC(rs232_port_device::write_txd)); + m_sio->out_dtra_callback().set(m_serial[0], FUNC(rs232_port_device::write_dtr)); + m_sio->out_rtsa_callback().set(m_serial[0], FUNC(rs232_port_device::write_rts)); + m_sio->out_txdb_callback().set(m_serial[1], FUNC(rs232_port_device::write_txd)); + m_sio->out_dtrb_callback().set([this] (bool state) { m_kgs_iml = !state; kgs_memory_remap(); }); + + // V.24 port for tablet + RS232_PORT(config, m_serial[0], default_rs232_devices, "loopback"); + m_serial[0]->rxd_handler().set(m_sio, FUNC(z80sio_device::rxa_w)); + m_serial[0]->dcd_handler().set(m_sio, FUNC(z80sio_device::dcda_w)); + m_serial[0]->cts_handler().set(m_sio, FUNC(z80sio_device::ctsa_w)); + + // IFSS (current loop) port for keyboard (unused on A7150) + RS232_PORT(config, m_serial[1], default_rs232_devices, "loopback"); + m_serial[1]->rxd_handler().set(m_sio, FUNC(z80sio_device::rxb_w)); + + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); + screen.set_color(rgb_t::green()); + screen.set_raw(XTAL(16'000'000), 737, 0, 640, 431, 0, 400); + screen.set_screen_update(FUNC(robotron_k7070_device::screen_update_k7072)); + screen.set_palette(m_palette); + screen.screen_vblank().set([this] (bool state) { if (m_nmi_enable) m_cpu->set_input_line(INPUT_LINE_NMI, state); }); + + PALETTE(config, m_palette, palette_device::MONOCHROME); +} + +void robotron_k7070_device::cpu_mem(address_map &map) +{ + map.unmap_value_high(); + + map(0x0000, 0x1fff).view(m_view_lo); + m_view_lo[0](0x0000, 0x1fff).rom().region("eprom", 0); + m_view_lo[1](0x0000, 0x1fff).ram().share("kgs_ram0"); + + map(0x2000, 0x7fff).ram().share("kgs_ram1"); + +// FIXME handle IML=0 and MSEL=1 (no access to VRAM) + map(0x8000, 0xffff).view(m_view_hi); + m_view_hi[0](0x8000, 0xffff).ram().share("kgs_ram2"); + m_view_hi[1](0x8000, 0xffff).ram().share("vram0"); +} + +void robotron_k7070_device::cpu_pio(address_map &map) +{ + map.unmap_value_high(); + map.global_mask(0xff); + + map(0x0000, 0x0003).rw(m_ctc, FUNC(z80ctc_device::read), FUNC(z80ctc_device::write)); + map(0x0008, 0x000b).rw(m_sio, FUNC(z80sio_device::ba_cd_r), FUNC(z80sio_device::ba_cd_w)); + map(0x0010, 0x0017).rw(FUNC(robotron_k7070_device::kgs_host_r), FUNC(robotron_k7070_device::kgs_host_w)); // p. 11 of KGS-K7070.pdf + + // p. 6 of ABG-K7072.pdf + map(0x0020, 0x0021).w(FUNC(robotron_k7070_device::abg_addr_w)); + map(0x0022, 0x0022).w(FUNC(robotron_k7070_device::abg_func_w)); + map(0x0023, 0x0023).w(FUNC(robotron_k7070_device::abg_split_w)); + map(0x0030, 0x003f).noprw(); // palette register + + map(0x0080, 0x0080).w(FUNC(robotron_k7070_device::abg_misc_w)); +} + +void robotron_k7070_device::palette_init(palette_device &palette) +{ + // 0=black, 1=dim, 2=normal, 3=bold + + palette.set_pen_color(0, rgb_t::black()); + palette.set_pen_color(1, rgb_t(0x80, 0x80, 0x80)); + palette.set_pen_color(2, rgb_t(0xc0, 0xc0, 0xc0)); + palette.set_pen_color(3, rgb_t::white()); +} + +uint16_t robotron_k7070_device::io_r(offs_t offset, uint16_t mem_mask) +{ + uint8_t data = 0; + + switch (offset) + { + case 0: + data = m_kgs_ctrl; + break; + + case 1: + data = m_kgs_datai; + if (!machine().side_effects_disabled()) + m_kgs_ctrl &= ~KGS_ST_OBF; + break; + } + + if (offset && !machine().side_effects_disabled()) + { + LOG("%s: KGS %d == %02x '%c'\n", machine().describe_context(), + offset, data, (data > 0x1f && data < 0x7f) ? data : 0x20); + } + + return data; +} + +void robotron_k7070_device::io_w(offs_t offset, uint16_t data, uint16_t mem_mask) +{ + if (offset) + { + LOG("%s: KGS %d <- %02x '%c', ctrl %02x\n", machine().describe_context(), + offset, data, (data > 0x1f && data < 0x7f) ? data : 0x20, m_kgs_ctrl); + } + + switch (offset) + { + case 0: + m_kgs_ctrl &= ~(KGS_ST_ERR | KGS_ST_INT); + int_w(7, CLEAR_LINE); + break; + + case 1: + if (m_kgs_ctrl & KGS_ST_IBF) + { + m_kgs_ctrl |= KGS_ST_ERR; + } + else + { + m_kgs_datao = data; + m_kgs_ctrl |= KGS_ST_IBF; + } + break; + } +} + +uint32_t robotron_k7070_device::screen_update_k7072(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int addr = m_start; + + for (int y = 0; y < 400; y++) + { + int horpos = 0; + for (int x = 0; x < 80; x++) + { + uint8_t code = m_ram[addr++ % 32768]; + for (int b = 0; b < 8; b++) + { + bitmap.pix(y, horpos++) = BIT(code, 7 - b); + } + } + } + + return 0; +} + + +uint8_t robotron_k7070_device::kgs_host_r(offs_t offset) +{ + uint8_t data = 0; + + switch (offset) + { + case 0: + data = m_kgs_datao; + if (!machine().side_effects_disabled()) + m_kgs_ctrl &= ~(KGS_ST_ERR | KGS_ST_IBF); + break; + + case 2: + data = m_kgs_ctrl; + break; + + case 6: + data = m_dsel[0]->read(); + break; + + case 7: + data = m_dsel[1]->read(); + break; + + default: + break; + } + + if (offset != 2 && offset != 5 && !machine().side_effects_disabled()) + { + LOG("%s: kgs %d == %02x '%c'\n", machine().describe_context(), + offset, data, (data > 0x1f && data < 0x7f) ? data : ' '); + } + + return data; +} + +void robotron_k7070_device::kgs_host_w(offs_t offset, uint8_t data) +{ + if (offset != 2 && offset != 5) + { + LOG("%s: kgs %d <- %02x '%c', ctrl %02x\n", machine().describe_context(), + offset, data, (data > 0x1f && data < 0x7f) ? data : ' ', m_kgs_ctrl); + } + + switch (offset) + { + case 1: + if (m_kgs_ctrl & KGS_ST_OBF) + { + m_kgs_ctrl |= KGS_ST_ERR; + } + else + { + m_kgs_datai = data; + m_kgs_ctrl |= KGS_ST_OBF; + } + break; + + case 3: + m_kgs_ctrl |= KGS_ST_INT; + int_w(7, ASSERT_LINE); + break; + + case 4: + m_kgs_ctrl |= KGS_ST_ERR; + break; + + case 5: + m_abg_msel = data; + kgs_memory_remap(); + break; + } +} + +void robotron_k7070_device::abg_addr_w(offs_t offset, uint8_t data) +{ + if (offset == 0) + m_start |= ((data & 127) << 8); + else + m_start = data; +} + +/* + * bit 0: GRAF This bit must be set if both video levels are to be output in graphics display mode or if the palette registers are to be programmed. + * bit 1: /PALP This bit must be set to program the palette register. + * bit 2: /KGSP If this bit is reset, the frame buffer can be accessed asynchronously. + * bit 3: BLNK Switching this bit causes the points (byte by byte) in which the attribute bit of video level 2 (bit 1) is set to flash in alphanumeric display mode. + */ +void robotron_k7070_device::abg_func_w(offs_t offset, uint8_t data) +{ + LOG("%s: abg func <- %02x\n", machine().describe_context(), data); + m_abg_func = data; +} + +void robotron_k7070_device::abg_split_w(offs_t offset, uint8_t data) +{ + LOG("%s: abg split <- %02x (%d -> %d)\n", machine().describe_context(), data, data, data*2); + m_abg_split = data; +} + +void robotron_k7070_device::abg_misc_w(offs_t offset, uint8_t data) +{ + LOG("%s: abg misc <- %02x\n", machine().describe_context(), data); + m_nmi_enable = BIT(data, 7); +} + +void robotron_k7070_device::kgs_memory_remap() +{ + LOG("%s: kgs memory: iml %d msel %d\n", machine().describe_context(), m_kgs_iml, m_abg_msel); + + m_view_lo.select(m_kgs_iml); + m_view_hi.select(m_abg_msel != 0); +} diff --git a/src/devices/bus/multibus/robotron_k7070.h b/src/devices/bus/multibus/robotron_k7070.h new file mode 100644 index 00000000000..14c0a9c868d --- /dev/null +++ b/src/devices/bus/multibus/robotron_k7070.h @@ -0,0 +1,77 @@ +// license:BSD-3-Clause +// copyright-holders:Sergey Svishchev + +#ifndef MAME_BUS_MULTIBUS_ROBOTRON_K7070_H +#define MAME_BUS_MULTIBUS_ROBOTRON_K7070_H + +#pragma once + +#include "multibus.h" + +#include "bus/rs232/rs232.h" +#include "cpu/z80/z80.h" +#include "machine/z80ctc.h" +#include "machine/z80sio.h" + +#include "emupal.h" +#include "screen.h" + + +class robotron_k7070_device + : public device_t + , public device_multibus_interface +{ +public: + robotron_k7070_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock); + +protected: + virtual void device_add_mconfig(machine_config &config) override; + virtual void device_start() override; + virtual void device_reset() override; + virtual ioport_constructor device_input_ports() const override; + virtual const tiny_rom_entry *device_rom_region() const override; + + void cpu_mem(address_map &map); + virtual void cpu_pio(address_map &map); + +private: + required_device m_cpu; + required_device m_ctc; + required_device m_sio; + required_device_array m_serial; + required_device m_palette; + required_shared_ptr m_ram; + required_ioport_array<2> m_dsel; + + memory_view m_view_lo; + memory_view m_view_hi; + + u16 m_start; + + bool m_abg_msel, m_kgs_iml; + uint8_t m_abg_func, m_abg_split; + uint16_t m_abg_addr; + uint8_t m_kgs_datao, m_kgs_datai, m_kgs_ctrl; + bool m_nmi_enable; + + uint8_t kgs_host_r(offs_t offset); + void kgs_host_w(offs_t offset, uint8_t data); + void abg_addr_w(offs_t offset, uint8_t data); + void abg_func_w(offs_t offset, uint8_t data); + void abg_split_w(offs_t offset, uint8_t data); + void abg_misc_w(offs_t offset, uint8_t data); + void kgs_memory_remap(); + + uint32_t screen_update_k7072(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void palette_init(palette_device &palette); + + uint16_t io_r(offs_t offset, uint16_t mem_mask); + void io_w(offs_t offset, uint16_t data, uint16_t mem_mask); + + void k7070_cpu_io(address_map &map); + void k7070_cpu_mem(address_map &map); +}; + +DECLARE_DEVICE_TYPE(ROBOTRON_K7070, robotron_k7070_device) + +#endif // MAME_BUS_MULTIBUS_ROBOTRON_K7070_H diff --git a/src/mame/robotron/a7150.cpp b/src/mame/robotron/a7150.cpp index fa2ba4268da..7fc8f333349 100644 --- a/src/mame/robotron/a7150.cpp +++ b/src/mame/robotron/a7150.cpp @@ -15,10 +15,16 @@ http://www.tiffe.de/Robotron/MMS16/ After about a minute, the self-test will appear. To do: -- Machine hangs when screen should scroll -- MMS16 (Multibus clone) and slot devices -- native keyboard -- A7100 model +- native keyboard -- K7637 and/or K7672 +- interrupts +- ABS K7071 (text-only video) +- ABG K7075 (CGA compatible video) +- KES K5170 media controller (derived from iSBC 215A but not 100% compatible) +- boot BOS (iRMX clone) +- boot DCP (DOS clone) +- boot MUTOS (V7 UNIX) to multiuser +- boot SCP (CP/M clone) +- A7100 model (KES at 0x100 etc.) ****************************************************************************/ @@ -26,49 +32,32 @@ To do: #include "isbc_215g.h" +#include "bus/multibus/multibus.h" +#include "bus/multibus/robotron_k7070.h" #include "bus/rs232/rs232.h" #include "cpu/i86/i86.h" -#include "cpu/z80/z80.h" -#include "machine/bankdev.h" #include "machine/i8087.h" #include "machine/i8251.h" #include "machine/i8255.h" -#include "machine/input_merger.h" #include "machine/keyboard.h" #include "machine/pic8259.h" #include "machine/pit8253.h" -#include "machine/z80ctc.h" -#include "machine/z80sio.h" - -#include "emupal.h" -#include "screen.h" namespace { -#define SCREEN_TAG "screen" -#define Z80_TAG "gfxcpu" -#define Z80CTC_TAG "z80ctc" -#define Z80SIO_TAG "z80sio" -#define RS232_A_TAG "kgsv24" -#define RS232_B_TAG "kgsifss" - class a7150_state : public driver_device { public: a7150_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) + , m_bus(*this, "slot") , m_maincpu(*this, "maincpu") , m_uart8251(*this, "uart8251") , m_pit8253(*this, "pit8253") , m_pic8259(*this, "pic8259") - , m_gfxcpu(*this, "gfxcpu") - , m_ctc(*this, Z80CTC_TAG) , m_rs232(*this, "rs232") - , m_video_ram(*this, "video_ram") - , m_video_bankdev(*this, "video_bankdev") - , m_palette(*this, "palette") { } void a7150(machine_config &config); @@ -78,101 +67,24 @@ protected: virtual void machine_start() override; private: - uint8_t a7150_kgs_r(offs_t offset); - void a7150_kgs_w(offs_t offset, uint8_t data); - - void a7150_tmr2_w(int state); void ppi_c_w(uint8_t data); - void ifss_write_txd(int state); - void ifss_write_dtr(int state); - - uint8_t kgs_host_r(offs_t offset); - void kgs_host_w(offs_t offset, uint8_t data); - void kgs_iml_w(int state); - void ifss_loopback_w(int state); - [[maybe_unused]] void kbd_put(uint8_t data); - void kgs_memory_remap(); - - bool m_kgs_msel = 0, m_kgs_iml = 0; - uint8_t m_kgs_datao = 0, m_kgs_datai = 0, m_kgs_ctrl = 0; bool m_ifss_loopback = 0; - uint32_t screen_update_k7072(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - [[maybe_unused]] void screen_eof(screen_device &screen, bool state); - + required_device m_bus; required_device m_maincpu; required_device m_uart8251; required_device m_pit8253; required_device m_pic8259; - - required_device m_gfxcpu; - required_device m_ctc; required_device m_rs232; - required_shared_ptr m_video_ram; - required_device m_video_bankdev; - required_device m_palette; void io_map(address_map &map); void mem_map(address_map &map); - void k7070_cpu_banked(address_map &map); - void k7070_cpu_io(address_map &map); - void k7070_cpu_mem(address_map &map); -}; - - -uint32_t a7150_state::screen_update_k7072(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int addr = 0; - - for (int y = 0; y < 400; y++) - { - int horpos = 0; - for (int x = 0; x < 80; x++) - { - uint8_t code = m_video_ram[addr++]; - for (int b = 0; b < 8; b++) - { - bitmap.pix(y, horpos++) = (code >> (7 - b)) & 1; - } - } - } - - return 0; -} - -void a7150_state::kgs_iml_w(int state) -{ - m_kgs_iml = !state; - kgs_memory_remap(); -} -void a7150_state::a7150_tmr2_w(int state) -{ - m_uart8251->write_rxc(state); - m_uart8251->write_txc(state); -} - -void a7150_state::ifss_loopback_w(int state) -{ - m_ifss_loopback = !state; -} - -void a7150_state::ifss_write_txd(int state) -{ - if (m_ifss_loopback) - m_uart8251->write_rxd(state); - else - m_rs232->write_txd(state); -} + u8 bus_pio_r(offs_t offset) { return m_bus->space(AS_IO).read_byte(offset); } + void bus_pio_w(offs_t offset, u8 data) { m_bus->space(AS_IO).write_byte(offset, data); } +}; -void a7150_state::ifss_write_dtr(int state) -{ - if (m_ifss_loopback) - m_uart8251->write_dsr(state); - else - m_rs232->write_dtr(state); -} void a7150_state::ppi_c_w(uint8_t data) { @@ -180,142 +92,9 @@ void a7150_state::ppi_c_w(uint8_t data) // b1 -- /OBF(B) // m_centronics->write_ack(BIT(data, 2)); // m_centronics->write_strobe(BIT(data, 3)); + // b7 -- /NMIDIS } -#define KGS_ST_OBF 0x01 -#define KGS_ST_IBF 0x02 -#define KGS_ST_INT 0x04 -#define KGS_ST_ERR 0x80 - -uint8_t a7150_state::kgs_host_r(offs_t offset) -{ - uint8_t data = 0; - - switch (offset) - { - case 0: - data = m_kgs_datao; - m_kgs_ctrl &= ~(KGS_ST_ERR | KGS_ST_IBF); - m_pic8259->ir7_w(ASSERT_LINE); - break; - - case 2: - data = m_kgs_ctrl; - break; - - case 6: - data = ioport("DSEL0")->read(); - break; - - case 7: - data = ioport("DSEL1")->read(); - break; - - default: - break; - } - - if (0 && offset != 2 && offset != 5) - logerror("%s: kgs %d == %02x '%c'\n", machine().describe_context(), offset, data, - (data > 0x1f && data < 0x7f) ? data : 0x20); - - return data; -} - -void a7150_state::kgs_host_w(offs_t offset, uint8_t data) -{ - if (0) logerror("%s: kgs %d <- %02x '%c', ctrl %02x\n", machine().describe_context(), offset, data, - (data > 0x1f && data < 0x7f) ? data : 0x20, m_kgs_ctrl); - - switch (offset) - { - case 1: - if (m_kgs_ctrl & KGS_ST_OBF) - { - m_kgs_ctrl |= KGS_ST_ERR; - } - else - { - m_kgs_datai = data; - m_kgs_ctrl |= KGS_ST_OBF; - m_pic8259->ir6_w(ASSERT_LINE); - } - break; - - case 3: - m_kgs_ctrl |= KGS_ST_INT; - m_pic8259->ir1_w(ASSERT_LINE); - break; - - case 4: - m_kgs_ctrl |= KGS_ST_ERR; - break; - - case 5: - m_kgs_msel = (data != 0); - kgs_memory_remap(); - break; - } -} - -void a7150_state::kbd_put(uint8_t data) -{ - m_kgs_datai = data; - m_kgs_ctrl |= KGS_ST_OBF | KGS_ST_INT; - m_pic8259->ir1_w(ASSERT_LINE); -} - -uint8_t a7150_state::a7150_kgs_r(offs_t offset) -{ - uint8_t data = 0; - - switch (offset) - { - case 0: - data = m_kgs_ctrl; - break; - - case 1: - data = m_kgs_datai; - m_kgs_ctrl &= ~KGS_ST_OBF; - break; - } - - if (offset) - logerror("%s: KGS %d == %02x '%c'\n", machine().describe_context(), offset, data, - (data > 0x1f && data < 0x7f) ? data : 0x20); - - return data; -} - -void a7150_state::a7150_kgs_w(offs_t offset, uint8_t data) -{ - logerror("%s: KGS %d <- %02x '%c', ctrl %02x\n", machine().describe_context(), offset, data, - (data > 0x1f && data < 0x7f) ? data : 0x20, m_kgs_ctrl); - - switch (offset) - { - case 0: - m_kgs_ctrl &= ~(KGS_ST_ERR | KGS_ST_INT); -// m_pic8259->ir1_w(CLEAR_LINE); - break; - - case 1: - if (m_kgs_ctrl & KGS_ST_IBF) - { - m_kgs_ctrl |= KGS_ST_ERR; - } - else - { - m_kgs_datao = data; - m_kgs_ctrl |= KGS_ST_IBF; - m_pic8259->ir7_w(CLEAR_LINE); - } - break; - } -} - - void a7150_state::mem_map(address_map &map) { map.unmap_value_high(); @@ -326,95 +105,19 @@ void a7150_state::mem_map(address_map &map) void a7150_state::io_map(address_map &map) { map.unmap_value_high(); + // map PIO to Multibus by default + map(0x0000, 0xffff).rw(FUNC(a7150_state::bus_pio_r), FUNC(a7150_state::bus_pio_w)); +// map(0x0000, 0x0003).unmaprw(); // memory parity 1-2 +// map(0x0040, 0x0043).unmaprw(); // memory parity 3-4 map(0x004a, 0x004a).w("isbc_215g", FUNC(isbc_215g_device::write)); // KES board map(0x00c0, 0x00c3).rw(m_pic8259, FUNC(pic8259_device::read), FUNC(pic8259_device::write)).umask16(0x00ff); map(0x00c8, 0x00cf).rw("ppi8255", FUNC(i8255_device::read), FUNC(i8255_device::write)).umask16(0x00ff); map(0x00d0, 0x00d7).rw(m_pit8253, FUNC(pit8253_device::read), FUNC(pit8253_device::write)).umask16(0x00ff); map(0x00d8, 0x00db).rw(m_uart8251, FUNC(i8251_device::read), FUNC(i8251_device::write)).umask16(0x00ff); - map(0x0200, 0x0203).rw(FUNC(a7150_state::a7150_kgs_r), FUNC(a7150_state::a7150_kgs_w)).umask16(0x00ff); // ABS/KGS board - map(0x0300, 0x031f).unmaprw(); // ASP board #1 - map(0x0320, 0x033f).unmaprw(); // ASP board #2 -} - -void a7150_state::k7070_cpu_banked(address_map &map) -{ - map.unmap_value_high(); - // default map: IML=0, MSEL=0. ROM + local RAM. - map(0x00000, 0x01fff).rom().region("user2", 0); - map(0x02000, 0x07fff).ram().share("kgs_ram1"); - map(0x08000, 0x0ffff).ram().share("kgs_ram2"); - // IML=1, MSEL=0. local RAM only. - map(0x10000, 0x11fff).ram().share("kgs_ram0"); - map(0x12000, 0x17fff).ram().share("kgs_ram1"); - map(0x18000, 0x1ffff).ram().share("kgs_ram2"); - // IML=0, MSEL=1. ROM + local RAM. - map(0x20000, 0x21fff).rom().region("user2", 0); - map(0x22000, 0x27fff).ram().share("kgs_ram1"); - // IML=1, MSEL=1. local RAM only. - map(0x30000, 0x31fff).ram().share("kgs_ram0"); - map(0x32000, 0x37fff).ram().share("kgs_ram1"); - map(0x38000, 0x3ffff).ram().share("video_ram"); -} - -void a7150_state::k7070_cpu_mem(address_map &map) -{ - map.unmap_value_high(); - map(0x0000, 0xffff).rw(m_video_bankdev, FUNC(address_map_bank_device::read8), FUNC(address_map_bank_device::write8)); -} - - -void a7150_state::k7070_cpu_io(address_map &map) -{ - map.unmap_value_high(); - map.global_mask(0xff); - map(0x0000, 0x0003).rw(m_ctc, FUNC(z80ctc_device::read), FUNC(z80ctc_device::write)); - map(0x0008, 0x000b).rw(Z80SIO_TAG, FUNC(z80sio_device::ba_cd_r), FUNC(z80sio_device::ba_cd_w)); - map(0x0010, 0x0017).rw(FUNC(a7150_state::kgs_host_r), FUNC(a7150_state::kgs_host_w)); // p. 11 of KGS-K7070.pdf - - map(0x0020, 0x0021).noprw(); // address register - map(0x0022, 0x0022).noprw(); // function register (p. 6 of ABG-K7072.pdf) - map(0x0023, 0x0023).noprw(); // split register - map(0x0030, 0x003f).noprw(); // palette register +// map(0x0300, 0x031f).unmaprw(); // ASP board #1 +// map(0x0320, 0x033f).unmaprw(); // ASP board #2 } -/* Input ports */ -static INPUT_PORTS_START( a7150 ) - PORT_START("DSEL0") - PORT_DIPNAME(0x01, 0x01, "Codepoint 0x24") - PORT_DIPSETTING(0x00, "Currency sign" ) - PORT_DIPSETTING(0x01, "Dollar sign" ) - PORT_DIPNAME(0x02, 0x02, "Perform I/O test") - PORT_DIPSETTING(0x00, DEF_STR(No) ) - PORT_DIPSETTING(0x02, DEF_STR(Yes) ) - PORT_DIPNAME(0x04, 0x00, "Perform VRAM test") - PORT_DIPSETTING(0x00, DEF_STR(Yes) ) - PORT_DIPSETTING(0x04, DEF_STR(No) ) - - PORT_START("DSEL1") - PORT_DIPNAME(0x03, 0x02, "V.24 Parity") - PORT_DIPSETTING(0x00, "No parity" ) - PORT_DIPSETTING(0x01, "Odd" ) - PORT_DIPSETTING(0x02, "No parity" ) - PORT_DIPSETTING(0x03, "Even" ) - PORT_DIPNAME(0x04, 0x04, "V.24 Character size") - PORT_DIPSETTING(0x00, "7 bits") - PORT_DIPSETTING(0x04, "8 bits") - PORT_DIPNAME(0x38, 0x38, "V.24 Baud rate") - PORT_DIPSETTING(0x38, "19200") - PORT_DIPSETTING(0x30, "9600") - PORT_DIPSETTING(0x28, "4800") - PORT_DIPSETTING(0x20, "2400") - PORT_DIPSETTING(0x18, "1200") - PORT_DIPSETTING(0x10, "600") - PORT_DIPSETTING(0x08, "300") - PORT_DIPNAME(0x40, 0x40, "IFSS Parity") - PORT_DIPSETTING(0x00, "Odd" ) - PORT_DIPSETTING(0x40, "Even" ) - PORT_DIPNAME(0x80, 0x80, "IFSS Baud rate") - PORT_DIPSETTING(0x00, "9600") - PORT_DIPSETTING(0x80, "Same as V.24") -INPUT_PORTS_END - static DEVICE_INPUT_DEFAULTS_START( kbd_rs232_defaults ) DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_28800 ) DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_28800 ) @@ -424,58 +127,38 @@ static DEVICE_INPUT_DEFAULTS_START( kbd_rs232_defaults ) DEVICE_INPUT_DEFAULTS( "FLOW_CONTROL", 0x01, 0x01 ) DEVICE_INPUT_DEFAULTS_END - -void a7150_state::kgs_memory_remap() -{ - int bank = m_kgs_iml + m_kgs_msel + m_kgs_msel; - - if (0) logerror("%s: kgs memory: iml %d msel %d bank %d\n", machine().describe_context(), m_kgs_iml, m_kgs_msel, bank); - - m_video_bankdev->set_bank(bank); -} - -void a7150_state::screen_eof(screen_device &screen, bool state) -{ - m_gfxcpu->set_input_line(INPUT_LINE_NMI, state); -} - void a7150_state::machine_reset() { - m_kgs_ctrl = 3; - m_kgs_datao = m_kgs_datai = 0; - m_kgs_iml = m_kgs_msel = 0; m_ifss_loopback = false; - kgs_memory_remap(); } void a7150_state::machine_start() { - save_item(NAME(m_kgs_msel)); - save_item(NAME(m_kgs_iml)); - save_item(NAME(m_kgs_datao)); - save_item(NAME(m_kgs_datai)); - save_item(NAME(m_kgs_ctrl)); save_item(NAME(m_ifss_loopback)); } -static const z80_daisy_config k7070_daisy_chain[] = +static void a7150_cards(device_slot_interface &device) { - { Z80SIO_TAG }, - { Z80CTC_TAG }, - { nullptr } -}; + device.option_add("kgs", ROBOTRON_K7070); +} /* * K2771.30 ZRE - processor board * K3571 OPS - 256KB RAM board (x4) * K7070 KGS - graphics terminal, running firmware from A7100 - * K7072 ABG - dumb monochrome framebuffer - * K5170 KES - media controller (compatible with iSBC 215A) - * - * (framebuffer and terminal should be slot devices.) + * K7072 ABG - dumb grayscale framebuffer + * K5170 KES - media controller */ void a7150_state::a7150(machine_config &config) { + MULTIBUS(config, m_bus, 10_MHz_XTAL); // FIXME: clock driven by bus master + m_bus->int_callback<1>().set(m_pic8259, FUNC(pic8259_device::ir1_w)); + m_bus->int_callback<6>().set(m_pic8259, FUNC(pic8259_device::ir6_w)); + m_bus->int_callback<7>().set(m_pic8259, FUNC(pic8259_device::ir7_w)); + MULTIBUS_SLOT(config, "slot:1", m_bus, a7150_cards, "kgs", false); + + // ZRE board + I8086(config, m_maincpu, XTAL(9'832'000) / 2); m_maincpu->set_addrmap(AS_PROGRAM, &a7150_state::mem_map); m_maincpu->set_addrmap(AS_IO, &a7150_state::io_map); @@ -491,7 +174,7 @@ void a7150_state::a7150(machine_config &config) PIC8259(config, m_pic8259, 0); m_pic8259->out_int_callback().set_inputline(m_maincpu, 0); - // IFSP port on processor card + // IFSP port (IRQ 4) i8255_device &ppi(I8255(config, "ppi8255")); // ppi.in_pa_callback().set("cent_status_in", FUNC(input_buffer_device::read)); // ppi.out_pb_callback().set("cent_data_out", output_latch_device::write)); @@ -502,75 +185,24 @@ void a7150_state::a7150(machine_config &config) m_pit8253->out_handler<0>().set(m_pic8259, FUNC(pic8259_device::ir2_w)); m_pit8253->set_clk<1>(14.7456_MHz_XTAL / 4); m_pit8253->set_clk<2>(14.7456_MHz_XTAL / 4); - m_pit8253->out_handler<2>().set(FUNC(a7150_state::a7150_tmr2_w)); - - INPUT_MERGER_ANY_HIGH(config, "uart_irq").output_handler().set(m_pic8259, FUNC(pic8259_device::ir4_w)); + m_pit8253->out_handler<2>().set([this] (bool state) { m_uart8251->write_rxc(state); m_uart8251->write_txc(state); }); + // IFSS port -- keyboard runs at 28800 8N2 I8251(config, m_uart8251, 0); - m_uart8251->txd_handler().set(FUNC(a7150_state::ifss_write_txd)); - m_uart8251->dtr_handler().set(FUNC(a7150_state::ifss_write_dtr)); - m_uart8251->rts_handler().set(FUNC(a7150_state::ifss_loopback_w)); - m_uart8251->rxrdy_handler().set("uart_irq", FUNC(input_merger_device::in_w<0>)); - m_uart8251->txrdy_handler().set("uart_irq", FUNC(input_merger_device::in_w<1>)); + m_uart8251->txd_handler().set([this] (bool state) { if (m_ifss_loopback) m_uart8251->write_rxd(state); else m_rs232->write_txd(state); }); + m_uart8251->dtr_handler().set([this] (bool state) { if (m_ifss_loopback) m_uart8251->write_dsr(state); else m_rs232->write_dtr(state); }); + m_uart8251->rts_handler().set([this] (bool state) { m_ifss_loopback = !state; }); + m_uart8251->rxrdy_handler().set(m_pic8259, FUNC(pic8259_device::ir6_w)); - // IFSS port on processor card -- keyboard runs at 28800 8N2 RS232_PORT(config, m_rs232, default_rs232_devices, "keyboard"); m_rs232->rxd_handler().set(m_uart8251, FUNC(i8251_device::write_rxd)); m_rs232->cts_handler().set(m_uart8251, FUNC(i8251_device::write_cts)); m_rs232->dsr_handler().set(m_uart8251, FUNC(i8251_device::write_dsr)); m_rs232->set_option_device_input_defaults("keyboard", DEVICE_INPUT_DEFAULTS_NAME(kbd_rs232_defaults)); - ISBC_215G(config, "isbc_215g", 0, 0x4a, m_maincpu).irq_callback().set(m_pic8259, FUNC(pic8259_device::ir5_w)); + // KES board - // KGS K7070 graphics terminal controlling ABG K7072 framebuffer - Z80(config, m_gfxcpu, XTAL(16'000'000) / 4); - m_gfxcpu->set_addrmap(AS_PROGRAM, &a7150_state::k7070_cpu_mem); - m_gfxcpu->set_addrmap(AS_IO, &a7150_state::k7070_cpu_io); - m_gfxcpu->set_daisy_config(k7070_daisy_chain); - - ADDRESS_MAP_BANK(config, m_video_bankdev, 0); - m_video_bankdev->set_map(&a7150_state::k7070_cpu_banked); - m_video_bankdev->set_endianness(ENDIANNESS_BIG); - m_video_bankdev->set_addr_width(18); - m_video_bankdev->set_data_width(8); - m_video_bankdev->set_stride(0x10000); - - Z80CTC(config, m_ctc, 16_MHz_XTAL / 3); - m_ctc->intr_callback().set_inputline(m_gfxcpu, INPUT_LINE_IRQ0); - m_ctc->set_clk<0>(1230750); - m_ctc->set_clk<1>(1230750); - m_ctc->set_clk<2>(1230750); - m_ctc->set_clk<3>(1230750); - m_ctc->zc_callback<0>().set(Z80SIO_TAG, FUNC(z80sio_device::rxca_w)); - m_ctc->zc_callback<0>().append(Z80SIO_TAG, FUNC(z80sio_device::txca_w)); - m_ctc->zc_callback<1>().set(Z80SIO_TAG, FUNC(z80sio_device::rxtxcb_w)); - - z80sio_device &sio(Z80SIO(config, Z80SIO_TAG, XTAL(16'000'000) / 4)); - sio.out_int_callback().set_inputline(m_gfxcpu, INPUT_LINE_IRQ0); - sio.out_txda_callback().set(RS232_A_TAG, FUNC(rs232_port_device::write_txd)); - sio.out_dtra_callback().set(RS232_A_TAG, FUNC(rs232_port_device::write_dtr)); - sio.out_rtsa_callback().set(RS232_A_TAG, FUNC(rs232_port_device::write_rts)); - sio.out_txdb_callback().set(RS232_B_TAG, FUNC(rs232_port_device::write_txd)); - sio.out_dtrb_callback().set(FUNC(a7150_state::kgs_iml_w)); - //sio.out_rtsb_callback().set(FUNC(a7150_state::kgs_ifss_loopback_w)); - - // V.24 port (graphics tablet) - rs232_port_device &rs232a(RS232_PORT(config, RS232_A_TAG, default_rs232_devices, "loopback")); - rs232a.rxd_handler().set(Z80SIO_TAG, FUNC(z80sio_device::rxa_w)); - rs232a.dcd_handler().set(Z80SIO_TAG, FUNC(z80sio_device::dcda_w)); - rs232a.cts_handler().set(Z80SIO_TAG, FUNC(z80sio_device::ctsa_w)); - - // IFSS (current loop) port (keyboard) - rs232_port_device &rs232b(RS232_PORT(config, RS232_B_TAG, default_rs232_devices, "loopback")); - rs232b.rxd_handler().set(Z80SIO_TAG, FUNC(z80sio_device::rxb_w)); - - screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); - screen.set_color(rgb_t::green()); - screen.set_raw(XTAL(16'000'000), 737, 0, 640, 431, 0, 400); - screen.set_screen_update(FUNC(a7150_state::screen_update_k7072)); - screen.set_palette(m_palette); - - PALETTE(config, m_palette, palette_device::MONOCHROME); + ISBC_215G(config, "isbc_215g", 0, 0x4a, m_maincpu).irq_callback().set(m_pic8259, FUNC(pic8259_device::ir5_w)); } /* ROM definition */ @@ -586,7 +218,7 @@ ROM_START( a7150 ) ROMX_LOAD("q262.bin", 0x0000, 0x2000, CRC(9df1c396) SHA1(a627889e1162e5b2fe95804de52bb78e41aaf7cc), ROM_BIOS(0) | ROM_SKIP(1)) // A7150 - ROM_SYSTEM_BIOS(1, "2.1", "ACT 2.1") + ROM_SYSTEM_BIOS(1, "2.1", "ACT 2.1") // requires K7075 video card ROMX_LOAD("265.bin", 0x4001, 0x2000, CRC(a5fb5f35) SHA1(9d9501441cad0ef724dec7b5ffb52b17a678a9f8), ROM_BIOS(1) | ROM_SKIP(1)) ROMX_LOAD("266.bin", 0x0001, 0x2000, CRC(f5898eb7) SHA1(af3fd82813fbea7883dea4d7e23a9b5e5b2b844a), ROM_BIOS(1) | ROM_SKIP(1)) ROMX_LOAD("267.bin", 0x4000, 0x2000, CRC(c1873a01) SHA1(77f15cc217cd854732fbe33d395e1ea9867fedd7), ROM_BIOS(1) | ROM_SKIP(1)) @@ -603,12 +235,6 @@ ROM_START( a7150 ) ROMX_LOAD("274.rom", 0x0001, 0x2000, CRC(6fa68834) SHA1(49abe48bbb5ae151f977a9c63b27336c15e8a08d), ROM_BIOS(3) | ROM_SKIP(1)) ROMX_LOAD("275.rom", 0x4000, 0x2000, CRC(0da54426) SHA1(7492caff98b1d1a896c5964942b17beadf996b60), ROM_BIOS(3) | ROM_SKIP(1)) ROMX_LOAD("276.rom", 0x0000, 0x2000, CRC(5924192a) SHA1(eb494d9f96a0b3ea69f4b9cb2b7add66a8c16946), ROM_BIOS(3) | ROM_SKIP(1)) - - ROM_REGION( 0x2000, "user2", ROMREGION_ERASEFF ) - // ROM from A7100 - ROM_LOAD( "kgs7070-152.bin", 0x0000, 0x2000, CRC(403f4235) SHA1(d07ccd40f8b600651d513f588bcf1ea4f15ed094)) -// ROM_LOAD( "kgs7070-153.rom", 0x0000, 0x2000, CRC(a72fe820) SHA1(4b77ab2b59ea8c3632986847ff359df26b16196b)) -// ROM_LOAD( "kgs7070-154.rom", 0x0000, 0x2000, CRC(2995ade0) SHA1(62516f2e1cb62698445f80fd823d39a1a78a7807)) ROM_END } // anonymous namespace @@ -617,4 +243,4 @@ ROM_END /* Driver */ // YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS -COMP( 1986, a7150, 0, 0, a7150, a7150, a7150_state, empty_init, "VEB Robotron", "A7150", MACHINE_NOT_WORKING | MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE ) +COMP( 1986, a7150, 0, 0, a7150, 0, a7150_state, empty_init, "VEB Robotron", "A7150", MACHINE_NOT_WORKING | MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE ) -- cgit v1.2.3