/*
Super Othello (c)1986 Fujiwara/Success
driver by Tomasz Slanina
1 2 3 4 5 6 7 8 9 10 11 12
+---------------------------------------------------------------------------------+
| |
+-+ LA460 LA6324 M5205 X3 Z80A 1 2 5816P 74374 74138 | A
| |
| |
+-+ 74367 Y3014 74174 74174 7404 7474 74138 7404 7432 | B
| |
| |
| 74367 DSW1 YM2203 Z80A 3 4 5 6264 | C
| J |
| A |
| M C1663 74367 DSW2 7408 74125 7404 74138 74139 74174 7408 | D
| M X2 7414 7474 |
| A |
| C1663 V9938 41464 41464 X1 7474 74139 7432 74157 74244 7432 | E
| |
| |
+-+ C1663 41464 41464 6809B 6 6264 6264 6264 74244 74245 | F
| |
| |
+-+ C1663 | H
| |
+---------------------------------------------------------------------------------+
CPU : Z80A(x2) 68B09
Sound: YM2203?(surface scrached) + M5205
OSC : 8.0000MHz(X1) 21.477 MHz(X2) 384kHz(X3)
*/
#include "driver.h"
#include "cpu/z80/z80.h"
#include "cpu/m6809/m6809.h"
#include "sound/2203intf.h"
#include "sound/msm5205.h"
#include "video/v9938.h"
#include "deprecat.h"
#define VDP_MEM 0x40000
#define MAINCPU_CLOCK (XTAL_21_477MHz/6)
#define SOUNDCPU_CLOCK (XTAL_21_477MHz/6)
#define YM_CLOCK (XTAL_21_477MHz/12)
#define MSM_CLOCK (XTAL_384kHz)
#define SUBCPU_CLOCK (XTAL_8MHz/4)
static int subcpu_status=0;
static int soundcpu_busy=0;
static int msm_data = 0;
/* main Z80 */
static WRITE8_HANDLER(bank_w)
{
UINT8 *RAM = memory_region(space->machine, "maincpu");
int bank=0;
switch(data^0xff)
{
case 1: bank=0; break;
case 2: bank=1; break;
case 4: bank=2; break;
case 8: bank=3; break;
}
memory_set_bankptr(space->machine,1,&RAM[bank*0x4000+0x10000]);
}
static TIMER_CALLBACK( subcpu_suspend )
{
cputag_suspend(machine, "sub", SUSPEND_REASON_HALT, 1);
}
static TIMER_CALLBACK( subcpu_resume )
{
cputag_resume(machine, "sub", SUSPEND_REASON_HALT);
cputag_set_input_line(machine, "sub", INPUT_LINE_NMI, PULSE_LINE);
}
static READ8_HANDLER( subcpu_halt_set )
{
timer_call_after_resynch(space->machine, NULL, 0, subcpu_suspend);
subcpu_status|=2;
return 0;
}
static READ8_HANDLER( subcpu_halt_clear )
{
timer_call_after_resynch(space->machine,NULL, 0, subcpu_resume);
subcpu_status&=~1;
subcpu_status&=~2;
return 0;
}
static READ8_HANDLER(subcpu_comm_status )
{
return subcpu_status;
}
static READ8_HANDLER( soundcpu_status_r )
{
return soundcpu_busy;
}
static ADDRESS_MAP_START( maincpu_mem_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0xbfff) AM_ROMBANK(1)
AM_RANGE(0xc000, 0xdfff) AM_RAM AM_MIRROR(0x1800) AM_SHARE(1)
AM_RANGE(0xe000, 0xffff) AM_RAM
ADDRESS_MAP_END
static ADDRESS_MAP_START( maincpu_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE( 0x00, 0x0f) AM_READ_PORT("INPUT1")
AM_RANGE( 0x10, 0x1f) AM_READ_PORT("INPUT2")
AM_RANGE( 0x20, 0x2f) AM_READ_PORT("SYSTEM")
AM_RANGE( 0x30, 0x30) AM_READ(subcpu_halt_set)
AM_RANGE( 0x31, 0x31) AM_READ(subcpu_halt_clear)
AM_RANGE( 0x32, 0x32) AM_READ(subcpu_comm_status)
AM_RANGE( 0x33, 0x33) AM_READ(soundcpu_status_r)
AM_RANGE( 0x40, 0x4f) AM_WRITE(soundlatch_w)
AM_RANGE( 0x50, 0x50) AM_WRITE(bank_w)
AM_RANGE( 0x60, 0x61) AM_MIRROR(0x02) AM_DEVREADWRITE("ymsnd", ym2203_r, ym2203_w)
/* not sure, but the A1 line is ignored, code @ $8b8 */
AM_RANGE( 0x70, 0x70) AM_WRITE( v9938_0_vram_w ) AM_READ( v9938_0_vram_r )
AM_RANGE( 0x71, 0x71) AM_WRITE( v9938_0_command_w ) AM_READ( v9938_0_status_r )
AM_RANGE( 0x72, 0x72) AM_WRITE( v9938_0_palette_w )
AM_RANGE( 0x73, 0x73) AM_WRITE( v9938_0_register_w )
ADDRESS_MAP_END
/* sound Z80 */
static WRITE8_DEVICE_HANDLER(msm_cfg_w)
{
/*
bit 0 = RESET
bit 1 = 4B/3B 0
bit 2 = S2 1
bit 3 = S1 2
*/
msm5205_playmode_w(device, BITSWAP8((data>>1), 7,6,5,4,3,0,1,2)); /* or maybe 7,6,5,4,3,0,2,1 ??? */
msm5205_reset_w(device,data&1);
}
static WRITE8_HANDLER( msm_data_w )
{
msm_data = data;
}
static WRITE8_HANDLER(soundcpu_busyflag_set_w)
{
soundcpu_busy=1;
}
static WRITE8_HANDLER(soundcpu_busyflag_reset_w)
{
soundcpu_busy=0;
}
static WRITE8_HANDLER(soundcpu_int_clear_w)
{
cputag_set_input_line(space->machine, "soundcpu", 0, CLEAR_LINE );
}
static ADDRESS_MAP_START( soundcpu_mem_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xdfff) AM_ROM
AM_RANGE(0xf800, 0xffff) AM_RAM
ADDRESS_MAP_END
static ADDRESS_MAP_START( soundcpu_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_READ(soundlatch_r)
AM_RANGE(0x01, 0x01) AM_WRITE(msm_data_w)
AM_RANGE(0x02, 0x02) AM_DEVWRITE("msm", msm_cfg_w)
AM_RANGE(0x03, 0x03) AM_WRITE(soundcpu_busyflag_set_w)
AM_RANGE(0x04, 0x04) AM_WRITE(soundcpu_busyflag_reset_w)
AM_RANGE(0x05, 0x05) AM_WRITE(soundcpu_int_clear_w)
ADDRESS_MAP_END
/* sub 6809 */
static void unlock_shared_ram(const address_space *space)
{
if(!cputag_is_suspended(space->machine, "sub", SUSPEND_REASON_HALT))
{
subcpu_status|=1;
}
else
{
logerror("Sub cpu active! @%x\n",cpu_get_pc(space->cpu));
}
}
static WRITE8_HANDLER(subcpu_status_w)
{
unlock_shared_ram(space);
}
static READ8_HANDLER(subcpu_status_r)
{
unlock_shared_ram(space);
return 0;
}
static ADDRESS_MAP_START( subcpu_mem_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_READWRITE(subcpu_status_r,subcpu_status_w)
AM_RANGE(0x2000, 0x77ff) AM_RAM
AM_RANGE(0x7800, 0x7fff) AM_RAM AM_SHARE(1) /* upper 0x800 of 6264 is shared with main cpu */
AM_RANGE(0x8000, 0xffff) AM_ROM
ADDRESS_MAP_END
static INPUT_PORTS_START( sothello )
PORT_START("INPUT1")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
PORT_START("INPUT2")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
PORT_START("SYSTEM")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0xf2, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("DSWA")
PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Coinage ) )
PORT_DIPSETTING( 0x00, DEF_STR( 5C_1C ) )
PORT_DIPSETTING( 0x20, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x40, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x60, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0xe0,<-- license:BSD-3-Clause
-- copyright-holders:MAMEdev Team
---------------------------------------------------------------------------
--
-- formats.lua
--
-- Rules for building formats
--
---------------------------------------------------------------------------
function formatsProject(_target, _subtarget)
project "formats"
uuid (os.uuid("formats-" .. _target .."_" .. _subtarget))
kind (LIBTYPE)
targetsubdir(_target .."_" .. _subtarget)
addprojectflags()
options {
"ArchiveSplit",
}
includedirs {
MAME_DIR .. "src/osd",
MAME_DIR .. "src/emu",
MAME_DIR .. "src/lib",
MAME_DIR .. "src/lib/util",
MAME_DIR .. "3rdparty",
ext_includedir("zlib"),
}
files {
MAME_DIR .. "src/lib/formats/ioprocs.cpp",
MAME_DIR .. "src/lib/formats/ioprocs.h",
MAME_DIR .. "src/lib/formats/imageutl.cpp",
MAME_DIR .. "src/lib/formats/imageutl.h",
MAME_DIR .. "src/lib/formats/cassimg.cpp",
MAME_DIR .. "src/lib/formats/cassimg.h",
MAME_DIR .. "src/lib/formats/wavfile.cpp",
MAME_DIR .. "src/lib/formats/wavfile.h",
MAME_DIR .. "src/lib/formats/flopimg.cpp",
MAME_DIR .. "src/lib/formats/flopimg.h",
MAME_DIR .. "src/lib/formats/cqm_dsk.cpp",
MAME_DIR .. "src/lib/formats/cqm_dsk.h",
MAME_DIR .. "src/lib/formats/dsk_dsk.cpp",
MAME_DIR .. "src/lib/formats/dsk_dsk.h",
MAME_DIR .. "src/lib/formats/td0_dsk.cpp",
MAME_DIR .. "src/lib/formats/td0_dsk.h",
MAME_DIR .. "src/lib/formats/hxchfe_dsk.cpp",
MAME_DIR .. "src/lib/formats/hxchfe_dsk.h",
MAME_DIR .. "src/lib/formats/hxcmfm_dsk.cpp",
MAME_DIR .. "src/lib/formats/hxcmfm_dsk.h",
MAME_DIR .. "src/lib/formats/mfi_dsk.cpp",
MAME_DIR .. "src/lib/formats/mfi_dsk.h",
MAME_DIR .. "src/lib/formats/imd_dsk.cpp",
MAME_DIR .. "src/lib/formats/imd_dsk.h",
MAME_DIR .. "src/lib/formats/ipf_dsk.cpp",
MAME_DIR .. "src/lib/formats/ipf_dsk.h",
MAME_DIR .. "src/lib/formats/d88_dsk.cpp",
MAME_DIR .. "src/lib/formats/d88_dsk.h",
MAME_DIR .. "src/lib/formats/dfi_dsk.cpp",
MAME_DIR .. "src/lib/formats/dfi_dsk.h",
MAME_DIR .. "src/lib/formats/fdi_dsk.cpp",
}
--------------------------------------------------
--
--@src/lib/formats/2d_dsk.h,FORMATS["2D_DSK"] = true
--------------------------------------------------
if (FORMATS["2D_DSK"]~=null or _OPTIONS["with-tools"]) then
files {
MAME_DIR.. "src/lib/formats/2d_dsk.cpp",
MAME_DIR.. "src/lib/formats/2d_dsk.h",
}
end
--------------------------------------------------
--
--@src/lib/formats/a26_cas.h,FORMATS["A26_CAS"] = true
--------------------------------------------------
if (FORMATS["A26_CAS"]~=null or _OPTIONS["with-tools"]) then
files {
MAME_DIR.. "src/lib/formats/a26_cas.cpp",
MAME_DIR.. "src/lib/formats/a26_cas.h",
}
end
--------------------------------------------------
--
--@src/lib/formats/a5105_dsk.h,FORMATS["A5105_DSK"] = true
--------------------------------------------------
if (FORMATS["A5105_DSK"]~=null or _OPTIONS["with-tools"]) then
files {
MAME_DIR.. "src/lib/formats/a5105_dsk.cpp",
MAME_DIR.. "src/lib/formats/a5105_dsk.h",
}
end
--------------------------------------------------
--
--@src/lib/formats/abc800_dsk.h,FORMATS["ABC800_DSK"] = true
--------------------------------------------------
if (FORMATS["ABC800_DSK"]~=null or _OPTIONS["with-tools"]) then
files {
MAME_DIR.. "src/lib/formats/abc800_dsk.cpp",
MAME_DIR.. "src/lib/formats/abc800_dsk.h",
}
end
--------------------------------------------------
--
--@src/lib/formats/abcfd2_dsk.h,FORMATS["ABCFD2_DSK"] = true
--------------------------------------------------
if (FORMATS["ABCFD2_DSK"]~=null or _OPTIONS["with-tools"]) then
files {
MAME_DIR.. "src/lib/formats/abcfd2_dsk.cpp",
MAME_DIR.. "src/lib/formats/abcfd2_dsk.h",
}
end
--------------------------------------------------
--
--@src/lib/formats/ace_tap.h,FORMATS["ACE_TAP"] = true
--------------------------------------------------
if (FORMATS["ACE_TAP"]~=null or _OPTIONS["with-tools"]) then
files {
MAME_DIR.. "src/lib/formats/ace_tap.cpp",
MAME_DIR.. "src/lib/formats/ace_tap.h",
}
end
--------------------------------------------------
--
--@src/lib/formats/acorn_dsk.h,FORMATS["ACORN_DSK"] = true
--------------------------------------------------
if (FORMATS["ACORN_DSK"]~=null or _OPTIONS["with-tools"]) then
files {
MAME_DIR.. "src/lib/formats/acorn_dsk.cpp",
MAME_DIR.. "src/lib/formats/acorn_dsk.h",
}
end
--------------------------------------------------
--
--@src/lib/formats/adam_cas.h,FORMATS["ADAM_CAS"] = true
--------------------------------------------------
if (FORMATS["ADAM_CAS"]~=null or _OPTIONS["with-tools"]) then
files {
MAME_DIR.. "src/lib/formats/adam_cas.cpp",
MAME_DIR.. "src/lib/formats/adam_cas.h",
}
end
--------------------------------------------------
--
--@src/lib/formats/adam_dsk.h,FORMATS["ADAM_DSK"] = true
--------------------------------------------------
if (FORMATS["ADAM_DSK"]~=null or _OPTIONS["with-tools"]) then
files {
MAME_DIR.. "src/lib/formats/adam_dsk.cpp",
MAME_DIR.. "src/lib/formats/adam_dsk.h",
}
end
--------------------------------------------------
--
--@src/lib/formats/afs_dsk.h,FORMATS["AFS_DSK"] = true
--------------------------------------------------
if (FORMATS["AFS_DSK"]~=null or _OPTIONS["with-tools"]) then
files {
MAME_DIR.. "src/lib/formats/afs_dsk.cpp",
MAME_DIR.. "src/lib/formats/afs_dsk.h",
}
end
--------------------------------------------------
--
--@src/lib/formats/agat840k_hle_dsk.h,FORMATS["AGAT840K_HLE_DSK"] = true
--------------------------------------------------
if (FORMATS["AGAT840K_HLE_DSK"]~=null or _OPTIONS["with-tools"]) then
files {
MAME_DIR.. "src/lib/formats/agat840k_hle_dsk.cpp",
MAME_DIR.. "src/lib/formats/agat840k_hle_dsk.h",
}
end
--------------------------------------------------
--
--@src/lib/formats/ami_dsk.h,FORMATS["AMI_DSK"] = true
--------------------------------------------------
if (FORMATS["AMI_DSK"]~=null or _OPTIONS["with-tools"]) then
files {
MAME_DIR.. "src/lib/formats/ami_dsk.cpp",
MAME_DIR.. "src/lib/formats/ami_dsk.h",
}
end
--------------------------------------------------
--
--@src/lib/formats/ap2_dsk.h,FORMATS["AP2_DSK"] = true
--------------------------------------------------
if (FORMATS["AP2_DSK"]~=null or _OPTIONS["with-tools"]) then
files {
MAME_DIR.. "src/lib/formats/ap2_dsk.cpp",
MAME_DIR.. "src/lib/formats/ap2_dsk.h",
}
end
--------------------------------------------------
--
--@src/lib/formats/apd_dsk.h,FORMATS["APD_DSK"] = true
--------------------------------------------------
if (FORMATS["APD_DSK"]~=null or _OPTIONS["with-tools"]) then
files {
MAME_DIR.. "src/lib/formats/apd_dsk.cpp",
MAME_DIR.. "src/lib/formats/apd_dsk.h",
}
end
--------------------------------------------------
--
--@src/lib/formats/apf_apt.h,FORMATS["APF_APT"] = true
--------------------------------------------------
if (FORMATS["APF_APT"]~=null or _OPTIONS["with-tools"]) then
files {
MAME_DIR.. "src/lib/formats/apf_apt.cpp",
MAME_DIR.. "src/lib/formats/apf_apt.h",
}
end
--------------------------------------------------
--
--@src/lib/formats/apollo_dsk.h,FORMATS["APOLLO_DSK"] = true
--------------------------------------------------
if (FORMATS["APOLLO_DSK"]~=null or _OPTIONS["with-tools"]) then
files {
MAME_DIR.. "src/lib/formats/apollo_dsk.cpp",
MAME_DIR.. "src/lib/formats/apollo_dsk.h",
}
end
--------------------------------------------------
--
--@src/lib/formats/applix_dsk.h,FORMATS["APPLIX_DSK"] = true
--------------------------------------------------
if (FORMATS["APPLIX_DSK"]~=null or _OPTIONS["with-tools"]) then
files {
MAME_DIR.. "src/lib/formats/applix_dsk.cpp",
MAME_DIR.. "src/lib/formats/applix_dsk.h",
}
end
--------------------------------------------------
--
--@src/lib/formats/apridisk.h,FORMATS["APRIDISK"] = true
--------------------------------------------------
if (FORMATS["APRIDISK"]~=null or _OPTIONS["with-tools"]) then
files {
MAME_DIR.. "src/lib/formats/apridisk.cpp",
MAME_DIR.. "src/lib/formats/apridisk.h",
}
end