amiga: Add support for the A2058 memory expansion

This commit is contained in:
Dirk Best 2018-12-09 12:01:54 +01:00
parent 35f7521386
commit 625cfabe02
4 changed files with 203 additions and 0 deletions

View File

@ -3055,6 +3055,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/a2058.cpp",
MAME_DIR .. "src/devices/bus/amiga/zorro/a2058.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",

View File

@ -0,0 +1,147 @@
// license:GPL-2.0+
// copyright-holders:Dirk Best
/***************************************************************************
Commodore A2058
Zorro-II RAM Expansion (2, 4 or 8 MB)
***************************************************************************/
#include "emu.h"
#include "a2058.h"
//**************************************************************************
// CONSTANTS / MACROS
//**************************************************************************
#define VERBOSE 1
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
DEFINE_DEVICE_TYPE(A2058, a2058_device, "a2058", "CBM A2058 Fast Memory")
//-------------------------------------------------
// input_ports - device-specific input ports
//-------------------------------------------------
static INPUT_PORTS_START( a2058 )
PORT_START("config")
PORT_CONFNAME(0x03, 0x02, "A2058 Installed RAM")
PORT_CONFSETTING(0x00, "2 MB")
PORT_CONFSETTING(0x01, "4 MB")
PORT_CONFSETTING(0x02, "8 MB")
PORT_CONFSETTING(0x03, "Auto-Config disabled")
INPUT_PORTS_END
ioport_constructor a2058_device::device_input_ports() const
{
return INPUT_PORTS_NAME( a2058 );
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// a2058_device - constructor
//-------------------------------------------------
a2058_device::a2058_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, A2058, tag, owner, clock),
device_zorro2_card_interface(mconfig, *this),
m_config(*this, "config"),
m_ram_size(0)
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void a2058_device::device_start()
{
// setup ram
m_ram = make_unique_clear<uint16_t[]>(0x800000/2);
// register for save states
save_pointer(NAME(m_ram), 0x800000/2);
set_zorro_device();
}
//**************************************************************************
// IMPLEMENTATION
//**************************************************************************
void a2058_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 a2058\n");
// stop responding to default autoconfig
m_slot->m_space->unmap_readwrite(0xe80000, 0xe8007f);
// install access to the rom space
m_slot->m_space->install_ram(address, address + (m_ram_size << 20) - 1, m_ram.get());
// we're done
m_slot->cfgout_w(0);
}
WRITE_LINE_MEMBER( a2058_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);
// setup ram
switch (m_config->read())
{
case 0:
autoconfig_board_size(BOARD_SIZE_2M);
m_ram_size = 0x200000 >> 20;
break;
case 1:
autoconfig_board_size(BOARD_SIZE_4M);
m_ram_size = 0x400000 >> 20;
break;
case 2:
autoconfig_board_size(BOARD_SIZE_8M);
m_ram_size = 0x800000 >> 20;
break;
case 3:
// auto-config disabled
m_ram_size = 0;
return;
}
autoconfig_product(0x0a);
autoconfig_manufacturer(0x0202);
autoconfig_serial(0x00000000);
autoconfig_link_into_memory(true);
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);
}
}

View File

@ -0,0 +1,51 @@
// license:GPL-2.0+
// copyright-holders:Dirk Best
/***************************************************************************
Commodore A2058
Zorro-II RAM Expansion (2, 4 or 8 MB)
***************************************************************************/
#ifndef MAME_BUS_AMIGA_ZORRO_A2058_H
#define MAME_BUS_AMIGA_ZORRO_A2058_H
#pragma once
#include "zorro.h"
#include "machine/autoconfig.h"
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> a2058_device
class a2058_device : public device_t, public device_zorro2_card_interface, public amiga_autoconfig
{
public:
// construction/destruction
a2058_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected:
virtual ioport_constructor device_input_ports() const 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_ioport m_config;
std::unique_ptr<uint16_t[]> m_ram;
int m_ram_size;
};
// device type definition
DECLARE_DEVICE_TYPE(A2058, a2058_device)
#endif // MAME_BUS_AMIGA_ZORRO_A2058_H

View File

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