summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/z9001.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/drivers/z9001.cpp')
-rw-r--r--src/mame/drivers/z9001.cpp47
1 files changed, 28 insertions, 19 deletions
diff --git a/src/mame/drivers/z9001.cpp b/src/mame/drivers/z9001.cpp
index f6950922c38..d0efb50e363 100644
--- a/src/mame/drivers/z9001.cpp
+++ b/src/mame/drivers/z9001.cpp
@@ -1,14 +1,19 @@
// license:BSD-3-Clause
// copyright-holders:Miodrag Milanovic , Robbbert
-/***************************************************************************
+/*************************************************************************************
- Robotron Z9001 (KC85/1)
+Robotron Z9001 (KC85/1)
- 12/05/2009 Skeleton driver.
- 13/07/2011 Notes added. You can enter text via terminal input.
- Colour and flashing added.
+2009-05-12 Skeleton driver.
+2011-07-13 Notes added. You can enter text via terminal input.
+ Colour and flashing added.
+2019-06-13 Basic enabled
-The only kind of acceptable input is a filename that is in 8.3 format and
+All input should be in UPPER case.
+
+For KC87_10/11/20/21, type BASIC to start Basic.
+
+The only other kind of acceptable input is a filename that is in 8.3 format and
begins with a letter. It will say 'start tape'. You can press ^C here to
escape, or any key to continue.
@@ -21,11 +26,14 @@ Some other control keys:
ToDo:
-- cassette in
-- proper keyboard
+- cassette in - interrupt-driven via PIO1
+ via astb should cause interrupt but nothing happens.
+- proper keyboard - interrupt-driven via PIO2
+ pressing any key should program ctc/2 to a debounce delay and this then causes
+ another interrupt which reads keyboard and places ascii character at 0x0025.
- get rid of temporary code
-****************************************************************************/
+**************************************************************************************/
#include "emu.h"
#include "cpu/z80/z80.h"
@@ -87,6 +95,7 @@ void z9001_state::z9001_mem(address_map &map)
map.unmap_value_high();
map(0x0000, 0xe7ff).ram();
map(0xe800, 0xebff).ram().share("colorram");
+ map(0xc000, 0xe7ff).rom();
map(0xec00, 0xefff).ram().share("videoram");
map(0xf000, 0xffff).rom();
}
@@ -95,9 +104,9 @@ void z9001_state::z9001_io(address_map &map)
{
map.unmap_value_high();
map.global_mask(0xff);
- map(0x80, 0x83).mirror(4).rw("z80ctc", FUNC(z80ctc_device::read), FUNC(z80ctc_device::write));
- map(0x88, 0x8B).mirror(4).rw("z80pio1", FUNC(z80pio_device::read), FUNC(z80pio_device::write));
- map(0x90, 0x93).mirror(4).rw("z80pio2", FUNC(z80pio_device::read), FUNC(z80pio_device::write));
+ map(0x80, 0x83).mirror(4).rw("ctc", FUNC(z80ctc_device::read), FUNC(z80ctc_device::write));
+ map(0x88, 0x8B).mirror(4).rw("pio1", FUNC(z80pio_device::read), FUNC(z80pio_device::write));
+ map(0x90, 0x93).mirror(4).rw("pio2", FUNC(z80pio_device::read), FUNC(z80pio_device::write));
}
/* Input ports */
@@ -106,9 +115,9 @@ INPUT_PORTS_END
static const z80_daisy_config z9001_daisy_chain[] =
{
- { "z80pio2" },
- { "z80pio1" },
- { "z80ctc" },
+ { "pio2" },
+ { "pio1" },
+ { "ctc" },
{ nullptr }
};
@@ -236,17 +245,17 @@ void z9001_state::z9001(machine_config &config)
keyboard.set_keyboard_callback(FUNC(z9001_state::kbd_put));
TIMER(config, "z9001_timer").configure_periodic(FUNC(z9001_state::timer_callback), attotime::from_msec(10));
- z80pio_device& pio1(Z80PIO(config, "z80pio1", XTAL(9'830'400) / 4));
+ z80pio_device& pio1(Z80PIO(config, "pio1", XTAL(9'830'400) / 4));
pio1.out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0);
pio1.out_pa_callback().set(FUNC(z9001_state::port88_w));
- z80pio_device& pio2(Z80PIO(config, "z80pio2", XTAL(9'830'400) / 4)); // keyboard PIO
+ z80pio_device& pio2(Z80PIO(config, "pio2", XTAL(9'830'400) / 4)); // keyboard PIO
pio2.out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0);
- z80ctc_device& ctc(Z80CTC(config, "z80ctc", XTAL(9'830'400) / 4));
+ z80ctc_device& ctc(Z80CTC(config, "ctc", XTAL(9'830'400) / 4));
ctc.intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0);
ctc.zc_callback<0>().set(FUNC(z9001_state::cass_w));
- ctc.zc_callback<2>().set("z80ctc", FUNC(z80ctc_device::trg3));
+ ctc.zc_callback<2>().set("ctc", FUNC(z80ctc_device::trg3));
CASSETTE(config, m_cass);
}
nt.Hashbang */ .highlight .cm { color: #8f5902; font-style: italic } /* Comment.Multiline */ .highlight .cp { color: #8f5902; font-style: italic } /* Comment.Preproc */ .highlight .cpf { color: #8f5902; font-style: italic } /* Comment.PreprocFile */ .highlight .c1 { color: #8f5902; font-style: italic } /* Comment.Single */ .highlight .cs { color: #8f5902; font-style: italic } /* Comment.Special */ .highlight .gd { color: #a40000 } /* Generic.Deleted */ .highlight .ge { color: #000000; font-style: italic } /* Generic.Emph */ .highlight .gr { color: #ef2929 } /* Generic.Error */ .highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ .highlight .gi { color: #00A000 } /* Generic.Inserted */ .highlight .go { color: #000000; font-style: italic } /* Generic.Output */ .highlight .gp { color: #8f5902 } /* Generic.Prompt */ .highlight .gs { color: #000000; font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ .highlight .gt { color: #a40000; font-weight: bold } /* Generic.Traceback */ .highlight .kc { color: #204a87; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #204a87; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #204a87; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #204a87; font-weight: bold } /* Keyword.Pseudo */ .highlight .kr { color: #204a87; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #204a87; font-weight: bold } /* Keyword.Type */ .highlight .ld { color: #000000 } /* Literal.Date */ .highlight .m { color: #0000cf; font-weight: bold } /* Literal.Number */ .highlight .s { color: #4e9a06 } /* Literal.String */ .highlight .na { color: #c4a000 } /* Name.Attribute */ .highlight .nb { color: #204a87 } /* Name.Builtin */ .highlight .nc { color: #000000 } /* Name.Class */ .highlight .no { color: #000000 } /* Name.Constant */ .highlight .nd { color: #5c35cc; font-weight: bold } /* Name.Decorator */ .highlight .ni { color: #ce5c00 } /* Name.Entity */ .highlight .ne { color: #cc0000; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #000000 } /* Name.Function */ .highlight .nl { color: #f57900 } /* Name.Label */ .highlight .nn { color: #000000 } /* Name.Namespace */ .highlight .nx { color: #000000 } /* Name.Other */ .highlight .py { color: #000000 } /* Name.Property */ .highlight .nt { color: #204a87; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #000000 } /* Name.Variable */ .highlight .ow { color: #204a87; font-weight: bold } /* Operator.Word */ .highlight .pm { color: #000000; font-weight: bold } /* Punctuation.Marker */ .highlight .w { color: #f8f8f8 } /* Text.Whitespace */ .highlight .mb { color: #0000cf; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000cf; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000cf; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000cf; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000cf; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #4e9a06 } /* Literal.String.Affix */ .highlight .sb { color: #4e9a06 } /* Literal.String.Backtick */ .highlight .sc { color: #4e9a06 } /* Literal.String.Char */ .highlight .dl { color: #4e9a06 } /* Literal.String.Delimiter */ .highlight .sd { color: #8f5902; font-style: italic } /* Literal.String.Doc */ .highlight .s2 { color: #4e9a06 } /* Literal.String.Double */ .highlight .se { color: #4e9a06 } /* Literal.String.Escape */ .highlight .sh { color: #4e9a06 } /* Literal.String.Heredoc */ .highlight .si { color: #4e9a06 } /* Literal.String.Interpol */ .highlight .sx { color: #4e9a06 } /* Literal.String.Other */ .highlight .sr { color: #4e9a06 } /* Literal.String.Regex */ .highlight .s1 { color: #4e9a06 } /* Literal.String.Single */ .highlight .ss { color: #4e9a06 } /* Literal.String.Symbol */ .highlight .bp { color: #3465a4 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #000000 } /* Name.Function.Magic */ .highlight .vc { color: #000000 } /* Name.Variable.Class */ .highlight .vg { color: #000000 } /* Name.Variable.Global */ .highlight .vi { color: #000000 } /* Name.Variable.Instance */ .highlight .vm { color: #000000 } /* Name.Variable.Magic */ .highlight .il { color: #0000cf; font-weight: bold } /* Literal.Number.Integer.Long */
/******************************************************************************

    Gomoku Narabe Renju
    (c)1981 Nihon Bussan Co.,Ltd.

    Driver by Takahiro Nogi <nogi@kt.rim.or.jp> 1999/11/06 -
    Updated to compile again by David Haywood 19th Oct 2002

******************************************************************************/
/******************************************************************************

todo:

- BG(Go table) is generated by board circuitry, so not fully emulated.

- Couldn't figure out the method to specify palette, so I modified palette number manually.

- Couldn't figure out oneshot sound playback parameter. so I adjusted it manually.

******************************************************************************/

#include "driver.h"
#include "cpu/z80/z80.h"
#include "sound/custom.h"


extern PALETTE_INIT( gomoku );
extern VIDEO_START( gomoku );
extern VIDEO_UPDATE( gomoku );

extern WRITE8_HANDLER( gomoku_videoram_w );
extern WRITE8_HANDLER( gomoku_colorram_w );
extern WRITE8_HANDLER( gomoku_bgram_w );
extern WRITE8_HANDLER( gomoku_flipscreen_w );
extern WRITE8_HANDLER( gomoku_bg_dispsw_w );

extern UINT8 *gomoku_videoram;
extern UINT8 *gomoku_colorram;
extern UINT8 *gomoku_bgram;

extern UINT8 *gomoku_soundregs1;
extern UINT8 *gomoku_soundregs2;
extern WRITE8_HANDLER( gomoku_sound1_w );
extern WRITE8_HANDLER( gomoku_sound2_w );

extern void *gomoku_sh_start(int clock, const struct CustomSound_interface *config);

/* input ports are rotated 90 degrees */
static READ8_HANDLER( input_port_r )
{
	int i, res;

	res = 0;
	for (i = 0; i < 8; i++)
		res |= ((readinputport(i) >> offset) & 1) << i;

	return res;
}


static ADDRESS_MAP_START( readmem_gomoku, ADDRESS_SPACE_PROGRAM, 8 )
	AM_RANGE(0x0000, 0x47ff) AM_READ(MRA8_ROM)
	AM_RANGE(0x4800, 0x4fff) AM_READ(MRA8_RAM)
	AM_RANGE(0x5000, 0x53ff) AM_READ(MRA8_RAM)
	AM_RANGE(0x5400, 0x57ff) AM_READ(MRA8_RAM)
	AM_RANGE(0x5800, 0x58ff) AM_READ(MRA8_RAM)
	AM_RANGE(0x7800, 0x7807) AM_READ(input_port_r)
ADDRESS_MAP_END

static ADDRESS_MAP_START( writemem_gomoku, ADDRESS_SPACE_PROGRAM, 8 )
	AM_RANGE(0x0000, 0x47ff) AM_WRITE(MWA8_ROM)
	AM_RANGE(0x4800, 0x4fff) AM_WRITE(MWA8_RAM)
	AM_RANGE(0x5000, 0x53ff) AM_WRITE(gomoku_videoram_w) AM_BASE(&gomoku_videoram)
	AM_RANGE(0x5400, 0x57ff) AM_WRITE(gomoku_colorram_w) AM_BASE(&gomoku_colorram)
	AM_RANGE(0x5800, 0x58ff) AM_WRITE(gomoku_bgram_w) AM_BASE(&gomoku_bgram)
	AM_RANGE(0x6000, 0x601f) AM_WRITE(gomoku_sound1_w) AM_BASE(&gomoku_soundregs1)
	AM_RANGE(0x6800, 0x681f) AM_WRITE(gomoku_sound2_w) AM_BASE(&gomoku_soundregs2)
	AM_RANGE(0x7000, 0x7000) AM_WRITE(MWA8_NOP)
	AM_RANGE(0x7001, 0x7001) AM_WRITE(gomoku_flipscreen_w)
	AM_RANGE(0x7002, 0x7002) AM_WRITE(gomoku_bg_dispsw_w)
	AM_RANGE(0x7003, 0x7007) AM_WRITE(MWA8_NOP)
	AM_RANGE(0x7800, 0x7800) AM_WRITE(MWA8_NOP)
ADDRESS_MAP_END


static INPUT_PORTS_START( gomoku )
	PORT_START	/* 0 */
	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP )
	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN )
	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT )
	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT )
	PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_COCKTAIL
	PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_COCKTAIL
	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_COCKTAIL
	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL

	PORT_START	/* 1 */
	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 )
	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL
	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )
	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START2 )
	PORT_DIPNAME (0x10, 0x10, DEF_STR( Cabinet ) )
	PORT_DIPSETTING(    0x10, DEF_STR( Upright ) )
	PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
	PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN3 )	/* service coin */
	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN1 )
	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN2 )

	PORT_START	/* 2 */
	PORT_SERVICE( 0x01, IP_ACTIVE_HIGH )
	PORT_DIPNAME( 0x06, 0x00, DEF_STR( Lives ))
	PORT_DIPSETTING(    0x00, "2" )
	PORT_DIPSETTING(    0x02, "4" )
	PORT_DIPSETTING(    0x04, "3" )
	PORT_DIPSETTING(    0x06, "5" )
	PORT_DIPNAME( 0x08, 0x00, "Time" )
	PORT_DIPSETTING(    0x00, "60" )
	PORT_DIPSETTING(    0x08, "80" )
	PORT_DIPNAME( 0x30, 0x00, DEF_STR( Coin_A ) )
	PORT_DIPSETTING(    0x10, DEF_STR( 3C_1C ) )
	PORT_DIPSETTING(    0x20, DEF_STR( 2C_1C ) )
	PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
	PORT_DIPSETTING(    0x30, DEF_STR( Free_Play ) )
	PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Coin_B ) )
	PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
	PORT_DIPSETTING(    0x80, DEF_STR( 1C_2C ) )
	PORT_DIPSETTING(    0x40, DEF_STR( 1C_3C ) )
	PORT_DIPSETTING(    0xc0, DEF_STR( 1C_4C ) )

	PORT_START	/* 3 */
	PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )

	PORT_START	/* 4 */
	PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )

	PORT_START	/* 5 */
	PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )

	PORT_START	/* 6 */
	PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )

	PORT_START	/* 7 */
	PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
