Merge pull request #2153 from shattered/_5321d22

agat: split from apple2, implement basic agat7 hardware (take 2).
This commit is contained in:
R. Belmont 2017-03-16 16:16:37 -04:00 committed by GitHub
commit ae7e249cfd
15 changed files with 2018 additions and 33 deletions

View File

@ -1649,6 +1649,10 @@ if (BUSES["A2BUS"]~=null) then
MAME_DIR .. "src/devices/bus/a2bus/ezcgi.h",
MAME_DIR .. "src/devices/bus/a2bus/pc_xporter.cpp",
MAME_DIR .. "src/devices/bus/a2bus/pc_xporter.h",
MAME_DIR .. "src/devices/bus/a2bus/agat7langcard.cpp",
MAME_DIR .. "src/devices/bus/a2bus/agat7langcard.h",
MAME_DIR .. "src/devices/bus/a2bus/agat7ram.cpp",
MAME_DIR .. "src/devices/bus/a2bus/agat7ram.h",
}
end

View File

@ -880,6 +880,7 @@ function linkProjects_mame_mess(_target, _subtarget)
"acorn",
"act",
"adc",
"agat",
"alesis",
"altos",
"ami",
@ -1323,6 +1324,14 @@ files {
MAME_DIR .. "src/mame/includes/superslave.h",
}
createMESSProjects(_target, _subtarget, "agat")
files {
MAME_DIR .. "src/mame/drivers/agat.cpp",
MAME_DIR .. "src/mame/includes/apple2.h",
MAME_DIR .. "src/mame/video/agat7.cpp",
MAME_DIR .. "src/mame/video/agat7.h",
}
createMESSProjects(_target, _subtarget, "alesis")
files {
MAME_DIR .. "src/mame/drivers/alesis.cpp",

View File

@ -25,6 +25,7 @@
const device_type A2BUS_DISKII = device_creator<a2bus_diskii_device>;
const device_type A2BUS_IWM_FDC = device_creator<a2bus_iwmflop_device>;
const device_type A2BUS_AGAT7_FDC = device_creator<a2bus_agat7flop_device>;
#define DISKII_ROM_REGION "diskii_rom"
#define FDC_TAG "diskii_fdc"
@ -61,6 +62,11 @@ ROM_START( diskii )
ROM_LOAD( "341-0027-a.p5", 0x000000, 0x000100, CRC(ce7144f6) SHA1(d4181c9f046aafc3fb326b381baac809d9e38d16) )
ROM_END
ROM_START( agat7 )
ROM_REGION(0x100, DISKII_ROM_REGION, 0)
ROM_LOAD( "shugart7.rom", 0x0000, 0x0100, CRC(c6e4850c) SHA1(71626d3d2d4bbeeac2b77585b45a5566d20b8d34) )
ROM_END
//-------------------------------------------------
// machine_config_additions - device-specific
// machine configurations
@ -85,6 +91,11 @@ const tiny_rom_entry *a2bus_floppy_device::device_rom_region() const
return ROM_NAME( diskii );
}
const tiny_rom_entry *a2bus_agat7flop_device::device_rom_region() const
{
return ROM_NAME( agat7 );
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
@ -106,6 +117,11 @@ a2bus_iwmflop_device::a2bus_iwmflop_device(const machine_config &mconfig, const
{
}
a2bus_agat7flop_device::a2bus_agat7flop_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
a2bus_floppy_device(mconfig, A2BUS_AGAT7_FDC, "Agat-7 140K floppy card", tag, owner, clock, "agat7_flop", __FILE__)
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------

View File

@ -59,8 +59,17 @@ public:
virtual machine_config_constructor device_mconfig_additions() const override;
};
class a2bus_agat7flop_device: public a2bus_floppy_device
{
public:
a2bus_agat7flop_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual const tiny_rom_entry *device_rom_region() const override;
};
// device type definition
extern const device_type A2BUS_DISKII;
extern const device_type A2BUS_IWM_FDC;
extern const device_type A2BUS_AGAT7_FDC;
#endif /* __A2BUS_DISKII__ */

View File

@ -0,0 +1,156 @@
// license:BSD-3-Clause
// copyright-holders:Sergey Svishchev
/*********************************************************************
agat7langcard.c
Implemention of the Agat-7 language card
*********************************************************************/
#include "agat7langcard.h"
/***************************************************************************
PARAMETERS
***************************************************************************/
//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
const device_type A2BUS_AGAT7LANGCARD = device_creator<a2bus_agat7langcard_device>;
/***************************************************************************
FUNCTION PROTOTYPES
***************************************************************************/
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
a2bus_agat7langcard_device::a2bus_agat7langcard_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source) :
device_t(mconfig, type, name, tag, owner, clock, shortname, source),
device_a2bus_card_interface(mconfig, *this), m_inh_state(0), m_last_offset(0), m_dxxx_bank(0), m_main_bank(0)
{
}
a2bus_agat7langcard_device::a2bus_agat7langcard_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, A2BUS_AGAT7LANGCARD, "Agat-7 32K Language Card", tag, owner, clock, "a7lang", __FILE__),
device_a2bus_card_interface(mconfig, *this), m_inh_state(0), m_last_offset(0), m_dxxx_bank(0), m_main_bank(0)
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void a2bus_agat7langcard_device::device_start()
{
// set_a2bus_device makes m_slot valid
set_a2bus_device();
memset(m_ram, 0, 32*1024);
save_item(NAME(m_inh_state));
save_item(NAME(m_ram));
save_item(NAME(m_dxxx_bank));
save_item(NAME(m_main_bank));
save_item(NAME(m_last_offset));
}
void a2bus_agat7langcard_device::device_reset()
{
m_inh_state = INH_NONE;
m_dxxx_bank = 0;
m_main_bank = 0;
m_last_offset = -1;
m_mode = 0;
}
void a2bus_agat7langcard_device::do_io(int offset)
{
int old_inh_state = m_inh_state;
m_last_offset = offset;
m_inh_state = INH_WRITE;
m_dxxx_bank = 0;
m_main_bank = (offset & 1) * 0x4000;
if (offset & 0x20)
{
m_inh_state = INH_READ;
}
if (offset & 0x40)
{
m_dxxx_bank = 0x1000;
}
if (m_inh_state != old_inh_state)
{
recalc_slot_inh();
}
#if 1
logerror("LC: (ofs %02x) new state %c%c dxxx=%04x main=%05x\n",
offset,
(m_inh_state & INH_READ) ? 'R' : 'x',
(m_inh_state & INH_WRITE) ? 'W' : 'x',
m_dxxx_bank, m_main_bank);
#endif
}
/*-------------------------------------------------
read_cnxx - called for reads from this card's cnxx space
-------------------------------------------------*/
uint8_t a2bus_agat7langcard_device::read_cnxx(address_space &space, uint8_t offset)
{
return m_last_offset < 0 ? 0x80 : (0x80 | m_last_offset);
}
/*-------------------------------------------------
write_cnxx - called for writes to this card's cnxx space
-------------------------------------------------*/
void a2bus_agat7langcard_device::write_cnxx(address_space &space, uint8_t offset, uint8_t data)
{
do_io(offset);
}
uint8_t a2bus_agat7langcard_device::read_inh_rom(address_space &space, uint16_t offset)
{
assert(m_inh_state & INH_READ); // this should never happen
if (offset < 0xe000)
{
return m_ram[(offset & 0xfff) + m_dxxx_bank + m_main_bank];
}
return m_ram[(offset & 0x1fff) + 0x2000 + m_main_bank];
}
void a2bus_agat7langcard_device::write_inh_rom(address_space &space, uint16_t offset, uint8_t data)
{
// are writes enabled?
if (!(m_inh_state & INH_WRITE))
{
return;
}
if (offset < 0xe000)
{
m_ram[(offset & 0xfff) + m_dxxx_bank + m_main_bank] = data;
return;
}
m_ram[(offset & 0x1fff) + 0x2000 + m_main_bank] = data;
}
int a2bus_agat7langcard_device::inh_type()
{
return m_inh_state;
}

