summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2018-08-22 19:13:42 -0400
committer AJR <ajrhacker@users.noreply.github.com>2018-08-22 19:13:42 -0400
commit0fe073225c589ad0848621ec9e5e5fad86205193 (patch)
treec557321b6f796cca9b08ca3d1ff0bdef4ca6e642 /src/mame
parent56ee4e784c8a30244700f25ae5cd2b3d197aa5c5 (diff)
unistar.cpp: Correct video configuration; add DMAC; remove MCFG_ (nw)
Diffstat (limited to 'src/mame')
-rw-r--r--src/mame/drivers/unistar.cpp73
1 files changed, 51 insertions, 22 deletions
diff --git a/src/mame/drivers/unistar.cpp b/src/mame/drivers/unistar.cpp
index 8f96a99ac28..bca0b614de4 100644
--- a/src/mame/drivers/unistar.cpp
+++ b/src/mame/drivers/unistar.cpp
@@ -13,7 +13,9 @@
#include "emu.h"
#include "cpu/i8085/i8085.h"
#include "machine/am9513.h"
+#include "machine/am9517a.h"
#include "machine/i8255.h"
+#include "machine/input_merger.h"
#include "video/i8275.h"
#include "emupal.h"
#include "screen.h"
@@ -30,6 +32,9 @@ public:
void unistar(machine_config &config);
private:
+ u8 dma_mem_r(offs_t offset);
+ void dma_mem_w(offs_t offset, u8 data);
+
DECLARE_PALETTE_INIT(unistar);
I8275_DRAW_CHARACTER_MEMBER(draw_character);
@@ -42,17 +47,28 @@ private:
};
+u8 unistar_state::dma_mem_r(offs_t offset)
+{
+ return m_maincpu->space(AS_PROGRAM).read_byte(offset);
+}
+
+void unistar_state::dma_mem_w(offs_t offset, u8 data)
+{
+ m_maincpu->space(AS_PROGRAM).write_byte(offset, data);
+}
+
void unistar_state::unistar_mem(address_map &map)
{
map.unmap_value_high();
map(0x0000, 0x2fff).rom();
- map(0x8000, 0x8fff).ram();
+ map(0x8000, 0x97ff).ram();
}
void unistar_state::unistar_io(address_map &map)
{
//ADDRESS_MAP_UNMAP_HIGH
map.global_mask(0xff);
+ map(0x00, 0x0f).rw("dmac", FUNC(am9517a_device::read), FUNC(am9517a_device::write));
map(0x84, 0x84).portr("CONFIG");
map(0x8c, 0x8d).rw("stc", FUNC(am9513_device::read8), FUNC(am9513_device::write8));
map(0x94, 0x97).rw("ppi", FUNC(i8255_device::read), FUNC(i8255_device::write));
@@ -104,32 +120,45 @@ static GFXDECODE_START( gfx_unistar )
GFXDECODE_ENTRY( "chargen", 0x0000, unistar_charlayout, 0, 1 )
GFXDECODE_END
-MACHINE_CONFIG_START(unistar_state::unistar)
+void unistar_state::unistar(machine_config &config)
+{
/* basic machine hardware */
- MCFG_DEVICE_ADD("maincpu", I8085A, 20_MHz_XTAL / 2)
- MCFG_DEVICE_PROGRAM_MAP(unistar_mem)
- MCFG_DEVICE_IO_MAP(unistar_io)
+ I8085A(config, m_maincpu, 20_MHz_XTAL / 2);
+ m_maincpu->set_addrmap(AS_PROGRAM, &unistar_state::unistar_mem);
+ m_maincpu->set_addrmap(AS_IO, &unistar_state::unistar_io);
+
+ INPUT_MERGER_ANY_HIGH(config, "rst75").output_handler().set_inputline(m_maincpu, I8085_RST75_LINE);
- AM9513(config, "stc", 8_MHz_XTAL).fout_cb().set("stc", FUNC(am9513_device::source1_w));
+ am9517a_device &dmac(AM9517A(config, "dmac", 20_MHz_XTAL / 4)); // Intel P8237A-5
+ dmac.out_hreq_callback().set_inputline(m_maincpu, INPUT_LINE_HALT);
+ dmac.out_hreq_callback().append("dmac", FUNC(am9517a_device::hack_w));
+ dmac.out_eop_callback().set("rst75", FUNC(input_merger_device::in_w<1>));
+ dmac.in_memr_callback().set(FUNC(unistar_state::dma_mem_r));
+ dmac.out_memw_callback().set(FUNC(unistar_state::dma_mem_w));
+ dmac.out_iow_callback<2>().set("crtc", FUNC(i8275_device::dack_w));
- MCFG_DEVICE_ADD("ppi", I8255A, 0)
+ am9513_device &stc(AM9513(config, "stc", 8_MHz_XTAL));
+ stc.fout_cb().set("stc", FUNC(am9513_device::source1_w));
+ // TODO: figure out what OUT1-OUT4 should do (timer 5 is unused)
+
+ I8255A(config, "ppi");
/* video hardware */
- MCFG_SCREEN_ADD("screen", RASTER)
- MCFG_SCREEN_REFRESH_RATE(50)
- MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
- MCFG_SCREEN_SIZE(640, 480)
- MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
- MCFG_SCREEN_UPDATE_DEVICE("crtc", i8275_device, screen_update)
-
- MCFG_DEVICE_ADD("crtc", I8275, 20_MHz_XTAL / 8.5) // clock is probably wrong
- MCFG_I8275_CHARACTER_WIDTH(8)
- MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(unistar_state, draw_character)
-
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_unistar)
- MCFG_PALETTE_ADD("palette", 3)
- MCFG_PALETTE_INIT_OWNER(unistar_state, unistar)
-MACHINE_CONFIG_END
+ screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
+ screen.set_raw(20_MHz_XTAL, 954, 0, 720, 351, 0, 325);
+ //screen.set_raw(20_MHz_XTAL, 990, 0, 720, 405, 0, 375);
+ screen.set_screen_update("crtc", FUNC(i8275_device::screen_update));
+
+ i8275_device &crtc(I8275(config, "crtc", 20_MHz_XTAL / 9));
+ crtc.set_character_width(9);
+ crtc.set_display_callback(FUNC(unistar_state::draw_character), this);
+ crtc.set_screen("screen");
+ crtc.drq_wr_callback().set("dmac", FUNC(am9517a_device::dreq2_w));
+ crtc.irq_wr_callback().set("rst75", FUNC(input_merger_device::in_w<0>));
+
+ GFXDECODE(config, "gfxdecode", "palette", gfx_unistar);
+ PALETTE(config, "palette", 3).set_init(FUNC(unistar_state::palette_init_unistar));
+}
/* ROM definition */
ROM_START( unistar )