diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index bee7a595236..32200b92bd1 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -4688,6 +4688,8 @@ if (BUSES["ZORRO"]~=null) then MAME_DIR .. "src/devices/bus/amiga/zorro/action_replay.h", MAME_DIR .. "src/devices/bus/amiga/zorro/buddha.cpp", MAME_DIR .. "src/devices/bus/amiga/zorro/buddha.h", + MAME_DIR .. "src/devices/bus/amiga/zorro/picasso2.cpp", + MAME_DIR .. "src/devices/bus/amiga/zorro/picasso2.h", MAME_DIR .. "src/devices/bus/amiga/zorro/ripple.cpp", MAME_DIR .. "src/devices/bus/amiga/zorro/ripple.h", MAME_DIR .. "src/devices/bus/amiga/zorro/toccata.cpp", diff --git a/src/devices/bus/amiga/zorro/cards.cpp b/src/devices/bus/amiga/zorro/cards.cpp index 8f90abfaa11..15a530bfb88 100644 --- a/src/devices/bus/amiga/zorro/cards.cpp +++ b/src/devices/bus/amiga/zorro/cards.cpp @@ -16,6 +16,7 @@ #include "a590.h" #include "action_replay.h" #include "buddha.h" +#include "picasso2.h" #include "ripple.h" #include "toccata.h" @@ -47,6 +48,7 @@ void zorro2_cards(device_slot_interface &device) device.option_add("a2091", ZORRO_A2091); device.option_add("a2232", ZORRO_A2232); device.option_add("buddha", ZORRO_BUDDHA); + device.option_add("picasso2p", ZORRO_PICASSO2P); device.option_add("ripple", ZORRO_RIPPLE); device.option_add("toccata", ZORRO_TOCCATA); } @@ -59,6 +61,7 @@ void zorro3_cards(device_slot_interface &device) device.option_add("a2091", ZORRO_A2091); device.option_add("a2232", ZORRO_A2232); device.option_add("buddha", ZORRO_BUDDHA); + device.option_add("picasso2p", ZORRO_PICASSO2P); device.option_add("ripple", ZORRO_RIPPLE); device.option_add("toccata", ZORRO_TOCCATA); } diff --git a/src/devices/bus/amiga/zorro/picasso2.cpp b/src/devices/bus/amiga/zorro/picasso2.cpp new file mode 100644 index 00000000000..0ff61413aa9 --- /dev/null +++ b/src/devices/bus/amiga/zorro/picasso2.cpp @@ -0,0 +1,212 @@ +// license: GPL-2.0+ +// copyright-holders: Dirk Best +/*************************************************************************** + + Village Tronic Picasso II/Picasso II+ + + RTG graphics card for Amiga 2000/3000/4000 + + Hardware: + - Cirrus Logic CL-GD5426 or CL-GD5428 + - 1 or 2 MB RAM + - 25 MHz (only II+) and 14.31818 MHz XTAL + + TODO: + - Not working, VGA core needs work + - Interrupts? + - Segmented mode (jumper setting, autoconfig id 13) + +***************************************************************************/ + +#include "emu.h" +#include "picasso2.h" +#include "screen.h" + +#define VERBOSE (LOG_GENERAL) + +#include "logmacro.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(ZORRO_PICASSO2P, bus::amiga::zorro::picasso2p_device, "zorro_picasso2p", "Picasso II+ RTG") + +namespace bus::amiga::zorro { + +picasso2p_device::picasso2p_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, ZORRO_PICASSO2P, tag, owner, clock), + device_memory_interface(mconfig, *this), + device_zorro2_card_interface(mconfig, *this), + m_vga(*this, "vga"), + m_autoconfig_memory_done(false) +{ + m_vga_space_config = address_space_config("vga_regs", ENDIANNESS_BIG, 8, 12, 0, address_map_constructor(FUNC(picasso2p_device::vga_map), this)); +} + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +void picasso2p_device::mmio_map(address_map &map) +{ + map(0x0000, 0x0fff).rw(FUNC(picasso2p_device::vga0_r), FUNC(picasso2p_device::vga0_w)).umask16(0xffff); + map(0x1000, 0x1fff).rw(FUNC(picasso2p_device::vga1_r), FUNC(picasso2p_device::vga1_w)).umask16(0xffff); + map(0x46e8, 0x46b8).unmaprw(); // TODO +} + +void picasso2p_device::vga_map(address_map &map) +{ + map(0x102, 0x102).unmaprw(); // TODO + map(0x3b0, 0x3df).m(m_vga, FUNC(cirrus_gd5428_vga_device::io_map)); +} + + +//************************************************************************** +// MACHINE DEFINITIONS +//************************************************************************** + +void picasso2p_device::device_add_mconfig(machine_config &config) +{ + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); + screen.set_raw(25.1748_MHz_XTAL, 900, 0, 640, 526, 0, 480); + screen.set_screen_update(m_vga, FUNC(cirrus_gd5428_vga_device::screen_update)); + + CIRRUS_GD5428_VGA(config, m_vga, 0); + m_vga->set_screen("screen"); + m_vga->set_vram_size(0x200000); +} + + +//************************************************************************** +// MACHINE EMULATION +//************************************************************************** + +void picasso2p_device::device_start() +{ +} + +void picasso2p_device::device_reset() +{ + m_autoconfig_memory_done = false; +} + +device_memory_interface::space_config_vector picasso2p_device::memory_space_config() const +{ + return space_config_vector { + std::make_pair(0, &m_vga_space_config) + }; +} + +uint8_t picasso2p_device::vga0_r(offs_t offset) +{ + LOG("vga0_r: %04x\n", offset); + return space(0).read_byte(offset); +} + +void picasso2p_device::vga0_w(offs_t offset, uint8_t data) +{ + LOG("vga0_w: %04x = %02x\n", offset, data); + space(0).write_byte(offset, data); +} + +uint8_t picasso2p_device::vga1_r(offs_t offset) +{ + LOG("vga1_r: %04x (%04x)\n", offset, offset | 1); + return space(0).read_byte(offset | 1); +} + +void picasso2p_device::vga1_w(offs_t offset, uint8_t data) +{ + LOG("vga1_w: %04x (%04x) = %02x\n", offset, offset | 1, data); + space(0).write_byte(offset | 1, data); +} + + +//************************************************************************** +// AUTOCONFIG +//************************************************************************** + +void picasso2p_device::autoconfig_base_address(offs_t address) +{ + LOG("autoconfig_base_address received: 0x%06x\n", address); + + if (!m_autoconfig_memory_done) + { + LOG("-> installing picasso2p memory\n"); + + m_slot->space().install_readwrite_handler(address, address + 0x1fffff, + emu::rw_delegate(m_vga, FUNC(cirrus_gd5428_vga_device::mem_r)), + emu::rw_delegate(m_vga, FUNC(cirrus_gd5428_vga_device::mem_w)), 0xffffffff); + + m_autoconfig_memory_done = true; + + // configure next + cfgin_w(0); + } + else + { + LOG("-> installing picasso2p registers\n"); + + // install picasso registers + m_slot->space().install_device(address, address + 0x0ffff, *this, &picasso2p_device::mmio_map); + + // stop responding to default autoconfig + m_slot->space().unmap_readwrite(0xe80000, 0xe8007f); + + // we're done + m_slot->cfgout_w(0); + } +} + +void picasso2p_device::cfgin_w(int state) +{ + LOG("configin_w (%d)\n", state); + + if (state != 0) + return; + + if (!m_autoconfig_memory_done) + { + LOG("autoconfig for memory\n"); + + // setup autoconfig for memory + autoconfig_board_type(BOARD_TYPE_ZORRO2); + autoconfig_board_size(BOARD_SIZE_2M); + autoconfig_link_into_memory(false); + autoconfig_rom_vector_valid(false); + autoconfig_multi_device(false); // ? + autoconfig_8meg_preferred(false); + autoconfig_can_shutup(true); // ? + autoconfig_product(11); + autoconfig_manufacturer(2167); + autoconfig_serial(0x00000000); + autoconfig_rom_vector(0x0000); + + // install autoconfig handler + m_slot->space().install_readwrite_handler(0xe80000, 0xe8007f, + read16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_read)), + write16_delegate(*this, FUNC(amiga_autoconfig::autoconfig_write)), 0xffffffff); + } + else + { + LOG("autoconfig for registers\n"); + + // setup autoconfig for registers + autoconfig_board_type(BOARD_TYPE_ZORRO2); + autoconfig_board_size(BOARD_SIZE_64K); + autoconfig_link_into_memory(false); + autoconfig_rom_vector_valid(false); + autoconfig_multi_device(false); // ? + autoconfig_8meg_preferred(false); + autoconfig_can_shutup(true); // ? + autoconfig_product(12); + autoconfig_manufacturer(2167); + autoconfig_serial(0x00000000); + autoconfig_rom_vector(0x0000); + } +} + +} // namespace bus::amiga::zorro diff --git a/src/devices/bus/amiga/zorro/picasso2.h b/src/devices/bus/amiga/zorro/picasso2.h new file mode 100644 index 00000000000..d75d49b6f7b --- /dev/null +++ b/src/devices/bus/amiga/zorro/picasso2.h @@ -0,0 +1,63 @@ +// license: GPL-2.0+ +// copyright-holders: Dirk Best +/*************************************************************************** + + Village Tronic Picasso II/Picasso II+ + + RTG graphics card for Amiga 2000/3000/4000 + +***************************************************************************/ + +#ifndef MAME_BUS_AMIGA_ZORRO_PICASSO2_H +#define MAME_BUS_AMIGA_ZORRO_PICASSO2_H + +#pragma once + +#include "zorro.h" +#include "machine/autoconfig.h" +#include "video/pc_vga_cirrus.h" + + +namespace bus::amiga::zorro { + +class picasso2p_device : public device_t, public device_memory_interface, public device_zorro2_card_interface, public amiga_autoconfig +{ +public: + picasso2p_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + virtual void device_add_mconfig(machine_config &config) override ATTR_COLD; + + virtual void device_start() override ATTR_COLD; + virtual void device_reset() override ATTR_COLD; + + // device_memory_interface + virtual space_config_vector memory_space_config() const override; + + // device_zorro2_card_interface overrides + virtual void cfgin_w(int state) override; + + // amiga_autoconfig overrides + virtual void autoconfig_base_address(offs_t address) override; + +private: + void mmio_map(address_map &map) ATTR_COLD; + void vga_map(address_map &map) ATTR_COLD; + + uint8_t vga0_r(offs_t offset); + void vga0_w(offs_t offset, uint8_t data); + uint8_t vga1_r(offs_t offset); + void vga1_w(offs_t offset, uint8_t data); + + required_device m_vga; + address_space_config m_vga_space_config; + + bool m_autoconfig_memory_done; +}; + +} // namespace bus::amiga::zorro + +// device type declaration +DECLARE_DEVICE_TYPE_NS(ZORRO_PICASSO2P, bus::amiga::zorro, picasso2p_device) + +#endif // MAME_BUS_AMIGA_ZORRO_PICASSO2_H