INPUT_PORTS_END


static const gfx_layout charlayout =
{
	8, 8,		/* 8*8 characters */
	256,		/* 256 characters */
	2,			/* 2 bits per pixel */
	{ 0, 4 },	/* the two bitplanes are packed in one byte */
	{ 0, 1, 2, 3, 8+0, 8+1, 8+2, 8+3 },
	{ 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 },
	16*8		/* every char takes 16 consecutive bytes */
};

static GFXDECODE_START( gomoku )
	GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout, 0, 32 )
GFXDECODE_END


static const struct CustomSound_interface custom_interface =
{
	gomoku_sh_start
};

static MACHINE_DRIVER_START( gomoku )
	/* basic machine hardware */
	MDRV_CPU_ADD(Z80, 18432000/12)		 /* 1.536 MHz ? */
	MDRV_CPU_PROGRAM_MAP(readmem_gomoku, writemem_gomoku)
	MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)

	MDRV_SCREEN_REFRESH_RATE(60)
	MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)

	/* video hardware */
	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER )
	MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
	MDRV_SCREEN_SIZE(256, 256)
	MDRV_SCREEN_VISIBLE_AREA(0, 256-1, 16, 256-16-1)
	MDRV_GFXDECODE(gomoku)
	MDRV_PALETTE_LENGTH(64)

	MDRV_PALETTE_INIT(gomoku)
	MDRV_VIDEO_START(gomoku)
	MDRV_VIDEO_UPDATE(gomoku)

	/* sound hardware */
	MDRV_SPEAKER_STANDARD_MONO("mono")

	MDRV_SOUND_ADD(CUSTOM, 0)
	MDRV_SOUND_CONFIG(custom_interface)
	MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MACHINE_DRIVER_END