View File

@ -0,0 +1,57 @@
// license:BSD-3-Clause
// copyright-holders:Sergey Svishchev
/*********************************************************************
agat7langcard.h
Implemention of the Agat-7 language card
*********************************************************************/
#ifndef __A2BUS_AGAT7LANGCARD__
#define __A2BUS_AGAT7LANGCARD__
#include "emu.h"
#include "a2bus.h"
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
class a2bus_agat7langcard_device:
public device_t,
public device_a2bus_card_interface
{
public:
// construction/destruction
a2bus_agat7langcard_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source);
a2bus_agat7langcard_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected:
virtual void device_start() override;
virtual void device_reset() override;
// overrides of standard a2bus slot functions
virtual uint8_t read_cnxx(address_space &space, uint8_t offset) override;
virtual void write_cnxx(address_space &space, uint8_t offset, uint8_t data) override;
virtual uint8_t read_inh_rom(address_space &space, uint16_t offset) override;
virtual void write_inh_rom(address_space &space, uint16_t offset, uint8_t data) override;
virtual uint16_t inh_start() override { return 0xd000; }
virtual uint16_t inh_end() override { return 0xffff; }
virtual int inh_type() override;
private:
void do_io(int offset);
int m_inh_state;
int m_last_offset;
int m_dxxx_bank;
int m_main_bank;
uint8_t m_ram[32*1024];
uint8_t m_mode;
};
// device type definition
extern const device_type A2BUS_AGAT7LANGCARD;
#endif /* __A2BUS_AGAT7LANGCARD__ */

