Initial version of Commodore A2065 Ethernet card

This commit is contained in:
Dirk Best 2018-11-20 17:18:28 +01:00
parent 36999f2826
commit 76637c49f4
4 changed files with 214 additions and 0 deletions

View file

@ -3043,6 +3043,8 @@ if (BUSES["ZORRO"]~=null) then
MAME_DIR .. "src/devices/bus/amiga/zorro/cards.h",
MAME_DIR .. "src/devices/bus/amiga/zorro/a2052.cpp",
MAME_DIR .. "src/devices/bus/amiga/zorro/a2052.h",
MAME_DIR .. "src/devices/bus/amiga/zorro/a2065.cpp",
MAME_DIR .. "src/devices/bus/amiga/zorro/a2065.h",
MAME_DIR .. "src/devices/bus/amiga/zorro/a2232.cpp",
MAME_DIR .. "src/devices/bus/amiga/zorro/a2232.h",
MAME_DIR .. "src/devices/bus/amiga/zorro/a590.cpp",

View file

@ -0,0 +1,151 @@
// license:GPL-2.0+
// copyright-holders:Dirk Best
/***************************************************************************
Commodore A2065
Zorro-II Ethernet Network Interface
***************************************************************************/
#include "emu.h"
#include "a2065.h"
//**************************************************************************
// CONSTANTS / MACROS
//**************************************************************************
#define VERBOSE 1
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
DEFINE_DEVICE_TYPE(A2065, a2065_device, "a2065", "CBM A2065 Ethernet Card")
//-------------------------------------------------
// device_add_mconfig - add device configuration
//-------------------------------------------------
void a2065_device::device_add_mconfig(machine_config &config)
{
AM7990(config, m_lance);
m_lance->intr_out().set(FUNC(a2065_device::lance_irq_w));
m_lance->dma_in().set(FUNC(a2065_device::ram_r));
m_lance->dma_out().set(FUNC(a2065_device::ram_w));
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// a2065_device - constructor
//-------------------------------------------------
a2065_device::a2065_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, A2065, tag, owner, clock),
device_zorro2_card_interface(mconfig, *this),
m_lance(*this, "lance")
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void a2065_device::device_start()
{
// setup ram
m_ram = std::make_unique<uint16_t[]>(0x4000);
memset(m_ram.get(), 0xff, 0x4000 * sizeof(uint16_t));
// register for save states
save_pointer(NAME(m_ram), 0x4000);
set_zorro_device();
}
//**************************************************************************
// IMPLEMENTATION
//**************************************************************************
void a2065_device::autoconfig_base_address(offs_t address)
{
if (VERBOSE)
logerror("%s('%s'): autoconfig_base_address received: 0x%06x\n", shortname(), basetag(), address);
if (VERBOSE)
logerror("-> installing a2065\n");
// stop responding to default autoconfig
m_slot->m_space->unmap_readwrite(0xe80000, 0xe8007f);
// install autoconfig handler to new location
m_slot->m_space->install_readwrite_handler(address, address + 0x7f,
read16_delegate(FUNC(amiga_autoconfig::autoconfig_read), static_cast<amiga_autoconfig *>(this)),
write16_delegate(FUNC(amiga_autoconfig::autoconfig_write), static_cast<amiga_autoconfig *>(this)), 0xffff);
// install access to lance registers
m_slot->m_space->install_readwrite_handler(address + 0x4000, address + 0x4003,
read16_delegate(FUNC(am7990_device::regs_r), &(*m_lance)),
write16_delegate(FUNC(am7990_device::regs_w), &(*m_lance)), 0xffff);
// install access to onboard ram (32k)
m_slot->m_space->install_readwrite_handler(address + 0x8000, address + 0x8000 + 0x7fff,
read16_delegate(FUNC(a2065_device::ram_r), this),
write16_delegate(FUNC(a2065_device::ram_w), this), 0xffff);
// we're done
m_slot->cfgout_w(0);
}
WRITE_LINE_MEMBER( a2065_device::cfgin_w )
{
if (VERBOSE)
logerror("%s('%s'): configin_w (%d)\n", shortname(), basetag(), state);
if (state == 0)
{
// setup autoconfig
autoconfig_board_type(BOARD_TYPE_ZORRO2);
autoconfig_board_size(BOARD_SIZE_64K);
autoconfig_product(0x70);
autoconfig_manufacturer(0x0202);
autoconfig_serial(0x00000000); // last 3 bytes = last 3 bytes of mac address
autoconfig_link_into_memory(false);
autoconfig_rom_vector_valid(false);
autoconfig_multi_device(false);
autoconfig_8meg_preferred(false);
autoconfig_can_shutup(true); // ?
// install autoconfig handler
m_slot->m_space->install_readwrite_handler(0xe80000, 0xe8007f,
read16_delegate(FUNC(amiga_autoconfig::autoconfig_read), static_cast<amiga_autoconfig *>(this)),
write16_delegate(FUNC(amiga_autoconfig::autoconfig_write), static_cast<amiga_autoconfig *>(this)), 0xffff);
}
}
READ16_MEMBER( a2065_device::ram_r )
{
// logerror("read offset %04x\n", offset);
return m_ram[offset & 0x3fff];
}
WRITE16_MEMBER( a2065_device::ram_w )
{
// logerror("write %04x = %04x\n", offset, data);
m_ram[offset & 0x3fff] = data;
}
WRITE_LINE_MEMBER( a2065_device::lance_irq_w )
{
// default is irq 2, can be changed via jumper
m_slot->int2_w(!state);
}

