From 0855900dedd4ef7a20fd577b23a01d65074deb89 Mon Sep 17 00:00:00 2001 From: Angelo Salese Date: Mon, 12 Jun 2023 01:51:23 +0200 Subject: bus/a800: modernize cart slot interface (#10528) - use address_maps instead of catch-all handlers; - implement rd4 and rd5 line views; - converted a800_rom_williams_device to the new system, make almost every entry in mega* and prisma* SW to actually boot; - bus/a800: implement maxflash_1mb / maxflash_8mb devices. * This allows loading arbitrary collection of .xex files built thru Maxflash Cartridge Studio program as flash ROM binaries; - bus/a800: implement sic_128kb / sic_256kb / sic_512kb flash ROM devices; - bus/a800: implement ast2k, atrax, Blizzard 32kb, Adawliah, SpartaDOS 128KB, A5200 Super Cart variants; - bus/a800: implement Super Charger math unit device; - a800_slot.cpp: fix xegs cart default slot for loose cart loading; - a800_carts.h: merge a800_turbo64 and a800_turbo128 into single a800_turbo slot option; - bus/a800/a800_slot: split a5200 to own interface New working software list additions ----------------------------------- a800.xml: Maxflash Cartridge Studio - Demonstration Workbook [Atarimax Team], SIC! 31-in-1 Demonstration [SIC! Team] a800.xml: Atrax 01, Atrax 02, Atrax 03, Atrax 04, Atrax 05, Atrax 06, Atrax 08, Atrax 09, Atrax 10, Atrax 11, Atrax 12, Atrax 13, Atrax 15 [Atarimania] a800.xml: Prince of Persia (AtariMAX i/f), Prince of Persia (SIC! i/f) [AtariAge] New software list items marked not working ------------------------------------------ a800.xml: Atrax 14, Atrax 16 [Atarimania], Turbo Hit (Blizzard 32kb) [atari.area] a5200.xml: Bosconian 5200 - Star Destroyer (Ultimate Version) [AtariAge] --- src/devices/bus/a800/sic.cpp | 114 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 src/devices/bus/a800/sic.cpp (limited to 'src/devices/bus/a800/sic.cpp') diff --git a/src/devices/bus/a800/sic.cpp b/src/devices/bus/a800/sic.cpp new file mode 100644 index 00000000000..fa5aaadb802 --- /dev/null +++ b/src/devices/bus/a800/sic.cpp @@ -0,0 +1,114 @@ +// license: BSD-3-Clause +// copyright-holders: Angelo Salese +/************************************************************************************************** + +SIC! "Super Inexpensive Cartridge!" + +TODO: +- Unknown flash types used, Altirra just observed a Winbond 29C020; +- Customizable Jumper/switch handling for pin signals; + +**************************************************************************************************/ + +#include "emu.h" +#include "sic.h" + +// device type definition +DEFINE_DEVICE_TYPE(A800_SIC_128KB, a800_sic_128kb_device, "a800_siccart_128kb", "Atari 8-bit SIC! 128KB flash ROM cart") +DEFINE_DEVICE_TYPE(A800_SIC_256KB, a800_sic_256kb_device, "a800_siccart_256kb", "Atari 8-bit SIC! 256KB flash ROM cart") +DEFINE_DEVICE_TYPE(A800_SIC_512KB, a800_sic_512kb_device, "a800_siccart_512kb", "Atari 8-bit SIC! 512KB flash ROM cart") + +a800_sic_128kb_device::a800_sic_128kb_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) + : a800_rom_device(mconfig, type, tag, owner, clock) + , m_flash(*this, "flash") + , m_bank(0) + , m_write_protect(true) +{ +} + +a800_sic_128kb_device::a800_sic_128kb_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : a800_sic_128kb_device(mconfig, A800_SIC_128KB, tag, owner, clock) +{ +} + +void a800_sic_128kb_device::device_add_mconfig(machine_config &config) +{ + AMD_29F010(config, m_flash); +} + +void a800_sic_128kb_device::device_start() +{ + save_item(NAME(m_bank)); + save_item(NAME(m_write_protect)); +} + +void a800_sic_128kb_device::device_reset() +{ + // TODO: ugly assignment, and shouldn't happen in device_reset + // TODO: assert against intended size for slot + memcpy(m_flash->base(), m_rom, get_rom_size()); + m_bank_mask = (get_rom_size() / 0x4000) - 1; + + // value of 0 for config_bank_w confirmed + m_bank = 0; + m_write_protect = true; +} + +// SIC! maps rd4 and rd5 linearly +// so that 0x8000 maps to 0 and 0xa000 to 0x2000 +u8 a800_sic_128kb_device::read(offs_t offset) +{ + return m_flash->read((offset & 0x3fff) | (m_bank * 0x4000)); +} + +void a800_sic_128kb_device::write(offs_t offset, u8 data) +{ + if (!m_write_protect) + m_flash->write((offset & 0x3fff) | (m_bank * 0x4000), data); +} + +void a800_sic_128kb_device::cart_map(address_map &map) +{ + map(0x0000, 0x3fff).rw(FUNC(a800_sic_128kb_device::read), FUNC(a800_sic_128kb_device::write)); +} + +/* + * 1--- ---- enable flash write + * -1-- ---- RD4 enable + * --0- ---- RD5 enable + * ---x xxxx ROM bank, where upper bits are unused for 128KB and 256KB versions + */ +void a800_sic_128kb_device::config_bank_w(offs_t offset, u8 data) +{ + m_bank = (data & m_bank_mask); + rd4_w(BIT(data, 5)); + rd5_w(!(BIT(data, 6))); + m_write_protect = !(BIT(data, 7)); +} + +void a800_sic_128kb_device::cctl_map(address_map &map) +{ + map(0x00, 0x1f).w(FUNC(a800_sic_128kb_device::config_bank_w)); +} + +// 256/512KB variants + +a800_sic_256kb_device::a800_sic_256kb_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : a800_sic_128kb_device(mconfig, A800_SIC_256KB, tag, owner, clock) +{ +} + +void a800_sic_256kb_device::device_add_mconfig(machine_config &config) +{ + AMD_29LV200T(config, m_flash); +} + +a800_sic_512kb_device::a800_sic_512kb_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : a800_sic_128kb_device(mconfig, A800_SIC_512KB, tag, owner, clock) +{ +} + +void a800_sic_512kb_device::device_add_mconfig(machine_config &config) +{ + AMD_29F040(config, m_flash); +} -- cgit v1.2.3-70-g09d2