View File

@ -0,0 +1,140 @@
// license:BSD-3-Clause
// copyright-holders:Sergey Svishchev
/*********************************************************************
agat7ram.c
Implemention of the Agat-7 RAM card
*********************************************************************/
#include "agat7ram.h"
/***************************************************************************
PARAMETERS
***************************************************************************/
//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
const device_type A2BUS_AGAT7RAM = device_creator<a2bus_agat7ram_device>;
/***************************************************************************
FUNCTION PROTOTYPES
***************************************************************************/
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
a2bus_agat7ram_device::a2bus_agat7ram_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source) :
device_t(mconfig, type, name, tag, owner, clock, shortname, source),
device_a2bus_card_interface(mconfig, *this), m_inh_state(0), m_last_offset(0), m_main_bank(0)
{
}
a2bus_agat7ram_device::a2bus_agat7ram_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, A2BUS_AGAT7RAM, "Agat-7 32K RAM Card", tag, owner, clock, "a7ram", __FILE__),
device_a2bus_card_interface(mconfig, *this), m_inh_state(0), m_last_offset(0), m_main_bank(0)
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void a2bus_agat7ram_device::device_start()
{
// set_a2bus_device makes m_slot valid
set_a2bus_device();
memset(m_ram, 0, 32*1024);
save_item(NAME(m_inh_state));
save_item(NAME(m_ram));
save_item(NAME(m_main_bank));
save_item(NAME(m_last_offset));
}
void a2bus_agat7ram_device::device_reset()
{
m_inh_state = INH_NONE;
m_main_bank = 0;
m_last_offset = -1;
}
void a2bus_agat7ram_device::do_io(int offset)
{
int old_inh_state = m_inh_state;
m_last_offset = offset;
m_inh_state = INH_NONE;
m_main_bank = 0;
if (offset & 0x8)
{
m_inh_state = INH_READ|INH_WRITE;
}
if (offset & 0x1)
{
m_main_bank = 0x4000;
}
if (m_inh_state != old_inh_state)
{
recalc_slot_inh();
}
#if 1
logerror("RAM: (ofs %02x) new state %c%c main=%05x\n",
offset,
(m_inh_state & INH_READ) ? 'R' : 'x',
(m_inh_state & INH_WRITE) ? 'W' : 'x',
m_main_bank);
#endif
}
/*-------------------------------------------------
read_cnxx - called for reads from this card's cnxx space
-------------------------------------------------*/
uint8_t a2bus_agat7ram_device::read_cnxx(address_space &space, uint8_t offset)
{
return m_last_offset < 0 ? 0 : (m_last_offset & 0x7f);
}
/*-------------------------------------------------
write_cnxx - called for writes to this card's cnxx space
-------------------------------------------------*/
void a2bus_agat7ram_device::write_cnxx(address_space &space, uint8_t offset, uint8_t data)
{
do_io(offset);
}
uint8_t a2bus_agat7ram_device::read_inh_rom(address_space &space, uint16_t offset)
{
assert(m_inh_state & INH_READ); // this should never happen
return m_ram[(offset & 0x3fff) + m_main_bank];
}
void a2bus_agat7ram_device::write_inh_rom(address_space &space, uint16_t offset, uint8_t data)
{
// are writes enabled?
if (!(m_inh_state & INH_WRITE))
{
return;
}
m_ram[(offset & 0x3fff) + m_main_bank] = data;
}
int a2bus_agat7ram_device::inh_type()
{
return m_inh_state;
}