View file

@ -0,0 +1,58 @@
// license:GPL-2.0+
// copyright-holders:Dirk Best
/***************************************************************************
Commodore A2065
Zorro-II Ethernet Network Interface
***************************************************************************/
#ifndef MAME_BUS_AMIGA_ZORRO_A2065_H
#define MAME_BUS_AMIGA_ZORRO_A2065_H
#pragma once
#include "zorro.h"
#include "machine/am79c90.h"
#include "machine/autoconfig.h"
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> a2065_device
class a2065_device : public device_t, public device_zorro2_card_interface, public amiga_autoconfig
{
public:
// construction/destruction
a2065_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
DECLARE_READ16_MEMBER( ram_r );
DECLARE_WRITE16_MEMBER( ram_w );
DECLARE_WRITE_LINE_MEMBER( lance_irq_w );
protected:
// device-level overrides
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
// device_zorro2_card_interface overrides
virtual DECLARE_WRITE_LINE_MEMBER( cfgin_w ) override;
// amiga_autoconfig overrides
virtual void autoconfig_base_address(offs_t address) override;
private:
required_device<am7990_device> m_lance;
std::unique_ptr<uint16_t[]> m_ram;
};
// device type definition
DECLARE_DEVICE_TYPE(A2065, a2065_device)
#endif // MAME_BUS_AMIGA_ZORRO_A2065_H

View file

@ -10,6 +10,7 @@
#include "cards.h"
#include "a2052.h"
#include "a2065.h"
#include "a2232.h"
#include "a590.h"
#include "action_replay.h"
@ -38,6 +39,7 @@ void a2000_expansion_cards(device_slot_interface &device)
void zorro2_cards(device_slot_interface &device)
{
device.option_add("a2052", A2052);
device.option_add("a2065", A2065);
device.option_add("a2091", A2091);
device.option_add("a2232", A2232);
device.option_add("buddha", BUDDHA);
@ -46,6 +48,7 @@ void zorro2_cards(device_slot_interface &device)
void zorro3_cards(device_slot_interface &device)
{
device.option_add("a2052", A2052);
device.option_add("a2065", A2065);
device.option_add("a2091", A2091);
device.option_add("a2232", A2232);
device.option_add("buddha", BUDDHA);