svi318: add support for the 80 column card (sv806)

This commit is contained in:
Dirk Best 2016-03-17 03:03:36 +01:00
parent 4cc9dd016a
commit 776bfad1c1
5 changed files with 209 additions and 0 deletions

View File

@ -2619,6 +2619,8 @@ if (BUSES["SVI_SLOT"]~=null) then
MAME_DIR .. "src/devices/bus/svi3x8/slot/sv801.h",
MAME_DIR .. "src/devices/bus/svi3x8/slot/sv803.cpp",
MAME_DIR .. "src/devices/bus/svi3x8/slot/sv803.h",
MAME_DIR .. "src/devices/bus/svi3x8/slot/sv806.cpp",
MAME_DIR .. "src/devices/bus/svi3x8/slot/sv806.h",
MAME_DIR .. "src/devices/bus/svi3x8/slot/sv807.cpp",
MAME_DIR .. "src/devices/bus/svi3x8/slot/sv807.h",
}

View File

@ -11,5 +11,6 @@
SLOT_INTERFACE_START( svi_slot_cards )
SLOT_INTERFACE("sv801", SV801)
SLOT_INTERFACE("sv803", SV803)
SLOT_INTERFACE("sv806", SV806)
SLOT_INTERFACE("sv807", SV807)
SLOT_INTERFACE_END

View File

@ -14,6 +14,7 @@
#include "emu.h"
#include "sv801.h"
#include "sv803.h"
#include "sv806.h"
#include "sv807.h"
SLOT_INTERFACE_EXTERN( svi_slot_cards );

View File

@ -0,0 +1,150 @@
// license:GPL-2.0+
// copyright-holders:Dirk Best
/***************************************************************************
SV-806 80 Column Cartridge for SVI-318/328
***************************************************************************/
#include "sv806.h"
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
const device_type SV806 = &device_creator<sv806_device>;
//-------------------------------------------------
// rom_region - device-specific ROM region
//-------------------------------------------------
ROM_START( sv806 )
ROM_REGION(0x1000, "gfx", 0)
ROM_SYSTEM_BIOS(0, "en", "English Character Set")
ROMX_LOAD("sv806.ic27", 0x0000, 0x1000, CRC(850bc232) SHA1(ed45cb0e9bd18a9d7bd74f87e620f016a7ae840f), ROM_BIOS(1))
ROM_SYSTEM_BIOS(1, "se", "Swedish Character Set")
ROMX_LOAD("sv806se.ic27", 0x0000, 0x1000, CRC(daea8956) SHA1(3f16d5513ad35692488ae7d864f660e76c6e8ed3), ROM_BIOS(2))
ROM_END
const rom_entry *sv806_device::device_rom_region() const
{
return ROM_NAME( sv806 );
}
//-------------------------------------------------
// machine_config_additions - device-specific
// machine configurations
//-------------------------------------------------
static MACHINE_CONFIG_FRAGMENT( sv806 )
MCFG_SCREEN_ADD_MONOCHROME("80col", RASTER, rgb_t::green)
MCFG_SCREEN_RAW_PARAMS((XTAL_12MHz / 6) * 8, 864, 0, 640, 317, 0, 192)
MCFG_SCREEN_UPDATE_DEVICE("crtc", hd6845_device, screen_update)
MCFG_PALETTE_ADD_MONOCHROME("palette")
MCFG_MC6845_ADD("crtc", HD6845, "80col", XTAL_12MHz / 6)
MCFG_MC6845_SHOW_BORDER_AREA(false)
MCFG_MC6845_CHAR_WIDTH(8)
MCFG_MC6845_UPDATE_ROW_CB(sv806_device, crtc_update_row)
MACHINE_CONFIG_END
machine_config_constructor sv806_device::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( sv806 );
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// sv806_device - constructor
//-------------------------------------------------
sv806_device::sv806_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, SV806, "SV-806 80 Column Cartridge", tag, owner, clock, "sv806", __FILE__),
device_svi_slot_interface(mconfig, *this),
m_crtc(*this, "crtc"),
m_palette(*this, "palette"),
m_gfx(*this, "gfx"),
m_ram_enabled(0)
{
m_ram = std::make_unique<UINT8[]>(0x800);
memset(m_ram.get(), 0xff, 0x800);
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void sv806_device::device_start()
{
}
//**************************************************************************
// IMPLEMENTATION
//**************************************************************************
MC6845_UPDATE_ROW( sv806_device::crtc_update_row )
{
const pen_t *pen = m_palette->pens();
for (int i = 0; i < x_count; i++)
{
UINT8 data = m_gfx->u8((m_ram[(ma + i) & 0x7ff] << 4) | ra);
if (i == cursor_x)
data = 0xff;
bitmap.pix32(y, i * 8 + 0) = pen[BIT(data, 7)];
bitmap.pix32(y, i * 8 + 1) = pen[BIT(data, 6)];
bitmap.pix32(y, i * 8 + 2) = pen[BIT(data, 5)];
bitmap.pix32(y, i * 8 + 3) = pen[BIT(data, 4)];
bitmap.pix32(y, i * 8 + 4) = pen[BIT(data, 3)];
bitmap.pix32(y, i * 8 + 5) = pen[BIT(data, 2)];
bitmap.pix32(y, i * 8 + 6) = pen[BIT(data, 1)];
bitmap.pix32(y, i * 8 + 7) = pen[BIT(data, 0)];
}
}
READ8_MEMBER( sv806_device::mreq_r )
{
if (offset >= 0xf000 && m_ram_enabled)
{
m_bus->ramdis_w(0);
return m_ram[offset & 0x7ff];
}
return 0xff;
}
WRITE8_MEMBER( sv806_device::mreq_w )
{
if (offset >= 0xf000 && m_ram_enabled)
{
m_bus->ramdis_w(0);
m_ram[offset & 0x7ff] = data;
}
}
READ8_MEMBER( sv806_device::iorq_r )
{
if (offset == 0x51)
return m_crtc->register_r(space, 0);
return 0xff;
}
WRITE8_MEMBER( sv806_device::iorq_w )
{
switch (offset)
{
case 0x50: m_crtc->address_w(space, 0, data); break;
case 0x51: m_crtc->register_w(space, 0, data); break;
case 0x58: m_ram_enabled = data; break;
}
}

View File

@ -0,0 +1,55 @@
// license:GPL-2.0+
// copyright-holders:Dirk Best
/***************************************************************************
SV-806 80 column card for SVI-318/328
***************************************************************************/
#pragma once
#ifndef __SVI3X8_SLOT_SV806_H__
#define __SVI3X8_SLOT_SV806_H__
#include "emu.h"
#include "slot.h"
#include "video/mc6845.h"
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> sv806_device
class sv806_device : public device_t, public device_svi_slot_interface
{
public:
// construction/destruction
sv806_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual DECLARE_READ8_MEMBER( mreq_r ) override;
virtual DECLARE_WRITE8_MEMBER( mreq_w ) override;
virtual DECLARE_READ8_MEMBER( iorq_r ) override;
virtual DECLARE_WRITE8_MEMBER( iorq_w ) override;
MC6845_UPDATE_ROW(crtc_update_row);
protected:
virtual const rom_entry *device_rom_region() const override;
virtual machine_config_constructor device_mconfig_additions() const override;
virtual void device_start() override;
private:
required_device<hd6845_device> m_crtc;
required_device<palette_device> m_palette;
required_memory_region m_gfx;
std::unique_ptr<UINT8[]> m_ram;
int m_ram_enabled;
};
// device type definition
extern const device_type SV806;
#endif // __SVI3X8_SLOT_SV806_H__