View File

@ -0,0 +1,55 @@
// license:BSD-3-Clause
// copyright-holders:Sergey Svishchev
/*********************************************************************
agat7ram.h
Implemention of the Agat-7 RAM card
*********************************************************************/
#ifndef __A2BUS_AGAT7RAM__
#define __A2BUS_AGAT7RAM__
#include "emu.h"
#include "a2bus.h"
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
class a2bus_agat7ram_device:
public device_t,
public device_a2bus_card_interface
{
public:
// construction/destruction
a2bus_agat7ram_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source);
a2bus_agat7ram_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected:
virtual void device_start() override;
virtual void device_reset() override;
// overrides of standard a2bus slot functions
virtual uint8_t read_cnxx(address_space &space, uint8_t offset) override;
virtual void write_cnxx(address_space &space, uint8_t offset, uint8_t data) override;
virtual uint8_t read_inh_rom(address_space &space, uint16_t offset) override;
virtual void write_inh_rom(address_space &space, uint16_t offset, uint8_t data) override;
virtual uint16_t inh_start() override { return 0x8000; }
virtual uint16_t inh_end() override { return 0xbfff; }
virtual int inh_type() override;
private:
void do_io(int offset);
int m_inh_state;
int m_last_offset;
int m_main_bank;
uint8_t m_ram[32*1024];
};
// device type definition
extern const device_type A2BUS_AGAT7RAM;
#endif /* __A2BUS_AGAT7RAM__ */

View File

@ -111,6 +111,7 @@ enum
XTAL_9_987MHz = 9987000, /* Crazy Balloon */
XTAL_10MHz = 10000000,
XTAL_10_245MHz = 10245000, /* PES Speech box */
XTAL_10_5MHz = 10500000, /* Agat-7 */
XTAL_10_595MHz = 10595000, /* Mad Alien */
XTAL_10_6875MHz = 10687500, /* BBC Bridge Companion */
XTAL_10_69425MHz = 10694250, /* Xerox 820 */
@ -141,6 +142,7 @@ enum
XTAL_13_4952MHz = 13495200, /* Used on Shadow Force pcb and maybe other Technos pcbs? */
XTAL_14MHz = 14000000,
XTAL_14_112MHz = 14112000, /* Timex/Sinclair TS2068 */
XTAL_14_3MHz = 14300000, /* Agat-7 */
XTAL_14_314MHz = 14314000, /* Taito TTL Board */
XTAL_14_31818MHz = 14318181, /* Extremely common, used on 100's of PCBs (4x NTSC subcarrier) */
XTAL_14_705882MHz = 14705882, /* Aleck64 */

