ussr/uknc.cpp: Added cassette interface and qbus slots with floppy controller card. (#12254)

* ussr/uknc.cpp: Added second CPU and corrected CPU clocks.
* bus/qbus: Added UKNC KMD floppy controller card device.
This commit is contained in:
shattered 2024-04-15 20:18:10 +00:00 committed by GitHub
parent f513e7c713
commit 217c386184
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 247 additions and 9 deletions

View file

@ -4648,6 +4648,8 @@ if (BUSES["QBUS"]~=null) then
MAME_DIR .. "src/devices/bus/qbus/qg640.h",
MAME_DIR .. "src/devices/bus/qbus/qtx.cpp",
MAME_DIR .. "src/devices/bus/qbus/qtx.h",
MAME_DIR .. "src/devices/bus/qbus/uknc_kmd.cpp",
MAME_DIR .. "src/devices/bus/qbus/uknc_kmd.h",
}
end

View file

@ -436,6 +436,18 @@ if opt_tool(FORMATS, "BASICDSK") then
}
end
--------------------------------------------------
--
--@src/lib/formats/bk0010_dsk.h,FORMATS["BK0010_DSK"] = true
--------------------------------------------------
if opt_tool(FORMATS, "BK0010_DSK") then
files {
MAME_DIR.. "src/lib/formats/bk0010_dsk.cpp",
MAME_DIR.. "src/lib/formats/bk0010_dsk.h",
}
end
--------------------------------------------------
--
--@src/lib/formats/bw12_dsk.h,FORMATS["BW12_DSK"] = true

View file

@ -17,6 +17,7 @@
#include "pc11.h"
#include "qg640.h"
#include "qtx.h"
#include "uknc_kmd.h"
void qbus_cards(device_slot_interface &device)
@ -26,6 +27,7 @@ void qbus_cards(device_slot_interface &device)
device.option_add("dsd4432", DSD4432);
device.option_add("kgd", DVK_KGD);
device.option_add("mx", DVK_MX);
device.option_add("mz", UKNC_KMD);
device.option_add("qg640", MATROX_QG640);
}

View file

