diff options
| author | 2015-04-04 14:44:22 +0200 | |
|---|---|---|
| committer | 2015-04-04 14:44:22 +0200 | |
| commit | 6f0fd1a366cbb3cd919f66b13598c575e39edd6f (patch) | |
| tree | 32cbc8b761db44feb3f0c8eb9030e40583e69548 | |
| parent | 1026d09afa7583f0a296ac88b90ca419ebf405ec (diff) | |
| parent | 73f53bb15e363712d097fe59c097de1a1fb9fed0 (diff) | |
Merge branch 'master' of https://github.com/mamedev/mame
| -rw-r--r-- | makefile | 10 | ||||
| -rw-r--r-- | scripts/genie.lua | 30 | ||||
| -rw-r--r-- | scripts/src/osd/modules.lua | 8 | ||||
| -rw-r--r-- | scripts/src/osd/sdl.lua | 34 | ||||
| -rw-r--r-- | scripts/src/osd/sdl_cfg.lua | 6 | ||||
| -rw-r--r-- | scripts/src/osd/windows.lua | 52 | ||||
| -rw-r--r-- | scripts/src/osd/windows_cfg.lua | 19 | ||||
| -rw-r--r-- | scripts/toolchain.lua | 12 | ||||
| -rw-r--r-- | src/mame/drivers/goldstar.c | 203 | ||||
| -rw-r--r-- | src/mame/drivers/peplus.c | 12 | ||||
| -rw-r--r-- | src/mess/drivers/hh_hmcs40.c | 712 | ||||
| -rw-r--r-- | src/mess/drivers/hh_pic16.c | 39 | ||||
| -rw-r--r-- | src/mess/drivers/hh_tms1k.c | 686 | ||||
| -rw-r--r-- | src/mess/drivers/hh_ucom4.c | 410 | ||||
| -rw-r--r-- | src/mess/drivers/mbdtower.c | 13 | ||||
| -rw-r--r-- | src/mess/drivers/ticalc1x.c | 337 | ||||
| -rw-r--r-- | src/mess/drivers/tispeak.c | 90 | ||||
| -rw-r--r-- | src/mess/includes/hh_tms1k.h | 89 | ||||
| -rw-r--r-- | src/osd/modules/render/drawogl.c | 36 | ||||
| -rw-r--r-- | src/osd/sdl/main.c | 19 | ||||
| -rw-r--r-- | src/osd/sdl/sdlmain.c | 7 | ||||
| -rw-r--r-- | src/osd/sdl/video.h | 5 | ||||
| -rw-r--r-- | src/osd/sdl/window.c | 17 |
23 files changed, 1704 insertions, 1142 deletions
@@ -28,6 +28,7 @@ # NO_OPENGL = 1 # USE_DISPATCH_GL = 0 # DIRECTINPUT = 7 +# USE_SDL = 1 # SDL2_MULTIAPI = 1 # NO_USE_MIDI = 1 # DONT_USE_NETWORK = 1 @@ -57,6 +58,7 @@ # SDL_FRAMEWORK_PATH = $(HOME)/Library/Frameworks # SDL_LIBVER = sdl # MACOSX_USE_LIBSDL = 1 +# CYGWIN_BUILD = 1 # TARGETOS = windows # CROSS_BUILD = 1 @@ -406,6 +408,14 @@ ifdef DIRECTINPUT PARAMS += --DIRECTINPUT='$(DIRECTINPUT)' endif +ifdef USE_SDL +PARAMS += --USE_SDL='$(USE_SDL)' +endif + +ifdef CYGWIN_BUILD +PARAMS += --CYGWIN_BUILD='$(CYGWIN_BUILD)' +endif + ifdef MESA_INSTALL_ROOT PARAMS += --MESA_INSTALL_ROOT='$(MESA_INSTALL_ROOT)' endif diff --git a/scripts/genie.lua b/scripts/genie.lua index 9764bd88219..0673238a681 100644 --- a/scripts/genie.lua +++ b/scripts/genie.lua @@ -56,7 +56,7 @@ newoption { newoption { trigger = "osd", - description = "Choose target OSD", + description = "Choose OSD layer implementation", } newoption { @@ -68,14 +68,17 @@ newoption { { "android-x86", "Android - x86" }, { "asmjs", "Emscripten/asm.js" }, { "freebsd", "FreeBSD" }, + { "netbsd", "NetBSD" }, + { "openbsd", "OpenBSD" }, { "nacl", "Native Client" }, { "nacl-arm", "Native Client - ARM" }, { "pnacl", "Native Client - PNaCl" }, - { "linux", "Linux" }, - { "ios", "iOS" }, + { "linux", "Linux" }, + { "ios", "iOS" }, { "macosx", "OSX" }, { "windows", "Windows" }, - + { "os2", "OS/2 eComStation" }, + { "haiku", "Haiku" }, }, } @@ -783,26 +786,12 @@ configuration { "mingw*" } "-static-libgcc", "-static-libstdc++", } -if _OPTIONS["osd"]=="sdl" then - links { - "SDL2", - "imm32", - "version", - "ole32", - "oleaut32", - } -end links { "user32", - "gdi32", - "dsound", - "dxguid", "winmm", "advapi32", - "comctl32", "shlwapi", "wsock32", - "comdlg32", } configuration { "vs*" } @@ -815,15 +804,10 @@ configuration { "vs*" } } links { "user32", - "gdi32", - "dsound", - "dxguid", "winmm", "advapi32", - "comctl32", "shlwapi", "wsock32", - "comdlg32", } buildoptions { diff --git a/scripts/src/osd/modules.lua b/scripts/src/osd/modules.lua index c8e1efee2c9..eac621aaf8b 100644 --- a/scripts/src/osd/modules.lua +++ b/scripts/src/osd/modules.lua @@ -181,6 +181,14 @@ function osdmodulestargetconf() end end + if _OPTIONS["targetos"]=="windows" then + links { + "gdi32", + "dsound", + "dxguid", + } + end + end diff --git a/scripts/src/osd/sdl.lua b/scripts/src/osd/sdl.lua index 7a2c24c014a..578fb17608f 100644 --- a/scripts/src/osd/sdl.lua +++ b/scripts/src/osd/sdl.lua @@ -43,6 +43,16 @@ function maintargetosdoptions(_target) end if _OPTIONS["targetos"]=="windows" then + if _OPTIONS["SDL_LIBVER"]=="sdl2" then + links { + "SDL2.dll", + } + else + links { + "SDL.dll", + } + end + configuration { "mingw*" } linkoptions{ "-municode", @@ -59,10 +69,6 @@ function maintargetosdoptions(_target) libdirs { path.join(_OPTIONS["SDL_INSTALL_ROOT"],"lib","x64") } - configuration { "vs*" } - links { - "SDL2", - } configuration {} elseif _OPTIONS["targetos"]=="haiku" then links { @@ -102,7 +108,7 @@ newoption { } if not _OPTIONS["NO_X11"] then - if _OPTIONS["targetos"]=="windows" or _OPTIONS["targetos"]=="macosx" or _OPTIONS["targetos"]=="haiku" or _OPTIONS["targetos"]=="emscripten" or _OPTIONS["targetos"]=="os2" then + if _OPTIONS["targetos"]=="windows" or _OPTIONS["targetos"]=="macosx" or _OPTIONS["targetos"]=="haiku" or _OPTIONS["targetos"]=="asmjs" or _OPTIONS["targetos"]=="os2" then _OPTIONS["NO_X11"] = "1" else _OPTIONS["NO_X11"] = "0" @@ -193,7 +199,7 @@ elseif _OPTIONS["targetos"]=="netbsd" then SDL_NETWORK = "pcap" elseif _OPTIONS["targetos"]=="haiku" then SYNC_IMPLEMENTATION = "ntc" -elseif _OPTIONS["targetos"]=="emscripten" then +elseif _OPTIONS["targetos"]=="asmjs" then SYNC_IMPLEMENTATION = "mini" elseif _OPTIONS["targetos"]=="windows" then BASE_TARGETOS = "win32" @@ -282,13 +288,6 @@ elseif BASE_TARGETOS=="os2" then } end -configuration { "mingw*" } - linkoptions { - "-static" - } - -configuration { } - project ("osd_" .. _OPTIONS["osd"]) uuid (os.uuid("osd_" .. _OPTIONS["osd"])) @@ -442,6 +441,15 @@ if _OPTIONS["with-tools"] then } if _OPTIONS["targetos"]=="windows" then + if _OPTIONS["SDL_LIBVER"]=="sdl2" then + links { + "SDL2.dll", + } + else + links { + "SDL.dll", + } + end linkoptions{ "-municode", } diff --git a/scripts/src/osd/sdl_cfg.lua b/scripts/src/osd/sdl_cfg.lua index 775398f87a6..aaf52e3e2cd 100644 --- a/scripts/src/osd/sdl_cfg.lua +++ b/scripts/src/osd/sdl_cfg.lua @@ -90,7 +90,7 @@ if BASE_TARGETOS=="unix" then buildoptions { backtick(sdlconfigcmd() .. " --cflags"), } - if _OPTIONS["targetos"]~="emscripten" then + if _OPTIONS["targetos"]~="asmjs" then buildoptions { backtick("pkg-config --cflags fontconfig"), } @@ -105,6 +105,10 @@ if _OPTIONS["targetos"]=="windows" then "main=utf8_main", } + configuration { "Debug" } + defines { + "MALLOC_DEBUG", + } configuration { "vs*" } includedirs { path.join(_OPTIONS["SDL_INSTALL_ROOT"],"include") diff --git a/scripts/src/osd/windows.lua b/scripts/src/osd/windows.lua index 57aa0d9bb46..b5faf8722c6 100644 --- a/scripts/src/osd/windows.lua +++ b/scripts/src/osd/windows.lua @@ -21,6 +21,18 @@ function maintargetosdoptions(_target) } end + + if _OPTIONS["USE_SDL"] == "1" then + links { + "SDL.dll", + } + end + + links { + "comctl32", + "comdlg32", + } + local rcfile = MAME_DIR .. "src/" .. _target .. "/osd/windows/" .. _target ..".rc" if os.isfile(rcfile) then @@ -46,7 +58,7 @@ newoption { description = "Minimum DirectInput version to support", allowed = { { "7", "Support DirectInput 7 or later" }, - { "8", "Support DirectInput 8 or later" }, + { "8", "Support DirectInput 8 or later" }, }, } @@ -54,6 +66,42 @@ if not _OPTIONS["DIRECTINPUT"] then _OPTIONS["DIRECTINPUT"] = "8" end +newoption { + trigger = "USE_SDL", + description = "Enable SDL sound output", + allowed = { + { "0", "Disable SDL sound output" }, + { "1", "Enable SDL sound output" }, + }, +} + +if not _OPTIONS["USE_SDL"] then + _OPTIONS["USE_SDL"] = "0" +end + +newoption { + trigger = "CYGWIN_BUILD", + description = "Build with Cygwin tools", + allowed = { + { "0", "Build with MinGW tools" }, + { "1", "Build with Cygwin tools" }, + }, +} + +if not _OPTIONS["CYGWIN_BUILD"] then + _OPTIONS["CYGWIN_BUILD"] = "0" +end + + +if _OPTIONS["CYGWIN_BUILD"] == "1" then + buildoptions { + "-mmo-cygwin", + } + linkoptions { + "-mno-cygwin", + } +end + project ("osd_" .. _OPTIONS["osd"]) uuid (os.uuid("osd_" .. _OPTIONS["osd"])) @@ -163,7 +211,7 @@ project ("ocore_" .. _OPTIONS["osd"]) MAME_DIR .. "src/osd/modules/lib/osdlib_win32.c", } - if _OPTIONS["NOASM"]=="1" then + if _OPTIONS["NOASM"] == "1" then files { MAME_DIR .. "src/osd/modules/sync/work_mini.c", } diff --git a/scripts/src/osd/windows_cfg.lua b/scripts/src/osd/windows_cfg.lua index 8bbba52f8d6..082cdc432eb 100644 --- a/scripts/src/osd/windows_cfg.lua +++ b/scripts/src/osd/windows_cfg.lua @@ -2,11 +2,15 @@ defines { "UNICODE", "_UNICODE", "OSD_WINDOWS", - "USE_SDL=0", "main=utf8_main", "_WIN32_WINNT=0x0501", } +configuration { "Debug" } + defines { + "MALLOC_DEBUG", + } + configuration { "vs*" } flags { "Unicode", @@ -20,3 +24,16 @@ if not _OPTIONS["DONT_USE_NETWORK"] then "OSD_NET_USE_PCAP", } end + +if _OPTIONS["USE_SDL"]=="1" then + defines { + "SDLMAME_SDL2=0", + "USE_XINPUT=0", + "USE_SDL=1", + "USE_SDL_SOUND", + } +else + defines { + "USE_SDL=0", + } +end diff --git a/scripts/toolchain.lua b/scripts/toolchain.lua index 1aa3dbde462..e534c7e4425 100644 --- a/scripts/toolchain.lua +++ b/scripts/toolchain.lua @@ -489,12 +489,13 @@ function toolchain(_buildDir, _subDir) objdir (_buildDir .. "android-arm" .. "/obj") libdirs { "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a", + "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-arm/usr/lib", } includedirs { "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include", + "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-arm/usr/include", } buildoptions { - "--sysroot=$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-arm", "-mthumb", "-march=armv7-a", "-mfloat-abi=softfp", @@ -503,7 +504,6 @@ function toolchain(_buildDir, _subDir) "-Wundef", } linkoptions { - "--sysroot=$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-arm", "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-arm/usr/lib/crtbegin_so.o", "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-arm/usr/lib/crtend_so.o", "-march=armv7-a", @@ -515,17 +515,17 @@ function toolchain(_buildDir, _subDir) objdir (_buildDir .. "android-mips" .. "/obj") libdirs { "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/mips", + "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-mips/usr/lib/", } includedirs { "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/mips/include", + "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-mips/usr/include", } buildoptions { - "--sysroot=$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-mips", "-Wunused-value", "-Wundef", } linkoptions { - "--sysroot=$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-mips", "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-mips/usr/lib/crtbegin_so.o", "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-mips/usr/lib/crtend_so.o", } @@ -535,12 +535,13 @@ function toolchain(_buildDir, _subDir) objdir (_buildDir .. "android-x86" .. "/obj") libdirs { "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/x86", + "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-x86/usr/lib", } includedirs { "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/x86/include", + "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-x86/usr/include", } buildoptions { - "--sysroot=$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-x86", "-march=i686", "-mtune=atom", "-mstackrealign", @@ -550,7 +551,6 @@ function toolchain(_buildDir, _subDir) "-Wundef", } linkoptions { - "--sysroot=$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-x86", "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-x86/usr/lib/crtbegin_so.o", "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-x86/usr/lib/crtend_so.o", } diff --git a/src/mame/drivers/goldstar.c b/src/mame/drivers/goldstar.c index 7daa0f8d626..9bf3b2ebb08 100644 --- a/src/mame/drivers/goldstar.c +++ b/src/mame/drivers/goldstar.c @@ -1196,7 +1196,7 @@ static INPUT_PORTS_START( cmv4_service ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_GAMBLE_KEYOUT ) PORT_NAME("Key Out / Attendant") PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_GAMBLE_SERVICE ) PORT_NAME("Settings") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_GAMBLE_BOOK ) PORT_NAME("Stats") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_GAMBLE_BOOK ) PORT_NAME("Stats") // on some sets a DSW must be on/off to access this menu INPUT_PORTS_END static INPUT_PORTS_START( cmv4_dsw1 ) @@ -3467,7 +3467,7 @@ static INPUT_PORTS_START( bingowng ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) INPUT_PORTS_END -INPUT_PORTS_START( bingownga ) +static INPUT_PORTS_START( bingownga ) PORT_INCLUDE( bingowng ) PORT_MODIFY("DSW4") @@ -3995,16 +3995,18 @@ static INPUT_PORTS_START( nfb96 ) PORT_DIPSETTING( 0x80, DEF_STR( Yes ) ) INPUT_PORTS_END -/* Displays tkt info on screen but has no settings or hopper controls */ + +/* Displays tkt info on screen but has no settings or hopper controls other than "Ticket Out By" DSW */ +/* All marked as "Unknown" until a manual or more information is found */ static INPUT_PORTS_START( nfb96tx ) PORT_START("IN0") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) // unused coin switch + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* unused coin switch */ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SLOT_STOP_ALL ) PORT_NAME("Stop All / Big") PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SLOT_STOP1 ) PORT_NAME("Stop 1 / D-UP") PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SLOT_STOP3 ) PORT_NAME("Stop 3 / Take / Select Card") PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_GAMBLE_BET ) PORT_NAME("Play (Bet)") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SLOT_STOP2 ) PORT_NAME("Stop 2 / Small") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SLOT_STOP2 ) PORT_NAME("Stop 2 / Small / Info") PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 ) PORT_NAME("Start") PORT_START("IN1") @@ -4014,15 +4016,15 @@ static INPUT_PORTS_START( nfb96tx ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(2) PORT_NAME("Ticket In") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_GAMBLE_KEYIN ) /* Key In shows in test mode but not used by game */ + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* unused keyin? - causes counter errors */ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2) PORT_START("IN2") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* unused coin switch */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* unused coin switch */ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_GAMBLE_KEYOUT ) PORT_NAME("Key Out / Attendant") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* unused keyout? */ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_GAMBLE_SERVICE ) PORT_NAME("Settings") PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_GAMBLE_BOOK ) PORT_NAME("Stats") @@ -4071,7 +4073,7 @@ static INPUT_PORTS_START( nfb96tx ) PORT_DIPSETTING( 0x28, "125" ) PORT_DIPSETTING( 0x30, "250" ) PORT_DIPSETTING( 0x38, "500" ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW2:7") /* unknown */ + PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW2:7") /* unknown */ PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x40, DEF_STR( On ) ) PORT_DIPNAME( 0x80, 0x00, "WARNING: Always Off" ) PORT_DIPLOCATION("DSW2:8") /* Listed that way in other manuals */ @@ -4079,91 +4081,80 @@ static INPUT_PORTS_START( nfb96tx ) PORT_DIPSETTING( 0x80, DEF_STR( On ) ) PORT_START("DSW3") - PORT_DIPNAME( 0x03, 0x02, "Minimum Play to Start" ) PORT_DIPLOCATION("DSW3:1,2") /* OK */ + PORT_DIPNAME( 0x03, 0x00, "Minimum Play to Start" ) PORT_DIPLOCATION("DSW3:1,2") /* OK */ PORT_DIPSETTING( 0x00, "1" ) PORT_DIPSETTING( 0x01, "8" ) PORT_DIPSETTING( 0x02, "16" ) PORT_DIPSETTING( 0x03, "24" ) - PORT_DIPNAME( 0x0c, 0x08, "Max Coin In & Note In Points" ) PORT_DIPLOCATION("DSW3:3,4") /* OK */ + PORT_DIPNAME( 0x0c, 0x08, "Coin In Limit" ) PORT_DIPLOCATION("DSW3:3,4") /* OK */ PORT_DIPSETTING( 0x00, "1000" ) PORT_DIPSETTING( 0x04, "5000" ) PORT_DIPSETTING( 0x08, "10000" ) PORT_DIPSETTING( 0x0c, "90000" ) - PORT_DIPNAME( 0xf0, 0x00, "Clear / Ticket Unit" ) PORT_DIPLOCATION("DSW3:5,6,7,8") /* OK */ - PORT_DIPSETTING( 0x00, "1" ) - PORT_DIPSETTING( 0x10, "4" ) - PORT_DIPSETTING( 0x20, "5" ) - PORT_DIPSETTING( 0x30, "10" ) - PORT_DIPSETTING( 0x40, "15" ) - PORT_DIPSETTING( 0x50, "20" ) - PORT_DIPSETTING( 0x60, "25" ) - PORT_DIPSETTING( 0x70, "30" ) - PORT_DIPSETTING( 0x80, "40" ) - PORT_DIPSETTING( 0x90, "50" ) - PORT_DIPSETTING( 0xa0, "60" ) - PORT_DIPSETTING( 0xb0, "75" ) - PORT_DIPSETTING( 0xc0, "80" ) - PORT_DIPSETTING( 0xd0, "100" ) - PORT_DIPSETTING( 0xe0, "200" ) - PORT_DIPSETTING( 0xf0, "500" ) + PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW3:5") /* unknown */ + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x10, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW3:6") /* unknown */ + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x20, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW3:7") /* unknown */ + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x40, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW3:8") /* unknown */ + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x80, DEF_STR( On ) ) PORT_START("DSW4") PORT_DIPNAME( 0x01, 0x01, "Check Account" ) PORT_DIPLOCATION("DSW4:1") /* OK */ PORT_DIPSETTING( 0x00, DEF_STR( No ) ) PORT_DIPSETTING( 0x01, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x02, 0x00, "Show In Confirm Screen" ) PORT_DIPLOCATION("DSW4:2") /* OK */ - PORT_DIPSETTING( 0x00, "Level of Difficulty" ) /* percentage in the manual */ - PORT_DIPSETTING( 0x02, "Percentage" ) /* level of difficulty in the manual */ + PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW4:2") /* unknown */ + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x02, DEF_STR( On ) ) PORT_DIPNAME( 0x04, 0x00, "Initial Bonus Settings After Reset" ) PORT_DIPLOCATION("DSW4:3") /* OK (need a reset after change) */ PORT_DIPSETTING( 0x00, "Type 1" ) PORT_DIPSETTING( 0x04, "Type 2" ) PORT_DIPNAME( 0x08, 0x08, "Bonus Accumulation" ) PORT_DIPLOCATION("DSW4:4") /* OK (need a reset after change) */ PORT_DIPSETTING( 0x00, DEF_STR( No ) ) PORT_DIPSETTING( 0x08, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x10, 0x10, "Auto Ticket Dispense" ) PORT_DIPLOCATION("DSW4:5") /* OK (need a reset after change) */ - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Yes ) ) - PORT_DIPNAME( 0xe0, 0xe0, "Ticket Dispense Mode" ) PORT_DIPLOCATION("DSW4:6,7,8") /* OK */ - PORT_DIPSETTING( 0xe0, "Continuous" ) - PORT_DIPSETTING( 0xc0, "Max 1 Ticket Per Game" ) - PORT_DIPSETTING( 0xa0, "Max 2 Ticket Per Game" ) - PORT_DIPSETTING( 0x80, "Max 3 Ticket Per Game" ) - PORT_DIPSETTING( 0x60, "Max 4 Ticket Per Game" ) - PORT_DIPSETTING( 0x40, "Max 5 Ticket Per Game" ) - PORT_DIPSETTING( 0x20, "Max 8 Ticket Per Game" ) - PORT_DIPSETTING( 0x00, "Max 10 Ticket Per Game" ) + PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW4:5") /* unknown */ + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x10, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW4:6") /* unknown */ + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x20, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW4:7") /* unknown */ + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x40, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW4:8") /* unknown */ + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x80, DEF_STR( On ) ) PORT_START("DSW5") - PORT_DIPNAME( 0x01, 0x00, DEF_STR( Unused ) ) PORT_DIPLOCATION("DSW5:1") /* OK */ + PORT_DIPNAME( 0x01, 0x00, DEF_STR( Unused ) ) PORT_DIPLOCATION("DSW5:1") /* OK */ PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x01, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x00, "Limit Score of Each Game to Max 10x Bet or $5.00" ) PORT_DIPLOCATION("DSW5:2") /* OK */ - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) PORT_CONDITION("DSW4",0x10,EQUALS,0x10) - PORT_DIPSETTING( 0x02, DEF_STR( Yes ) ) PORT_CONDITION("DSW4",0x10,EQUALS,0x10) - PORT_DIPSETTING( 0x00, DEF_STR( Unused ) ) PORT_CONDITION("DSW4",0x10,EQUALS,0x00) - PORT_DIPSETTING( 0x02, DEF_STR( Unused ) ) PORT_CONDITION("DSW4",0x10,EQUALS,0x00) - PORT_DIPNAME( 0x04, 0x00, "Use Printer" ) PORT_DIPLOCATION("DSW5:3") /* OK */ - PORT_DIPSETTING( 0x00, "Interfase" ) - PORT_DIPSETTING( 0x04, "Direct Driver" ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW5:4") /* OK */ - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW5:5") /* OK */ - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, "Play Score when no point left" ) PORT_DIPLOCATION("DSW5:6") /* OK (turn the machine off/on after change) */ - PORT_DIPSETTING( 0x20, DEF_STR( No ) ) PORT_CONDITION("DSW4",0x10,EQUALS,0x10) - PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) PORT_CONDITION("DSW4",0x10,EQUALS,0x10) - PORT_DIPSETTING( 0x20, DEF_STR( Unused ) ) PORT_CONDITION("DSW4",0x10,EQUALS,0x00) - PORT_DIPSETTING( 0x00, DEF_STR( Unused ) ) PORT_CONDITION("DSW4",0x10,EQUALS,0x00) - PORT_DIPNAME( 0x40, 0x00, "Reset Remaining Score when Game Over" ) PORT_DIPLOCATION("DSW5:7") /* OK (turn the machine off/on after change) */ - PORT_DIPSETTING( 0x40, DEF_STR( No ) ) PORT_CONDITION("DSW4",0x10,EQUALS,0x10) - PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) PORT_CONDITION("DSW4",0x10,EQUALS,0x10) - PORT_DIPSETTING( 0x40, DEF_STR( Unused ) ) PORT_CONDITION("DSW4",0x10,EQUALS,0x00) - PORT_DIPSETTING( 0x00, DEF_STR( Unused ) ) PORT_CONDITION("DSW4",0x10,EQUALS,0x00) - PORT_DIPNAME( 0x80, 0x00, "Advanced Count Game" ) PORT_DIPLOCATION("DSW5:8") /* OK (turn the machine off/on after change) */ - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW5:2") /* unknown */ + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x02, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x00, "Ticket Out By" ) PORT_DIPLOCATION("DSW5:3") /* OK */ + PORT_DIPSETTING( 0x00, "Interface" ) + PORT_DIPSETTING( 0x04, "Direct Drive" ) + PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW5:4") /* unknown */ + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x08, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW5:5") /* unknown */ + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x10, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW5:6") /* unknown */ + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x20, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW5:7") /* unknown */ + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x40, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW5:8") /* unknown */ + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x80, DEF_STR( On ) ) INPUT_PORTS_END static INPUT_PORTS_START( roypok96 ) @@ -4690,10 +4681,10 @@ static INPUT_PORTS_START( nfb96bl ) PORT_DIPSETTING( 0xc0, "32" ) PORT_START("DSW2") - PORT_DIPNAME( 0x01, 0x01, "Double-Up Game" ) PORT_DIPLOCATION("DSW2:1") /* OK */ + PORT_DIPNAME( 0x01, 0x01, "Double-Up Game" ) PORT_DIPLOCATION("DSW2:1") /* OK */ PORT_DIPSETTING( 0x00, DEF_STR( No ) ) PORT_DIPSETTING( 0x01, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x02, 0x02, "Skill Spinning" ) PORT_DIPLOCATION("DSW2:2") /* OK */ + PORT_DIPNAME( 0x02, 0x02, "Skill Spinning" ) PORT_DIPLOCATION("DSW2:2") /* OK */ PORT_DIPSETTING( 0x00, DEF_STR( No ) ) PORT_DIPSETTING( 0x02, DEF_STR( Yes ) ) PORT_DIPNAME( 0x1c, 0x10, "Coin In" ) PORT_DIPLOCATION("DSW2:3,4,5") /* OK */ @@ -4705,12 +4696,12 @@ static INPUT_PORTS_START( nfb96bl ) PORT_DIPSETTING( 0x14, "1 Coin/20 Credits" ) PORT_DIPSETTING( 0x18, "1 Coin/25 Credits" ) PORT_DIPSETTING( 0x1c, "1 Coin/100 Credits" ) - PORT_DIPNAME( 0x60, 0x00, "Note In Value" ) PORT_DIPLOCATION("DSW2:6,7") /* OK */ + PORT_DIPNAME( 0x60, 0x00, "Note In Value" ) PORT_DIPLOCATION("DSW2:6,7") /* OK */ PORT_DIPSETTING( 0x00, "100" ) PORT_DIPSETTING( 0x20, "200" ) PORT_DIPSETTING( 0x40, "500" ) PORT_DIPSETTING( 0x60, "1000" ) - PORT_DIPNAME( 0x80, 0x00, "WARNING: Always Off" ) PORT_DIPLOCATION("DSW2:8") /* Listed that way in the manual */ + PORT_DIPNAME( 0x80, 0x00, "WARNING: Always Off" ) PORT_DIPLOCATION("DSW2:8") /* Listed that way in the manual */ PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x80, DEF_STR( On ) ) @@ -4720,7 +4711,7 @@ static INPUT_PORTS_START( nfb96bl ) PORT_DIPSETTING( 0x01, "8" ) PORT_DIPSETTING( 0x02, "16" ) PORT_DIPSETTING( 0x03, "24" ) - PORT_DIPNAME( 0x0c, 0x08, "Max Coin In & Note In Point" ) PORT_DIPLOCATION("DSW3:3,4") /* OK */ + PORT_DIPNAME( 0x0c, 0x08, "Max Coin In & Note In Points" ) PORT_DIPLOCATION("DSW3:3,4") /* OK */ PORT_DIPSETTING( 0x00, "1000" ) PORT_DIPSETTING( 0x04, "5000" ) PORT_DIPSETTING( 0x08, "10000" ) @@ -4744,35 +4735,57 @@ static INPUT_PORTS_START( nfb96bl ) PORT_DIPSETTING( 0xf0, "500" ) PORT_START("DSW4") - PORT_DIPNAME( 0x01, 0x01, "Check Account" ) PORT_DIPLOCATION("DSW4:1") /* OK */ - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x01, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW4:2") /* unknown */ - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x02, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x00, "Initial Bonus Settings After Reset" ) PORT_DIPLOCATION("DSW4:3") /* not checked */ + PORT_DIPNAME( 0x01, 0x01, "Check Account" ) PORT_DIPLOCATION("DSW4:1") /* OK */ + PORT_DIPSETTING( 0x01, DEF_STR( No ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x02, 0x00, "Show Coin In Limit On Screen" ) PORT_DIPLOCATION("DSW4:2") /* OK */ + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPNAME( 0x04, 0x00, "Initial Bonus Settings After Reset" ) PORT_DIPLOCATION("DSW4:3") /* OK (need a reset after change) */ PORT_DIPSETTING( 0x00, "Type 1" ) PORT_DIPSETTING( 0x04, "Type 2" ) - PORT_DIPNAME( 0x08, 0x08, "Bonus Accumulation" ) PORT_DIPLOCATION("DSW4:4") /* not checked */ + PORT_DIPNAME( 0x08, 0x08, "Bonus Accumulation" ) PORT_DIPLOCATION("DSW4:4") /* OK (need a reset after change) */ PORT_DIPSETTING( 0x00, DEF_STR( No ) ) PORT_DIPSETTING( 0x08, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x10, 0x10, "Auto Ticket Dispense" ) PORT_DIPLOCATION("DSW4:5") /* not checked */ + PORT_DIPNAME( 0x10, 0x10, "Auto Ticket Dispense" ) PORT_DIPLOCATION("DSW4:5") /* OK (need a reset after change) */ PORT_DIPSETTING( 0x00, DEF_STR( No ) ) PORT_DIPSETTING( 0x10, DEF_STR( Yes ) ) - PORT_DIPNAME( 0xe0, 0xe0, "Ticket Dispense Mode" ) PORT_DIPLOCATION("DSW4:6,7,8") /* OK */ - PORT_DIPSETTING( 0xe0, "Continuous" ) - PORT_DIPSETTING( 0xc0, "Max 1 Ticket Per Game" ) - PORT_DIPSETTING( 0xa0, "Max 2 Ticket Per Game" ) - PORT_DIPSETTING( 0x80, "Max 3 Ticket Per Game" ) - PORT_DIPSETTING( 0x60, "Max 4 Ticket Per Game" ) - PORT_DIPSETTING( 0x40, "Max 5 Ticket Per Game" ) - PORT_DIPSETTING( 0x20, "Max 8 Ticket Per Game" ) - PORT_DIPSETTING( 0x00, "Max 10 Ticket Per Game" ) + PORT_DIPNAME( 0x60, 0x00, "Ticket Dispense Mode" ) PORT_DIPLOCATION("DSW4:6,7") /* OK */ + PORT_DIPSETTING( 0x60, "Continuous" ) + PORT_DIPSETTING( 0x40, "Max 1 Ticket Per Game" ) + PORT_DIPSETTING( 0x20, "Max 5 Tickets Per Game" ) + PORT_DIPSETTING( 0x00, "Max 10 Tickets Per Game" ) + PORT_DIPNAME( 0x80, 0x00, "Show In Confirm Screen" ) PORT_DIPLOCATION("DSW4:8") /* OK */ + PORT_DIPSETTING( 0x00, "Level of Difficulty" ) + PORT_DIPSETTING( 0x80, "Percentage" ) PORT_START("DSW5") PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) INPUT_PORTS_END +/* no manual - similiar to nfb96 sets */ +static INPUT_PORTS_START( nfm ) + PORT_INCLUDE( nfb96bl ) + + PORT_MODIFY( "IN2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* tied to hopper somehow? fill/empty switch? */ + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* display ticket value? */ + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_GAMBLE_KEYOUT ) PORT_NAME("Key Out / Attendant") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* keyin? tied to ticket clear value */ + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_GAMBLE_SERVICE ) PORT_NAME("Settings") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_GAMBLE_BOOK ) PORT_NAME("Stats") /* DSW4-1 must be on to access account menu */ + + PORT_MODIFY( "DSW2" ) + PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW2:2") /* unknown */ + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x02, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x00, "Spin Length" ) PORT_DIPLOCATION("DSW2:8") /* OK */ + PORT_DIPSETTING( 0x00, "Long" ) + PORT_DIPSETTING( 0x80, "Short" ) +INPUT_PORTS_END + static INPUT_PORTS_START( unkch_controls ) PORT_START("IN0") @@ -13135,7 +13148,7 @@ GAME( 1996, nfb96seb, nfb96, amcoe2, nfb96bl, driver_device, 0, GAME( 2002, carb2002, nfb96, amcoe2, nfb96bl, driver_device, 0, ROT0, "bootleg", "Carriage Bonus 2002 (bootleg)", GAME_WRONG_COLORS ) GAME( 2003, carb2003, nfb96, amcoe2, nfb96bl, driver_device, 0, ROT0, "bootleg", "Carriage Bonus 2003 (bootleg)", GAME_WRONG_COLORS ) -GAME( 2003, nfm, 0, nfm, nfb96bl, driver_device, 0, ROT0, "Ming-Yang Electronic", "New Fruit Machine (Ming-Yang Electronic)", GAME_NOT_WORKING ) // vFB02-07A "Copyright By Ms. Liu Orchis 2003/03/06" +GAME( 2003, nfm, 0, nfm, nfm, driver_device, 0, ROT0, "Ming-Yang Electronic", "New Fruit Machine (Ming-Yang Electronic)", GAME_NOT_WORKING ) // vFB02-07A "Copyright By Ms. Liu Orchis 2003/03/06" // these have 'cherry 1994' in the program roms, but also "Super Cherry / New Cherry Gold '99" probably hacks of a 1994 version of Cherry Bonus / Cherry Master (Super Cherry Master?) GAMEL(1999, unkch1, 0, unkch, unkch, unkch_state, unkch1, ROT0, "bootleg", "New Cherry Gold '99 (bootleg of Super Cherry Master) (set 1)", 0, layout_unkch ) diff --git a/src/mame/drivers/peplus.c b/src/mame/drivers/peplus.c index bd3e86bbad0..a27ac0733bf 100644 --- a/src/mame/drivers/peplus.c +++ b/src/mame/drivers/peplus.c @@ -146,10 +146,10 @@ Super PE+ XMP00002 through XMP00006 & XMP00024 Use the XM000xxP Multi-Poker Data XMP00014, XMP00017 & XMP00030 Use the WING Board add-on and use the XnnnnnnP Poker Data (Not all are compatible!) XMP00013, XMP00022 & XMP00026 Use the WING Board add-on & CG2346 + CAPX2346 for Spanish paytables - XMP00025 Uses the Wing Board add-on and is for the International markets. Auto Hold always enabled. + XMP00025 Uses the XM000xxP Multi-Poker Data roms and is for the International markets. Auto Hold always enabled. XMnnnnnP Multi-Poker Data. Contains poker games + paytable percentages: Requires specific CG graphics + CAP color prom XKnnnnnn Spot Keno Programs. Different options for each set, but all use the same XnnnnnnK data roms - XnnnnnnK Spot Keno Data. Uses CG2120 with CAP1267 + XnnnnnnK Spot Keno Data. Uses CG2120 with CAPX1267 XSnnnnnn Slot Programs. Different options for each set, but all use the same XnnnnnnS data roms XnnnnnnT Tournament Slot Programs? Different options for each set, but all use the same XnnnnnnS data roms XnnnnnnS Slot Data. Each set requires specific CG graphics + CAP color prom @@ -9723,9 +9723,9 @@ GAMEL(1995, pex0053p, 0, peplus, peplus_poker, peplus_state, peplussb, GAMEL(1995, pex0054p, 0, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X000054P+XP000038) Deuces Wild Poker", 0, layout_pe_poker ) GAMEL(1995, pex0055p, 0, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X000055P+XP000019) Deuces Wild Poker", 0, layout_pe_poker ) GAMEL(1995, pex0055pa, pex0055p, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X000055P+XP000022) Deuces Wild Poker (The Orleans)", 0, layout_pe_poker ) -GAMEL(1995, pex0055pb, pex0055p, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X000055P+XP000023) Deuces Wild Poker (The Fun Ships)", GAME_WRONG_COLORS, layout_pe_poker ) /* CAP2399 not dumped */ +GAMEL(1995, pex0055pb, pex0055p, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X000055P+XP000023) Deuces Wild Poker (The Fun Ships)", GAME_WRONG_COLORS, layout_pe_poker ) /* CAPX2399 not dumped */ GAMEL(1995, pex0055pc, pex0055p, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X000055P+XP000028) Deuces Wild Poker (Horseshoe)", 0, layout_pe_poker ) -GAMEL(1995, pex0055pd, pex0055p, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X000055P+XP000035) Deuces Wild Poker (The Wild Wild West Casino)", GAME_WRONG_COLORS, layout_pe_poker ) /* CAP2389 not dumped */ +GAMEL(1995, pex0055pd, pex0055p, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X000055P+XP000035) Deuces Wild Poker (The Wild Wild West Casino)", GAME_WRONG_COLORS, layout_pe_poker ) /* CAPX2389 not dumped */ GAMEL(1995, pex0055pe, pex0055p, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X000055P+XP000038) Deuces Wild Poker", 0, layout_pe_poker ) GAMEL(1995, pex0055pf, pex0055p, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X000055P+XP000040) Deuces Wild Poker", 0, layout_pe_poker ) GAMEL(1995, pex0055pg, pex0055p, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X000055P+XP000053) Deuces Wild Poker", 0, layout_pe_poker ) @@ -9821,8 +9821,8 @@ GAMEL(1995, pex2251p, 0, peplus, peplus_poker, peplus_state, peplussb, GAMEL(1995, pex2272p, 0, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X002272P+XP000055) Black Jack Bonus Poker", 0, layout_pe_poker ) GAMEL(1995, pex2275p, 0, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X002275P+XP000055) Black Jack Bonus Poker", 0, layout_pe_poker ) GAMEL(1995, pex2276p, 0, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X002276P+XP000055) Black Jack Bonus Poker", 0, layout_pe_poker ) -GAMEL(1995, pex2283p, 0, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X002283P+XP000057) Dealt Deuces Wild Bonus Poker", 0, layout_pe_poker ) /* Undumped color CAP but should have correct colors anyways */ -GAMEL(1995, pex2284p, 0, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X002284P+XP000057) Barbaric Decues Wild Bonus Poker", 0, layout_pe_poker ) /* Undumped color CAP but should have correct colors anyways */ +GAMEL(1995, pex2283p, 0, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X002283P+XP000057) Dealt Deuces Wild Bonus Poker", 0, layout_pe_poker ) /* Undumped color CAPX but should have correct colors anyways */ +GAMEL(1995, pex2284p, 0, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X002284P+XP000057) Barbaric Decues Wild Bonus Poker", 0, layout_pe_poker ) /* Undumped color CAPX but should have correct colors anyways */ GAMEL(1995, pex2302p, 0, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X002302P+XP000038) Bonus Poker Deluxe", 0, layout_pe_poker ) GAMEL(1995, pex2303p, 0, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X002303P+XP000112) White Hot Aces Poker", 0, layout_pe_poker ) GAMEL(1995, pex2306p, 0, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X002306P+XP000112) Triple Double Bonus Poker", 0, layout_pe_poker ) diff --git a/src/mess/drivers/hh_hmcs40.c b/src/mess/drivers/hh_hmcs40.c index c06521aed8a..14ccef23591 100644 --- a/src/mess/drivers/hh_hmcs40.c +++ b/src/mess/drivers/hh_hmcs40.c @@ -68,8 +68,8 @@ public: optional_device<speaker_sound_device> m_speaker; // misc common - UINT8 m_r[8]; // MCU R ports write data - UINT16 m_d; // MCU D port write data + UINT8 m_r[8]; // MCU R ports write data (optional) + UINT16 m_d; // MCU D port write data (optional) UINT8 m_int[2]; // MCU INT0/1 pins state UINT16 m_inp_mux; // multiplexed inputs mask @@ -96,64 +96,6 @@ public: void set_display_size(int maxx, int maxy); void display_matrix(int maxx, int maxy, UINT64 setx, UINT32 sety); - // game-specific handlers - DECLARE_WRITE8_MEMBER(bambball_plate_w); - DECLARE_WRITE16_MEMBER(bambball_grid_w); - DECLARE_READ8_MEMBER(bambball_input_r); - - DECLARE_WRITE8_MEMBER(alnattck_plate_w); - DECLARE_WRITE16_MEMBER(alnattck_grid_w); - DECLARE_READ16_MEMBER(alnattck_input_r); - - DECLARE_WRITE8_MEMBER(packmon_plate_w); - DECLARE_WRITE16_MEMBER(packmon_grid_w); - DECLARE_READ16_MEMBER(packmon_input_r); - - DECLARE_WRITE8_MEMBER(zackman_plate_w); - DECLARE_WRITE16_MEMBER(zackman_grid_w); - void zackman_update_int0(); - DECLARE_INPUT_CHANGED_MEMBER(zackman_input_changed); - - int m_cdkong_speaker_volume; - TIMER_DEVICE_CALLBACK_MEMBER(cdkong_speaker_decay_sim); - void cdkong_display(); - DECLARE_WRITE8_MEMBER(cdkong_plate_w); - DECLARE_WRITE16_MEMBER(cdkong_grid_w); - DECLARE_MACHINE_START(cdkong); - - void cgalaxn_display(); - DECLARE_WRITE16_MEMBER(cgalaxn_plate_w); - DECLARE_WRITE8_MEMBER(cgalaxn_grid_w); - DECLARE_READ8_MEMBER(cgalaxn_input_r); - - DECLARE_WRITE8_MEMBER(cpacman_plate_w); - DECLARE_WRITE16_MEMBER(cpacman_grid_w); - DECLARE_READ8_MEMBER(cpacman_input_r); - - DECLARE_WRITE8_MEMBER(cmspacmn_plate_w); - DECLARE_WRITE16_MEMBER(cmspacmn_grid_w); - DECLARE_READ8_MEMBER(cmspacmn_input_r); - - void egalaxn2_display(); - DECLARE_WRITE8_MEMBER(egalaxn2_plate_w); - DECLARE_WRITE16_MEMBER(egalaxn2_grid_w); - DECLARE_READ8_MEMBER(egalaxn2_input_r); - - DECLARE_WRITE8_MEMBER(pbqbert_plate_w); - DECLARE_WRITE16_MEMBER(pbqbert_grid_w); - - void kingman_display(); - DECLARE_WRITE8_MEMBER(kingman_plate_w); - DECLARE_WRITE16_MEMBER(kingman_grid_w); - void kingman_update_int0(); - DECLARE_INPUT_CHANGED_MEMBER(kingman_input_changed); - - void tmtron_display(); - DECLARE_WRITE8_MEMBER(tmtron_plate_w); - DECLARE_WRITE16_MEMBER(tmtron_grid_w); - void tmtron_update_int1(); - DECLARE_INPUT_CHANGED_MEMBER(tmtron_input_changed); - protected: virtual void machine_start(); virtual void machine_reset(); @@ -337,7 +279,7 @@ INPUT_CHANGED_MEMBER(hh_hmcs40_state::single_interrupt_line) /*************************************************************************** - Minidrivers (I/O, Inputs, Machine Config) + Minidrivers (subclass, I/O, Inputs, Machine Config) ***************************************************************************/ @@ -352,7 +294,21 @@ INPUT_CHANGED_MEMBER(hh_hmcs40_state::single_interrupt_line) ***************************************************************************/ -WRITE8_MEMBER(hh_hmcs40_state::bambball_plate_w) +class bambball_state : public hh_hmcs40_state +{ +public: + bambball_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_hmcs40_state(mconfig, type, tag) + { } + + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE16_MEMBER(grid_w); + DECLARE_READ8_MEMBER(input_r); +}; + +// handlers + +WRITE8_MEMBER(bambball_state::plate_w) { // R1x-R3x, D0-D3: vfd matrix plate int shift = (offset - HMCS40_PORT_R1X) * 4; @@ -360,11 +316,10 @@ WRITE8_MEMBER(hh_hmcs40_state::bambball_plate_w) // update display UINT16 plate = BITSWAP16(m_plate,13,8,4,12,9,10,14,1,7,0,15,11,6,3,5,2); - display_matrix(16, 9, plate, m_grid); } -WRITE16_MEMBER(hh_hmcs40_state::bambball_grid_w) +WRITE16_MEMBER(bambball_state::grid_w) { // D4: speaker out m_speaker->level_w(data >> 4 & 1); @@ -376,16 +331,18 @@ WRITE16_MEMBER(hh_hmcs40_state::bambball_grid_w) m_grid = data >> 7 & 0x1ff; // D0-D3: plates (update display there) - bambball_plate_w(space, 3 + HMCS40_PORT_R1X, data & 0xf); + plate_w(space, 3 + HMCS40_PORT_R1X, data & 0xf); } -READ8_MEMBER(hh_hmcs40_state::bambball_input_r) +READ8_MEMBER(bambball_state::input_r) { // R0x: inputs return read_inputs(4); } +// config + static INPUT_PORTS_START( bambball ) PORT_START("IN.0") // D7 port R0x PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Dribble Low") @@ -413,16 +370,15 @@ static INPUT_PORTS_START( bambball ) PORT_CONFSETTING( 0x00, "2" ) INPUT_PORTS_END - -static MACHINE_CONFIG_START( bambball, hh_hmcs40_state ) +static MACHINE_CONFIG_START( bambball, bambball_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", HD38750, 400000) // approximation - RC osc. - MCFG_HMCS40_READ_R_CB(0, READ8(hh_hmcs40_state, bambball_input_r)) - MCFG_HMCS40_WRITE_R_CB(1, WRITE8(hh_hmcs40_state, bambball_plate_w)) - MCFG_HMCS40_WRITE_R_CB(2, WRITE8(hh_hmcs40_state, bambball_plate_w)) - MCFG_HMCS40_WRITE_R_CB(3, WRITE8(hh_hmcs40_state, bambball_plate_w)) - MCFG_HMCS40_WRITE_D_CB(WRITE16(hh_hmcs40_state, bambball_grid_w)) + MCFG_HMCS40_READ_R_CB(0, READ8(bambball_state, input_r)) + MCFG_HMCS40_WRITE_R_CB(1, WRITE8(bambball_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(bambball_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(3, WRITE8(bambball_state, plate_w)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(bambball_state, grid_w)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) @@ -450,7 +406,21 @@ MACHINE_CONFIG_END ***************************************************************************/ -WRITE8_MEMBER(hh_hmcs40_state::packmon_plate_w) +class packmon_state : public hh_hmcs40_state +{ +public: + packmon_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_hmcs40_state(mconfig, type, tag) + { } + + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE16_MEMBER(grid_w); + DECLARE_READ16_MEMBER(input_r); +}; + +// handlers + +WRITE8_MEMBER(packmon_state::plate_w) { // R0x-R3x, D0-D3: vfd matrix plate int shift = offset * 4; @@ -459,11 +429,10 @@ WRITE8_MEMBER(hh_hmcs40_state::packmon_plate_w) // update display UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,0,1,2,3,4,5,6,7,8,9); UINT32 plate = BITSWAP24(m_plate,23,22,21,20,0,1,2,3,4,5,6,19,18,17,16,15,14,13,12,11,10,9,8,7); - display_matrix(20, 10, plate, grid); } -WRITE16_MEMBER(hh_hmcs40_state::packmon_grid_w) +WRITE16_MEMBER(packmon_state::grid_w) { // D4: speaker out m_speaker->level_w(data >> 4 & 1); @@ -475,16 +444,18 @@ WRITE16_MEMBER(hh_hmcs40_state::packmon_grid_w) m_grid = data >> 6 & 0x3ff; // D0-D3: plate 9-12 (update display there) - packmon_plate_w(space, 4, data & 0xf); + plate_w(space, 4, data & 0xf); } -READ16_MEMBER(hh_hmcs40_state::packmon_input_r) +READ16_MEMBER(packmon_state::input_r) { // D5: multiplexed inputs return read_inputs(5); } +// config + static INPUT_PORTS_START( packmon ) PORT_START("IN.0") // D11 line D5 PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_START ) @@ -502,17 +473,16 @@ static INPUT_PORTS_START( packmon ) PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) INPUT_PORTS_END - -static MACHINE_CONFIG_START( packmon, hh_hmcs40_state ) +static MACHINE_CONFIG_START( packmon, packmon_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", HD38800, 400000) // approximation - RC osc. - MCFG_HMCS40_WRITE_R_CB(0, WRITE8(hh_hmcs40_state, packmon_plate_w)) - MCFG_HMCS40_WRITE_R_CB(1, WRITE8(hh_hmcs40_state, packmon_plate_w)) - MCFG_HMCS40_WRITE_R_CB(2, WRITE8(hh_hmcs40_state, packmon_plate_w)) - MCFG_HMCS40_WRITE_R_CB(3, WRITE8(hh_hmcs40_state, packmon_plate_w)) - MCFG_HMCS40_WRITE_D_CB(WRITE16(hh_hmcs40_state, packmon_grid_w)) - MCFG_HMCS40_READ_D_CB(READ16(hh_hmcs40_state, packmon_input_r)) + MCFG_HMCS40_WRITE_R_CB(0, WRITE8(packmon_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(1, WRITE8(packmon_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(packmon_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(3, WRITE8(packmon_state, plate_w)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(packmon_state, grid_w)) + MCFG_HMCS40_READ_D_CB(READ16(packmon_state, input_r)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) @@ -539,7 +509,23 @@ MACHINE_CONFIG_END ***************************************************************************/ -WRITE8_MEMBER(hh_hmcs40_state::zackman_plate_w) +class zackman_state : public hh_hmcs40_state +{ +public: + zackman_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_hmcs40_state(mconfig, type, tag) + { } + + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE16_MEMBER(grid_w); + + void update_int0(); + DECLARE_INPUT_CHANGED_MEMBER(input_changed); +}; + +// handlers + +WRITE8_MEMBER(zackman_state::plate_w) { // R0x-R6x,D0,D1: vfd matrix plate int shift = offset * 4; @@ -548,11 +534,10 @@ WRITE8_MEMBER(hh_hmcs40_state::zackman_plate_w) // update display UINT8 grid = BITSWAP8(m_grid,0,1,2,3,4,5,6,7); UINT32 plate = BITSWAP32(m_plate,31,30,27,0,1,2,3,4,5,6,7,8,9,10,11,24,25,26,29,28,23,22,21,20,19,18,17,16,15,14,13,12); - display_matrix(29, 8, plate, grid); } -WRITE16_MEMBER(hh_hmcs40_state::zackman_grid_w) +WRITE16_MEMBER(zackman_state::grid_w) { // D2: speaker out m_speaker->level_w(data >> 2 & 1); @@ -562,58 +547,60 @@ WRITE16_MEMBER(hh_hmcs40_state::zackman_grid_w) if (inp_mux != m_inp_mux) { m_inp_mux = inp_mux; - zackman_update_int0(); + update_int0(); } // D8-D15: vfd matrix grid m_grid = data >> 8 & 0xff; // D0,D1: plate 12,13 (update display there) - zackman_plate_w(space, 7, data & 3); + plate_w(space, 7, data & 3); } -void hh_hmcs40_state::zackman_update_int0() +void zackman_state::update_int0() { // INT0 on multiplexed inputs set_interrupt(0, read_inputs(4)); } -INPUT_CHANGED_MEMBER(hh_hmcs40_state::zackman_input_changed) -{ - zackman_update_int0(); -} +// config static INPUT_PORTS_START( zackman ) PORT_START("IN.0") // D11 INT0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, zackman_input_changed, NULL) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CHANGED_MEMBER(DEVICE_SELF, zackman_state, input_changed, NULL) PORT_START("IN.1") // D12 INT0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, zackman_input_changed, NULL) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CHANGED_MEMBER(DEVICE_SELF, zackman_state, input_changed, NULL) PORT_START("IN.2") // D13 INT0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, zackman_input_changed, NULL) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, zackman_state, input_changed, NULL) PORT_START("IN.3") // D14 INT0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, zackman_input_changed, NULL) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CHANGED_MEMBER(DEVICE_SELF, zackman_state, input_changed, NULL) PORT_START("IN.4") // INT1 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, single_interrupt_line, (void *)1) INPUT_PORTS_END +INPUT_CHANGED_MEMBER(zackman_state::input_changed) +{ + update_int0(); +} + -static MACHINE_CONFIG_START( zackman, hh_hmcs40_state ) +static MACHINE_CONFIG_START( zackman, zackman_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", HD38820, 400000) // approximation - RC osc. - MCFG_HMCS40_WRITE_R_CB(0, WRITE8(hh_hmcs40_state, zackman_plate_w)) - MCFG_HMCS40_WRITE_R_CB(1, WRITE8(hh_hmcs40_state, zackman_plate_w)) - MCFG_HMCS40_WRITE_R_CB(2, WRITE8(hh_hmcs40_state, zackman_plate_w)) - MCFG_HMCS40_WRITE_R_CB(3, WRITE8(hh_hmcs40_state, zackman_plate_w)) - MCFG_HMCS40_WRITE_R_CB(4, WRITE8(hh_hmcs40_state, zackman_plate_w)) - MCFG_HMCS40_WRITE_R_CB(5, WRITE8(hh_hmcs40_state, zackman_plate_w)) - MCFG_HMCS40_WRITE_R_CB(6, WRITE8(hh_hmcs40_state, zackman_plate_w)) - MCFG_HMCS40_WRITE_D_CB(WRITE16(hh_hmcs40_state, zackman_grid_w)) + MCFG_HMCS40_WRITE_R_CB(0, WRITE8(zackman_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(1, WRITE8(zackman_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(zackman_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(3, WRITE8(zackman_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(4, WRITE8(zackman_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(5, WRITE8(zackman_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(6, WRITE8(zackman_state, plate_w)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(zackman_state, grid_w)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) @@ -640,7 +627,21 @@ MACHINE_CONFIG_END ***************************************************************************/ -WRITE8_MEMBER(hh_hmcs40_state::alnattck_plate_w) +class alnattck_state : public hh_hmcs40_state +{ +public: + alnattck_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_hmcs40_state(mconfig, type, tag) + { } + + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE16_MEMBER(grid_w); + DECLARE_READ16_MEMBER(input_r); +}; + +// handlers + +WRITE8_MEMBER(alnattck_state::plate_w) { // R0x-R3x, D0-D3: vfd matrix plate int shift = offset * 4; @@ -648,11 +649,10 @@ WRITE8_MEMBER(hh_hmcs40_state::alnattck_plate_w) // update display UINT32 plate = BITSWAP16(m_plate,11,9,8,10,7,2,0,1,3,4,5,6,12,13,14,15) | (m_plate & 0xf0000); - display_matrix(20, 10, plate, m_grid); } -WRITE16_MEMBER(hh_hmcs40_state::alnattck_grid_w) +WRITE16_MEMBER(alnattck_state::grid_w) { // D4: speaker out m_speaker->level_w(data >> 4 & 1); @@ -664,16 +664,18 @@ WRITE16_MEMBER(hh_hmcs40_state::alnattck_grid_w) m_grid = data >> 6 & 0x3ff; // D0-D3: plate 16-19 (update display there) - alnattck_plate_w(space, 4, data & 0xf); + plate_w(space, 4, data & 0xf); } -READ16_MEMBER(hh_hmcs40_state::alnattck_input_r) +READ16_MEMBER(alnattck_state::input_r) { // D5: multiplexed inputs return read_inputs(7); } +// config + static INPUT_PORTS_START( alnattck ) PORT_START("IN.0") // D5 D7 PORT_CONFNAME( 0x20, 0x00, "Skill Level" ) @@ -699,17 +701,16 @@ static INPUT_PORTS_START( alnattck ) PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Fire") INPUT_PORTS_END - -static MACHINE_CONFIG_START( alnattck, hh_hmcs40_state ) +static MACHINE_CONFIG_START( alnattck, alnattck_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", HD38800, 400000) // approximation - RC osc. - MCFG_HMCS40_WRITE_R_CB(0, WRITE8(hh_hmcs40_state, alnattck_plate_w)) - MCFG_HMCS40_WRITE_R_CB(1, WRITE8(hh_hmcs40_state, alnattck_plate_w)) - MCFG_HMCS40_WRITE_R_CB(2, WRITE8(hh_hmcs40_state, alnattck_plate_w)) - MCFG_HMCS40_WRITE_R_CB(3, WRITE8(hh_hmcs40_state, alnattck_plate_w)) - MCFG_HMCS40_WRITE_D_CB(WRITE16(hh_hmcs40_state, alnattck_grid_w)) - MCFG_HMCS40_READ_D_CB(READ16(hh_hmcs40_state, alnattck_input_r)) + MCFG_HMCS40_WRITE_R_CB(0, WRITE8(alnattck_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(1, WRITE8(alnattck_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(alnattck_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(3, WRITE8(alnattck_state, plate_w)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(alnattck_state, grid_w)) + MCFG_HMCS40_READ_D_CB(READ16(alnattck_state, input_r)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) @@ -737,6 +738,26 @@ MACHINE_CONFIG_END ***************************************************************************/ +class cdkong_state : public hh_hmcs40_state +{ +public: + cdkong_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_hmcs40_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE16_MEMBER(grid_w); + + int m_speaker_volume; + TIMER_DEVICE_CALLBACK_MEMBER(speaker_decay_sim); + +protected: + virtual void machine_start(); +}; + +// handlers + // Sound is controlled by two pins: D3 for pitch, and R13 for on/off. When turned // off, it does not mute instantly, but volume slowly decays. Until we emulate it // with discrete audio, this crude simulation will do. @@ -744,42 +765,44 @@ MACHINE_CONFIG_END #define CDKONG_SPEAKER_MAX 0x10000 #define CDKONG_SPEAKER_DECAY 50 -TIMER_DEVICE_CALLBACK_MEMBER(hh_hmcs40_state::cdkong_speaker_decay_sim) +TIMER_DEVICE_CALLBACK_MEMBER(cdkong_state::speaker_decay_sim) { - m_speaker->set_output_gain(0, m_cdkong_speaker_volume / (double)CDKONG_SPEAKER_MAX); - m_cdkong_speaker_volume /= 2; + m_speaker->set_output_gain(0, m_speaker_volume / (double)CDKONG_SPEAKER_MAX); + m_speaker_volume /= 2; } -void hh_hmcs40_state::cdkong_display() + +void cdkong_state::prepare_display() { UINT32 plate = BITSWAP32(m_plate,31,30,29,24,0,16,8,1,23,17,9,2,18,10,25,27,26,3,15,27,11,11,14,22,6,13,21,5,19,12,20,4); - display_matrix(29, 11, plate, m_grid); } -WRITE8_MEMBER(hh_hmcs40_state::cdkong_plate_w) +WRITE8_MEMBER(cdkong_state::plate_w) { // R13: speaker on if (offset == HMCS40_PORT_R1X && data & 8) - m_cdkong_speaker_volume = CDKONG_SPEAKER_MAX; + m_speaker_volume = CDKONG_SPEAKER_MAX; // R0x-R6x: vfd matrix plate int shift = offset * 4; m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - cdkong_display(); + prepare_display(); } -WRITE16_MEMBER(hh_hmcs40_state::cdkong_grid_w) +WRITE16_MEMBER(cdkong_state::grid_w) { // D3: speaker out m_speaker->level_w(data >> 3 & 1); // D4-D14: vfd matrix grid m_grid = data >> 4 & 0x7ff; - cdkong_display(); + prepare_display(); } +// config + static INPUT_PORTS_START( cdkong ) PORT_START("IN.0") // port D PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) @@ -793,35 +816,33 @@ static INPUT_PORTS_START( cdkong ) INPUT_PORTS_END -MACHINE_START_MEMBER(hh_hmcs40_state, cdkong) +void cdkong_state::machine_start() { hh_hmcs40_state::machine_start(); - + // zerofill/init - m_cdkong_speaker_volume = 0; - save_item(NAME(m_cdkong_speaker_volume)); + m_speaker_volume = 0; + save_item(NAME(m_speaker_volume)); } -static MACHINE_CONFIG_START( cdkong, hh_hmcs40_state ) +static MACHINE_CONFIG_START( cdkong, cdkong_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", HD38820, 400000) // approximation - RC osc. - MCFG_HMCS40_WRITE_R_CB(0, WRITE8(hh_hmcs40_state, cdkong_plate_w)) - MCFG_HMCS40_WRITE_R_CB(1, WRITE8(hh_hmcs40_state, cdkong_plate_w)) - MCFG_HMCS40_WRITE_R_CB(2, WRITE8(hh_hmcs40_state, cdkong_plate_w)) - MCFG_HMCS40_WRITE_R_CB(3, WRITE8(hh_hmcs40_state, cdkong_plate_w)) - MCFG_HMCS40_WRITE_R_CB(4, WRITE8(hh_hmcs40_state, cdkong_plate_w)) - MCFG_HMCS40_WRITE_R_CB(5, WRITE8(hh_hmcs40_state, cdkong_plate_w)) - MCFG_HMCS40_WRITE_R_CB(6, WRITE8(hh_hmcs40_state, cdkong_plate_w)) - MCFG_HMCS40_WRITE_D_CB(WRITE16(hh_hmcs40_state, cdkong_grid_w)) + MCFG_HMCS40_WRITE_R_CB(0, WRITE8(cdkong_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(1, WRITE8(cdkong_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(cdkong_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(3, WRITE8(cdkong_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(4, WRITE8(cdkong_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(5, WRITE8(cdkong_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(6, WRITE8(cdkong_state, plate_w)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(cdkong_state, grid_w)) MCFG_HMCS40_READ_D_CB(IOPORT("IN.0")) - MCFG_TIMER_DRIVER_ADD_PERIODIC("speaker_decay", hh_hmcs40_state, cdkong_speaker_decay_sim, attotime::from_msec(CDKONG_SPEAKER_DECAY)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("speaker_decay", cdkong_state, speaker_decay_sim, attotime::from_msec(CDKONG_SPEAKER_DECAY)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) - MCFG_MACHINE_START_OVERRIDE(hh_hmcs40_state, cdkong) - /* no video! */ /* sound hardware */ @@ -851,15 +872,29 @@ MACHINE_CONFIG_END ***************************************************************************/ -void hh_hmcs40_state::cgalaxn_display() +class cgalaxn_state : public hh_hmcs40_state +{ +public: + cgalaxn_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_hmcs40_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE16_MEMBER(plate_w); + DECLARE_WRITE8_MEMBER(grid_w); + DECLARE_READ8_MEMBER(input_r); +}; + +// handlers + +void cgalaxn_state::prepare_display() { UINT16 grid = BITSWAP16(m_grid,15,14,13,12,1,2,0,11,10,9,8,7,6,5,4,3); UINT16 plate = BITSWAP16(m_plate,15,14,5,4,3,2,1,0,7,11,12,9,8,10,6,13); - display_matrix(14, 12, plate, grid); } -WRITE8_MEMBER(hh_hmcs40_state::cgalaxn_grid_w) +WRITE8_MEMBER(cgalaxn_state::grid_w) { // D0: speaker out m_speaker->level_w(data & 1); @@ -868,16 +903,10 @@ WRITE8_MEMBER(hh_hmcs40_state::cgalaxn_grid_w) // D2-D15: vfd matrix plate m_plate = data >> 2 & 0x3fff; - cgalaxn_display(); - - // a, f, g, c, e, d, h, b, p, o, n, m, k, i - - // 0, 5, 6, 2, 4, 3, 7, 1,13,12,11,10, 9, 8 - // 15,14,13,12,11,10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 - // 15,14, 5, 4, 3, 2, 1, 0, 7,11,12, 9, 8,10, 6,13 + prepare_display(); } -WRITE16_MEMBER(hh_hmcs40_state::cgalaxn_plate_w) +WRITE16_MEMBER(cgalaxn_state::plate_w) { // R10,R11: input mux if (offset == HMCS40_PORT_R1X) @@ -886,23 +915,18 @@ WRITE16_MEMBER(hh_hmcs40_state::cgalaxn_plate_w) // R1x-R3x: vfd matrix grid int shift = (offset - HMCS40_PORT_R1X) * 4; m_grid = (m_grid & ~(0xf << shift)) | (data << shift); - - cgalaxn_display(); - - // 9, 8, 7, 6, 5, 4, 3, 2, 1,11,12,10 - - // 8, 7, 6, 5, 4, 3, 2, 1, 0,10,11, 9 - // 15,14,13,12,11,10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 - // 15,14,13,12, 1, 2, 0,11,10, 9, 8, 7, 6, 5, 4, 3 + prepare_display(); } -READ8_MEMBER(hh_hmcs40_state::cgalaxn_input_r) +READ8_MEMBER(cgalaxn_state::input_r) { // R0x: multiplexed inputs return read_inputs(2); } +// config + static INPUT_PORTS_START( cgalaxn ) PORT_START("IN.0") // R10 port R0x PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) @@ -923,16 +947,15 @@ static INPUT_PORTS_START( cgalaxn ) PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, single_interrupt_line, (void *)1) INPUT_PORTS_END - -static MACHINE_CONFIG_START( cgalaxn, hh_hmcs40_state ) +static MACHINE_CONFIG_START( cgalaxn, cgalaxn_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", HD38800, 400000) // approximation - RC osc. - MCFG_HMCS40_READ_R_CB(0, READ8(hh_hmcs40_state, cgalaxn_input_r)) - MCFG_HMCS40_WRITE_R_CB(1, WRITE8(hh_hmcs40_state, cgalaxn_grid_w)) - MCFG_HMCS40_WRITE_R_CB(2, WRITE8(hh_hmcs40_state, cgalaxn_grid_w)) - MCFG_HMCS40_WRITE_R_CB(3, WRITE8(hh_hmcs40_state, cgalaxn_grid_w)) - MCFG_HMCS40_WRITE_D_CB(WRITE16(hh_hmcs40_state, cgalaxn_plate_w)) + MCFG_HMCS40_READ_R_CB(0, READ8(cgalaxn_state, input_r)) + MCFG_HMCS40_WRITE_R_CB(1, WRITE8(cgalaxn_state, grid_w)) + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(cgalaxn_state, grid_w)) + MCFG_HMCS40_WRITE_R_CB(3, WRITE8(cgalaxn_state, grid_w)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(cgalaxn_state, plate_w)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) @@ -970,7 +993,21 @@ MACHINE_CONFIG_END ***************************************************************************/ -WRITE8_MEMBER(hh_hmcs40_state::cpacman_plate_w) +class cpacman_state : public hh_hmcs40_state +{ +public: + cpacman_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_hmcs40_state(mconfig, type, tag) + { } + + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE16_MEMBER(grid_w); + DECLARE_READ8_MEMBER(input_r); +}; + +// handlers + +WRITE8_MEMBER(cpacman_state::plate_w) { // R1x-R6x, D1,D2: vfd matrix plate int shift = (offset - HMCS40_PORT_R1X) * 4; @@ -979,11 +1016,10 @@ WRITE8_MEMBER(hh_hmcs40_state::cpacman_plate_w) // update display UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,0,1,2,3,4,5,6,7,8,9,10); UINT32 plate = BITSWAP32(m_plate,31,30,29,28,27,0,1,2,3,8,9,10,11,16,17,18,19,25,26,23,22,21,20,24,15,14,13,12,4,5,6,7); - display_matrix(27, 11, plate, grid); } -WRITE16_MEMBER(hh_hmcs40_state::cpacman_grid_w) +WRITE16_MEMBER(cpacman_state::grid_w) { // D0: speaker out m_speaker->level_w(data & 1); @@ -995,16 +1031,18 @@ WRITE16_MEMBER(hh_hmcs40_state::cpacman_grid_w) m_grid = data >> 5 & 0x7ff; // D1,D2: plate 8,14 (update display there) - cpacman_plate_w(space, 6 + HMCS40_PORT_R1X, data >> 1 & 3); + plate_w(space, 6 + HMCS40_PORT_R1X, data >> 1 & 3); } -READ8_MEMBER(hh_hmcs40_state::cpacman_input_r) +READ8_MEMBER(cpacman_state::input_r) { // R0x: multiplexed inputs return read_inputs(3); } +// config + static INPUT_PORTS_START( cpacman ) PORT_START("IN.0") // D13 port R0x PORT_CONFNAME( 0x01, 0x01, "Skill Level" ) @@ -1025,19 +1063,18 @@ static INPUT_PORTS_START( cpacman ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) INPUT_PORTS_END - -static MACHINE_CONFIG_START( cpacman, hh_hmcs40_state ) +static MACHINE_CONFIG_START( cpacman, cpacman_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", HD38820, 400000) // approximation - RC osc. - MCFG_HMCS40_READ_R_CB(0, READ8(hh_hmcs40_state, cpacman_input_r)) - MCFG_HMCS40_WRITE_R_CB(1, WRITE8(hh_hmcs40_state, cpacman_plate_w)) - MCFG_HMCS40_WRITE_R_CB(2, WRITE8(hh_hmcs40_state, cpacman_plate_w)) - MCFG_HMCS40_WRITE_R_CB(3, WRITE8(hh_hmcs40_state, cpacman_plate_w)) - MCFG_HMCS40_WRITE_R_CB(4, WRITE8(hh_hmcs40_state, cpacman_plate_w)) - MCFG_HMCS40_WRITE_R_CB(5, WRITE8(hh_hmcs40_state, cpacman_plate_w)) - MCFG_HMCS40_WRITE_R_CB(6, WRITE8(hh_hmcs40_state, cpacman_plate_w)) - MCFG_HMCS40_WRITE_D_CB(WRITE16(hh_hmcs40_state, cpacman_grid_w)) + MCFG_HMCS40_READ_R_CB(0, READ8(cpacman_state, input_r)) + MCFG_HMCS40_WRITE_R_CB(1, WRITE8(cpacman_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(cpacman_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(3, WRITE8(cpacman_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(4, WRITE8(cpacman_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(5, WRITE8(cpacman_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(6, WRITE8(cpacman_state, plate_w)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(cpacman_state, grid_w)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) @@ -1073,7 +1110,21 @@ MACHINE_CONFIG_END ***************************************************************************/ -WRITE8_MEMBER(hh_hmcs40_state::cmspacmn_plate_w) +class cmspacmn_state : public hh_hmcs40_state +{ +public: + cmspacmn_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_hmcs40_state(mconfig, type, tag) + { } + + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE16_MEMBER(grid_w); + DECLARE_READ8_MEMBER(input_r); +}; + +// handlers + +WRITE8_MEMBER(cmspacmn_state::plate_w) { // R1x-R6x, D0,D1: vfd matrix plate int shift = (offset - HMCS40_PORT_R1X) * 4; @@ -1082,11 +1133,10 @@ WRITE8_MEMBER(hh_hmcs40_state::cmspacmn_plate_w) // update display UINT16 grid = BITSWAP16(m_grid,15,14,13,11,10,9,8,7,6,5,4,3,2,1,0,1); UINT64 plate = BIT(m_plate,15)<<32 | BITSWAP32(m_plate,14,13,12,4,5,6,7,24,23,25,22,21,20,13,24,3,19,14,12,11,24,2,10,8,7,25,0,9,1,18,17,16); - display_matrix(33, 12, plate, grid); } -WRITE16_MEMBER(hh_hmcs40_state::cmspacmn_grid_w) +WRITE16_MEMBER(cmspacmn_state::grid_w) { // D2: speaker out m_speaker->level_w(data >> 2 & 1); @@ -1098,16 +1148,18 @@ WRITE16_MEMBER(hh_hmcs40_state::cmspacmn_grid_w) m_grid = data >> 5 & 0x7ff; // D0,D1: plate 11+17,6+22 (update display there) - cmspacmn_plate_w(space, 6 + HMCS40_PORT_R1X, data & 3); + plate_w(space, 6 + HMCS40_PORT_R1X, data & 3); } -READ8_MEMBER(hh_hmcs40_state::cmspacmn_input_r) +READ8_MEMBER(cmspacmn_state::input_r) { // R0x: multiplexed inputs return read_inputs(3); } +// config + static INPUT_PORTS_START( cmspacmn ) PORT_START("IN.0") // D13 port R0x PORT_CONFNAME( 0x01, 0x00, "Skill Level" ) @@ -1128,19 +1180,18 @@ static INPUT_PORTS_START( cmspacmn ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) INPUT_PORTS_END - -static MACHINE_CONFIG_START( cmspacmn, hh_hmcs40_state ) +static MACHINE_CONFIG_START( cmspacmn, cmspacmn_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", HD38820, 400000) // approximation - RC osc. - MCFG_HMCS40_READ_R_CB(0, READ8(hh_hmcs40_state, cmspacmn_input_r)) - MCFG_HMCS40_WRITE_R_CB(1, WRITE8(hh_hmcs40_state, cmspacmn_plate_w)) - MCFG_HMCS40_WRITE_R_CB(2, WRITE8(hh_hmcs40_state, cmspacmn_plate_w)) - MCFG_HMCS40_WRITE_R_CB(3, WRITE8(hh_hmcs40_state, cmspacmn_plate_w)) - MCFG_HMCS40_WRITE_R_CB(4, WRITE8(hh_hmcs40_state, cmspacmn_plate_w)) - MCFG_HMCS40_WRITE_R_CB(5, WRITE8(hh_hmcs40_state, cmspacmn_plate_w)) - MCFG_HMCS40_WRITE_R_CB(6, WRITE8(hh_hmcs40_state, cmspacmn_plate_w)) - MCFG_HMCS40_WRITE_D_CB(WRITE16(hh_hmcs40_state, cmspacmn_grid_w)) + MCFG_HMCS40_READ_R_CB(0, READ8(cmspacmn_state, input_r)) + MCFG_HMCS40_WRITE_R_CB(1, WRITE8(cmspacmn_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(cmspacmn_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(3, WRITE8(cmspacmn_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(4, WRITE8(cmspacmn_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(5, WRITE8(cmspacmn_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(6, WRITE8(cmspacmn_state, plate_w)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(cmspacmn_state, grid_w)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) @@ -1167,15 +1218,29 @@ MACHINE_CONFIG_END ***************************************************************************/ -void hh_hmcs40_state::egalaxn2_display() +class egalaxn2_state : public hh_hmcs40_state +{ +public: + egalaxn2_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_hmcs40_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE16_MEMBER(grid_w); + DECLARE_READ8_MEMBER(input_r); +}; + +// handlers + +void egalaxn2_state::prepare_display() { UINT16 grid = BITSWAP16(m_grid,15,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14); UINT32 plate = BITSWAP24(m_plate,23,22,21,20,15,14,13,12,7,6,5,4,3,2,1,0,19,18,17,16,11,10,9,8); - display_matrix(24, 15, plate, grid); } -WRITE16_MEMBER(hh_hmcs40_state::egalaxn2_grid_w) +WRITE16_MEMBER(egalaxn2_state::grid_w) { // D0: speaker out m_speaker->level_w(data & 1); @@ -1185,25 +1250,26 @@ WRITE16_MEMBER(hh_hmcs40_state::egalaxn2_grid_w) // D1-D15: vfd matrix grid m_grid = data >> 1; - egalaxn2_display(); + prepare_display(); } -WRITE8_MEMBER(hh_hmcs40_state::egalaxn2_plate_w) +WRITE8_MEMBER(egalaxn2_state::plate_w) { // R1x-R6x: vfd matrix plate int shift = (offset - HMCS40_PORT_R1X) * 4; m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - - egalaxn2_display(); + prepare_display(); } -READ8_MEMBER(hh_hmcs40_state::egalaxn2_input_r) +READ8_MEMBER(egalaxn2_state::input_r) { // R0x: multiplexed inputs return read_inputs(4); } +// config + static INPUT_PORTS_START( egalaxn2 ) PORT_START("IN.0") // D1 port R0x PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) @@ -1235,18 +1301,18 @@ static INPUT_PORTS_START( egalaxn2 ) INPUT_PORTS_END -static MACHINE_CONFIG_START( egalaxn2, hh_hmcs40_state ) +static MACHINE_CONFIG_START( egalaxn2, egalaxn2_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", HD38820, 400000) // approximation - RC osc. - MCFG_HMCS40_READ_R_CB(0, READ8(hh_hmcs40_state, egalaxn2_input_r)) - MCFG_HMCS40_WRITE_R_CB(1, WRITE8(hh_hmcs40_state, egalaxn2_plate_w)) - MCFG_HMCS40_WRITE_R_CB(2, WRITE8(hh_hmcs40_state, egalaxn2_plate_w)) - MCFG_HMCS40_WRITE_R_CB(3, WRITE8(hh_hmcs40_state, egalaxn2_plate_w)) - MCFG_HMCS40_WRITE_R_CB(4, WRITE8(hh_hmcs40_state, egalaxn2_plate_w)) - MCFG_HMCS40_WRITE_R_CB(5, WRITE8(hh_hmcs40_state, egalaxn2_plate_w)) - MCFG_HMCS40_WRITE_R_CB(6, WRITE8(hh_hmcs40_state, egalaxn2_plate_w)) - MCFG_HMCS40_WRITE_D_CB(WRITE16(hh_hmcs40_state, egalaxn2_grid_w)) + MCFG_HMCS40_READ_R_CB(0, READ8(egalaxn2_state, input_r)) + MCFG_HMCS40_WRITE_R_CB(1, WRITE8(egalaxn2_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(egalaxn2_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(3, WRITE8(egalaxn2_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(4, WRITE8(egalaxn2_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(5, WRITE8(egalaxn2_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(6, WRITE8(egalaxn2_state, plate_w)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(egalaxn2_state, grid_w)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) @@ -1273,7 +1339,17 @@ MACHINE_CONFIG_END ***************************************************************************/ -// i/o hookup is identical to Galaxian 2, so we can use those handlers +class epacman2_state : public egalaxn2_state +{ +public: + epacman2_state(const machine_config &mconfig, device_type type, const char *tag) + : egalaxn2_state(mconfig, type, tag) + { } +}; + +// handlers are identical to Galaxian 2, so we can use those + +// config static INPUT_PORTS_START( epacman2 ) PORT_START("IN.0") // D1 port R0x @@ -1305,19 +1381,18 @@ static INPUT_PORTS_START( epacman2 ) PORT_CONFSETTING( 0x00, "2" ) INPUT_PORTS_END - -static MACHINE_CONFIG_START( epacman2, hh_hmcs40_state ) +static MACHINE_CONFIG_START( epacman2, epacman2_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", HD38820, 400000) // approximation - RC osc. - MCFG_HMCS40_READ_R_CB(0, READ8(hh_hmcs40_state, egalaxn2_input_r)) - MCFG_HMCS40_WRITE_R_CB(1, WRITE8(hh_hmcs40_state, egalaxn2_plate_w)) - MCFG_HMCS40_WRITE_R_CB(2, WRITE8(hh_hmcs40_state, egalaxn2_plate_w)) - MCFG_HMCS40_WRITE_R_CB(3, WRITE8(hh_hmcs40_state, egalaxn2_plate_w)) - MCFG_HMCS40_WRITE_R_CB(4, WRITE8(hh_hmcs40_state, egalaxn2_plate_w)) - MCFG_HMCS40_WRITE_R_CB(5, WRITE8(hh_hmcs40_state, egalaxn2_plate_w)) - MCFG_HMCS40_WRITE_R_CB(6, WRITE8(hh_hmcs40_state, egalaxn2_plate_w)) - MCFG_HMCS40_WRITE_D_CB(WRITE16(hh_hmcs40_state, egalaxn2_grid_w)) + MCFG_HMCS40_READ_R_CB(0, READ8(egalaxn2_state, input_r)) + MCFG_HMCS40_WRITE_R_CB(1, WRITE8(egalaxn2_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(egalaxn2_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(3, WRITE8(egalaxn2_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(4, WRITE8(egalaxn2_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(5, WRITE8(egalaxn2_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(6, WRITE8(egalaxn2_state, plate_w)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(egalaxn2_state, grid_w)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) @@ -1344,7 +1419,20 @@ MACHINE_CONFIG_END ***************************************************************************/ -WRITE8_MEMBER(hh_hmcs40_state::pbqbert_plate_w) +class pbqbert_state : public hh_hmcs40_state +{ +public: + pbqbert_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_hmcs40_state(mconfig, type, tag) + { } + + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE16_MEMBER(grid_w); +}; + +// handlers + +WRITE8_MEMBER(pbqbert_state::plate_w) { // R0x-R6x,D8: vfd matrix plate int shift = offset * 4; @@ -1352,11 +1440,10 @@ WRITE8_MEMBER(hh_hmcs40_state::pbqbert_plate_w) // update display UINT32 plate = BITSWAP32(m_plate,31,30,24,25,26,27,28,15,14,29,13,12,11,10,9,8,7,6,5,4,3,2,1,0,16,17,18,19,20,21,22,23); - display_matrix(30, 8, plate, m_grid); } -WRITE16_MEMBER(hh_hmcs40_state::pbqbert_grid_w) +WRITE16_MEMBER(pbqbert_state::grid_w) { // D14: speaker out m_speaker->level_w(data >> 14 & 1); @@ -1365,10 +1452,12 @@ WRITE16_MEMBER(hh_hmcs40_state::pbqbert_grid_w) m_grid = data & 0xff; // D8: plate 25 (update display there) - pbqbert_plate_w(space, 7, data >> 8 & 1); + plate_w(space, 7, data >> 8 & 1); } +// config + static INPUT_PORTS_START( pbqbert ) PORT_START("IN.0") // port D PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) // up-left @@ -1378,19 +1467,18 @@ static INPUT_PORTS_START( pbqbert ) PORT_BIT( 0xe1ff, IP_ACTIVE_HIGH, IPT_UNUSED ) INPUT_PORTS_END - -static MACHINE_CONFIG_START( pbqbert, hh_hmcs40_state ) +static MACHINE_CONFIG_START( pbqbert, pbqbert_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", HD38820, 400000) // approximation - RC osc. - MCFG_HMCS40_WRITE_R_CB(0, WRITE8(hh_hmcs40_state, pbqbert_plate_w)) - MCFG_HMCS40_WRITE_R_CB(1, WRITE8(hh_hmcs40_state, pbqbert_plate_w)) - MCFG_HMCS40_WRITE_R_CB(2, WRITE8(hh_hmcs40_state, pbqbert_plate_w)) - MCFG_HMCS40_WRITE_R_CB(3, WRITE8(hh_hmcs40_state, pbqbert_plate_w)) - MCFG_HMCS40_WRITE_R_CB(4, WRITE8(hh_hmcs40_state, pbqbert_plate_w)) - MCFG_HMCS40_WRITE_R_CB(5, WRITE8(hh_hmcs40_state, pbqbert_plate_w)) - MCFG_HMCS40_WRITE_R_CB(6, WRITE8(hh_hmcs40_state, pbqbert_plate_w)) - MCFG_HMCS40_WRITE_D_CB(WRITE16(hh_hmcs40_state, pbqbert_grid_w)) + MCFG_HMCS40_WRITE_R_CB(0, WRITE8(pbqbert_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(1, WRITE8(pbqbert_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(pbqbert_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(3, WRITE8(pbqbert_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(4, WRITE8(pbqbert_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(5, WRITE8(pbqbert_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(6, WRITE8(pbqbert_state, plate_w)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(pbqbert_state, grid_w)) MCFG_HMCS40_READ_D_CB(IOPORT("IN.0")) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) @@ -1419,24 +1507,39 @@ MACHINE_CONFIG_END ***************************************************************************/ -void hh_hmcs40_state::kingman_display() +class kingman_state : public hh_hmcs40_state +{ +public: + kingman_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_hmcs40_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE16_MEMBER(grid_w); + + void update_int0(); + DECLARE_INPUT_CHANGED_MEMBER(input_changed); +}; + +// handlers + +void kingman_state::prepare_display() { UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,0,1,2,3,4,5,6,7,8); UINT32 plate = BITSWAP24(m_plate,23,6,7,5,4,3,2,1,0,13,12,20,19,18,17,16,10,11,9,8,14,15,13,12); - display_matrix(23, 9, plate, grid); } -WRITE8_MEMBER(hh_hmcs40_state::kingman_plate_w) +WRITE8_MEMBER(kingman_state::plate_w) { // R0x-R3x: vfd matrix plate int shift = offset * 4; m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - - kingman_display(); + prepare_display(); } -WRITE16_MEMBER(hh_hmcs40_state::kingman_grid_w) +WRITE16_MEMBER(kingman_state::grid_w) { // D6: speaker out m_speaker->level_w(data >> 6 & 1); @@ -1446,7 +1549,7 @@ WRITE16_MEMBER(hh_hmcs40_state::kingman_grid_w) if (inp_mux != m_inp_mux) { m_inp_mux = inp_mux; - kingman_update_int0(); + update_int0(); } // D7-D15: vfd matrix grid @@ -1454,50 +1557,50 @@ WRITE16_MEMBER(hh_hmcs40_state::kingman_grid_w) // D0-D4: more plates m_plate = (m_plate & 0x00ffff) | (data << 16 & 0x1f0000); - kingman_display(); + prepare_display(); } -void hh_hmcs40_state::kingman_update_int0() +void kingman_state::update_int0() { // INT0 on multiplexed inputs set_interrupt(0, read_inputs(4)); } -INPUT_CHANGED_MEMBER(hh_hmcs40_state::kingman_input_changed) -{ - kingman_update_int0(); -} +// config static INPUT_PORTS_START( kingman ) PORT_START("IN.0") // D12 INT0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, kingman_input_changed, NULL) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CHANGED_MEMBER(DEVICE_SELF, kingman_state, input_changed, NULL) PORT_START("IN.1") // D13 INT0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, kingman_input_changed, NULL) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CHANGED_MEMBER(DEVICE_SELF, kingman_state, input_changed, NULL) PORT_START("IN.2") // D14 INT0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, kingman_input_changed, NULL) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, kingman_state, input_changed, NULL) PORT_START("IN.3") // D15 INT0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, kingman_input_changed, NULL) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CHANGED_MEMBER(DEVICE_SELF, kingman_state, input_changed, NULL) PORT_START("IN.4") // INT1 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, single_interrupt_line, (void *)1) - - INPUT_PORTS_END +INPUT_CHANGED_MEMBER(kingman_state::input_changed) +{ + update_int0(); +} + -static MACHINE_CONFIG_START( kingman, hh_hmcs40_state ) +static MACHINE_CONFIG_START( kingman, kingman_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", HD38800, 400000) // approximation - RC osc. - MCFG_HMCS40_WRITE_R_CB(0, WRITE8(hh_hmcs40_state, kingman_plate_w)) - MCFG_HMCS40_WRITE_R_CB(1, WRITE8(hh_hmcs40_state, kingman_plate_w)) - MCFG_HMCS40_WRITE_R_CB(2, WRITE8(hh_hmcs40_state, kingman_plate_w)) - MCFG_HMCS40_WRITE_R_CB(3, WRITE8(hh_hmcs40_state, kingman_plate_w)) - MCFG_HMCS40_WRITE_D_CB(WRITE16(hh_hmcs40_state, kingman_grid_w)) + MCFG_HMCS40_WRITE_R_CB(0, WRITE8(kingman_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(1, WRITE8(kingman_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(kingman_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(3, WRITE8(kingman_state, plate_w)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(kingman_state, grid_w)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) @@ -1525,24 +1628,39 @@ MACHINE_CONFIG_END ***************************************************************************/ -void hh_hmcs40_state::tmtron_display() +class tmtron_state : public hh_hmcs40_state +{ +public: + tmtron_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_hmcs40_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE16_MEMBER(grid_w); + + void update_int1(); + DECLARE_INPUT_CHANGED_MEMBER(input_changed); +}; + +// handlers + +void tmtron_state::prepare_display() { UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,1,2,3,4,5,6,7,8,9,0); UINT32 plate = BITSWAP24(m_plate,23,5,2,21,1,6,7,9,10,11,21,0,19,3,4,8,3,18,17,16,12,13,14,15); - display_matrix(23, 10, plate, grid); } -WRITE8_MEMBER(hh_hmcs40_state::tmtron_plate_w) +WRITE8_MEMBER(tmtron_state::plate_w) { // R0x-R3x: vfd matrix plate int shift = offset * 4; m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - - tmtron_display(); + prepare_display(); } -WRITE16_MEMBER(hh_hmcs40_state::tmtron_grid_w) +WRITE16_MEMBER(tmtron_state::grid_w) { // D4: speaker out m_speaker->level_w(data >> 4 & 1); @@ -1552,7 +1670,7 @@ WRITE16_MEMBER(hh_hmcs40_state::tmtron_grid_w) if (inp_mux != m_inp_mux) { m_inp_mux = inp_mux; - tmtron_update_int1(); + update_int1(); } // D6-D15: vfd matrix grid @@ -1560,48 +1678,50 @@ WRITE16_MEMBER(hh_hmcs40_state::tmtron_grid_w) // D0-D3,D5: more plates m_plate = (m_plate & 0x00ffff) | (data << 16 & 0x2f0000); - tmtron_display(); + prepare_display(); } - -void hh_hmcs40_state::tmtron_update_int1() +void tmtron_state::update_int1() { // INT1 on multiplexed inputs set_interrupt(1, read_inputs(4)); } -INPUT_CHANGED_MEMBER(hh_hmcs40_state::tmtron_input_changed) -{ - tmtron_update_int1(); -} + +// config static INPUT_PORTS_START( tmtron ) PORT_START("IN.0") // D12 INT1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, tmtron_input_changed, NULL) PORT_16WAY // separate directional buttons, hence 16way + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, tmtron_state, input_changed, NULL) PORT_16WAY // separate directional buttons, hence 16way PORT_START("IN.1") // D13 INT1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, tmtron_input_changed, NULL) PORT_16WAY // " + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CHANGED_MEMBER(DEVICE_SELF, tmtron_state, input_changed, NULL) PORT_16WAY // " PORT_START("IN.2") // D14 INT1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, tmtron_input_changed, NULL) PORT_16WAY // " + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CHANGED_MEMBER(DEVICE_SELF, tmtron_state, input_changed, NULL) PORT_16WAY // " PORT_START("IN.3") // D15 INT1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, tmtron_input_changed, NULL) PORT_16WAY // " + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CHANGED_MEMBER(DEVICE_SELF, tmtron_state, input_changed, NULL) PORT_16WAY // " PORT_START("IN.4") // INT0 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, single_interrupt_line, (void *)0) INPUT_PORTS_END +INPUT_CHANGED_MEMBER(tmtron_state::input_changed) +{ + update_int1(); +} + -static MACHINE_CONFIG_START( tmtron, hh_hmcs40_state ) +static MACHINE_CONFIG_START( tmtron, tmtron_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", HD38800, 400000) // approximation - RC osc. - MCFG_HMCS40_WRITE_R_CB(0, WRITE8(hh_hmcs40_state, tmtron_plate_w)) - MCFG_HMCS40_WRITE_R_CB(1, WRITE8(hh_hmcs40_state, tmtron_plate_w)) - MCFG_HMCS40_WRITE_R_CB(2, WRITE8(hh_hmcs40_state, tmtron_plate_w)) - MCFG_HMCS40_WRITE_R_CB(3, WRITE8(hh_hmcs40_state, tmtron_plate_w)) - MCFG_HMCS40_WRITE_D_CB(WRITE16(hh_hmcs40_state, tmtron_grid_w)) + MCFG_HMCS40_WRITE_R_CB(0, WRITE8(tmtron_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(1, WRITE8(tmtron_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(tmtron_state, plate_w)) + MCFG_HMCS40_WRITE_R_CB(3, WRITE8(tmtron_state, plate_w)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(tmtron_state, grid_w)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) diff --git a/src/mess/drivers/hh_pic16.c b/src/mess/drivers/hh_pic16.c index 07edf6a32e5..77d29015073 100644 --- a/src/mess/drivers/hh_pic16.c +++ b/src/mess/drivers/hh_pic16.c @@ -51,8 +51,6 @@ public: UINT8 m_b; // MCU port B data UINT8 m_c; // MCU port C data - virtual void machine_start(); - // display common int m_display_wait; // led/lamp off-delay in microseconds (default 33ms) int m_display_maxy; // display matrix number of rows @@ -68,11 +66,14 @@ public: void set_display_size(int maxx, int maxy); void display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety); - // game-specific handlers - DECLARE_WRITE8_MEMBER(maniac_output_w); +protected: + virtual void machine_start(); + virtual void machine_reset(); }; +// machine start/reset + void hh_pic16_state::machine_start() { // zerofill @@ -98,6 +99,10 @@ void hh_pic16_state::machine_start() save_item(NAME(m_c)); } +void hh_pic16_state::machine_reset() +{ +} + /*************************************************************************** @@ -124,7 +129,7 @@ void hh_pic16_state::display_update() m_display_decay[y][x] = m_display_wait; // determine active state - int ds = (m_display_decay[y][x] != 0) ? 1 : 0; + UINT32 ds = (m_display_decay[y][x] != 0) ? 1 : 0; active_state[y] |= (ds << x); } } @@ -195,7 +200,7 @@ void hh_pic16_state::display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety /*************************************************************************** - Minidrivers (I/O, Inputs, Machine Config) + Minidrivers (subclass, I/O, Inputs, Machine Config) ***************************************************************************/ @@ -207,7 +212,19 @@ void hh_pic16_state::display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety ***************************************************************************/ -WRITE8_MEMBER(hh_pic16_state::maniac_output_w) +class maniac_state : public hh_pic16_state +{ +public: + maniac_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_pic16_state(mconfig, type, tag) + { } + + DECLARE_WRITE8_MEMBER(output_w); +}; + +// handlers + +WRITE8_MEMBER(maniac_state::output_w) { // B,C: outputs offset -= PIC16C5x_PORTB; @@ -228,6 +245,8 @@ WRITE8_MEMBER(hh_pic16_state::maniac_output_w) } +// config + static INPUT_PORTS_START( maniac ) PORT_START("IN.0") // port A PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) // bottom-right @@ -239,13 +258,13 @@ INPUT_PORTS_END static const INT16 maniac_speaker_levels[] = { 0, 32767, -32768, 0 }; -static MACHINE_CONFIG_START( maniac, hh_pic16_state ) +static MACHINE_CONFIG_START( maniac, maniac_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", PIC16C55, 850000) // RC osc. R=13.4K, C=470pf, but unknown RC curve - measured 800-890kHz MCFG_PIC16C5x_READ_A_CB(IOPORT("IN.0")) - MCFG_PIC16C5x_WRITE_B_CB(WRITE8(hh_pic16_state, maniac_output_w)) - MCFG_PIC16C5x_WRITE_C_CB(WRITE8(hh_pic16_state, maniac_output_w)) + MCFG_PIC16C5x_WRITE_B_CB(WRITE8(maniac_state, output_w)) + MCFG_PIC16C5x_WRITE_C_CB(WRITE8(maniac_state, output_w)) MCFG_PIC16C5x_SET_CONFIG(0) // ? MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_pic16_state, display_decay_tick, attotime::from_msec(1)) diff --git a/src/mess/drivers/hh_tms1k.c b/src/mess/drivers/hh_tms1k.c index 8937ce30f21..5a1008f8a15 100644 --- a/src/mess/drivers/hh_tms1k.c +++ b/src/mess/drivers/hh_tms1k.c @@ -161,7 +161,7 @@ void hh_tms1k_state::display_update() m_display_decay[y][x] = m_display_wait; // determine active state - int ds = (m_display_decay[y][x] != 0) ? 1 : 0; + UINT32 ds = (m_display_decay[y][x] != 0) ? 1 : 0; active_state[y] |= (ds << x); } } @@ -228,6 +228,15 @@ void hh_tms1k_state::display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety display_update(); } +void hh_tms1k_state::display_matrix_seg(int maxx, int maxy, UINT32 setx, UINT32 sety, UINT16 segmask) +{ + // expects m_display_segmask to be not-0 + for (int y = 0; y < maxy; y++) + m_display_segmask[y] &= segmask; + + display_matrix(maxx, maxy, setx, sety); +} + UINT8 hh_tms1k_state::read_inputs(int columns) { @@ -263,7 +272,7 @@ INPUT_CHANGED_MEMBER(hh_tms1k_state::power_button) /*************************************************************************** - Minidrivers (I/O, Inputs, Machine Config) + Minidrivers (subclass, I/O, Inputs, Machine Config) ***************************************************************************/ @@ -290,7 +299,22 @@ INPUT_CHANGED_MEMBER(hh_tms1k_state::power_button) ***************************************************************************/ -void hh_tms1k_state::mathmagi_display() +class mathmagi_state : public hh_tms1k_state +{ +public: + mathmagi_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +void mathmagi_state::prepare_display() { // R0-R7: 7seg leds for (int y = 0; y < 8; y++) @@ -309,17 +333,17 @@ void hh_tms1k_state::mathmagi_display() display_update(); } -WRITE16_MEMBER(hh_tms1k_state::mathmagi_write_r) +WRITE16_MEMBER(mathmagi_state::write_r) { // R3,R5-R7,R9,R10: input mux m_inp_mux = (data >> 3 & 1) | (data >> 4 & 0xe) | (data >> 5 & 0x30); // +others: m_r = data; - mathmagi_display(); + prepare_display(); } -WRITE16_MEMBER(hh_tms1k_state::mathmagi_write_o) +WRITE16_MEMBER(mathmagi_state::write_o) { // O1-O7: led segments A-G // O0: N/C @@ -327,12 +351,14 @@ WRITE16_MEMBER(hh_tms1k_state::mathmagi_write_o) m_o = data; } -READ8_MEMBER(hh_tms1k_state::mathmagi_read_k) +READ8_MEMBER(mathmagi_state::read_k) { return read_inputs(6); } +// config + /* physical button layout and labels is like this: ON ONE [SEL] [NXT] [?] [/] @@ -382,6 +408,7 @@ static INPUT_PORTS_START( mathmagi ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) INPUT_PORTS_END + // output PLA is not dumped static const UINT16 mathmagi_output_pla[0x20] = { @@ -419,14 +446,14 @@ static const UINT16 mathmagi_output_pla[0x20] = lA+lF+lE+lD+lC // G }; -static MACHINE_CONFIG_START( mathmagi, hh_tms1k_state ) +static MACHINE_CONFIG_START( mathmagi, mathmagi_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS1100, 175000) // RC osc. R=68K, C=82pf -> ~175kHz MCFG_TMS1XXX_OUTPUT_PLA(mathmagi_output_pla) - MCFG_TMS1XXX_READ_K_CB(READ8(hh_tms1k_state, mathmagi_read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(hh_tms1k_state, mathmagi_write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(hh_tms1k_state, mathmagi_write_o)) + MCFG_TMS1XXX_READ_K_CB(READ8(mathmagi_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(mathmagi_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(mathmagi_state, write_o)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_mathmagi) @@ -453,7 +480,22 @@ MACHINE_CONFIG_END ***************************************************************************/ -void hh_tms1k_state::amaztron_display() +class amaztron_state : public hh_tms1k_state +{ +public: + amaztron_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +void amaztron_state::prepare_display() { // R8,R9: select digit for (int y = 0; y < 2; y++) @@ -469,7 +511,7 @@ void hh_tms1k_state::amaztron_display() display_update(); } -WRITE16_MEMBER(hh_tms1k_state::amaztron_write_r) +WRITE16_MEMBER(amaztron_state::write_r) { // R0-R5: input mux m_inp_mux = data & 0x3f; @@ -479,18 +521,18 @@ WRITE16_MEMBER(hh_tms1k_state::amaztron_write_r) // other bits: m_r = data; - amaztron_display(); + prepare_display(); } -WRITE16_MEMBER(hh_tms1k_state::amaztron_write_o) +WRITE16_MEMBER(amaztron_state::write_o) { // O0-O6: digit segments // O7: N/C m_o = data & 0x7f; - amaztron_display(); + prepare_display(); } -READ8_MEMBER(hh_tms1k_state::amaztron_read_k) +READ8_MEMBER(amaztron_state::read_k) { UINT8 k = read_inputs(6); @@ -500,6 +542,8 @@ READ8_MEMBER(hh_tms1k_state::amaztron_read_k) } +// config + static INPUT_PORTS_START( amaztron ) PORT_START("IN.0") // R0 PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_1) PORT_NAME("Button 1") @@ -544,14 +588,13 @@ static INPUT_PORTS_START( amaztron ) PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) INPUT_PORTS_END - -static MACHINE_CONFIG_START( amaztron, hh_tms1k_state ) +static MACHINE_CONFIG_START( amaztron, amaztron_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS1100, 350000) // RC osc. R=33K?, C=100pf -> ~350kHz - MCFG_TMS1XXX_READ_K_CB(READ8(hh_tms1k_state, amaztron_read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(hh_tms1k_state, amaztron_write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(hh_tms1k_state, amaztron_write_o)) + MCFG_TMS1XXX_READ_K_CB(READ8(amaztron_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(amaztron_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(amaztron_state, write_o)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_amaztron) @@ -600,7 +643,22 @@ MACHINE_CONFIG_END ***************************************************************************/ -void hh_tms1k_state::tc4_display() +class tc4_state : public hh_tms1k_state +{ +public: + tc4_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +void tc4_state::prepare_display() { m_display_wait = 50; @@ -613,7 +671,7 @@ void hh_tms1k_state::tc4_display() display_matrix(9, 10, (m_o | (m_r << 2 & 0x100)), m_r); } -WRITE16_MEMBER(hh_tms1k_state::tc4_write_r) +WRITE16_MEMBER(tc4_state::write_r) { // R10: speaker out m_speaker->level_w(data >> 10 & 1); @@ -625,17 +683,17 @@ WRITE16_MEMBER(hh_tms1k_state::tc4_write_r) // R6: led column 8 // +other columns m_r = data; - tc4_display(); + prepare_display(); } -WRITE16_MEMBER(hh_tms1k_state::tc4_write_o) +WRITE16_MEMBER(tc4_state::write_o) { // O0-O7: led row m_o = data; - tc4_display(); + prepare_display(); } -READ8_MEMBER(hh_tms1k_state::tc4_read_k) +READ8_MEMBER(tc4_state::read_k) { UINT8 k = read_inputs(6); @@ -647,6 +705,8 @@ READ8_MEMBER(hh_tms1k_state::tc4_read_k) } +// config + static INPUT_PORTS_START( tc4 ) PORT_START("IN.0") // R0 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P1 Pass/Shoot Button 3") // right @@ -692,14 +752,13 @@ static INPUT_PORTS_START( tc4 ) PORT_CONFSETTING( 0x08, "Football" ) INPUT_PORTS_END - -static MACHINE_CONFIG_START( tc4, hh_tms1k_state ) +static MACHINE_CONFIG_START( tc4, tc4_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS1400, 450000) // approximation - RC osc. R=27.3K, C=100pf, but unknown RC curve - MCFG_TMS1XXX_READ_K_CB(READ8(hh_tms1k_state, tc4_read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(hh_tms1k_state, tc4_write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(hh_tms1k_state, tc4_write_o)) + MCFG_TMS1XXX_READ_K_CB(READ8(tc4_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(tc4_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(tc4_state, write_o)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_tc4) @@ -748,7 +807,22 @@ MACHINE_CONFIG_END ***************************************************************************/ -void hh_tms1k_state::ebball_display() +class ebball_state : public hh_tms1k_state +{ +public: + ebball_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +void ebball_state::prepare_display() { // R8 is a 7seg m_display_segmask[8] = 0x7f; @@ -756,7 +830,7 @@ void hh_tms1k_state::ebball_display() display_matrix(7, 9, ~m_o, m_r); } -WRITE16_MEMBER(hh_tms1k_state::ebball_write_r) +WRITE16_MEMBER(ebball_state::write_r) { // R1-R5: input mux m_inp_mux = data >> 1 & 0x1f; @@ -766,24 +840,26 @@ WRITE16_MEMBER(hh_tms1k_state::ebball_write_r) // R0-R8: led columns m_r = data; - ebball_display(); + prepare_display(); } -WRITE16_MEMBER(hh_tms1k_state::ebball_write_o) +WRITE16_MEMBER(ebball_state::write_o) { // O0-O6: led row // O7: N/C m_o = data; - ebball_display(); + prepare_display(); } -READ8_MEMBER(hh_tms1k_state::ebball_read_k) +READ8_MEMBER(ebball_state::read_k) { // note: K8(Vss row) is always on return m_inp_matrix[5]->read() | read_inputs(5); } +// config + static INPUT_PORTS_START( ebball ) PORT_START("IN.0") // R1 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 Change Up") @@ -814,14 +890,13 @@ static INPUT_PORTS_START( ebball ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P1 Batter") INPUT_PORTS_END - -static MACHINE_CONFIG_START( ebball, hh_tms1k_state ) +static MACHINE_CONFIG_START( ebball, ebball_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS1000, 375000) // RC osc. R=43K, C=47pf -> ~375kHz - MCFG_TMS1XXX_READ_K_CB(READ8(hh_tms1k_state, ebball_read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(hh_tms1k_state, ebball_write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(hh_tms1k_state, ebball_write_o)) + MCFG_TMS1XXX_READ_K_CB(READ8(ebball_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ebball_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ebball_state, write_o)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_ebball) @@ -866,7 +941,22 @@ MACHINE_CONFIG_END ***************************************************************************/ -void hh_tms1k_state::ebball2_display() +class ebball2_state : public hh_tms1k_state +{ +public: + ebball2_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +void ebball2_state::prepare_display() { // the first 3 are 7segs for (int y = 0; y < 3; y++) @@ -875,7 +965,7 @@ void hh_tms1k_state::ebball2_display() display_matrix(8, 10, ~m_o, m_r ^ 0x7f); } -WRITE16_MEMBER(hh_tms1k_state::ebball2_write_r) +WRITE16_MEMBER(ebball2_state::write_r) { // R3-R6: input mux m_inp_mux = data >> 3 & 0xf; @@ -885,22 +975,24 @@ WRITE16_MEMBER(hh_tms1k_state::ebball2_write_r) // R0-R9: led columns m_r = data; - ebball2_display(); + prepare_display(); } -WRITE16_MEMBER(hh_tms1k_state::ebball2_write_o) +WRITE16_MEMBER(ebball2_state::write_o) { // O0-O7: led row/segment m_o = data; - ebball2_display(); + prepare_display(); } -READ8_MEMBER(hh_tms1k_state::ebball2_read_k) +READ8_MEMBER(ebball2_state::read_k) { return read_inputs(4); } +// config + static INPUT_PORTS_START( ebball2 ) PORT_START("IN.0") // R3 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) @@ -925,14 +1017,13 @@ static INPUT_PORTS_START( ebball2 ) PORT_BIT( 0x0a, IP_ACTIVE_HIGH, IPT_UNUSED ) INPUT_PORTS_END - -static MACHINE_CONFIG_START( ebball2, hh_tms1k_state ) +static MACHINE_CONFIG_START( ebball2, ebball2_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS1000, 350000) // RC osc. R=47K, C=47pf -> ~350kHz - MCFG_TMS1XXX_READ_K_CB(READ8(hh_tms1k_state, ebball2_read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(hh_tms1k_state, ebball2_write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(hh_tms1k_state, ebball2_write_o)) + MCFG_TMS1XXX_READ_K_CB(READ8(ebball2_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ebball2_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ebball2_state, write_o)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_ebball2) @@ -982,7 +1073,28 @@ MACHINE_CONFIG_END ***************************************************************************/ -void hh_tms1k_state::ebball3_display() +class ebball3_state : public hh_tms1k_state +{ +public: + ebball3_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); + + void set_clock(); + DECLARE_INPUT_CHANGED_MEMBER(difficulty_switch); + +protected: + virtual void machine_reset(); +}; + +// handlers + +void ebball3_state::prepare_display() { // update current state for (int y = 0; y < 10; y++) @@ -1000,7 +1112,7 @@ void hh_tms1k_state::ebball3_display() display_update(); } -WRITE16_MEMBER(hh_tms1k_state::ebball3_write_r) +WRITE16_MEMBER(ebball3_state::write_r) { // R0-R2: input mux m_inp_mux = data & 7; @@ -1010,23 +1122,25 @@ WRITE16_MEMBER(hh_tms1k_state::ebball3_write_r) // R0-R9: led columns m_r = data; - ebball3_display(); + prepare_display(); } -WRITE16_MEMBER(hh_tms1k_state::ebball3_write_o) +WRITE16_MEMBER(ebball3_state::write_o) { // O0-O6: led row // O7: N/C m_o = data & 0x7f; - ebball3_display(); + prepare_display(); } -READ8_MEMBER(hh_tms1k_state::ebball3_read_k) +READ8_MEMBER(ebball3_state::read_k) { return read_inputs(3); } +// config + /* physical button layout and labels is like this: main device (batter side): remote pitcher: @@ -1061,13 +1175,18 @@ static INPUT_PORTS_START( ebball3 ) PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_START("IN.3") // fake - PORT_CONFNAME( 0x01, 0x00, DEF_STR( Difficulty ) ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, ebball3_difficulty_switch, NULL) + PORT_CONFNAME( 0x01, 0x00, DEF_STR( Difficulty ) ) PORT_CHANGED_MEMBER(DEVICE_SELF, ebball3_state, difficulty_switch, NULL) PORT_CONFSETTING( 0x00, "Amateur" ) PORT_CONFSETTING( 0x01, "Professional" ) INPUT_PORTS_END +INPUT_CHANGED_MEMBER(ebball3_state::difficulty_switch) +{ + set_clock(); +} -void hh_tms1k_state::ebball3_set_clock() + +void ebball3_state::set_clock() { // MCU clock is from an RC circuit(R=47K, C=33pf) oscillating by default at ~340kHz, // but on PRO, the difficulty switch adds an extra 150K resistor to Vdd to speed @@ -1075,30 +1194,23 @@ void hh_tms1k_state::ebball3_set_clock() m_maincpu->set_unscaled_clock((m_inp_matrix[3]->read() & 1) ? 440000 : 340000); } -INPUT_CHANGED_MEMBER(hh_tms1k_state::ebball3_difficulty_switch) -{ - ebball3_set_clock(); -} - -MACHINE_RESET_MEMBER(hh_tms1k_state, ebball3) +void ebball3_state::machine_reset() { - machine_reset(); - ebball3_set_clock(); + hh_tms1k_state::machine_reset(); + set_clock(); } -static MACHINE_CONFIG_START( ebball3, hh_tms1k_state ) +static MACHINE_CONFIG_START( ebball3, ebball3_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1100, 340000) // see ebball3_set_clock - MCFG_TMS1XXX_READ_K_CB(READ8(hh_tms1k_state, ebball3_read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(hh_tms1k_state, ebball3_write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(hh_tms1k_state, ebball3_write_o)) + MCFG_CPU_ADD("maincpu", TMS1100, 340000) // see set_clock + MCFG_TMS1XXX_READ_K_CB(READ8(ebball3_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ebball3_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ebball3_state, write_o)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_ebball3) - MCFG_MACHINE_RESET_OVERRIDE(hh_tms1k_state, ebball3) - /* no video! */ /* sound hardware */ @@ -1126,7 +1238,21 @@ MACHINE_CONFIG_END ***************************************************************************/ -WRITE16_MEMBER(hh_tms1k_state::elecdet_write_r) +class elecdet_state : public hh_tms1k_state +{ +public: + elecdet_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +WRITE16_MEMBER(elecdet_state::write_r) { // R7,R8: speaker on m_speaker->level_w((data & 0x180 && m_o & 0x80) ? 1 : 0); @@ -1138,7 +1264,7 @@ WRITE16_MEMBER(hh_tms1k_state::elecdet_write_r) display_matrix(7, 7, BITSWAP8(m_o,7,5,2,1,4,0,6,3), data); } -WRITE16_MEMBER(hh_tms1k_state::elecdet_write_o) +WRITE16_MEMBER(elecdet_state::write_o) { // O0,O1,O4,O6: input mux m_inp_mux = (data & 3) | (data >> 2 & 4) | (data >> 3 & 8); @@ -1148,13 +1274,15 @@ WRITE16_MEMBER(hh_tms1k_state::elecdet_write_o) m_o = data; } -READ8_MEMBER(hh_tms1k_state::elecdet_read_k) +READ8_MEMBER(elecdet_state::read_k) { // note: the Vss row is always on return m_inp_matrix[4]->read() | read_inputs(4); } +// config + /* physical button layout and labels is like this: [1] [2] [3] [SUSPECT] @@ -1202,14 +1330,13 @@ static INPUT_PORTS_START( elecdet ) PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)false) INPUT_PORTS_END - -static MACHINE_CONFIG_START( elecdet, hh_tms1k_state ) +static MACHINE_CONFIG_START( elecdet, elecdet_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS0980, 425000) // approximation - unknown freq - MCFG_TMS1XXX_READ_K_CB(READ8(hh_tms1k_state, elecdet_read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(hh_tms1k_state, elecdet_write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(hh_tms1k_state, elecdet_write_o)) + MCFG_TMS1XXX_READ_K_CB(READ8(elecdet_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(elecdet_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(elecdet_state, write_o)) MCFG_TMS1XXX_POWER_OFF_CB(WRITELINE(hh_tms1k_state, auto_power_off)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) @@ -1239,15 +1366,29 @@ MACHINE_CONFIG_END ***************************************************************************/ -void hh_tms1k_state::starwbc_display() +class starwbc_state : public hh_tms1k_state +{ +public: + starwbc_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +void starwbc_state::prepare_display() { // R6,R8 are 7segs m_display_segmask[6] = m_display_segmask[8] = 0x7f; - display_matrix(8, 10, m_o, m_r); } -WRITE16_MEMBER(hh_tms1k_state::starwbc_write_r) +WRITE16_MEMBER(starwbc_state::write_r) { // R0,R1,R3,R5,R7: input mux m_inp_mux = (data & 3) | (data >> 1 & 4) | (data >> 2 & 8) | (data >> 3 & 0x10); @@ -1257,22 +1398,24 @@ WRITE16_MEMBER(hh_tms1k_state::starwbc_write_r) // R0,R2,R4,R6,R8: led columns m_r = data & 0x155; - starwbc_display(); + prepare_display(); } -WRITE16_MEMBER(hh_tms1k_state::starwbc_write_o) +WRITE16_MEMBER(starwbc_state::write_o) { // O0-O7: led row m_o = (data << 4 & 0xf0) | (data >> 4 & 0x0f); - starwbc_display(); + prepare_display(); } -READ8_MEMBER(hh_tms1k_state::starwbc_read_k) +READ8_MEMBER(starwbc_state::read_k) { return read_inputs(5); } +// config + /* physical button layout and labels is like this: (reconnnaissance=yellow) (tactical reaction=green) @@ -1315,13 +1458,13 @@ static INPUT_PORTS_START( starwbc ) PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_RIGHT) PORT_NAME("Right") INPUT_PORTS_END -static MACHINE_CONFIG_START( starwbc, hh_tms1k_state ) +static MACHINE_CONFIG_START( starwbc, starwbc_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS1100, 325000) // RC osc. R=51K, C=47pf -> ~325kHz - MCFG_TMS1XXX_READ_K_CB(READ8(hh_tms1k_state, starwbc_read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(hh_tms1k_state, starwbc_write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(hh_tms1k_state, starwbc_write_o)) + MCFG_TMS1XXX_READ_K_CB(READ8(starwbc_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(starwbc_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(starwbc_state, write_o)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_starwbc) @@ -1349,7 +1492,22 @@ MACHINE_CONFIG_END ***************************************************************************/ -void hh_tms1k_state::astro_display() +class astro_state : public hh_tms1k_state +{ +public: + astro_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +void astro_state::prepare_display() { // declare 7segs for (int y = 0; y < 9; y++) @@ -1358,29 +1516,31 @@ void hh_tms1k_state::astro_display() display_matrix(8, 10, m_o, m_r); } -WRITE16_MEMBER(hh_tms1k_state::astro_write_r) +WRITE16_MEMBER(astro_state::write_r) { // R0-R7: input mux m_inp_mux = data & 0xff; // R0-R9: select digit/leds m_r = data; - astro_display(); + prepare_display(); } -WRITE16_MEMBER(hh_tms1k_state::astro_write_o) +WRITE16_MEMBER(astro_state::write_o) { // O0-O7: digit segments/leds m_o = data; - astro_display(); + prepare_display(); } -READ8_MEMBER(hh_tms1k_state::astro_read_k) +READ8_MEMBER(astro_state::read_k) { return read_inputs(8); } +// config + static INPUT_PORTS_START( astro ) PORT_START("IN.0") // R0 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") @@ -1429,14 +1589,13 @@ static INPUT_PORTS_START( astro ) PORT_CONFSETTING( 0x08, "Astro" ) INPUT_PORTS_END - -static MACHINE_CONFIG_START( astro, hh_tms1k_state ) +static MACHINE_CONFIG_START( astro, astro_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS1470, 450000) // approximation - RC osc. R=4.7K, C=33pf, but unknown RC curve - MCFG_TMS1XXX_READ_K_CB(READ8(hh_tms1k_state, astro_read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(hh_tms1k_state, astro_write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(hh_tms1k_state, astro_write_o)) + MCFG_TMS1XXX_READ_K_CB(READ8(astro_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(astro_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(astro_state, write_o)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_astro) @@ -1465,7 +1624,21 @@ MACHINE_CONFIG_END ***************************************************************************/ -WRITE16_MEMBER(hh_tms1k_state::comp4_write_r) +class comp4_state : public hh_tms1k_state +{ +public: + comp4_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +WRITE16_MEMBER(comp4_state::write_r) { // leds: // R4 R9 @@ -1477,7 +1650,7 @@ WRITE16_MEMBER(hh_tms1k_state::comp4_write_r) display_matrix(11, 1, m_r, m_o); } -WRITE16_MEMBER(hh_tms1k_state::comp4_write_o) +WRITE16_MEMBER(comp4_state::write_o) { // O1-O3: input mux m_inp_mux = data >> 1 & 7; @@ -1488,12 +1661,14 @@ WRITE16_MEMBER(hh_tms1k_state::comp4_write_o) display_matrix(11, 1, m_r, m_o); } -READ8_MEMBER(hh_tms1k_state::comp4_read_k) +READ8_MEMBER(comp4_state::read_k) { return read_inputs(3); } +// config + static INPUT_PORTS_START( comp4 ) PORT_START("IN.0") // O1 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_R) PORT_CODE(KEYCODE_DEL) PORT_CODE(KEYCODE_DEL_PAD) PORT_NAME("R") @@ -1514,13 +1689,13 @@ static INPUT_PORTS_START( comp4 ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") INPUT_PORTS_END -static MACHINE_CONFIG_START( comp4, hh_tms1k_state ) +static MACHINE_CONFIG_START( comp4, comp4_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS0970, 250000) // approximation - unknown freq - MCFG_TMS1XXX_READ_K_CB(READ8(hh_tms1k_state, comp4_read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(hh_tms1k_state, comp4_write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(hh_tms1k_state, comp4_write_o)) + MCFG_TMS1XXX_READ_K_CB(READ8(comp4_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(comp4_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(comp4_state, write_o)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_comp4) @@ -1549,7 +1724,21 @@ MACHINE_CONFIG_END ***************************************************************************/ -WRITE16_MEMBER(hh_tms1k_state::simon_write_r) +class simon_state : public hh_tms1k_state +{ +public: + simon_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +WRITE16_MEMBER(simon_state::write_r) { // R4-R8 go through an 75494 IC first: // R4 -> 75494 IN6 -> green lamp @@ -1567,17 +1756,19 @@ WRITE16_MEMBER(hh_tms1k_state::simon_write_r) m_inp_mux = (data & 7) | (data >> 6 & 8); } -WRITE16_MEMBER(hh_tms1k_state::simon_write_o) +WRITE16_MEMBER(simon_state::write_o) { // N/C } -READ8_MEMBER(hh_tms1k_state::simon_read_k) +READ8_MEMBER(simon_state::read_k) { return read_inputs(4); } +// config + static INPUT_PORTS_START( simon ) PORT_START("IN.0") // R0 PORT_CONFNAME( 0x07, 0x02, "Game Select") @@ -1606,14 +1797,13 @@ static INPUT_PORTS_START( simon ) PORT_CONFSETTING( 0x01, "4" ) INPUT_PORTS_END - -static MACHINE_CONFIG_START( simon, hh_tms1k_state ) +static MACHINE_CONFIG_START( simon, simon_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS1000, 350000) // RC osc. R=33K, C=100pf -> ~350kHz - MCFG_TMS1XXX_READ_K_CB(READ8(hh_tms1k_state, simon_read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(hh_tms1k_state, simon_write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(hh_tms1k_state, simon_write_o)) + MCFG_TMS1XXX_READ_K_CB(READ8(simon_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(simon_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(simon_state, write_o)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_simon) @@ -1641,7 +1831,27 @@ MACHINE_CONFIG_END ***************************************************************************/ -WRITE16_MEMBER(hh_tms1k_state::ssimon_write_r) +class ssimon_state : public hh_tms1k_state +{ +public: + ssimon_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); + + void set_clock(); + DECLARE_INPUT_CHANGED_MEMBER(speed_switch); + +protected: + virtual void machine_reset(); +}; + +// handlers + +WRITE16_MEMBER(ssimon_state::write_r) { // R0-R3,R9,R10: input mux m_inp_mux = (data & 0xf) | (data >> 5 & 0x30); @@ -1656,17 +1866,19 @@ WRITE16_MEMBER(hh_tms1k_state::ssimon_write_r) m_speaker->level_w(data >> 8 & 1); } -WRITE16_MEMBER(hh_tms1k_state::ssimon_write_o) +WRITE16_MEMBER(ssimon_state::write_o) { // N/C } -READ8_MEMBER(hh_tms1k_state::ssimon_read_k) +READ8_MEMBER(ssimon_state::read_k) { return read_inputs(6); } +// config + static INPUT_PORTS_START( ssimon ) PORT_START("IN.0") // R0 PORT_CONFNAME( 0x0f, 0x01, "Game Select") @@ -1708,14 +1920,19 @@ static INPUT_PORTS_START( ssimon ) PORT_BIT( 0x0d, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_START("IN.6") // fake - PORT_CONFNAME( 0x03, 0x01, "Speed" ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, ssimon_speed_switch, NULL) + PORT_CONFNAME( 0x03, 0x01, "Speed" ) PORT_CHANGED_MEMBER(DEVICE_SELF, ssimon_state, speed_switch, NULL) PORT_CONFSETTING( 0x00, "Simple" ) PORT_CONFSETTING( 0x01, "Normal" ) PORT_CONFSETTING( 0x02, "Super" ) INPUT_PORTS_END +INPUT_CHANGED_MEMBER(ssimon_state::speed_switch) +{ + set_clock(); +} + -void hh_tms1k_state::ssimon_set_clock() +void ssimon_state::set_clock() { // MCU clock is from an RC circuit with C=100pf, R=x depending on speed switch: // 0 Simple: R=51K -> ~200kHz @@ -1725,30 +1942,23 @@ void hh_tms1k_state::ssimon_set_clock() m_maincpu->set_unscaled_clock((inp & 2) ? 400000 : ((inp & 1) ? 275000 : 200000)); } -INPUT_CHANGED_MEMBER(hh_tms1k_state::ssimon_speed_switch) -{ - ssimon_set_clock(); -} - -MACHINE_RESET_MEMBER(hh_tms1k_state, ssimon) +void ssimon_state::machine_reset() { - machine_reset(); - ssimon_set_clock(); + hh_tms1k_state::machine_reset(); + set_clock(); } -static MACHINE_CONFIG_START( ssimon, hh_tms1k_state ) +static MACHINE_CONFIG_START( ssimon, ssimon_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1100, 275000) // see ssimon_set_clock - MCFG_TMS1XXX_READ_K_CB(READ8(hh_tms1k_state, ssimon_read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(hh_tms1k_state, ssimon_write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(hh_tms1k_state, ssimon_write_o)) + MCFG_CPU_ADD("maincpu", TMS1100, 275000) // see set_clock + MCFG_TMS1XXX_READ_K_CB(READ8(ssimon_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ssimon_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ssimon_state, write_o)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_ssimon) - MCFG_MACHINE_RESET_OVERRIDE(hh_tms1k_state, ssimon) - /* no video! */ /* sound hardware */ @@ -1773,7 +1983,21 @@ MACHINE_CONFIG_END ***************************************************************************/ -WRITE16_MEMBER(hh_tms1k_state::cnsector_write_r) +class cnsector_state : public hh_tms1k_state +{ +public: + cnsector_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +WRITE16_MEMBER(cnsector_state::write_r) { // R0-R5: select digit (right-to-left) for (int y = 0; y < 6; y++) @@ -1789,7 +2013,7 @@ WRITE16_MEMBER(hh_tms1k_state::cnsector_write_r) display_update(); } -WRITE16_MEMBER(hh_tms1k_state::cnsector_write_o) +WRITE16_MEMBER(cnsector_state::write_o) { // O0-O4: input mux m_inp_mux = data & 0x1f; @@ -1798,12 +2022,14 @@ WRITE16_MEMBER(hh_tms1k_state::cnsector_write_o) m_o = data; } -READ8_MEMBER(hh_tms1k_state::cnsector_read_k) +READ8_MEMBER(cnsector_state::read_k) { return read_inputs(5); } +// config + static INPUT_PORTS_START( cnsector ) PORT_START("IN.0") // O0 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Q) PORT_NAME("Next Ship") @@ -1836,14 +2062,13 @@ static INPUT_PORTS_START( cnsector ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_T) PORT_NAME("Move Ship") INPUT_PORTS_END - -static MACHINE_CONFIG_START( cnsector, hh_tms1k_state ) +static MACHINE_CONFIG_START( cnsector, cnsector_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS0970, 250000) // approximation - unknown freq - MCFG_TMS1XXX_READ_K_CB(READ8(hh_tms1k_state, cnsector_read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(hh_tms1k_state, cnsector_write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(hh_tms1k_state, cnsector_write_o)) + MCFG_TMS1XXX_READ_K_CB(READ8(cnsector_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(cnsector_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(cnsector_state, write_o)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_cnsector) @@ -1861,7 +2086,7 @@ MACHINE_CONFIG_END Parker Bros Merlin handheld game, by Bob Doyle * TMS1100NLL MP3404A-N2 - * 11 LEDs behind buttons, 1bit sound + * 11 LEDs behind buttons, 2bit sound Also published in Japan by Tomy as "Dr. Smith", white case instead of red. The one with dark-blue case is the rare sequel Master Merlin. More sequels @@ -1879,7 +2104,21 @@ MACHINE_CONFIG_END ***************************************************************************/ -WRITE16_MEMBER(hh_tms1k_state::merlin_write_r) +class merlin_state : public hh_tms1k_state +{ +public: + merlin_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +WRITE16_MEMBER(merlin_state::write_r) { /* leds: @@ -1892,7 +2131,7 @@ WRITE16_MEMBER(hh_tms1k_state::merlin_write_r) display_matrix(11, 1, data, 1); } -WRITE16_MEMBER(hh_tms1k_state::merlin_write_o) +WRITE16_MEMBER(merlin_state::write_o) { // O4-O6: speaker out (paralleled for increased current driving capability) static const int count[8] = { 0, 1, 1, 2, 1, 2, 2, 3 }; @@ -1903,12 +2142,14 @@ WRITE16_MEMBER(hh_tms1k_state::merlin_write_o) m_inp_mux = data & 0xf; } -READ8_MEMBER(hh_tms1k_state::merlin_read_k) +READ8_MEMBER(merlin_state::read_k) { return read_inputs(4); } +// config + static INPUT_PORTS_START( merlin ) PORT_START("IN.0") // O0 PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME("Button 0") @@ -1938,13 +2179,13 @@ INPUT_PORTS_END static const INT16 merlin_speaker_levels[] = { 0, 10922, 21845, 32767 }; -static MACHINE_CONFIG_START( merlin, hh_tms1k_state ) +static MACHINE_CONFIG_START( merlin, merlin_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS1100, 350000) // RC osc. R=33K, C=100pf -> ~350kHz - MCFG_TMS1XXX_READ_K_CB(READ8(hh_tms1k_state, merlin_read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(hh_tms1k_state, merlin_write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(hh_tms1k_state, merlin_write_o)) + MCFG_TMS1XXX_READ_K_CB(READ8(merlin_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(merlin_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(merlin_state, write_o)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_merlin) @@ -1974,7 +2215,21 @@ MACHINE_CONFIG_END ***************************************************************************/ -WRITE16_MEMBER(hh_tms1k_state::stopthief_write_r) +class stopthief_state : public hh_tms1k_state +{ +public: + stopthief_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +WRITE16_MEMBER(stopthief_state::write_r) { // R0-R2: select digit UINT8 o = BITSWAP8(m_o,3,5,2,1,4,0,6,7) & 0x7f; @@ -1991,7 +2246,7 @@ WRITE16_MEMBER(hh_tms1k_state::stopthief_write_r) m_speaker->level_w((data & 0x1f8 && m_o & 8) ? 1 : 0); } -WRITE16_MEMBER(hh_tms1k_state::stopthief_write_o) +WRITE16_MEMBER(stopthief_state::write_o) { // O0,O6: input mux m_inp_mux = (data & 1) | (data >> 5 & 2); @@ -2001,13 +2256,15 @@ WRITE16_MEMBER(hh_tms1k_state::stopthief_write_o) m_o = data; } -READ8_MEMBER(hh_tms1k_state::stopthief_read_k) +READ8_MEMBER(stopthief_state::read_k) { // note: the Vss row is always on return m_inp_matrix[2]->read() | read_inputs(2); } +// config + /* physical button layout and labels is like this: [1] [2] [OFF] @@ -2041,13 +2298,13 @@ static INPUT_PORTS_START( stopthief ) PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)false) INPUT_PORTS_END -static MACHINE_CONFIG_START( stopthief, hh_tms1k_state ) +static MACHINE_CONFIG_START( stopthief, stopthief_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS0980, 425000) // approximation - unknown freq - MCFG_TMS1XXX_READ_K_CB(READ8(hh_tms1k_state, stopthief_read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(hh_tms1k_state, stopthief_write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(hh_tms1k_state, stopthief_write_o)) + MCFG_TMS1XXX_READ_K_CB(READ8(stopthief_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(stopthief_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(stopthief_state, write_o)) MCFG_TMS1XXX_POWER_OFF_CB(WRITELINE(hh_tms1k_state, auto_power_off)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) @@ -2081,7 +2338,21 @@ MACHINE_CONFIG_END ***************************************************************************/ -WRITE16_MEMBER(hh_tms1k_state::bankshot_write_r) +class bankshot_state : public hh_tms1k_state +{ +public: + bankshot_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +WRITE16_MEMBER(bankshot_state::write_r) { // R0: speaker out m_speaker->level_w(data & 1); @@ -2094,7 +2365,7 @@ WRITE16_MEMBER(hh_tms1k_state::bankshot_write_r) display_matrix(7, 11, m_o, m_r); } -WRITE16_MEMBER(hh_tms1k_state::bankshot_write_o) +WRITE16_MEMBER(bankshot_state::write_o) { // O0-O6: led row // O7: N/C @@ -2102,12 +2373,14 @@ WRITE16_MEMBER(hh_tms1k_state::bankshot_write_o) display_matrix(7, 11, m_o, m_r); } -READ8_MEMBER(hh_tms1k_state::bankshot_read_k) +READ8_MEMBER(bankshot_state::read_k) { return read_inputs(2); } +// config + /* physical button layout and labels is like this: (note: remember that you can rotate the display in MESS) @@ -2134,13 +2407,13 @@ static INPUT_PORTS_START( bankshot ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) INPUT_PORTS_END -static MACHINE_CONFIG_START( bankshot, hh_tms1k_state ) +static MACHINE_CONFIG_START( bankshot, bankshot_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS1400, 475000) // approximation - RC osc. R=24K, C=100pf, but unknown RC curve - MCFG_TMS1XXX_READ_K_CB(READ8(hh_tms1k_state, bankshot_read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(hh_tms1k_state, bankshot_write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(hh_tms1k_state, bankshot_write_o)) + MCFG_TMS1XXX_READ_K_CB(READ8(bankshot_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(bankshot_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(bankshot_state, write_o)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_bankshot) @@ -2189,7 +2462,21 @@ MACHINE_CONFIG_END ***************************************************************************/ -WRITE16_MEMBER(hh_tms1k_state::splitsec_write_r) +class splitsec_state : public hh_tms1k_state +{ +public: + splitsec_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +WRITE16_MEMBER(splitsec_state::write_r) { // R8: speaker out m_speaker->level_w(data >> 8 & 1); @@ -2202,7 +2489,7 @@ WRITE16_MEMBER(hh_tms1k_state::splitsec_write_r) display_matrix(7, 8, m_o, m_r); } -WRITE16_MEMBER(hh_tms1k_state::splitsec_write_o) +WRITE16_MEMBER(splitsec_state::write_o) { // O0-O6: led row // O7: N/C @@ -2210,12 +2497,14 @@ WRITE16_MEMBER(hh_tms1k_state::splitsec_write_o) display_matrix(7, 8, m_o, m_r); } -READ8_MEMBER(hh_tms1k_state::splitsec_read_k) +READ8_MEMBER(splitsec_state::read_k) { return read_inputs(2); } +// config + static INPUT_PORTS_START( splitsec ) PORT_START("IN.0") // R9 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_16WAY // 4 separate directional buttons, hence 16way @@ -2230,13 +2519,13 @@ static INPUT_PORTS_START( splitsec ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) INPUT_PORTS_END -static MACHINE_CONFIG_START( splitsec, hh_tms1k_state ) +static MACHINE_CONFIG_START( splitsec, splitsec_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS1400, 475000) // approximation - RC osc. R=24K, C=100pf, but unknown RC curve - MCFG_TMS1XXX_READ_K_CB(READ8(hh_tms1k_state, splitsec_read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(hh_tms1k_state, splitsec_write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(hh_tms1k_state, splitsec_write_o)) + MCFG_TMS1XXX_READ_K_CB(READ8(splitsec_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(splitsec_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(splitsec_state, write_o)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_splitsec) @@ -2275,13 +2564,28 @@ MACHINE_CONFIG_END ***************************************************************************/ -void hh_tms1k_state::tandy12_display() +class tandy12_state : public hh_tms1k_state +{ +public: + tandy12_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +void tandy12_state::prepare_display() { // O0-O7: button lamps 1-8, R0-R3: button lamps 9-12 display_matrix(13, 1, (m_o << 1 & 0x1fe) | (m_r << 9 & 0x1e00), 1); } -WRITE16_MEMBER(hh_tms1k_state::tandy12_write_r) +WRITE16_MEMBER(tandy12_state::write_r) { // R10: speaker out m_speaker->level_w(data >> 10 & 1); @@ -2291,21 +2595,23 @@ WRITE16_MEMBER(hh_tms1k_state::tandy12_write_r) // other bits: m_r = data; - tandy12_display(); + prepare_display(); } -WRITE16_MEMBER(hh_tms1k_state::tandy12_write_o) +WRITE16_MEMBER(tandy12_state::write_o) { m_o = data; - tandy12_display(); + prepare_display(); } -READ8_MEMBER(hh_tms1k_state::tandy12_read_k) +READ8_MEMBER(tandy12_state::read_k) { return read_inputs(5); } +// config + /* physical button layout and labels is like this: REPEAT-2 SPACE-2 @@ -2372,14 +2678,14 @@ static const UINT16 tandy12_output_pla[0x20] = 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static MACHINE_CONFIG_START( tandy12, hh_tms1k_state ) +static MACHINE_CONFIG_START( tandy12, tandy12_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS1100, 400000) // RC osc. R=39K, C=47pf -> ~400kHz MCFG_TMS1XXX_OUTPUT_PLA(tandy12_output_pla) - MCFG_TMS1XXX_READ_K_CB(READ8(hh_tms1k_state, tandy12_read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(hh_tms1k_state, tandy12_write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(hh_tms1k_state, tandy12_write_o)) + MCFG_TMS1XXX_READ_K_CB(READ8(tandy12_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(tandy12_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(tandy12_state, write_o)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_tandy12) diff --git a/src/mess/drivers/hh_ucom4.c b/src/mess/drivers/hh_ucom4.c index 69e5f4f2d84..faf59c83205 100644 --- a/src/mess/drivers/hh_ucom4.c +++ b/src/mess/drivers/hh_ucom4.c @@ -54,13 +54,11 @@ public: optional_device<speaker_sound_device> m_speaker; // misc common - UINT8 m_port[9]; // MCU port A-I write data + UINT8 m_port[9]; // MCU port A-I write data (optional) UINT16 m_inp_mux; // multiplexed inputs mask UINT8 read_inputs(int columns); - virtual void machine_start(); - // display common int m_display_wait; // led/lamp off-delay in microseconds (default 33ms) int m_display_maxy; // display matrix number of rows @@ -79,41 +77,14 @@ public: void set_display_size(int maxx, int maxy); void display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety); - // game-specific handlers - void ssfball_display(); - DECLARE_WRITE8_MEMBER(ssfball_grid_w); - DECLARE_WRITE8_MEMBER(ssfball_plate_w); - DECLARE_READ8_MEMBER(ssfball_input_b_r); - - void splasfgt_display(); - DECLARE_WRITE8_MEMBER(splasfgt_grid_w); - DECLARE_WRITE8_MEMBER(splasfgt_plate_w); - DECLARE_READ8_MEMBER(splasfgt_input_b_r); - - void astrocmd_display(); - DECLARE_WRITE8_MEMBER(astrocmd_grid_w); - DECLARE_WRITE8_MEMBER(astrocmd_plate_w); - - DECLARE_WRITE8_MEMBER(edracula_grid_w); - DECLARE_WRITE8_MEMBER(edracula_plate_w); - - DECLARE_WRITE8_MEMBER(tmtennis_grid_w); - DECLARE_WRITE8_MEMBER(tmtennis_plate_w); - DECLARE_WRITE8_MEMBER(tmtennis_port_e_w); - DECLARE_READ8_MEMBER(tmtennis_input_r); - void tmtennis_set_clock(); - DECLARE_INPUT_CHANGED_MEMBER(tmtennis_difficulty_switch); - DECLARE_MACHINE_RESET(tmtennis); - - void tmpacman_display(); - DECLARE_WRITE8_MEMBER(tmpacman_grid_w); - DECLARE_WRITE8_MEMBER(tmpacman_plate_w); - - DECLARE_WRITE8_MEMBER(alnchase_output_w); - DECLARE_READ8_MEMBER(alnchase_input_r); +protected: + virtual void machine_start(); + virtual void machine_reset(); }; +// machine start/reset + void hh_ucom4_state::machine_start() { // zerofill @@ -143,6 +114,10 @@ void hh_ucom4_state::machine_start() save_item(NAME(m_plate)); } +void hh_ucom4_state::machine_reset() +{ +} + /*************************************************************************** @@ -169,7 +144,7 @@ void hh_ucom4_state::display_update() m_display_decay[y][x] = m_display_wait; // determine active state - int ds = (m_display_decay[y][x] != 0) ? 1 : 0; + UINT32 ds = (m_display_decay[y][x] != 0) ? 1 : 0; active_state[y] |= (ds << x); } } @@ -253,7 +228,7 @@ UINT8 hh_ucom4_state::read_inputs(int columns) /*************************************************************************** - Minidrivers (I/O, Inputs, Machine Config) + Minidrivers (subclass, I/O, Inputs, Machine Config) ***************************************************************************/ @@ -272,23 +247,36 @@ UINT8 hh_ucom4_state::read_inputs(int columns) ***************************************************************************/ -void hh_ucom4_state::ssfball_display() +class ssfball_state : public hh_ucom4_state { - UINT32 plate = BITSWAP24(m_plate,23,22,21,20,19,11,7,3,12,17,13,18,16,14,15,10,9,8,0,1,2,4,5,6); +public: + ssfball_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_ucom4_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE8_MEMBER(grid_w); + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_READ8_MEMBER(input_b_r); +}; +// handlers + +void ssfball_state::prepare_display() +{ + UINT32 plate = BITSWAP24(m_plate,23,22,21,20,19,11,7,3,12,17,13,18,16,14,15,10,9,8,0,1,2,4,5,6); display_matrix(16, 9, plate, m_grid); } -WRITE8_MEMBER(hh_ucom4_state::ssfball_grid_w) +WRITE8_MEMBER(ssfball_state::grid_w) { - // C,D(,E): vfd matrix grid 0-7(,8) + // C,D(,E3): vfd matrix grid 0-7(,8) int shift = (offset - NEC_UCOM4_PORTC) * 4; m_grid = (m_grid & ~(0xf << shift)) | (data << shift); - - ssfball_display(); + prepare_display(); } -WRITE8_MEMBER(hh_ucom4_state::ssfball_plate_w) +WRITE8_MEMBER(ssfball_state::plate_w) { m_port[offset] = data; @@ -302,18 +290,20 @@ WRITE8_MEMBER(hh_ucom4_state::ssfball_plate_w) // E3: vfd matrix grid 8 if (offset == NEC_UCOM4_PORTE) - ssfball_grid_w(space, offset, data >> 3 & 1); + grid_w(space, offset, data >> 3 & 1); else - ssfball_display(); + prepare_display(); } -READ8_MEMBER(hh_ucom4_state::ssfball_input_b_r) +READ8_MEMBER(ssfball_state::input_b_r) { // B: input port 2, where B3 is multiplexed return m_inp_matrix[2]->read() | read_inputs(2); } +// config + static INPUT_PORTS_START( ssfball ) PORT_START("IN.0") // F3 port B3 PORT_BIT( 0x07, IP_ACTIVE_HIGH, IPT_UNUSED ) @@ -341,19 +331,19 @@ INPUT_PORTS_END static const INT16 ssfball_speaker_levels[] = { 0, 32767, -32768, 0 }; -static MACHINE_CONFIG_START( ssfball, hh_ucom4_state ) +static MACHINE_CONFIG_START( ssfball, ssfball_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", NEC_D553, XTAL_400kHz) MCFG_UCOM4_READ_A_CB(IOPORT("IN.3")) - MCFG_UCOM4_READ_B_CB(READ8(hh_ucom4_state, ssfball_input_b_r)) - MCFG_UCOM4_WRITE_C_CB(WRITE8(hh_ucom4_state, ssfball_grid_w)) - MCFG_UCOM4_WRITE_D_CB(WRITE8(hh_ucom4_state, ssfball_grid_w)) - MCFG_UCOM4_WRITE_E_CB(WRITE8(hh_ucom4_state, ssfball_plate_w)) - MCFG_UCOM4_WRITE_F_CB(WRITE8(hh_ucom4_state, ssfball_plate_w)) - MCFG_UCOM4_WRITE_G_CB(WRITE8(hh_ucom4_state, ssfball_plate_w)) - MCFG_UCOM4_WRITE_H_CB(WRITE8(hh_ucom4_state, ssfball_plate_w)) - MCFG_UCOM4_WRITE_I_CB(WRITE8(hh_ucom4_state, ssfball_plate_w)) + MCFG_UCOM4_READ_B_CB(READ8(ssfball_state, input_b_r)) + MCFG_UCOM4_WRITE_C_CB(WRITE8(ssfball_state, grid_w)) + MCFG_UCOM4_WRITE_D_CB(WRITE8(ssfball_state, grid_w)) + MCFG_UCOM4_WRITE_E_CB(WRITE8(ssfball_state, plate_w)) + MCFG_UCOM4_WRITE_F_CB(WRITE8(ssfball_state, plate_w)) + MCFG_UCOM4_WRITE_G_CB(WRITE8(ssfball_state, plate_w)) + MCFG_UCOM4_WRITE_H_CB(WRITE8(ssfball_state, plate_w)) + MCFG_UCOM4_WRITE_I_CB(WRITE8(ssfball_state, plate_w)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_hh_ucom4_test) @@ -382,14 +372,28 @@ MACHINE_CONFIG_END ***************************************************************************/ -void hh_ucom4_state::splasfgt_display() +class splasfgt_state : public hh_ucom4_state { - UINT32 plate = BITSWAP24(m_plate,23,22,21,20,19,18,17,13,1,0,8,6,0,10,11,14,15,16,9,5,7,4,2,3); +public: + splasfgt_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_ucom4_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE8_MEMBER(grid_w); + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_READ8_MEMBER(input_b_r); +}; + +// handlers +void splasfgt_state::prepare_display() +{ + UINT32 plate = BITSWAP24(m_plate,23,22,21,20,19,18,17,13,1,0,8,6,0,10,11,14,15,16,9,5,7,4,2,3); display_matrix(16, 9, plate, m_grid); } -WRITE8_MEMBER(hh_ucom4_state::splasfgt_grid_w) +WRITE8_MEMBER(splasfgt_state::grid_w) { // G,H,I0: vfd matrix grid int shift = (offset - NEC_UCOM4_PORTG) * 4; @@ -400,31 +404,32 @@ WRITE8_MEMBER(hh_ucom4_state::splasfgt_grid_w) // I2: vfd matrix plate 6 if (offset == NEC_UCOM4_PORTI) - m_plate = (m_plate & 0xffff) | (data << 14 & 0x10000); - - splasfgt_display(); + plate_w(space, 4 + NEC_UCOM4_PORTC, data >> 2 & 1); + else + prepare_display(); } -WRITE8_MEMBER(hh_ucom4_state::splasfgt_plate_w) +WRITE8_MEMBER(splasfgt_state::plate_w) { - // C,D,E,F23: vfd matrix plate - int shift = (offset - NEC_UCOM4_PORTC) * 4; - m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - // F01: speaker out if (offset == NEC_UCOM4_PORTF) m_speaker->level_w(data & 3); - ssfball_display(); + // C,D,E,F23(,I2): vfd matrix plate + int shift = (offset - NEC_UCOM4_PORTC) * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + prepare_display(); } -READ8_MEMBER(hh_ucom4_state::splasfgt_input_b_r) +READ8_MEMBER(splasfgt_state::input_b_r) { // B: multiplexed buttons return read_inputs(4); } +// config + /* physical button layout and labels is like this: * left = P1 side * * right = P2 side * (note: in 1P mode, switch sides between turns) @@ -475,19 +480,19 @@ INPUT_PORTS_END static const INT16 splasfgt_speaker_levels[] = { 0, 32767, -32768, 0 }; -static MACHINE_CONFIG_START( splasfgt, hh_ucom4_state ) +static MACHINE_CONFIG_START( splasfgt, splasfgt_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", NEC_D553, XTAL_400kHz) MCFG_UCOM4_READ_A_CB(IOPORT("IN.4")) - MCFG_UCOM4_READ_B_CB(READ8(hh_ucom4_state, splasfgt_input_b_r)) - MCFG_UCOM4_WRITE_C_CB(WRITE8(hh_ucom4_state, splasfgt_plate_w)) - MCFG_UCOM4_WRITE_D_CB(WRITE8(hh_ucom4_state, splasfgt_plate_w)) - MCFG_UCOM4_WRITE_E_CB(WRITE8(hh_ucom4_state, splasfgt_plate_w)) - MCFG_UCOM4_WRITE_F_CB(WRITE8(hh_ucom4_state, splasfgt_plate_w)) - MCFG_UCOM4_WRITE_G_CB(WRITE8(hh_ucom4_state, splasfgt_grid_w)) - MCFG_UCOM4_WRITE_H_CB(WRITE8(hh_ucom4_state, splasfgt_grid_w)) - MCFG_UCOM4_WRITE_I_CB(WRITE8(hh_ucom4_state, splasfgt_grid_w)) + MCFG_UCOM4_READ_B_CB(READ8(splasfgt_state, input_b_r)) + MCFG_UCOM4_WRITE_C_CB(WRITE8(splasfgt_state, plate_w)) + MCFG_UCOM4_WRITE_D_CB(WRITE8(splasfgt_state, plate_w)) + MCFG_UCOM4_WRITE_E_CB(WRITE8(splasfgt_state, plate_w)) + MCFG_UCOM4_WRITE_F_CB(WRITE8(splasfgt_state, plate_w)) + MCFG_UCOM4_WRITE_G_CB(WRITE8(splasfgt_state, grid_w)) + MCFG_UCOM4_WRITE_H_CB(WRITE8(splasfgt_state, grid_w)) + MCFG_UCOM4_WRITE_I_CB(WRITE8(splasfgt_state, grid_w)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_hh_ucom4_test) @@ -521,24 +526,36 @@ MACHINE_CONFIG_END ***************************************************************************/ -void hh_ucom4_state::astrocmd_display() +class astrocmd_state : public hh_ucom4_state +{ +public: + astrocmd_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_ucom4_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE8_MEMBER(grid_w); + DECLARE_WRITE8_MEMBER(plate_w); +}; + +// handlers + +void astrocmd_state::prepare_display() { UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,8,4,5,6,7,0,1,2,3); UINT32 plate = BITSWAP24(m_plate,23,22,21,20,19,3,2,12,13,14,15,16,17,18,0,1,4,8,5,9,7,11,6,10); - display_matrix(17, 9, plate, grid); } -WRITE8_MEMBER(hh_ucom4_state::astrocmd_grid_w) +WRITE8_MEMBER(astrocmd_state::grid_w) { // C,D(,E3): vfd matrix grid int shift = (offset - NEC_UCOM4_PORTC) * 4; m_grid = (m_grid & ~(0xf << shift)) | (data << shift); - - astrocmd_display(); + prepare_display(); } -WRITE8_MEMBER(hh_ucom4_state::astrocmd_plate_w) +WRITE8_MEMBER(astrocmd_state::plate_w) { // E01,F,G,H,I: vfd matrix plate int shift = (offset - NEC_UCOM4_PORTE) * 4; @@ -550,13 +567,15 @@ WRITE8_MEMBER(hh_ucom4_state::astrocmd_plate_w) m_speaker->level_w(data >> 2 & 1); // E3: vfd matrix grid 8 - astrocmd_grid_w(space, offset, data >> 3 & 1); + grid_w(space, offset, data >> 3 & 1); } else - astrocmd_display(); + prepare_display(); } +// config + static INPUT_PORTS_START( astrocmd ) PORT_START("IN.0") // port A PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SELECT ) @@ -571,20 +590,19 @@ static INPUT_PORTS_START( astrocmd ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) INPUT_PORTS_END - -static MACHINE_CONFIG_START( astrocmd, hh_ucom4_state ) +static MACHINE_CONFIG_START( astrocmd, astrocmd_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", NEC_D553, XTAL_400kHz) MCFG_UCOM4_READ_A_CB(IOPORT("IN.0")) MCFG_UCOM4_READ_B_CB(IOPORT("IN.1")) - MCFG_UCOM4_WRITE_C_CB(WRITE8(hh_ucom4_state, astrocmd_grid_w)) - MCFG_UCOM4_WRITE_D_CB(WRITE8(hh_ucom4_state, astrocmd_grid_w)) - MCFG_UCOM4_WRITE_E_CB(WRITE8(hh_ucom4_state, astrocmd_plate_w)) - MCFG_UCOM4_WRITE_F_CB(WRITE8(hh_ucom4_state, astrocmd_plate_w)) - MCFG_UCOM4_WRITE_G_CB(WRITE8(hh_ucom4_state, astrocmd_plate_w)) - MCFG_UCOM4_WRITE_H_CB(WRITE8(hh_ucom4_state, astrocmd_plate_w)) - MCFG_UCOM4_WRITE_I_CB(WRITE8(hh_ucom4_state, astrocmd_plate_w)) + MCFG_UCOM4_WRITE_C_CB(WRITE8(astrocmd_state, grid_w)) + MCFG_UCOM4_WRITE_D_CB(WRITE8(astrocmd_state, grid_w)) + MCFG_UCOM4_WRITE_E_CB(WRITE8(astrocmd_state, plate_w)) + MCFG_UCOM4_WRITE_F_CB(WRITE8(astrocmd_state, plate_w)) + MCFG_UCOM4_WRITE_G_CB(WRITE8(astrocmd_state, plate_w)) + MCFG_UCOM4_WRITE_H_CB(WRITE8(astrocmd_state, plate_w)) + MCFG_UCOM4_WRITE_I_CB(WRITE8(astrocmd_state, plate_w)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_hh_ucom4_test) @@ -617,16 +635,28 @@ MACHINE_CONFIG_END ***************************************************************************/ -WRITE8_MEMBER(hh_ucom4_state::edracula_grid_w) +class edracula_state : public hh_ucom4_state +{ +public: + edracula_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_ucom4_state(mconfig, type, tag) + { } + + DECLARE_WRITE8_MEMBER(grid_w); + DECLARE_WRITE8_MEMBER(plate_w); +}; + +// handlers + +WRITE8_MEMBER(edracula_state::grid_w) { // C,D: vfd matrix grid int shift = (offset - NEC_UCOM4_PORTC) * 4; m_grid = (m_grid & ~(0xf << shift)) | (data << shift); - - display_matrix(18+1, 8, m_plate, m_grid); + display_matrix(18, 8, m_plate, m_grid); } -WRITE8_MEMBER(hh_ucom4_state::edracula_plate_w) +WRITE8_MEMBER(edracula_state::plate_w) { // I2: speaker out if (offset == NEC_UCOM4_PORTI) @@ -635,11 +665,12 @@ WRITE8_MEMBER(hh_ucom4_state::edracula_plate_w) // E,F,G,H,I01: vfd matrix plate int shift = (offset - NEC_UCOM4_PORTE) * 4; m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - display_matrix(18, 8, m_plate, m_grid); } +// config + static INPUT_PORTS_START( edracula ) PORT_START("IN.0") // port A PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SELECT ) @@ -654,20 +685,19 @@ static INPUT_PORTS_START( edracula ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) INPUT_PORTS_END - -static MACHINE_CONFIG_START( edracula, hh_ucom4_state ) +static MACHINE_CONFIG_START( edracula, edracula_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", NEC_D553, XTAL_400kHz) MCFG_UCOM4_READ_A_CB(IOPORT("IN.0")) MCFG_UCOM4_READ_B_CB(IOPORT("IN.1")) - MCFG_UCOM4_WRITE_C_CB(WRITE8(hh_ucom4_state, edracula_grid_w)) - MCFG_UCOM4_WRITE_D_CB(WRITE8(hh_ucom4_state, edracula_grid_w)) - MCFG_UCOM4_WRITE_E_CB(WRITE8(hh_ucom4_state, edracula_plate_w)) - MCFG_UCOM4_WRITE_F_CB(WRITE8(hh_ucom4_state, edracula_plate_w)) - MCFG_UCOM4_WRITE_G_CB(WRITE8(hh_ucom4_state, edracula_plate_w)) - MCFG_UCOM4_WRITE_H_CB(WRITE8(hh_ucom4_state, edracula_plate_w)) - MCFG_UCOM4_WRITE_I_CB(WRITE8(hh_ucom4_state, edracula_plate_w)) + MCFG_UCOM4_WRITE_C_CB(WRITE8(edracula_state, grid_w)) + MCFG_UCOM4_WRITE_D_CB(WRITE8(edracula_state, grid_w)) + MCFG_UCOM4_WRITE_E_CB(WRITE8(edracula_state, plate_w)) + MCFG_UCOM4_WRITE_F_CB(WRITE8(edracula_state, plate_w)) + MCFG_UCOM4_WRITE_G_CB(WRITE8(edracula_state, plate_w)) + MCFG_UCOM4_WRITE_H_CB(WRITE8(edracula_state, plate_w)) + MCFG_UCOM4_WRITE_I_CB(WRITE8(edracula_state, plate_w)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_hh_ucom4_test) @@ -701,26 +731,45 @@ MACHINE_CONFIG_END ***************************************************************************/ -WRITE8_MEMBER(hh_ucom4_state::tmtennis_grid_w) +class tmtennis_state : public hh_ucom4_state +{ +public: + tmtennis_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_ucom4_state(mconfig, type, tag) + { } + + DECLARE_WRITE8_MEMBER(grid_w); + DECLARE_WRITE8_MEMBER(plate_w); + DECLARE_WRITE8_MEMBER(port_e_w); + DECLARE_READ8_MEMBER(input_r); + + void set_clock(); + DECLARE_INPUT_CHANGED_MEMBER(difficulty_switch); + +protected: + virtual void machine_reset(); +}; + +// handlers + +WRITE8_MEMBER(tmtennis_state::grid_w) { // G,H,I: vfd matrix grid int shift = (offset - NEC_UCOM4_PORTG) * 4; m_grid = (m_grid & ~(0xf << shift)) | (data << shift); - display_matrix(12, 12, m_plate, m_grid); } -WRITE8_MEMBER(hh_ucom4_state::tmtennis_plate_w) +WRITE8_MEMBER(tmtennis_state::plate_w) { // C,D,F: vfd matrix plate if (offset == NEC_UCOM4_PORTF) offset--; int shift = (offset - NEC_UCOM4_PORTC) * 4; m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - display_matrix(12, 12, m_plate, m_grid); } -WRITE8_MEMBER(hh_ucom4_state::tmtennis_port_e_w) +WRITE8_MEMBER(tmtennis_state::port_e_w) { // E01: input mux // E2: speaker out @@ -729,13 +778,15 @@ WRITE8_MEMBER(hh_ucom4_state::tmtennis_port_e_w) m_speaker->level_w(data >> 2 & 1); } -READ8_MEMBER(hh_ucom4_state::tmtennis_input_r) +READ8_MEMBER(tmtennis_state::input_r) { // A,B: multiplexed buttons return ~read_inputs(2) >> (offset*4); } +// config + /* Pro-Tennis physical button layout and labels is like this: * left = P2/CPU side * * right = P1 side * @@ -758,9 +809,9 @@ static INPUT_PORTS_START( tmtennis ) PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_J) PORT_NAME("P1 Button 6") PORT_START("IN.1") // E1 port A/B - PORT_CONFNAME( 0x101, 0x100, DEF_STR( Difficulty ) ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_ucom4_state, tmtennis_difficulty_switch, NULL) + PORT_CONFNAME( 0x101, 0x100, DEF_STR( Difficulty ) ) PORT_CHANGED_MEMBER(DEVICE_SELF, tmtennis_state, difficulty_switch, NULL) PORT_CONFSETTING( 0x001, "Practice" ) - PORT_CONFSETTING( 0x100, "Pro 1" ) // -> tmtennis_difficulty_switch + PORT_CONFSETTING( 0x100, "Pro 1" ) // -> difficulty_switch PORT_CONFSETTING( 0x000, "Pro 2" ) PORT_CONFNAME( 0x02, 0x00, "Players" ) PORT_CONFSETTING( 0x00, "1" ) @@ -773,8 +824,13 @@ static INPUT_PORTS_START( tmtennis ) PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_D) PORT_NAME("P2 Button 6") INPUT_PORTS_END +INPUT_CHANGED_MEMBER(tmtennis_state::difficulty_switch) +{ + set_clock(); +} + -void hh_ucom4_state::tmtennis_set_clock() +void tmtennis_state::set_clock() { // MCU clock is from an LC circuit oscillating by default at ~360kHz, // but on PRO1, the difficulty switch puts a capacitor across the LC circuit @@ -782,35 +838,29 @@ void hh_ucom4_state::tmtennis_set_clock() m_maincpu->set_unscaled_clock((m_inp_matrix[1]->read() & 0x100) ? 260000 : 360000); } -INPUT_CHANGED_MEMBER(hh_ucom4_state::tmtennis_difficulty_switch) -{ - tmtennis_set_clock(); -} - -MACHINE_RESET_MEMBER(hh_ucom4_state, tmtennis) +void tmtennis_state::machine_reset() { - tmtennis_set_clock(); + hh_ucom4_state::machine_reset(); + set_clock(); } -static MACHINE_CONFIG_START( tmtennis, hh_ucom4_state ) +static MACHINE_CONFIG_START( tmtennis, tmtennis_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", NEC_D552, 360000) // see tmtennis_set_clock - MCFG_UCOM4_READ_A_CB(READ8(hh_ucom4_state, tmtennis_input_r)) - MCFG_UCOM4_READ_B_CB(READ8(hh_ucom4_state, tmtennis_input_r)) - MCFG_UCOM4_WRITE_C_CB(WRITE8(hh_ucom4_state, tmtennis_plate_w)) - MCFG_UCOM4_WRITE_D_CB(WRITE8(hh_ucom4_state, tmtennis_plate_w)) - MCFG_UCOM4_WRITE_E_CB(WRITE8(hh_ucom4_state, tmtennis_port_e_w)) - MCFG_UCOM4_WRITE_F_CB(WRITE8(hh_ucom4_state, tmtennis_plate_w)) - MCFG_UCOM4_WRITE_G_CB(WRITE8(hh_ucom4_state, tmtennis_grid_w)) - MCFG_UCOM4_WRITE_H_CB(WRITE8(hh_ucom4_state, tmtennis_grid_w)) - MCFG_UCOM4_WRITE_I_CB(WRITE8(hh_ucom4_state, tmtennis_grid_w)) + MCFG_CPU_ADD("maincpu", NEC_D552, 360000) // see set_clock + MCFG_UCOM4_READ_A_CB(READ8(tmtennis_state, input_r)) + MCFG_UCOM4_READ_B_CB(READ8(tmtennis_state, input_r)) + MCFG_UCOM4_WRITE_C_CB(WRITE8(tmtennis_state, plate_w)) + MCFG_UCOM4_WRITE_D_CB(WRITE8(tmtennis_state, plate_w)) + MCFG_UCOM4_WRITE_E_CB(WRITE8(tmtennis_state, port_e_w)) + MCFG_UCOM4_WRITE_F_CB(WRITE8(tmtennis_state, plate_w)) + MCFG_UCOM4_WRITE_G_CB(WRITE8(tmtennis_state, grid_w)) + MCFG_UCOM4_WRITE_H_CB(WRITE8(tmtennis_state, grid_w)) + MCFG_UCOM4_WRITE_I_CB(WRITE8(tmtennis_state, grid_w)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_hh_ucom4_test) - MCFG_MACHINE_RESET_OVERRIDE(hh_ucom4_state, tmtennis) - /* no video! */ /* sound hardware */ @@ -844,24 +894,36 @@ MACHINE_CONFIG_END ***************************************************************************/ -void hh_ucom4_state::tmpacman_display() +class tmpacman_state : public hh_ucom4_state +{ +public: + tmpacman_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_ucom4_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE8_MEMBER(grid_w); + DECLARE_WRITE8_MEMBER(plate_w); +}; + +// handlers + +void tmpacman_state::prepare_display() { UINT16 grid = BITSWAP8(m_grid,0,1,2,3,4,5,6,7); UINT32 plate = BITSWAP24(m_plate,23,22,21,20,19,16,17,18,11,10,9,8,0,2,3,1,4,5,6,7,12,13,14,15); - display_matrix(19, 8, plate, grid); } -WRITE8_MEMBER(hh_ucom4_state::tmpacman_grid_w) +WRITE8_MEMBER(tmpacman_state::grid_w) { // C,D: vfd matrix grid int shift = (offset - NEC_UCOM4_PORTC) * 4; m_grid = (m_grid & ~(0xf << shift)) | (data << shift); - - tmpacman_display(); + prepare_display(); } -WRITE8_MEMBER(hh_ucom4_state::tmpacman_plate_w) +WRITE8_MEMBER(tmpacman_state::plate_w) { // E1: speaker out if (offset == NEC_UCOM4_PORTE) @@ -870,11 +932,12 @@ WRITE8_MEMBER(hh_ucom4_state::tmpacman_plate_w) // E023,F,G,H,I: vfd matrix plate int shift = (offset - NEC_UCOM4_PORTE) * 4; m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - - tmpacman_display(); + prepare_display(); } +// config + static INPUT_PORTS_START( tmpacman ) PORT_START("IN.0") // port A PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_16WAY // separate directional buttons, hence 16way @@ -889,20 +952,19 @@ static INPUT_PORTS_START( tmpacman ) PORT_BIT( 0x0e, IP_ACTIVE_HIGH, IPT_UNUSED ) INPUT_PORTS_END - -static MACHINE_CONFIG_START( tmpacman, hh_ucom4_state ) +static MACHINE_CONFIG_START( tmpacman, tmpacman_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", NEC_D553, XTAL_430kHz) MCFG_UCOM4_READ_A_CB(IOPORT("IN.0")) MCFG_UCOM4_READ_B_CB(IOPORT("IN.1")) - MCFG_UCOM4_WRITE_C_CB(WRITE8(hh_ucom4_state, tmpacman_grid_w)) - MCFG_UCOM4_WRITE_D_CB(WRITE8(hh_ucom4_state, tmpacman_grid_w)) - MCFG_UCOM4_WRITE_E_CB(WRITE8(hh_ucom4_state, tmpacman_plate_w)) - MCFG_UCOM4_WRITE_F_CB(WRITE8(hh_ucom4_state, tmpacman_plate_w)) - MCFG_UCOM4_WRITE_G_CB(WRITE8(hh_ucom4_state, tmpacman_plate_w)) - MCFG_UCOM4_WRITE_H_CB(WRITE8(hh_ucom4_state, tmpacman_plate_w)) - MCFG_UCOM4_WRITE_I_CB(WRITE8(hh_ucom4_state, tmpacman_plate_w)) + MCFG_UCOM4_WRITE_C_CB(WRITE8(tmpacman_state, grid_w)) + MCFG_UCOM4_WRITE_D_CB(WRITE8(tmpacman_state, grid_w)) + MCFG_UCOM4_WRITE_E_CB(WRITE8(tmpacman_state, plate_w)) + MCFG_UCOM4_WRITE_F_CB(WRITE8(tmpacman_state, plate_w)) + MCFG_UCOM4_WRITE_G_CB(WRITE8(tmpacman_state, plate_w)) + MCFG_UCOM4_WRITE_H_CB(WRITE8(tmpacman_state, plate_w)) + MCFG_UCOM4_WRITE_I_CB(WRITE8(tmpacman_state, plate_w)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_hh_ucom4_test) @@ -937,7 +999,20 @@ MACHINE_CONFIG_END ***************************************************************************/ -WRITE8_MEMBER(hh_ucom4_state::alnchase_output_w) +class alnchase_state : public hh_ucom4_state +{ +public: + alnchase_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_ucom4_state(mconfig, type, tag) + { } + + DECLARE_WRITE8_MEMBER(output_w); + DECLARE_READ8_MEMBER(input_r); +}; + +// handlers + +WRITE8_MEMBER(alnchase_state::output_w) { if (offset <= NEC_UCOM4_PORTE) { @@ -964,13 +1039,15 @@ WRITE8_MEMBER(hh_ucom4_state::alnchase_output_w) display_matrix(17, 9, m_plate, m_grid); } -READ8_MEMBER(hh_ucom4_state::alnchase_input_r) +READ8_MEMBER(alnchase_state::input_r) { // A: buttons return read_inputs(2); } +// config + /* physical button layout and labels is like this: POWER SOUND LEVEL PLAYER @@ -1008,20 +1085,19 @@ static INPUT_PORTS_START( alnchase ) PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNUSED ) INPUT_PORTS_END - -static MACHINE_CONFIG_START( alnchase, hh_ucom4_state ) +static MACHINE_CONFIG_START( alnchase, alnchase_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", NEC_D553, XTAL_400kHz) - MCFG_UCOM4_READ_A_CB(READ8(hh_ucom4_state, alnchase_input_r)) + MCFG_UCOM4_READ_A_CB(READ8(alnchase_state, input_r)) MCFG_UCOM4_READ_B_CB(IOPORT("IN.2")) - MCFG_UCOM4_WRITE_C_CB(WRITE8(hh_ucom4_state, alnchase_output_w)) - MCFG_UCOM4_WRITE_D_CB(WRITE8(hh_ucom4_state, alnchase_output_w)) - MCFG_UCOM4_WRITE_E_CB(WRITE8(hh_ucom4_state, alnchase_output_w)) - MCFG_UCOM4_WRITE_F_CB(WRITE8(hh_ucom4_state, alnchase_output_w)) - MCFG_UCOM4_WRITE_G_CB(WRITE8(hh_ucom4_state, alnchase_output_w)) - MCFG_UCOM4_WRITE_H_CB(WRITE8(hh_ucom4_state, alnchase_output_w)) - MCFG_UCOM4_WRITE_I_CB(WRITE8(hh_ucom4_state, alnchase_output_w)) + MCFG_UCOM4_WRITE_C_CB(WRITE8(alnchase_state, output_w)) + MCFG_UCOM4_WRITE_D_CB(WRITE8(alnchase_state, output_w)) + MCFG_UCOM4_WRITE_E_CB(WRITE8(alnchase_state, output_w)) + MCFG_UCOM4_WRITE_F_CB(WRITE8(alnchase_state, output_w)) + MCFG_UCOM4_WRITE_G_CB(WRITE8(alnchase_state, output_w)) + MCFG_UCOM4_WRITE_H_CB(WRITE8(alnchase_state, output_w)) + MCFG_UCOM4_WRITE_I_CB(WRITE8(alnchase_state, output_w)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_hh_ucom4_test) diff --git a/src/mess/drivers/mbdtower.c b/src/mess/drivers/mbdtower.c index 70aa569678a..1db1a8eaede 100644 --- a/src/mess/drivers/mbdtower.c +++ b/src/mess/drivers/mbdtower.c @@ -8,7 +8,7 @@ * TMS1400NLL MP7332-N1.U1(Rev. B) or MP7332-N2LL(Rev. C), die labeled MP7332 (assume same ROM contents between revisions) * SN75494N MOS-to-LED digit driver - * rotating reel + lightsensor + * rotating reel + lightsensor, 1bit-sound This is a board game, it obviously requires game pieces and the board. The emulated part is the centerpiece, a black tower with a rotating card @@ -32,7 +32,7 @@ public: : hh_tms1k_state(mconfig, type, tag) { } - void mbdtower_display(); + void prepare_display(); bool sensor_led_on() { return m_display_decay[0][0] != 0; } int m_motor_pos; @@ -58,7 +58,7 @@ protected: ***************************************************************************/ -void mbdtower_state::mbdtower_display() +void mbdtower_state::prepare_display() { // declare display matrix size and the 2 7segs set_display_size(7, 3); @@ -148,7 +148,7 @@ WRITE16_MEMBER(mbdtower_state::write_r) // R5-R7: tower lamps // R8: rotation sensor led m_r = data; - mbdtower_display(); + prepare_display(); // R10: speaker out m_speaker->level_w(~data >> 4 & data >> 10 & 1); @@ -159,7 +159,7 @@ WRITE16_MEMBER(mbdtower_state::write_o) // O0-O6: led segments A-G // O7: digit select m_o = data; - mbdtower_display(); + prepare_display(); } READ8_MEMBER(mbdtower_state::read_k) @@ -226,13 +226,14 @@ void mbdtower_state::machine_start() { hh_tms1k_state::machine_start(); - // zerofill/register for savestates + // zerofill m_motor_pos = 0; m_motor_pos_prev = -1; m_motor_decay = 0; m_motor_on = false; m_sensor_blind = false; + // register for savestates save_item(NAME(m_motor_pos)); /* save_item(NAME(m_motor_pos_prev)); */ // don't save! save_item(NAME(m_motor_decay)); diff --git a/src/mess/drivers/ticalc1x.c b/src/mess/drivers/ticalc1x.c index b0e06af609d..e106c554e2b 100644 --- a/src/mess/drivers/ticalc1x.c +++ b/src/mess/drivers/ticalc1x.c @@ -31,37 +31,6 @@ public: : hh_tms1k_state(mconfig, type, tag) { } - void display_matrix_seg(int maxx, int maxy, UINT32 setx, UINT32 sety, UINT16 segmask); - - // calculator-specific handlers - void tisr16_display(); - DECLARE_WRITE16_MEMBER(tisr16_write_o); - DECLARE_WRITE16_MEMBER(tisr16_write_r); - DECLARE_READ8_MEMBER(tisr16_read_k); - - DECLARE_WRITE16_MEMBER(ti1270_write_o); - DECLARE_WRITE16_MEMBER(ti1270_write_r); - DECLARE_READ8_MEMBER(ti1270_read_k); - - DECLARE_WRITE16_MEMBER(ti1000_write_o); - DECLARE_WRITE16_MEMBER(ti1000_write_r); - DECLARE_READ8_MEMBER(ti1000_read_k); - - DECLARE_WRITE16_MEMBER(wizatron_write_o); - DECLARE_WRITE16_MEMBER(wizatron_write_r); - DECLARE_READ8_MEMBER(wizatron_read_k); - - DECLARE_WRITE16_MEMBER(lilprof_write_o); - DECLARE_READ8_MEMBER(lilprof_read_k); - - DECLARE_WRITE16_MEMBER(lilprof78_write_o); - DECLARE_WRITE16_MEMBER(lilprof78_write_r); - DECLARE_READ8_MEMBER(lilprof78_read_k); - - DECLARE_WRITE16_MEMBER(ti30_write_o); - DECLARE_WRITE16_MEMBER(ti30_write_r); - DECLARE_READ8_MEMBER(ti30_read_k); - protected: virtual void machine_start(); }; @@ -73,31 +42,41 @@ void ticalc1x_state::machine_start() memset(m_display_segmask, ~0, sizeof(m_display_segmask)); // ! } -void ticalc1x_state::display_matrix_seg(int maxx, int maxy, UINT32 setx, UINT32 sety, UINT16 segmask) -{ - for (int y = 0; y < maxy; y++) - m_display_segmask[y] &= segmask; - - display_matrix(maxx, maxy, setx, sety); -} - /*************************************************************************** - Minidrivers (I/O, Inputs, Machine Config) + Minidrivers (subclass, I/O, Inputs, Machine Config) ***************************************************************************/ /*************************************************************************** - TI SR-16 - * TMS1000 MCU labeled TMS1001NL. die labeled 1000, 1001A + TI SR-16, SR-16 II + * SR-16: TMS1000 MCU labeled TMS1001NL. die labeled 1000, 1001A + * SR-16 II: TMS1000 MCU labeled TMS1016NL. die labeled 1000B, 1016A * 12-digit 7seg LED display + SR-16 II is a cost-reduced 'sequel', [10^x] was removed, and [pi] was added. + ***************************************************************************/ -void ticalc1x_state::tisr16_display() +class tisr16_state : public ticalc1x_state +{ +public: + tisr16_state(const machine_config &mconfig, device_type type, const char *tag) + : ticalc1x_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +void tisr16_state::prepare_display() { // update leds state for (int y = 0; y < 11; y++) @@ -111,27 +90,29 @@ void ticalc1x_state::tisr16_display() display_update(); } -WRITE16_MEMBER(ticalc1x_state::tisr16_write_r) +WRITE16_MEMBER(tisr16_state::write_r) { // R0-R10: input mux // R0-R10: select digit (right-to-left) m_r = m_inp_mux = data; - tisr16_display(); + prepare_display(); } -WRITE16_MEMBER(ticalc1x_state::tisr16_write_o) +WRITE16_MEMBER(tisr16_state::write_o) { // O0-O7: digit segments m_o = data; - tisr16_display(); + prepare_display(); } -READ8_MEMBER(ticalc1x_state::tisr16_read_k) +READ8_MEMBER(tisr16_state::read_k) { return read_inputs(11); } +// config + static INPUT_PORTS_START( tisr16 ) PORT_START("IN.0") // R0 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) @@ -201,38 +182,6 @@ static INPUT_PORTS_START( tisr16 ) INPUT_PORTS_END -static MACHINE_CONFIG_START( tisr16, ticalc1x_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1000, 300000) // RC osc. R=43K, C=68pf -> ~300kHz - MCFG_TMS1XXX_READ_K_CB(READ8(ticalc1x_state, tisr16_read_k)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ticalc1x_state, tisr16_write_o)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ticalc1x_state, tisr16_write_r)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_tisr16) - - /* no video! */ - - /* no sound! */ -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - TI SR-16 II - * TMS1000 MCU labeled TMS1016NL. die labeled 1000B, 1016A - * 12-digit 7seg LED display - - A cost-reduced 'sequel', [10^x] was removed, and [pi] was added. - -***************************************************************************/ - -// hardware is nearly identical to TI SR-16 above, so we simply use those handlers - static INPUT_PORTS_START( tisr16ii ) PORT_START("IN.0") // R0 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) @@ -302,10 +251,20 @@ static INPUT_PORTS_START( tisr16ii ) INPUT_PORTS_END -static MACHINE_CONFIG_DERIVED( tisr16ii, tisr16 ) +static MACHINE_CONFIG_START( tisr16, tisr16_state ) /* basic machine hardware */ - // the MCU RC osc. is different: R=30K, C=100pf -> ~300kHz(same freq as tisr16, no change needed) + MCFG_CPU_ADD("maincpu", TMS1000, 300000) // RC osc. R=43K, C=68pf -> ~300kHz (note: tisr16ii MCU RC osc. is different: R=30K, C=100pf -> also ~300kHz) + MCFG_TMS1XXX_READ_K_CB(READ8(tisr16_state, read_k)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(tisr16_state, write_o)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(tisr16_state, write_r)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_tisr16) + + /* no video! */ + + /* no sound! */ MACHINE_CONFIG_END @@ -320,13 +279,27 @@ MACHINE_CONFIG_END ***************************************************************************/ -WRITE16_MEMBER(ticalc1x_state::ti1270_write_r) +class ti1270_state : public ticalc1x_state +{ +public: + ti1270_state(const machine_config &mconfig, device_type type, const char *tag) + : ticalc1x_state(mconfig, type, tag) + { } + + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +WRITE16_MEMBER(ti1270_state::write_r) { // R0-R7: select digit (right-to-left) display_matrix_seg(8, 8, m_o, data, 0xff); } -WRITE16_MEMBER(ticalc1x_state::ti1270_write_o) +WRITE16_MEMBER(ti1270_state::write_o) { // O1-O5,O7: input mux // O0-O7: digit segments @@ -334,12 +307,14 @@ WRITE16_MEMBER(ticalc1x_state::ti1270_write_o) m_o = data; } -READ8_MEMBER(ticalc1x_state::ti1270_read_k) +READ8_MEMBER(ti1270_state::read_k) { return read_inputs(6); } +// config + static INPUT_PORTS_START( ti1270 ) PORT_START("IN.0") // O1 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CODE(KEYCODE_DEL) PORT_NAME("CE/C") @@ -378,14 +353,13 @@ static INPUT_PORTS_START( ti1270 ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_NAME("+/-") INPUT_PORTS_END - -static MACHINE_CONFIG_START( ti1270, ticalc1x_state ) +static MACHINE_CONFIG_START( ti1270, ti1270_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS0970, 250000) // guessed - MCFG_TMS1XXX_READ_K_CB(READ8(ticalc1x_state, ti1270_read_k)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ticalc1x_state, ti1270_write_o)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ticalc1x_state, ti1270_write_r)) + MCFG_TMS1XXX_READ_K_CB(READ8(ti1270_state, read_k)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ti1270_state, write_o)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ti1270_state, write_r)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_ti1270) @@ -407,14 +381,28 @@ MACHINE_CONFIG_END ***************************************************************************/ -WRITE16_MEMBER(ticalc1x_state::ti1000_write_r) +class ti1000_state : public ticalc1x_state +{ +public: + ti1000_state(const machine_config &mconfig, device_type type, const char *tag) + : ticalc1x_state(mconfig, type, tag) + { } + + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +WRITE16_MEMBER(ti1000_state::write_r) { // R0-R7: select digit (right-to-left) UINT8 o = BITSWAP8(m_o,7,4,3,2,1,0,6,5); display_matrix_seg(8, 8, o, data, 0xff); } -WRITE16_MEMBER(ticalc1x_state::ti1000_write_o) +WRITE16_MEMBER(ti1000_state::write_o) { // O0-O3,O5(?): input mux // O0-O7: digit segments @@ -422,12 +410,14 @@ WRITE16_MEMBER(ticalc1x_state::ti1000_write_o) m_o = data; } -READ8_MEMBER(ticalc1x_state::ti1000_read_k) +READ8_MEMBER(ti1000_state::read_k) { return read_inputs(5); } +// config + static INPUT_PORTS_START( ti1000 ) PORT_START("IN.0") // O0 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") @@ -449,26 +439,25 @@ static INPUT_PORTS_START( ti1000 ) // note: even though power buttons are on the matrix, they are not CPU-controlled PORT_START("IN.3") // O3 or O4? - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off") PORT_CHANGED_MEMBER(DEVICE_SELF, ticalc1x_state, power_button, (void *)false) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)false) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_NAME("+/-") PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_NAME("%") PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME(UTF8_DIVIDE) PORT_START("IN.4") // O5 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_CODE(KEYCODE_DEL) PORT_NAME("On/C") PORT_CHANGED_MEMBER(DEVICE_SELF, ticalc1x_state, power_button, (void *)true) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_CODE(KEYCODE_DEL) PORT_NAME("On/C") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)true) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CODE(KEYCODE_DEL_PAD) PORT_NAME(".") PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("=") INPUT_PORTS_END - -static MACHINE_CONFIG_START( ti1000, ticalc1x_state ) +static MACHINE_CONFIG_START( ti1000, ti1000_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS1990, 250000) // guessed - MCFG_TMS1XXX_READ_K_CB(READ8(ticalc1x_state, ti1000_read_k)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ticalc1x_state, ti1000_write_o)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ticalc1x_state, ti1000_write_r)) + MCFG_TMS1XXX_READ_K_CB(READ8(ti1000_state, read_k)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ti1000_state, write_o)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ti1000_state, write_r)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_ti1270) @@ -490,7 +479,21 @@ MACHINE_CONFIG_END ***************************************************************************/ -WRITE16_MEMBER(ticalc1x_state::wizatron_write_r) +class wizatron_state : public ticalc1x_state +{ +public: + wizatron_state(const machine_config &mconfig, device_type type, const char *tag) + : ticalc1x_state(mconfig, type, tag) + { } + + virtual DECLARE_WRITE16_MEMBER(write_o); + virtual DECLARE_WRITE16_MEMBER(write_r); + virtual DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +WRITE16_MEMBER(wizatron_state::write_r) { // 6th digit is custom(not 7seg), for math symbols, like this: // \./ GAB @@ -505,7 +508,7 @@ WRITE16_MEMBER(ticalc1x_state::wizatron_write_r) display_matrix_seg(7, 9, m_o, data, 0x7f); } -WRITE16_MEMBER(ticalc1x_state::wizatron_write_o) +WRITE16_MEMBER(wizatron_state::write_o) { // O1-O4: input mux // O0-O6: digit segments A-G @@ -514,12 +517,14 @@ WRITE16_MEMBER(ticalc1x_state::wizatron_write_o) m_o = data & 0x7f; } -READ8_MEMBER(ticalc1x_state::wizatron_read_k) +READ8_MEMBER(wizatron_state::read_k) { return read_inputs(4); } +// config + static INPUT_PORTS_START( wizatron ) PORT_START("IN.0") // O1 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_DEL) PORT_NAME("Clear") @@ -546,14 +551,13 @@ static INPUT_PORTS_START( wizatron ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME(UTF8_DIVIDE) INPUT_PORTS_END - -static MACHINE_CONFIG_START( wizatron, ticalc1x_state ) +static MACHINE_CONFIG_START( wizatron, wizatron_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS0970, 250000) // guessed - MCFG_TMS1XXX_READ_K_CB(READ8(ticalc1x_state, wizatron_read_k)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ticalc1x_state, wizatron_write_o)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ticalc1x_state, wizatron_write_r)) + MCFG_TMS1XXX_READ_K_CB(READ8(wizatron_state, read_k)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(wizatron_state, write_o)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(wizatron_state, write_r)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_wizatron) @@ -578,7 +582,20 @@ MACHINE_CONFIG_END ***************************************************************************/ -WRITE16_MEMBER(ticalc1x_state::lilprof_write_o) +class lilprof_state : public wizatron_state +{ +public: + lilprof_state(const machine_config &mconfig, device_type type, const char *tag) + : wizatron_state(mconfig, type, tag) + { } + + virtual DECLARE_WRITE16_MEMBER(write_o); + virtual DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +WRITE16_MEMBER(lilprof_state::write_o) { // O1-O4,O7: input mux // O0-O6: digit segments A-G @@ -586,12 +603,14 @@ WRITE16_MEMBER(ticalc1x_state::lilprof_write_o) m_o = data; } -READ8_MEMBER(ticalc1x_state::lilprof_read_k) +READ8_MEMBER(lilprof_state::read_k) { return read_inputs(5); } +// config + static INPUT_PORTS_START( lilprof ) PORT_INCLUDE( wizatron ) @@ -607,14 +626,13 @@ static INPUT_PORTS_START( lilprof ) PORT_CONFSETTING( 0x08, "4" ) INPUT_PORTS_END - -static MACHINE_CONFIG_START( lilprof, ticalc1x_state ) +static MACHINE_CONFIG_START( lilprof, lilprof_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS0970, 250000) // guessed - MCFG_TMS1XXX_READ_K_CB(READ8(ticalc1x_state, lilprof_read_k)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ticalc1x_state, lilprof_write_o)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ticalc1x_state, wizatron_write_r)) + MCFG_TMS1XXX_READ_K_CB(READ8(lilprof_state, read_k)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(lilprof_state, write_o)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(wizatron_state, write_r)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_wizatron) @@ -639,7 +657,21 @@ MACHINE_CONFIG_END ***************************************************************************/ -WRITE16_MEMBER(ticalc1x_state::lilprof78_write_r) +class lilprof78_state : public ticalc1x_state +{ +public: + lilprof78_state(const machine_config &mconfig, device_type type, const char *tag) + : ticalc1x_state(mconfig, type, tag) + { } + + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +WRITE16_MEMBER(lilprof78_state::write_r) { // update leds state UINT8 o = BITSWAP8(m_o,7,4,3,2,1,0,6,5) & 0x7f; @@ -651,14 +683,14 @@ WRITE16_MEMBER(ticalc1x_state::lilprof78_write_r) // 3rd digit A/G(equals sign) is from O7 m_display_state[3] = (m_o & 0x80) ? 0x41 : 0; - // 6th digit is a custom 7seg for math symbols (see wizatron_write_r) + // 6th digit is a custom 7seg for math symbols (see wizatron_state write_r) m_display_state[6] = BITSWAP8(m_display_state[6],7,6,1,4,2,3,5,0); set_display_size(7, 9); display_update(); } -WRITE16_MEMBER(ticalc1x_state::lilprof78_write_o) +WRITE16_MEMBER(lilprof78_state::write_o) { // O0-O3,O5(?): input mux // O0-O6: digit segments A-G @@ -667,12 +699,14 @@ WRITE16_MEMBER(ticalc1x_state::lilprof78_write_o) m_o = data; } -READ8_MEMBER(ticalc1x_state::lilprof78_read_k) +READ8_MEMBER(lilprof78_state::read_k) { return read_inputs(5); } +// config + static INPUT_PORTS_START( lilprof78 ) PORT_START("IN.0") // O0 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") @@ -694,26 +728,25 @@ static INPUT_PORTS_START( lilprof78 ) // note: even though power buttons are on the matrix, they are not CPU-controlled PORT_START("IN.3") // O3 or O4? - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off") PORT_CHANGED_MEMBER(DEVICE_SELF, ticalc1x_state, power_button, (void *)false) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)false) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_S) PORT_NAME("Set") PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_L) PORT_NAME("Level") PORT_START("IN.4") // O5 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PGUP) PORT_CODE(KEYCODE_DEL) PORT_NAME("On") PORT_CHANGED_MEMBER(DEVICE_SELF, ticalc1x_state, power_button, (void *)true) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PGUP) PORT_CODE(KEYCODE_DEL) PORT_NAME("On") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)true) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("Go") PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("+") INPUT_PORTS_END - -static MACHINE_CONFIG_START( lilprof78, ticalc1x_state ) +static MACHINE_CONFIG_START( lilprof78, lilprof78_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS1990, 250000) // guessed - MCFG_TMS1XXX_READ_K_CB(READ8(ticalc1x_state, lilprof78_read_k)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ticalc1x_state, lilprof78_write_o)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ticalc1x_state, lilprof78_write_r)) + MCFG_TMS1XXX_READ_K_CB(READ8(lilprof78_state, read_k)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(lilprof78_state, write_o)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(lilprof78_state, write_r)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_wizatron) @@ -737,7 +770,21 @@ MACHINE_CONFIG_END ***************************************************************************/ -WRITE16_MEMBER(ticalc1x_state::ti30_write_r) +class majestic_state : public ticalc1x_state +{ +public: + majestic_state(const machine_config &mconfig, device_type type, const char *tag) + : ticalc1x_state(mconfig, type, tag) + { } + + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +WRITE16_MEMBER(majestic_state::write_r) { // note: 1st digit only has segments B,F,G,DP m_display_segmask[0] = 0xe2; @@ -747,7 +794,7 @@ WRITE16_MEMBER(ticalc1x_state::ti30_write_r) display_matrix_seg(8, 9, o, data, 0xff); } -WRITE16_MEMBER(ticalc1x_state::ti30_write_o) +WRITE16_MEMBER(majestic_state::write_o) { // O0-O2,O4-O7: input mux // O0-O7: digit segments @@ -755,13 +802,15 @@ WRITE16_MEMBER(ticalc1x_state::ti30_write_o) m_o = data; } -READ8_MEMBER(ticalc1x_state::ti30_read_k) +READ8_MEMBER(majestic_state::read_k) { // note: the Vss row is always on return m_inp_matrix[7]->read() | read_inputs(7); } +// config + static INPUT_PORTS_START( ti30 ) PORT_START("IN.0") // O0 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_NAME("y" UTF8_POW_X) @@ -814,11 +863,11 @@ static INPUT_PORTS_START( ti30 ) // note: even though power buttons are on the matrix, they are not CPU-controlled PORT_START("IN.7") // Vss! - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_CODE(KEYCODE_DEL) PORT_NAME("ON/C") PORT_CHANGED_MEMBER(DEVICE_SELF, ticalc1x_state, power_button, (void *)true) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_CODE(KEYCODE_DEL) PORT_NAME("ON/C") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)true) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_NAME("1/x") PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_NAME(UTF8_SQUAREROOT"x") PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_NAME("x" UTF8_POW_2) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("OFF") PORT_CHANGED_MEMBER(DEVICE_SELF, ticalc1x_state, power_button, (void *)false) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("OFF") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)false) INPUT_PORTS_END @@ -874,11 +923,11 @@ static INPUT_PORTS_START( tiprog ) // note: even though power buttons are on the matrix, they are not CPU-controlled PORT_START("IN.7") // Vss! - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL) PORT_CODE(KEYCODE_PGUP) PORT_NAME("C/ON") PORT_CHANGED_MEMBER(DEVICE_SELF, ticalc1x_state, power_button, (void *)true) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL) PORT_CODE(KEYCODE_PGUP) PORT_NAME("C/ON") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)true) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_NAME("DEC") PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_NAME("OCT") PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_NAME("HEX") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("OFF") PORT_CHANGED_MEMBER(DEVICE_SELF, ticalc1x_state, power_button, (void *)false) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("OFF") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)false) INPUT_PORTS_END @@ -935,22 +984,22 @@ static INPUT_PORTS_START( tibusan1 ) // note: even though power buttons are on the matrix, they are not CPU-controlled PORT_START("IN.7") // Vss! - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_CODE(KEYCODE_DEL) PORT_NAME("ON/C") PORT_CHANGED_MEMBER(DEVICE_SELF, ticalc1x_state, power_button, (void *)true) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_CODE(KEYCODE_DEL) PORT_NAME("ON/C") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)true) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_NAME("2nd") PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_NAME("x" UTF8_POW_2" " UTF8_SQUAREROOT"x") PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_NAME("ln(x) e" UTF8_POW_X) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("OFF") PORT_CHANGED_MEMBER(DEVICE_SELF, ticalc1x_state, power_button, (void *)false) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("OFF") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)false) INPUT_PORTS_END -static MACHINE_CONFIG_START( ti30, ticalc1x_state ) +static MACHINE_CONFIG_START( majestic, majestic_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS0980, 400000) // guessed - MCFG_TMS1XXX_READ_K_CB(READ8(ticalc1x_state, ti30_read_k)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ticalc1x_state, ti30_write_o)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ticalc1x_state, ti30_write_r)) - MCFG_TMS1XXX_POWER_OFF_CB(WRITELINE(ticalc1x_state, auto_power_off)) + MCFG_TMS1XXX_READ_K_CB(READ8(majestic_state, read_k)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(majestic_state, write_o)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(majestic_state, write_r)) + MCFG_TMS1XXX_POWER_OFF_CB(WRITELINE(hh_tms1k_state, auto_power_off)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_ti30) @@ -1114,7 +1163,7 @@ ROM_END /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ COMP( 1974, tisr16, 0, 0, tisr16, tisr16, driver_device, 0, "Texas Instruments", "SR-16", GAME_SUPPORTS_SAVE | GAME_NO_SOUND_HW ) -COMP( 1975, tisr16ii, 0, 0, tisr16ii, tisr16ii, driver_device, 0, "Texas Instruments", "SR-16 II", GAME_SUPPORTS_SAVE | GAME_NO_SOUND_HW ) +COMP( 1975, tisr16ii, 0, 0, tisr16, tisr16ii, driver_device, 0, "Texas Instruments", "SR-16 II", GAME_SUPPORTS_SAVE | GAME_NO_SOUND_HW ) COMP( 1976, ti1270, 0, 0, ti1270, ti1270, driver_device, 0, "Texas Instruments", "TI-1270", GAME_SUPPORTS_SAVE | GAME_NO_SOUND_HW ) COMP( 1977, ti1000, 0, 0, ti1000, ti1000, driver_device, 0, "Texas Instruments", "TI-1000", GAME_SUPPORTS_SAVE | GAME_NO_SOUND_HW ) @@ -1122,6 +1171,6 @@ COMP( 1977, wizatron, 0, 0, wizatron, wizatron, driver_device, 0, "Tex COMP( 1976, lilprof, 0, 0, lilprof, lilprof, driver_device, 0, "Texas Instruments", "Little Professor (1976 version)", GAME_SUPPORTS_SAVE | GAME_NO_SOUND_HW ) COMP( 1978, lilprof78, lilprof, 0, lilprof78, lilprof78, driver_device, 0, "Texas Instruments", "Little Professor (1978 version)", GAME_SUPPORTS_SAVE | GAME_NO_SOUND_HW ) -COMP( 1976, ti30, 0, 0, ti30, ti30, driver_device, 0, "Texas Instruments", "TI-30", GAME_SUPPORTS_SAVE | GAME_NO_SOUND_HW ) -COMP( 1977, tiprog, 0, 0, ti30, tiprog, driver_device, 0, "Texas Instruments", "TI Programmer", GAME_SUPPORTS_SAVE | GAME_NO_SOUND_HW ) -COMP( 1979, tibusan1, 0, 0, ti30, tibusan1, driver_device, 0, "Texas Instruments", "TI Business Analyst-I", GAME_SUPPORTS_SAVE | GAME_NO_SOUND_HW ) +COMP( 1976, ti30, 0, 0, majestic, ti30, driver_device, 0, "Texas Instruments", "TI-30", GAME_SUPPORTS_SAVE | GAME_NO_SOUND_HW ) +COMP( 1977, tiprog, 0, 0, majestic, tiprog, driver_device, 0, "Texas Instruments", "TI Programmer", GAME_SUPPORTS_SAVE | GAME_NO_SOUND_HW ) +COMP( 1979, tibusan1, 0, 0, majestic, tibusan1, driver_device, 0, "Texas Instruments", "TI Business Analyst-I", GAME_SUPPORTS_SAVE | GAME_NO_SOUND_HW ) diff --git a/src/mess/drivers/tispeak.c b/src/mess/drivers/tispeak.c index b206220f654..b8794c98b37 100644 --- a/src/mess/drivers/tispeak.c +++ b/src/mess/drivers/tispeak.c @@ -314,6 +314,7 @@ public: // cartridge UINT32 m_cart_max_size; UINT8* m_cart_base; + void init_cartridge(); DECLARE_DEVICE_IMAGE_LOAD_MEMBER(tispeak_cartridge); DECLARE_DRIVER_INIT(snspell); DECLARE_DRIVER_INIT(lantutor); @@ -326,20 +327,40 @@ public: DECLARE_INPUT_CHANGED_MEMBER(snspell_power_button); void snspell_power_off(); - void snspell_display(); + void prepare_display(); protected: virtual void machine_start(); }; +void tispeak_state::machine_start() +{ + hh_tms1k_state::machine_start(); + memset(m_display_segmask, ~0, sizeof(m_display_segmask)); // ! + + init_cartridge(); +} + + /*************************************************************************** - File Handling + Cartridge Handling ***************************************************************************/ +void tispeak_state::init_cartridge() +{ + if (m_cart != NULL && m_cart->exists()) + { + astring region_tag; + memory_region *src = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG)); + if (src) + memcpy(m_cart_base, src->base(), src->bytes()); + } +} + DEVICE_IMAGE_LOAD_MEMBER(tispeak_state, tispeak_cartridge) { UINT32 size = m_cart->common_get_size("rom"); @@ -379,18 +400,9 @@ DRIVER_INIT_MEMBER(tispeak_state, lantutor) // common/snspell -void tispeak_state::snspell_display() -{ - for (int y = 0; y < 16; y++) - m_display_segmask[y] = 0x3fff; - - display_matrix(16, 16, m_o, (m_r & 0x8000) ? (m_r & 0x21ff) : 0); -} - -READ8_MEMBER(tispeak_state::snspell_read_k) +void tispeak_state::prepare_display() { - // note: the Vss row is always on - return m_inp_matrix[8]->read() | read_inputs(8); + display_matrix_seg(16, 16, m_o, (m_r & 0x8000) ? (m_r & 0x21ff) : 0, 0x3fff); } WRITE16_MEMBER(tispeak_state::snspell_write_r) @@ -403,7 +415,7 @@ WRITE16_MEMBER(tispeak_state::snspell_write_r) // R15: filament on // other bits: MCU internal use m_r = m_inp_mux = data; - snspell_display(); + prepare_display(); } WRITE16_MEMBER(tispeak_state::snspell_write_o) @@ -411,7 +423,13 @@ WRITE16_MEMBER(tispeak_state::snspell_write_o) // reorder opla to led14seg, plus DP as d14 and AP as d15: // E,D,C,G,B,A,I,M,L,K,N,J,[AP],H,F,[DP] (sidenote: TI KLMN = MAME MLNK) m_o = BITSWAP16(data,12,15,10,7,8,9,11,6,13,3,14,0,1,2,4,5); - snspell_display(); + prepare_display(); +} + +READ8_MEMBER(tispeak_state::snspell_read_k) +{ + // note: the Vss row is always on + return m_inp_matrix[8]->read() | read_inputs(8); } @@ -432,7 +450,7 @@ WRITE16_MEMBER(tispeak_state::snmath_write_o) // reorder opla to led14seg, plus DP as d14 and AP as d15: // [DP],D,C,H,F,B,I,M,L,K,N,J,[AP],E,G,A (sidenote: TI KLMN = MAME MLNK) m_o = BITSWAP16(data,12,0,10,7,8,9,11,6,3,14,4,13,1,2,5,15); - snspell_display(); + prepare_display(); } @@ -442,7 +460,7 @@ WRITE16_MEMBER(tispeak_state::lantutor_write_r) { // same as default, except R13 is used for an extra digit m_r = m_inp_mux = data; - snspell_display(); + prepare_display(); } @@ -639,21 +657,6 @@ INPUT_PORTS_END ***************************************************************************/ -void tispeak_state::machine_start() -{ - hh_tms1k_state::machine_start(); - - // init cartridge - if (m_cart != NULL && m_cart->exists()) - { - astring region_tag; - memory_region *src = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG)); - if (src) - memcpy(m_cart_base, src->base(), src->bytes()); - } -} - - static MACHINE_CONFIG_START( snmath, tispeak_state ) /* basic machine hardware */ @@ -919,17 +922,18 @@ ROM_END -COMP( 1978, snspell, 0, 0, snspell, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (US, 1978 version/prototype)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND ) -COMP( 1979, snspella, snspell, 0, snspell, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (US, 1979 version)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) // incomplete dump, uses prototype MCU ROM -COMP( 1980, snspellb, snspell, 0, snspell, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (US, 1980 version)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) // incomplete dump, uses prototype MCU ROM -COMP( 1978, snspelluk, snspell, 0, snspell, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (UK, 1978 version)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) // incomplete dump, uses prototype MCU ROM -COMP( 1981, snspelluka, snspell, 0, snspell, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (UK, 1981 version)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) // incomplete dump, uses prototype MCU ROM -COMP( 1979, snspelljp, snspell, 0, snspell, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (Japan)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) // incomplete dump, uses prototype MCU ROM -COMP( 1980, ladictee, snspell, 0, snspell, snspell, tispeak_state, snspell, "Texas Instruments", "La Dictee Magique (France)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) // doesn't work due to missing CD2702 MCU dump, German/Italian version has CD2702 too +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ +COMP( 1978, snspell, 0, 0, snspell, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (US, 1978 version/prototype)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND ) +COMP( 1979, snspella, snspell, 0, snspell, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (US, 1979 version)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) // incomplete dump, uses prototype MCU ROM +COMP( 1980, snspellb, snspell, 0, snspell, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (US, 1980 version)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) // incomplete dump, uses prototype MCU ROM +COMP( 1978, snspelluk, snspell, 0, snspell, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (UK, 1978 version)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) // incomplete dump, uses prototype MCU ROM +COMP( 1981, snspelluka, snspell, 0, snspell, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (UK, 1981 version)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) // incomplete dump, uses prototype MCU ROM +COMP( 1979, snspelljp, snspell, 0, snspell, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (Japan)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) // incomplete dump, uses prototype MCU ROM +COMP( 1980, ladictee, snspell, 0, snspell, snspell, tispeak_state, snspell, "Texas Instruments", "La Dictee Magique (France)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) // doesn't work due to missing CD2702 MCU dump, German/Italian version has CD2702 too -COMP( 1986, snmath, 0, 0, snmath, snmath, driver_device, 0, "Texas Instruments", "Speak & Math (US, 1986 version)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND ) -COMP( 1980, snmathp, snmath, 0, snmath, snmath, driver_device, 0, "Texas Instruments", "Speak & Math (US, 1980 version/prototype)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) +COMP( 1986, snmath, 0, 0, snmath, snmath, driver_device, 0, "Texas Instruments", "Speak & Math (US, 1986 version)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND ) +COMP( 1980, snmathp, snmath, 0, snmath, snmath, driver_device, 0, "Texas Instruments", "Speak & Math (US, 1980 version/prototype)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) -COMP( 1980, snread, 0, 0, snread, snread, tispeak_state, snspell, "Texas Instruments", "Speak & Read (US)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND ) +COMP( 1980, snread, 0, 0, snread, snread, tispeak_state, snspell, "Texas Instruments", "Speak & Read (US)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND ) -COMP( 1979, lantutor, 0, 0, lantutor, lantutor, tispeak_state, lantutor, "Texas Instruments", "Language Tutor (prototype)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) +COMP( 1979, lantutor, 0, 0, lantutor, lantutor, tispeak_state, lantutor, "Texas Instruments", "Language Tutor (prototype)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) diff --git a/src/mess/includes/hh_tms1k.h b/src/mess/includes/hh_tms1k.h index d7d83058d49..27cf20279d2 100644 --- a/src/mess/includes/hh_tms1k.h +++ b/src/mess/includes/hh_tms1k.h @@ -57,94 +57,7 @@ public: void display_update(); void set_display_size(int maxx, int maxy); void display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety); - - // game-specific handlers - void mathmagi_display(); - DECLARE_WRITE16_MEMBER(mathmagi_write_r); - DECLARE_WRITE16_MEMBER(mathmagi_write_o); - DECLARE_READ8_MEMBER(mathmagi_read_k); - - void amaztron_display(); - DECLARE_WRITE16_MEMBER(amaztron_write_r); - DECLARE_WRITE16_MEMBER(amaztron_write_o); - DECLARE_READ8_MEMBER(amaztron_read_k); - - void tc4_display(); - DECLARE_WRITE16_MEMBER(tc4_write_r); - DECLARE_WRITE16_MEMBER(tc4_write_o); - DECLARE_READ8_MEMBER(tc4_read_k); - - void ebball_display(); - DECLARE_WRITE16_MEMBER(ebball_write_r); - DECLARE_WRITE16_MEMBER(ebball_write_o); - DECLARE_READ8_MEMBER(ebball_read_k); - - void ebball2_display(); - DECLARE_WRITE16_MEMBER(ebball2_write_r); - DECLARE_WRITE16_MEMBER(ebball2_write_o); - DECLARE_READ8_MEMBER(ebball2_read_k); - - void ebball3_display(); - DECLARE_WRITE16_MEMBER(ebball3_write_r); - DECLARE_WRITE16_MEMBER(ebball3_write_o); - DECLARE_READ8_MEMBER(ebball3_read_k); - void ebball3_set_clock(); - DECLARE_INPUT_CHANGED_MEMBER(ebball3_difficulty_switch); - DECLARE_MACHINE_RESET(ebball3); - - DECLARE_WRITE16_MEMBER(elecdet_write_r); - DECLARE_WRITE16_MEMBER(elecdet_write_o); - DECLARE_READ8_MEMBER(elecdet_read_k); - - void starwbc_display(); - DECLARE_WRITE16_MEMBER(starwbc_write_r); - DECLARE_WRITE16_MEMBER(starwbc_write_o); - DECLARE_READ8_MEMBER(starwbc_read_k); - - void astro_display(); - DECLARE_WRITE16_MEMBER(astro_write_r); - DECLARE_WRITE16_MEMBER(astro_write_o); - DECLARE_READ8_MEMBER(astro_read_k); - - DECLARE_WRITE16_MEMBER(comp4_write_r); - DECLARE_WRITE16_MEMBER(comp4_write_o); - DECLARE_READ8_MEMBER(comp4_read_k); - - DECLARE_WRITE16_MEMBER(simon_write_r); - DECLARE_WRITE16_MEMBER(simon_write_o); - DECLARE_READ8_MEMBER(simon_read_k); - - DECLARE_WRITE16_MEMBER(ssimon_write_r); - DECLARE_WRITE16_MEMBER(ssimon_write_o); - DECLARE_READ8_MEMBER(ssimon_read_k); - void ssimon_set_clock(); - DECLARE_INPUT_CHANGED_MEMBER(ssimon_speed_switch); - DECLARE_MACHINE_RESET(ssimon); - - DECLARE_WRITE16_MEMBER(cnsector_write_r); - DECLARE_WRITE16_MEMBER(cnsector_write_o); - DECLARE_READ8_MEMBER(cnsector_read_k); - - DECLARE_WRITE16_MEMBER(merlin_write_r); - DECLARE_WRITE16_MEMBER(merlin_write_o); - DECLARE_READ8_MEMBER(merlin_read_k); - - DECLARE_WRITE16_MEMBER(stopthief_write_r); - DECLARE_WRITE16_MEMBER(stopthief_write_o); - DECLARE_READ8_MEMBER(stopthief_read_k); - - DECLARE_WRITE16_MEMBER(bankshot_write_r); - DECLARE_WRITE16_MEMBER(bankshot_write_o); - DECLARE_READ8_MEMBER(bankshot_read_k); - - DECLARE_WRITE16_MEMBER(splitsec_write_r); - DECLARE_WRITE16_MEMBER(splitsec_write_o); - DECLARE_READ8_MEMBER(splitsec_read_k); - - void tandy12_display(); - DECLARE_WRITE16_MEMBER(tandy12_write_r); - DECLARE_WRITE16_MEMBER(tandy12_write_o); - DECLARE_READ8_MEMBER(tandy12_read_k); + void display_matrix_seg(int maxx, int maxy, UINT32 setx, UINT32 sety, UINT16 segmask); protected: virtual void machine_start(); diff --git a/src/osd/modules/render/drawogl.c b/src/osd/modules/render/drawogl.c index 4a3bf4d1e45..05cd39fe985 100644 --- a/src/osd/modules/render/drawogl.c +++ b/src/osd/modules/render/drawogl.c @@ -32,8 +32,8 @@ #include "modules/lib/osdlib.h" #include "modules/lib/osdobj_common.h" -#ifdef OSD_WINDOWS -#define SDLMAME_SDL2 1 +#if defined(OSD_WINDOWS) && !defined(SDLMAME_SDL2) +#define SDLMAME_SDL2 0 #endif // OpenGL headers @@ -189,9 +189,8 @@ enum // TYPES //============================================================ -#if (SDLMAME_SDL2) +#if defined(OSD_WINDOWS) -#ifdef OSD_WINDOWS class win_gl_context : public osd_gl_context { public: @@ -347,7 +346,8 @@ private: HMODULE win_gl_context::m_module; -#else +#elif SDLMAME_SDL2 + class sdl_gl_context : public osd_gl_context { public: @@ -396,7 +396,7 @@ private: SDL_Window *m_window; char m_error[256]; }; -#endif + #else // SDL 1.2 class sdl12_gl_context : public osd_gl_context @@ -442,7 +442,6 @@ private: char m_error[256]; }; - #endif //============================================================ @@ -763,12 +762,13 @@ int drawogl_init(running_machine &machine, osd_draw_callbacks *callbacks) dll_loaded = 0; load_gl_lib(machine); - if (SDLMAME_SDL2) - { - osd_printf_verbose("Using SDL multi-window OpenGL driver (SDL 2.0+)\n"); - } - else - osd_printf_verbose("Using SDL single-window OpenGL driver (SDL 1.2)\n"); +#if defined(OSD_WINDOWS) + osd_printf_verbose("Using Windows OpenGL driver\n"); +#elif SDLMAME_SDL2 + osd_printf_verbose("Using SDL multi-window OpenGL driver (SDL 2.0+)\n"); +#else + osd_printf_verbose("Using SDL single-window OpenGL driver (SDL 1.2)\n"); +#endif return 0; } @@ -1030,13 +1030,11 @@ void sdl_info_ogl::initialize_gl() int sdl_info_ogl::create() { -#if (SDLMAME_SDL2) // create renderer -#ifdef OSD_WINDOWS +#if defined(OSD_WINDOWS) m_gl_context = global_alloc(win_gl_context(window().m_hwnd)); -#else +#elif SDLMAME_SDL2 m_gl_context = global_alloc(sdl_gl_context(window().sdl_window())); -#endif #else m_gl_context = global_alloc(sdl12_gl_context(window().sdl_surface())); #endif @@ -1530,7 +1528,7 @@ int sdl_info_ogl::draw(const int update) if (m_init_context) { // do some one-time OpenGL setup -#if (SDLMAME_SDL2) +#if SDLMAME_SDL2 // FIXME: SRGB conversion is working on SDL2, may be of use // when we eventually target gamma and monitor profiles. //glEnable(GL_FRAMEBUFFER_SRGB); @@ -1560,7 +1558,7 @@ int sdl_info_ogl::draw(const int update) loadGLExtensions(); } -#if (!SDLMAME_SDL2) +#if !defined(OSD_WINDOWS) && !SDLMAME_SDL2 // force all textures to be regenerated destroy_all_textures(); #endif diff --git a/src/osd/sdl/main.c b/src/osd/sdl/main.c index da27c9ba9ba..f3ccb07f83d 100644 --- a/src/osd/sdl/main.c +++ b/src/osd/sdl/main.c @@ -37,14 +37,6 @@ extern "C" int _tmain(int argc, TCHAR **argv) int i, rc; char **utf8_argv; -#ifdef OSD_SDL -#ifdef MALLOC_DEBUG -{ - extern int winalloc_in_main_code; - winalloc_in_main_code = TRUE; -#endif -#endif - /* convert arguments to UTF-8 */ utf8_argv = (char **) malloc(argc * sizeof(*argv)); if (utf8_argv == NULL) @@ -64,16 +56,5 @@ extern "C" int _tmain(int argc, TCHAR **argv) osd_free(utf8_argv[i]); free(utf8_argv); -#ifdef OSD_SDL -#ifdef MALLOC_DEBUG - { - void check_unfreed_mem(void); - check_unfreed_mem(); - } - winalloc_in_main_code = FALSE; -} -#endif -#endif - return rc; } diff --git a/src/osd/sdl/sdlmain.c b/src/osd/sdl/sdlmain.c index 927facfd175..881fe0ff248 100644 --- a/src/osd/sdl/sdlmain.c +++ b/src/osd/sdl/sdlmain.c @@ -290,13 +290,6 @@ int main(int argc, char *argv[]) res = frontend.execute(argc, argv); } -#ifdef MALLOC_DEBUG - { - void check_unfreed_mem(void); - check_unfreed_mem(); - } -#endif - #ifdef SDLMAME_UNIX #if (!defined(SDLMAME_MACOSX)) && (!defined(SDLMAME_HAIKU)) && (!defined(SDLMAME_EMSCRIPTEN)) if (!sdl_entered_debugger) diff --git a/src/osd/sdl/video.h b/src/osd/sdl/video.h index 913116f6b62..862988fe6ac 100644 --- a/src/osd/sdl/video.h +++ b/src/osd/sdl/video.h @@ -12,6 +12,11 @@ #ifndef __SDLVIDEO__ #define __SDLVIDEO__ +#if defined(SDLMAME_WIN32) && !(SDLMAME_SDL2) +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#endif + #include "osdsdl.h" //============================================================ diff --git a/src/osd/sdl/window.c b/src/osd/sdl/window.c index e77fa480bb0..d44742c80f6 100644 --- a/src/osd/sdl/window.c +++ b/src/osd/sdl/window.c @@ -9,6 +9,11 @@ // //============================================================ +#ifdef SDLMAME_WIN32 +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#endif + // standard SDL headers #include "sdlinc.h" @@ -60,16 +65,16 @@ // minimum window dimension #define MIN_WINDOW_DIM 200 -//#ifndef SDLMAME_WIN32 -#define WMSZ_TOP (0) -#define WMSZ_BOTTOM (1) +#ifndef SDLMAME_WIN32 +#define WMSZ_TOP (0) +#define WMSZ_BOTTOM (1) #define WMSZ_BOTTOMLEFT (2) #define WMSZ_BOTTOMRIGHT (3) -#define WMSZ_LEFT (4) +#define WMSZ_LEFT (4) #define WMSZ_TOPLEFT (5) #define WMSZ_TOPRIGHT (6) -#define WMSZ_RIGHT (7) -//#endif +#define WMSZ_RIGHT (7) +#endif //============================================================ // GLOBAL VARIABLES |
