apple2: add new files for CMS SCSI II card [R. Belmont, Apple II Documentation Project]

This commit is contained in:
arbee 2020-08-08 12:58:09 -04:00
parent 6fe3a9fa7c
commit 24e40bc932
2 changed files with 308 additions and 0 deletions

View File

@ -0,0 +1,247 @@
// license:BSD-3-Clause
// copyright-holders:R. Belmont
/*********************************************************************
cmsscsi.cpp
Implementation of the CMS Apple II SCSI Card
Details:
ROM is $2000 bytes. The last $800 bytes are 7 slot images at
offset (slot*$100). There is no slot 0 image, naturally, so $1800-$18FF
is blank.
The other $1800 bytes of the ROM are banked at $C800. The first $80
bytes at $C800 are the first $80 bytes of the 2K SRAM chip regardless
of the ROM bank setting. This also means the first $80 bytes of each
ROM bank are inaccessible. (Most of the SRAM is also inaccessible)
$C0(n+8)X space:
$0-$7: NCR5380 registers
$8: Appears to control SCSI delay time. 1 is shortest, 0 is longest ($FF is second longest, etc)
$9: ROM bank at $C800 in the low 2 bits.
$A: read/write to the DMA data register on the 5380
$B, $C, $D, $E: the jumpers on the card. Not sure yet which is which.
$F: Card will not boot if it doesn't return 0.
*********************************************************************/
#include "emu.h"
#include "cmsscsi.h"
#include "bus/nscsi/devices.h"
/***************************************************************************
PARAMETERS
***************************************************************************/
//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
DEFINE_DEVICE_TYPE(A2BUS_CMSSCSI, a2bus_cmsscsi_device, "cmsscsi", "CMS Apple II SCSI Card")
#define SCSI_ROM_REGION "scsi_rom"
#define SCSI_BUS_TAG "scsibus"
#define SCSI_5380_TAG "scsibus:7:ncr5380"
ROM_START( scsi )
ROM_REGION(0x4000, SCSI_ROM_REGION, 0)
ROM_DEFAULT_BIOS("cms3190")
ROM_SYSTEM_BIOS( 0, "cms3190", "CMS SCSI BIOS dated 3-1-90" )
ROMX_LOAD( "cms scsi ii interface card rom 3-1-90.bin", 0x000000, 0x002000, CRC(9452cc76) SHA1(b981ce644dde479c22d2ba270d472fe3b5d7f3e9), ROM_BIOS(0) )
ROM_SYSTEM_BIOS( 1, "cms871109", "CMS SCSI BIOS dated 1987-11-09" )
ROMX_LOAD( "cms 1987-11-09 scsi.bin", 0x000000, 0x002000, CRC(89d1d917) SHA1(f6028f6f2b16250950297e2ff5317ce463006796), ROM_BIOS(1) )
ROM_END
/***************************************************************************
FUNCTION PROTOTYPES
***************************************************************************/
//-------------------------------------------------
// device_add_mconfig - add device configuration
//-------------------------------------------------
void a2bus_cmsscsi_device::device_add_mconfig(machine_config &config)
{
NSCSI_BUS(config, m_scsibus);
NSCSI_CONNECTOR(config, "scsibus:0", default_scsi_devices, nullptr, false);
NSCSI_CONNECTOR(config, "scsibus:1", default_scsi_devices, nullptr, false);
NSCSI_CONNECTOR(config, "scsibus:2", default_scsi_devices, nullptr, false);
NSCSI_CONNECTOR(config, "scsibus:3", default_scsi_devices, nullptr, false);
NSCSI_CONNECTOR(config, "scsibus:4", default_scsi_devices, nullptr, false);
NSCSI_CONNECTOR(config, "scsibus:5", default_scsi_devices, nullptr, false);
NSCSI_CONNECTOR(config, "scsibus:6", default_scsi_devices, "harddisk", false);
NSCSI_CONNECTOR(config, "scsibus:7").option_set("ncr5380", NCR5380N);
}
//-------------------------------------------------
// rom_region - device-specific ROM region
//-------------------------------------------------
const tiny_rom_entry *a2bus_cmsscsi_device::device_rom_region() const
{
return ROM_NAME( scsi );
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
a2bus_cmsscsi_device::a2bus_cmsscsi_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, type, tag, owner, clock),
device_a2bus_card_interface(mconfig, *this),
m_ncr5380(*this, SCSI_5380_TAG),
m_scsibus(*this, SCSI_BUS_TAG), m_rom(nullptr), m_rombank(0)
{
}
a2bus_cmsscsi_device::a2bus_cmsscsi_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
a2bus_cmsscsi_device(mconfig, A2BUS_CMSSCSI, tag, owner, clock)
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void a2bus_cmsscsi_device::device_start()
{
m_rom = device().machine().root_device().memregion(this->subtag(SCSI_ROM_REGION).c_str())->base();
memset(m_ram, 0, 2048);
save_item(NAME(m_ram));
save_item(NAME(m_rombank));
}
void a2bus_cmsscsi_device::device_reset()
{
m_rombank = 0;
}
/*-------------------------------------------------
read_c0nx - called for reads from this card's c0nx space
-------------------------------------------------*/
uint8_t a2bus_cmsscsi_device::read_c0nx(uint8_t offset)
{
switch (offset)
{
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
// logerror("Read 5380 @ %x\n", offset);
return m_ncr5380->read(offset);
case 8: // appears to be delay time
return 1;
case 0xa: // read and DACK
return m_ncr5380->dma_r();
case 0xb: //
return 0x1;
case 0xc: //
return 0x1;
case 0xd: //
return 0x1;
case 0xe: //
return 0x1;
case 0xf: // must be 0 to boot
return 0;
default:
printf("Read c0n%x (%s)\n", offset, machine().describe_context().c_str());
break;
}
return 0xff;
}
/*-------------------------------------------------
write_c0nx - called for writes to this card's c0nx space
-------------------------------------------------*/
void a2bus_cmsscsi_device::write_c0nx(uint8_t offset, uint8_t data)
{
switch (offset)
{
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
// logerror("%02x to 5380 reg %x\n", data, offset);
m_ncr5380->write(offset, data);
break;
case 9:
m_rombank = (data & 3) * 0x800;
//printf("ROM bank to %x\n", m_rombank);
break;
case 0xa: // write and DACK
m_ncr5380->dma_w(data);
break;
default:
logerror("Write %02x to c0n%x (%s)\n", data, offset, machine().describe_context().c_str());
break;
}
}
/*-------------------------------------------------
read_cnxx - called for reads from this card's cnxx space
-------------------------------------------------*/
uint8_t a2bus_cmsscsi_device::read_cnxx(uint8_t offset)
{
// slot images at $1800 + (slot * 100)
return m_rom[offset + (slotno() * 0x100) + 0x1800];
}
void a2bus_cmsscsi_device::write_cnxx(uint8_t offset, uint8_t data)
{
// there are writes to cn0A, possibly misguided C0nA (bank select?) writes?
// logerror("Write %02x to cn%02x (%s)\n", data, offset, machine().describe_context());
}
/*-------------------------------------------------
read_c800 - called for reads from this card's c800 space
-------------------------------------------------*/
uint8_t a2bus_cmsscsi_device::read_c800(uint16_t offset)
{
if (offset < 0x80)
{
return m_ram[offset];
}
return m_rom[offset + m_rombank];
}
/*-------------------------------------------------
write_c800 - called for writes to this card's c800 space
-------------------------------------------------*/
void a2bus_cmsscsi_device::write_c800(uint16_t offset, uint8_t data)
{
if (offset < 0x80)
{
m_ram[offset] = data;
}
}