1115
src/mame/drivers/agat.cpp Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1605,35 +1605,6 @@ ROM_START(am64)
ROM_LOAD( "tk10.bin", 0x0800, 0x0800, CRC(a06c5b78) SHA1(27c5160b913e0f62120f384026d24b9f1acb6970) )
ROM_END
ROM_START( agat7 )
ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF )
ROM_SYSTEM_BIOS( 0, "v1", "Version 1" )
ROMX_LOAD( "monitor7.rom", 0x3800, 0x0800, CRC(071fda0b) SHA1(6089d46b7addc4e2ae096b2cf81124681bd2b27a), ROM_BIOS(1))
ROM_SYSTEM_BIOS( 1, "v2", "Version 2" )
ROMX_LOAD( "agat_pzu.bin", 0x3800, 0x0800, CRC(c605163d) SHA1(b30fd1b264a347a9de69bb9e3105483254994d06), ROM_BIOS(2))
// Floppy controllers
ROM_LOAD( "shugart7.rom", 0x4500, 0x0100, CRC(c6e4850c) SHA1(71626d3d2d4bbeeac2b77585b45a5566d20b8d34))
ROM_LOAD( "teac.rom", 0x4500, 0x0100, CRC(94266928) SHA1(5d369bad6cdd6a70b0bb16480eba69640de87a2e))
ROM_REGION(0x0800,"gfx1",0)
ROM_LOAD( "agathe7.fnt", 0x0000, 0x0800, CRC(fcffb490) SHA1(0bda26ae7ad75f74da835c0cf6d9928f9508844c))
ROM_END
ROM_START( agat9 )
ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF )
ROM_SYSTEM_BIOS( 0, "v1", "Version 1" )
ROMX_LOAD( "monitor9.rom", 0x3800, 0x0800, CRC(b90bb66a) SHA1(02217f0785913b41fc25eabcff70fa814799c69a), ROM_BIOS(1))
ROM_SYSTEM_BIOS( 1, "v2", "Version 2" )
ROMX_LOAD( "monitor91.rom", 0x3800, 0x0800, CRC(89b10fc1) SHA1(7fe1ede32b5525255f82597ca9c3c2034c5996fa), ROM_BIOS(2))
// Floppy controllers
ROM_LOAD( "shugart9.rom", 0x4500, 0x0100, CRC(964a0ce2) SHA1(bf955189ebffe874c20ef649a3db8177dc16af61))
ROM_LOAD( "teac.rom", 0x4500, 0x0100, CRC(94266928) SHA1(5d369bad6cdd6a70b0bb16480eba69640de87a2e))
// Printer card
ROM_LOAD( "cm6337.rom", 0x8000, 0x0100, CRC(73be16ec) SHA1(ead1abbef5b86f1def0b956147d5b267f0d544b5))
ROM_LOAD( "cm6337p.rom", 0x8100, 0x0800, CRC(9120f11f) SHA1(78107653491e88d5ea12e07367c4c028771a4aca))
ROM_REGION(0x0800,"gfx1",0)
ROM_LOAD( "agathe9.fnt", 0x0000, 0x0800, CRC(8c55c984) SHA1(5a5a202000576b88b4ae2e180dd2d1b9b337b594))
ROM_END
ROM_START(ivelultr)
ROM_REGION(0x2000,"gfx1",0)
ROM_LOAD( "ultra.chr", 0x0000, 0x1000,CRC(fed62c85) SHA1(479fb3f38a3f7332cef2e8c4856871afe8dc6017))
@ -1683,10 +1654,8 @@ COMP( 1982, ace100, apple2, 0, apple2, apple2p, driver_device,
COMP( 1982, uniap2en, apple2, 0, apple2p, apple2p, driver_device, 0, "Unitron Eletronica", "Unitron AP II (in English)", MACHINE_SUPPORTS_SAVE )
COMP( 1982, uniap2pt, apple2, 0, apple2p, apple2p, driver_device, 0, "Unitron Eletronica", "Unitron AP II (in Brazilian Portuguese)", MACHINE_SUPPORTS_SAVE )
COMP( 1984, uniap2ti, apple2, 0, apple2p, apple2p, driver_device, 0, "Unitron Eletronica", "Unitron AP II+ (Teclado Inteligente)", MACHINE_SUPPORTS_SAVE )
COMP( 1983, agat7, apple2, 0, apple2p, apple2p, driver_device, 0, "Agat", "Agat-7", MACHINE_NOT_WORKING) // disk controller ROM JSRs to $FCA8 which is a delay on apple II, illegal instruction crash here :(
// reverse font direction -\/
COMP( 1984, ivelultr, apple2, 0, apple2p, apple2p, driver_device, 0, "Ivasim", "Ivel Ultra", MACHINE_SUPPORTS_SAVE )
COMP( 1984, agat9, apple2, 0, apple2p, apple2p, driver_device, 0, "Agat", "Agat-9", MACHINE_NOT_WORKING)
COMP( 1985, prav8m, apple2, 0, apple2p, apple2p, driver_device, 0, "Pravetz", "Pravetz 8M", MACHINE_SUPPORTS_SAVE )
COMP( 1985, space84, apple2, 0, space84, apple2p, driver_device, 0, "ComputerTechnik/IBS", "Space 84", MACHINE_NOT_WORKING )
COMP( 1985, am64, apple2, 0, space84, apple2p, driver_device, 0, "ASEM", "AM 64", MACHINE_SUPPORTS_SAVE )

View File

@ -910,6 +910,10 @@ wbbc97 // (c) 1997 Comad
@source:age_candy.cpp
age_cand // AGE Candy Crane
@source:agat.cpp
agat7 // Agat-7
agat9 // Agat-9
@source:aim65.cpp
aim65 // Rockwell AIM65
@ -1216,8 +1220,6 @@ apple1 // Jul 1976 Apple 1
@source:apple2.cpp
ace100 // ??? 1982 Franklin Ace 100
agat7 // Agat-7
agat9 // Agat-9
am64 // 1985 ASEM AM 64 (motherboard is marked AM-100 but it boots as "AM 64")
apple2 // Apr 1977 Apple ][
apple2jp // ??? ???? Apple ][j+

View File

@ -17,6 +17,7 @@ aceex.cpp
acrnsys1.cpp
adam.cpp
advision.cpp
agat.cpp
aim65.cpp
aim65_40.cpp
akaiax80.cpp

375
src/mame/video/agat7.cpp Normal file
View File

@ -0,0 +1,375 @@
// license:BSD-3-Clause
// copyright-holders:Sergey Svishchev
/*********************************************************************
agat7video.cpp
Implementation of Agat-7 onboard video.
5 video modes:
- 32x32 color text
- 64x32 mono text with reverse video
- 64x64 color graphics
- 128x128 color graphics
- 256x256 mono graphics
Character generator ROM could have 128 or 256 chars.
C7xx: video mode select
*********************************************************************/
#include "video/agat7.h"
#include "screen.h"
/***************************************************************************
PARAMETERS
***************************************************************************/
//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
const device_type AGAT7VIDEO = device_creator<agat7video_device>;
MACHINE_CONFIG_FRAGMENT(agat7video)
MCFG_SCREEN_ADD("a7screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(XTAL_10_5MHz, 672, 0, 512, 312, 0, 256)
MCFG_SCREEN_UPDATE_DRIVER(agat7video_device, screen_update)
MCFG_SCREEN_PALETTE("a7palette")
MCFG_PALETTE_ADD("a7palette", 16)
MCFG_PALETTE_INIT_OWNER(agat7video_device, agat7)
MACHINE_CONFIG_END
/***************************************************************************
FUNCTION PROTOTYPES
***************************************************************************/
//-------------------------------------------------
// machine_config_additions - device-specific
// machine configurations
//-------------------------------------------------
machine_config_constructor agat7video_device::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( agat7video );
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
agat7video_device::agat7video_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, AGAT7VIDEO, "Agat-7 video", tag, owner, clock, "agat7video", __FILE__),
m_palette(*this, "a7palette")
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void agat7video_device::device_start()
{
// save_item(NAME(m_video_mode));
save_item(NAME(m_start_address));
}
void agat7video_device::device_reset()
{
// XXX to be confirmed
m_video_mode = TEXT_LORES;
m_start_address = 0x7800;
}
READ8_MEMBER(agat7video_device::read)
{
do_io(offset);
return 0;
}
WRITE8_MEMBER(agat7video_device::write)
{
do_io(offset);
}
void agat7video_device::do_io(int offset)
{
switch (offset & 3)
{
case 0:
m_video_mode = GRAPHICS_LORES;
m_start_address = (offset) << 9;
logerror("offset %04X, video mode 0 (GRAPHICS_LORES)\n", m_start_address);
break;
case 1:
m_video_mode = GRAPHICS_HIRES;
m_start_address = ((offset & 0x3f) - 0x01) << 9;
logerror("offset %04X, video mode 1 (GRAPHICS_HIRES)\n", m_start_address);
break;
case 2:
if (offset > 0x80) {
m_video_mode = TEXT_HIRES;
m_start_address = (offset - 0x82) << 9;
logerror("offset %04X, video mode 2 (TEXT_HIRES)\n", m_start_address);
} else {
m_video_mode = TEXT_LORES;
m_start_address = (offset - 0x02) << 9;
logerror("offset %04X, video mode 2 (TEXT_LORES)\n", m_start_address);
}
break;
case 3:
m_video_mode = GRAPHICS_MONO;
m_start_address = ((offset & 0x3f) - 0x03) << 9;
logerror("offset %04X, video mode 3 (GRAPHICS_MONO)\n", m_start_address);
break;
}
}
void agat7video_device::plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code,
const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg)
{
int x, y, i;
const uint8_t *chardata;
uint16_t color;
/* look up the character data */
chardata = &textgfx_data[(code * 8)];
for (y = 0; y < 8; y++)
{
for (x = 0; x < 8; x++)
{
color = (chardata[y] & (1 << (7-x))) ? fg : bg;
for (i = 0; i < xscale; i++)
{
bitmap.pix16(ypos + y, xpos + (x * xscale) + i) = color;
}
}
}
}
void agat7video_device::text_update_lores(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow)
{
int row, col;
uint32_t address;
uint8_t ch, attr;
int fg = 0;
int bg = 0;
beginrow = std::max(beginrow, cliprect.min_y - (cliprect.min_y % 8));
endrow = std::min(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7);
for (row = beginrow; row <= endrow; row += 8)
{
for (col = 0; col < 32; col++)
{
/* calculate address */
address = m_start_address + (col * 2) + (row * 8);
ch = m_ram_dev->read(address);
attr = m_ram_dev->read(address + 1);
if (BIT(attr, 5)) {
fg = BITSWAP8(attr,7,6,5,3,4,2,1,0) & 15;
bg = 0;
} else {
fg = 0;
bg = BITSWAP8(attr,7,6,5,3,4,2,1,0) & 15;
}
plot_text_character(bitmap, col * 16, row, 2, ch, m_char_ptr, m_char_size, fg, bg);
}
}
}
void agat7video_device::text_update_hires(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow)
{
int row, col;
uint32_t address;
uint8_t ch;
int fg, bg;
beginrow = std::max(beginrow, cliprect.min_y - (cliprect.min_y % 8));
endrow = std::min(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7);
if (m_start_address & 0x800) {
fg = 7; bg = 0;
} else {
fg = 0; bg = 7;
}
for (row = beginrow; row <= endrow; row += 8)
{
for (col = 0; col < 64; col++)
{
/* calculate address */
address = m_start_address + col + (row * 8);
ch = m_ram_dev->read(address);
plot_text_character(bitmap, col * 8, row, 1, ch, m_char_ptr, m_char_size, fg, bg);
}
}
}
void agat7video_device::graph_update_mono(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow)
{
int row, col, b;
uint32_t address;
uint16_t *p;
uint8_t gfx, v;
int fg = 7, bg = 0;
beginrow = std::max(beginrow, cliprect.min_y - (cliprect.min_y % 8));
endrow = std::min(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7);
for (row = beginrow; row <= endrow; row++)
{
p = &bitmap.pix16(row);
for (col = 0; col < 32; col++)
{
address = m_start_address + col + (row * 0x20);
gfx = m_ram_dev->read(address);
for (b = 0; b < 8; b++)
{
v = (gfx & 0x80);
gfx <<= 1;
*(p++) = v ? fg : bg;
*(p++) = v ? fg : bg;
}
}
}
}
void agat7video_device::graph_update_hires(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow)
{
int row, col, b;
uint32_t address;
uint16_t *p;
uint8_t gfx, v;
beginrow = std::max(beginrow, cliprect.min_y - (cliprect.min_y % 8));
endrow = std::min(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7);
for (row = beginrow; row <= endrow; row++)
{
p = &bitmap.pix16(row);
for (col = 0; col < 0x40; col++)
{
address = m_start_address + col + ((row/2) * 0x40);
gfx = m_ram_dev->read(address);
for (b = 0; b < 2; b++)
{
v = (gfx & 0xf0) >> 4;
gfx <<= 4;
*(p++) = v;
*(p++) = v;
*(p++) = v;
*(p++) = v;
}
}
}
}
void agat7video_device::graph_update_lores(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow)
{
int row, col, b;
uint32_t address;
uint16_t *p;
uint8_t gfx, v;
beginrow = std::max(beginrow, cliprect.min_y - (cliprect.min_y % 8));
endrow = std::min(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7);
for (row = beginrow; row <= endrow; row++)
{
p = &bitmap.pix16(row);
for (col = 0; col < 0x20; col++)
{
address = m_start_address + col + ((row/4) * 0x20);
gfx = m_ram_dev->read(address);
for (b = 0; b < 2; b++)
{
v = (gfx & 0xf0) >> 4;
gfx <<= 4;
*(p++) = v;
*(p++) = v;
*(p++) = v;
*(p++) = v;
*(p++) = v;
*(p++) = v;
*(p++) = v;
*(p++) = v;
}
}
}
}
uint32_t agat7video_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
switch (m_video_mode)
{
case TEXT_LORES:
text_update_lores(screen, bitmap, cliprect, 0, 255);
break;
case TEXT_HIRES:
text_update_hires(screen, bitmap, cliprect, 0, 255);
break;
case GRAPHICS_MONO:
graph_update_mono(screen, bitmap, cliprect, 0, 255);
break;
case GRAPHICS_LORES:
graph_update_lores(screen, bitmap, cliprect, 0, 255);
break;
case GRAPHICS_HIRES:
graph_update_hires(screen, bitmap, cliprect, 0, 255);
break;
default:
graph_update_mono(screen, bitmap, cliprect, 0, 255);
break;
}
return 0;
}
// per http://agatcomp.ru/Reading/IiO/87-2-077.djvu
static const rgb_t agat7_palette[] =
{
rgb_t::black(),
rgb_t(0xFF, 0x00, 0x00), /* White */
rgb_t(0x00, 0xFF, 0x00), /* White */
rgb_t(0xFF, 0xFF, 0x00), /* White */
rgb_t(0x00, 0x00, 0xFF), /* White */
rgb_t(0xFF, 0x00, 0xFF), /* White */
rgb_t(0xFF, 0xFF, 0x00), /* White */
rgb_t(0xFF, 0xFF, 0xFF), /* White */
rgb_t::black(),
rgb_t(0x7F, 0x00, 0x00), /* White */
rgb_t(0x00, 0x7F, 0x00), /* White */
rgb_t(0x7F, 0x7F, 0x00), /* White */
rgb_t(0x00, 0x00, 0x7F), /* White */
rgb_t(0x7F, 0x00, 0x7F), /* White */
rgb_t(0x7F, 0x7F, 0x00), /* White */
rgb_t(0x7F, 0x7F, 0x7F) /* White */
};
PALETTE_INIT_MEMBER(agat7video_device, agat7)
{
palette.set_pen_colors(0, agat7_palette, ARRAY_LENGTH(agat7_palette));
}