@ -0,0 +1,87 @@
// license:BSD-3-Clause
// copyright-holders:Sergey Svishchev
/***************************************************************************
UKNC floppy controller (device driver MZ.SYS)
***************************************************************************/
#include "emu.h"
#include "uknc_kmd.h"
#include "machine/pdp11.h"
#include "formats/bk0010_dsk.h"
namespace {
void uknc_floppies(device_slot_interface &device)
{
device.option_add("525qd", FLOPPY_525_QD);
}
void uknc_floppy_formats(format_registration &fr)
{
fr.add_mfm_containers();
fr.add(FLOPPY_BK0010_FORMAT);
}
} // anonymous namespace
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
DEFINE_DEVICE_TYPE(UKNC_KMD, uknc_kmd_device, "uknc_kmd", "UKNC floppy")
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// uknc_kmd_device - constructor
//-------------------------------------------------
uknc_kmd_device::uknc_kmd_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, UKNC_KMD, tag, owner, clock)
, device_qbus_card_interface(mconfig, *this)
, m_fdc(*this, "fdc")
{
}
void uknc_kmd_device::device_add_mconfig(machine_config &config)
{
K1801VP128(config, m_fdc, XTAL(4'000'000));
m_fdc->ds_in_callback().set(
[this] (uint16_t data)
{
switch (data & 02003)
{
case 02000: return 3;
case 02001: return 2;
case 02002: return 1;
case 02003: return 0;
default: return -1;
}
});
FLOPPY_CONNECTOR(config, "fdc:0", uknc_floppies, "525qd", uknc_floppy_formats);
FLOPPY_CONNECTOR(config, "fdc:1", uknc_floppies, "525qd", uknc_floppy_formats);
FLOPPY_CONNECTOR(config, "fdc:2", uknc_floppies, "525qd", uknc_floppy_formats);
FLOPPY_CONNECTOR(config, "fdc:3", uknc_floppies, "525qd", uknc_floppy_formats);
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void uknc_kmd_device::device_start()
{
m_bus->install_device(0177130, 0177133,
emu::rw_delegate(m_fdc, FUNC(k1801vp128_device::read)),
emu::rw_delegate(m_fdc, FUNC(k1801vp128_device::write)));
}

View file

@ -0,0 +1,43 @@
// license:BSD-3-Clause
// copyright-holders:Sergey Svishchev
/***************************************************************************
UKNC floppy controller (device driver MZ.SYS)
***************************************************************************/
#ifndef MAME_BUS_QBUS_UKNC_KMD_H
#define MAME_BUS_QBUS_UKNC_KMD_H
#pragma once
#include "qbus.h"
#include "machine/1801vp128.h"
/***************************************************************************
TYPE DEFINITIONS
***************************************************************************/
// ======================> uknc_kmd_device
class uknc_kmd_device : public device_t, public device_qbus_card_interface
{
public:
// construction/destruction
uknc_kmd_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected:
// device_t implementation
virtual void device_start() override;
virtual void device_add_mconfig(machine_config &config) override;
required_device<k1801vp128_device> m_fdc;
};
// device type definition
DECLARE_DEVICE_TYPE(UKNC_KMD, uknc_kmd_device)
#endif // MAME_BUS_QBUS_UKNC_KMD_H

View file

@ -0,0 +1,39 @@
// license:BSD-3-Clause
// copyright-holders:Sergey Svishchev
/*********************************************************************
formats/bk0010_dsk.cpp
Floppies used by BK (BY: device), DVK (MY: device) and UKNC
(MZ: device)
*********************************************************************/
#include "formats/bk0010_dsk.h"
bk0010_format::bk0010_format() : wd177x_format(formats)
{
}
// gap sizes taken from BKBTL emulator
const bk0010_format::format bk0010_format::formats[] = {
{
floppy_image::FF_525, floppy_image::SSQD, floppy_image::MFM,
2000, // 2us, 300rpm
10, 80, 1,
512, {},
1, {},
42, 22, 36
},
{
floppy_image::FF_525, floppy_image::DSQD, floppy_image::MFM,
2000, // 2us, 300rpm
10, 80, 2,
512, {},
1, {},
42, 22, 36
},
{}
};
const bk0010_format FLOPPY_BK0010_FORMAT;

View file

@ -0,0 +1,30 @@
// license:BSD-3-Clause
// copyright-holders:Sergey Svishchev
/*********************************************************************
formats/bk0010_dsk.h
*********************************************************************/
#ifndef MAME_FORMATS_BK0010_DSK_H
#define MAME_FORMATS_BK0010_DSK_H
#pragma once
#include "wd177x_dsk.h"
class bk0010_format : public wd177x_format
{
public:
bk0010_format();
virtual const char *name() const noexcept override { return "bk0010"; }
virtual const char *description() const noexcept override { return "BK-0010 disk image"; }
virtual const char *extensions() const noexcept override { return "img,bkd"; }
private:
static const format formats[];
};
extern const bk0010_format FLOPPY_BK0010_FORMAT;
#endif // MAME_FORMATS_BK0010_DSK_H

View file

@ -14,7 +14,10 @@ Status: both CPUs start in the weeds.
****************************************************************************/
#include "emu.h"
#include "bus/qbus/qbus.h"
#include "cpu/t11/t11.h"
#include "imagedev/cassette.h"
#include "emupal.h"
#include "screen.h"
@ -27,6 +30,10 @@ public:
uknc_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag)
, m_maincpu(*this, "maincpu")
, m_subcpu(*this, "subcpu")
, m_qbus(*this, "qbus")
, m_cart(*this, "cart")
, m_cassette(*this, "cassette")
{ }
void uknc(machine_config &config);
@ -36,6 +43,10 @@ private:
virtual void machine_start() override;
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
required_device<k1801vm2_device> m_maincpu;
required_device<k1801vm2_device> m_subcpu;
required_device<qbus_device> m_qbus;
required_device<qbus_device> m_cart;
required_device<cassette_image_device> m_cassette;
void uknc_mem(address_map &map);
void uknc_sub_mem(address_map &map);
@ -46,7 +57,6 @@ void uknc_state::uknc_mem(address_map &map)
{
map.unmap_value_high();
map(0x0000, 0x7fff).ram();
map(0x8000, 0xffff).rom().region("maincpu",0);
}
void uknc_state::uknc_sub_mem(address_map &map)
@ -77,13 +87,28 @@ uint32_t uknc_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap,
void uknc_state::uknc(machine_config &config)
{
/* basic machine hardware */
K1801VM2(config, m_maincpu, 8'000'000);
K1801VM2(config, m_maincpu, XTAL(16'000'000)/4); // external clock is /2 + internal divider /2
m_maincpu->set_initial_mode(0x8000);
m_maincpu->set_addrmap(AS_PROGRAM, &uknc_state::uknc_mem);
m_maincpu->set_disable();
k1801vm2_device &subcpu(K1801VM2(config, "subcpu", 6'250'000));
subcpu.set_initial_mode(0x8000);
subcpu.set_addrmap(AS_PROGRAM, &uknc_state::uknc_sub_mem);
QBUS(config, m_qbus, 0);
m_qbus->set_space(m_maincpu, AS_PROGRAM);
m_qbus->birq4().set_inputline(m_maincpu, t11_device::VEC_LINE);
QBUS_SLOT(config, "qbus" ":1", qbus_cards, nullptr);
K1801VM2(config, m_subcpu, XTAL(12'500'000)/4);
m_subcpu->set_addrmap(AS_PROGRAM, &uknc_state::uknc_sub_mem);
m_subcpu->set_initial_mode(0x8000);
QBUS(config, m_cart, 0);
m_cart->set_space(m_subcpu, AS_PROGRAM);
m_cart->birq4().set_inputline(m_subcpu, t11_device::VEC_LINE);
QBUS_SLOT(config, "cart" ":1", qbus_cards, "mz");
QBUS_SLOT(config, "cart" ":2", qbus_cards, nullptr);
CASSETTE(config, m_cassette);
m_cassette->set_default_state(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED);
/* video hardware */
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
@ -98,10 +123,8 @@ void uknc_state::uknc(machine_config &config)
/* ROM definition */
ROM_START( uknc )
ROM_REGION( 0x8000, "maincpu", 0 )
ROM_LOAD( "uknc.rom", 0x0000, 0x8000, CRC(a1536994) SHA1(b3c7c678c41ffa9b37f654fbf20fef7d19e6407b))
ROM_REGION( 0x8000, "subcpu", ROMREGION_ERASEFF )
ROM_REGION16_LE(0100000, "subcpu", ROMREGION_ERASE00)
ROM_LOAD("uknc.rom", 0x0000, 0x8000, CRC(a1536994) SHA1(b3c7c678c41ffa9b37f654fbf20fef7d19e6407b))
ROM_END
} // anonymous namespace