View File

@ -0,0 +1,61 @@
// license:BSD-3-Clause
// copyright-holders:R. Belmont
/*********************************************************************
cmsscsi.h
Implementation of the CMS Apple II SCSI Card
*********************************************************************/
#ifndef MAME_BUS_A2BUS_CMSSCSI_H
#define MAME_BUS_A2BUS_CMSSCSI_H
#pragma once
#include "a2bus.h"
#include "machine/ncr5380n.h"
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
class a2bus_cmsscsi_device:
public device_t,
public device_a2bus_card_interface
{
public:
// construction/destruction
a2bus_cmsscsi_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
DECLARE_WRITE_LINE_MEMBER( drq_w );
protected:
a2bus_cmsscsi_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
// overrides of standard a2bus slot functions
virtual uint8_t read_c0nx(uint8_t offset) override;
virtual void write_c0nx(uint8_t offset, uint8_t data) override;
virtual uint8_t read_cnxx(uint8_t offset) override;
virtual void write_cnxx(uint8_t offset, uint8_t data) override;
virtual uint8_t read_c800(uint16_t offset) override;
virtual void write_c800(uint16_t offset, uint8_t data) override;
required_device<ncr5380n_device> m_ncr5380;
required_device<nscsi_bus_device> m_scsibus;
private:
uint8_t *m_rom;
uint8_t m_ram[2048]; // 2K SRAM chip on the card, only 128 bytes are used?
int m_rombank;
};
// device type definition
DECLARE_DEVICE_TYPE(A2BUS_CMSSCSI, a2bus_cmsscsi_device)
#endif // MAME_BUS_A2BUS_CMSSCSI_H