ROM_START( gomoku )
	ROM_REGION( 0x10000, REGION_CPU1, 0 )	// program
	ROM_LOAD( "rj_1.7a",    0x0000, 0x1000, CRC(ed20d539) SHA1(7cbbc678cbe5c85b914ca44f82bdbd452cf694a0) )
	ROM_LOAD( "rj_2.7c",    0x1000, 0x1000, CRC(26a28516) SHA1(53d5d134cd91020fa06e380d355deb1df6b9cb6e) )
	ROM_LOAD( "rj_3.7d",    0x2000, 0x1000, CRC(d05db072) SHA1(9697c932c6dcee6f8536c9f0b3c84a719a7d3dee) )
	ROM_LOAD( "rj_4.7f",    0x3000, 0x1000, CRC(6e3d1c18) SHA1(e2f7e4c0de3c78d1b8e686152458972f996b023a) )
	ROM_LOAD( "rj_5.4e",    0x4000, 0x0800, CRC(eaf541b4) SHA1(bc7e7ec1ba68f71ab9ac86f9ae77971ddb9ce3a4) )

	ROM_REGION( 0x1000, REGION_GFX1, ROMREGION_DISPOSE )	// text char
	ROM_LOAD( "rj_6.4r",    0x0000, 0x1000, CRC(ed26ae36) SHA1(61cb73d7f2568e88e1c2981e7af3e9a3b26797d3) )

	ROM_REGION( 0x1000, REGION_SOUND1, 0 )	// sound
	ROM_LOAD( "rj_7.3c",    0x0000, 0x1000, CRC(d1ed1365) SHA1(4ef08f26fe7df4c400f72e09e56d8825d584f55f) )

	ROM_REGION( 0x0040, REGION_PROMS, 0 )
	ROM_LOAD( "rj_prom.1m", 0x0000, 0x0020, CRC(5da2f2bd) SHA1(4355ccf06cb09ec3240dc92bda19b1f707a010ef) )	// TEXT color
	ROM_LOAD( "rj_prom.1l", 0x0020, 0x0020, CRC(fe4ef393) SHA1(d4c63f8645afeadd13ff82087bcc497d8936d90b) )	// BG color

	ROM_REGION( 0x0100, REGION_USER1, 0 )	// BG draw data X
	ROM_LOAD( "rj_prom.8n", 0x0000, 0x0100, CRC(9ba43222) SHA1(a443df49d7ee9dbfd258b09731d392bf1249cbfa) )

	ROM_REGION( 0x0100, REGION_USER2, 0 )	// BG draw data Y
	ROM_LOAD( "rj_prom.7p", 0x0000, 0x0100, CRC(5b5464f8) SHA1(b945efb8a7233f501d67f6b1be4e9d4967dc6719) )

	ROM_REGION( 0x0100, REGION_USER3, 0 )	// BG character data
	ROM_LOAD( "rj_prom.7r", 0x0000, 0x0100, CRC(3004585a) SHA1(711b68140827f0f3dc71f2576fcf9b905c999e8d) )

	ROM_REGION( 0x0020, REGION_USER4, 0 )	// unknown
	ROM_LOAD( "rj_prom.9k", 0x0000, 0x0020, CRC(cff72923) SHA1(4f61375028ab62da46ed119bc81052f5f98c28d4) )
ROM_END


//    YEAR,     NAME,   PARENT,  MACHINE,    INPUT,     INIT,    MONITOR,      COMPANY, FULLNAME
GAME( 1981,   gomoku,        0,   gomoku,   gomoku,        0,      ROT90, "Nichibutsu", "Gomoku Narabe Renju", 0 )