mirror of
https://github.com/libretro/mame2016-libretro.git
synced 2024-11-30 04:00:50 +00:00
Nascom: Clean up, add NASBUS emulation and make the floppy disc
controller a NASBUS card, convert to the new wdc emulation, add generic socket emulation, add initial software list.
This commit is contained in:
parent
f63baa6dca
commit
1e9f57c2cd
45
hash/nascom_socket.xml
Normal file
45
hash/nascom_socket.xml
Normal file
@ -0,0 +1,45 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE softwarelist SYSTEM "softwarelist.dtd">
|
||||
|
||||
<!-- Nascom internal sockets for ROM/RAM -->
|
||||
|
||||
<softwarelist name="nascom_socket" description="Nascom internal sockets">
|
||||
|
||||
<software name="nasdos">
|
||||
<description>NAS-DOS</description>
|
||||
<year>1982</year>
|
||||
<publisher>Lucas Control Systems</publisher>
|
||||
<info name="usage" value="Enter ED000 to start" />
|
||||
<part name="socket" interface="nascom_socket">
|
||||
<dataarea name="d000" size="0x1000">
|
||||
<!-- Normally supplied as 4 1k ROMs -->
|
||||
<rom name="nasdos.rom" size="0x1000" crc="54a36f6d" sha1="1d063d04be5024f128bd589e6edc066e9a63fc1b" offset="0" />
|
||||
</dataarea>
|
||||
</part>
|
||||
</software>
|
||||
|
||||
<software name="odebdis">
|
||||
<description>Super-Debug 3.1 & Nas-Dis</description>
|
||||
<year>198?</year>
|
||||
<publisher><unknown></publisher>
|
||||
<info name="usage" value="Enter EC000 to start Super-Debug or EC400 to start Nas-Dis" />
|
||||
<part name="socket" interface="nascom_socket">
|
||||
<dataarea name="c000" size="0x1000">
|
||||
<rom name="odebdis.rom" size="0x1000" crc="b0dce113" sha1="545466ab12bcf2ab613d6aff90946efa319bd943" offset="0" />
|
||||
</dataarea>
|
||||
</part>
|
||||
</software>
|
||||
|
||||
<software name="zeap">
|
||||
<description>ZEAP Z80 Editor-Assembler 2.1</description>
|
||||
<year>1980?</year>
|
||||
<publisher>Sigma Accouting & Management Services</publisher>
|
||||
<info name="usage" value="Enter ED000 to start" />
|
||||
<part name="socket" interface="nascom_socket">
|
||||
<dataarea name="d000" size="0x1000">
|
||||
<rom name="zeap.rom" size="0x1000" crc="87ce8f68" sha1="e6dff4c30eecc9a5557395088d1d83776b9b4514" offset="0" />
|
||||
</dataarea>
|
||||
</part>
|
||||
</software>
|
||||
|
||||
</softwarelist>
|
@ -2414,3 +2414,19 @@ if (BUSES["PSX_CONTROLLER"]~=null) then
|
||||
MAME_DIR .. "src/emu/bus/psx/memcard.h",
|
||||
}
|
||||
end
|
||||
|
||||
---------------------------------------------------
|
||||
--
|
||||
--@src/emu/bus/nasbus/nasbus.h,BUSES += NASBUS
|
||||
---------------------------------------------------
|
||||
|
||||
if (BUSES["NASBUS"]~=null) then
|
||||
files {
|
||||
MAME_DIR .. "src/emu/bus/nasbus/nasbus.c",
|
||||
MAME_DIR .. "src/emu/bus/nasbus/nasbus.h",
|
||||
MAME_DIR .. "src/emu/bus/nasbus/cards.c",
|
||||
MAME_DIR .. "src/emu/bus/nasbus/cards.h",
|
||||
MAME_DIR .. "src/emu/bus/nasbus/floppy.c",
|
||||
MAME_DIR .. "src/emu/bus/nasbus/floppy.h",
|
||||
}
|
||||
end
|
||||
|
@ -279,6 +279,8 @@ project "formats"
|
||||
MAME_DIR .. "src/lib/formats/mz_cas.h",
|
||||
MAME_DIR .. "src/lib/formats/nanos_dsk.c",
|
||||
MAME_DIR .. "src/lib/formats/nanos_dsk.h",
|
||||
MAME_DIR .. "src/lib/formats/nascom_dsk.c",
|
||||
MAME_DIR .. "src/lib/formats/nascom_dsk.h",
|
||||
MAME_DIR .. "src/lib/formats/naslite_dsk.c",
|
||||
MAME_DIR .. "src/lib/formats/naslite_dsk.h",
|
||||
MAME_DIR .. "src/lib/formats/nes_dsk.c",
|
||||
|
@ -606,6 +606,7 @@ BUSES["MACPDS"] = true
|
||||
BUSES["MIDI"] = true
|
||||
BUSES["MEGADRIVE"] = true
|
||||
BUSES["MSX_SLOT"] = true
|
||||
BUSES["NASBUS"] = true
|
||||
BUSES["NEOGEO"] = true
|
||||
BUSES["NES"] = true
|
||||
BUSES["NES_CTRL"] = true
|
||||
@ -1790,8 +1791,6 @@ files {
|
||||
createMESSProjects(_target, _subtarget, "nascom")
|
||||
files {
|
||||
MAME_DIR .. "src/mess/drivers/nascom1.c",
|
||||
MAME_DIR .. "src/mess/machine/nascom1.c",
|
||||
MAME_DIR .. "src/mess/video/nascom1.c",
|
||||
}
|
||||
|
||||
createMESSProjects(_target, _subtarget, "ne")
|
||||
|
13
src/emu/bus/nasbus/cards.c
Normal file
13
src/emu/bus/nasbus/cards.c
Normal file
@ -0,0 +1,13 @@
|
||||
// license:GPL-2.0+
|
||||
// copyright-holders:Dirk Best
|
||||
/***************************************************************************
|
||||
|
||||
Nascom NASBUS Slot Devices
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "cards.h"
|
||||
|
||||
SLOT_INTERFACE_START( nasbus_slot_cards )
|
||||
SLOT_INTERFACE("floppy", NASCOM_FDC)
|
||||
SLOT_INTERFACE_END
|
20
src/emu/bus/nasbus/cards.h
Normal file
20
src/emu/bus/nasbus/cards.h
Normal file
@ -0,0 +1,20 @@
|
||||
// license:GPL-2.0+
|
||||
// copyright-holders:Dirk Best
|
||||
/***************************************************************************
|
||||
|
||||
Nascom NASBUS Slot Devices
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __NASBUS_CARDS_H__
|
||||
#define __NASBUS_CARDS_H__
|
||||
|
||||
#include "emu.h"
|
||||
|
||||
#include "floppy.h"
|
||||
|
||||
SLOT_INTERFACE_EXTERN( nasbus_slot_cards );
|
||||
|
||||
#endif // __NASBUS_CARDS_H__
|
129
src/emu/bus/nasbus/floppy.c
Normal file
129
src/emu/bus/nasbus/floppy.c
Normal file
@ -0,0 +1,129 @@
|
||||
// license:GPL-2.0+
|
||||
// copyright-holders:Dirk Best
|
||||
/***************************************************************************
|
||||
|
||||
Nascom NASBUS Floppy Disc Controller
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "floppy.h"
|
||||
#include "formats/nascom_dsk.h"
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// DEVICE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
const device_type NASCOM_FDC = &device_creator<nascom_fdc_device>;
|
||||
|
||||
FLOPPY_FORMATS_MEMBER( nascom_fdc_device::floppy_formats )
|
||||
FLOPPY_NASCOM_FORMAT
|
||||
FLOPPY_FORMATS_END
|
||||
|
||||
static SLOT_INTERFACE_START( nascom_floppies )
|
||||
SLOT_INTERFACE("525qd", FLOPPY_525_QD)
|
||||
SLOT_INTERFACE_END
|
||||
|
||||
//-------------------------------------------------
|
||||
// machine_config_additions - device-specific
|
||||
// machine configurations
|
||||
//-------------------------------------------------
|
||||
|
||||
static MACHINE_CONFIG_FRAGMENT( nascom_fdc )
|
||||
MCFG_FD1793x_ADD("fd1793", XTAL_16MHz / 4 / 4)
|
||||
|
||||
MCFG_FLOPPY_DRIVE_ADD("fd1793:0", nascom_floppies, "525qd", nascom_fdc_device::floppy_formats)
|
||||
MCFG_FLOPPY_DRIVE_ADD("fd1793:1", nascom_floppies, NULL, nascom_fdc_device::floppy_formats)
|
||||
MCFG_FLOPPY_DRIVE_ADD("fd1793:2", nascom_floppies, NULL, nascom_fdc_device::floppy_formats)
|
||||
MCFG_FLOPPY_DRIVE_ADD("fd1793:3", nascom_floppies, NULL, nascom_fdc_device::floppy_formats)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
machine_config_constructor nascom_fdc_device::device_mconfig_additions() const
|
||||
{
|
||||
return MACHINE_CONFIG_NAME( nascom_fdc );
|
||||
}
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// LIVE DEVICE
|
||||
//**************************************************************************
|
||||
|
||||
//-------------------------------------------------
|
||||
// wordpro_device - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
nascom_fdc_device::nascom_fdc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
|
||||
device_t(mconfig, NASCOM_FDC, "Nascom Floppy Disc Controller", tag, owner, clock, "nascom_fdc", __FILE__),
|
||||
device_nasbus_card_interface(mconfig, *this),
|
||||
m_fdc(*this, "fd1793"),
|
||||
m_floppy0(*this, "fd1793:0"),
|
||||
m_floppy1(*this, "fd1793:1"),
|
||||
m_floppy2(*this, "fd1793:2"),
|
||||
m_floppy3(*this, "fd1793:3"),
|
||||
m_floppy(NULL),
|
||||
m_select(0)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
|
||||
void nascom_fdc_device::device_start()
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_reset - device-specific reset
|
||||
//-------------------------------------------------
|
||||
|
||||
void nascom_fdc_device::device_reset()
|
||||
{
|
||||
m_nasbus->m_io->install_readwrite_handler(0xe0, 0xe3, read8_delegate(FUNC(fd1793_t::read), m_fdc.target()), write8_delegate(FUNC(fd1793_t::write), m_fdc.target()));
|
||||
m_nasbus->m_io->install_readwrite_handler(0xe4, 0xe4, read8_delegate(FUNC(nascom_fdc_device::select_r), this), write8_delegate(FUNC(nascom_fdc_device::select_w), this));
|
||||
m_nasbus->m_io->install_read_handler(0xe5, 0xe5, read8_delegate(FUNC(nascom_fdc_device::status_r), this));
|
||||
}
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// IMPLEMENTATION
|
||||
//**************************************************************************
|
||||
|
||||
READ8_MEMBER( nascom_fdc_device::select_r )
|
||||
{
|
||||
return m_select | 0xa0;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER( nascom_fdc_device::select_w )
|
||||
{
|
||||
logerror("nascom_fdc_device::select_w: 0x%02x\n", data);
|
||||
|
||||
m_floppy = NULL;
|
||||
|
||||
if (BIT(data, 0)) m_floppy = m_floppy0->get_device();
|
||||
if (BIT(data, 1)) m_floppy = m_floppy1->get_device();
|
||||
if (BIT(data, 2)) m_floppy = m_floppy2->get_device();
|
||||
if (BIT(data, 3)) m_floppy = m_floppy3->get_device();
|
||||
|
||||
m_fdc->set_floppy(m_floppy);
|
||||
|
||||
if (m_floppy)
|
||||
{
|
||||
m_floppy->ss_w(BIT(data, 4));
|
||||
m_floppy->mon_w(!BIT(data, 5));
|
||||
}
|
||||
|
||||
m_fdc->dden_w(BIT(data, 6));
|
||||
|
||||
m_select = data;
|
||||
}
|
||||
|
||||
READ8_MEMBER( nascom_fdc_device::status_r )
|
||||
{
|
||||
UINT8 data = 0;
|
||||
|
||||
data |= m_fdc->intrq_r() << 0;
|
||||
data |= m_fdc->drq_r() << 7;
|
||||
|
||||
return data;
|
||||
}
|
57
src/emu/bus/nasbus/floppy.h
Normal file
57
src/emu/bus/nasbus/floppy.h
Normal file
@ -0,0 +1,57 @@
|
||||
// license:GPL-2.0+
|
||||
// copyright-holders:Dirk Best
|
||||
/***************************************************************************
|
||||
|
||||
Nascom NASBUS Floppy Disc Controller
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __NASBUS_FLOPPY_H__
|
||||
#define __NASBUS_FLOPPY_H__
|
||||
|
||||
#include "emu.h"
|
||||
#include "nasbus.h"
|
||||
#include "machine/wd_fdc.h"
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// TYPE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
// ======================> nascom_fdc_device
|
||||
|
||||
class nascom_fdc_device : public device_t, public device_nasbus_card_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
nascom_fdc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
DECLARE_READ8_MEMBER( select_r );
|
||||
DECLARE_WRITE8_MEMBER( select_w );
|
||||
DECLARE_READ8_MEMBER( status_r );
|
||||
|
||||
DECLARE_FLOPPY_FORMATS(floppy_formats);
|
||||
|
||||
protected:
|
||||
virtual machine_config_constructor device_mconfig_additions() const;
|
||||
virtual void device_start();
|
||||
virtual void device_reset();
|
||||
|
||||
private:
|
||||
required_device<fd1793_t> m_fdc;
|
||||
required_device<floppy_connector> m_floppy0;
|
||||
required_device<floppy_connector> m_floppy1;
|
||||
required_device<floppy_connector> m_floppy2;
|
||||
required_device<floppy_connector> m_floppy3;
|
||||
|
||||
floppy_image_device *m_floppy;
|
||||
|
||||
UINT8 m_select;
|
||||
};
|
||||
|
||||
// device type definition
|
||||
extern const device_type NASCOM_FDC;
|
||||
|
||||
#endif // __NASBUS_FLOPPY_H__
|
159
src/emu/bus/nasbus/nasbus.c
Normal file
159
src/emu/bus/nasbus/nasbus.c
Normal file
@ -0,0 +1,159 @@
|
||||
// license:GPL-2.0+
|
||||
// copyright-holders:Dirk Best
|
||||
/***************************************************************************
|
||||
|
||||
Nascom NASBUS
|
||||
|
||||
77-pin slot
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "nasbus.h"
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// NASBUS SLOT DEVICE
|
||||
//**************************************************************************
|
||||
|
||||
const device_type NASBUS_SLOT = &device_creator<nasbus_slot_device>;
|
||||
|
||||
//-------------------------------------------------
|
||||
// nasbus_slot_device - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
nasbus_slot_device::nasbus_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
|
||||
device_t(mconfig, NASBUS_SLOT, "NASBUS Slot", tag, owner, clock, "nasbus_slot", __FILE__),
|
||||
device_slot_interface(mconfig, *this),
|
||||
m_nasbus_tag(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
nasbus_slot_device::nasbus_slot_device(const machine_config &mconfig, device_type type, const char *name,
|
||||
const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) :
|
||||
device_t(mconfig, type, name, tag, owner, clock, shortname, source),
|
||||
device_slot_interface(mconfig, *this),
|
||||
m_nasbus_tag(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
void nasbus_slot_device::set_nasbus_slot(device_t &device, device_t *owner, const char *nasbus_tag)
|
||||
{
|
||||
nasbus_slot_device &nasbus_card = dynamic_cast<nasbus_slot_device &>(device);
|
||||
nasbus_card.m_owner = owner;
|
||||
nasbus_card.m_nasbus_tag = nasbus_tag;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
|
||||
void nasbus_slot_device::device_start()
|
||||
{
|
||||
device_nasbus_card_interface *dev = dynamic_cast<device_nasbus_card_interface *>(get_card_device());
|
||||
|
||||
if (dev)
|
||||
{
|
||||
nasbus_device *m_nasbus = downcast<nasbus_device *>(m_owner->subdevice(m_nasbus_tag));
|
||||
m_nasbus->add_card(dev);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// NASBUS DEVICE
|
||||
//**************************************************************************
|
||||
|
||||
const device_type NASBUS = &device_creator<nasbus_device>;
|
||||
|
||||
//-------------------------------------------------
|
||||
// nasbus_device - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
nasbus_device::nasbus_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
|
||||
device_t(mconfig, NASBUS_SLOT, "NASBUS Backplane", tag, owner, clock, "nasbus", __FILE__),
|
||||
m_program(NULL),
|
||||
m_io(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// nasbus_device - destructor
|
||||
//-------------------------------------------------
|
||||
|
||||
nasbus_device::~nasbus_device()
|
||||
{
|
||||
m_dev.detach_all();
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
|
||||
void nasbus_device::device_start()
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_reset - device-specific reset
|
||||
//-------------------------------------------------
|
||||
|
||||
void nasbus_device::device_reset()
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// add_card - add new card to our bus
|
||||
//-------------------------------------------------
|
||||
|
||||
void nasbus_device::add_card(device_nasbus_card_interface *card)
|
||||
{
|
||||
card->set_nasbus_device(this);
|
||||
m_dev.append(*card);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// set_program_space - set address space we are attached to
|
||||
//-------------------------------------------------
|
||||
|
||||
void nasbus_device::set_program_space(address_space *program)
|
||||
{
|
||||
m_program = program;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// set_io_space - set address space we are attached to
|
||||
//-------------------------------------------------
|
||||
|
||||
void nasbus_device::set_io_space(address_space *io)
|
||||
{
|
||||
m_io = io;
|
||||
}
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// CARTRIDGE INTERFACE
|
||||
//**************************************************************************
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_nasbus_card_interface - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
device_nasbus_card_interface::device_nasbus_card_interface(const machine_config &mconfig, device_t &device) :
|
||||
device_slot_card_interface(mconfig, device),
|
||||
m_next(NULL),
|
||||
m_nasbus(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// ~device_nasbus_card_interface - destructor
|
||||
//-------------------------------------------------
|
||||
|
||||
device_nasbus_card_interface::~device_nasbus_card_interface()
|
||||
{
|
||||
}
|
||||
|
||||
void device_nasbus_card_interface::set_nasbus_device(nasbus_device *nasbus)
|
||||
{
|
||||
m_nasbus = nasbus;
|
||||
}
|
199
src/emu/bus/nasbus/nasbus.h
Normal file
199
src/emu/bus/nasbus/nasbus.h
Normal file
@ -0,0 +1,199 @@
|
||||
// license:GPL-2.0+
|
||||
// copyright-holders:Dirk Best
|
||||
/***************************************************************************
|
||||
|
||||
Nascom NASBUS
|
||||
|
||||
77-pin slot
|
||||
|
||||
1 0V
|
||||
2 0V
|
||||
3 0V
|
||||
4 0V
|
||||
5 Clock
|
||||
6 (spare)
|
||||
7 (spare)
|
||||
8 (spare)
|
||||
9 /RAM DISABLE
|
||||
10 /RESET SWITCH
|
||||
11 /NASCOM MEM
|
||||
12 /NASCOM IO
|
||||
13 /DBDR
|
||||
14 /RESET
|
||||
15 /HALT
|
||||
16 /BAI
|
||||
17 /BAO
|
||||
18 /BUSRQ
|
||||
19 IEI
|
||||
20 IEO
|
||||
21 (reserved for /NMI)
|
||||
22 /INT
|
||||
23 /WAIT
|
||||
24 /RFSH
|
||||
25 /MI
|
||||
26 /IORQ
|
||||
27 /MREQ
|
||||
28 /WR
|
||||
29 /RD
|
||||
30 A0
|
||||
31 A1
|
||||
32 A2
|
||||
33 A3
|
||||
34 A4
|
||||
35 A5
|
||||
36 A6
|
||||
37 A7
|
||||
38 A8
|
||||
39 A9
|
||||
40 A10
|
||||
41 A11
|
||||
42 A12
|
||||
43 A13
|
||||
44 A14
|
||||
45 A15
|
||||
46 (reserved)
|
||||
47 (reserved)
|
||||
48 (reserved)
|
||||
49 (reserved)
|
||||
50 D0
|
||||
51 D1
|
||||
52 D2
|
||||
53 D3
|
||||
54 D4
|
||||
55 D5
|
||||
56 D6
|
||||
57 D7
|
||||
58 (reserved)
|
||||
59 (reserved)
|
||||
60 (reserved)
|
||||
61 (reserved)
|
||||
62 (reserved)
|
||||
63 (reserved)
|
||||
64 (reserved)
|
||||
65 (reserved)
|
||||
66 (unused)
|
||||
67 (unused)
|
||||
68 -5V
|
||||
69 -5V
|
||||
70 -12V
|
||||
71 -12V
|
||||
72 Keyway
|
||||
73 +12V
|
||||
74 +12V
|
||||
75 +5V
|
||||
76 +5V
|
||||
77 +5V
|
||||
78 +5V
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __NASBUS_H__
|
||||
#define __NASBUS_H__
|
||||
|
||||
#include "emu.h"
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// CONSTANTS / MACROS
|
||||
//**************************************************************************
|
||||
|
||||
#define NASBUS_TAG "nasbus"
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// INTERFACE CONFIGURATION MACROS
|
||||
//**************************************************************************
|
||||
|
||||
#define MCFG_NASBUS_ADD(_tag) \
|
||||
MCFG_DEVICE_ADD(_tag, NASBUS, 0)
|
||||
|
||||
#define MCFG_NASBUS_SLOT_ADD(_tag, _slot_intf, _def_slot) \
|
||||
MCFG_DEVICE_ADD(_tag, NASBUS_SLOT, 0) \
|
||||
MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \
|
||||
nasbus_slot_device::set_nasbus_slot(*device, owner, NASBUS_TAG);
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// TYPE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
// forward declaration
|
||||
class device_nasbus_card_interface;
|
||||
|
||||
// ======================> nasbus_slot_device
|
||||
|
||||
class nasbus_slot_device : public device_t, public device_slot_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
nasbus_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
nasbus_slot_device(const machine_config &mconfig, device_type type, const char *name,
|
||||
const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
|
||||
|
||||
// device-level overrides
|
||||
virtual void device_start();
|
||||
|
||||
// inline configuration
|
||||
static void set_nasbus_slot(device_t &device, device_t *owner, const char *nasbus_tag);
|
||||
|
||||
protected:
|
||||
// configuration
|
||||
const char *m_nasbus_tag;
|
||||
};
|
||||
|
||||
// device type definition
|
||||
extern const device_type NASBUS_SLOT;
|
||||
|
||||
// ======================> nasbus_device
|
||||
|
||||
class nasbus_device : public device_t
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
nasbus_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
virtual ~nasbus_device();
|
||||
|
||||
void add_card(device_nasbus_card_interface *card);
|
||||
|
||||
void set_program_space(address_space *program);
|
||||
void set_io_space(address_space *io);
|
||||
|
||||
address_space *m_program;
|
||||
address_space *m_io;
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_start();
|
||||
virtual void device_reset();
|
||||
|
||||
private:
|
||||
simple_list<device_nasbus_card_interface> m_dev;
|
||||
};
|
||||
|
||||
// device type definition
|
||||
extern const device_type NASBUS;
|
||||
|
||||
// ======================> device_nasbus_interface
|
||||
|
||||
class device_nasbus_card_interface : public device_slot_card_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
device_nasbus_card_interface(const machine_config &mconfig, device_t &device);
|
||||
virtual ~device_nasbus_card_interface();
|
||||
|
||||
void set_nasbus_device(nasbus_device *nasbus);
|
||||
|
||||
device_nasbus_card_interface *next() const { return m_next; }
|
||||
device_nasbus_card_interface *m_next;
|
||||
|
||||
protected:
|
||||
nasbus_device *m_nasbus;
|
||||
};
|
||||
|
||||
// include here so drivers don't need to
|
||||
#include "cards.h"
|
||||
|
||||
#endif // __NASBUS_H__
|
45
src/lib/formats/nascom_dsk.c
Normal file
45
src/lib/formats/nascom_dsk.c
Normal file
@ -0,0 +1,45 @@
|
||||
// license:GPL-2.0+
|
||||
// copyright-holders:Dirk Best
|
||||
/***************************************************************************
|
||||
|
||||
Nascom 1/2/3
|
||||
|
||||
Disk image format
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "nascom_dsk.h"
|
||||
|
||||
nascom_format::nascom_format() : wd177x_format(formats)
|
||||
{
|
||||
}
|
||||
|
||||
const char *nascom_format::name() const
|
||||
{
|
||||
return "nascom";
|
||||
}
|
||||
|
||||
const char *nascom_format::description() const
|
||||
{
|
||||
return "Nascom disk image";
|
||||
}
|
||||
|
||||
const char *nascom_format::extensions() const
|
||||
{
|
||||
return "dsk";
|
||||
}
|
||||
|
||||
const nascom_format::format nascom_format::formats[] =
|
||||
{
|
||||
{ // 360k 5 1/4 inch double density single sided
|
||||
floppy_image::FF_525, floppy_image::SSQD, floppy_image::MFM,
|
||||
2000, 16, 80, 1, 256, {}, 1, {}, 32, 22, 54
|
||||
},
|
||||
{ // 720k 5 1/4 inch double density double sided
|
||||
floppy_image::FF_525, floppy_image::DSQD, floppy_image::MFM,
|
||||
2000, 16, 80, 2, 256, {}, 1, {}, 32, 22, 54
|
||||
},
|
||||
{}
|
||||
};
|
||||
|
||||
const floppy_format_type FLOPPY_NASCOM_FORMAT = &floppy_image_format_creator<nascom_format>;
|
33
src/lib/formats/nascom_dsk.h
Normal file
33
src/lib/formats/nascom_dsk.h
Normal file
@ -0,0 +1,33 @@
|
||||
// license:GPL-2.0+
|
||||
// copyright-holders:Dirk Best
|
||||
/***************************************************************************
|
||||
|
||||
Nascom 1/2/3
|
||||
|
||||
Disk image format
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __NASCOM_DSK_H__
|
||||
#define __NASCOM_DSK_H__
|
||||
|
||||
#include "wd177x_dsk.h"
|
||||
|
||||
class nascom_format : public wd177x_format
|
||||
{
|
||||
public:
|
||||
nascom_format();
|
||||
|
||||
virtual const char *name() const;
|
||||
virtual const char *description() const;
|
||||
virtual const char *extensions() const;
|
||||
|
||||
private:
|
||||
static const format formats[];
|
||||
};
|
||||
|
||||
extern const floppy_format_type FLOPPY_NASCOM_FORMAT;
|
||||
|
||||
#endif // __NASCOM_DSK_H__
|
@ -1,119 +1,351 @@
|
||||
// license:GPL-2.0+
|
||||
// copyright-holders:(Original Author?), Dirk Best
|
||||
/************************************************************************
|
||||
// copyright-holders:Dirk Best
|
||||
/***************************************************************************
|
||||
|
||||
Nascom 1 and Nascom 2
|
||||
Nascom 1/2/3
|
||||
|
||||
Memory map
|
||||
Single board computer
|
||||
|
||||
CPU: z80
|
||||
0000-03ff ROM (Nascom1 Monitor)
|
||||
0400-07ff ROM (Nascom2 Monitor extension)
|
||||
0800-0bff RAM (Screen)
|
||||
0c00-0c7f RAM (OS workspace)
|
||||
0c80-0cff RAM (extended OS workspace)
|
||||
0d00-0f7f RAM (Firmware workspace)
|
||||
0f80-0fff RAM (Stack space)
|
||||
1000-8fff RAM (User space)
|
||||
9000-97ff RAM (Programmable graphics RAM/User space)
|
||||
9800-afff RAM (Colour graphics RAM/User space)
|
||||
b000-b7ff ROM (OS extensions)
|
||||
b800-bfff ROM (WP/Naspen software)
|
||||
c000-cfff ROM (Disassembler/colour graphics software)
|
||||
d000-dfff ROM (Assembler/Basic extensions)
|
||||
e000-ffff ROM (Nascom2 Basic)
|
||||
***************************************************************************/
|
||||
|
||||
Interrupts:
|
||||
|
||||
Ports:
|
||||
OUT (00) 0: Increment keyboard scan
|
||||
1: Reset keyboard scan
|
||||
2:
|
||||
3: Read from cassette
|
||||
4:
|
||||
5:
|
||||
6:
|
||||
7:
|
||||
IN (00) Read keyboard
|
||||
OUT (01) Write to cassette/serial
|
||||
IN (01) Read from cassette/serial
|
||||
OUT (02) Unused
|
||||
IN (02) ?
|
||||
|
||||
Monitors:
|
||||
Nasbug1 1K Original Nascom1
|
||||
Nasbug2 1K
|
||||
Nasbug3 Probably non existing
|
||||
Nasbug4 2K
|
||||
Nassys1 2K Original Nascom2
|
||||
Nassys2 Probably non existing
|
||||
Nassys3 2K
|
||||
Nassys4 2K
|
||||
T4 2K
|
||||
|
||||
************************************************************************/
|
||||
|
||||
/* Core includes */
|
||||
#include "emu.h"
|
||||
#include "includes/nascom1.h"
|
||||
|
||||
/* Components */
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "machine/wd17xx.h"
|
||||
#include "machine/z80pio.h"
|
||||
|
||||
/* Devices */
|
||||
#include "imagedev/flopdrv.h"
|
||||
#include "formats/basicdsk.h"
|
||||
#include "imagedev/cassette.h"
|
||||
#include "machine/ram.h"
|
||||
#include "machine/z80pio.h"
|
||||
#include "machine/ay31015.h"
|
||||
#include "imagedev/cassette.h"
|
||||
#include "imagedev/snapquik.h"
|
||||
#include "bus/generic/slot.h"
|
||||
#include "bus/generic/carts.h"
|
||||
#include "bus/nasbus/nasbus.h"
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Memory maps
|
||||
*
|
||||
*************************************/
|
||||
//**************************************************************************
|
||||
// CONSTANTS/MACROS
|
||||
//**************************************************************************
|
||||
|
||||
static ADDRESS_MAP_START( nascom1_mem, AS_PROGRAM, 8, nascom1_state )
|
||||
AM_RANGE(0x0000, 0x07ff) AM_ROM
|
||||
AM_RANGE(0x0800, 0x0bff) AM_RAM AM_SHARE("videoram")
|
||||
AM_RANGE(0x0c00, 0x0fff) AM_RAM
|
||||
AM_RANGE(0x1000, 0x13ff) AM_RAM /* 1Kb */
|
||||
AM_RANGE(0x1400, 0x4fff) AM_RAM /* 16Kb */
|
||||
AM_RANGE(0x5000, 0x8fff) AM_RAM /* 32Kb */
|
||||
AM_RANGE(0x9000, 0xafff) AM_RAM /* 40Kb */
|
||||
AM_RANGE(0xb000, 0xffff) AM_ROM
|
||||
ADDRESS_MAP_END
|
||||
#define NASCOM1_KEY_RESET 0x02
|
||||
#define NASCOM1_KEY_INCR 0x01
|
||||
|
||||
|
||||
static ADDRESS_MAP_START( nascom1_io, AS_IO, 8, nascom1_state )
|
||||
ADDRESS_MAP_GLOBAL_MASK(0x0F)
|
||||
AM_RANGE(0x00, 0x00) AM_READWRITE(nascom1_port_00_r, nascom1_port_00_w)
|
||||
AM_RANGE(0x01, 0x01) AM_READWRITE(nascom1_port_01_r, nascom1_port_01_w)
|
||||
AM_RANGE(0x02, 0x02) AM_READ(nascom1_port_02_r)
|
||||
AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("z80pio", z80pio_device, read, write )
|
||||
ADDRESS_MAP_END
|
||||
//**************************************************************************
|
||||
// TYPE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
struct nascom1_portstat_t
|
||||
{
|
||||
UINT8 stat_flags;
|
||||
UINT8 stat_count;
|
||||
};
|
||||
|
||||
class nascom_state : public driver_device
|
||||
{
|
||||
public:
|
||||
nascom_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_hd6402(*this, "hd6402"),
|
||||
m_cassette(*this, "cassette"),
|
||||
m_ram(*this, RAM_TAG),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_palette(*this, "palette"),
|
||||
m_videoram(*this, "videoram"),
|
||||
m_keyboard(*this, "KEY")
|
||||
{ }
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<ay31015_device> m_hd6402;
|
||||
required_device<cassette_image_device> m_cassette;
|
||||
required_device<ram_device> m_ram;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<palette_device> m_palette;
|
||||
required_shared_ptr<UINT8> m_videoram;
|
||||
required_ioport_array<9> m_keyboard;
|
||||
|
||||
int m_tape_size;
|
||||
UINT8 *m_tape_image;
|
||||
int m_tape_index;
|
||||
nascom1_portstat_t m_portstat;
|
||||
|
||||
DECLARE_READ8_MEMBER(nascom1_port_00_r);
|
||||
DECLARE_WRITE8_MEMBER(nascom1_port_00_w);
|
||||
DECLARE_READ8_MEMBER(nascom1_port_01_r);
|
||||
DECLARE_WRITE8_MEMBER(nascom1_port_01_w);
|
||||
DECLARE_READ8_MEMBER(nascom1_port_02_r);
|
||||
virtual DECLARE_DRIVER_INIT(nascom);
|
||||
void screen_update(bitmap_ind16 &bitmap, const rectangle &cliprect, int char_height);
|
||||
DECLARE_READ8_MEMBER(nascom1_hd6402_si);
|
||||
DECLARE_WRITE8_MEMBER(nascom1_hd6402_so);
|
||||
DECLARE_DEVICE_IMAGE_LOAD_MEMBER( nascom1_cassette );
|
||||
DECLARE_DEVICE_IMAGE_UNLOAD_MEMBER( nascom1_cassette );
|
||||
DECLARE_SNAPSHOT_LOAD_MEMBER( nascom1 );
|
||||
|
||||
protected:
|
||||
virtual void machine_reset();
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
class nascom1_state : public nascom_state
|
||||
{
|
||||
public:
|
||||
nascom1_state(const machine_config &mconfig, device_type type, const char *tag) :
|
||||
nascom_state(mconfig, type, tag)
|
||||
{}
|
||||
|
||||
UINT32 screen_update_nascom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
class nascom2_state : public nascom_state
|
||||
{
|
||||
public:
|
||||
nascom2_state(const machine_config &mconfig, device_type type, const char *tag) :
|
||||
nascom_state(mconfig, type, tag),
|
||||
m_nasbus(*this, "nasbus"),
|
||||
m_socket1(*this, "socket1"),
|
||||
m_socket2(*this, "socket2")
|
||||
{}
|
||||
|
||||
virtual DECLARE_DRIVER_INIT(nascom);
|
||||
UINT32 screen_update_nascom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
|
||||
int load_cart(device_image_interface &image, generic_slot_device *slot, int slot_id);
|
||||
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(socket1_load) { return load_cart(image, m_socket1, 1); }
|
||||
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(socket2_load) { return load_cart(image, m_socket2, 2); }
|
||||
|
||||
private:
|
||||
required_device<nasbus_device> m_nasbus;
|
||||
required_device<generic_slot_device> m_socket1;
|
||||
required_device<generic_slot_device> m_socket2;
|
||||
};
|
||||
|
||||
|
||||
static ADDRESS_MAP_START( nascom2_io, AS_IO, 8, nascom1_state )
|
||||
ADDRESS_MAP_GLOBAL_MASK(0xff)
|
||||
AM_RANGE(0x00, 0x00) AM_READWRITE(nascom1_port_00_r, nascom1_port_00_w)
|
||||
AM_RANGE(0x01, 0x01) AM_READWRITE(nascom1_port_01_r, nascom1_port_01_w)
|
||||
AM_RANGE(0x02, 0x02) AM_READ(nascom1_port_02_r)
|
||||
AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("z80pio", z80pio_device, read, write )
|
||||
AM_RANGE(0xe0, 0xe3) AM_DEVREADWRITE("wd1793", fd1793_device, read, write)
|
||||
AM_RANGE(0xe4, 0xe4) AM_READWRITE(nascom2_fdc_select_r, nascom2_fdc_select_w)
|
||||
AM_RANGE(0xe5, 0xe5) AM_READ(nascom2_fdc_status_r)
|
||||
ADDRESS_MAP_END
|
||||
//**************************************************************************
|
||||
// KEYBOARD
|
||||
//**************************************************************************
|
||||
|
||||
READ8_MEMBER( nascom_state::nascom1_port_00_r )
|
||||
{
|
||||
if (m_portstat.stat_count < 9)
|
||||
return ((m_keyboard[m_portstat.stat_count])->read() | ~0x7f);
|
||||
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER( nascom_state::nascom1_port_00_w )
|
||||
{
|
||||
m_cassette->change_state(
|
||||
(data & 0x10) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR);
|
||||
|
||||
if (!(data & NASCOM1_KEY_RESET))
|
||||
{
|
||||
if (m_portstat.stat_flags & NASCOM1_KEY_RESET)
|
||||
m_portstat.stat_count = 0;
|
||||
}
|
||||
else
|
||||
m_portstat.stat_flags = NASCOM1_KEY_RESET;
|
||||
|
||||
if (!(data & NASCOM1_KEY_INCR))
|
||||
{
|
||||
if (m_portstat.stat_flags & NASCOM1_KEY_INCR)
|
||||
m_portstat.stat_count++;
|
||||
}
|
||||
else
|
||||
m_portstat.stat_flags = NASCOM1_KEY_INCR;
|
||||
}
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// CASSETTE
|
||||
//**************************************************************************
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* GFX layouts
|
||||
*
|
||||
*************************************/
|
||||
READ8_MEMBER( nascom_state::nascom1_port_01_r )
|
||||
{
|
||||
return m_hd6402->get_received_data();
|
||||
}
|
||||
|
||||
|
||||
WRITE8_MEMBER( nascom_state::nascom1_port_01_w )
|
||||
{
|
||||
m_hd6402->set_transmit_data(data);
|
||||
}
|
||||
|
||||
READ8_MEMBER( nascom_state::nascom1_port_02_r )
|
||||
{
|
||||
UINT8 data = 0x31;
|
||||
|
||||
m_hd6402->set_input_pin(AY31015_SWE, 0);
|
||||
data |= m_hd6402->get_output_pin(AY31015_OR ) ? 0x02 : 0;
|
||||
data |= m_hd6402->get_output_pin(AY31015_PE ) ? 0x04 : 0;
|
||||
data |= m_hd6402->get_output_pin(AY31015_FE ) ? 0x08 : 0;
|
||||
data |= m_hd6402->get_output_pin(AY31015_TBMT) ? 0x40 : 0;
|
||||
data |= m_hd6402->get_output_pin(AY31015_DAV ) ? 0x80 : 0;
|
||||
m_hd6402->set_input_pin(AY31015_SWE, 1);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
READ8_MEMBER( nascom_state::nascom1_hd6402_si )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER( nascom_state::nascom1_hd6402_so )
|
||||
{
|
||||
}
|
||||
|
||||
DEVICE_IMAGE_LOAD_MEMBER( nascom_state, nascom1_cassette )
|
||||
{
|
||||
m_tape_size = image.length();
|
||||
m_tape_image = (UINT8*)image.ptr();
|
||||
|
||||
if (!m_tape_image)
|
||||
return IMAGE_INIT_FAIL;
|
||||
|
||||
m_tape_index = 0;
|
||||
return IMAGE_INIT_PASS;
|
||||
}
|
||||
|
||||
DEVICE_IMAGE_UNLOAD_MEMBER( nascom_state, nascom1_cassette )
|
||||
{
|
||||
m_tape_image = NULL;
|
||||
m_tape_size = m_tape_index = 0;
|
||||
}
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// SNAPSHOTS
|
||||
//**************************************************************************
|
||||
|
||||
SNAPSHOT_LOAD_MEMBER( nascom_state, nascom1 )
|
||||
{
|
||||
UINT8 line[35];
|
||||
|
||||
while (image.fread( &line, sizeof(line)) == sizeof(line))
|
||||
{
|
||||
int addr, b0, b1, b2, b3, b4, b5, b6, b7, dummy;
|
||||
|
||||
if (sscanf((char *)line, "%x %x %x %x %x %x %x %x %x %x\010\010\n",
|
||||
&addr, &b0, &b1, &b2, &b3, &b4, &b5, &b6, &b7, &dummy) == 10)
|
||||
{
|
||||
m_maincpu->space(AS_PROGRAM).write_byte(addr++, b0);
|
||||
m_maincpu->space(AS_PROGRAM).write_byte(addr++, b1);
|
||||
m_maincpu->space(AS_PROGRAM).write_byte(addr++, b2);
|
||||
m_maincpu->space(AS_PROGRAM).write_byte(addr++, b3);
|
||||
m_maincpu->space(AS_PROGRAM).write_byte(addr++, b4);
|
||||
m_maincpu->space(AS_PROGRAM).write_byte(addr++, b5);
|
||||
m_maincpu->space(AS_PROGRAM).write_byte(addr++, b6);
|
||||
m_maincpu->space(AS_PROGRAM).write_byte(addr++, b7);
|
||||
}
|
||||
}
|
||||
|
||||
return IMAGE_INIT_PASS;
|
||||
}
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// SOCKETS
|
||||
//**************************************************************************
|
||||
|
||||
int nascom2_state::load_cart(device_image_interface &image, generic_slot_device *slot, int slot_id)
|
||||
{
|
||||
// loading directly from file
|
||||
if (image.software_entry() == NULL)
|
||||
{
|
||||
if (slot->length() > 0x1000)
|
||||
{
|
||||
image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported file size");
|
||||
return IMAGE_INIT_FAIL;
|
||||
}
|
||||
|
||||
slot->rom_alloc(slot->length(), GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
|
||||
slot->fread(slot->get_rom_base(), slot->length());
|
||||
|
||||
// we just assume that socket1 should be loaded to 0xc000 and socket2 to 0xd000
|
||||
switch (slot_id)
|
||||
{
|
||||
case 1:
|
||||
m_maincpu->space(AS_PROGRAM).install_rom(0xc000, 0xc000 + slot->length() - 1, slot->get_rom_base());
|
||||
break;
|
||||
case 2:
|
||||
m_maincpu->space(AS_PROGRAM).install_rom(0xd000, 0xd000 + slot->length() - 1, slot->get_rom_base());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// loading from software list. this supports multiple regions to load to
|
||||
else
|
||||
{
|
||||
UINT8 *region_b000 = image.get_software_region("b000");
|
||||
UINT8 *region_c000 = image.get_software_region("c000");
|
||||
UINT8 *region_d000 = image.get_software_region("d000");
|
||||
|
||||
if (region_b000 != NULL)
|
||||
{
|
||||
UINT32 size = image.get_software_region_length("b000");
|
||||
m_maincpu->space(AS_PROGRAM).install_rom(0xb000, 0xb000 + size - 1, region_b000);
|
||||
}
|
||||
|
||||
if (region_c000 != NULL)
|
||||
{
|
||||
UINT32 size = image.get_software_region_length("c000");
|
||||
m_maincpu->space(AS_PROGRAM).install_rom(0xc000, 0xc000 + size - 1, region_c000);
|
||||
}
|
||||
|
||||
if (region_d000 != NULL)
|
||||
{
|
||||
UINT32 size = image.get_software_region_length("d000");
|
||||
m_maincpu->space(AS_PROGRAM).install_rom(0xd000, 0xd000 + size - 1, region_d000);
|
||||
}
|
||||
}
|
||||
|
||||
return IMAGE_INIT_PASS;
|
||||
}
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// DRIVER INIT
|
||||
//**************************************************************************
|
||||
|
||||
void nascom_state::machine_reset()
|
||||
{
|
||||
// Set up hd6402 pins
|
||||
m_hd6402->set_input_pin(AY31015_SWE, 1);
|
||||
|
||||
m_hd6402->set_input_pin(AY31015_CS, 0);
|
||||
m_hd6402->set_input_pin(AY31015_NP, 1);
|
||||
m_hd6402->set_input_pin(AY31015_NB1, 1);
|
||||
m_hd6402->set_input_pin(AY31015_NB2, 1);
|
||||
m_hd6402->set_input_pin(AY31015_EPS, 1);
|
||||
m_hd6402->set_input_pin(AY31015_TSB, 1);
|
||||
m_hd6402->set_input_pin(AY31015_CS, 1);
|
||||
}
|
||||
|
||||
DRIVER_INIT_MEMBER( nascom_state, nascom )
|
||||
{
|
||||
// install extra memory
|
||||
if (m_ram->size() > 0)
|
||||
{
|
||||
m_maincpu->space(AS_PROGRAM).install_ram(0x1000, 0x1000 + m_ram->size() - 1, m_ram->pointer());
|
||||
}
|
||||
}
|
||||
|
||||
DRIVER_INIT_MEMBER( nascom2_state, nascom )
|
||||
{
|
||||
nascom_state::init_nascom();
|
||||
|
||||
// setup nasbus
|
||||
m_nasbus->set_program_space(&m_maincpu->space(AS_PROGRAM));
|
||||
m_nasbus->set_io_space(&m_maincpu->space(AS_IO));
|
||||
}
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// VIDEO
|
||||
//**************************************************************************
|
||||
|
||||
static const gfx_layout nascom1_charlayout =
|
||||
{
|
||||
@ -127,11 +359,15 @@ static const gfx_layout nascom1_charlayout =
|
||||
8 * 16
|
||||
};
|
||||
|
||||
|
||||
static GFXDECODE_START( nascom1 )
|
||||
GFXDECODE_ENTRY("gfx1", 0x0000, nascom1_charlayout, 0, 1)
|
||||
GFXDECODE_END
|
||||
|
||||
UINT32 nascom1_state::screen_update_nascom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
screen_update(bitmap, cliprect, 16);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const gfx_layout nascom2_charlayout =
|
||||
{
|
||||
@ -145,18 +381,70 @@ static const gfx_layout nascom2_charlayout =
|
||||
8 * 16
|
||||
};
|
||||
|
||||
|
||||
static GFXDECODE_START( nascom2 )
|
||||
GFXDECODE_ENTRY("gfx1", 0x0000, nascom2_charlayout, 0, 1)
|
||||
GFXDECODE_END
|
||||
|
||||
UINT32 nascom2_state::screen_update_nascom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
screen_update(bitmap, cliprect, 14);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void nascom_state::screen_update(bitmap_ind16 &bitmap, const rectangle &cliprect, int char_height)
|
||||
{
|
||||
for (int sx = 0; sx < 48; sx++)
|
||||
{
|
||||
m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, m_videoram[0x03ca + sx], 1, 0, 0, sx * 8, 0);
|
||||
}
|
||||
|
||||
for (int sy = 0; sy < 15; sy++)
|
||||
{
|
||||
for (int sx = 0; sx < 48; sx++)
|
||||
{
|
||||
m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, m_videoram[0x000a + (sy * 64) + sx], 1, 0, 0, sx * 8, (sy + 1) * char_height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Input ports
|
||||
*
|
||||
*************************************/
|
||||
//**************************************************************************
|
||||
// ADDRESS MAPS
|
||||
//**************************************************************************
|
||||
|
||||
static ADDRESS_MAP_START( nascom1_mem, AS_PROGRAM, 8, nascom1_state )
|
||||
AM_RANGE(0x0000, 0x07ff) AM_ROM // MONITOR
|
||||
AM_RANGE(0x0800, 0x0bff) AM_RAM AM_SHARE("videoram")
|
||||
AM_RANGE(0x0c00, 0x0fff) AM_RAM // WRAM
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( nascom1_io, AS_IO, 8, nascom1_state )
|
||||
ADDRESS_MAP_GLOBAL_MASK(0x0f)
|
||||
AM_RANGE(0x00, 0x00) AM_READWRITE(nascom1_port_00_r, nascom1_port_00_w)
|
||||
AM_RANGE(0x01, 0x01) AM_READWRITE(nascom1_port_01_r, nascom1_port_01_w)
|
||||
AM_RANGE(0x02, 0x02) AM_READ(nascom1_port_02_r)
|
||||
AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("z80pio", z80pio_device, read, write )
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( nascom2_mem, AS_PROGRAM, 8, nascom2_state )
|
||||
AM_RANGE(0x0000, 0x07ff) AM_ROM // MONITOR
|
||||
AM_RANGE(0x0800, 0x0bff) AM_RAM AM_SHARE("videoram")
|
||||
AM_RANGE(0x0c00, 0x0fff) AM_RAM // WRAM
|
||||
AM_RANGE(0xe000, 0xffff) AM_ROM AM_REGION("basic", 0)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( nascom2_io, AS_IO, 8, nascom2_state )
|
||||
ADDRESS_MAP_GLOBAL_MASK(0xff)
|
||||
AM_RANGE(0x00, 0x00) AM_READWRITE(nascom1_port_00_r, nascom1_port_00_w)
|
||||
AM_RANGE(0x01, 0x01) AM_READWRITE(nascom1_port_01_r, nascom1_port_01_w)
|
||||
AM_RANGE(0x02, 0x02) AM_READ(nascom1_port_02_r)
|
||||
AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("z80pio", z80pio_device, read, write )
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// INPUT PORTS
|
||||
//**************************************************************************
|
||||
|
||||
static INPUT_PORTS_START( nascom1 )
|
||||
PORT_START("KEY.0")
|
||||
@ -249,133 +537,119 @@ static INPUT_PORTS_START( nascom2 )
|
||||
INPUT_PORTS_END
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Machine drivers
|
||||
*
|
||||
*************************************/
|
||||
//**************************************************************************
|
||||
// MACHINE DRIVERS
|
||||
//**************************************************************************
|
||||
|
||||
static MACHINE_CONFIG_START( nascom1, nascom1_state )
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", Z80, XTAL_16MHz/8)
|
||||
// main cpu
|
||||
MCFG_CPU_ADD("maincpu", Z80, XTAL_16MHz / 8)
|
||||
MCFG_CPU_PROGRAM_MAP(nascom1_mem)
|
||||
MCFG_CPU_IO_MAP(nascom1_io)
|
||||
|
||||
/* video hardware */
|
||||
// video hardware
|
||||
MCFG_SCREEN_ADD("screen", RASTER)
|
||||
MCFG_SCREEN_REFRESH_RATE(50)
|
||||
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
|
||||
MCFG_SCREEN_SIZE(48 * 8, 16 * 16)
|
||||
MCFG_SCREEN_VISIBLE_AREA(0, 48 * 8 - 1, 0, 16 * 16 - 1)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(nascom1_state, screen_update_nascom1)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(nascom1_state, screen_update_nascom)
|
||||
MCFG_SCREEN_PALETTE("palette")
|
||||
|
||||
MCFG_GFXDECODE_ADD("gfxdecode", "palette", nascom1)
|
||||
MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette")
|
||||
|
||||
// uart
|
||||
MCFG_DEVICE_ADD( "hd6402", AY31015, 0 )
|
||||
MCFG_AY31015_TX_CLOCK(( XTAL_16MHz / 16 ) / 256)
|
||||
MCFG_AY31015_RX_CLOCK(( XTAL_16MHz / 16 ) / 256)
|
||||
MCFG_AY51013_READ_SI_CB(READ8(nascom1_state, nascom1_hd6402_si))
|
||||
MCFG_AY51013_WRITE_SO_CB(WRITE8(nascom1_state, nascom1_hd6402_so))
|
||||
MCFG_AY51013_READ_SI_CB(READ8(nascom_state, nascom1_hd6402_si))
|
||||
MCFG_AY51013_WRITE_SO_CB(WRITE8(nascom_state, nascom1_hd6402_so))
|
||||
|
||||
// cassette is connected to the uart
|
||||
MCFG_CASSETTE_ADD("cassette")
|
||||
|
||||
// pio
|
||||
MCFG_DEVICE_ADD("z80pio", Z80PIO, XTAL_16MHz/8)
|
||||
|
||||
/* devices */
|
||||
MCFG_SNAPSHOT_ADD("snapshot", nascom1_state, nascom1, "nas", 0.5)
|
||||
|
||||
MCFG_CASSETTE_ADD( "cassette" )
|
||||
|
||||
/* internal ram */
|
||||
// internal extra ram
|
||||
MCFG_RAM_ADD(RAM_TAG)
|
||||
MCFG_RAM_DEFAULT_SIZE("40K")
|
||||
MCFG_RAM_EXTRA_OPTIONS("1K,16K,32K")
|
||||
MCFG_RAM_DEFAULT_SIZE("32K")
|
||||
MCFG_RAM_EXTRA_OPTIONS("8K,16K")
|
||||
|
||||
// devices
|
||||
MCFG_SNAPSHOT_ADD("snapshot", nascom_state, nascom1, "nas", 0.5)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
static LEGACY_FLOPPY_OPTIONS_START(nascom2)
|
||||
LEGACY_FLOPPY_OPTION(nascom2_ss, "dsk", "Nascom 2 SS disk image", basicdsk_identify_default, basicdsk_construct_default, NULL,
|
||||
HEADS([1])
|
||||
TRACKS([80])
|
||||
SECTORS([16])
|
||||
SECTOR_LENGTH([256])
|
||||
FIRST_SECTOR_ID([1]))
|
||||
LEGACY_FLOPPY_OPTION(nascom2_ds, "dsk", "Nascom 2 DS disk image", basicdsk_identify_default, basicdsk_construct_default, NULL,
|
||||
HEADS([2])
|
||||
TRACKS([80])
|
||||
SECTORS([16])
|
||||
SECTOR_LENGTH([256])
|
||||
FIRST_SECTOR_ID([1]))
|
||||
LEGACY_FLOPPY_OPTIONS_END
|
||||
|
||||
static const floppy_interface nascom2_floppy_interface =
|
||||
{
|
||||
FLOPPY_STANDARD_5_25_DSHD,
|
||||
LEGACY_FLOPPY_OPTIONS_NAME(nascom2),
|
||||
NULL
|
||||
};
|
||||
|
||||
static MACHINE_CONFIG_DERIVED( nascom2, nascom1 )
|
||||
MCFG_CPU_MODIFY("maincpu")
|
||||
static MACHINE_CONFIG_DERIVED_CLASS( nascom2, nascom1, nascom2_state )
|
||||
MCFG_CPU_REPLACE("maincpu", Z80, XTAL_16MHz / 4)
|
||||
MCFG_CPU_PROGRAM_MAP(nascom2_mem)
|
||||
MCFG_CPU_IO_MAP(nascom2_io)
|
||||
|
||||
/* video hardware */
|
||||
// video hardware
|
||||
MCFG_SCREEN_MODIFY("screen")
|
||||
MCFG_SCREEN_SIZE(48 * 8, 16 * 14)
|
||||
MCFG_SCREEN_VISIBLE_AREA(0, 48 * 8 - 1, 0, 16 * 14 - 1)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(nascom1_state, screen_update_nascom2)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(nascom2_state, screen_update_nascom)
|
||||
|
||||
MCFG_GFXDECODE_MODIFY("gfxdecode", nascom2)
|
||||
|
||||
MCFG_DEVICE_ADD("wd1793", FD1793, 0)
|
||||
MCFG_WD17XX_DEFAULT_DRIVE4_TAGS
|
||||
MCFG_WD17XX_INTRQ_CALLBACK(WRITELINE(nascom1_state, nascom2_fdc_intrq_w))
|
||||
MCFG_WD17XX_DRQ_CALLBACK(WRITELINE(nascom1_state, nascom2_fdc_drq_w))
|
||||
MCFG_WD17XX_DDEN_CALLBACK(VCC)
|
||||
// generic sockets for ram/rom (todo: support ram here)
|
||||
MCFG_GENERIC_SOCKET_ADD("socket1", generic_plain_slot, "nascom_socket")
|
||||
MCFG_GENERIC_EXTENSIONS("bin,rom")
|
||||
MCFG_GENERIC_LOAD(nascom2_state, socket1_load)
|
||||
MCFG_GENERIC_SOCKET_ADD("socket2", generic_plain_slot, "nascom_socket")
|
||||
MCFG_GENERIC_EXTENSIONS("bin,rom")
|
||||
MCFG_GENERIC_LOAD(nascom2_state, socket2_load)
|
||||
|
||||
MCFG_LEGACY_FLOPPY_4_DRIVES_ADD(nascom2_floppy_interface)
|
||||
MCFG_SOFTWARE_LIST_ADD("socket_list", "nascom_socket")
|
||||
|
||||
// nasbus expansion bus
|
||||
MCFG_NASBUS_ADD(NASBUS_TAG)
|
||||
MCFG_NASBUS_SLOT_ADD("nasbus1", nasbus_slot_cards, NULL)
|
||||
MCFG_NASBUS_SLOT_ADD("nasbus2", nasbus_slot_cards, NULL)
|
||||
MCFG_NASBUS_SLOT_ADD("nasbus3", nasbus_slot_cards, NULL)
|
||||
MCFG_NASBUS_SLOT_ADD("nasbus4", nasbus_slot_cards, NULL)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// ROM DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* ROM definitions
|
||||
*
|
||||
*************************************/
|
||||
|
||||
ROM_START(nascom1)
|
||||
ROM_REGION(0x10000, "maincpu",0)
|
||||
ROM_START( nascom1 )
|
||||
ROM_REGION(0x0800, "maincpu", 0)
|
||||
ROM_SYSTEM_BIOS(0, "T4", "NasBug T4")
|
||||
ROMX_LOAD("nasbugt4.rom", 0x0000, 0x0800, CRC(f391df68) SHA1(00218652927afc6360c57e77d6a4fd32d4e34566), ROM_BIOS(1))
|
||||
ROM_SYSTEM_BIOS(1, "T1", "NasBug T1")
|
||||
ROMX_LOAD("nasbugt1.rom", 0x0000, 0x0400, CRC(8ea07054) SHA1(3f9a8632826003d6ea59d2418674d0fb09b83a4c), ROM_BIOS(2))
|
||||
ROM_SYSTEM_BIOS(2, "T2", "NasBug T2")
|
||||
ROMX_LOAD("nasbugt2.rom", 0x0000, 0x0400, CRC(e371b58a) SHA1(485b20a560b587cf9bb4208ba203b12b3841689b), ROM_BIOS(3))
|
||||
|
||||
ROM_REGION(0x0800, "gfx1", 0)
|
||||
ROM_LOAD("nascom1.chr", 0x0000, 0x0800, CRC(33e92a04) SHA1(be6e1cc80e7f95a032759f7df19a43c27ff93a52))
|
||||
ROM_END
|
||||
|
||||
|
||||
ROM_START(nascom2)
|
||||
ROM_REGION(0x10000, "maincpu",0)
|
||||
ROM_SYSTEM_BIOS( 0, "NS3", "NasSys 3")
|
||||
ROM_START( nascom2 )
|
||||
ROM_REGION(0x0800, "maincpu", 0)
|
||||
ROM_SYSTEM_BIOS(0, "NS3", "NasSys 3")
|
||||
ROMX_LOAD("nassys3.rom", 0x0000, 0x0800, CRC(3da17373) SHA1(5fbda15765f04e4cd08cf95c8d82ce217889f240), ROM_BIOS(1))
|
||||
ROM_SYSTEM_BIOS( 1, "NS1", "NasSys 1")
|
||||
ROM_SYSTEM_BIOS(1, "NS1", "NasSys 1")
|
||||
ROMX_LOAD("nassys1.rom", 0x0000, 0x0800, CRC(b6300716) SHA1(29da7d462ba3f569f70ed3ecd93b981f81c7adfa), ROM_BIOS(2))
|
||||
ROM_LOAD("nasdos.rom", 0xd000, 0x1000, CRC(54a36f6d) SHA1(1d063d04be5024f128bd589e6edc066e9a63fc1b))
|
||||
ROM_LOAD("basic.rom", 0xe000, 0x2000, CRC(5cb5197b) SHA1(c41669c2b6d6dea808741a2738426d97bccc9b07))
|
||||
|
||||
ROM_REGION(0x2000, "basic", 0)
|
||||
ROM_LOAD("basic.rom", 0x0000, 0x2000, CRC(5cb5197b) SHA1(c41669c2b6d6dea808741a2738426d97bccc9b07))
|
||||
|
||||
ROM_REGION(0x1000, "gfx1", 0)
|
||||
ROM_LOAD("nascom1.chr", 0x0000, 0x0800, CRC(33e92a04) SHA1(be6e1cc80e7f95a032759f7df19a43c27ff93a52))
|
||||
ROM_LOAD("nasgra.chr", 0x0800, 0x0800, CRC(2bc09d32) SHA1(d384297e9b02cbcb283c020da51b3032ff62b1ae))
|
||||
ROM_LOAD("nascom1.chr", 0x0000, 0x0800, CRC(33e92a04) SHA1(be6e1cc80e7f95a032759f7df19a43c27ff93a52))
|
||||
ROM_LOAD("nasgra.chr", 0x0800, 0x0800, CRC(2bc09d32) SHA1(d384297e9b02cbcb283c020da51b3032ff62b1ae))
|
||||
ROM_END
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Driver definitions
|
||||
*
|
||||
*************************************/
|
||||
//**************************************************************************
|
||||
// GAME DRIVERS
|
||||
//**************************************************************************
|
||||
|
||||
/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */
|
||||
COMP( 1978, nascom1, 0, 0, nascom1, nascom1, nascom1_state, nascom1, "Nascom Microcomputers", "Nascom 1", GAME_NO_SOUND )
|
||||
COMP( 1979, nascom2, nascom1, 0, nascom2, nascom2, nascom1_state, nascom1, "Nascom Microcomputers", "Nascom 2", GAME_NO_SOUND )
|
||||
// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */
|
||||
COMP( 1977, nascom1, 0, 0, nascom1, nascom1, nascom_state, nascom, "Nascom Microcomputers", "Nascom 1", GAME_NO_SOUND_HW )
|
||||
COMP( 1979, nascom2, 0, 0, nascom2, nascom2, nascom2_state, nascom, "Nascom Microcomputers", "Nascom 2", GAME_NO_SOUND_HW )
|
||||
|
@ -1,87 +0,0 @@
|
||||
// license:GPL-2.0+
|
||||
// copyright-holders:(Original Author?), Dirk Best
|
||||
/***************************************************************************
|
||||
|
||||
Nascom 1 and Nascom 2
|
||||
|
||||
license: MAME
|
||||
copyright-holders: (Original Author?), Dirk Best
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef NASCOM1_H_
|
||||
#define NASCOM1_H_
|
||||
|
||||
#include "imagedev/snapquik.h"
|
||||
#include "imagedev/cassette.h"
|
||||
#include "machine/wd17xx.h"
|
||||
#include "machine/ram.h"
|
||||
#include "machine/ay31015.h"
|
||||
|
||||
struct nascom1_portstat_t
|
||||
{
|
||||
UINT8 stat_flags;
|
||||
UINT8 stat_count;
|
||||
};
|
||||
|
||||
struct nascom2_fdc_t
|
||||
{
|
||||
UINT8 select;
|
||||
UINT8 irq;
|
||||
UINT8 drq;
|
||||
};
|
||||
|
||||
|
||||
class nascom1_state : public driver_device
|
||||
{
|
||||
public:
|
||||
nascom1_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_hd6402(*this, "hd6402"),
|
||||
m_cassette(*this, "cassette"),
|
||||
m_fdc(*this, "wd1793"),
|
||||
m_ram(*this, RAM_TAG),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_palette(*this, "palette"),
|
||||
m_videoram(*this, "videoram"),
|
||||
m_keyboard(*this, "KEY")
|
||||
{ }
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<ay31015_device> m_hd6402;
|
||||
required_device<cassette_image_device> m_cassette;
|
||||
optional_device<fd1793_device> m_fdc;
|
||||
required_device<ram_device> m_ram;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<palette_device> m_palette;
|
||||
required_shared_ptr<UINT8> m_videoram;
|
||||
required_ioport_array<9> m_keyboard;
|
||||
int m_tape_size;
|
||||
UINT8 *m_tape_image;
|
||||
int m_tape_index;
|
||||
nascom1_portstat_t m_portstat;
|
||||
nascom2_fdc_t m_nascom2_fdc;
|
||||
DECLARE_READ8_MEMBER(nascom2_fdc_select_r);
|
||||
DECLARE_WRITE8_MEMBER(nascom2_fdc_select_w);
|
||||
DECLARE_READ8_MEMBER(nascom2_fdc_status_r);
|
||||
DECLARE_READ8_MEMBER(nascom1_port_00_r);
|
||||
DECLARE_WRITE8_MEMBER(nascom1_port_00_w);
|
||||
DECLARE_READ8_MEMBER(nascom1_port_01_r);
|
||||
DECLARE_WRITE8_MEMBER(nascom1_port_01_w);
|
||||
DECLARE_READ8_MEMBER(nascom1_port_02_r);
|
||||
DECLARE_DRIVER_INIT(nascom1);
|
||||
virtual void machine_reset();
|
||||
UINT32 screen_update_nascom1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
UINT32 screen_update_nascom2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
DECLARE_WRITE_LINE_MEMBER(nascom2_fdc_intrq_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(nascom2_fdc_drq_w);
|
||||
DECLARE_READ8_MEMBER(nascom1_hd6402_si);
|
||||
DECLARE_WRITE8_MEMBER(nascom1_hd6402_so);
|
||||
DECLARE_DEVICE_IMAGE_LOAD_MEMBER( nascom1_cassette );
|
||||
DECLARE_DEVICE_IMAGE_UNLOAD_MEMBER( nascom1_cassette );
|
||||
DECLARE_SNAPSHOT_LOAD_MEMBER( nascom1 );
|
||||
};
|
||||
|
||||
|
||||
#endif /* NASCOM1_H_ */
|
@ -1,261 +0,0 @@
|
||||
// license:GPL-2.0+
|
||||
// copyright-holders:(Original Author?), Dirk Best
|
||||
/**********************************************************************
|
||||
|
||||
Nascom 1 and Nascom 2
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "includes/nascom1.h"
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "machine/ay31015.h"
|
||||
#include "imagedev/snapquik.h"
|
||||
#include "imagedev/cassette.h"
|
||||
#include "imagedev/flopdrv.h"
|
||||
#include "machine/ram.h"
|
||||
|
||||
#define NASCOM1_KEY_RESET 0x02
|
||||
#define NASCOM1_KEY_INCR 0x01
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Floppy
|
||||
*
|
||||
*************************************/
|
||||
|
||||
WRITE_LINE_MEMBER(nascom1_state::nascom2_fdc_intrq_w)
|
||||
{
|
||||
m_nascom2_fdc.irq = state;
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER(nascom1_state::nascom2_fdc_drq_w)
|
||||
{
|
||||
m_nascom2_fdc.drq = state;
|
||||
}
|
||||
|
||||
READ8_MEMBER(nascom1_state::nascom2_fdc_select_r)
|
||||
{
|
||||
return m_nascom2_fdc.select | 0xa0;
|
||||
}
|
||||
|
||||
|
||||
WRITE8_MEMBER(nascom1_state::nascom2_fdc_select_w)
|
||||
{
|
||||
m_nascom2_fdc.select = data;
|
||||
|
||||
logerror("nascom2_fdc_select_w: %02x\n", data);
|
||||
|
||||
if (data & 0x01) m_fdc->set_drive(0);
|
||||
if (data & 0x02) m_fdc->set_drive(1);
|
||||
if (data & 0x04) m_fdc->set_drive(2);
|
||||
if (data & 0x08) m_fdc->set_drive(3);
|
||||
if (data & 0x10) m_fdc->set_side((data & 0x10) >> 4);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* D0 -- WD1793 IRQ
|
||||
* D1 -- NOT READY
|
||||
* D2 to D6 -- 0
|
||||
* D7 -- WD1793 DRQ
|
||||
*
|
||||
*/
|
||||
READ8_MEMBER(nascom1_state::nascom2_fdc_status_r)
|
||||
{
|
||||
return (m_nascom2_fdc.drq << 7) | m_nascom2_fdc.irq;
|
||||
}
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Keyboard
|
||||
*
|
||||
*************************************/
|
||||
|
||||
READ8_MEMBER(nascom1_state::nascom1_port_00_r)
|
||||
{
|
||||
if (m_portstat.stat_count < 9)
|
||||
return ((m_keyboard[m_portstat.stat_count])->read() | ~0x7f);
|
||||
|
||||
return (0xff);
|
||||
}
|
||||
|
||||
|
||||
WRITE8_MEMBER(nascom1_state::nascom1_port_00_w)
|
||||
{
|
||||
m_cassette->change_state(
|
||||
( data & 0x10 ) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR );
|
||||
|
||||
if (!(data & NASCOM1_KEY_RESET))
|
||||
{
|
||||
if (m_portstat.stat_flags & NASCOM1_KEY_RESET)
|
||||
m_portstat.stat_count = 0;
|
||||
}
|
||||
else
|
||||
m_portstat.stat_flags = NASCOM1_KEY_RESET;
|
||||
|
||||
if (!(data & NASCOM1_KEY_INCR))
|
||||
{
|
||||
if (m_portstat.stat_flags & NASCOM1_KEY_INCR)
|
||||
m_portstat.stat_count++;
|
||||
}
|
||||
else
|
||||
m_portstat.stat_flags = NASCOM1_KEY_INCR;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Cassette
|
||||
*
|
||||
*************************************/
|
||||
|
||||
|
||||
READ8_MEMBER(nascom1_state::nascom1_port_01_r)
|
||||
{
|
||||
return m_hd6402->get_received_data();
|
||||
}
|
||||
|
||||
|
||||
WRITE8_MEMBER(nascom1_state::nascom1_port_01_w)
|
||||
{
|
||||
m_hd6402->set_transmit_data(data);
|
||||
}
|
||||
|
||||
READ8_MEMBER(nascom1_state::nascom1_port_02_r)
|
||||
{
|
||||
UINT8 data = 0x31;
|
||||
|
||||
m_hd6402->set_input_pin(AY31015_SWE, 0);
|
||||
data |= m_hd6402->get_output_pin(AY31015_OR ) ? 0x02 : 0;
|
||||
data |= m_hd6402->get_output_pin(AY31015_PE ) ? 0x04 : 0;
|
||||
data |= m_hd6402->get_output_pin(AY31015_FE ) ? 0x08 : 0;
|
||||
data |= m_hd6402->get_output_pin(AY31015_TBMT) ? 0x40 : 0;
|
||||
data |= m_hd6402->get_output_pin(AY31015_DAV ) ? 0x80 : 0;
|
||||
m_hd6402->set_input_pin(AY31015_SWE, 1);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
READ8_MEMBER(nascom1_state::nascom1_hd6402_si)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
WRITE8_MEMBER(nascom1_state::nascom1_hd6402_so)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
DEVICE_IMAGE_LOAD_MEMBER( nascom1_state,nascom1_cassette )
|
||||
{
|
||||
m_tape_size = image.length();
|
||||
m_tape_image = (UINT8*)image.ptr();
|
||||
if (!m_tape_image)
|
||||
return IMAGE_INIT_FAIL;
|
||||
|
||||
m_tape_index = 0;
|
||||
return IMAGE_INIT_PASS;
|
||||
}
|
||||
|
||||
|
||||
DEVICE_IMAGE_UNLOAD_MEMBER( nascom1_state,nascom1_cassette )
|
||||
{
|
||||
m_tape_image = NULL;
|
||||
m_tape_size = m_tape_index = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Snapshots
|
||||
*
|
||||
* ASCII .nas format
|
||||
*
|
||||
*************************************/
|
||||
|
||||
SNAPSHOT_LOAD_MEMBER( nascom1_state, nascom1 )
|
||||
{
|
||||
UINT8 line[35];
|
||||
|
||||
while (image.fread( &line, sizeof(line)) == sizeof(line))
|
||||
{
|
||||
int addr, b0, b1, b2, b3, b4, b5, b6, b7, dummy;
|
||||
|
||||
if (sscanf((char *)line, "%x %x %x %x %x %x %x %x %x %x\010\010\n",
|
||||
&addr, &b0, &b1, &b2, &b3, &b4, &b5, &b6, &b7, &dummy) == 10)
|
||||
{
|
||||
m_maincpu->space(AS_PROGRAM).write_byte(addr++, b0);
|
||||
m_maincpu->space(AS_PROGRAM).write_byte(addr++, b1);
|
||||
m_maincpu->space(AS_PROGRAM).write_byte(addr++, b2);
|
||||
m_maincpu->space(AS_PROGRAM).write_byte(addr++, b3);
|
||||
m_maincpu->space(AS_PROGRAM).write_byte(addr++, b4);
|
||||
m_maincpu->space(AS_PROGRAM).write_byte(addr++, b5);
|
||||
m_maincpu->space(AS_PROGRAM).write_byte(addr++, b6);
|
||||
m_maincpu->space(AS_PROGRAM).write_byte(addr++, b7);
|
||||
}
|
||||
}
|
||||
|
||||
return IMAGE_INIT_PASS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Initialization
|
||||
*
|
||||
*************************************/
|
||||
|
||||
void nascom1_state::machine_reset()
|
||||
{
|
||||
/* Set up hd6402 pins */
|
||||
m_hd6402->set_input_pin(AY31015_SWE, 1);
|
||||
|
||||
m_hd6402->set_input_pin(AY31015_CS, 0);
|
||||
m_hd6402->set_input_pin(AY31015_NP, 1);
|
||||
m_hd6402->set_input_pin(AY31015_NB1, 1);
|
||||
m_hd6402->set_input_pin(AY31015_NB2, 1);
|
||||
m_hd6402->set_input_pin(AY31015_EPS, 1);
|
||||
m_hd6402->set_input_pin(AY31015_TSB, 1);
|
||||
m_hd6402->set_input_pin(AY31015_CS, 1);
|
||||
}
|
||||
|
||||
DRIVER_INIT_MEMBER(nascom1_state,nascom1)
|
||||
{
|
||||
switch (m_ram->size())
|
||||
{
|
||||
case 1 * 1024:
|
||||
m_maincpu->space(AS_PROGRAM).nop_readwrite(
|
||||
0x1400, 0x9000);
|
||||
break;
|
||||
|
||||
case 16 * 1024:
|
||||
m_maincpu->space(AS_PROGRAM).install_readwrite_bank(
|
||||
0x1400, 0x4fff, "bank1");
|
||||
m_maincpu->space(AS_PROGRAM).nop_readwrite(
|
||||
0x5000, 0xafff);
|
||||
membank("bank1")->set_base(m_ram->pointer());
|
||||
break;
|
||||
|
||||
case 32 * 1024:
|
||||
m_maincpu->space(AS_PROGRAM).install_readwrite_bank(
|
||||
0x1400, 0x8fff, "bank1");
|
||||
m_maincpu->space(AS_PROGRAM).nop_readwrite(
|
||||
0x9000, 0xafff);
|
||||
membank("bank1")->set_base(m_ram->pointer());
|
||||
break;
|
||||
|
||||
case 40 * 1024:
|
||||
m_maincpu->space(AS_PROGRAM).install_readwrite_bank(
|
||||
0x1400, 0xafff, "bank1");
|
||||
membank("bank1")->set_base(m_ram->pointer());
|
||||
break;
|
||||
}
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
// license:GPL-2.0+
|
||||
// copyright-holders:(Original Author?), Dirk Best
|
||||
/***************************************************************************
|
||||
|
||||
nascom1.c
|
||||
|
||||
Functions to emulate the video hardware of the nascom1.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "includes/nascom1.h"
|
||||
|
||||
UINT32 nascom1_state::screen_update_nascom1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
UINT8 *videoram = m_videoram;
|
||||
int sy, sx;
|
||||
|
||||
for (sx = 0; sx < 48; sx++)
|
||||
{
|
||||
m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, videoram[0x03ca + sx],
|
||||
1, 0, 0, sx * 8, 0);
|
||||
}
|
||||
|
||||
for (sy = 0; sy < 15; sy++)
|
||||
{
|
||||
for (sx = 0; sx < 48; sx++)
|
||||
{
|
||||
m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, videoram[0x000a + (sy * 64) + sx],
|
||||
1, 0, 0, sx * 8, (sy + 1) * 16);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
UINT32 nascom1_state::screen_update_nascom2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
UINT8 *videoram = m_videoram;
|
||||
int sy, sx;
|
||||
|
||||
for (sx = 0; sx < 48; sx++)
|
||||
{
|
||||
m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, videoram[0x03ca + sx],
|
||||
1, 0, 0, sx * 8, 0);
|
||||
}
|
||||
|
||||
for (sy = 0; sy < 15; sy++)
|
||||
{
|
||||
for (sx = 0; sx < 48; sx++)
|
||||
{
|
||||
m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, videoram[0x000a + (sy * 64) + sx],
|
||||
1, 0, 0, sx * 8, (sy + 1) * 14);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user