75
src/mame/video/agat7.h Normal file
View File

@ -0,0 +1,75 @@
// license:BSD-3-Clause
// copyright-holders:Sergey Svishchev
/*********************************************************************
agat7video.h
Implementation of Agat-7 onboard video.
*********************************************************************/
#ifndef __AGAT7VIDEO__
#define __AGAT7VIDEO__
#include "emu.h"
#include "machine/ram.h"
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
class agat7video_device:
public device_t
{
public:
// construction/destruction
agat7video_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// optional information overrides
virtual machine_config_constructor device_mconfig_additions() const override;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_PALETTE_INIT(agat7);
DECLARE_READ8_MEMBER(read);
DECLARE_WRITE8_MEMBER(write);
ram_device *m_ram_dev;
uint8_t *m_char_ptr;
int m_char_size;
protected:
virtual void device_start() override;
virtual void device_reset() override;
void text_update_lores(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow);
void text_update_hires(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow);
void graph_update_mono(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow);
void graph_update_lores(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow);
void graph_update_hires(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow);
private:
void do_io(int offset);
uint32_t m_start_address;
enum {
TEXT_LORES = 0,
TEXT_HIRES,
GRAPHICS_LORES,
GRAPHICS_HIRES,
GRAPHICS_MONO
} m_video_mode;
void plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg);
public:
required_device<palette_device> m_palette;
};
// device type definition
extern const device_type AGAT7VIDEO;
#endif /* __AGAT7VIDEO__ */