summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/devices/bus/a2bus/a2alfam2.cpp1
-rw-r--r--src/devices/bus/a2bus/a2applicard.cpp1
-rw-r--r--src/devices/bus/a2bus/a2cffa.cpp1
-rw-r--r--src/devices/bus/a2bus/a2corvus.cpp1
-rw-r--r--src/devices/bus/a2bus/a2diskii.cpp1
-rw-r--r--src/devices/bus/a2bus/a2dx1.cpp1
-rw-r--r--src/devices/bus/a2bus/a2echoii.cpp1
-rw-r--r--src/devices/bus/a2bus/a2eext80col.cpp1
-rw-r--r--src/devices/bus/a2bus/a2eramworks3.cpp1
-rw-r--r--src/devices/bus/a2bus/a2estd80col.cpp1
-rw-r--r--src/devices/bus/a2bus/a2hsscsi.cpp1
-rw-r--r--src/devices/bus/a2bus/a2lang.cpp145
-rw-r--r--src/devices/bus/a2bus/a2lang.h46
-rw-r--r--src/devices/bus/a2bus/a2mcms.cpp1
-rw-r--r--src/devices/bus/a2bus/a2memexp.cpp1
-rw-r--r--src/devices/bus/a2bus/a2sam.cpp1
-rw-r--r--src/devices/bus/a2bus/a2scsi.cpp1
-rw-r--r--src/devices/bus/a2bus/a2softcard.cpp1
-rw-r--r--src/devices/bus/a2bus/a2swyft.cpp1
-rw-r--r--src/devices/bus/a2bus/a2themill.cpp1
-rw-r--r--src/devices/bus/a2bus/a2ultraterm.cpp1
-rw-r--r--src/devices/bus/a2bus/a2videoterm.cpp1
-rw-r--r--src/devices/bus/a2bus/a2vulcan.cpp1
-rw-r--r--src/devices/bus/a2bus/a2zipdrive.cpp1
-rw-r--r--src/devices/bus/a2bus/laser128.cpp1
-rw-r--r--src/devices/bus/amiga/keyboard/a1200.cpp191
-rw-r--r--src/devices/bus/amiga/keyboard/a1200.h43
-rw-r--r--src/devices/bus/amiga/keyboard/a500.cpp603
-rw-r--r--src/devices/bus/amiga/keyboard/a500.h171
-rw-r--r--src/devices/bus/amiga/keyboard/keyboard.cpp8
-rw-r--r--src/devices/bus/amiga/keyboard/keyboard.h12
-rw-r--r--src/devices/bus/amiga/keyboard/matrix.cpp778
-rw-r--r--src/devices/bus/amiga/keyboard/matrix.h29
-rw-r--r--src/devices/bus/c64/exp.cpp2
-rw-r--r--src/devices/bus/c64/speakeasy.cpp103
-rw-r--r--src/devices/bus/c64/speakeasy.h54
-rw-r--r--src/devices/bus/coco/coco_dwsock.cpp1
-rw-r--r--src/devices/bus/coco/coco_fdc.cpp1
-rw-r--r--src/devices/bus/coco/coco_multi.cpp3
-rw-r--r--src/devices/bus/coco/coco_pak.cpp28
-rw-r--r--src/devices/bus/coco/coco_pak.h1
-rw-r--r--src/devices/bus/coco/coco_t4426.cpp27
-rw-r--r--src/devices/bus/coco/coco_t4426.h1
-rw-r--r--src/devices/bus/coco/dragon_fdc.cpp1
-rw-r--r--src/devices/bus/cpc/amdrum.cpp1
-rw-r--r--src/devices/bus/cpc/cpc_pds.cpp1
-rw-r--r--src/devices/bus/cpc/cpc_rom.cpp2
-rw-r--r--src/devices/bus/cpc/cpc_rs232.cpp3
-rw-r--r--src/devices/bus/cpc/cpc_ssa1.cpp2
-rw-r--r--src/devices/bus/cpc/ddi1.cpp2
-rw-r--r--src/devices/bus/cpc/doubler.cpp2
-rw-r--r--src/devices/bus/cpc/hd20.cpp3
-rw-r--r--src/devices/bus/cpc/magicsound.cpp3
-rw-r--r--src/devices/bus/cpc/mface2.cpp2
-rw-r--r--src/devices/bus/cpc/playcity.cpp2
-rw-r--r--src/devices/bus/cpc/smartwatch.cpp3
-rw-r--r--src/devices/bus/cpc/transtape.cpp2
-rw-r--r--src/devices/bus/ep64/exp.h2
-rw-r--r--src/devices/bus/ieee488/hp9895.cpp21
-rw-r--r--src/devices/bus/ieee488/hp9895.h4
-rw-r--r--src/devices/bus/nes/ggenie.cpp3
-rw-r--r--src/devices/bus/vic20/exp.cpp4
-rw-r--r--src/devices/bus/vic20/speakeasy.cpp104
-rw-r--r--src/devices/bus/vic20/speakeasy.h55
-rw-r--r--src/devices/bus/vic20/videopak.cpp336
-rw-r--r--src/devices/bus/vic20/videopak.h71
-rw-r--r--src/devices/bus/vme/vme_fccpu20.cpp5
-rw-r--r--src/devices/cpu/m6805/6805dasm.cpp32
-rw-r--r--src/devices/cpu/m6805/6805ops.hxx4
-rw-r--r--src/devices/cpu/m6805/m6805.cpp7
-rw-r--r--src/devices/cpu/m6805/m68705.cpp18
-rw-r--r--src/devices/cpu/m6805/m68705.h1
-rw-r--r--src/devices/cpu/m6805/m68hc05.cpp882
-rw-r--r--src/devices/cpu/m6805/m68hc05.h243
-rw-r--r--src/devices/cpu/pic16c5x/pic16c5x.cpp26
-rw-r--r--src/devices/cpu/tlcs870/tlcs870.cpp3245
-rw-r--r--src/devices/cpu/tlcs870/tlcs870.h245
-rw-r--r--src/devices/machine/fdc_pll.cpp2
-rw-r--r--src/devices/machine/phi.cpp18
-rw-r--r--src/devices/machine/phi.h1
-rw-r--r--src/devices/machine/t10mmc.cpp35
-rw-r--r--src/devices/machine/t10mmc.h1
-rw-r--r--src/devices/sound/dave.cpp (renamed from src/mame/audio/dave.cpp)0
-rw-r--r--src/devices/sound/dave.h (renamed from src/mame/audio/dave.h)0
-rw-r--r--src/devices/sound/es8712.cpp20
-rw-r--r--src/devices/sound/es8712.h3
-rw-r--r--src/devices/sound/namco.cpp4
-rw-r--r--src/devices/video/cesblit.cpp282
-rw-r--r--src/devices/video/cesblit.h84
-rw-r--r--src/devices/video/mc6845.cpp2
-rw-r--r--src/devices/video/ppu2c0x.cpp (renamed from src/mame/video/ppu2c0x.cpp)0
-rw-r--r--src/devices/video/ppu2c0x.h (renamed from src/mame/video/ppu2c0x.h)0
-rw-r--r--src/devices/video/tms9927.cpp26
-rw-r--r--src/devices/video/tms9927.h22
-rw-r--r--src/emu/debug/express.cpp13
-rw-r--r--src/emu/devfind.h101
-rw-r--r--src/emu/ioport.cpp4
-rw-r--r--src/emu/natkeyboard.cpp154
-rw-r--r--src/emu/natkeyboard.h16
-rw-r--r--src/frontend/mame/cheat.cpp593
-rw-r--r--src/frontend/mame/cheat.h162
-rw-r--r--src/lib/formats/apd_dsk.cpp127
-rw-r--r--src/lib/formats/tzx_cas.cpp77
-rw-r--r--src/lib/formats/tzx_cas.h2
-rw-r--r--src/lib/formats/zx81_p.cpp22
-rw-r--r--src/lib/formats/zx81_p.h1
-rw-r--r--src/lib/netlist/analog/nld_bjt.cpp2
-rw-r--r--src/lib/netlist/analog/nlid_twoterm.h2
-rw-r--r--src/lib/netlist/build/doxygen.conf8
-rw-r--r--src/lib/netlist/build/makefile22
-rw-r--r--src/lib/netlist/devices/net_lib.cpp6
-rw-r--r--src/lib/netlist/devices/nld_9322.cpp47
-rw-r--r--src/lib/netlist/devices/nld_am2847.cpp7
-rw-r--r--src/lib/netlist/devices/nld_ne555.cpp45
-rw-r--r--src/lib/netlist/devices/nld_ne555.h15
-rw-r--r--src/lib/netlist/devices/nlid_system.h4
-rw-r--r--src/lib/netlist/documentation/mainpage.dox.h9
-rw-r--r--src/lib/netlist/netlist_types.h (renamed from src/lib/netlist/nl_types.h)14
-rw-r--r--src/lib/netlist/nl_base.cpp181
-rw-r--r--src/lib/netlist/nl_base.h119
-rw-r--r--src/lib/netlist/nl_config.h15
-rw-r--r--src/lib/netlist/nl_lists.h29
-rw-r--r--src/lib/netlist/nl_setup.h2
-rwxr-xr-x[-rw-r--r--]src/lib/netlist/plib/palloc.cpp23
-rw-r--r--src/lib/netlist/plib/palloc.h10
-rwxr-xr-x[-rw-r--r--]src/lib/netlist/plib/pconfig.h10
-rw-r--r--src/lib/netlist/plib/plists.h32
-rwxr-xr-x[-rw-r--r--]src/lib/netlist/plib/ppmf.h97
-rw-r--r--src/lib/netlist/plib/pstring.cpp17
-rw-r--r--src/lib/netlist/prg/nltool.cpp111
-rw-r--r--src/lib/netlist/solver/nld_solver.cpp1
-rw-r--r--src/lib/util/chd.cpp14
-rw-r--r--src/lib/util/client_http.hpp12
-rw-r--r--src/lib/util/client_https.hpp2
-rw-r--r--src/lib/util/hashing.h54
-rw-r--r--src/lib/util/server_http.hpp11
-rw-r--r--src/mame/arcade.flt1
-rw-r--r--src/mame/drivers/5clown.cpp2
-rw-r--r--src/mame/drivers/aerofgt.cpp58
-rw-r--r--src/mame/drivers/aleisttl.cpp2
-rw-r--r--src/mame/drivers/amiga.cpp2
-rw-r--r--src/mame/drivers/apple2e.cpp1
-rw-r--r--src/mame/drivers/apple2gs.cpp2
-rw-r--r--src/mame/drivers/aquarium.cpp86
-rw-r--r--src/mame/drivers/asteroid.cpp8
-rw-r--r--src/mame/drivers/atom.cpp38
-rw-r--r--src/mame/drivers/banctec.cpp103
-rw-r--r--src/mame/drivers/battlex.cpp74
-rw-r--r--src/mame/drivers/bwidow.cpp6
-rw-r--r--src/mame/drivers/bzone.cpp2
-rw-r--r--src/mame/drivers/coco12.cpp14
-rw-r--r--src/mame/drivers/coco3.cpp1
-rw-r--r--src/mame/drivers/cps2.cpp35
-rw-r--r--src/mame/drivers/d9final.cpp2
-rw-r--r--src/mame/drivers/dblcrown.cpp35
-rw-r--r--src/mame/drivers/dec0.cpp224
-rw-r--r--src/mame/drivers/deco_mlc.cpp5
-rw-r--r--src/mame/drivers/decocass.cpp61
-rw-r--r--src/mame/drivers/ep64.cpp2
-rw-r--r--src/mame/drivers/equites.cpp2
-rw-r--r--src/mame/drivers/esd16.cpp33
-rw-r--r--src/mame/drivers/fccpu20.cpp6
-rw-r--r--src/mame/drivers/firetrk.cpp4
-rw-r--r--src/mame/drivers/galgames.cpp1161
-rw-r--r--src/mame/drivers/gcpinbal.cpp178
-rw-r--r--src/mame/drivers/gts80b.cpp19
-rw-r--r--src/mame/drivers/h19.cpp87
-rw-r--r--src/mame/drivers/h89.cpp78
-rw-r--r--src/mame/drivers/hng64.cpp10
-rw-r--r--src/mame/drivers/igs011.cpp56
-rw-r--r--src/mame/drivers/intv.cpp17
-rw-r--r--src/mame/drivers/lastbank.cpp277
-rw-r--r--src/mame/drivers/lwriter.cpp196
-rw-r--r--src/mame/drivers/marineb.cpp17
-rw-r--r--src/mame/drivers/metro.cpp65
-rw-r--r--src/mame/drivers/missile.cpp210
-rw-r--r--src/mame/drivers/osborne1.cpp97
-rw-r--r--src/mame/drivers/polepos.cpp110
-rw-r--r--src/mame/drivers/pong.cpp14
-rw-r--r--src/mame/drivers/route16.cpp36
-rw-r--r--src/mame/drivers/segac2.cpp17
-rw-r--r--src/mame/drivers/shanghai.cpp51
-rw-r--r--src/mame/drivers/starwars.cpp2
-rw-r--r--src/mame/drivers/stv.cpp21
-rw-r--r--src/mame/drivers/taito_l.cpp22
-rw-r--r--src/mame/drivers/tempest.cpp2
-rw-r--r--src/mame/drivers/testconsole.cpp206
-rw-r--r--src/mame/drivers/tmaster.cpp967
-rw-r--r--src/mame/drivers/williams.cpp19
-rw-r--r--src/mame/drivers/witch.cpp10
-rw-r--r--src/mame/drivers/zx.cpp24
-rw-r--r--src/mame/includes/aerofgt.h7
-rw-r--r--src/mame/includes/apple2.h1
-rw-r--r--src/mame/includes/banctec.h36
-rw-r--r--src/mame/includes/battlex.h3
-rw-r--r--src/mame/includes/coco.h2
-rw-r--r--src/mame/includes/decocass.h1
-rw-r--r--src/mame/includes/gcpinbal.h22
-rw-r--r--src/mame/includes/hng64.h1
-rw-r--r--src/mame/includes/intv.h17
-rw-r--r--src/mame/includes/metro.h2
-rw-r--r--src/mame/includes/osborne1.h69
-rw-r--r--src/mame/includes/polepos.h2
-rw-r--r--src/mame/includes/zx.h1
-rw-r--r--src/mame/layout/polepos.lay4
-rw-r--r--src/mame/layout/whousetc.lay801
-rw-r--r--src/mame/machine/apple2.cpp171
-rw-r--r--src/mame/machine/decocass.cpp33
-rw-r--r--src/mame/machine/egret.cpp2
-rw-r--r--src/mame/machine/intv.cpp656
-rw-r--r--src/mame/machine/ms7004.cpp16
-rw-r--r--src/mame/machine/osborne1.cpp27
-rw-r--r--src/mame/mame.lst25
-rw-r--r--src/mame/mess.flt1
-rw-r--r--src/mame/video/battlex.cpp13
-rw-r--r--src/mame/video/gcpinbal.cpp19
-rw-r--r--src/mame/video/intv.cpp101
-rw-r--r--src/mame/video/n64.cpp1239
-rw-r--r--src/mame/video/n64.h87
-rw-r--r--src/mame/video/pin64.cpp506
-rw-r--r--src/mame/video/pin64.h180
-rw-r--r--src/mame/video/stic.cpp2
222 files changed, 14616 insertions, 4509 deletions
diff --git a/src/devices/bus/a2bus/a2alfam2.cpp b/src/devices/bus/a2bus/a2alfam2.cpp
index 0bee8380532..d4decaeae92 100644
--- a/src/devices/bus/a2bus/a2alfam2.cpp
+++ b/src/devices/bus/a2bus/a2alfam2.cpp
@@ -10,7 +10,6 @@
*********************************************************************/
#include "a2alfam2.h"
-#include "includes/apple2.h"
#include "sound/sn76496.h"
/***************************************************************************
diff --git a/src/devices/bus/a2bus/a2applicard.cpp b/src/devices/bus/a2bus/a2applicard.cpp
index 1e4f71e3e33..9fe268dbabd 100644
--- a/src/devices/bus/a2bus/a2applicard.cpp
+++ b/src/devices/bus/a2bus/a2applicard.cpp
@@ -12,7 +12,6 @@
*********************************************************************/
#include "a2applicard.h"
-#include "includes/apple2.h"
#include "cpu/z80/z80.h"
#include "machine/z80ctc.h"
diff --git a/src/devices/bus/a2bus/a2cffa.cpp b/src/devices/bus/a2bus/a2cffa.cpp
index e046b2e120e..79420fff9d3 100644
--- a/src/devices/bus/a2bus/a2cffa.cpp
+++ b/src/devices/bus/a2bus/a2cffa.cpp
@@ -12,7 +12,6 @@
*********************************************************************/
#include "a2cffa.h"
-#include "includes/apple2.h"
#include "machine/ataintf.h"
#include "imagedev/harddriv.h"
#include "softlist.h"
diff --git a/src/devices/bus/a2bus/a2corvus.cpp b/src/devices/bus/a2bus/a2corvus.cpp
index 9ee553b17d8..32d86cdc091 100644
--- a/src/devices/bus/a2bus/a2corvus.cpp
+++ b/src/devices/bus/a2bus/a2corvus.cpp
@@ -41,7 +41,6 @@
*********************************************************************/
#include "a2corvus.h"
-#include "includes/apple2.h"
#include "imagedev/harddriv.h"
/***************************************************************************
diff --git a/src/devices/bus/a2bus/a2diskii.cpp b/src/devices/bus/a2bus/a2diskii.cpp
index 50243e2f596..fa89dfc228e 100644
--- a/src/devices/bus/a2bus/a2diskii.cpp
+++ b/src/devices/bus/a2bus/a2diskii.cpp
@@ -9,7 +9,6 @@
*********************************************************************/
#include "emu.h"
-#include "includes/apple2.h"
#include "imagedev/flopdrv.h"
#include "formats/ap2_dsk.h"
#include "machine/appldriv.h"
diff --git a/src/devices/bus/a2bus/a2dx1.cpp b/src/devices/bus/a2bus/a2dx1.cpp
index 158403ee10c..71eee7cea0b 100644
--- a/src/devices/bus/a2bus/a2dx1.cpp
+++ b/src/devices/bus/a2bus/a2dx1.cpp
@@ -8,7 +8,6 @@
*********************************************************************/
-#include "includes/apple2.h"
#include "a2dx1.h"
#include "sound/volt_reg.h"
diff --git a/src/devices/bus/a2bus/a2echoii.cpp b/src/devices/bus/a2bus/a2echoii.cpp
index ee8e318da31..b309e265a07 100644
--- a/src/devices/bus/a2bus/a2echoii.cpp
+++ b/src/devices/bus/a2bus/a2echoii.cpp
@@ -9,7 +9,6 @@
*********************************************************************/
#include "a2echoii.h"
-#include "includes/apple2.h"
#include "sound/tms5220.h"
/***************************************************************************
diff --git a/src/devices/bus/a2bus/a2eext80col.cpp b/src/devices/bus/a2bus/a2eext80col.cpp
index 1d2f6ae4e74..bd975354314 100644
--- a/src/devices/bus/a2bus/a2eext80col.cpp
+++ b/src/devices/bus/a2bus/a2eext80col.cpp
@@ -9,7 +9,6 @@
*********************************************************************/
#include "emu.h"
-#include "includes/apple2.h"
#include "a2eext80col.h"
diff --git a/src/devices/bus/a2bus/a2eramworks3.cpp b/src/devices/bus/a2bus/a2eramworks3.cpp
index c0a0e2c016d..e832bb53123 100644
--- a/src/devices/bus/a2bus/a2eramworks3.cpp
+++ b/src/devices/bus/a2bus/a2eramworks3.cpp
@@ -10,7 +10,6 @@
*********************************************************************/
#include "emu.h"
-#include "includes/apple2.h"
#include "a2eramworks3.h"
diff --git a/src/devices/bus/a2bus/a2estd80col.cpp b/src/devices/bus/a2bus/a2estd80col.cpp
index c6982aafa83..28a669ffd20 100644
--- a/src/devices/bus/a2bus/a2estd80col.cpp
+++ b/src/devices/bus/a2bus/a2estd80col.cpp
@@ -9,7 +9,6 @@
*********************************************************************/
#include "emu.h"
-#include "includes/apple2.h"
#include "a2estd80col.h"
diff --git a/src/devices/bus/a2bus/a2hsscsi.cpp b/src/devices/bus/a2bus/a2hsscsi.cpp
index e8e5f4b98e4..eb36d7cb8cb 100644
--- a/src/devices/bus/a2bus/a2hsscsi.cpp
+++ b/src/devices/bus/a2bus/a2hsscsi.cpp
@@ -39,7 +39,6 @@
*********************************************************************/
#include "a2hsscsi.h"
-#include "includes/apple2.h"
#include "machine/nscsi_cd.h"
#include "machine/nscsi_hd.h"
diff --git a/src/devices/bus/a2bus/a2lang.cpp b/src/devices/bus/a2bus/a2lang.cpp
deleted file mode 100644
index 3c156fd4c90..00000000000
--- a/src/devices/bus/a2bus/a2lang.cpp
+++ /dev/null
@@ -1,145 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:R. Belmont
-/*********************************************************************
-
- a2lang.c
-
- Implementation of the Apple II Language Card
-
- TODO: refactor machine/apple2.c so it's possible to have an Apple II
- and II Plus without a language card (and to emulate other
- slot 0 stuff like hack/freezer cards).
-
-*********************************************************************/
-
-#include "emu.h"
-#include "includes/apple2.h"
-#include "a2lang.h"
-
-
-/***************************************************************************
- PARAMETERS
-***************************************************************************/
-
-#define LOG_LANGCARD 0
-
-//**************************************************************************
-// GLOBAL VARIABLES
-//**************************************************************************
-
-const device_type A2BUS_LANG = &device_creator<a2bus_lang_device>;
-
-
-//**************************************************************************
-// LIVE DEVICE
-//**************************************************************************
-
-a2bus_lang_device::a2bus_lang_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, A2BUS_LANG, "Apple II Language Card", tag, owner, clock, "a2lang", __FILE__),
- device_a2bus_card_interface(mconfig, *this)
-{
- last_offset = -1;
-}
-
-a2bus_lang_device::a2bus_lang_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source) :
- device_t(mconfig, type, name, tag, owner, clock, shortname, source),
- device_a2bus_card_interface(mconfig, *this)
-{
- last_offset = -1;
-}
-
-//-------------------------------------------------
-// device_start - device-specific startup
-//-------------------------------------------------
-
-void a2bus_lang_device::device_start()
-{
- // set_a2bus_device makes m_slot valid
- set_a2bus_device();
-
- save_item(NAME(last_offset));
-}
-
-void a2bus_lang_device::device_reset()
-{
-}
-
-/*-------------------------------------------------
- apple2_langcard_touch - device read callback
--------------------------------------------------*/
-
-void a2bus_lang_device::langcard_touch(offs_t offset)
-{
- uint32_t val, mask;
-
- if (LOG_LANGCARD)
- logerror("language card bankswitch read, offset: $c08%0x\n", offset);
-
- /* determine which flags to change */
- mask = VAR_LCWRITE | VAR_LCRAM | VAR_LCRAM2;
- val = 0;
-
- if (offset & 0x01)
- val |= VAR_LCWRITE;
-
- switch(offset & 0x03)
- {
- case 0x03:
- case 0x00:
- val |= VAR_LCRAM;
- break;
- }
-
- if ((offset & 0x08) == 0)
- val |= VAR_LCRAM2;
-
- /* change the flags */
- apple2_state *state = machine().driver_data<apple2_state>();
- state->apple2_setvar(val, mask);
-}
-
-
-
-/*-------------------------------------------------
- read_c0nx - called for reads from this card's c0nx space
--------------------------------------------------*/
-
-uint8_t a2bus_lang_device::read_c0nx(address_space &space, uint8_t offset)
-{
- apple2_state *state = machine().driver_data<apple2_state>();
-
- // enforce "read twice" for c081/3/9/B
- // but only on the II/II+ with a discrete language card.
- // later machines' ASICs dropped the double-read requirement,
- // likely to be interrupt-safe.
- if (state->m_machinetype == APPLE_II)
- {
- switch (offset & 0x03)
- {
- case 1:
- case 3:
- if (offset != last_offset)
- {
- last_offset = offset;
- return 0;
- }
- break;
- }
- }
-
- langcard_touch(offset);
- last_offset = offset;
- return 0;
-}
-
-
-
-/*-------------------------------------------------
- write_c0nx - called for writes to this card's c0nx space
--------------------------------------------------*/
-
-void a2bus_lang_device::write_c0nx(address_space &space, uint8_t offset, uint8_t data)
-{
- langcard_touch(offset);
- last_offset = -1;
-}
diff --git a/src/devices/bus/a2bus/a2lang.h b/src/devices/bus/a2bus/a2lang.h
deleted file mode 100644
index 4d4bdc4aa81..00000000000
--- a/src/devices/bus/a2bus/a2lang.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:R. Belmont
-/*********************************************************************
-
- a2lang.h
-
- Apple II Language Card
-
-*********************************************************************/
-
-#ifndef __A2BUS_LANG__
-#define __A2BUS_LANG__
-
-#include "emu.h"
-#include "a2bus.h"
-
-//**************************************************************************
-// TYPE DEFINITIONS
-//**************************************************************************
-
-class a2bus_lang_device:
- public device_t,
- public device_a2bus_card_interface
-{
-public:
- // construction/destruction
- a2bus_lang_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- a2bus_lang_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source);
-
-protected:
- virtual void device_start() override;
- virtual void device_reset() override;
-
- virtual uint8_t read_c0nx(address_space &space, uint8_t offset) override;
- virtual void write_c0nx(address_space &space, uint8_t offset, uint8_t data) override;
-
-private:
- void langcard_touch(offs_t offset);
-
- int last_offset;
-};
-
-// device type definition
-extern const device_type A2BUS_LANG;
-
-#endif /* __A2BUS_LANG__ */
diff --git a/src/devices/bus/a2bus/a2mcms.cpp b/src/devices/bus/a2bus/a2mcms.cpp
index 57abe911fd0..38b8ce36fa8 100644
--- a/src/devices/bus/a2bus/a2mcms.cpp
+++ b/src/devices/bus/a2bus/a2mcms.cpp
@@ -11,7 +11,6 @@
*********************************************************************/
#include "a2mcms.h"
-#include "includes/apple2.h"
// the actual sound device (a slot device can't currently also be a sound device so we keep this private here)
enum
diff --git a/src/devices/bus/a2bus/a2memexp.cpp b/src/devices/bus/a2bus/a2memexp.cpp
index f34b71e435d..be1d28cd1bc 100644
--- a/src/devices/bus/a2bus/a2memexp.cpp
+++ b/src/devices/bus/a2bus/a2memexp.cpp
@@ -9,7 +9,6 @@
*********************************************************************/
#include "a2memexp.h"
-#include "includes/apple2.h"
/***************************************************************************
diff --git a/src/devices/bus/a2bus/a2sam.cpp b/src/devices/bus/a2bus/a2sam.cpp
index e8b6f811754..3abc1820061 100644
--- a/src/devices/bus/a2bus/a2sam.cpp
+++ b/src/devices/bus/a2bus/a2sam.cpp
@@ -8,7 +8,6 @@
*********************************************************************/
-#include "includes/apple2.h"
#include "a2sam.h"
#include "sound/volt_reg.h"
diff --git a/src/devices/bus/a2bus/a2scsi.cpp b/src/devices/bus/a2bus/a2scsi.cpp
index f1da850482d..3dba10aa849 100644
--- a/src/devices/bus/a2bus/a2scsi.cpp
+++ b/src/devices/bus/a2bus/a2scsi.cpp
@@ -32,7 +32,6 @@
*********************************************************************/
#include "a2scsi.h"
-#include "includes/apple2.h"
#include "machine/nscsi_cd.h"
#include "machine/nscsi_hd.h"
diff --git a/src/devices/bus/a2bus/a2softcard.cpp b/src/devices/bus/a2bus/a2softcard.cpp
index df509e7e079..8ffb9ba88da 100644
--- a/src/devices/bus/a2bus/a2softcard.cpp
+++ b/src/devices/bus/a2bus/a2softcard.cpp
@@ -9,7 +9,6 @@
*********************************************************************/
#include "a2softcard.h"
-#include "includes/apple2.h"
#include "cpu/z80/z80.h"
/***************************************************************************
diff --git a/src/devices/bus/a2bus/a2swyft.cpp b/src/devices/bus/a2bus/a2swyft.cpp
index 975974b849b..ec6ef5af5f7 100644
--- a/src/devices/bus/a2bus/a2swyft.cpp
+++ b/src/devices/bus/a2bus/a2swyft.cpp
@@ -9,7 +9,6 @@
*********************************************************************/
#include "emu.h"
-#include "includes/apple2.h"
#include "a2swyft.h"
diff --git a/src/devices/bus/a2bus/a2themill.cpp b/src/devices/bus/a2bus/a2themill.cpp
index 71aed47ace9..ecabb3e085f 100644
--- a/src/devices/bus/a2bus/a2themill.cpp
+++ b/src/devices/bus/a2bus/a2themill.cpp
@@ -23,7 +23,6 @@
*********************************************************************/
#include "a2themill.h"
-#include "includes/apple2.h"
#include "cpu/m6809/m6809.h"
/***************************************************************************
diff --git a/src/devices/bus/a2bus/a2ultraterm.cpp b/src/devices/bus/a2bus/a2ultraterm.cpp
index 5526515ab1d..82a56021e02 100644
--- a/src/devices/bus/a2bus/a2ultraterm.cpp
+++ b/src/devices/bus/a2bus/a2ultraterm.cpp
@@ -28,7 +28,6 @@
*********************************************************************/
#include "a2ultraterm.h"
-#include "includes/apple2.h"
/***************************************************************************
diff --git a/src/devices/bus/a2bus/a2videoterm.cpp b/src/devices/bus/a2bus/a2videoterm.cpp
index 53eb6d5d20a..03f1ba1f2f4 100644
--- a/src/devices/bus/a2bus/a2videoterm.cpp
+++ b/src/devices/bus/a2bus/a2videoterm.cpp
@@ -24,7 +24,6 @@
*********************************************************************/
#include "a2videoterm.h"
-#include "includes/apple2.h"
/***************************************************************************
diff --git a/src/devices/bus/a2bus/a2vulcan.cpp b/src/devices/bus/a2bus/a2vulcan.cpp
index 216ccc7d043..6cb28536d94 100644
--- a/src/devices/bus/a2bus/a2vulcan.cpp
+++ b/src/devices/bus/a2bus/a2vulcan.cpp
@@ -54,7 +54,6 @@
*********************************************************************/
#include "a2vulcan.h"
-#include "includes/apple2.h"
#include "machine/ataintf.h"
#include "imagedev/harddriv.h"
diff --git a/src/devices/bus/a2bus/a2zipdrive.cpp b/src/devices/bus/a2bus/a2zipdrive.cpp
index 369aec79a4d..0e57cf691c1 100644
--- a/src/devices/bus/a2bus/a2zipdrive.cpp
+++ b/src/devices/bus/a2bus/a2zipdrive.cpp
@@ -20,7 +20,6 @@
*********************************************************************/
#include "a2zipdrive.h"
-#include "includes/apple2.h"
#include "machine/ataintf.h"
#include "imagedev/harddriv.h"
diff --git a/src/devices/bus/a2bus/laser128.cpp b/src/devices/bus/a2bus/laser128.cpp
index 3ba434abfa4..c7dae25191d 100644
--- a/src/devices/bus/a2bus/laser128.cpp
+++ b/src/devices/bus/a2bus/laser128.cpp
@@ -9,7 +9,6 @@
*********************************************************************/
#include "laser128.h"
-#include "includes/apple2.h"
/***************************************************************************
PARAMETERS
diff --git a/src/devices/bus/amiga/keyboard/a1200.cpp b/src/devices/bus/amiga/keyboard/a1200.cpp
index d99e2570f72..c9588ca0a8a 100644
--- a/src/devices/bus/amiga/keyboard/a1200.cpp
+++ b/src/devices/bus/amiga/keyboard/a1200.cpp
@@ -1,111 +1,170 @@
-// license: GPL-2.0+
-// copyright-holders: Dirk Best
+// license:BSD-3-Clause
+// copyright-holders:Vas Crabb
/***************************************************************************
- Amiga 1200 Keyboard
-
- Skeleton device, needs MC68HC05Cx device support
+ Amiga 1200 Keyboard
391508-01 = Rev 0 is MC68HC05C4AFN
391508-02 = Rev 1 is MC68HC05C12FN
***************************************************************************/
+#include "emu.h"
#include "a1200.h"
+#include "matrix.h"
+
+#include "cpu/m6805/m68hc05.h"
+
+//#define VERBOSE 1
+#include "logmacro.h"
//**************************************************************************
-// DEVICE DEFINITIONS
+// GLOBAL VARIABLES
//**************************************************************************
-const device_type A1200_KBD = &device_creator<a1200_kbd_device>;
+device_type const A1200_KBD = &device_creator<bus::amiga::keyboard::a1200_kbd_device>;
-//-------------------------------------------------
-// machine_config_additions - device-specific
-// machine configurations
-//-------------------------------------------------
-static ADDRESS_MAP_START( mc68hc05c12_map, AS_PROGRAM, 8, a1200_kbd_device )
- ADDRESS_MAP_GLOBAL_MASK(0x1fff)
- ADDRESS_MAP_UNMAP_HIGH
- AM_RANGE(0x0000, 0x1fff) AM_ROM AM_REGION("mpu", 0)
-ADDRESS_MAP_END
-static MACHINE_CONFIG_FRAGMENT( a1200kbd_rev1 )
- // should be MC68HC05C12
- MCFG_CPU_ADD("mpu", M6805, XTAL_3MHz)
- MCFG_CPU_PROGRAM_MAP(mc68hc05c12_map)
-MACHINE_CONFIG_END
+namespace bus { namespace amiga { namespace keyboard {
-machine_config_constructor a1200_kbd_device::device_mconfig_additions() const
-{
- return MACHINE_CONFIG_NAME( a1200kbd_rev1 );
-}
+namespace {
+
+INPUT_PORTS_START(a1200_mod)
+ PORT_START("MOD")
+ PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LWIN) PORT_CHAR(UCHAR_MAMEKEY(LWIN)) PORT_NAME("Left Amiga")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) PORT_NAME("Left Alt")
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_NAME("Left Shift")
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) PORT_NAME("Ctrl")
+ PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RWIN) PORT_CHAR(UCHAR_MAMEKEY(RWIN)) PORT_NAME("Right Amiga")
+ PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_SHIFT_2) PORT_NAME("Right Alt")
+ PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) PORT_NAME("Right Shift")
+INPUT_PORTS_END
+
+INPUT_PORTS_START(a1200_us_keyboard)
+ PORT_INCLUDE(matrix_us)
+ PORT_INCLUDE(a1200_mod)
+INPUT_PORTS_END
+
+
+MACHINE_CONFIG_FRAGMENT(a1200kbd_revB)
+ MCFG_CPU_ADD("mpu", M68HC705C8A, XTAL_3MHz)
+ MCFG_M68HC05_PORTB_R_CB(READ8(a1200_kbd_device, mpu_portb_r));
+ MCFG_M68HC05_PORTD_R_CB(IOPORT("MOD"));
+ MCFG_M68HC05_PORTA_W_CB(WRITE8(a1200_kbd_device, mpu_porta_w));
+ MCFG_M68HC05_PORTB_W_CB(WRITE8(a1200_kbd_device, mpu_portb_w));
+ MCFG_M68HC05_PORTC_W_CB(WRITE8(a1200_kbd_device, mpu_portc_w));
+ MCFG_M68HC05_TCMP_CB(WRITELINE(a1200_kbd_device, mpu_tcmp));
+MACHINE_CONFIG_END
-//-------------------------------------------------
-// rom_region - device-specific ROM region
-//-------------------------------------------------
-ROM_START( a1200kbd_rev1 )
+ROM_START(a1200kbd_revB)
ROM_REGION(0x2000, "mpu", 0)
- // should be 0x3000, i assume it was hacked to allow it to be written to a 68hc705c8
- // it was labeled "rev b", so it's probably the rev 1 (a rev 0 is in our queue to be decapped)
- ROM_LOAD("391508-02.bin", 0x0000, 0x2000, BAD_DUMP CRC(2a77eec4) SHA1(301ec6a69404457d912c89e3fc54095eda9f0e93))
+ ROM_LOAD("DFA_Rev_B_A1200_HC705.bin", 0x0000, 0x2000, CRC(2a77eec4) SHA1(301ec6a69404457d912c89e3fc54095eda9f0e93))
ROM_END
-const tiny_rom_entry *a1200_kbd_device::device_rom_region() const
-{
- return ROM_NAME( a1200kbd_rev1 );
-}
+} // anonymous namespace
-//-------------------------------------------------
-// input_ports - device-specific input ports
-//-------------------------------------------------
-static INPUT_PORTS_START( a1200_us_keyboard )
-INPUT_PORTS_END
-ioport_constructor a1200_kbd_device::device_input_ports() const
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+a1200_kbd_device::a1200_kbd_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock)
+ : device_t(mconfig, A1200_KBD, "Amiga 1200 Keyboard Rev B", tag, owner, clock, "a1200kbd_rb", __FILE__)
+ , device_amiga_keyboard_interface(mconfig, *this)
+ , m_rows(*this, "ROW%u", 0)
+ , m_mpu(*this, "mpu")
+ , m_row_drive(0xffff)
+ , m_host_kdat(true)
+ , m_mpu_kdat(true)
{
- return INPUT_PORTS_NAME( a1200_us_keyboard );
}
+WRITE_LINE_MEMBER(a1200_kbd_device::kdat_w)
+{
+ if (bool(state) != m_host_kdat)
+ {
+ LOG("host DATA %u -> %u\n", m_host_kdat ? 1 : 0, state ? 1 : 0);
+ m_host_kdat = bool(state);
+ if (m_mpu_kdat)
+ m_mpu->set_input_line(M68HC05_TCAP_LINE, m_host_kdat ? 1 : 0);
+ }
+}
-//**************************************************************************
-// LIVE DEVICE
-//**************************************************************************
+READ8_MEMBER(a1200_kbd_device::mpu_portb_r)
+{
+ u8 result(m_host_kdat ? 0xff : 0xfe);
+ for (unsigned row = 0; m_rows.size() > row; ++row)
+ {
+ if (!BIT(m_row_drive, row))
+ result &= m_rows[row]->read();
+ }
+ return result;
+}
-//-------------------------------------------------
-// a1200_kbd_device - constructor
-//-------------------------------------------------
+WRITE8_MEMBER(a1200_kbd_device::mpu_porta_w)
+{
+ m_row_drive = (m_row_drive & 0xff00) | u16(u8(data | ~mem_mask));
+}
-a1200_kbd_device::a1200_kbd_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, A1200_KBD, "Amiga 1200 Keyboard Rev 1", tag, owner, clock, "a1200kbd_r1", __FILE__),
- device_amiga_keyboard_interface(mconfig, *this),
- m_mpu(*this, "mpu")
-{}
+WRITE8_MEMBER(a1200_kbd_device::mpu_portb_w)
+{
+ u8 const kdat(BIT(data, 0) | BIT(~mem_mask, 0));
+ m_host->kdat_w(kdat ? 1 : 0);
+ m_host->kclk_w(BIT(data, 1));
+
+ if (bool(kdat) != m_mpu_kdat)
+ {
+ LOG("keyboard DATA %u -> %u\n", m_mpu_kdat ? 1 : 0, kdat);
+ m_mpu_kdat = bool(kdat);
+ if (m_host_kdat)
+ m_mpu->set_input_line(M68HC05_TCAP_LINE, kdat);
+ }
+}
-//-------------------------------------------------
-// device_start - device-specific startup
-//-------------------------------------------------
+WRITE8_MEMBER(a1200_kbd_device::mpu_portc_w)
+{
+ m_row_drive = (m_row_drive & 0x80ff) | (u16(u8(data | ~mem_mask) & 0x7f) << 8);
+ machine().output().set_value("led_kbd_caps", BIT(~data, 7));
+}
-void a1200_kbd_device::device_start()
+WRITE_LINE_MEMBER(a1200_kbd_device::mpu_tcmp)
+{
+ m_host->krst_w(state);
+}
+
+machine_config_constructor a1200_kbd_device::device_mconfig_additions() const
{
+ return MACHINE_CONFIG_NAME(a1200kbd_revB);
}
-//-------------------------------------------------
-// device_reset - device-specific reset
-//-------------------------------------------------
+const tiny_rom_entry *a1200_kbd_device::device_rom_region() const
+{
+ return ROM_NAME(a1200kbd_revB);
+}
-void a1200_kbd_device::device_reset()
+ioport_constructor a1200_kbd_device::device_input_ports() const
{
+ return INPUT_PORTS_NAME(a1200_us_keyboard);
}
+void a1200_kbd_device::device_start()
+{
+ save_item(NAME(m_row_drive));
+ save_item(NAME(m_host_kdat));
+ save_item(NAME(m_mpu_kdat));
-//**************************************************************************
-// INTERFACE
-//**************************************************************************
+ m_row_drive = 0xffff;
+ m_host_kdat = true;
+ m_mpu_kdat = true;
+}
-WRITE_LINE_MEMBER( a1200_kbd_device::kdat_w )
+void a1200_kbd_device::device_reset()
{
}
+
+} } } // namespace bus::amiga::keyboard
diff --git a/src/devices/bus/amiga/keyboard/a1200.h b/src/devices/bus/amiga/keyboard/a1200.h
index f2159c26fdc..f29689b18e3 100644
--- a/src/devices/bus/amiga/keyboard/a1200.h
+++ b/src/devices/bus/amiga/keyboard/a1200.h
@@ -1,25 +1,30 @@
-// license: GPL-2.0+
-// copyright-holders: Dirk Best
+// license:BSD-3-Clause
+// copyright-holders: Vas Crabb
/***************************************************************************
- Amiga 1200 Keyboard
+ Amiga 1200 Keyboard
- Skeleton device, needs MC68HC05Cx device support
-
-***************************************************************************/
+ ***************************************************************************/
#ifndef DEVICES_BUS_AMIGA_KEYBOARD_A1200_H
#define DEVICES_BUS_AMIGA_KEYBOARD_A1200_H
#pragma once
-#include "emu.h"
#include "keyboard.h"
-#include "cpu/m6805/m6805.h"
//**************************************************************************
-// TYPE DEFINITIONS
+// GLOBAL VARIABLES
+//**************************************************************************
+
+extern device_type const A1200_KBD;
+
+
+namespace bus { namespace amiga { namespace keyboard {
+
+//**************************************************************************
+// TYPE DECLARATIONS
//**************************************************************************
// ======================> a1200_kbd_device
@@ -28,24 +33,34 @@ class a1200_kbd_device : public device_t, public device_amiga_keyboard_interface
{
public:
// construction/destruction
- a1200_kbd_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ a1200_kbd_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock);
// from host
virtual DECLARE_WRITE_LINE_MEMBER(kdat_w) override;
+ // MPU I/O
+ DECLARE_READ8_MEMBER(mpu_portb_r);
+ DECLARE_WRITE8_MEMBER(mpu_porta_w);
+ DECLARE_WRITE8_MEMBER(mpu_portb_w);
+ DECLARE_WRITE8_MEMBER(mpu_portc_w);
+ DECLARE_WRITE_LINE_MEMBER(mpu_tcmp);
+
protected:
- // device-level overrides
virtual const tiny_rom_entry *device_rom_region() const override;
virtual machine_config_constructor device_mconfig_additions() const override;
virtual ioport_constructor device_input_ports() const override;
+
virtual void device_start() override;
virtual void device_reset() override;
private:
- required_device<m6805_device> m_mpu;
+ required_ioport_array<15> m_rows;
+ required_device<cpu_device> m_mpu;
+
+ u16 m_row_drive;
+ bool m_host_kdat, m_mpu_kdat;
};
-// device type definition
-extern const device_type A1200_KBD;
+} } } // namespace bus::amiga::keyboard
#endif // DEVICES_BUS_AMIGA_KEYBOARD_A1200_H
diff --git a/src/devices/bus/amiga/keyboard/a500.cpp b/src/devices/bus/amiga/keyboard/a500.cpp
index dce046099c4..266728e6b5e 100644
--- a/src/devices/bus/amiga/keyboard/a500.cpp
+++ b/src/devices/bus/amiga/keyboard/a500.cpp
@@ -4,14 +4,15 @@
Amiga 500 Keyboard
- TODO: - Natural keyboard mode doesn't work with shifted characters,
- they get sent in the wrong order (core bug?)
- - Move 6500/1 to its own CPU core so that it can be shared with
+ TODO: - Move 6500/1 to its own CPU core so that it can be shared with
other systems
***************************************************************************/
+#include "emu.h"
#include "a500.h"
+#include "matrix.h"
+
#include "machine/rescap.h"
@@ -19,15 +20,28 @@
// DEVICE DEFINITIONS
//**************************************************************************
-const device_type A500_KBD_US = &device_creator<a500_kbd_us_device>;
-const device_type A500_KBD_DE = &device_creator<a500_kbd_de_device>;
+const device_type A500_KBD_US = &device_creator<bus::amiga::keyboard::a500_kbd_us_device>;
+const device_type A500_KBD_DE = &device_creator<bus::amiga::keyboard::a500_kbd_de_device>;
+const device_type A500_KBD_FR = &device_creator<bus::amiga::keyboard::a500_kbd_fr_device>;
+const device_type A500_KBD_IT = &device_creator<bus::amiga::keyboard::a500_kbd_it_device>;
+const device_type A500_KBD_SE = &device_creator<bus::amiga::keyboard::a500_kbd_se_device>;
+const device_type A500_KBD_ES = &device_creator<bus::amiga::keyboard::a500_kbd_es_device>;
+const device_type A500_KBD_DK = &device_creator<bus::amiga::keyboard::a500_kbd_dk_device>;
+const device_type A500_KBD_CH = &device_creator<bus::amiga::keyboard::a500_kbd_ch_device>;
+const device_type A500_KBD_NO = &device_creator<bus::amiga::keyboard::a500_kbd_no_device>;
+const device_type A500_KBD_GB = &device_creator<bus::amiga::keyboard::a500_kbd_gb_device>;
+
+
+namespace bus { namespace amiga { namespace keyboard {
+
+namespace {
//-------------------------------------------------
// machine_config_additions - device-specific
// machine configurations
//-------------------------------------------------
-static ADDRESS_MAP_START( mpu6500_map, AS_PROGRAM, 8, a500_kbd_us_device )
+ADDRESS_MAP_START( mpu6500_map, AS_PROGRAM, 8, a500_kbd_device )
ADDRESS_MAP_GLOBAL_MASK(0xfff)
AM_RANGE(0x000, 0x03f) AM_RAM
AM_RANGE(0x080, 0x080) AM_READWRITE(port_a_r, port_a_w)
@@ -44,16 +58,11 @@ static ADDRESS_MAP_START( mpu6500_map, AS_PROGRAM, 8, a500_kbd_us_device )
AM_RANGE(0x800, 0xfff) AM_ROM AM_REGION("ic1", 0)
ADDRESS_MAP_END
-static MACHINE_CONFIG_FRAGMENT( kbd_pcb )
+MACHINE_CONFIG_FRAGMENT( kbd_pcb )
MCFG_CPU_ADD("ic1", M6502, XTAL_3MHz / 2)
MCFG_CPU_PROGRAM_MAP(mpu6500_map)
MACHINE_CONFIG_END
-machine_config_constructor a500_kbd_us_device::device_mconfig_additions() const
-{
- return MACHINE_CONFIG_NAME(kbd_pcb);
-}
-
//-------------------------------------------------
// rom_region - device-specific ROM region
//-------------------------------------------------
@@ -63,410 +72,186 @@ ROM_START( kbd_pcb )
ROM_LOAD("328191-02.ic1", 0x000, 0x800, CRC(4a3fc332) SHA1(83b21d0c8b93fc9b9b3b287fde4ec8f3badac5a2))
ROM_END
-const tiny_rom_entry *a500_kbd_us_device::device_rom_region() const
-{
- return ROM_NAME(kbd_pcb);
-}
-
//-------------------------------------------------
// input_ports - device-specific input ports
//-------------------------------------------------
-static INPUT_PORTS_START( a500_us_keyboard )
+INPUT_PORTS_START( a500_special )
PORT_START("special")
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LWIN) PORT_CHAR(UCHAR_MAMEKEY(LWIN)) PORT_NAME("Left Amiga") PORT_CHANGED_MEMBER(DEVICE_SELF, a500_kbd_us_device, check_reset, nullptr)
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT))
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) PORT_NAME("Ctrl") PORT_CHANGED_MEMBER(DEVICE_SELF, a500_kbd_us_device, check_reset, nullptr)
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RWIN) PORT_CHAR(UCHAR_MAMEKEY(RWIN)) PORT_NAME("Right Amiga") PORT_CHANGED_MEMBER(DEVICE_SELF, a500_kbd_us_device, check_reset, nullptr)
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT))
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
-
- PORT_START("row_d6")
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK))
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) PORT_NAME("Caps Lock")
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR(9)
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~')
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC))
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
-
- PORT_START("row_d5")
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD))
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z')
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A')
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q')
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!')
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR('(')
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
-
- PORT_START("row_d4")
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD))
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X')
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S')
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W')
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@')
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1))
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
-
- PORT_START("row_d3")
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD))
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C')
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D')
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E')
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#')
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2))
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
-
- PORT_START("row_d2")
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD))
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V')
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F')
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R')
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$')
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3))
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
-
- PORT_START("row_d1")
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD))
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B')
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G')
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T')
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%')
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4))
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
-
- PORT_START("row_d0")
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD))
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N')
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H')
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y')
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^')
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5))
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
-
- PORT_START("row_c7")
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD))
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M')
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J')
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U')
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&')
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PGUP) PORT_CHAR(')')
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
-
- PORT_START("row_c6")
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD))
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<')
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K')
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I')
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*')
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6))
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
-
- PORT_START("row_c5")
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD))
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>')
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L')
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O')
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(')
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR('/')
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
-
- PORT_START("row_c4")
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD))
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?')
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':')
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P')
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')')
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7))
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
-
- PORT_START("row_c3")
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD))
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"')
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{')
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_')
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8))
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
-
- PORT_START("row_c2")
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD))
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED)
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}')
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+')
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9))
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
-
- PORT_START("row_c1")
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD))
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL))
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|')
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10))
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
-
- PORT_START("row_c0")
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD))
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN))
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP))
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F11) PORT_NAME("Help")
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LWIN) PORT_CHAR(UCHAR_MAMEKEY(LWIN)) PORT_NAME("Left Amiga") PORT_CHANGED_MEMBER(DEVICE_SELF, a500_kbd_device, check_reset, nullptr)
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) PORT_NAME("Left Alt")
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_NAME("Left Shift")
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) PORT_NAME("Ctrl") PORT_CHANGED_MEMBER(DEVICE_SELF, a500_kbd_device, check_reset, nullptr)
+ PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RWIN) PORT_CHAR(UCHAR_MAMEKEY(RWIN)) PORT_NAME("Right Amiga") PORT_CHANGED_MEMBER(DEVICE_SELF, a500_kbd_device, check_reset, nullptr)
+ PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_SHIFT_2) PORT_NAME("Right Alt")
+ PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) PORT_NAME("Right Shift")
INPUT_PORTS_END
-ioport_constructor a500_kbd_us_device::device_input_ports() const
-{
- return INPUT_PORTS_NAME( a500_us_keyboard );
-}
+INPUT_PORTS_START( a500_us_keyboard )
+ PORT_INCLUDE(a500_special)
+ PORT_INCLUDE(matrix_us)
+INPUT_PORTS_END
-static INPUT_PORTS_START( a500_de_keyboard )
- PORT_START("special")
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LWIN) PORT_CHAR(UCHAR_MAMEKEY(LWIN)) PORT_NAME("Left Amiga") PORT_CHANGED_MEMBER(DEVICE_SELF, a500_kbd_us_device, check_reset, nullptr)
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT))
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) PORT_NAME("Ctrl") PORT_CHANGED_MEMBER(DEVICE_SELF, a500_kbd_us_device, check_reset, nullptr)
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RWIN) PORT_CHAR(UCHAR_MAMEKEY(RWIN)) PORT_NAME("Right Amiga") PORT_CHANGED_MEMBER(DEVICE_SELF, a500_kbd_us_device, check_reset, nullptr)
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT))
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
-
- PORT_START("row_d6")
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK))
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('<') PORT_CHAR('>')
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) PORT_NAME("Caps Lock")
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR(9)
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('\'') PORT_CHAR('~')
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC))
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
-
- PORT_START("row_d5")
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD))
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('y') PORT_CHAR('Y')
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A')
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q')
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!')
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR('[') PORT_CHAR('{')
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
-
- PORT_START("row_d4")
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD))
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X')
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S')
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W')
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@')
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1))
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
-
- PORT_START("row_d3")
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD))
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C')
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D')
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E')
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR(0x00a7) // §
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2))
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
-
- PORT_START("row_d2")
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD))
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V')
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F')
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R')
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$')
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3))
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
-
- PORT_START("row_d1")
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD))
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B')
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G')
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T')
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%')
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4))
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
-
- PORT_START("row_d0")
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD))
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N')
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H')
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('z') PORT_CHAR('Z')
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&')
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5))
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
-
- PORT_START("row_c7")
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD))
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M')
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J')
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U')
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('/')
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PGUP) PORT_CHAR(']') PORT_CHAR('}')
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
-
- PORT_START("row_c6")
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD))
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';')
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K')
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I')
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(')
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6))
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
-
- PORT_START("row_c5")
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD))
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':')
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L')
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O')
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')')
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR('/')
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
-
- PORT_START("row_c4")
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD))
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('-') PORT_CHAR('_')
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(0x00f6) PORT_CHAR(0x00d6) // ö Ö
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P')
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=')
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7))
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
-
- PORT_START("row_c3")
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD))
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00e4) PORT_CHAR(0x00c4) // ä Ä
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00fc) PORT_CHAR(0x00dc) // ü Ü
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR(0x00df) PORT_CHAR('?') // ß
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8))
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
-
- PORT_START("row_c2")
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD))
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('#') PORT_CHAR('^')
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('+') PORT_CHAR('*')
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(0x00b4) PORT_CHAR('`') // ´
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9))
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
-
- PORT_START("row_c1")
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD))
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL))
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F12) PORT_CHAR('\\') PORT_CHAR('|')
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10))
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
-
- PORT_START("row_c0")
- PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD))
- PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN))
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP))
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F11) PORT_NAME("Help")
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
+INPUT_PORTS_START( a500_de_keyboard )
+ PORT_INCLUDE(a500_special)
+ PORT_INCLUDE(matrix_de)
+INPUT_PORTS_END
+
+INPUT_PORTS_START( a500_fr_keyboard )
+ PORT_INCLUDE(a500_special)
+ PORT_INCLUDE(matrix_fr)
+INPUT_PORTS_END
+
+INPUT_PORTS_START( a500_it_keyboard )
+ PORT_INCLUDE(a500_special)
+ PORT_INCLUDE(matrix_it)
INPUT_PORTS_END
-ioport_constructor a500_kbd_de_device::device_input_ports() const
+INPUT_PORTS_START( a500_se_keyboard )
+ PORT_INCLUDE(a500_special)
+ PORT_INCLUDE(matrix_se)
+INPUT_PORTS_END
+
+INPUT_PORTS_START( a500_es_keyboard )
+ PORT_INCLUDE(a500_special)
+ PORT_INCLUDE(matrix_es)
+INPUT_PORTS_END
+
+INPUT_PORTS_START( a500_dk_keyboard )
+ PORT_INCLUDE(a500_special)
+ PORT_INCLUDE(matrix_dk)
+INPUT_PORTS_END
+
+INPUT_PORTS_START( a500_ch_keyboard )
+ PORT_INCLUDE(a500_special)
+ PORT_INCLUDE(matrix_ch)
+INPUT_PORTS_END
+
+INPUT_PORTS_START( a500_no_keyboard )
+ PORT_INCLUDE(a500_special)
+ PORT_INCLUDE(matrix_no)
+INPUT_PORTS_END
+
+INPUT_PORTS_START( a500_gb_keyboard )
+ PORT_INCLUDE(a500_special)
+ PORT_INCLUDE(matrix_gb)
+INPUT_PORTS_END
+
+} // anonymous namespace
+
+
+machine_config_constructor a500_kbd_device::device_mconfig_additions() const
{
- return INPUT_PORTS_NAME( a500_de_keyboard );
+ return MACHINE_CONFIG_NAME(kbd_pcb);
}
+const tiny_rom_entry *a500_kbd_device::device_rom_region() const
+{
+ return ROM_NAME(kbd_pcb);
+}
+
+ioport_constructor a500_kbd_us_device::device_input_ports() const { return INPUT_PORTS_NAME( a500_us_keyboard ); }
+ioport_constructor a500_kbd_de_device::device_input_ports() const { return INPUT_PORTS_NAME( a500_de_keyboard ); }
+ioport_constructor a500_kbd_fr_device::device_input_ports() const { return INPUT_PORTS_NAME( a500_fr_keyboard ); }
+ioport_constructor a500_kbd_it_device::device_input_ports() const { return INPUT_PORTS_NAME( a500_it_keyboard ); }
+ioport_constructor a500_kbd_se_device::device_input_ports() const { return INPUT_PORTS_NAME( a500_se_keyboard ); }
+ioport_constructor a500_kbd_es_device::device_input_ports() const { return INPUT_PORTS_NAME( a500_es_keyboard ); }
+ioport_constructor a500_kbd_dk_device::device_input_ports() const { return INPUT_PORTS_NAME( a500_dk_keyboard ); }
+ioport_constructor a500_kbd_ch_device::device_input_ports() const { return INPUT_PORTS_NAME( a500_ch_keyboard ); }
+ioport_constructor a500_kbd_no_device::device_input_ports() const { return INPUT_PORTS_NAME( a500_no_keyboard ); }
+ioport_constructor a500_kbd_gb_device::device_input_ports() const { return INPUT_PORTS_NAME( a500_gb_keyboard ); }
+
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
-//-------------------------------------------------
-// a500_kbd_us_device - constructor
-//-------------------------------------------------
-
-a500_kbd_us_device::a500_kbd_us_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, A500_KBD_US, "Amiga 500 Keyboard (U.S./Canada)", tag, owner, clock, "a500_kbd_us", __FILE__),
+a500_kbd_device::a500_kbd_device(
+ const machine_config &mconfig,
+ const char *tag,
+ device_t *owner,
+ uint32_t clock,
+ device_type type,
+ const char *name,
+ const char *shortname,
+ const char *file) :
+ device_t(mconfig, type, name, tag, owner, clock, shortname, file),
device_amiga_keyboard_interface(mconfig, *this),
m_mpu(*this, "ic1"),
m_special(*this, "special"),
- m_row_d(*this, "row_d%u", 0),
- m_row_c(*this, "row_c%u", 0),
+ m_rows(*this, "ROW%u", 0),
m_timer(nullptr),
m_watchdog(nullptr),
m_reset(nullptr),
- m_kdat(1),
+ m_host_kdat(1),
+ m_mpu_kdat(1),
m_kclk(1),
m_port_c(0xff),
m_port_d(0xff),
m_latch(0xffff),
m_counter(0xffff),
m_control(0x00)
-{}
+{
+}
-a500_kbd_us_device::a500_kbd_us_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock,
- device_type type, const char *name, const char *shortname) :
- device_t(mconfig, type, name, tag, owner, clock, shortname, __FILE__),
- device_amiga_keyboard_interface(mconfig, *this),
- m_mpu(*this, "ic1"),
- m_special(*this, "special"),
- m_row_d(*this, "row_d%u", 0),
- m_row_c(*this, "row_c%u", 0),
- m_timer(nullptr),
- m_watchdog(nullptr),
- m_reset(nullptr),
- m_kdat(1),
- m_kclk(1),
- m_port_c(0xff),
- m_port_d(0xff),
- m_latch(0xffff),
- m_counter(0xffff),
- m_control(0x00)
-{}
-//-------------------------------------------------
-// a500_kbd_de_device - constructor
-//-------------------------------------------------
+a500_kbd_us_device::a500_kbd_us_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ a500_kbd_device(mconfig, tag, owner, clock, A500_KBD_US, "Amiga 500 Keyboard (U.S./Canada)", "a500_kbd_us", __FILE__)
+{
+}
a500_kbd_de_device::a500_kbd_de_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- a500_kbd_us_device(mconfig, tag, owner, clock, A500_KBD_DE, "Amiga 500 Keyboard (Germany/Austria)", "a500_kbd_de")
-{}
+ a500_kbd_device(mconfig, tag, owner, clock, A500_KBD_DE, "Amiga 500 Keyboard (Germany/Austria)", "a500_kbd_de", __FILE__)
+{
+}
+
+a500_kbd_fr_device::a500_kbd_fr_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ a500_kbd_device(mconfig, tag, owner, clock, A500_KBD_FR, "Amiga 500 Keyboard (France/Belgium)", "a500_kbd_fr", __FILE__)
+{
+}
+
+a500_kbd_it_device::a500_kbd_it_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ a500_kbd_device(mconfig, tag, owner, clock, A500_KBD_IT, "Amiga 500 Keyboard (Italy)", "a500_kbd_it", __FILE__)
+{
+}
+
+a500_kbd_se_device::a500_kbd_se_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ a500_kbd_device(mconfig, tag, owner, clock, A500_KBD_SE, "Amiga 500 Keyboard (Sweden/Finland)", "a500_kbd_se", __FILE__)
+{
+}
+
+a500_kbd_es_device::a500_kbd_es_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ a500_kbd_device(mconfig, tag, owner, clock, A500_KBD_ES, "Amiga 500 Keyboard (Spain)", "a500_kbd_es", __FILE__)
+{
+}
+
+a500_kbd_dk_device::a500_kbd_dk_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ a500_kbd_device(mconfig, tag, owner, clock, A500_KBD_DK, "Amiga 500 Keyboard (Denmark)", "a500_kbd_dk", __FILE__)
+{
+}
+
+a500_kbd_ch_device::a500_kbd_ch_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ a500_kbd_device(mconfig, tag, owner, clock, A500_KBD_CH, "Amiga 500 Keyboard (Switzerland)", "a500_kbd_ch", __FILE__)
+{
+}
+
+a500_kbd_no_device::a500_kbd_no_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ a500_kbd_device(mconfig, tag, owner, clock, A500_KBD_NO, "Amiga 500 Keyboard (Norway)", "a500_kbd_no", __FILE__)
+{
+}
+
+a500_kbd_gb_device::a500_kbd_gb_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ a500_kbd_device(mconfig, tag, owner, clock, A500_KBD_NO, "Amiga 500 Keyboard (UK)", "a500_kbd_gb", __FILE__)
+{
+}
+
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
-void a500_kbd_us_device::device_start()
+void a500_kbd_device::device_start()
{
// allocate timers
m_timer = timer_alloc(0, nullptr);
@@ -474,7 +259,8 @@ void a500_kbd_us_device::device_start()
m_reset = timer_alloc(2, nullptr);
// register for save states
- save_item(NAME(m_kdat));
+ save_item(NAME(m_host_kdat));
+ save_item(NAME(m_mpu_kdat));
save_item(NAME(m_kclk));
save_item(NAME(m_port_c));
save_item(NAME(m_port_d));
@@ -487,12 +273,13 @@ void a500_kbd_us_device::device_start()
// device_reset - device-specific reset
//-------------------------------------------------
-void a500_kbd_us_device::device_reset()
+void a500_kbd_device::device_reset()
{
// stack starts 0
m_mpu->set_state_int(M6502_S, 0);
- m_kdat = 1;
+ m_host_kdat = 1;
+ m_mpu_kdat = 1;
m_kclk = 1;
m_port_c = 0xff;
m_port_d = 0xff;
@@ -504,7 +291,7 @@ void a500_kbd_us_device::device_reset()
m_watchdog->adjust(attotime::from_msec(54));
}
-void a500_kbd_us_device::device_timer(emu_timer &timer, device_timer_id tid, int param, void *ptr)
+void a500_kbd_device::device_timer(emu_timer &timer, device_timer_id tid, int param, void *ptr)
{
switch (tid)
{
@@ -554,7 +341,7 @@ void a500_kbd_us_device::device_timer(emu_timer &timer, device_timer_id tid, int
// IMPLEMENTATION
//**************************************************************************
-INPUT_CHANGED_MEMBER( a500_kbd_us_device::check_reset )
+INPUT_CHANGED_MEMBER( a500_kbd_device::check_reset )
{
uint8_t keys = m_special->read();
@@ -566,7 +353,7 @@ INPUT_CHANGED_MEMBER( a500_kbd_us_device::check_reset )
}
}
-void a500_kbd_us_device::update_irqs()
+void a500_kbd_device::update_irqs()
{
if ((m_control & PA1_INT_ENABLED) && (m_control & PA1_NEGATIVE_EDGE))
m_mpu->set_input_line(M6502_IRQ_LINE, ASSERT_LINE);
@@ -581,28 +368,26 @@ void a500_kbd_us_device::update_irqs()
m_mpu->set_input_line(M6502_IRQ_LINE, CLEAR_LINE);
}
-READ8_MEMBER( a500_kbd_us_device::port_a_r )
+READ8_MEMBER( a500_kbd_device::port_a_r )
{
uint8_t data = 0xfc;
// kdat & kclk
- data |= m_kdat << 0;
+ data |= (m_host_kdat & m_mpu_kdat) << 0;
data |= m_kclk << 1;
// scan port d and c rows
- for (int i = 0; i < 7; i++)
- if (!BIT(m_port_d, i)) data &= m_row_d[i]->read();
-
- for (int i = 0; i < 8; i++)
- if (!BIT(m_port_c, i)) data &= m_row_c[i]->read();
+ uint16_t const row_drive = (uint16_t(m_port_d | 0x80) << 8) | uint16_t(m_port_c);
+ for (unsigned i = 0; i < m_rows.size(); i++)
+ if (!BIT(row_drive, m_rows.size() - i - 1)) data &= m_rows[i]->read();
return data;
}
-WRITE8_MEMBER( a500_kbd_us_device::port_a_w )
+WRITE8_MEMBER( a500_kbd_device::port_a_w )
{
// look for pa0 edge
- if (!m_kdat && BIT(data, 0))
+ if (m_host_kdat && !m_mpu_kdat && BIT(data, 0))
{
m_control |= PA0_POSITIVE_EDGE;
update_irqs();
@@ -616,10 +401,10 @@ WRITE8_MEMBER( a500_kbd_us_device::port_a_w )
}
// update with new values and output
- if (m_kdat != BIT(data, 0))
+ if (m_mpu_kdat != BIT(data, 0))
{
- m_kdat = BIT(data, 0);
- m_host->kdat_w(m_kdat);
+ m_mpu_kdat = BIT(data, 0);
+ m_host->kdat_w(m_mpu_kdat);
}
if (m_kclk != BIT(data, 1))
@@ -629,18 +414,18 @@ WRITE8_MEMBER( a500_kbd_us_device::port_a_w )
}
}
-WRITE8_MEMBER( a500_kbd_us_device::port_b_w )
+WRITE8_MEMBER( a500_kbd_device::port_b_w )
{
// caps lock led
- machine().output().set_value("led0", BIT(data, 7));
+ machine().output().set_value("led_kbd_caps", BIT(data, 7));
}
-WRITE8_MEMBER( a500_kbd_us_device::port_c_w )
+WRITE8_MEMBER( a500_kbd_device::port_c_w )
{
m_port_c = data;
}
-WRITE8_MEMBER( a500_kbd_us_device::port_d_w )
+WRITE8_MEMBER( a500_kbd_device::port_d_w )
{
// reset watchdog on 0 -> 1 transition
if (!BIT(m_port_d, 7) && BIT(data, 7))
@@ -649,7 +434,7 @@ WRITE8_MEMBER( a500_kbd_us_device::port_d_w )
m_port_d = data;
}
-WRITE8_MEMBER( a500_kbd_us_device::latch_w )
+WRITE8_MEMBER( a500_kbd_device::latch_w )
{
if (offset == 0)
{
@@ -663,7 +448,7 @@ WRITE8_MEMBER( a500_kbd_us_device::latch_w )
}
}
-READ8_MEMBER( a500_kbd_us_device::counter_r )
+READ8_MEMBER( a500_kbd_device::counter_r )
{
if (!space.debugger_access())
{
@@ -677,7 +462,7 @@ READ8_MEMBER( a500_kbd_us_device::counter_r )
return m_counter >> 0;
}
-WRITE8_MEMBER( a500_kbd_us_device::transfer_latch_w )
+WRITE8_MEMBER( a500_kbd_device::transfer_latch_w )
{
m_control &= ~COUNTER_OVERFLOW;
update_irqs();
@@ -688,37 +473,39 @@ WRITE8_MEMBER( a500_kbd_us_device::transfer_latch_w )
m_counter = m_latch;
}
-WRITE8_MEMBER( a500_kbd_us_device::clear_pa0_detect )
+WRITE8_MEMBER( a500_kbd_device::clear_pa0_detect )
{
m_control &= ~PA0_POSITIVE_EDGE;
update_irqs();
}
-WRITE8_MEMBER( a500_kbd_us_device::clear_pa1_detect )
+WRITE8_MEMBER( a500_kbd_device::clear_pa1_detect )
{
m_control &= ~PA1_NEGATIVE_EDGE;
update_irqs();
}
-READ8_MEMBER( a500_kbd_us_device::control_r )
+READ8_MEMBER( a500_kbd_device::control_r )
{
return m_control;
}
-WRITE8_MEMBER( a500_kbd_us_device::control_w )
+WRITE8_MEMBER( a500_kbd_device::control_w )
{
m_control = data;
update_irqs();
}
-WRITE_LINE_MEMBER( a500_kbd_us_device::kdat_w )
+WRITE_LINE_MEMBER( a500_kbd_device::kdat_w )
{
// detect positive edge
- if (state && !m_kdat)
+ if (!m_host_kdat && m_mpu_kdat && state)
{
m_control |= PA0_POSITIVE_EDGE;
update_irqs();
}
- m_kdat = state;
+ m_host_kdat = state;
}
+
+} } } // namespace bus::amiga::keyboard
diff --git a/src/devices/bus/amiga/keyboard/a500.h b/src/devices/bus/amiga/keyboard/a500.h
index 5af5f62ee5a..6716622a1e9 100644
--- a/src/devices/bus/amiga/keyboard/a500.h
+++ b/src/devices/bus/amiga/keyboard/a500.h
@@ -2,20 +2,20 @@
// copyright-holders: Dirk Best
/***************************************************************************
- Amiga 500 Keyboard
+ Amiga 500 Keyboard
- Assembly part numbers:
+ Assembly part numbers:
- - 312502-01 U.S./Canada
- - 312502-02 Germany/Austria
- - 312502-03 France/Belgium
- - 312502-04 Italy
- - 312502-05 Sweden/Finland
- - 312502-06 Spain
- - 312502-07 Denmark
- - 312502-08 Switzerland
- - 312502-09 Norway
- - 312502-12 UK
+ - 312502-01 U.S./Canada
+ - 312502-02 Germany/Austria
+ - 312502-03 France/Belgium
+ - 312502-04 Italy
+ - 312502-05 Sweden/Finland
+ - 312502-06 Spain
+ - 312502-07 Denmark
+ - 312502-08 Switzerland
+ - 312502-09 Norway
+ - 312502-12 UK
Amiga 1000 (for reference, to be moved):
@@ -32,25 +32,34 @@
#pragma once
-#include "emu.h"
#include "keyboard.h"
#include "cpu/m6502/m6502.h"
+// device type definition
+extern const device_type A500_KBD_US;
+extern const device_type A500_KBD_DE;
+extern const device_type A500_KBD_FR;
+extern const device_type A500_KBD_IT;
+extern const device_type A500_KBD_SE;
+extern const device_type A500_KBD_ES;
+extern const device_type A500_KBD_DK;
+extern const device_type A500_KBD_CH;
+extern const device_type A500_KBD_NO;
+extern const device_type A500_KBD_GB;
+
+
+namespace bus { namespace amiga { namespace keyboard {
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
-// ======================> a500_kbd_us_device
+// ======================> a500_kbd_device
-class a500_kbd_us_device : public device_t, public device_amiga_keyboard_interface
+class a500_kbd_device : public device_t, public device_amiga_keyboard_interface
{
public:
- // construction/destruction
- a500_kbd_us_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- a500_kbd_us_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock,
- device_type type, const char *name, const char *shortname);
-
// from host
virtual DECLARE_WRITE_LINE_MEMBER(kdat_w) override;
@@ -71,10 +80,19 @@ public:
DECLARE_INPUT_CHANGED_MEMBER(check_reset);
protected:
+ a500_kbd_device(
+ const machine_config &mconfig,
+ const char *tag,
+ device_t *owner,
+ uint32_t clock,
+ device_type type,
+ const char *name,
+ const char *shortname,
+ const char *file);
+
// device-level overrides
virtual const tiny_rom_entry *device_rom_region() const override;
virtual machine_config_constructor device_mconfig_additions() const override;
- virtual ioport_constructor device_input_ports() const override;
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
@@ -103,14 +121,14 @@ private:
required_device<m6502_device> m_mpu;
required_ioport m_special;
- required_ioport_array<7> m_row_d;
- required_ioport_array<8> m_row_c;
+ required_ioport_array<15> m_rows;
emu_timer *m_timer;
emu_timer *m_watchdog;
emu_timer *m_reset;
- int m_kdat;
+ int m_host_kdat;
+ int m_mpu_kdat;
int m_kclk;
uint8_t m_port_c;
@@ -120,9 +138,20 @@ private:
uint8_t m_control;
};
+// ======================> a500_kbd_us_device
+
+class a500_kbd_us_device : public a500_kbd_device
+{
+public:
+ a500_kbd_us_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+protected:
+ virtual ioport_constructor device_input_ports() const override;
+};
+
// ======================> a500_kbd_de_device
-class a500_kbd_de_device : public a500_kbd_us_device
+class a500_kbd_de_device : public a500_kbd_device
{
public:
a500_kbd_de_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
@@ -131,8 +160,94 @@ protected:
virtual ioport_constructor device_input_ports() const override;
};
-// device type definition
-extern const device_type A500_KBD_US;
-extern const device_type A500_KBD_DE;
+// ======================> a500_kbd_fr_device
+
+class a500_kbd_fr_device : public a500_kbd_device
+{
+public:
+ a500_kbd_fr_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+protected:
+ virtual ioport_constructor device_input_ports() const override;
+};
+
+// ======================> a500_kbd_it_device
+
+class a500_kbd_it_device : public a500_kbd_device
+{
+public:
+ a500_kbd_it_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+protected:
+ virtual ioport_constructor device_input_ports() const override;
+};
+
+// ======================> a500_kbd_se_device
+
+class a500_kbd_se_device : public a500_kbd_device
+{
+public:
+ a500_kbd_se_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+protected:
+ virtual ioport_constructor device_input_ports() const override;
+};
+
+// ======================> a500_kbd_es_device
+
+class a500_kbd_es_device : public a500_kbd_device
+{
+public:
+ a500_kbd_es_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+protected:
+ virtual ioport_constructor device_input_ports() const override;
+};
+
+// ======================> a500_kbd_dk_device
+
+class a500_kbd_dk_device : public a500_kbd_device
+{
+public:
+ a500_kbd_dk_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+protected:
+ virtual ioport_constructor device_input_ports() const override;
+};
+
+// ======================> a500_kbd_ch_device
+
+class a500_kbd_ch_device : public a500_kbd_device
+{
+public:
+ a500_kbd_ch_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+protected:
+ virtual ioport_constructor device_input_ports() const override;
+};
+
+// ======================> a500_kbd_no_device
+
+class a500_kbd_no_device : public a500_kbd_device
+{
+public:
+ a500_kbd_no_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+protected:
+ virtual ioport_constructor device_input_ports() const override;
+};
+
+// ======================> a500_kbd_gb_device
+
+class a500_kbd_gb_device : public a500_kbd_device
+{
+public:
+ a500_kbd_gb_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+protected:
+ virtual ioport_constructor device_input_ports() const override;
+};
+
+} } } // namespace bus::amiga::keyboard
#endif // DEVICES_BUS_AMIGA_KEYBOARD_A500_H
diff --git a/src/devices/bus/amiga/keyboard/keyboard.cpp b/src/devices/bus/amiga/keyboard/keyboard.cpp
index c9d9bc95ce9..1e587e896cb 100644
--- a/src/devices/bus/amiga/keyboard/keyboard.cpp
+++ b/src/devices/bus/amiga/keyboard/keyboard.cpp
@@ -106,5 +106,13 @@ device_amiga_keyboard_interface::~device_amiga_keyboard_interface()
SLOT_INTERFACE_START( amiga_keyboard_devices )
SLOT_INTERFACE("a500_us", A500_KBD_US)
SLOT_INTERFACE("a500_de", A500_KBD_DE)
+ SLOT_INTERFACE("a500_fr", A500_KBD_FR)
+ SLOT_INTERFACE("a500_it", A500_KBD_IT)
+ SLOT_INTERFACE("a500_se", A500_KBD_SE)
+ SLOT_INTERFACE("a500_es", A500_KBD_ES)
+ SLOT_INTERFACE("a500_dk", A500_KBD_DK)
+ SLOT_INTERFACE("a500_ch", A500_KBD_CH)
+ SLOT_INTERFACE("a500_no", A500_KBD_NO)
+ SLOT_INTERFACE("a500_gb", A500_KBD_GB)
SLOT_INTERFACE("a1200_us", A1200_KBD)
SLOT_INTERFACE_END
diff --git a/src/devices/bus/amiga/keyboard/keyboard.h b/src/devices/bus/amiga/keyboard/keyboard.h
index 0a65b6c17bc..deb2f79295a 100644
--- a/src/devices/bus/amiga/keyboard/keyboard.h
+++ b/src/devices/bus/amiga/keyboard/keyboard.h
@@ -2,13 +2,13 @@
// copyright-holders: Dirk Best
/***************************************************************************
- Amiga Keyboard Interface
+ Amiga Keyboard Interface
- Serial data and reset control
+ Serial data and reset control
- - KDAT (serial data)
- - KCLK (serial clock)
- - KRST (reset output)
+ - KDAT (serial data)
+ - KCLK (serial clock)
+ - KRST (reset output)
***************************************************************************/
@@ -93,7 +93,7 @@ public:
device_amiga_keyboard_interface(const machine_config &mconfig, device_t &device);
virtual ~device_amiga_keyboard_interface();
- virtual DECLARE_WRITE_LINE_MEMBER(kdat_w) {};
+ virtual DECLARE_WRITE_LINE_MEMBER(kdat_w) = 0;
protected:
amiga_keyboard_bus_device *m_host;
diff --git a/src/devices/bus/amiga/keyboard/matrix.cpp b/src/devices/bus/amiga/keyboard/matrix.cpp
new file mode 100644
index 00000000000..5161fea5947
--- /dev/null
+++ b/src/devices/bus/amiga/keyboard/matrix.cpp
@@ -0,0 +1,778 @@
+// license:BSD-3-Clause
+// copyright-holders: Vas Crabb
+/***************************************************************************
+
+ Amiga Keyboard Matrix Ports
+
+ ***************************************************************************/
+
+#include "emu.h"
+#include "matrix.h"
+
+namespace bus { namespace amiga { namespace keyboard {
+
+namespace {
+
+INPUT_PORTS_START(matrix_common)
+ PORT_START("ROW0")
+ PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK))
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK))
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR(9)
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~')
+ PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC))
+ PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED)
+
+ PORT_START("ROW1")
+ PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD))
+ PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK))
+ PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED)
+
+ PORT_START("ROW2")
+ PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD))
+ PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1))
+ PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED)
+
+ PORT_START("ROW3")
+ PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD))
+ PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2))
+ PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED)
+
+ PORT_START("ROW4")
+ PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD))
+ PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3))
+ PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED)
+
+ PORT_START("ROW5")
+ PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD))
+ PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4))
+ PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED)
+
+ PORT_START("ROW6")
+ PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD))
+ PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5))
+ PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED)
+
+ PORT_START("ROW7")
+ PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD))
+ PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SCRLOCK) PORT_CHAR(UCHAR_MAMEKEY(SCRLOCK))
+ PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED)
+
+ PORT_START("ROW8")
+ PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD))
+ PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6))
+ PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED)
+
+ PORT_START("ROW9")
+ PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD))
+ PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD))
+ PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED)
+
+ PORT_START("ROW10")
+ PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD))
+ PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7))
+ PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED)
+
+ PORT_START("ROW11")
+ PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD))
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
+ PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8))
+ PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED)
+
+ PORT_START("ROW12")
+ PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD))
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
+ PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9))
+ PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED)
+
+ PORT_START("ROW13")
+ PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD))
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL))
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F11) PORT_CHAR('\\') PORT_CHAR('|')
+ PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10))
+ PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED)
+
+ PORT_START("ROW14")
+ PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD))
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN))
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP))
+ PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) PORT_NAME("Help")
+ PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED)
+INPUT_PORTS_END
+
+} // anonymous namespace
+
+
+INPUT_PORTS_START(matrix_us)
+ PORT_INCLUDE(matrix_common)
+
+ PORT_MODIFY("ROW0")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
+
+ PORT_MODIFY("ROW1")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHAR(0x00b1) PORT_CHAR(0x00ac) // ± ¬
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_CHAR(0x00e6) PORT_CHAR(0x00c6) // æ Æ
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') PORT_CHAR(0x00e5) PORT_CHAR(0x00c5) // å Å
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') PORT_CHAR(0x00b9) // ¹
+
+ PORT_MODIFY("ROW2")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHAR(0x00d7) PORT_CHAR(0x00f7) // × ÷
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_CHAR(0x00df) PORT_CHAR(0x00a7) // ß §
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_CHAR(0x00b0) // °
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') PORT_CHAR(0x00b2) // ²
+
+ PORT_MODIFY("ROW3")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_CHAR(0x00e7) PORT_CHAR(0x00c7) // ç Ç
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_CHAR(0x00f0) PORT_CHAR(0x00d0) // ð Ð
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_CHAR(0x00a9) // ©
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') PORT_CHAR(0x00b3) // ³
+
+ PORT_MODIFY("ROW4")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') PORT_CHAR(0x00aa) // ª
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') PORT_CHAR(0x00b4) // ´
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHAR(0x00ae) // ®
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') PORT_CHAR(0x00a2) // ¢
+
+ PORT_MODIFY("ROW5")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_CHAR(0x00ba) // º
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') PORT_CHAR(0x02cb) // ˋ
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_CHAR(0x00fe) PORT_CHAR(0x00de) // þ Þ
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') PORT_CHAR(0x00bc) // ¼
+
+ PORT_MODIFY("ROW6")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_CHAR(0x00ad) PORT_CHAR(0x00af) // soft hyphen ¯
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') PORT_CHAR(0x02c6) // ˆ
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') PORT_CHAR(0x00a4) PORT_CHAR(0x00a5) // ¤ ¥
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') PORT_CHAR(0x00bd) // ½
+
+ PORT_MODIFY("ROW7")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_CHAR(0x00b8) PORT_CHAR(0x00bf) // ¸ ¿
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') PORT_CHAR(0x02dc) // ˜
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_CHAR(0x00b5) // µ
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') PORT_CHAR(0x00be) // ¾
+
+ PORT_MODIFY("ROW8")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<')
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') PORT_CHAR(0x00a8) // ¨
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_CHAR(0x00a1) PORT_CHAR(0x00a6) // ¡ ¦
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') PORT_CHAR(0x00b7) // ·
+
+ PORT_MODIFY("ROW9")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>')
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') PORT_CHAR(0x00a3) // £
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_CHAR(0x00f8) PORT_CHAR(0x00d8) // ø Ø
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') PORT_CHAR(0x00ab) // «
+
+ PORT_MODIFY("ROW10")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?')
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':')
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHAR(0x00b6) // ¶
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') PORT_CHAR(0x00bb) // »
+
+ PORT_MODIFY("ROW11")
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"')
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{')
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_')
+
+ PORT_MODIFY("ROW12")
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED)
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}')
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+')
+
+ PORT_MODIFY("ROW13")
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|')
+INPUT_PORTS_END
+
+INPUT_PORTS_START(matrix_de)
+ PORT_INCLUDE(matrix_common)
+
+ PORT_MODIFY("ROW0")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('<') PORT_CHAR('>')
+
+ PORT_MODIFY("ROW1")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('y') PORT_CHAR('Y') PORT_CHAR(0x00b1) PORT_CHAR(0x00ac) // ± ¬
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_CHAR(0x00e6) PORT_CHAR(0x00c6) // æ Æ
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') PORT_CHAR(0x00e5) PORT_CHAR(0x00c5) // å Å
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') PORT_CHAR(0x00b9) // ¹
+
+ PORT_MODIFY("ROW2")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHAR(0x00d7) PORT_CHAR(0x00f7) // × ÷
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S')
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_CHAR(0x00b0) // °
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') PORT_CHAR('@') PORT_CHAR(0x00b2) // ²
+
+ PORT_MODIFY("ROW3")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_CHAR(0x00e7) PORT_CHAR(0x00c7) // ç Ç
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_CHAR(0x00f0) PORT_CHAR(0x00d0) // ð Ð
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_CHAR(0x00a9) // ©
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR(0x00a7) PORT_CHAR(0x00b3) // § ³
+
+ PORT_MODIFY("ROW4")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') PORT_CHAR(0x00aa) // ª
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F')
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHAR(0x00ae) // ®
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') PORT_CHAR(0x00b0) PORT_CHAR(0x00a2) // ° ¢
+
+ PORT_MODIFY("ROW5")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_CHAR(0x00ba) // º
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G')
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_CHAR(0x00fe) PORT_CHAR(0x00de) // þ Þ
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') PORT_CHAR(0x00bc) // ¼
+
+ PORT_MODIFY("ROW6")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_CHAR(0x00ad) PORT_CHAR(0x00af) // soft hyphen ¯
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') PORT_CHAR(0x02c6) // ˆ
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHAR(0x00a4) PORT_CHAR(0x00a5) // ¤ ¥
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') PORT_CHAR(0x00bd) // ½
+
+ PORT_MODIFY("ROW7")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_CHAR(0x00b8) PORT_CHAR(0x00bf) // ¸ ¿
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') PORT_CHAR(0x02dc) // ˜
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_CHAR(0x00b5) // µ
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('/') PORT_CHAR(0x00be) // ¾
+
+ PORT_MODIFY("ROW8")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';')
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') PORT_CHAR(0x02dc) // ˜
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_CHAR(0x00a1) PORT_CHAR(0x00a6) // ¡ ¦
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') PORT_CHAR(0x00b7) // ·
+
+ PORT_MODIFY("ROW9")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':')
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') PORT_CHAR(0x00a3) // £
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_CHAR(0x00f8) PORT_CHAR(0x00d8) // ø Ø
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') PORT_CHAR(0x00ab) // «
+
+ PORT_MODIFY("ROW10")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('-') PORT_CHAR('_')
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(0x00f6) PORT_CHAR(0x00d6) // ö Ö
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHAR(0x00b6) // ¶
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') PORT_CHAR(0x00bb) // »
+
+ PORT_MODIFY("ROW11")
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00e4) PORT_CHAR(0x00c4) PORT_CHAR('\'') // ä Ä
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00fc) PORT_CHAR(0x00dc) PORT_CHAR('[') PORT_CHAR('{') // ü Ü
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR(0x00df) PORT_CHAR('?') // ß
+
+ PORT_MODIFY("ROW12")
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('#') PORT_CHAR('^')
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('+') PORT_CHAR('*') PORT_CHAR(']') PORT_CHAR('}')
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(0x00b4) PORT_CHAR(0x02cb) // ´ ˋ
+INPUT_PORTS_END
+
+INPUT_PORTS_START(matrix_fr)
+ PORT_INCLUDE(matrix_common)
+
+ PORT_MODIFY("ROW0")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('<') PORT_CHAR('>')
+
+ PORT_MODIFY("ROW1")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('w') PORT_CHAR('W') PORT_CHAR(0x00b1) PORT_CHAR(0x00ac) // ± ¬
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('q') PORT_CHAR('Q') PORT_CHAR(0x00e6) PORT_CHAR(0x00c6) // æ Æ
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('a') PORT_CHAR('A') PORT_CHAR(0x00e5) PORT_CHAR(0x00c5) // å Å
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('&') PORT_CHAR('1') PORT_CHAR(0x00b9) PORT_CHAR('!') // ¹
+
+ PORT_MODIFY("ROW2")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHAR(0x00d7) PORT_CHAR(0x00f7) // × ÷
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_CHAR(0x00df) PORT_CHAR(0x00a7) // ß §
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHAR(0x00b0) // °
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR(0x00e9) PORT_CHAR('2') PORT_CHAR(0x00b2) PORT_CHAR('@') // é ²
+
+ PORT_MODIFY("ROW3")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_CHAR(0x00e7) PORT_CHAR(0x00c7) // ç Ç
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_CHAR(0x00f0) PORT_CHAR(0x00d0) // ð Ð
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_CHAR(0x00a9) // ©
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('"') PORT_CHAR('3') PORT_CHAR(0x00b3) PORT_CHAR('#') // ³
+
+ PORT_MODIFY("ROW4")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') PORT_CHAR(0x00aa) // ª
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') PORT_CHAR(0x00b4) // ´
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHAR(0x00ae) // ®
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('\'') PORT_CHAR('4') PORT_CHAR(0x00a2) PORT_CHAR('$') // ¢
+
+ PORT_MODIFY("ROW5")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_CHAR(0x00ba) // º
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') PORT_CHAR(0x02cb) // ˋ
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_CHAR(0x00fe) PORT_CHAR(0x00de) // þ Þ
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('(') PORT_CHAR('5') PORT_CHAR(0x00bc) PORT_CHAR('%') // ¼
+
+ PORT_MODIFY("ROW6")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_CHAR(0x00ad) PORT_CHAR(0x00af) // soft hyphen ¯
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H')
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') PORT_CHAR(0x00a4) PORT_CHAR(0x00a5) // ¤ ¥
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR(0x00a7) PORT_CHAR('6') PORT_CHAR(0x00bd) PORT_CHAR('^') // § ½
+
+ PORT_MODIFY("ROW7")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR(',') PORT_CHAR('?') PORT_CHAR(0x00b8) PORT_CHAR(0x00bf) // ¸ ¿
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') PORT_CHAR(0x02dc) // ˜
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_CHAR(0x00b5) // µ
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR(0x00e8) PORT_CHAR('7') PORT_CHAR(0x00be) PORT_CHAR('&') // è ¾
+
+ PORT_MODIFY("ROW8")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(';') PORT_CHAR('.') PORT_CHAR(',') PORT_CHAR('<')
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K')
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_CHAR(0x00a1) PORT_CHAR(0x00a6) // ¡ ¦
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('!') PORT_CHAR('8') PORT_CHAR(0x00b7) PORT_CHAR('*') // ·
+
+ PORT_MODIFY("ROW9")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR(':') PORT_CHAR('/') PORT_CHAR('.') PORT_CHAR(':')
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') PORT_CHAR(0x00a3) // £
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_CHAR(0x00f8) PORT_CHAR(0x00d8) // ø Ø
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR(0x00e7) PORT_CHAR('9') PORT_CHAR(0x00ab) PORT_CHAR('(') // ç «
+
+ PORT_MODIFY("ROW10")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('=') PORT_CHAR('+') PORT_CHAR('/') PORT_CHAR('?')
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR('m') PORT_CHAR('M') PORT_CHAR(';') PORT_CHAR(':')
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHAR(0x00b6) // ¶
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR(0x00e0) PORT_CHAR('0') PORT_CHAR(0x00bb) PORT_CHAR(')') // à »
+
+ PORT_MODIFY("ROW11")
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00f9) PORT_CHAR('%') PORT_CHAR('\'') PORT_CHAR('"') // ù
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x02c6) PORT_CHAR(0x00a8) PORT_CHAR('[') PORT_CHAR('{') // ˆ ¨
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR(')') PORT_CHAR(0x00b0) PORT_CHAR('-') PORT_CHAR('_') // °
+
+ PORT_MODIFY("ROW12")
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(0x00b5) PORT_CHAR(0x00a3) // µ £
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('$') PORT_CHAR('*') PORT_CHAR(']') PORT_CHAR('}')
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') PORT_CHAR('_') PORT_CHAR('=') PORT_CHAR('+')
+INPUT_PORTS_END
+
+INPUT_PORTS_START(matrix_it)
+ PORT_INCLUDE(matrix_common)
+
+ PORT_MODIFY("ROW0")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('<') PORT_CHAR('>')
+
+ PORT_MODIFY("ROW1")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHAR(0x00b1) PORT_CHAR(0x00ac) // ± ¬
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_CHAR(0x00e6) PORT_CHAR(0x00c6) // æ Æ
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') PORT_CHAR(0x00e5) PORT_CHAR(0x00c5) // å Å
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') PORT_CHAR(0x00b9) // ¹
+
+ PORT_MODIFY("ROW2")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHAR(0x00d7) PORT_CHAR(0x00f7) // × ÷
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_CHAR(0x00df) // ß
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_CHAR(0x00b0) // °
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') PORT_CHAR(0x00b2) // ²
+
+ PORT_MODIFY("ROW3")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_CHAR(0x00e7) PORT_CHAR(0x00c7) // ç Ç
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_CHAR(0x00f0) PORT_CHAR(0x00d0) // ð Ð
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_CHAR(0x00a9) // ©
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR(0x00a3) PORT_CHAR(0x00b3) // £ ³
+
+ PORT_MODIFY("ROW4")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') PORT_CHAR(0x00aa) // ª
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') PORT_CHAR(0x00b4) // ´
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHAR(0x00ae) // ®
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') PORT_CHAR(0x00a2) PORT_CHAR(0x00b0) // ¢ °
+
+ PORT_MODIFY("ROW5")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_CHAR(0x00ba) // º
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') PORT_CHAR(0x02cb) // ˋ
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_CHAR(0x00fe) PORT_CHAR(0x00de) // þ Þ
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') PORT_CHAR(0x00bc) // ¼
+
+ PORT_MODIFY("ROW6")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_CHAR(0x00ad) PORT_CHAR(0x00af) // soft hyphen ¯
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H')
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') PORT_CHAR(0x00a4) PORT_CHAR(0x00a5) // ¤ ¥
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') PORT_CHAR(0x00bd) PORT_CHAR('^') // ½
+
+ PORT_MODIFY("ROW7")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_CHAR(0x00b8) PORT_CHAR(0x00bf) // ¸ ¿
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') PORT_CHAR(0x02dc) // ˜
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_CHAR(0x00b5) // µ
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('/') PORT_CHAR(0x00be) PORT_CHAR('&') // ¾
+
+ PORT_MODIFY("ROW8")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';')
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') PORT_CHAR(0x00a8) // ¨
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_CHAR(0x00a1) PORT_CHAR(0x00a6) // ¡ ¦
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') PORT_CHAR(0x00b7) // ·
+
+ PORT_MODIFY("ROW9")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':')
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') PORT_CHAR(0x00a3) // £
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_CHAR(0x00f8) PORT_CHAR(0x00d8) // ø Ø
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') PORT_CHAR(0x00ab) // «
+
+ PORT_MODIFY("ROW10")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('-') PORT_CHAR('_')
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(0x00f2) PORT_CHAR('@') // ò
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHAR(0x00b6) // ¶
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') PORT_CHAR(0x00bb) // »
+
+ PORT_MODIFY("ROW11")
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00e0) PORT_CHAR('#') // à
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00e8) PORT_CHAR(0x00e9) PORT_CHAR('[') PORT_CHAR('{') // è é
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('\'') PORT_CHAR('?')
+
+ PORT_MODIFY("ROW12")
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(0x00f9) PORT_CHAR(0x00a7) // ù §
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('+') PORT_CHAR('*') PORT_CHAR(']') PORT_CHAR('}')
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(0x00ec) PORT_CHAR(0x02c6) // ì ˆ
+INPUT_PORTS_END
+
+INPUT_PORTS_START(matrix_se)
+ PORT_INCLUDE(matrix_common)
+
+ PORT_MODIFY("ROW0")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('<') PORT_CHAR('>')
+
+ PORT_MODIFY("ROW1")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHAR(0x00b1) PORT_CHAR(0x00ac) // ± ¬
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_CHAR(0x00e6) PORT_CHAR(0x00c6) // æ Æ
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q')
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') PORT_CHAR(0x00b9) // ¹
+
+ PORT_MODIFY("ROW2")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHAR(0x00d7) PORT_CHAR(0x00f7) // × ÷
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_CHAR(0x00df) PORT_CHAR(0x00a7) // ß §
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_CHAR(0x00b0) // °
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') PORT_CHAR(0x00b2) PORT_CHAR('@') // ²
+
+ PORT_MODIFY("ROW3")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_CHAR(0x00e7) PORT_CHAR(0x00c7) // ç Ç
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_CHAR(0x00f0) PORT_CHAR(0x00d0) // ð Ð
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_CHAR(0x00a9) // ©
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR(0x00a3) PORT_CHAR(0x00b3) PORT_CHAR('#') // £ ³
+
+ PORT_MODIFY("ROW4")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') PORT_CHAR(0x00aa) // ª
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F')
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHAR(0x00ae) // ®
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') PORT_CHAR(0x00a2) // ¢
+
+ PORT_MODIFY("ROW5")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_CHAR(0x00ba) // º
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G')
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_CHAR(0x00fe) PORT_CHAR(0x00de) // þ Þ
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') PORT_CHAR(0x00bc) // ¼
+
+ PORT_MODIFY("ROW6")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_CHAR(0x00ad) PORT_CHAR(0x00af) // soft hyphen ¯
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H')
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') PORT_CHAR(0x00a4) PORT_CHAR(0x00a5) // ¤ ¥
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') PORT_CHAR(0x00bd) PORT_CHAR('^') // ½
+
+ PORT_MODIFY("ROW7")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_CHAR(0x00b8) PORT_CHAR(0x00bf) // ¸ ¿
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') PORT_CHAR(0x02dc) // ˜
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_CHAR(0x00b5) // µ
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('/') PORT_CHAR(0x00be) // ¾
+
+ PORT_MODIFY("ROW8")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';')
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K')
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_CHAR(0x00a1) PORT_CHAR(0x00a6) // ¡ ¦
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') PORT_CHAR(0x00b7) // ·
+
+ PORT_MODIFY("ROW9")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':')
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L')
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_CHAR(0x00f8) PORT_CHAR(0x00d8) // ø Ø
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') PORT_CHAR(0x00ab) // «
+
+ PORT_MODIFY("ROW10")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('-') PORT_CHAR('_')
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(0x00f6) PORT_CHAR(0x00d6) // ö Ö
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHAR(0x00b6) // ¶
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') PORT_CHAR(0x00bb) // »
+
+ PORT_MODIFY("ROW11")
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00e4) PORT_CHAR(0x00c4) // ä Ä
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00e5) PORT_CHAR(0x00c5) PORT_CHAR('[') PORT_CHAR('{') // å Å
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') PORT_CHAR('?')
+
+ PORT_MODIFY("ROW12")
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\'') PORT_CHAR('*') PORT_CHAR(0x00fc) PORT_CHAR(0x00dc) // ü Ü
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(0x00a8) PORT_CHAR(0x2c6) PORT_CHAR(']') PORT_CHAR('}') // ¨ ˆ
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(0x00b4) PORT_CHAR(0x02cb) // ´ ˋ
+INPUT_PORTS_END
+
+INPUT_PORTS_START(matrix_es)
+ PORT_INCLUDE(matrix_common)
+
+ PORT_MODIFY("ROW0")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('<') PORT_CHAR('>') PORT_CHAR(0x00ab) PORT_CHAR(0x00bb) // « »
+
+ PORT_MODIFY("ROW1")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHAR(0x00b1) PORT_CHAR(0x00ac) // ± ¬
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_CHAR(0x00e6) PORT_CHAR(0x00c6) // æ Æ
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') PORT_CHAR(0x00e5) PORT_CHAR(0x00c5) // å Å
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR(0x00a1) PORT_CHAR(0x00b9) // ¡ ¹
+
+ PORT_MODIFY("ROW2")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHAR(0x00d7) PORT_CHAR(0x00f7) // × ÷
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_CHAR(0x00df) PORT_CHAR(0x00a7) // ß §
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_CHAR(0x00b0) // °
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR(0x00bf) PORT_CHAR(0x00b2) PORT_CHAR('@') // ¿ ²
+
+ PORT_MODIFY("ROW3")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C')
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_CHAR(0x00f0) PORT_CHAR(0x00d0) // ð Ð
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_CHAR(0x00a9) // ©
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') PORT_CHAR(0x00b3) // ³
+
+ PORT_MODIFY("ROW4")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V')
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F')
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHAR(0x00ae) // ®
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') PORT_CHAR(0x00a2) PORT_CHAR(0x00b0) // ¢ °
+
+ PORT_MODIFY("ROW5")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B')
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G')
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_CHAR(0x00fe) PORT_CHAR(0x00de) // þ Þ
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') PORT_CHAR(0x00bc) // ¼
+
+ PORT_MODIFY("ROW6")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_CHAR(0x00ad) PORT_CHAR(0x00af) // soft hyphen ¯
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H')
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') PORT_CHAR(0x00a4) PORT_CHAR(0x00a5) // ¤ ¥
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('/') PORT_CHAR(0x00bd) PORT_CHAR('^') // ½
+
+ PORT_MODIFY("ROW7")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_CHAR(0x00b8) // ¸
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') PORT_CHAR(0x02dc) // ˜
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_CHAR(0x00b5) // µ
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') PORT_CHAR(0x00be) // ¾
+
+ PORT_MODIFY("ROW8")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('?')
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K')
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_CHAR(0x00a1) PORT_CHAR(0x00a6) // ¡ ¦
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') PORT_CHAR(0x00b7) // ·
+
+ PORT_MODIFY("ROW9")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('!')
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') PORT_CHAR(0x00a3) // £
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_CHAR(0x00f8) PORT_CHAR(0x00d8) // ø Ø
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(')
+
+ PORT_MODIFY("ROW10")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('\'') PORT_CHAR('"')
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(0x00f1) PORT_CHAR(0x00d1) // ñ Ñ
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHAR(0x00b6) // ¶
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')')
+
+ PORT_MODIFY("ROW11")
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR(':')
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00b4) PORT_CHAR(0x00a8) PORT_CHAR('[') PORT_CHAR('{') // ´ ¨
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_')
+
+ PORT_MODIFY("ROW12")
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(0x00e7) PORT_CHAR(0x00c7) PORT_CHAR(0x00aa) PORT_CHAR(0x00ba) // ç Ç ª º
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(0x02cb) PORT_CHAR(0x02c6) PORT_CHAR(']') PORT_CHAR('}') // ˋ ˆ
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+')
+INPUT_PORTS_END
+
+INPUT_PORTS_START(matrix_dk)
+ PORT_INCLUDE(matrix_common)
+
+ PORT_MODIFY("ROW0")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('<') PORT_CHAR('>') PORT_CHAR(0x00ab) PORT_CHAR(0x00bb) // « »
+
+ PORT_MODIFY("ROW1")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHAR(0x00b1) PORT_CHAR(0x00ac) // ± ¬
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A')
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q')
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') PORT_CHAR(0x00b9) // ¹
+
+ PORT_MODIFY("ROW2")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHAR(0x00d7) PORT_CHAR(0x00f7) // × ÷
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_CHAR(0x00df) PORT_CHAR(0x00a7) // ß §
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_CHAR(0x00b0) // °
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') PORT_CHAR(0x00b2) PORT_CHAR('@') // ²
+
+ PORT_MODIFY("ROW3")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_CHAR(0x00e7) PORT_CHAR(0x00c7) // ç Ç
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_CHAR(0x00f0) PORT_CHAR(0x00d0) // ð Ð
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_CHAR(0x00a9) // ©
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') PORT_CHAR(0x00b3) // ³
+
+ PORT_MODIFY("ROW4")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') PORT_CHAR(0x00aa) // ª
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F')
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHAR(0x00ae) // ®
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR(0x00a4) PORT_CHAR(0x00a2) PORT_CHAR('$') // ¤ ¢
+
+ PORT_MODIFY("ROW5")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_CHAR(0x00ba) // º
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G')
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_CHAR(0x00fe) PORT_CHAR(0x00de) // þ Þ
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') PORT_CHAR(0x00bc) // ¼
+
+ PORT_MODIFY("ROW6")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_CHAR(0x00ad) PORT_CHAR(0x00af) // soft hyphen ¯
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H')
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') PORT_CHAR(0x00a4) PORT_CHAR(0x00a5) // ¤ ¥
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') PORT_CHAR(0x00bd) PORT_CHAR('^') // ½
+
+ PORT_MODIFY("ROW7")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_CHAR(0x00b8) PORT_CHAR(0x00bf) // ¸ ¿
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') PORT_CHAR(0x02dc) // ˜
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_CHAR(0x00b5) // µ
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('/') PORT_CHAR(0x00be) // ¾
+
+ PORT_MODIFY("ROW8")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';')
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K')
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_CHAR(0x00a1) PORT_CHAR(0x00a6) // ¡ ¦
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') PORT_CHAR(0x00b7) // ·
+
+ PORT_MODIFY("ROW9")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':')
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') PORT_CHAR(0x00a3) // £
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O')
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')')
+
+ PORT_MODIFY("ROW10")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('-') PORT_CHAR('_')
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(0x00e6) PORT_CHAR(0x00c6) // æ Æ
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHAR(0x00b6) // ¶
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=')
+
+ PORT_MODIFY("ROW11")
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00f8) PORT_CHAR(0x00d8) // ø Ø
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00e5) PORT_CHAR(0x00c5) PORT_CHAR('[') PORT_CHAR('{') // å Å
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') PORT_CHAR('?')
+
+ PORT_MODIFY("ROW12")
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\'') PORT_CHAR('*')
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(0x00a8) PORT_CHAR(0x02c6) PORT_CHAR(']') PORT_CHAR('}') // ¨ ˆ
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(0x00b4) PORT_CHAR(0x02cb) // ´ ˋ
+INPUT_PORTS_END
+
+INPUT_PORTS_START(matrix_ch)
+ // FIXME: not implemented innit?
+ PORT_INCLUDE(matrix_common)
+
+ PORT_START("CFG")
+ PORT_CONFNAME(0x01, 0x01, "Language" )
+ PORT_CONFSETTING( 0x01, "French" )
+ PORT_CONFSETTING( 0x00, "German" )
+
+ PORT_MODIFY("ROW0")
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR(0x02dc) PORT_CHAR('`') PORT_CHAR('~') // ˜
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('<') PORT_CHAR('>') PORT_CHAR(0x00ab) PORT_CHAR(0x00bb) // « »
+
+ PORT_MODIFY("ROW1")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('y') PORT_CHAR('Y') PORT_CHAR(0x00b1) PORT_CHAR(0x00ac) // ± ¬
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_CHAR(0x00e6) PORT_CHAR(0x00c6) // æ Æ
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') PORT_CHAR(0x00e5) PORT_CHAR(0x00c5) // å Å
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('+') PORT_CHAR(0x00b9) // ¹
+
+ PORT_MODIFY("ROW2")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHAR(0x00d7) PORT_CHAR(0x00f7) // × ÷
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_CHAR(0x00df) PORT_CHAR(0x00a7) // ß §
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_CHAR(0x00b0) // °
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') PORT_CHAR(0x00b2) PORT_CHAR('@') // ²
+
+ PORT_MODIFY("ROW3")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_CHAR(0x00e7) PORT_CHAR(0x00c7) // ç Ç
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_CHAR(0x00f0) PORT_CHAR(0x00d0) // ð Ð
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_CHAR(0x00a9) // ©
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('*') PORT_CHAR(0x00b3) PORT_CHAR('#') // ³
+
+ PORT_MODIFY("ROW4")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') PORT_CHAR(0x00aa) // ª
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F')
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHAR(0x00ae) // ®
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR(0x00e7) PORT_CHAR(0x00a2) // ç ¢
+
+ PORT_MODIFY("ROW5")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_CHAR(0x00ba) // º
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G')
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_CHAR(0x00fe) PORT_CHAR(0x00de) // þ Þ
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') PORT_CHAR(0x00bc) PORT_CHAR(0x00a7) // ¼ §
+
+ PORT_MODIFY("ROW6")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_CHAR(0x00ad) PORT_CHAR(0x00af) // soft hyphen ¯
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H')
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') PORT_CHAR(0x00a4) PORT_CHAR(0x00a5) // ¤ ¥
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') PORT_CHAR(0x00bd) PORT_CHAR('^') // ½
+
+ PORT_MODIFY("ROW7")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_CHAR(0x00b8) PORT_CHAR(0x00bf) // ¸ ¿
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J')
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_CHAR(0x00b5) // µ
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('/') PORT_CHAR(0x00be) // ¾
+
+ PORT_MODIFY("ROW8")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';')
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K')
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_CHAR(0x00a1) PORT_CHAR(0x00a6) // ¡ ¦
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') PORT_CHAR(0x00b7) // ·
+
+ PORT_MODIFY("ROW9")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':')
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L')
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_CHAR(0x00f8) PORT_CHAR(0x00d8) // ø Ø
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')')
+
+ PORT_MODIFY("ROW10")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('-') PORT_CHAR('_')
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(0x00e9) PORT_CHAR(0x00f6) PORT_CONDITION("CFG", 0x01, EQUALS, 0x01) // é ö
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(0x00f6) PORT_CHAR(0x00e9) PORT_CONDITION("CFG", 0x01, EQUALS, 0x00) // ö é
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHAR(0x00b6) // ¶
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=')
+
+ PORT_MODIFY("ROW11")
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00e0) PORT_CHAR(0x00e4) PORT_CONDITION("CFG", 0x01, EQUALS, 0x01) // à ä
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00e4) PORT_CHAR(0x00e0) PORT_CONDITION("CFG", 0x01, EQUALS, 0x00) // ä à
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00e8) PORT_CHAR(0x00fc) PORT_CHAR('[') PORT_CHAR('{') PORT_CONDITION("CFG", 0x01, EQUALS, 0x01) // è ü
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00fc) PORT_CHAR(0x00e8) PORT_CHAR('[') PORT_CHAR('{') PORT_CONDITION("CFG", 0x01, EQUALS, 0x00) // ü è
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('\'') PORT_CHAR('?')
+
+ PORT_MODIFY("ROW12")
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('$') PORT_CHAR(0x00a3) // £
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(0x00a8) PORT_CHAR('!') PORT_CHAR(']') PORT_CHAR('}') // ¨
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(0x02c6) PORT_CHAR(0x02cb) PORT_CHAR('=') PORT_CHAR(0x00b4) // ˆ ˋ ´
+INPUT_PORTS_END
+
+INPUT_PORTS_START(matrix_no)
+ PORT_INCLUDE(matrix_dk)
+
+ PORT_MODIFY("ROW0")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('<') PORT_CHAR('>') PORT_CHAR('\\') PORT_CHAR('|')
+
+ PORT_MODIFY("ROW3")
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR(0x00a3) PORT_CHAR(0x00b3) PORT_CHAR('#') // £ ³
+
+ PORT_MODIFY("ROW4")
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') PORT_CHAR(0x00a2) // ¢
+
+ PORT_MODIFY("ROW9")
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L')
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') PORT_CHAR(0x00ab) // «
+
+ PORT_MODIFY("ROW10")
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(0x00f8) PORT_CHAR(0x00d8) // ø Ø
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') PORT_CHAR(0x00bb) // »
+
+ PORT_MODIFY("ROW11")
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00e6) PORT_CHAR(0x00c6) // æ Æ
+INPUT_PORTS_END
+
+INPUT_PORTS_START(matrix_gb)
+ PORT_INCLUDE(matrix_us)
+
+ PORT_MODIFY("ROW2")
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') PORT_CHAR(0x00b2) // ²
+
+ PORT_MODIFY("ROW3")
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR(0x00a3) PORT_CHAR(0x00b3) // £ ³
+
+ PORT_MODIFY("ROW9")
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L')
+
+ PORT_MODIFY("ROW11")
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('#') PORT_CHAR('@') PORT_CHAR('\'')
+INPUT_PORTS_END
+
+} } } // namespace bus::amiga::keyboard
diff --git a/src/devices/bus/amiga/keyboard/matrix.h b/src/devices/bus/amiga/keyboard/matrix.h
new file mode 100644
index 00000000000..aafc2942ce4
--- /dev/null
+++ b/src/devices/bus/amiga/keyboard/matrix.h
@@ -0,0 +1,29 @@
+// license:BSD-3-Clause
+// copyright-holders: Vas Crabb
+/***************************************************************************
+
+ Amiga Keyboard Matrix Ports
+
+ ***************************************************************************/
+
+#ifndef DEVICES_BUS_AMIGA_KEYBOARD_MATRIX_H
+#define DEVICES_BUS_AMIGA_KEYBOARD_MATRIX_H
+
+#pragma once
+
+namespace bus { namespace amiga { namespace keyboard {
+
+INPUT_PORTS_EXTERN(matrix_us);
+INPUT_PORTS_EXTERN(matrix_de);
+INPUT_PORTS_EXTERN(matrix_fr);
+INPUT_PORTS_EXTERN(matrix_it);
+INPUT_PORTS_EXTERN(matrix_se);
+INPUT_PORTS_EXTERN(matrix_es);
+INPUT_PORTS_EXTERN(matrix_dk);
+INPUT_PORTS_EXTERN(matrix_ch);
+INPUT_PORTS_EXTERN(matrix_no);
+INPUT_PORTS_EXTERN(matrix_gb);
+
+} } } // namespace bus::amiga::keyboard
+
+#endif // DEVICES_BUS_AMIGA_KEYBOARD_MATRIX_H
diff --git a/src/devices/bus/c64/exp.cpp b/src/devices/bus/c64/exp.cpp
index 92c7eb64e5d..ab37fe19481 100644
--- a/src/devices/bus/c64/exp.cpp
+++ b/src/devices/bus/c64/exp.cpp
@@ -339,6 +339,7 @@ int c64_expansion_slot_device::exrom_r(offs_t offset, int sphi2, int ba, int rw,
#include "sfx_sound_expander.h"
#include "silverrock.h"
#include "simons_basic.h"
+#include "speakeasy.h"
#include "stardos.h"
#include "std.h"
#include "structured_basic.h"
@@ -375,6 +376,7 @@ SLOT_INTERFACE_START( c64_expansion_cards )
SLOT_INTERFACE("reu1750", C64_REU1750)
SLOT_INTERFACE("reu1764", C64_REU1764)
SLOT_INTERFACE("sfxse", C64_SFX_SOUND_EXPANDER)
+ SLOT_INTERFACE("speakez", C64_SPEAKEASY)
SLOT_INTERFACE("supercpu", C64_SUPERCPU)
SLOT_INTERFACE("swiftlink", C64_SWIFTLINK)
SLOT_INTERFACE("turbo232", C64_TURBO232)
diff --git a/src/devices/bus/c64/speakeasy.cpp b/src/devices/bus/c64/speakeasy.cpp
new file mode 100644
index 00000000000..6c59b7a11a5
--- /dev/null
+++ b/src/devices/bus/c64/speakeasy.cpp
@@ -0,0 +1,103 @@
+// license:BSD-3-Clause
+// copyright-holders:smf
+/**********************************************************************
+
+ Personal Peripheral Products Speakeasy 64 cartridge emulation
+
+**********************************************************************/
+
+#include "speakeasy.h"
+
+
+
+//**************************************************************************
+// MACROS/CONSTANTS
+//**************************************************************************
+
+#define SC01A_TAG "sc01a"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_SPEAKEASY = &device_creator<c64_speakeasy_t>;
+
+
+//-------------------------------------------------
+// MACHINE_DRIVER( speakeasy )
+//-------------------------------------------------
+
+static MACHINE_CONFIG_FRAGMENT( speakeasy )
+ MCFG_SPEAKER_STANDARD_MONO("mono")
+
+ MCFG_SOUND_ADD(SC01A_TAG, VOTRAX_SC01, 720000)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.85)
+MACHINE_CONFIG_END
+
+
+//-------------------------------------------------
+// machine_config_additions - device-specific
+// machine configurations
+//-------------------------------------------------
+
+machine_config_constructor c64_speakeasy_t::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( speakeasy );
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_speakeasy_t - constructor
+//-------------------------------------------------
+
+c64_speakeasy_t::c64_speakeasy_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ device_t(mconfig, C64_SPEAKEASY, "Speakeasy 64", tag, owner, clock, "speakeasy64", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this),
+ m_votrax(*this, SC01A_TAG)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_speakeasy_t::device_start()
+{
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+uint8_t c64_speakeasy_t::c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io1)
+ {
+ return m_votrax->request() << 7;
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_speakeasy_t::c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io1)
+ {
+ m_votrax->write(space, 0, data & 0x3f);
+ m_votrax->inflection_w(space, 0, data >> 6);
+ }
+}
diff --git a/src/devices/bus/c64/speakeasy.h b/src/devices/bus/c64/speakeasy.h
new file mode 100644
index 00000000000..136a565344f
--- /dev/null
+++ b/src/devices/bus/c64/speakeasy.h
@@ -0,0 +1,54 @@
+// license:BSD-3-Clause
+// copyright-holders:Curt Coder
+/**********************************************************************
+
+ Personal Peripheral Products Speakeasy 64 cartridge emulation
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __C64_SPEAKEASY__
+#define __C64_SPEAKEASY__
+
+#include "emu.h"
+#include "exp.h"
+#include "sound/votrax.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_speakeasy_t
+
+class c64_speakeasy_t : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_speakeasy_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+ // optional information overrides
+ virtual machine_config_constructor device_mconfig_additions() const override;
+
+protected:
+ // device-level overrides
+ virtual void device_start() override;
+
+ // device_c64_expansion_card_interface overrides
+ virtual uint8_t c64_cd_r(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+ virtual void c64_cd_w(address_space &space, offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
+
+private:
+ required_device<votrax_sc01_device> m_votrax;
+};
+
+
+// device type definition
+extern const device_type C64_SPEAKEASY;
+
+
+
+#endif
diff --git a/src/devices/bus/coco/coco_dwsock.cpp b/src/devices/bus/coco/coco_dwsock.cpp
index afd8e4dad5f..1d5322e1801 100644
--- a/src/devices/bus/coco/coco_dwsock.cpp
+++ b/src/devices/bus/coco/coco_dwsock.cpp
@@ -10,7 +10,6 @@
#include "emu.h"
#include "osdcore.h"
-#include "includes/coco.h"
#include "coco_dwsock.h"
diff --git a/src/devices/bus/coco/coco_fdc.cpp b/src/devices/bus/coco/coco_fdc.cpp
index c80ebc61391..fbab4c4c58a 100644
--- a/src/devices/bus/coco/coco_fdc.cpp
+++ b/src/devices/bus/coco/coco_fdc.cpp
@@ -46,7 +46,6 @@
#include "cococart.h"
#include "coco_fdc.h"
#include "imagedev/flopdrv.h"
-#include "includes/coco.h"
#include "machine/msm6242.h"
#include "machine/ds1315.h"
#include "machine/wd_fdc.h"
diff --git a/src/devices/bus/coco/coco_multi.cpp b/src/devices/bus/coco/coco_multi.cpp
index fcfd764a169..dcfe5f062aa 100644
--- a/src/devices/bus/coco/coco_multi.cpp
+++ b/src/devices/bus/coco/coco_multi.cpp
@@ -52,7 +52,6 @@
***************************************************************************/
#include "emu.h"
-#include "includes/coco.h"
#include "coco_multi.h"
#include "coco_232.h"
#include "coco_orch90.h"
@@ -161,7 +160,7 @@ void coco_multipak_device::device_start()
// install $FF7F handler
write8_delegate wh = write8_delegate(FUNC(coco_multipak_device::ff7f_write), this);
- machine().device(MAINCPU_TAG)->memory().space(AS_PROGRAM).install_write_handler(0xFF7F, 0xFF7F, wh);
+ machine().device(":maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xFF7F, 0xFF7F, wh);
// initial state
m_select = 0xFF;
diff --git a/src/devices/bus/coco/coco_pak.cpp b/src/devices/bus/coco/coco_pak.cpp
index 1cc9e4f5e05..e3ba87bbbdb 100644
--- a/src/devices/bus/coco/coco_pak.cpp
+++ b/src/devices/bus/coco/coco_pak.cpp
@@ -10,9 +10,9 @@
#include "emu.h"
#include "coco_pak.h"
-#include "includes/coco.h"
#define CARTSLOT_TAG "cart"
+#define CART_AUTOSTART_TAG "cart_autostart"
/***************************************************************************
IMPLEMENTATION
@@ -26,6 +26,19 @@ ROM_START( coco_pak )
// this region is filled by cococart_slot_device::call_load()
ROM_END
+
+//-------------------------------------------------
+// INPUT_PORTS( coco_cart_autostart )
+//-------------------------------------------------
+
+static INPUT_PORTS_START( coco_cart_autostart )
+ PORT_START(CART_AUTOSTART_TAG)
+ PORT_CONFNAME( 0x01, 0x01, "Cart Auto-Start" )
+ PORT_CONFSETTING( 0x00, DEF_STR( Off ))
+ PORT_CONFSETTING( 0x01, DEF_STR( On ))
+INPUT_PORTS_END
+
+
//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
@@ -42,14 +55,14 @@ const device_type COCO_PAK = &device_creator<coco_pak_device>;
coco_pak_device::coco_pak_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source)
: device_t(mconfig, type, name, tag, owner, clock, shortname, source),
device_cococart_interface( mconfig, *this ), m_cart(nullptr), m_owner(nullptr),
- m_autostart(*this, ":" CART_AUTOSTART_TAG)
+ m_autostart(*this, CART_AUTOSTART_TAG)
{
}
coco_pak_device::coco_pak_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, COCO_PAK, "CoCo Program PAK", tag, owner, clock, "cocopak", __FILE__),
device_cococart_interface( mconfig, *this ), m_cart(nullptr), m_owner(nullptr),
- m_autostart(*this, ":" CART_AUTOSTART_TAG)
+ m_autostart(*this, CART_AUTOSTART_TAG)
{
}
@@ -74,6 +87,15 @@ machine_config_constructor coco_pak_device::device_mconfig_additions() const
}
//-------------------------------------------------
+// input_ports - device-specific input ports
+//-------------------------------------------------
+
+ioport_constructor coco_pak_device::device_input_ports() const
+{
+ return INPUT_PORTS_NAME( coco_cart_autostart );
+}
+
+//-------------------------------------------------
// rom_region - device-specific ROM region
//-------------------------------------------------
diff --git a/src/devices/bus/coco/coco_pak.h b/src/devices/bus/coco/coco_pak.h
index f6a93ec459f..84f8e68f75f 100644
--- a/src/devices/bus/coco/coco_pak.h
+++ b/src/devices/bus/coco/coco_pak.h
@@ -26,6 +26,7 @@ public:
// optional information overrides
virtual machine_config_constructor device_mconfig_additions() const override;
virtual const tiny_rom_entry *device_rom_region() const override;
+ virtual ioport_constructor device_input_ports() const override;
virtual uint8_t* get_cart_base() override;
protected:
diff --git a/src/devices/bus/coco/coco_t4426.cpp b/src/devices/bus/coco/coco_t4426.cpp
index b067c5b8d50..1d5c3b3fa2f 100644
--- a/src/devices/bus/coco/coco_t4426.cpp
+++ b/src/devices/bus/coco/coco_t4426.cpp
@@ -41,7 +41,6 @@
#include "emu.h"
#include "coco_t4426.h"
-#include "includes/coco.h"
#define LOG_GENERAL 0x01
#define LOG_SETUP 0x02
@@ -74,6 +73,7 @@
#define UART_TAG "acia"
#define PIA_TAG "pia"
#define CARTSLOT_TAG "t4426"
+#define CART_AUTOSTART_TAG "cart_autostart"
/***************************************************************************
IMPLEMENTATION
@@ -109,6 +109,17 @@ ROM_START( coco_t4426 )
ROM_RELOAD(0x18000,0x1000)
ROM_END
+//-------------------------------------------------
+// INPUT_PORTS( coco_cart_autostart )
+//-------------------------------------------------
+
+static INPUT_PORTS_START( coco_cart_autostart )
+ PORT_START(CART_AUTOSTART_TAG)
+ PORT_CONFNAME( 0x01, 0x01, "Cart Auto-Start" )
+ PORT_CONFSETTING( 0x00, DEF_STR( Off ))
+ PORT_CONFSETTING( 0x01, DEF_STR( On ))
+INPUT_PORTS_END
+
//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
@@ -129,7 +140,7 @@ coco_t4426_device::coco_t4426_device(const machine_config &mconfig, device_type
,m_cart(nullptr)
,m_owner(nullptr)
,m_select(0)
- ,m_autostart(*this, ":" CART_AUTOSTART_TAG)
+ ,m_autostart(*this, CART_AUTOSTART_TAG)
,m_uart(*this, UART_TAG)
,m_pia(*this, PIA_TAG)
{
@@ -141,7 +152,7 @@ coco_t4426_device::coco_t4426_device(const machine_config &mconfig, const char *
,m_cart(nullptr)
,m_owner(nullptr)
,m_select(0)
- ,m_autostart(*this, ":" CART_AUTOSTART_TAG)
+ ,m_autostart(*this, CART_AUTOSTART_TAG)
,m_uart(*this, UART_TAG)
,m_pia(*this, PIA_TAG)
{
@@ -179,6 +190,16 @@ const tiny_rom_entry *coco_t4426_device::device_rom_region() const
return ROM_NAME( coco_t4426 );
}
+//-------------------------------------------------
+// input_ports - device-specific input ports
+//-------------------------------------------------
+
+ioport_constructor coco_t4426_device::device_input_ports() const
+{
+ return INPUT_PORTS_NAME( coco_cart_autostart );
+}
+
+
/*-------------------------------------------------
device_reset - device-specific startup
-------------------------------------------------*/
diff --git a/src/devices/bus/coco/coco_t4426.h b/src/devices/bus/coco/coco_t4426.h
index a0ec0532142..9fd446c21fb 100644
--- a/src/devices/bus/coco/coco_t4426.h
+++ b/src/devices/bus/coco/coco_t4426.h
@@ -28,6 +28,7 @@ public:
// optional information overrides
virtual machine_config_constructor device_mconfig_additions() const override;
virtual const tiny_rom_entry *device_rom_region() const override;
+ virtual ioport_constructor device_input_ports() const override;
virtual uint8_t* get_cart_base() override;
DECLARE_WRITE8_MEMBER( pia_A_w );
diff --git a/src/devices/bus/coco/dragon_fdc.cpp b/src/devices/bus/coco/dragon_fdc.cpp
index e32bab843e9..f633d465f8c 100644
--- a/src/devices/bus/coco/dragon_fdc.cpp
+++ b/src/devices/bus/coco/dragon_fdc.cpp
@@ -69,7 +69,6 @@
#include "cococart.h"
#include "coco_fdc.h"
#include "imagedev/flopdrv.h"
-#include "includes/coco.h"
#include "machine/wd_fdc.h"
#include "formats/dmk_dsk.h"
#include "formats/jvc_dsk.h"
diff --git a/src/devices/bus/cpc/amdrum.cpp b/src/devices/bus/cpc/amdrum.cpp
index 3ed2f019655..18eea564be0 100644
--- a/src/devices/bus/cpc/amdrum.cpp
+++ b/src/devices/bus/cpc/amdrum.cpp
@@ -7,7 +7,6 @@
*/
#include "emu.h"
-#include "includes/amstrad.h"
#include "amdrum.h"
#include "sound/volt_reg.h"
diff --git a/src/devices/bus/cpc/cpc_pds.cpp b/src/devices/bus/cpc/cpc_pds.cpp
index 311bca693cb..0708cb67f9a 100644
--- a/src/devices/bus/cpc/cpc_pds.cpp
+++ b/src/devices/bus/cpc/cpc_pds.cpp
@@ -8,7 +8,6 @@
#include "emu.h"
#include "cpc_pds.h"
-#include "includes/amstrad.h"
//**************************************************************************
diff --git a/src/devices/bus/cpc/cpc_rom.cpp b/src/devices/bus/cpc/cpc_rom.cpp
index 766c6b8277e..aae1044dc26 100644
--- a/src/devices/bus/cpc/cpc_rom.cpp
+++ b/src/devices/bus/cpc/cpc_rom.cpp
@@ -8,10 +8,10 @@
#include "emu.h"
#include "cpc_rom.h"
-#include "includes/amstrad.h"
const device_type CPC_ROM = &device_creator<cpc_rom_device>;
+SLOT_INTERFACE_EXTERN(cpc_exp_cards);
//**************************************************************************
// DEVICE CONFIG INTERFACE
diff --git a/src/devices/bus/cpc/cpc_rs232.cpp b/src/devices/bus/cpc/cpc_rs232.cpp
index 00090ace9aa..b00503584f0 100644
--- a/src/devices/bus/cpc/cpc_rs232.cpp
+++ b/src/devices/bus/cpc/cpc_rs232.cpp
@@ -7,7 +7,8 @@
*/
#include "cpc_rs232.h"
-#include "includes/amstrad.h"
+
+SLOT_INTERFACE_EXTERN(cpc_exp_cards);
//**************************************************************************
// DEVICE DEFINITIONS
diff --git a/src/devices/bus/cpc/cpc_ssa1.cpp b/src/devices/bus/cpc/cpc_ssa1.cpp
index 9779f4b96da..ef21af1e384 100644
--- a/src/devices/bus/cpc/cpc_ssa1.cpp
+++ b/src/devices/bus/cpc/cpc_ssa1.cpp
@@ -10,7 +10,7 @@
#include "emu.h"
#include "cpc_ssa1.h"
-#include "includes/amstrad.h"
+SLOT_INTERFACE_EXTERN(cpc_exp_cards);
//**************************************************************************
// DEVICE DEFINITIONS
diff --git a/src/devices/bus/cpc/ddi1.cpp b/src/devices/bus/cpc/ddi1.cpp
index ef21cb9f319..be82f2f05b8 100644
--- a/src/devices/bus/cpc/ddi1.cpp
+++ b/src/devices/bus/cpc/ddi1.cpp
@@ -6,8 +6,8 @@
#include "emu.h"
#include "ddi1.h"
-#include "includes/amstrad.h"
#include "softlist.h"
+SLOT_INTERFACE_EXTERN(cpc_exp_cards);
//**************************************************************************
// DEVICE DEFINITIONS
diff --git a/src/devices/bus/cpc/doubler.cpp b/src/devices/bus/cpc/doubler.cpp
index 79d47383b6c..5e5f6587404 100644
--- a/src/devices/bus/cpc/doubler.cpp
+++ b/src/devices/bus/cpc/doubler.cpp
@@ -7,7 +7,7 @@
*/
#include "doubler.h"
-#include "includes/amstrad.h"
+SLOT_INTERFACE_EXTERN(cpc_exp_cards);
//**************************************************************************
// DEVICE DEFINITIONS
diff --git a/src/devices/bus/cpc/hd20.cpp b/src/devices/bus/cpc/hd20.cpp
index 163687d41c7..370b3076b8c 100644
--- a/src/devices/bus/cpc/hd20.cpp
+++ b/src/devices/bus/cpc/hd20.cpp
@@ -8,8 +8,7 @@
#include "emu.h"
#include "hd20.h"
-#include "includes/amstrad.h"
-
+SLOT_INTERFACE_EXTERN(cpc_exp_cards);
//**************************************************************************
// DEVICE DEFINITIONS
diff --git a/src/devices/bus/cpc/magicsound.cpp b/src/devices/bus/cpc/magicsound.cpp
index b80b9218884..d2bf11d2009 100644
--- a/src/devices/bus/cpc/magicsound.cpp
+++ b/src/devices/bus/cpc/magicsound.cpp
@@ -8,10 +8,9 @@
*/
#include "emu.h"
-#include "includes/amstrad.h"
#include "magicsound.h"
#include "sound/volt_reg.h"
-
+SLOT_INTERFACE_EXTERN(cpc_exp_cards);
//**************************************************************************
// DEVICE DEFINITIONS
diff --git a/src/devices/bus/cpc/mface2.cpp b/src/devices/bus/cpc/mface2.cpp
index 7832de1ba7c..90d08716e25 100644
--- a/src/devices/bus/cpc/mface2.cpp
+++ b/src/devices/bus/cpc/mface2.cpp
@@ -8,7 +8,7 @@
#include "emu.h"
#include "mface2.h"
-#include "includes/amstrad.h"
+SLOT_INTERFACE_EXTERN(cpc_exp_cards);
//**************************************************************************
// DEVICE DEFINITIONS
diff --git a/src/devices/bus/cpc/playcity.cpp b/src/devices/bus/cpc/playcity.cpp
index eece3a9c2d7..41896009037 100644
--- a/src/devices/bus/cpc/playcity.cpp
+++ b/src/devices/bus/cpc/playcity.cpp
@@ -11,7 +11,7 @@
*/
#include "playcity.h"
-#include "includes/amstrad.h"
+SLOT_INTERFACE_EXTERN(cpc_exp_cards);
//**************************************************************************
// DEVICE DEFINITIONS
diff --git a/src/devices/bus/cpc/smartwatch.cpp b/src/devices/bus/cpc/smartwatch.cpp
index f7ae8148037..b6a453d79cd 100644
--- a/src/devices/bus/cpc/smartwatch.cpp
+++ b/src/devices/bus/cpc/smartwatch.cpp
@@ -11,8 +11,7 @@
#include "emu.h"
#include "smartwatch.h"
-#include "includes/amstrad.h"
-
+SLOT_INTERFACE_EXTERN(cpc_exp_cards);
//**************************************************************************
// DEVICE DEFINITIONS
diff --git a/src/devices/bus/cpc/transtape.cpp b/src/devices/bus/cpc/transtape.cpp
index 1b3056d12c9..df05e1e491a 100644
--- a/src/devices/bus/cpc/transtape.cpp
+++ b/src/devices/bus/cpc/transtape.cpp
@@ -9,7 +9,7 @@
*/
#include "transtape.h"
-#include "includes/amstrad.h"
+SLOT_INTERFACE_EXTERN(cpc_exp_cards);
//**************************************************************************
// DEVICE DEFINITIONS
diff --git a/src/devices/bus/ep64/exp.h b/src/devices/bus/ep64/exp.h
index 153afb0abc6..cbba96f1efa 100644
--- a/src/devices/bus/ep64/exp.h
+++ b/src/devices/bus/ep64/exp.h
@@ -48,7 +48,7 @@
#define __EP64_EXPANSION_BUS__
#include "emu.h"
-#include "audio/dave.h"
+#include "sound/dave.h"
diff --git a/src/devices/bus/ieee488/hp9895.cpp b/src/devices/bus/ieee488/hp9895.cpp
index 30df3426ac1..6abe8bc773d 100644
--- a/src/devices/bus/ieee488/hp9895.cpp
+++ b/src/devices/bus/ieee488/hp9895.cpp
@@ -48,8 +48,8 @@
Hardware Maintenance Manual
TODO/Issues:
- * floppy_image_device sometimes reports the wrong state for ready &
- wpt signals
+ * floppy_image_device sometimes reports the wrong state for wpt
+ signal
* IBM mode hasn't been tested yet
*********************************************************************/
@@ -232,10 +232,6 @@ void hp9895_device::device_reset()
m_timeout_timer->reset();
m_byte_timer->reset();
m_half_bit_timer->reset();
-#if 0
- // DEBUG DEBUG DEBUG DEBUG
- for (auto& r : m_ready) r = 2;
-#endif
}
void hp9895_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
@@ -705,19 +701,6 @@ READ8_MEMBER(hp9895_device::switches2_r)
void hp9895_device::floppy_ready_cb(floppy_image_device *floppy , int state)
{
-#if 0
- // DEBUG DEBUG DEBUG DEBUG
- for (unsigned i = 0; i < 2; i++) {
- if (floppy == m_drives[ i ]->get_device()) {
- if (m_ready[ i ] != state) {
- LOG(("Ready %u=%d\n" , i , state));
- m_ready[ i ] = state;
- }
- break;
- }
- }
-#endif
-
if (state) {
// Set Disk Changed flag when a drive is not ready
for (unsigned i = 0; i < 2; i++) {
diff --git a/src/devices/bus/ieee488/hp9895.h b/src/devices/bus/ieee488/hp9895.h
index 29d776e6d13..5837792de82 100644
--- a/src/devices/bus/ieee488/hp9895.h
+++ b/src/devices/bus/ieee488/hp9895.h
@@ -109,10 +109,6 @@ private:
uint8_t m_sync_cnt; // U28 & U73
bool m_hiden;
bool m_mgnena;
-#if 0
- // DEBUG DEBUG DEBUG DEBUG
- int m_ready[ 2 ];
-#endif
// Timers
emu_timer *m_timeout_timer;
diff --git a/src/devices/bus/nes/ggenie.cpp b/src/devices/bus/nes/ggenie.cpp
index ec6664bb23d..7831f91b717 100644
--- a/src/devices/bus/nes/ggenie.cpp
+++ b/src/devices/bus/nes/ggenie.cpp
@@ -15,8 +15,7 @@
#include "emu.h"
#include "ggenie.h"
-#include "includes/nes.h"
-
+#include "bus/nes/nes_carts.h"
#ifdef NES_PCB_DEBUG
#define VERBOSE 1
diff --git a/src/devices/bus/vic20/exp.cpp b/src/devices/bus/vic20/exp.cpp
index c95601773e3..d465279c91e 100644
--- a/src/devices/bus/vic20/exp.cpp
+++ b/src/devices/bus/vic20/exp.cpp
@@ -202,6 +202,8 @@ void vic20_expansion_slot_device::cd_w(address_space &space, offs_t offset, uint
#include "vic1111.h"
#include "vic1112.h"
#include "vic1210.h"
+#include "videopak.h"
+#include "speakeasy.h"
SLOT_INTERFACE_START( vic20_expansion_cards )
SLOT_INTERFACE("exp", VIC1010)
@@ -209,6 +211,8 @@ SLOT_INTERFACE_START( vic20_expansion_cards )
SLOT_INTERFACE("8k", VIC1110)
SLOT_INTERFACE("16k", VIC1111)
SLOT_INTERFACE("fe3", VIC20_FE3)
+ SLOT_INTERFACE("speakez", VIC20_SPEAKEASY)
+ SLOT_INTERFACE("videopak", VIC20_VIDEO_PAK)
// the following need ROMs from the software list
SLOT_INTERFACE_INTERNAL("standard", VIC20_STD)
diff --git a/src/devices/bus/vic20/speakeasy.cpp b/src/devices/bus/vic20/speakeasy.cpp
new file mode 100644
index 00000000000..d13a1908c75
--- /dev/null
+++ b/src/devices/bus/vic20/speakeasy.cpp
@@ -0,0 +1,104 @@
+// license:BSD-3-Clause
+// copyright-holders:smf
+/**********************************************************************
+
+ Personal Peripheral Products Speakeasy cartridge emulation
+ (aka Protecto Enterprizes VIC-20 Voice Synthesizer)
+
+**********************************************************************/
+
+#include "speakeasy.h"
+
+
+
+//**************************************************************************
+// MACROS/CONSTANTS
+//**************************************************************************
+
+#define SC01A_TAG "sc01a"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type VIC20_SPEAKEASY = &device_creator<vic20_speakeasy_t>;
+
+
+//-------------------------------------------------
+// MACHINE_DRIVER( speakeasy )
+//-------------------------------------------------
+
+static MACHINE_CONFIG_FRAGMENT( speakeasy )
+ MCFG_SPEAKER_STANDARD_MONO("mono")
+
+ MCFG_SOUND_ADD(SC01A_TAG, VOTRAX_SC01, 720000)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.85)
+MACHINE_CONFIG_END
+
+
+//-------------------------------------------------
+// machine_config_additions - device-specific
+// machine configurations
+//-------------------------------------------------
+
+machine_config_constructor vic20_speakeasy_t::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( speakeasy );
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// vic20_speakeasy_t - constructor
+//-------------------------------------------------
+
+vic20_speakeasy_t::vic20_speakeasy_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ device_t(mconfig, VIC20_SPEAKEASY, "Speakeasy VIC20", tag, owner, clock, "speakeasyvic20", __FILE__),
+ device_vic20_expansion_card_interface(mconfig, *this),
+ m_votrax(*this, SC01A_TAG)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void vic20_speakeasy_t::device_start()
+{
+}
+
+
+//-------------------------------------------------
+// vic20_cd_r - cartridge data read
+//-------------------------------------------------
+
+uint8_t vic20_speakeasy_t::vic20_cd_r(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
+{
+ if (!io2)
+ {
+ return m_votrax->request() << 7;
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// vic20_cd_w - cartridge data write
+//-------------------------------------------------
+
+void vic20_speakeasy_t::vic20_cd_w(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
+{
+ if (!io2)
+ {
+ m_votrax->write(space, 0, data & 0x3f);
+ m_votrax->inflection_w(space, 0, data >> 6);
+ }
+}
diff --git a/src/devices/bus/vic20/speakeasy.h b/src/devices/bus/vic20/speakeasy.h
new file mode 100644
index 00000000000..dbd9ccf4e84
--- /dev/null
+++ b/src/devices/bus/vic20/speakeasy.h
@@ -0,0 +1,55 @@
+// license:BSD-3-Clause
+// copyright-holders:Curt Coder
+/**********************************************************************
+
+ Personal Peripheral Products Speakeasy cartridge emulation
+ (aka Protecto Enterprizes VIC-20 Voice Synthesizer)
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __VIC20_SPEAKEASY__
+#define __VIC20_SPEAKEASY__
+
+#include "emu.h"
+#include "exp.h"
+#include "sound/votrax.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> vic20_speakeasy_t
+
+class vic20_speakeasy_t : public device_t,
+ public device_vic20_expansion_card_interface
+{
+public:
+ // construction/destruction
+ vic20_speakeasy_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+ // optional information overrides
+ virtual machine_config_constructor device_mconfig_additions() const override;
+
+protected:
+ // device-level overrides
+ virtual void device_start() override;
+
+ // device_vic20_expansion_card_interface overrides
+ virtual uint8_t vic20_cd_r(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override;
+ virtual void vic20_cd_w(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override;
+
+private:
+ required_device<votrax_sc01_device> m_votrax;
+};
+
+
+// device type definition
+extern const device_type VIC20_SPEAKEASY;
+
+
+
+#endif
diff --git a/src/devices/bus/vic20/videopak.cpp b/src/devices/bus/vic20/videopak.cpp
new file mode 100644
index 00000000000..ecf3355bab8
--- /dev/null
+++ b/src/devices/bus/vic20/videopak.cpp
@@ -0,0 +1,336 @@
+// license:BSD-3-Clause
+// copyright-holders:Curt Coder
+/**********************************************************************
+
+ Data 20 Corporation Video Pak cartridge emulation
+ aka Data 20 Display Manager aka Protecto 40/80
+
+**********************************************************************/
+
+#include "videopak.h"
+
+
+
+//**************************************************************************
+// MACROS/CONSTANTS
+//**************************************************************************
+
+#define VIDEORAM_SIZE 0x800
+#define RAM_SIZE 0x10000
+
+#define MC6845_TAG "mc6845"
+#define MC6845_SCREEN_TAG "screen80"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type VIC20_VIDEO_PAK = &device_creator<vic20_video_pak_t>;
+
+
+//-------------------------------------------------
+// ROM( videopak )
+//-------------------------------------------------
+
+ROM_START( videopak )
+ ROM_REGION( 0x800, MC6845_TAG, 0 )
+ // ROM has been borrowed from the C64 XL80 cartridge
+ ROM_LOAD( "chargen", 0x000, 0x800, BAD_DUMP CRC(9edf5e58) SHA1(4b244e6d94a7653a2e52c351589f0b469119fb04) )
+ROM_END
+
+
+//-------------------------------------------------
+// rom_region - device-specific ROM region
+//-------------------------------------------------
+
+const tiny_rom_entry *vic20_video_pak_t::device_rom_region() const
+{
+ return ROM_NAME( videopak );
+}
+
+//-------------------------------------------------
+// mc6845
+//-------------------------------------------------
+
+MC6845_UPDATE_ROW( vic20_video_pak_t::crtc_update_row )
+{
+ const pen_t *pen = m_palette->pens();
+
+ for (int column = 0; column < x_count; column++)
+ {
+ uint8_t code = m_videoram[((ma + column) & 0x7ff)];
+ uint16_t addr = (code << 3) | (ra & 0x07);
+ uint8_t data = m_char_rom->base()[addr & 0x7ff];
+
+ if (column == cursor_x)
+ {
+ data = 0xff;
+ }
+
+ for (int bit = 0; bit < 8; bit++)
+ {
+ int x = (column * 8) + bit;
+ int color = BIT(data, 7) && de;
+
+ bitmap.pix32(vbp + y, hbp + x) = pen[color];
+
+ data <<= 1;
+ }
+ }
+}
+
+//-------------------------------------------------
+// GFXDECODE( vic20_video_pak )
+//-------------------------------------------------
+
+static GFXDECODE_START( vic20_video_pak )
+ GFXDECODE_ENTRY(MC6845_TAG, 0x0000, gfx_8x8x1, 0, 1)
+GFXDECODE_END
+
+
+//-------------------------------------------------
+// MACHINE_CONFIG_FRAGMENT( vic20_video_pak )
+//-------------------------------------------------
+
+static MACHINE_CONFIG_FRAGMENT( vic20_video_pak )
+ MCFG_SCREEN_ADD_MONOCHROME(MC6845_SCREEN_TAG, RASTER, rgb_t::white())
+ MCFG_SCREEN_UPDATE_DEVICE(MC6845_TAG, h46505_device, screen_update)
+ MCFG_SCREEN_SIZE(80*8, 24*8)
+ MCFG_SCREEN_VISIBLE_AREA(0, 80*8-1, 0, 24*8-1)
+ MCFG_SCREEN_REFRESH_RATE(50)
+
+ MCFG_GFXDECODE_ADD("gfxdecode", "palette", vic20_video_pak)
+ MCFG_PALETTE_ADD_MONOCHROME("palette")
+
+ MCFG_MC6845_ADD(MC6845_TAG, H46505, MC6845_SCREEN_TAG, XTAL_14_31818MHz / 8)
+ MCFG_MC6845_SHOW_BORDER_AREA(true)
+ MCFG_MC6845_CHAR_WIDTH(8)
+ MCFG_MC6845_UPDATE_ROW_CB(vic20_video_pak_t, crtc_update_row)
+MACHINE_CONFIG_END
+
+
+//-------------------------------------------------
+// machine_config_additions - device-specific
+// machine configurations
+//-------------------------------------------------
+
+machine_config_constructor vic20_video_pak_t::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( vic20_video_pak );
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// vic20_video_pak_t - constructor
+//-------------------------------------------------
+
+vic20_video_pak_t::vic20_video_pak_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ device_t(mconfig, VIC20_VIDEO_PAK, "Data 20 Video Pak", tag, owner, clock, "videopak", __FILE__),
+ device_vic20_expansion_card_interface(mconfig, *this),
+ m_crtc(*this, MC6845_TAG),
+ m_palette(*this, "palette"),
+ m_char_rom(*this, MC6845_TAG),
+ m_videoram(*this, "videoram"),
+ m_ram(*this, "ram")
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void vic20_video_pak_t::device_start()
+{
+ // allocate memory
+ m_videoram.allocate(VIDEORAM_SIZE);
+ m_ram.allocate(RAM_SIZE);
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void vic20_video_pak_t::device_reset()
+{
+}
+
+
+//-------------------------------------------------
+// vic20_cd_r - cartridge data read
+//-------------------------------------------------
+
+uint8_t vic20_video_pak_t::vic20_cd_r(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
+{
+ if (!m_ram_enable)
+ {
+ if (m_bank_size)
+ {
+ if (!blk1)
+ {
+ offs_t addr = m_bank_msb << 15 | m_bank_lsb << 14 | offset;
+
+ data = m_ram[addr];
+ }
+
+ if (!blk2)
+ {
+ offs_t addr = m_bank_msb << 15 | m_bank_lsb << 14 | 0x2000 | offset;
+
+ data = m_ram[addr];
+ }
+ }
+ else
+ {
+ if (!blk1)
+ {
+ offs_t addr = m_bank_msb << 15 | offset;
+
+ data = m_ram[addr];
+ }
+
+ if (!blk2)
+ {
+ offs_t addr = m_bank_msb << 15 | 0x2000 | offset;
+
+ data = m_ram[addr];
+ }
+
+ if (!blk3)
+ {
+ offs_t addr = m_bank_msb << 15 | 0x4000 | offset;
+
+ data = m_ram[addr];
+ }
+ }
+ }
+
+ if (!blk5)
+ {
+ switch ((offset >> 11) & 0x03)
+ {
+ case 0:
+ data = m_blk5[offset & 0x7ff];
+ break;
+
+ case 3:
+ data = m_videoram[offset & 0x7ff];
+ break;
+ }
+ }
+
+ if (!io2)
+ {
+ if (offset == 0x1bf9)
+ {
+ data = m_crtc->register_r(space, 0);
+ }
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// vic20_cd_w - cartridge data write
+//-------------------------------------------------
+
+void vic20_video_pak_t::vic20_cd_w(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
+{
+ if (!m_ram_enable)
+ {
+ if (m_bank_size)
+ {
+ if (!blk1)
+ {
+ offs_t addr = m_bank_msb << 15 | m_bank_lsb << 14 | offset;
+
+ m_ram[addr] = data;
+ }
+
+ if (!blk2)
+ {
+ offs_t addr = m_bank_msb << 15 | m_bank_lsb << 14 | 0x2000 | offset;
+
+ m_ram[addr] = data;
+ }
+ }
+ else
+ {
+ if (!blk1)
+ {
+ offs_t addr = m_bank_msb << 15 | offset;
+
+ m_ram[addr] = data;
+ }
+
+ if (!blk2)
+ {
+ offs_t addr = m_bank_msb << 15 | 0x2000 | offset;
+
+ m_ram[addr] = data;
+ }
+
+ if (!blk3)
+ {
+ offs_t addr = m_bank_msb << 15 | 0x4000 | offset;
+
+ m_ram[addr] = data;
+ }
+ }
+ }
+
+ if (!blk5)
+ {
+ switch ((offset >> 11) & 0x03)
+ {
+ case 3:
+ m_videoram[offset & 0x7ff] = data;
+ break;
+ }
+ }
+
+ if (!io2)
+ {
+ switch (offset)
+ {
+ case 0x1bf8:
+ m_crtc->address_w(space, 0, data);
+ break;
+
+ case 0x1bf9:
+ m_crtc->register_w(space, 0, data);
+ break;
+
+ case 0x1bfc:
+ /*
+
+ bit description
+
+ 0 0 = upper case, 1 = lower case
+ 1 bank size: 0 = 2x24KB, 1 = 4x16KB
+ 2 16KB mode address LSB
+ 3 memory address MSB
+ 4 0 = enable RAM, 1 = disable RAM
+ 5 0 = 40 columns, 1 = 80 columns (Data 20 Video Manager)
+
+ */
+
+ m_case = BIT(data, 0);
+ m_bank_size = BIT(data, 1);
+ m_bank_lsb = BIT(data, 2);
+ m_bank_msb = BIT(data, 3);
+ m_ram_enable = BIT(data, 4);
+ m_columns = BIT(data, 5);
+ break;
+ }
+ }
+}
diff --git a/src/devices/bus/vic20/videopak.h b/src/devices/bus/vic20/videopak.h
new file mode 100644
index 00000000000..5d1e46f2005
--- /dev/null
+++ b/src/devices/bus/vic20/videopak.h
@@ -0,0 +1,71 @@
+// license:BSD-3-Clause
+// copyright-holders:Curt Coder
+/**********************************************************************
+
+ Data 20 Corporation Video Pak cartridge emulation
+ aka Data 20 Display Manager aka Protecto 40/80
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __VIC20_VIDEO_PAK__
+#define __VIC20_VIDEO_PAK__
+
+
+#include "emu.h"
+#include "exp.h"
+#include "video/mc6845.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> vic20_video_pak_t
+
+class vic20_video_pak_t : public device_t,
+ public device_vic20_expansion_card_interface
+{
+public:
+ // construction/destruction
+ vic20_video_pak_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+ // optional information overrides
+ virtual const tiny_rom_entry *device_rom_region() const override;
+ virtual machine_config_constructor device_mconfig_additions() const override;
+
+ // not really public
+ MC6845_UPDATE_ROW( crtc_update_row );
+
+protected:
+ // device-level overrides
+ virtual void device_start() override;
+ virtual void device_reset() override;
+
+ // device_vic20_expansion_card_interface overrides
+ virtual uint8_t vic20_cd_r(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override;
+ virtual void vic20_cd_w(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override;
+
+private:
+ required_device<h46505_device> m_crtc;
+ required_device<palette_device> m_palette;
+ required_memory_region m_char_rom;
+ optional_shared_ptr<uint8_t> m_videoram;
+ optional_shared_ptr<uint8_t> m_ram;
+
+ bool m_case;
+ bool m_bank_size;
+ bool m_bank_lsb;
+ bool m_bank_msb;
+ bool m_ram_enable;
+ bool m_columns;
+};
+
+
+// device type definition
+extern const device_type VIC20_VIDEO_PAK;
+
+
+#endif
diff --git a/src/devices/bus/vme/vme_fccpu20.cpp b/src/devices/bus/vme/vme_fccpu20.cpp
index a1e621d258b..92282f5f73c 100644
--- a/src/devices/bus/vme/vme_fccpu20.cpp
+++ b/src/devices/bus/vme/vme_fccpu20.cpp
@@ -601,11 +601,6 @@ ROM_START (fccpu20) /* This is an original rom dump */
ROM_LOAD32_BYTE("UU.BIN", 0x000000, 0x4000, CRC (b54d623b) SHA1 (49b272184a04570b09004de71fae0ed0d1bf5929))
ROM_END
-ROM_START (nodump)
- ROM_REGION32_BE(0x900000, "roms", 0)
- ROM_LOAD("rom.bin", 0x800000, 0x10000, NO_DUMP)
-ROM_END
-
/* These cpu-21 boards are supported by the latest cpu-20 rom */
#define rom_fccpu21s rom_fccpu20
#define rom_fccpu21 rom_fccpu20
diff --git a/src/devices/cpu/m6805/6805dasm.cpp b/src/devices/cpu/m6805/6805dasm.cpp
index 6f4934aa755..e8cca5bf4e3 100644
--- a/src/devices/cpu/m6805/6805dasm.cpp
+++ b/src/devices/cpu/m6805/6805dasm.cpp
@@ -36,10 +36,10 @@ enum class lvl {
HC
};
-enum op_names {
+enum class op_names {
adca, adda, anda, asl, asla, aslx, asr, asra,
asrx, bcc, bclr, bcs, beq, bhcc, bhcs, bhi,
- bih, bil, bita, bls, bmc, bmi, bms, bne,
+ bih, bil, bit, bls, bmc, bmi, bms, bne,
bpl, bra, brclr, brn, brset, bset, bsr, clc,
cli, clr, clra, clrx, cmpa, com, coma, comx,
cpx, dec, deca, decx, eora, ill, inc, inca,
@@ -50,10 +50,10 @@ enum op_names {
tst, tsta, tstx, txa, wait
};
-#define OP(name, mode) { name, #name, md::mode, lvl::HMOS }
-#define OPC(name, mode) { name, #name, md::mode, lvl::CMOS }
-#define OPHC(name, mode) { name, #name, md::mode, lvl::HC }
-#define ILLEGAL { ill, nullptr, md::INH, lvl::HMOS }
+#define OP(name, mode) { op_names::name, #name, md::mode, lvl::HMOS }
+#define OPC(name, mode) { op_names::name, #name, md::mode, lvl::CMOS }
+#define OPHC(name, mode) { op_names::name, #name, md::mode, lvl::HC }
+#define ILLEGAL { op_names::ill, nullptr, md::INH, lvl::HMOS }
struct { op_names op; char const *name; md mode; lvl level; } const disasm[0x100] = {
OP (brset,BTR), OP (brclr,BTR), OP (brset,BTR), OP (brclr,BTR), // 00
OP (brset,BTR), OP (brclr,BTR), OP (brset,BTR), OP (brclr,BTR),
@@ -96,27 +96,27 @@ struct { op_names op; char const *name; md mode; lvl level; } const disasm[0x100
OP (clc, INH), OP (sec, INH), OP (cli, INH), OP (sei, INH),
OP (rsp, INH), OP (nop, INH), ILLEGAL , OP (txa, INH),
OP (suba, IMM), OP (cmpa, IMM), OP (sbca, IMM), OP (cpx, IMM), // a0
- OP (anda, IMM), OP (bita, IMM), OP (lda, IMM), ILLEGAL ,
+ OP (anda, IMM), OP (bit, IMM), OP (lda, IMM), ILLEGAL ,
OP (eora, IMM), OP (adca, IMM), OP (ora, IMM), OP (adda, IMM),
ILLEGAL , OP (bsr, REL), OP (ldx, IMM), ILLEGAL ,
OP (suba, DIR), OP (cmpa, DIR), OP (sbca, DIR), OP (cpx, DIR), // b0
- OP (anda, DIR), OP (bita, DIR), OP (lda, DIR), OP (sta, DIR),
+ OP (anda, DIR), OP (bit, DIR), OP (lda, DIR), OP (sta, DIR),
OP (eora, DIR), OP (adca, DIR), OP (ora, DIR), OP (adda, DIR),
OP (jmp, DIR), OP (jsr, DIR), OP (ldx, DIR), OP (stx, DIR),
OP (suba, EXT), OP (cmpa, EXT), OP (sbca, EXT), OP (cpx, EXT), // c0
- OP (anda, EXT), OP (bita, EXT), OP (lda, EXT), OP (sta, EXT),
+ OP (anda, EXT), OP (bit, EXT), OP (lda, EXT), OP (sta, EXT),
OP (eora, EXT), OP (adca, EXT), OP (ora, EXT), OP (adda, EXT),
OP (jmp, EXT), OP (jsr, EXT), OP (ldx, EXT), OP (stx, EXT),
OP (suba, IX2), OP (cmpa, IX2), OP (sbca, IX2), OP (cpx, IX2), // d0
- OP (anda, IX2), OP (bita, IX2), OP (lda, IX2), OP (sta, IX2),
+ OP (anda, IX2), OP (bit, IX2), OP (lda, IX2), OP (sta, IX2),
OP (eora, IX2), OP (adca, IX2), OP (ora, IX2), OP (adda, IX2),
OP (jmp, IX2), OP (jsr, IX2), OP (ldx, IX2), OP (stx, IX2),
OP (suba, IX1), OP (cmpa, IX1), OP (sbca, IX1), OP (cpx, IX1), // e0
- OP (anda, IX1), OP (bita, IX1), OP (lda, IX1), OP (sta, IX1),
+ OP (anda, IX1), OP (bit, IX1), OP (lda, IX1), OP (sta, IX1),
OP (eora, IX1), OP (adca, IX1), OP (ora, IX1), OP (adda, IX1),
OP (jmp, IX1), OP (jsr, IX1), OP (ldx, IX1), OP (stx, IX1),
OP (suba, IDX), OP (cmpa, IDX), OP (sbca, IDX), OP (cpx, IDX), // f0
- OP (anda, IDX), OP (bita, IDX), OP (lda, IDX), OP (sta, IDX),
+ OP (anda, IDX), OP (bit, IDX), OP (lda, IDX), OP (sta, IDX),
OP (eora, IDX), OP (adca, IDX), OP (ora, IDX), OP (adda, IDX),
OP (jmp, IDX), OP (jsr, IDX), OP (ldx, IDX), OP (stx, IDX)
};
@@ -164,12 +164,12 @@ offs_t disassemble(
u32 flags;
switch (disasm[code].op)
{
- case bsr:
- case jsr:
+ case op_names::bsr:
+ case op_names::jsr:
flags = DASMFLAG_STEP_OVER;
break;
- case rts:
- case rti:
+ case op_names::rts:
+ case op_names::rti:
flags = DASMFLAG_STEP_OUT;
break;
default:
diff --git a/src/devices/cpu/m6805/6805ops.hxx b/src/devices/cpu/m6805/6805ops.hxx
index f7082cf8bfa..f69183a77ed 100644
--- a/src/devices/cpu/m6805/6805ops.hxx
+++ b/src/devices/cpu/m6805/6805ops.hxx
@@ -552,13 +552,13 @@ OP_HANDLER( swi )
// $8E STOP inherent ----
OP_HANDLER( stop )
{
- fatalerror("m6805: unimplemented STOP");
+ fatalerror("m6805[%s]: unimplemented STOP", tag());
}
// $8F WAIT inherent ----
OP_HANDLER( wait )
{
- fatalerror("m6805: unimplemented WAIT");
+ fatalerror("m6805[%s]: unimplemented WAIT", tag());
}
diff --git a/src/devices/cpu/m6805/m6805.cpp b/src/devices/cpu/m6805/m6805.cpp
index 05dfb07e2ef..4cb9301151b 100644
--- a/src/devices/cpu/m6805/m6805.cpp
+++ b/src/devices/cpu/m6805/m6805.cpp
@@ -386,7 +386,7 @@ void m6805_base_device::interrupt()
m_icount -= 11;
burn_cycles(11);
}
- else if((m_pending_interrupts & ((1 << M6805_IRQ_LINE) | HD63705_INT_MASK)) != 0)
+ else if ((m_pending_interrupts & ((1 << M6805_IRQ_LINE) | HD63705_INT_MASK)) != 0)
{
if ((CC & IFLAG) == 0)
{
@@ -402,9 +402,10 @@ void m6805_base_device::interrupt()
interrupt_vector();
m_pending_interrupts &= ~(1 << M6805_IRQ_LINE);
+
+ m_icount -= 11;
+ burn_cycles(11);
}
- m_icount -= 11;
- burn_cycles(11);
}
}
diff --git a/src/devices/cpu/m6805/m68705.cpp b/src/devices/cpu/m6805/m68705.cpp
index e4d0c920d5e..bcb2d1a858b 100644
--- a/src/devices/cpu/m6805/m68705.cpp
+++ b/src/devices/cpu/m6805/m68705.cpp
@@ -75,9 +75,11 @@ constexpr u16 M68705_VECTOR_BOOTSTRAP = 0xfff6;
constexpr u16 M68705_VECTOR_TIMER = 0xfff8;
//constexpr u16 M68705_VECTOR_INT2 = 0xfff8;
constexpr u16 M68705_VECTOR_INT = 0xfffa;
-//constexpr u16 M68705_VECTOR_SWI = 0xfffc;
+constexpr u16 M68705_VECTOR_SWI = 0xfffc;
constexpr u16 M68705_VECTOR_RESET = 0xfffe;
+constexpr u16 M68705_INT_MASK = 0x03;
+
} // anonymous namespace
@@ -201,7 +203,7 @@ m68705_device::m68705_device(
clock,
type,
name,
- { s_hmos_ops, s_hmos_cycles, addr_width, 0x007f, 0x0060, 0xfffc },
+ { s_hmos_ops, s_hmos_cycles, addr_width, 0x007f, 0x0060, M68705_VECTOR_SWI },
internal_map,
shortname,
source)
@@ -249,7 +251,7 @@ template <offs_t B> WRITE8_MEMBER(m68705_device::eprom_w)
else
{
// this causes undefined behaviour, which is bad when EPROM programming is involved
- logerror("warning: write to EPROM when /PGE = 0 (%x = %x)\n", B + offset, data);
+ logerror("warning: write to EPROM when /PGE = 0 (%04X = %02X)\n", B + offset, data);
}
}
}
@@ -273,7 +275,7 @@ template <std::size_t N> READ8_MEMBER(m68705_device::port_r)
u8 const newval(m_port_cb_r[N](space, 0, ~m_port_ddr[N] & ~m_port_mask[N]) & ~m_port_mask[N]);
if (newval != m_port_input[N])
{
- LOGIOPORT("read PORT%c: new input = %02X & %02X (was %02x)\n",
+ LOGIOPORT("read PORT%c: new input = %02X & %02X (was %02X)\n",
char('A' + N), newval, ~m_port_ddr[N] & ~m_port_mask[N], m_port_input[N]);
}
m_port_input[N] = newval;
@@ -286,7 +288,7 @@ template <std::size_t N> WRITE8_MEMBER(m68705_device::port_latch_w)
data &= ~m_port_mask[N];
u8 const diff = m_port_latch[N] ^ data;
if (diff)
- LOGIOPORT("write PORT%c latch: %02X & %02X (was %02x)\n", char('A' + N), data, m_port_ddr[N], m_port_latch[N]);
+ LOGIOPORT("write PORT%c latch: %02X & %02X (was %02X)\n", char('A' + N), data, m_port_ddr[N], m_port_latch[N]);
m_port_latch[N] = data;
if (diff & m_port_ddr[N])
port_cb_w<N>();
@@ -297,7 +299,7 @@ template <std::size_t N> WRITE8_MEMBER(m68705_device::port_ddr_w)
data &= ~m_port_mask[N];
if (data != m_port_ddr[N])
{
- LOGIOPORT("write DDR%c: %02X (was %02x)\n", char('A' + N), data, m_port_ddr[N]);
+ LOGIOPORT("write DDR%c: %02X (was %02X)\n", char('A' + N), data, m_port_ddr[N]);
m_port_ddr[N] = data;
port_cb_w<N>();
}
@@ -594,9 +596,9 @@ void m68705_device::interrupt()
{
throw emu_fatalerror("Unknown pending interrupt");
}
+ m_icount -= 11;
+ burn_cycles(11);
}
- m_icount -= 11;
- burn_cycles(11);
}
}
diff --git a/src/devices/cpu/m6805/m68705.h b/src/devices/cpu/m6805/m68705.h
index 6a3ada15c44..6241079f912 100644
--- a/src/devices/cpu/m6805/m68705.h
+++ b/src/devices/cpu/m6805/m68705.h
@@ -352,7 +352,6 @@ protected:
* 68705 section
****************************************************************************/
-#define M68705_INT_MASK 0x03
#define M68705_IRQ_LINE (M6805_IRQ_LINE + 0)
#define M68705_INT_TIMER (M6805_IRQ_LINE + 1)
#define M68705_VPP_LINE (M6805_IRQ_LINE + 2)
diff --git a/src/devices/cpu/m6805/m68hc05.cpp b/src/devices/cpu/m6805/m68hc05.cpp
index 79ef97f0e9f..c1821965736 100644
--- a/src/devices/cpu/m6805/m68hc05.cpp
+++ b/src/devices/cpu/m6805/m68hc05.cpp
@@ -1,37 +1,98 @@
// license:BSD-3-Clause
// copyright-holders:Vas Crabb
+/*
+High-speed CMOS 6805-compatible microcontrollers
+
+The M68HC05 family uses the M6805 instruction set with a few additions
+but runs at two clocks per machine cycle, and has incompatible on-board
+peripherals. It comes in mask ROM (M68HC05), EPROM (M68HC705) and
+EEPROM (M68HC805) variants. The suffix gives some indication of the
+memory sizes and on-board peripherals, but there's not a lot of
+consistency across the ROM/EPROM/EEPROM variants.
+
+All devices in this family have a 16-bit free-running counter fed from
+the internal clock. The counter value can be captured on an input edge,
+and an output can be automatically set when the counter reaches a
+certain value.
+*/
#include "emu.h"
#include "m68hc05.h"
#include "m6805defs.h"
+
/****************************************************************************
* Configurable logging
****************************************************************************/
-//#define VERBOSE (LOG_GENERAL)
+#define LOG_GENERAL (1U << 0)
+#define LOG_INT (1U << 1)
+#define LOG_IOPORT (1U << 2)
+#define LOG_TIMER (1U << 3)
+#define LOG_COP (1U << 4)
+
+//#define VERBOSE (LOG_GENERAL | LOG_INT | LOG_IOPORT | LOG_TIMER | LOG_COP)
//#define LOG_OUTPUT_FUNC printf
#include "logmacro.h"
+#define LOGINT(...) LOGMASKED(LOG_INT, __VA_ARGS__)
+#define LOGIOPORT(...) LOGMASKED(LOG_IOPORT, __VA_ARGS__)
+#define LOGTIMER(...) LOGMASKED(LOG_TIMER, __VA_ARGS__)
+#define LOGCOP(...) LOGMASKED(LOG_COP, __VA_ARGS__)
+
namespace {
-std::pair<u16, char const *> const m68705c4_syms[] = {
- { 0x0000, "PORTA" }, { 0x0001, "PORTB" }, { 0x0002, "PORTC" }, { 0x0003, "PORTD" },
- { 0x0004, "DDRA" }, { 0x0005, "DDRB" }, { 0x0006, "DDRC" },
- { 0x000a, "SPCR" }, { 0x000b, "SPSR" }, { 0x000c, "SPDR" },
- { 0x000d, "BAUD" }, { 0x000e, "SCCR1" }, { 0x000f, "SCCR2" }, { 0x0010, "SCSR" }, { 0x0011, "SCDR" },
- { 0x0012, "TCR" }, { 0x0013, "TSR" },
- { 0x0014, "ICRH" }, { 0x0015, "ICRL" }, { 0x0016, "OCRH" }, { 0x0017, "OCRL" },
- { 0x0018, "TRH" }, { 0x0019, "TRL" }, { 0x001a, "ATRH" }, { 0x001b, "ATRL" } };
+std::pair<u16, char const *> const m68hc05c4_syms[] = {
+ { 0x0000, "PORTA" }, { 0x0001, "PORTB" }, { 0x0002, "PORTC" }, { 0x0003, "PORTD" },
+ { 0x0004, "DDRA" }, { 0x0005, "DDRB" }, { 0x0006, "DDRC" },
+ { 0x000a, "SPCR" }, { 0x000b, "SPSR" }, { 0x000c, "SPDR" },
+ { 0x000d, "BAUD" }, { 0x000e, "SCCR1" }, { 0x000f, "SCCR2" }, { 0x0010, "SCSR" }, { 0x0011, "SCDR" },
+ { 0x0012, "TCR" }, { 0x0013, "TSR" },
+ { 0x0014, "ICRH" }, { 0x0015, "ICRL" }, { 0x0016, "OCRH" }, { 0x0017, "OCRL" },
+ { 0x0018, "TRH" }, { 0x0019, "TRL" }, { 0x001a, "ATRH" }, { 0x001b, "ATRL" } };
+
+std::pair<u16, char const *> const m68hc705c8a_syms[] = {
+ { 0x0000, "PORTA" }, { 0x0001, "PORTB" }, { 0x0002, "PORTC" }, { 0x0003, "PORTD" },
+ { 0x0004, "DDRA" }, { 0x0005, "DDRB" }, { 0x0006, "DDRC" },
+ { 0x000a, "SPCR" }, { 0x000b, "SPSR" }, { 0x000c, "SPDR" },
+ { 0x000d, "BAUD" }, { 0x000e, "SCCR1" }, { 0x000f, "SCCR2" }, { 0x0010, "SCSR" }, { 0x0011, "SCDR" },
+ { 0x0012, "TCR" }, { 0x0013, "TSR" },
+ { 0x0014, "ICRH" }, { 0x0015, "ICRL" }, { 0x0016, "OCRH" }, { 0x0017, "OCRL" },
+ { 0x0018, "TRH" }, { 0x0019, "TRL" }, { 0x001a, "ATRH" }, { 0x001b, "ATRL" },
+ { 0x001c, "PROG" },
+ { 0x001d, "COPRST" }, { 0x001e, "COPCR" } };
+
+
+ROM_START( m68hc705c8a )
+ ROM_REGION(0x00f0, "bootstrap", 0)
+ ROM_LOAD("bootstrap.bin", 0x0000, 0x00f0, NO_DUMP)
+ROM_END
+
+
+//constexpr u16 M68HC05_VECTOR_SPI = 0xfff4;
+//constexpr u16 M68HC05_VECTOR_SCI = 0xfff6;
+constexpr u16 M68HC05_VECTOR_TIMER = 0xfff8;
+constexpr u16 M68HC05_VECTOR_IRQ = 0xfffa;
+constexpr u16 M68HC05_VECTOR_SWI = 0xfffc;
+//constexpr u16 M68HC05_VECTOR_RESET = 0xfffe;
+
+constexpr u16 M68HC05_INT_IRQ = u16(1) << 0;
+constexpr u16 M68HC05_INT_TIMER = u16(1) << 1;
+
+constexpr u16 M68HC05_INT_MASK = M68HC05_INT_IRQ | M68HC05_INT_TIMER;
} // anonymous namespace
+
/****************************************************************************
* Global variables
****************************************************************************/
-device_type const M68HC05C4 = &device_creator<m68hc05c4_device>;
+device_type const M68HC05C4 = &device_creator<m68hc05c4_device>;
+device_type const M68HC05C8 = &device_creator<m68hc05c8_device>;
+device_type const M68HC705C8A = &device_creator<m68hc705c8a_device>;
+
/****************************************************************************
@@ -55,49 +116,613 @@ m68hc05_device::m68hc05_device(
clock,
type,
name,
- { s_hc_ops, s_hc_cycles, 13, 0x00ff, 0x00c0, 0xfffc },
+ { s_hc_ops, s_hc_cycles, 13, 0x00ff, 0x00c0, M68HC05_VECTOR_SWI },
internal_map,
shortname,
source)
+ , m_port_cb_r{ *this, *this, *this, *this }
+ , m_port_cb_w{ *this, *this, *this, *this }
+ , m_port_bits{ 0xff, 0xff, 0xff, 0xff }
+ , m_port_interrupt{ 0x00, 0x00, 0x00, 0x00 }
+ , m_port_input{ 0xff, 0xff, 0xff, 0xff }
+ , m_port_latch{ 0xff, 0xff, 0xff, 0xff }
+ , m_port_ddr{ 0x00, 0x00, 0x00, 0x00 }
+ , m_port_irq_state(false)
+ , m_irq_line_state(false)
+ , m_irq_latch(0)
+ , m_tcmp_cb(*this)
+ , m_tcap_state(false)
+ , m_tcr(0x00)
+ , m_tsr(0x00), m_tsr_seen(0x00)
+ , m_prescaler(0x00)
+ , m_counter(0xfffc), m_icr(0x0000), m_ocr(0x0000)
+ , m_inhibit_cap(false), m_inhibit_cmp(false)
+ , m_trl_buf{ 0xfc, 0xfc }
+ , m_trl_latched{ false, false }
+ , m_pcop_cnt(0)
+ , m_ncop_cnt(0)
+ , m_coprst(0x00)
+ , m_copcr(0x00)
+ , m_ncope(0)
+{
+}
+
+
+void m68hc05_device::set_port_bits(std::array<u8, PORT_COUNT> const &bits)
+{
+ if (configured() || started())
+ throw emu_fatalerror("Attempt to set physical port bits after configuration");
+
+ for (unsigned i = 0; PORT_COUNT > i; ++i)
+ m_port_bits[i] = bits[i];
+}
+
+void m68hc05_device::set_port_interrupt(std::array<u8, PORT_COUNT> const &interrupt)
+{
+ u8 diff(0x00);
+ for (unsigned i = 0; PORT_COUNT > i; ++i)
+ {
+ diff |= (m_port_interrupt[i] ^ interrupt[i]) & ~m_port_ddr[i];
+ m_port_interrupt[i] = interrupt[i];
+ if (interrupt[i] && !m_port_cb_r[i].isnull())
+ logerror("PORT%c has interrupts enabled with pulled inputs, behaviour may be incorrect\n", 'A' + i);
+ }
+ if (diff) update_port_irq();
+}
+
+READ8_MEMBER(m68hc05_device::port_r)
+{
+ offset &= PORT_COUNT - 1;
+ if (!space.debugger_access() && !m_port_cb_r[offset].isnull())
+ {
+ u8 const newval(m_port_cb_r[offset](space, 0, ~m_port_ddr[offset] & m_port_bits[offset]) & m_port_bits[offset]);
+ u8 const diff(newval ^ m_port_input[offset]);
+ if (diff)
+ {
+ LOGIOPORT("read PORT%c: new input = %02X & %02X (was %02X)\n",
+ char('A' + offset), newval, ~m_port_ddr[offset] & m_port_bits[offset], m_port_input[offset]);
+ }
+ m_port_input[offset] = newval;
+ if (diff & m_port_interrupt[offset] & ~m_port_ddr[offset])
+ update_port_irq();
+ }
+ return port_value(offset);
+}
+
+WRITE8_MEMBER(m68hc05_device::port_latch_w)
+{
+ offset &= PORT_COUNT - 1;
+ data &= m_port_bits[offset];
+ u8 const diff = m_port_latch[offset] ^ data;
+ if (diff)
+ {
+ LOGIOPORT("write PORT%c latch: %02X & %02X (was %02X)\n",
+ char('A' + offset), data, m_port_ddr[offset], m_port_latch[offset]);
+ }
+ m_port_latch[offset] = data;
+ if (diff & m_port_ddr[offset])
+ m_port_cb_w[offset](space, 0, port_value(offset), m_port_ddr[offset]);
+}
+
+READ8_MEMBER(m68hc05_device::port_ddr_r)
+{
+ return m_port_ddr[offset & (PORT_COUNT - 1)];
+}
+
+WRITE8_MEMBER(m68hc05_device::port_ddr_w)
+{
+ offset &= PORT_COUNT - 1;
+ data &= m_port_bits[offset];
+ u8 const diff(data ^ m_port_ddr[offset]);
+ if (diff)
+ {
+ LOGIOPORT("write DDR%c: %02X (was %02X)\n", char('A' + offset), data, m_port_ddr[offset]);
+ m_port_ddr[offset] = data;
+ if (diff & m_port_interrupt[offset])
+ {
+ if (!m_port_cb_r[offset].isnull())
+ {
+ u8 const newval(m_port_cb_r[offset](space, 0, ~m_port_ddr[offset] & m_port_bits[offset]) & m_port_bits[offset]);
+ u8 const diff(newval ^ m_port_input[offset]);
+ if (diff)
+ {
+ LOGIOPORT("read PORT%c: new input = %02X & %02X (was %02X)\n",
+ char('A' + offset), newval, ~m_port_ddr[offset] & m_port_bits[offset], m_port_input[offset]);
+ }
+ m_port_input[offset] = newval;
+ }
+ update_port_irq();
+ }
+ m_port_cb_w[offset](space, 0, port_value(offset), m_port_ddr[offset]);
+ }
+}
+
+
+READ8_MEMBER(m68hc05_device::tcr_r)
+{
+ return m_tcr;
+}
+
+WRITE8_MEMBER(m68hc05_device::tcr_w)
+{
+ data &= 0xe3;
+ LOGTIMER("write TCR: ICIE=%u OCIE=%u TOIE=%u IEDG=%u OLVL=%u\n",
+ BIT(data, 7), BIT(data, 6), BIT(data, 5), BIT(data, 1), BIT(data, 0));
+ m_tcr = data;
+ if (m_tcr & m_tsr & 0xe0)
+ m_pending_interrupts |= M68HC05_INT_TIMER;
+ else
+ m_pending_interrupts &= ~M68HC05_INT_TIMER;
+}
+
+READ8_MEMBER(m68hc05_device::tsr_r)
+{
+ if (!space.debugger_access())
+ {
+ u8 const events(m_tsr & ~m_tsr_seen);
+ if (events)
+ {
+ LOGTIMER("read TSR: seen%s%s%s\n",
+ BIT(events, 7) ? " ICF" : "", BIT(events, 6) ? " OCF" : "", BIT(events, 5) ? " TOF" : "");
+ }
+ m_tsr_seen = m_tsr;
+ }
+ return m_tsr;
+}
+
+READ8_MEMBER(m68hc05_device::icr_r)
+{
+ // reading IRCH inhibits capture until ICRL is read
+ // reading ICRL after reading TCR with ICF set clears ICF
+
+ u8 const low(BIT(offset, 0));
+ if (!space.debugger_access())
+ {
+ if (low)
+ {
+ if (BIT(m_tsr_seen, 7))
+ {
+ LOGTIMER("read ICRL, clear ICF\n");
+ m_tsr &= 0x7f;
+ m_tsr_seen &= 0x7f;
+ if (!(m_tcr & m_tsr & 0xe0)) m_pending_interrupts &= ~M68HC05_INT_TIMER;
+ }
+ if (m_inhibit_cap) LOGTIMER("read ICRL, enable capture\n");
+ m_inhibit_cap = false;
+ }
+ else
+ {
+ if (!m_inhibit_cap) LOGTIMER("read ICRH, inhibit capture\n");
+ m_inhibit_cap = true;
+ }
+ }
+ return u8(m_icr >> (low ? 0 : 8));
+}
+
+READ8_MEMBER(m68hc05_device::ocr_r)
+{
+ // reading OCRL after reading TCR with OCF set clears OCF
+
+ u8 const low(BIT(offset, 0));
+ if (!space.debugger_access() && low && BIT(m_tsr_seen, 6))
+ {
+ LOGTIMER("read OCRL, clear OCF\n");
+ m_tsr &= 0xbf;
+ m_tsr_seen &= 0xbf;
+ if (!(m_tcr & m_tsr & 0xe0)) m_pending_interrupts &= ~M68HC05_INT_TIMER;
+ }
+ return u8(m_ocr >> (low ? 0 : 8));
+}
+
+WRITE8_MEMBER(m68hc05_device::ocr_w)
{
+ // writing ORCH inhibits compare until OCRL is written
+ // writing OCRL after reading TCR with OCF set clears OCF
+
+ u8 const low(BIT(offset, 0));
+ if (!space.debugger_access())
+ {
+ if (low)
+ {
+ if (BIT(m_tsr_seen, 6))
+ {
+ LOGTIMER("write OCRL, clear OCF\n");
+ m_tsr &= 0xbf;
+ m_tsr_seen &= 0xbf;
+ if (!(m_tcr & m_tsr & 0xe0)) m_pending_interrupts &= ~M68HC05_INT_TIMER;
+ }
+ if (m_inhibit_cmp) LOGTIMER("write OCRL, enable compare\n");
+ m_inhibit_cmp = false;
+ }
+ else
+ {
+ if (!m_inhibit_cmp) LOGTIMER("write OCRH, inhibit compare\n");
+ m_inhibit_cmp = true;
+ }
+ }
+ m_ocr = (m_ocr & (low ? 0xff00 : 0x00ff)) | (u16(data) << (low ? 0 : 8));
+}
+
+READ8_MEMBER(m68hc05_device::timer_r)
+{
+ // reading [A]TRH returns current counter MSB and latches [A]TRL buffer
+ // reading [A]TRL returns current [A]TRL buffer and completes read sequence
+ // reading TRL after reading TSR with TOF set clears TOF
+ // reading ATRL doesn't affect TOF
+
+ u8 const low(BIT(offset, 0));
+ u8 const alt(BIT(offset, 1));
+ if (low)
+ {
+ if (!space.debugger_access())
+ {
+ if (m_trl_latched[alt]) LOGTIMER("read %sTRL, read sequence complete\n", alt ? "A" : "");
+ m_trl_latched[alt] = false;
+ if (!alt && BIT(m_tsr_seen, 5))
+ {
+ LOGTIMER("read TRL, clear TOF\n");
+ m_tsr &= 0xdf;
+ m_tsr_seen &= 0xdf;
+ if (!(m_tcr & m_tsr & 0xe0)) m_pending_interrupts &= ~M68HC05_INT_TIMER;
+ }
+ }
+ return m_trl_buf[alt];
+ }
+ else
+ {
+ if (!space.debugger_access() && !m_trl_latched[alt])
+ {
+ LOGTIMER("read %sTRH, latch %sTRL\n", alt ? "A" : "", alt ? "A" : "");
+ m_trl_latched[alt] = true;
+ m_trl_buf[alt] = u8(m_counter);
+ }
+ return u8(m_counter >> 8);
+ }
+}
+
+
+WRITE8_MEMBER(m68hc05_device::coprst_w)
+{
+ LOGCOP("write COPRST=%02x%s\n", data, ((0xaa == data) && (0x55 == m_coprst)) ? ", reset" : "");
+ if (0x55 == data)
+ {
+ m_coprst = data;
+ }
+ else if (0xaa == data)
+ {
+ if (0x55 == m_coprst) m_pcop_cnt &= 0x00007fff;
+ m_coprst = data;
+ }
+}
+
+READ8_MEMBER(m68hc05_device::copcr_r)
+{
+ if (copcr_copf()) LOGCOP("read COPCR, clear COPF\n");
+ u8 const result(m_copcr);
+ m_copcr &= 0xef;
+ return result;
}
+WRITE8_MEMBER(m68hc05_device::copcr_w)
+{
+ LOGCOP("write COPCR: CME=%u PCOPE=%u [%s] CM=%u\n",
+ BIT(data, 3), BIT(data, 2), (!copcr_pcope() && BIT(data, 2)) ? "set" : "ignored", data & 0x03);
+ m_copcr = (m_copcr & 0xf4) | (data & 0x0f); // PCOPE is set-only, hence the mask overlap
+}
+
+WRITE8_MEMBER(m68hc05_device::copr_w)
+{
+ LOGCOP("write COPR: COPC=%u\n", BIT(data, 0));
+ if (!BIT(data, 0)) m_ncop_cnt = 0;
+}
+
+
+void m68hc05_device::device_start()
+{
+ m6805_base_device::device_start();
+
+ // resolve callbacks
+ for (devcb_read8 &cb : m_port_cb_r) cb.resolve();
+ for (devcb_write8 &cb : m_port_cb_w) cb.resolve_safe();
+ m_tcmp_cb.resolve_safe();
+
+ // save digital I/O
+ save_item(NAME(m_port_interrupt));
+ save_item(NAME(m_port_input));
+ save_item(NAME(m_port_latch));
+ save_item(NAME(m_port_ddr));
+ save_item(NAME(m_port_irq_state));
+ save_item(NAME(m_irq_line_state));
+ save_item(NAME(m_irq_latch));
+
+ // save timer/counter
+ save_item(NAME(m_tcap_state));
+ save_item(NAME(m_tcr));
+ save_item(NAME(m_tsr));
+ save_item(NAME(m_tsr_seen));
+ save_item(NAME(m_prescaler));
+ save_item(NAME(m_counter));
+ save_item(NAME(m_icr));
+ save_item(NAME(m_ocr));
+ save_item(NAME(m_inhibit_cap));;
+ save_item(NAME(m_inhibit_cmp));
+ save_item(NAME(m_trl_buf));
+ save_item(NAME(m_trl_latched));
+
+ // save COP watchdogs
+ save_item(NAME(m_pcop_cnt));
+ save_item(NAME(m_ncop_cnt));
+ save_item(NAME(m_coprst));
+ save_item(NAME(m_copcr));
+ save_item(NAME(m_ncope));
+
+ // digital I/O state unaffected by reset
+ std::fill(std::begin(m_port_interrupt), std::end(m_port_interrupt), 0x00);
+ std::fill(std::begin(m_port_input), std::end(m_port_input), 0xff);
+ std::fill(std::begin(m_port_latch), std::end(m_port_latch), 0xff);
+ m_irq_line_state = false;
+
+ // timer state unaffected by reset
+ m_tcap_state = false;
+ m_tcr = 0x00;
+ m_tsr = 0x00;
+ m_icr = 0x0000;
+ m_ocr = 0x0000;
+
+ // COP watchdog state unaffected by reset
+ m_pcop_cnt = 0;
+ m_coprst = 0x00;
+ m_copcr = 0x00;
+ m_ncope = 0;
+
+ // expose most basic state to debugger
+ state_add(M68HC05_IRQLATCH, "IRQLATCH", m_irq_latch).mask(0x01);
+}
+
+void m68hc05_device::device_reset()
+{
+ m6805_base_device::device_reset();
+
+ // digital I/O reset
+ std::fill(std::begin(m_port_ddr), std::end(m_port_ddr), 0x00);
+ m_irq_latch = 0;
+ update_port_irq();
+
+ // timer reset
+ m_tcr &= 0x02;
+ m_tsr_seen = 0x00;
+ m_prescaler = 0;
+ m_counter = 0xfffc;
+ m_inhibit_cap = m_inhibit_cmp = false;
+ m_trl_buf[0] = m_trl_buf[1] = u8(m_counter);
+ m_trl_latched[0] = m_trl_latched[1] = false;
+
+ // COP watchdog reset
+ m_ncop_cnt = 0;
+ m_copcr &= 0x10;
+}
+
+
void m68hc05_device::execute_set_input(int inputnum, int state)
{
switch (inputnum)
{
- default:
- if (m_irq_state[inputnum] != state)
+ case M68HC05_IRQ_LINE:
+ if ((CLEAR_LINE != state) && !m_irq_line_state)
{
- m_irq_state[inputnum] = (state == ASSERT_LINE) ? ASSERT_LINE : CLEAR_LINE;
-
- if (state != CLEAR_LINE)
- m_pending_interrupts |= 1 << inputnum;
+ LOGINT("/IRQ edge%s\n", (m_port_irq_state || m_irq_latch) ? "" : ", set IRQ latch");
+ if (!m_port_irq_state)
+ {
+ m_irq_latch = 1;
+ m_pending_interrupts |= M68HC05_INT_IRQ;
+ }
}
+ m_irq_line_state = ASSERT_LINE == state;
+ break;
+ case M68HC05_TCAP_LINE:
+ if ((bool(state) != m_tcap_state) && (bool(state) == tcr_iedg()))
+ {
+ LOGTIMER("input capture %04X%s\n", m_counter, m_inhibit_cap ? " [inhibited]" : "");
+ if (!m_inhibit_cap)
+ {
+ m_tsr |= 0x80;
+ m_icr = m_counter;
+ if (m_tcr & m_tsr & 0xe0) m_pending_interrupts |= M68HC05_INT_TIMER;
+ }
+ }
+ m_tcap_state = bool(state);
+ break;
+ default:
+ fatalerror("m68hc05[%s]: unknown input line %d", tag(), inputnum);
}
}
-uint64_t m68hc05_device::execute_clocks_to_cycles(uint64_t clocks) const
+u64 m68hc05_device::execute_clocks_to_cycles(u64 clocks) const
{
return (clocks + 1) / 2;
}
-uint64_t m68hc05_device::execute_cycles_to_clocks(uint64_t cycles) const
+u64 m68hc05_device::execute_cycles_to_clocks(u64 cycles) const
{
return cycles * 2;
}
+
offs_t m68hc05_device::disasm_disassemble(
std::ostream &stream,
offs_t pc,
- const uint8_t *oprom,
- const uint8_t *opram,
- uint32_t options)
+ const u8 *oprom,
+ const u8 *opram,
+ u32 options)
{
return CPU_DISASSEMBLE_NAME(m68hc05)(this, stream, pc, oprom, opram, options);
}
+void m68hc05_device::interrupt()
+{
+ if ((m_pending_interrupts & M68HC05_INT_MASK) && !(CC & IFLAG))
+ {
+ pushword(m_pc);
+ pushbyte(m_x);
+ pushbyte(m_a);
+ pushbyte(m_cc);
+ SEI;
+ standard_irq_callback(0);
+
+ if (m_pending_interrupts & M68HC05_INT_IRQ)
+ {
+ LOGINT("servicing external interrupt\n");
+ m_irq_latch = 0;
+ m_pending_interrupts &= ~M68HC05_INT_IRQ;
+ rm16(M68HC05_VECTOR_IRQ, m_pc);
+ }
+ else if (m_pending_interrupts & M68HC05_INT_TIMER)
+ {
+ LOGINT("servicing timer interrupt\n");
+ rm16(M68HC05_VECTOR_TIMER, m_pc);
+ }
+ else
+ {
+ fatalerror("m68hc05[%s]: unknown pending interrupt(s) %x", tag(), m_pending_interrupts);
+ }
+ m_icount -= 10;
+ burn_cycles(10);
+ }
+}
+
+void m68hc05_device::burn_cycles(unsigned count)
+{
+ // calculate new timer values (fixed prescaler of four)
+ unsigned const ps_opt(4);
+ unsigned const ps_mask((1 << ps_opt) - 1);
+ unsigned const increments((count + (m_prescaler & ps_mask)) >> ps_opt);
+ u32 const new_counter(u32(m_counter) + increments);
+ bool const timer_rollover((0x010000 > m_counter) && (0x010000 <= new_counter));
+ bool const output_compare_match((m_ocr > m_counter) && (m_ocr <= new_counter));
+ m_prescaler = (count + m_prescaler) & ps_mask;
+ m_counter = u16(new_counter);
+ if (timer_rollover)
+ {
+ LOGTIMER("timer rollover\n");
+ m_tsr |= 0x20;
+ }
+ if (output_compare_match)
+ {
+ LOGTIMER("output compare match %s\n", m_inhibit_cmp ? " [inhibited]" : "");
+ if (!m_inhibit_cmp)
+ {
+ m_tsr |= 0x40;
+ m_tcmp_cb(tcr_olvl() ? 1 : 0);
+ }
+ }
+ if (m_tcr & m_tsr & 0xe0) m_pending_interrupts |= M68HC05_INT_TIMER;
+
+ // run programmable COP
+ u32 const pcop_timeout(u32(1) << ((copcr_cm() << 1) + 15));
+ if (copcr_pcope() && (pcop_timeout <= ((m_pcop_cnt & (pcop_timeout - 1)) + count)))
+ {
+ LOGCOP("PCOP reset\n");
+ m_copcr |= 0x10;
+ set_input_line(INPUT_LINE_RESET, PULSE_LINE);
+ }
+ m_pcop_cnt = (m_pcop_cnt + count) & ((u32(1) << 21) - 1);
+
+ // run non-programmable COP
+ m_ncop_cnt += count;
+ if ((u32(1) << 17) <= m_ncop_cnt)
+ {
+ set_input_line(INPUT_LINE_RESET, PULSE_LINE);
+ LOGCOP("NCOP reset\n");
+ }
+ m_ncop_cnt &= (u32(1) << 17) - 1;
+}
+
+
+void m68hc05_device::add_port_state(std::array<bool, PORT_COUNT> const &ddr)
+{
+ for (unsigned i = 0; PORT_COUNT > i; ++i)
+ {
+ if (m_port_bits[i])
+ state_add(M68HC05_LATCHA + i, util::string_format("LATCH%c", 'A' + i).c_str(), m_port_latch[i]).mask(m_port_bits[i]);
+ }
+ for (unsigned i = 0; PORT_COUNT > i; ++i)
+ {
+ if (ddr[i] && m_port_bits[i])
+ state_add(M68HC05_DDRA + i, util::string_format("DDR%c", 'A' + i).c_str(), m_port_ddr[i]).mask(m_port_bits[i]);
+ }
+}
+
+void m68hc05_device::add_timer_state()
+{
+ state_add(M68HC05_TCR, "TCR", m_tcr).mask(0x7f);
+ state_add(M68HC05_TSR, "TSR", m_tsr).mask(0xff);
+ state_add(M68HC05_ICR, "ICR", m_icr).mask(0xffff);
+ state_add(M68HC05_OCR, "OCR", m_ocr).mask(0xffff);
+ state_add(M68HC05_PS, "PS", m_prescaler).mask(0x03);
+ state_add(M68HC05_TR, "TR", m_counter).mask(0xffff);
+}
+
+void m68hc05_device::add_pcop_state()
+{
+ state_add(M68HC05_COPRST, "COPRST", m_coprst).mask(0xff);
+ state_add(M68HC05_COPCR, "COPCR", m_copcr).mask(0x1f);
+ state_add(M68HC05_PCOP, "PCOP", m_pcop_cnt).mask(0x001fffff);
+}
+
+void m68hc05_device::add_ncop_state()
+{
+ state_add(M68HC05_NCOPE, "NCOPE", m_ncope).mask(0x01);
+ state_add(M68HC05_NCOP, "NCOP", m_ncop_cnt).mask(0x0001ffff);
+}
+
+
+u8 m68hc05_device::port_value(unsigned offset) const
+{
+ return (m_port_latch[offset] & m_port_ddr[offset]) | (m_port_input[offset] & ~m_port_ddr[offset]);
+}
+
+void m68hc05_device::update_port_irq()
+{
+ u8 state(0x00);
+ for (unsigned i = 0; i < PORT_COUNT; ++i)
+ state |= m_port_interrupt[i] & ~m_port_ddr[i] & ~m_port_input[i];
+
+ if (bool(state) != m_port_irq_state)
+ {
+ LOGINT("I/O port IRQ state now %u%s\n",
+ state ? 1 : 0, (!m_irq_line_state && state && !m_irq_latch) ? ", set IRQ latch" : "");
+ m_port_irq_state = bool(state);
+ if (!m_irq_line_state && state)
+ {
+ m_irq_latch = 1;
+ m_pending_interrupts |= M68HC05_INT_IRQ;
+ }
+ }
+}
+
+
+
+/****************************************************************************
+ * M68HC705 base device
+ ****************************************************************************/
+
+m68hc705_device::m68hc705_device(
+ machine_config const &mconfig,
+ char const *tag,
+ device_t *owner,
+ u32 clock,
+ device_type type,
+ char const *name,
+ address_map_delegate internal_map,
+ char const *shortname,
+ char const *source)
+ : m68hc05_device(mconfig, tag, owner, clock, type, name, internal_map, shortname, source)
+{
+}
+
+
+
/****************************************************************************
* MC68HC05C4 device
****************************************************************************/
@@ -106,13 +731,8 @@ DEVICE_ADDRESS_MAP_START( c4_map, 8, m68hc05c4_device )
ADDRESS_MAP_GLOBAL_MASK(0x1fff)
ADDRESS_MAP_UNMAP_HIGH
- // 0x0000 PORTA
- // 0x0001 PORTB
- // 0x0002 PORTC
- // 0x0003 PORTD
- // 0x0004 DDRA
- // 0x0005 DDRB
- // 0x0006 DDRC
+ AM_RANGE(0x0000, 0x0003) AM_READWRITE(port_r, port_latch_w)
+ AM_RANGE(0x0004, 0x0006) AM_READWRITE(port_ddr_r, port_ddr_w)
// 0x0007-0x0009 unused
// 0x000a SPCR
// 0x000b SPSR
@@ -122,16 +742,11 @@ DEVICE_ADDRESS_MAP_START( c4_map, 8, m68hc05c4_device )
// 0x000f SCCR2
// 0x0010 SCSR
// 0x0011 SCDR
- // 0x0012 TCR
- // 0x0013 TDR
- // 0x0014 ICRH
- // 0x0015 ICRL
- // 0x0016 OCRH
- // 0x0017 OCRL
- // 0x0018 TRH
- // 0x0019 TRL
- // 0x001a ATRH
- // 0x001b ATRL
+ AM_RANGE(0x0012, 0x0012) AM_READWRITE(tcr_r, tcr_w)
+ AM_RANGE(0x0013, 0x0013) AM_READ(tsr_r)
+ AM_RANGE(0x0014, 0x0015) AM_READ(icr_r)
+ AM_RANGE(0x0016, 0x0017) AM_READWRITE(ocr_r, ocr_w)
+ AM_RANGE(0x0018, 0x001b) AM_READ(timer_r)
// 0x001c-0x001f unused
AM_RANGE(0x0020, 0x004f) AM_ROM // user ROM
AM_RANGE(0x0050, 0x00ff) AM_RAM // RAM/stack
@@ -142,7 +757,8 @@ DEVICE_ADDRESS_MAP_START( c4_map, 8, m68hc05c4_device )
AM_RANGE(0x1ff4, 0x1fff) AM_ROM // user vectors
ADDRESS_MAP_END
-m68hc05c4_device::m68hc05c4_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock)
+
+m68hc05c4_device::m68hc05c4_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock)
: m68hc05_device(
mconfig,
tag,
@@ -154,14 +770,192 @@ m68hc05c4_device::m68hc05c4_device(machine_config const &mconfig, char const *ta
"m68hc05c4",
__FILE__)
{
+ set_port_bits(std::array<u8, PORT_COUNT>{{ 0xff, 0xff, 0xff, 0xbf }});
}
+
+
+void m68hc05c4_device::device_start()
+{
+ m68hc05_device::device_start();
+
+ add_port_state(std::array<bool, PORT_COUNT>{{ true, true, true, false }});
+ add_timer_state();
+}
+
+
offs_t m68hc05c4_device::disasm_disassemble(
std::ostream &stream,
offs_t pc,
- const uint8_t *oprom,
- const uint8_t *opram,
- uint32_t options)
+ const u8 *oprom,
+ const u8 *opram,
+ u32 options)
+{
+ return CPU_DISASSEMBLE_NAME(m68hc05)(this, stream, pc, oprom, opram, options, m68hc05c4_syms);
+}
+
+
+
+/****************************************************************************
+ * MC68HC05C8 device
+ ****************************************************************************/
+
+DEVICE_ADDRESS_MAP_START( c8_map, 8, m68hc05c8_device )
+ ADDRESS_MAP_GLOBAL_MASK(0x1fff)
+ ADDRESS_MAP_UNMAP_HIGH
+
+ AM_RANGE(0x0000, 0x0003) AM_READWRITE(port_r, port_latch_w)
+ AM_RANGE(0x0004, 0x0006) AM_READWRITE(port_ddr_r, port_ddr_w)
+ // 0x0007-0x0009 unused
+ // 0x000a SPCR
+ // 0x000b SPSR
+ // 0x000c SPDR
+ // 0x000d BAUD
+ // 0x000e SCCR1
+ // 0x000f SCCR2
+ // 0x0010 SCSR
+ // 0x0011 SCDR
+ AM_RANGE(0x0012, 0x0012) AM_READWRITE(tcr_r, tcr_w)
+ AM_RANGE(0x0013, 0x0013) AM_READ(tsr_r)
+ AM_RANGE(0x0014, 0x0015) AM_READ(icr_r)
+ AM_RANGE(0x0016, 0x0017) AM_READWRITE(ocr_r, ocr_w)
+ AM_RANGE(0x0018, 0x001b) AM_READ(timer_r)
+ // 0x001c-0x001f unused
+ AM_RANGE(0x0020, 0x004f) AM_ROM // user ROM
+ AM_RANGE(0x0050, 0x00ff) AM_RAM // RAM/stack
+ AM_RANGE(0x0100, 0x1eff) AM_ROM // user ROM
+ AM_RANGE(0x1f00, 0x1fef) AM_ROM // self-check
+ // 0x1ff0-0x1ff3 unused
+ AM_RANGE(0x1ff4, 0x1fff) AM_ROM // user vectors
+ADDRESS_MAP_END
+
+
+m68hc05c8_device::m68hc05c8_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock)
+ : m68hc05_device(
+ mconfig,
+ tag,
+ owner,
+ clock,
+ M68HC05C8,
+ "MC68HC05C8",
+ address_map_delegate(FUNC(m68hc05c8_device::c8_map), this),
+ "m68hc05c8",
+ __FILE__)
+{
+ set_port_bits(std::array<u8, PORT_COUNT>{{ 0xff, 0xff, 0xff, 0xbf }});
+}
+
+
+void m68hc05c8_device::device_start()
+{
+ m68hc05_device::device_start();
+
+ add_port_state(std::array<bool, PORT_COUNT>{{ true, true, true, false }});
+ add_timer_state();
+}
+
+
+offs_t m68hc05c8_device::disasm_disassemble(
+ std::ostream &stream,
+ offs_t pc,
+ const u8 *oprom,
+ const u8 *opram,
+ u32 options)
+{
+ // same I/O registers as MC68HC05C4
+ return CPU_DISASSEMBLE_NAME(m68hc05)(this, stream, pc, oprom, opram, options, m68hc05c4_syms);
+}
+
+
+
+/****************************************************************************
+ * MC68HC705C8A device
+ ****************************************************************************/
+
+DEVICE_ADDRESS_MAP_START( c8a_map, 8, m68hc705c8a_device )
+ ADDRESS_MAP_GLOBAL_MASK(0x1fff)
+ ADDRESS_MAP_UNMAP_HIGH
+
+ AM_RANGE(0x0000, 0x0003) AM_READWRITE(port_r, port_latch_w)
+ AM_RANGE(0x0004, 0x0006) AM_READWRITE(port_ddr_r, port_ddr_w)
+ // 0x0007-0x0009 unused
+ // 0x000a SPCR
+ // 0x000b SPSR
+ // 0x000c SPDR
+ // 0x000d BAUD
+ // 0x000e SCCR1
+ // 0x000f SCCR2
+ // 0x0010 SCSR
+ // 0x0011 SCDR
+ AM_RANGE(0x0012, 0x0012) AM_READWRITE(tcr_r, tcr_w)
+ AM_RANGE(0x0013, 0x0013) AM_READ(tsr_r)
+ AM_RANGE(0x0014, 0x0015) AM_READ(icr_r)
+ AM_RANGE(0x0016, 0x0017) AM_READWRITE(ocr_r, ocr_w)
+ AM_RANGE(0x0018, 0x001b) AM_READ(timer_r)
+ // 0x001c PROG
+ AM_RANGE(0x001d, 0x001d) AM_WRITE(coprst_w)
+ AM_RANGE(0x001e, 0x001e) AM_READWRITE(copcr_r, copcr_w)
+ // 0x001f unused
+ AM_RANGE(0x0020, 0x004f) AM_ROM // user PROM FIXME: banked with RAM
+ AM_RANGE(0x0050, 0x00ff) AM_RAM // RAM/stack
+ AM_RANGE(0x0100, 0x015f) AM_ROM // user PROM FIXME: banked with RAM
+ AM_RANGE(0x0160, 0x1eff) AM_ROM // user PROM
+ AM_RANGE(0x1f00, 0x1fde) AM_ROM AM_REGION("bootstrap", 0x0000) // bootloader
+ // 0x1fdf option register FIXME: controls banking
+ AM_RANGE(0x1fe0, 0x1fef) AM_ROM AM_REGION("bootstrap", 0x00e0) // boot ROM vectors
+ AM_RANGE(0x1ff0, 0x1ff0) AM_WRITE(copr_w)
+ AM_RANGE(0x1ff0, 0x1fff) AM_ROM // user vectors
+ADDRESS_MAP_END
+
+
+m68hc705c8a_device::m68hc705c8a_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock)
+ : m68hc705_device(
+ mconfig,
+ tag,
+ owner,
+ clock,
+ M68HC705C8A,
+ "MC68HC705C8A",
+ address_map_delegate(FUNC(m68hc705c8a_device::c8a_map), this),
+ "m68hc705c8a",
+ __FILE__)
+{
+ set_port_bits(std::array<u8, PORT_COUNT>{{ 0xff, 0xff, 0xff, 0xbf }});
+}
+
+
+tiny_rom_entry const *m68hc705c8a_device::device_rom_region() const
+{
+ return ROM_NAME(m68hc705c8a);
+}
+
+
+void m68hc705c8a_device::device_start()
+{
+ m68hc705_device::device_start();
+
+ add_port_state(std::array<bool, PORT_COUNT>{{ true, true, true, false }});
+ add_timer_state();
+ add_pcop_state();
+ add_ncop_state();
+}
+
+void m68hc705c8a_device::device_reset()
+{
+ m68hc705_device::device_reset();
+
+ // latch MOR registers on reset
+ set_port_interrupt(std::array<u8, PORT_COUNT>{{ 0x00, u8(rdmem(0xfff0)), 0x00, 0x00 }});
+ set_ncope(BIT(rdmem(0xfff1), 0));
+}
+
+
+offs_t m68hc705c8a_device::disasm_disassemble(
+ std::ostream &stream,
+ offs_t pc,
+ const u8 *oprom,
+ const u8 *opram,
+ u32 options)
{
- return CPU_DISASSEMBLE_NAME(m68hc05)(this, stream, pc, oprom, opram, options, m68705c4_syms);
+ return CPU_DISASSEMBLE_NAME(m68hc05)(this, stream, pc, oprom, opram, options, m68hc705c8a_syms);
}
diff --git a/src/devices/cpu/m6805/m68hc05.h b/src/devices/cpu/m6805/m68hc05.h
index e32c838360b..cd0de3a31c0 100644
--- a/src/devices/cpu/m6805/m68hc05.h
+++ b/src/devices/cpu/m6805/m68hc05.h
@@ -7,12 +7,16 @@
#include "m6805.h"
+#include <array>
+
//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
extern device_type const M68HC05C4;
+extern device_type const M68HC05C8;
+extern device_type const M68HC705C8A;
//**************************************************************************
@@ -21,9 +25,83 @@ extern device_type const M68HC05C4;
// ======================> m68hc05_device
+#define MCFG_M68HC05_PORTA_R_CB(obj) \
+ devcb = &m68hc05_device::set_port_cb_r<0>(*device, DEVCB_##obj);
+
+#define MCFG_M68HC05_PORTB_R_CB(obj) \
+ devcb = &m68hc05_device::set_port_cb_r<1>(*device, DEVCB_##obj);
+
+#define MCFG_M68HC05_PORTC_R_CB(obj) \
+ devcb = &m68hc05_device::set_port_cb_r<2>(*device, DEVCB_##obj);
+
+#define MCFG_M68HC05_PORTD_R_CB(obj) \
+ devcb = &m68hc05_device::set_port_cb_r<3>(*device, DEVCB_##obj);
+
+#define MCFG_M68HC05_PORTA_W_CB(obj) \
+ devcb = &m68hc05_device::set_port_cb_w<0>(*device, DEVCB_##obj);
+
+#define MCFG_M68HC05_PORTB_W_CB(obj) \
+ devcb = &m68hc05_device::set_port_cb_w<1>(*device, DEVCB_##obj);
+
+#define MCFG_M68HC05_PORTC_W_CB(obj) \
+ devcb = &m68hc05_device::set_port_cb_w<2>(*device, DEVCB_##obj);
+
+#define MCFG_M68HC05_PORTD_W_CB(obj) \
+ devcb = &m68hc05_device::set_port_cb_w<3>(*device, DEVCB_##obj);
+
+#define MCFG_M68HC05_TCMP_CB(obj) \
+ devcb = &m68hc05_device::set_tcmp_cb(*device, DEVCB_##obj);
+
+
class m68hc05_device : public m6805_base_device
{
+public:
+ // static configuration helpers
+ template<std::size_t N, typename Object> static devcb_base &set_port_cb_r(device_t &device, Object &&obj)
+ { return downcast<m68hc05_device &>(device).m_port_cb_r[N].set_callback(std::forward<Object>(obj)); }
+ template<std::size_t N, typename Object> static devcb_base &set_port_cb_w(device_t &device, Object &&obj)
+ { return downcast<m68hc05_device &>(device).m_port_cb_w[N].set_callback(std::forward<Object>(obj)); }
+ template<typename Object> static devcb_base &set_tcmp_cb(device_t &device, Object &&obj)
+ { return downcast<m68hc05_device &>(device).m_tcmp_cb.set_callback(std::forward<Object>(obj)); }
+
protected:
+ // state index constants
+ enum
+ {
+ M68HC05_A = M6805_A,
+ M68HC05_PC = M6805_PC,
+ M68HC05_S = M6805_S,
+ M68HC05_X = M6805_X,
+ M68HC05_CC = M6805_CC,
+ M68HC05_IRQ_STATE = M6805_IRQ_STATE,
+
+ M68HC05_IRQLATCH = 0x10,
+
+ M68HC05_LATCHA,
+ M68HC05_LATCHB,
+ M68HC05_LATCHC,
+ M68HC05_LATCHD,
+ M68HC05_DDRA,
+ M68HC05_DDRB,
+ M68HC05_DDRC,
+ M68HC05_DDRD,
+
+ M68HC05_TCR,
+ M68HC05_TSR,
+ M68HC05_ICR,
+ M68HC05_OCR,
+ M68HC05_PS,
+ M68HC05_TR,
+
+ M68HC05_COPRST,
+ M68HC05_COPCR,
+ M68HC05_PCOP,
+ M68HC05_NCOPE,
+ M68HC05_NCOP
+ };
+
+ enum { PORT_COUNT = 4 };
+
m68hc05_device(
machine_config const &mconfig,
char const *tag,
@@ -35,16 +113,112 @@ protected:
char const *shortname,
char const *source);
+ void set_port_bits(std::array<u8, PORT_COUNT> const &bits);
+ void set_port_interrupt(std::array<u8, PORT_COUNT> const &interrupt);
+ DECLARE_READ8_MEMBER(port_r);
+ DECLARE_WRITE8_MEMBER(port_latch_w);
+ DECLARE_READ8_MEMBER(port_ddr_r);
+ DECLARE_WRITE8_MEMBER(port_ddr_w);
+
+ DECLARE_READ8_MEMBER(tcr_r);
+ DECLARE_WRITE8_MEMBER(tcr_w);
+ DECLARE_READ8_MEMBER(tsr_r);
+ DECLARE_READ8_MEMBER(icr_r);
+ DECLARE_READ8_MEMBER(ocr_r);
+ DECLARE_WRITE8_MEMBER(ocr_w);
+ DECLARE_READ8_MEMBER(timer_r);
+
+ void set_ncope(bool state) { m_ncope = state ? 1 : 0; }
+ DECLARE_WRITE8_MEMBER(coprst_w);
+ DECLARE_READ8_MEMBER(copcr_r);
+ DECLARE_WRITE8_MEMBER(copcr_w);
+ DECLARE_WRITE8_MEMBER(copr_w);
+
+ virtual void device_start() override;
+ virtual void device_reset() override;
+
virtual void execute_set_input(int inputnum, int state) override;
- virtual uint64_t execute_clocks_to_cycles(uint64_t clocks) const override;
- virtual uint64_t execute_cycles_to_clocks(uint64_t cycles) const override;
+ virtual u64 execute_clocks_to_cycles(u64 clocks) const override;
+ virtual u64 execute_cycles_to_clocks(u64 cycles) const override;
virtual offs_t disasm_disassemble(
std::ostream &stream,
offs_t pc,
- const uint8_t *oprom,
+ const u8 *oprom,
const uint8_t *opram,
- uint32_t options) override;
+ u32 options) override;
+
+ virtual void interrupt() override;
+ virtual void burn_cycles(unsigned count) override;
+
+ void add_port_state(std::array<bool, PORT_COUNT> const &ddr);
+ void add_timer_state();
+ void add_pcop_state();
+ void add_ncop_state();
+
+private:
+ u8 port_value(unsigned offset) const;
+ void update_port_irq();
+
+ bool tcr_icie() const { return BIT(m_tcr, 7); }
+ bool tcr_ocie() const { return BIT(m_tcr, 6); }
+ bool tcr_toie() const { return BIT(m_tcr, 5); }
+ bool tcr_iedg() const { return BIT(m_tcr, 1); }
+ bool tcr_olvl() const { return BIT(m_tcr, 0); }
+
+ bool tsr_icf() const { return BIT(m_tsr, 7); }
+ bool tsr_ocf() const { return BIT(m_tsr, 6); }
+ bool tsr_tof() const { return BIT(m_tsr, 5); }
+
+ bool copcr_copf() const { return BIT(m_copcr, 4); }
+ bool copcr_cme() const { return BIT(m_copcr, 3); }
+ bool copcr_pcope() const { return BIT(m_copcr, 2); }
+ u8 copcr_cm() const { return m_copcr & 0x03; }
+
+ // digital I/O
+ devcb_read8 m_port_cb_r[PORT_COUNT];
+ devcb_write8 m_port_cb_w[PORT_COUNT];
+ u8 m_port_bits[PORT_COUNT];
+ u8 m_port_interrupt[PORT_COUNT];
+ u8 m_port_input[PORT_COUNT];
+ u8 m_port_latch[PORT_COUNT];
+ u8 m_port_ddr[PORT_COUNT];
+ bool m_port_irq_state, m_irq_line_state;
+ u8 m_irq_latch;
+
+ // timer/counter
+ devcb_write_line m_tcmp_cb;
+ bool m_tcap_state;
+ u8 m_tcr;
+ u8 m_tsr, m_tsr_seen;
+ u8 m_prescaler;
+ u16 m_counter, m_icr, m_ocr;
+ bool m_inhibit_cap, m_inhibit_cmp;
+ u8 m_trl_buf[2];
+ bool m_trl_latched[2];
+
+ // COP watchdogs
+ u32 m_pcop_cnt, m_ncop_cnt;
+ u8 m_coprst, m_copcr;
+ u8 m_ncope;
+};
+
+
+// ======================> m68hc705_device
+
+class m68hc705_device : public m68hc05_device
+{
+protected:
+ m68hc705_device(
+ machine_config const &mconfig,
+ char const *tag,
+ device_t *owner,
+ u32 clock,
+ device_type type,
+ char const *name,
+ address_map_delegate internal_map,
+ char const *shortname,
+ char const *source);
};
@@ -58,12 +232,67 @@ public:
protected:
DECLARE_ADDRESS_MAP(c4_map, 8);
+ virtual void device_start() override;
+
virtual offs_t disasm_disassemble(
std::ostream &stream,
offs_t pc,
- const uint8_t *oprom,
- const uint8_t *opram,
- uint32_t options) override;
+ const u8 *oprom,
+ const u8 *opram,
+ u32 options) override;
};
+
+// ======================> m68hc05c8_device
+
+class m68hc05c8_device : public m68hc05_device
+{
+public:
+ m68hc05c8_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock);
+
+protected:
+ DECLARE_ADDRESS_MAP(c8_map, 8);
+
+ virtual void device_start() override;
+
+ virtual offs_t disasm_disassemble(
+ std::ostream &stream,
+ offs_t pc,
+ const u8 *oprom,
+ const u8 *opram,
+ u32 options) override;
+};
+
+
+// ======================> m68hc705c8a_device
+
+class m68hc705c8a_device : public m68hc705_device
+{
+public:
+ m68hc705c8a_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock);
+
+protected:
+ DECLARE_ADDRESS_MAP(c8a_map, 8);
+
+ virtual tiny_rom_entry const *device_rom_region() const override;
+
+ virtual void device_start() override;
+ virtual void device_reset() override;
+
+ virtual offs_t disasm_disassemble(
+ std::ostream &stream,
+ offs_t pc,
+ const u8 *oprom,
+ const u8 *opram,
+ u32 options) override;
+};
+
+
+/****************************************************************************
+ * 68HC05 section
+ ****************************************************************************/
+
+#define M68HC05_IRQ_LINE (M6805_IRQ_LINE + 0)
+#define M68HC05_TCAP_LINE (M6805_IRQ_LINE + 1)
+
#endif // MAME_CPU_M6805_M68HC05_H
diff --git a/src/devices/cpu/pic16c5x/pic16c5x.cpp b/src/devices/cpu/pic16c5x/pic16c5x.cpp
index 09279821e06..3fe90d8e225 100644
--- a/src/devices/cpu/pic16c5x/pic16c5x.cpp
+++ b/src/devices/cpu/pic16c5x/pic16c5x.cpp
@@ -42,6 +42,12 @@
* do not have Port-C implemented. *
* TLP (07-Sep-2009) Ver 1.14 *
* - Edge sense control for the T0 count input was incorrectly reversed *
+ * LE (05-Feb-2017) Ver 1.15 *
+ * - Allow writing all bits of the status register except TO and PD. *
+ * This enables e.g. bcf, bsf or clrf to change the flags when the *
+ * status register is the destination. *
+ * - Changed rlf and rrf to update the carry flag in the last step. *
+ * Fixes the case where the status register is the destination. *
* *
* *
* **** Notes: **** *
@@ -381,7 +387,7 @@ void pic16c5x_device::STORE_REGFILE(offs_t addr, uint8_t data) /* Write to in
case 02: PCL = data;
m_PC = ((STATUS & PA_REG) << 4) | data;
break;
- case 03: STATUS &= (uint8_t)(~PA_REG); STATUS |= (data & PA_REG);
+ case 03: STATUS = (STATUS & (TO_FLAG | PD_FLAG)) | (data & (uint8_t)(~(TO_FLAG | PD_FLAG)));
break;
case 04: FSR = (data | (uint8_t)(~m_picRAMmask));
break;
@@ -432,6 +438,14 @@ void pic16c5x_device::illegal()
logerror("PIC16C5x: PC=%03x, Illegal opcode = %04x\n", (m_PC-1), m_opcode.w.l);
}
+/*
+ Note:
+ According to the manual, if the STATUS register is the destination for an instruction that affects the Z, DC or C bits
+ then the write to these three bits is disabled. These bits are set or cleared according to the device logic.
+ To ensure this is correctly emulated, in instructions that write to the file registers, always change the status flags
+ *after* storing the result of the instruction.
+ e.g. CALCULATE_*, SET(STATUS,*_FLAG) and CLR(STATUS,*_FLAG) should appear as the last steps of the instruction emulation.
+*/
void pic16c5x_device::addwf()
{
@@ -622,21 +636,23 @@ void pic16c5x_device::retlw()
void pic16c5x_device::rlf()
{
m_ALU = GET_REGFILE(ADDR);
+ uint8_t bit7 = m_ALU & 0x80;
m_ALU <<= 1;
if (STATUS & C_FLAG) m_ALU |= 1;
- if (GET_REGFILE(ADDR) & 0x80) SET(STATUS, C_FLAG);
- else CLR(STATUS, C_FLAG);
STORE_RESULT(ADDR, m_ALU);
+ if (bit7) SET(STATUS, C_FLAG);
+ else CLR(STATUS, C_FLAG);
}
void pic16c5x_device::rrf()
{
m_ALU = GET_REGFILE(ADDR);
+ uint8_t bit0 = m_ALU & 1;
m_ALU >>= 1;
if (STATUS & C_FLAG) m_ALU |= 0x80;
- if (GET_REGFILE(ADDR) & 1) SET(STATUS, C_FLAG);
- else CLR(STATUS, C_FLAG);
STORE_RESULT(ADDR, m_ALU);
+ if (bit0) SET(STATUS, C_FLAG);
+ else CLR(STATUS, C_FLAG);
}
void pic16c5x_device::sleepic()
diff --git a/src/devices/cpu/tlcs870/tlcs870.cpp b/src/devices/cpu/tlcs870/tlcs870.cpp
new file mode 100644
index 00000000000..ff20237779e
--- /dev/null
+++ b/src/devices/cpu/tlcs870/tlcs870.cpp
@@ -0,0 +1,3245 @@
+// license:BSD-3-Clause
+// copyright-holders:David Haywood
+/*************************************************************************************************************
+
+ Toshiba TLCS-870 Series MCUs
+
+ The TLCS-870/X expands on this instruction set using the same base encoding.
+
+ The TLCS-870/C appears to have a completely different encoding.
+
+ loosely baesd on the tlcs90 core by Luca Elia
+
+*************************************************************************************************************/
+
+
+
+#include "emu.h"
+#include "debugger.h"
+#include "tlcs870.h"
+
+// di, ei, j, and test are just 'alias' opcodes
+static const char *const op_names[] = {
+ "??",
+ "call", "callp", "callv", "clr", "cpl",
+ "daa", "das", "dec", /*"di",*/ "div",
+ /*"ei",*/
+ "inc",
+ /*"j",*/ "jp", "jr", "jrs",
+ "ld", "ldw",
+ "mcmp", "mul",
+ "nop",
+ "pop", "push",
+ "ret", "reti", "retn", "rolc", "rold", "rorc", "rord",
+ "set", "shlc", "shrc", "swap", "swi",
+ /*"test",*/ "xch",
+ // ALU operations
+ "addc",
+ "add",
+ "subb",
+ "sub",
+ "and",
+ "xor",
+ "or",
+ "cmp",
+};
+
+
+
+
+static const char *const reg8[] = {
+ "A",
+ "W",
+ "C",
+ "B",
+ "E",
+ "D",
+ "L",
+ "H"
+};
+
+static const char *const type_x[] = {
+ "(x)",
+ "(PC+A)",
+ "(DE)",
+ "(HL)",
+ "(HL+d)",
+ "(HL+C)",
+ "(HL+)",
+ "(-HL)",
+};
+
+static const char *const conditions[] = {
+ "EQ/Z",
+ "NE/NZ",
+ "LT/CS",
+ "GE/CC",
+ "LE",
+ "GT",
+ "T",
+ "F",
+};
+
+static const char *const reg16[] = {
+ "WA",
+ "BC",
+ "DE",
+ "HL"
+};
+
+#ifdef UNUSED_DEFINTION
+static const char *const reg16p[] = {
+ "DE",
+ "HL"
+};
+#endif
+
+
+
+const device_type TMP87PH40AN = &device_creator<tmp87ph40an_device>;
+
+static ADDRESS_MAP_START(tmp87ph40an_mem, AS_PROGRAM, 8, tlcs870_device)
+#if 0
+ AM_RANGE(0x0000, 0x0000) AM_READWRITE(port0_r,port0_w)
+ AM_RANGE(0x0001, 0x0001) AM_READWRITE(port1_r,port1_w)
+ AM_RANGE(0x0002, 0x0002) AM_READWRITE(port2_r,port2_w)
+ AM_RANGE(0x0003, 0x0003) AM_READWRITE(port3_r,port3_w)
+ AM_RANGE(0x0004, 0x0004) AM_READWRITE(port4_r,port4_w)
+ AM_RANGE(0x0005, 0x0005) AM_READWRITE(port5_r,port5_w)
+ AM_RANGE(0x0006, 0x0006) AM_READWRITE(port6_r,port6_w)
+ AM_RANGE(0x0007, 0x0007) AM_READWRITE(port7_r,port7_w)
+ // 0x8 reserved
+ // 0x9 reserved
+ AM_RANGE(0x000a, 0x000a) AM_WRITE(p0cr_w) // Port 0 I/O control
+ AM_RANGE(0x000b, 0x000b) AM_WRITE(p1cr_w) // Port 1 I/O control
+ AM_RANGE(0x000c, 0x000c) AM_WRITE(p6cr_w) // Port 6 I/O control
+ AM_RANGE(0x000d, 0x000d) AM_WRITE(p7cr_w) // Port 7 I/O control
+ AM_RANGE(0x000e, 0x000e) AM_READWRITE(adccr_r,adccr_w) // A/D converter control
+ AM_RANGE(0x000f, 0x000f) AM_READ(adcdr_r) // A/D converter result
+
+ AM_RANGE(0x0010, 0x0010) AM_WRITE(treg1a_l_w) // Timer register 1A
+ AM_RANGE(0x0011, 0x0011) AM_WRITE(treg1a_h_w) //
+ AM_RANGE(0x0012, 0x0012) AM_READWRITE(treg1b_l_r, treg1b_l_w) // Timer register 1B
+ AM_RANGE(0x0013, 0x0013) AM_READWRITE(treg1b_h_r, treg1b_h_w) //
+ AM_RANGE(0x0014, 0x0014) AM_WRITE(tc1cr_w) // TC1 control
+ AM_RANGE(0x0015, 0x0015) AM_WRITE(tc2cr_w) // TC2 control
+ AM_RANGE(0x0016, 0x0016) AM_WRITE(treg2_l_w) // Timer register 2
+ AM_RANGE(0x0017, 0x0017) AM_WRITE(treg2_h_w) //
+ AM_RANGE(0x0018, 0x0018) AM_READWRITE(treg3a_r, treg3a_w) // Timer register 3A
+ AM_RANGE(0x0019, 0x0019) AM_READ(treg3b_r) // Timer register 3B
+ AM_RANGE(0x001a, 0x001a) AM_WRITE(tc3cr_w) // TC3 control
+ AM_RANGE(0x001b, 0x001b) AM_READ(treg4_r) // Timer register 4
+ AM_RANGE(0x001c, 0x001c) AM_WRITE(tc4cr_w) // TC4 control
+ // 0x1d reserved
+ // 0x1e reserved
+ // 0x1f reserved
+
+ AM_RANGE(0x0020, 0x0020) AM_READWRITE(sio1sr_r, sio1cr1_w) // SIO1 status / SIO1 control
+ AM_RANGE(0x0021, 0x0021) AM_WRITE(sio1cr2_w) // SIO1 control
+ AM_RANGE(0x0022, 0x0022) AM_READWRITE(sio2sr_r, sio2cr1_w) // SIO2 status / SIO2 control
+ AM_RANGE(0x0023, 0x0023) AM_WRITE(sio2cr2_w) // SIO2 control
+ // 0x24 reserved
+ // 0x25 reserved
+ // 0x26 reserved
+ // 0x27 reserved
+ // 0x28 reserved
+ // 0x29 reserved
+ // 0x2a reserved
+ // 0x2b reserved
+ // 0x2c reserved
+ // 0x2d reserved
+ // 0x2e reserved
+ // 0x2f reserved
+
+ // 0x30 reserved
+ // 0x31 reserved
+ // 0x32 reserved
+ // 0x33 reserved
+ AM_RANGE(0x0034, 0x0034) AM_WRITE(wdtcr1_w) // WDT control
+ AM_RANGE(0x0035, 0x0035) AM_WRITE(wdtcr2_w) //
+
+ AM_RANGE(0x0036, 0x0036) AM_READWRITE(tbtcr_r, tbtcr_w) // TBT / TG / DVO control
+ AM_RANGE(0x0037, 0x0037) AM_READWRITE(eintcr_r, eintcr_w) // External interrupt control
+
+ AM_RANGE(0x0038, 0x0038) AM_READWRITE(syscr1_r, syscr1_w) // System Control
+ AM_RANGE(0x0039, 0x0039) AM_READWRITE(syscr2_r, syscr2_w) //
+
+ AM_RANGE(0x003a, 0x003a) AM_READWRITE(eir_l_r, eir_l_w) // Interrupt enable register
+ AM_RANGE(0x003b, 0x003b) AM_READWRITE(eir_h_r, eir_h_w) //
+
+ AM_RANGE(0x003c, 0x003c) AM_READWRITE(il_l_r, il_l_w) // Interrupt latch
+ AM_RANGE(0x003d, 0x003d) AM_READWRITE(il_h_r, il_h_w) //
+ // 0x3e reserved
+ AM_RANGE(0x003f, 0x003f) AM_READWRITE(psw_r, rbs_w) // Program status word / Register bank selector
+#endif
+
+ AM_RANGE(0x0040, 0x023f) AM_RAM AM_SHARE("intram") // register banks + internal RAM, not, code execution NOT allowed here
+ AM_RANGE(0x0f80, 0x0fff) AM_RAM // DBR
+ AM_RANGE(0xc000, 0xffff) AM_ROM
+ADDRESS_MAP_END
+
+
+tlcs870_device::tlcs870_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source, address_map_constructor program_map)
+ : cpu_device(mconfig, type, name, tag, owner, clock, shortname, source)
+ , m_program_config("program", ENDIANNESS_LITTLE, 8, 16, 0, program_map)
+ , m_io_config("io", ENDIANNESS_LITTLE, 8, 16, 0)
+ , m_intram(*this, "intram")
+{
+}
+
+
+tmp87ph40an_device::tmp87ph40an_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+ : tlcs870_device(mconfig, TMP87PH40AN, "TMP87PH40AN", tag, owner, clock, "tmp87ph40an", __FILE__, ADDRESS_MAP_NAME(tmp87ph40an_mem))
+{
+}
+
+uint8_t tlcs870_device::RM8 (uint32_t a) { return m_program->read_byte( a ); }
+uint16_t tlcs870_device::RM16(uint32_t a) { return RM8(a) | (RM8( (a+1) & 0xffff ) << 8); }
+
+void tlcs870_device::WM8 (uint32_t a, uint8_t v) { m_program->write_byte( a, v ); }
+void tlcs870_device::WM16(uint32_t a, uint16_t v) { WM8(a,v); WM8( (a+1) & 0xffff, v >> 8); }
+
+uint8_t tlcs870_device::RX8 (uint32_t a, uint32_t base) { return m_program->read_byte( base | a ); }
+uint16_t tlcs870_device::RX16(uint32_t a, uint32_t base) { return RX8(a,base) | (RX8( (a+1) & 0xffff, base ) << 8); }
+
+void tlcs870_device::WX8 (uint32_t a, uint8_t v, uint32_t base) { m_program->write_byte( base | a, v ); }
+void tlcs870_device::WX16(uint32_t a, uint16_t v, uint32_t base) { WX8(a,v,base); WX8( (a+1) & 0xffff, v >> 8, base); }
+
+uint8_t tlcs870_device::READ8() { uint8_t b0 = RM8( m_addr++ ); m_addr &= 0xffff; return b0; }
+uint16_t tlcs870_device::READ16() { uint8_t b0 = READ8(); return b0 | (READ8() << 8); }
+
+void tlcs870_device::decode()
+{
+ m_op = 0;
+ m_param1_type = 0;
+ m_param1 = 0;
+ m_param2_type = 0;
+ m_param2 = 0;
+ m_bitpos = 0;
+ m_cycles = 1;
+ m_flagsaffected = 0; // needed to signal which flags to change and which to leave alone in some cases (LD operations at least)
+
+ uint8_t b0;
+ uint8_t b1;
+
+ int tmppc = m_addr;
+
+ b0 = READ8();
+
+
+ switch (b0)
+ {
+ case 0x00:
+ m_op = NOP;
+ // NOP;
+ break;
+
+ case 0x01:
+ // SWAP A
+ m_op = SWAP;
+
+ m_param1_type = REG_8BIT;
+ m_param1 = 0; // A
+ break;
+
+ case 0x02:
+ // MUL W,A
+ m_op = MUL;
+
+ m_param1_type = REG_8BIT;
+ m_param1 = 1; // W
+
+ m_param2_type = REG_8BIT;
+ m_param2 = 0; // A
+ break;
+
+ case 0x03:
+ // DIV WA,C
+ m_op = DIV;
+
+ m_param1_type = REG_16BIT;
+ m_param1 = 0; // WA
+
+ m_param2_type = REG_8BIT;
+ m_param2 = 2; // C
+ break;
+
+ case 0x04:
+ // RETI
+ m_op = RETI;
+ break;
+
+ case 0x05:
+ // RET
+ m_op = RET;
+ break;
+
+ case 0x06:
+ // POP PSW
+ m_op = POP;
+ m_param1_type = PROGRAMSTATUSWORD;
+ break;
+
+ case 0x07:
+ // PUSH PSW:
+ m_op = PUSH;
+ m_param1_type = PROGRAMSTATUSWORD;
+ break;
+
+ case 0x08:
+ case 0x09:
+ // unused?
+ break;
+
+ case 0x0a:
+ // DAA A
+ m_op = DAA;
+
+ m_param1_type = REG_8BIT;
+ m_param1 = 0; // A
+ break;
+
+ case 0x0b:
+ // DAS A
+ m_op = DAS;
+
+ m_param1_type = REG_8BIT;
+ m_param1 = 0; // A
+ break;
+
+ case 0x0c:
+ // CLR CF
+ m_op = CLR;
+
+ m_param1_type = CARRYFLAG; // 16-bit register
+ //m_param1 = 0;
+ break;
+
+ case 0x0d:
+ // SET CF
+ m_op = SET;
+
+ m_param1_type = CARRYFLAG; // 16-bit register
+ //m_param1 = 0;
+ break;
+
+ case 0x0e:
+ // CPL CF
+ m_op = CPL;
+
+ m_param1_type = CARRYFLAG; // 16-bit register
+ //m_param1 = 0;
+ break;
+
+ case 0x0f:
+ // LD RBS,n
+ m_op = LD; // Flags / Cycles 1--- / 2
+ m_flagsaffected |= FLAG_J;
+
+ m_param1_type = REGISTERBANK; // 4-bit register
+ //m_param1 = 0;
+
+ m_param2_type = ABSOLUTE_VAL_8;
+ m_param2 = READ8();
+
+ break;
+
+ case 0x10:
+ case 0x11:
+ case 0x12:
+ case 0x13:
+ // INC rr
+ m_op = INC;
+
+ m_param1_type = REG_16BIT; // 16-bit register
+ m_param1 = b0&3;
+
+ break;
+
+ case 0x14:
+ case 0x15:
+ case 0x16:
+ case 0x17:
+ // LD rr,mn
+ m_op = LD; // Flags / Cycles 1--- / 3
+ m_flagsaffected |= FLAG_J;
+
+ m_param1_type = REG_16BIT; // 16-bit register
+ m_param1 = b0&3;
+
+ m_param2_type = ABSOLUTE_VAL_16; // absolute value
+ m_param2 = READ16(); // 16-bit
+
+ break;
+
+ case 0x18:
+ case 0x19:
+ case 0x1a:
+ case 0x1b:
+ // DEC rr
+ m_op = DEC;
+
+ m_param1_type = REG_16BIT; // 16-bit register
+ m_param1 = b0&3;
+
+ break;
+
+ case 0x1c:
+ // SHLC A
+ m_op = SHLC;
+
+ m_param1_type = REG_8BIT;
+ m_param1 = 0; // A
+ break;
+
+ case 0x1d:
+ // SHRC A
+ m_op = SHRC;
+
+ m_param1_type = REG_8BIT;
+ m_param1 = 0; // A
+ break;
+
+ case 0x1e:
+ // ROLC A
+ m_op = ROLC;
+
+ m_param1_type = REG_8BIT;
+ m_param1 = 0; // A
+ break;
+
+ case 0x1f:
+ // RORC A
+ m_op = RORC;
+
+ m_param1_type = REG_8BIT;
+ m_param1 = 0; // A
+ break;
+
+ case 0x20:
+ // INC (x)
+ m_op = INC;
+ m_param1_type = ADDR_IN_IMM_X;
+ m_param1 = READ8();
+ break;
+
+ case 0x21:
+ // INC (HL)
+ m_op = INC;
+ m_param1_type = ADDR_IN_HL;
+ //m_param1 = 0;
+ break;
+
+ case 0x22:
+ // LD A,(x)
+ m_op = LD; // Flags / Cycles 1Z-- / 3
+ m_flagsaffected |= FLAG_J | FLAG_Z;
+
+ m_param1_type = REG_8BIT;
+ m_param1 = 0; // A
+
+ m_param2_type = ADDR_IN_IMM_X;
+ m_param2 = READ8();
+ break;
+
+ case 0x23:
+ // LD A,(HL)
+ m_op = LD; // Flags / Cycles 1Z-- / 2
+ m_flagsaffected |= FLAG_J | FLAG_Z;
+
+ m_param1_type = REG_8BIT;
+ m_param1 = 0; // A
+
+ m_param2_type = ADDR_IN_HL;
+ //m_param2 = 0;
+ break;
+
+ case 0x24:
+ // LDW (x),mn
+ m_op = LDW;
+ m_param1_type = ADDR_IN_IMM_X; // 8-bit memory address
+ m_param1 = READ8();
+
+ m_param2_type = ABSOLUTE_VAL_16; // absolute value
+ m_param2 = READ16();
+ break;
+
+ case 0x25:
+ // LDW (HL),mn
+ m_op = LDW;
+ m_param1_type = ADDR_IN_HL;
+ //m_param1 = 0;
+
+ m_param2_type = ABSOLUTE_VAL_16;
+ m_param2 = READ16();
+ break;
+
+
+ case 0x26:
+ // LD (x),(y) // Flags / Cycles 1Z-- / 5
+ m_op = LD;
+ m_flagsaffected |= FLAG_J | FLAG_Z;
+
+ m_param2_type = ADDR_IN_IMM_X;
+ m_param2 = READ8();
+
+ m_param1_type = ADDR_IN_IMM_X;
+ m_param1 = READ8();
+ break;
+
+ case 0x27:
+ // unused
+ break;
+
+ case 0x28:
+ // DEC (x)
+ m_op = DEC;
+ m_param1_type = ADDR_IN_IMM_X;
+ m_param1 = READ8();
+ break;
+
+ case 0x29:
+ // DEC (HL)
+ m_op = DEC;
+ m_param1_type = ADDR_IN_HL;
+ //m_param1 = 0;
+ break;
+
+ case 0x2a:
+ // LD (x),A // Flags / Cycles 1Z-- / 3
+ m_op = LD;
+ m_flagsaffected |= FLAG_J | FLAG_Z;
+
+ m_param1_type = ADDR_IN_IMM_X;
+ m_param1 = READ8();
+
+ m_param2_type = REG_8BIT;
+ m_param2 = 0; // A
+
+ break;
+
+ case 0x2b:
+ // LD (HL),A // Flags / Cycles 1--- / 2
+ m_op = LD;
+ m_flagsaffected |= FLAG_J;
+
+ m_param1_type = ADDR_IN_HL;
+ //m_param1 = 0;
+
+ m_param2_type = REG_8BIT;
+ m_param2 = 0; // A
+ break;
+
+ case 0x2c:
+ // LD (x),n
+ m_op = LD; // Flags / Cycles 1--- / 4
+ m_flagsaffected |= FLAG_J;
+
+ m_param1_type = ADDR_IN_IMM_X; // 8-bit memory address
+ m_param1 = READ8();
+
+ m_param2_type = ABSOLUTE_VAL_8; // absolute value
+ m_param2 = READ8();
+
+ break;
+
+ case 0x2d:
+ // LD (HL),n
+ m_op = LD; // Flags / Cycles 1--- / 3
+ m_flagsaffected |= FLAG_J;
+
+ m_param1_type = ADDR_IN_HL; // memory address in 16-bit register
+ //m_param1 = 3; // (HL)
+
+ m_param2_type = ABSOLUTE_VAL_8; // absolute value
+ m_param2 = READ8();
+
+ break;
+
+ case 0x2e:
+ // CLR (x)
+ m_op = CLR;
+ m_param1_type = ADDR_IN_IMM_X; // 8-bit memory address
+ m_param1 = READ8();
+
+ break;
+
+ case 0x2f:
+ // CLR (HL)
+ m_op = CLR;
+ m_param1_type = ADDR_IN_HL; // memory address in 16-bit register
+ //m_param1 = 3; // (HL)
+
+ break;
+
+ case 0x30:
+ case 0x31:
+ case 0x32:
+ case 0x33:
+ case 0x34:
+ case 0x35:
+ case 0x36:
+ case 0x37:
+ // LD r,n
+
+ m_op = LD; // Flags / Cycles 1--- / 2
+ m_flagsaffected |= FLAG_J;
+
+ m_param1_type = REG_8BIT; // 8-bit register register
+ m_param1 = b0&7;
+
+ m_param2_type = ABSOLUTE_VAL_8; // absolute value
+ m_param2 = READ8();
+
+
+ break;
+
+ case 0x38:
+ case 0x39:
+ case 0x3a:
+ case 0x3b:
+ case 0x3c:
+ case 0x3d:
+ case 0x3e:
+ case 0x3f:
+ break;
+
+ case 0x40:
+ case 0x41:
+ case 0x42:
+ case 0x43:
+ case 0x44:
+ case 0x45:
+ case 0x46:
+ case 0x47:
+ // SET (x).b
+ b1 = READ8();
+#if 0
+ // this is just an alias
+ if ((b0 == 0x40) && (b1 == 0x3a))
+ {
+ // EI 'Assembler expansion machine instruction'
+ break;
+ }
+#endif
+ m_op = SET;
+
+ m_param1_type = ADDR_IN_IMM_X | BITPOS;
+ m_param1 = b1;
+ m_bitpos = b0 & 7;
+
+ break;
+
+ case 0x48:
+ case 0x49:
+ case 0x4a:
+ case 0x4b:
+ case 0x4c:
+ case 0x4d:
+ case 0x4e:
+ case 0x4f:
+ // CLR (x).b
+ b1 = READ8();
+#if 0
+ // this is just an alias
+ if ((b0 == 0x48) && (b1 == 0x3a))
+ {
+ // DI 'Assembler expansion machine instruction'
+ break;
+ }
+#endif
+ m_op = CLR;
+
+ m_param1_type = ADDR_IN_IMM_X | BITPOS;
+ m_param1 = b1;
+ m_bitpos = b0 & 7;
+
+ break;
+
+ case 0x50:
+ case 0x51:
+ case 0x52:
+ case 0x53:
+ case 0x54:
+ case 0x55:
+ case 0x56:
+ case 0x57:
+ // LD A,r 0101 0rrr
+ m_op = LD; // Flags / Cycles 1Z-- / 1
+ m_flagsaffected |= FLAG_J | FLAG_Z;
+
+ m_param1_type = REG_8BIT;
+ m_param1 = 0; // A
+
+ m_param2_type = REG_8BIT;
+ m_param2 = b0 & 0x7;
+
+ break;
+
+ case 0x58:
+ case 0x59:
+ case 0x5a:
+ case 0x5b:
+ case 0x5c:
+ case 0x5d:
+ case 0x5e:
+ case 0x5f:
+ // LD r,A 0101 1rrr
+ m_op = LD; // Flags / Cycles 1Z-- / 1
+ m_flagsaffected |= FLAG_J | FLAG_Z;
+
+ m_param2_type = REG_8BIT;
+ m_param2 = 0; // A
+
+ m_param1_type = REG_8BIT;
+ m_param1 = b0 & 0x7;
+ break;
+
+ case 0x60:
+ case 0x61:
+ case 0x62:
+ case 0x63:
+ case 0x64:
+ case 0x65:
+ case 0x66:
+ case 0x67:
+ // INC r
+ m_op = INC;
+ m_param1_type = REG_8BIT;
+ m_param1 = b0 & 0x7;
+ break;
+
+ case 0x68:
+ case 0x69:
+ case 0x6a:
+ case 0x6b:
+ case 0x6c:
+ case 0x6d:
+ case 0x6e:
+ case 0x6f:
+ // DEC r
+ m_op = DEC;
+ m_param1_type = REG_8BIT;
+ m_param1 = b0 & 0x7;
+ break;
+
+ case 0x70:
+ case 0x71:
+ case 0x72:
+ case 0x73:
+ case 0x74:
+ case 0x75:
+ case 0x76:
+ case 0x77:
+ // (ALU OP) A,n
+ m_op = (b0 & 0x7)+ALU_ADDC;
+
+ m_param1_type = REG_8BIT;
+ m_param1 = 0; // A
+
+ m_param2_type = ABSOLUTE_VAL_8;
+ m_param2 = READ8();
+
+ break;
+
+ case 0x78:
+ case 0x79:
+ case 0x7a:
+ case 0x7b:
+ case 0x7c:
+ case 0x7d:
+ case 0x7e:
+ case 0x7f:
+ // (ALU OP) A,(x)
+ m_op = (b0 & 0x7)+ALU_ADDC;
+
+ m_param1_type = REG_8BIT;
+ m_param1 = 0; // A
+
+ m_param2_type = ADDR_IN_IMM_X;
+ m_param2 = READ8();
+
+ break;
+
+ case 0x80:
+ case 0x81:
+ case 0x82:
+ case 0x83:
+ case 0x84:
+ case 0x85:
+ case 0x86:
+ case 0x87:
+ case 0x88:
+ case 0x89:
+ case 0x8a:
+ case 0x8b:
+ case 0x8c:
+ case 0x8d:
+ case 0x8e:
+ case 0x8f:
+ case 0x90:
+ case 0x91:
+ case 0x92:
+ case 0x93:
+ case 0x94:
+ case 0x95:
+ case 0x96:
+ case 0x97:
+ case 0x98:
+ case 0x99:
+ case 0x9a:
+ case 0x9b:
+ case 0x9c:
+ case 0x9d:
+ case 0x9e:
+ case 0x9f:
+ {
+ // JRS T,a
+ m_op = JRS;
+
+ m_param1_type = CONDITIONAL;
+ m_param1 = 6;
+
+ m_param2_type = ABSOLUTE_VAL_16;
+
+ int val = b0 & 0x1f;
+ if (val & 0x10) val -= 0x20;
+
+ m_param2 = tmppc + 2 + val;
+
+ break;
+ }
+ case 0xa0:
+ case 0xa1:
+ case 0xa2:
+ case 0xa3:
+ case 0xa4:
+ case 0xa5:
+ case 0xa6:
+ case 0xa7:
+ case 0xa8:
+ case 0xa9:
+ case 0xaa:
+ case 0xab:
+ case 0xac:
+ case 0xad:
+ case 0xae:
+ case 0xaf:
+ case 0xb0:
+ case 0xb1:
+ case 0xb2:
+ case 0xb3:
+ case 0xb4:
+ case 0xb5:
+ case 0xb6:
+ case 0xb7:
+ case 0xb8:
+ case 0xb9:
+ case 0xba:
+ case 0xbb:
+ case 0xbc:
+ case 0xbd:
+ case 0xbe:
+ case 0xbf:
+ {
+ // JRS F,a
+ m_op = JRS;
+
+ m_param1_type = CONDITIONAL;
+ m_param1 = 7;
+
+ m_param2_type = ABSOLUTE_VAL_16;
+
+ int val = b0 & 0x1f;
+ if (val & 0x10) val -= 0x20;
+
+ m_param2 = tmppc + 2 + val;
+
+ break;
+ }
+
+ case 0xc0:
+ case 0xc1:
+ case 0xc2:
+ case 0xc3:
+ case 0xc4:
+ case 0xc5:
+ case 0xc6:
+ case 0xc7:
+ case 0xc8:
+ case 0xc9:
+ case 0xca:
+ case 0xcb:
+ case 0xcc:
+ case 0xcd:
+ case 0xce:
+ case 0xcf:
+ // CALLV n
+ m_op = CALLV;
+
+ m_param1_type = MEMVECTOR_16BIT;
+
+ m_param1 = 0xffc0 + ((b0 & 0xf) * 2);
+
+ break;
+
+ case 0xd0:
+ case 0xd1:
+ case 0xd2:
+ case 0xd3:
+ case 0xd4:
+ case 0xd5:
+ case 0xd6:
+ case 0xd7:
+ {
+ // JR cc,a
+
+ m_op = JR;
+
+ m_param1_type = CONDITIONAL;
+ m_param1 = b0 & 0x7;
+
+ m_param2_type = ABSOLUTE_VAL_16;
+
+ int val = READ8();
+ if (val & 0x80) val -= 0x100;
+
+ m_param2 = tmppc+ 2 + val;
+
+ break;
+ }
+ case 0xd8:
+ case 0xd9:
+ case 0xda:
+ case 0xdb:
+ case 0xdc:
+ case 0xdd:
+ case 0xde:
+ case 0xdf:
+ // LD CF, (x).b aka TEST (x).b
+ m_op = LD; // Flags / Cycles %-*- / 4
+ m_flagsaffected |= FLAG_J | FLAG_C;
+
+ m_param1_type = CARRYFLAG;
+ //m_param1 = 0;
+
+ m_param2_type = ADDR_IN_IMM_X | BITPOS;
+ m_param2 = READ8();
+ m_bitpos = b0 & 0x7;
+ break;
+
+ case 0xe0:
+ // src prefix
+ decode_source(ADDR_IN_BASE+(b0&0x7), READ8());
+ break;
+
+ case 0xe1:
+ case 0xe2:
+ case 0xe3:
+ decode_source(ADDR_IN_BASE+(b0&0x7), 0);
+ break;
+
+ case 0xe4:
+ decode_source(ADDR_IN_BASE+(b0&0x7), READ8());
+ break;
+
+ case 0xe5:
+ case 0xe6:
+ case 0xe7:
+ decode_source(ADDR_IN_BASE+(b0&0x7), 0);
+ break;
+
+ case 0xe8:
+ case 0xe9:
+ case 0xea:
+ case 0xeb:
+ case 0xec:
+ case 0xed:
+ case 0xee:
+ case 0xef:
+ // register prefix: g/gg
+ decode_register_prefix(b0);
+ break;
+
+ case 0xf0: // 1111 0000 xxxx xxxx 0101 0rrr
+ // destination memory prefix (dst)
+ m_param1_type = ADDR_IN_BASE+(b0&0x7);
+ m_param1 = READ8();
+ decode_dest(b0);
+ break;
+
+ case 0xf2: // 1111 001p 0101 0rrr
+ case 0xf3: // 1111 001p 0101 0rrr
+ // destination memory prefix (dst)
+ m_param1_type = ADDR_IN_BASE+(b0&0x7);
+ decode_dest(b0);
+ break;
+
+
+ case 0xf4: // 1111 0100 dddd dddd 0101 0rrr
+ // destination memory prefix (dst)
+ m_param1_type = ADDR_IN_BASE+(b0&0x7);
+ m_param1 = READ8();
+ decode_dest(b0);
+ break;
+
+ case 0xf6: // 1110 0110 0101 0rrr
+ case 0xf7: // 1111 0111 0101 0rrr
+ // destination memory prefix (dst)
+ m_param1_type = ADDR_IN_BASE+(b0&0x7);
+ decode_dest(b0);
+ break;
+
+ case 0xf1:
+ case 0xf5:
+ // invalid dst memory prefix
+ break;
+
+
+ case 0xf8:
+ case 0xf9:
+ // unused
+ break;
+
+ case 0xfa:
+ // LD SP,mn
+ m_op = LD; // Flags / Cycles 1--- / 3
+ m_flagsaffected |= FLAG_J;
+
+ m_param1_type = STACKPOINTER;
+ //m_param1 = 0;
+
+ m_param2_type = ABSOLUTE_VAL_16;
+ m_param2 = READ16();
+
+ break;
+
+ case 0xfb:
+ {
+ // JR a
+ m_op = JR;
+
+ m_param2_type = ABSOLUTE_VAL_16;
+
+ int val = READ8();
+ if (val & 0x80) val -= 0x100;
+
+ m_param2 = tmppc + 2 + val;
+
+ break;
+ }
+
+ break;
+
+ case 0xfc:
+ // CALL mn
+ m_op = CALL;
+
+ m_param1_type = ABSOLUTE_VAL_16;
+ m_param1 = READ16();
+ break;
+
+ case 0xfd:
+ // CALLP n
+ m_op = CALLP;
+
+ m_param1_type = ABSOLUTE_VAL_16;
+ m_param1 = READ8()+0xff00;
+
+ break;
+
+ case 0xfe:
+ // JP mn
+ m_op = JP;
+
+ m_param2_type = ABSOLUTE_VAL_16;
+ m_param2 = READ16();
+
+ break;
+
+ case 0xff:
+ // SWI
+ m_op = SWI;
+
+ break;
+ }
+}
+
+// e8 - ef use this table
+void tlcs870_device::decode_register_prefix(uint8_t b0)
+{
+ uint8_t bx;
+
+ bx = READ8();
+
+ switch (bx)
+ {
+ case 0x00:
+ // nothing
+ break;
+
+ case 0x01:
+ // SWAP g
+ m_op = SWAP;
+
+ m_param1_type = REG_8BIT;
+ m_param1 = b0 & 0x7;
+ break;
+
+ case 0x02:
+ // MUL ggG, ggL
+ m_op = MUL;
+
+ m_param1_type = REG_16BIT; // odd syntax
+ m_param1 = b0 & 0x3;
+ break;
+
+ case 0x03:
+ // DIV gg,C
+ m_op = DIV;
+ m_param1_type = REG_16BIT;
+ m_param1 = b0 & 3;
+
+ m_param2_type = REG_8BIT;
+ m_param2 = 2; // C
+
+ break;
+
+ case 0x04:
+ // with E8 only
+ // RETN
+ if (b0 == 0xe8)
+ {
+ m_op = RETN;
+ }
+
+ break;
+
+ case 0x05:
+ break;
+
+ case 0x06:
+ // POP gg
+ m_op = POP;
+ m_param1_type = REG_16BIT;
+ m_param1 = b0 & 3;
+ // b0 & 4 = invalid?
+
+ break;
+
+ case 0x07:
+ // PUSH gg
+ m_op = PUSH;
+ m_param1_type = REG_16BIT;
+ m_param1 = b0 & 3;
+ // b0 & 4 = invalid?
+
+ break;
+
+ case 0x08:
+ case 0x09:
+ break;
+
+ case 0x0a:
+ // DAA g
+ m_op = DAA;
+
+ m_param1_type = REG_8BIT;
+ m_param1 = b0 & 0x7;
+
+ break;
+
+ case 0x0b:
+ // DAS g
+ m_op = DAS;
+
+ m_param1_type = REG_8BIT;
+ m_param1 = b0 & 0x7;
+
+ break;
+
+ case 0x0c:
+ case 0x0d:
+ case 0x0e:
+ case 0x0f:
+ break;
+
+ case 0x10:
+ case 0x11:
+ case 0x12:
+ case 0x13:
+ // XCH rr,gg
+ m_op = XCH;
+
+ m_param1_type = REG_16BIT;
+ m_param1 = bx & 0x3;
+
+ m_param2_type = REG_16BIT;
+ m_param2 = b0 & 0x3;
+ break;
+
+ case 0x14:
+ case 0x15:
+ case 0x16:
+ case 0x17:
+ // LD rr,gg
+ m_op = LD; // Flags / Cycles 1--- / 2
+ m_flagsaffected |= FLAG_J;
+
+ m_param1_type = REG_16BIT;
+ m_param1 = bx & 0x3;
+
+ m_param2_type = REG_16BIT;
+ m_param2 = b0 & 0x3;
+
+ break;
+
+ case 0x18:
+ case 0x19:
+ case 0x1a:
+ case 0x1b:
+ break;
+
+ case 0x1c:
+ // SHLC g
+ m_op = SHLC;
+
+ m_param1_type = REG_8BIT;
+ m_param1 = b0 & 0x7;
+
+ break;
+
+ case 0x1d:
+ // SHRC g
+ m_op = SHRC;
+
+ m_param1_type = REG_8BIT;
+ m_param1 = b0 & 0x7;
+
+ break;
+
+ case 0x1e:
+ // ROLC g
+ m_op = ROLC;
+
+ m_param1_type = REG_8BIT;
+ m_param1 = b0 & 0x7;
+
+ break;
+
+ case 0x1f:
+ // RORC g
+ m_op = RORC;
+
+ m_param1_type = REG_8BIT;
+ m_param1 = b0 & 0x7;
+
+ break;
+
+ case 0x20:
+ case 0x21:
+ case 0x22:
+ case 0x23:
+ case 0x24:
+ case 0x25:
+ case 0x26:
+ case 0x27:
+ case 0x28:
+ case 0x29:
+ case 0x2a:
+ case 0x2b:
+ case 0x2c:
+ case 0x2d:
+ case 0x2e:
+ case 0x2f:
+ break;
+
+ case 0x30:
+ case 0x31:
+ case 0x32:
+ case 0x33:
+ case 0x34:
+ case 0x35:
+ case 0x36:
+ case 0x37:
+ // (ALU OP) WA,gg
+ m_op = (bx & 0x7)+ALU_ADDC;
+
+ m_param1_type = REG_16BIT;
+ m_param1 = 0;
+
+ m_param2_type = REG_16BIT;
+ m_param2 = b0 & 3;
+ // b0 & 4 would be invalid?
+
+
+ break;
+
+ case 0x38:
+ case 0x39:
+ case 0x3a:
+ case 0x3b:
+ case 0x3c:
+ case 0x3d:
+ case 0x3e:
+ case 0x3f:
+ // (ALU OP) gg,mn
+ m_op = (bx & 0x7)+ALU_ADDC;
+
+ m_param1_type = REG_16BIT;
+ m_param1 = b0 & 0x3;
+
+ m_param2_type = ABSOLUTE_VAL_16; // absolute value
+ m_param2 = READ16(); // 16-bit
+
+ break;
+
+ case 0x40:
+ case 0x41:
+ case 0x42:
+ case 0x43:
+ case 0x44:
+ case 0x45:
+ case 0x46:
+ case 0x47:
+ // SET g.b
+ m_op = SET;
+
+ m_param1_type = REG_8BIT | BITPOS;
+ m_param1 = b0 & 0x7;
+ m_bitpos = bx & 0x7;
+
+
+ break;
+
+ case 0x48:
+ case 0x49:
+ case 0x4a:
+ case 0x4b:
+ case 0x4c:
+ case 0x4d:
+ case 0x4e:
+ case 0x4f:
+ // CLR g.b
+ m_op = CLR;
+
+ m_param1_type = REG_8BIT | BITPOS;
+ m_param1 = b0 & 0x7;
+ m_bitpos = bx & 0x7;
+
+ break;
+
+ case 0x50:
+ case 0x51:
+ case 0x52:
+ case 0x53:
+ case 0x54:
+ case 0x55:
+ case 0x56:
+ case 0x57:
+ break;
+
+ case 0x58:
+ case 0x59:
+ case 0x5a:
+ case 0x5b:
+ case 0x5c:
+ case 0x5d:
+ case 0x5e:
+ case 0x5f:
+ // LD r,g
+ m_op = LD; // Flags / Cycles 1Z-- / 2
+ m_flagsaffected |= FLAG_J | FLAG_Z;
+
+ m_param1_type = REG_8BIT;
+ m_param1 = bx & 0x7;
+
+ m_param2_type = REG_8BIT;
+ m_param2 = b0 & 0x7;
+ break;
+
+ case 0x60:
+ case 0x61:
+ case 0x62:
+ case 0x63:
+ case 0x64:
+ case 0x65:
+ case 0x66:
+ case 0x67:
+ // (ALU OP) A,g
+ m_op = (bx & 0x7)+ALU_ADDC;
+
+ m_param2_type = REG_8BIT;
+ m_param2 = b0 & 0x7;
+
+ m_param1_type = REG_8BIT;
+ m_param1 = 0; // A
+ break;
+
+ case 0x68:
+ case 0x69:
+ case 0x6a:
+ case 0x6b:
+ case 0x6c:
+ case 0x6d:
+ case 0x6e:
+ case 0x6f:
+ // (ALU OP) g,A
+ m_op = (bx & 0x7)+ALU_ADDC;
+
+ m_param1_type = REG_8BIT;
+ m_param1 = b0 & 0x7;
+
+ m_param2_type = REG_8BIT;
+ m_param2 = 0; // A
+ break;
+
+ case 0x70:
+ case 0x71:
+ case 0x72:
+ case 0x73:
+ case 0x74:
+ case 0x75:
+ case 0x76:
+ case 0x77:
+ // (ALU OP) g,n
+ m_op = (bx & 0x7)+ALU_ADDC;
+
+ m_param1_type = REG_8BIT;
+ m_param1 = b0 & 0x7;
+
+ m_param2_type = ABSOLUTE_VAL_8;
+ m_param2 = READ8();
+
+
+ break;
+
+ case 0x78:
+ case 0x79:
+ case 0x7a:
+ case 0x7b:
+ case 0x7c:
+ case 0x7d:
+ case 0x7e:
+ case 0x7f:
+ break;
+
+
+ case 0x80:
+ case 0x81:
+ break;
+
+ case 0x82:
+ case 0x83:
+ // SET (pp).g
+ m_op = SET;
+ m_param1_type = (ADDR_IN_DE+(bx&1)) | BITPOS | BITPOS_INDIRECT;
+ //m_param1 = 0;
+ m_bitpos = b0 & 7;
+ break;
+
+ case 0x84:
+ case 0x85:
+ case 0x86:
+ case 0x87:
+ break;
+
+ case 0x88:
+ case 0x89:
+ break;
+
+ case 0x8a:
+ case 0x8b:
+ // CLR (pp).g
+ m_op = CLR;
+ m_param1_type = (ADDR_IN_DE+(bx&1)) | BITPOS | BITPOS_INDIRECT;
+ //m_param1 = 0;
+ m_bitpos = b0 & 7;
+ break;
+
+ case 0x8c:
+ case 0x8d:
+ case 0x8e:
+ case 0x8f:
+ break;
+
+
+ case 0x90:
+ case 0x91:
+ break;
+
+ case 0x92:
+ case 0x93:
+ // CPL (pp).g
+ m_op = CPL;
+ m_param1_type = (ADDR_IN_DE+(bx&1)) | BITPOS | BITPOS_INDIRECT;
+ //m_param1 = 0;
+ m_bitpos = b0 & 7;
+ break;
+
+ case 0x94:
+ case 0x95:
+ case 0x96:
+ case 0x97:
+ break;
+
+ case 0x9a:
+ case 0x9b:
+ // LD (pp).g,CF
+ m_op = LD; // Flags / Cycles 1--- / 5
+ m_flagsaffected |= FLAG_J;
+
+ m_param1_type = (ADDR_IN_DE+(bx&1)) | BITPOS | BITPOS_INDIRECT;
+ //m_para1 = 0;
+ m_bitpos = b0 & 7;
+
+ m_param2_type = CARRYFLAG;
+ //m_param2 = 0;
+ break;
+
+ case 0x9c:
+ case 0x9d:
+ break;
+
+ case 0x9e:
+ case 0x9f:
+ // LD CF,(pp).g aka TEST (pp).g
+ m_op = LD; // Flags / Cycles %-*- / 4
+ m_flagsaffected |= FLAG_J | FLAG_C;
+
+ m_param1_type = CARRYFLAG;
+ //m_param1 = 0;
+
+ m_param2_type = (ADDR_IN_DE+(bx&1)) | BITPOS | BITPOS_INDIRECT;
+ //m_param2 = 0;
+ m_bitpos = b0 & 7;
+ break;
+
+ case 0xa0:
+ case 0xa1:
+ case 0xa2:
+ case 0xa3:
+ case 0xa4:
+ case 0xa5:
+ case 0xa6:
+ case 0xa7:
+ break;
+
+ case 0xb0:
+ case 0xb1:
+ case 0xb2:
+ case 0xb3:
+ case 0xb4:
+ case 0xb5:
+ case 0xb6:
+ case 0xb7:
+ case 0xb8:
+ case 0xb9:
+ case 0xba:
+ case 0xbb:
+ case 0xbc:
+ case 0xbd:
+ case 0xbe:
+ case 0xbf:
+ break;
+
+ case 0xc0:
+ case 0xc1:
+ case 0xc2:
+ case 0xc3:
+ case 0xc4:
+ case 0xc5:
+ case 0xc6:
+ case 0xc7:
+ // CPL g.b
+ m_op = CPL;
+
+ m_param1_type = REG_8BIT | BITPOS;
+ m_param1 = b0 & 0x7;
+ m_bitpos = bx & 0x7;
+ break;
+
+ case 0xc8:
+ case 0xc9:
+ case 0xca:
+ case 0xcb:
+ case 0xcc:
+ case 0xcd:
+ case 0xce:
+ case 0xcf:
+ // LD g.b,CF
+ m_op = LD; // Flags / Cycles 1--- / 2
+ m_flagsaffected |= FLAG_J;
+
+ m_param2_type = CARRYFLAG;
+ //m_param2 = 0;
+
+ m_param1_type = REG_8BIT | BITPOS;
+ m_param1 = b0 & 0x7;
+ m_bitpos = bx & 0x7;
+
+ break;
+
+ case 0xd0:
+ case 0xd1:
+ case 0xd2:
+ case 0xd3:
+ case 0xd4:
+ case 0xd5:
+ case 0xd6:
+ case 0xd7:
+ // XOR CF,g.b
+ m_op = ALU_XOR;
+
+ m_param1_type = CARRYFLAG;
+ //m_param1 = 0;
+
+ m_param2_type = REG_8BIT | BITPOS;
+ m_param2 = b0 & 0x7;
+ m_bitpos = bx & 0x7;
+
+ break;
+
+ case 0xd8:
+ case 0xd9:
+ case 0xda:
+ case 0xdb:
+ case 0xdc:
+ case 0xdd:
+ case 0xde:
+ case 0xdf:
+ // LD CF,g.b aka TEST g.b
+ m_op = LD; // Flags / Cycles %-*- / 2
+ m_flagsaffected |= FLAG_J | FLAG_C;
+
+ m_param1_type = CARRYFLAG;
+ //m_param1 = 0;
+
+ m_param2_type = REG_8BIT | BITPOS;
+ m_param2 = b0 & 0x7;
+ m_bitpos = bx & 0x7;
+
+ break;
+
+ case 0xe0:
+ case 0xe1:
+ case 0xe2:
+ case 0xe3:
+ case 0xe4:
+ case 0xe5:
+ case 0xe6:
+ case 0xe7:
+ case 0xe8:
+ case 0xe9:
+ case 0xea:
+ case 0xeb:
+ case 0xec:
+ case 0xed:
+ case 0xee:
+ case 0xef:
+ break;
+
+ case 0xf0:
+ case 0xf1:
+ case 0xf2:
+ case 0xf3:
+ case 0xf4:
+ case 0xf5:
+ case 0xf6:
+ case 0xf7:
+ break;
+
+ case 0xf8:
+ case 0xf9:
+ break;
+
+ case 0xfa:
+ // LD SP,gg
+ m_op = LD; // Flags / Cycles 1--- / 3
+ m_flagsaffected |= FLAG_J;
+
+ m_param2_type = REG_16BIT;
+ m_param2 = b0 & 3;
+ // b0 & 4 would be invalid?
+
+ m_param1_type = STACKPOINTER;
+ // m_param1 = 0;
+
+ break;
+
+ case 0xfb:
+ // LD gg,SP
+ m_op = LD; // Flags / Cycles 1--- / 3
+ m_flagsaffected |= FLAG_J;
+
+ m_param1_type = REG_16BIT;
+ m_param1 = b0 & 3;
+ // b0 & 4 would be invalid?
+
+ m_param2_type = STACKPOINTER;
+ // m_param2 = 0;
+ break;
+
+ case 0xfc:
+ // CALL gg
+ m_op = CALL;
+
+ m_param2_type = REG_16BIT;
+ m_param2 = b0 & 3;
+ // b0 & 4 would be invalid?
+
+ break;
+
+ case 0xfd:
+ break;
+
+ case 0xfe:
+ // JP gg
+ m_op = JP;
+
+ m_param2_type = REG_16BIT;
+ m_param2 = b0 & 3;
+ // b0 & 4 would be invalid?
+
+ break;
+
+ case 0xff:
+ break;
+
+ }
+
+}
+
+
+
+// e0 - e7 use this table
+void tlcs870_device::decode_source(int type, uint16_t val)
+{
+ uint8_t bx;
+
+ bx = READ8();
+
+ switch (bx)
+ {
+ case 0x00:
+ case 0x01:
+ case 0x02:
+ case 0x03:
+ case 0x04:
+ case 0x05:
+ case 0x06:
+ case 0x07:
+ break;
+
+ case 0x08:
+ // ROLD A,(src)
+ m_op = ROLD;
+ m_param2_type = type;
+ m_param2 = val;
+
+ m_param1_type = REG_8BIT;
+ m_param1 = 0; // A
+ break;
+
+ case 0x09:
+ // RORD A,(src)
+ m_op = RORD;
+ m_param2_type = type;
+ m_param2 = val;
+
+ m_param1_type = REG_8BIT;
+ m_param1 = 0; // A
+ break;
+
+ case 0x0a:
+ case 0x0b:
+ case 0x0c:
+ case 0x0d:
+ case 0x0e:
+ case 0x0f:
+
+ case 0x10:
+ case 0x11:
+ case 0x12:
+ case 0x13:
+ // see dst
+ break;
+
+ case 0x14:
+ case 0x15:
+ case 0x16:
+ case 0x17:
+ // LD rr, (src)
+ m_op = LD; // Flags / Cycles 1--- / x
+ m_flagsaffected |= FLAG_J;
+
+ m_param1_type = REG_16BIT;
+ m_param1 = bx & 0x3;
+
+ m_param2_type = type | IS16BIT;
+ m_param2 = val;
+ break;
+
+ case 0x18:
+ case 0x19:
+ case 0x1a:
+ case 0x1b:
+ case 0x1c:
+ case 0x1d:
+ case 0x1e:
+ case 0x1f:
+ break;
+
+ case 0x20:
+ // INC (src)
+ m_op = INC;
+ m_param1_type = type;
+ m_param1 = val;
+
+ break;
+
+ case 0x21:
+ case 0x22:
+ case 0x23:
+ case 0x24:
+ case 0x25:
+ break;
+
+ case 0x26: // invalid if (src) is also (x) ? (not specified)
+ // LD (x),(src)
+ m_op = LD; // Flags / Cycles 1U-- / x
+ m_flagsaffected |= FLAG_J /*| FLAG_Z*/; // Z is undefined!
+
+ m_param1_type = ADDR_IN_IMM_X;
+ m_param1 = READ8();
+
+ m_param2_type = type;
+ m_param2 = val;
+ break;
+
+ case 0x27:
+ // LD (HL),(src)
+ m_op = LD; // Flags / Cycles 1Z-- / x
+ m_flagsaffected |= FLAG_J | FLAG_Z;
+
+ m_param1_type = ADDR_IN_HL;
+ //m_param1 = 0;
+
+ m_param2_type = type;
+ m_param2 = val;
+ break;
+
+
+ case 0x28:
+ // DEC (src)
+ m_op = DEC;
+ m_param1_type = type;
+ m_param1 = val;
+
+ break;
+
+ case 0x29:
+ case 0x2a:
+ case 0x2b:
+ case 0x2c:
+ case 0x2d:
+ case 0x2e:
+ break;
+
+ case 0x2f:
+ // MCMP (src), n
+ m_op = MCMP;
+ m_param1_type = type;
+ m_param1 = val;
+
+ m_param2_type = ABSOLUTE_VAL_8;
+ m_param2 = READ8();
+ break;
+
+ case 0x30:
+ case 0x31:
+ case 0x32:
+ case 0x33:
+ case 0x34:
+ case 0x35:
+ case 0x36:
+ case 0x37:
+ case 0x38:
+ case 0x39:
+ case 0x3a:
+ case 0x3b:
+ case 0x3c:
+ case 0x3d:
+ case 0x3e:
+ case 0x3f:
+ break;
+
+ case 0x40:
+ case 0x41:
+ case 0x42:
+ case 0x43:
+ case 0x44:
+ case 0x45:
+ case 0x46:
+ case 0x47:
+ // SET (src).b
+ m_op = SET;
+
+ m_param1_type = type | BITPOS;
+ m_param1 = val;
+ m_bitpos = bx & 0x7;
+ break;
+
+ case 0x48:
+ case 0x49:
+ case 0x4a:
+ case 0x4b:
+ case 0x4c:
+ case 0x4d:
+ case 0x4e:
+ case 0x4f:
+ // CLR (src).b
+ m_op = CLR;
+
+ m_param1_type = type | BITPOS;
+ m_param1 = val;
+ m_bitpos = bx & 0x7;
+ break;
+
+ case 0x50:
+ case 0x51:
+ case 0x52:
+ case 0x53:
+ case 0x54:
+ case 0x55:
+ case 0x56:
+ case 0x57:
+ // see dst
+ break;
+
+ case 0x58:
+ case 0x59:
+ case 0x5a:
+ case 0x5b:
+ case 0x5c:
+ case 0x5d:
+ case 0x5e:
+ case 0x5f:
+ // LD r, (src)
+ m_op = LD; // Flags / Cycles 1Z-- / x
+ m_flagsaffected |= FLAG_J | FLAG_Z;
+
+ m_param1_type = REG_8BIT;
+ m_param1 = bx & 0x7;
+
+ m_param2_type = type;
+ m_param2 = val;
+ break;
+
+ case 0x60:
+ case 0x61:
+ case 0x62:
+ case 0x63:
+ case 0x64:
+ case 0x65:
+ case 0x66:
+ case 0x67:
+ // (ALU OP) (src), (HL)
+ m_op = (bx & 0x7)+ALU_ADDC;
+ m_param1_type = type;
+ m_param1 = val;
+
+ m_param2_type = ADDR_IN_HL;
+ //m_param2 = 0;
+ break;
+
+ case 0x68:
+ case 0x69:
+ case 0x6a:
+ case 0x6b:
+ case 0x6c:
+ case 0x6d:
+ case 0x6e:
+ case 0x6f:
+ break;
+
+ case 0x70:
+ case 0x71:
+ case 0x72:
+ case 0x73:
+ case 0x74:
+ case 0x75:
+ case 0x76:
+ case 0x77:
+ // (ALU OP) (src), n
+ m_op = (bx & 0x7)+ALU_ADDC;
+ m_param1_type = type;
+ m_param1 = val;
+
+ m_param2_type = ABSOLUTE_VAL_8;
+ m_param2 = READ8();
+ break;
+
+ case 0x78:
+ case 0x79:
+ case 0x7a:
+ case 0x7b:
+ case 0x7c:
+ case 0x7d:
+ case 0x7e:
+ case 0x7f:
+ // (ALU OP) A, (src)
+
+ m_op = (bx & 0x7)+ALU_ADDC;
+ m_param2_type = type;
+ m_param2 = val;
+
+ m_param1_type = REG_8BIT;
+ m_param1 = 0; // A
+ break;
+
+ case 0x80:
+ case 0x81:
+ case 0x82:
+ case 0x83:
+ case 0x84:
+ case 0x85:
+ case 0x86:
+ case 0x87:
+ case 0x88:
+ case 0x89:
+ case 0x8a:
+ case 0x8b:
+ case 0x8c:
+ case 0x8d:
+ case 0x8e:
+ case 0x8f:
+ break;
+
+ case 0x90:
+ case 0x91:
+ case 0x92:
+ case 0x93:
+ case 0x94:
+ case 0x95:
+ case 0x96:
+ case 0x97:
+ case 0x98:
+ case 0x99:
+ case 0x9a:
+ case 0x9b:
+ case 0x9c:
+ case 0x9d:
+ case 0x9e:
+ case 0x9f:
+ break;
+
+ case 0xa0:
+ case 0xa1:
+ case 0xa2:
+ case 0xa3:
+ case 0xa4:
+ case 0xa5:
+ case 0xa6:
+ case 0xa7:
+ break;
+
+ case 0xa8:
+ case 0xa9:
+ case 0xaa:
+ case 0xab:
+ case 0xac:
+ case 0xad:
+ case 0xae:
+ case 0xaf:
+ // XCH r,(src)
+ m_op = XCH;
+
+ m_param1_type = REG_8BIT;
+ m_param1 = bx & 0x7;
+
+ m_param2_type = type;
+ m_param2 = val;
+ break;
+
+
+ case 0xb0:
+ case 0xb1:
+ case 0xb2:
+ case 0xb3:
+ case 0xb4:
+ case 0xb5:
+ case 0xb6:
+ case 0xb7:
+ case 0xb8:
+ case 0xb9:
+ case 0xba:
+ case 0xbb:
+ case 0xbc:
+ case 0xbd:
+ case 0xbe:
+ case 0xbf:
+ break;
+
+ case 0xc0:
+ case 0xc1:
+ case 0xc2:
+ case 0xc3:
+ case 0xc4:
+ case 0xc5:
+ case 0xc6:
+ case 0xc7:
+ // CPL (src).b
+ m_op = CPL;
+
+ m_param1_type = type | BITPOS;
+ m_param1 = val;
+ m_bitpos = bx & 0x7;
+ break;
+
+ case 0xc8:
+ case 0xc9:
+ case 0xca:
+ case 0xcb:
+ case 0xcc:
+ case 0xcd:
+ case 0xce:
+ case 0xcf:
+ // LD (src).b,CF
+ m_op = LD; // Flags / Cycles 1--- / x
+ m_flagsaffected |= FLAG_J;
+
+ m_param1_type = type | BITPOS;
+ m_param1 = val;
+ m_bitpos = bx & 0x7;
+
+ m_param2_type = CARRYFLAG;
+ //m_param2 = 0;
+ break;
+
+
+ case 0xd0:
+ case 0xd1:
+ case 0xd2:
+ case 0xd3:
+ case 0xd4:
+ case 0xd5:
+ case 0xd6:
+ case 0xd7:
+ // XOR CF,(src).b
+ m_op = ALU_XOR;
+ m_param1_type = CARRYFLAG;
+ //m_param1 = 0;
+
+ m_param2_type = type | BITPOS;
+ m_param2 = val;
+ m_bitpos = bx & 0x7;
+ break;
+
+ case 0xd8:
+ case 0xd9:
+ case 0xda:
+ case 0xdb:
+ case 0xdc:
+ case 0xdd:
+ case 0xde:
+ case 0xdf:
+ // LD CF,(src).b aka TEST (src).b
+ m_op = LD; // Flags / Cycles %-*- / x
+ m_flagsaffected |= FLAG_J | FLAG_C;
+
+ m_param2_type = type | BITPOS;
+ m_param2 = val;
+ m_bitpos = bx & 0x7;
+
+ m_param1_type = CARRYFLAG;
+ //m_param1 = 0;
+ break;
+
+
+ case 0xe0:
+ case 0xe1:
+ case 0xe2:
+ case 0xe3:
+ case 0xe4:
+ case 0xe5:
+ case 0xe6:
+ case 0xe7:
+ case 0xe8:
+ case 0xe9:
+ case 0xea:
+ case 0xeb:
+ case 0xec:
+ case 0xed:
+ case 0xee:
+ case 0xef:
+ break;
+
+ case 0xf0:
+ case 0xf1:
+ case 0xf2:
+ case 0xf3:
+ case 0xf4:
+ case 0xf5:
+ case 0xf6:
+ case 0xf7:
+ break;
+
+ case 0xf8:
+ case 0xf9:
+ case 0xfa:
+ case 0xfb:
+ case 0xfc:
+ // CALL (src)
+ m_op = CALL;
+ m_param1_type = type;
+ m_param1 = val;
+ break;
+
+ case 0xfd:
+ break;
+
+ case 0xfe:
+ // JP (src)
+ m_op = JP;
+ m_param2_type = type | IS16BIT;
+ m_param2 = val;
+ break;
+
+ case 0xff:
+ break;
+
+
+ }
+
+}
+
+// f0 - f7 use this table
+// note, same table is shown as above in manual, there's no overlap between src/dest, but they're not compatible
+void tlcs870_device::decode_dest(uint8_t b0)
+{
+ uint8_t bx;
+
+ bx = READ8();
+
+ switch (bx)
+ {
+ case 0x10:
+ case 0x11:
+ case 0x12:
+ case 0x13:
+ // LD (dst),rr // (dst) can only be (x) (pp) or (HL+d) ? not (HL+) or (-HL) ?
+ m_op = LD; // Flags / Cycles 1--- / x
+ m_flagsaffected |= FLAG_J;
+
+ m_param1_type |= IS16BIT;
+
+
+ m_param2_type = REG_16BIT;
+ m_param2 = bx&0x3;
+ break;
+
+ case 0x2c:
+ // LD (dst),n // (dst) can only be (DE), (HL+), (-HL), or (HL+d) because (x) and (HL) are redundant encodings?
+ m_op = LD; // Flags / Cycles 1--- / x
+ m_flagsaffected |= FLAG_J;
+
+ m_param2_type = ABSOLUTE_VAL_8;
+ m_param2 = READ8();
+ break;
+
+ case 0x50:
+ case 0x51:
+ case 0x52:
+ case 0x53:
+ case 0x54:
+ case 0x55:
+ case 0x56:
+ case 0x57:
+ // LD (dst),r
+ m_op = LD; // Flags / Cycles 1--- / x
+ m_flagsaffected |= FLAG_J;
+
+ m_param2_type = REG_8BIT;
+ m_param2 = bx&0x7;
+ break;
+
+ default:
+ break;
+ }
+}
+
+bool tlcs870_device::stream_arg(std::ostream &stream, uint32_t pc, const char *pre, const uint16_t mode, const uint16_t r, const uint16_t rb)
+{
+ return false;
+}
+
+void tlcs870_device::disasm_disassemble_param(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options, int type, uint16_t val)
+{
+ int basetype = type & MODE_MASK;
+
+ if (basetype==ADDR_IN_IMM_X) util::stream_format(stream, " ($%02x)", val); // direct
+ if (basetype==ADDR_IN_PC_PLUS_REG_A) util::stream_format(stream, " %s", type_x[1]);
+ if (basetype==ADDR_IN_DE) util::stream_format(stream, " %s", type_x[2]);
+ if (basetype==ADDR_IN_HL) util::stream_format(stream, " %s", type_x[3]);
+ if (basetype==ADDR_IN_HL_PLUS_IMM_D) util::stream_format(stream, " (HL+$%04x)", val); // todo, sign extend
+ if (basetype==ADDR_IN_HL_PLUS_REG_C) util::stream_format(stream, " %s", type_x[5]);
+ if (basetype==ADDR_IN_HLINC) util::stream_format(stream, " %s", type_x[6]);
+ if (basetype==ADDR_IN_DECHL) util::stream_format(stream, " %s", type_x[7]);
+
+ if (basetype==REG_8BIT)
+ {
+ if (type&IS16BIT) util::stream_format(stream, " %s", reg16[val&3]);
+ else util::stream_format(stream, " %s", reg8[val & 7]);
+ }
+
+ if (basetype==CONDITIONAL) util::stream_format(stream, " %s", conditions[val]);
+ if (basetype==(STACKPOINTER & MODE_MASK)) util::stream_format(stream, " SP");
+ if (basetype==REGISTERBANK) util::stream_format(stream, " RBS");
+ if (basetype==PROGRAMSTATUSWORD) util::stream_format(stream, " PSW");
+ if (basetype==MEMVECTOR_16BIT) util::stream_format(stream, " ($%04x)", val);
+ if (basetype==ABSOLUTE_VAL_8)
+ {
+ if (type&IS16BIT) util::stream_format(stream, "$%04x", val);
+ else util::stream_format(stream, "$%02x", val);
+ }
+
+ if (basetype == (CARRYFLAG & MODE_MASK))
+ {
+ util::stream_format(stream, " CF");
+ }
+ else if (type&BITPOS)
+ {
+ if (type & BITPOS_INDIRECT) util::stream_format(stream, ".BIT_%s", reg8[m_bitpos&7]);
+ else util::stream_format(stream, ".BIT_%d", m_bitpos);
+ }
+}
+
+offs_t tlcs870_device::disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options)
+{
+ m_addr = pc;
+
+ decode();
+
+ util::stream_format (stream, "%-5s", op_names[ m_op ] );
+
+ if (m_param1_type)
+ {
+ disasm_disassemble_param(stream, pc, oprom, opram, options, m_param1_type, m_param1);
+ }
+
+ if (m_param2_type)
+ {
+ if (m_param1_type) util::stream_format(stream, ",");
+
+ disasm_disassemble_param(stream, pc, oprom, opram, options, m_param2_type, m_param2);
+
+ }
+
+ return (m_addr - pc) | DASMFLAG_SUPPORTED;
+}
+
+void tlcs870_device::execute_set_input(int inputnum, int state)
+{
+#if 0
+ switch(inputnum) {
+ case INPUT_LINE_NMI:
+ set_irq_line(INTNMI, state);
+ break;
+ case INPUT_LINE_IRQ0:
+ set_irq_line(INT0, state);
+ break;
+ case INPUT_LINE_IRQ1:
+ set_irq_line(INT1, state);
+ break;
+ case INPUT_LINE_IRQ2:
+ set_irq_line(INT2, state);
+ break;
+ }
+#endif
+}
+
+uint16_t tlcs870_device::get_addr(uint16_t param_type, uint16_t param_val)
+{
+ uint16_t addr = 0x0000;
+
+ switch (param_type&MODE_MASK)
+ {
+ case ADDR_IN_IMM_X:
+ addr = param_val;
+ break;
+ case ADDR_IN_PC_PLUS_REG_A:
+ addr = m_temppc + 2 + get_reg8(REG_A);
+ break;
+ case ADDR_IN_DE:
+ addr = get_reg16(REG_DE);
+ break;
+ case ADDR_IN_HL:
+ addr = get_reg16(REG_HL);
+ break;
+ case ADDR_IN_HL_PLUS_IMM_D:
+ addr = get_reg16(REG_HL) + param_val;
+ break;
+ case ADDR_IN_HL_PLUS_REG_C:
+ addr = get_reg16(REG_HL) + get_reg16(REG_C);
+ break;
+ case ADDR_IN_HLINC:
+ {
+ uint16_t tmpHL = get_reg16(REG_HL);
+ addr = tmpHL;
+ tmpHL++;
+ set_reg16(REG_HL, tmpHL);
+ break;
+ }
+ case ADDR_IN_DECHL:
+ {
+ uint16_t tmpHL = get_reg16(REG_HL);
+ tmpHL--;
+ set_reg16(REG_HL, tmpHL);
+ addr = tmpHL;
+ break;
+ }
+ }
+
+ return addr;
+}
+
+void tlcs870_device::set_dest_val(uint16_t param_type, uint16_t param_val, uint16_t dest_val)
+{
+ if (param_type & IS16BIT)
+ {
+ switch (param_type)
+ {
+ case ABSOLUTE_VAL_16:
+ logerror("illegal dest ABSOLUTE_VAL_16\n");
+ break;
+
+ case REG_16BIT:
+ set_reg16(param_val, dest_val);
+ break;
+
+ case (STACKPOINTER):
+ m_sp.d = dest_val;
+ break;
+ }
+ }
+ else
+ {
+ switch (param_type & MODE_MASK)
+ {
+ case ABSOLUTE_VAL_8:
+ logerror("illegal dest ABSOLUTE_VAL_8\n");
+ break;
+ case REG_8BIT:
+ set_reg8(param_val, dest_val);
+ break;
+ }
+ }
+}
+
+uint16_t tlcs870_device::get_source_val(uint16_t param_type, uint16_t param_val)
+{
+ uint16_t ret_val = 0x0000;
+
+ if (param_type & IS16BIT)
+ {
+ switch (param_type)
+ {
+ case ABSOLUTE_VAL_16:
+ ret_val = param_val;
+ break;
+
+ case REG_16BIT:
+ ret_val = get_reg16(param_val);
+ break;
+
+ case (STACKPOINTER):
+ ret_val = m_sp.d;
+ break;
+ }
+ }
+ else
+ {
+ switch (param_type & MODE_MASK)
+ {
+ case ABSOLUTE_VAL_8:
+ ret_val = param_val;
+ break;
+ case REG_8BIT:
+ ret_val = get_reg8(param_val);
+ break;
+ }
+ }
+ return ret_val;
+}
+
+void tlcs870_device::setbit_param(uint16_t param_type, uint16_t param, uint8_t bit, bool do_flag)
+{
+ if (param_type & BITPOS)
+ {
+ uint8_t bitpos = 0;
+
+ // need to read param 1
+ uint16_t addr = 0x0000;
+ uint16_t val = 0;
+
+ // READ
+ if (param_type & ADDR_IN_BASE)
+ {
+ addr = get_addr(param_type, param); // any pre/post HL address adjustments happen here
+ if (param_type & IS16BIT)
+ val = RM16(addr);
+ else
+ val = RM8(addr);
+ }
+ else
+ {
+ val = get_source_val(param_type, param);
+ }
+
+ if (param_type & BITPOS_INDIRECT)
+ {
+ bitpos = get_reg8(m_bitpos & 7) & 0x7;
+ }
+ else
+ {
+ bitpos = m_bitpos;
+ }
+
+ // MODIFY
+ int bitused = (1 << bitpos);
+
+ // this is the flag behavior for the set/clr bit opcodes
+ if (do_flag)
+ {
+ int existingbit = (val & bitused);
+ if (existingbit)
+ {
+ CLEAR_ZF;
+ CLEAR_JF; // 'Z' (so copy Z flag?)
+ }
+ else
+ {
+ SET_ZF;
+ SET_JF; // 'Z'
+ }
+ }
+
+
+ bit ? (val |= bitused) : (val &= ~bitused);
+
+ //printf("bit to set is %d, value is %02x", bitused, val);
+
+ // WRITE
+ if (param_type & ADDR_IN_BASE)
+ {
+ //addr = get_addr(param_type,param); // already have addr, don't want to cause any further HL decrements/increments.
+ if (param_type & IS16BIT)
+ WM16(addr, val);
+ else
+ WM8(addr, val);
+ }
+ else
+ {
+ set_dest_val(param_type, param, val);
+ }
+ }
+ else
+ {
+ fatalerror("not a bit op? 0\n");
+ }
+}
+
+uint8_t tlcs870_device::getbit_param(uint16_t param_type, uint16_t param)
+{
+ uint8_t bit = 0;
+
+ if (param_type & BITPOS)
+ {
+ uint8_t bitpos;
+
+ // need to read param 2
+ uint16_t addr = 0x0000;
+ uint16_t val = 0;
+ if (param_type & ADDR_IN_BASE)
+ {
+ addr = get_addr(param_type, param);
+ if (param_type & IS16BIT)
+ val = RM16(addr);
+ else
+ val = RM8(addr);
+ }
+ else
+ {
+ val = get_source_val(param_type, param);
+ }
+
+ if (param_type & BITPOS_INDIRECT)
+ {
+ bitpos = get_reg8(m_bitpos & 7) & 0x7;
+ }
+ else
+ {
+ bitpos = m_bitpos;
+ }
+
+ bit = (val >> bitpos) & 1;
+ }
+ else
+ {
+ fatalerror("not a bit op? 0\n");
+ }
+
+ return bit;
+}
+
+void tlcs870_device::execute_run()
+{
+ do
+ {
+ m_prvpc.d = m_pc.d;
+ debugger_instruction_hook(this, m_pc.d);
+
+ //check_interrupts();
+ m_temppc = m_pc.d;
+
+ m_addr = m_pc.d;
+ decode();
+ m_pc.d = m_addr;
+
+ switch (m_op)
+ {
+ case UNKNOWN:
+ // invalid instruction
+ break;
+
+ case CALL:
+ break;
+ case CALLP:
+ break;
+ case CALLV:
+ break;
+
+ case CLR:
+ if ((m_param1_type & BITPOS))
+ {
+ //printf("clr on bit\n");
+
+ if (m_param1_type == CARRYFLAG)
+ {
+ CLEAR_CF;
+ SET_JF;
+ }
+ else
+ {
+ setbit_param(m_param1_type, m_param1, 0, true);
+ }
+ }
+ else
+ {
+ // grouped with the LD operations in the manual but with CLR name, so probably internally just calling LD with 0 value
+
+ uint16_t addr = 0x0000;
+ uint16_t val = 0;
+
+ if (m_param1_type & ADDR_IN_BASE)
+ {
+ addr = get_addr(m_param1_type,m_param1);
+ if (m_param1_type & IS16BIT)
+ WM16(addr, val);
+ else
+ WM8(addr, val);
+ }
+ else
+ {
+ set_dest_val(m_param1_type,m_param1, val);
+ }
+ SET_JF;
+ }
+ break;
+
+
+ case CPL:
+ break;
+ case DAA:
+ break;
+ case DAS:
+ break;
+ case DEC:
+ break;
+ /*
+ case DI:
+ break;
+ */
+ case DIV:
+ break;
+ /*
+ case EI:
+ break;
+ */
+ case INC:
+ {
+ // READ
+ uint16_t addr = 0x0000;
+ uint16_t val = 0;
+ if (m_param1_type & ADDR_IN_BASE)
+ {
+ addr = get_addr(m_param1_type, m_param1);
+ if (m_param1_type & IS16BIT)
+ val = RM16(addr);
+ else
+ val = RM8(addr);
+ }
+ else
+ {
+ val = get_source_val(m_param1_type, m_param1);
+ }
+
+ // MODIFY
+ val++;
+
+ if (!(m_param1_type & IS16BIT))
+ val &= 0xff;
+
+ if (val == 0)
+ {
+ SET_ZF;
+ SET_JF;
+ }
+ else
+ {
+ CLEAR_ZF;
+ CLEAR_JF;
+ }
+
+ // WRITE
+ if (m_param1_type & ADDR_IN_BASE)
+ {
+ //addr = get_addr(m_param1_type,m_param1); // already have
+ if (m_param1_type & IS16BIT)
+ WM16(addr, val);
+ else
+ WM8(addr, val);
+ }
+ else
+ {
+ set_dest_val(m_param1_type,m_param1, val);
+ }
+
+ break;
+ }
+ /*
+ case J:
+ break;
+ */
+ case JP:
+ case JR:
+ case JRS:
+ {
+ bool takejump = true;
+
+ if (m_param1_type == CONDITIONAL)
+ {
+ switch (m_param1)
+ {
+ case COND_EQ_Z:
+ if (IS_ZF == 1) takejump = true;
+ else takejump = false;
+ break;
+
+ case COND_NE_NZ:
+ if (IS_ZF == 0) takejump = true;
+ else takejump = false;
+ break;
+
+ case COND_LT_CS:
+ if (IS_CF == 1) takejump = true;
+ else takejump = false;
+ break;
+
+ case COND_GE_CC:
+ if (IS_CF == 0) takejump = true;
+ else takejump = false;
+ break;
+
+ case COND_LE:
+ if ((IS_CF || IS_ZF) == 1) takejump = true;
+ else takejump = false;
+ break;
+
+ case COND_GT:
+ if ((IS_CF || IS_ZF) == 0) takejump = true;
+ else takejump = false;
+ break;
+
+ case COND_T:
+ if (IS_JF == 1) takejump = true;
+ else takejump = false;
+ break;
+
+ case COND_F:
+ if (IS_JF == 0) takejump = true;
+ else takejump = false;
+ break;
+
+ }
+ }
+
+ if (takejump)
+ {
+ // would the address / register be read even if the jump isn't going to be taken?
+ uint16_t addr = 0x0000;
+ uint16_t val = 0;
+ if (m_param2_type & ADDR_IN_BASE)
+ {
+ addr = get_addr(m_param2_type,m_param2);
+ if (m_param2_type & IS16BIT)
+ val = RM16(addr);
+ else
+ {
+ fatalerror("8-bit jump destination?");
+ // val = RM8(addr);
+ }
+ }
+ else
+ {
+ val = get_source_val(m_param2_type,m_param2);
+ }
+
+ m_pc.d = val;
+ }
+
+ SET_JF;
+
+ break;
+ }
+ case LD:
+ {
+ if ((m_param1_type & BITPOS) || (m_param2_type & BITPOS))
+ {
+ // bit operations, including the 'TEST' style bit instruction
+ uint8_t bit = 0;
+
+ if (m_param2_type == CARRYFLAG)
+ {
+ bit = IS_CF;
+
+ setbit_param(m_param1_type,m_param1,bit, false);
+
+ // for this type of operation ( LD *.b, CF ) the Jump Flag always ends up being 1
+ SET_JF;
+
+ }
+ else if (m_param1_type == CARRYFLAG)
+ {
+ getbit_param(m_param2_type,m_param2);
+
+ bit ? SET_CF : CLEAR_CF;
+ // for this type of operation ( LD CF, *.b ) the Jump Flag always ends up the inverse of the Carry Flag
+ bit ? CLEAR_JF : SET_JF;
+ }
+ else
+ {
+ fatalerror("not a bit op?! 2");
+ }
+ }
+ else
+ {
+ uint16_t addr = 0x0000;
+ uint16_t val = 0;
+ if (m_param2_type & ADDR_IN_BASE)
+ {
+ addr = get_addr(m_param2_type,m_param2);
+ if (m_param2_type & IS16BIT)
+ val = RM16(addr);
+ else
+ val = RM8(addr);
+ }
+ else
+ {
+ val = get_source_val(m_param2_type,m_param2);
+ }
+
+ SET_JF; // Jump Flag always gets set
+
+ // some (but not all) LD operations change the Zero Flag, some leave it undefined (for those we don't change it)
+ if (m_flagsaffected & FLAG_Z)
+ {
+ if (val == 0x00) SET_ZF;
+ else CLEAR_ZF;
+ }
+
+ if (m_param1_type & ADDR_IN_BASE)
+ {
+ addr = get_addr(m_param1_type,m_param1);
+ if (m_param1_type & IS16BIT)
+ WM16(addr, val);
+ else
+ WM8(addr, val);
+ }
+ else
+ {
+ set_dest_val(m_param1_type,m_param1, val);
+ }
+ }
+ break;
+ }
+ case LDW:
+ break;
+ case MCMP:
+ break;
+ case MUL:
+ break;
+ case NOP:
+ break;
+ case POP:
+ break;
+ case PUSH:
+ break;
+ case RET:
+ break;
+ case RETI:
+ break;
+ case RETN:
+ break;
+ case ROLC:
+ break;
+ case ROLD:
+ break;
+ case RORC:
+ break;
+ case RORD:
+ break;
+
+
+ case SET:
+ if ((m_param1_type & BITPOS))
+ {
+ //printf("set on bit\n");
+
+ if (m_param1_type == CARRYFLAG)
+ {
+ SET_CF;
+ CLEAR_JF;
+ }
+ else
+ {
+ //printf("set with setbit_param\n");
+
+ setbit_param(m_param1_type, m_param1, 1, true);
+ }
+ }
+ else
+ {
+ fatalerror("all SET opcode should be bit operations\n");
+ /*
+ uint16_t addr = 0x0000;
+ uint16_t val = 1;
+
+ if (m_param1_type & ADDR_IN_BASE)
+ {
+ addr = get_addr(m_param1_type,m_param1);
+ if (m_param1_type & IS16BIT)
+ WM16(addr, val);
+ else
+ WM8(addr, val);
+ }
+ else
+ {
+ set_dest_val(m_param1_type,m_param1, val);
+ }
+ */
+
+ }
+ break;
+
+
+ case SHLC:
+ break;
+ case SHRC:
+ break;
+ case SWAP:
+ break;
+ case SWI:
+ break;
+ /*
+ case TEST:
+ break;
+ */
+ case XCH:
+ break;
+ case ALU_ADDC:
+ break;
+ case ALU_ADD:
+ break;
+ case ALU_SUBB:
+ break;
+ case ALU_SUB:
+ break;
+ case ALU_AND:
+ break;
+ case ALU_XOR:
+ break;
+ case ALU_OR:
+ break;
+ case ALU_CMP:
+
+ uint16_t addr = 0x0000;
+ uint16_t val = 0;
+ if (m_param2_type & ADDR_IN_BASE)
+ {
+ addr = get_addr(m_param2_type,m_param2);
+ if (m_param2_type & IS16BIT)
+ val = RM16(addr);
+ else
+ val = RM8(addr);
+ }
+ else
+ {
+ val = get_source_val(m_param2_type,m_param2);
+ }
+
+ uint16_t val2 = val;
+
+ if (m_param1_type & ADDR_IN_BASE)
+ {
+ addr = get_addr(m_param1_type,m_param1);
+ if (m_param1_type & IS16BIT)
+ val = RM16(addr);
+ else
+ val = RM8(addr);
+ }
+ else
+ {
+ val = get_source_val(m_param1_type,m_param1);
+ }
+
+ if (val < val2)
+ {
+ SET_CF;
+ }
+ else
+ {
+ CLEAR_CF;
+ }
+
+ if (val == val2)
+ {
+ SET_ZF;
+ SET_JF;
+ }
+ else
+ {
+ CLEAR_ZF;
+ CLEAR_JF;
+ }
+
+ // TODO: HF (how to calculate it?)
+
+
+ break;
+ }
+
+ m_icount-=m_cycles*4; // 1 machine cycle = 4 clock cycles?
+
+
+ } while( m_icount > 0 );
+}
+
+void tlcs870_device::device_reset()
+{
+ // todo, read from top address
+ m_pc.d = 0xc030;
+
+ m_RBS = 0;
+
+}
+
+uint8_t tlcs870_device::get_reg8(int reg)
+{
+ return m_intram[((m_RBS & 0xf) * 8) + (reg & 0x7)];
+}
+
+void tlcs870_device::set_reg8(int reg, uint8_t val)
+{
+ m_intram[((m_RBS & 0xf) * 8) + (reg & 0x7)] = val;
+}
+
+uint16_t tlcs870_device::get_reg16(int reg)
+{
+ uint16_t res = 0;
+ res |= get_reg8(((reg & 0x3) * 2) + 1) << 8;
+ res |= get_reg8(((reg & 0x3) * 2) + 0) << 0;
+ return res;
+}
+
+void tlcs870_device::set_reg16(int reg, uint16_t val)
+{
+ set_reg8(((reg & 0x3) * 2) + 1, (val & 0xff00) >> 8);
+ set_reg8(((reg & 0x3) * 2) + 0, (val & 0x00ff) >> 0);
+}
+
+
+
+void tlcs870_device::state_import(const device_state_entry &entry)
+{
+ switch (entry.index())
+ {
+ case DEBUGGER_REG_A:
+ set_reg8(REG_A, m_debugger_temp);
+ break;
+
+ case DEBUGGER_REG_W:
+ set_reg8(REG_W, m_debugger_temp);
+ break;
+
+ case DEBUGGER_REG_C:
+ set_reg8(REG_C, m_debugger_temp);
+ break;
+
+ case DEBUGGER_REG_B:
+ set_reg8(REG_B, m_debugger_temp);
+ break;
+
+ case DEBUGGER_REG_E:
+ set_reg8(REG_E, m_debugger_temp);
+ break;
+
+ case DEBUGGER_REG_D:
+ set_reg8(REG_D, m_debugger_temp);
+ break;
+
+ case DEBUGGER_REG_L:
+ set_reg8(REG_L, m_debugger_temp);
+ break;
+
+ case DEBUGGER_REG_H:
+ set_reg8(REG_H, m_debugger_temp);
+ break;
+
+ case DEBUGGER_REG_WA:
+ set_reg16(REG_WA, m_debugger_temp);
+ break;
+
+ case DEBUGGER_REG_BC:
+ set_reg16(REG_BC, m_debugger_temp);
+ break;
+
+ case DEBUGGER_REG_DE:
+ set_reg16(REG_DE, m_debugger_temp);
+ break;
+
+ case DEBUGGER_REG_HL:
+ set_reg16(REG_HL, m_debugger_temp);
+ break;
+ }
+}
+
+
+void tlcs870_device::state_export(const device_state_entry &entry)
+{
+ switch (entry.index())
+ {
+ case DEBUGGER_REG_A:
+ m_debugger_temp = get_reg8(REG_A);
+ break;
+
+ case DEBUGGER_REG_W:
+ m_debugger_temp = get_reg8(REG_W);
+ break;
+
+ case DEBUGGER_REG_C:
+ m_debugger_temp = get_reg8(REG_C);
+ break;
+
+ case DEBUGGER_REG_B:
+ m_debugger_temp = get_reg8(REG_B);
+ break;
+
+ case DEBUGGER_REG_E:
+ m_debugger_temp = get_reg8(REG_E);
+ break;
+
+ case DEBUGGER_REG_D:
+ m_debugger_temp = get_reg8(REG_D);
+ break;
+
+ case DEBUGGER_REG_L:
+ m_debugger_temp = get_reg8(REG_L);
+ break;
+
+ case DEBUGGER_REG_H:
+ m_debugger_temp = get_reg8(REG_H);
+ break;
+
+ case DEBUGGER_REG_WA:
+ m_debugger_temp = get_reg16(REG_WA);
+ break;
+
+ case DEBUGGER_REG_BC:
+ m_debugger_temp = get_reg16(REG_BC);
+ break;
+
+ case DEBUGGER_REG_DE:
+ m_debugger_temp = get_reg16(REG_DE);
+ break;
+
+ case DEBUGGER_REG_HL:
+ m_debugger_temp = get_reg16(REG_HL);
+ break;
+
+ }
+}
+
+
+void tlcs870_device::device_start()
+{
+// int i, p;
+ m_sp.d = 0x0000;
+ m_F = 0;
+
+ m_program = &space(AS_PROGRAM);
+ m_io = &space(AS_IO);
+
+ state_add(DEBUGGER_REG_A, "A", m_debugger_temp).callimport().callexport().formatstr("%02X");
+ state_add(DEBUGGER_REG_W, "W", m_debugger_temp).callimport().callexport().formatstr("%02X");
+ state_add(DEBUGGER_REG_C, "C", m_debugger_temp).callimport().callexport().formatstr("%02X");
+ state_add(DEBUGGER_REG_B, "B", m_debugger_temp).callimport().callexport().formatstr("%02X");
+ state_add(DEBUGGER_REG_E, "E", m_debugger_temp).callimport().callexport().formatstr("%02X");
+ state_add(DEBUGGER_REG_D, "D", m_debugger_temp).callimport().callexport().formatstr("%02X");
+ state_add(DEBUGGER_REG_L, "L", m_debugger_temp).callimport().callexport().formatstr("%02X");
+ state_add(DEBUGGER_REG_H, "H", m_debugger_temp).callimport().callexport().formatstr("%02X");
+
+ state_add(DEBUGGER_REG_WA, "WA", m_debugger_temp).callimport().callexport().formatstr("%04X");
+ state_add(DEBUGGER_REG_BC, "BC", m_debugger_temp).callimport().callexport().formatstr("%04X");
+ state_add(DEBUGGER_REG_DE, "DE", m_debugger_temp).callimport().callexport().formatstr("%04X");
+ state_add(DEBUGGER_REG_HL, "HL", m_debugger_temp).callimport().callexport().formatstr("%04X");
+
+
+ state_add(STATE_GENPC, "GENPC", m_pc.w.l).formatstr("%04X");
+ state_add(STATE_GENPCBASE, "CURPC", m_prvpc.w.l).formatstr("%04X").noshow();
+ state_add(STATE_GENSP, "GENSP", m_sp.w.l).formatstr("%04X");
+ state_add(STATE_GENFLAGS, "GENFLAGS", m_F ).formatstr("%8s").noshow();
+
+ m_icountptr = &m_icount;
+}
+
+
+void tlcs870_device::state_string_export(const device_state_entry &entry, std::string &str) const
+{
+ int F = m_F;
+
+ switch (entry.index())
+ {
+
+ case STATE_GENFLAGS:
+ str = string_format("%c%c%c%c",
+ F & 0x80 ? 'J':'.',
+ F & 0x40 ? 'Z':'.',
+ F & 0x20 ? 'C':'.',
+ F & 0x10 ? 'H':'.'
+ );
+ break;
+ }
+
+}
diff --git a/src/devices/cpu/tlcs870/tlcs870.h b/src/devices/cpu/tlcs870/tlcs870.h
new file mode 100644
index 00000000000..fc4dbc0be02
--- /dev/null
+++ b/src/devices/cpu/tlcs870/tlcs870.h
@@ -0,0 +1,245 @@
+// license:BSD-3-Clause
+// copyright-holders:David Haywood
+#pragma once
+
+#ifndef TLCS870_H
+#define TLCS870_H
+
+class tlcs870_device : public cpu_device
+{
+public:
+ // construction/destruction
+ tlcs870_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source, address_map_constructor program_map);
+
+
+protected:
+ enum _e_op {
+ UNKNOWN = 0x00,
+ CALL, CALLP, CALLV, CLR, CPL,
+ DAA, DAS, DEC, /*DI,*/ DIV,
+ /*EI,*/
+ INC,
+ /*J,*/ JP, JR, JRS,
+ LD, LDW,
+ MCMP, MUL,
+ NOP,
+ POP, PUSH,
+ RET, RETI, RETN, ROLC, ROLD, RORC, RORD,
+ SET, SHLC, SHRC, SWAP, SWI,
+ /*TEST,*/ XCH,
+
+ ALU_ADDC,
+ ALU_ADD,
+ ALU_SUBB,
+ ALU_SUB,
+ ALU_AND,
+ ALU_XOR,
+ ALU_OR,
+ ALU_CMP
+ };
+
+ enum _regs8 {
+ REG_A,
+ REG_W,
+ REG_C,
+ REG_B,
+ REG_E,
+ REG_D,
+ REG_L,
+ REG_H
+ };
+
+ enum _regs16 {
+ REG_WA,
+ REG_BC,
+ REG_DE,
+ REG_HL
+ };
+
+ enum _regs16p {
+ pREG_DE,
+ pREG_HL
+ };
+
+ enum _regs_debugger {
+ DEBUGGER_REG_A,
+ DEBUGGER_REG_W,
+ DEBUGGER_REG_C,
+ DEBUGGER_REG_B,
+ DEBUGGER_REG_E,
+ DEBUGGER_REG_D,
+ DEBUGGER_REG_L,
+ DEBUGGER_REG_H,
+ DEBUGGER_REG_WA,
+ DEBUGGER_REG_BC,
+ DEBUGGER_REG_DE,
+ DEBUGGER_REG_HL
+ };
+
+ enum _conditions {
+ COND_EQ_Z,
+ COND_NE_NZ,
+ COND_LT_CS,
+ COND_GE_CC,
+ COND_LE,
+ COND_GT,
+ COND_T,
+ COND_F
+ };
+
+ uint32_t m_debugger_temp;
+
+#define IS16BIT 0x80
+#define BITPOS 0x40
+#define BITPOS_INDIRECT 0x20
+
+#define ABSOLUTE_VAL_8 0x01
+#define REG_8BIT 0x02
+
+// special
+#define CONDITIONAL 0x03
+#define STACKPOINTER (0x04 | IS16BIT) // this is a 16-bit reg
+#define CARRYFLAG (0x5 | BITPOS) // also flag as BITPOS since it's a bit operation?
+#define MEMVECTOR_16BIT 0x6
+#define REGISTERBANK 0x7
+#define PROGRAMSTATUSWORD 0x8
+
+#define ABSOLUTE_VAL_16 (ABSOLUTE_VAL_8|IS16BIT)
+#define REG_16BIT (REG_8BIT|IS16BIT)
+
+#define ADDR_IN_BASE 0x10
+#define ADDR_IN_IMM_X (ADDR_IN_BASE+0x0)
+#define ADDR_IN_PC_PLUS_REG_A (ADDR_IN_BASE+0x1)
+#define ADDR_IN_DE (ADDR_IN_BASE+0x2)
+#define ADDR_IN_HL (ADDR_IN_BASE+0x3)
+#define ADDR_IN_HL_PLUS_IMM_D (ADDR_IN_BASE+0x4)
+#define ADDR_IN_HL_PLUS_REG_C (ADDR_IN_BASE+0x5)
+#define ADDR_IN_HLINC (ADDR_IN_BASE+0x6)
+#define ADDR_IN_DECHL (ADDR_IN_BASE+0x7)
+
+#define MODE_MASK 0x1f
+
+
+#define FLAG_J (0x80)
+#define FLAG_Z (0x40)
+#define FLAG_C (0x20)
+#define FLAG_H (0x10)
+
+
+#define IS_JF ((m_F & FLAG_J) ? 1 : 0)
+#define IS_ZF ((m_F & FLAG_Z) ? 1 : 0)
+#define IS_CF ((m_F & FLAG_C) ? 1 : 0)
+#define IS_HF ((m_F & FLAG_H) ? 1 : 0)
+
+#define SET_JF (m_F |= FLAG_J)
+#define SET_ZF (m_F |= FLAG_Z)
+#define SET_CF (m_F |= FLAG_C)
+#define SET_HF (m_F |= FLAG_H)
+
+#define CLEAR_JF (m_F &= ~FLAG_J)
+#define CLEAR_ZF (m_F &= ~FLAG_Z)
+#define CLEAR_CF (m_F &= ~FLAG_C)
+#define CLEAR_HF (m_F &= ~FLAG_H)
+
+ // device-level overrides
+ virtual void device_start() override;
+ virtual void device_reset() override;
+
+ // device_execute_interface overrides
+ virtual uint32_t execute_min_cycles() const override { return 2; }
+ virtual uint32_t execute_max_cycles() const override { return 26; }
+ virtual uint32_t execute_input_lines() const override { return 1; }
+ virtual uint32_t execute_default_irq_vector() const override { return 0xff; }
+ virtual void execute_run() override;
+ virtual void execute_set_input(int inputnum, int state) override;
+
+ // device_memory_interface overrides
+ virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_IO) ? &m_io_config : nullptr ); }
+
+ // device_state_interface overrides
+ virtual void state_string_export(const device_state_entry &entry, std::string &str) const override;
+ virtual void state_import(const device_state_entry &entry) override;
+ virtual void state_export(const device_state_entry &entry) override;
+
+ // device_disasm_interface overrides
+ virtual uint32_t disasm_min_opcode_bytes() const override { return 1; }
+ virtual uint32_t disasm_max_opcode_bytes() const override { return 6; }
+ virtual void disasm_disassemble_param(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options, int type, uint16_t val);
+ virtual offs_t disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) override;
+
+private:
+
+
+ address_space_config m_program_config;
+ address_space_config m_io_config;
+ required_shared_ptr<uint8_t> m_intram;
+
+ PAIR m_prvpc, m_pc, m_sp;
+
+ address_space *m_program;
+ address_space *m_io;
+ int m_icount;
+
+ // Work registers
+ uint16_t m_op;
+ int m_param2_type;
+ uint16_t m_param2;
+
+ int m_param1_type;
+ uint16_t m_param1;
+ uint16_t m_temppc; // this is just PPC? use generic reg?
+
+ uint8_t m_bitpos;
+ uint8_t m_flagsaffected;
+ uint8_t m_cycles;
+
+ uint32_t m_addr;
+
+ uint16_t m_F;
+
+ /* CPU registers */
+ uint8_t m_RBS; // register base (4-bits)
+
+ inline uint8_t RM8 (uint32_t a);
+ inline uint16_t RM16(uint32_t a);
+ inline void WM8 (uint32_t a, uint8_t v);
+ inline void WM16(uint32_t a, uint16_t v);
+ inline uint8_t RX8 (uint32_t a, uint32_t base);
+ inline uint16_t RX16(uint32_t a, uint32_t base);
+ inline void WX8 (uint32_t a, uint8_t v, uint32_t base);
+ inline void WX16(uint32_t a, uint16_t v, uint32_t base);
+ inline uint8_t READ8();
+ inline uint16_t READ16();
+ void decode();
+ void decode_register_prefix(uint8_t b0);
+ void decode_source(int type, uint16_t val);
+ void decode_dest(uint8_t b0);
+
+ void setbit_param(uint16_t param_type, uint16_t param, uint8_t bit, bool do_flag);
+ uint8_t getbit_param(uint16_t param_type, uint16_t param);
+
+ uint16_t get_addr(uint16_t param_type, uint16_t param_val);
+ uint16_t get_source_val(uint16_t param_type, uint16_t param_val);
+ void set_dest_val(uint16_t param_type, uint16_t param_val, uint16_t dest_val);
+
+ uint8_t get_reg8(int reg);
+ void set_reg8(int reg, uint8_t val);
+ uint16_t get_reg16(int reg);
+ void set_reg16(int reg, uint16_t val);
+
+ bool stream_arg(std::ostream &stream, uint32_t pc, const char *pre, const uint16_t mode, const uint16_t r, const uint16_t rb);
+};
+
+
+class tmp87ph40an_device : public tlcs870_device
+{
+public:
+ // construction/destruction
+ tmp87ph40an_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+};
+
+
+
+extern const device_type TMP87PH40AN;
+
+#endif /* TLCS870_H */
diff --git a/src/devices/machine/fdc_pll.cpp b/src/devices/machine/fdc_pll.cpp
index bec0102f95c..ef93eda920d 100644
--- a/src/devices/machine/fdc_pll.cpp
+++ b/src/devices/machine/fdc_pll.cpp
@@ -80,7 +80,7 @@ int fdc_pll_t::feed_read_data(attotime &tm, const attotime& edge, const attotime
ctime = next;
tm = next;
- if(edge.is_never() || edge >= next) {
+ if(edge.is_never() || edge > next) {
// No transition in the window means 0 and pll in free run mode
phase_adjust = attotime::zero;
return 0;
diff --git a/src/devices/machine/phi.cpp b/src/devices/machine/phi.cpp
index 0fd0c4a90b9..18166c068cc 100644
--- a/src/devices/machine/phi.cpp
+++ b/src/devices/machine/phi.cpp
@@ -1274,7 +1274,7 @@ bool phi_device::if_cmd_received(uint8_t byte)
if (m_t_state == PHI_T_TADS) {
BIT_SET(word, REG_IFIFO_TALK_BIT);
}
- m_fifo_in.enqueue(word);
+ rx_n_data_freeze(word);
}
}
}
@@ -1320,13 +1320,8 @@ bool phi_device::byte_received(uint8_t byte , bool eoi)
LOG_0(("..stalled\n"));
return false;
} else {
- m_fifo_in.enqueue(word);
LOG_0(("..OK\n"));
- if (m_t_state != PHI_T_TACS && m_t_state != PHI_T_ID3 &&
- m_t_state != PHI_T_ID5 && m_t_state != PHI_T_SPAS) {
- // If PHI didn't send this byte to itself, set data freeze
- BIT_SET(m_reg_status, REG_STATUS_DATA_FREEZE_BIT);
- }
+ rx_n_data_freeze(word);
}
}
if (end_of_transfer) {
@@ -1340,6 +1335,15 @@ bool phi_device::byte_received(uint8_t byte , bool eoi)
return true;
}
+void phi_device::rx_n_data_freeze(uint16_t word)
+{
+ m_fifo_in.enqueue(word);
+ if (m_sh_state != PHI_SH_STRS) {
+ // If PHI didn't send this byte to itself, set data freeze
+ BIT_SET(m_reg_status, REG_STATUS_DATA_FREEZE_BIT);
+ }
+}
+
bool phi_device::ton_msg(void) const
{
return BIT(m_reg_address , REG_ADDR_TA_BIT);
diff --git a/src/devices/machine/phi.h b/src/devices/machine/phi.h
index 23a9d224108..bd1a0906143 100644
--- a/src/devices/machine/phi.h
+++ b/src/devices/machine/phi.h
@@ -276,6 +276,7 @@ private:
void clear_nba(nba_origin_t origin);
bool if_cmd_received(uint8_t byte);
bool byte_received(uint8_t byte , bool eoi);
+ void rx_n_data_freeze(uint16_t word);
bool ton_msg(void) const;
bool lon_msg(void) const;
bool odd_parity(uint8_t byte) const;
diff --git a/src/devices/machine/t10mmc.cpp b/src/devices/machine/t10mmc.cpp
index bf16dc0d8d5..ffa28c9676a 100644
--- a/src/devices/machine/t10mmc.cpp
+++ b/src/devices/machine/t10mmc.cpp
@@ -251,6 +251,41 @@ void t10mmc::ExecCommand()
m_transfer_length = 0;
break;
+ case T10MMC_CMD_PLAY_AUDIO_MSF:
+ m_lba = (command[5] % 75) + ((command[4] * 75) % (60*75)) + (command[3] * (75*60));
+ m_blocks = (command[8] % 75) + ((command[7] * 75) % (60*75)) + (command[6] * (75*60)) - m_lba;
+
+ // special cases: lba of 0 means MSF of 00:02:00
+ if (m_lba == 0)
+ {
+ m_lba = 150;
+ }
+ else if (m_lba == 0xffffffff)
+ {
+ m_device->logerror("T10MMC: play audio from current not implemented!\n");
+ }
+
+ m_device->logerror("T10MMC: PLAY AUDIO MSF at LBA %x for %x blocks (MSF %i:%i:%i - %i:%i:%i)\n",
+ m_lba, m_blocks, command[3], command[4], command[5], command[6], command[7], command[8]);
+
+ trk = cdrom_get_track(m_cdrom, m_lba);
+
+ if (cdrom_get_track_type(m_cdrom, trk) == CD_TRACK_AUDIO)
+ {
+ m_cdda->start_audio(m_lba, m_blocks);
+ m_audio_sense = SCSI_SENSE_ASC_ASCQ_AUDIO_PLAY_OPERATION_IN_PROGRESS;
+ }
+ else
+ {
+ m_device->logerror("T10MMC: track is NOT audio!\n");
+ set_sense(SCSI_SENSE_KEY_ILLEGAL_REQUEST, SCSI_SENSE_ASC_ASCQ_ILLEGAL_MODE_FOR_THIS_TRACK);
+ }
+
+ m_phase = SCSI_PHASE_STATUS;
+ m_status_code = SCSI_STATUS_CODE_GOOD;
+ m_transfer_length = 0;
+ break;
+
case T10MMC_CMD_PLAY_AUDIO_TRACK_INDEX:
// be careful: tracks here are zero-based, but the SCSI command
// uses the real CD track number which is 1-based!
diff --git a/src/devices/machine/t10mmc.h b/src/devices/machine/t10mmc.h
index b473a6f9c2b..a2598380a5f 100644
--- a/src/devices/machine/t10mmc.h
+++ b/src/devices/machine/t10mmc.h
@@ -36,6 +36,7 @@ protected:
T10MMC_CMD_READ_SUB_CHANNEL = 0x42,
T10MMC_CMD_READ_TOC_PMA_ATIP = 0x43,
T10MMC_CMD_PLAY_AUDIO_10 = 0x45,
+ T10MMC_CMD_PLAY_AUDIO_MSF = 0x47,
T10MMC_CMD_PLAY_AUDIO_TRACK_INDEX = 0x48,
T10MMC_CMD_PAUSE_RESUME = 0x4b,
T10MMC_CMD_STOP_PLAY_SCAN = 0x4e,
diff --git a/src/mame/audio/dave.cpp b/src/devices/sound/dave.cpp
index 69a7f2aec6f..69a7f2aec6f 100644
--- a/src/mame/audio/dave.cpp
+++ b/src/devices/sound/dave.cpp
diff --git a/src/mame/audio/dave.h b/src/devices/sound/dave.h
index 95bcf38fe92..95bcf38fe92 100644
--- a/src/mame/audio/dave.h
+++ b/src/devices/sound/dave.h
diff --git a/src/devices/sound/es8712.cpp b/src/devices/sound/es8712.cpp
index e7f5aa1fd75..ec5a546bab2 100644
--- a/src/devices/sound/es8712.cpp
+++ b/src/devices/sound/es8712.cpp
@@ -7,9 +7,14 @@
*
* Samples are currently looped, but whether they should and how, is unknown.
* Interface to the chip is also not 100% clear.
- * Should there be any status signals signifying busy, end of sample - etc?
*
- * Heavily borrowed from the OKI M6295 source
+ * This implementation, heavily borrowed from the OKI M6295 source, is based on
+ * almost certainly incorrect assumptions about the chip's nature. It seems
+ * that the ES8712 is actually a programmable counter which can stream ADPCM
+ * samples when hooked up to a ROM and a M5205 or M6585 (whose VCK signal can
+ * drive the counter). Neither of these seem to be used in conjunction with the
+ * ES8712 on Dream 9 and Dream 9 Final, which suggests it may have been used
+ * for an entirely different purpose there (perhaps to do with video timing).
*
**********************************************************************************************/
@@ -325,7 +330,7 @@ void es8712_device::play()
*
***********************************************************************************************/
-WRITE8_MEMBER( es8712_device::es8712_w )
+WRITE8_MEMBER(es8712_device::write)
{
switch (offset)
{
@@ -347,3 +352,12 @@ WRITE8_MEMBER( es8712_device::es8712_w )
}
m_start &= 0xfffff; m_end &= 0xfffff;
}
+
+READ8_MEMBER(es8712_device::read)
+{
+ // busy state (other bits unknown)
+ if (offset == 0)
+ return m_playing ? 1 : 0;
+
+ return 0;
+}
diff --git a/src/devices/sound/es8712.h b/src/devices/sound/es8712.h
index a2f73209930..d56494f894f 100644
--- a/src/devices/sound/es8712.h
+++ b/src/devices/sound/es8712.h
@@ -40,7 +40,8 @@ protected:
virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
public:
- DECLARE_WRITE8_MEMBER( es8712_w );
+ DECLARE_WRITE8_MEMBER(write);
+ DECLARE_READ8_MEMBER(read);
public:
void play();
diff --git a/src/devices/sound/namco.cpp b/src/devices/sound/namco.cpp
index 9e46457e9b3..ba55f89d0c9 100644
--- a/src/devices/sound/namco.cpp
+++ b/src/devices/sound/namco.cpp
@@ -19,7 +19,9 @@
Pole Position does more complicated sound mixing: a 4051 multiplexes
wavetable sound with four signals derived from the 52XX and 54XX, the
selected signal is distributed to four volume control sections, and
- finally the engine noise is mixed into all four channels.
+ finally the engine noise is mixed into all four channels. The later
+ CUS30 also uses the 99XX DAC, or two 99XX in the optional 16-channel
+ stereo configuration, but it uses no PROM and delivers its own samples.
***************************************************************************/
diff --git a/src/devices/video/cesblit.cpp b/src/devices/video/cesblit.cpp
new file mode 100644
index 00000000000..4f3ff950087
--- /dev/null
+++ b/src/devices/video/cesblit.cpp
@@ -0,0 +1,282 @@
+// license:BSD-3-Clause
+// copyright-holders:Luca Elia
+/***************************************************************************
+
+ CES Blitter, with two layers and double buffering (Xilinx FPGA)
+
+ Offset: Bits: Value:
+
+ 00
+
+ 02 fedc ba-- ---- ----
+ ---- --9- ---- ---- Layer 1 Buffer To Display
+ ---- ---8 ---- ---- Layer 0 Buffer To Display
+ ---- ---- 7654 3210
+
+ 04 Width
+ 06 X
+
+ 08 Height - 1
+ 0A Y
+
+ 0C Source Address (low)
+ 0E Source Address (mid)
+
+ 10 fedc ba-- ---- ----
+ ---- --9- ---- ---- Pen Replacement Mode
+ ---- ---8 ---- ----
+ ---- ---- 7--- ---- Layer
+ ---- ---- -6-- ---- Buffer
+ ---- ---- --5- ---- Solid Fill
+ ---- ---- ---4 ---- Enable VBlank IRQ (e.g. level 3) (0 clears the IRQ line too)
+ ---- ---- ---- 3--- Enable Blitter Finished IRQ (e.g. level 2) ""
+ ---- ---- ---- -2-- Enable Scanline IRQ (e.g. level 1) ""
+ ---- ---- ---- --1- Flip Y
+ ---- ---- ---- ---0 Flip X
+
+ Addr_Hi Register:
+
+ fedc ba98 ---- ---- Solid Fill Pen
+ ---- ---- 7654 3210 Source Address (high)
+
+ Color Register:
+
+ fedc ba98 ---- ---- Source Pen (Pen Replacement Mode)
+ ---- ---- 7654 3210 Palette (0-f) / Destination Pen (Pen Replacement Mode)
+
+ A write to the source address (mid) triggers the blit.
+ A the end of the blit, an IRQ is issued.
+
+***************************************************************************/
+
+#include "emu.h"
+#include "cesblit.h"
+
+/***************************************************************************
+ GLOBAL VARIABLES
+***************************************************************************/
+
+// device type definition
+const device_type CESBLIT = &device_creator<cesblit_device>;
+
+/***************************************************************************
+ LIVE DEVICE
+***************************************************************************/
+
+//-------------------------------------------------
+// cesblit_device - constructor
+//-------------------------------------------------
+
+cesblit_device::cesblit_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ device_t(mconfig, CESBLIT, "CES Blitter FPGA", tag, owner, clock, "cesblit", __FILE__),
+ device_video_interface(mconfig, *this),
+ device_memory_interface(mconfig, *this),
+ m_space_config("blitter_space", ENDIANNESS_BIG, 16,23),
+ m_blit_irq_cb(*this)
+{ }
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void cesblit_device::device_start()
+{
+ // resolve callbacks
+ m_blit_irq_cb.resolve();
+
+ // default to rom reading from a region
+ m_space = &space(AS_PROGRAM);
+ memory_region *region = memregion(tag());
+ if (region)
+ m_space->install_rom(0, region->bytes() - 1, region->base());
+
+ // bitmaps
+ for (int layer = 0; layer < 2; ++layer)
+ {
+ for (int buffer = 0; buffer < 2; ++buffer)
+ {
+ m_screen->register_screen_bitmap(m_bitmap[layer][buffer]);
+ m_bitmap[layer][buffer].fill(0xff);
+ }
+ }
+}
+
+/***************************************************************************
+ READ/WRITE HANDLERS
+***************************************************************************/
+
+READ16_MEMBER(cesblit_device::status_r)
+{
+ return 0x0000; // bit 7 = blitter busy
+}
+
+WRITE16_MEMBER(cesblit_device::regs_w)
+{
+ uint16_t olddata = m_regs[offset];
+ uint16_t newdata = COMBINE_DATA( &m_regs[offset] );
+
+ switch (offset)
+ {
+// case 0x00/2: // bit 15: FPGA programming serial in (lsb first)
+
+ case 0x10/2:
+ if (!m_blit_irq_cb.isnull() && !BIT(olddata, 3) && BIT(newdata, 3))
+ m_blit_irq_cb(CLEAR_LINE);
+ break;
+
+ case 0x0e/2:
+ do_blit();
+ if (!m_blit_irq_cb.isnull() && BIT(m_regs[0x10/2], 3))
+ m_blit_irq_cb(ASSERT_LINE);
+ break;
+ }
+}
+
+WRITE16_MEMBER(cesblit_device::color_w)
+{
+ COMBINE_DATA( &m_color );
+}
+
+WRITE16_MEMBER(cesblit_device::addr_hi_w)
+{
+ COMBINE_DATA( &m_addr_hi );
+}
+
+void cesblit_device::do_blit()
+{
+ int buffer = (m_regs[0x02/2] >> 8) & 3; // 1 bit per layer, selects the currently displayed buffer
+ int sw = m_regs[0x04/2];
+ int sx = m_regs[0x06/2];
+ int sh = m_regs[0x08/2] + 1;
+ int sy = m_regs[0x0a/2];
+ int addr = (*m_compute_addr)(m_regs[0x0c/2], m_regs[0x0e/2], m_addr_hi);
+ int mode = m_regs[0x10/2];
+
+ int layer = (mode >> 7) & 1; // layer to draw to
+ buffer = ((mode >> 6) & 1) ^ ((buffer >> layer) & 1); // bit 6 selects whether to use the opposite buffer to that displayed
+
+ addr <<= 1;
+
+#ifdef MAME_DEBUG
+#if 0
+ logerror("%s: blit w %03x, h %02x, x %03x, y %02x, src %06x, fill/addr_hi %04x, repl/color %04x, mode %02x\n", machine().describe_context(),
+ sw,sh,sx,sy, addr, m_addr_hi, m_color, mode
+ );
+#endif
+#endif
+
+ int flipx = mode & 1;
+ int flipy = mode & 2;
+
+ int x0,x1,y0,y1,dx,dy;
+
+ if (flipx) { x0 = sw-1; x1 = -1; dx = -1; sx -= sw-1; }
+ else { x0 = 0; x1 = sw; dx = +1; }
+
+ if (flipy) { y0 = sh-1; y1 = -1; dy = -1; sy -= sh-1; }
+ else { y0 = 0; y1 = sh; dy = +1; }
+
+ sx = (sx & 0x7fff) - (sx & 0x8000);
+ sy = (sy & 0x7fff) - (sy & 0x8000);
+
+ int color = (m_color & 0x0f) << 8;
+
+ // Draw
+
+ bitmap_ind16 &bitmap = m_bitmap[layer][buffer];
+ int x,y;
+ uint16_t pen;
+
+ switch (mode & 0x20)
+ {
+ case 0x00: // blit from ROM
+
+ if ( mode & 0x200 )
+ {
+ // copy from ROM, replacing occurrences of src pen with dst pen
+
+ uint8_t dst_pen = (m_color >> 8) & 0xff;
+ uint8_t src_pen = (m_color >> 0) & 0xff;
+
+ for (y = y0; y != y1; y += dy)
+ {
+ for (x = x0; x != x1; x += dx)
+ {
+ if ((sx + x >= 0) && (sx + x < 400) && (sy + y >= 0) && (sy + y < 256))
+ {
+ pen = m_space->read_byte(addr);
+
+ if (pen == src_pen)
+ pen = dst_pen;
+
+ if (pen != 0xff)
+ bitmap.pix16(sy + y, sx + x) = pen + color;
+ }
+ ++addr;
+ }
+ if ( (dy > 0 && (sy + y >= 256-1)) || (dy < 0 && (sy + y <= 0)) )
+ break;
+ }
+ }
+ else
+ {
+ // copy from ROM as is
+
+ for (y = y0; y != y1; y += dy)
+ {
+ for (x = x0; x != x1; x += dx)
+ {
+ if ((sx + x >= 0) && (sx + x < 400) && (sy + y >= 0) && (sy + y < 256))
+ {
+ pen = m_space->read_byte(addr);
+
+ if (pen != 0xff)
+ bitmap.pix16(sy + y, sx + x) = pen + color;
+ }
+ ++addr;
+ }
+ if ( (dy > 0 && (sy + y >= 256-1)) || (dy < 0 && (sy + y <= 0)) )
+ break;
+ }
+ }
+ break;
+
+ case 0x20: // solid fill
+ pen = ((m_addr_hi >> 8) & 0xff) + color;
+
+ if ((pen & 0xff) == 0xff)
+ pen = 0xff;
+
+ for (y = y0; y != y1; y += dy)
+ {
+ for (x = x0; x != x1; x += dx)
+ {
+ if ((sx + x >= 0) && (sx + x < 400) && (sy + y >= 0) && (sy + y < 256))
+ bitmap.pix16(sy + y, sx + x) = pen;
+ }
+ if ( (dy > 0 && (sy + y >= 256-1)) || (dy < 0 && (sy + y <= 0)) )
+ break;
+ }
+ break;
+ }
+}
+
+uint32_t cesblit_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ int layers_ctrl = -1;
+
+#ifdef MAME_DEBUG
+ if (machine().input().code_pressed(KEYCODE_Z))
+ {
+ int mask = 0;
+ if (machine().input().code_pressed(KEYCODE_Q)) mask |= 1;
+ if (machine().input().code_pressed(KEYCODE_W)) mask |= 2;
+ if (mask != 0) layers_ctrl &= mask;
+ }
+#endif
+
+ if (layers_ctrl & 1) copybitmap_trans(bitmap, m_bitmap[0][(m_regs[0x02/2]>>8)&1], 0,0,0,0, cliprect, 0xff);
+ if (layers_ctrl & 2) copybitmap_trans(bitmap, m_bitmap[1][(m_regs[0x02/2]>>9)&1], 0,0,0,0, cliprect, 0xff);
+
+ return 0;
+}
diff --git a/src/devices/video/cesblit.h b/src/devices/video/cesblit.h
new file mode 100644
index 00000000000..47709bf530d
--- /dev/null
+++ b/src/devices/video/cesblit.h
@@ -0,0 +1,84 @@
+// license:BSD-3-Clause
+// copyright-holders:Luca Elia
+/***************************************************************************
+
+ CES Blitter, with two layers and double buffering (Xilinx FPGA)
+
+***************************************************************************/
+
+#pragma once
+
+#ifndef CESBLIT_H
+#define CESBLIT_H
+
+/***************************************************************************
+ INTERFACE CONFIGURATION MACROS
+***************************************************************************/
+
+#define MCFG_CESBLIT_ADD(_tag, _screen, _clock) \
+ MCFG_DEVICE_ADD(_tag, CESBLIT, _clock) \
+ MCFG_VIDEO_SET_SCREEN(_screen)
+
+#define MCFG_CESBLIT_MAP MCFG_DEVICE_PROGRAM_MAP
+
+#define MCFG_CESBLIT_COMPUTE_ADDR(_compute_addr) \
+ cesblit_device::static_set_compute_addr(*device, _compute_addr);
+
+#define MCFG_CESBLIT_IRQ_CB(_devcb) \
+ devcb = &cesblit_device::static_set_irq_callback(*device, DEVCB_##_devcb);
+
+/***************************************************************************
+ TYPE DEFINITIONS
+***************************************************************************/
+
+// ======================> cesblit_device
+
+class cesblit_device : public device_t,
+ public device_video_interface,
+ public device_memory_interface
+{
+public:
+ typedef int (*compute_addr_t) (uint16_t reg_low, uint16_t reg_mid, uint16_t reg_high);
+
+ // construction/destruction
+ cesblit_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+ // static configuration
+ void set_compute_addr(compute_addr_t compute_addr) { m_compute_addr = compute_addr; }
+ static void static_set_compute_addr(device_t &device, compute_addr_t compute_addr) { downcast<cesblit_device &>(device).set_compute_addr(compute_addr); }
+ template<class _Object> static devcb_base &static_set_irq_callback(device_t &device, _Object object) { return downcast<cesblit_device &>(device).m_blit_irq_cb.set_callback(object); }
+
+ DECLARE_WRITE16_MEMBER(color_w);
+ DECLARE_WRITE16_MEMBER(addr_hi_w);
+ DECLARE_WRITE16_MEMBER(regs_w);
+ DECLARE_READ16_MEMBER(status_r);
+
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+
+protected:
+ // device-level overrides
+ virtual void device_start() override;
+ virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_PROGRAM) const override { return (spacenum == AS_PROGRAM) ? &m_space_config: nullptr; }
+
+ void do_blit();
+
+ address_space_config m_space_config;
+ address_space *m_space;
+
+ devcb_write_line m_blit_irq_cb; // blit finished irq
+
+ bitmap_ind16 m_bitmap[2][2];
+ uint16_t m_regs[0x12/2];
+ uint16_t m_color;
+ uint16_t m_addr_hi;
+ compute_addr_t m_compute_addr;
+};
+
+/***************************************************************************
+ GLOBAL VARIABLES
+***************************************************************************/
+
+// device type definition
+extern const device_type CESBLIT;
+
+#endif
diff --git a/src/devices/video/mc6845.cpp b/src/devices/video/mc6845.cpp
index 10dd1421f35..94578bda3c6 100644
--- a/src/devices/video/mc6845.cpp
+++ b/src/devices/video/mc6845.cpp
@@ -954,7 +954,7 @@ uint8_t mc6845_device::draw_scanline(int y, bitmap_rgb32 &bitmap, const rectangl
uint8_t cr = y / (m_max_ras_addr + (MODE_INTERLACE_AND_VIDEO ? m_interlace_adjust : m_noninterlace_adjust));
uint16_t ma = (cr << 8) | cc;
- m_update_row_cb(bitmap, cliprect, ma, ra, y, m_horiz_disp, cursor_x, de, hbp, vbp);
+ m_update_row_cb(bitmap, cliprect, ma + m_disp_start_addr, ra, y, m_horiz_disp, cursor_x, de, hbp, vbp);
}
else
{
diff --git a/src/mame/video/ppu2c0x.cpp b/src/devices/video/ppu2c0x.cpp
index c86bed6c6fb..c86bed6c6fb 100644
--- a/src/mame/video/ppu2c0x.cpp
+++ b/src/devices/video/ppu2c0x.cpp
diff --git a/src/mame/video/ppu2c0x.h b/src/devices/video/ppu2c0x.h
index d426630eb64..d426630eb64 100644
--- a/src/mame/video/ppu2c0x.h
+++ b/src/devices/video/ppu2c0x.h
diff --git a/src/devices/video/tms9927.cpp b/src/devices/video/tms9927.cpp
index b0553642316..3c36f644c69 100644
--- a/src/devices/video/tms9927.cpp
+++ b/src/devices/video/tms9927.cpp
@@ -16,8 +16,8 @@ static const uint8_t skew_bits_value[4] = { 0, 1, 2, 2 };
#define HCOUNT (m_reg[0] + 1)
#define INTERLACED ((m_reg[1] >> 7) & 0x01)
-#define HSYNC_WIDTH ((m_reg[1] >> 4) & 0x0f)
-#define HSYNC_DELAY ((m_reg[1] >> 0) & 0x07)
+#define HSYNC_WIDTH (((m_reg[1] >> 3) & 0x0f) + 1)
+#define HSYNC_DELAY (((m_reg[1] >> 0) & 0x07) + 1)
#define SCANS_PER_DATA_ROW (((m_reg[2] >> 3) & 0x0f) + 1)
#define CHARS_PER_DATA_ROW (chars_per_row_value[(m_reg[2] >> 0) & 0x07])
#define SKEW_BITS (skew_bits_value[(m_reg[3] >> 6) & 0x03])
@@ -45,6 +45,10 @@ tms9927_device::tms9927_device(const machine_config &mconfig, device_type type,
, device_video_interface(mconfig, *this)
, m_write_vsyn(*this)
, m_hpixels_per_column(0)
+ , m_overscan_left(0)
+ , m_overscan_right(0)
+ , m_overscan_top(0)
+ , m_overscan_bottom(0)
, m_selfload(*this, finder_base::DUMMY_TAG)
, m_reset(0)
{
@@ -108,7 +112,7 @@ void tms9927_device::device_reset()
void tms9927_device::device_stop()
{
- osd_printf_debug("TMS9937: Final params: (%d, %d, %d, %d, %d, %d, %d)\n",
+ osd_printf_debug("TMS9927: Final params: (%d, %d, %d, %d, %d, %d, %d)\n",
m_clock,
m_total_hpix,
0, m_visible_hpix,
@@ -194,7 +198,6 @@ void tms9927_device::generic_access(address_space &space, offs_t offset)
}
}
-
WRITE8_MEMBER( tms9927_device::write )
{
switch (offset)
@@ -270,8 +273,7 @@ int tms9927_device::cursor_bounds(rectangle &bounds)
void tms9927_device::recompute_parameters(bool postload)
{
- uint16_t offset_hpix, offset_vpix;
- attoseconds_t refresh;
+ attoseconds_t refresh;
rectangle visarea;
if (m_reset)
@@ -286,11 +288,8 @@ void tms9927_device::recompute_parameters(bool postload)
m_visible_vpix = DATA_ROWS_PER_FRAME * SCANS_PER_DATA_ROW;
m_start_datarow = (LAST_DISP_DATA_ROW + 1) % DATA_ROWS_PER_FRAME;
- /* determine the horizontal/vertical offsets */
- offset_hpix = HSYNC_DELAY * m_hpixels_per_column;
- offset_vpix = VERTICAL_DATA_START;
- osd_printf_debug("TMS9937: Total = %dx%d, Visible = %dx%d, Offset=%dx%d, Skew=%d, Upscroll=%d\n", m_total_hpix, m_total_vpix, m_visible_hpix, m_visible_vpix, offset_hpix, offset_vpix, SKEW_BITS, m_start_datarow);
+ osd_printf_debug("TMS9927: Total = %dx%d, Visible = %dx%d, Skew=%d, Upscroll=%d\n", m_total_hpix, m_total_vpix, m_visible_hpix, m_visible_vpix, SKEW_BITS, m_start_datarow);
/* see if it all makes sense */
m_valid_config = true;
@@ -310,10 +309,10 @@ void tms9927_device::recompute_parameters(bool postload)
/* update */
if (!m_valid_config)
return;
-
+
/* create a visible area */
- /* fix me: how do the offsets fit in here? */
- visarea.set(0, m_visible_hpix - 1, 0, m_visible_vpix - 1);
+ visarea.set(0, m_overscan_left + m_visible_hpix + m_overscan_right - 1,
+ 0, m_overscan_top + m_visible_vpix + m_overscan_bottom - 1);
refresh = HZ_TO_ATTOSECONDS(m_clock) * m_total_hpix * m_total_vpix;
@@ -321,4 +320,5 @@ void tms9927_device::recompute_parameters(bool postload)
m_vsyn = 0;
m_vsync_timer->adjust(m_screen->time_until_pos(0, 0));
+
}
diff --git a/src/devices/video/tms9927.h b/src/devices/video/tms9927.h
index eac4fdc8463..11a3648fbf8 100644
--- a/src/devices/video/tms9927.h
+++ b/src/devices/video/tms9927.h
@@ -19,7 +19,9 @@
#define MCFG_TMS9927_REGION(_tag) \
tms9927_device::set_region_tag(*device, "^" _tag);
-
+#define MCFG_TMS9927_OVERSCAN(_left, _right, _top, _bottom) \
+ tms9927_device::set_overscan(*device, _left, _right, _top, _bottom);
+
class tms9927_device : public device_t,
public device_video_interface
{
@@ -32,7 +34,14 @@ public:
static void set_char_width(device_t &device, int pixels) { downcast<tms9927_device &>(device).m_hpixels_per_column = pixels; }
static void set_region_tag(device_t &device, const char *tag) { downcast<tms9927_device &>(device).m_selfload.set_tag(tag); }
-
+ static void set_overscan(device_t &device, int left, int right, int top, int bottom) {
+ tms9927_device &dev = downcast<tms9927_device &>(device);
+ dev.m_overscan_left = left;
+ dev.m_overscan_right = right;
+ dev.m_overscan_top = top;
+ dev.m_overscan_bottom = bottom;
+ }
+
DECLARE_WRITE8_MEMBER(write);
DECLARE_READ8_MEMBER(read);
@@ -59,7 +68,11 @@ private:
devcb_write_line m_write_vsyn;
int m_hpixels_per_column; /* number of pixels per video memory address */
-
+ uint16_t m_overscan_left;
+ uint16_t m_overscan_right;
+ uint16_t m_overscan_top;
+ uint16_t m_overscan_bottom;
+
// internal state
optional_region_ptr<uint8_t> m_selfload;
@@ -68,12 +81,13 @@ private:
uint8_t m_reg[9];
uint8_t m_start_datarow;
uint8_t m_reset;
-
+
/* derived state; no need to save */
uint8_t m_valid_config;
uint16_t m_total_hpix, m_total_vpix;
uint16_t m_visible_hpix, m_visible_vpix;
+
int m_vsyn;
emu_timer *m_vsync_timer;
diff --git a/src/emu/debug/express.cpp b/src/emu/debug/express.cpp
index 0aa123f1d11..6e3a6a65354 100644
--- a/src/emu/debug/express.cpp
+++ b/src/emu/debug/express.cpp
@@ -952,7 +952,18 @@ void parsed_expression::parse_symbol_or_number(parse_token &token, const char *&
// if we have an 0b prefix, we must be a binary value
case 'b':
case 'B':
- return parse_number(token, buffer.c_str() + 2, 2, expression_error::INVALID_NUMBER);
+ try
+ {
+ return parse_number(token, buffer.c_str() + 2, 2, expression_error::INVALID_NUMBER);
+ }
+ catch (expression_error const &err)
+ {
+ // this is really a hack, but 0B1234 could also hex depending on default base
+ if (expression_error::INVALID_NUMBER == err)
+ return parse_number(token, buffer.c_str(), DEFAULT_BASE, expression_error::INVALID_NUMBER);
+ else
+ throw;
+ }
// TODO: for octal address spaces, treat 0123 as octal
default:
diff --git a/src/emu/devfind.h b/src/emu/devfind.h
index d74799c5672..63efc179834 100644
--- a/src/emu/devfind.h
+++ b/src/emu/devfind.h
@@ -17,6 +17,10 @@
#pragma once
+#include <iterator>
+#include <stdexcept>
+#include <type_traits>
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -65,6 +69,27 @@ private:
T m_array[Count];
public:
+ /// \brief Element type for Container concept
+ typedef T value_type;
+
+ /// \brief Reference to element type for Container concept
+ typedef T &reference;
+
+ /// \brief Reference to constant element type for Container concept
+ typedef T const &const_reference;
+
+ /// \brief Iterator for Container concept
+ typedef T *iterator;
+
+ /// \brief Constant iterator for Container concept
+ typedef T const *const_iterator;
+
+ /// \brief Iterator difference type for Container concept
+ typedef typename std::iterator_traits<iterator>::difference_type difference_type;
+
+ /// \brief Size type for Container concept
+ typedef std::make_unsigned_t<difference_type> size_type;
+
/// \brief Construct with programmatically generated tags
///
/// Specify a format string and starting number. A single unsigned
@@ -102,11 +127,72 @@ public:
{
}
+ /// \brief Get iterator to first element
+ ///
+ /// Returns an iterator to the first element in the array.
+ /// \return Iterator to first element.
+ const_iterator begin() const { return m_array; }
+ iterator begin() { return m_array; }
+
+ /// \brief Get iterator beyond last element
+ ///
+ /// Returns an iterator one past the last element in the array.
+ /// \return Iterator one past last element.
+ const_iterator end() const { return m_array + Count; }
+ iterator end() { return m_array + Count; }
+
+ /// \brief Get constant iterator to first element
+ ///
+ /// Returns a constant iterator to the first element in the array.
+ /// \return Constant iterator to first element.
+ const_iterator cbegin() const { return m_array; }
+
+ /// \brief Get constant iterator beyond last element
+ ///
+ /// Returns aconstant iterator one past the last element in the
+ /// array.
+ /// \return Constant iterator one past last element.
+ const_iterator cend() const { return m_array + Count; }
+
+ /// \brief Get array size
+ ///
+ /// Returns number of elements in the array (compile-time constant).
+ /// \return The size of the array.
+ constexpr size_type size() const { return Count; }
+
+ /// \brief Get maximum array size
+ ///
+ /// Returns maximum number of elements in the array (compile-time
+ /// constant, always equal to the size of the array).
+ /// \return The size of the array.
+ constexpr size_type max_size() const { return Count; }
+
+ /// \brief Does array have no elements
+ ///
+ /// Returns whether the arary has no elements (compile-time
+ /// constant).
+ /// \return True if the array has no elements, false otherwise.
+ constexpr bool empty() const { return !Count; }
+
+ /// \brief Get first element
+ ///
+ /// Returns a reference to the first element in the array.
+ /// \return Reference to first element.
+ T const &front() const { return m_array[0]; }
+ T &front() { return m_array[0]; }
+
+ /// \brief Get last element
+ ///
+ /// Returns a reference to the last element in the array.
+ /// \return Reference to last element.
+ T const &back() const { return m_array[Count - 1]; }
+ T &back() { return m_array[Count - 1]; }
+
/// \brief Element accessor (const)
///
/// Returns a const reference to the element at the supplied index.
/// \param [in] index Index of desired element (zero-based).
- /// \return Reference to element at specified index.
+ /// \return Constant reference to element at specified index.
T const &operator[](unsigned index) const { assert(index < Count); return m_array[index]; }
/// \brief Element accessor (non-const)
@@ -116,11 +202,16 @@ public:
/// \return Reference to element at specified index.
T &operator[](unsigned index) { assert(index < Count); return m_array[index]; }
- /// \brief Get array size
+ /// \brief Checked element accesor
///
- /// Returns number of objects in array (compile-time constant).
- /// \return The size of the array.
- constexpr unsigned size() const { return Count; }
+ /// Returns a reference to the element at the supplied index if less
+ /// than the size of the array, or throws std::out_of_range
+ /// otherwise.
+ /// \param [in] index Index of desired element (zero-based).
+ /// \return Reference to element at specified index.
+ /// \throw std::out_of_range
+ T const &at(unsigned index) const { if (Count > index) return m_array[index]; else throw std::out_of_range("Index out of range"); }
+ T &at(unsigned index) { if (Count > index) return m_array[index]; else throw std::out_of_range("Index out of range"); }
};
diff --git a/src/emu/ioport.cpp b/src/emu/ioport.cpp
index 4d106912d7b..6ffff130915 100644
--- a/src/emu/ioport.cpp
+++ b/src/emu/ioport.cpp
@@ -1388,9 +1388,9 @@ ioport_field_live::ioport_field_live(ioport_field &field, analog_field *analog)
if (field.type_class() == INPUT_CLASS_KEYBOARD && field.specific_name() == nullptr)
{
// loop through each character on the field
- for (int which = 0; ; which++)
+ for (int which = 0; which < 4; which++)
{
- char32_t ch = field.keyboard_code(which);
+ char32_t const ch = field.keyboard_code(which);
if (ch == 0)
break;
name.append(string_format("%-*s ", std::max(SPACE_COUNT - 1, 0), field.key_name(which)));
diff --git a/src/emu/natkeyboard.cpp b/src/emu/natkeyboard.cpp
index a5d856a20e9..e1921b7a21d 100644
--- a/src/emu/natkeyboard.cpp
+++ b/src/emu/natkeyboard.cpp
@@ -314,17 +314,18 @@ const char_info charinfo[] =
//-------------------------------------------------
natural_keyboard::natural_keyboard(running_machine &machine)
- : m_machine(machine),
- m_in_use(false),
- m_bufbegin(0),
- m_bufend(0),
- m_status_keydown(false),
- m_last_cr(false),
- m_timer(nullptr),
- m_current_rate(attotime::zero),
- m_queue_chars(),
- m_accept_char(),
- m_charqueue_empty()
+ : m_machine(machine)
+ , m_in_use(false)
+ , m_bufbegin(0)
+ , m_bufend(0)
+ , m_fieldnum(0)
+ , m_status_keydown(false)
+ , m_last_cr(false)
+ , m_timer(nullptr)
+ , m_current_rate(attotime::zero)
+ , m_queue_chars()
+ , m_accept_char()
+ , m_charqueue_empty()
{
// try building a list of keycodes; if none are available, don't bother
build_codes(machine.ioport());
@@ -571,48 +572,68 @@ void natural_keyboard::post_coded(const char *text, size_t length, const attotim
void natural_keyboard::build_codes(ioport_manager &manager)
{
- // iterate over shift keys
- ioport_field *shift[UCHAR_SHIFT_END + 1 - UCHAR_SHIFT_BEGIN] = { nullptr };
- for (int curshift = 0; curshift <= ARRAY_LENGTH(shift); curshift++)
- if (curshift == 0 || shift[curshift - 1] != nullptr)
-
- // iterate over ports and fields
- for (auto &port : manager.ports())
- for (ioport_field &field : port.second->fields())
- if (field.type() == IPT_KEYBOARD)
- {
- // fetch the code, ignoring 0
- char32_t code = field.keyboard_code(curshift);
- if (code == 0)
- continue;
-
- // is this a shifter key?
- if (code >= UCHAR_SHIFT_BEGIN && code <= UCHAR_SHIFT_END)
- shift[code - UCHAR_SHIFT_BEGIN] = &field;
+ // find all shfit keys
+ unsigned mask = 0;
+ ioport_field *shift[SHIFT_COUNT];
+ std::fill(std::begin(shift), std::end(shift), nullptr);
+ for (auto const &port : manager.ports())
+ {
+ for (ioport_field &field : port.second->fields())
+ {
+ if (field.type() == IPT_KEYBOARD)
+ {
+ char32_t const code = field.keyboard_code(0);
+ if ((code >= UCHAR_SHIFT_BEGIN) && (code <= UCHAR_SHIFT_END))
+ {
+ mask |= 1U << (code - UCHAR_SHIFT_BEGIN);
+ shift[code - UCHAR_SHIFT_BEGIN] = &field;
+ }
+ }
+ }
+ }
- // not a shifter key; record normally
- else
+ // iterate over ports and fields
+ for (auto const &port : manager.ports())
+ {
+ for (ioport_field &field : port.second->fields())
+ {
+ if (field.type() == IPT_KEYBOARD)
+ {
+ // iterate over all shift states
+ for (unsigned curshift = 0; curshift < SHIFT_STATES; ++curshift)
+ {
+ if (!(curshift & ~mask))
+ {
+ // fetch the code, ignoring 0 and shiters
+ char32_t const code = field.keyboard_code(curshift);
+ if (((code < UCHAR_SHIFT_BEGIN) || (code > UCHAR_SHIFT_END)) && (code != 0))
{
keycode_map_entry newcode;
- if (curshift == 0)
- {
- newcode.field[0] = &field;
- newcode.field[1] = nullptr;
- }
- else
+ newcode.ch = code;
+ std::fill(std::begin(newcode.field), std::end(newcode.field), nullptr);
+
+ unsigned fieldnum = 0;
+ for (unsigned i = 0, bits = curshift; (i < SHIFT_COUNT) && bits; ++i, bits >>= 1)
{
- newcode.field[0] = shift[curshift - 1];
- newcode.field[1] = &field;
+ if (BIT(bits, 0))
+ newcode.field[fieldnum++] = shift[i];
}
- newcode.ch = code;
- m_keycode_map.push_back(newcode);
+
+ assert(fieldnum < ARRAY_LENGTH(newcode.field));
+ newcode.field[fieldnum] = &field;
+ m_keycode_map.push_back(std::move(newcode));
if (LOG_NATURAL_KEYBOARD)
{
- machine().logerror("natural_keyboard: code=%i (%s) port=%p field.name='%s'\n", int(code), unicode_to_string(code).c_str(), (void *)&port, field.name());
+ machine().logerror("natural_keyboard: code=%u (%s) port=%p field.name='%s'\n",
+ code, unicode_to_string(code), (void *)&port, field.name());
}
}
}
+ }
+ }
+ }
+ }
}
@@ -692,7 +713,8 @@ void natural_keyboard::internal_post(char32_t ch)
if (empty())
{
m_timer->adjust(choose_delay(ch));
- m_status_keydown = 0;
+ m_fieldnum = 0;
+ m_status_keydown = false;
}
// add to the buffer, resizing if necessary
@@ -710,9 +732,9 @@ void natural_keyboard::internal_post(char32_t ch)
void natural_keyboard::timer(void *ptr, int param)
{
- // the driver has a queue_chars handler
if (!m_queue_chars.isnull())
{
+ // the driver has a queue_chars handler
while (!empty() && m_queue_chars(&m_buffer[m_bufbegin], 1))
{
m_bufbegin = (m_bufbegin + 1) % m_buffer.size();
@@ -720,36 +742,46 @@ void natural_keyboard::timer(void *ptr, int param)
break;
}
}
-
- // the driver does not have a queue_chars handler
else
{
+ // the driver does not have a queue_chars handler
+
// loop through this character's component codes
- const bool new_keydown = !m_status_keydown;
const keycode_map_entry *const code = find_code(m_buffer[m_bufbegin]);
- if (code != nullptr)
+ bool advance;
+ if (code)
{
- for (int fieldnum = 0; fieldnum < ARRAY_LENGTH(code->field); fieldnum++)
+ do
{
- ioport_field *const field = code->field[fieldnum];
- if (field == nullptr)
- break;
+ assert(m_fieldnum < ARRAY_LENGTH(code->field));
- // special handling for toggle fields
- if (field->live().toggle)
+ ioport_field *const field = code->field[m_fieldnum];
+ if (field)
{
- if (new_keydown)
+ // special handling for toggle fields
+ if (!field->live().toggle)
+ field->set_value(!m_status_keydown);
+ else if (!m_status_keydown)
field->set_value(!field->digital_value());
}
- else
- field->set_value(new_keydown);
}
+ while (code->field[m_fieldnum] && (++m_fieldnum < ARRAY_LENGTH(code->field)) && m_status_keydown);
+ advance = (m_fieldnum >= ARRAY_LENGTH(code->field)) || !code->field[m_fieldnum];
+ }
+ else
+ {
+ advance = true;
}
- // proceed to next character when keydown expires
- if (!new_keydown)
- m_bufbegin = (m_bufbegin + 1) % m_buffer.size();
- m_status_keydown = new_keydown;
+ if (advance)
+ {
+ m_fieldnum = 0;
+ m_status_keydown = !m_status_keydown;
+
+ // proceed to next character when keydown expires
+ if (!m_status_keydown)
+ m_bufbegin = (m_bufbegin + 1) % m_buffer.size();
+ }
}
// need to make sure timerproc is called again if buffer not empty
diff --git a/src/emu/natkeyboard.h b/src/emu/natkeyboard.h
index 74bc9ac72d5..e89d9b3f2ca 100644
--- a/src/emu/natkeyboard.h
+++ b/src/emu/natkeyboard.h
@@ -7,12 +7,11 @@
Natural keyboard input support.
***************************************************************************/
-
-#pragma once
-
#ifndef EMU_NATKEYBOARD_H
#define EMU_NATKEYBOARD_H
+#pragma once
+
//**************************************************************************
// TYPE DEFINITIONS
@@ -57,11 +56,17 @@ public:
std::string dump();
private:
+ enum
+ {
+ SHIFT_COUNT = UCHAR_SHIFT_END - UCHAR_SHIFT_BEGIN + 1,
+ SHIFT_STATES = 1 << SHIFT_COUNT
+ };
+
// internal keyboard code information
struct keycode_map_entry
{
- char32_t ch;
- ioport_field * field[UCHAR_SHIFT_END + 1 - UCHAR_SHIFT_BEGIN];
+ char32_t ch;
+ ioport_field * field[SHIFT_COUNT + 1];
};
// internal helpers
@@ -80,6 +85,7 @@ private:
u32 m_bufbegin; // index of starting character
u32 m_bufend; // index of ending character
std::vector<char32_t> m_buffer; // actual buffer
+ unsigned m_fieldnum; // current step in multi-key sequence
bool m_status_keydown; // current keydown status
bool m_last_cr; // was the last char a CR?
emu_timer * m_timer; // timer for posting characters
diff --git a/src/frontend/mame/cheat.cpp b/src/frontend/mame/cheat.cpp
index 2c758ed1020..606d1ec74f0 100644
--- a/src/frontend/mame/cheat.cpp
+++ b/src/frontend/mame/cheat.cpp
@@ -73,13 +73,19 @@
***************************************************************************/
#include "emu.h"
-#include "emuopts.h"
+#include "cheat.h"
+
#include "mame.h"
#include "ui/ui.h"
#include "ui/menu.h"
-#include "cheat.h"
-#include "debug/debugcpu.h"
+
#include "debugger.h"
+#include "emuopts.h"
+#include "debug/debugcpu.h"
+
+#include <cstring>
+#include <iterator>
+#include <utility>
#include <ctype.h>
@@ -133,18 +139,18 @@ inline std::string number_and_format::format() const
//-------------------------------------------------
cheat_parameter::cheat_parameter(cheat_manager &manager, symbol_table &symbols, const char *filename, util::xml::data_node const &paramnode)
- : m_value(0)
+ : m_minval(number_and_format(paramnode.get_attribute_int("min", 0), paramnode.get_attribute_int_format("min")))
+ , m_maxval(number_and_format(paramnode.get_attribute_int("max", 0), paramnode.get_attribute_int_format("max")))
+ , m_stepval(number_and_format(paramnode.get_attribute_int("step", 1), paramnode.get_attribute_int_format("step")))
+ , m_value(0)
+ , m_curtext()
+ , m_itemlist()
{
- // read the core attributes
- m_minval = number_and_format(paramnode.get_attribute_int("min", 0), paramnode.get_attribute_int_format("min"));
- m_maxval = number_and_format(paramnode.get_attribute_int("max", 0), paramnode.get_attribute_int_format("max"));
- m_stepval = number_and_format(paramnode.get_attribute_int("step", 1), paramnode.get_attribute_int_format("step"));
-
// iterate over items
for (util::xml::data_node const *itemnode = paramnode.get_child("item"); itemnode != nullptr; itemnode = itemnode->get_next_sibling("item"))
{
// check for nullptr text
- if (itemnode->get_value() == nullptr || itemnode->get_value()[0] == 0)
+ if (!itemnode->get_value() || !itemnode->get_value()[0])
throw emu_fatalerror("%s.xml(%d): item is missing text\n", filename, itemnode->line);
// check for non-existant value
@@ -152,16 +158,14 @@ cheat_parameter::cheat_parameter(cheat_manager &manager, symbol_table &symbols,
throw emu_fatalerror("%s.xml(%d): item is value\n", filename, itemnode->line);
// extract the parameters
- uint64_t const value = itemnode->get_attribute_int("value", 0);
- util::xml::data_node::int_format const format = itemnode->get_attribute_int_format("value");
+ uint64_t const value(itemnode->get_attribute_int("value", 0));
+ util::xml::data_node::int_format const format(itemnode->get_attribute_int_format("value"));
// allocate and append a new item
- auto curitem = std::make_unique<item>(itemnode->get_value(), value, format);
+ item &curitem(*m_itemlist.emplace(m_itemlist.end(), itemnode->get_value(), value, format));
// ensure the maximum expands to suit
- m_maxval = std::max(m_maxval, curitem->value());
-
- m_itemlist.push_back(std::move(curitem));
+ m_maxval = std::max(m_maxval, curitem.value());
}
// add a variable to the symbol table for our value
@@ -178,18 +182,20 @@ const char *cheat_parameter::text()
// are we a value cheat?
if (!has_itemlist())
{
- m_curtext = string_format("%d (0x%X)", uint32_t(m_value), uint32_t(m_value));
+ m_curtext = string_format("%u (0x%X)", uint64_t(m_value), uint64_t(m_value));
}
else
{
// if not, we're an item cheat
- m_curtext = string_format("??? (%d)", uint32_t(m_value));
- for (auto &curitem : m_itemlist)
- if (curitem->value() == m_value)
+ m_curtext = string_format("??? (%u)", uint64_t(m_value));
+ for (item const &curitem : m_itemlist)
+ {
+ if (curitem.value() == m_value)
{
- m_curtext.assign(curitem->text());
+ m_curtext = curitem.text();
break;
}
+ }
}
return m_curtext.c_str();
}
@@ -204,9 +210,9 @@ void cheat_parameter::save(emu_file &cheatfile) const
// output the parameter tag
cheatfile.printf("\t\t<parameter");
- // if no items, just output min/max/step
if (!has_itemlist())
{
+ // if no items, just output min/max/step
if (m_minval != 0)
cheatfile.printf(" min=\"%s\"", m_minval.format().c_str());
if (m_maxval != 0)
@@ -215,13 +221,12 @@ void cheat_parameter::save(emu_file &cheatfile) const
cheatfile.printf(" step=\"%s\"", m_stepval.format().c_str());
cheatfile.printf("/>\n");
}
-
- // iterate over items
else
{
+ // iterate over items
cheatfile.printf(">\n");
- for (auto &curitem : m_itemlist)
- cheatfile.printf("\t\t\t<item value=\"%s\">%s</item>\n", curitem->value().format().c_str(), curitem->text());
+ for (item const &curitem : m_itemlist)
+ cheatfile.printf("\t\t\t<item value=\"%s\">%s</item>\n", curitem.value().format().c_str(), curitem.text());
cheatfile.printf("\t\t</parameter>\n");
}
}
@@ -233,12 +238,12 @@ void cheat_parameter::save(emu_file &cheatfile) const
bool cheat_parameter::set_minimum_state()
{
- uint64_t origvalue = m_value;
+ uint64_t const origvalue(m_value);
// set based on whether we have an item list
- m_value = (!has_itemlist()) ? m_minval : m_itemlist.front()->value();
+ m_value = !has_itemlist() ? m_minval : m_itemlist.front().value();
- return (m_value != origvalue);
+ return m_value != origvalue;
}
@@ -248,31 +253,26 @@ bool cheat_parameter::set_minimum_state()
bool cheat_parameter::set_prev_state()
{
- uint64_t origvalue = m_value;
+ uint64_t const origvalue(m_value);
- // are we a value cheat?
if (!has_itemlist())
{
- if (m_value < m_minval + m_stepval)
+ // are we a value cheat?
+ if (m_value < (m_minval + m_stepval))
m_value = m_minval;
else
m_value -= m_stepval;
}
-
- // if not, we're an item cheat
else
{
- item *previtem = nullptr;
- for (auto &curitem : m_itemlist) {
- if (curitem->value() == m_value)
- break;
- previtem = curitem.get();
- }
- if (previtem != nullptr)
- m_value = previtem->value();
+ // if not, we're an item cheat
+ std::vector<item>::const_iterator it;
+ for (it = m_itemlist.begin(); (m_itemlist.end() != it) && (it->value() != m_value); ++it) { }
+ if (m_itemlist.begin() != it)
+ m_value = std::prev(it)->value();
}
- return (m_value != origvalue);
+ return m_value != origvalue;
}
@@ -282,29 +282,26 @@ bool cheat_parameter::set_prev_state()
bool cheat_parameter::set_next_state()
{
- uint64_t origvalue = m_value;
+ uint64_t const origvalue(m_value);
- // are we a value cheat?
if (!has_itemlist())
{
+ // are we a value cheat?
if (m_value > m_maxval - m_stepval)
m_value = m_maxval;
else
m_value += m_stepval;
}
-
- // if not, we're an item cheat
else
{
- std::vector<std::unique_ptr<item>>::iterator it;
- for (it = m_itemlist.begin(); it != m_itemlist.end(); ++it)
- if (it->get()->value() == m_value)
- break;
- if (it != m_itemlist.end() && (++it != m_itemlist.end()))
- m_value = it->get()->value();
+ // if not, we're an item cheat
+ std::vector<item>::const_iterator it;
+ for (it = m_itemlist.begin(); (m_itemlist.end() != it) && (it->value() != m_value); ++it) { }
+ if ((m_itemlist.end() != it) && (m_itemlist.end() != ++it))
+ m_value = it->value();
}
- return (m_value != origvalue);
+ return m_value != origvalue;
}
@@ -317,37 +314,33 @@ bool cheat_parameter::set_next_state()
// cheat_script - constructor
//-------------------------------------------------
-cheat_script::cheat_script(cheat_manager &manager, symbol_table &symbols, const char *filename, util::xml::data_node const &scriptnode)
+cheat_script::cheat_script(
+ cheat_manager &manager,
+ symbol_table &symbols,
+ char const *filename,
+ util::xml::data_node const &scriptnode)
: m_state(SCRIPT_STATE_RUN)
{
// read the core attributes
- const char *state = scriptnode.get_attribute_string("state", "run");
- if (strcmp(state, "on") == 0)
+ char const *const state(scriptnode.get_attribute_string("state", "run"));
+ if (!std::strcmp(state, "on"))
m_state = SCRIPT_STATE_ON;
- else if (strcmp(state, "off") == 0)
+ else if (!std::strcmp(state, "off"))
m_state = SCRIPT_STATE_OFF;
- else if (strcmp(state, "change") == 0)
+ else if (!std::strcmp(state, "change"))
m_state = SCRIPT_STATE_CHANGE;
- else if (strcmp(state, "run") != 0)
+ else if (std::strcmp(state, "run"))
throw emu_fatalerror("%s.xml(%d): invalid script state '%s'\n", filename, scriptnode.line, state);
// iterate over nodes within the script
for (util::xml::data_node const *entrynode = scriptnode.get_first_child(); entrynode != nullptr; entrynode = entrynode->get_next_sibling())
{
- // handle action nodes
- if (strcmp(entrynode->get_name(), "action") == 0)
+ if (!std::strcmp(entrynode->get_name(), "action")) // handle action nodes
m_entrylist.push_back(std::make_unique<script_entry>(manager, symbols, filename, *entrynode, true));
-
- // handle output nodes
- else if (strcmp(entrynode->get_name(), "output") == 0)
+ else if (!std::strcmp(entrynode->get_name(), "output")) // handle output nodes
m_entrylist.push_back(std::make_unique<script_entry>(manager, symbols, filename, *entrynode, false));
-
- // anything else is ignored
- else
- {
+ else // anything else is ignored
osd_printf_warning("%s.xml(%d): unknown script item '%s' will be lost if saved\n", filename, entrynode->line, entrynode->get_name());
- continue;
- }
}
}
@@ -378,11 +371,11 @@ void cheat_script::save(emu_file &cheatfile) const
cheatfile.printf("\t\t<script");
switch (m_state)
{
- case SCRIPT_STATE_OFF: cheatfile.printf(" state=\"off\""); break;
- case SCRIPT_STATE_ON: cheatfile.printf(" state=\"on\""); break;
- default:
- case SCRIPT_STATE_RUN: cheatfile.printf(" state=\"run\""); break;
- case SCRIPT_STATE_CHANGE: cheatfile.printf(" state=\"change\""); break;
+ case SCRIPT_STATE_OFF: cheatfile.printf(" state=\"off\""); break;
+ case SCRIPT_STATE_ON: cheatfile.printf(" state=\"on\""); break;
+ default:
+ case SCRIPT_STATE_RUN: cheatfile.printf(" state=\"run\""); break;
+ case SCRIPT_STATE_CHANGE: cheatfile.printf(" state=\"change\""); break;
}
cheatfile.printf(">\n");
@@ -399,49 +392,54 @@ void cheat_script::save(emu_file &cheatfile) const
// script_entry - constructor
//-------------------------------------------------
-cheat_script::script_entry::script_entry(cheat_manager &manager, symbol_table &symbols, const char *filename, util::xml::data_node const &entrynode, bool isaction)
- : m_condition(&symbols),
- m_expression(&symbols)
+cheat_script::script_entry::script_entry(
+ cheat_manager &manager,
+ symbol_table &symbols,
+ char const *filename,
+ util::xml::data_node const &entrynode,
+ bool isaction)
+ : m_condition(&symbols)
+ , m_expression(&symbols)
{
- const char *expression = nullptr;
+ char const *expression(nullptr);
try
{
// read the condition if present
expression = entrynode.get_attribute_string("condition", nullptr);
- if (expression != nullptr)
+ if (expression)
m_condition.parse(expression);
- // if this is an action, parse the expression
if (isaction)
{
+ // if this is an action, parse the expression
expression = entrynode.get_value();
- if (expression == nullptr || expression[0] == 0)
+ if (!expression || !expression[0])
throw emu_fatalerror("%s.xml(%d): missing expression in action tag\n", filename, entrynode.line);
m_expression.parse(expression);
}
-
- // otherwise, parse the attributes and arguments
else
{
+ // otherwise, parse the attributes and arguments
+
// extract format
- const char *format = entrynode.get_attribute_string("format", nullptr);
- if (format == nullptr || format[0] == 0)
+ char const *const format(entrynode.get_attribute_string("format", nullptr));
+ if (!format || !format[0])
throw emu_fatalerror("%s.xml(%d): missing format in output tag\n", filename, entrynode.line);
- m_format.assign(format);
+ m_format = format;
// extract other attributes
m_line = entrynode.get_attribute_int("line", 0);
m_justify = ui::text_layout::LEFT;
- const char *align = entrynode.get_attribute_string("align", "left");
- if (strcmp(align, "center") == 0)
+ char const *const align(entrynode.get_attribute_string("align", "left"));
+ if (!std::strcmp(align, "center"))
m_justify = ui::text_layout::CENTER;
- else if (strcmp(align, "right") == 0)
+ else if (!std::strcmp(align, "right"))
m_justify = ui::text_layout::RIGHT;
- else if (strcmp(align, "left") != 0)
+ else if (std::strcmp(align, "left"))
throw emu_fatalerror("%s.xml(%d): invalid alignment '%s' specified\n", filename, entrynode.line, align);
// then parse arguments
- int totalargs = 0;
+ int totalargs(0);
for (util::xml::data_node const *argnode = entrynode.get_child("argument"); argnode != nullptr; argnode = argnode->get_next_sibling("argument"))
{
auto curarg = std::make_unique<output_argument>(manager, symbols, filename, *argnode);
@@ -458,7 +456,7 @@ cheat_script::script_entry::script_entry(cheat_manager &manager, symbol_table &s
validate_format(filename, entrynode.line);
}
}
- catch (expression_error &err)
+ catch (expression_error const &err)
{
throw emu_fatalerror("%s.xml(%d): error parsing cheat expression \"%s\" (%s)\n", filename, entrynode.line, expression, err.code_string());
}
@@ -476,11 +474,11 @@ void cheat_script::script_entry::execute(cheat_manager &manager, uint64_t &argin
{
try
{
- uint64_t result = m_condition.execute();
- if (result == 0)
+ uint64_t const result(m_condition.execute());
+ if (!result)
return;
}
- catch (expression_error &err)
+ catch (expression_error const &err)
{
osd_printf_warning("Error executing conditional expression \"%s\": %s\n", m_condition.original_string(), err.code_string());
return;
@@ -511,14 +509,14 @@ void cheat_script::script_entry::execute(cheat_manager &manager, uint64_t &argin
// generate the astring
manager.get_output_string(m_line, m_justify) = string_format(m_format,
- (uint32_t)params[0], (uint32_t)params[1], (uint32_t)params[2], (uint32_t)params[3],
- (uint32_t)params[4], (uint32_t)params[5], (uint32_t)params[6], (uint32_t)params[7],
- (uint32_t)params[8], (uint32_t)params[9], (uint32_t)params[10], (uint32_t)params[11],
- (uint32_t)params[12], (uint32_t)params[13], (uint32_t)params[14], (uint32_t)params[15],
- (uint32_t)params[16], (uint32_t)params[17], (uint32_t)params[18], (uint32_t)params[19],
- (uint32_t)params[20], (uint32_t)params[21], (uint32_t)params[22], (uint32_t)params[23],
- (uint32_t)params[24], (uint32_t)params[25], (uint32_t)params[26], (uint32_t)params[27],
- (uint32_t)params[28], (uint32_t)params[29], (uint32_t)params[30], (uint32_t)params[31]);
+ params[0], params[1], params[2], params[3],
+ params[4], params[5], params[6], params[7],
+ params[8], params[9], params[10], params[11],
+ params[12], params[13], params[14], params[15],
+ params[16], params[17], params[18], params[19],
+ params[20], params[21], params[22], params[23],
+ params[24], params[25], params[26], params[27],
+ params[28], params[29], params[30], params[31]);
}
}
@@ -529,33 +527,36 @@ void cheat_script::script_entry::execute(cheat_manager &manager, uint64_t &argin
void cheat_script::script_entry::save(emu_file &cheatfile) const
{
- // output an action
if (m_format.empty())
{
+ // output an action
cheatfile.printf("\t\t\t<action");
if (!m_condition.is_empty())
cheatfile.printf(" condition=\"%s\"", cheat_manager::quote_expression(m_condition).c_str());
cheatfile.printf(">%s</action>\n", cheat_manager::quote_expression(m_expression).c_str());
}
-
- // output an output
else
{
+ // output an output
cheatfile.printf("\t\t\t<output format=\"%s\"", m_format.c_str());
if (!m_condition.is_empty())
cheatfile.printf(" condition=\"%s\"", cheat_manager::quote_expression(m_condition).c_str());
+
if (m_line != 0)
cheatfile.printf(" line=\"%d\"", m_line);
+
if (m_justify == ui::text_layout::CENTER)
cheatfile.printf(" align=\"center\"");
else if (m_justify == ui::text_layout::RIGHT)
cheatfile.printf(" align=\"right\"");
+
if (m_arglist.size() == 0)
+ {
cheatfile.printf(" />\n");
-
- // output arguments
+ }
else
{
+ // output arguments
cheatfile.printf(">\n");
for (auto &curarg : m_arglist)
curarg->save(cheatfile);
@@ -573,27 +574,20 @@ void cheat_script::script_entry::save(emu_file &cheatfile) const
void cheat_script::script_entry::validate_format(const char *filename, int line)
{
// first count arguments
- int argsprovided = 0;
+ int argsprovided(0);
for (auto &curarg : m_arglist)
argsprovided += curarg->count();
// now scan the string for valid argument usage
- const char *p = strchr(m_format.c_str(), '%');
int argscounted = 0;
- while (p != nullptr)
+ for (char const *p = strchr(m_format.c_str(), '%'); p; ++argscounted, p = strchr(p, '%'))
{
// skip past any valid attributes
- p++;
- while (strchr("lh0123456789.-+ #", *p) != nullptr)
- p++;
+ for (++p; strchr("lh0123456789.-+ #", *p); ++p) { }
// look for a valid type
- if (strchr("cdiouxX", *p) == nullptr)
+ if (!strchr("cdiouxX", *p))
throw emu_fatalerror("%s.xml(%d): invalid format specification \"%s\"\n", filename, line, m_format.c_str());
- argscounted++;
-
- // look for the next one
- p = strchr(p, '%');
}
// did we match?
@@ -608,16 +602,20 @@ void cheat_script::script_entry::validate_format(const char *filename, int line)
// output_argument - constructor
//-------------------------------------------------
-cheat_script::script_entry::output_argument::output_argument(cheat_manager &manager, symbol_table &symbols, const char *filename, util::xml::data_node const &argnode)
- : m_expression(&symbols),
- m_count(0)
+cheat_script::script_entry::output_argument::output_argument(
+ cheat_manager &manager,
+ symbol_table &symbols,
+ char const *filename,
+ util::xml::data_node const &argnode)
+ : m_expression(&symbols)
+ , m_count(0)
{
// first extract attributes
m_count = argnode.get_attribute_int("count", 1);
// read the expression
- const char *expression = argnode.get_value();
- if (expression == nullptr || expression[0] == 0)
+ char const *const expression(argnode.get_value());
+ if (!expression || !expression[0])
throw emu_fatalerror("%s.xml(%d): missing expression in argument tag\n", filename, argnode.line);
// parse it
@@ -625,7 +623,7 @@ cheat_script::script_entry::output_argument::output_argument(cheat_manager &mana
{
m_expression.parse(expression);
}
- catch (expression_error &err)
+ catch (expression_error const &err)
{
throw emu_fatalerror("%s.xml(%d): error parsing cheat expression \"%s\" (%s)\n", filename, argnode.line, expression, err.code_string());
}
@@ -645,7 +643,7 @@ int cheat_script::script_entry::output_argument::values(uint64_t &argindex, uint
{
result[argindex] = m_expression.execute();
}
- catch (expression_error &err)
+ catch (expression_error const &err)
{
osd_printf_warning("Error executing argument expression \"%s\": %s\n", m_expression.original_string(), err.code_string());
}
@@ -662,7 +660,7 @@ void cheat_script::script_entry::output_argument::save(emu_file &cheatfile) cons
{
cheatfile.printf("\t\t\t\t<argument");
if (m_count != 1)
- cheatfile.printf(" count=\"%d\"", (int)m_count);
+ cheatfile.printf(" count=\"%d\"", int(m_count));
cheatfile.printf(">%s</argument>\n", cheat_manager::quote_expression(m_expression).c_str());
}
@@ -683,75 +681,64 @@ cheat_entry::cheat_entry(cheat_manager &manager, symbol_table &globaltable, cons
, m_numtemp(DEFAULT_TEMP_VARIABLES)
, m_argindex(0)
{
- // reset scripts
- try
+ // pull the variable count out ahead of things
+ int const tempcount(cheatnode.get_attribute_int("tempvariables", DEFAULT_TEMP_VARIABLES));
+ if (tempcount < 1)
+ throw emu_fatalerror("%s.xml(%d): invalid tempvariables attribute (%d)\n", filename, cheatnode.line, tempcount);
+
+ // allocate memory for the cheat
+ m_numtemp = tempcount;
+
+ // get the description
+ char const *const description(cheatnode.get_attribute_string("desc", nullptr));
+ if (!description || !description[0])
+ throw emu_fatalerror("%s.xml(%d): empty or missing desc attribute on cheat\n", filename, cheatnode.line);
+ m_description = description;
+
+ // create the symbol table
+ m_symbols.add("argindex", symbol_table::READ_ONLY, &m_argindex);
+ for (int curtemp = 0; curtemp < tempcount; curtemp++)
+ m_symbols.add(string_format("temp%d", curtemp).c_str(), symbol_table::READ_WRITE);
+
+ // read the first comment node
+ util::xml::data_node const *const commentnode(cheatnode.get_child("comment"));
+ if (commentnode != nullptr)
{
- // pull the variable count out ahead of things
- int tempcount = cheatnode.get_attribute_int("tempvariables", DEFAULT_TEMP_VARIABLES);
- if (tempcount < 1)
- throw emu_fatalerror("%s.xml(%d): invalid tempvariables attribute (%d)\n", filename, cheatnode.line, tempcount);
-
- // allocate memory for the cheat
- m_numtemp = tempcount;
-
- // get the description
- const char *description = cheatnode.get_attribute_string("desc", nullptr);
- if (description == nullptr || description[0] == 0)
- throw emu_fatalerror("%s.xml(%d): empty or missing desc attribute on cheat\n", filename, cheatnode.line);
- m_description = description;
-
- // create the symbol table
- m_symbols.add("argindex", symbol_table::READ_ONLY, &m_argindex);
- for (int curtemp = 0; curtemp < tempcount; curtemp++) {
- m_symbols.add(string_format("temp%d", curtemp).c_str(), symbol_table::READ_WRITE);
- }
-
- // read the first comment node
- util::xml::data_node const *commentnode = cheatnode.get_child("comment");
- if (commentnode != nullptr)
- {
- // set the value if not nullptr
- if (commentnode->get_value() != nullptr && commentnode->get_value()[0] != 0)
- m_comment.assign(commentnode->get_value());
-
- // only one comment is kept
- commentnode = commentnode->get_next_sibling("comment");
- if (commentnode != nullptr)
- osd_printf_warning("%s.xml(%d): only one comment node is retained; ignoring additional nodes\n", filename, commentnode->line);
- }
-
- // read the first parameter node
- util::xml::data_node const *paramnode = cheatnode.get_child("parameter");
- if (paramnode != nullptr)
- {
- // load this parameter
- m_parameter.reset(global_alloc(cheat_parameter(manager, m_symbols, filename, *paramnode)));
-
- // only one parameter allowed
- paramnode = paramnode->get_next_sibling("parameter");
- if (paramnode != nullptr)
- osd_printf_warning("%s.xml(%d): only one parameter node allowed; ignoring additional nodes\n", filename, paramnode->line);
- }
+ // set the value if not nullptr
+ if (commentnode->get_value() && commentnode->get_value()[0])
+ m_comment.assign(commentnode->get_value());
+
+ // only one comment is kept
+ util::xml::data_node const *const nextcomment(commentnode->get_next_sibling("comment"));
+ if (nextcomment)
+ osd_printf_warning("%s.xml(%d): only one comment node is retained; ignoring additional nodes\n", filename, nextcomment->line);
+ }
- // read the script nodes
- for (util::xml::data_node const *scriptnode = cheatnode.get_child("script"); scriptnode != nullptr; scriptnode = scriptnode->get_next_sibling("script"))
- {
- // load this entry
- auto curscript = global_alloc(cheat_script(manager, m_symbols, filename, *scriptnode));
+ // read the first parameter node
+ util::xml::data_node const *const paramnode(cheatnode.get_child("parameter"));
+ if (paramnode != nullptr)
+ {
+ // load this parameter
+ m_parameter.reset(new cheat_parameter(manager, m_symbols, filename, *paramnode));
- // if we have a script already for this slot, it is an error
- std::unique_ptr<cheat_script> &slot = script_for_state(curscript->state());
- if (slot != nullptr)
- osd_printf_warning("%s.xml(%d): only one on script allowed; ignoring additional scripts\n", filename, scriptnode->line);
- else
- slot.reset(curscript);
- }
+ // only one parameter allowed
+ util::xml::data_node const *const nextparam(paramnode->get_next_sibling("parameter"));
+ if (nextparam)
+ osd_printf_warning("%s.xml(%d): only one parameter node allowed; ignoring additional nodes\n", filename, nextparam->line);
}
- catch (emu_fatalerror &)
+
+ // read the script nodes
+ for (util::xml::data_node const *scriptnode = cheatnode.get_child("script"); scriptnode != nullptr; scriptnode = scriptnode->get_next_sibling("script"))
{
- // call our destructor to clean up and re-throw
- this->~cheat_entry();
- throw;
+ // load this entry
+ std::unique_ptr<cheat_script> curscript(new cheat_script(manager, m_symbols, filename, *scriptnode));
+
+ // if we have a script already for this slot, it is an error
+ std::unique_ptr<cheat_script> &slot = script_for_state(curscript->state());
+ if (slot)
+ osd_printf_warning("%s.xml(%d): only one on script allowed; ignoring additional scripts\n", filename, scriptnode->line);
+ else
+ slot = std::move(curscript);
}
}
@@ -772,14 +759,17 @@ cheat_entry::~cheat_entry()
void cheat_entry::save(emu_file &cheatfile) const
{
// determine if we have scripts
- bool has_scripts = (m_off_script != nullptr || m_on_script != nullptr || m_run_script != nullptr || m_change_script != nullptr);
+ bool const has_scripts(m_off_script || m_on_script || m_run_script || m_change_script);
// output the cheat tag
cheatfile.printf("\t<cheat desc=\"%s\"", m_description.c_str());
if (m_numtemp != DEFAULT_TEMP_VARIABLES)
cheatfile.printf(" tempvariables=\"%d\"", m_numtemp);
- if (m_comment.empty() && m_parameter == nullptr && !has_scripts)
+
+ if (m_comment.empty() && !m_parameter && !has_scripts)
+ {
cheatfile.printf(" />\n");
+ }
else
{
cheatfile.printf(">\n");
@@ -789,18 +779,13 @@ void cheat_entry::save(emu_file &cheatfile) const
cheatfile.printf("\t\t<comment><![CDATA[\n%s\n\t\t]]></comment>\n", m_comment.c_str());
// output the parameter, if present
- if (m_parameter != nullptr)
- m_parameter->save(cheatfile);
+ if (m_parameter) m_parameter->save(cheatfile);
// output the script nodes
- if (m_on_script != nullptr)
- m_on_script->save(cheatfile);
- if (m_off_script != nullptr)
- m_off_script->save(cheatfile);
- if (m_change_script != nullptr)
- m_change_script->save(cheatfile);
- if (m_run_script != nullptr)
- m_run_script->save(cheatfile);
+ if (m_on_script) m_on_script->save(cheatfile);
+ if (m_off_script) m_off_script->save(cheatfile);
+ if (m_change_script) m_change_script->save(cheatfile);
+ if (m_run_script) m_run_script->save(cheatfile);
// close the cheat tag
cheatfile.printf("\t</cheat>\n");
@@ -814,23 +799,22 @@ void cheat_entry::save(emu_file &cheatfile) const
bool cheat_entry::activate()
{
- bool changed = false;
+ bool changed(false);
// if cheats have been toggled off no point in even trying to do anything
if (!m_manager.enabled())
return changed;
- // if we're a oneshot cheat, execute the "on" script and indicate change
if (is_oneshot())
{
+ // if we're a oneshot cheat, execute the "on" script and indicate change
execute_on_script();
changed = true;
m_manager.machine().popmessage("Activated %s", m_description.c_str());
}
-
- // if we're a oneshot parameter cheat and we're active, execute the "state change" script and indicate change
- else if (is_oneshot_parameter() && m_state != SCRIPT_STATE_OFF)
+ else if (is_oneshot_parameter() && (m_state != SCRIPT_STATE_OFF))
{
+ // if we're a oneshot parameter cheat and we're active, execute the "state change" script and indicate change
execute_change_script();
changed = true;
m_manager.machine().popmessage("Activated\n %s = %s", m_description.c_str(), m_parameter->text());
@@ -847,15 +831,17 @@ bool cheat_entry::activate()
bool cheat_entry::select_default_state()
{
- bool changed = false;
+ bool changed(false);
- // if we're a oneshot cheat, there is no default state
if (is_oneshot())
- ;
-
- // all other types switch to the "off" state
+ {
+ // if we're a oneshot cheat, there is no default state
+ }
else
+ {
+ // all other types switch to the "off" state
changed = set_state(SCRIPT_STATE_OFF);
+ }
return changed;
}
@@ -868,22 +854,26 @@ bool cheat_entry::select_default_state()
bool cheat_entry::select_previous_state()
{
- bool changed = false;
+ bool changed(false);
- // if we're a oneshot, there is no previous state
if (is_oneshot())
- ;
-
- // if we're on/off, toggle to off
+ {
+ // if we're a oneshot, there is no previous state
+ }
else if (is_onoff())
+ {
+ // if we're on/off, toggle to off
changed = set_state(SCRIPT_STATE_OFF);
-
- // if we have a parameter, set the previous state
+ }
else if (m_parameter != nullptr)
{
+ // if we have a parameter, set the previous state
+
// if we're at our minimum, turn off
if (m_parameter->is_minimum())
+ {
changed = set_state(SCRIPT_STATE_OFF);
+ }
else
{
// if we changed, ensure we are in the running state and signal state change
@@ -896,6 +886,7 @@ bool cheat_entry::select_previous_state()
}
}
}
+
return changed;
}
@@ -907,34 +898,37 @@ bool cheat_entry::select_previous_state()
bool cheat_entry::select_next_state()
{
- bool changed = false;
+ bool changed(false);
- // if we're a oneshot, there is no next state
if (is_oneshot())
- ;
-
- // if we're on/off, toggle to running state
+ {
+ // if we're a oneshot, there is no next state
+ }
else if (is_onoff())
+ {
+ // if we're on/off, toggle to running state
changed = set_state(SCRIPT_STATE_RUN);
-
- // if we have a parameter, set the next state
+ }
else if (m_parameter != nullptr)
{
- // if we're off, switch on to the minimum state
+ // if we have a parameter, set the next state
if (m_state == SCRIPT_STATE_OFF)
{
+ // if we're off, switch on to the minimum state
changed = set_state(SCRIPT_STATE_RUN);
m_parameter->set_minimum_state();
}
-
- // otherwise, switch to the next state
else
+ {
+ // otherwise, switch to the next state
changed = m_parameter->set_next_state();
+ }
// if we changed, signal a state change
if (changed && !is_oneshot_parameter())
execute_change_script();
}
+
return changed;
}
@@ -947,44 +941,43 @@ bool cheat_entry::select_next_state()
void cheat_entry::menu_text(std::string &description, std::string &state, uint32_t &flags)
{
// description is standard
- description.assign(m_description);
+ description = m_description;
state.clear();
flags = 0;
- // some cheat entries are just text for display
if (is_text_only())
{
+ // some cheat entries are just text for display
if (!description.empty())
{
strtrimspace(description);
if (description.empty())
- description.assign(MENU_SEPARATOR_ITEM);
+ description = MENU_SEPARATOR_ITEM;
}
flags = ui::menu::FLAG_DISABLE;
}
-
- // if we have no parameter and no run or off script, it's a oneshot cheat
else if (is_oneshot())
- state.assign("Set");
-
- // if we have no parameter, it's just on/off
+ {
+ // if we have no parameter and no run or off script, it's a oneshot cheat
+ state = "Set";
+ }
else if (is_onoff())
{
- state.assign((m_state == SCRIPT_STATE_RUN) ? "On" : "Off");
+ // if we have no parameter, it's just on/off
+ state = (m_state == SCRIPT_STATE_RUN) ? "On" : "Off";
flags = (m_state != 0) ? ui::menu::FLAG_LEFT_ARROW : ui::menu::FLAG_RIGHT_ARROW;
}
-
- // if we have a value parameter, compute it
else if (m_parameter != nullptr)
{
+ // if we have a value parameter, compute it
if (m_state == SCRIPT_STATE_OFF)
{
- state.assign(is_oneshot_parameter() ? "Set" : "Off");
+ state = is_oneshot_parameter() ? "Set" : "Off";
flags = ui::menu::FLAG_RIGHT_ARROW;
}
else
{
- state.assign(m_parameter->text());
+ state = m_parameter->text();
flags = ui::menu::FLAG_LEFT_ARROW;
if (!m_parameter->is_maximum())
flags |= ui::menu::FLAG_RIGHT_ARROW;
@@ -1007,8 +1000,9 @@ bool cheat_entry::set_state(script_state newstate)
m_state = newstate;
if (newstate == SCRIPT_STATE_OFF)
execute_off_script();
- else if (newstate == SCRIPT_STATE_ON || newstate == SCRIPT_STATE_RUN)
+ else if ((newstate == SCRIPT_STATE_ON) || (newstate == SCRIPT_STATE_RUN))
execute_on_script();
+
return true;
}
@@ -1022,11 +1016,11 @@ std::unique_ptr<cheat_script> &cheat_entry::script_for_state(script_state state)
{
switch (state)
{
- case SCRIPT_STATE_ON: return m_on_script;
- case SCRIPT_STATE_OFF: return m_off_script;
- case SCRIPT_STATE_CHANGE: return m_change_script;
- default:
- case SCRIPT_STATE_RUN: return m_run_script;
+ case SCRIPT_STATE_ON: return m_on_script;
+ case SCRIPT_STATE_OFF: return m_off_script;
+ case SCRIPT_STATE_CHANGE: return m_change_script;
+ default:
+ case SCRIPT_STATE_RUN: return m_run_script;
}
}
@@ -1039,8 +1033,10 @@ std::unique_ptr<cheat_script> &cheat_entry::script_for_state(script_state state)
bool cheat_entry::is_duplicate() const
{
for (auto &scannode : manager().entries())
- if (strcmp(scannode->description(), description()) == 0)
+ {
+ if (!std::strcmp(scannode->description(), description()))
return true;
+ }
return false;
}
@@ -1049,7 +1045,7 @@ bool cheat_entry::is_duplicate() const
// CHEAT MANAGER
//**************************************************************************
-const int cheat_manager::CHEAT_VERSION;
+constexpr int cheat_manager::CHEAT_VERSION;
//-------------------------------------------------
@@ -1057,16 +1053,16 @@ const int cheat_manager::CHEAT_VERSION;
//-------------------------------------------------
cheat_manager::cheat_manager(running_machine &machine)
- : m_machine(machine),
- m_disabled(true),
- m_symtable(&machine)
+ : m_machine(machine)
+ , m_disabled(true)
+ , m_symtable(&machine)
{
// if the cheat engine is disabled, we're done
if (!machine.options().cheat())
return;
- m_output.resize(UI_TARGET_FONT_ROWS*2);
- m_justify.resize(UI_TARGET_FONT_ROWS*2);
+ m_output.resize(UI_TARGET_FONT_ROWS * 2);
+ m_justify.resize(UI_TARGET_FONT_ROWS * 2);
// request a callback
machine.add_notifier(MACHINE_NOTIFY_FRAME, machine_notify_delegate(&cheat_manager::frame_update, this));
@@ -1105,25 +1101,30 @@ void cheat_manager::set_enable(bool enable)
if (!machine().options().cheat())
return;
- // if we're enabled currently and we don't want to be, turn things off
if (!m_disabled && !enable)
{
+ // if we're enabled currently and we don't want to be, turn things off
+
// iterate over running cheats and execute any OFF Scripts
for (auto &cheat : m_cheatlist)
+ {
if (cheat->state() == SCRIPT_STATE_RUN)
cheat->execute_off_script();
+ }
machine().popmessage("Cheats Disabled");
m_disabled = true;
}
-
- // if we're disabled currently and we want to be enabled, turn things on
else if (m_disabled && enable)
{
+ // if we're disabled currently and we want to be enabled, turn things on
+
// iterate over running cheats and execute any ON Scripts
m_disabled = false;
for (auto &cheat : m_cheatlist)
+ {
if (cheat->state() == SCRIPT_STATE_RUN)
cheat->execute_on_script();
+ }
machine().popmessage("Cheats Enabled");
}
}
@@ -1152,6 +1153,7 @@ void cheat_manager::reload()
// load the cheat file, if it's a system that has a software list then try softlist_name/shortname.xml first,
// if it fails to load then try to load via crc32 - basename/crc32.xml ( eg. 01234567.xml )
for (device_image_interface &image : image_interface_iterator(machine().root_device()))
+ {
if (image.exists())
{
// if we are loading through a software list, try to load softlist_name/shortname.xml
@@ -1173,9 +1175,10 @@ void cheat_manager::reload()
}
}
}
+ }
// if we haven't found the cheats yet, load by basename
- if (m_cheatlist.size() == 0)
+ if (m_cheatlist.empty())
load_cheats(machine().basename());
// temporary: save the file back out as output.xml for comparison
@@ -1193,7 +1196,7 @@ bool cheat_manager::save_all(const char *filename)
{
// open the file with the proper name
emu_file cheatfile(machine().options().cheat_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
- osd_file::error filerr = cheatfile.open(filename, ".xml");
+ osd_file::error const filerr(cheatfile.open(filename, ".xml"));
// if that failed, return nothing
if (filerr != osd_file::error::NONE)
@@ -1215,10 +1218,9 @@ bool cheat_manager::save_all(const char *filename)
cheatfile.printf("</mamecheat>\n");
return true;
}
-
- // catch errors and cleanup
- catch (emu_fatalerror &err)
+ catch (emu_fatalerror const &err)
{
+ // catch errors and cleanup
osd_printf_error("%s\n", err.string());
cheatfile.remove_on_close();
}
@@ -1235,14 +1237,16 @@ void cheat_manager::render_text(mame_ui_manager &mui, render_container &containe
{
// render any text and free it along the way
for (int linenum = 0; linenum < m_output.size(); linenum++)
+ {
if (!m_output[linenum].empty())
{
// output the text
mui.draw_text_full(container, m_output[linenum].c_str(),
- 0.0f, (float)linenum * mui.get_line_height(), 1.0f,
+ 0.0f, float(linenum) * mui.get_line_height(), 1.0f,
m_justify[linenum], ui::text_layout::NEVER, mame_ui_manager::OPAQUE_,
rgb_t::white(), rgb_t::black(), nullptr, nullptr);
}
+ }
}
@@ -1256,17 +1260,16 @@ std::string &cheat_manager::get_output_string(int row, ui::text_layout::text_jus
{
// if the row is not specified, grab the next one
if (row == 0)
- row = (m_lastline >= 0) ? m_lastline + 1 : m_lastline - 1;
+ row = (m_lastline >= 0) ? (m_lastline + 1) : (m_lastline - 1);
// remember the last request
m_lastline = row;
// invert if negative
- row = (row < 0) ? m_numlines + row : row - 1;
+ row = (row < 0) ? (m_numlines + row) : (row - 1);
// clamp within range
- row = std::max(row, 0);
- row = std::min(row, m_numlines - 1);
+ row = std::min(std::max(row, 0), m_numlines - 1);
// return the appropriate string
m_justify[row] = justify;
@@ -1319,9 +1322,9 @@ std::string cheat_manager::quote_expression(const parsed_expression &expression)
uint64_t cheat_manager::execute_frombcd(symbol_table &table, void *ref, int params, const uint64_t *param)
{
- uint64_t value = param[0];
- uint64_t multiplier = 1;
- uint64_t result = 0;
+ uint64_t value(param[0]);
+ uint64_t multiplier(1);
+ uint64_t result(0);
while (value != 0)
{
@@ -1339,9 +1342,9 @@ uint64_t cheat_manager::execute_frombcd(symbol_table &table, void *ref, int para
uint64_t cheat_manager::execute_tobcd(symbol_table &table, void *ref, int params, const uint64_t *param)
{
- uint64_t value = param[0];
- uint64_t result = 0;
- uint8_t shift = 0;
+ uint64_t value(param[0]);
+ uint64_t result(0);
+ uint8_t shift(0);
while (value != 0)
{
@@ -1407,35 +1410,45 @@ void cheat_manager::load_cheats(const char *filename)
throw emu_fatalerror("%s.xml(%d): error parsing XML (%s)\n", filename, error.error_line, error.error_message);
// find the layout node
- util::xml::data_node const *const mamecheatnode = rootnode->get_child("mamecheat");
+ util::xml::data_node const *const mamecheatnode(rootnode->get_child("mamecheat"));
if (mamecheatnode == nullptr)
throw emu_fatalerror("%s.xml: missing mamecheatnode node", filename);
// validate the config data version
- int version = mamecheatnode->get_attribute_int("version", 0);
+ int const version(mamecheatnode->get_attribute_int("version", 0));
if (version != CHEAT_VERSION)
throw emu_fatalerror("%s.xml(%d): Invalid cheat XML file: unsupported version", filename, mamecheatnode->line);
// parse all the elements
for (util::xml::data_node const *cheatnode = mamecheatnode->get_child("cheat"); cheatnode != nullptr; cheatnode = cheatnode->get_next_sibling("cheat"))
{
- // load this entry
- auto curcheat = std::make_unique<cheat_entry>(*this, m_symtable, filename, *cheatnode);
-
- // make sure we're not a duplicate
- if (REMOVE_DUPLICATE_CHEATS && curcheat->is_duplicate())
+ try
{
- osd_printf_verbose("Ignoring duplicate cheat '%s' from file %s\n", curcheat->description(), cheatfile.fullpath());
+ // load this entry
+ auto curcheat = std::make_unique<cheat_entry>(*this, m_symtable, filename, *cheatnode);
+
+ // make sure we're not a duplicate
+ if (REMOVE_DUPLICATE_CHEATS && curcheat->is_duplicate())
+ {
+ osd_printf_verbose("Ignoring duplicate cheat '%s' from file %s\n", curcheat->description(), cheatfile.fullpath());
+ }
+ else
+ {
+ // add to the end of the list
+ m_cheatlist.push_back(std::move(curcheat));
+ }
+ }
+ catch (emu_fatalerror const &err)
+ {
+ // just move on to the next cheat
+ osd_printf_error("%s\n", err.string());
}
- else // add to the end of the list
- m_cheatlist.push_back(std::move(curcheat));
}
}
}
-
- // handle errors cleanly
- catch (emu_fatalerror &err)
+ catch (emu_fatalerror const &err)
{
+ // handle errors cleanly
osd_printf_error("%s\n", err.string());
m_cheatlist.clear();
}
diff --git a/src/frontend/mame/cheat.h b/src/frontend/mame/cheat.h
index eaba3650e7e..93b7d1ebfb8 100644
--- a/src/frontend/mame/cheat.h
+++ b/src/frontend/mame/cheat.h
@@ -8,10 +8,10 @@
***************************************************************************/
-#pragma once
+#ifndef MAME_FRONTEND_CHEAT_H
+#define MAME_FRONTEND_CHEAT_H
-#ifndef __CHEAT_H__
-#define __CHEAT_H__
+#pragma once
#include "debug/express.h"
#include "debug/debugcpu.h"
@@ -50,12 +50,20 @@ class number_and_format
{
public:
// construction/destruction
- number_and_format(uint64_t value = 0, util::xml::data_node::int_format format = util::xml::data_node::int_format::DECIMAL)
+ constexpr number_and_format(
+ uint64_t value = 0,
+ util::xml::data_node::int_format format = util::xml::data_node::int_format::DECIMAL)
: m_value(value)
, m_format(format)
{
}
+ // copyable/movable
+ constexpr number_and_format(number_and_format const &) = default;
+ number_and_format(number_and_format &&) = default;
+ number_and_format &operator=(number_and_format const &) = default;
+ number_and_format &operator=(number_and_format &&) = default;
+
// pass-through to look like a regular number
operator uint64_t &() { return m_value; }
operator const uint64_t &() const { return m_value; }
@@ -77,13 +85,17 @@ class cheat_parameter
{
public:
// construction/destruction
- cheat_parameter(cheat_manager &manager, symbol_table &symbols, const char *filename, util::xml::data_node const &paramnode);
+ cheat_parameter(
+ cheat_manager &manager,
+ symbol_table &symbols,
+ char const *filename,
+ util::xml::data_node const &paramnode);
// queries
- const char *text();
- bool has_itemlist() const { return (m_itemlist.size() != 0); }
- bool is_minimum() const { return (m_value == ((m_itemlist.size() == 0) ? m_minval : m_itemlist.front()->value())); }
- bool is_maximum() const { return (m_value == ((m_itemlist.size() == 0) ? m_maxval : m_itemlist.back()->value())); }
+ char const *text();
+ bool has_itemlist() const { return !m_itemlist.empty(); }
+ bool is_minimum() const { return (m_itemlist.empty() ? m_minval : m_itemlist.front().value()) == m_value; }
+ bool is_maximum() const { return (m_itemlist.empty() ? m_maxval : m_itemlist.back().value()) == m_value; }
// state setters
bool set_minimum_state();
@@ -102,25 +114,32 @@ private:
item(const char *text, uint64_t value, util::xml::data_node::int_format valformat)
: m_text(text)
, m_value(value, valformat)
- { }
+ {
+ }
+
+ // copyable/movable
+ item(item const &) = default;
+ item(item &&) = default;
+ item &operator=(item const &) = default;
+ item &operator=(item &&) = default;
// getters
- const number_and_format &value() const { return m_value; }
- const char *text() const { return m_text.c_str(); }
+ number_and_format const &value() const { return m_value; }
+ char const *text() const { return m_text.c_str(); }
private:
// internal state
- std::string m_text; // name of the item
- number_and_format m_value; // value of the item
+ std::string m_text; // name of the item
+ number_and_format m_value; // value of the item
};
// internal state
- number_and_format m_minval; // minimum value
- number_and_format m_maxval; // maximum value
- number_and_format m_stepval; // step value
- uint64_t m_value; // live value of the parameter
- std::string m_curtext; // holding for a value string
- std::vector<std::unique_ptr<item>> m_itemlist; // list of items
+ number_and_format m_minval; // minimum value
+ number_and_format m_maxval; // maximum value
+ number_and_format m_stepval; // step value
+ uint64_t m_value; // live value of the parameter
+ std::string m_curtext; // holding for a value string
+ std::vector<item> m_itemlist; // list of items
};
@@ -131,7 +150,11 @@ class cheat_script
{
public:
// construction/destruction
- cheat_script(cheat_manager &manager, symbol_table &symbols, const char *filename, util::xml::data_node const &scriptnode);
+ cheat_script(
+ cheat_manager &manager,
+ symbol_table &symbols,
+ char const *filename,
+ util::xml::data_node const &scriptnode);
// getters
script_state state() const { return m_state; }
@@ -146,7 +169,12 @@ private:
{
public:
// construction/destruction
- script_entry(cheat_manager &manager, symbol_table &symbols, const char *filename, util::xml::data_node const &entrynode, bool isaction);
+ script_entry(
+ cheat_manager &manager,
+ symbol_table &symbols,
+ char const *filename,
+ util::xml::data_node const &entrynode,
+ bool isaction);
// actions
void execute(cheat_manager &manager, uint64_t &argindex);
@@ -158,7 +186,11 @@ private:
{
public:
// construction/destruction
- output_argument(cheat_manager &manager, symbol_table &symbols, const char *filename, util::xml::data_node const &argnode);
+ output_argument(
+ cheat_manager &manager,
+ symbol_table &symbols,
+ char const *filename,
+ util::xml::data_node const &argnode);
// getters
int count() const { return m_count; }
@@ -169,28 +201,28 @@ private:
private:
// internal state
- parsed_expression m_expression; // expression for argument
- uint64_t m_count; // number of repetitions
+ parsed_expression m_expression; // expression for argument
+ uint64_t m_count; // number of repetitions
};
// internal helpers
- void validate_format(const char *filename, int line);
+ void validate_format(char const *filename, int line);
// internal state
- parsed_expression m_condition; // condition under which this is executed
- parsed_expression m_expression; // expression to execute
- std::string m_format; // string format to print
- std::vector<std::unique_ptr<output_argument>> m_arglist; // list of arguments
- int8_t m_line; // which line to print on
- ui::text_layout::text_justify m_justify; // justification when printing
+ parsed_expression m_condition; // condition under which this is executed
+ parsed_expression m_expression; // expression to execute
+ std::string m_format; // string format to print
+ std::vector<std::unique_ptr<output_argument>> m_arglist; // list of arguments
+ int8_t m_line; // which line to print on
+ ui::text_layout::text_justify m_justify; // justification when printing
// constants
- static const int MAX_ARGUMENTS = 32;
+ static constexpr int MAX_ARGUMENTS = 32;
};
// internal state
- std::vector<std::unique_ptr<script_entry>> m_entrylist; // list of actions to perform
- script_state m_state; // which state this script is for
+ std::vector<std::unique_ptr<script_entry>> m_entrylist; // list of actions to perform
+ script_state m_state; // which state this script is for
};
@@ -250,21 +282,21 @@ private:
std::unique_ptr<cheat_script> &script_for_state(script_state state);
// internal state
- cheat_manager & m_manager; // reference to our manager
- std::string m_description; // string description/menu title
- std::string m_comment; // comment data
- std::unique_ptr<cheat_parameter> m_parameter; // parameter
- std::unique_ptr<cheat_script> m_on_script; // script to run when turning on
- std::unique_ptr<cheat_script> m_off_script; // script to run when turning off
- std::unique_ptr<cheat_script> m_change_script; // script to run when value changes
- std::unique_ptr<cheat_script> m_run_script; // script to run each frame when on
- symbol_table m_symbols; // symbol table for this cheat
- script_state m_state; // current cheat state
- uint32_t m_numtemp; // number of temporary variables
- uint64_t m_argindex; // argument index variable
+ cheat_manager & m_manager; // reference to our manager
+ std::string m_description; // string description/menu title
+ std::string m_comment; // comment data
+ std::unique_ptr<cheat_parameter> m_parameter; // parameter
+ std::unique_ptr<cheat_script> m_on_script; // script to run when turning on
+ std::unique_ptr<cheat_script> m_off_script; // script to run when turning off
+ std::unique_ptr<cheat_script> m_change_script; // script to run when value changes
+ std::unique_ptr<cheat_script> m_run_script; // script to run each frame when on
+ symbol_table m_symbols; // symbol table for this cheat
+ script_state m_state; // current cheat state
+ uint32_t m_numtemp; // number of temporary variables
+ uint64_t m_argindex; // argument index variable
// constants
- static const int DEFAULT_TEMP_VARIABLES = 10;
+ static constexpr int DEFAULT_TEMP_VARIABLES = 10;
};
@@ -280,10 +312,10 @@ public:
// getters
running_machine &machine() const { return m_machine; }
bool enabled() const { return !m_disabled; }
- const std::vector<std::unique_ptr<cheat_entry>> &entries() const { return m_cheatlist; }
+ std::vector<std::unique_ptr<cheat_entry>> const &entries() const { return m_cheatlist; }
// setters
- void set_enable(bool enable = true);
+ void set_enable(bool enable);
// actions
void reload();
@@ -294,30 +326,30 @@ public:
std::string &get_output_string(int row, ui::text_layout::text_justify justify);
// global helpers
- static std::string quote_expression(const parsed_expression &expression);
- static uint64_t execute_frombcd(symbol_table &table, void *ref, int params, const uint64_t *param);
- static uint64_t execute_tobcd(symbol_table &table, void *ref, int params, const uint64_t *param);
+ static std::string quote_expression(parsed_expression const &expression);
+ static uint64_t execute_frombcd(symbol_table &table, void *ref, int params, uint64_t const *param);
+ static uint64_t execute_tobcd(symbol_table &table, void *ref, int params, uint64_t const *param);
private:
// internal helpers
void frame_update();
- void load_cheats(const char *filename);
+ void load_cheats(char const *filename);
// internal state
- running_machine & m_machine; // reference to our machine
- std::vector<std::unique_ptr<cheat_entry>> m_cheatlist; // cheat list
- uint64_t m_framecount; // frame count
- std::vector<std::string> m_output; // array of output strings
- std::vector<ui::text_layout::text_justify> m_justify; // justification for each string
- uint8_t m_numlines; // number of lines available for output
- int8_t m_lastline; // last line used for output
- bool m_disabled; // true if the cheat engine is disabled
- symbol_table m_symtable; // global symbol table
- std::unique_ptr<debugger_cpu> m_cpu; // debugger interface for cpus/memory
+ running_machine & m_machine; // reference to our machine
+ std::vector<std::unique_ptr<cheat_entry>> m_cheatlist; // cheat list
+ uint64_t m_framecount; // frame count
+ std::vector<std::string> m_output; // array of output strings
+ std::vector<ui::text_layout::text_justify> m_justify; // justification for each string
+ uint8_t m_numlines; // number of lines available for output
+ int8_t m_lastline; // last line used for output
+ bool m_disabled; // true if the cheat engine is disabled
+ symbol_table m_symtable; // global symbol table
+ std::unique_ptr<debugger_cpu> m_cpu; // debugger interface for cpus/memory
// constants
static constexpr int CHEAT_VERSION = 1;
};
-#endif /* __CHEAT_H__ */
+#endif /* MAME_FRONTEND_CHEAT_H */
diff --git a/src/lib/formats/apd_dsk.cpp b/src/lib/formats/apd_dsk.cpp
index cd5de8ad206..3c972c25e49 100644
--- a/src/lib/formats/apd_dsk.cpp
+++ b/src/lib/formats/apd_dsk.cpp
@@ -11,7 +11,7 @@
#include <zlib.h>
#include "formats/apd_dsk.h"
-static const uint8_t APD_HEADER[8] = { 0x41, 0x50, 0x44, 0x58, 0x30, 0x30, 0x30, 0x31 };
+static const uint8_t APD_HEADER[8] = { 'A', 'P', 'D', 'X', '0', '0', '0', '1' };
static const uint8_t GZ_HEADER[2] = { 0x1f, 0x8b };
apd_format::apd_format()
@@ -35,10 +35,36 @@ const char *apd_format::extensions() const
int apd_format::identify(io_generic *io, uint32_t form_factor)
{
- char h[8];
+ uint64_t size = io_generic_size(io);
+ std::vector<uint8_t> img(size);
+ io_generic_read(io, &img[0], 0, size);
+
+ int err;
+ std::vector<uint8_t> gz_ptr(8);
+ z_stream d_stream;
+
+ if (!memcmp(&img[0], GZ_HEADER, sizeof(GZ_HEADER))) {
+ d_stream.zalloc = nullptr;
+ d_stream.zfree = nullptr;
+ d_stream.opaque = nullptr;
+ d_stream.next_in = &img[0];
+ d_stream.avail_in = size;
+ d_stream.next_out = &gz_ptr[0];
+ d_stream.avail_out = 8;
+
+ err = inflateInit2(&d_stream, MAX_WBITS | 16);
+ if (err != Z_OK) return 0;
+
+ err = inflate(&d_stream, Z_SYNC_FLUSH);
+ if (err != Z_OK) return 0;
+
+ err = inflateEnd(&d_stream);
+ if (err != Z_OK) return 0;
+
+ img = gz_ptr;
+ }
- io_generic_read(io, h, 0, 8);
- if (!memcmp(h, GZ_HEADER, sizeof(GZ_HEADER)) || !memcmp(h, APD_HEADER, sizeof(APD_HEADER))) {
+ if (!memcmp(&img[0], APD_HEADER, sizeof(APD_HEADER))) {
return 100;
}
@@ -57,58 +83,53 @@ bool apd_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
int inflate_size = (img[size - 1] << 24) | (img[size - 2] << 16) | (img[size - 3] << 8) | img[size - 4];
uint8_t *in_ptr = &img[0];
- gz_ptr.resize(inflate_size);
-
- d_stream.zalloc = nullptr;
- d_stream.zfree = nullptr;
- d_stream.opaque = nullptr;
- d_stream.next_in = in_ptr;
- d_stream.avail_in = size;
- d_stream.next_out = &gz_ptr[0];
- d_stream.avail_out = inflate_size;
-
- err = inflateInit2(&d_stream, MAX_WBITS | 16);
- if (err != Z_OK) {
- LOG_FORMATS("inflateInit2 error: %d\n", err);
- return false;
- }
- err = inflate(&d_stream, Z_FINISH);
- if (err != Z_STREAM_END && err != Z_OK) {
- LOG_FORMATS("inflate error: %d\n", err);
- return false;
- }
- err = inflateEnd(&d_stream);
- if (err != Z_OK) {
- LOG_FORMATS("inflateEnd error: %d\n", err);
- return false;
- }
- size = inflate_size;
- img = gz_ptr;
-
- if (memcmp(&img[0], APD_HEADER, sizeof(APD_HEADER))) {
- LOG_FORMATS("apd_dsk: floppy image has incorrect header\n");
- return false;
+ if (!memcmp(&img[0], GZ_HEADER, sizeof(GZ_HEADER))) {
+ gz_ptr.resize(inflate_size);
+
+ d_stream.zalloc = nullptr;
+ d_stream.zfree = nullptr;
+ d_stream.opaque = nullptr;
+ d_stream.next_in = in_ptr;
+ d_stream.avail_in = size;
+ d_stream.next_out = &gz_ptr[0];
+ d_stream.avail_out = inflate_size;
+
+ err = inflateInit2(&d_stream, MAX_WBITS | 16);
+ if (err != Z_OK) {
+ LOG_FORMATS("inflateInit2 error: %d\n", err);
+ return false;
+ }
+ err = inflate(&d_stream, Z_FINISH);
+ if (err != Z_STREAM_END && err != Z_OK) {
+ LOG_FORMATS("inflate error: %d\n", err);
+ return false;
+ }
+ err = inflateEnd(&d_stream);
+ if (err != Z_OK) {
+ LOG_FORMATS("inflateEnd error: %d\n", err);
+ return false;
+ }
+ size = inflate_size;
+ img = gz_ptr;
}
int data = 0x7d0;
- for (int track = 0; track < 83; track++) {
- for (int side = 0; side < 2; side++) {
- uint32_t sdlen = little_endianize_int32(*(uint32_t *)(&img[(track * 2 + side) * 12 + 8 + 0x0]));
- uint32_t ddlen = little_endianize_int32(*(uint32_t *)(&img[(track * 2 + side) * 12 + 8 + 0x4]));
- uint32_t qdlen = little_endianize_int32(*(uint32_t *)(&img[(track * 2 + side) * 12 + 8 + 0x8]));
-
- if (sdlen > 0) {
- generate_track_from_bitstream(track, side, &img[data], sdlen, image);
- data += (sdlen + 7) >> 3;
- }
- if (ddlen > 0) {
- generate_track_from_bitstream(track, side, &img[data], ddlen, image);
- data += (ddlen + 7) >> 3;
- }
- if (qdlen > 0) {
- generate_track_from_bitstream(track, side, &img[data], qdlen, image);
- data += (qdlen + 7) >> 3;
- }
+ for (int track = 0; track < 166; track++) {
+ uint32_t sdlen = little_endianize_int32(*(uint32_t *)(&img[(track * 12) + 8 + 0x0]));
+ uint32_t ddlen = little_endianize_int32(*(uint32_t *)(&img[(track * 12) + 8 + 0x4]));
+ uint32_t qdlen = little_endianize_int32(*(uint32_t *)(&img[(track * 12) + 8 + 0x8]));
+
+ if (sdlen > 0) {
+ generate_track_from_bitstream(track / 2, track % 2, &img[data], sdlen, image);
+ data += (sdlen + 7) >> 3;
+ }
+ if (ddlen > 0) {
+ generate_track_from_bitstream(track / 2, track % 2, &img[data], ddlen, image);
+ data += (ddlen + 7) >> 3;
+ }
+ if (qdlen > 0) {
+ generate_track_from_bitstream(track / 2, track % 2, &img[data], qdlen, image);
+ data += (qdlen + 7) >> 3;
}
}
image->set_variant(floppy_image::DSDD);
diff --git a/src/lib/formats/tzx_cas.cpp b/src/lib/formats/tzx_cas.cpp
index 748f0227c65..7f03be7977a 100644
--- a/src/lib/formats/tzx_cas.cpp
+++ b/src/lib/formats/tzx_cas.cpp
@@ -8,7 +8,6 @@ TODO:
Add support for the remaining block types:
case 0x15: Direct Recording
case 0x18: CSW Recording
- case 0x19: Generalized Data Block
case 0x21: Group Start
case 0x22: Group End
case 0x23: Jump To Block
@@ -31,7 +30,7 @@ Notes:
TZX format specification lists
8064 pulses for a header block and 3220 for a data block
-but the documentaiton on worldofspectrum lists
+but the documentation on worldofspectrum lists
8063 pulses for a header block and 3223 for a data block
see http://www.worldofspectrum.org/faq/reference/48kreference.htm#TapeDataStructure
@@ -315,7 +314,6 @@ static int tzx_handle_direct(int16_t **buffer, const uint8_t *bytes, int pause,
tzx_output_wave(buffer, samples);
size += samples;
-
}
}
@@ -342,8 +340,6 @@ static inline int tzx_handle_symbol(int16_t **buffer, const uint8_t *symtable, u
uint8_t starttype = cursymb[0];
-// printf("start polarity %01x (max number of symbols is %d)\n", starttype, maxp);
-
switch (starttype)
{
case 0x00:
@@ -371,7 +367,6 @@ static inline int tzx_handle_symbol(int16_t **buffer, const uint8_t *symtable, u
for (int i = 0; i < maxp; i++)
{
uint16_t pulse_length = cursymb[1 + (i*2)] | (cursymb[2 + (i*2)] << 8);
- // printf("pulse_length %04x\n", pulse_length);
// shorter lists can be terminated with a pulse_length of 0
if (pulse_length != 0)
@@ -380,7 +375,6 @@ static inline int tzx_handle_symbol(int16_t **buffer, const uint8_t *symtable, u
tzx_output_wave(buffer, samples);
size += samples;
toggle_wave_data();
-
}
else
{
@@ -390,8 +384,6 @@ static inline int tzx_handle_symbol(int16_t **buffer, const uint8_t *symtable, u
}
}
- //toggle_wave_data();
-
return size;
}
@@ -405,7 +397,6 @@ static inline int stream_get_bit(const uint8_t *bytes, uint8_t &stream_bit, uint
if (byte & 0x80) retbit = 1;
-
stream_bit++;
if (stream_bit == 8)
@@ -433,34 +424,26 @@ static int tzx_handle_generalized(int16_t **buffer, const uint8_t *bytes, int pa
{
uint8_t symbol = table2[i + 0];
uint16_t repetitions = table2[i + 1] + (table2[i + 2] << 8);
- //printf("symbol %02x repititions %04x\n", symbol, repetitions); // does 1 mean repeat once, or that it only occurs once?
+ //printf("symbol %02x repetitions %04x\n", symbol, repetitions); // does 1 mean repeat once, or that it only occurs once?
for (int j = 0; j < repetitions; j++)
{
size += tzx_handle_symbol(buffer, symtable, symbol, npp);
- // toggle_wave_data();
}
-
-
}
// advance to after this data
bytes += ((2 * npp + 1)*asp) + totp * 3;
}
- else
- {
- printf("no pilot block\n");
- }
if (totd > 0)
{
- printf("data block table %04x (has %0d symbols, max symbol length is %d)\n", totd, asd, npd);
+ // printf("data block table %04x (has %0d symbols, max symbol length is %d)\n", totd, asd, npd);
const uint8_t *symtable = bytes;
const uint8_t *table2 = bytes + (2 * npd + 1)*asd;
int NB = ceil(compute_log2(asd)); // number of bits needed to represent each symbol
- printf("NB is %d\n", NB);
uint8_t stream_bit = 0;
uint32_t stream_byte = 0;
@@ -475,16 +458,8 @@ static int tzx_handle_generalized(int16_t **buffer, const uint8_t *bytes, int pa
}
size += tzx_handle_symbol(buffer, symtable, symbol, npd);
-
- //toggle_wave_data();
}
}
- else
- {
- printf("no data block\n");
- }
-
-
/* pause */
if (pause > 0)
@@ -505,9 +480,7 @@ static int tzx_handle_generalized(int16_t **buffer, const uint8_t *bytes, int pa
static void ascii_block_common_log( const char *block_type_string, uint8_t block_type )
{
- LOG_FORMATS("%s (type %02x) encountered.\n", block_type_string, block_type);
- LOG_FORMATS("This block contains info on the .tzx file you are loading.\n");
- LOG_FORMATS("Please include the following info in your bug reports, if the image has issue in M.E.S.S.\n");
+ LOG_FORMATS("%s (type %02x) encountered:\n", block_type_string, block_type);
}
static const char *const archive_ident[] =
@@ -744,20 +717,18 @@ static int tzx_cas_do_work( int16_t **buffer )
{
// having this missing is fatal
// used crudely by batmanc in spectrum_cass list (which is just a redundant encoding of batmane ?)
- printf("Unsupported block type (0x19 - Generalized Data Block) encountered.\n");
-
data_size = cur_block[1] + (cur_block[2] << 8) + (cur_block[3] << 16) + (cur_block[4] << 24);
pause_time= cur_block[5] + (cur_block[6] << 8);
uint32_t totp = cur_block[7] + (cur_block[8] << 8) + (cur_block[9] << 16) + (cur_block[10] << 24);
int npp = cur_block[11];
int asp = cur_block[12];
- if (asp == 0) asp = 256;
+ if (asp == 0 && totp > 0) asp = 256;
uint32_t totd = cur_block[13] + (cur_block[14] << 8) + (cur_block[15] << 16) + (cur_block[16] << 24);
int npd = cur_block[17];
int asd = cur_block[18];
- if (asd == 0) asd = 256;
+ if (asd == 0 && totd > 0) asd = 256;
size += tzx_handle_generalized(buffer, &cur_block[19], pause_time, data_size, totp, npp, asp, totd, npd, asd);
@@ -840,7 +811,7 @@ static int tap_cas_to_wav_size( const uint8_t *casdata, int caslen )
{
int data_size = p[0] + (p[1] << 8);
int pilot_length = (p[2] == 0x00) ? 8064 : 3220; /* TZX specification */
-// int pilot_length = (p[2] == 0x00) ? 8063 : 3223; /* worldofspectrum */
+// int pilot_length = (p[2] == 0x00) ? 8063 : 3223; /* worldofspectrum */
LOG_FORMATS("tap_cas_to_wav_size: Handling TAP block containing 0x%X bytes", data_size);
p += 2;
size += tzx_cas_handle_block(nullptr, p, 1000, data_size, 2168, pilot_length, 667, 735, 855, 1710, 8);
@@ -859,7 +830,7 @@ static int tap_cas_fill_wave( int16_t *buffer, int length, uint8_t *bytes )
{
int data_size = bytes[0] + (bytes[1] << 8);
int pilot_length = (bytes[2] == 0x00) ? 8064 : 3220; /* TZX specification */
-// int pilot_length = (bytes[2] == 0x00) ? 8063 : 3223; /* worldofspectrum */
+// int pilot_length = (bytes[2] == 0x00) ? 8063 : 3223; /* worldofspectrum */
LOG_FORMATS("tap_cas_fill_wave: Handling TAP block containing 0x%X bytes\n", data_size);
bytes += 2;
size += tzx_cas_handle_block(&p, bytes, 1000, data_size, 2168, pilot_length, 667, 735, 855, 1710, 8);
@@ -871,34 +842,34 @@ static int tap_cas_fill_wave( int16_t *buffer, int length, uint8_t *bytes )
static const struct CassetteLegacyWaveFiller tzx_legacy_fill_wave =
{
tzx_cas_fill_wave, /* fill_wave */
- -1, /* chunk_size */
- 0, /* chunk_samples */
- tzx_cas_to_wav_size, /* chunk_sample_calc */
+ -1, /* chunk_size */
+ 0, /* chunk_samples */
+ tzx_cas_to_wav_size, /* chunk_sample_calc */
TZX_WAV_FREQUENCY, /* sample_frequency */
- 0, /* header_samples */
- 0 /* trailer_samples */
+ 0, /* header_samples */
+ 0 /* trailer_samples */
};
static const struct CassetteLegacyWaveFiller tap_legacy_fill_wave =
{
tap_cas_fill_wave, /* fill_wave */
- -1, /* chunk_size */
- 0, /* chunk_samples */
- tap_cas_to_wav_size, /* chunk_sample_calc */
+ -1, /* chunk_size */
+ 0, /* chunk_samples */
+ tap_cas_to_wav_size, /* chunk_sample_calc */
TZX_WAV_FREQUENCY, /* sample_frequency */
- 0, /* header_samples */
- 0 /* trailer_samples */
+ 0, /* header_samples */
+ 0 /* trailer_samples */
};
static const struct CassetteLegacyWaveFiller cdt_legacy_fill_wave =
{
cdt_cas_fill_wave, /* fill_wave */
- -1, /* chunk_size */
- 0, /* chunk_samples */
- tzx_cas_to_wav_size, /* chunk_sample_calc */
+ -1, /* chunk_size */
+ 0, /* chunk_samples */
+ tzx_cas_to_wav_size, /* chunk_sample_calc */
TZX_WAV_FREQUENCY, /* sample_frequency */
- 0, /* header_samples */
- 0 /* trailer_samples */
+ 0, /* header_samples */
+ 0 /* trailer_samples */
};
static cassette_image::error tzx_cassette_identify( cassette_image *cassette, struct CassetteOptions *opts )
@@ -931,7 +902,7 @@ static cassette_image::error cdt_cassette_load( cassette_image *cassette )
return cassette_legacy_construct(cassette, &cdt_legacy_fill_wave);
}
-static const struct CassetteFormat tzx_cassette_format =
+const struct CassetteFormat tzx_cassette_format =
{
"tzx",
tzx_cassette_identify,
diff --git a/src/lib/formats/tzx_cas.h b/src/lib/formats/tzx_cas.h
index 8610fb0cdd4..2db31245310 100644
--- a/src/lib/formats/tzx_cas.h
+++ b/src/lib/formats/tzx_cas.h
@@ -12,6 +12,8 @@
#include "cassimg.h"
+extern const struct CassetteFormat tzx_cassette_format;
+
CASSETTE_FORMATLIST_EXTERN(tzx_cassette_formats);
CASSETTE_FORMATLIST_EXTERN(cdt_cassette_formats);
diff --git a/src/lib/formats/zx81_p.cpp b/src/lib/formats/zx81_p.cpp
index 7f359ccaca3..9fa5814385f 100644
--- a/src/lib/formats/zx81_p.cpp
+++ b/src/lib/formats/zx81_p.cpp
@@ -34,6 +34,7 @@ medium transfer rate is approx. 307 bps (38 bytes/sec) for files that contain
#include <assert.h>
#include "zx81_p.h"
+#include "tzx_cas.h"
#define WAVEENTRY_LOW -32768
@@ -197,13 +198,13 @@ static int zx81_cassette_fill_wave(int16_t *buffer, int length, uint8_t *bytes)
static const struct CassetteLegacyWaveFiller zx81_legacy_fill_wave =
{
- zx81_cassette_fill_wave, /* fill_wave */
- -1, /* chunk_size */
- 0, /* chunk_samples */
+ zx81_cassette_fill_wave, /* fill_wave */
+ -1, /* chunk_size */
+ 0, /* chunk_samples */
zx81_cassette_calculate_size_in_samples, /* chunk_sample_calc */
- ZX81_WAV_FREQUENCY, /* sample_frequency */
- 0, /* header_samples */
- 0 /* trailer_samples */
+ ZX81_WAV_FREQUENCY, /* sample_frequency */
+ 0, /* header_samples */
+ 0 /* trailer_samples */
};
static cassette_image::error zx81_p_identify(cassette_image *cassette, struct CassetteOptions *opts)
@@ -233,6 +234,11 @@ CASSETTE_FORMATLIST_START(zx81_p_format)
CASSETTE_FORMAT(zx81_p_image_format)
CASSETTE_FORMATLIST_END
+CASSETTE_FORMATLIST_START(zx81_cassette_formats)
+ CASSETTE_FORMAT(zx81_p_image_format)
+ CASSETTE_FORMAT(tzx_cassette_format)
+CASSETTE_FORMATLIST_END
+
/* ZX-80 functions */
static int zx80_cassette_calculate_size_in_samples(const uint8_t *bytes, int length)
@@ -265,11 +271,11 @@ static int zx80_cassette_fill_wave(int16_t *buffer, int length, uint8_t *bytes)
static const struct CassetteLegacyWaveFiller zx80_legacy_fill_wave =
{
- zx80_cassette_fill_wave, /* fill_wave */
+ zx80_cassette_fill_wave, /* fill_wave */
-1, /* chunk_size */
0, /* chunk_samples */
zx80_cassette_calculate_size_in_samples, /* chunk_sample_calc */
- ZX81_WAV_FREQUENCY, /* sample_frequency */
+ ZX81_WAV_FREQUENCY, /* sample_frequency */
0, /* header_samples */
0 /* trailer_samples */
};
diff --git a/src/lib/formats/zx81_p.h b/src/lib/formats/zx81_p.h
index 16a1b22724d..36da808c989 100644
--- a/src/lib/formats/zx81_p.h
+++ b/src/lib/formats/zx81_p.h
@@ -14,6 +14,7 @@
#include "cassimg.h"
CASSETTE_FORMATLIST_EXTERN(zx81_p_format);
+CASSETTE_FORMATLIST_EXTERN(zx81_cassette_formats);
CASSETTE_FORMATLIST_EXTERN(zx80_o_format);
#endif /* ZX81_P_H */
diff --git a/src/lib/netlist/analog/nld_bjt.cpp b/src/lib/netlist/analog/nld_bjt.cpp
index e40fbfa366d..127614367cf 100644
--- a/src/lib/netlist/analog/nld_bjt.cpp
+++ b/src/lib/netlist/analog/nld_bjt.cpp
@@ -127,7 +127,7 @@ public:
};
NETLIB_CONSTRUCTOR(Q)
- , m_model(*this, "MODEL", "")
+ , m_model(*this, "MODEL", "NPN")
, m_qtype(BJT_NPN)
{
}
diff --git a/src/lib/netlist/analog/nlid_twoterm.h b/src/lib/netlist/analog/nlid_twoterm.h
index 6166c707d2d..e77f65be702 100644
--- a/src/lib/netlist/analog/nlid_twoterm.h
+++ b/src/lib/netlist/analog/nlid_twoterm.h
@@ -348,7 +348,7 @@ NETLIB_OBJECT_DERIVED(D, twoterm)
{
public:
NETLIB_CONSTRUCTOR_DERIVED(D, twoterm)
- , m_model(*this, "MODEL", "")
+ , m_model(*this, "MODEL", "D")
, m_D(*this, "m_D")
{
register_subalias("A", m_P);
diff --git a/src/lib/netlist/build/doxygen.conf b/src/lib/netlist/build/doxygen.conf
index 9de9b691114..ca019aeef04 100644
--- a/src/lib/netlist/build/doxygen.conf
+++ b/src/lib/netlist/build/doxygen.conf
@@ -32,7 +32,7 @@ DOXYFILE_ENCODING = UTF-8
# title of most generated pages and in a few other places.
# The default value is: My Project.
-PROJECT_NAME = Netlist documentaton
+PROJECT_NAME = Netlist documentation
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
# could be handy for archiving the generated documentation or if some version
@@ -771,7 +771,7 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.
-INPUT = ".." "../analog" "../documentation"
+INPUT = .. ../analog ../documentation ../devices
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
@@ -844,7 +844,7 @@ EXCLUDE_SYMBOLS =
# that contain example code fragments that are included (see the \include
# command).
-EXAMPLE_PATH =
+EXAMPLE_PATH = ../../../../nl_examples ../documentation
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
@@ -1416,7 +1416,7 @@ DISABLE_INDEX = NO
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
-GENERATE_TREEVIEW = NO
+GENERATE_TREEVIEW = YES
# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
# doxygen will group on one line in the generated HTML documentation.
diff --git a/src/lib/netlist/build/makefile b/src/lib/netlist/build/makefile
index fa983cb1d6c..d2b1afa6b36 100644
--- a/src/lib/netlist/build/makefile
+++ b/src/lib/netlist/build/makefile
@@ -9,9 +9,14 @@
#
###########################################################################
-OBJ = obj
SRC = ..
+ifeq ($(subst Windows_NT,windows,$(OS)),windows)
+OBJ = obj/mingw
+else
+OBJ = obj/nix
+endif
+
#-fuse-ld=gold -Wpedantic -march=native -march=native
# LTO = -flto=4 -fuse-linker-plugin -flto-partition=balanced -Wodr
@@ -167,15 +172,18 @@ maketree: $(sort $(OBJDIRS))
# Special targets
#-------------------------------------------------
-.PHONY: clang mingw doc
+.PHONY: clang clang-5 mingw doc
clang:
- $(MAKE) CC=clang++-5.0 LD=clang++-5.0 CEXTRAFLAGS="-march=native -Weverything -Werror -Wno-padded -Wno-weak-vtables -Wno-missing-variable-declarations -Wconversion -Wno-c++98-compat -Wno-float-equal -Wno-global-constructors -Wno-c++98-compat-pedantic -Wno-format-nonliteral -Wno-weak-template-vtables -Wno-exit-time-destructors"
+ $(MAKE) CC=clang++ LD=clang++ CEXTRAFLAGS="-march=native -Weverything -Werror -Wno-padded -Wno-weak-vtables -Wno-missing-variable-declarations -Wconversion -Wno-c++98-compat -Wno-float-equal -Wno-global-constructors -Wno-c++98-compat-pedantic -Wno-format-nonliteral -Wno-weak-template-vtables -Wno-exit-time-destructors"
+
+clang-5:
+ $(MAKE) CC=clang++-5.0 LD=clang++-5.0 CEXTRAFLAGS="-march=native -Weverything -Werror -Wno-unreachable-code -Wno-padded -Wno-weak-vtables -Wno-missing-variable-declarations -Wconversion -Wno-c++98-compat -Wno-float-equal -Wno-global-constructors -Wno-c++98-compat-pedantic -Wno-format-nonliteral -Wno-weak-template-vtables -Wno-exit-time-destructors"
#
# Mostly done: -Wno-weak-vtables -Wno-cast-align
# FIXME: -Wno-weak-vtables -Wno-missing-variable-declarations -Wno-conversion -Wno-exit-time-destructors
-#
+# FIXME: -Wunreachable-code : False warnings, this a documented clang bug: https://llvm.org/bugs/show_bug.cgi?id=28994
mingw:
$(MAKE) LDEXTRAFLAGS="-Wl,--subsystem,console" LIBS= MD=@mkdir.exe SHELL=sh.exe
@@ -187,7 +195,8 @@ mingw:
#
-doc:
+doc: nltool
+ ./nltool -c docheader > ../documentation/devsyn.dox.h
$(DOXYGEN) doxygen.conf
#-------------------------------------------------
@@ -198,7 +207,7 @@ doc:
@echo creating .depend
@rm -f ./.depend
@for i in $(SOURCES); do \
- $(CC) $(CFLAGS) -MM $$i -MT `echo $$i | sed -e 's/$(SRC)/$(OBJ)/' -e 's/.cpp/.o/' ` >>./.depend; \
+ $(CC) $(CFLAGS) -MM $$i -MT `echo $$i | sed -e 's+$(SRC)+$(OBJ)+' -e 's+.cpp+.o+' ` >>./.depend; \
done
depend: .depend
@@ -228,3 +237,4 @@ $(OBJ)/%.a:
@echo Archiving $@...
$(RM) $@
$(AR) $(ARFLAGS) $@ $^
+
diff --git a/src/lib/netlist/devices/net_lib.cpp b/src/lib/netlist/devices/net_lib.cpp
index bc1d7051b39..3fb47772c45 100644
--- a/src/lib/netlist/devices/net_lib.cpp
+++ b/src/lib/netlist/devices/net_lib.cpp
@@ -15,14 +15,8 @@
#define xstr(s) # s
-#if 0
-#define ENTRY1(nic, name, defparam) factory.register_device<nic>( # name, xstr(nic), defparam );
-#define ENTRY(nic, name, defparam) ENTRY1(NETLIB_NAME(nic), name, defparam)
-#endif
-
#define NETLIB_DEVICE_DECL(chip) extern factory::constructor_ptr_t decl_ ## chip;
-//#define ENTRYX1(nic, name, defparam, decl) factory.register_device( decl (# name, xstr(nic), defparam) );
#define ENTRYX1(nic, name, defparam, decl) factory.register_device( decl (pstring(# name), pstring(xstr(nic)), pstring(defparam)) );
#define ENTRYX(nic, name, defparam) { NETLIB_DEVICE_DECL(nic) ENTRYX1(NETLIB_NAME(nic), name, defparam, decl_ ## nic) }
diff --git a/src/lib/netlist/devices/nld_9322.cpp b/src/lib/netlist/devices/nld_9322.cpp
index 1f402d4111b..b10213152f8 100644
--- a/src/lib/netlist/devices/nld_9322.cpp
+++ b/src/lib/netlist/devices/nld_9322.cpp
@@ -12,43 +12,36 @@ namespace netlist
{
namespace devices
{
+ class NETLIB_NAME(9322);
+
NETLIB_OBJECT(9322_selector)
{
NETLIB_CONSTRUCTOR(9322_selector)
+ , m_parent(owner)
, m_A(*this, "A")
, m_B(*this, "B")
, m_Y(*this, "Y")
{
}
- void update_outputs(const netlist_sig_t strobe, const netlist_sig_t select);
+ NETLIB_UPDATEI();
public:
+ NETLIB_NAME(9322) &m_parent;
logic_input_t m_A;
logic_input_t m_B;
logic_output_t m_Y;
};
- // FIXME: Timing
- void NETLIB_NAME(9322_selector)::update_outputs(const netlist_sig_t strobe, const netlist_sig_t select)
- {
- if (strobe)
- m_Y.push(0, NLTIME_FROM_NS(21));
- else if (select)
- m_Y.push(m_B(), NLTIME_FROM_NS(14));
- else
- m_Y.push(m_A(), NLTIME_FROM_NS(14));
- }
-
NETLIB_OBJECT(9322)
{
NETLIB_CONSTRUCTOR(9322)
+ , m_SELECT(*this, "SELECT")
+ , m_STROBE(*this, "STROBE")
, m_1(*this, "1")
, m_2(*this, "2")
, m_3(*this, "3")
, m_4(*this, "4")
- , m_SELECT(*this, "SELECT")
- , m_STROBE(*this, "STROBE")
{
register_subalias("A1", m_1.m_A);
register_subalias("B1", m_1.m_B);
@@ -66,14 +59,15 @@ namespace netlist
NETLIB_UPDATEI();
+ public:
+ logic_input_t m_SELECT;
+ logic_input_t m_STROBE;
protected:
NETLIB_SUB(9322_selector) m_1;
NETLIB_SUB(9322_selector) m_2;
NETLIB_SUB(9322_selector) m_3;
NETLIB_SUB(9322_selector) m_4;
- logic_input_t m_SELECT;
- logic_input_t m_STROBE;
};
NETLIB_OBJECT_DERIVED(9322_dip, 9322)
@@ -98,14 +92,23 @@ namespace netlist
}
};
+ // FIXME: Timing
+ NETLIB_UPDATE(9322_selector)
+ {
+ if (m_parent.m_STROBE())
+ m_Y.push(0, NLTIME_FROM_NS(21));
+ else if (m_parent.m_SELECT())
+ m_Y.push(m_B(), NLTIME_FROM_NS(14));
+ else
+ m_Y.push(m_A(), NLTIME_FROM_NS(14));
+ }
+
NETLIB_UPDATE(9322)
{
- const netlist_sig_t strobe = m_STROBE();
- const netlist_sig_t select = m_SELECT();
- m_1.update_outputs(strobe, select);
- m_2.update_outputs(strobe, select);
- m_3.update_outputs(strobe, select);
- m_4.update_outputs(strobe, select);
+ m_1.update_dev();
+ m_2.update_dev();
+ m_3.update_dev();
+ m_4.update_dev();
}
NETLIB_DEVICE_IMPL(9322)
diff --git a/src/lib/netlist/devices/nld_am2847.cpp b/src/lib/netlist/devices/nld_am2847.cpp
index be5f75c3774..29a3b2417eb 100644
--- a/src/lib/netlist/devices/nld_am2847.cpp
+++ b/src/lib/netlist/devices/nld_am2847.cpp
@@ -22,6 +22,8 @@ namespace netlist
{
}
+ NETLIB_UPDATEI();
+
public:
void shift();
@@ -109,6 +111,11 @@ namespace netlist
m_last_CP = m_CP();
}
+ NETLIB_UPDATE(Am2847_shifter)
+ {
+ /* do nothing */
+ }
+
inline NETLIB_FUNC_VOID(Am2847_shifter, shift, (void))
{
uint32_t out = m_buffer[0] & 1;
diff --git a/src/lib/netlist/devices/nld_ne555.cpp b/src/lib/netlist/devices/nld_ne555.cpp
index f9bb5e261c2..a171d05595a 100644
--- a/src/lib/netlist/devices/nld_ne555.cpp
+++ b/src/lib/netlist/devices/nld_ne555.cpp
@@ -1,8 +1,48 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * nld_NE555.c
+/*!
+ * \file nld_NE555.cpp
*
+ * \page NE555 NE555: PRECISION TIMERS
+ *
+ * The Swiss army knife for timing purposes
+ *
+ * \section ne555_1 Synopsis
+ *
+ * \snippet devsyn.dox.h NE555 synopsis
+ * \snippet devsyn.dox.h NE555_DIP synopsis
+
+ * \section ne555_11 "C" Synopsis
+ *
+ * \snippet devsyn.dox.h NE555 csynopsis
+ * \snippet devsyn.dox.h NE555_DIP csynopsis
+ *
+ * For the \c NE555 use verbose pin assignments like \c name.TRIG or \c name.OUT.
+ * For the \c NE555_DIP use pin numbers like \c name.1.
+ *
+ * \section ne555_2 Connection Diagram
+ *
+ * <pre>
+ * +--------+
+ * GND |1 ++ 8| VCC
+ * TRIG |2 7| DISCH
+ * OUT |3 6| THRES
+ * RESET |4 5| CONT
+ * +--------+
+ * </pre>
+ *
+ * Naming conventions follow Texas Instruments datasheet
+ *
+ * \section ne555_3 Function Table
+ *
+ * Please refer to the datasheet.
+ *
+ * \section ne555_4 Limitations
+ *
+ * Internal resistor network currently fixed to 5k.
+ *
+ * \section ne555_5 Example
+ * \snippet ne555_astable.c ne555 example
*/
#include "nld_ne555.h"
@@ -96,6 +136,7 @@ namespace netlist
m_R3.do_reset();
m_RDIS.do_reset();
+ /* FIXME make resistance a parameter, properly model other variants */
m_R1.set_R(5000);
m_R2.set_R(5000);
m_R3.set_R(5000);
diff --git a/src/lib/netlist/devices/nld_ne555.h b/src/lib/netlist/devices/nld_ne555.h
index 27e02285ee0..c73906b1b66 100644
--- a/src/lib/netlist/devices/nld_ne555.h
+++ b/src/lib/netlist/devices/nld_ne555.h
@@ -1,20 +1,5 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
-/*
- * nld_NE555.h
- *
- * NE555: PRECISION TIMERS
- *
- * +--------+
- * GND |1 ++ 8| VCC
- * TRIG |2 7| DISCH
- * OUT |3 6| THRES
- * RESET |4 5| CONT
- * +--------+
- *
- * Naming conventions follow Texas Instruments datasheet
- *
- */
#ifndef NLD_NE555_H_
#define NLD_NE555_H_
diff --git a/src/lib/netlist/devices/nlid_system.h b/src/lib/netlist/devices/nlid_system.h
index e9baa4c159d..5bf75ca0497 100644
--- a/src/lib/netlist/devices/nlid_system.h
+++ b/src/lib/netlist/devices/nlid_system.h
@@ -303,8 +303,8 @@ namespace netlist
NETLIB_OBJECT(function)
{
NETLIB_CONSTRUCTOR(function)
- , m_N(*this, "N", 2)
- , m_func(*this, "FUNC", "")
+ , m_N(*this, "N", 1)
+ , m_func(*this, "FUNC", "A0")
, m_Q(*this, "Q")
{
std::vector<pstring> inps;
diff --git a/src/lib/netlist/documentation/mainpage.dox.h b/src/lib/netlist/documentation/mainpage.dox.h
index 744abe642e6..cfe098845ed 100644
--- a/src/lib/netlist/documentation/mainpage.dox.h
+++ b/src/lib/netlist/documentation/mainpage.dox.h
@@ -1,5 +1,12 @@
+/*
+ * Documentation settings
+ */
+
+/*!
+ *
+ * \mainpage Netlist
+
-/*! \mainpage notitle
##Netlist
diff --git a/src/lib/netlist/nl_types.h b/src/lib/netlist/netlist_types.h
index 365b0e19868..c7c4aef4750 100644
--- a/src/lib/netlist/nl_types.h
+++ b/src/lib/netlist/netlist_types.h
@@ -2,12 +2,12 @@
// copyright-holders:Couriersud
/*!
*
- * \file nl_types.h
+ * \file netlist_types.h
*
*/
-#ifndef NLTYPES_H_
-#define NLTYPES_H_
+#ifndef NETLIST_TYPES_H_
+#define NETLIST_TYPES_H_
#include <cstdint>
#include <unordered_map>
@@ -22,13 +22,13 @@ namespace netlist
// Performance tracking
//============================================================
- #if NL_KEEP_STATISTICS
+#if NL_KEEP_STATISTICS
using nperftime_t = plib::chrono::timer<plib::chrono::exact_ticks, true>;
using nperfcount_t = plib::chrono::counter<true>;
- #else
+#else
using nperftime_t = plib::chrono::timer<plib::chrono::exact_ticks, false>;
using nperfcount_t = plib::chrono::counter<false>;
- #endif
+#endif
//============================================================
// Types needed by various includes
@@ -51,4 +51,4 @@ namespace netlist
}
}
-#endif /* NLTYPES_H_ */
+#endif /* NETLIST_TYPES_H_ */
diff --git a/src/lib/netlist/nl_base.cpp b/src/lib/netlist/nl_base.cpp
index 4374ef2212d..c2e81ee69a2 100644
--- a/src/lib/netlist/nl_base.cpp
+++ b/src/lib/netlist/nl_base.cpp
@@ -25,31 +25,35 @@ namespace netlist
{
namespace detail
{
-#if (USE_MEMPOOL)
-static plib::mempool pool(6553600, 64);
-void * object_t::operator new (size_t size)
-{
- return pool.alloc(size);
-}
+ static plib::mempool *pool()
+ {
+ static plib::mempool *s_pool = nullptr;
+ if (s_pool == nullptr)
+ s_pool = new plib::mempool(65536, 16);
+ return s_pool;
+ }
-void object_t::operator delete (void * mem)
-{
- if (mem)
- pool.free(mem);
-}
-#else
-void * object_t::operator new (size_t size)
-{
- return ::operator new(size);
-}
+ void * object_t::operator new (size_t size)
+ {
+ void *ret = nullptr;
+ if ((USE_MEMPOOL))
+ ret = pool()->alloc(size);
+ else
+ ret = ::operator new(size);
+ return ret;
+ }
-void object_t::operator delete (void * mem)
-{
- if (mem)
- ::operator delete(mem);
-}
-#endif
+ void object_t::operator delete (void * mem)
+ {
+ if (mem)
+ {
+ if ((USE_MEMPOOL))
+ pool()->free(mem);
+ else
+ ::operator delete(mem);
+ }
+ }
}
@@ -361,12 +365,6 @@ void netlist_t::start()
/* resolve inputs */
setup().resolve_inputs();
- /* Make sure devices are fully created - now done in register_dev */
-
- log().debug("Setting delegate pointers ...\n");
- for (auto &dev : m_devices)
- dev->set_delegate_pointer();
-
log().verbose("looking for two terms connected to rail nets ...");
for (auto & t : get_device_list<analog::NETLIB_NAME(twoterm)>())
{
@@ -391,6 +389,14 @@ void netlist_t::start()
else
m_solver->post_start();
+ for (auto &n : m_nets)
+ for (auto & term : n->m_core_terms)
+ {
+ //core_device_t *dev = reinterpret_cast<core_device_t *>(term->m_delegate.object());
+ core_device_t *dev = &term->device();
+ dev->set_default_delegate(*term);
+ }
+
}
void netlist_t::stop()
@@ -427,6 +433,14 @@ void netlist_t::reset()
//if (m_solver != nullptr)
// m_solver->do_reset();
+ std::unordered_map<core_device_t *, bool> m;
+
+ for (auto &d : m_devices)
+ {
+ m[d.get()] = d->get_hint_deactivate();
+ }
+
+
// Reset all nets once !
for (auto & n : m_nets)
n->reset();
@@ -444,15 +458,66 @@ void netlist_t::reset()
* INFO: The order here affects power up of e.g. breakout. However, such
* variations are explicitly stated in the breakout manual.
*/
-#if 0
- for (std::size_t i = 0; i < m_devices.size(); i++)
+
+ const unsigned startup_strategy = 1; //! \note make this a parameter
+
+ switch (startup_strategy)
{
- m_devices[i]->update_dev();
+ case 0:
+ {
+ std::vector<core_device_t *> d;
+ std::vector<nldelegate *> t;
+ log().verbose("Using default startup strategy");
+ for (auto &n : m_nets)
+ for (auto & term : n->m_core_terms)
+ if (term->m_delegate.has_object())
+ {
+ if (!plib::container::contains(t, &term->m_delegate))
+ {
+ t.push_back(&term->m_delegate);
+ term->m_delegate();
+ }
+ core_device_t *dev = reinterpret_cast<core_device_t *>(term->m_delegate.object());
+ if (!plib::container::contains(d, dev))
+ d.push_back(dev);
+ }
+ log().verbose("Call update on devices which need parameter update:");
+ for (auto & dev : m_devices)
+ if (dev->needs_update_after_param_change())
+ {
+ if (!plib::container::contains(d, dev.get()))
+ {
+ d.push_back(dev.get());
+ log().verbose("\t ...{1}", dev->name());
+ dev->update_dev();
+ }
+ }
+ log().verbose("Devices not yet updated:");
+ for (auto &dev : m_devices)
+ if (!plib::container::contains(d, dev.get()))
+ log().verbose("\t ...{1}", dev->name());
+ //x->update_dev();
+ }
+ break;
+ case 1: // brute force backward
+ {
+ std::size_t i = m_devices.size();
+ while (i>0)
+ m_devices[--i]->update_dev();
+ }
+ break;
+ case 2: // brute force forward
+ {
+ for (std::size_t i = 0; i < m_devices.size(); i++)
+ m_devices[i]->update_dev();
+ }
+ break;
}
-#else
- std::size_t i = m_devices.size();
- while (i>0)
- m_devices[--i]->update_dev();
+
+#if 1
+ /* the above may screw up m_active and the list */
+ for (auto &n : m_nets)
+ n->rebuild_list();
#endif
}
@@ -568,7 +633,7 @@ void netlist_t::print_stats() const
}
}
-core_device_t *netlist_t::pget_single_device(const pstring classname, bool (*cc)(core_device_t *))
+core_device_t *netlist_t::get_single_device(const pstring classname, bool (*cc)(core_device_t *))
{
core_device_t *ret = nullptr;
for (auto &d : m_devices)
@@ -594,9 +659,6 @@ core_device_t::core_device_t(netlist_t &owner, const pstring &name)
, logic_family_t()
, netlist_ref(owner)
, m_hint_deactivate(false)
-#if (!NL_USE_PMF_VIRTUAL)
- , m_static_update()
-#endif
{
if (logic_family() == nullptr)
set_logic_family(family_TTL());
@@ -607,9 +669,6 @@ core_device_t::core_device_t(core_device_t &owner, const pstring &name)
, logic_family_t()
, netlist_ref(owner.netlist())
, m_hint_deactivate(false)
-#if (!NL_USE_PMF_VIRTUAL)
- , m_static_update()
-#endif
{
set_logic_family(owner.logic_family());
if (logic_family() == nullptr)
@@ -621,11 +680,9 @@ core_device_t::~core_device_t()
{
}
-void core_device_t::set_delegate_pointer()
+void core_device_t::set_default_delegate(detail::core_terminal_t &term)
{
-#if (!NL_USE_PMF_VIRTUAL)
- m_static_update.set_base(&core_device_t::update, this);
-#endif
+ term.m_delegate.set(&core_device_t::update, this);
}
plib::plog_base<NL_DEBUG> &core_device_t::log()
@@ -772,7 +829,7 @@ void detail::net_t::update_devs() NL_NOEXCEPT
{
nl_assert(this->isRailNet());
- static const unsigned masks[4] =
+ const unsigned masks[4] =
{
0,
core_terminal_t::STATE_INP_LH | core_terminal_t::STATE_INP_ACTIVE,
@@ -780,16 +837,16 @@ void detail::net_t::update_devs() NL_NOEXCEPT
0
};
- const unsigned mask = masks[ m_cur_Q * 2 + m_new_Q ];
+ const unsigned mask = masks[ (m_cur_Q << 1) | m_new_Q ];
- m_in_queue = 2; /* mark as taken ... */
m_cur_Q = m_new_Q;
+ m_in_queue = 2; /* mark as taken ... */
for (auto & p : m_list_active)
{
p.device().m_stat_call_count.inc();
if ((p.state() & mask) != 0)
- p.device().update_dev();
+ p.m_delegate();
}
}
@@ -891,6 +948,8 @@ detail::core_terminal_t::core_terminal_t(core_device_t &dev, const pstring &anam
, m_net(nullptr)
, m_state(*this, "m_state", state)
{
+ //m_delegate.set(&core_device_t::update, &dev);
+ //m_delegate.set(&core_device_t::update_dev, &dev);
}
detail::core_terminal_t::~core_terminal_t()
@@ -1199,4 +1258,26 @@ std::unique_ptr<plib::pistream> param_data_t::stream()
} //namespace devices
+
+ bool detail::core_terminal_t::is_logic() const NL_NOEXCEPT
+ {
+ return dynamic_cast<const logic_t *>(this) != nullptr;
+ }
+
+ bool detail::core_terminal_t::is_analog() const NL_NOEXCEPT
+ {
+ return dynamic_cast<const analog_t *>(this) != nullptr;
+ }
+
+ bool detail::net_t::is_logic() const NL_NOEXCEPT
+ {
+ return dynamic_cast<const logic_net_t *>(this) != nullptr;
+ }
+
+ bool detail::net_t::is_analog() const NL_NOEXCEPT
+ {
+ return dynamic_cast<const analog_net_t *>(this) != nullptr;
+ }
+
+
} // namespace netlist
diff --git a/src/lib/netlist/nl_base.h b/src/lib/netlist/nl_base.h
index e56a10b9e20..3e06144168d 100644
--- a/src/lib/netlist/nl_base.h
+++ b/src/lib/netlist/nl_base.h
@@ -316,15 +316,15 @@ namespace netlist
//! Move Constructor.
state_var(state_var &&rhs) NL_NOEXCEPT = default;
//! Assignment operator to assign value of a state var.
- state_var &operator=(const state_var &rhs) { m_value = rhs; return *this; }
+ state_var &operator=(const state_var &rhs) NL_NOEXCEPT { m_value = rhs; return *this; }
//! Assignment operator to assign value of type T.
- state_var &operator=(const T &rhs) { m_value = rhs; return *this; }
+ state_var &operator=(const T &rhs) NL_NOEXCEPT { m_value = rhs; return *this; }
//! Return value of state variable.
- operator T & () { return m_value; }
+ operator T & () NL_NOEXCEPT { return m_value; }
//! Return const value of state variable.
- constexpr operator const T & () const { return m_value; }
+ constexpr operator const T & () const NL_NOEXCEPT { return m_value; }
T * ptr() { return &m_value; }
- constexpr T * ptr() const { return &m_value; }
+ constexpr T * ptr() const NL_NOEXCEPT{ return &m_value; }
private:
T m_value;
};
@@ -347,10 +347,10 @@ namespace netlist
state_var(const state_var &rhs) NL_NOEXCEPT = default;
//! Move Constructor.
state_var(state_var &&rhs) NL_NOEXCEPT = default;
- state_var &operator=(const state_var &rhs) { m_value = rhs.m_value; return *this; }
- state_var &operator=(const T &rhs) { m_value = rhs; return *this; }
- T & operator[](const std::size_t i) { return m_value[i]; }
- constexpr T & operator[](const std::size_t i) const { return m_value[i]; }
+ state_var &operator=(const state_var &rhs) NL_NOEXCEPT { m_value = rhs.m_value; return *this; }
+ state_var &operator=(const T &rhs) NL_NOEXCEPT { m_value = rhs; return *this; }
+ T & operator[](const std::size_t i) NL_NOEXCEPT { return m_value[i]; }
+ constexpr T & operator[](const std::size_t i) const NL_NOEXCEPT { return m_value[i]; }
private:
T m_value[N];
};
@@ -443,7 +443,7 @@ namespace netlist
/*! returns reference to owning device.
* \returns reference to owning device.
*/
- core_device_t &device() const { return m_device; }
+ core_device_t &device() const NL_NOEXCEPT { return m_device; }
/*! The netlist owning the owner of this object.
* \returns reference to netlist object.
@@ -455,6 +455,10 @@ namespace netlist
core_device_t & m_device;
};
+ /*! Delegate type for device notification.
+ *
+ */
+ typedef plib::pmfp<void> nldelegate;
// -----------------------------------------------------------------------------
// core_terminal_t
@@ -495,20 +499,22 @@ namespace netlist
void set_net(net_t *anet);
void clear_net();
- bool has_net() const { return (m_net != nullptr); }
+ bool has_net() const NL_NOEXCEPT { return (m_net != nullptr); }
- const net_t & net() const { return *m_net;}
- net_t & net() { return *m_net;}
+ const net_t & net() const NL_NOEXCEPT { return *m_net;}
+ net_t & net() NL_NOEXCEPT { return *m_net;}
bool is_logic() const NL_NOEXCEPT;
bool is_analog() const NL_NOEXCEPT;
- bool is_state(const state_e astate) const { return (m_state == astate); }
- state_e state() const { return m_state; }
- void set_state(const state_e astate) { m_state = astate; }
+ bool is_state(const state_e astate) const NL_NOEXCEPT { return (m_state == astate); }
+ state_e state() const NL_NOEXCEPT { return m_state; }
+ void set_state(const state_e astate) NL_NOEXCEPT { m_state = astate; }
void reset();
+ nldelegate m_delegate;
+
private:
net_t * m_net;
state_var<state_e> m_state;
@@ -666,7 +672,7 @@ namespace netlist
/*! returns voltage at terminal.
* \returns voltage at terminal.
*/
- nl_double operator()() const { return Q_Analog(); }
+ nl_double operator()() const NL_NOEXCEPT { return Q_Analog(); }
/*! returns voltage at terminal.
* \returns voltage at terminal.
@@ -690,17 +696,17 @@ namespace netlist
void reset();
- void toggle_new_Q() { m_new_Q ^= 1; }
- void force_queue_execution() { m_new_Q = (m_cur_Q ^ 1); }
+ void toggle_new_Q() NL_NOEXCEPT { m_new_Q ^= 1; }
+ void force_queue_execution() NL_NOEXCEPT { m_new_Q = (m_cur_Q ^ 1); }
void push_to_queue(const netlist_time delay) NL_NOEXCEPT;
void reschedule_in_queue(const netlist_time delay) NL_NOEXCEPT;
- bool is_queued() const { return m_in_queue == 1; }
+ bool is_queued() const NL_NOEXCEPT { return m_in_queue == 1; }
void update_devs() NL_NOEXCEPT;
- const netlist_time time() const { return m_time; }
- void set_time(const netlist_time ntime) { m_time = ntime; }
+ const netlist_time time() const NL_NOEXCEPT { return m_time; }
+ void set_time(const netlist_time ntime) NL_NOEXCEPT { m_time = ntime; }
bool isRailNet() const { return !(m_railterminal == nullptr); }
core_terminal_t & railterminal() const { return *m_railterminal; }
@@ -748,9 +754,9 @@ namespace netlist
logic_net_t(netlist_t &nl, const pstring &aname, detail::core_terminal_t *mr = nullptr);
virtual ~logic_net_t();
- netlist_sig_t Q() const { return m_cur_Q; }
- netlist_sig_t new_Q() const { return m_new_Q; }
- void initial(const netlist_sig_t val) { m_cur_Q = m_new_Q = val; }
+ netlist_sig_t Q() const NL_NOEXCEPT { return m_cur_Q; }
+ netlist_sig_t new_Q() const NL_NOEXCEPT { return m_new_Q; }
+ void initial(const netlist_sig_t val) NL_NOEXCEPT { m_cur_Q = m_new_Q = val; }
void set_Q(const netlist_sig_t newQ, const netlist_time delay) NL_NOEXCEPT
{
@@ -1027,8 +1033,6 @@ namespace netlist
m_stat_total_time.stop();
}
- void set_delegate_pointer();
-
void do_inc_active() NL_NOEXCEPT
{
if (m_hint_deactivate)
@@ -1046,12 +1050,16 @@ namespace netlist
void do_reset() { reset(); }
void set_hint_deactivate(bool v) { m_hint_deactivate = v; }
+ bool get_hint_deactivate() { return m_hint_deactivate; }
+
+ void set_default_delegate(detail::core_terminal_t &term);
/* stats */
nperftime_t m_stat_total_time;
nperfcount_t m_stat_call_count;
nperfcount_t m_stat_inc_active;
+
protected:
virtual void update() NL_NOEXCEPT { }
@@ -1061,11 +1069,7 @@ namespace netlist
void do_update() NL_NOEXCEPT
{
- #if (NL_USE_PMF_VIRTUAL)
update();
- #else
- m_static_update.call(this);
- #endif
}
plib::plog_base<NL_DEBUG> &log();
@@ -1081,10 +1085,6 @@ namespace netlist
private:
bool m_hint_deactivate;
-
- #if (!NL_USE_PMF_VIRTUAL)
- plib::pmfp_base<void> m_static_update;
- #endif
};
// -----------------------------------------------------------------------------
@@ -1232,7 +1232,7 @@ namespace netlist
template<class C>
C *get_single_device(const pstring classname)
{
- return dynamic_cast<C *>(pget_single_device(classname, check_class<C>));
+ return dynamic_cast<C *>(get_single_device(classname, check_class<C>));
}
/* logging and name */
@@ -1254,8 +1254,6 @@ namespace netlist
this->state().save_state_ptr(static_cast<void *>(&owner), from_utf8(owner.name()) + pstring(".") + stname, plib::state_manager_t::datatype_f<C>::f(), count, state);
}
- void rebuild_lists(); /* must be called after post_load ! */
-
plib::dynlib &lib() { return *m_lib; }
// FIXME: find something better
@@ -1264,7 +1262,11 @@ namespace netlist
/* sole use is to manage lifetime of family objects */
std::vector<std::pair<pstring, std::unique_ptr<logic_family_desc_t>>> m_family_cache;
+ // FIXME: sort rebuild_lists out
+ void rebuild_lists(); /* must be called after post_load ! */
+
protected:
+
void print_stats() const;
private:
@@ -1273,7 +1275,7 @@ namespace netlist
static pstring from_utf8(const char *c) { return pstring(c, pstring::UTF8); }
static pstring from_utf8(const pstring &c) { return c; }
- core_device_t *pget_single_device(const pstring classname, bool (*cc)(core_device_t *));
+ core_device_t *get_single_device(const pstring classname, bool (*cc)(core_device_t *));
/* mostly rw */
netlist_time m_time;
@@ -1333,26 +1335,6 @@ namespace netlist
device.netlist().log().warning("Rom {1} not found", Value());
}
- inline bool detail::core_terminal_t::is_logic() const NL_NOEXCEPT
- {
- return dynamic_cast<const logic_t *>(this) != nullptr;
- }
-
- inline bool detail::core_terminal_t::is_analog() const NL_NOEXCEPT
- {
- return dynamic_cast<const analog_t *>(this) != nullptr;
- }
-
- inline bool detail::net_t::is_logic() const NL_NOEXCEPT
- {
- return dynamic_cast<const logic_net_t *>(this) != nullptr;
- }
-
- inline bool detail::net_t::is_analog() const NL_NOEXCEPT
- {
- return dynamic_cast<const analog_net_t *>(this) != nullptr;
- }
-
inline void logic_input_t::inactivate()
{
if (!is_state(STATE_INP_PASSIVE))
@@ -1453,6 +1435,16 @@ namespace netlist
}
}
+ inline netlist_t &detail::device_object_t::netlist()
+ {
+ return m_device.netlist();
+ }
+
+ inline const netlist_t &detail::device_object_t::netlist() const
+ {
+ return m_device.netlist();
+ }
+
template <typename T>
template <typename O>
state_var<T>::state_var(O &owner, const pstring name, const T &value)
@@ -1470,15 +1462,6 @@ namespace netlist
m_value[i] = value;
}
- inline netlist_t &detail::device_object_t::netlist()
- {
- return m_device.netlist();
- }
-
- inline const netlist_t &detail::device_object_t::netlist() const
- {
- return m_device.netlist();
- }
}
diff --git a/src/lib/netlist/nl_config.h b/src/lib/netlist/nl_config.h
index ded567717f9..57b6a03f031 100644
--- a/src/lib/netlist/nl_config.h
+++ b/src/lib/netlist/nl_config.h
@@ -95,16 +95,6 @@ using nl_double = double;
* approach will be automatically selected.
*/
-//#define NL_USE_PMF_VIRTUAL 1
-
-#ifndef NL_USE_PMF_VIRTUAL
- #if PPMF_TYPE == PPMF_TYPE_PMF
- #define NL_USE_PMF_VIRTUAL 1
- #else
- #define NL_USE_PMF_VIRTUAL 0
- #endif
-#endif
-
//============================================================
// WARNINGS
//============================================================
@@ -115,9 +105,4 @@ using nl_double = double;
#endif
#endif
-#ifdef __APPLE__
-#undef USE_MEMPOOL
-#define USE_MEMPOOL (0)
-#endif
-
#endif /* NLCONFIG_H_ */
diff --git a/src/lib/netlist/nl_lists.h b/src/lib/netlist/nl_lists.h
index 0461a445ff2..a841db1e084 100644
--- a/src/lib/netlist/nl_lists.h
+++ b/src/lib/netlist/nl_lists.h
@@ -15,7 +15,7 @@
#include <mutex>
#include "nl_config.h"
-#include "nl_types.h"
+#include "netlist_types.h"
#include "plib/plists.h"
#include "plib/pchrono.h"
#include "plib/ptypes.h"
@@ -52,12 +52,13 @@ namespace netlist
{
public:
- struct entry_t
+ struct entry_t final
{
- entry_t() { }
- entry_t(const Time &t, const Element &o) : m_exec_time(t), m_object(o) { }
- entry_t(const entry_t &e) : m_exec_time(e.m_exec_time), m_object(e.m_object) { }
- entry_t(entry_t &&e) : m_exec_time(e.m_exec_time), m_object(e.m_object) { }
+ constexpr entry_t() : m_exec_time(), m_object(nullptr) { }
+ constexpr entry_t(const Time &t, const Element &o) : m_exec_time(t), m_object(o) { }
+ constexpr entry_t(const entry_t &e) : m_exec_time(e.m_exec_time), m_object(e.m_object) { }
+ constexpr entry_t(entry_t &&e) : m_exec_time(e.m_exec_time), m_object(e.m_object) { }
+ ~entry_t() = default;
entry_t& operator=(entry_t && other)
{
@@ -76,8 +77,8 @@ namespace netlist
clear();
}
- std::size_t capacity() const { return m_list.size(); }
- bool empty() const { return (m_end == &m_list[1]); }
+ constexpr std::size_t capacity() const { return m_list.size(); }
+ constexpr bool empty() const { return (m_end == &m_list[1]); }
void push(entry_t &&e) noexcept
{
@@ -95,9 +96,13 @@ namespace netlist
m_prof_call.inc();
}
+#if 0
entry_t pop() noexcept { return std::move(*(--m_end)); }
const entry_t &top() const noexcept { return std::move(*(m_end-1)); }
-
+#else
+ entry_t pop() noexcept { return *(--m_end); }
+ const entry_t &top() const noexcept { return *(m_end-1); }
+#endif
void remove(const Element &elem) noexcept
{
/* Lock */
@@ -137,9 +142,9 @@ namespace netlist
// save state support & mame disasm
- const entry_t *listptr() const { return &m_list[1]; }
- std::size_t size() const noexcept { return static_cast<std::size_t>(m_end - &m_list[1]); }
- const entry_t & operator[](const std::size_t index) const { return m_list[ 1 + index]; }
+ constexpr const entry_t *listptr() const { return &m_list[1]; }
+ constexpr std::size_t size() const noexcept { return static_cast<std::size_t>(m_end - &m_list[1]); }
+ constexpr const entry_t & operator[](const std::size_t index) const { return m_list[ 1 + index]; }
private:
#if HAS_OPENMP && USE_OPENMP
diff --git a/src/lib/netlist/nl_setup.h b/src/lib/netlist/nl_setup.h
index 4ee449a06a8..e9fc0861328 100644
--- a/src/lib/netlist/nl_setup.h
+++ b/src/lib/netlist/nl_setup.h
@@ -15,7 +15,7 @@
#include "nl_factory.h"
#include "nl_config.h"
-#include "nl_types.h"
+#include "netlist_types.h"
#include <stack>
#include <vector>
diff --git a/src/lib/netlist/plib/palloc.cpp b/src/lib/netlist/plib/palloc.cpp
index ceee5a75904..1377edabde5 100644..100755
--- a/src/lib/netlist/plib/palloc.cpp
+++ b/src/lib/netlist/plib/palloc.cpp
@@ -5,6 +5,8 @@
*
*/
+#include <algorithm>
+
#include "pconfig.h"
#include "palloc.h"
#include "pfmtlog.h"
@@ -27,7 +29,7 @@ mempool::~mempool()
{
fprintf(stderr, "Found block with %d dangling allocations\n", static_cast<int>(b.m_num_alloc));
}
- delete b.data;
+ ::operator delete(b.data);
}
m_blocks.clear();
}
@@ -35,7 +37,7 @@ mempool::~mempool()
size_t mempool::new_block()
{
block b;
- b.data = new char[m_min_alloc];
+ b.data = static_cast<char *>(::operator new(m_min_alloc));
b.cur_ptr = b.data;
b.m_free = m_min_alloc;
b.m_num_alloc = 0;
@@ -43,10 +45,19 @@ size_t mempool::new_block()
return m_blocks.size() - 1;
}
+size_t mempool::mininfosize()
+{
+ size_t sinfo = sizeof(mempool::info);
+ size_t ma = 8;
+#ifdef __APPLE__
+ ma = 16;
+#endif
+ return ((std::max(m_min_align, sinfo) + ma - 1) / ma) * ma;
+}
void *mempool::alloc(size_t size)
{
- size_t rs = (size + sizeof(info) + m_min_align - 1) & ~(m_min_align - 1);
+ size_t rs = (size + mininfosize() + m_min_align - 1) & ~(m_min_align - 1);
for (size_t bn=0; bn < m_blocks.size(); bn++)
{
auto &b = m_blocks[bn];
@@ -56,7 +67,7 @@ void *mempool::alloc(size_t size)
b.m_num_alloc++;
auto i = reinterpret_cast<info *>(b.cur_ptr);
i->m_block = bn;
- auto ret = reinterpret_cast<void *>(b.cur_ptr + sizeof(info));
+ auto ret = reinterpret_cast<void *>(b.cur_ptr + mininfosize());
b.cur_ptr += rs;
return ret;
}
@@ -68,7 +79,7 @@ void *mempool::alloc(size_t size)
b.m_free = m_min_alloc - rs;
auto i = reinterpret_cast<info *>(b.cur_ptr);
i->m_block = bn;
- auto ret = reinterpret_cast<void *>(b.cur_ptr + sizeof(info));
+ auto ret = reinterpret_cast<void *>(b.cur_ptr + mininfosize());
b.cur_ptr += rs;
return ret;
}
@@ -78,7 +89,7 @@ void mempool::free(void *ptr)
{
auto p = reinterpret_cast<char *>(ptr);
- auto i = reinterpret_cast<info *>(p - sizeof(info));
+ auto i = reinterpret_cast<info *>(p - mininfosize());
block *b = &m_blocks[i->m_block];
if (b->m_num_alloc == 0)
fprintf(stderr, "Argh .. double free\n");
diff --git a/src/lib/netlist/plib/palloc.h b/src/lib/netlist/plib/palloc.h
index 2e4c2809048..02249f09168 100644
--- a/src/lib/netlist/plib/palloc.h
+++ b/src/lib/netlist/plib/palloc.h
@@ -144,6 +144,7 @@ private:
};
size_t new_block();
+ size_t mininfosize();
struct info
{
@@ -151,6 +152,11 @@ private:
size_t m_block;
};
+ size_t m_min_alloc;
+ size_t m_min_align;
+
+ std::vector<block> m_blocks;
+
public:
mempool(size_t min_alloc, size_t min_align);
~mempool();
@@ -158,10 +164,6 @@ public:
void *alloc(size_t size);
void free(void *ptr);
- size_t m_min_alloc;
- size_t m_min_align;
-
- std::vector<block> m_blocks;
};
}
diff --git a/src/lib/netlist/plib/pconfig.h b/src/lib/netlist/plib/pconfig.h
index e3870206cbd..e5a98fb5be8 100644..100755
--- a/src/lib/netlist/plib/pconfig.h
+++ b/src/lib/netlist/plib/pconfig.h
@@ -71,13 +71,13 @@ typedef __int128_t INT128;
#define MEMBER_ABI _thiscall
#elif defined(__clang__) && defined(__i386__) && defined(_WIN32)
#define PHAS_PMF_INTERNAL 0
- #elif defined(EMSCRIPTEN)
- #define PHAS_PMF_INTERNAL 0
- #elif defined(__arm__) || defined(__ARMEL__)
- #define PHAS_PMF_INTERNAL 0
+ #elif defined(__arm__) || defined(__ARMEL__) || defined(__aarch64__) || defined(__MIPSEL__) || defined(__mips_isa_rev) || defined(__mips64) || defined(EMSCRIPTEN)
+ #define PHAS_PMF_INTERNAL 2
#else
#define PHAS_PMF_INTERNAL 1
#endif
+#elif defined(_MSC_VER) && defined (_M_X64)
+ #define PHAS_PMF_INTERNAL 3
#else
#define PHAS_PMF_INTERNAL 0
#endif
@@ -87,7 +87,7 @@ typedef __int128_t INT128;
#endif
#ifndef PPMF_TYPE
- #if PHAS_PMF_INTERNAL
+ #if (PHAS_PMF_INTERNAL > 0)
#define PPMF_TYPE PPMF_TYPE_INTERNAL
#else
#define PPMF_TYPE PPMF_TYPE_PMF
diff --git a/src/lib/netlist/plib/plists.h b/src/lib/netlist/plib/plists.h
index c6ba2821790..e792ae06ca9 100644
--- a/src/lib/netlist/plib/plists.h
+++ b/src/lib/netlist/plib/plists.h
@@ -81,32 +81,40 @@ public:
friend class linkedlist_t<LC>;
- element_t() : m_next(nullptr) {}
- virtual ~element_t() = default;
+ constexpr element_t() : m_next(nullptr) {}
+ constexpr element_t(const element_t &rhs) = delete;
+ constexpr element_t(element_t &&rhs) = delete;
- LC *next() const noexcept { return m_next; }
+ constexpr LC *next() const noexcept { return m_next; }
+
+ protected:
+ ~element_t() = default;
private:
LC * m_next;
};
struct iter_t final : public std::iterator<std::forward_iterator_tag, LC>
{
+ private:
LC* p;
public:
explicit constexpr iter_t(LC* x) noexcept : p(x) {}
- explicit iter_t(const iter_t &rhs) noexcept = default;
- iter_t(iter_t &&rhs) noexcept = default;
+ explicit constexpr iter_t(const iter_t &rhs) noexcept = default;
+ constexpr iter_t(iter_t &&rhs) noexcept = default;
iter_t& operator++() noexcept {p = p->next();return *this;}
iter_t operator++(int) noexcept {iter_t tmp(*this); operator++(); return tmp;}
- bool operator==(const iter_t& rhs) noexcept {return p==rhs.p;}
- bool operator!=(const iter_t& rhs) noexcept {return p!=rhs.p;}
- LC& operator*() noexcept {return *p;}
- LC* operator->() noexcept {return p;}
+ constexpr bool operator==(const iter_t& rhs) const noexcept {return p == rhs.p;}
+ constexpr bool operator!=(const iter_t& rhs) const noexcept {return p != rhs.p;}
+ /* constexpr */ LC& operator*() noexcept {return *p;}
+ /* constexpr */ LC* operator->() noexcept {return p;}
+
+ constexpr LC& operator*() const noexcept {return *p;}
+ constexpr LC* operator->() const noexcept {return p;}
};
- linkedlist_t() : m_head(nullptr) {}
+ constexpr linkedlist_t() : m_head(nullptr) {}
- iter_t begin() const noexcept { return iter_t(m_head); }
+ constexpr iter_t begin() const noexcept { return iter_t(m_head); }
constexpr iter_t end() const noexcept { return iter_t(nullptr); }
void push_front(LC *elem)
@@ -138,7 +146,7 @@ public:
LC *front() const { return m_head; }
void clear() { m_head = nullptr; }
- bool empty() const { return (m_head == nullptr); }
+ constexpr bool empty() const { return (m_head == nullptr); }
private:
LC *m_head;
diff --git a/src/lib/netlist/plib/ppmf.h b/src/lib/netlist/plib/ppmf.h
index 03a2a65baa4..a80fbf2ec86 100644..100755
--- a/src/lib/netlist/plib/ppmf.h
+++ b/src/lib/netlist/plib/ppmf.h
@@ -51,44 +51,82 @@ namespace plib {
* It derives a pointer to a member function.
*/
-#if (PHAS_PMF_INTERNAL)
+#if (PHAS_PMF_INTERNAL > 0)
class mfp
{
public:
// construct from any member function pointer
+#ifdef _MSC_VER
+ class __single_inheritance si_generic_class;
+ class generic_class { };
+#else
class generic_class;
+#endif
using generic_function = void (*)();
template<typename MemberFunctionType>
mfp(MemberFunctionType mftp)
- : m_function(0), m_this_delta(0)
+ : m_function(0), m_this_delta(0), m_size(sizeof(mfp))
{
*reinterpret_cast<MemberFunctionType *>(this) = mftp;
}
- template<typename FunctionType, typename MemberFunctionType, typename ObjectType>
- static FunctionType get_mfp(MemberFunctionType mftp, ObjectType *object)
+ template<typename MemberFunctionType, typename FunctionType, typename ObjectType>
+ static void get_mfp(MemberFunctionType mftp, FunctionType &func, ObjectType *&object)
{
mfp mfpo(mftp);
//return mfpo.update_after_bind<FunctionType>(object);
- return reinterpret_cast<FunctionType>(
- mfpo.convert_to_generic(reinterpret_cast<generic_class *>(object)));
+ generic_function rfunc(nullptr);
+ generic_class *robject = reinterpret_cast<generic_class *>(object);
+ mfpo.convert_to_generic(rfunc, robject);
+ func = reinterpret_cast<FunctionType>(rfunc);
+ object = reinterpret_cast<ObjectType *>(robject);
}
private:
// extract the generic function and adjust the object pointer
- generic_function convert_to_generic(generic_class * object) const
+ void convert_to_generic(generic_function &func, generic_class *&object) const
{
- // apply the "this" delta to the object first
- generic_class * o_p_delta = reinterpret_cast<generic_class *>(reinterpret_cast<std::uint8_t *>(object) + m_this_delta);
+ if (PHAS_PMF_INTERNAL == 1)
+ {
+ // apply the "this" delta to the object first
+ generic_class * o_p_delta = reinterpret_cast<generic_class *>(reinterpret_cast<std::uint8_t *>(object) + m_this_delta);
+
+ // if the low bit of the vtable index is clear, then it is just a raw function pointer
+ if (!(m_function & 1))
+ func = reinterpret_cast<generic_function>(m_function);
+ else
+ {
+ // otherwise, it is the byte index into the vtable where the actual function lives
+ std::uint8_t *vtable_base = *reinterpret_cast<std::uint8_t **>(o_p_delta);
+ func = *reinterpret_cast<generic_function *>(vtable_base + m_function - 1);
+ }
+ object = o_p_delta;
+ }
+ else if (PHAS_PMF_INTERNAL == 2)
+ {
+ if ((m_this_delta & 1) == 0) {
+ object = reinterpret_cast<generic_class *>(reinterpret_cast<std::uint8_t *>(object) + m_this_delta);
+ func = reinterpret_cast<generic_function>(m_function);
+ }
+ else
+ {
+ object = reinterpret_cast<generic_class *>(reinterpret_cast<std::uint8_t *>(object));
+
+ // otherwise, it is the byte index into the vtable where the actual function lives
+ std::uint8_t *vtable_base = *reinterpret_cast<std::uint8_t **>(object);
+ func = *reinterpret_cast<generic_function *>(vtable_base + m_function + m_this_delta - 1);
+ }
+ }
+ else if (PHAS_PMF_INTERNAL == 3)
+ {
+ const int SINGLE_MEMFUNCPTR_SIZE = sizeof(void (generic_class::*)());
+
+ func = reinterpret_cast<generic_function>(m_function);
+ if (m_size == SINGLE_MEMFUNCPTR_SIZE + sizeof(int))
+ object = reinterpret_cast<generic_class *>(reinterpret_cast<std::uint8_t *>(object) + m_this_delta);
+ }
- // if the low bit of the vtable index is clear, then it is just a raw function pointer
- if (!(m_function & 1))
- return reinterpret_cast<generic_function>(m_function);
-
- // otherwise, it is the byte index into the vtable where the actual function lives
- std::uint8_t *vtable_base = *reinterpret_cast<std::uint8_t **>(o_p_delta);
- return *reinterpret_cast<generic_function *>(vtable_base + m_function - 1);
}
// actual state
@@ -96,6 +134,10 @@ namespace plib {
// if even, it's a pointer to the function
// if odd, it's the byte offset into the vtable
int m_this_delta; // delta to apply to the 'this' pointer
+
+ int m_dummy1; // only used for visual studio x64
+ int m_dummy2;
+ int m_size;
};
#endif
@@ -107,12 +149,18 @@ namespace plib {
class generic_class;
#if defined (__INTEL_COMPILER) && defined (_M_X64) // needed for "Intel(R) C++ Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 14.0.2.176 Build 20140130" at least
using generic_function = int [((sizeof(void *) + 4 * sizeof(int)) + (sizeof(int) - 1)) / sizeof(int)];
-#elif defined(_MSC_VER)// all other cases - for MSVC maximum size is one pointer, plus 3 ints; all other implementations seem to be smaller
- using generic_function = int [((sizeof(void *) + 3 * sizeof(int)) + (sizeof(int) - 1)) / sizeof(int)];
+#elif defined(_MSC_VER) // all other cases - for MSVC maximum size is one pointer, plus 3 ints; all other implementations seem to be smaller
+ using generic_function = int[((sizeof(void *) + 3 * sizeof(int)) + (sizeof(int) - 1)) / sizeof(int)];
#else
using generic_function = R (generic_class::*)(Targs...);
#endif
- pmfp_base() {}
+ pmfp_base()
+ {
+ int *p = reinterpret_cast<int *>(&m_func);
+ int *e = p + sizeof(generic_function) / sizeof(int);
+ for (; p < e; p++)
+ *p = 0;
+ }
template<typename MemberFunctionType, typename O>
void set_base(MemberFunctionType mftp, O *object)
@@ -130,6 +178,9 @@ namespace plib {
}
private:
generic_function m_func;
+#if 0 && defined(_MSC_VER)
+ int dummy[4];
+#endif
};
#elif ((PPMF_TYPE == PPMF_TYPE_GNUC_PMF_CONV) || (PPMF_TYPE == PPMF_TYPE_INTERNAL))
@@ -146,7 +197,9 @@ namespace plib {
{
#if (PPMF_TYPE == PPMF_TYPE_INTERNAL)
using function_ptr = MEMBER_ABI R (*)(O *obj, Targs... args);
- m_func = reinterpret_cast<generic_function>(plib::mfp::get_mfp<function_ptr>(mftp, object));
+ function_ptr func(nullptr);
+ plib::mfp::get_mfp(mftp, func, object);
+ m_func = reinterpret_cast<generic_function>(func);
#elif (PPMF_TYPE == PPMF_TYPE_GNUC_PMF_CONV)
R (O::* pFunc)(Targs...) = mftp;
m_func = reinterpret_cast<generic_function>((object->*pFunc));
@@ -159,6 +212,7 @@ namespace plib {
return (reinterpret_cast<function_ptr>(m_func))(obj, std::forward<Targs>(args)...);
}
bool is_set() { return m_func != nullptr; }
+ generic_function get_function() const { return m_func; }
private:
generic_function m_func;
};
@@ -188,6 +242,9 @@ namespace plib {
{
return this->call(m_obj, std::forward<Targs>(args)...);
}
+
+ generic_class *object() const { return m_obj; }
+ bool has_object() const { return m_obj != nullptr; }
private:
generic_class *m_obj;
};
diff --git a/src/lib/netlist/plib/pstring.cpp b/src/lib/netlist/plib/pstring.cpp
index baeace1edb9..3369f23b6e2 100644
--- a/src/lib/netlist/plib/pstring.cpp
+++ b/src/lib/netlist/plib/pstring.cpp
@@ -415,16 +415,19 @@ static inline std::size_t countleadbits(std::size_t x)
template<typename F>
void pstring_t<F>::sfree(pstr_t *s)
{
- bool b = s->dec_and_check();
- if ( b && s != &m_zero)
+ if (s != nullptr)
{
- if (stk != nullptr)
+ bool b = s->dec_and_check();
+ if ( b && s != &m_zero)
{
- size_type sn= ((32 - countleadbits(s->len())) + 1) / 2;
- stk[sn].push(s);
+ if (stk != nullptr)
+ {
+ size_type sn= ((32 - countleadbits(s->len())) + 1) / 2;
+ stk[sn].push(s);
+ }
+ else
+ plib::pfree_array(reinterpret_cast<char *>(s));
}
- else
- plib::pfree_array(reinterpret_cast<char *>(s));
}
}
diff --git a/src/lib/netlist/prg/nltool.cpp b/src/lib/netlist/prg/nltool.cpp
index 6eec3d0e6dc..353afa8556c 100644
--- a/src/lib/netlist/prg/nltool.cpp
+++ b/src/lib/netlist/prg/nltool.cpp
@@ -21,7 +21,7 @@ public:
tool_options_t() :
plib::options(),
opt_grp1(*this, "General options", "The following options apply to all commands."),
- opt_cmd (*this, "c", "cmd", "run", "run:convert:listdevices:static:header", "run|convert|listdevices|static|header"),
+ opt_cmd (*this, "c", "cmd", "run", "run:convert:listdevices:static:header:docheader", "run|convert|listdevices|static|header"),
opt_file(*this, "f", "file", "-", "file to process (default is stdin)"),
opt_defines(*this, "D", "define", "predefine value as macro, e.g. -Dname=value. If '=value' is omitted predefine it as 1. This option may be specified repeatedly."),
opt_rfolders(*this, "r", "rom", "where to look for files"),
@@ -339,6 +339,50 @@ static void mac_out(const pstring s, const bool cont = true)
pout("{1}\n", s);
}
+static void cmac(const netlist::factory::element_t *e)
+{
+ auto v = plib::psplit(e->param_desc(), ",");
+ pstring vs;
+ for (auto s : v)
+ vs += ", p" + s.replace("+","").replace(".","_");
+ mac_out("#define " + e->name() + "(name" + vs + ")");
+ mac_out("\tNET_REGISTER_DEV(" + e->name() +", name)");
+
+ for (auto s : v)
+ {
+ pstring r(s.replace("+","").replace(".","_"));
+ if (s.startsWith("+"))
+ mac_out("\tNET_CONNECT(name, " + r + ", p" + r + ")");
+ else
+ mac_out("\tNETDEV_PARAMI(name, " + r + ", p" + r + ")");
+ }
+ mac_out("", false);
+}
+
+static void mac(const netlist::factory::element_t *e)
+{
+ auto v = plib::psplit(e->param_desc(), ",");
+ pstring vs;
+ for (auto s : v)
+ {
+ vs += ", " + s.replace("+","").replace(".","_");
+ }
+ pout("{1}(name{2})\n", e->name(), vs);
+ if (v.size() > 0)
+ {
+ pout("/*\n");
+ for (auto s : v)
+ {
+ pstring r(s.replace("+","").replace(".","_"));
+ if (s.startsWith("+"))
+ pout("{1:10}: Terminal\n",r);
+ else
+ pout("{1:10}: Parameter\n", r);
+ }
+ pout("*/\n");
+ }
+}
+
static void create_header(tool_options_t &opts)
{
netlist_tool_t nt("netlist");
@@ -376,22 +420,7 @@ static void create_header(tool_options_t &opts)
pout("{1}\n", pstring("// Source: ").cat(e->sourcefile().replace("../","")));
pout("{1}\n", pstring("// ").rpad("-", 72));
}
- auto v = plib::psplit(e->param_desc(), ",");
- pstring vs;
- for (auto s : v)
- vs += ", p" + s.replace("+","").replace(".","_");
- mac_out("#define " + e->name() + "(name" + vs + ")");
- mac_out("\tNET_REGISTER_DEV(" + e->name() +", name)"); \
-
- for (auto s : v)
- {
- pstring r(s.replace("+","").replace(".","_"));
- if (s.startsWith("+"))
- mac_out("\tNET_CONNECT(name, " + r + ", p" + r + ")");
- else
- mac_out("\tNETDEV_PARAMI(name, " + r + ", p" + r + ")");
- }
- mac_out("", false);
+ cmac(e.get());
}
pout("#endif // __PLIB_PREPROCESSOR__\n");
pout("#endif\n");
@@ -399,6 +428,52 @@ static void create_header(tool_options_t &opts)
}
+static void create_docheader(tool_options_t &opts)
+{
+ netlist_tool_t nt("netlist");
+
+ nt.init();
+
+ nt.log().verbose.set_enabled(false);
+ nt.log().warning.set_enabled(false);
+
+ nt.setup().register_source(plib::make_unique_base<netlist::source_t,
+ netlist::source_proc_t>(nt.setup(), "dummy", &netlist_dummy));
+ nt.setup().include("dummy");
+
+ std::vector<pstring> devs;
+ for (auto &e : nt.setup().factory())
+ devs.push_back(e->name());
+ std::sort(devs.begin(), devs.end(), [&](pstring &a, pstring &b) { return a < b; });
+
+ pout("// license:GPL-2.0+\n");
+ pout("// copyright-holders:Couriersud\n");
+ pout("/* ----------------------------------------------------------------------------\n");
+ pout(" * Automatically created file. DO NOT MODIFY.\n");
+ pout(" * ---------------------------------------------------------------------------*/\n");
+ pout("/*!\n");
+ pout(" * \\page devices Devices\n");
+ pout(" *\n");
+ pout(" * Below is a list of all the devices currently known to the system ...\n");
+ pout(" *\n");
+
+ for (auto &s : devs)
+ pout(" * - \\subpage {1}\n", s);
+
+ pout(" *\n");
+
+ for (auto &e : nt.setup().factory())
+ {
+ pout("//! [{1} csynopsis]\n", e->name());
+ cmac(e.get());
+ pout("//! [{1} csynopsis]\n", e->name());
+ pout("//! [{1} synopsis]\n", e->name());
+ mac(e.get());
+ pout("//! [{1} synopsis]\n", e->name());
+ }
+ nt.stop();
+}
+
/*-------------------------------------------------
listdevices - list all known devices
@@ -549,6 +624,8 @@ int main(int argc, char *argv[])
static_compile(opts);
else if (cmd == "header")
create_header(opts);
+ else if (cmd == "docheader")
+ create_docheader(opts);
else if (cmd == "convert")
{
pstring contents;
diff --git a/src/lib/netlist/solver/nld_solver.cpp b/src/lib/netlist/solver/nld_solver.cpp
index d2ecf3c5bd2..e769797c42e 100644
--- a/src/lib/netlist/solver/nld_solver.cpp
+++ b/src/lib/netlist/solver/nld_solver.cpp
@@ -404,7 +404,6 @@ void NETLIB_NAME(solver)::post_start()
}
// FIXME ...
- ms->set_delegate_pointer();
ms->setup(grp);
log().verbose("Solver {1}", ms->name());
diff --git a/src/lib/util/chd.cpp b/src/lib/util/chd.cpp
index 0db64344861..dc7c334b1bf 100644
--- a/src/lib/util/chd.cpp
+++ b/src/lib/util/chd.cpp
@@ -885,7 +885,7 @@ chd_error chd_file::read_hunk(uint32_t hunknum, void *buffer)
// get a pointer to the map entry
uint64_t blockoffs;
uint32_t blocklen;
- uint32_t blockcrc;
+ util::crc32_t blockcrc;
uint8_t *rawmap;
uint8_t *dest = reinterpret_cast<uint8_t *>(buffer);
switch (m_version)
@@ -2147,12 +2147,12 @@ void chd_file::decompress_v5_map()
// read the reader
uint8_t rawbuf[16];
file_read(m_mapoffset, rawbuf, sizeof(rawbuf));
- uint32_t mapbytes = be_read(&rawbuf[0], 4);
- uint64_t firstoffs = be_read(&rawbuf[4], 6);
- uint16_t mapcrc = be_read(&rawbuf[10], 2);
- uint8_t lengthbits = rawbuf[12];
- uint8_t selfbits = rawbuf[13];
- uint8_t parentbits = rawbuf[14];
+ uint32_t const mapbytes = be_read(&rawbuf[0], 4);
+ uint64_t const firstoffs = be_read(&rawbuf[4], 6);
+ util::crc16_t const mapcrc = be_read(&rawbuf[10], 2);
+ uint8_t const lengthbits = rawbuf[12];
+ uint8_t const selfbits = rawbuf[13];
+ uint8_t const parentbits = rawbuf[14];
// now read the map
std::vector<uint8_t> compressed(mapbytes);
diff --git a/src/lib/util/client_http.hpp b/src/lib/util/client_http.hpp
index df188090f87..63bd60c1f32 100644
--- a/src/lib/util/client_http.hpp
+++ b/src/lib/util/client_http.hpp
@@ -70,6 +70,8 @@ namespace webpp {
public:
/// Set timeout on requests in seconds. Default value: 0 (no timeout).
size_t timeout = 0;
+ /// Set connect timeout in seconds. Default value: 0 (Config::timeout is then used instead).
+ size_t timeout_connect=0;
/// Set proxy server (server:port)
std::string proxy_server;
};
@@ -213,12 +215,14 @@ namespace webpp {
virtual void connect()=0;
- std::shared_ptr<asio::system_timer> get_timeout_timer() {
- if (config.timeout == 0)
+ std::shared_ptr<asio::system_timer> get_timeout_timer(size_t timeout=0) {
+ if(timeout==0)
+ timeout=config.timeout;
+ if (timeout == 0)
return nullptr;
auto timer = std::make_shared<asio::system_timer>(io_context);
- timer->expires_from_now(std::chrono::seconds(config.timeout));
+ timer->expires_from_now(std::chrono::seconds(timeout));
timer->async_wait([this](const std::error_code& ec) {
if (!ec) {
close();
@@ -401,7 +405,7 @@ namespace webpp {
socket = std::make_unique<HTTP>(io_context);
}
- auto timer = get_timeout_timer();
+ auto timer = get_timeout_timer(config.timeout_connect);
asio::async_connect(*socket, it, [this,timer]
(const std::error_code &ec, asio::ip::tcp::resolver::iterator /*it*/){
if (timer)
diff --git a/src/lib/util/client_https.hpp b/src/lib/util/client_https.hpp
index fc1f12bb075..3300ea6865f 100644
--- a/src/lib/util/client_https.hpp
+++ b/src/lib/util/client_https.hpp
@@ -56,7 +56,7 @@ namespace webpp {
socket = std::make_unique<HTTPS>(io_context, m_context);
}
- auto timer = get_timeout_timer();
+ auto timer = get_timeout_timer(config.timeout_connect);
asio::async_connect(socket->lowest_layer(), it, [this, timer]
(const std::error_code &ec, asio::ip::tcp::resolver::iterator /*it*/) {
if (timer)
diff --git a/src/lib/util/hashing.h b/src/lib/util/hashing.h
index 906bad047b4..5e9c9134c97 100644
--- a/src/lib/util/hashing.h
+++ b/src/lib/util/hashing.h
@@ -15,10 +15,12 @@
#include "osdcore.h"
#include "corestr.h"
-#include <string>
#include "md5.h"
#include "sha1.h"
+#include <functional>
+#include <string>
+
namespace util {
//**************************************************************************
@@ -132,13 +134,23 @@ protected:
// final digest
struct crc32_t
{
- bool operator==(const crc32_t &rhs) const { return m_raw == rhs.m_raw; }
- bool operator!=(const crc32_t &rhs) const { return m_raw != rhs.m_raw; }
+ crc32_t() { }
+ constexpr crc32_t(const crc32_t &rhs) = default;
+ constexpr crc32_t(const uint32_t crc) : m_raw(crc) { }
+
+ constexpr bool operator==(const crc32_t &rhs) const { return m_raw == rhs.m_raw; }
+ constexpr bool operator!=(const crc32_t &rhs) const { return m_raw != rhs.m_raw; }
+
+ crc32_t &operator=(const crc32_t &rhs) = default;
crc32_t &operator=(const uint32_t crc) { m_raw = crc; return *this; }
- operator uint32_t() const { return m_raw; }
+
+ constexpr operator uint32_t() const { return m_raw; }
+
bool from_string(const char *string, int length = -1);
std::string as_string() const;
+
uint32_t m_raw;
+
static const crc32_t null;
};
@@ -178,13 +190,23 @@ protected:
// final digest
struct crc16_t
{
- bool operator==(const crc16_t &rhs) const { return m_raw == rhs.m_raw; }
- bool operator!=(const crc16_t &rhs) const { return m_raw != rhs.m_raw; }
+ crc16_t() { }
+ constexpr crc16_t(const crc16_t &rhs) = default;
+ constexpr crc16_t(const uint16_t crc) : m_raw(crc) { }
+
+ constexpr bool operator==(const crc16_t &rhs) const { return m_raw == rhs.m_raw; }
+ constexpr bool operator!=(const crc16_t &rhs) const { return m_raw != rhs.m_raw; }
+
+ crc16_t &operator=(const crc16_t &rhs) = default;
crc16_t &operator=(const uint16_t crc) { m_raw = crc; return *this; }
- operator uint16_t() const { return m_raw; }
+
+ constexpr operator uint16_t() const { return m_raw; }
+
bool from_string(const char *string, int length = -1);
std::string as_string() const;
+
uint16_t m_raw;
+
static const crc16_t null;
};
@@ -220,4 +242,22 @@ protected:
} // namespace util
+namespace std {
+
+template <> struct hash<::util::crc32_t>
+{
+ typedef ::util::crc32_t argument_type;
+ typedef std::size_t result_type;
+ result_type operator()(argument_type const & s) const { return std::hash<std::uint32_t>()(s); }
+};
+
+template <> struct hash<::util::crc16_t>
+{
+ typedef ::util::crc16_t argument_type;
+ typedef std::size_t result_type;
+ result_type operator()(argument_type const & s) const { return std::hash<std::uint16_t>()(s); }
+};
+
+} // namespace std
+
#endif // __HASHING_H__
diff --git a/src/lib/util/server_http.hpp b/src/lib/util/server_http.hpp
index 57fd57e6993..978e9e3ce40 100644
--- a/src/lib/util/server_http.hpp
+++ b/src/lib/util/server_http.hpp
@@ -89,6 +89,12 @@ namespace webpp {
void send(std::string str) { m_ostream << m_header.str() << "Content-Length: " << str.length() << "\r\n\r\n" << str; }
size_t size() const { return m_streambuf.size(); }
std::shared_ptr<socket_type> socket() { return m_socket; }
+
+ /// If true, force server to close the connection after the response have been sent.
+ ///
+ /// This is useful when implementing a HTTP/1.0-server sending content
+ /// without specifying the content length.
+ bool close_connection_after_response = false;
};
class Content : public std::istream {
@@ -182,7 +188,7 @@ namespace webpp {
void remove_handler(std::string regex)
{
std::lock_guard<std::mutex> lock(m_resource_mutex);
- for (auto &it = m_resource.begin(); it != m_resource.end(); ++it)
+ for (auto it = m_resource.begin(); it != m_resource.end(); ++it)
{
if (it->first.getstr() == regex)
{
@@ -428,6 +434,9 @@ namespace webpp {
return;
}
+ if (response->close_connection_after_response)
+ return;
+
auto range = request->header.equal_range("Connection");
case_insensitive_equals check;
for (auto it = range.first; it != range.second; ++it) {
diff --git a/src/mame/arcade.flt b/src/mame/arcade.flt
index d1a207b97e0..74b9df3d635 100644
--- a/src/mame/arcade.flt
+++ b/src/mame/arcade.flt
@@ -413,6 +413,7 @@ galaxia.cpp
galaxian.cpp
galaxold.cpp
galgame.cpp
+galgames.cpp
galivan.cpp
galpani2.cpp
galpani3.cpp
diff --git a/src/mame/drivers/5clown.cpp b/src/mame/drivers/5clown.cpp
index c4440d0e9f1..56cdac32fe2 100644
--- a/src/mame/drivers/5clown.cpp
+++ b/src/mame/drivers/5clown.cpp
@@ -874,7 +874,7 @@ static INPUT_PORTS_START( fclown )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("IN0-3")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Setting") PORT_CODE(KEYCODE_9)
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Setting")
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(3) PORT_NAME("Coin In")
diff --git a/src/mame/drivers/aerofgt.cpp b/src/mame/drivers/aerofgt.cpp
index 3fd5d2b8953..2fb4748ccdd 100644
--- a/src/mame/drivers/aerofgt.cpp
+++ b/src/mame/drivers/aerofgt.cpp
@@ -93,7 +93,7 @@ WRITE8_MEMBER(aerofgt_state::pending_command_clear_w)
WRITE8_MEMBER(aerofgt_state::aerofgt_sh_bankswitch_w)
{
- membank("bank1")->set_entry(data & 0x03);
+ m_soundbank->set_entry(data & 0x03);
}
WRITE16_MEMBER(aerofgt_state::pspikesb_oki_banking_w)
@@ -112,9 +112,9 @@ WRITE16_MEMBER(aerofgt_state::aerfboo2_okim6295_banking_w)
WRITE8_MEMBER(aerofgt_state::aerfboot_okim6295_banking_w)
{
- /*bit 2 (0x4) setted too?*/
+ /*bit 2 (0x4) set too?*/
if (data & 0x4)
- membank("okibank")->set_entry(data & 0x3);
+ m_okibank->set_entry(data & 0x3);
}
WRITE8_MEMBER(aerofgt_state::karatblzbl_d7759_write_port_0_w)
@@ -374,7 +374,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, aerofgt_state )
AM_RANGE(0x0000, 0x77ff) AM_ROM
AM_RANGE(0x7800, 0x7fff) AM_RAM
- AM_RANGE(0x8000, 0xffff) AM_ROMBANK("bank1")
+ AM_RANGE(0x8000, 0xffff) AM_ROMBANK("soundbank")
ADDRESS_MAP_END
static ADDRESS_MAP_START( turbofrc_sound_portmap, AS_IO, 8, aerofgt_state )
@@ -1304,9 +1304,7 @@ MACHINE_START_MEMBER(aerofgt_state,common)
MACHINE_START_MEMBER(aerofgt_state,aerofgt)
{
- uint8_t *rom = memregion("audiocpu")->base();
-
- membank("bank1")->configure_entries(0, 4, &rom[0x10000], 0x8000);
+ m_soundbank->configure_entries(0, 4, memregion("audiocpu")->base(), 0x8000);
MACHINE_START_CALL_MEMBER(common);
}
@@ -1320,7 +1318,7 @@ MACHINE_RESET_MEMBER(aerofgt_state,aerofgt)
{
MACHINE_RESET_CALL_MEMBER(common);
- membank("bank1")->set_entry(0); /* needed by spinlbrk */
+ m_soundbank->set_entry(0); /* needed by spinlbrk */
}
static MACHINE_CONFIG_START( pspikes, aerofgt_state )
@@ -1922,9 +1920,8 @@ ROM_START( pspikes )
ROM_REGION( 0x40000, "maincpu", 0 ) /* 68000 code */
ROM_LOAD16_WORD_SWAP( "pspikes2.bin", 0x00000, 0x40000, CRC(ec0c070e) SHA1(4ddcc184e835a2f9d15f01aaa03734fd75fe797e) )
- ROM_REGION( 0x30000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */
+ ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */
ROM_LOAD( "19", 0x00000, 0x20000, CRC(7e8ed6e5) SHA1(eeb1a1e1989fad8fc1e741928422efaec0598868) )
- ROM_RELOAD( 0x10000, 0x20000 )
ROM_REGION( 0x080000, "gfx1", 0 )
ROM_LOAD( "g7h", 0x000000, 0x80000, CRC(74c23c3d) SHA1(c0ac57d1f05c42556f97154ce1a08f465948546b) )
@@ -1947,9 +1944,8 @@ ROM_START( pspikesk )
ROM_REGION( 0x40000, "maincpu", 0 ) /* 68000 code */
ROM_LOAD16_WORD_SWAP( "20", 0x00000, 0x40000, CRC(75cdcee2) SHA1(272a08c46c1d0989f9fbb156e28e6a7ffa9c0a53) )
- ROM_REGION( 0x30000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */
+ ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */
ROM_LOAD( "19", 0x00000, 0x20000, CRC(7e8ed6e5) SHA1(eeb1a1e1989fad8fc1e741928422efaec0598868) )
- ROM_RELOAD( 0x10000, 0x20000 )
ROM_REGION( 0x080000, "gfx1", 0 )
ROM_LOAD( "g7h", 0x000000, 0x80000, CRC(74c23c3d) SHA1(c0ac57d1f05c42556f97154ce1a08f465948546b) )
@@ -1973,9 +1969,8 @@ ROM_START( pspikesu )
ROM_REGION( 0x40000, "maincpu", 0 ) /* 68000 code */
ROM_LOAD16_WORD_SWAP( "svolly91.73", 0x00000, 0x40000, CRC(bfbffcdb) SHA1(2bba99cb6d0cb2fbb3cd1242551dd7e2c6ebef50) )
- ROM_REGION( 0x30000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */
+ ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */
ROM_LOAD( "19", 0x00000, 0x20000, CRC(7e8ed6e5) SHA1(eeb1a1e1989fad8fc1e741928422efaec0598868) )
- ROM_RELOAD( 0x10000, 0x20000 )
ROM_REGION( 0x080000, "gfx1", 0 )
ROM_LOAD( "g7h", 0x000000, 0x80000, CRC(74c23c3d) SHA1(c0ac57d1f05c42556f97154ce1a08f465948546b) )
@@ -1995,9 +1990,8 @@ ROM_START( svolly91 )
ROM_REGION( 0x40000, "maincpu", 0 ) /* 68000 code */
ROM_LOAD16_WORD_SWAP( "u11.jpn", 0x00000, 0x40000, CRC(ea2e4c82) SHA1(f9cf9122499d9b1e54221fb8b6ef9c12004ca85e) )
- ROM_REGION( 0x30000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */
+ ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */
ROM_LOAD( "19", 0x00000, 0x20000, CRC(7e8ed6e5) SHA1(eeb1a1e1989fad8fc1e741928422efaec0598868) )
- ROM_RELOAD( 0x10000, 0x20000 )
ROM_REGION( 0x080000, "gfx1", 0 )
ROM_LOAD( "g7h", 0x000000, 0x80000, CRC(74c23c3d) SHA1(c0ac57d1f05c42556f97154ce1a08f465948546b) )
@@ -2374,9 +2368,8 @@ ROM_START( karatblz )
ROM_LOAD16_WORD_SWAP( "rom2v3", 0x00000, 0x40000, CRC(01f772e1) SHA1(f87f19a82d75839b5671f23ce14218d7b910eabc) )
ROM_LOAD16_WORD_SWAP( "1.u15", 0x40000, 0x40000, CRC(d16ee21b) SHA1(d454cdf22b72a537b9d7ae73deb8136a4f09da47) )
- ROM_REGION( 0x30000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */
+ ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */
ROM_LOAD( "5.u92", 0x00000, 0x20000, CRC(97d67510) SHA1(1ffd419e3dec7de1099cd5819b0309f7dd0df80e) )
- ROM_RELOAD( 0x10000, 0x20000 )
ROM_REGION( 0x80000, "gfx1", 0 )
ROM_LOAD( "gha.u55", 0x00000, 0x80000, CRC(3e0cea91) SHA1(bab41715f106d364013b64649441d280bc6893cf) )
@@ -2406,9 +2399,8 @@ ROM_START( karatblza )
ROM_LOAD16_WORD_SWAP( "v2.u14", 0x00000, 0x40000, CRC(7a78976e) SHA1(3b74b80765622b8488bdd0729ec98a2c7584cad5) )
ROM_LOAD16_WORD_SWAP( "v1.u15", 0x40000, 0x40000, CRC(47e410fe) SHA1(d26fc93f91ccf00856db2b7dfd0d905d87e99bd8) )
- ROM_REGION( 0x30000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */
+ ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */
ROM_LOAD( "5.u92", 0x00000, 0x20000, CRC(97d67510) SHA1(1ffd419e3dec7de1099cd5819b0309f7dd0df80e) )
- ROM_RELOAD( 0x10000, 0x20000 )
ROM_REGION( 0x80000, "gfx1", 0 )
ROM_LOAD( "gha.u55", 0x00000, 0x80000, CRC(3e0cea91) SHA1(bab41715f106d364013b64649441d280bc6893cf) )
@@ -2438,9 +2430,8 @@ ROM_START( karatblzu )
ROM_LOAD16_WORD_SWAP( "2.u14", 0x00000, 0x40000, CRC(202e6220) SHA1(2605511a0574cbc39fdf3d8ae27a0aa9b43345fb) )
ROM_LOAD16_WORD_SWAP( "1.u15", 0x40000, 0x40000, CRC(d16ee21b) SHA1(d454cdf22b72a537b9d7ae73deb8136a4f09da47) )
- ROM_REGION( 0x30000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */
+ ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */
ROM_LOAD( "5.u92", 0x00000, 0x20000, CRC(97d67510) SHA1(1ffd419e3dec7de1099cd5819b0309f7dd0df80e) )
- ROM_RELOAD( 0x10000, 0x20000 )
ROM_REGION( 0x80000, "gfx1", 0 )
ROM_LOAD( "gha.u55", 0x00000, 0x80000, CRC(3e0cea91) SHA1(bab41715f106d364013b64649441d280bc6893cf) )
@@ -2470,9 +2461,8 @@ ROM_START( karatblzj )
ROM_LOAD16_WORD_SWAP( "2tecmo.u14", 0x00000, 0x40000, CRC(57e52654) SHA1(15939d8f7c693b9248f3dd2b2ad5fbae2c19621f) )
ROM_LOAD16_WORD_SWAP( "1.u15", 0x40000, 0x40000, CRC(d16ee21b) SHA1(d454cdf22b72a537b9d7ae73deb8136a4f09da47) )
- ROM_REGION( 0x30000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */
+ ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */
ROM_LOAD( "5.u92", 0x00000, 0x20000, CRC(97d67510) SHA1(1ffd419e3dec7de1099cd5819b0309f7dd0df80e) )
- ROM_RELOAD( 0x10000, 0x20000 )
ROM_REGION( 0x80000, "gfx1", 0 )
ROM_LOAD( "gha.u55", 0x00000, 0x80000, CRC(3e0cea91) SHA1(bab41715f106d364013b64649441d280bc6893cf) )
@@ -2560,9 +2550,8 @@ ROM_START( turbofrc ) // World version with no copyright notice
ROM_LOAD16_WORD_SWAP( "4v1.subpcb.u1", 0x40000, 0x40000, CRC(6cd5312b) SHA1(57b109fe268fb963e981c91b6d288667a3c9a665) ) // 27c2048 - located on a OR-10 SUB BOARD - 4 stamped on chip with VideoSystem logo V
ROM_LOAD16_WORD_SWAP( "4v3.u14", 0x80000, 0x40000, CRC(63f50557) SHA1(f8dba8c9ba412c9a67457ec31a804c57593ab20b) ) // 27c2048 - 4 stamped on chip with VideoSystem logo V
- ROM_REGION( 0x30000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */
+ ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */
ROM_LOAD( "6.u166", 0x00000, 0x20000, CRC(2ca14a65) SHA1(95f6e7b4fa7ca26872ff472d7e6fb75fd4f281d5) ) // 27c1001
- ROM_RELOAD( 0x10000, 0x20000 )
ROM_REGION( 0x0a0000, "gfx1", 0 )
ROM_LOAD( "lh534ggs.u94", 0x000000, 0x80000, CRC(baa53978) SHA1(7f103122dd0bf675226ccf309fba73f645e0c79b) ) // mask rom
@@ -2595,9 +2584,8 @@ ROM_START( turbofrcu ) // US version: most notable thing in there is the points
ROM_LOAD16_WORD_SWAP( "8v1.subpcb.u1", 0x40000, 0x40000, CRC(cc324da6) SHA1(ed2eaff7351914e3ebaf925ddc01be9d44d89fa6) ) // 27c2048 - located on a OR-10 SUB BOARD - 8 stamped on chip with VideoSystem logo V
ROM_LOAD16_WORD_SWAP( "8v3.u14", 0x80000, 0x40000, CRC(c0a15480) SHA1(1ec99382e0a00a8167773b1d454a63cc5cd6199c) ) // 27c2048 - 8 stamped on chip with VideoSystem logo V
- ROM_REGION( 0x30000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */
+ ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */
ROM_LOAD( "6.u166", 0x00000, 0x20000, CRC(2ca14a65) SHA1(95f6e7b4fa7ca26872ff472d7e6fb75fd4f281d5) ) // 27c1001
- ROM_RELOAD( 0x10000, 0x20000 )
ROM_REGION( 0x0a0000, "gfx1", 0 )
ROM_LOAD( "lh534ggs.u94", 0x000000, 0x80000, CRC(baa53978) SHA1(7f103122dd0bf675226ccf309fba73f645e0c79b) ) // mask rom
@@ -2628,9 +2616,8 @@ ROM_START( aerofgt )
ROM_REGION( 0x80000, "maincpu", 0 ) /* 68000 code */
ROM_LOAD16_WORD_SWAP( "1.u4", 0x00000, 0x80000, CRC(6fdff0a2) SHA1(7cc9529b426091027aa3e23586cb7d162376c0ff) )
- ROM_REGION( 0x30000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */
+ ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */
ROM_LOAD( "2.153", 0x00000, 0x20000, CRC(a1ef64ec) SHA1(fa3e434738bf4e742ad68882c1e914100ce0f761) )
- ROM_RELOAD( 0x10000, 0x20000 )
ROM_REGION( 0x100000, "gfx1", 0 )
ROM_LOAD( "538a54.124", 0x000000, 0x80000, CRC(4d2c4df2) SHA1(f51c2b3135f0a921ac1a79e63d6878c03cb6254b) )
@@ -2652,9 +2639,8 @@ ROM_START( aerofgtb )
ROM_LOAD16_BYTE( "v2", 0x00000, 0x40000, CRC(5c9de9f0) SHA1(93b62c59f0bc052c6fdbd5aae292a7ab2122dfd1) )
ROM_LOAD16_BYTE( "v1", 0x00001, 0x40000, CRC(89c1dcf4) SHA1(41401d63049c140e4254dc791022d85c44271390) )
- ROM_REGION( 0x30000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */
+ ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */
ROM_LOAD( "v3", 0x00000, 0x20000, CRC(cbb18cf4) SHA1(7119a7536cf710660ff06d1e7d2879c79ef12b3d) )
- ROM_RELOAD( 0x10000, 0x20000 )
ROM_REGION( 0x080000, "gfx1", 0 )
ROM_LOAD( "it-19-03", 0x000000, 0x80000, CRC(85eba1a4) SHA1(5691a95d6359fdab29be0d615066370c2b856c0a) )
@@ -2682,9 +2668,8 @@ ROM_START( aerofgtc )
ROM_LOAD16_BYTE( "v2.149", 0x00000, 0x40000, CRC(f187aec6) SHA1(8905af34f114ae22fbfbd3ae115f19280bdd4fb3) )
ROM_LOAD16_BYTE( "v1.111", 0x00001, 0x40000, CRC(9e684b19) SHA1(b5e1e5b74ed9fd223c9315ee2d548e620224c102) )
- ROM_REGION( 0x30000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */
+ ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */
ROM_LOAD( "2.153", 0x00000, 0x20000, CRC(a1ef64ec) SHA1(fa3e434738bf4e742ad68882c1e914100ce0f761) )
- ROM_RELOAD( 0x10000, 0x20000 )
/* gfx ROMs were missing in this set, I'm using the aerofgtb ones */
ROM_REGION( 0x080000, "gfx1", 0 )
@@ -2713,9 +2698,8 @@ ROM_START( sonicwi )
ROM_LOAD16_BYTE( "2.149", 0x00000, 0x40000, CRC(3d1b96ba) SHA1(941be323c0cb15e05c92b897984617b05c5cf676) )
ROM_LOAD16_BYTE( "1.111", 0x00001, 0x40000, CRC(a3d09f94) SHA1(a1064d659488878f5303edc2b8636312ab632a83) )
- ROM_REGION( 0x30000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */
+ ROM_REGION( 0x20000, "audiocpu", 0 ) /* 64k for the audio CPU + banks */
ROM_LOAD( "2.153", 0x00000, 0x20000, CRC(a1ef64ec) SHA1(fa3e434738bf4e742ad68882c1e914100ce0f761) ) // 3.156
- ROM_RELOAD( 0x10000, 0x20000 )
/* gfx ROMs were missing in this set, I'm using the aerofgtb ones */
ROM_REGION( 0x080000, "gfx1", 0 )
@@ -2823,7 +2807,7 @@ ROM_END
DRIVER_INIT_MEMBER(aerofgt_state, banked_oki)
{
- membank("okibank")->configure_entries(0, 4, memregion("oki")->base() + 0x20000, 0x20000);
+ m_okibank->configure_entries(0, 4, memregion("oki")->base() + 0x20000, 0x20000);
}
diff --git a/src/mame/drivers/aleisttl.cpp b/src/mame/drivers/aleisttl.cpp
index df43a588445..51c2e64ff1a 100644
--- a/src/mame/drivers/aleisttl.cpp
+++ b/src/mame/drivers/aleisttl.cpp
@@ -7,7 +7,7 @@
Chase (aka Chase1) (1976)
Deluxe Soccer (1973)
Fire Power (1975) EG-1020-2
- Fütsball (1975)
+ Fötsball (1975)
Galaxy Raider (1974)
Hesitation (1974) AL-6500?
Hockey, Soccer, Tennis (1974)
diff --git a/src/mame/drivers/amiga.cpp b/src/mame/drivers/amiga.cpp
index 4c955d133e1..7cd26f8acfd 100644
--- a/src/mame/drivers/amiga.cpp
+++ b/src/mame/drivers/amiga.cpp
@@ -1319,7 +1319,7 @@ static MACHINE_CONFIG_START( amiga_base, amiga_state )
MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(amiga_state, cia_0_port_a_write))
MCFG_MOS6526_PB_OUTPUT_CALLBACK(DEVWRITE8("cent_data_out", output_latch_device, write))
MCFG_MOS6526_PC_CALLBACK(DEVWRITELINE("centronics", centronics_device, write_strobe))
- MCFG_MOS6526_SP_CALLBACK(DEVWRITELINE("kbd", amiga_keyboard_bus_device, kdat_in_w))
+ MCFG_MOS6526_SP_CALLBACK(DEVWRITELINE("kbd", amiga_keyboard_bus_device, kdat_in_w)) MCFG_DEVCB_INVERT
MCFG_DEVICE_ADD("cia_1", MOS8520, amiga_state::CLK_E_PAL)
MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(amiga_state, cia_1_irq))
diff --git a/src/mame/drivers/apple2e.cpp b/src/mame/drivers/apple2e.cpp
index 09d03c3d9ca..80d3cc41f95 100644
--- a/src/mame/drivers/apple2e.cpp
+++ b/src/mame/drivers/apple2e.cpp
@@ -116,7 +116,6 @@ Address bus A0-A11 is Y0-Y11
#include "video/apple2.h"
#include "bus/a2bus/a2bus.h"
-#include "bus/a2bus/a2lang.h"
#include "bus/a2bus/a2diskii.h"
#include "bus/a2bus/a2diskiing.h"
#include "bus/a2bus/a2mockingboard.h"
diff --git a/src/mame/drivers/apple2gs.cpp b/src/mame/drivers/apple2gs.cpp
index 6e87452f8ca..5d31f13b25e 100644
--- a/src/mame/drivers/apple2gs.cpp
+++ b/src/mame/drivers/apple2gs.cpp
@@ -60,7 +60,6 @@
#include "machine/ram.h"
#include "bus/a2bus/a2bus.h"
-#include "bus/a2bus/a2lang.h"
#include "bus/a2bus/a2diskii.h"
#include "bus/a2bus/a2mockingboard.h"
#include "bus/a2bus/a2cffa.h"
@@ -376,7 +375,6 @@ static MACHINE_CONFIG_START( apple2gs, apple2gs_state )
MCFG_A2BUS_OUT_IRQ_CB(WRITELINE(apple2gs_state, a2bus_irq_w))
MCFG_A2BUS_OUT_NMI_CB(WRITELINE(apple2gs_state, a2bus_nmi_w))
MCFG_A2BUS_OUT_INH_CB(WRITELINE(apple2gs_state, a2bus_inh_w))
- MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl0", A2BUS_LANG, NOOP)
MCFG_A2BUS_SLOT_ADD("a2bus", "sl1", apple2_cards, nullptr)
MCFG_A2BUS_SLOT_ADD("a2bus", "sl2", apple2_cards, nullptr)
MCFG_A2BUS_SLOT_ADD("a2bus", "sl3", apple2_cards, nullptr)
diff --git a/src/mame/drivers/aquarium.cpp b/src/mame/drivers/aquarium.cpp
index bcee0345930..128de28049c 100644
--- a/src/mame/drivers/aquarium.cpp
+++ b/src/mame/drivers/aquarium.cpp
@@ -7,19 +7,35 @@
AQUARIUM
EXCELLENT SYSTEMS
ES-9206
- 3
- 14.318MHz 7
- ES 9207
- 8
- ES 9303
- ES 9208 2
-
-AQUARF1 68000-16 6
-
- SW1
- YM2151 M6295 4 32MHz 1
- Z80-6 5 SW2Q
-
++------------------------------------------------+
+| 6116 23C16000 23C16000*|
+| YM2151 6116 23C16000* 23C16000*|
+| +-------+ +-------+ |
+| 1.056MHz M6295 |ES-9303| |ES 9207| |
+|YM3012 | | | | AS7C256 |
+| +-------+ +-------+ AS7C256 |
+|J AS7C256 |
+|A 4 AS7C256 AS7C256 |
+|M Z80B 32MHz |
+|M 5 68000P-16 14.318MHz |
+|A PAL AS7C256 AS7C256 |
+| +-------+ AS7C256 |
+| PAL |ES-9208| PB1 3 |
+| 1 PAL 6 | | 8 27C4096*|
+| +-------+ |
+|SW4*SW3* SW2 SW1 AS7C256 2 7 |
++------------------------------------------------+
+
+ CPU: TMP68HC000P-16
+ Sound: Z0840006PSC Z80B
+ OKI M6295, YM2151 & YM3012 DAC
+ OSC: 32MHz, 14.31818MHz & 1056kHz resonator
+Custom: EXCELLENT SYSTEM ES-9208 347101 (QFP160)
+ EXCELLENT SYSTEM LTD. ES 9207 9343 T (QFP208)
+ ES-9303 EXCELLENT 9338 C001 (QFP120)
+ Other: PB1 - Push button reset
+
+* Denotes unpopulated components
Notes:
@@ -30,6 +46,7 @@ Notes:
// https://www.youtube.com/watch?v=nyAQPrkt_a4
// https://www.youtube.com/watch?v=0gn2Kj2M46Q
+
*/
@@ -314,7 +331,6 @@ static MACHINE_CONFIG_START( aquarium, aquarium_state )
MCFG_CPU_PROGRAM_MAP(snd_map)
MCFG_CPU_IO_MAP(snd_portmap)
-
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
@@ -340,68 +356,68 @@ static MACHINE_CONFIG_START( aquarium, aquarium_state )
MCFG_SOUND_ROUTE(0, "lspeaker", 0.45)
MCFG_SOUND_ROUTE(1, "rspeaker", 0.45)
- MCFG_OKIM6295_ADD("oki", 1122000, OKIM6295_PIN7_HIGH) // clock frequency & pin 7 not verified
+ MCFG_OKIM6295_ADD("oki", XTAL_1_056MHz, OKIM6295_PIN7_HIGH) // pin 7 not verified
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.47)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.47)
MACHINE_CONFIG_END
ROM_START( aquarium )
ROM_REGION( 0x080000, "maincpu", 0 ) /* 68000 code */
- ROM_LOAD16_WORD_SWAP( "aquar3.bin", 0x000000, 0x080000, CRC(f197991e) SHA1(0a217d735e2643605dbfd6ee20f98f46b37d4838) )
+ ROM_LOAD16_WORD_SWAP( "aquar3.13h", 0x000000, 0x080000, CRC(f197991e) SHA1(0a217d735e2643605dbfd6ee20f98f46b37d4838) )
ROM_REGION( 0x40000, "audiocpu", 0 ) /* z80 (sound) code */
- ROM_LOAD( "aquar5", 0x000000, 0x40000, CRC(fa555be1) SHA1(07236f2b2ba67e92984b9ddf4a8154221d535245) )
+ ROM_LOAD( "excellent_5.10c", 0x000000, 0x40000, CRC(fa555be1) SHA1(07236f2b2ba67e92984b9ddf4a8154221d535245) )
ROM_REGION( 0x100000, "gfx1", 0 ) /* BG Tiles */
- ROM_LOAD( "aquar1", 0x000000, 0x080000, CRC(575df6ac) SHA1(071394273e512666fe124facdd8591a767ad0819) ) // 4bpp
+ ROM_LOAD( "excellent_1.15b", 0x000000, 0x080000, CRC(575df6ac) SHA1(071394273e512666fe124facdd8591a767ad0819) ) // 4bpp
/* data is expanded here from USER1 */
ROM_REGION( 0x100000, "user1", 0 ) /* BG Tiles */
- ROM_LOAD( "aquar6", 0x000000, 0x020000, CRC(9065b146) SHA1(befc218bbcd63453ea7eb8f976796d36f2b2d552) ) // 1bpp
+ ROM_LOAD( "excellent_6.15d", 0x000000, 0x020000, CRC(9065b146) SHA1(befc218bbcd63453ea7eb8f976796d36f2b2d552) ) // 1bpp
ROM_REGION( 0x100000, "gfx4", 0 ) /* BG Tiles */
- ROM_LOAD( "aquar8", 0x000000, 0x080000, CRC(915520c4) SHA1(308207cb20f1ed6df365710c808644a6e4f07614) ) // 4bpp
+ ROM_LOAD( "excellent_8.14g", 0x000000, 0x080000, CRC(915520c4) SHA1(308207cb20f1ed6df365710c808644a6e4f07614) ) // 4bpp
/* data is expanded here from USER2 */
ROM_REGION( 0x100000, "user2", 0 ) /* BG Tiles */
- ROM_LOAD( "aquar7", 0x000000, 0x020000, CRC(b96b2b82) SHA1(2b719d0c185d1eca4cd9ea66bed7842b74062288) ) // 1bpp
+ ROM_LOAD( "excellent_7.17g", 0x000000, 0x020000, CRC(b96b2b82) SHA1(2b719d0c185d1eca4cd9ea66bed7842b74062288) ) // 1bpp
ROM_REGION( 0x060000, "gfx2", 0 ) /* FG Tiles */
- ROM_LOAD( "aquar2", 0x000000, 0x020000, CRC(aa071b05) SHA1(517415bfd8e4dd51c6eb03a25c706f8613d34a09) )
+ ROM_LOAD( "excellent_2.17e", 0x000000, 0x020000, CRC(aa071b05) SHA1(517415bfd8e4dd51c6eb03a25c706f8613d34a09) )
ROM_REGION( 0x200000, "gfx3", 0 ) /* Sprites? */
- ROM_LOAD( "aquarf1", 0x000000, 0x0100000, CRC(14758b3c) SHA1(b372ccb42acb55a3dd15352a9d4ed576878a6731) )
+ ROM_LOAD( "d23c8000.1f", 0x000000, 0x0100000, CRC(14758b3c) SHA1(b372ccb42acb55a3dd15352a9d4ed576878a6731) ) // PCB denotes 23C16000 but a 23C8000 MASK is used
ROM_REGION( 0x100000, "oki", 0 ) /* Samples */
- ROM_LOAD( "aquar4", 0x000000, 0x80000, CRC(9a4af531) SHA1(bb201b7a6c9fd5924a0d79090257efffd8d4aba1) )
+ ROM_LOAD( "excellent_4.7d", 0x000000, 0x80000, CRC(9a4af531) SHA1(bb201b7a6c9fd5924a0d79090257efffd8d4aba1) )
ROM_END
ROM_START( aquariumj )
ROM_REGION( 0x080000, "maincpu", 0 ) /* 68000 code */
- ROM_LOAD16_WORD_SWAP( "aquar3", 0x000000, 0x080000, CRC(344509a1) SHA1(9deb610732dee5066b3225cd7b1929b767579235) )
+ ROM_LOAD16_WORD_SWAP( "excellent_3.13h", 0x000000, 0x080000, CRC(344509a1) SHA1(9deb610732dee5066b3225cd7b1929b767579235) )
ROM_REGION( 0x40000, "audiocpu", 0 ) /* z80 (sound) code */
- ROM_LOAD( "aquar5", 0x000000, 0x40000, CRC(fa555be1) SHA1(07236f2b2ba67e92984b9ddf4a8154221d535245) )
+ ROM_LOAD( "excellent_5.10c", 0x000000, 0x40000, CRC(fa555be1) SHA1(07236f2b2ba67e92984b9ddf4a8154221d535245) )
ROM_REGION( 0x100000, "gfx1", 0 ) /* BG Tiles */
- ROM_LOAD( "aquar1", 0x000000, 0x080000, CRC(575df6ac) SHA1(071394273e512666fe124facdd8591a767ad0819) ) // 4bpp
+ ROM_LOAD( "excellent_1.15b", 0x000000, 0x080000, CRC(575df6ac) SHA1(071394273e512666fe124facdd8591a767ad0819) ) // 4bpp
/* data is expanded here from USER1 */
ROM_REGION( 0x100000, "user1", 0 ) /* BG Tiles */
- ROM_LOAD( "aquar6", 0x000000, 0x020000, CRC(9065b146) SHA1(befc218bbcd63453ea7eb8f976796d36f2b2d552) ) // 1bpp
+ ROM_LOAD( "excellent_6.15d", 0x000000, 0x020000, CRC(9065b146) SHA1(befc218bbcd63453ea7eb8f976796d36f2b2d552) ) // 1bpp
ROM_REGION( 0x100000, "gfx4", 0 ) /* BG Tiles */
- ROM_LOAD( "aquar8", 0x000000, 0x080000, CRC(915520c4) SHA1(308207cb20f1ed6df365710c808644a6e4f07614) ) // 4bpp
+ ROM_LOAD( "excellent_8.14g", 0x000000, 0x080000, CRC(915520c4) SHA1(308207cb20f1ed6df365710c808644a6e4f07614) ) // 4bpp
/* data is expanded here from USER2 */
ROM_REGION( 0x100000, "user2", 0 ) /* BG Tiles */
- ROM_LOAD( "aquar7", 0x000000, 0x020000, CRC(b96b2b82) SHA1(2b719d0c185d1eca4cd9ea66bed7842b74062288) ) // 1bpp
+ ROM_LOAD( "excellent_7.17g", 0x000000, 0x020000, CRC(b96b2b82) SHA1(2b719d0c185d1eca4cd9ea66bed7842b74062288) ) // 1bpp
ROM_REGION( 0x060000, "gfx2", 0 ) /* FG Tiles */
- ROM_LOAD( "aquar2", 0x000000, 0x020000, CRC(aa071b05) SHA1(517415bfd8e4dd51c6eb03a25c706f8613d34a09) )
+ ROM_LOAD( "excellent_2.17e", 0x000000, 0x020000, CRC(aa071b05) SHA1(517415bfd8e4dd51c6eb03a25c706f8613d34a09) )
ROM_REGION( 0x200000, "gfx3", 0 ) /* Sprites? */
- ROM_LOAD( "aquarf1", 0x000000, 0x0100000, CRC(14758b3c) SHA1(b372ccb42acb55a3dd15352a9d4ed576878a6731) )
+ ROM_LOAD( "d23c8000.1f", 0x000000, 0x0100000, CRC(14758b3c) SHA1(b372ccb42acb55a3dd15352a9d4ed576878a6731) ) // PCB denotes 23C16000 but a 23C8000 MASK is used
ROM_REGION( 0x100000, "oki", 0 ) /* Samples */
- ROM_LOAD( "aquar4", 0x000000, 0x80000, CRC(9a4af531) SHA1(bb201b7a6c9fd5924a0d79090257efffd8d4aba1) )
+ ROM_LOAD( "excellent_4.7d", 0x000000, 0x80000, CRC(9a4af531) SHA1(bb201b7a6c9fd5924a0d79090257efffd8d4aba1) )
ROM_END
-GAME( 1996, aquarium, 0, aquarium, aquarium, aquarium_state, aquarium, ROT0, "Excellent System", "Aquarium (US)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL )
-GAME( 1996, aquariumj,aquarium, aquarium, aquarium, aquarium_state, aquarium, ROT0, "Excellent System", "Aquarium (Japan)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL )
+GAME( 1996, aquarium, 0, aquarium, aquarium, aquarium_state, aquarium, ROT0, "Excellent System", "Aquarium (US)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL )
+GAME( 1996, aquariumj, aquarium, aquarium, aquarium, aquarium_state, aquarium, ROT0, "Excellent System", "Aquarium (Japan)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL )
diff --git a/src/mame/drivers/asteroid.cpp b/src/mame/drivers/asteroid.cpp
index 574c420501e..08520d50cbd 100644
--- a/src/mame/drivers/asteroid.cpp
+++ b/src/mame/drivers/asteroid.cpp
@@ -323,7 +323,7 @@ static INPUT_PORTS_START( asteroid )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER("dvg", dvg_device, done_r, nullptr)
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_CODE(KEYCODE_SPACE) PORT_CODE(JOYCODE_BUTTON3) /* hyperspace */
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(JOYCODE_BUTTON1) /* fire */
- PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SERVICE ) PORT_NAME("Diagnostic Step") PORT_CODE(KEYCODE_F1)
+ PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_NAME("Diagnostic Step")
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_TILT )
PORT_SERVICE( 0x80, IP_ACTIVE_HIGH )
@@ -416,7 +416,7 @@ static INPUT_PORTS_START( asterock )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, asteroid_state,clock_r, nullptr)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_CODE(KEYCODE_SPACE) PORT_CODE(JOYCODE_BUTTON3) /* hyperspace */
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(JOYCODE_BUTTON1) /* fire */
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Diagnostic Step") PORT_CODE(KEYCODE_F1)
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Diagnostic Step")
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_TILT )
PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
@@ -457,7 +457,7 @@ static INPUT_PORTS_START( astdelux )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER("dvg", dvg_device, done_r, nullptr)
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_CODE(KEYCODE_SPACE) PORT_CODE(JOYCODE_BUTTON3) /* hyperspace */
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(JOYCODE_BUTTON1) /* fire */
- PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SERVICE ) PORT_NAME("Diagnostic Step") PORT_CODE(KEYCODE_F1)
+ PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_NAME("Diagnostic Step")
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_TILT )
PORT_SERVICE( 0x80, IP_ACTIVE_HIGH )
@@ -542,7 +542,7 @@ static INPUT_PORTS_START( llander )
/* Of the rest, Bit 6 is the 3KHz source. 3,4 and 5 are unknown */
PORT_BIT( 0x38, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, asteroid_state,clock_r, nullptr)
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Diagnostic Step") PORT_CODE(KEYCODE_F1)
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Diagnostic Step")
PORT_START("IN1")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
diff --git a/src/mame/drivers/atom.cpp b/src/mame/drivers/atom.cpp
index cb412dc9cd8..9f9a2da2a5d 100644
--- a/src/mame/drivers/atom.cpp
+++ b/src/mame/drivers/atom.cpp
@@ -75,12 +75,12 @@ Hardware: PPIA 8255
The identity number of each station is set up in hardware by links to IC 8. IC 8 is an octal buffer which when enabled feeds the cards station ID to the computer bus.
Each link codes a bit in an eight bit binary number allowing any station ID in the range 0 to 255 to be set up. if a link is left open then the bit is a one, when a
link is made the bit is a zero. Hence all links open corresponds to station ID 255, and all links made to station ID 0. Each station must have a unique identity and
- some indentities are associated with specific functions on the network. Station ID zero is reserved for broadcast signals and should not be used. Station ID 255 is
- reserved at present for the file server, and 235 for the printer server. Wire links must be soldered to each network station card during installation, a sugested
+ some identities are associated with specific functions on the network. Station ID zero is reserved for broadcast signals and should not be used. Station ID 255 is
+ reserved at present for the file server, and 235 for the printer server. Wire links must be soldered to each network station card during installation, a suggested
scheme for number allocation is to number normal user stations from one upwards and to number special stations and servers from 255 downwards.
2011 June 04 - Phill Harvey-Smith
- Fixed "ERROR" repeating infinite loop, caused by random values in machine_start() being poked into the wrong memory reigion causing the basic ROM to become
+ Fixed "ERROR" repeating infinite loop, caused by random values in machine_start() being poked into the wrong memory region causing the basic ROM to become
corrupted. Values are now correctly placed in bytes 0x0008 - 0x000B of RAM.
@@ -90,10 +90,9 @@ Hardware: PPIA 8255
TODO:
- - connect to softwarelist
- e000 EPROM switching
- display should be monochrome -- Should be optional, Acorn produced a Colour Card, and there is
- at least one aftermarket Colour card.
+ at least one after market Colour card.
- ram expansion
- tap files
- mouse
@@ -287,17 +286,16 @@ static ADDRESS_MAP_START( atombb_mem, AS_PROGRAM, 8, atom_state )
ADDRESS_MAP_END
/*-------------------------------------------------
- ADDRESS_MAP( prophet2_mem )
+ ADDRESS_MAP( prophet_mem )
-------------------------------------------------*/
-//static ADDRESS_MAP_START( prophet2_mem, AS_PROGRAM, 8, atom_state )
+//static ADDRESS_MAP_START( prophet_mem, AS_PROGRAM, 8, atom_state )
// AM_RANGE(0x0000, 0x09ff) AM_RAM
// AM_RANGE(0x0a00, 0x7fff) AM_RAM
// AM_RANGE(0x8000, 0x97ff) AM_RAM AM_SHARE("video_ram")
// AM_RANGE(0x9800, 0x9fff) AM_RAM
+// AM_RANGE(0xa000, 0xafff) AM_ROM AM_REGION("ic24", 0)
// AM_RANGE(0xb000, 0xb003) AM_MIRROR(0x3fc) AM_DEVREADWRITE(INS8255_TAG, i8255_device, read, write)
-//// AM_RANGE(0xb400, 0xb403) AM_DEVREADWRITE(MC6854_TAG, mc6854_device, read, write)
-//// AM_RANGE(0xb404, 0xb404) AM_READ_PORT("ECONET")
// AM_RANGE(0xb800, 0xb80f) AM_MIRROR(0x3f0) AM_DEVREADWRITE(R6522_TAG, via6522_device, read, write)
// AM_RANGE(0xc000, 0xffff) AM_ROM AM_REGION(SY6502_TAG, 0)
//ADDRESS_MAP_END
@@ -603,7 +601,7 @@ WRITE_LINE_MEMBER( atom_state::atom_8271_interrupt_callback )
WRITE_LINE_MEMBER( atom_state::motor_w )
{
for (int i=0; i != 2; i++) {
- char devname[1];
+ char devname[8];
sprintf(devname, "%d", i);
floppy_connector *con = m_fdc->subdevice<floppy_connector>(devname);
if (con) {
@@ -681,7 +679,7 @@ image_init_result atom_state::load_cart(device_image_interface &image, generic_s
if (size > 0x1000)
{
- image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size");
+ image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported ROM size");
return image_init_result::FAIL;
}
@@ -754,7 +752,7 @@ static MACHINE_CONFIG_START( atom, atom_state )
MCFG_QUICKLOAD_ADD("quickload", atom_state, atom_atm, "atm", 0)
- /* cartridge */
+ /* utility rom slot */
MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_linear_slot, "atom_cart")
MCFG_GENERIC_EXTENSIONS("bin,rom")
MCFG_GENERIC_LOAD(atom_state, cart_load)
@@ -867,14 +865,19 @@ MACHINE_CONFIG_END
//static MACHINE_CONFIG_DERIVED( prophet2, atom )
// /* basic machine hardware */
// MCFG_CPU_MODIFY(SY6502_TAG)
-// MCFG_CPU_PROGRAM_MAP(prophet2_mem)
+// MCFG_CPU_PROGRAM_MAP(prophet_mem)
//
// /* fdc */
// MCFG_DEVICE_REMOVE(I8271_TAG)
// MCFG_DEVICE_REMOVE(I8271_TAG ":0")
// MCFG_DEVICE_REMOVE(I8271_TAG ":1")
//
+// /* internal ram */
+// MCFG_RAM_MODIFY(RAM_TAG)
+// MCFG_RAM_DEFAULT_SIZE("32K")
+
// /* Software lists */
+// MCFG_SOFTWARE_LIST_REMOVE("rom_list")
// MCFG_SOFTWARE_LIST_REMOVE("flop_list")
//MACHINE_CONFIG_END
@@ -883,7 +886,16 @@ MACHINE_CONFIG_END
-------------------------------------------------*/
//static MACHINE_CONFIG_DERIVED( prophet3, atom )
+// /* basic machine hardware */
+// MCFG_CPU_MODIFY(SY6502_TAG)
+// MCFG_CPU_PROGRAM_MAP(prophet_mem)
//
+// /* internal ram */
+// MCFG_RAM_MODIFY(RAM_TAG)
+// MCFG_RAM_DEFAULT_SIZE("32K")
+
+// /* Software lists */
+// MCFG_SOFTWARE_LIST_REMOVE("rom_list")
//MACHINE_CONFIG_END
/*-------------------------------------------------
diff --git a/src/mame/drivers/banctec.cpp b/src/mame/drivers/banctec.cpp
index cdd55f5aa34..c6a00cdda8f 100644
--- a/src/mame/drivers/banctec.cpp
+++ b/src/mame/drivers/banctec.cpp
@@ -6,23 +6,59 @@
Author: Felipe Sanches <juca@members.fsf.org>
Maintainence Manual: <https://garoa.net.br/w/images/PAINEL_BANCTEC_91690.PDF>
+
+ The display is considered a replaceable part, not repairable. Therefore the manual
+ has no circuit description or schematic. And so, much of the below is guesswork.
+
+ Machine starts up and clears video ram, then nothing more. Location of videoram
+ in the memory map is unknown, left at 8000 for now.
+
*/
#include "emu.h"
#include "cpu/mcs51/mcs51.h"
#include "cpu/m6800/m6800.h"
-#include "includes/banctec.h"
#include "video/mc6845.h"
+class banctec_state : public driver_device
+{
+public:
+ banctec_state(const machine_config &mconfig, device_type type, const char *tag)
+ : driver_device(mconfig, type, tag)
+ , m_palette(*this, "palette")
+ , m_video_address(0)
+ , m_maincpu(*this, "maincpu")
+ , m_videoram(*this, "videoram")
+ , m_p_chargen(*this, "chargen")
+ { }
+
+ MC6845_UPDATE_ROW(crtc_update_row);
+ MC6845_ON_UPDATE_ADDR_CHANGED(crtc_addr);
+ DECLARE_WRITE8_MEMBER(videoram_w);
+ required_device<palette_device> m_palette;
+
+private:
+ u8 m_video_address;
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
+ required_device<cpu_device> m_maincpu;
+ required_shared_ptr<u8> m_videoram;
+ required_region_ptr<u8> m_p_chargen;
+};
+
static ADDRESS_MAP_START( banctec_mem , AS_PROGRAM, 8, banctec_state )
AM_RANGE(0x0000, 0x07ff) AM_ROM
AM_RANGE(0x0800, 0xffff) AM_RAM /* Probably wrong. Must be verified on pcb! */
ADDRESS_MAP_END
static ADDRESS_MAP_START( banctec_mcu_mem , AS_PROGRAM, 8, banctec_state )
- AM_RANGE(0x0000, 0x1fff) AM_ROM
- AM_RANGE(0x2000, 0x7fff) AM_RAM /* Probably wrong. Must be verified on pcb! */
- AM_RANGE(0x8000, 0xffff) AM_RAM AM_SHARE("videoram") /* Probably wrong. Must be verified on pcb! */
+ AM_RANGE(0x0000, 0x00ff) AM_RAM /* Probably wrong. Must be verified on pcb! */
+ AM_RANGE(0x2000, 0x2000) AM_DEVREADWRITE("crtc", mc6845_device, status_r, address_w)
+ AM_RANGE(0x2001, 0x2001) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w)
+ AM_RANGE(0x2003, 0x2003) AM_WRITE(videoram_w)
+ AM_RANGE(0x8000, 0x80ff) AM_RAM AM_SHARE("videoram") /* Probably wrong. Must be verified on pcb! */
+ AM_RANGE(0xe000, 0xffff) AM_ROM AM_REGION("mcu", 0x0000)
ADDRESS_MAP_END
void banctec_state::machine_reset()
@@ -34,32 +70,47 @@ void banctec_state::machine_reset()
* Video/Character functions *
****************************/
-TILE_GET_INFO_MEMBER(banctec_state::get_bg_tile_info)
+WRITE8_MEMBER( banctec_state::videoram_w )
{
- uint8_t *videoram = m_videoram;
- int code = videoram[tile_index];
- int color = 1;
-
- SET_TILE_INFO_MEMBER(0, code, color, 0);
+ m_videoram[m_video_address] = data;
+ m_video_address++;
}
void banctec_state::video_start()
{
- m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(banctec_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 40, 25);
}
-uint32_t banctec_state::screen_update_banctec(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
- m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
+/* ROCKWELL 6545 - Transparent Memory Addressing */
- return 0;
+MC6845_UPDATE_ROW( banctec_state::crtc_update_row )
+{
+ const rgb_t *palette = m_palette->palette()->entry_list_raw();
+ u8 chr,gfx;
+ u16 mem,x;
+ u32 *p = &bitmap.pix32(y);
+
+ for (x = 0; x < x_count; x++)
+ {
+ mem = (ma + x) & 0xff;
+ chr = m_videoram[mem];
+ gfx = m_p_chargen[chr | (ra << 8)] ^ ((x == cursor_x) ? 0xff : 0);
+
+ /* Display a scanline of a character (8 pixels) */
+ *p++ = palette[BIT(gfx, 7)];
+ *p++ = palette[BIT(gfx, 6)];
+ *p++ = palette[BIT(gfx, 5)];
+ *p++ = palette[BIT(gfx, 4)];
+ *p++ = palette[BIT(gfx, 3)];
+ *p++ = palette[BIT(gfx, 2)];
+ *p++ = palette[BIT(gfx, 1)];
+ *p++ = palette[BIT(gfx, 0)];
+ }
}
-/* ROCKWELL 6545 - Transparent Memory Addressing */
-
MC6845_ON_UPDATE_ADDR_CHANGED(banctec_state::crtc_addr)
{
/* What is this function meant to do ? */
+ m_video_address = address;
}
/******************************
@@ -78,7 +129,7 @@ const gfx_layout banctec_gfx_layout =
};
static GFXDECODE_START( banctec )
- GFXDECODE_ENTRY( "gfx", 0x00000, banctec_gfx_layout, 0, 2 )
+ GFXDECODE_ENTRY( "chargen", 0x00000, banctec_gfx_layout, 0, 1 )
GFXDECODE_END
static MACHINE_CONFIG_START( banctec, banctec_state )
@@ -98,28 +149,26 @@ static MACHINE_CONFIG_START( banctec, banctec_state )
MCFG_SCREEN_REFRESH_RATE(60)
MCFG_SCREEN_SIZE((52+1)*8, (31+1)*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 25*8-1)
- MCFG_SCREEN_UPDATE_DRIVER(banctec_state, screen_update_banctec)
- MCFG_SCREEN_PALETTE("palette")
-
+ MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update)
+ MCFG_PALETTE_ADD_MONOCHROME("palette")
MCFG_GFXDECODE_ADD("gfxdecode", "palette", banctec)
- MCFG_PALETTE_ADD("palette", 2)
-// MCFG_PALETTE_INIT_OWNER(banctec_state, banctec)
- MCFG_MC6845_ADD("crtc", R6545_1, "screen", XTAL_20MHz) /* (?) */
+ MCFG_MC6845_ADD("crtc", R6545_1, "screen", XTAL_2MHz) /* (?) */
MCFG_MC6845_SHOW_BORDER_AREA(false)
MCFG_MC6845_CHAR_WIDTH(8)
+ MCFG_MC6845_UPDATE_ROW_CB(banctec_state, crtc_update_row)
MCFG_MC6845_ADDR_CHANGED_CB(banctec_state, crtc_addr)
MACHINE_CONFIG_END
ROM_START(banctec)
- ROM_REGION(0x800,"maincpu",0)
+ ROM_REGION(0x800, "maincpu", 0)
ROM_LOAD("banctec_eseries_panel_opnl.u20", 0x000, 0x800, CRC(c2ab9c06) SHA1(a296589034f656790ad5ffbce028dd846a40cf03))
- ROM_REGION(0x2000,"mcu",0)
+ ROM_REGION(0x2000, "mcu", 0)
ROM_LOAD("banctec_eseries_panel.u8", 0x0000, 0x2000, CRC(f3335e0a) SHA1(5ca45fdcb7ef45a65c28c79abfa9ebb7a8a06619))
- ROM_REGION(0x1000,"gfx",0)
+ ROM_REGION(0x1000, "chargen", 0)
ROM_LOAD("banctec_eseries_panel.u20", 0x0000, 0x1000, CRC(5b6ecec9) SHA1(35aff8f965bce77205e3a43d71e39097585091a7))
ROM_END
diff --git a/src/mame/drivers/battlex.cpp b/src/mame/drivers/battlex.cpp
index 1ca17c12f34..1282c9afbe4 100644
--- a/src/mame/drivers/battlex.cpp
+++ b/src/mame/drivers/battlex.cpp
@@ -93,12 +93,16 @@ static ADDRESS_MAP_START( io_map, AS_IO, 8, battlex_state )
AM_RANGE(0x10, 0x10) AM_WRITE(battlex_flipscreen_w)
/* verify all of these */
- AM_RANGE(0x22, 0x23) AM_DEVWRITE("aysnd", ay8910_device, data_address_w)
+ AM_RANGE(0x22, 0x23) AM_DEVWRITE("ay1", ay8910_device, data_address_w)
AM_RANGE(0x30, 0x30) AM_WRITE(battlex_scroll_starfield_w)
AM_RANGE(0x32, 0x32) AM_WRITE(battlex_scroll_x_lsb_w)
AM_RANGE(0x33, 0x33) AM_WRITE(battlex_scroll_x_msb_w)
ADDRESS_MAP_END
+static ADDRESS_MAP_START( dodgeman_io_map, AS_IO, 8, battlex_state )
+ AM_IMPORT_FROM(io_map)
+ AM_RANGE(0x26, 0x27) AM_DEVWRITE("ay2", ay8910_device, data_address_w)
+ADDRESS_MAP_END
/*************************************
*
@@ -131,6 +135,7 @@ static INPUT_PORTS_START( battlex )
PORT_START("SYSTEM") /* IN1 */
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 )
+ // TODO: PORT_IMPULSE?
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_IMPULSE(4)
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_IMPULSE(4) PORT_COCKTAIL
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_START1 )
@@ -173,6 +178,16 @@ static INPUT_PORTS_START( battlex )
PORT_DIPSETTING( 0x80, DEF_STR( On ) )
INPUT_PORTS_END
+static INPUT_PORTS_START( dodgeman )
+ PORT_INCLUDE( battlex )
+
+ PORT_MODIFY("SYSTEM")
+ PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 )
+ PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL
+ PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2 )
+ PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_COCKTAIL
+INPUT_PORTS_END
+
/*************************************
*
@@ -185,7 +200,7 @@ static const gfx_layout battlex_charlayout =
8,8,
RGN_FRAC(1,3),
3,
- { 0,RGN_FRAC(1,3),RGN_FRAC(2,3) },
+ { RGN_FRAC(0,3), RGN_FRAC(1,3), RGN_FRAC(2,3) },
{ 7,6,5,4,3,2,1,0 },
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
8*8
@@ -196,7 +211,7 @@ static const gfx_layout battlex_spritelayout =
16,16,
RGN_FRAC(1,3),
3,
- { 0,RGN_FRAC(1,3),RGN_FRAC(2,3) },
+ { RGN_FRAC(0,3), RGN_FRAC(1,3), RGN_FRAC(2,3) },
{ 7,6,5,4,3,2,1,0,
15,14,13,12,11,10,9,8 },
{ 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16,
@@ -256,10 +271,20 @@ static MACHINE_CONFIG_START( battlex, battlex_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
- MCFG_SOUND_ADD("aysnd", AY8910, XTAL_10MHz/8) // ?
+ MCFG_SOUND_ADD("ay1", AY8910, XTAL_10MHz/8) // ?
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40)
MACHINE_CONFIG_END
+static MACHINE_CONFIG_DERIVED( dodgeman, battlex )
+
+ MCFG_CPU_MODIFY("maincpu")
+ MCFG_CPU_IO_MAP(dodgeman_io_map)
+
+ MCFG_VIDEO_START_OVERRIDE(battlex_state, dodgeman)
+
+ MCFG_SOUND_ADD("ay2", AY8910, XTAL_10MHz/8) // ?
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40)
+MACHINE_CONFIG_END
/*************************************
*
@@ -276,18 +301,41 @@ ROM_START( battlex )
ROM_LOAD( "p-rom5.2", 0x4000, 0x1000, CRC(ceb63d38) SHA1(92cab905d009c59115f52172ba7d01c8ff8991d7) )
ROM_LOAD( "p-rom6.1", 0x5000, 0x1000, CRC(6923f601) SHA1(e6c33cbd8d8679299d7b2c568d56f96ed3073971) )
+ ROM_REGION( 0x3000, "gfx1", ROMREGION_ERASE00 ) // filled in later
+
ROM_REGION( 0x3000, "gfx2", 0 )
ROM_LOAD( "1a_f.6f", 0x0000, 0x1000, CRC(2b69287a) SHA1(30c0edaec44118b95ec390bd41c1bd49a2802451) )
ROM_LOAD( "1a_h.6h", 0x1000, 0x1000, CRC(9f4c3bdd) SHA1(e921ecafefe54c033d05d9cd289808e971ac7940) )
ROM_LOAD( "1a_j.6j", 0x2000, 0x1000, CRC(c1345b05) SHA1(17194c8ec961990222bd295ff1d036a64f497b0e) )
- ROM_REGION( 0x3000, "gfx1", ROMREGION_ERASE00 ) // filled in later
+ ROM_REGION( 0x1000, "user1", 0 ) // gfx1 colormask, bad?
+ ROM_LOAD( "1a_d.6d", 0x0000, 0x1000, CRC(750a46ef) SHA1(b6ab93e084ab0b7c6ad90ee6431bc1b7ab9ed46d) )
ROM_REGION( 0x1000, "user2", 0 ) // gfx1 1bpp gfxdata
ROM_LOAD( "1a_e.6e", 0x0000, 0x1000, CRC(126842b7) SHA1(2da4f64e077232c1dd0853d07d801f9781517850) )
+ROM_END
- ROM_REGION( 0x1000, "user1", 0 ) // gfx1 colormask, bad?
- ROM_LOAD( "1a_d.6d", 0x0000, 0x1000, CRC(750a46ef) SHA1(b6ab93e084ab0b7c6ad90ee6431bc1b7ab9ed46d) )
+ROM_START( dodgeman )
+ ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASE00 )
+ ROM_LOAD( "dg0.7f", 0x0000, 0x001000, CRC(1219b5db) SHA1(e4050a5e52f7b125f317b6e2ef615774c81cf679) )
+ ROM_LOAD( "dg1.5f", 0x1000, 0x001000, CRC(fff9a086) SHA1(e4e528789d07755cf999054c191e242ea3ebe55f) )
+ ROM_LOAD( "dg2.4f", 0x2000, 0x001000, CRC(2ca9ac99) SHA1(7fe81626ab2b5c01189fbb578999157863fcc29f) )
+ ROM_LOAD( "dg3.3f", 0x3000, 0x001000, CRC(55a51c0e) SHA1(a5b253f096e1fe85ee391ad2aa0373809a3b48c2) )
+ ROM_LOAD( "dg4.2f", 0x4000, 0x001000, CRC(14169361) SHA1(86d3cd1fa0aa4f21029daea2eba99bdaa34372e8) )
+ ROM_LOAD( "dg5.1f", 0x5000, 0x001000, CRC(8f83ae2f) SHA1(daad41b61ba3d55531021d444bbe4acfc275cfc9) )
+
+ ROM_REGION( 0x6000, "gfx1", ROMREGION_ERASE00 ) // filled in later
+
+ ROM_REGION( 0x6000, "gfx2", ROMREGION_ERASE00 )
+ ROM_LOAD( "f.6f", 0x0000, 0x002000, CRC(dfaaf4c8) SHA1(1e09f1d72e7e5e6782d73ae60bca7982fc04df0e) )
+ ROM_LOAD( "h.6h", 0x2000, 0x002000, CRC(e2525ffe) SHA1(a17b608b4089014be381b26f16597b83d4a66ebd) )
+ ROM_LOAD( "j.6j", 0x4000, 0x002000, CRC(2731ee46) SHA1(15b9350e19f31b1cea99deb9935543777644e6a8) )
+
+ ROM_REGION( 0x2000, "user1", 0 ) // gfx1 1bpp gfxdata
+ ROM_LOAD( "d.6d", 0x0000, 0x002000, CRC(451c1c3a) SHA1(214f775e242f7f29ac799cdd554708acddd1e34f) )
+
+ ROM_REGION( 0x2000, "user2", 0 ) // gfx1 colormask, bad?
+ ROM_LOAD( "e.6e", 0x0000, 0x002000, CRC(c9a515df) SHA1(5232d2d1bd02b89cb651d817995daf33469f0e2f) )
ROM_END
@@ -302,11 +350,12 @@ DRIVER_INIT_MEMBER(battlex_state,battlex)
uint8_t *colormask = memregion("user1")->base();
uint8_t *gfxdata = memregion("user2")->base();
uint8_t *dest = memregion("gfx1")->base();
-
+ int tile_size = memregion("gfx1")->bytes() / 24;
+ int tile_shift = (tile_size / 512) + 11;
int tile, line, bit;
-
+
/* convert gfx data from 1bpp + color block mask to straight 3bpp */
- for (tile = 0; tile < 512; tile++)
+ for (tile = 0; tile < tile_size; tile++)
{
for (line = 0; line < 8; line ++)
{
@@ -319,7 +368,7 @@ DRIVER_INIT_MEMBER(battlex_state,battlex)
for (plane = 2; plane >= 0; plane--)
{
- dest[tile << 3 | line | (plane << 12)] |= (color & 1) << bit;
+ dest[tile << 3 | line | (plane << tile_shift)] |= (color & 1) << bit;
color >>= 1;
}
}
@@ -334,4 +383,5 @@ DRIVER_INIT_MEMBER(battlex_state,battlex)
*
*************************************/
-GAME( 1982, battlex, 0, battlex, battlex, battlex_state, battlex, ROT180, "Omori Electric Co., Ltd.", "Battle Cross", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_COLORS | MACHINE_SUPPORTS_SAVE )
+GAME( 1982, battlex, 0, battlex, battlex, battlex_state, battlex, ROT180, "Omori Electric Co., Ltd.", "Battle Cross", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_COLORS | MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL )
+GAME( 1983, dodgeman, 0, dodgeman, dodgeman, battlex_state, battlex, ROT180, "Omori Electric Co., Ltd.", "Dodge Man", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_COLORS | MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL )
diff --git a/src/mame/drivers/bwidow.cpp b/src/mame/drivers/bwidow.cpp
index 3eb06741e9e..e9d7c1c4629 100644
--- a/src/mame/drivers/bwidow.cpp
+++ b/src/mame/drivers/bwidow.cpp
@@ -447,7 +447,7 @@ static INPUT_PORTS_START( bwidow )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN1 ) // To fit "Coin A" Dip Switch
PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_SERVICE( 0x10, IP_ACTIVE_LOW )
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Diagnostic Step") PORT_CODE(KEYCODE_F1)
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Diagnostic Step")
/* bit 6 is the VG HALT bit. We set it to "low" */
/* per default (busy vector processor). */
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER("avg", avg_device, done_r, nullptr)
@@ -525,7 +525,7 @@ static INPUT_PORTS_START( gravitar )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN1 ) // To fit "Coin A" Dip Switch
PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_SERVICE( 0x10, IP_ACTIVE_LOW )
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Diagnostic Step") PORT_CODE(KEYCODE_F1)
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Diagnostic Step")
/* bit 6 is the VG HALT bit. We set it to "low" */
/* per default (busy vector processor). */
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER("avg", avg_device, done_r, nullptr)
@@ -633,7 +633,7 @@ static INPUT_PORTS_START( spacduel )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN1 ) // To fit "Coin A" Dip Switch
PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_SERVICE( 0x10, IP_ACTIVE_LOW )
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Diagnostic Step") PORT_CODE(KEYCODE_F1)
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Diagnostic Step")
/* bit 6 is the VG HALT bit. We set it to "low" */
/* per default (busy vector processor). */
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER("avg", avg_device, done_r, nullptr)
diff --git a/src/mame/drivers/bzone.cpp b/src/mame/drivers/bzone.cpp
index f95bf75f3d7..2da43382822 100644
--- a/src/mame/drivers/bzone.cpp
+++ b/src/mame/drivers/bzone.cpp
@@ -355,7 +355,7 @@ ADDRESS_MAP_END
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )\
PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_UNUSED )\
PORT_SERVICE( 0x10, IP_ACTIVE_LOW )\
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Diagnostic Step") PORT_CODE(KEYCODE_F1)\
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Diagnostic Step") \
/* bit 6 is the VG HALT bit. We set it to "low" */\
/* per default (busy vector processor). */\
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER("avg", avg_bzone_device, done_r, nullptr)\
diff --git a/src/mame/drivers/coco12.cpp b/src/mame/drivers/coco12.cpp
index 35a3d776915..7b4c38df94f 100644
--- a/src/mame/drivers/coco12.cpp
+++ b/src/mame/drivers/coco12.cpp
@@ -107,19 +107,6 @@ INPUT_PORTS_END
//-------------------------------------------------
-// INPUT_PORTS( coco_cart_autostart )
-//-------------------------------------------------
-
-INPUT_PORTS_START( coco_cart_autostart )
- PORT_START(CART_AUTOSTART_TAG)
- PORT_CONFNAME( 0x01, 0x01, "Cart Auto-Start" )
- PORT_CONFSETTING( 0x00, DEF_STR( Off ))
- PORT_CONFSETTING( 0x01, DEF_STR( On ))
-INPUT_PORTS_END
-
-
-
-//-------------------------------------------------
// INPUT_PORTS( coco_beckerport )
//-------------------------------------------------
@@ -238,7 +225,6 @@ static INPUT_PORTS_START( coco )
PORT_INCLUDE( coco_keyboard )
PORT_INCLUDE( coco_joystick )
PORT_INCLUDE( coco_analog_control )
- PORT_INCLUDE( coco_cart_autostart )
PORT_INCLUDE( coco_rtc )
PORT_INCLUDE( coco_beckerport )
INPUT_PORTS_END
diff --git a/src/mame/drivers/coco3.cpp b/src/mame/drivers/coco3.cpp
index cefb1940070..15f41f0f42d 100644
--- a/src/mame/drivers/coco3.cpp
+++ b/src/mame/drivers/coco3.cpp
@@ -221,7 +221,6 @@ static INPUT_PORTS_START( coco3 )
PORT_INCLUDE( coco3_keyboard )
PORT_INCLUDE( coco3_joystick )
PORT_INCLUDE( coco_analog_control )
- PORT_INCLUDE( coco_cart_autostart )
PORT_INCLUDE( coco_rat_mouse )
PORT_INCLUDE( coco_lightgun )
PORT_INCLUDE( coco_rtc )
diff --git a/src/mame/drivers/cps2.cpp b/src/mame/drivers/cps2.cpp
index ac14acddb64..d2be82309e7 100644
--- a/src/mame/drivers/cps2.cpp
+++ b/src/mame/drivers/cps2.cpp
@@ -3143,6 +3143,40 @@ ROM_START( ddsomjr1 )
ROM_LOAD( "ddsomj.key", 0x000000, 0x000014, CRC(d8dadb22) SHA1(e07b50ae464c35439333dd983e2acac48a1ce529) )
ROM_END
+ROM_START( ddsomjr2 )
+ ROM_REGION( CODE_SIZE, "maincpu", 0 ) /* 68000 code */
+ ROM_LOAD16_WORD_SWAP( "dd2j.03b", 0x000000, 0x80000, CRC(b2fd4a24) SHA1(6b5bd11e665e84a9de56d167a5d8957a3a967f8c) )
+ ROM_LOAD16_WORD_SWAP( "dd2j.04b", 0x080000, 0x80000, CRC(3a68c310) SHA1(8806ea2765e82f396158f0ae8a906cda90bd3472) )
+ ROM_LOAD16_WORD_SWAP( "dd2.05b", 0x100000, 0x80000, CRC(aa56f42f) SHA1(2795a1c8978c5f459daaca57985c24027139d7e1) )
+ ROM_LOAD16_WORD_SWAP( "dd2.06b", 0x180000, 0x80000, CRC(2f8cd040) SHA1(f2ec09d06432a5f44dd85557d94b35d01b0ece6a) )
+ ROM_LOAD16_WORD_SWAP( "dd2.07", 0x200000, 0x80000, CRC(909a0b8b) SHA1(58bda17c36063a79df8b5031755c7909a9bda221) )
+ ROM_LOAD16_WORD_SWAP( "dd2.08", 0x280000, 0x80000, CRC(e53c4d01) SHA1(bad872e4e793a39f68bc0e580772e982714b5876) )
+ ROM_LOAD16_WORD_SWAP( "dd2.09", 0x300000, 0x80000, CRC(5f86279f) SHA1(c2a454e5f821b1cdd49f2cf0602e9bfb7ba63340) )
+ ROM_LOAD16_WORD_SWAP( "dd2.10", 0x380000, 0x80000, CRC(ad954c26) SHA1(468c01735dbdb1114b37060546a660678290a97f) )
+
+ ROM_REGION( 0x1800000, "gfx", 0 )
+ ROMX_LOAD( "dd2.13m", 0x0000000, 0x400000, CRC(a46b4e6e) SHA1(fb90f42868c581c481b4ceff9f692753fb186b30) , ROM_GROUPWORD | ROM_SKIP(6) )
+ ROMX_LOAD( "dd2.15m", 0x0000002, 0x400000, CRC(d5fc50fc) SHA1(bc692f17b18bb47a724cd5152377cd5ccd6e184a) , ROM_GROUPWORD | ROM_SKIP(6) )
+ ROMX_LOAD( "dd2.17m", 0x0000004, 0x400000, CRC(837c0867) SHA1(3d6db290a8f76299a23543f0ccf6a7905e1088ac) , ROM_GROUPWORD | ROM_SKIP(6) )
+ ROMX_LOAD( "dd2.19m", 0x0000006, 0x400000, CRC(bb0ec21c) SHA1(e43ccc1cf63ccd2b504cc9fd701af849a7321914) , ROM_GROUPWORD | ROM_SKIP(6) )
+ ROMX_LOAD( "dd2.14m", 0x1000000, 0x200000, CRC(6d824ce2) SHA1(0ccfe6c8a944937718e28a1a373b5822c7b7001b) , ROM_GROUPWORD | ROM_SKIP(6) )
+ ROMX_LOAD( "dd2.16m", 0x1000002, 0x200000, CRC(79682ae5) SHA1(ee84f4791c29ce9e2bae06ba3ec47ff4d2cd7054) , ROM_GROUPWORD | ROM_SKIP(6) )
+ ROMX_LOAD( "dd2.18m", 0x1000004, 0x200000, CRC(acddd149) SHA1(7f50de9b2d1cc733594c642be1804190519caffa) , ROM_GROUPWORD | ROM_SKIP(6) )
+ ROMX_LOAD( "dd2.20m", 0x1000006, 0x200000, CRC(117fb0c0) SHA1(15c01fa1a71b6469b0e1bde0ce5835c5ff9d938c) , ROM_GROUPWORD | ROM_SKIP(6) )
+
+ ROM_REGION( QSOUND_SIZE, "audiocpu", 0 ) /* 64k for the audio CPU (+banks) */
+ ROM_LOAD( "dd2.01", 0x00000, 0x08000, CRC(99d657e5) SHA1(1528dd6b07a0e79951a35c0457c8a9c9770e9c78) )
+ ROM_CONTINUE( 0x10000, 0x18000 )
+ ROM_LOAD( "dd2.02", 0x28000, 0x20000, CRC(117a3824) SHA1(14f3a12170b601c5466c93af9d2f24e0b386b4e4) )
+
+ ROM_REGION( 0x400000, "qsound", 0 ) /* QSound samples */
+ ROM_LOAD16_WORD_SWAP( "dd2.11m", 0x000000, 0x200000, CRC(98d0c325) SHA1(7406e8d943d77c468eb418c4113261f4ab973bbf) )
+ ROM_LOAD16_WORD_SWAP( "dd2.12m", 0x200000, 0x200000, CRC(5ea2e7fa) SHA1(0e6a9fd007f637adcb2226c902394f07de45e803) )
+
+ ROM_REGION( 0x20, "key", 0 )
+ ROM_LOAD( "ddsomj.key", 0x000000, 0x000014, CRC(d8dadb22) SHA1(e07b50ae464c35439333dd983e2acac48a1ce529) )
+ROM_END
+
ROM_START( ddsoma )
ROM_REGION( CODE_SIZE, "maincpu", 0 ) /* 68000 code */
ROM_LOAD16_WORD_SWAP( "dd2a.03g", 0x000000, 0x80000, CRC(0b4fec22) SHA1(4dd69637898e0bc64d1b1dc34561ce1807da314b) )
@@ -9951,6 +9985,7 @@ GAME( 1996, ddsomu, ddsom, cps2, cps2_4p4b, cps_state, cps2, ROT0,
GAME( 1996, ddsomur1, ddsom, cps2, cps2_4p4b, cps_state, cps2, ROT0, "Capcom", "Dungeons & Dragons: Shadow over Mystara (USA 960209)", MACHINE_SUPPORTS_SAVE )
GAME( 1996, ddsomj, ddsom, cps2, cps2_4p4b, cps_state, cps2, ROT0, "Capcom", "Dungeons & Dragons: Shadow over Mystara (Japan 960619)", MACHINE_SUPPORTS_SAVE )
GAME( 1996, ddsomjr1, ddsom, cps2, cps2_4p4b, cps_state, cps2, ROT0, "Capcom", "Dungeons & Dragons: Shadow over Mystara (Japan 960206)", MACHINE_SUPPORTS_SAVE )
+GAME( 1996, ddsomjr2, ddsom, cps2, cps2_4p4b, cps_state, cps2, ROT0, "Capcom", "Dungeons & Dragons: Shadow over Mystara (Japan 960223)", MACHINE_SUPPORTS_SAVE )
GAME( 1996, ddsoma, ddsom, cps2, cps2_4p4b, cps_state, cps2, ROT0, "Capcom", "Dungeons & Dragons: Shadow over Mystara (Asia 960619)", MACHINE_SUPPORTS_SAVE )
GAME( 1996, ddsomar1, ddsom, cps2, cps2_4p4b, cps_state, cps2, ROT0, "Capcom", "Dungeons & Dragons: Shadow over Mystara (Asia 960208)", MACHINE_SUPPORTS_SAVE )
GAME( 1996, ddsomh, ddsom, cps2, cps2_4p4b, cps_state, cps2, ROT0, "Capcom", "Dungeons & Dragons: Shadow over Mystara (Hispanic 960223)", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/d9final.cpp b/src/mame/drivers/d9final.cpp
index 9d1328e1cc2..f076490d0bc 100644
--- a/src/mame/drivers/d9final.cpp
+++ b/src/mame/drivers/d9final.cpp
@@ -130,7 +130,7 @@ static ADDRESS_MAP_START( d9final_map, AS_PROGRAM, 8, d9final_state )
AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(sc0_lovram) AM_SHARE("lo_vram")
AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(sc0_hivram) AM_SHARE("hi_vram")
AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(sc0_cram) AM_SHARE("cram")
- AM_RANGE(0xf000, 0xf007) AM_READ(prot_latch_r) //AM_DEVWRITE("essnd", es8712_device, es8712_w)
+ AM_RANGE(0xf000, 0xf007) AM_READ(prot_latch_r) //AM_DEVREADWRITE("essnd", es8712_device, read, write)
AM_RANGE(0xf800, 0xf80f) AM_DEVREADWRITE("rtc", rtc62421_device, read, write)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/dblcrown.cpp b/src/mame/drivers/dblcrown.cpp
index 257103cd97a..9ba9a8c1525 100644
--- a/src/mame/drivers/dblcrown.cpp
+++ b/src/mame/drivers/dblcrown.cpp
@@ -47,6 +47,7 @@
#include "emu.h"
#include "cpu/z80/z80.h"
#include "sound/ay8910.h"
+#include "machine/i8255.h"
#include "machine/nvram.h"
#include "machine/watchdog.h"
@@ -79,9 +80,7 @@ public:
std::unique_ptr<uint8_t[]> m_vram;
uint8_t m_vram_bank[2];
uint8_t m_mux_data;
- uint8_t m_lamps_data;
- DECLARE_READ8_MEMBER(bank_r);
DECLARE_WRITE8_MEMBER(bank_w);
DECLARE_READ8_MEMBER(irq_source_r);
DECLARE_WRITE8_MEMBER(irq_source_w);
@@ -91,12 +90,10 @@ public:
DECLARE_WRITE8_MEMBER(vram_w);
DECLARE_READ8_MEMBER(vram_bank_r);
DECLARE_WRITE8_MEMBER(vram_bank_w);
- DECLARE_READ8_MEMBER(mux_r);
DECLARE_WRITE8_MEMBER(mux_w);
DECLARE_READ8_MEMBER(in_mux_r);
DECLARE_READ8_MEMBER(in_mux_type_r);
DECLARE_WRITE8_MEMBER(output_w);
- DECLARE_READ8_MEMBER(lamps_r);
DECLARE_WRITE8_MEMBER(lamps_w);
DECLARE_WRITE8_MEMBER(watchdog_w);
@@ -159,11 +156,6 @@ uint32_t dblcrown_state::screen_update( screen_device &screen, bitmap_ind16 &bit
return 0;
}
-READ8_MEMBER( dblcrown_state::bank_r)
-{
- return m_bank;
-}
-
WRITE8_MEMBER( dblcrown_state::bank_w)
{
m_bank = data;
@@ -246,11 +238,6 @@ WRITE8_MEMBER( dblcrown_state::vram_bank_w)
printf("vram bank = %02x\n",data);
}
-READ8_MEMBER( dblcrown_state::mux_r)
-{
- return m_mux_data;
-}
-
WRITE8_MEMBER( dblcrown_state::mux_w)
{
m_mux_data = data;
@@ -307,11 +294,6 @@ WRITE8_MEMBER( dblcrown_state::output_w )
}
-READ8_MEMBER( dblcrown_state::lamps_r )
-{
- return m_lamps_data;
-}
-
WRITE8_MEMBER( dblcrown_state::lamps_w )
{
/* bits
@@ -333,8 +315,6 @@ WRITE8_MEMBER( dblcrown_state::lamps_w )
output().set_lamp_value(5, (data >> 5) & 1); /* Hold 3 */
output().set_lamp_value(6, (data >> 6) & 1); /* Hold 2 */
output().set_lamp_value(7, (data >> 7) & 1); /* Hold 1 */
-
- m_lamps_data = data;
}
WRITE8_MEMBER(dblcrown_state::watchdog_w)
@@ -377,10 +357,8 @@ static ADDRESS_MAP_START( dblcrown_io, AS_IO, 8, dblcrown_state )
AM_RANGE(0x03, 0x03) AM_READ_PORT("DSWD")
AM_RANGE(0x04, 0x04) AM_READ(in_mux_r)
AM_RANGE(0x05, 0x05) AM_READ(in_mux_type_r)
- AM_RANGE(0x10, 0x10) AM_READWRITE(lamps_r, lamps_w)
- AM_RANGE(0x11, 0x11) AM_READWRITE(bank_r, bank_w)
- AM_RANGE(0x12, 0x12) AM_READWRITE(mux_r, mux_w)
- AM_RANGE(0x20, 0x21) AM_DEVWRITE("aysnd", ay8910_device, address_data_w)
+ AM_RANGE(0x10, 0x13) AM_DEVREADWRITE("ppi", i8255_device, read, write)
+ AM_RANGE(0x20, 0x21) AM_DEVWRITE("ymz", ymz284_device, address_data_w)
AM_RANGE(0x30, 0x30) AM_WRITE(watchdog_w)
AM_RANGE(0x40, 0x40) AM_WRITE(output_w)
ADDRESS_MAP_END
@@ -638,9 +616,14 @@ static MACHINE_CONFIG_START( dblcrown, dblcrown_state )
MCFG_NVRAM_ADD_0FILL("nvram")
+ MCFG_DEVICE_ADD("ppi", I8255, 0)
+ MCFG_I8255_OUT_PORTA_CB(WRITE8(dblcrown_state, lamps_w))
+ MCFG_I8255_OUT_PORTB_CB(WRITE8(dblcrown_state, bank_w))
+ MCFG_I8255_OUT_PORTC_CB(WRITE8(dblcrown_state, mux_w))
+
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
- MCFG_SOUND_ADD("aysnd", AY8910, SND_CLOCK)
+ MCFG_SOUND_ADD("ymz", YMZ284, SND_CLOCK)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/dec0.cpp b/src/mame/drivers/dec0.cpp
index 0c84483b3ad..27edc2acfd5 100644
--- a/src/mame/drivers/dec0.cpp
+++ b/src/mame/drivers/dec0.cpp
@@ -51,7 +51,7 @@ ToDo:
- Get rid of ROM patches in Sly Spy and Hippodrome;
- background pen in Birdie Try is presumably wrong.
- Pixel clock frequency isn't verified;
-- Finally, get a proper decap of the MCUs used by Drangonninja and Birdie Try;
+- Finally, get a proper decap of the MCUs used by Dragonninja and Birdie Try;
Bad Dudes MCU dump came from an MCU that had been damaged during a misguided
@@ -92,35 +92,54 @@ startup), $07 (same function as Bad Dudes) and $09 (same function as Bad
Dudes). Most of the MCU program isn't utilised.
+Guru-Readme for Data East 16 bit games (Updated 7-Feb-2017)
+
+Heavy Barrel
+Bad Dudes vs. Dragonninja
+Dragonninja
+Birdie Try
+Robocop
+Hippodrome
+Fighting Fantasy
+Secret Agent
+Sly Spy
+Midnight Resistance
+Boulderdash
+
+Heavy Barrel, Bad Dudes, Robocop, Birdie Try & Hippodrome/Fighting Fantasy use the 'MEC-M1'
+motherboard and another plug-in game board containing all the ROMs.
+Sly Spy, Midnight Resistance and Boulderdash use the same graphics chips but are single pcbs.
+
PCB Layouts
-----------
-Bad Dudes vs Dragonninja
-Data East, 1988
-
Main Board:
-This board is used with Heavy Barrel, Bad Dudes, Robocop, Birdie Try & Hippodrome
-DE-0297-3 (earlier version DE-0295-1 uses PGA custom chips)
-MEC-M1
+This board is used with Heavy Barrel, Bad Dudes, Robocop, Birdie Try & Hippodrome/Fighting Fantasy
+
+PCB number: MEC-M1 DE-0297-3 (uses QFP custom chips)
+or
+MEC-M1 DE-0295-1 (uses PGA custom chips)
+or
+DE-0289-2 (uses PGA custom chips and MEC-M1 not written on PCB)
|------------------------------------------------------------------|
| TMM2018 12MHz |
| TMM2018 |
-| TMM2018 MB7122 TC5565 |
+| TMM2018 MB7122 |
| TC5565 |
-| TMM2018 |
-| TMM2018 |
-| 20MHz MB7116 |
+| TC5565 |
+| MB7116 TMM2018 |
+| 20MHz TMM2018 |
|J RCDM-I1 |
-|A RCDM-I1 TMM2018 |---------| |
-|M RCDM-I1 |L7B0072 | |
-|M RCDM-I1 TMM2018 |DATAEAST | |
-|A RCDM-I1 |BAC 06 | |
-| RCDM-I1 TMM2018 |---------| |
-| DSW2 68000P10 TMM2018 |
-| DSW1 |---------| |---------| |
-| RP65C02 |L7B0073 | |L7B0072 | |
-|UPC3403 TC5565 |DATAEAST | |DATAEAST | |
+|A RCDM-I1 |---------| |
+|M RCDM-I1 TMM2018 |L7B0072 | |
+|M RCDM-I1 TMM2018 |DATAEAST | |
+|A RCDM-I1 TMM2018 |BAC 06 | |
+| RCDM-I1 |-------------| TMM2018 |---------| |
+| DSW2 | 68000P10 | |
+| DSW1 |-------------| |---------| |---------| |
+| |L7B0073 | |L7B0072 | |
+|UPC3403 TC5565 RP65C02 |DATAEAST | |DATAEAST | |
|CN4 YM3014 TC5565 TMM2018 |MXC 06 | |BAC 06 | |
|VOL YM3014 YM3812 |---------| |---------| |
|MB3730 YM2203 CN2 CN1 |
@@ -132,8 +151,8 @@ Notes:
YM3812 - Clock input 3.000MHz [12/4]
TMM2018 - 2k x8 SRAM
TC5565 - 8k x8 SRAM
- MB7122 - 1k x4 bipolar PROM
- MB7116 - 512b x4 bipolar PROM
+ MB7122 - 1k x4 bipolar PROM with label "A-2" at location E17
+ MB7116 - 512b x4 bipolar PROM with label "A-1" at location C12
RCDM-I1 - Custom resistor array
DSW1/2 - 8-position DIP switches
L7B007x - DECO custom graphics chips (QFP160 or PGA type)
@@ -144,26 +163,26 @@ Notes:
------------
VSync - 57.4162Hz
HSync - 15.6172kHz
- OSC1 - 20.00006MHz
- XTAL1 - 11.9938MHz
+ OSC1 - 20.00006MHz (20MHz)
+ XTAL1 - 11.9938MHz (12MHz)
+
+ROM Board Type 1:
-ROM Board:
-This board is used with Heavy Barrel, Bad Dudes & Birdie Try only.
-There is another type of ROM board used with Robocop & Hippodrome which
-is different (but not documented here)
+This board is used with Heavy Barrel, Bad Dudes & Birdie Try
+All ROMs are in sockets. Boards that do not use some positions
+do not have the socket populated (i.e. Bad Dudes)
-DE-0299-2 (earlier version DE-0293-2 uses PGA custom chips)
-MEC-M1
+DE-0299-2 (earlier version DE-0293-2 or DE-0293-1 uses PGA custom chips)
|-------------------------------------------------------|
-|C4558 CN2 7.8A CN1 |
-| 1.3A 2.4A 3.6A i8751 9.12A 10.14A 11.16A 12.17A|
-| M6295 8MHz |
-|CN9 |
+|C4558 CN2 7.8A CN1 |
+| 1.3A 2.4A 3.6A 9.12A 10.14A 11.16A 12.17A|
+| M6295 I8751_31.9A |
+|CN9 8MHz |
| |
| 4.3C 5.4C 6.6C 13.12C 14.14C 15.16C 16.17C|
+| 8.2C |
| |
-|8.2C |
| |---------| |
| |L7B0072 | TMM2018 |
|CN5 |DATAEAST |17.12D 18.14D 19.16D 20.17D|
@@ -172,31 +191,140 @@ MEC-M1
|CN6 |
| 21.12F 22.14F 23.16F 24.17F|
| 27.7F 28.9F |
-|CN7 |
-| |
-| |
+|CN7 D4701 |
+| LA6339 |
+| LA6339 D4701 |
|CN8 29.7J 30.9J 25.15J 26.16J |
|-------------------------------------------------------|
Notes:
- i8751 - intel 8751 microcontroller, clock input 8.000MHz
+ i8751 - Intel 8751 microcontroller, clock input 8.000MHz
M6295 - Clock 1.000MHz [20/2/10], pin 7 HIGH
- L7B0072 - DECO custom graphics chip (QFP160 or PGA type)
+ L7B0072 - DECO custom graphics chip (QFP160 or PGA type). Populated on ALL PCBs even if not used.
+ If ROMs 27/28/29 & 30 are not populated this chip is not used
TMM2018 - 2k x8 SRAM
+ C4558 - NEC C4558 Dual Op Amp
+ LA6339 - Sanyo LA6339 High Performance Quad Comparator
+ D4701 - NEC uPD4701 X,Y 2-axis Incremental Encoder Counter
CN1/2 - 96-pin connectors joining to Main Board
- CN5/6/7/8 - Connectors for other inputs/buttons (these are not populated on
- Bad Dudes but are used with Birdie Try/Heavy Barrel etc)
+ CN5/6 - Connectors for other inputs/buttons. Not populated on Bad Dudes.
+ Used for the rotary joysticks on Heavy Barrel
+ CN7/8 - Connectors for trackball inputs for player 1 and player 2. Not populated on Bad Dudes or Heavy Barrel.
+ Used for trackballs on Birdie Try
CN9 - 6-pin cable joining to Main Board
-
ROMs - All ROM locations shown but not all are populated.
- All DECO games use a ROM code on the label....
+ All DECO games use a game code on the label....
- Bad Dudes = EI \
- Birdie Try = EK |
- Dragon Ninja = EG | These also change for different country/regions
- - Heavy Barrel = EC /
+ - Heavy Barrel = EC / Some Heavy Barrel boards only have numbers on the stickers
All ROMs are 27512/27256 EPROM/maskROM
- All ROMs have a number location on the board next to the chip. The chips
- can also be referenced via the numbers & letters on the side of the board.
- For example, both of these are the same chip.... EI30.30 or EI30.9J
+ All ROMs have a number location on the board next to the chip and that same number is used
+ as part of the ROM label. The chips can also be referenced via the numbers & letters on the
+ side of the board. For example EI30.30 or EI30.9J. Both of these are the same chip and the
+ game code identifies the game, which in this case is Bad Dudes.
+
+ROM usage per game
+------------------
+ Location 3A 4A 6A 3C 4C 6C 8A 2C 12A 14A 16A 17A 12C 14C 16C 17C 12D 14D 16D 17D 12F 14F 16F 17F 15J 16J 7F 9F 7J 9J 9A
+Game 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+Birdie Try EK01 EK02 EK03 EK04 EK05 EK06 EK07 EK08 EK09 EK10 EK11 EK12 EK13 EK14 EK15 EK16 EK17 EK18 EK19 EK20 EK21 EK22 EK23 EK24 EK25 EK26 - - - - EK31-1
+Bad Dudes EI01 - EI03 EI04 - EI06 EI07 EI08 EI09 EI10 EI11 EI12 EI13 EI14 EI15 EI16 - EI18 - EI20 - EI22 - EI24 EI25 EI26 - EI28 - EI30 EI31
+Dragon Ninja EG01 - EG03 EG04 - EG06 EG07 EG08 EG09 EG10 EG11 EG12 EG13 EG14 EG15 EG16 - EG18 - EG20 - EG22 - EG24 EG25 EG26 - EG28 - EG30 EG31
+Heavy Barrel EC01 EC02 EC03 EC04 EC05 EC06 EC07 EC08 EC09 EC10 EC11 EC12 EC13 EC14 EC15 EC16 EC17 EC18 EC19 EC20 EC21 EC22 EC23 EC24 EC25 EC26 EC27 EC28 EC29 EC30 EC31
+
+Note the games can be converted by swapping all of the ROMs and MCU. For example on a Birdie Try PCB, when the
+ROMs are swapped for the 'hbarrel' set from MAME, the board will run Heavy Barrel. I can confirm the MCU dump
+from the 'hbarrel' MAME ROM set (HB31.9A) and 'baddudes' MAME ROM set (EI31.9A) works fine on the real PCB.
+
+
+ROM Board Type 2:
+
+This board is used with Hippodrome & Fighting Fantasy
+
+DE-0318-4
+|-------------------------------------------------------|
+| CN2 CN1 |
+| |
+| EX00.B1 EX04.C1 |
+|CN4 |
+| EX01-3.B3 PZ-1.C3 EX13.F3 EX18.G3 |
+| |
+| EX02-3.B4 EX05.C4 EX14.F4 EX19.G4 |
+| |
+| EX03.B5 EX06.C5 EX10.D5 EX15.F5 EX20.G5 |
+| |
+| M6295 EX07.C6 EX11.D6 EX16.F6 EX21.G6 |
+| 4558 EX12.D8 EX17.F8 EX22.G8 |
+||--| TMM2018 |
+|| | |---------| TMM2018 EX23.G10|
+||49| | 47 | |---------| |
+|| | |---------| |L7B0072 | EX24.G11|
+|| | TMM2063 |DATAEAST | |
+||--| 21.4772MHz |BAC 06 | EX25.G13|
+| |---| EX08.C15 |---------| |
+| C1060 | 45| |
+|-----------|---|---------------------------------------|
+Notes:
+ 49 - Unknown DIP40 ASIC (no clock input so not an MCU)
+ 47 - Unknown SDIP52 ASIC (no clock input so not an MCU)
+ 45 - HuC6280 sound CPU in disguise as Data East custom chip #45. Clock input 21.4772MHz on pin 10
+ M6295 - Clock 1.000MHz [20/2/10], pin 7 HIGH
+ 4558 - NEC C4558 Dual Op Amp
+ C1060 - NEC uPC1060C 2.5V High Precision Reference Voltage Circuit
+ L7B0072 - DECO custom graphics chip (QFP160)
+ TMM2018 - 2k x8 SRAM
+ TMM2063 - 8k x8 SRAM
+ PZ-1.C3 - MMI PAL16L8 marked "PZ-1"
+ CN1/2 - 96-pin connectors joining to Main Board
+ CN4 - 6-pin cable joining to Main Board
+ ROMs - All ROMs are 27512/27256 EPROM/maskROM
+ All ROMs have a number location under the chip and that same number is used
+ as part of the ROM label. The chips can also be referenced via the numbers
+ & letters on the side of the board. For example EX25.G13 or EX25.25 are the
+ same chip. Game code on the ROM labels for Hippodrome/Fighting Fantasy is
+ EV, EW or EX.
+
+
+ROM Board Type 3:
+
+This board is used only with Robocop
+
+DE-0316-4
+|-------------------------------------------------------|
+| CN2 CN1 |
+|4558 PZ-1.B15 |
+| EP03-3.C14 EP06.E14 EP10.F14 |
+|CN4 |
+| EP00-3.B13 EP07.E13 EP11.F13 EP18.H13|
+|M6295 |
+| EP01-4.B12 EP04-3.C12 EP08.E12 EP12.F12 EP19.H12|
+| |
+| EP02.B11 EP05-4.C11 EP09.E11 EP13.F11 EP20.H11|
+| TMM2063 |
+| PZ-0.A9 TMM2063 EP21.H10|
+| |
+| 21.4772MHz |---------| EP14.F7 EP22.H7 |
+| |------| |L7B0072 | EP23.H6 |
+| |DEC-01| |DATAEAST | EP15.F4 |
+| | | |BAC 06 | |
+| |------| |---------| |---------| EP16.F3 |
+| 2018 | DEM-01 | |
+| |---------| EP17.F2 |
+| PZ-2.A2 |
+|-------------------------------------------------------|
+Notes:
+ DEM-01 - Unknown SDIP52 ASIC (no clock input so not an MCU, decapping it found only ASIC, no ROM)
+ DEC-01 - HuC6280 sound CPU in disguise as Data East custom chip DEC-01. Clock input 21.4772MHz on pin 10
+ M6295 - Clock 1.000MHz [20/2/10], pin 7 HIGH
+ 4558 - NEC C4558 Dual Op Amp
+ L7B0072 - DECO custom graphics chip (QFP160)
+ TMM2018 - 2k x8 SRAM
+ TMM2063 - 8k x8 SRAM
+ PZ-* - MMI PAL16L8 PALs
+ CN1/2 - 96-pin connectors joining to Main Board
+ CN4 - 6-pin cable joining to Main Board
+ ROMs - All ROMs are 27512/27256 EPROM/maskROM
***************************************************************************/
diff --git a/src/mame/drivers/deco_mlc.cpp b/src/mame/drivers/deco_mlc.cpp
index 174e93c8474..e9761f99b75 100644
--- a/src/mame/drivers/deco_mlc.cpp
+++ b/src/mame/drivers/deco_mlc.cpp
@@ -575,6 +575,11 @@ MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( mlc_5bpp, mlc )
MCFG_GFXDECODE_MODIFY("gfxdecode", 5bpp)
+
+ // TODO: mono? ch.0 doesn't output any sound in-game
+ MCFG_SOUND_MODIFY("ymz")
+ MCFG_SOUND_ROUTE(1, "lspeaker", 1.0)
+ MCFG_SOUND_ROUTE(0, "rspeaker", 1.0)
MACHINE_CONFIG_END
/***************************************************************************/
diff --git a/src/mame/drivers/decocass.cpp b/src/mame/drivers/decocass.cpp
index dab345ae431..a9e92724ab0 100644
--- a/src/mame/drivers/decocass.cpp
+++ b/src/mame/drivers/decocass.cpp
@@ -14,23 +14,30 @@
The Dumping Union
Team Japump!!!
Hau
+ Jean-Francois Del Nero
+ Omar Cornut
+ Game Preservation Society
+ Joseph Redon
The DECO cassette system consists of three PCBS in a card cage:
Early boardset: (1980-1983) (proms unknown for this boardset, no schematics for this boardset)
One DE-0069C-0 RMS-3 pcb with a 6502 processor, D8041C MCU (DECO Cassette control), two ay-3-8910s, and one 2708 eprom holding the audio bios. (audio, needs external amp and volume control)
- One DE-0068B-0 DSP-3 pcb with a 'DECO CPU-3' custom, two 2716 eproms (main processor and bios, graphics, dipswitches?)
- One DE-0070C-0 BIO-3 pcb with an analog ADC0908 8-bit adc
+ One DE-0068B-0 DSP-3 pcb with a 'DECO CPU-3' custom, two 2716 eproms. (main processor and bios, graphics, dipswitches?)
+ One DE-0070C-0 BIO-3 pcb with an analog ADC0908 8-bit adc.
One DE-0066B-0 card rack board that the other three boards plug into.
- TODO: get more info about this older boardset: D. Widel has some info about it on his page at http://www.widel.com/stuff/decopin.htm
+ This boardset has two versions : MD, known as "shokase" in Japan, and MT, known as "daikase" which is using bigger data tapes. (MT was only sold in Japan, not emulated yet)
- Later boardset: (1984 onward, schematic is dated 10/83)
+ Later boardset: (1984 onward, schematic is dated October 1983)
One DE-0097C-0 RMS-8 pcb with a 6502 processor, two ay-3-8910s, two eproms (2716 and 2732) plus one prom, and 48k worth of 4116 16kx1 DRAMs; the 6502 processor has its own 4K of SRAM. (audio processor and RAM, Main processor's dram, dipswitches)
One DE-0096C-0 DSP-8 board with a 'DECO 222' custom on it (labeled '8049 // C10707-2') which appears to really be a 'cleverly' disguised 6502, and two proms, plus 4K of sram, and three hm2511-1 1kx1 srams. (main processor and graphics)
- One DE-0098C-0 B10-8 (BIO-8 on schematics) board with an 8041, an analog devices ADC0908 8-bit adc, and 4K of SRAM on it (DECO Cassette control, inputs)
- One DE-0109C-0 card rack board that the other three boards plug into.
+ One DE-0098C-0 B10-8 (BIO-8 on schematics) board with an 8041, an analog devices ADC0908 8-bit adc, and 4K of SRAM on it. (DECO Cassette control, inputs)
+ One DE-0109C-0 card rack board that the other three boards plug into. (fourth connector for DE-109C-0 is shorter than in earlier versions)
The actual cassettes use a custom player hooked to the BIO board, and are roughly microcassette form factor, but are larger and will not fit in a conventional microcassette player.
- Each cassette has two tracks on it: a clock track and a data track, for a form of synchronous serial. The data is stored in blocks with headers and checksums.
+ Each cassette has one track on it and is separated into clock and data by two Magtek IC in the player, for a form of synchronous serial.
+ The data is stored in blocks with headers and CRC16 checksums.
+ The first block contains information such as the region (A:Japan, B:USA, C:UK, D:Europe) and the total number of blocks left to read.
+ The last physical block on the cassette is a dummy block not used by the system. (only used to mark the end of last block)
***********************************************************************/
@@ -656,6 +663,26 @@ static INPUT_PORTS_START( cfishing )
/* Switches 5, 6, 7 & 8 are listed as "Not Used" and "Don't Change" */
INPUT_PORTS_END
+static INPUT_PORTS_START( cfboy0a1 ) /* 12 */
+ PORT_INCLUDE( decocass )
+
+ PORT_MODIFY("DSW2")
+ PORT_DIPNAME( 0x01, 0x01, "Number of The Deco Kids" ) PORT_DIPLOCATION("SW2:1")
+ PORT_DIPSETTING( 0x01, "3" )
+ PORT_DIPSETTING( 0x00, "5" )
+ PORT_DIPNAME( 0x06, 0x06, "Bonus Points" ) PORT_DIPLOCATION("SW2:2,3")
+ PORT_DIPSETTING( 0x06, "5000" )
+ PORT_DIPSETTING( 0x04, "10000" )
+ PORT_DIPSETTING( 0x02, "15000" )
+ PORT_DIPSETTING( 0x00, DEF_STR( None ) )
+ PORT_DIPNAME( 0x08, 0x08, "Number of Alien Missiles" ) PORT_DIPLOCATION("SW2:4")
+ PORT_DIPSETTING( 0x08, DEF_STR( Easy ) )
+ PORT_DIPSETTING( 0x00, DEF_STR( Difficult ) )
+ PORT_DIPNAME( 0x10, 0x10, "Alien Craft Movement" ) PORT_DIPLOCATION("SW2:5")
+ PORT_DIPSETTING( 0x10, DEF_STR( Easy ) )
+ PORT_DIPSETTING( 0x00, DEF_STR( Difficult ) )
+ /* Switches 6 to 8 are shown as "Country Code" (A to F) and "Don't Change" */
+INPUT_PORTS_END
static const gfx_layout charlayout =
{
@@ -866,6 +893,13 @@ static MACHINE_CONFIG_DERIVED( clocknch, decocass )
MACHINE_CONFIG_END
+static MACHINE_CONFIG_DERIVED( cfboy0a1, decocass ) /* 12 */
+
+ /* basic machine hardware */
+ MCFG_MACHINE_RESET_OVERRIDE(decocass_state,cfboy0a1)
+MACHINE_CONFIG_END
+
+
static MACHINE_CONFIG_DERIVED( cprogolf, decocass )
/* basic machine hardware */
@@ -1237,6 +1271,17 @@ ROM_START( clocknch )
ROM_LOAD( "clocknch.cas", 0x0000, 0x8000, CRC(c9d163a4) SHA1(3ef55a8d8f603059e263776c08eb81f2cf18b75c) )
ROM_END
+/* 12 Flash Boy (early vertical Japan version, then horizontal version), The Deco Kid (early vertical World version, then vertical version) */
+ROM_START( cfboy0a1 ) // version MD 0-A-1 verified, 105 blocks, decrypted main data CRC(7ca358f0)
+ DECOCASS_BIOS_AO_ROMS
+
+ ROM_REGION( 0x10000, "cassette", 0 ) /* (max) 64k for cassette image */
+ ROM_LOAD( "dt-1120-a-1.cas", 0x0000, 0x6a00, CRC(c6746dc0) SHA1(816ccb61dfa2745a9ef918d9a50d1cd91493c9ed) )
+
+ ROM_REGION( 0x00020, "dongle", 0 ) /* dongle data */
+ ROM_LOAD( "dp-1120-a.rom", 0x0000, 0x0020, CRC(1bc9fccb) SHA1(ffc59c7660d5c87a8deca294f80260b6bc7c3027) )
+ROM_END
+
/* 13 */
/* Photo of Dongle shows DP-1130B (the "B" is in a separate white box then the DP-1130 label) */
ROM_START( cprogolf ) // version 9-B-0
@@ -1788,7 +1833,7 @@ DRIVER_INIT_MEMBER(decocass_state,cdsteljn)
/* 10 */ GAME( 1981, cocean1a, decocass, cocean1a, cocean1a, decocass_state, decocass, ROT270, "Data East Corporation", "Ocean to Ocean (Medal) (DECO Cassette MD) (No.10/Ver.1,Japan)", 0 ) /* no lever, 1P/2P buttons used to switch player, cocktail mode not emulated */
/* */ GAME( 1981, cocean6b, cocean1a, cocean1a, cocean1a, decocass_state, decocass, ROT270, "Data East Corporation", "Ocean to Ocean (Medal) (DECO Cassette MD) (No.10/Ver.6,US)", 0 ) /* lever, 1P/2P buttons used to switch player, cocktail mode not emulated */
/* 11 */ GAME( 1981, clocknch, decocass, clocknch, clocknch, decocass_state, decocass, ROT270, "Data East Corporation", "Lock'n'Chase (DECO Cassette) (US)", 0 )
-/* 12 */ // 1981.08 Flash Boy/DECO Kid
+/* 12 */ GAME( 1981, cfboy0a1, decocass, cfboy0a1, cfboy0a1, decocass_state, decocass, ROT270, "Data East Corporation", "Flash Boy (vertical) [DECO Cassette MD] (No.12/Ver.0/Set.1,Japan)", 0 )
/* 13 */ GAME( 1981, cprogolf, decocass, cprogolf, cprogolf, decocass_state, decocass, ROT270, "Data East Corporation", "Tournament Pro Golf (DECO Cassette) (US)", 0 )
/* */ GAME( 1981, cprogolfj, cprogolf, cprogolfj,cprogolf, decocass_state, decocass, ROT270, "Data East Corporation", "Tournament Pro Golf (DECO Cassette) (Japan)", 0 )
/* 14 */ GAME( 1981, cdsteljn, decocass, cdsteljn, cdsteljn, decocass_state, cdsteljn, ROT270, "Data East Corporation", "DS Telejan (DECO Cassette) (Japan)", 0 )
diff --git a/src/mame/drivers/ep64.cpp b/src/mame/drivers/ep64.cpp
index a1b9c94f4c2..f094b9dba0d 100644
--- a/src/mame/drivers/ep64.cpp
+++ b/src/mame/drivers/ep64.cpp
@@ -151,7 +151,7 @@ Notes: (All IC's shown)
#include "emu.h"
#include "softlist.h"
-#include "audio/dave.h"
+#include "sound/dave.h"
#include "bus/rs232/rs232.h"
#include "bus/ep64/exp.h"
#include "cpu/z80/z80.h"
diff --git a/src/mame/drivers/equites.cpp b/src/mame/drivers/equites.cpp
index 4c108332c09..c07d0c42c7d 100644
--- a/src/mame/drivers/equites.cpp
+++ b/src/mame/drivers/equites.cpp
@@ -781,7 +781,7 @@ static INPUT_PORTS_START( gekisou )
PORT_START("IN1")
PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_COIN1 )
PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_COIN2 )
- PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_SERVICE) PORT_NAME("Settings") PORT_CODE(KEYCODE_F1)
+ PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_SERVICE ) // settings
PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_UNKNOWN )
diff --git a/src/mame/drivers/esd16.cpp b/src/mame/drivers/esd16.cpp
index 75483cb0372..5dad197c838 100644
--- a/src/mame/drivers/esd16.cpp
+++ b/src/mame/drivers/esd16.cpp
@@ -23,6 +23,7 @@ Year + Game PCB Notes
98 Multi Champ ESD 11-09-98 (also a year 1999 revision)
99 Multi Champ Deluxe ESD 08-26-1999 (also a year 2000 revision)
99 Head Panic ESD 05-28-99 (All English version, copyright 1999)
+99 Head Panic ESD 06-10-1999 (All English version, copyright 1999)
00 Head Panic ESD 08-26-1999 (All English version, copyright 2000)
00 Head Panic ESD 08-26-1999 (with Fuuki, Story in Japanese)
00 Deluxe 5 ESD (no date is marked on PCB)
@@ -1026,7 +1027,7 @@ Notes:
2x pushbutton
-ESD 08-26-1999
+ESD 08-26-1999 (ESD 06-10-1999 nearly identical)
|-----------------------------------------|
| 3014 3812 6116 6295 ESD4 |
|VOL ESD3 Z80 * |
@@ -1121,6 +1122,33 @@ ROM_START( hedpanicf ) /* Story line in Japanese, game instructions in English *
ROM_END
+ROM_START( hedpanica ) /* Story line & game instructions in English, copyright year is 1999 - ESD 06-10-1999 PCB */
+ ROM_REGION( 0x080000, "maincpu", 0 ) /* 68000 Code */
+ ROM_LOAD16_BYTE( "esd12.cu03", 0x000000, 0x040000, CRC(deb7e0a0) SHA1(ef3a00e9bfdffd7c89326ad97a261f9a7b9863ae) ) /* CU03 */
+ ROM_LOAD16_BYTE( "esd11.cu02", 0x000001, 0x040000, CRC(e1418f23) SHA1(39f14172d9b1a0d47edfe2456362fddc22f60066) ) /* CU02 */
+
+ ROM_REGION( 0x40000, "audiocpu", 0 ) /* Z80 Code */
+ ROM_LOAD( "esd3.su06", 0x00000, 0x40000, CRC(a88d4424) SHA1(eefb5ac79632931a36f360713c482cd079891f91) ) /* AT27C020 mask rom */
+
+ ROM_REGION( 0x600000, "spr", 0 ) /* Sprites, 16x16x5 */
+ ROM_LOAD( "ju04", 0x200000, 0x200000, CRC(4f3503d7) SHA1(4bed795c7328e0ebfa97688918eb8a908c29deb8) )
+ ROM_LOAD( "ju06", 0x000000, 0x200000, CRC(9f6f6193) SHA1(c7c7ae6898ab7177eefb0e525d827666e2af9f7e) )
+ /* expand this to take up 0x200000 bytes too so we can decode it */
+ ROM_LOAD16_BYTE( "esd5.bin", 0x400000, 0x080000, CRC(6968265a) SHA1(84b4f2d8b3bf6ea4117fa8281c76b58df778261d) ) /* JU07 */
+ ROM_FILL( 0x500000, 0x100000, 0x00 )
+
+ ROM_REGION( 0x400000, "bgs", 0 ) /* Layers, 16x16x8 */
+ ROM_LOAD16_BYTE( "fu35", 0x000000, 0x200000, CRC(9b5a45c5) SHA1(fbd8bc6ccc068d2cc7fe4f575fa0847f53e786ab) )
+ ROM_LOAD16_BYTE( "fu34", 0x000001, 0x200000, CRC(8f2099cc) SHA1(40795ae5fb8de613c2d5b6147992c153695bf698) )
+
+ ROM_REGION( 0x80000, "oki", 0 ) /* Samples */
+ ROM_LOAD( "esd4.bin", 0x000000, 0x080000, CRC(5692fe92) SHA1(4423039cb437ab36d198b212ef394bf1704be404) ) /* SU10 */
+
+ ROM_REGION16_BE( 0x80, "eeprom", 0 )
+ ROM_LOAD( "hedpanic.nv", 0x0000, 0x0080, CRC(e91f4038) SHA1(f492de71170900f87912a272ab4f4a3a37ba31fe) )
+ROM_END
+
+
ROM_START( hedpanico ) /* Story line & game instructions in English, copyright year is 1999 - ESD 05-28-99 PCB which uses older style sprites */
ROM_REGION( 0x080000, "maincpu", 0 ) /* 68000 Code */
ROM_LOAD16_BYTE( "esd2.rom", 0x000000, 0x040000, CRC(70b08424) SHA1(2ba4fb3b749e31db4239a9173b8509366400152f) ) /* CU03 */
@@ -1600,6 +1628,9 @@ GAME( 2001, jumppope, jumppop, jumppop, jumppop, driver_device, 0, ROT0, "Ema
/* ESD 05-28-99 */
GAME( 1999, hedpanico,hedpanic, hedpanio, hedpanic, driver_device, 0, ROT0, "ESD", "Head Panic (ver. 0615, 15/06/1999)", MACHINE_SUPPORTS_SAVE )
+/* ESD 06-10-1999 */
+GAME( 1999, hedpanica,hedpanic, hedpanic, hedpanic, driver_device, 0, ROT0, "ESD", "Head Panic (ver. 0702, 02/07/1999)", MACHINE_SUPPORTS_SAVE )
+
/* ESD 08-26-1999 */
GAME( 2000, mchampdx, 0, mchampdx, hedpanic, driver_device, 0, ROT0, "ESD", "Multi Champ Deluxe (ver. 0106, 06/01/2000)", MACHINE_SUPPORTS_SAVE )
GAME( 1999, mchampdxa,mchampdx, mchampdx, hedpanic, driver_device, 0, ROT0, "ESD", "Multi Champ Deluxe (ver. 1126, 26/11/1999)", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/fccpu20.cpp b/src/mame/drivers/fccpu20.cpp
index 2def86c02a8..bc32d103f09 100644
--- a/src/mame/drivers/fccpu20.cpp
+++ b/src/mame/drivers/fccpu20.cpp
@@ -177,12 +177,6 @@ MACHINE_CONFIG_END
/* ROM configurations */
ROM_START(fccpu20sbc) ROM_END
-ROM_START(fccpu21ssbc) ROM_END
-ROM_START(fccpu21sbc) ROM_END
-ROM_START(fccpu21asbc) ROM_END
-ROM_START(fccpu21yasbc) ROM_END
-ROM_START(fccpu21bsbc) ROM_END
-ROM_START(fccpu21ybsbc) ROM_END
/* Boards supported by same rom set, need to do like this to avoid need for multi named rom sets */
#define rom_fccpu21ssbc rom_fccpu20sbc
diff --git a/src/mame/drivers/firetrk.cpp b/src/mame/drivers/firetrk.cpp
index 6faf9916048..7a465d04edd 100644
--- a/src/mame/drivers/firetrk.cpp
+++ b/src/mame/drivers/firetrk.cpp
@@ -434,7 +434,7 @@ static INPUT_PORTS_START( firetrk )
PORT_DIPNAME( 0x40, 0x40, DEF_STR( Cabinet ))
PORT_DIPSETTING( 0x00, "Smokey Joe (1 Player)" )
PORT_DIPSETTING( 0x40, "Fire Truck (2 Players)" )
- PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SERVICE ) PORT_NAME("Diag Hold") PORT_CODE(KEYCODE_F6)
+ PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SERVICE2 ) PORT_NAME("Diag Hold")
PORT_START("BIT_7")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
@@ -444,7 +444,7 @@ static INPUT_PORTS_START( firetrk )
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_COIN1 )
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN2 )
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, firetrk_state,crash_r, (void *)2)
- PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SERVICE ) PORT_NAME("Diag Step") PORT_CODE(KEYCODE_F1)
+ PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_NAME("Diag Step")
PORT_START("HORN")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Horn") PORT_PLAYER(1) PORT_CHANGED_MEMBER(DEVICE_SELF, firetrk_state,firetrk_horn_changed, 0)
diff --git a/src/mame/drivers/galgames.cpp b/src/mame/drivers/galgames.cpp
new file mode 100644
index 00000000000..bccfdad9116
--- /dev/null
+++ b/src/mame/drivers/galgames.cpp
@@ -0,0 +1,1161 @@
+// license:BSD-3-Clause
+// copyright-holders:Luca Elia
+/***************************************************************************
+
+ -= Galaxy Games =-
+
+ driver by Luca Elia (l.elia@tin.it)
+
+
+CPU: 68000
+Video: Blitter with two layers and double buffering (Xilinx FPGA)
+Sound: OKI M6295
+Input: Trackballs and buttons
+Other: EEPROM
+Carts: EEPROM + Flash + PIC
+
+To Do:
+
+- Coin optics
+
+Notes:
+
+- 4 known game carts where produced, these are:
+
+ Star Pak 1: Seek the Peaks, 21 Thunder, Solar Solitaire, Prism Poker, Pharaoh's Tomb, Black Jack,
+ Twenty One Thunder Plus, Power Pairs, Prism Poker Plus & Have A Cow
+ Star Pak 2: Pack-Man, Ms.Pac-Man, Pharaoh's Tomb, Solar Solitaire, Power Pairs, Seek The peeks & Have A Cow
+ Star Pak 3: Centipede, Great Wall, Ker-Chunk, Diamond Derby, Word Sleuth, Pull!, Astro Blast & Sweeper
+ Star Pak 4: Berzerk, Neon Nightmare, Battle Checkers, Orbit, Deep Sea Shadow, Star Tiger & Orbit Freefall
+
+- Allegedly there is a hard lock that SP1 and the PAC-MAN games (on SP2) cannot play together. Was a licensing issue with Namco.
+ The system checks for cartridges on power up by querying the PIC parts. If the system sees SP1 & SP2 it disables SP2.
+
+***************************************************************************/
+
+#include "emu.h"
+#include "cpu/m68000/m68000.h"
+#include "cpu/pic16c5x/pic16c5x.h"
+#include "machine/eepromser.h"
+#include "machine/watchdog.h"
+#include "sound/okim6295.h"
+#include "video/cesblit.h"
+
+/***************************************************************************
+
+ Galgames Cart Device
+
+ Each cartridge contains a PIC, that provides, among other things, a 32-byte
+ response starting with "CES1997", followed by the contents of the cart rom
+ at some fixed addresses.
+
+***************************************************************************/
+
+class galgames_slot_device;
+
+// CART declaration
+
+class galgames_cart_device : public device_t,
+ public device_rom_interface
+{
+public:
+ // construction/destruction
+ galgames_cart_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+ // static configuration
+ static void static_set_cart(device_t &device, uint8_t cart) { downcast<galgames_cart_device &>(device).m_cart = cart; }
+ static void static_set_pic_bits(device_t &device, int clk, int in, int out, int dis) { downcast<galgames_cart_device &>(device).set_pic_bits(clk, in, out, dis); }
+
+ // ROM
+ DECLARE_READ16_MEMBER(rom_r) { return read_word(offset*2); }
+
+ // EEPROM
+ DECLARE_READ8_MEMBER(eeprom_r);
+ DECLARE_WRITE8_MEMBER(eeprom_w);
+ DECLARE_WRITE_LINE_MEMBER(eeprom_cs_write);
+
+ // PIC
+ DECLARE_READ8_MEMBER(pic_status_r);
+ DECLARE_WRITE8_MEMBER(pic_data_w);
+ DECLARE_READ8_MEMBER(pic_data_r);
+ void set_pic_reset_line(int state);
+
+ DECLARE_READ8_MEMBER(int_pic_data_r);
+ DECLARE_WRITE8_MEMBER(int_pic_data_w);
+ DECLARE_WRITE8_MEMBER(int_pic_bank_w);
+
+protected:
+ // device-level overrides
+ virtual void device_start() override { }
+ virtual void device_reset() override;
+ virtual void rom_bank_updated() override { }
+
+ bool is_selected();
+
+ machine_config_constructor m_mconfig_additions;
+ uint8_t m_cart;
+
+ // SLOT
+ required_device<galgames_slot_device> m_slot;
+
+ // EEPROM
+ optional_device<eeprom_serial_93cxx_device> m_eeprom;
+
+ // PIC
+ optional_device<pic16c5x_device> m_pic;
+
+ uint8_t m_pic_iobits, m_pic_data, m_pic_data_rdy, m_pic_data_bit, m_pic_data_clk;
+ uint8_t m_pic_clk_mask, m_pic_in_mask, m_pic_out_mask, m_pic_dis_mask;
+
+ void set_pic_bits(int clk, int in, int out, int dis);
+ void log_cart_comm(const char *text, uint8_t data);
+ void pic_comm_reset();
+};
+
+// device type definition
+const device_type GALGAMES_CART = &device_creator<galgames_cart_device>;
+
+#define MCFG_GALGAMES_CART_INDEX(_cart) \
+ galgames_cart_device::static_set_cart(*device, _cart);
+
+#define MCFG_GALGAMES_PIC_BITS(_clk, _in, _out, _dis) \
+ galgames_cart_device::static_set_pic_bits(*device, _clk, _in, _out, _dis);
+
+#define MCFG_GALGAMES_EMPTY_CART_ADD(_tag, _cart) \
+ MCFG_DEVICE_ADD(_tag, GALGAMES_CART, 0) \
+ MCFG_GALGAMES_CART_INDEX(_cart)
+
+
+
+// BIOS "cart"
+
+static MACHINE_CONFIG_FRAGMENT( bios )
+ MCFG_EEPROM_SERIAL_93C76_8BIT_ADD("eeprom")
+MACHINE_CONFIG_END
+
+class galgames_bios_cart_device : public galgames_cart_device
+{
+public:
+ // construction/destruction
+ galgames_bios_cart_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ galgames_cart_device(mconfig, tag, owner, clock)
+ { }
+protected:
+ // device-level overrides
+ virtual machine_config_constructor device_mconfig_additions() const override { return MACHINE_CONFIG_NAME(bios); }
+};
+
+const device_type GALGAMES_BIOS_CART = &device_creator<galgames_bios_cart_device>;
+
+#define MCFG_GALGAMES_BIOS_CART_ADD(_tag, _cart) \
+ MCFG_DEVICE_ADD(_tag, GALGAMES_BIOS_CART, 0) \
+ MCFG_GALGAMES_CART_INDEX(_cart)
+
+
+
+// STARPAK2 cart
+
+static MACHINE_CONFIG_FRAGMENT( starpak2 )
+ MCFG_CPU_ADD("pic", PIC16C56, XTAL_4MHz) // !! PIC12C508 !! 4MHz internal RC oscillator (selected by the configuration word)
+ MCFG_PIC16C5x_READ_B_CB( READ8( galgames_cart_device, int_pic_data_r))
+ MCFG_PIC16C5x_WRITE_B_CB(WRITE8(galgames_cart_device, int_pic_data_w))
+
+ MCFG_EEPROM_SERIAL_93C76_8BIT_ADD("eeprom")
+MACHINE_CONFIG_END
+
+class galgames_starpak2_cart_device : public galgames_cart_device
+{
+public:
+ // construction/destruction
+ galgames_starpak2_cart_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ galgames_cart_device(mconfig, tag, owner, clock)
+ { }
+protected:
+ // device-level overrides
+ virtual machine_config_constructor device_mconfig_additions() const override { return MACHINE_CONFIG_NAME(starpak2); }
+};
+
+const device_type GALGAMES_STARPAK2_CART = &device_creator<galgames_starpak2_cart_device>;
+
+#define MCFG_GALGAMES_STARPAK2_CART_ADD(_tag, _cart) \
+ MCFG_DEVICE_ADD(_tag, GALGAMES_STARPAK2_CART, 0) \
+ MCFG_GALGAMES_CART_INDEX(_cart) \
+ MCFG_GALGAMES_PIC_BITS(5, 4, 2, 1)
+
+
+
+// STARPAK3 cart
+
+static MACHINE_CONFIG_FRAGMENT( starpak3 )
+ MCFG_CPU_ADD("pic", PIC16C56, XTAL_4MHz)
+ MCFG_PIC16C5x_WRITE_A_CB(WRITE8(galgames_cart_device, int_pic_bank_w))
+ MCFG_PIC16C5x_READ_B_CB( READ8( galgames_cart_device, int_pic_data_r))
+ MCFG_PIC16C5x_WRITE_B_CB(WRITE8(galgames_cart_device, int_pic_data_w))
+
+ MCFG_EEPROM_SERIAL_93C76_8BIT_ADD("eeprom")
+MACHINE_CONFIG_END
+
+class galgames_starpak3_cart_device : public galgames_cart_device
+{
+public:
+ // construction/destruction
+ galgames_starpak3_cart_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ galgames_cart_device(mconfig, tag, owner, clock)
+ { }
+protected:
+ // device-level overrides
+ virtual machine_config_constructor device_mconfig_additions() const override { return MACHINE_CONFIG_NAME(starpak3); }
+};
+
+const device_type GALGAMES_STARPAK3_CART = &device_creator<galgames_starpak3_cart_device>;
+
+#define MCFG_GALGAMES_STARPAK3_CART_ADD(_tag, _cart) \
+ MCFG_DEVICE_ADD(_tag, GALGAMES_STARPAK3_CART, 0) \
+ MCFG_GALGAMES_CART_INDEX(_cart) \
+ MCFG_GALGAMES_PIC_BITS(0, 2, 3, 4)
+
+
+
+/***************************************************************************
+
+ Galgames Slot Device
+
+***************************************************************************/
+
+// SLOT declaration
+
+class galgames_slot_device : public device_t,
+ public device_memory_interface
+{
+public:
+ // construction/destruction
+ galgames_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+ DECLARE_ADDRESS_MAP(slot_map, 16);
+
+ DECLARE_READ16_MEMBER(read) { return m_space->read_word(offset * 2, mem_mask); }
+ DECLARE_WRITE16_MEMBER(write) { m_space->write_word(offset * 2, data, mem_mask); }
+
+ // SLOT
+ DECLARE_WRITE8_MEMBER(cart_sel_w);
+ DECLARE_WRITE8_MEMBER(ram_sel_w);
+
+ // ROM
+ DECLARE_READ16_MEMBER(rom0_r);
+ DECLARE_READ16_MEMBER(rom_r);
+ DECLARE_READ16_MEMBER(rom0_or_ram_r);
+ DECLARE_READ16_MEMBER(rom_or_ram_r);
+ DECLARE_WRITE16_MEMBER(ram_w);
+
+ // PIC
+ DECLARE_READ8_MEMBER(pic_status_r);
+ DECLARE_WRITE8_MEMBER(pic_data_w);
+ DECLARE_READ8_MEMBER(pic_data_r);
+ void set_pic_reset_line(int state);
+
+ // EEPROM
+ DECLARE_READ8_MEMBER(eeprom_r);
+ DECLARE_WRITE8_MEMBER(eeprom_w);
+ DECLARE_WRITE_LINE_MEMBER(eeprom_cs_write);
+
+ uint8_t get_cart() const { return m_cart; }
+
+protected:
+
+ // device-level overrides
+ virtual void device_start() override;
+ virtual void device_reset() override;
+ virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_PROGRAM) const override { return (spacenum == AS_PROGRAM) ? &m_space_config: nullptr; }
+
+ address_space_config m_space_config;
+ address_space *m_space;
+
+ required_shared_ptr<uint16_t> m_ram;
+
+ required_device<galgames_cart_device> m_cart0;
+
+ required_device<galgames_cart_device> m_cart1;
+ required_device<galgames_cart_device> m_cart2;
+ required_device<galgames_cart_device> m_cart3;
+ required_device<galgames_cart_device> m_cart4;
+
+ void set_cart(int cart);
+ void reset_eeproms_except(int cart);
+
+ galgames_cart_device *m_carts[1+4];
+
+ uint8_t m_cart;
+ bool m_is_ram_active;
+};
+
+// device type definition
+const device_type GALGAMES_SLOT = &device_creator<galgames_slot_device>;
+
+#define MCFG_GALGAMES_SLOT_ADD(_tag) \
+ MCFG_DEVICE_ADD(_tag, GALGAMES_SLOT, 0)
+
+// CART implementation
+
+galgames_cart_device::galgames_cart_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ device_t(mconfig, GALGAMES_CART, "Galaxy Games StarPak Cartridge", tag, owner, clock, "starpak_cart", __FILE__),
+ device_rom_interface(mconfig, *this, 21, ENDIANNESS_BIG, 16),
+ m_mconfig_additions(nullptr),
+ m_cart(0),
+ m_slot(*this, "^slot"),
+ m_eeprom(*this, "eeprom"),
+ m_pic(*this, "pic")
+{
+}
+
+void galgames_cart_device::device_reset()
+{
+ pic_comm_reset();
+}
+
+bool galgames_cart_device::is_selected()
+{
+ return m_slot->get_cart() == m_cart;
+}
+
+void galgames_cart_device::set_pic_reset_line(int state)
+{
+ if (!m_pic)
+ return;
+
+// logerror("reset line = %x\n", state);
+
+ if (!m_pic->input_state(INPUT_LINE_RESET) && state)
+ pic_comm_reset();
+
+ m_pic->set_input_line(INPUT_LINE_RESET, state);
+}
+
+void galgames_cart_device::log_cart_comm(const char *text, uint8_t data)
+{
+// logerror("%s: comm %-10s %02x - data:%02x bit:%02x rdy:%x clk:%02x\n", machine().describe_context(),
+// text, data, m_pic_data, m_pic_data_bit, m_pic_data_rdy, m_pic_data_clk );
+
+// logerror("%s: comm %-10s %02x\n", machine().describe_context(), text, data );
+}
+
+void galgames_cart_device::pic_comm_reset()
+{
+ m_pic_iobits = m_pic_data = m_pic_data_rdy = m_pic_data_clk = 0;
+ m_pic_data_bit = 0xff;
+// logerror("%s: comm reset\n", machine().describe_context());
+}
+
+// External PIC status and data interface
+
+READ8_MEMBER(galgames_cart_device::pic_status_r)
+{
+ // bit 7 = data from the cart PIC can be read
+ return (is_selected() && (m_pic_data_rdy == 2)) ? 0x80 : 0;
+}
+
+READ8_MEMBER(galgames_cart_device::pic_data_r)
+{
+ if (is_selected())
+ {
+ m_pic_data_rdy = 0;
+ return m_pic_data;
+ }
+ return 0xff;
+}
+
+WRITE8_MEMBER(galgames_cart_device::pic_data_w)
+{
+ if (is_selected())
+ {
+ m_pic_data = data;
+ m_pic_data_rdy = 1;
+ m_pic_data_bit = 0xff;
+ m_pic_data_clk = 0;
+ log_cart_comm("EXT WRITE", data);
+ }
+}
+
+/*
+galgame2:
+ bit 0 = cleared at boot (never touched again)
+ bit 1 = PIC waits for it to become 0 before reading (or to become 1 when another byte is expected)
+ bit 2 = data out
+ bit 3 unused
+ bit 4 = data in
+ bit 5 = clock
+ bit 6 n.c.
+ bit 7 n.c.
+
+galgame3:
+ bit 0 = clock
+ bit 1 unused
+ bit 2 = data in
+ bit 3 = data out
+ bit 4 = PIC waits for it to become 0 before reading (or to become 1 when another byte is expected)
+ bit 5 = 0
+ bit 6 = 1
+ bit 7 unused
+*/
+void galgames_cart_device::set_pic_bits(int clk, int in, int out, int dis)
+{
+ m_pic_clk_mask = 1 << clk;
+ m_pic_in_mask = 1 << in;
+ m_pic_out_mask = 1 << out;
+ m_pic_dis_mask = 1 << dis;
+}
+
+READ8_MEMBER(galgames_cart_device::int_pic_data_r)
+{
+ // clock
+
+ uint8_t clk0 = m_pic_data_clk & 0x80;
+ m_pic_data_clk += 0x10;
+ uint8_t clk1 = m_pic_data_clk & 0x80;
+
+ m_pic_iobits = (m_pic_iobits & (~m_pic_clk_mask)) | (clk1 ? m_pic_clk_mask : 0);
+
+ // disabled
+
+ bool disabled = !is_selected();
+ m_pic_iobits = (m_pic_iobits & (~m_pic_dis_mask)) | (disabled ? m_pic_dis_mask : 0);
+
+ // The PIC waits for a falling edge before reading the new input bit.
+ // It waits for a rising edge before setting the new output bit.
+ // Hence we shift the data on the falling edge of the clock.
+
+ if (clk0 && !clk1)
+ {
+ uint8_t bit_in = 0;
+
+ if (m_pic_data_rdy == 1)
+ {
+ if (m_pic_data_bit == 0xff)
+ {
+ // first read bit must be 1 (sync)
+ bit_in = 1;
+ m_pic_data_bit = 7;
+ }
+ else
+ {
+ // read current bit and move to the next
+ bit_in = BIT(m_pic_data, m_pic_data_bit);
+ --m_pic_data_bit;
+
+ if (m_pic_data_bit == 0xff)
+ {
+ m_pic_data_rdy = 0;
+ log_cart_comm("PIC should have READ", m_pic_data);
+ }
+ }
+ }
+ else if (m_pic_data_rdy == 0)
+ {
+ uint8_t bit_out = m_pic_iobits & m_pic_out_mask;
+
+ if (m_pic_data_bit == 0xff)
+ {
+ // first written bit must be 1 (sync)
+ if (bit_out)
+ m_pic_data_bit = 7;
+ }
+ else
+ {
+ // write current bit and move to the next
+ uint8_t mask = 1 << m_pic_data_bit;
+ m_pic_data = (m_pic_data & (~mask)) | (bit_out ? mask : 0);
+ --m_pic_data_bit;
+
+ if (m_pic_data_bit == 0xff)
+ {
+ m_pic_data_rdy = 2;
+ log_cart_comm("PIC should have WRITTEN", m_pic_data);
+ }
+ }
+ }
+
+ m_pic_iobits = (m_pic_iobits & (~m_pic_in_mask)) | (bit_in ? m_pic_in_mask : 0);
+ }
+
+// log_cart_comm("PIC READ", m_pic_iobits);
+
+ return m_pic_iobits;
+}
+
+WRITE8_MEMBER(galgames_cart_device::int_pic_data_w)
+{
+ m_pic_iobits = (m_pic_iobits & (~m_pic_out_mask)) | (data & m_pic_out_mask);
+
+// log_cart_comm("PIC WRITE", data);
+}
+
+/*
+galgame3, port A:
+ bit 2 = bank lsb
+ bit 3 = bank msb
+*/
+WRITE8_MEMBER(galgames_cart_device::int_pic_bank_w)
+{
+ set_rom_bank((data >> 2) & 3);
+}
+
+
+
+// External EEPROM interface
+
+READ8_MEMBER(galgames_cart_device::eeprom_r)
+{
+ return (m_eeprom && m_eeprom->do_read()) ? 0x80 : 0x00;
+}
+
+WRITE8_MEMBER(galgames_cart_device::eeprom_w)
+{
+ if (!m_eeprom)
+ return;
+
+ if (data & ~0x03)
+ logerror("Unknown EEPROM bit written %04X\n", data);
+
+ // latch the bit
+ m_eeprom->di_write(data & 0x01);
+
+ // clock line asserted: write latch or select next bit to read
+ m_eeprom->clk_write((data & 0x02) ? ASSERT_LINE : CLEAR_LINE );
+}
+
+WRITE_LINE_MEMBER(galgames_cart_device::eeprom_cs_write)
+{
+ if (!m_eeprom)
+ return;
+
+ m_eeprom->cs_write(state);
+}
+
+
+
+
+// SLOT implementation
+
+DEVICE_ADDRESS_MAP_START( slot_map, 16, galgames_slot_device )
+ AM_RANGE( 0x000000, 0x03ffff ) AM_READWRITE(rom0_or_ram_r, ram_w) AM_SHARE("ram")
+ AM_RANGE( 0x000000, 0x1fffff ) AM_READ(rom0_r)
+ AM_RANGE( 0x200000, 0x23ffff ) AM_READWRITE(rom_or_ram_r, ram_w)
+ AM_RANGE( 0x200000, 0x3fffff ) AM_READ(rom_r)
+ADDRESS_MAP_END
+
+galgames_slot_device::galgames_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ device_t(mconfig, GALGAMES_SLOT, "Galaxy Games Slot", tag, owner, clock, "galgames_slot", __FILE__),
+ device_memory_interface(mconfig, *this),
+ m_space_config("slot_space", ENDIANNESS_BIG, 16,22, 0, address_map_delegate(FUNC(galgames_slot_device::slot_map), this)),
+ m_ram(*this, "ram"),
+ m_cart0(*this, "^cart0"),
+ m_cart1(*this, "^cart1"),
+ m_cart2(*this, "^cart2"),
+ m_cart3(*this, "^cart3"),
+ m_cart4(*this, "^cart4")
+{
+}
+
+void galgames_slot_device::device_start()
+{
+ m_space = &space(AS_PROGRAM);
+
+ m_carts[0] = m_cart0;
+ m_carts[1] = m_cart1;
+ m_carts[2] = m_cart2;
+ m_carts[3] = m_cart3;
+ m_carts[4] = m_cart4;
+}
+
+void galgames_slot_device::device_reset()
+{
+ m_is_ram_active = false;
+
+ set_cart(0);
+ reset_eeproms_except(-1);
+}
+
+void galgames_slot_device::set_cart(int cart)
+{
+// if (m_cart != cart)
+// logerror("%s: cart sel = %02x\n", machine().describe_context(), cart);
+
+ m_cart = cart;
+}
+
+void galgames_slot_device::reset_eeproms_except(int cart)
+{
+ // Reset all eeproms except the selected one
+ for (int i = 0; i < 5; i++)
+ m_carts[i]->eeprom_cs_write((cart == i) ? ASSERT_LINE : CLEAR_LINE);
+}
+
+WRITE8_MEMBER(galgames_slot_device::cart_sel_w)
+{
+ // cart selection (0 1 2 3 4 7)
+
+ switch( data )
+ {
+ case 0x07: // 7 resets all
+ reset_eeproms_except(-1);
+ break;
+
+ case 0x00: // cart 0 (motherboard)
+ case 0x01: // cart 1
+ case 0x02: // cart 2
+ case 0x03: // cart 3
+ case 0x04: // cart 4
+ set_cart(data);
+ reset_eeproms_except(data);
+ break;
+
+ default:
+ set_cart(0);
+ reset_eeproms_except(0);
+ logerror("%s: unknown cart sel = %02x\n", machine().describe_context(), data);
+ break;
+ }
+}
+
+// Select RAM, reset PIC
+
+WRITE8_MEMBER(galgames_slot_device::ram_sel_w)
+{
+ // bit 3 = PIC reset (active low)
+ set_pic_reset_line(BIT(data, 3) ? CLEAR_LINE : ASSERT_LINE);
+
+ // ROM/RAM banking
+ if ((data & 0xf7) == 0x05)
+ {
+ m_is_ram_active = true;
+// logerror("%s: romram bank = %02x\n", machine().describe_context(), data);
+ }
+}
+
+// External ROM read
+
+READ16_MEMBER(galgames_slot_device::rom0_r)
+{
+ return m_carts[0]->rom_r(space, offset, mem_mask);
+}
+READ16_MEMBER(galgames_slot_device::rom_r)
+{
+ return m_carts[m_cart]->rom_r(space, offset, mem_mask);
+}
+
+READ16_MEMBER(galgames_slot_device::rom0_or_ram_r)
+{
+ return m_is_ram_active ? m_ram[offset] : m_carts[0]->rom_r(space, offset, mem_mask);
+}
+READ16_MEMBER(galgames_slot_device::rom_or_ram_r)
+{
+ return !m_is_ram_active ? m_ram[offset] : m_carts[m_cart]->rom_r(space, offset, mem_mask);
+}
+
+WRITE16_MEMBER(galgames_slot_device::ram_w)
+{
+ COMBINE_DATA(m_ram + offset);
+}
+
+// External PIC status and data interface
+
+READ8_MEMBER(galgames_slot_device::pic_status_r)
+{
+ return m_carts[m_cart]->pic_status_r(space, offset, mem_mask);
+}
+READ8_MEMBER(galgames_slot_device::pic_data_r)
+{
+ return m_carts[m_cart]->pic_data_r(space, offset, mem_mask);
+}
+WRITE8_MEMBER(galgames_slot_device::pic_data_w)
+{
+ m_carts[m_cart]->pic_data_w(space, offset, data, mem_mask);
+}
+
+void galgames_slot_device::set_pic_reset_line(int state)
+{
+ m_carts[m_cart]->set_pic_reset_line(state);
+}
+
+// External EEPROM interface
+
+READ8_MEMBER(galgames_slot_device::eeprom_r)
+{
+ return m_carts[m_cart]->eeprom_r(space, offset, mem_mask);
+}
+WRITE8_MEMBER(galgames_slot_device::eeprom_w)
+{
+ m_carts[m_cart]->eeprom_w(space, offset, data, mem_mask);
+}
+WRITE_LINE_MEMBER(galgames_slot_device::eeprom_cs_write)
+{
+ m_carts[m_cart]->eeprom_cs_write(state);
+}
+
+/***************************************************************************
+
+ General
+
+***************************************************************************/
+
+class galgames_state : public driver_device
+{
+public:
+ galgames_state(const machine_config &mconfig, device_type type, const char *tag)
+ : driver_device(mconfig, type, tag),
+ m_maincpu(*this, "maincpu"),
+ m_screen(*this, "screen"),
+ m_palette(*this, "palette"),
+ m_blitter(*this, "blitter"),
+ m_oki(*this, "oki"),
+ m_slot(*this, "slot")
+ { }
+
+ DECLARE_WRITE_LINE_MEMBER(blitter_irq_callback);
+
+ TIMER_DEVICE_CALLBACK_MEMBER(scanline_interrupt);
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+
+ DECLARE_WRITE16_MEMBER(galgames_palette_offset_w);
+ DECLARE_WRITE16_MEMBER(galgames_palette_data_w);
+
+ DECLARE_READ16_MEMBER(galgames_okiram_r);
+ DECLARE_WRITE16_MEMBER(galgames_okiram_w);
+
+ DECLARE_READ16_MEMBER(fpga_status_r);
+ DECLARE_WRITE16_MEMBER(outputs_w);
+
+protected:
+ required_device<cpu_device> m_maincpu;
+ required_device<screen_device> m_screen;
+ required_device<palette_device> m_palette;
+ required_device<cesblit_device> m_blitter;
+ required_device<okim6295_device> m_oki;
+ required_device<galgames_slot_device> m_slot;
+
+ uint32_t m_palette_offset;
+ uint8_t m_palette_index;
+ uint8_t m_palette_data[3];
+};
+
+WRITE_LINE_MEMBER(galgames_state::blitter_irq_callback)
+{
+// logerror("%s: Blitter IRQ callback state = %x\n", machine().describe_context(), state);
+ m_maincpu->set_input_line(2, state);
+}
+
+/***************************************************************************
+
+ Video
+
+***************************************************************************/
+
+uint32_t galgames_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ bitmap.fill(m_palette->black_pen(), cliprect);
+ return m_blitter->screen_update(screen, bitmap, cliprect);
+}
+
+// BT481A Palette RAMDAC
+
+WRITE16_MEMBER(galgames_state::galgames_palette_offset_w)
+{
+ if (ACCESSING_BITS_0_7)
+ {
+ m_palette_offset = data & 0xff;
+ m_palette_index = 0;
+ }
+}
+WRITE16_MEMBER(galgames_state::galgames_palette_data_w)
+{
+ if (ACCESSING_BITS_0_7)
+ {
+ m_palette_data[m_palette_index] = data & 0xff;
+ if (++m_palette_index == 3)
+ {
+ int palette_base;
+ for (palette_base = 0; palette_base < 0x1000; palette_base += 0x100)
+ m_palette->set_pen_color(m_palette_offset + palette_base, rgb_t(m_palette_data[0], m_palette_data[1], m_palette_data[2]));
+ m_palette_index = 0;
+ m_palette_offset++;
+ }
+ }
+}
+
+/***************************************************************************
+
+ Sound
+
+***************************************************************************/
+
+READ16_MEMBER(galgames_state::galgames_okiram_r)
+{
+ return memregion("oki")->base()[offset] | 0xff00;
+}
+
+WRITE16_MEMBER(galgames_state::galgames_okiram_w)
+{
+ if (ACCESSING_BITS_0_7)
+ memregion("oki")->base()[offset] = data & 0xff;
+}
+
+/***************************************************************************
+
+ Memory Maps
+
+***************************************************************************/
+
+// Outputs
+
+WRITE16_MEMBER(galgames_state::outputs_w)
+{
+ if (data & mem_mask & ~0x000f)
+ logerror("%s: Unknown output bit written %04X\n", machine().describe_context(), data);
+
+ if ( ACCESSING_BITS_0_7 )
+ {
+ // bit 0 & 1 : ? always on (may be trackball lights or coin lockouts)
+ // bit 2 : coin counter
+ // bit 3 : ? set after selecting a game (mostly off in-game)
+ machine().bookkeeping().coin_counter_w(0, data & 0x0004);
+ }
+
+// popmessage("OUT %02X", data & mem_mask);
+}
+
+// FPGA
+
+READ16_MEMBER(galgames_state::fpga_status_r)
+{
+ return 0x3; // Pass the check at PC = 0xfae & a later one
+}
+
+static ADDRESS_MAP_START( galgames_map, AS_PROGRAM, 16, galgames_state )
+ AM_RANGE( 0x000000, 0x3fffff ) AM_DEVREADWRITE("slot", galgames_slot_device, read, write )
+
+ AM_RANGE( 0x400000, 0x400011 ) AM_DEVWRITE("blitter", cesblit_device, regs_w )
+ AM_RANGE( 0x400012, 0x400013 ) AM_DEVWRITE("blitter", cesblit_device, addr_hi_w )
+ AM_RANGE( 0x400014, 0x400015 ) AM_DEVWRITE("blitter", cesblit_device, color_w )
+ AM_RANGE( 0x400020, 0x400021 ) AM_DEVREAD( "blitter", cesblit_device, status_r )
+
+ AM_RANGE( 0x600000, 0x600001 ) AM_READ(fpga_status_r )
+ AM_RANGE( 0x700000, 0x700001 ) AM_READ(fpga_status_r ) AM_WRITENOP
+ AM_RANGE( 0x800020, 0x80003f ) AM_NOP // ?
+ AM_RANGE( 0x900000, 0x900001 ) AM_DEVWRITE("watchdog", watchdog_timer_device, reset16_w)
+
+ AM_RANGE( 0xa00000, 0xa00001 ) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff )
+ AM_RANGE( 0xb00000, 0xb7ffff ) AM_READWRITE(galgames_okiram_r, galgames_okiram_w ) // (only low bytes tested) 4x N341024SJ-15
+
+ AM_RANGE( 0xc00000, 0xc00001 ) AM_WRITE(galgames_palette_offset_w )
+ AM_RANGE( 0xc00002, 0xc00003 ) AM_WRITE(galgames_palette_data_w )
+
+ AM_RANGE( 0xd00000, 0xd00001 ) AM_READ_PORT("TRACKBALL_1_X")
+ AM_RANGE( 0xd00000, 0xd00001 ) AM_WRITENOP // bit 0: FPGA programming serial in (lsb first)
+ AM_RANGE( 0xd00002, 0xd00003 ) AM_READ_PORT("TRACKBALL_1_Y")
+ AM_RANGE( 0xd00004, 0xd00005 ) AM_READ_PORT("TRACKBALL_2_X")
+ AM_RANGE( 0xd00006, 0xd00007 ) AM_READ_PORT("TRACKBALL_2_Y")
+ AM_RANGE( 0xd00008, 0xd00009 ) AM_READ_PORT("P1")
+ AM_RANGE( 0xd0000a, 0xd0000b ) AM_READ_PORT("P2")
+ AM_RANGE( 0xd0000c, 0xd0000d ) AM_READ_PORT("SYSTEM") AM_WRITE(outputs_w )
+
+ AM_RANGE( 0xd0000e, 0xd0000f ) AM_READNOP AM_DEVWRITE8("slot", galgames_slot_device, cart_sel_w, 0x00ff )
+ AM_RANGE( 0xd00010, 0xd00011 ) AM_DEVREADWRITE8("slot", galgames_slot_device, eeprom_r, eeprom_w, 0x00ff )
+ AM_RANGE( 0xd00012, 0xd00013 ) AM_DEVREADWRITE8("slot", galgames_slot_device, pic_data_r, pic_data_w, 0x00ff )
+ AM_RANGE( 0xd00014, 0xd00015 ) AM_DEVREADWRITE8("slot", galgames_slot_device, pic_status_r, ram_sel_w, 0x00ff )
+ADDRESS_MAP_END
+
+static ADDRESS_MAP_START( blitter_map, AS_PROGRAM, 16, galgames_state )
+ AM_RANGE( 0x000000, 0x1fffff ) AM_DEVREAD(":slot", galgames_slot_device, rom_r)
+ADDRESS_MAP_END
+
+/***************************************************************************
+
+ Input Ports
+
+***************************************************************************/
+
+static INPUT_PORTS_START( galgames )
+ PORT_START("P1")
+ PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) // Button A (right)
+ PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) // Button B (left)
+ PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
+
+ PORT_START("P2")
+ PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) // Button A (right)
+ PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) // Button B (left)
+ PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_SERVICE1) // DBA (coin)
+ PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
+
+ PORT_START("SYSTEM")
+ PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) // CS 1 (coin)
+ PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) // CS 2 (coin)
+ PORT_BIT( 0x0004, IP_ACTIVE_HIGH,IPT_OTHER ) PORT_CODE(KEYCODE_F2) PORT_NAME("Service Mode (Coin Door)") PORT_TOGGLE
+ PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
+
+ PORT_START("TRACKBALL_1_X")
+ PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(5) PORT_PLAYER(1) PORT_RESET
+
+ PORT_START("TRACKBALL_1_Y")
+ PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(5) PORT_PLAYER(1) PORT_RESET
+
+ PORT_START("TRACKBALL_2_X")
+ PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(5) PORT_PLAYER(2) PORT_RESET
+
+ PORT_START("TRACKBALL_2_Y")
+ PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(5) PORT_PLAYER(2) PORT_RESET
+INPUT_PORTS_END
+
+/***************************************************************************
+
+ Machine Drivers
+
+***************************************************************************/
+
+TIMER_DEVICE_CALLBACK_MEMBER(galgames_state::scanline_interrupt)
+{
+ int scanline = param;
+
+ if (scanline == 0) // vblank, FIXME
+ m_maincpu->set_input_line(3, HOLD_LINE);
+ else if ((scanline % 16) == 0)
+ m_maincpu->set_input_line(1, HOLD_LINE);
+
+ // lev 2 triggered at the end of the blit
+}
+
+int galgames_compute_addr(uint16_t reg_low, uint16_t reg_mid, uint16_t reg_high)
+{
+ return reg_low | (reg_mid << 16);
+}
+
+static MACHINE_CONFIG_START( galgames_base, galgames_state )
+ MCFG_CPU_ADD("maincpu", M68000, XTAL_24MHz / 2)
+ MCFG_CPU_PROGRAM_MAP(galgames_map)
+ MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", galgames_state, scanline_interrupt, "screen", 0, 1)
+ MCFG_WATCHDOG_ADD("watchdog")
+
+ MCFG_GALGAMES_SLOT_ADD("slot")
+ MCFG_GALGAMES_BIOS_CART_ADD( "cart0", 0)
+
+ // video hardware
+ MCFG_SCREEN_ADD("screen", RASTER)
+ MCFG_SCREEN_REFRESH_RATE(60)
+ MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
+ MCFG_SCREEN_SIZE(400, 256)
+ MCFG_SCREEN_VISIBLE_AREA(0, 400-1, 0, 256-1)
+ MCFG_SCREEN_UPDATE_DRIVER(galgames_state, screen_update)
+ MCFG_SCREEN_PALETTE("palette")
+
+ MCFG_CESBLIT_ADD("blitter", "screen", XTAL_24MHz)
+ MCFG_CESBLIT_MAP(blitter_map)
+ MCFG_CESBLIT_COMPUTE_ADDR(galgames_compute_addr)
+ MCFG_CESBLIT_IRQ_CB(WRITELINE(galgames_state, blitter_irq_callback))
+
+ MCFG_PALETTE_ADD("palette", 0x1000) // only 0x100 used
+ MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+
+ // sound hardware
+ MCFG_SPEAKER_STANDARD_MONO("mono")
+
+ MCFG_OKIM6295_ADD("oki", XTAL_24MHz / 8, OKIM6295_PIN7_LOW) // clock frequency & pin 7 not verified
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
+MACHINE_CONFIG_END
+
+static MACHINE_CONFIG_DERIVED( galgbios, galgames_base )
+ MCFG_GALGAMES_EMPTY_CART_ADD("cart1", 1)
+ MCFG_GALGAMES_EMPTY_CART_ADD("cart2", 2)
+ MCFG_GALGAMES_EMPTY_CART_ADD("cart3", 3)
+ MCFG_GALGAMES_EMPTY_CART_ADD("cart4", 4)
+MACHINE_CONFIG_END
+
+static MACHINE_CONFIG_DERIVED( galgame2, galgames_base )
+ MCFG_GALGAMES_STARPAK2_CART_ADD("cart1", 1)
+ MCFG_GALGAMES_EMPTY_CART_ADD("cart2", 2)
+ MCFG_GALGAMES_EMPTY_CART_ADD("cart3", 3)
+ MCFG_GALGAMES_EMPTY_CART_ADD("cart4", 4)
+MACHINE_CONFIG_END
+
+static MACHINE_CONFIG_DERIVED( galgame3, galgames_base )
+ MCFG_GALGAMES_STARPAK3_CART_ADD("cart1", 1)
+ MCFG_GALGAMES_EMPTY_CART_ADD("cart2", 2)
+ MCFG_GALGAMES_EMPTY_CART_ADD("cart3", 3)
+ MCFG_GALGAMES_EMPTY_CART_ADD("cart4", 4)
+MACHINE_CONFIG_END
+
+/***************************************************************************
+
+ ROMs Loading
+
+***************************************************************************/
+
+
+/***************************************************************************
+
+Galaxy Games BIOS
+
+This is a multi-game cocktail cabinet released in 1998. Namco and Atari
+licensed their IP for some cartridges for it.
+
+Trackball-based. 'BIOS' has 7 built-in games. There are two LEDs on the PCB.
+
+More information here : http://www.cesgames.com/museum/galaxy/index.html
+
+----
+
+Board silkscreened 237-0211-00
+ REV.-D
+
+Cartridge based mother board
+Holds up to 4 cartridges
+Chips labeled
+ GALAXY U1 V1.90 12/1/98
+ GALAXY U2 V1.90 12/1/98
+
+Motorola MC68HC000FN12
+24 MHz oscillator
+Xilinx XC5206
+Xilinx XC5202
+BT481AKPJ110 (Palette RAMDAC)
+NKK N341024SJ-15 x8 (128kB RAM)
+OKI M6295 8092352-2
+
+PAL16V8H-15 @ U24 Blue dot on it
+PAL16V8H-15 @ U25 Yellow dot on it
+PAL16V8H-15 @ U26 Red dot on it
+PAL16V8H-15 @ U27 Green dot on it
+PAL16V8H-15 @ U45 Magenta dot on it
+
+Copyright notice in rom states: Creative Electronics & Software Written by Keith M. Kolmos May 29,1998
+
+***************************************************************************/
+
+#define ROM_LOAD16_BYTE_BIOS(bios,name,offset,length,hash) \
+ ROMX_LOAD(name, offset, length, hash, ROM_SKIP(1) | ROM_BIOS(bios+1)) /* Note '+1' */
+
+#define GALGAMES_BIOS_ROMS \
+ ROM_SYSTEM_BIOS( 0, "1.90", "v1.90 12/01/98" ) \
+ ROM_LOAD16_BYTE_BIOS( 0, "galaxy_u2__v1.90_12-01-98.u2", 0x000000, 0x100000, CRC(e51ff184) SHA1(aaa795f2c15ec29b3ceeb5c917b643db0dbb7083) ) \
+ ROM_LOAD16_BYTE_BIOS( 0, "galaxy_u1__v1.90_12-01-98.u1", 0x000001, 0x100000, CRC(c6d7bc6d) SHA1(93c032f9aa38cbbdda59a8a25ff9f38f7ad9c760) ) \
+ \
+ ROM_SYSTEM_BIOS( 1, "1.80", "v1.80 10/05/98" ) \
+ ROM_LOAD16_BYTE_BIOS( 1, "galaxy_u2__v1.80_10-15-98.u2", 0x000000, 0x100000, CRC(73cff284) SHA1(e6f7d92999cdb478c21c3b65a04eade84299ac12) ) \
+ ROM_LOAD16_BYTE_BIOS( 1, "galaxy_u1__v1.80_10-15-98.u1", 0x000001, 0x100000, CRC(e3ae423c) SHA1(66d1964845a99a5ed4b19b4135b55cde6b5fe295) )
+
+#define GALGAMES_MB_PALS \
+ ROM_REGION( 0xa00, "pals", 0) \
+ ROM_LOAD( "16v8h-blue.u24", 0x000, 0x117, NO_DUMP ) \
+ ROM_LOAD( "16v8h-yellow.u25", 0x200, 0x117, NO_DUMP ) \
+ ROM_LOAD( "16v8h-magenta.u26", 0x400, 0x117, NO_DUMP ) \
+ ROM_LOAD( "16v8h-green.u27", 0x600, 0x117, NO_DUMP ) \
+ ROM_LOAD( "16v8h-red.u45", 0x800, 0x117, NO_DUMP )
+
+ROM_START( galgbios )
+ ROM_REGION16_BE( 0x200000, "cart0", 0 )
+ GALGAMES_BIOS_ROMS
+
+ ROM_REGION( 0x200000, "cart1", ROMREGION_ERASEFF )
+ ROM_REGION( 0x200000, "cart2", ROMREGION_ERASEFF )
+ ROM_REGION( 0x200000, "cart3", ROMREGION_ERASEFF )
+ ROM_REGION( 0x200000, "cart4", ROMREGION_ERASEFF )
+
+ ROM_REGION( 0x40000, "oki", ROMREGION_ERASE )
+ // RAM, filled by the 68000 and fed to the OKI
+
+ GALGAMES_MB_PALS
+ROM_END
+
+/***************************************************************************
+
+Galaxy Games StarPak 2
+
+NAMCO 307 Cartridge, has surface mount Flash chips in it:
+
+.U1 AM29F800BB
+.U2 AM29F800BB
+.U3 93AA76/SN
+.U4 PIC 12C508
+.L1 Led
+
+Board silkscreened 237-0209-00
+ REV.-C
+
+***************************************************************************/
+
+ROM_START( galgame2 )
+ ROM_REGION16_BE( 0x200000, "cart0", 0 )
+ GALGAMES_BIOS_ROMS
+
+ ROM_REGION( 0x200000, "cart1", 0 )
+ ROM_LOAD16_BYTE( "am29f800bb.u2", 0x000000, 0x100000, CRC(f43c0c54) SHA1(4a13946c3d173b0e4ab25b01849574fa3302b417) )
+ ROM_LOAD16_BYTE( "am29f800bb.u1", 0x000001, 0x100000, CRC(b8c34a8b) SHA1(40d3b35f573d2bd2ae1c7d876c55fc436864fa3f) )
+
+ ROM_REGION( 0x2000, "cart1:pic", 0 )
+ ROM_LOAD( "pic12c508.u4", 0x0000, 0x2000, CRC(bb253913) SHA1(eace069344da6dda7c05673e422876d130ed5d48) ) // includes config word at fff, hence size is 2*1000
+
+ ROM_REGION( 0x200000, "cart2", ROMREGION_ERASEFF )
+ ROM_REGION( 0x200000, "cart3", ROMREGION_ERASEFF )
+ ROM_REGION( 0x200000, "cart4", ROMREGION_ERASEFF )
+
+ ROM_REGION( 0x40000, "oki", ROMREGION_ERASE )
+ // RAM, filled by the 68000 and fed to the OKI
+
+ GALGAMES_MB_PALS
+ROM_END
+
+/***************************************************************************
+
+Galaxy Games StarPak 3
+
+Cartridge with 8 games, including Atari licensed Centipede.
+
+.U1 AM29F032B
+.U2 AM29F032B
+.U5 93AA76/SN
+.U6 PIC 16C56-XT/P
+.L1 Led
+
+Board silkscreened 237-0228-00
+ REV.-B
+
+***************************************************************************/
+
+ROM_START( galgame3 )
+ ROM_REGION16_BE( 0x200000, "cart0", 0 )
+ GALGAMES_BIOS_ROMS
+
+ ROM_REGION( 0x800000, "cart1", 0 )
+ ROM_LOAD16_BYTE( "am29f032b.u2", 0x000000, 0x400000, CRC(a4ffc70a) SHA1(328c6ceef025af7ff5b7998df59a10d90c654d53) )
+ ROM_LOAD16_BYTE( "am29f032b.u1", 0x000001, 0x400000, CRC(b0876751) SHA1(487f052989e4b2df2df2293b283e8e03ffc3ddf4) )
+
+ ROM_REGION( 0x800, "cart1:pic", 0 )
+ ROM_LOAD( "pic16c56.u6", 0x000, 0x800, CRC(cf901ed8) SHA1(ebb2da0f50ba82a038f315aab7e6b20b9a1af3a1) )
+
+ ROM_REGION( 0x200000, "cart2", ROMREGION_ERASEFF )
+ ROM_REGION( 0x200000, "cart3", ROMREGION_ERASEFF )
+ ROM_REGION( 0x200000, "cart4", ROMREGION_ERASEFF )
+
+ ROM_REGION( 0x40000, "oki", ROMREGION_ERASE )
+ // RAM, filled by the 68000 and fed to the OKI
+
+ GALGAMES_MB_PALS
+ROM_END
+
+
+GAME( 1998, galgbios, 0, galgbios, galgames, driver_device, 0, ROT0, "Creative Electronics & Software", "Galaxy Games BIOS", MACHINE_IS_BIOS_ROOT )
+GAME( 1998, galgame2, galgbios, galgame2, galgames, driver_device, 0, ROT0, "Creative Electronics & Software / Namco", "Galaxy Games StarPak 2", 0 )
+GAME( 1998, galgame3, galgbios, galgame3, galgames, driver_device, 0, ROT0, "Creative Electronics & Software / Atari", "Galaxy Games StarPak 3", 0 )
diff --git a/src/mame/drivers/gcpinbal.cpp b/src/mame/drivers/gcpinbal.cpp
index 416ca126619..eca94b98a30 100644
--- a/src/mame/drivers/gcpinbal.cpp
+++ b/src/mame/drivers/gcpinbal.cpp
@@ -23,12 +23,11 @@ TODO
----
- Screen flipping support
- - Understand role of bit 5 of IN1
- - Hook up 93C46 EEPROM
- - Hook up ES-8712
- - Sort out the IOC commands for the M6585 & ES-8712
+ - Modernize ES-8712 and hook up to MSM6585 and HCT157
+ - Figure out which customs use D80010-D80077 and merge implementation with Aquarium
- Is SW3 actually used?
- Missing row scroll (column scroll?)
+ Reference video showing effect: https://www.youtube.com/watch?v=zBGjncVsSf4
BGMs (controlled by OKI MSM6585 sound chip)
MSM6585: is an upgraded MSM5205 voice synth IC.
@@ -64,7 +63,7 @@ ES-9209B
CPU: TMP68HC000P-16
Sound: OKI M6295
OKI M6585
- Ecxellent ES-8712
+ Excellent ES-8712
OSC: 32MHz, 14.31818MHz & 1056kHz, 640kHz resonators
RAM: Sony CXK5864BSP-10L 8K x 8bit high speed CMOS SRAM
Alliance AS7C256-20PC 32K x 8bit CMOS SRAM
@@ -101,13 +100,6 @@ void gcpinbal_state::device_timer(emu_timer &timer, device_timer_id id, int para
case TIMER_GCPINBAL_INTERRUPT1:
m_maincpu->set_input_line(1, HOLD_LINE);
break;
- case TIMER_GCPINBAL_INTERRUPT3:
- // IRQ3 is from the M6585
- //if (!ADPCM_playing(0))
- {
- m_maincpu->set_input_line(3, HOLD_LINE);
- }
- break;
default:
assert_always(false, "Unknown id in gcpinbal_state::device_timer");
}
@@ -118,7 +110,6 @@ INTERRUPT_GEN_MEMBER(gcpinbal_state::gcpinbal_interrupt)
/* Unsure of actual sequence */
timer_set(downcast<cpu_device *>(&device)->cycles_to_attotime(500), TIMER_GCPINBAL_INTERRUPT1);
-// timer_set(downcast<cpu_device *>(&device)->cycles_to_attotime(1000), TIMER_GCPINBAL_INTERRUPT3);
device.execute().set_input_line(4, HOLD_LINE);
}
@@ -127,122 +118,95 @@ INTERRUPT_GEN_MEMBER(gcpinbal_state::gcpinbal_interrupt)
IOC
***********************************************************/
-READ16_MEMBER(gcpinbal_state::ioc_r)
+WRITE16_MEMBER(gcpinbal_state::d80010_w)
{
- /* 20 (only once), 76, a0 are read in log */
-
- switch (offset)
- {
- case 0x80/2:
- return ioport("DSW")->read();
-
- case 0x84/2:
- return ioport("IN0")->read();
+ //logerror("CPU #0 PC %06x: warning - write ioc offset %06x with %04x\n", space.device().safe_pc(), offset, data);
+ COMBINE_DATA(&m_d80010_ram[offset]);
+}
- case 0x86/2:
- return ioport("IN1")->read();
+WRITE8_MEMBER(gcpinbal_state::d80040_w)
+{
+ logerror("Writing byte value %02X to offset %X\n", data, offset);
+}
- case 0x50:
- case 0x51:
- return m_oki->read(space, 0) << 8;
+WRITE16_MEMBER(gcpinbal_state::d80060_w)
+{
+ //logerror("CPU #0 PC %06x: warning - write ioc offset %06x with %04x\n", space.device().safe_pc(), offset, data);
+ COMBINE_DATA(&m_d80060_ram[offset]);
+}
- }
+WRITE8_MEMBER(gcpinbal_state::bank_w)
+{
+ // MSM6585 bank, coin LEDs, maybe others?
+ m_msm_bank = data & 0x10 ? 0x100000 : 0;
+ m_oki->set_rom_bank((data & 0x20) >> 5);
-//logerror("CPU #0 PC %06x: warning - read unmapped ioc offset %06x\n",space.device().safe_pc(),offset);
+ m_bg0_gfxset = (data & 0x04) ? 0x1000 : 0;
+ m_bg1_gfxset = (data & 0x08) ? 0x1000 : 0;
- return m_ioc_ram[offset];
+// machine().bookkeeping().coin_lockout_w(0, ~data & 0x01);
+// machine().bookkeeping().coin_lockout_w(1, ~data & 0x02);
}
+WRITE8_MEMBER(gcpinbal_state::eeprom_w)
+{
+ // 93C46 serial EEPROM (status read at D80087)
+ m_eeprom->di_write(BIT(data, 2));
+ m_eeprom->clk_write(BIT(data, 1));
+ m_eeprom->cs_write(BIT(data, 0));
+}
-WRITE16_MEMBER(gcpinbal_state::ioc_w)
+WRITE8_MEMBER(gcpinbal_state::es8712_ack_w)
{
- COMBINE_DATA(&m_ioc_ram[offset]);
-
-// switch (offset)
-// {
-// case 0x??: /* */
-// return;
-//
-// case 0x88/2: /* coin control (+ others) ??? */
-// machine().bookkeeping().coin_lockout_w(0, ~data & 0x01);
-// machine().bookkeeping().coin_lockout_w(1, ~data & 0x02);
-//popmessage(" address %04x value %04x", offset, data);
-// }
+ // This probably works by resetting the ES-8712
+ m_maincpu->set_input_line(3, CLEAR_LINE);
+ m_adpcm_idle = 1;
+ m_msm->reset_w(1);
+}
+WRITE8_MEMBER(gcpinbal_state::es8712_w)
+{
+ // MSM6585/ES-8712 ADPCM - mini emulation
switch (offset)
{
- // these are all written every frame
- case 0x3b:
- case 0xa:
- case 0xc:
- case 0xb:
- case 0xd:
- case 0xe:
- case 0xf:
- case 0x10:
- case 0x47:
- break;
-
- // MSM6585 bank, coin LEDs, maybe others?
- case 0x44:
- m_msm_bank = data & 0x1000 ? 0x100000 : 0;
- m_oki->set_rom_bank((data & 0x800) >> 11);
- break;
-
- case 0x45:
- //m_adpcm_idle = 1;
- break;
-
- // OKIM6295
- case 0x50:
- case 0x51:
- m_oki->write(space, 0, data >> 8);
- break;
-
- // MSM6585 ADPCM - mini emulation
- case 0x60:
+ case 0:
m_msm_start &= 0xffff00;
- m_msm_start |= (data >> 8);
+ m_msm_start |= data;
break;
- case 0x61:
+ case 1:
m_msm_start &= 0xff00ff;
- m_msm_start |= data;
+ m_msm_start |= (data << 8);
break;
- case 0x62:
+ case 2:
m_msm_start &= 0x00ffff;
- m_msm_start |= (data << 8);
+ m_msm_start |= (data << 16);
break;
- case 0x63:
+ case 3:
m_msm_end &= 0xffff00;
- m_msm_end |= (data >> 8);
+ m_msm_end |= data;
break;
- case 0x64:
+ case 4:
m_msm_end &= 0xff00ff;
- m_msm_end |= data;
+ m_msm_end |= (data << 8);
break;
- case 0x65:
+ case 5:
m_msm_end &= 0x00ffff;
- m_msm_end |= (data << 8);
+ m_msm_end |= (data << 16);
break;
- case 0x66:
+ case 6:
+ logerror("ES-8712 playing sample %08x-%08x\n", m_msm_start + m_msm_bank, m_msm_end);
if (m_msm_start < m_msm_end)
{
/* data written here is adpcm param? */
- //popmessage("%08x %08x", m_msm_start + m_msm_bank, m_msm_end);
m_adpcm_idle = 0;
m_msm->reset_w(0);
m_adpcm_start = m_msm_start + m_msm_bank;
m_adpcm_end = m_msm_end;
-// ADPCM_stop(0);
-// ADPCM_play(0, start+bank, end-start);
}
break;
-
default:
- logerror("CPU #0 PC %06x: warning - write ioc offset %06x with %04x\n", space.device().safe_pc(), offset, data);
break;
}
-
}
@@ -251,17 +215,17 @@ WRITE16_MEMBER(gcpinbal_state::ioc_w)
************************************************/
-/* Controlled through ioc? */
+// Controlled through ES-8712
WRITE_LINE_MEMBER(gcpinbal_state::gcp_adpcm_int)
{
- if (!state)
+ if (!state || m_adpcm_idle)
return;
- if (m_adpcm_idle)
- m_msm->reset_w(1);
if (m_adpcm_start >= 0x200000 || m_adpcm_start > m_adpcm_end)
{
- //m_msm->reset_w(1);
- m_adpcm_start = m_msm_start + m_msm_bank;
+ m_adpcm_idle = 1;
+ m_msm->reset_w(1);
+ m_maincpu->set_input_line(3, ASSERT_LINE);
+ //m_adpcm_start = m_msm_start + m_msm_bank;
m_adpcm_trigger = 0;
}
else
@@ -286,7 +250,17 @@ static ADDRESS_MAP_START( gcpinbal_map, AS_PROGRAM, 16, gcpinbal_state )
AM_RANGE(0xc00000, 0xc03fff) AM_READWRITE(gcpinbal_tilemaps_word_r, gcpinbal_tilemaps_word_w) AM_SHARE("tilemapram")
AM_RANGE(0xc80000, 0xc81fff) AM_DEVREADWRITE8("spritegen", excellent_spr_device, read, write, 0x00ff)
AM_RANGE(0xd00000, 0xd00fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
- AM_RANGE(0xd80000, 0xd800ff) AM_READWRITE(ioc_r, ioc_w) AM_SHARE("ioc_ram")
+ AM_RANGE(0xd80010, 0xd8002f) AM_RAM_WRITE(d80010_w) AM_SHARE("d80010")
+ AM_RANGE(0xd80040, 0xd8005b) AM_WRITE8(d80040_w, 0x00ff)
+ AM_RANGE(0xd80060, 0xd80077) AM_RAM_WRITE(d80060_w) AM_SHARE("d80060")
+ AM_RANGE(0xd80080, 0xd80081) AM_READ_PORT("DSW")
+ AM_RANGE(0xd80084, 0xd80085) AM_READ_PORT("IN0")
+ AM_RANGE(0xd80086, 0xd80087) AM_READ_PORT("IN1")
+ AM_RANGE(0xd80088, 0xd80089) AM_WRITE8(bank_w, 0xff00)
+ AM_RANGE(0xd8008a, 0xd8008b) AM_WRITE8(eeprom_w, 0xff00)
+ AM_RANGE(0xd8008e, 0xd8008f) AM_WRITE8(es8712_ack_w, 0xff00)
+ AM_RANGE(0xd800a0, 0xd800a1) AM_MIRROR(0x2) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0xff00)
+ AM_RANGE(0xd800c0, 0xd800cd) AM_WRITE8(es8712_w, 0xff00)
AM_RANGE(0xff0000, 0xffffff) AM_RAM /* RAM */
ADDRESS_MAP_END
@@ -368,7 +342,7 @@ static INPUT_PORTS_START( gcpinbal )
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN ) // This bit gets tested (search for d8 00 87)
+ PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_93cxx_device, do_read)
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_COIN1 )
@@ -445,7 +419,6 @@ void gcpinbal_state::machine_start()
save_item(NAME(m_adpcm_end));
save_item(NAME(m_adpcm_idle));
save_item(NAME(m_adpcm_trigger));
- save_item(NAME(m_adpcm_data));
}
void gcpinbal_state::machine_reset()
@@ -462,7 +435,6 @@ void gcpinbal_state::machine_reset()
m_adpcm_start = 0;
m_adpcm_end = 0;
m_adpcm_trigger = 0;
- m_adpcm_data = 0;
m_bg0_gfxset = 0;
m_bg1_gfxset = 0;
m_msm_start = 0;
@@ -477,6 +449,8 @@ static MACHINE_CONFIG_START( gcpinbal, gcpinbal_state )
MCFG_CPU_PROGRAM_MAP(gcpinbal_map)
MCFG_CPU_VBLANK_INT_DRIVER("screen", gcpinbal_state, gcpinbal_interrupt)
+ MCFG_EEPROM_SERIAL_93C46_ADD("eeprom")
+
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
diff --git a/src/mame/drivers/gts80b.cpp b/src/mame/drivers/gts80b.cpp
index 9a0b2e58146..516ceb7fbf9 100644
--- a/src/mame/drivers/gts80b.cpp
+++ b/src/mame/drivers/gts80b.cpp
@@ -896,6 +896,24 @@ ROM_START(excalibrf)
ROM_LOAD("yrom1.snd", 0x8000, 0x8000, CRC(9f194744) SHA1(dbd73b546071c3d4f0dcfe21e3e646da716c5b71))
ROM_END
+ROM_START(excalibrg)
+ ROM_REGION(0x10000, "maincpu", 0)
+ ROM_LOAD("prom2g.cpu", 0x1000, 0x0800, CRC(49079396) SHA1(92361a87464e39afeb74fe531b7d4356323405b8))
+ ROM_CONTINUE(0x9000, 0x0800)
+ ROM_RELOAD(0x5000, 0x0800)
+ ROM_CONTINUE(0xd000, 0x0800)
+ ROM_LOAD("prom1g.cpu", 0x2000, 0x2000, CRC(504fad7a) SHA1(6648778d537161e9bdcf2955209e1525e90a3617))
+ ROM_RELOAD(0x6000, 0x2000)
+ ROM_RELOAD(0xa000, 0x2000)
+ ROM_RELOAD(0xe000, 0x2000)
+
+ ROM_REGION(0x10000, "cpu3", 0)
+ ROM_LOAD("drom1.snd", 0x8000, 0x8000, CRC(a4368cd0) SHA1(c48513e56899938dc83a3545d8ee9def3dc1491f))
+
+ ROM_REGION(0x10000, "cpu2", 0)
+ ROM_LOAD("yrom1.snd", 0x8000, 0x8000, CRC(9f194744) SHA1(dbd73b546071c3d4f0dcfe21e3e646da716c5b71))
+ROM_END
+
/*-------------------------------------------------------------------
/ Genesis (#705)
/-------------------------------------------------------------------*/
@@ -1746,6 +1764,7 @@ GAME(1988, robowars, 0, gts80b_s2, gts80b, gts80b_state, gts80b, ROT0, "
GAME(1988, robowarsf, robowars, gts80b_s2, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Robo-War (French)", MACHINE_IS_SKELETON_MECHANICAL)
GAME(1988, excalibr, 0, gts80b_s3, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Excalibur", MACHINE_IS_SKELETON_MECHANICAL)
GAME(1988, excalibrf, excalibr, gts80b_s3, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Excalibur (French)", MACHINE_IS_SKELETON_MECHANICAL)
+GAME(1988, excalibrg, excalibr, gts80b_s3, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Excalibur (German)", MACHINE_IS_SKELETON_MECHANICAL)
GAME(1988, badgirls, 0, gts80b_s3, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Bad Girls", MACHINE_IS_SKELETON_MECHANICAL)
GAME(1988, badgirlsf, badgirls, gts80b_s3, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Bad Girls (French)", MACHINE_IS_SKELETON_MECHANICAL)
GAME(1988, badgirlsg, badgirls, gts80b_s3, gts80b, gts80b_state, gts80b, ROT0, "Gottlieb", "Bad Girls (German)", MACHINE_IS_SKELETON_MECHANICAL)
diff --git a/src/mame/drivers/h19.cpp b/src/mame/drivers/h19.cpp
index 73332ffe62e..b168bee0bb9 100644
--- a/src/mame/drivers/h19.cpp
+++ b/src/mame/drivers/h19.cpp
@@ -1,5 +1,5 @@
// license:BSD-3-Clause
-// copyright-holders:Robbbert
+// copyright-holders:Robbbert, Mark Garlanger
/***************************************************************************
Heathkit H19
@@ -33,6 +33,34 @@
However, a keyclick can be heard, to assure you it does in fact work.
****************************************************************************/
+/***************************************************************************
+ Memory Layout
+ The U435 three-to-eight line decoder uses A14 and A15 to generate three memory addresses:
+
+ 1. Program ROM 0x0000
+
+ 2. Scratchpad RAM 0x4000
+
+ 3. Display Memory 0xF800
+
+
+ Port Layout
+
+ Only address lines A5, A6, A7 are used by the U442 three-to-eight line decoder
+
+ 1. Keyboard encoder 0x80
+ 2. Keyboard status 0xA0
+ 3. CRT controller 0x60
+ 4. Power-up configuration (primary) 0x00
+ 5. Power-up configuration (secondary) 0x20
+ 6. ACE (communications) 0x40
+ 7. Bell enable 0xE0
+ 8. Key click enable 0xC0
+
+ Decoder U442 is enabled only during an I/O read or write operation to elimnate the
+ possibility of false decoding on a refresh address coming from the Z80.
+
+****************************************************************************/
#include "emu.h"
#include "cpu/z80/z80.h"
@@ -41,8 +69,11 @@
#include "machine/ins8250.h"
#include "machine/keyboard.h"
+// Standard H19 used a 2.048 MHz clock
#define H19_CLOCK (XTAL_12_288MHz / 6)
-#define H19_BEEP_FRQ (H19_CLOCK / 1024)
+
+// Beep Frequency is 1 KHz
+#define H19_BEEP_FRQ (H19_CLOCK / 2048)
class h19_state : public driver_device
@@ -115,11 +146,11 @@ READ8_MEMBER( h19_state::h19_a0_r )
WRITE8_MEMBER( h19_state::h19_c0_w )
{
/* Beeper control - a 96L02 contains 2 oneshots, one for bell and one for keyclick.
-- lengths need verifying
+
offset 00-1F = keyclick
offset 20-3F = terminal bell */
- uint8_t length = (offset & 0x20) ? 200 : 4;
+ uint8_t length = (offset & 0x20) ? 200 : 6;
m_beep->set_state(1);
timer_set(attotime::from_msec(length), TIMER_BEEP_OFF);
}
@@ -360,7 +391,7 @@ static const gfx_layout h19_charlayout =
{
8, 10, /* 8 x 10 characters */
128, /* 128 characters */
- 1, /* 1 bits per pixel */
+ 1, /* 1 bits per pixel */
{ 0 }, /* no bitplanes */
/* x offsets */
{ 0, 1, 2, 3, 4, 5, 6, 7 },
@@ -391,8 +422,8 @@ static MACHINE_CONFIG_START( h19, h19_state )
MCFG_SCREEN_REFRESH_RATE(60)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update)
- MCFG_SCREEN_SIZE(640, 200)
- MCFG_SCREEN_VISIBLE_AREA(0, 640 - 1, 0, 200 - 1)
+ MCFG_SCREEN_SIZE(640, 250)
+ MCFG_SCREEN_VISIBLE_AREA(0, 640 - 1, 0, 250 - 1)
MCFG_GFXDECODE_ADD("gfxdecode", "palette", h19)
MCFG_PALETTE_ADD_MONOCHROME("palette")
@@ -418,14 +449,21 @@ MACHINE_CONFIG_END
ROM_START( h19 )
ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF )
// Original
- ROM_SYSTEM_BIOS(0, "orig", "Original")
- ROMX_LOAD( "2732_444-46_h19code.bin", 0x0000, 0x1000, CRC(f4447da0) SHA1(fb4093d5b763be21a9580a0defebed664b1f7a7b), ROM_BIOS(1))
- // Super H19 ROM (
- ROM_SYSTEM_BIOS(1, "super", "Super 19")
- ROMX_LOAD( "2732_super19_h447.bin", 0x0000, 0x1000, CRC(6c51aaa6) SHA1(5e368b39fe2f1af44a905dc474663198ab630117), ROM_BIOS(2))
- // Watzman ROM
- ROM_SYSTEM_BIOS(2, "watzman", "Watzman")
- ROMX_LOAD( "watzman.bin", 0x0000, 0x1000, CRC(8168b6dc) SHA1(bfaebb9d766edbe545d24bc2b6630be4f3aa0ce9), ROM_BIOS(3))
+ ROM_LOAD( "2732_444-46_h19code.bin", 0x0000, 0x1000, CRC(f4447da0) SHA1(fb4093d5b763be21a9580a0defebed664b1f7a7b))
+
+ ROM_REGION( 0x0800, "chargen", 0 )
+ // Original font dump
+ ROM_LOAD( "2716_444-29_h19font.bin", 0x0000, 0x0800, CRC(d595ac1d) SHA1(130fb4ea8754106340c318592eec2d8a0deaf3d0))
+
+ ROM_REGION( 0x1000, "keyboard", 0 )
+ // Original dump
+ ROM_LOAD( "2716_444-37_h19keyb.bin", 0x0000, 0x0800, CRC(5c3e6972) SHA1(df49ce64ae48652346a91648c58178a34fb37d3c))
+ROM_END
+
+ROM_START( super19 )
+ // Super H19 ROM
+ ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF )
+ ROM_LOAD( "2732_super19_h447.bin", 0x0000, 0x1000, CRC(6c51aaa6) SHA1(5e368b39fe2f1af44a905dc474663198ab630117))
ROM_REGION( 0x0800, "chargen", 0 )
// Original font dump
@@ -434,11 +472,24 @@ ROM_START( h19 )
ROM_REGION( 0x1000, "keyboard", 0 )
// Original dump
ROM_LOAD( "2716_444-37_h19keyb.bin", 0x0000, 0x0800, CRC(5c3e6972) SHA1(df49ce64ae48652346a91648c58178a34fb37d3c))
+ROM_END
+
+ROM_START( watz19 )
+ // Watzman ROM
+ ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF )
+ ROM_LOAD( "watzman.bin", 0x0000, 0x1000, CRC(8168b6dc) SHA1(bfaebb9d766edbe545d24bc2b6630be4f3aa0ce9))
+
+ ROM_REGION( 0x0800, "chargen", 0 )
+ // Original font dump
+ ROM_LOAD( "2716_444-29_h19font.bin", 0x0000, 0x0800, CRC(d595ac1d) SHA1(130fb4ea8754106340c318592eec2d8a0deaf3d0))
// Watzman keyboard
+ ROM_REGION( 0x1000, "keyboard", 0 )
ROM_LOAD( "keybd.bin", 0x0800, 0x0800, CRC(58dc8217) SHA1(1b23705290bdf9fc6342065c6a528c04bff67b13))
ROM_END
-/* Driver (year is either 1978 or 1979) */
+/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */
+COMP( 1979, h19, 0, 0, h19, h19, driver_device, 0, "Heath Inc", "Heathkit H-19", MACHINE_NOT_WORKING )
+/* TODO - verify the years for these third-party replacement ROMs. */
+COMP( 1982, super19, h19, 0, h19, h19, driver_device, 0, "Heath Inc", "Heathkit H-19 w/ Super-19 ROM", MACHINE_NOT_WORKING )
+COMP( 1982, watz19, h19, 0, h19, h19, driver_device, 0, "Heath Inc", "Heathkit H-19 w/ Watzman ROM", MACHINE_NOT_WORKING )
-/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */
-COMP( 1978, h19, 0, 0, h19, h19, driver_device, 0, "Heath Inc", "Heathkit H-19", MACHINE_NOT_WORKING )
diff --git a/src/mame/drivers/h89.cpp b/src/mame/drivers/h89.cpp
index 4431a1a4e99..5b0aac8ce2d 100644
--- a/src/mame/drivers/h89.cpp
+++ b/src/mame/drivers/h89.cpp
@@ -1,5 +1,5 @@
// license:BSD-3-Clause
-// copyright-holders:Sandro Ronco
+// copyright-holders:Sandro Ronco, Mark Garlanger
/***************************************************************************
Heathkit H89
@@ -46,27 +46,82 @@ public:
static ADDRESS_MAP_START(h89_mem, AS_PROGRAM, 8, h89_state)
ADDRESS_MAP_UNMAP_HIGH
- AM_RANGE(0x0000, 0x1fff) AM_ROM
+ // Bank 0 - At startup has the format defined below, but software could swap it for RAM (Later H-89s and
+ // Early ones with the Org-0 modification),
+ // TODO - define the RAM so it can swap in/out under program control.
+ AM_RANGE(0x0000, 0x0fff) AM_ROM // Page 0-4 - System ROM (at most 4k(MTR-90), early versions(MTR-88, MTR-89) only had 2k)
+ AM_RANGE(0x1000, 0x13ff) AM_RAM // Page 5 - Floppy Disk RAM (Write-protectable)
+ AM_RANGE(0x1400, 0x1fff) AM_ROM // Page 6-7 - Floppy Disk ROM
+
+ // Banks 1-7
AM_RANGE(0x2000, 0xffff) AM_RAM
ADDRESS_MAP_END
static ADDRESS_MAP_START( h89_io, AS_IO, 8, h89_state)
ADDRESS_MAP_UNMAP_HIGH
ADDRESS_MAP_GLOBAL_MASK(0xff)
-// AM_RANGE(0x78, 0x7b) expansion 1
-// AM_RANGE(0x7c, 0x7f) expansion 2
+// AM_RANGE(0x78, 0x7b) expansion 1 // Options - Cassette I/O (only uses 0x78 - 0x79) Requires MTR-88 ROM
+ // - H37 5-1/4" Soft-sectored Controller MTR-90 ROM
+ // - H47 Dual 8" Drives - Requires MTR-89 or MTR-90 ROM
+ // - H67 8" Hard disk + 8" Floppy Drives - MTR-90 ROM
+// AM_RANGE(0x7c, 0x7f) expansion 2 // Options - 5-1/4" Hard-sectored Controller (works with ALL ROMs)
+ // - H47 Dual 8" Drives - Requires MTR-89 or MTR-90 ROM
+ // - H67 8" Hard disk + 8" Floppy Drives - MTR-90 ROM
+
// AM_RANGE(0xd0, 0xd7) 8250 UART DCE
-// AM_RANGE(0xd8, 0xdf) 8250 UART DTE
-// AM_RANGE(0xe0, 0xe7) 8250 UART LP
- AM_RANGE(0xe8, 0xef) AM_DEVREADWRITE("ins8250", ins8250_device, ins8250_r, ins8250_w) // 8250 UART console
-// AM_RANGE(0xf0, 0xf1) front panel
+// AM_RANGE(0xd8, 0xdf) 8250 UART DTE - MODEM
+// AM_RANGE(0xe0, 0xe7) 8250 UART DCE - LP
+ AM_RANGE(0xe8, 0xef) AM_DEVREADWRITE("ins8250", ins8250_device, ins8250_r, ins8250_w) // 8250 UART console - this
+ // connects internally to a Terminal board
+ // that is also used in the H19. Ideally,
+ // the H19 code could be connected and ran
+ // as a separate thread.
+// AM_RANGE(0xf0, 0xf1) // ports defined on the H8 - on the H89, access to these addresses causes a NMI
AM_RANGE(0xf2, 0xf2) AM_WRITE(port_f2_w) AM_READ_PORT("SW501")
-// AM_RANGE(0xf8, 0xf9) cassette
-// AM_RANGE(0xfa, 0xff) serial I/O
+// AM_RANGE(0xf3, 0xf3) // ports defined on the H8 - on the H89, access to these addresses causes a NMI
ADDRESS_MAP_END
/* Input ports */
static INPUT_PORTS_START( h89 )
+
+ // Settings with the MTR-88 ROM (#444-40)
+// PORT_START("SW501")
+// PORT_DIPNAME( 0x1f, 0x00, "Unused" ) PORT_DIPLOCATION("S1:1,S1:2,S1:3,S1:4,S1:5")
+// PORT_DIPNAME( 0x20, 0x20, "Perform memory test at start" ) PORT_DIPLOCATION("S1:6")
+// PORT_DIPSETTING( 0x20, DEF_STR( Off ) )
+// PORT_DIPSETTING( 0x00, DEF_STR( On ) )
+// PORT_DIPNAME( 0xc0, 0x00, "Console Baud rate" ) PORT_DIPLOCATION("S1:7")
+// PORT_DIPSETTING( 0x00, "9600" )
+// PORT_DIPSETTING( 0x40, "19200" )
+// PORT_DIPSETTING( 0x80, "38400" )
+// PORT_DIPSETTING( 0xc0, "57600" )
+
+ // Settings with the MTR-89 ROM (#444-62)
+// PORT_START("SW501")
+// PORT_DIPNAME( 0x03, 0x00, "Expansion 1" ) PORT_DIPLOCATION("S1:1,S1:2")
+// PORT_DIPSETTING( 0x00, "H-88-1" )
+// PORT_DIPSETTING( 0x01, "H/Z-47" )
+// PORT_DIPSETTING( 0x02, "Undefined" )
+// PORT_DIPSETTING( 0x03, "Undefined" )
+// PORT_DIPNAME( 0x0c, 0x00, "Expansion 2" ) PORT_DIPLOCATION("S1:3,S1:4")
+// PORT_DIPSETTING( 0x00, "Unused" )
+// PORT_DIPSETTING( 0x04, "H/Z-47" )
+// PORT_DIPSETTING( 0x08, "Undefined" )
+// PORT_DIPSETTING( 0x0c, "Undefined" )
+// PORT_DIPNAME( 0x10, 0x00, "Boot from" ) PORT_DIPLOCATION("S1:5")
+// PORT_DIPSETTING( 0x00, "Expansion 1" )
+// PORT_DIPSETTING( 0x10, "Expansion 2" )
+// PORT_DIPNAME( 0x20, 0x20, "Perform memory test at start" ) PORT_DIPLOCATION("S1:6")
+// PORT_DIPSETTING( 0x20, DEF_STR( Off ) )
+// PORT_DIPSETTING( 0x00, DEF_STR( On ) )
+// PORT_DIPNAME( 0x40, 0x00, "Console Baud rate" ) PORT_DIPLOCATION("S1:7")
+// PORT_DIPSETTING( 0x00, "9600" )
+// PORT_DIPSETTING( 0x40, "19200" )
+// PORT_DIPNAME( 0x80, 0x00, "Boot mode" ) PORT_DIPLOCATION("S1:8")
+// PORT_DIPSETTING( 0x00, DEF_STR( Normal ) )
+// PORT_DIPSETTING( 0x80, "Auto" )
+
+ // Settings with the MTR-90 ROM (#444-84 or 444-142)
PORT_START("SW501")
PORT_DIPNAME( 0x03, 0x00, "Expansion 1" ) PORT_DIPLOCATION("S1:1,S1:2")
PORT_DIPSETTING( 0x00, "H-88-1" )
@@ -105,10 +160,13 @@ TIMER_DEVICE_CALLBACK_MEMBER(h89_state::h89_irq_timer)
WRITE8_MEMBER( h89_state::port_f2_w )
{
+ // Bit 0 - Single-step
+ // Bit 1 - Enable timer interrupt (2mSec Clock)
m_port_f2 = data;
}
static DEVICE_INPUT_DEFAULTS_START( terminal )
+ // TODO - baud rate should be controlled by SW501 setting
DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_9600 )
DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_9600 )
DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 )
diff --git a/src/mame/drivers/hng64.cpp b/src/mame/drivers/hng64.cpp
index 0df1f10f4c8..93dab2a4e37 100644
--- a/src/mame/drivers/hng64.cpp
+++ b/src/mame/drivers/hng64.cpp
@@ -1553,6 +1553,10 @@ static MACHINE_CONFIG_START(hng64, hng64_state)
MCFG_FRAGMENT_ADD( hng64_audio )
MCFG_FRAGMENT_ADD( hng64_network )
+
+ MCFG_CPU_ADD("iomcu", TMP87PH40AN, 8000000)
+ MCFG_DEVICE_DISABLE() // work in progress
+
MACHINE_CONFIG_END
@@ -1574,9 +1578,9 @@ MACHINE_CONFIG_END
ROM_LOAD ( "from1.bin", 0x000000, 0x080000, CRC(6b933005) SHA1(e992747f46c48b66e5509fe0adf19c91250b00c7) ) \
ROM_REGION( 0x0100000, "fpga", 0 ) /* FPGA data */ \
ROM_LOAD ( "rom1.bin", 0x000000, 0x01ff32, CRC(4a6832dc) SHA1(ae504f7733c2f40450157cd1d3b85bc83fac8569) ) \
- ROM_REGION( 0x08000, "iomcu", 0 ) /* unknown I/O MCU, might be Shooting type, came from recycled OTP chip sample, not a HNG64 board. */ \
- /* "64Bit I/O Controller Ver 1.0 1997.06.29(C)SNK" internal ID string */ \
- ROM_LOAD ( "tmp87ph40an.bin", 0x000000, 0x08000, CRC(b70df21f) SHA1(5b742e8a0bbf4c0ae4f4398d34c7058fb24acc92) )
+ ROM_REGION( 0x10000, "iomcu", 0 ) /* "64Bit I/O Controller Ver 1.0 1997.06.29(C)SNK" internal ID string */ \
+ /* this was dumped from a TMP87PH40AN type chip. Some boards use a TMP87CH40N, in all cases they're stickered SNK-IOJ1.00A so likely the same content */ \
+ ROM_LOAD ( "tmp87ph40an.bin", 0x8000, 0x8000, CRC(b70df21f) SHA1(5b742e8a0bbf4c0ae4f4398d34c7058fb24acc92) )
ROM_START( hng64 )
diff --git a/src/mame/drivers/igs011.cpp b/src/mame/drivers/igs011.cpp
index a2d18ca6302..b3c1274878e 100644
--- a/src/mame/drivers/igs011.cpp
+++ b/src/mame/drivers/igs011.cpp
@@ -4788,6 +4788,25 @@ ROM_START( vbowlj )
ROM_COPY( "ics", 0x000000, 0x300000,0x100000)
ROM_END
+ROM_START( vbowlhk )
+ ROM_REGION( 0x80000, "maincpu", 0 )
+ ROM_LOAD16_WORD_SWAP( "bowlingv101hjs.bin", 0x00000, 0x80000, CRC(92fbfa72) SHA1(824b666ea2247ef5a974675925bcef94dbd1a992) ) // second half all 00
+
+ ROM_REGION( 0x400000 * 2, "blitter", 0)
+ ROM_LOAD( "vrbowlng.u69", 0x000000, 0x400000, CRC(b0d339e8) SHA1(a26a5e0202a78e8cdc562b10d64e14eadfa4e115) )
+ // extra space to expand every 4 bits to 8
+
+ ROM_REGION( 0x100000, "blitter_hi", ROMREGION_INVERT )
+ ROM_LOAD( "vrbowlng.u68", 0x000000, 0x100000, CRC(b0ce27e7) SHA1(6d3ef97edd606f384b1e05b152fbea12714887b7) )
+
+ ROM_REGION( 0x400000, "ics", 0 )
+ ROM_LOAD( "vrbowlng.u67", 0x00000, 0x80000, CRC(53000936) SHA1(e50c6216f559a9248c095bdfae05c3be4be79ff3) ) // 8 bit signed mono & u-law
+ ROM_LOAD( "vrbowlng.u66", 0x80000, 0x80000, CRC(f62cf8ed) SHA1(c53e47e2c619ed974ad40ee4aaa4a35147ea8311) ) // 8 bit signed mono
+ ROM_COPY( "ics", 0x000000, 0x100000,0x100000)
+ ROM_COPY( "ics", 0x000000, 0x200000,0x100000)
+ ROM_COPY( "ics", 0x000000, 0x300000,0x100000)
+ROM_END
+
/***************************************************************************
Xing Yen Man Guan
@@ -4821,21 +4840,22 @@ ROM_END
***************************************************************************/
-GAME( 1997, drgnwrld, 0, drgnwrld, drgnwrld, igs011_state, drgnwrld, ROT0, "IGS", "Dragon World (World, V040O)", MACHINE_SUPPORTS_SAVE )
-GAME( 1995, drgnwrldv30, drgnwrld, drgnwrld, drgnwrld, igs011_state, drgnwrldv30, ROT0, "IGS", "Dragon World (World, V030O)", MACHINE_SUPPORTS_SAVE )
-GAME( 1995, drgnwrldv21, drgnwrld, drgnwrld_igs012, drgnwrld, igs011_state, drgnwrldv21, ROT0, "IGS", "Dragon World (World, V021O)", MACHINE_SUPPORTS_SAVE )
-GAME( 1995, drgnwrldv21j, drgnwrld, drgnwrld_igs012, drgnwrldj, igs011_state, drgnwrldv21j, ROT0, "IGS / Alta", "Zhong Guo Long (Japan, V021J)", MACHINE_SUPPORTS_SAVE )
-GAME( 1995, drgnwrldv20j, drgnwrld, drgnwrld_igs012, drgnwrldj, igs011_state, drgnwrldv20j, ROT0, "IGS / Alta", "Zhong Guo Long (Japan, V020J)", MACHINE_SUPPORTS_SAVE )
-GAME( 1995, drgnwrldv10c, drgnwrld, drgnwrld, drgnwrldc, igs011_state, drgnwrldv10c, ROT0, "IGS", "Zhong Guo Long (China, V010C)", MACHINE_SUPPORTS_SAVE )
-GAME( 1995, drgnwrldv11h, drgnwrld, drgnwrld, drgnwrldc, igs011_state, drgnwrldv11h, ROT0, "IGS", "Dong Fang Zhi Zhu (Hong Kong, V011H)", MACHINE_SUPPORTS_SAVE )
-GAME( 1995, drgnwrldv40k, drgnwrld, drgnwrld_igs012, drgnwrldc, igs011_state, drgnwrldv40k, ROT0, "IGS", "Dragon World (Korea, V040K)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING )
-GAME( 1995, lhb, 0, lhb, lhb, igs011_state, lhb, ROT0, "IGS", "Long Hu Bang (China, V035C)", MACHINE_SUPPORTS_SAVE )
-GAME( 1995, lhbv33c, lhb, lhb, lhb, igs011_state, lhbv33c, ROT0, "IGS", "Long Hu Bang (China, V033C)", MACHINE_SUPPORTS_SAVE )
-GAME( 1995, dbc, lhb, lhb, lhb, igs011_state, dbc, ROT0, "IGS", "Da Ban Cheng (Hong Kong, V027H)", MACHINE_SUPPORTS_SAVE )
-GAME( 1995, ryukobou, lhb, lhb, lhb, igs011_state, ryukobou, ROT0, "IGS / Alta", "Mahjong Ryukobou (Japan, V030J)", MACHINE_SUPPORTS_SAVE )
-GAME( 1996, lhb2, 0, lhb2, lhb2, igs011_state, lhb2, ROT0, "IGS", "Long Hu Bang II (Hong Kong, V185H)", MACHINE_SUPPORTS_SAVE )
-GAME( 1996, xymg, 0, xymg, xymg, igs011_state, xymg, ROT0, "IGS", "Xing Yun Man Guan (China, V651C)", MACHINE_SUPPORTS_SAVE )
-GAME( 1996, wlcc, xymg, wlcc, wlcc, igs011_state, wlcc, ROT0, "IGS", "Wan Li Chang Cheng (China, V638C)", MACHINE_SUPPORTS_SAVE )
-GAME( 1996, vbowl, 0, vbowl, vbowl, igs011_state, vbowl, ROT0, "IGS", "Virtua Bowling (World, V101XCM)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND )
-GAME( 1996, vbowlj, vbowl, vbowl, vbowlj, igs011_state, vbowlj, ROT0, "IGS / Alta", "Virtua Bowling (Japan, V100JCM)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND )
-GAME( 1998, nkishusp, lhb2, nkishusp, nkishusp, igs011_state, nkishusp, ROT0, "IGS / Alta", "Mahjong Nenrikishu SP (Japan, V250J)", MACHINE_SUPPORTS_SAVE )
+GAME( 1997, drgnwrld, 0, drgnwrld, drgnwrld, igs011_state, drgnwrld, ROT0, "IGS", "Dragon World (World, V040O)", MACHINE_SUPPORTS_SAVE )
+GAME( 1995, drgnwrldv30, drgnwrld, drgnwrld, drgnwrld, igs011_state, drgnwrldv30, ROT0, "IGS", "Dragon World (World, V030O)", MACHINE_SUPPORTS_SAVE )
+GAME( 1995, drgnwrldv21, drgnwrld, drgnwrld_igs012, drgnwrld, igs011_state, drgnwrldv21, ROT0, "IGS", "Dragon World (World, V021O)", MACHINE_SUPPORTS_SAVE )
+GAME( 1995, drgnwrldv21j, drgnwrld, drgnwrld_igs012, drgnwrldj, igs011_state, drgnwrldv21j, ROT0, "IGS / Alta", "Zhong Guo Long (Japan, V021J)", MACHINE_SUPPORTS_SAVE )
+GAME( 1995, drgnwrldv20j, drgnwrld, drgnwrld_igs012, drgnwrldj, igs011_state, drgnwrldv20j, ROT0, "IGS / Alta", "Zhong Guo Long (Japan, V020J)", MACHINE_SUPPORTS_SAVE )
+GAME( 1995, drgnwrldv10c, drgnwrld, drgnwrld, drgnwrldc, igs011_state, drgnwrldv10c, ROT0, "IGS", "Zhong Guo Long (China, V010C)", MACHINE_SUPPORTS_SAVE )
+GAME( 1995, drgnwrldv11h, drgnwrld, drgnwrld, drgnwrldc, igs011_state, drgnwrldv11h, ROT0, "IGS", "Dong Fang Zhi Zhu (Hong Kong, V011H)", MACHINE_SUPPORTS_SAVE )
+GAME( 1995, drgnwrldv40k, drgnwrld, drgnwrld_igs012, drgnwrldc, igs011_state, drgnwrldv40k, ROT0, "IGS", "Dragon World (Korea, V040K)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING )
+GAME( 1995, lhb, 0, lhb, lhb, igs011_state, lhb, ROT0, "IGS", "Long Hu Bang (China, V035C)", MACHINE_SUPPORTS_SAVE )
+GAME( 1995, lhbv33c, lhb, lhb, lhb, igs011_state, lhbv33c, ROT0, "IGS", "Long Hu Bang (China, V033C)", MACHINE_SUPPORTS_SAVE )
+GAME( 1995, dbc, lhb, lhb, lhb, igs011_state, dbc, ROT0, "IGS", "Da Ban Cheng (Hong Kong, V027H)", MACHINE_SUPPORTS_SAVE )
+GAME( 1995, ryukobou, lhb, lhb, lhb, igs011_state, ryukobou, ROT0, "IGS / Alta", "Mahjong Ryukobou (Japan, V030J)", MACHINE_SUPPORTS_SAVE )
+GAME( 1996, lhb2, 0, lhb2, lhb2, igs011_state, lhb2, ROT0, "IGS", "Long Hu Bang II (Hong Kong, V185H)", MACHINE_SUPPORTS_SAVE )
+GAME( 1996, xymg, 0, xymg, xymg, igs011_state, xymg, ROT0, "IGS", "Xing Yun Man Guan (China, V651C)", MACHINE_SUPPORTS_SAVE )
+GAME( 1996, wlcc, xymg, wlcc, wlcc, igs011_state, wlcc, ROT0, "IGS", "Wan Li Chang Cheng (China, V638C)", MACHINE_SUPPORTS_SAVE )
+GAME( 1996, vbowl, 0, vbowl, vbowl, igs011_state, vbowl, ROT0, "IGS", "Virtua Bowling (World, V101XCM)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND )
+GAME( 1996, vbowlj, vbowl, vbowl, vbowlj, igs011_state, vbowlj, ROT0, "IGS / Alta", "Virtua Bowling (Japan, V100JCM)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND )
+GAME( 1996, vbowlhk, vbowl, vbowl, vbowl, igs011_state, vbowlj, ROT0, "IGS / Tai Tin Amusement", "Virtua Bowling (Honk Kong, V101HJS)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING |MACHINE_IMPERFECT_SOUND ) // different encryption?
+GAME( 1998, nkishusp, lhb2, nkishusp, nkishusp, igs011_state, nkishusp, ROT0, "IGS / Alta", "Mahjong Nenrikishu SP (Japan, V250J)", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/intv.cpp b/src/mame/drivers/intv.cpp
index c73695c5d33..d29ffaf0e59 100644
--- a/src/mame/drivers/intv.cpp
+++ b/src/mame/drivers/intv.cpp
@@ -53,6 +53,7 @@ RO-3-9506 = 8KiB (4Kiw) self decoding address mask rom with external address dec
#include "emu.h"
#include "cpu/m6502/m6502.h"
#include "cpu/cp1610/cp1610.h"
+#include "video/tms9927.h"
#include "includes/intv.h"
#include "sound/ay8910.h"
#include "softlist.h"
@@ -236,7 +237,7 @@ static INPUT_PORTS_START( intvkbd )
PORT_START("ROW7")
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+')
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('O') PORT_CHAR(')')
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')')
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*')
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('\xA2')
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$')
@@ -409,8 +410,10 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( intvkbd2_mem , AS_PROGRAM, 8, intv_state )
ADDRESS_MAP_UNMAP_HIGH /* Required because of probing */
AM_RANGE(0x0000, 0x3fff) AM_READWRITE(intvkbd_dualport8_lsb_r, intvkbd_dualport8_lsb_w) /* Dual-port RAM */
- AM_RANGE(0x4000, 0x7fff) AM_READWRITE(intvkbd_dualport8_msb_r, intvkbd_dualport8_msb_w) /* Dual-port RAM */
- AM_RANGE(0xb7f8, 0xb7ff) AM_RAM /* ??? */
+ AM_RANGE(0x4000, 0x40bf) AM_READWRITE(intvkbd_io_r, intvkbd_io_w)
+ AM_RANGE(0x40c0, 0x40cf) AM_DEVREADWRITE("crtc", tms9927_device, read, write)
+ AM_RANGE(0x4200, 0x7fff) AM_READWRITE(intvkbd_dualport8_msb_r, intvkbd_dualport8_msb_w) /* Dual-port RAM */
+ AM_RANGE(0xb7f8, 0xb7ff) AM_READWRITE(intvkbd_periph_r, intvkbd_periph_w)
AM_RANGE(0xb800, 0xbfff) AM_RAM AM_SHARE("videoram") /* Text Display */
AM_RANGE(0xc000, 0xdfff) AM_ROM
AM_RANGE(0xe000, 0xffff) AM_READ(intvkb_iocart_r)
@@ -538,9 +541,13 @@ static MACHINE_CONFIG_DERIVED( intvkbd, intv )
MCFG_PALETTE_MODIFY("palette")
MCFG_PALETTE_INIT_OWNER(intv_state, intv)
+ /* crt controller */
+ MCFG_DEVICE_ADD("crtc", TMS9927, XTAL_7_15909MHz)
+ MCFG_TMS9927_CHAR_WIDTH(8)
+ MCFG_TMS9927_OVERSCAN(STIC_OVERSCAN_LEFT_WIDTH*STIC_X_SCALE*INTVKBD_X_SCALE, STIC_OVERSCAN_RIGHT_WIDTH*STIC_X_SCALE*INTVKBD_X_SCALE,
+ STIC_OVERSCAN_TOP_HEIGHT*STIC_Y_SCALE*INTVKBD_Y_SCALE, STIC_OVERSCAN_BOTTOM_HEIGHT*STIC_Y_SCALE*INTVKBD_Y_SCALE)
+
MCFG_SCREEN_MODIFY("screen")
- MCFG_SCREEN_SIZE((STIC_OVERSCAN_LEFT_WIDTH+STIC_BACKTAB_WIDTH*STIC_CARD_WIDTH-1+STIC_OVERSCAN_RIGHT_WIDTH)*STIC_X_SCALE*INTVKBD_X_SCALE, (STIC_OVERSCAN_TOP_HEIGHT+STIC_BACKTAB_HEIGHT*STIC_CARD_HEIGHT+STIC_OVERSCAN_BOTTOM_HEIGHT)*STIC_Y_SCALE*INTVKBD_Y_SCALE)
- MCFG_SCREEN_VISIBLE_AREA(0, (STIC_OVERSCAN_LEFT_WIDTH+STIC_BACKTAB_WIDTH*STIC_CARD_WIDTH-1+STIC_OVERSCAN_RIGHT_WIDTH)*STIC_X_SCALE*INTVKBD_X_SCALE-1, 0, (STIC_OVERSCAN_TOP_HEIGHT+STIC_BACKTAB_HEIGHT*STIC_CARD_HEIGHT+STIC_OVERSCAN_BOTTOM_HEIGHT)*STIC_Y_SCALE*INTVKBD_Y_SCALE-1)
MCFG_SCREEN_UPDATE_DRIVER(intv_state, screen_update_intvkbd)
/* I/O cartslots for BASIC */
diff --git a/src/mame/drivers/lastbank.cpp b/src/mame/drivers/lastbank.cpp
index 94526115a8c..d89033ac514 100644
--- a/src/mame/drivers/lastbank.cpp
+++ b/src/mame/drivers/lastbank.cpp
@@ -8,14 +8,14 @@
Uses a TC0091LVC, a variant of the one used on Taito L HW
- TODO:
- - sound;
-
***************************************************************************/
#include "emu.h"
#include "cpu/z80/z80.h"
#include "sound/2203intf.h"
+#include "sound/es8712.h"
+#include "sound/okim6295.h"
+#include "machine/nvram.h"
#include "machine/tc009xlvc.h"
#define MASTER_CLOCK XTAL_14_31818MHz
@@ -26,11 +26,15 @@ public:
lastbank_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
- m_vdp(*this, "tc0091lvc")
+ m_vdp(*this, "tc0091lvc"),
+ m_oki(*this, "oki"),
+ m_essnd(*this, "essnd")
{ }
required_device<cpu_device> m_maincpu;
required_device<tc0091lvc_device> m_vdp;
+ required_device<okim6295_device> m_oki;
+ required_device<es8712_device> m_essnd;
virtual void video_start() override;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
@@ -41,6 +45,8 @@ public:
uint8_t m_irq_vector[3];
uint8_t m_irq_enable;
uint8_t m_mux_data;
+ uint8_t m_soundlatch[2];
+ uint8_t m_sound_flags;
DECLARE_READ8_MEMBER(lastbank_rom_r);
@@ -53,8 +59,16 @@ public:
DECLARE_WRITE8_MEMBER(lastbank_ram_2_w);
DECLARE_WRITE8_MEMBER(lastbank_ram_3_w);
+ DECLARE_WRITE8_MEMBER(output_w);
+
DECLARE_READ8_MEMBER(mux_0_r);
DECLARE_WRITE8_MEMBER(mux_w);
+ DECLARE_WRITE8_MEMBER(soundlatch_w);
+
+ DECLARE_READ8_MEMBER(soundlatch1_r);
+ DECLARE_READ8_MEMBER(soundlatch2_r);
+ DECLARE_WRITE8_MEMBER(sound_flags_w);
+ DECLARE_CUSTOM_INPUT_MEMBER(sound_status_r);
DECLARE_READ8_MEMBER(lastbank_rom_bank_r);
DECLARE_WRITE8_MEMBER(lastbank_rom_bank_w);
@@ -180,16 +194,50 @@ READ8_MEMBER(lastbank_state::mux_0_r)
return res;
}
+WRITE8_MEMBER(lastbank_state::output_w)
+{
+ //logerror("%s: Writing %02x to A80%x\n", machine().describe_context(), data, offset);
+}
+
WRITE8_MEMBER(lastbank_state::mux_w)
{
m_mux_data = data;
}
+WRITE8_MEMBER(lastbank_state::soundlatch_w)
+{
+ m_soundlatch[offset] = data;
+}
+
+READ8_MEMBER(lastbank_state::soundlatch1_r)
+{
+ return m_soundlatch[0];
+}
+
+READ8_MEMBER(lastbank_state::soundlatch2_r)
+{
+ return m_soundlatch[1];
+}
+
+WRITE8_MEMBER(lastbank_state::sound_flags_w)
+{
+ m_sound_flags = data;
+ if (!BIT(data, 4))
+ m_essnd->reset();
+ if (!BIT(data, 5))
+ m_oki->reset();
+}
+
+CUSTOM_INPUT_MEMBER(lastbank_state::sound_status_r)
+{
+ return BIT(m_sound_flags, 0) << 1 | BIT(m_sound_flags, 1);
+}
+
static ADDRESS_MAP_START( tc0091lvc_map, AS_PROGRAM, 8, lastbank_state )
AM_RANGE(0x0000, 0x5fff) AM_ROM
AM_RANGE(0x6000, 0x7fff) AM_READ(lastbank_rom_r)
- AM_RANGE(0x8000, 0x9fff) AM_RAM
+ AM_RANGE(0x8000, 0x9fff) AM_RAM AM_SHARE("nvram")
AM_RANGE(0xc000, 0xcfff) AM_READWRITE(lastbank_ram_0_r,lastbank_ram_0_w)
AM_RANGE(0xd000, 0xdfff) AM_READWRITE(lastbank_ram_1_r,lastbank_ram_1_w)
@@ -205,15 +253,13 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( lastbank_map, AS_PROGRAM, 8, lastbank_state )
AM_IMPORT_FROM( tc0091lvc_map )
- AM_RANGE(0xa000, 0xa7ff) AM_RAM AM_SHARE("share1")
- AM_RANGE(0xa800, 0xa800) AM_READ_PORT("COINS") AM_WRITENOP
- AM_RANGE(0xa801, 0xa801) AM_WRITENOP
- AM_RANGE(0xa802, 0xa802) AM_WRITENOP
+ AM_RANGE(0xa000, 0xa00d) AM_NOP // MSM62X42B or equivalent probably read from here
+ AM_RANGE(0xa800, 0xa800) AM_READ_PORT("COINS")
+ AM_RANGE(0xa800, 0xa802) AM_WRITE(output_w)
AM_RANGE(0xa803, 0xa803) AM_WRITE(mux_w) // mux for $a808 / $a80c
- AM_RANGE(0xa804, 0xa804) AM_READ_PORT("VBLANK")
- AM_RANGE(0xa805, 0xa805) AM_WRITENOP
- AM_RANGE(0xa806, 0xa806) AM_WRITENOP
- AM_RANGE(0xa807, 0xa807) AM_WRITENOP
+ AM_RANGE(0xa804, 0xa804) AM_READ_PORT("SPECIAL")
+ AM_RANGE(0xa805, 0xa806) AM_WRITE(soundlatch_w)
+ AM_RANGE(0xa807, 0xa807) AM_WRITENOP // hopper?
AM_RANGE(0xa808, 0xa808) AM_READ(mux_0_r)
AM_RANGE(0xa80c, 0xa80c) AM_READ(mux_0_r)
AM_RANGE(0xa81c, 0xa81c) AM_READ_PORT("DSW0")
@@ -225,11 +271,15 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( lastbank_audio_map, AS_PROGRAM, 8, lastbank_state )
AM_RANGE(0x0000, 0xbfff) AM_ROM
AM_RANGE(0xc000, 0xdfff) AM_RAM
- AM_RANGE(0xe000, 0xe7ff) AM_RAM AM_SHARE("share1")
+ AM_RANGE(0xe000, 0xe7ff) AM_RAM
ADDRESS_MAP_END
static ADDRESS_MAP_START( lastbank_audio_io, AS_IO, 8, lastbank_state )
ADDRESS_MAP_GLOBAL_MASK(0xff)
+ AM_RANGE(0x00, 0x06) AM_DEVREADWRITE("essnd", es8712_device, read, write)
+ AM_RANGE(0x40, 0x40) AM_DEVREADWRITE("oki", okim6295_device, read, write)
+ AM_RANGE(0x80, 0x80) AM_READ(soundlatch1_r) AM_WRITE(sound_flags_w)
+ AM_RANGE(0xc0, 0xc0) AM_READ(soundlatch2_r)
ADDRESS_MAP_END
static INPUT_PORTS_START( lastbank )
@@ -237,169 +287,179 @@ static INPUT_PORTS_START( lastbank )
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_GAMBLE_KEYOUT ) PORT_CODE(KEYCODE_M)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT )
PORT_SERVICE_NO_TOGGLE( 0x04, IP_ACTIVE_LOW )
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Bookkeeping")
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_GAMBLE_BOOK )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN3 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_GAMBLE_KEYIN ) PORT_CODE(KEYCODE_N)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
- PORT_START("VBLANK")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE2 ) PORT_NAME("Reset")
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE3 ) PORT_NAME("Service")
+ PORT_START("SPECIAL")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MEMORY_RESET )
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_GAMBLE_SERVICE )
PORT_DIPNAME( 0x04, 0x04, "Hopper Count" )
PORT_DIPSETTING( 0x04, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x08, 0x08, "Hopper Empty" )
PORT_DIPSETTING( 0x08, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_UNKNOWN ) // bit 6 is a status of some sort
- PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen")
+ PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, lastbank_state, sound_status_r, nullptr)
PORT_START("P1_KEY0")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON15 ) PORT_NAME("1P 5-6") PORT_CODE(KEYCODE_V)
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON10 ) PORT_NAME("1P 3-4") PORT_CODE(KEYCODE_G)
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("5-6") PORT_CODE(KEYCODE_B)
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("3-4") PORT_CODE(KEYCODE_G)
PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON14 ) PORT_NAME("1P 4-6") PORT_CODE(KEYCODE_C)
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON13 ) PORT_NAME("1P 4-5") PORT_CODE(KEYCODE_X)
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("4-6") PORT_CODE(KEYCODE_V)
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("4-5") PORT_CODE(KEYCODE_C)
PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("P1_KEY1")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_GAMBLE_LOW ) PORT_NAME("1P Small") PORT_CODE(KEYCODE_Y)
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("1P 1-4") PORT_CODE(KEYCODE_E)
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_GAMBLE_LOW ) PORT_NAME("Small") PORT_CODE(KEYCODE_Y)
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("1-4") PORT_CODE(KEYCODE_E)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1P FF") PORT_CODE(KEYCODE_0_PAD)
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("1P 2-4") PORT_CODE(KEYCODE_S)
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("FF") PORT_CODE(KEYCODE_MINUS)
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("2-4") PORT_CODE(KEYCODE_S)
PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("P1_KEY2")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_GAMBLE_HIGH ) PORT_NAME("1P Big") PORT_CODE(KEYCODE_U)
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON16 ) PORT_NAME("1P Cancel") PORT_CODE(KEYCODE_I)
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("1P 1-2") PORT_CODE(KEYCODE_Q)
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON11 ) PORT_NAME("1P 3-5") PORT_CODE(KEYCODE_H)
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON9 ) PORT_NAME("1P 2-6") PORT_CODE(KEYCODE_F)
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("1P 1-6") PORT_CODE(KEYCODE_T)
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_GAMBLE_HIGH ) PORT_NAME("Big") PORT_CODE(KEYCODE_U)
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Cancel") PORT_CODE(KEYCODE_SPACE)
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("1-2") PORT_CODE(KEYCODE_Q)
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("3-5") PORT_CODE(KEYCODE_Z)
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("2-6") PORT_CODE(KEYCODE_F)
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("1-6") PORT_CODE(KEYCODE_T)
PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("P1_KEY3")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_GAMBLE_D_UP )
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("1P 1-5") PORT_CODE(KEYCODE_R)
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("1-5") PORT_CODE(KEYCODE_R)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1P Payout") PORT_CODE(KEYCODE_O)
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("1P 2-5") PORT_CODE(KEYCODE_D)
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Payout 2") PORT_CODE(KEYCODE_O)
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("2-5") PORT_CODE(KEYCODE_D)
PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("P1_KEY4")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_GAMBLE_TAKE )
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_GAMBLE_BET ) PORT_NAME("1P Autobet") PORT_CODE(KEYCODE_2)
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("1P 1-3") PORT_CODE(KEYCODE_W)
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON12 ) PORT_NAME("1P 3-6") PORT_CODE(KEYCODE_Z)
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_GAMBLE_BET ) PORT_NAME("Auto Bet") PORT_CODE(KEYCODE_2)
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("1-3") PORT_CODE(KEYCODE_W)
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("3-6") PORT_CODE(KEYCODE_X)
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("1P 2-3") PORT_CODE(KEYCODE_A)
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("2-3") PORT_CODE(KEYCODE_A)
PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("DSW0")
- PORT_DIPNAME( 0x01, 0x01, "DSWA" )
+ PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW1:1")
PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
+ PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW1:2")
PORT_DIPSETTING( 0x02, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
+ PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW1:3")
PORT_DIPSETTING( 0x04, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
+ PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW1:4")
PORT_DIPSETTING( 0x08, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
+ PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW1:5")
PORT_DIPSETTING( 0x10, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
+ PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW1:6")
PORT_DIPSETTING( 0x20, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
+ PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW1:7")
PORT_DIPSETTING( 0x40, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
+ PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW1:8")
PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_START("DSW1")
- PORT_DIPNAME( 0x01, 0x01, "DSWA" )
+ PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW2:1")
PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
+ PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW2:2")
PORT_DIPSETTING( 0x02, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
+ PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW2:3")
PORT_DIPSETTING( 0x04, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
+ PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW2:4")
PORT_DIPSETTING( 0x08, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
+ PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW2:5")
PORT_DIPSETTING( 0x10, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
+ PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW2:6")
PORT_DIPSETTING( 0x20, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
- PORT_DIPSETTING( 0x40, DEF_STR( Off ) )
- PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
+ PORT_DIPNAME( 0x40, 0x40, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("DSW2:7")
+ PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
+ PORT_DIPSETTING( 0x40, DEF_STR( On ) )
+ PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW2:8")
PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_START("DSW2")
- PORT_DIPNAME( 0x01, 0x01, "DSWA" )
- PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
- PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
- PORT_DIPSETTING( 0x02, DEF_STR( Off ) )
- PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
- PORT_DIPSETTING( 0x04, DEF_STR( Off ) )
- PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
- PORT_DIPSETTING( 0x08, DEF_STR( Off ) )
- PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
- PORT_DIPSETTING( 0x10, DEF_STR( Off ) )
- PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
- PORT_DIPSETTING( 0x20, DEF_STR( Off ) )
- PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
- PORT_DIPSETTING( 0x40, DEF_STR( Off ) )
- PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
- PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
- PORT_DIPSETTING( 0x00, DEF_STR( On ) )
+ PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("DSW3:1,2,3,4")
+ PORT_DIPSETTING( 0x07, "1 Coin /100 Credits" )
+ PORT_DIPSETTING( 0x08, "1 Coin /50 Credits" )
+ PORT_DIPSETTING( 0x09, "1 Coin /25 Credits" )
+ PORT_DIPSETTING( 0x0a, "1 Coin /20 Credits" )
+ PORT_DIPSETTING( 0x0b, "1 Coin /10 Credits" )
+ PORT_DIPSETTING( 0x0c, DEF_STR( 1C_5C ) )
+ PORT_DIPSETTING( 0x0d, DEF_STR( 1C_3C ) )
+ PORT_DIPSETTING( 0x01, "5 Coins /2 Credits" )
+ PORT_DIPSETTING( 0x0e, DEF_STR( 1C_2C ) )
+ PORT_DIPSETTING( 0x05, DEF_STR( 2C_3C ) )
+ PORT_DIPSETTING( 0x0f, DEF_STR( 1C_1C ) )
+ PORT_DIPSETTING( 0x06, DEF_STR( 2C_1C ) )
+ PORT_DIPSETTING( 0x04, DEF_STR( 3C_1C ) )
+ PORT_DIPSETTING( 0x03, DEF_STR( 4C_1C ) )
+ PORT_DIPSETTING( 0x02, DEF_STR( 5C_1C ) )
+ PORT_DIPSETTING( 0x00, "10 Coins /1 Credit" )
+ PORT_DIPNAME( 0xf0, 0xf0, "Coin C" ) PORT_DIPLOCATION("DSW3:5,6,7,8")
+ PORT_DIPSETTING( 0x70, "1 Coin /100 Credits" )
+ PORT_DIPSETTING( 0x80, "1 Coin /50 Credits" )
+ PORT_DIPSETTING( 0x90, "1 Coin /25 Credits" )
+ PORT_DIPSETTING( 0xa0, "1 Coin /20 Credits" )
+ PORT_DIPSETTING( 0xb0, "1 Coin /10 Credits" )
+ PORT_DIPSETTING( 0xc0, DEF_STR( 1C_5C ) )
+ PORT_DIPSETTING( 0xd0, DEF_STR( 1C_3C ) )
+ PORT_DIPSETTING( 0x10, "5 Coins /2 Credits" )
+ PORT_DIPSETTING( 0xe0, DEF_STR( 1C_2C ) )
+ PORT_DIPSETTING( 0x50, DEF_STR( 2C_3C ) )
+ PORT_DIPSETTING( 0xf0, DEF_STR( 1C_1C ) )
+ PORT_DIPSETTING( 0x60, DEF_STR( 2C_1C ) )
+ PORT_DIPSETTING( 0x40, DEF_STR( 3C_1C ) )
+ PORT_DIPSETTING( 0x30, DEF_STR( 4C_1C ) )
+ PORT_DIPSETTING( 0x20, DEF_STR( 5C_1C ) )
+ PORT_DIPSETTING( 0x00, "10 Coins /1 Credit" )
PORT_START("DSW3")
- PORT_DIPNAME( 0x01, 0x01, "DSWA" )
+ PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW4:1")
PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
+ PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW4:2")
PORT_DIPSETTING( 0x02, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
+ PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW4:3")
PORT_DIPSETTING( 0x04, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
- PORT_DIPSETTING( 0x08, DEF_STR( Off ) )
- PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
- PORT_DIPSETTING( 0x10, DEF_STR( Off ) )
- PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
- PORT_DIPSETTING( 0x20, DEF_STR( Off ) )
- PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
+ PORT_DIPNAME( 0x38, 0x38, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("DSW4:4,5,6")
+ PORT_DIPSETTING( 0x30, "1 Coin /50 Credits" )
+ PORT_DIPSETTING( 0x38, DEF_STR( 1C_1C ) )
+ PORT_DIPSETTING( 0x28, DEF_STR( 2C_1C ) )
+ PORT_DIPSETTING( 0x20, DEF_STR( 3C_1C ) )
+ PORT_DIPSETTING( 0x18, DEF_STR( 5C_1C ) )
+ PORT_DIPSETTING( 0x10, DEF_STR( 6C_1C ) )
+ PORT_DIPSETTING( 0x08, "9 Coins /1 Credit" )
+ PORT_DIPSETTING( 0x00, "10 Coins /1 Credit" )
+ PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW4:7")
PORT_DIPSETTING( 0x40, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
+ PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW4:8")
PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
INPUT_PORTS_END
@@ -458,10 +518,12 @@ static MACHINE_CONFIG_START( lastbank, lastbank_state )
MCFG_CPU_PROGRAM_MAP(lastbank_map)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", lastbank_state, lastbank_irq_scanline, "screen", 0, 1)
+ MCFG_NVRAM_ADD_0FILL("nvram")
+
MCFG_CPU_ADD("audiocpu",Z80,MASTER_CLOCK/4)
MCFG_CPU_PROGRAM_MAP(lastbank_audio_map)
MCFG_CPU_IO_MAP(lastbank_audio_io)
- MCFG_CPU_PERIODIC_INT_DRIVER(lastbank_state, nmi_line_pulse, 60)
+ // yes, we have no interrupts
MCFG_QUANTUM_PERFECT_CPU("maincpu")
@@ -488,7 +550,16 @@ static MACHINE_CONFIG_START( lastbank, lastbank_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
- // es8712
+
+ MCFG_OKIM6295_ADD("oki", 1000000, OKIM6295_PIN7_HIGH)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
+
+ MCFG_ES8712_ADD("essnd", 12000)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
+
+ // A RTC-62421 is present on the Last Bank PCB. However, the code
+ // that tries to read from it is broken and nonfunctional. The RTC
+ // is also absent from some other games on the same hardware.
MACHINE_CONFIG_END
/***************************************************************************
@@ -508,9 +579,11 @@ ROM_START( lastbank )
ROM_LOAD( "u11", 0x000000, 0x100000, CRC(2588d82d) SHA1(426f6821862d54123e53410e2776586ddf6b21e7) )
ROM_LOAD( "5.u10", 0x100000, 0x020000, CRC(51f3c5a7) SHA1(73d4c8817fe96d75be32c43e816e93c52b5d2b27) )
- ROM_REGION( 0x200000, "essnd", 0 ) /* Samples */
+ ROM_REGION( 0x40000, "oki", 0 )
ROM_LOAD( "6.u55", 0x00000, 0x40000, CRC(9e78e234) SHA1(031f93e4bc338d0257fa673da7ce656bb1cda5fb) )
- ROM_LOAD( "7.u60", 0x40000, 0x80000, CRC(41be7146) SHA1(00f1c0d5809efccf888e27518a2a5876c4b633d8) )
+
+ ROM_REGION( 0x80000, "essnd", 0 ) /* Samples */
+ ROM_LOAD( "7.u60", 0x00000, 0x80000, CRC(41be7146) SHA1(00f1c0d5809efccf888e27518a2a5876c4b633d8) )
ROM_END
-GAME( 1994, lastbank, 0, lastbank, lastbank, driver_device, 0, ROT0, "Excellent System", "Last Bank (v1.16)", MACHINE_NO_SOUND )
+GAME( 1994, lastbank, 0, lastbank, lastbank, driver_device, 0, ROT0, "Excellent System", "Last Bank (v1.16)", 0 )
diff --git a/src/mame/drivers/lwriter.cpp b/src/mame/drivers/lwriter.cpp
index c88b5220ea3..03da909522a 100644
--- a/src/mame/drivers/lwriter.cpp
+++ b/src/mame/drivers/lwriter.cpp
@@ -4,13 +4,25 @@
Apple LaserWriter II NT driver
+ 0x000000 - 0x1fffff SRAM/ROM (switches based on overlay)
+ 0x200000 - 0x3fffff ROM
+ 0x400000 - 0x5fffff RAM
+ 0x600000 - 0x7fffff ??? more RAM?
+ 0x800000 - 0x9fffff LED/Printer Controls(MSB), FIFO to print mechanism(LSB)
+ 0xa00000 - 0xbfffff Zilog 8530 SCC (Serial Control Chip) Read
+ 0xc00000 - 0xdfffff Zilog 8530 SCC (Serial Control Chip) Write
+ 0xe00000 - 0xefffff Rockwell 6522 VIA
+ 0xf00000 - 0xffffef ??? (the ROM appears to be accessing here)
+ 0xfffff0 - 0xffffff ???Auto Vector??
+
TODO:
- Get the board to pass its self test, it fails long before it even bothers reading the dipswitches
- - Hook up SCC and VIA interrupt pins to the 68k
- Hook up the rest of the VIA pins to a canon printer HLE stub
- Hook up ADB bitbang device to the VIA CB1, CB2 and PortA pins
- Hook up VIA Port A, bits 5 and 6 to the SW1 and SW2 panel switches
- Everything else
+ DONE:
+ - Hook up SCC and VIA interrupt pins to the 68k
Future:
- Let the board identify itself to a emulated mac driver so it displays the printer icon on the desktop
@@ -21,8 +33,9 @@
0xD - <Passes> 5ffff8-5fffff High half of DRAM individual bit tests (walking ones and zeroes)
0xC - <Passes> 400000-5fffff comprehensive DRAM data test
0xB - <Passes?> Unknown test
- 0xA - <Hacked to pass, not understood> dies if something to do with 600000-7fffff doesn't mirror 400000-5fffff ?
- 0x8 - <Fails> Unknown test
+ 0xA - <Passes> dies if 600000-7fffff doesn't mirror 400000-5fffff ?
+ 0x8 - <Passes> SRAM test 000000-000FFF (2e3616-2e3654)
+ 0x0 - <runs off into weeds> not sure... (2e2fd0... 2db764 is the end of the 'clear ram 41d53f down to 400000' loop...)
If one of the self tests fails, the uppermost bit will oscillate (c000 4000 c000 4000 etc) forever
@@ -35,6 +48,7 @@
2KB SRAM
X2804 EEPROM (custom marked as 335-0022) [note that technically a 2808 or 2816 can go here and will work too]
1MB ROM
+ MMI67L401 64x4 FIFO, x2
+------------------------------------------------------------------------------------------------------------------------+=====+
| 1 2 3 4 5 6 7 8 9 10 11 | #
@@ -100,7 +114,8 @@ public:
{ }
DECLARE_READ16_MEMBER(bankedarea_r);
DECLARE_WRITE16_MEMBER(bankedarea_w);
- DECLARE_WRITE8_MEMBER(led_w);
+ DECLARE_WRITE8_MEMBER(led_out_w);
+ DECLARE_WRITE8_MEMBER(fifo_out_w);
DECLARE_READ8_MEMBER(via_pa_r);
DECLARE_WRITE8_MEMBER(via_pa_w);
DECLARE_WRITE_LINE_MEMBER(via_ca2_w);
@@ -109,6 +124,7 @@ public:
DECLARE_WRITE_LINE_MEMBER(via_cb1_w);
DECLARE_WRITE_LINE_MEMBER(via_cb2_w);
DECLARE_WRITE_LINE_MEMBER(via_int_w);
+ //DECLARE_WRITE_LINE_MEMBER(scc_int);
virtual void machine_start () override;
virtual void machine_reset () override;
private:
@@ -122,7 +138,7 @@ private:
required_device<via6522_device> m_via;
#endif
- //
+ uint16_t *m_dram_ptr, *m_sram_ptr, *m_rom_ptr;
bool m_overlay;
};
@@ -132,29 +148,43 @@ Address maps (x = ignored; * = selects address within this range)
a23 a22 a21 a20 a19 a18 a17 a16 a15 a14 a13 a12 a11 a10 a9 a8 a7 a6 a5 a4 a3 a2 a1 (a0 via UDS/LDS)
* * * PAL16R6 U80
* * * * * * decoded by pals
-0 0 A * * * * * * * * * * * * * * * * * * * * * R ROM
-0 0 A 0 0 0 * * * * * * * * * * * * * * * * * * R ROMEN1
-0 0 A 0 0 1 * * * * * * * * * * * * * * * * * * R ROMEN2
-0 0 A 0 1 0 * * * * * * * * * * * * * * * * * * R ROMEN3
-0 0 A 0 1 1 * * * * * * * * * * * * * * * * * * R ROMEN4
-0 0 A 1 x x x x x x x x x x x x x x x x x x x x OPEN BUS
-0 1 * * * * * * * * * * * * * * * * * * * * * * RW DRAM
+Overlay ON:
+0 0 0 * * * * * * * * * * * * * * * * * * * * * R ROM
+0 0 0 0 0 0 * * * * * * * * * * * * * * * * * * R ROMEN1
+0 0 0 0 0 1 * * * * * * * * * * * * * * * * * * R ROMEN2
+0 0 0 0 1 0 * * * * * * * * * * * * * * * * * * R ROMEN3
+0 0 0 0 1 1 * * * * * * * * * * * * * * * * * * R ROMEN4
+0 0 0 1 x x x x x x x x x x x x x x x x x x x x OPEN BUS
+Overlay OFF:
+0 0 0 ? ? ?0? x x x x x x * * * * * * * * * * * * RW SRAM
+Unknown:
+? ? ? ? ? ? x x x x x x (*) (*) * * * * * * * * * 1 RW 2804 EEPROM
+ (technically a10 and a11 are ignored, but if a 2808 or 2816 is put in this spot the address lines do connect to the appropriate pins)
+Common:
+0 0 1 * * * * * * * * * * * * * * * * * * * * * R ROM
+0 0 1 0 0 0 * * * * * * * * * * * * * * * * * * R ROMEN1
+0 0 1 0 0 1 * * * * * * * * * * * * * * * * * * R ROMEN2
+0 0 1 0 1 0 * * * * * * * * * * * * * * * * * * R ROMEN3
+0 0 1 0 1 1 * * * * * * * * * * * * * * * * * * R ROMEN4
+0 0 1 1 x x x x x x x x x x x x x x x x x x x x OPEN BUS
+0 1 0 * * * * * * * * * * * * * * * * * * * * * RW DRAM
+0 1 1 * * * * * * * * * * * * * * * * * * * * * RW ???? DRAM mirror?
+1 0 0 ? ? ? x x x x x x x x x x x x x x x x x 0 W 64x8 FIFO
1 0 0 ? ? ? x x x x x x x x x x x x x x x x x 1 W Status LEDs and mech
1 0 1 ? ? ? x x x x x x x x x x x x x x x * * 1 R 8530 SCC Read
1 1 0 ? ? ? x x x x x x x x x x x x x x x * * 0 W 8530 SCC Write
1 1 1 ?x? ?0? ? x x x x x x x x x x x x x * * * * 0 RW 65C22 VIA
1 1 1 ?x? ?1? ? x x x x x x x x x x x x x * * * * 0 RW debugger rom/pod area
-TODO:
-? ? ? ? ? ? x x x x x x * * * * * * * * * * * * RW SRAM
-? ? ? ? ? ? x x x x x x (*) (*) * * * * * * * * * 1 RW 2804 EEPROM
- (technically a10 and a11 are ignored, but if a 2808 or 2816 is put in this spot the address lines do connect to the appropriate pins)
| | | | |
-map when overlay is set, i.e. A above is considered 'x':
+map when overlay is set:
000000-1fffff ROM (second half is open bus)
+map when overlay is clear:
+000000-03ffff SRAM(?)
+040000-1fffff ????
200000-3fffff ROM (second half is open bus)
-400000-5fffff DRAM?
-600000-7fffff unknown
-800000-83ffff LEDs and status bits to printer mechanism
+400000-5fffff DRAM
+600000-7fffff DRAM mirror
+800000-83ffff LEDs and status bits to printer mechanism, FIFO
840000-9fffff unknown
a00000-a3ffff SCC read
a40000-bfffff unknown
@@ -165,23 +195,8 @@ e40000-f7ffff unknown
f80000-fbffff debug area (first read must be 0xAAAA5555, then 68k will jump to address of second read)
fc0000-ffffff unknown
-map when overlay is clear, i.e. A above is considered '1':
-000000-1fffff unknown, maybe RAM???? maybe eeprom goes here too? eeprom is specifically disabled when overlay is set
-200000-3fffff ROM (second half is open bus)
-400000-5fffff DRAM?
-600000-7fffff unknown
-800000-83ffff LEDs and status bits to printer mechanism
-840000-9fffff unknown
-a00000-a3ffff SCC read
-a40000-bfffff unknown
-c00000-c3ffff SCC write
-c40000-dfffff unknown
-e00000-e3ffff VIA
-e40000-f7ffff unknown
-f80000-fbffff unknown
-fc0000-ffffff unknown
-
-The ADB bitbang transceiver connects to the
+The ADB bit-bang transceiver MCU connects to the VIA CB1 (adbclk) and CB2 (adbdata) pins,
+as well as PA0 (ST1), PA2 (ST2) and PA3 (ADB /INT)
*/
static ADDRESS_MAP_START (maincpu_map, AS_PROGRAM, 16, lwriter_state)
@@ -189,8 +204,9 @@ static ADDRESS_MAP_START (maincpu_map, AS_PROGRAM, 16, lwriter_state)
AM_RANGE(0x000000, 0x1fffff) AM_READWRITE(bankedarea_r, bankedarea_w)
AM_RANGE(0x200000, 0x2fffff) AM_ROM AM_REGION("rom", 0) // 1MB ROM
//AM_RANGE(0x300000, 0x3fffff) // open bus?
- AM_RANGE(0x400000, 0x5fffff) AM_RAM AM_REGION("mainram", 0) AM_MIRROR(0x200000) // 2MB DRAM; the AM_MIRROR is probably wrong, but it gets the selftest to failing on test 08 instead of 0A
- AM_RANGE(0x800000, 0x800001) AM_WRITE8(led_w, 0xff00) AM_MIRROR(0x1ffffe) // mirror is a guess given that the pals can only decode A18-A23
+ AM_RANGE(0x400000, 0x5fffff) AM_RAM AM_REGION("dram", 0) AM_MIRROR(0x200000) // 2MB DRAM
+ AM_RANGE(0x800000, 0x800001) AM_WRITE8(led_out_w, 0xff00) AM_MIRROR(0x1ffffe) // mirror is a guess given that the pals can only decode A18-A23
+ AM_RANGE(0x800000, 0x800001) AM_WRITE8(fifo_out_w, 0x00ff) AM_MIRROR(0x1ffffe) // mirror is a guess given that the pals can only decode A18-A23
AM_RANGE(0xc00000, 0xc00001) AM_DEVWRITE8("scc", scc8530_device, ca_w, 0x00ff) AM_MIRROR(0x1ffff8)
AM_RANGE(0xc00004, 0xc00005) AM_DEVWRITE8("scc", scc8530_device, da_w, 0x00ff) AM_MIRROR(0x1ffff8)
AM_RANGE(0xa00000, 0xa00001) AM_DEVREAD8 ("scc", scc8530_device, ca_r, 0xff00) AM_MIRROR(0x1ffff8)
@@ -214,6 +230,9 @@ INPUT_PORTS_END
/* Start it up */
void lwriter_state::machine_start()
{
+ m_rom_ptr = (uint16_t*)memregion("rom")->base();
+ m_dram_ptr = (uint16_t*)memregion("dram")->base();
+ m_sram_ptr = (uint16_t*)memregion("sram")->base();
// do stuff here later on like setting up printer mechanisms HLE timers etc
}
@@ -223,16 +242,54 @@ void lwriter_state::machine_reset()
m_via->reset();
}
+/* Overlay area */
+READ16_MEMBER(lwriter_state::bankedarea_r)
+{
+ if (m_overlay)
+ {
+ return m_rom_ptr[offset];
+ }
+ else if (offset <= 0x01ffff)
+ {
+ if ((offset > 0x7ff) && !space.debugger_access()) { logerror("Attempt to read banked area (with overlay off) past end of SRAM from offset %08X!\n",offset<<1); }
+ return m_sram_ptr[offset&0x7FF];
+ }
+ if(!space.debugger_access()) { logerror("Attempt to read banked area (with overlay off) past end of SRAM from offset %08X! Returning 0xFFFF!\n",offset<<1); }
+ return 0xFFFF;
+}
+
+WRITE16_MEMBER(lwriter_state::bankedarea_w)
+{
+ if (m_overlay)
+ {
+ if(!space.debugger_access()) { logerror("Attempt to write banked area (with overlay ON) with data %04X to offset %08X IGNORED!\n",data, offset<<1); }
+ return;
+ }
+ else if (offset <= 0x01ffff)
+ {
+ if ((offset > 0x7ff) && !space.debugger_access()) { logerror("Attempt to write banked area (with overlay off) with data %04X to offset %08X!\n",data, offset<<1); }
+ COMBINE_DATA(&m_sram_ptr[offset&0x7FF]);
+ return;
+ }
+ if(!space.debugger_access()) { logerror("Attempt to write banked area (with overlay off) with data %04X to offset %08X IGNORED!\n", data, offset<<1); }
+}
+
/* 4 diagnostic LEDs, plus 4 i/o lines for the printer */
-WRITE8_MEMBER(lwriter_state::led_w)
+WRITE8_MEMBER(lwriter_state::led_out_w)
{
//popmessage("LED status: %02X\n", data&0xFF);
logerror("LED status: %02X\n", data&0xFF);
popmessage("LED status: %x %x %x %x %x %x %x %x\n", data&0x80, data&0x40, data&0x20, data&0x10, data&0x8, data&0x4, data&0x2, data&0x1);
}
+/* FIFO to printer, 64 bytes long */
+WRITE8_MEMBER(lwriter_state::fifo_out_w)
+{
+ /** TODO: actually emulate this */
+ logerror("FIFO written with: %02X\n", data&0xFF);
+}
+
/* via stuff */
-// second via
READ8_MEMBER(lwriter_state::via_pa_r)
{
logerror(" VIA: Port A read!\n");
@@ -258,6 +315,8 @@ READ8_MEMBER(lwriter_state::via_pb_r)
WRITE8_MEMBER(lwriter_state::via_pb_w)
{
logerror(" VIA: Port B written with data of 0x%02x!\n", data);
+ /* Like early Mac models which had VIA A4 control overlaying, the
+ * LaserWriter II NT overlay is controlled by VIA B3 */
m_overlay = BIT(data,3);
}
@@ -274,31 +333,18 @@ WRITE_LINE_MEMBER(lwriter_state::via_cb2_w)
WRITE_LINE_MEMBER(lwriter_state::via_int_w)
{
logerror(" VIA: INT output set to %d!\n", state);
+ //TODO: this is likely wrong, the VPA pin which controls whether autovector is enabled or not is controlled by PAL U8D, which is not dumped.
+ m_maincpu->set_input_line_and_vector(M68K_IRQ_1, (state ? ASSERT_LINE : CLEAR_LINE), M68K_INT_ACK_AUTOVECTOR);
}
-READ16_MEMBER(lwriter_state::bankedarea_r)
-{
- uint16_t *rom = (uint16_t *)(memregion("rom")->base());
- //uint16_t *ram = (uint16_t *)(memregion("mainram")->base());
- if (m_overlay == 1)
- {
- rom += (offset&0x1fffff);
- return *rom;
- }
- else
- {
- // what actually maps here? the sram and eeprom?
- //ram += (offset&0x1fffff);
- //return *ram;
- return 0xFFFF; /** TODO: fix me */
- }
-}
-
-WRITE16_MEMBER (lwriter_state::bankedarea_w)
+/* scc stuff */
+/*
+WRITE_LINE_MEMBER(lwriter_state::scc_int)
{
- uint16_t *ram = (uint16_t *)(memregion("mainram")->base());
- COMBINE_DATA(&ram[offset]);
-}
+ logerror(" SCC: INT output set to %d!\n", state);
+ //m_via->set_input_line(VIA_CA1, state ? ASSERT_LINE : CLEAR_LINE);
+ m_via->write_ca1(state);
+}*/
#define CPU_CLK (XTAL_22_3210MHz / 2) // Based on pictures form here: http://picclick.co.uk/Apple-Postscript-LaserWriter-IINT-Printer-640-4105-M6009-Mainboard-282160713108.html#&gid=1&pid=7
#define RXC_CLK ((CPU_CLK - (87 * 16 * 70)) / 3) // Tuned to get 9600 baud according to manual, needs rework based on real hardware
@@ -315,6 +361,9 @@ static MACHINE_CONFIG_START( lwriter, lwriter_state )
MCFG_Z80SCC_OUT_TXDB_CB(DEVWRITELINE("rs232b", rs232_port_device, write_txd))
MCFG_Z80SCC_OUT_DTRB_CB(DEVWRITELINE("rs232b", rs232_port_device, write_dtr))
MCFG_Z80SCC_OUT_RTSB_CB(DEVWRITELINE("rs232b", rs232_port_device, write_rts))
+ /* Interrupt */
+ MCFG_Z80SCC_OUT_INT_CB(DEVWRITELINE("via", via6522_device, write_ca1))
+ //MCFG_Z80SCC_OUT_INT_CB(WRITELINE(lwriter_state, scc_int))
MCFG_RS232_PORT_ADD ("rs232a", default_rs232_devices, "terminal")
MCFG_RS232_RXD_HANDLER (DEVWRITELINE ("scc", scc8530_device, rxa_w))
@@ -372,16 +421,17 @@ MACHINE_CONFIG_END
ROM_START(lwriter)
- ROM_REGION16_BE (0x1000000, "rom", 0)
- ROM_LOAD16_BYTE ("342-0545.l0", 0x000001, 0x20000, CRC (6431742d) SHA1 (040bd5b84b49b86f2b0fe9ece378bbc7a10a94ec))
- ROM_LOAD16_BYTE ("342-0546.h0", 0x000000, 0x20000, CRC (c592bfb7) SHA1 (b595ae225238f7fabd1566a3133ea6154e082e2d))
- ROM_LOAD16_BYTE ("342-0547.l1", 0x040001, 0x20000, CRC (205a5ea8) SHA1 (205fefbb5c67a07d57cb6184c69648321a34a8fe))
- ROM_LOAD16_BYTE ("342-0548.h1", 0x040000, 0x20000, CRC (f616e1c3) SHA1 (b9e2cd4d07990b2d1936be97b6e89ef21f06b462))
- ROM_LOAD16_BYTE ("342-0549.l2", 0x080001, 0x20000, CRC (0b0b051a) SHA1 (64a80085001570c3f99d9865031715bf49bd7698))
- ROM_LOAD16_BYTE ("342-0550.h2", 0x080000, 0x20000, CRC (82adcf85) SHA1 (e2ab728afdae802c0c67fc25c9ba278b9cb04e31))
- ROM_LOAD16_BYTE ("342-0551.l3", 0x0c0001, 0x20000, CRC (176b3346) SHA1 (eb8dfc7e44f2bc884097e51a47e2f10ee091c9e9))
- ROM_LOAD16_BYTE ("342-0552.h3", 0x0c0000, 0x20000, CRC (69b175c6) SHA1 (a84c82be1ec7e373bb097ee74b941920a3b091aa))
- ROM_REGION( 0x200000, "mainram", ROMREGION_ERASEFF )
+ ROM_REGION16_BE( 0x200000, "rom", ROMREGION_ERASEFF )
+ ROM_LOAD16_BYTE("342-0545.l0", 0x000001, 0x20000, CRC (6431742d) SHA1 (040bd5b84b49b86f2b0fe9ece378bbc7a10a94ec)) // Label: "342-0545-A JAPAN // TC531000CP-F700 // (C) 87 APPLE 8940EAI // (C) 83-87 ADOBE V47.0 // (C) 81 LINOTYPE" TC531000 @L0
+ ROM_LOAD16_BYTE("342-0546.h0", 0x000000, 0x20000, CRC (c592bfb7) SHA1 (b595ae225238f7fabd1566a3133ea6154e082e2d)) // Label: "342-0546-A JAPAN // TC531000CP-F701 // (C) 87 APPLE 8940EAI // (C) 83-87 ADOBE V47.0 // (C) 81 LINOTYPE" TC531000 @H0
+ ROM_LOAD16_BYTE("342-0547.l1", 0x040001, 0x20000, CRC (205a5ea8) SHA1 (205fefbb5c67a07d57cb6184c69648321a34a8fe)) // Label: "342-0547-A JAPAN // TC531000CP-F702 // (C) 87 APPLE 8940EAI // (C) 83-87 ADOBE V47.0 // (C) 81 LINOTYPE" TC531000 @L1
+ ROM_LOAD16_BYTE("342-0548.h1", 0x040000, 0x20000, CRC (f616e1c3) SHA1 (b9e2cd4d07990b2d1936be97b6e89ef21f06b462)) // Label: "342-0548-A JAPAN // TC531000CP-F703 // (C) 87 APPLE 8940EAI // (C) 83-87 ADOBE V47.0 // (C) 81 LINOTYPE" TC531000 @H1
+ ROM_LOAD16_BYTE("342-0549.l2", 0x080001, 0x20000, CRC (0b0b051a) SHA1 (64a80085001570c3f99d9865031715bf49bd7698)) // Label: "342-0549-A JAPAN // TC531000CP-F704 // (C) 87 APPLE 8940EAI // (C) 83-87 ADOBE V47.0 // (C) 81 LINOTYPE" TC531000 @L2
+ ROM_LOAD16_BYTE("342-0550.h2", 0x080000, 0x20000, CRC (82adcf85) SHA1 (e2ab728afdae802c0c67fc25c9ba278b9cb04e31)) // Label: "342-0550-A JAPAN // TC531000CP-F705 // (C) 87 APPLE 8940EAI // (C) 83-87 ADOBE V47.0 // (C) 81 LINOTYPE" TC531000 @H2
+ ROM_LOAD16_BYTE("342-0551.l3", 0x0c0001, 0x20000, CRC (176b3346) SHA1 (eb8dfc7e44f2bc884097e51a47e2f10ee091c9e9)) // Label: "342-0551-A JAPAN // TC531000CP-F706 // (C) 87 APPLE 8940EAI // (C) 83-87 ADOBE V47.0 // (C) 81 LINOTYPE" TC531000 @L3
+ ROM_LOAD16_BYTE("342-0552.h3", 0x0c0000, 0x20000, CRC (69b175c6) SHA1 (a84c82be1ec7e373bb097ee74b941920a3b091aa)) // Label: "342-0552-A JAPAN // TC531000CP-F707 // (C) 87 APPLE 8940EAI // (C) 83-87 ADOBE V47.0 // (C) 81 LINOTYPE" TC531000 @H3
+ ROM_REGION( 0x200000, "dram", ROMREGION_ERASEFF )
+ ROM_REGION( 0x1000, "sram", ROMREGION_ERASEFF )
ROM_END
diff --git a/src/mame/drivers/marineb.cpp b/src/mame/drivers/marineb.cpp
index d01ce880e39..f6b2133a475 100644
--- a/src/mame/drivers/marineb.cpp
+++ b/src/mame/drivers/marineb.cpp
@@ -94,8 +94,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( wanted_io_map, AS_IO, 8, marineb_state )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x01) AM_DEVWRITE("ay1", ay8910_device, address_data_w)
- AM_RANGE(0x02, 0x03) AM_DEVWRITE("ay2", ay8910_device, address_data_w)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE("ay1", ay8912_device, address_data_w)
+ AM_RANGE(0x02, 0x03) AM_DEVWRITE("ay2", ay8912_device, address_data_w)
ADDRESS_MAP_END
@@ -605,11 +605,11 @@ static MACHINE_CONFIG_DERIVED( wanted, marineb )
MCFG_SCREEN_MODIFY("screen")
MCFG_SCREEN_UPDATE_DRIVER(marineb_state, screen_update_springer)
- /* sound hardware */
- MCFG_SOUND_REPLACE("ay1", AY8910, 1500000)
+ // sound hardware (PSG type verified only for bcruzm12)
+ MCFG_SOUND_REPLACE("ay1", AY8912, 1500000)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
- MCFG_SOUND_ADD("ay2", AY8910, 1500000)
+ MCFG_SOUND_ADD("ay2", AY8912, 1500000)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
MACHINE_CONFIG_END
@@ -807,6 +807,9 @@ All roms type 2764
Both proms type MB7052 (compatible to 82s129)
RAM: 1 x 8416, 1 x AM9122, 2 x D2125, 4 x M5L2114
+The topmost row is entirely unpopulated. This includes a space (at 19D) for
+a MC68705P3.
+
PCB Layout:
NECD780C D-84_4 D-84_5 D-84_6 D-84_7
@@ -833,8 +836,8 @@ ROM_START( bcruzm12 )
ROM_LOAD( "d-84_4.17ef", 0x2000, 0x2000, CRC(fe186459) SHA1(3b0ee1fe98c835271f5b67de5ca0507827e25d71) )
ROM_REGION( 0x4000, "gfx2", 0 )
- ROM_LOAD( "d-84_7.17h", 0x0000, 0x2000, CRC(a5be90ef) SHA1(6037d924296ba62999aafe665396fef142d73df2) )
- ROM_LOAD( "d-84_6.17fh", 0x2000, 0x2000, CRC(1337dc01) SHA1(c55bfc6dd15a499dd71da0acc5016035a7c51f16) )
+ ROM_LOAD( "d-84_6.17fh", 0x0000, 0x2000, CRC(1337dc01) SHA1(c55bfc6dd15a499dd71da0acc5016035a7c51f16) )
+ ROM_LOAD( "d-84_7.17h", 0x2000, 0x2000, CRC(a5be90ef) SHA1(6037d924296ba62999aafe665396fef142d73df2) )
ROM_REGION( 0x0200, "proms", 0 )
ROM_LOAD( "bcm12col.7k", 0x0000, 0x0100, CRC(bf4f2671) SHA1(dde6da568ecf0121910f4b507c83fe6230b07c8d) ) /* palette low 4 bits */
diff --git a/src/mame/drivers/metro.cpp b/src/mame/drivers/metro.cpp
index 94f2b2985d4..0c4f68a93a0 100644
--- a/src/mame/drivers/metro.cpp
+++ b/src/mame/drivers/metro.cpp
@@ -94,7 +94,34 @@ Notes:
- Sprite zoom in Mouja at the end of a match looks wrong, but it's been verified
to be the same on the original board
- vmetal: has Sega and Taito logos in the roms ?!
+- vmetal: Many samples in the ADPCM ROM are actually not used.
+ Snd Offset Writes Sample Range
+ 0000 0004 0002 0006 000a 0008 000c
+ -- ---------------------------------- -------------
+ 00 006e 0001 00ab 003c 0002 003a 003a 01ab6e-023a3c
+ 01 003d 0002 003a 001d 0002 007e 007e 023a3d-027e1d
+ 02 00e2 0003 0005 002e 0003 00f3 00f3 0305e2-03f32e
+ 03 000a 0005 001e 00f6 0005 00ec 00ec 051e0a-05ecf6
+ 04 00f7 0005 00ec 008d 0006 0060 0060 05ecf7-06608d
+ 05 0016 0008 002e 0014 0009 0019 0019 082e16-091914
+ 06 0015 0009 0019 0094 000b 0015 0015 091915-0b1594
+ 07 0010 000d 0012 00bf 000d 0035 0035 0d1210-0d35bf
+ 08 00ce 000e 002f 0074 000f 0032 0032 0e2fce-0f3274
+ 09 0000 0000 0000 003a 0000 007d 007d 000000-007d3a
+ 0a 0077 0000 00fa 008d 0001 00b6 00b6 00fa77-01b68d
+ 0b 008e 0001 00b6 00b3 0002 0021 0021 01b68e-0221b3
+ 0c 0062 0002 00f7 0038 0003 00de 00de 02f762-03de38
+ 0d 00b9 0005 00ab 00ef 0006 0016 0016 05abb9-0616ef
+ 0e 00dd 0007 0058 00db 0008 001a 001a 0758dd-081adb
+ 0f 00dc 0008 001a 002e 0008 008a 008a 081adc-088a2e
+ 10 00db 0009 00d7 00ff 000a 0046 0046 09d7db-0a46ff
+ 11 0077 000c 0003 006d 000c 0080 0080 0c0377-0c806d
+ 12 006e 000c 0080 006c 000d 0002 0002 0c806e-0d026c
+ 13 006d 000d 0002 002b 000d 0041 0041 0d026d-0d412b
+ 14 002c 000d 0041 002a 000d 00be 00be 0d412c-0dbe2a
+ 15 002b 000d 00be 0029 000e 0083 0083 0dbe2b-0e8329
+ 16 002a 000e 0083 00ee 000f 0069 0069 0e832a-0f69ee
driver modified by Hau
***************************************************************************/
@@ -1897,40 +1924,9 @@ WRITE8_MEMBER(metro_state::vmetal_control_w)
logerror("%s: Writing unknown bits %04x to $200000\n",machine().describe_context(),data);
}
-WRITE8_MEMBER(metro_state::vmetal_es8712_w)
+WRITE8_MEMBER(metro_state::vmetal_se_control_w)
{
- /* Many samples in the ADPCM ROM are actually not used.
-
- Snd Offset Writes Sample Range
- 0000 0004 0002 0006 000a 0008 000c
- -- ---------------------------------- -------------
- 00 006e 0001 00ab 003c 0002 003a 003a 01ab6e-023a3c
- 01 003d 0002 003a 001d 0002 007e 007e 023a3d-027e1d
- 02 00e2 0003 0005 002e 0003 00f3 00f3 0305e2-03f32e
- 03 000a 0005 001e 00f6 0005 00ec 00ec 051e0a-05ecf6
- 04 00f7 0005 00ec 008d 0006 0060 0060 05ecf7-06608d
- 05 0016 0008 002e 0014 0009 0019 0019 082e16-091914
- 06 0015 0009 0019 0094 000b 0015 0015 091915-0b1594
- 07 0010 000d 0012 00bf 000d 0035 0035 0d1210-0d35bf
- 08 00ce 000e 002f 0074 000f 0032 0032 0e2fce-0f3274
- 09 0000 0000 0000 003a 0000 007d 007d 000000-007d3a
- 0a 0077 0000 00fa 008d 0001 00b6 00b6 00fa77-01b68d
- 0b 008e 0001 00b6 00b3 0002 0021 0021 01b68e-0221b3
- 0c 0062 0002 00f7 0038 0003 00de 00de 02f762-03de38
- 0d 00b9 0005 00ab 00ef 0006 0016 0016 05abb9-0616ef
- 0e 00dd 0007 0058 00db 0008 001a 001a 0758dd-081adb
- 0f 00dc 0008 001a 002e 0008 008a 008a 081adc-088a2e
- 10 00db 0009 00d7 00ff 000a 0046 0046 09d7db-0a46ff
- 11 0077 000c 0003 006d 000c 0080 0080 0c0377-0c806d
- 12 006e 000c 0080 006c 000d 0002 0002 0c806e-0d026c
- 13 006d 000d 0002 002b 000d 0041 0041 0d026d-0d412b
- 14 002c 000d 0041 002a 000d 00be 00be 0d412c-0dbe2a
- 15 002b 000d 00be 0029 000e 0083 0083 0dbe2b-0e8329
- 16 002a 000e 0083 00ee 000f 0069 0069 0e832a-0f69ee
- */
-
- m_essnd->es8712_w(space, offset, data);
- logerror("%s: Writing %04x to ES8712 offset %02x\n", machine().describe_context(), data, offset);
+ logerror("%s: Writing %02x to $500000\n", machine().describe_context(), data);
}
static ADDRESS_MAP_START( vmetal_map, AS_PROGRAM, 16, metro_state )
@@ -1958,7 +1954,8 @@ static ADDRESS_MAP_START( vmetal_map, AS_PROGRAM, 16, metro_state )
AM_RANGE(0x300000, 0x31ffff) AM_READ(balcube_dsw_r) // DSW x 3
AM_RANGE(0x400000, 0x400001) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff )
AM_RANGE(0x400002, 0x400003) AM_DEVWRITE8("oki", okim6295_device, write, 0x00ff)
- AM_RANGE(0x500000, 0x50000d) AM_WRITE8(vmetal_es8712_w, 0x00ff)
+ AM_RANGE(0x500000, 0x500001) AM_WRITE8(vmetal_se_control_w, 0xff00)
+ AM_RANGE(0x500000, 0x50000d) AM_DEVWRITE8("essnd", es8712_device, write, 0x00ff)
AM_RANGE(0xf00000, 0xf0ffff) AM_RAM AM_MIRROR(0x0f0000) // RAM (mirrored)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/missile.cpp b/src/mame/drivers/missile.cpp
index b0268101d15..64abc50e377 100644
--- a/src/mame/drivers/missile.cpp
+++ b/src/mame/drivers/missile.cpp
@@ -353,7 +353,7 @@ Super Missile Attack Board Layout
#include "cpu/m6502/m6502.h"
#include "machine/watchdog.h"
#include "sound/pokey.h"
-
+#include "sound/ay8910.h"
class missile_state : public driver_device
{
@@ -379,7 +379,7 @@ public:
required_device<m6502_device> m_maincpu;
required_shared_ptr<uint8_t> m_videoram;
required_device<watchdog_timer_device> m_watchdog;
- required_device<pokey_device> m_pokey;
+ optional_device<pokey_device> m_pokey;
required_ioport m_in0;
required_ioport m_in1;
required_ioport m_r10;
@@ -402,6 +402,8 @@ public:
DECLARE_WRITE8_MEMBER(missile_w);
DECLARE_READ8_MEMBER(missile_r);
+ DECLARE_WRITE8_MEMBER(bootleg_w);
+ DECLARE_READ8_MEMBER(bootleg_r);
DECLARE_CUSTOM_INPUT_MEMBER(get_vblank);
DECLARE_DRIVER_INIT(missilem);
DECLARE_DRIVER_INIT(suprmatk);
@@ -705,8 +707,6 @@ uint32_t missile_state::screen_update_missile(screen_device &screen, bitmap_ind1
WRITE8_MEMBER(missile_state::missile_w)
{
- uint8_t *videoram = m_videoram;
-
/* if this is a MADSEL cycle, write to video RAM */
if (get_madsel())
{
@@ -719,12 +719,13 @@ WRITE8_MEMBER(missile_state::missile_w)
/* RAM */
if (offset < 0x4000)
- videoram[offset] = data;
+ m_videoram[offset] = data;
/* POKEY */
else if (offset < 0x4800)
{
- m_pokey->write(m_maincpu->space(), offset, data, 0xff);
+ if (m_pokey.found())
+ m_pokey->write(space, offset, data, 0xff);
}
/* OUT0 */
@@ -738,7 +739,7 @@ WRITE8_MEMBER(missile_state::missile_w)
output().set_led_value(0, ~data & 0x02);
m_ctrld = data & 1;
}
-
+
/* color RAM */
else if (offset >= 0x4b00 && offset < 0x4c00)
m_palette->set_pen_color(offset & 7, pal1bit(~data >> 3), pal1bit(~data >> 2), pal1bit(~data >> 1));
@@ -765,7 +766,6 @@ WRITE8_MEMBER(missile_state::missile_w)
READ8_MEMBER(missile_state::missile_r)
{
- uint8_t *videoram = m_videoram;
uint8_t result = 0xff;
/* if this is a MADSEL cycle, read from video RAM */
@@ -777,7 +777,7 @@ READ8_MEMBER(missile_state::missile_r)
/* RAM */
if (offset < 0x4000)
- result = videoram[offset];
+ result = m_videoram[offset];
/* ROM */
else if (offset >= 0x5000)
@@ -785,7 +785,10 @@ READ8_MEMBER(missile_state::missile_r)
/* POKEY */
else if (offset < 0x4800)
- result = m_pokey->read(m_maincpu->space(), offset & 0x0f, 0xff);
+ {
+ if (m_pokey.found())
+ result = m_pokey->read(space, offset & 0x0f, 0xff);
+ }
/* IN0 */
else if (offset < 0x4900)
@@ -822,6 +825,112 @@ READ8_MEMBER(missile_state::missile_r)
}
+WRITE8_MEMBER(missile_state::bootleg_w)
+{
+ /* if this is a MADSEL cycle, write to video RAM */
+ if (get_madsel())
+ {
+ write_vram(space, offset, data);
+ return;
+ }
+
+ /* otherwise, strip A15 and handle manually */
+ offset &= 0x7fff;
+
+ /* RAM */
+ if (offset < 0x4000)
+ m_videoram[offset] = data;
+
+ /* OUT0 */
+ else if (offset >= 0x4800 && offset < 0x4900)
+ {
+ m_flipscreen = ~data & 0x40;
+ machine().bookkeeping().coin_counter_w(0, data & 0x20);
+ machine().bookkeeping().coin_counter_w(1, data & 0x10);
+ machine().bookkeeping().coin_counter_w(2, data & 0x08);
+ output().set_led_value(1, ~data & 0x04);
+ output().set_led_value(0, ~data & 0x02);
+ m_ctrld = data & 1;
+ }
+
+ /* watchdog */
+ else if (offset >= 0x4900 && offset < 0x4a00)
+ m_watchdog->watchdog_reset();
+
+ /* color RAM */
+ else if (offset >= 0x4b00 && offset < 0x4c00)
+ m_palette->set_pen_color(offset & 7, pal1bit(~data >> 3), pal1bit(~data >> 2), pal1bit(~data >> 1));
+
+ /* interrupt ack */
+ else if (offset >= 0x4d00 && offset < 0x4e00)
+ {
+ if (m_irq_state)
+ {
+ m_maincpu->set_input_line(0, CLEAR_LINE);
+ m_irq_state = 0;
+ }
+ }
+
+ /* anything else */
+ else
+ logerror("%04X:Unknown write to %04X = %02X\n", space.device().safe_pc(), offset, data);
+}
+
+
+READ8_MEMBER(missile_state::bootleg_r)
+{
+ uint8_t result = 0xff;
+
+ /* if this is a MADSEL cycle, read from video RAM */
+ if (get_madsel())
+ return read_vram(space, offset);
+
+ /* otherwise, strip A15 and handle manually */
+ offset &= 0x7fff;
+
+ /* RAM */
+ if (offset < 0x4000)
+ result = m_videoram[offset];
+
+ /* ROM */
+ else if (offset >= 0x5000)
+ result = m_mainrom[offset];
+
+ /* IN0 */
+ else if (offset >= 0x4800 && offset < 0x4900) // doesn't seem ok
+ {
+ if (m_ctrld) /* trackball */
+ {
+ if (!m_flipscreen)
+ result = ((m_track0_y->read() << 4) & 0xf0) | (m_track0_x->read() & 0x0f);
+ else
+ result = ((m_track1_y->read() << 4) & 0xf0) | (m_track1_x->read() & 0x0f);
+ }
+ else /* buttons */
+ result = m_in0->read();
+ }
+
+ /* IN1 */
+ else if (offset >= 0x4900 && offset < 0x4a00) // seems ok
+ result = m_in1->read();
+
+ /* IN2 */
+ else if (offset >= 0x4b00 && offset < 0x4c00) // seems ok
+ result = m_r10->read();
+
+
+ /* anything else */
+ else
+ logerror("%04X:Unknown read from %04X\n", space.device().safe_pc(), offset);
+
+
+ /* update the MADSEL state */
+ if (!m_irq_state && ((result & 0x1f) == 0x01) && m_maincpu->get_sync())
+ m_madsel_lastcycles = m_maincpu->total_cycles();
+
+ return result;
+}
+
/*************************************
*
@@ -834,7 +943,10 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, missile_state )
AM_RANGE(0x0000, 0xffff) AM_READWRITE(missile_r, missile_w) AM_SHARE("videoram")
ADDRESS_MAP_END
-
+/* adjusted from the above to get the bootlegs to boot */
+static ADDRESS_MAP_START( bootleg_main_map, AS_PROGRAM, 8, missile_state )
+ AM_RANGE(0x0000, 0xffff) AM_READWRITE(bootleg_r, bootleg_w) AM_SHARE("videoram")
+ADDRESS_MAP_END
/*************************************
*
@@ -924,6 +1036,14 @@ static INPUT_PORTS_START( missile )
INPUT_PORTS_END
+static INPUT_PORTS_START( missileb )
+
+ PORT_INCLUDE(missile)
+
+ PORT_MODIFY("IN1")
+ PORT_SERVICE( 0x40, IP_ACTIVE_HIGH )
+INPUT_PORTS_END
+
static INPUT_PORTS_START( suprmatk )
PORT_START("IN0") /* IN0 */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL
@@ -1039,6 +1159,20 @@ static MACHINE_CONFIG_START( missile, missile_state )
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MACHINE_CONFIG_END
+static MACHINE_CONFIG_DERIVED( missilea, missile )
+
+ MCFG_DEVICE_REMOVE("pokey")
+MACHINE_CONFIG_END
+
+static MACHINE_CONFIG_DERIVED( missileb, missilea )
+
+ MCFG_CPU_MODIFY("maincpu")
+ MCFG_CPU_PROGRAM_MAP(bootleg_main_map)
+
+ MCFG_SOUND_ADD("ay8912", AY8912, MASTER_CLOCK/8)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
+
+MACHINE_CONFIG_END
/*************************************
@@ -1088,7 +1222,6 @@ ROM_START( missile1 )
ROM_LOAD( "035826-01.l6", 0x0000, 0x0020, CRC(86a22140) SHA1(2beebf7855e29849ada1823eae031fc98220bc43) )
ROM_END
-
ROM_START( suprmatk )
ROM_REGION( 0x9000, "maincpu", 0 ) /* ROM's located on the enhancement board */
ROM_LOAD( "035820-02.c1", 0x5000, 0x0800, CRC(7a62ce6a) SHA1(9a39978138dc28fdefe193bfae1b226391e471db) )
@@ -1200,7 +1333,47 @@ ROM_START( mcombats ) /* bootleg (Sidam) @ $ */
ROM_LOAD( "mmi6331.6f", 0x0000, 0x0020, CRC(86a22140) SHA1(2beebf7855e29849ada1823eae031fc98220bc43) )
ROM_END
+/*
+CPUs
+QTY Type clock position function
+1x 6502 2B 8-bit Microprocessor - main
+1x LM380 12B Audio Amplifier - sound
+1x oscillator 10.000 6C
+
+ROMs
+QTY Type position status
+2x F2708 10C, 10E dumped
+6x MCM2716C 1-6 dumped
+1x DM74S288N 6L dumped
+
+RAMs
+QTY Type position
+8x TMS4116 4F,4H,4J,4K,4L,4M,4N,4P
+1x 74S189N 7L
+
+Others
+
+1x 22x2 edge connector
+1x trimmer (volume)(12E)
+2x 8x2 switches DIP(8R,10R)
+*/
+ROM_START( missilea )
+ ROM_REGION( 0x8000, "maincpu", 0 )
+ ROM_LOAD( "1.1h", 0x5000, 0x0800, CRC(49d66ca1) SHA1(59e20a048ac76aff5843dc8253fe61cdb65f94fb) )
+ ROM_LOAD( "2.1j", 0x5800, 0x0800, CRC(8008918d) SHA1(a72ce8997ba66c0f51d94e4f2cb3cf2734612ac9) )
+ ROM_LOAD( "3.1k", 0x6000, 0x0800, CRC(b87c02f7) SHA1(748fa3aa2e7314407ded0d6c0fc24f9015c66c28) )
+ ROM_LOAD( "4.1l", 0x6800, 0x0800, CRC(33bc6f47) SHA1(5753fbfbcd65a4863f877cd3a07400bd61ffb8ce) )
+ ROM_LOAD( "5.1n", 0x7000, 0x0800, CRC(df8c58f4) SHA1(44a0cdb0e5222e14e3e91547c35e73b2cf2df174) )
+ ROM_LOAD( "6.1r", 0x7800, 0x0800, CRC(96a21c1f) SHA1(6e43ce8d53aa6d38cef920e7fa2e0683ce42cdb4) )
+
+ ROM_REGION( 0x800, "unknown", 0 )
+ ROM_LOAD( "2708.10c", 0x0000, 0x0400, CRC(9f6978c4) SHA1(34b356fddd86b8b73ee1415b3ad6b00dc4be60e2) )
+ ROM_LOAD( "2708.10e", 0x0400, 0x0400, CRC(90eb28c8) SHA1(c82bc0a00d9e54004b0210f95343c8d7dc1f2050) )
+
+ ROM_REGION( 0x0020, "proms", 0 )
+ ROM_LOAD( "dm74s288n.6l", 0x0000, 0x0020, CRC(86a22140) SHA1(2beebf7855e29849ada1823eae031fc98220bc43) )
+ROM_END
/*************************************
@@ -1316,8 +1489,11 @@ GAME( 1980, missile1, missile, missile, missile, driver_device, 0, ROT0,
GAME( 1981, suprmatk, missile, missile, suprmatk, missile_state, suprmatk, ROT0, "Atari / General Computer Corporation", "Super Missile Attack (for rev 1)", MACHINE_SUPPORTS_SAVE )
GAME( 1981, suprmatkd,missile, missile, suprmatk, driver_device, 0, ROT0, "Atari / General Computer Corporation", "Super Missile Attack (not encrypted)", MACHINE_SUPPORTS_SAVE )
-/* the bootlegs are on different hardware and don't work */
-GAME( 1980, mcombat, missile, missile, missile, driver_device, 0, ROT0, "bootleg (Videotron)", "Missile Combat (Videotron bootleg, set 1)", MACHINE_NOT_WORKING )
-GAME( 1980, mcombata, missile, missile, missile, driver_device, 0, ROT0, "bootleg (Videotron)", "Missile Combat (Videotron bootleg, set 2)", MACHINE_NOT_WORKING )
-GAME( 1980, mcombats, missile, missile, missile, driver_device, 0, ROT0, "bootleg (Sidam)", "Missile Combat (Sidam bootleg)", MACHINE_NOT_WORKING )
-GAME( 2005, missilem, missile, missile, missile, missile_state, missilem, ROT0, "hack (Braze Technologies)", "Missile Command Multigame", MACHINE_NOT_WORKING )
+/* the following bootleg has extremely similar program ROMs to missile1, but has different unknown sound hardware and 2 more ROMs */
+GAME( 1981, missilea, missile, missilea, missile, driver_device, 0, ROT0, "bootleg (Ugames)", "Missile Attack", MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE )
+
+/* the following bootlegs are on different hardware and don't work */
+GAME( 1980, mcombat, missile, missileb, missileb, driver_device, 0, ROT0, "bootleg (Videotron)", "Missile Combat (Videotron bootleg, set 1)", MACHINE_NOT_WORKING )
+GAME( 1980, mcombata, missile, missileb, missileb, driver_device, 0, ROT0, "bootleg (Videotron)", "Missile Combat (Videotron bootleg, set 2)", MACHINE_NOT_WORKING )
+GAME( 1980, mcombats, missile, missileb, missileb, driver_device, 0, ROT0, "bootleg (Sidam)", "Missile Combat (Sidam bootleg)", MACHINE_NOT_WORKING )
+GAME( 2005, missilem, missile, missilea, missileb, missile_state, missilem, ROT0, "hack (Braze Technologies)", "Missile Command Multigame", MACHINE_NOT_WORKING )
diff --git a/src/mame/drivers/osborne1.cpp b/src/mame/drivers/osborne1.cpp
index 99b68229b14..27128b98927 100644
--- a/src/mame/drivers/osborne1.cpp
+++ b/src/mame/drivers/osborne1.cpp
@@ -58,6 +58,23 @@ Schematics specify a WD1793 floppy controller, but we're using the Fujitsu
equivalent MB8877 here. Is it known that the original machines used one or
the other exclusively? In any case MAME emulates them identically.
+The installing the SCREEN-PAC requires the CPU and character generator ROM
+to be transplanted to the add-on board, and cables run to the sockets that
+previously held these chips. It contains additional RAM clocked at twice
+the speed of the main system RAM. Writes to video memory get sent to this
+RAM as well as the main system RAM, so there are actually two live copies
+of video RAM at all times. The SCREEN-PAC supports switching between
+normal and double horizontal resolution (52x24 or 104x24) at exactly 60Hz.
+
+The Nuevo Video board also requires the CPU to be transplanted to it and has
+a pair of RAMs holding a copy of video memory. However it has its own
+character generator ROM, so the mainboard's character generator ROM doesn't
+need to be moved. However, it doesn't behave like the SCREEN-PAC. It uses
+a Synertek SY6545-1 with its pixel clock derived from a 12.288MHz crystal
+mapped at 0x04/0x05 in I/O space. It runs at 640x240 (80x24) at just below
+60Hz. We don't know how video RAM contention on video RAM is handled, how
+scrolling works, or whether the CRTC can generate VBL interrupts.
+
TODO:
@@ -66,12 +83,19 @@ TODO:
Centronics parallel over the same physical interface, so this should be
tested, too.
+* Complete emulation of the Nuevo Video board (interrupts, CRTC video RAM
+ updates). It would be nice to get a schematic for this.
+
***************************************************************************/
+#include "emu.h"
#include "includes/osborne1.h"
+
#include "bus/rs232/rs232.h"
+
#include "softlist.h"
+
#define MAIN_CLOCK 15974400
@@ -92,9 +116,20 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( osborne1_io, AS_IO, 8, osborne1_state )
ADDRESS_MAP_UNMAP_HIGH
ADDRESS_MAP_GLOBAL_MASK(0xff)
+
AM_RANGE( 0x00, 0x03 ) AM_MIRROR( 0xfc ) AM_WRITE(bankswitch_w)
ADDRESS_MAP_END
+static ADDRESS_MAP_START( osborne1nv_io, AS_IO, 8, osborne1_state )
+ ADDRESS_MAP_UNMAP_HIGH
+ ADDRESS_MAP_GLOBAL_MASK(0xff)
+
+ AM_RANGE( 0x00, 0x03 ) AM_WRITE(bankswitch_w)
+ AM_RANGE( 0x04, 0x04 ) AM_DEVREADWRITE("crtc", mc6845_device, status_r, address_w)
+ AM_RANGE( 0x05, 0x05 ) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w)
+ // seems to be something at 0x06 as well, but no idea what - BIOS writes 0x07 on boot
+ADDRESS_MAP_END
+
static INPUT_PORTS_START( osborne1 )
PORT_START("ROW0")
@@ -172,9 +207,7 @@ static INPUT_PORTS_START( osborne1 )
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED)
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
- PORT_DIPNAME( 0x08, 0, "Alpha Lock" ) PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK))
- PORT_DIPSETTING( 0x08, DEF_STR( Off ) )
- PORT_DIPSETTING( 0x00, DEF_STR( On ) )
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) PORT_TOGGLE PORT_NAME("Alpha Lock")
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED)
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
@@ -201,6 +234,13 @@ static INPUT_PORTS_START( osborne1 )
PORT_CONFSETTING(0x01, "SCREEN-PAC")
INPUT_PORTS_END
+INPUT_PORTS_START( osborne1nv )
+ PORT_INCLUDE(osborne1)
+
+ PORT_MODIFY("CNF")
+ PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED)
+INPUT_PORTS_END
+
/*
* The Osborne-1 supports the following disc formats:
@@ -296,28 +336,55 @@ static MACHINE_CONFIG_START( osborne1, osborne1_state )
MCFG_SOFTWARE_LIST_ADD("flop_list","osborne1")
MACHINE_CONFIG_END
+MACHINE_CONFIG_DERIVED_CLASS( osborne1nv, osborne1, osborne1nv_state )
+ MCFG_CPU_MODIFY("maincpu")
+ MCFG_CPU_IO_MAP(osborne1nv_io)
+
+ MCFG_SCREEN_MODIFY("screen")
+ MCFG_SCREEN_NO_PALETTE
+ MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update)
+
+ MCFG_MC6845_ADD("crtc", SY6545_1, "screen", XTAL_12_288MHz/8)
+ MCFG_MC6845_SHOW_BORDER_AREA(false)
+ MCFG_MC6845_CHAR_WIDTH(8)
+ MCFG_MC6845_UPDATE_ROW_CB(osborne1nv_state, crtc_update_row)
+ MCFG_MC6845_ADDR_CHANGED_CB(osborne1nv_state, crtc_update_addr_changed)
+MACHINE_CONFIG_END
+
ROM_START( osborne1 )
- ROM_REGION(0x1000, "maincpu", 0)
+ ROM_REGION( 0x1000, "maincpu", 0 )
ROM_SYSTEM_BIOS( 0, "ver144", "BIOS version 1.44" )
- ROMX_LOAD( "3a10082-00rev-e.ud11", 0x0000, 0x1000, CRC(c0596b14) SHA1(ee6a9cc9be3ddc5949d3379351c1d58a175ce9ac), ROM_BIOS(1) )
+ ROMX_LOAD( "3a10082-00rev-e.ud11", 0x0000, 0x1000, CRC(c0596b14) SHA1(ee6a9cc9be3ddc5949d3379351c1d58a175ce9ac), ROM_BIOS(1) )
ROM_SYSTEM_BIOS( 1, "verA", "BIOS version A" )
- ROMX_LOAD( "osba.bin", 0x0000, 0x1000, NO_DUMP, ROM_BIOS(2) )
+ ROMX_LOAD( "osba.bin", 0x0000, 0x1000, NO_DUMP, ROM_BIOS(2) )
ROM_SYSTEM_BIOS( 2, "ver12", "BIOS version 1.2" )
- ROMX_LOAD( "osb12.bin", 0x0000, 0x1000, NO_DUMP, ROM_BIOS(3) )
+ ROMX_LOAD( "osb12.bin", 0x0000, 0x1000, NO_DUMP, ROM_BIOS(3) )
ROM_SYSTEM_BIOS( 3, "ver121", "BIOS version 1.2.1" )
- ROMX_LOAD( "osb121.bin", 0x0000, 0x1000, NO_DUMP, ROM_BIOS(4) )
+ ROMX_LOAD( "osb121.bin", 0x0000, 0x1000, NO_DUMP, ROM_BIOS(4) )
ROM_SYSTEM_BIOS( 4, "ver13", "BIOS version 1.3" )
- ROMX_LOAD( "osb13.bin", 0x0000, 0x1000, NO_DUMP, ROM_BIOS(5) )
- ROM_SYSTEM_BIOS( 5, "ver14", "BISO version 1.4" )
- ROMX_LOAD( "rev1.40.ud11", 0x0000, 0x1000, CRC(3d966335) SHA1(0c60b97a3154a75868efc6370d26995eadc7d927), ROM_BIOS(6) )
- ROM_SYSTEM_BIOS( 6, "ver143", "BIOS version 1.43" )
- ROMX_LOAD( "rev1.43.ud11", 0x0000, 0x1000, CRC(91a48e3c) SHA1(c37b83f278d21e6e92d80f9c057b11f7f22d88d4), ROM_BIOS(7) )
+ ROMX_LOAD( "osb13.bin", 0x0000, 0x1000, NO_DUMP, ROM_BIOS(5) )
+ ROM_SYSTEM_BIOS( 5, "ver14", "BIOS version 1.4" )
+ ROMX_LOAD( "rev1.40.ud11", 0x0000, 0x1000, CRC(3d966335) SHA1(0c60b97a3154a75868efc6370d26995eadc7d927), ROM_BIOS(6) )
+ ROM_SYSTEM_BIOS( 6, "ver143", "BIOS version 1.43" )
+ ROMX_LOAD( "rev1.43.ud11", 0x0000, 0x1000, CRC(91a48e3c) SHA1(c37b83f278d21e6e92d80f9c057b11f7f22d88d4), ROM_BIOS(7) )
+
ROM_REGION( 0x800, "chargen", 0 )
ROM_LOAD( "7a3007-00.ud15", 0x0000, 0x800, CRC(6c1eab0d) SHA1(b04459d377a70abc9155a5486003cb795342c801) )
//ROM_LOAD( "char.ua15", 0x0000, 0x800, CRC(5297C109) SHA1(e1a59d87edd66e6c226102cb0688e9cb74dbb594) ) // this is CHRROM from v1.4 BIOS MB. I don't know how to hook up diff CHR to ROM_BIOS(6)
+ROM_END
+
+ROM_START( osborne1nv )
+ ROM_REGION(0x1000, "maincpu", 0)
+ ROM_LOAD( "monrom-rev1.51-12.ud11", 0x0000, 0x1000, CRC(298da402) SHA1(7fedd070936ccfe98f96d6e0ac71689666da79cb) )
+
+ ROM_REGION( 0x0800, "chargen", 0 )
+ ROM_LOAD( "7a3007-00.ud15", 0x0000, 0x800, CRC(6c1eab0d) SHA1(b04459d377a70abc9155a5486003cb795342c801) )
+ ROM_REGION( 0x0800, "nuevo", 0 )
+ ROM_LOAD( "character_generator_6-29-84.14", 0x0000, 0x800, CRC(6c1eab0d) SHA1(b04459d377a70abc9155a5486003cb795342c801) )
ROM_END
-/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */
-COMP( 1981, osborne1, 0, 0, osborne1, osborne1, osborne1_state, osborne1, "Osborne", "Osborne-1", MACHINE_SUPPORTS_SAVE )
+/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */
+COMP( 1981, osborne1, 0, 0, osborne1, osborne1, osborne1_state, osborne1, "Osborne", "Osborne-1", MACHINE_SUPPORTS_SAVE )
+COMP( 1984, osborne1nv, osborne1, 0, osborne1nv, osborne1nv, osborne1_state, osborne1, "Osborne/Nuevo", "Osborne-1 (Nuevo Video)", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/polepos.cpp b/src/mame/drivers/polepos.cpp
index bfd0b3d2124..e038e2db0df 100644
--- a/src/mame/drivers/polepos.cpp
+++ b/src/mame/drivers/polepos.cpp
@@ -343,9 +343,6 @@ WRITE16_MEMBER(polepos_state::polepos_z8002_nvi_enable_w)
space.device().execute().set_input_line(0, CLEAR_LINE);
}
-
-CUSTOM_INPUT_MEMBER(polepos_state::high_port_r){ return ioport((const char *)param)->read() >> 4; }
-CUSTOM_INPUT_MEMBER(polepos_state::low_port_r){ return ioport((const char *)param)->read() & 0x0f; }
CUSTOM_INPUT_MEMBER(polepos_state::auto_start_r)
{
return m_auto_start_mask;
@@ -491,17 +488,15 @@ ADDRESS_MAP_END
*********************************************************************/
static INPUT_PORTS_START( polepos )
- PORT_START("IN0L")
+ PORT_START("IN0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Gear Change") PORT_CODE(KEYCODE_SPACE) POLEPOS_TOGGLE /* Gear */
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, polepos_state,auto_start_r, nullptr) // start 1, program controlled
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
-
- PORT_START("IN0H")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
- PORT_SERVICE( 0x08, IP_ACTIVE_LOW )
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 )
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 )
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE1 )
+ PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
PORT_START("DSWA")
PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:1,2,3")
@@ -527,9 +522,6 @@ static INPUT_PORTS_START( polepos )
PORT_DIPSETTING( 0x80, "3" ) /* Manufacturer's recommended settings for Upright cabinet */
PORT_DIPSETTING( 0x00, "4" ) /* Manufacturer's recommended settings for Sit-Down cabinet */
- PORT_START("DSWA_HI")
- PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, polepos_state,high_port_r, "DSWA")
-
PORT_START("DSWB")
PORT_DIPNAME( 0x07, 0x03, "Extended Rank" ) PORT_DIPLOCATION("SW2:1,2,3")
PORT_DIPSETTING( 0x07, "A" )
@@ -556,9 +548,6 @@ static INPUT_PORTS_START( polepos )
PORT_DIPSETTING( 0x80, DEF_STR( Off ))
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_START("DSWB_HI")
- PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, polepos_state,high_port_r, "DSWB")
-
PORT_START("BRAKE")
PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_MINMAX(0,0x90) PORT_SENSITIVITY(100) PORT_KEYDELTA(16)
@@ -635,12 +624,6 @@ static INPUT_PORTS_START( topracern )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
- PORT_START("IN0L")
- PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, polepos_state,low_port_r, "IN0")
-
- PORT_START("IN0H")
- PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, polepos_state,high_port_r, "IN0")
-
PORT_START("DSWA")
PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) )
PORT_DIPSETTING( 0x05, DEF_STR( 3C_1C ) )
@@ -665,9 +648,6 @@ static INPUT_PORTS_START( topracern )
PORT_DIPSETTING( 0x80, "3" )
PORT_DIPSETTING( 0x00, "4" )
- PORT_START("DSWA_HI")
- PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, polepos_state,high_port_r, "DSWA")
-
/* FIXME: these dips don't work and may not even exist on this bootleg */
PORT_START("DSWB")
PORT_DIPNAME( 0x07, 0x07, "Extended Rank" )
@@ -695,9 +675,6 @@ static INPUT_PORTS_START( topracern )
PORT_DIPSETTING( 0x80, DEF_STR( Off ))
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_START("DSWB_HI")
- PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, polepos_state,high_port_r, "DSWB")
-
PORT_START("BRAKE")
PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_MINMAX(0,0x90) PORT_SENSITIVITY(100) PORT_KEYDELTA(16)
@@ -772,6 +749,59 @@ static INPUT_PORTS_START( polepos2j )
INPUT_PORTS_END
+static INPUT_PORTS_START( polepos2bi )
+ PORT_INCLUDE( topracern )
+
+ PORT_MODIFY("DSWA")
+ PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SWA:1,3,5")
+ PORT_DIPSETTING( 0x05, DEF_STR( 3C_1C ) )
+ PORT_DIPSETTING( 0x03, DEF_STR( 2C_1C ) )
+ PORT_DIPSETTING( 0x07, DEF_STR( 1C_1C ) )
+ PORT_DIPSETTING( 0x04, DEF_STR( 2C_3C ) )
+ PORT_DIPSETTING( 0x06, DEF_STR( 1C_2C ) )
+ PORT_DIPSETTING( 0x02, DEF_STR( 1C_3C ) )
+ PORT_DIPSETTING( 0x00, DEF_STR( 1C_5C ) )
+ PORT_DIPSETTING( 0x01, DEF_STR( 1C_6C ) )
+ PORT_DIPNAME( 0x18, 0x18, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SWA:7,2")
+ PORT_DIPSETTING( 0x10, DEF_STR( 2C_1C ) )
+ PORT_DIPSETTING( 0x18, DEF_STR( 1C_1C ) )
+ PORT_DIPSETTING( 0x00, DEF_STR( 2C_3C ) )
+ PORT_DIPSETTING( 0x08, DEF_STR( 1C_2C ) )
+ PORT_DIPNAME( 0x20, 0x00, "Speed Unit" ) PORT_DIPLOCATION("SWA:4")
+ PORT_DIPSETTING( 0x20, "mph" )
+ PORT_DIPSETTING( 0x00, "km/h" )
+ PORT_DIPNAME( 0x40, 0x40, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SWA:6")
+ PORT_DIPSETTING( 0x00, DEF_STR( Off ))
+ PORT_DIPSETTING( 0x40, DEF_STR( On ) )
+ PORT_DIPNAME( 0x80, 0x80, "Speed" ) PORT_DIPLOCATION("SWA:8")
+ PORT_DIPSETTING( 0x80, "Average" )
+ PORT_DIPSETTING( 0x00, DEF_STR( High ) )
+
+ PORT_MODIFY("DSWB")
+ PORT_DIPNAME( 0x03, 0x01, "Extended Rank" ) PORT_DIPLOCATION("SWB:1,3")
+ PORT_DIPSETTING( 0x00, "A" )
+ PORT_DIPSETTING( 0x01, "B" )
+ PORT_DIPSETTING( 0x02, "C" )
+ PORT_DIPSETTING( 0x03, "D" )
+ PORT_DIPNAME( 0x0c, 0x04, "Practice Rank" ) PORT_DIPLOCATION("SWB:5,7")
+ PORT_DIPSETTING( 0x00, "A" )
+ PORT_DIPSETTING( 0x04, "B" )
+ PORT_DIPSETTING( 0x08, "C" )
+ PORT_DIPSETTING( 0x0c, "D" )
+ PORT_DIPNAME( 0x30, 0x10, "Goal" ) PORT_DIPLOCATION("SWB:2,4")
+ PORT_DIPSETTING( 0x00, "3" )
+ PORT_DIPSETTING( 0x10, "4" )
+ PORT_DIPSETTING( 0x20, "5" )
+ PORT_DIPSETTING( 0x30, "6" )
+ PORT_DIPNAME( 0x40, 0x00, DEF_STR( Game_Time ) ) PORT_DIPLOCATION("SWB:6")
+ PORT_DIPSETTING( 0x00, "90 secs." )
+ PORT_DIPSETTING( 0x40, "120 secs." )
+ PORT_DIPNAME( 0x80, 0x00, "Always On" ) PORT_DIPLOCATION("SWB:8")
+ PORT_DIPSETTING( 0x80, DEF_STR( Off ))
+ PORT_DIPSETTING( 0x00, DEF_STR( On ) )
+INPUT_PORTS_END
+
+
/*********************************************************************
* Graphics layouts
@@ -845,10 +875,10 @@ static MACHINE_CONFIG_START( polepos, polepos_state )
MCFG_CPU_PROGRAM_MAP(z8002_map)
MCFG_NAMCO_51XX_ADD("51xx", MASTER_CLOCK/8/2) /* 1.536 MHz */
- MCFG_NAMCO_51XX_INPUT_0_CB(IOPORT("IN0L"))
- MCFG_NAMCO_51XX_INPUT_1_CB(IOPORT("IN0H"))
- MCFG_NAMCO_51XX_INPUT_2_CB(IOPORT("DSWB"))
- MCFG_NAMCO_51XX_INPUT_3_CB(IOPORT("DSWB_HI"))
+ MCFG_NAMCO_51XX_INPUT_0_CB(IOPORT("IN0")) MCFG_DEVCB_MASK(0x0f)
+ MCFG_NAMCO_51XX_INPUT_1_CB(IOPORT("IN0")) MCFG_DEVCB_RSHIFT(4)
+ MCFG_NAMCO_51XX_INPUT_2_CB(IOPORT("DSWB")) MCFG_DEVCB_MASK(0x0f)
+ MCFG_NAMCO_51XX_INPUT_3_CB(IOPORT("DSWB")) MCFG_DEVCB_RSHIFT(4)
MCFG_NAMCO_51XX_OUTPUT_0_CB(WRITE8(polepos_state,out_0))
MCFG_NAMCO_51XX_OUTPUT_1_CB(WRITE8(polepos_state,out_1))
@@ -862,8 +892,8 @@ static MACHINE_CONFIG_START( polepos, polepos_state )
MCFG_NAMCO_53XX_K_CB(READ8(polepos_state,namco_53xx_k_r))
MCFG_NAMCO_53XX_INPUT_0_CB(READ8(polepos_state,steering_changed_r))
MCFG_NAMCO_53XX_INPUT_1_CB(READ8(polepos_state,steering_delta_r))
- MCFG_NAMCO_53XX_INPUT_2_CB(IOPORT("DSWA"))
- MCFG_NAMCO_53XX_INPUT_3_CB(IOPORT("DSWA_HI"))
+ MCFG_NAMCO_53XX_INPUT_2_CB(IOPORT("DSWA")) MCFG_DEVCB_MASK(0x0f)
+ MCFG_NAMCO_53XX_INPUT_3_CB(IOPORT("DSWA")) MCFG_DEVCB_RSHIFT(4)
MCFG_NAMCO_54XX_ADD("54xx", MASTER_CLOCK/8/2) /* 1.536 MHz */
MCFG_NAMCO_54XX_DISCRETE("discrete")
@@ -942,8 +972,8 @@ static ADDRESS_MAP_START( topracern_io, AS_IO, 8, polepos_state )
// extra direct mapped inputs read
AM_RANGE(0x02, 0x02) AM_READ_PORT("STEER") AM_WRITENOP
AM_RANGE(0x03, 0x03) AM_READ_PORT("IN0") AM_DEVWRITE("dac", dac_byte_interface, write)
- AM_RANGE(0x04, 0x04) AM_READ_PORT("DSWA") AM_WRITENOP
- AM_RANGE(0x05, 0x05) AM_READ_PORT("DSWB") /* ??? */ AM_WRITE(bootleg_soundlatch_w)
+ AM_RANGE(0x04, 0x04) AM_READ_PORT("DSWA") AM_WRITENOP // explosion sound trigger
+ AM_RANGE(0x05, 0x05) AM_READ_PORT("DSWB") AM_WRITE(bootleg_soundlatch_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_z80_bootleg_map, AS_PROGRAM, 8, polepos_state )
@@ -975,7 +1005,7 @@ static MACHINE_CONFIG_START( topracern, polepos_state )
/* doesn't exist on the bootleg, but required for now or the game only boots in test mode!
they probably simulate some of the logic */
MCFG_NAMCO_51XX_ADD("51xx", MASTER_CLOCK/8/2) /* 1.536 MHz */
- MCFG_NAMCO_51XX_INPUT_1_CB(IOPORT("IN0H"))
+ MCFG_NAMCO_51XX_INPUT_1_CB(IOPORT("IN0")) MCFG_DEVCB_RSHIFT(4)
MCFG_NAMCO_06XX_ADD("06xx", MASTER_CLOCK/8/64)
MCFG_NAMCO_06XX_MAINCPU("maincpu")
@@ -2350,10 +2380,10 @@ GAME( 1982, poleposa2, polepos, polepos, poleposa, driver_device, 0,
GAME( 1984, topracer, polepos, polepos, polepos, driver_device, 0, ROT0, "bootleg", "Top Racer (with MB8841 + MB8842, 1984)", 0 ) // the NAMCO customs have been cloned on these bootlegs
GAME( 1983, topracera, polepos, polepos, polepos, driver_device, 0, ROT0, "bootleg", "Top Racer (with MB8841 + MB8842, 1983)", 0 ) // the only difference between them is the year displayed on the title screen
GAME( 1983, ppspeed, polepos, polepos, polepos, driver_device, 0, ROT0, "bootleg", "Speed Up (Spanish bootleg of Pole Position)", 0 ) // very close to topracer / topracera
-GAME( 1982, topracern, polepos, topracern, topracern, driver_device, 0, ROT0, "bootleg", "Top Racer (no MB8841 + MB8842)", MACHINE_IMPERFECT_SOUND ) // is there any explosion sound generator here?
+GAME( 1982, topracern, polepos, topracern, topracern, driver_device, 0, ROT0, "bootleg", "Top Racer (no MB8841 + MB8842)", MACHINE_IMPERFECT_SOUND ) // explosion sound generator missing
GAME( 1983, polepos2, 0, polepos, polepos2j, polepos_state, polepos2, ROT0, "Namco", "Pole Position II (Japan)", 0 )
GAME( 1983, polepos2a, polepos2, polepos, polepos2, polepos_state, polepos2, ROT0, "Namco (Atari license)", "Pole Position II (Atari)", 0 )
GAME( 1983, polepos2b, polepos2, polepos, polepos2, driver_device, 0, ROT0, "bootleg", "Pole Position II (bootleg)", 0 )
-GAME( 1984, polepos2bi, polepos2, polepos2bi, topracern, driver_device, 0, ROT0, "bootleg", "Gran Premio F1 (Italian bootleg of Pole Position II)", MACHINE_IMPERFECT_COLORS | MACHINE_IMPERFECT_SOUND )
-GAME( 1984, polepos2bs, polepos2, polepos2bi, topracern, driver_device, 0, ROT0, "BCN Internacional S.A.)", "Gran Premio F1 (Spanish bootleg of Pole Position II)", MACHINE_IMPERFECT_COLORS | MACHINE_IMPERFECT_SOUND )
+GAME( 1984, polepos2bi, polepos2, polepos2bi, polepos2bi,driver_device, 0, ROT0, "bootleg", "Gran Premio F1 (Italian bootleg of Pole Position II)", MACHINE_IMPERFECT_COLORS | MACHINE_IMPERFECT_SOUND )
+GAME( 1984, polepos2bs, polepos2, polepos2bi, polepos2bi,driver_device, 0, ROT0, "bootleg (BCN Internacional S.A.)", "Gran Premio F1 (Spanish bootleg of Pole Position II)", MACHINE_IMPERFECT_COLORS | MACHINE_IMPERFECT_SOUND )
diff --git a/src/mame/drivers/pong.cpp b/src/mame/drivers/pong.cpp
index aeaa7103462..d9c67a78e6b 100644
--- a/src/mame/drivers/pong.cpp
+++ b/src/mame/drivers/pong.cpp
@@ -47,15 +47,23 @@ TODO: Superpong is believed to use the Pong (Rev E) PCB with some minor modifica
#include "emu.h"
#include "machine/netlist.h"
-#include "netlist/devices/net_lib.h"
+
#include "sound/dac.h"
#include "sound/volt_reg.h"
+
#include "video/fixfreq.h"
+
+#include "netlist/devices/net_lib.h"
+
#include "machine/nl_breakout.h"
#include "machine/nl_pong.h"
#include "machine/nl_pongd.h"
+
#include "breakout.lh"
+#include <cmath>
+
+
/*
* H count width to 512
* Reset at 1C6 = 454
@@ -81,8 +89,8 @@ TODO: Superpong is believed to use the Pong (Rev E) PCB with some minor modifica
*/
#define MASTER_CLOCK 7159000
-#define V_TOTAL_PONG (0x105+1) // 262
-#define H_TOTAL_PONG (0x1C6+1) // 454
+#define V_TOTAL_PONG (0x105+1) // 262
+#define H_TOTAL_PONG (0x1C6+1) // 454
/*
* Breakout's H1 signal:
diff --git a/src/mame/drivers/route16.cpp b/src/mame/drivers/route16.cpp
index 57666b43422..dd3c9ca0b90 100644
--- a/src/mame/drivers/route16.cpp
+++ b/src/mame/drivers/route16.cpp
@@ -937,6 +937,41 @@ ROM_START( spacecho2 )
ROM_LOAD( "mb7052.6m", 0x0100, 0x0100, CRC(08793ef7) SHA1(bfc27aaf25d642cd57c0fbe73ab575853bd5f3ca) ) /* bottom bitmap */
ROM_END
+/*
+Speak & Help
+
+Single layer re-engineered pcb, very tidy and working.
+
+All dumps are in label.location format, see the two
+included photos for one of the pcb with and without the
+speech? daughterboard plugged in for verification.
+
+Roms are all mitsubishi 2716, proms are fujitsu MB7052.
+
+https://youtu.be/YuWZ8hZ-MtY
+Unique speech, as detailed in video, seems will require additional work to emulate correctly.
+*/
+
+ROM_START( speakhlp )
+ ROM_REGION( 0x10000, "cpu1", 0 )
+ ROM_LOAD( "b1.56t", 0x0000, 0x0800, CRC(ce009d85) SHA1(d8683d358ff04ffa0eef574e42a8f3885f538ecc) )
+ ROM_LOAD( "b2.5t", 0x0800, 0x0800, CRC(935219f1) SHA1(83d41eb8af6dc5d44d578c01c123872e75fa927e) )
+ ROM_LOAD( "b3.45t", 0x1000, 0x0800, CRC(083c28de) SHA1(82e159f218f60e9c06ff78f2e52572f8f5a6c530) )
+ ROM_LOAD( "b4.4t", 0x1800, 0x0800, CRC(b0927e3b) SHA1(cc5f030dcbc93d5265dbf17a2425acdb921ab18b) )
+ ROM_LOAD( "b5.3t", 0x2000, 0x0800, CRC(ccd25c4e) SHA1(d6d5722d746dd22cecacfea407e798f4531eea99) )
+ ROM_LOAD( "b6.23t", 0x2800, 0x0800, CRC(a657dd4b) SHA1(4f6b85ccf5449d08f5c7f5dc6f59d0df276d9994) )
+
+ ROM_REGION( 0x10000, "cpu2", 0 )
+ ROM_LOAD( "b07.5b", 0x0000, 0x0800, CRC(c9317d91) SHA1(b509ce371d89ad39acaefea732eb955a11df1ed9) )
+ ROM_LOAD( "b09.4b", 0x1000, 0x0800, CRC(29310c32) SHA1(d5d5953111d81661ab98c950d94e5912fc907445) )
+ ROM_LOAD( "b010.3b", 0x1800, 0x0800, CRC(4d567bc9) SHA1(6bc05213042d9069a054b2ae044f04938a9bfe06) )
+
+ ROM_REGION( 0x0200, "proms", 0 ) /* Intersil IM5623CPE proms compatible with 82s129 */
+ /* The upper 128 bytes are 0's, used by the hardware to blank the display */
+ ROM_LOAD( "prom.6k", 0x0000, 0x0100, CRC(08793ef7) SHA1(bfc27aaf25d642cd57c0fbe73ab575853bd5f3ca) ) /* top bitmap */
+ ROM_LOAD( "prom.6m", 0x0100, 0x0100, CRC(08793ef7) SHA1(bfc27aaf25d642cd57c0fbe73ab575853bd5f3ca) ) /* bottom bitmap */
+ROM_END
+
ROM_START( ttmahjng )
ROM_REGION( 0x10000, "cpu1", 0 )
ROM_LOAD( "ju04", 0x0000, 0x1000, CRC(fe7c693a) SHA1(be0630557e0bcd9ec2e9542cc4a4d947889ec57a) )
@@ -1055,5 +1090,6 @@ GAME( 1980, stratvoxa,speakres, stratvox, stratvox, driver_device, 0, ROT
GAME( 1980, stratvoxb,speakres, stratvox, stratvox, driver_device, 0, ROT270, "bootleg", "Stratovox (bootleg)", MACHINE_SUPPORTS_SAVE )
GAME( 1980, spacecho, speakres, spacecho, spacecho, driver_device, 0, ROT270, "bootleg (Gayton Games)", "Space Echo (set 1)", MACHINE_SUPPORTS_SAVE )
GAME( 1980, spacecho2,speakres, spacecho, spacecho, driver_device, 0, ROT270, "bootleg (Gayton Games)", "Space Echo (set 2)", MACHINE_SUPPORTS_SAVE )
+GAME( 1980, speakhlp, speakres, spacecho, spacecho, driver_device, 0, ROT270, "bootleg", "Speak & Help", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND )
GAME( 1981, ttmahjng, 0, ttmahjng, ttmahjng, driver_device, 0, ROT0, "Taito", "T.T Mahjong", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/segac2.cpp b/src/mame/drivers/segac2.cpp
index bc9e88bfdc8..fcfc3e89f81 100644
--- a/src/mame/drivers/segac2.cpp
+++ b/src/mame/drivers/segac2.cpp
@@ -32,7 +32,8 @@
1992 Tant-R (Korea) Sega ? C2
1992 Waku Waku Marine Sega 317-0140 C2
1993 SegaSonic Popcorn Shop Sega 317-0140 C2
- 1994 PotoPoto (Japan) Sega 317-0218 C2
+ 1993 Sega Sonic Cosmo Fighter Sega 317-0140 C2
+ 1994 PotoPoto (Japan) Sega 317-0218 C2
1994 Stack Columns (Japan) Sega 317-0219 C2
1994 Stack Columns (World) Sega 317-0223 C2
1994 Ichidant-R (Japan) Sega 317-0224 C2
@@ -1774,6 +1775,18 @@ ROM_START( sonicpop ) /* Sega Sonic Popcorn Shop (Rev.B) (c)1993 Sega - 834-9555
ROM_END
+ROM_START( sonicfgt ) /* Sega Sonic Cosmo Fighter (c)1993 Sega - 834-10082 930719-1755T (EMP5032 labeled 317-0140) */
+ ROM_REGION( 0x200000, "maincpu", 0 )
+ ROM_LOAD16_BYTE( "epr-16001.ic32", 0x000000, 0x040000, CRC(8ed1dc11) SHA1(cd1cb6066c2ff159bec88802bc4b7ca7fff2ed71) )
+ ROM_LOAD16_BYTE( "epr-16000.ic31", 0x000001, 0x040000, CRC(1440caec) SHA1(9e50c28544d6c42cdc7d3ae0f321670fed68fedb) )
+ ROM_LOAD16_BYTE( "epr-16003.ic34", 0x100000, 0x040000, CRC(8933e91c) SHA1(5dc7451874f97e0e5d0c666800c26907b9abf5f5) )
+ ROM_LOAD16_BYTE( "epr-16002.ic33", 0x100001, 0x040000, CRC(0ae979cd) SHA1(a4d4f096e976d4993123de0c2505382f878ea42a) )
+
+ ROM_REGION( 0x040000, "upd", 0 )
+ ROM_LOAD( "epr-16004.ic4", 0x000000, 0x040000, CRC(e87e8433) SHA1(b2b7945c7660ab2383049af5a2434768544a4ea8) )
+ROM_END
+
+
ROM_START( ribbit ) /* Ribbit (c)1991 Sega */
ROM_REGION( 0x200000, "maincpu", 0 )
ROM_LOAD16_BYTE( "epr-13833.ic32", 0x000000, 0x040000, CRC(5347f8ce) SHA1(b95b99536157edfbf0d74a42f64235f47dca7ee1) )
@@ -2506,6 +2519,8 @@ GAME( 1992, wwmarine, 0, segac2, wwmarine, segac2_state, bloxeedc, ROT0,
// not really sure how this should hook up, things like the 'sold out' flags could be mechanical sensors, or from another MCU / CPU board in the actual popcorn part of the machine?
GAME( 1993, sonicpop, 0, segac2, sonicpop, segac2_state, bloxeedc, ROT0, "Sega", "SegaSonic Popcorn Shop (Rev B)", MACHINE_MECHANICAL ) // region DSW for USA / Export / Japan, still speaks Japanese tho. 'Mechanical' part isn't emulated
+GAME( 1993, sonicfgt, 0, segac2, systemc_generic, segac2_state, bloxeedc, ROT0, "Sega", "Sega Sonic Cosmo Fighter", 0 )
+
GAME( 1994, potopoto, 0, segac2, potopoto, segac2_state, potopoto, ROT0, "Sega", "Poto Poto (Japan, Rev A)", 0 )
GAME( 1994, stkclmns, 0, segac2, stkclmns, segac2_state, stkclmns, ROT0, "Sega", "Stack Columns (World)", 0 )
diff --git a/src/mame/drivers/shanghai.cpp b/src/mame/drivers/shanghai.cpp
index 246ced6c2bf..a81c08a0620 100644
--- a/src/mame/drivers/shanghai.cpp
+++ b/src/mame/drivers/shanghai.cpp
@@ -189,8 +189,8 @@ static INPUT_PORTS_START( kothello )
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_START("DSW")
- PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
+ PORT_START("DSW1")
+ PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:1,2,3")
PORT_DIPSETTING( 0x00, DEF_STR( 5C_1C ) )
PORT_DIPSETTING( 0x04, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x02, DEF_STR( 3C_1C ) )
@@ -199,21 +199,43 @@ static INPUT_PORTS_START( kothello )
PORT_DIPSETTING( 0x03, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x05, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x01, DEF_STR( 1C_4C ) )
- PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
- PORT_DIPSETTING( 0x08, DEF_STR( Off ) )
- PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
- PORT_DIPSETTING( 0x10, DEF_STR( Off ) )
- PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
- PORT_DIPSETTING( 0x20, DEF_STR( Off ) )
- PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
+ PORT_DIPNAME( 0x38, 0x38, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW1:4,5,6")
+ PORT_DIPSETTING( 0x00, DEF_STR( 5C_1C ) )
+ PORT_DIPSETTING( 0x20, DEF_STR( 4C_1C ) )
+ PORT_DIPSETTING( 0x10, DEF_STR( 3C_1C ) )
+ PORT_DIPSETTING( 0x30, DEF_STR( 2C_1C ) )
+ PORT_DIPSETTING( 0x38, DEF_STR( 1C_1C ) )
+ PORT_DIPSETTING( 0x18, DEF_STR( 1C_2C ) )
+ PORT_DIPSETTING( 0x28, DEF_STR( 1C_3C ) )
+ PORT_DIPSETTING( 0x08, DEF_STR( 1C_4C ) )
+ PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:7")
PORT_DIPSETTING( 0x40, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
+ PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:8")
PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
+
+ PORT_START("DSW2")
+ PORT_DIPNAME( 0x03, 0x01, "Move Timer (Versus)" ) PORT_DIPLOCATION("SW2:1,2")
+ PORT_DIPSETTING( 0x03, "20 Seconds" )
+ PORT_DIPSETTING( 0x01, "25 Seconds" )
+ PORT_DIPSETTING( 0x02, "30 Seconds" )
+ PORT_DIPSETTING( 0x00, "35 Seconds" )
+ PORT_DIPNAME( 0x0c, 0x04, "Move Timer (Puzzle)" ) PORT_DIPLOCATION("SW2:3,4")
+ PORT_DIPSETTING( 0x0c, "30 Seconds" )
+ PORT_DIPSETTING( 0x04, "35 Seconds" )
+ PORT_DIPSETTING( 0x08, "40 Seconds" )
+ PORT_DIPSETTING( 0x00, "45 Seconds" )
+ PORT_DIPNAME( 0x30, 0x10, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:5,6")
+ PORT_DIPSETTING( 0x30, DEF_STR( Easy ) )
+ PORT_DIPSETTING( 0x10, DEF_STR( Medium_Easy ) )
+ PORT_DIPSETTING( 0x20, DEF_STR( Medium_Hard ) )
+ PORT_DIPSETTING( 0x00, DEF_STR( Hard ) )
+ PORT_DIPNAME( 0xc0, 0x40, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:7,8") // alleged to be number of losses to end tsume mode
+ PORT_DIPSETTING( 0xc0, "1" )
+ PORT_DIPSETTING( 0x40, "2" )
+ PORT_DIPSETTING( 0x80, "3" )
+ PORT_DIPSETTING( 0x00, "4" )
INPUT_PORTS_END
@@ -481,7 +503,8 @@ static MACHINE_CONFIG_START( kothello, shanghai_state )
/* same as standard seibu ym2203, but also reads "DSW" */
MCFG_SOUND_ADD("ymsnd", YM2203, XTAL_16MHz/4)
MCFG_YM2203_IRQ_HANDLER(DEVWRITELINE("seibu_sound", seibu_sound_device, fm_irqhandler))
- MCFG_AY8910_PORT_A_READ_CB(IOPORT("DSW"))
+ MCFG_AY8910_PORT_A_READ_CB(IOPORT("DSW1"))
+ MCFG_AY8910_PORT_B_READ_CB(IOPORT("DSW2"))
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.15)
MCFG_DEVICE_ADD("seibu_sound", SEIBU_SOUND, 0)
diff --git a/src/mame/drivers/starwars.cpp b/src/mame/drivers/starwars.cpp
index d3efae464cc..59320b60504 100644
--- a/src/mame/drivers/starwars.cpp
+++ b/src/mame/drivers/starwars.cpp
@@ -204,7 +204,7 @@ static INPUT_PORTS_START( starwars )
PORT_START("IN1")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED )
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Diagnostic Step") PORT_CODE(KEYCODE_F1)
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE2 ) PORT_NAME("Diagnostic Step")
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
diff --git a/src/mame/drivers/stv.cpp b/src/mame/drivers/stv.cpp
index 34c16c1dc1e..9abc3fe9b6c 100644
--- a/src/mame/drivers/stv.cpp
+++ b/src/mame/drivers/stv.cpp
@@ -2540,7 +2540,25 @@ ROM_START( znpwfv )
STV_BIOS
ROM_REGION32_BE( 0x3000000, "cart", ROMREGION_ERASE00 ) /* SH2 code */
- ROM_LOAD16_BYTE( "epr20398.13", 0x0000001, 0x0100000, CRC(3fb56a0b) SHA1(13c2fa2d94b106d39e46f71d15fbce3607a5965a) ) // bad
+ ROM_LOAD16_BYTE( "epr20398.13", 0x0000001, 0x0100000, CRC(3fb56a0b) SHA1(13c2fa2d94b106d39e46f71d15fbce3607a5965a) ) // good
+ ROM_RELOAD_PLAIN( 0x0200000, 0x0100000)
+ ROM_RELOAD_PLAIN( 0x0300000, 0x0100000)
+ ROM_LOAD16_WORD_SWAP( "mpr20400.2", 0x0400000, 0x0400000, CRC(1edfbe05) SHA1(b0edd3f3d57408101ae6eb0aec742afbb4d289ca) ) // good
+ ROM_LOAD16_WORD_SWAP( "mpr20401.3", 0x0800000, 0x0400000, CRC(99e98937) SHA1(e1b4d12a0b4d0fe97a62fcc085e19cce77657c99) ) // good
+ ROM_LOAD16_WORD_SWAP( "mpr20402.4", 0x0c00000, 0x0400000, CRC(4572aa60) SHA1(8b2d76ea8c6e2f472c6ee7c9b6ad6e80e6a1a85a) ) // good
+ ROM_LOAD16_WORD_SWAP( "mpr20403.5", 0x1000000, 0x0400000, CRC(26a8e13e) SHA1(07f5564b704598e3c3580d3d620ecc4f14549dbd) ) // good
+ ROM_LOAD16_WORD_SWAP( "mpr20404.6", 0x1400000, 0x0400000, CRC(0b70275d) SHA1(47b8672e19c698dc948760f7091f4c6280e728d0) ) // good
+ ROM_LOAD16_WORD_SWAP( "mpr20399.1", 0x1800000, 0x0400000, CRC(c178a96e) SHA1(65f4aa05187d48ba8ad4fe75ff6ffe1f8524831d) ) // good
+ ROM_LOAD16_WORD_SWAP( "mpr20405.8", 0x1c00000, 0x0400000, CRC(f53337b7) SHA1(09a21f81016ee54f10554ae1f790415d7436afe0) ) // good
+ ROM_LOAD16_WORD_SWAP( "mpr20406.9", 0x2000000, 0x0400000, CRC(b677c175) SHA1(d0de7b5a29928036df0bdfced5a8021c0999eb26) ) // good
+ ROM_LOAD16_WORD_SWAP( "mpr20407.10", 0x2400000, 0x0400000, CRC(58356050) SHA1(f8fb5a14f4ec516093c785891b05d55ae345754e) ) // good
+ROM_END
+
+ROM_START( znpwfvt )
+ STV_BIOS
+
+ ROM_REGION32_BE( 0x3000000, "cart", ROMREGION_ERASE00 ) /* SH2 code */
+ ROM_LOAD16_BYTE( "epr20408.13", 0x0000001, 0x0100000, CRC(1d62fcf6) SHA1(3651261aa755da27b11462f2705311b7c639a687) ) // good
ROM_RELOAD_PLAIN( 0x0200000, 0x0100000)
ROM_RELOAD_PLAIN( 0x0300000, 0x0100000)
ROM_LOAD16_WORD_SWAP( "mpr20400.2", 0x0400000, 0x0400000, CRC(1edfbe05) SHA1(b0edd3f3d57408101ae6eb0aec742afbb4d289ca) ) // good
@@ -3424,6 +3442,7 @@ GAME( 1996, vfkids, stvbios, stv, stv, stv_state, stv, ROT
GAME( 1997, vmahjong, stvbios, stv, vmahjong, stv_state, stvmp, ROT0, "Micronet", "Virtual Mahjong (J 961214 V1.000)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS )
GAME( 1997, winterht, stvbios, stv, stv, stv_state, winterht, ROT0, "Sega", "Winter Heat (JUET 971012 V1.000)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS )
GAME( 1997, znpwfv, stvbios, stv, stv, stv_state, znpwfv, ROT0, "Sega", "Zen Nippon Pro-Wrestling Featuring Virtua (J 971123 V1.000)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS )
+GAME( 1997, znpwfvt, znpwfv, stv, stv, stv_state, znpwfv, ROT0, "Sega", "Zen Nippon Pro-Wrestling Featuring Virtua (T 971123 V1.000)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS )
/* Unemulated printer / camera devices */
// USA sets
diff --git a/src/mame/drivers/taito_l.cpp b/src/mame/drivers/taito_l.cpp
index e2366c02cb0..268e222bdc3 100644
--- a/src/mame/drivers/taito_l.cpp
+++ b/src/mame/drivers/taito_l.cpp
@@ -1881,7 +1881,7 @@ static MACHINE_CONFIG_DERIVED( puzznic, plotting )
MCFG_CPU_MODIFY("maincpu")
MCFG_CPU_PROGRAM_MAP(puzznic_map)
- MCFG_DEVICE_ADD("mcu", ARKANOID_68705P3, XTAL_13_33056MHz / 4) /* clock is complete guess */
+ MCFG_DEVICE_ADD("mcu", ARKANOID_68705P3, XTAL_3MHz)
MCFG_MACHINE_RESET_OVERRIDE(taitol_1cpu_state, puzznic)
MACHINE_CONFIG_END
@@ -2291,7 +2291,7 @@ ROM_START( puzznic )
ROM_LOAD( "c20-09.ic11", 0x00000, 0x20000, CRC(156d6de1) SHA1(c247936b62ef354851c9bace76a7a0aa14194d5f) )
ROM_REGION( 0x0800, "mcu:mcu", 0 ) /* 2k for the microcontroller */
- ROM_LOAD( "mc68705p3.ic4", 0x0000, 0x0800, CRC(085f68b4) SHA1(2dbc7e2c015220dc59ee1f1208540744e5b9b7cc) )
+ ROM_LOAD( "c20-01.ic4", 0x0000, 0x0800, CRC(085f68b4) SHA1(2dbc7e2c015220dc59ee1f1208540744e5b9b7cc) )
ROM_REGION( 0x20000, "gfx1", 0 )
ROM_LOAD16_BYTE( "c20-07.ic10", 0x00000, 0x10000, CRC(be12749a) SHA1(c67d1a434486843a6776d89e905362b7db595d8d) )
@@ -2301,12 +2301,27 @@ ROM_START( puzznic )
ROM_LOAD( "mmipal20l8.ic3", 0x0000, 0x0800, NO_DUMP )
ROM_END
+ROM_START( puzznicu )
+ ROM_REGION( 0x20000, "maincpu", 0 )
+ ROM_LOAD( "c20-10.ic11", 0x00000, 0x20000, CRC(3522d2e5) SHA1(2428663d1d71f2920c69cd2cd907f0750c22af77) )
+
+ ROM_REGION( 0x0800, "mcu:mcu", 0 ) /* 2k for the microcontroller */
+ ROM_LOAD( "c20-01.ic4", 0x0000, 0x0800, CRC(085f68b4) SHA1(2dbc7e2c015220dc59ee1f1208540744e5b9b7cc) )
+
+ ROM_REGION( 0x40000, "gfx1", 0 )
+ ROM_LOAD16_BYTE( "c20-03.ic10", 0x00000, 0x20000, CRC(4264056c) SHA1(d2d8a170ae0f361093a5384935238605a59e5938) )
+ ROM_LOAD16_BYTE( "c20-02.ic9", 0x00001, 0x20000, CRC(3c115f8b) SHA1(8d518be01b7c4d6d993d5d9b62aab719a5c8baca) )
+
+ ROM_REGION( 0x0800, "pals", 0 )
+ ROM_LOAD( "mmipal20l8.ic3", 0x0000, 0x0800, NO_DUMP )
+ROM_END
+
ROM_START( puzznicj )
ROM_REGION( 0x20000, "maincpu", 0 )
ROM_LOAD( "c20-04.ic11", 0x00000, 0x20000, CRC(a4150b6c) SHA1(27719b8993735532cd59f4ed5693ff3143ee2336) )
ROM_REGION( 0x0800, "mcu:mcu", 0 ) /* 2k for the microcontroller */
- ROM_LOAD( "mc68705p3.ic4", 0x0000, 0x0800, CRC(085f68b4) SHA1(2dbc7e2c015220dc59ee1f1208540744e5b9b7cc) )
+ ROM_LOAD( "c20-01.ic4", 0x0000, 0x0800, CRC(085f68b4) SHA1(2dbc7e2c015220dc59ee1f1208540744e5b9b7cc) )
ROM_REGION( 0x40000, "gfx1", 0 )
ROM_LOAD16_BYTE( "c20-03.ic10", 0x00000, 0x20000, CRC(4264056c) SHA1(d2d8a170ae0f361093a5384935238605a59e5938) )
@@ -2555,6 +2570,7 @@ GAME( 1989, plottingu, plotting, plotting, plottingu, driver_device, 0,
GAME( 1989, flipull, plotting, plotting, plotting, driver_device, 0, ROT0, "Taito Corporation", "Flipull (Japan)", 0 )
GAME( 1989, puzznic, 0, puzznic, puzznic, driver_device, 0, ROT0, "Taito Corporation Japan", "Puzznic (World)", 0 )
+GAME( 1989, puzznicu, puzznic, puzznic, puzznic, driver_device, 0, ROT0, "Taito America Corporation", "Puzznic (US)", 0 )
GAME( 1989, puzznicj, puzznic, puzznic, puzznic, driver_device, 0, ROT0, "Taito Corporation", "Puzznic (Japan)", 0 )
GAME( 1989, puzznici, puzznic, puzznici, puzznic, driver_device, 0, ROT0, "bootleg", "Puzznic (Italian bootleg)", 0 )
GAME( 1989, puzznicb, puzznic, puzznici, puzznic, driver_device, 0, ROT0, "bootleg", "Puzznic (bootleg, set 1)", 0 )
diff --git a/src/mame/drivers/tempest.cpp b/src/mame/drivers/tempest.cpp
index ed90b761427..52aa2e411b1 100644
--- a/src/mame/drivers/tempest.cpp
+++ b/src/mame/drivers/tempest.cpp
@@ -477,7 +477,7 @@ static INPUT_PORTS_START( tempest )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_TILT )
PORT_SERVICE( 0x10, IP_ACTIVE_LOW )
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Diagnostic Step") PORT_CODE(KEYCODE_F1)
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Diagnostic Step")
/* bit 6 is the VG HALT bit. We set it to "low" */
/* per default (busy vector processor). */
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER("avg", avg_tempest_device, done_r, nullptr)
diff --git a/src/mame/drivers/testconsole.cpp b/src/mame/drivers/testconsole.cpp
new file mode 100644
index 00000000000..bf77d88225f
--- /dev/null
+++ b/src/mame/drivers/testconsole.cpp
@@ -0,0 +1,206 @@
+// license:BSD-3-Clause
+// copyright-holders:Vas Crabb
+/*
+
+Westinghouse Test Console
+
+This appears to be a wire-wrapped prototype of a device for field-
+programming some kind of interlocking system (possibly railway
+signalling or industrial automation). Chips have date codes up to
+8020, but there doesn't appear to be a copyright date in ROM, and the
+nameplate has no date either. There's a 110/220 switch on the side,
+and the AC wiring uses the brown, blue, green/yellow standard.
+
+
+Nameplate says:
+
+Westinghouse
+TEST CONSOLE
+SERIAL #5
+ELECTRONIC SYSTEMS DIVISION
+WESTINGHOUSE CANADA LTD. ES-595C303
+
+
+Key components:
+
+* 6.144 MHz crystal
+* Intel 8085A CPU
+* Intel P8155 I/O, timer, RAM
+* Intel 8255 PIA
+* 2x D2732 EPROM (8 kB total)
+* 8x 2114P45 RAM (4 kB total)
+* 4x DL-1416 quad 16-segment displays
+* 3x red LED
+* 24-pin ZIF socket for burning 2716 or 2732
+* 2x 4x4 keypad
+* two insulated trimpots (programming voltage adjustment?)
+* a sea of 7400 logic
+* two DIP switches
+
+
+Keypad layout (second pad is actually to the right of first):
+
+MODE TRAP/HEX ARM/DEC RESET/CLR
+MNE/+ HARD/- TRACE/× REL/÷
+REC/BCC SOFT/LIST DISP/VER STEP/PROG
+left/up right/down X/TRAN ENTER
+
+C/MW D/IW E/OF F/IA
+8/XX 9/HT A/MR B/IR
+4 5 6 7
+0 1 2 3
+
+TODO:
+* 8155/8255 peripherals
+* Timers/interrupts
+* EPROM programming
+* Debugging target machine(s)
+* DIP switches
+
+*/
+
+#include "emu.h"
+
+#include "cpu/i8085/i8085.h"
+#include "machine/i8155.h"
+#include "machine/i8255.h"
+#include "video/dl1416.h"
+
+#include "whousetc.lh"
+
+namespace {
+
+class whouse_testcons_state : public driver_device
+{
+public:
+ whouse_testcons_state(const machine_config &mconfig, device_type type, const char *tag)
+ : driver_device(mconfig, type, tag)
+ , m_dsp(*this, "dsp%u", 0)
+ {
+ }
+
+ DECLARE_DRIVER_INIT(whousetc)
+ {
+ }
+
+ template <unsigned Dsp> DECLARE_WRITE16_MEMBER(update_dsp)
+ {
+ output().set_digit_value((Dsp << 2) | offset, data);
+ }
+
+protected:
+ virtual void machine_reset() override
+ {
+ for (required_device<dl1416_device> const &dsp : m_dsp)
+ {
+ dsp->ce_w(0);
+ dsp->wr_w(0);
+ dsp->cu_w(1);
+ }
+ }
+
+ required_device_array<dl1416_device, 4> m_dsp;
+};
+
+
+ADDRESS_MAP_START(program_map, AS_PROGRAM, 8, whouse_testcons_state)
+ ADDRESS_MAP_UNMAP_HIGH
+ AM_RANGE(0x0000, 0x1fff) AM_ROM
+ AM_RANGE(0x2000, 0x2003) AM_DEVWRITE("dsp0", dl1416_device, data_w)
+ AM_RANGE(0x2004, 0x2007) AM_DEVWRITE("dsp1", dl1416_device, data_w)
+ AM_RANGE(0x2008, 0x200b) AM_DEVWRITE("dsp2", dl1416_device, data_w)
+ AM_RANGE(0x200c, 0x200f) AM_DEVWRITE("dsp3", dl1416_device, data_w)
+ AM_RANGE(0x2800, 0x28ff) AM_DEVREADWRITE("i8155", i8155_device, memory_r, memory_w)
+ AM_RANGE(0x3000, 0x3fff) AM_RAM
+ AM_RANGE(0x8800, 0x8800) AM_READ_PORT("row0")
+ AM_RANGE(0x8801, 0x8801) AM_READ_PORT("row1")
+ AM_RANGE(0x8802, 0x8802) AM_READ_PORT("row2")
+ AM_RANGE(0x8803, 0x8803) AM_READ_PORT("row3")
+ADDRESS_MAP_END
+
+ADDRESS_MAP_START(io_map, AS_IO, 8, whouse_testcons_state)
+ ADDRESS_MAP_GLOBAL_MASK(0xff)
+ ADDRESS_MAP_UNMAP_HIGH
+ AM_RANGE(0x80, 0x87) AM_DEVREADWRITE("i8155", i8155_device, io_r, io_w)
+ AM_RANGE(0x88, 0x8b) AM_DEVREADWRITE("i8255", i8255_device, read, write)
+ADDRESS_MAP_END
+
+
+INPUT_PORTS_START(whousetc)
+ PORT_START("row0")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_NAME("MODE")
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_NAME("TRAP / HEX")
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_NAME("ARM / DEC")
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_NAME("RESET / CLR")
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_NAME("C / MW")
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_NAME("D / IW")
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_NAME("E / OF")
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_NAME("F / IA")
+
+ PORT_START("row1")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_Q) PORT_NAME("MNE / +")
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_W) PORT_NAME("HARD / \xe2\x88\x92")
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_NAME("TRACE / \xc3\x97")
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_R) PORT_NAME("REL / \xc3\xb7")
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_T) PORT_NAME("8 / XX")
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_Y) PORT_NAME("9 / HT")
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_U) PORT_NAME("A / MR")
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_I) PORT_NAME("B / IR")
+
+ PORT_START("row2")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_A) PORT_NAME("REC / BCC")
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_S) PORT_NAME("SOFT / LIST")
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_D) PORT_NAME("DISP / VER")
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_F) PORT_NAME("STEP / PROG")
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_G) PORT_NAME("4")
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_H) PORT_NAME("5")
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_J) PORT_NAME("6")
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_K) PORT_NAME("7")
+
+ PORT_START("row3")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_Z) PORT_NAME("\xe2\x86\x90 / \xe2\x86\x91")
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_X) PORT_NAME("\xe2\x86\x92 / \xe2\x86\x93")
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_NAME("X / TRAN")
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_V) PORT_NAME("ENTER")
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_B) PORT_NAME("0")
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_N) PORT_NAME("1")
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_M) PORT_NAME("2")
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_COMMA) PORT_NAME("3")
+INPUT_PORTS_END
+
+
+MACHINE_CONFIG_START(whousetc, whouse_testcons_state)
+ MCFG_CPU_ADD("maincpu", I8085A, XTAL_6_144MHz)
+ MCFG_CPU_PROGRAM_MAP(program_map)
+ MCFG_CPU_IO_MAP(io_map)
+
+ MCFG_DEVICE_ADD("i8155", I8155, XTAL_6_144MHz)
+
+ MCFG_DEVICE_ADD("i8255", I8255, 0)
+
+ MCFG_DEVICE_ADD("dsp0", DL1416B, 0)
+ MCFG_DL1416_UPDATE_HANDLER(WRITE16(whouse_testcons_state, update_dsp<0>))
+
+ MCFG_DEVICE_ADD("dsp1", DL1416B, 0)
+ MCFG_DL1416_UPDATE_HANDLER(WRITE16(whouse_testcons_state, update_dsp<1>))
+
+ MCFG_DEVICE_ADD("dsp2", DL1416B, 0)
+ MCFG_DL1416_UPDATE_HANDLER(WRITE16(whouse_testcons_state, update_dsp<2>))
+
+ MCFG_DEVICE_ADD("dsp3", DL1416B, 0)
+ MCFG_DL1416_UPDATE_HANDLER(WRITE16(whouse_testcons_state, update_dsp<3>))
+
+ MCFG_DEFAULT_LAYOUT(layout_whousetc)
+MACHINE_CONFIG_END
+
+
+ROM_START(whousetc)
+ ROM_REGION(0x2000, "maincpu", 0)
+ ROM_LOAD("ofm.g2", 0x0000, 0x1000, CRC(40bf8973) SHA1(7815d36532a40384f6ae2a38df3140c1e70a06aa))
+ ROM_LOAD("ipc.a3", 0x1000, 0x1000, CRC(16f1e109) SHA1(0c6086f42c3cf6d79b1b54ab5c2dae8523c96d69))
+ROM_END
+
+} // anonymous namespace
+
+// YEAR NAME PARENT COMPAT MACHINE INPUT STATE INIT COMPANY FULLNAME FLAGS
+COMP( 1980?, whousetc, 0, 0, whousetc, whousetc, whouse_testcons_state, whousetc, "Westinghouse", "Test Console Serial #5", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW )
diff --git a/src/mame/drivers/tmaster.cpp b/src/mame/drivers/tmaster.cpp
index c989d84b77e..231ae17e593 100644
--- a/src/mame/drivers/tmaster.cpp
+++ b/src/mame/drivers/tmaster.cpp
@@ -2,17 +2,14 @@
// copyright-holders:Luca Elia, Mariusz Wojcieszek, Peter Ferrie
/***************************************************************************
- -= Touch Master / Galaxy Games =-
+ -= Touch Master Games =-
driver by Luca Elia (l.elia@tin.it) and Mariusz Wojcieszek
CPU: 68000
-Video: Blitter, double framebuffer
-Sound: OKI6295
-
-[Touch Master]
-
+Video: Blitter with two layers and double buffering (Xilinx FPGA)
+Sound: OKI M6295
Input: Microtouch touch screen
Other: Dallas NVRAM + optional RTC
@@ -91,27 +88,17 @@ Chips:
CY7C128A-55PC (x2 used for serial communication)
W241024AJ-15 (x4 used for blitter frame buffer)
-******************************************************************
-
-[Galaxy Games]
-
-Input: Trackballs and buttons
-Other: EEPROM
-To Do:
-
-- Coin optics
-
***************************************************************************/
#include "emu.h"
#include "cpu/m68000/m68000.h"
-#include "sound/okim6295.h"
-#include "machine/eepromser.h"
-#include "machine/microtch.h"
+#include "machine/ds1204.h"
#include "machine/mc68681.h"
+#include "machine/microtch.h"
#include "machine/nvram.h"
-#include "machine/ds1204.h"
#include "machine/watchdog.h"
+#include "sound/okim6295.h"
+#include "video/cesblit.h"
/***************************************************************************
@@ -124,74 +111,61 @@ class tmaster_state : public driver_device
public:
tmaster_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
- m_maincpu(*this,"maincpu"),
- m_microtouch(*this,"microtouch"),
- m_regs(*this, "regs"),
- m_galgames_ram(*this, "galgames_ram"),
- m_oki(*this, "oki"),
- m_duart(*this, "duart68681"),
+ m_maincpu(*this, "maincpu"),
m_screen(*this, "screen"),
- m_palette(*this, "palette") { }
+ m_palette(*this, "palette"),
+ m_blitter(*this, "blitter"),
+ m_oki(*this, "oki"),
+ m_microtouch(*this,"microtouch"),
+ m_duart(*this, "duart68681")
+ { }
- required_device<cpu_device> m_maincpu;
- optional_device<microtouch_device> m_microtouch;
- required_shared_ptr<uint16_t> m_regs;
- optional_shared_ptr<uint16_t> m_galgames_ram;
- required_device<okim6295_device> m_oki;
- optional_device<mc68681_device> m_duart;
- required_device<screen_device> m_screen;
- required_device<palette_device> m_palette;
+ DECLARE_WRITE_LINE_MEMBER(blitter_irq_callback);
- int m_okibank;
- uint8_t m_rtc_ram[8];
- bitmap_ind16 m_bitmap[2][2];
- uint16_t m_color;
- uint16_t m_addr;
- uint32_t m_gfx_offs;
- uint32_t m_gfx_size;
- int (tmaster_state::*m_compute_addr) (uint16_t reg_low, uint16_t reg_mid, uint16_t reg_high);
- uint16_t m_galgames_cart;
- uint32_t m_palette_offset;
- uint8_t m_palette_index;
- uint8_t m_palette_data[3];
+ TIMER_DEVICE_CALLBACK_MEMBER(scanline_interrupt);
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+
+ DECLARE_WRITE_LINE_MEMBER(write_oki_bank0);
+ DECLARE_WRITE_LINE_MEMBER(write_oki_bank1);
DECLARE_WRITE_LINE_MEMBER(duart_irq_handler);
+
DECLARE_READ16_MEMBER(rtc_r);
DECLARE_WRITE16_MEMBER(rtc_w);
- DECLARE_WRITE16_MEMBER(tmaster_color_w);
- DECLARE_WRITE16_MEMBER(tmaster_addr_w);
- DECLARE_WRITE16_MEMBER(tmaster_blitter_w);
- DECLARE_READ16_MEMBER(tmaster_blitter_r);
+
DECLARE_READ_LINE_MEMBER(read_rand);
- DECLARE_READ16_MEMBER(galgames_eeprom_r);
- DECLARE_WRITE16_MEMBER(galgames_eeprom_w);
- DECLARE_WRITE16_MEMBER(galgames_palette_offset_w);
- DECLARE_WRITE16_MEMBER(galgames_palette_data_w);
- DECLARE_READ16_MEMBER(galgames_okiram_r);
- DECLARE_WRITE16_MEMBER(galgames_okiram_w);
- DECLARE_WRITE16_MEMBER(galgames_cart_sel_w);
- DECLARE_READ16_MEMBER(galgames_cart_clock_r);
- DECLARE_WRITE16_MEMBER(galgames_cart_clock_w);
- DECLARE_READ16_MEMBER(galgames_cart_data_r);
- DECLARE_WRITE16_MEMBER(galgames_cart_data_w);
- DECLARE_READ16_MEMBER(dummy_read_01);
- DECLARE_WRITE_LINE_MEMBER(write_oki_bank0);
- DECLARE_WRITE_LINE_MEMBER(write_oki_bank1);
- DECLARE_DRIVER_INIT(galgames);
- DECLARE_DRIVER_INIT(galgame2);
- DECLARE_MACHINE_RESET(tmaster);
- DECLARE_VIDEO_START(tmaster);
- DECLARE_MACHINE_RESET(galgames);
- DECLARE_VIDEO_START(galgames);
- uint32_t screen_update_tmaster(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- TIMER_DEVICE_CALLBACK_MEMBER(tm3k_interrupt);
- uint8_t binary_to_BCD(uint8_t data);
- int tmaster_compute_addr(uint16_t reg_low, uint16_t reg_mid, uint16_t reg_high);
- int galgames_compute_addr(uint16_t reg_low, uint16_t reg_mid, uint16_t reg_high);
- void tmaster_draw();
- void galgames_update_rombank(uint32_t cart);
+
+protected:
+ required_device<cpu_device> m_maincpu;
+ required_device<screen_device> m_screen;
+ required_device<palette_device> m_palette;
+ required_device<cesblit_device> m_blitter;
+ required_device<okim6295_device> m_oki;
+ required_device<microtouch_device> m_microtouch;
+ required_device<mc68681_device> m_duart;
+
+ int m_okibank;
+
+ uint8_t m_rtc_ram[8];
};
+WRITE_LINE_MEMBER(tmaster_state::blitter_irq_callback)
+{
+// logerror("%s: Blitter IRQ callback state = %x\n", machine().describe_context(), state);
+ m_maincpu->set_input_line(2, state);
+}
+
+/***************************************************************************
+
+ Video
+
+***************************************************************************/
+
+uint32_t tmaster_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ bitmap.fill(m_palette->black_pen(), cliprect);
+ return m_blitter->screen_update(screen, bitmap, cliprect);
+}
/***************************************************************************
@@ -236,12 +210,10 @@ WRITE_LINE_MEMBER(tmaster_state::duart_irq_handler)
***************************************************************************/
-
-uint8_t tmaster_state::binary_to_BCD(uint8_t data)
+uint8_t binary_to_bcd(uint8_t data)
{
data %= 100;
-
- return ((data / 10) << 4) | (data %10);
+ return ((data / 10) << 4) | (data % 10);
}
READ16_MEMBER(tmaster_state::rtc_r)
@@ -249,13 +221,13 @@ READ16_MEMBER(tmaster_state::rtc_r)
system_time systime;
machine().current_datetime(systime);
- m_rtc_ram[0x1] = binary_to_BCD(systime.local_time.second);
- m_rtc_ram[0x2] = binary_to_BCD(systime.local_time.minute);
- m_rtc_ram[0x3] = binary_to_BCD(systime.local_time.hour);
- m_rtc_ram[0x4] = binary_to_BCD(systime.local_time.weekday);
- m_rtc_ram[0x5] = binary_to_BCD(systime.local_time.mday);
- m_rtc_ram[0x6] = binary_to_BCD(systime.local_time.month+1);
- m_rtc_ram[0x7] = binary_to_BCD(systime.local_time.year % 100);
+ m_rtc_ram[0x1] = binary_to_bcd(systime.local_time.second);
+ m_rtc_ram[0x2] = binary_to_bcd(systime.local_time.minute);
+ m_rtc_ram[0x3] = binary_to_bcd(systime.local_time.hour);
+ m_rtc_ram[0x4] = binary_to_bcd(systime.local_time.weekday);
+ m_rtc_ram[0x5] = binary_to_bcd(systime.local_time.mday);
+ m_rtc_ram[0x6] = binary_to_bcd(systime.local_time.month+1);
+ m_rtc_ram[0x7] = binary_to_bcd(systime.local_time.year % 100);
return m_rtc_ram[offset];
}
@@ -268,261 +240,15 @@ WRITE16_MEMBER(tmaster_state::rtc_w)
}
}
-
-/***************************************************************************
-
- Video & Blitter
-
-
- Offset: Bits: Value:
-
- 00
-
- 02 fedc ba-- ---- ----
- ---- --9- ---- ---- Layer 1 Buffer To Display
- ---- ---8 ---- ---- Layer 0 Buffer To Display
- ---- ---- 7654 3210
-
- 04 Width
- 06 X
-
- 08 Height - 1
- 0A Y
-
- 0C Source Address (low)
- 0E Source Address (mid)
-
- 10 fedc ba98 ---- ----
- ---- ---- 7--- ---- Layer
- ---- ---- -6-- ---- Buffer
- ---- ---- --5- ---- Solid Fill
- ---- ---- ---4 ---- flipped by lev.3 interrupt routine
- ---- ---- ---- 3--- flipped by lev.2 interrupt routine
- ---- ---- ---- -2-- flipped by lev.1 interrupt routine
- ---- ---- ---- --1- Flip Y
- ---- ---- ---- ---0 Flip X
-
- Addr Register:
-
- fedc ba98 ---- ---- Solid Fill Pen
- ---- ---- 7654 3210 Source Address (high)
-
- Color Register:
-
- fedc ba98 ---- ---- Source Pen (Pen Replacement Mode)
- ---- ---- 7654 3210 Palette (0-f) / Destination Pen (Pen Replacement Mode)
-
- A write to the source address (mid) triggers the blit.
- A the end of the blit, a level 2 IRQ is issued.
-
-***************************************************************************/
-
-int tmaster_state::tmaster_compute_addr(uint16_t reg_low, uint16_t reg_mid, uint16_t reg_high)
-{
- return (reg_low & 0xff) | ((reg_mid & 0x1ff) << 8) | (reg_high << 17);
-}
-
-int tmaster_state::galgames_compute_addr(uint16_t reg_low, uint16_t reg_mid, uint16_t reg_high)
-{
- return reg_low | (reg_mid << 16);
-}
-
-VIDEO_START_MEMBER(tmaster_state,tmaster)
-{
- int layer, buffer;
- for (layer = 0; layer < 2; layer++)
- {
- for (buffer = 0; buffer < 2; buffer++)
- {
- m_screen->register_screen_bitmap(m_bitmap[layer][buffer]);
- m_bitmap[layer][buffer].fill(0xff);
- }
- }
-
- m_compute_addr = &tmaster_state::tmaster_compute_addr;
-}
-
-VIDEO_START_MEMBER(tmaster_state,galgames)
-{
- VIDEO_START_CALL_MEMBER( tmaster );
- m_compute_addr = &tmaster_state::galgames_compute_addr;
-}
-
-uint32_t tmaster_state::screen_update_tmaster(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
- int layers_ctrl = -1;
-
-#ifdef MAME_DEBUG
- if (machine().input().code_pressed(KEYCODE_Z))
- {
- int mask = 0;
- if (machine().input().code_pressed(KEYCODE_Q)) mask |= 1;
- if (machine().input().code_pressed(KEYCODE_W)) mask |= 2;
- if (mask != 0) layers_ctrl &= mask;
- }
-#endif
-
-
- bitmap.fill(m_palette->black_pen(), cliprect);
-
- if (layers_ctrl & 1) copybitmap_trans(bitmap, m_bitmap[0][(m_regs[0x02/2]>>8)&1], 0,0,0,0, cliprect, 0xff);
- if (layers_ctrl & 2) copybitmap_trans(bitmap, m_bitmap[1][(m_regs[0x02/2]>>9)&1], 0,0,0,0, cliprect, 0xff);
-
- return 0;
-}
-
-WRITE16_MEMBER(tmaster_state::tmaster_color_w)
-{
- COMBINE_DATA( &m_color );
-}
-
-WRITE16_MEMBER(tmaster_state::tmaster_addr_w)
-{
- COMBINE_DATA( &m_addr );
-}
-
-void tmaster_state::tmaster_draw()
-{
- int x,y,x0,x1,y0,y1,dx,dy,flipx,flipy,sx,sy,sw,sh, addr, mode, layer,buffer, color;
-
- uint8_t *gfxdata = memregion( "blitter" )->base() + m_gfx_offs;
-
- uint16_t pen;
-
- buffer = (m_regs[0x02/2] >> 8) & 3; // 1 bit per layer, selects the currently displayed buffer
- sw = m_regs[0x04/2];
- sx = m_regs[0x06/2];
- sh = m_regs[0x08/2] + 1;
- sy = m_regs[0x0a/2];
- addr = (this->*m_compute_addr)(
- m_regs[0x0c/2],
- m_regs[0x0e/2], m_addr);
- mode = m_regs[0x10/2];
-
- layer = (mode >> 7) & 1; // layer to draw to
- buffer = ((mode >> 6) & 1) ^ ((buffer >> layer) & 1); // bit 6 selects whether to use the opposite buffer to that displayed
- bitmap_ind16 &bitmap = m_bitmap[layer][buffer];
-
- addr <<= 1;
-
-#ifdef MAME_DEBUG
-#if 0
- logerror("%s: blit w %03x, h %02x, x %03x, y %02x, src %06x, fill/addr %04x, repl/color %04x, mode %02x\n", machine().describe_context(),
- sw,sh,sx,sy, addr, m_addr, m_color, mode
- );
-#endif
-#endif
-
- flipx = mode & 1;
- flipy = mode & 2;
-
- if (flipx) { x0 = sw-1; x1 = -1; dx = -1; sx -= sw-1; }
- else { x0 = 0; x1 = sw; dx = +1; }
-
- if (flipy) { y0 = sh-1; y1 = -1; dy = -1; sy -= sh-1; }
- else { y0 = 0; y1 = sh; dy = +1; }
-
- sx = (sx & 0x7fff) - (sx & 0x8000);
- sy = (sy & 0x7fff) - (sy & 0x8000);
-
- color = (m_color & 0x0f) << 8;
-
- switch (mode & 0x20)
- {
- case 0x00: // blit with transparency
- if (addr > m_gfx_size - sw*sh)
- {
- logerror("%s: blit error, addr %06x out of bounds\n", machine().describe_context(),addr);
- addr = m_gfx_size - sw*sh;
- }
-
- if ( mode & 0x200 )
- {
- // copy from ROM, replacing occurrences of src pen with dst pen
-
- uint8_t dst_pen = (m_color >> 8) & 0xff;
- uint8_t src_pen = (m_color >> 0) & 0xff;
-
- for (y = y0; y != y1; y += dy)
- {
- for (x = x0; x != x1; x += dx)
- {
- pen = gfxdata[addr++];
-
- if (pen == src_pen)
- pen = dst_pen;
-
- if ((pen != 0xff) && (sx + x >= 0) && (sx + x < 400) && (sy + y >= 0) && (sy + y < 256))
- bitmap.pix16(sy + y, sx + x) = pen + color;
- }
- }
- }
- else
- {
- // copy from ROM as is
-
- for (y = y0; y != y1; y += dy)
- {
- for (x = x0; x != x1; x += dx)
- {
- pen = gfxdata[addr++];
-
- if ((pen != 0xff) && (sx + x >= 0) && (sx + x < 400) && (sy + y >= 0) && (sy + y < 256))
- bitmap.pix16(sy + y, sx + x) = pen + color;
- }
- }
- }
- break;
-
- case 0x20: // solid fill
- pen = ((m_addr >> 8) & 0xff) + color;
-
- if ((pen & 0xff) == 0xff)
- pen = 0xff;
-
- for (y = y0; y != y1; y += dy)
- {
- for (x = x0; x != x1; x += dx)
- {
- if ((sx + x >= 0) && (sx + x < 400) && (sy + y >= 0) && (sy + y < 256))
- bitmap.pix16(sy + y, sx + x) = pen;
- }
- }
- break;
-
- }
-}
-
-WRITE16_MEMBER(tmaster_state::tmaster_blitter_w)
-{
- COMBINE_DATA( m_regs + offset );
- switch (offset*2)
- {
- case 0x0e:
- tmaster_draw();
- m_maincpu->set_input_line(2, HOLD_LINE);
- break;
- }
-}
-
-READ16_MEMBER(tmaster_state::tmaster_blitter_r)
-{
- return 0x0000; // bit 7 = 1 -> blitter busy
-}
-
/***************************************************************************
Memory Maps
***************************************************************************/
-/***************************************************************************
- Touch Master
-***************************************************************************/
-
READ_LINE_MEMBER(tmaster_state::read_rand)
{
- return machine().rand()&1;
+ return machine().rand() & 1;
}
static ADDRESS_MAP_START( tmaster_map, AS_PROGRAM, 16, tmaster_state )
@@ -537,10 +263,10 @@ static ADDRESS_MAP_START( tmaster_map, AS_PROGRAM, 16, tmaster_state )
AM_RANGE( 0x300040, 0x300041 ) AM_WRITE_PORT("OUT")
- AM_RANGE( 0x300070, 0x300071 ) AM_WRITE(tmaster_addr_w )
+ AM_RANGE( 0x300070, 0x300071 ) AM_DEVWRITE("blitter", cesblit_device, addr_hi_w )
- AM_RANGE( 0x500000, 0x500011 ) AM_WRITE(tmaster_blitter_w ) AM_SHARE("regs")
- AM_RANGE( 0x500010, 0x500011 ) AM_READ(tmaster_blitter_r )
+ AM_RANGE( 0x500000, 0x500011 ) AM_DEVWRITE("blitter", cesblit_device, regs_w )
+ AM_RANGE( 0x500010, 0x500011 ) AM_DEVREAD( "blitter", cesblit_device, status_r )
AM_RANGE( 0x580000, 0x580001 ) AM_WRITENOP // often
@@ -548,251 +274,33 @@ static ADDRESS_MAP_START( tmaster_map, AS_PROGRAM, 16, tmaster_state )
AM_RANGE( 0x800000, 0x800001 ) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff )
- AM_RANGE( 0x800010, 0x800011 ) AM_WRITE(tmaster_color_w )
+ AM_RANGE( 0x800010, 0x800011 ) AM_DEVWRITE("blitter", cesblit_device, color_w )
ADDRESS_MAP_END
-
-/***************************************************************************
- Galaxy Games
-***************************************************************************/
-
-// ROM/RAM Banking
-
-#define GALGAMES_BANK_000000_R "000000_r"
-#define GALGAMES_BANK_000000_W "000000_w"
-#define GALGAMES_BANK_200000_R "200000_r"
-#define GALGAMES_BANK_200000_W "200000_w"
-#define GALGAMES_BANK_240000_R "240000_r"
-
-#define GALGAMES_RAM 0
-#define GALGAMES_ROM0 1
-#define GALGAMES_ROM1 2
-#define GALGAMES_ROM2 3
-#define GALGAMES_ROM3 4
-
-
-// NVRAM (5 x EEPROM)
-
-#define GALGAMES_EEPROM_BIOS "eeprom_bios"
-#define GALGAMES_EEPROM_CART1 "eeprom_cart1"
-#define GALGAMES_EEPROM_CART2 "eeprom_cart2"
-#define GALGAMES_EEPROM_CART3 "eeprom_cart3"
-#define GALGAMES_EEPROM_CART4 "eeprom_cart4"
-
-static const char *const galgames_eeprom_names[5] = { GALGAMES_EEPROM_BIOS, GALGAMES_EEPROM_CART1, GALGAMES_EEPROM_CART2, GALGAMES_EEPROM_CART3, GALGAMES_EEPROM_CART4 };
-
-READ16_MEMBER(tmaster_state::galgames_eeprom_r)
-{
- eeprom_serial_93cxx_device *eeprom = machine().device<eeprom_serial_93cxx_device>(galgames_eeprom_names[m_galgames_cart]);
-
- return eeprom->do_read() ? 0x80 : 0x00;
-}
-
-WRITE16_MEMBER(tmaster_state::galgames_eeprom_w)
-{
- if (data & ~0x0003)
- logerror("CPU #0 PC: %06X - Unknown EEPROM bit written %04X\n",space.device().safe_pc(),data);
-
- if ( ACCESSING_BITS_0_7 )
- {
- eeprom_serial_93cxx_device *eeprom = machine().device<eeprom_serial_93cxx_device>(galgames_eeprom_names[m_galgames_cart]);
-
- // latch the bit
- eeprom->di_write(data & 0x0001);
-
- // clock line asserted: write latch or select next bit to read
- eeprom->clk_write((data & 0x0002) ? ASSERT_LINE : CLEAR_LINE );
- }
-}
-
-// BT481A Palette RAMDAC
-
-WRITE16_MEMBER(tmaster_state::galgames_palette_offset_w)
-{
- if (ACCESSING_BITS_0_7)
- {
- m_palette_offset = data & 0xff;
- m_palette_index = 0;
- }
-}
-WRITE16_MEMBER(tmaster_state::galgames_palette_data_w)
-{
- if (ACCESSING_BITS_0_7)
- {
- m_palette_data[m_palette_index] = data & 0xff;
- if (++m_palette_index == 3)
- {
- int palette_base;
- for (palette_base = 0; palette_base < 0x1000; palette_base += 0x100)
- m_palette->set_pen_color(m_palette_offset + palette_base, rgb_t(m_palette_data[0], m_palette_data[1], m_palette_data[2]));
- m_palette_index = 0;
- m_palette_offset++;
- }
- }
-}
-
-// Sound
-READ16_MEMBER(tmaster_state::galgames_okiram_r)
-{
- return memregion("oki")->base()[offset] | 0xff00;
-}
-WRITE16_MEMBER(tmaster_state::galgames_okiram_w)
-{
- if (ACCESSING_BITS_0_7)
- memregion("oki")->base()[offset] = data & 0xff;
-}
-
-// Carts (preliminary, PIC communication is not implemented)
-
-void tmaster_state::galgames_update_rombank(uint32_t cart)
-{
- m_galgames_cart = cart;
-
- m_gfx_offs = 0x200000 * cart;
-
- if (membank(GALGAMES_BANK_000000_R)->entry() == GALGAMES_RAM)
- membank(GALGAMES_BANK_200000_R)->set_entry(GALGAMES_ROM0 + m_galgames_cart); // rom
-
- membank(GALGAMES_BANK_240000_R)->set_entry(GALGAMES_ROM0 + m_galgames_cart); // rom
-}
-
-WRITE16_MEMBER(tmaster_state::galgames_cart_sel_w)
-{
- // cart selection (0 1 2 3 4 7)
-
- if (ACCESSING_BITS_0_7)
- {
- int i;
-
- switch( data & 0xff )
- {
- case 0x07: // 7 resets the eeprom
- for (i = 0; i < 5; i++)
- machine().device<eeprom_serial_93cxx_device>(galgames_eeprom_names[i])->cs_write(CLEAR_LINE);
- break;
-
- case 0x00:
- case 0x01:
- case 0x02:
- case 0x03:
- case 0x04:
- machine().device<eeprom_serial_93cxx_device>(galgames_eeprom_names[data & 0xff])->cs_write(ASSERT_LINE);
- galgames_update_rombank(data & 0xff);
- break;
-
- default:
- machine().device<eeprom_serial_93cxx_device>(galgames_eeprom_names[0])->cs_write(ASSERT_LINE);
- galgames_update_rombank(0);
- logerror("%06x: unknown cart sel = %04x\n", space.device().safe_pc(), data);
- break;
- }
- }
-}
-
-READ16_MEMBER(tmaster_state::galgames_cart_clock_r)
-{
- return 0x0080;
-}
-
-WRITE16_MEMBER(tmaster_state::galgames_cart_clock_w)
-{
- if (ACCESSING_BITS_0_7)
- {
- // bit 3 = clock
-
- // ROM/RAM banking
- if ((data & 0xf7) == 0x05)
- {
- membank(GALGAMES_BANK_000000_R)->set_entry(GALGAMES_RAM); // ram
- galgames_update_rombank(m_galgames_cart);
- logerror("%06x: romram bank = %04x\n", space.device().safe_pc(), data);
- }
- else
- {
- membank(GALGAMES_BANK_000000_R)->set_entry(GALGAMES_ROM0); // rom
- membank(GALGAMES_BANK_200000_R)->set_entry(GALGAMES_RAM); // ram
- logerror("%06x: unknown romram bank = %04x\n", space.device().safe_pc(), data);
- }
- }
-}
-
-READ16_MEMBER(tmaster_state::galgames_cart_data_r)
-{
- return 0;
-}
-WRITE16_MEMBER(tmaster_state::galgames_cart_data_w)
-{
-}
-
-
-READ16_MEMBER(tmaster_state::dummy_read_01)
-{
- return 0x3; // Pass the check at PC = 0xfae & a later one
-}
-
-static ADDRESS_MAP_START( galgames_map, AS_PROGRAM, 16, tmaster_state )
-
- AM_RANGE( 0x000000, 0x03ffff ) AM_READ_BANK(GALGAMES_BANK_000000_R) AM_WRITE_BANK(GALGAMES_BANK_000000_W) AM_SHARE("galgames_ram")
- AM_RANGE( 0x040000, 0x1fffff ) AM_ROM AM_REGION( "maincpu", 0x40000 )
- AM_RANGE( 0x200000, 0x23ffff ) AM_READ_BANK(GALGAMES_BANK_200000_R) AM_WRITE_BANK(GALGAMES_BANK_200000_W)
- AM_RANGE( 0x240000, 0x3fffff ) AM_READ_BANK(GALGAMES_BANK_240000_R)
-
- AM_RANGE( 0x400000, 0x400011 ) AM_WRITE(tmaster_blitter_w ) AM_SHARE("regs")
- AM_RANGE( 0x400012, 0x400013 ) AM_WRITE(tmaster_addr_w )
- AM_RANGE( 0x400014, 0x400015 ) AM_WRITE(tmaster_color_w )
- AM_RANGE( 0x400020, 0x400021 ) AM_READ(tmaster_blitter_r )
-
- AM_RANGE( 0x600000, 0x600001 ) AM_READ(dummy_read_01 ) AM_WRITENOP
- AM_RANGE( 0x700000, 0x700001 ) AM_READ(dummy_read_01 ) AM_WRITENOP
- AM_RANGE( 0x800020, 0x80003f ) AM_NOP // ?
- AM_RANGE( 0x900000, 0x900001 ) AM_DEVWRITE("watchdog", watchdog_timer_device, reset16_w)
-
- AM_RANGE( 0xa00000, 0xa00001 ) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff )
- AM_RANGE( 0xb00000, 0xb7ffff ) AM_READWRITE(galgames_okiram_r, galgames_okiram_w ) // (only low bytes tested) 4x N341024SJ-15
-
- AM_RANGE( 0xc00000, 0xc00001 ) AM_WRITE(galgames_palette_offset_w )
- AM_RANGE( 0xc00002, 0xc00003 ) AM_WRITE(galgames_palette_data_w )
-
- AM_RANGE( 0xd00000, 0xd00001 ) AM_READ_PORT("TRACKBALL_1_X")
- AM_RANGE( 0xd00000, 0xd00001 ) AM_WRITENOP
- AM_RANGE( 0xd00002, 0xd00003 ) AM_READ_PORT("TRACKBALL_1_Y")
- AM_RANGE( 0xd00004, 0xd00005 ) AM_READ_PORT("TRACKBALL_2_X")
- AM_RANGE( 0xd00006, 0xd00007 ) AM_READ_PORT("TRACKBALL_2_Y")
- AM_RANGE( 0xd00008, 0xd00009 ) AM_READ_PORT("P1")
- AM_RANGE( 0xd0000a, 0xd0000b ) AM_READ_PORT("P2")
- AM_RANGE( 0xd0000c, 0xd0000d ) AM_READ_PORT("SYSTEM") AM_WRITENOP
-
- AM_RANGE( 0xd0000e, 0xd0000f ) AM_WRITE(galgames_cart_sel_w )
- AM_RANGE( 0xd00010, 0xd00011 ) AM_READWRITE(galgames_eeprom_r, galgames_eeprom_w )
- AM_RANGE( 0xd00012, 0xd00013 ) AM_READWRITE(galgames_cart_data_r, galgames_cart_data_w )
- AM_RANGE( 0xd00014, 0xd00015 ) AM_READWRITE(galgames_cart_clock_r, galgames_cart_clock_w )
-
-ADDRESS_MAP_END
-
-
/***************************************************************************
Input Ports
***************************************************************************/
+
static INPUT_PORTS_START( tm )
PORT_START("COIN")
- PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN5 ) // "M. Coin 1 Input"
- PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN6 ) // "M. Coin 2 Input"
- PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BILL1 ) PORT_IMPULSE(2) // "DBV Input"
- PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN ) // service coin?
- PORT_SERVICE_NO_TOGGLE( 0x0020, IP_ACTIVE_LOW )
- PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_SERVICE1 ) // "Calibrate"
- PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER( DEVICE_SELF, tmaster_state, read_rand )
- PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_COIN1 ) // "E. Coin 1" (ECA?) tmaster defaults to e. coin,
- PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_COIN2 ) // "E. Coin 2" (ECA?) rather than m. coin
- PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_COIN3 ) // "E. Coin 3" (ECA?) so they're coin1-coin4
- PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_COIN4 ) // "E. Coin 4" (ECA?)
+ PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN5 ) // "M. Coin 1 Input"
+ PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN6 ) // "M. Coin 2 Input"
+ PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BILL1 ) PORT_IMPULSE(2) // "DBV Input"
+ PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN ) // service coin?
+ PORT_SERVICE_NO_TOGGLE( 0x0020, IP_ACTIVE_LOW )
+ PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_SERVICE1 ) // "Calibrate"
+ PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER( DEVICE_SELF, tmaster_state, read_rand )
+ PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_COIN1 ) // "E. Coin 1" (ECA?) tmaster defaults to e. coin,
+ PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_COIN2 ) // "E. Coin 2" (ECA?) rather than m. coin
+ PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_COIN3 ) // "E. Coin 3" (ECA?) so they're coin1-coin4
+ PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_COIN4 ) // "E. Coin 4" (ECA?)
PORT_START("OUT")
//0800?
@@ -821,89 +329,37 @@ static INPUT_PORTS_START( tm4k )
PORT_MODIFY( "OUT" )
PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER( "ds1204", ds1204_device, write_rst )
- PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER( "ds1204", ds1204_device, write_dq )
+ PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER( "ds1204", ds1204_device, write_dq )
PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER( "ds1204", ds1204_device, write_clk )
INPUT_PORTS_END
-static INPUT_PORTS_START( galgames )
- PORT_START("P1")
- PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) // Button A (right)
- PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) // Button B (left)
- PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
-
- PORT_START("P2")
- PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) // Button A (right)
- PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) // Button B (left)
- PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_SERVICE1) // DBA (coin)
- PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
-
- PORT_START("SYSTEM")
- PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) // CS 1 (coin)
- PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) // CS 2 (coin)
- PORT_SERVICE( 0x0004, IP_ACTIVE_HIGH ) // System Check
- PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
-
- PORT_START("TRACKBALL_1_X")
- PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(5) PORT_PLAYER(1) PORT_RESET
-
- PORT_START("TRACKBALL_1_Y")
- PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(5) PORT_PLAYER(1) PORT_RESET
-
- PORT_START("TRACKBALL_2_X")
- PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(5) PORT_PLAYER(2) PORT_RESET
-
- PORT_START("TRACKBALL_2_Y")
- PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(5) PORT_PLAYER(2) PORT_RESET
-INPUT_PORTS_END
-
-
/***************************************************************************
Machine Drivers
***************************************************************************/
-MACHINE_RESET_MEMBER(tmaster_state,tmaster)
-{
- m_gfx_offs = 0;
- m_gfx_size = memregion("blitter")->bytes();
-
-}
-
-TIMER_DEVICE_CALLBACK_MEMBER(tmaster_state::tm3k_interrupt)
+TIMER_DEVICE_CALLBACK_MEMBER(tmaster_state::scanline_interrupt)
{
int scanline = param;
- if(scanline == 0) // vblank, FIXME
+ if (scanline == 0) // vblank, FIXME
m_maincpu->set_input_line(3, HOLD_LINE);
- else if((scanline % 16) == 0)
+ else if ((scanline % 16) == 0)
m_maincpu->set_input_line(1, HOLD_LINE);
// lev 2 triggered at the end of the blit
}
+int tmaster_compute_addr(uint16_t reg_low, uint16_t reg_mid, uint16_t reg_high)
+{
+ return (reg_low & 0xff) | ((reg_mid & 0x1ff) << 8) | (reg_high << 17);
+}
+
static MACHINE_CONFIG_START( tm, tmaster_state )
MCFG_CPU_ADD("maincpu", M68000, XTAL_24MHz / 2) /* 12MHz */
MCFG_CPU_PROGRAM_MAP(tmaster_map)
- MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", tmaster_state, tm3k_interrupt, "screen", 0, 1)
-
- MCFG_MACHINE_RESET_OVERRIDE(tmaster_state,tmaster)
+ MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", tmaster_state, scanline_interrupt, "screen", 0, 1)
MCFG_MC68681_ADD( "duart68681", XTAL_8_664MHz / 2 /*??*/)
MCFG_MC68681_IRQ_CALLBACK(WRITELINE(tmaster_state, duart_irq_handler))
@@ -913,19 +369,23 @@ static MACHINE_CONFIG_START( tm, tmaster_state )
MCFG_NVRAM_ADD_0FILL("nvram")
+ // video hardware
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
MCFG_SCREEN_SIZE(400, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 400-1, 0, 256-1)
- MCFG_SCREEN_UPDATE_DRIVER(tmaster_state, screen_update_tmaster)
+ MCFG_SCREEN_UPDATE_DRIVER(tmaster_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
MCFG_PALETTE_ADD("palette", 0x1000)
MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
- MCFG_VIDEO_START_OVERRIDE(tmaster_state,tmaster)
+ MCFG_CESBLIT_ADD("blitter", "screen", XTAL_32MHz)
+ MCFG_CESBLIT_COMPUTE_ADDR(tmaster_compute_addr)
+ MCFG_CESBLIT_IRQ_CB(WRITELINE(tmaster_state, blitter_irq_callback))
+ // sound hardware
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_OKIM6295_ADD("oki", XTAL_24MHz / 16, OKIM6295_PIN7_HIGH) /* 1.5Mhz? clock frequency & pin 7 not verified */
@@ -936,71 +396,6 @@ static MACHINE_CONFIG_DERIVED( tmds1204, tm )
MCFG_DS1204_ADD("ds1204")
MACHINE_CONFIG_END
-MACHINE_RESET_MEMBER(tmaster_state,galgames)
-{
- m_gfx_offs = 0;
- m_gfx_size = 0x200000;
-
- membank(GALGAMES_BANK_000000_R)->set_entry(GALGAMES_ROM0); // rom
- membank(GALGAMES_BANK_000000_W)->set_entry(GALGAMES_RAM); // ram
-
- membank(GALGAMES_BANK_200000_R)->set_entry(GALGAMES_RAM); // ram
- membank(GALGAMES_BANK_200000_W)->set_entry(GALGAMES_RAM); // ram
-
- membank(GALGAMES_BANK_240000_R)->set_entry(GALGAMES_ROM0); // rom
-
- galgames_update_rombank(0);
-
- m_maincpu->reset();
-}
-
-static MACHINE_CONFIG_START( galgames, tmaster_state )
- MCFG_CPU_ADD("maincpu", M68000, XTAL_24MHz / 2)
- MCFG_CPU_PROGRAM_MAP(galgames_map)
- MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", tmaster_state, tm3k_interrupt, "screen", 0, 1)
- MCFG_WATCHDOG_ADD("watchdog")
-
- // 5 EEPROMs on the motherboard (for BIOS + 4 Carts)
- MCFG_EEPROM_SERIAL_93C76_8BIT_ADD(GALGAMES_EEPROM_BIOS)
- MCFG_EEPROM_SERIAL_93C76_8BIT_ADD(GALGAMES_EEPROM_CART1)
- MCFG_EEPROM_SERIAL_93C76_8BIT_ADD(GALGAMES_EEPROM_CART2)
- MCFG_EEPROM_SERIAL_93C76_8BIT_ADD(GALGAMES_EEPROM_CART3)
- MCFG_EEPROM_SERIAL_93C76_8BIT_ADD(GALGAMES_EEPROM_CART4)
-
- MCFG_MACHINE_RESET_OVERRIDE(tmaster_state, galgames )
-
- /* video hardware */
- MCFG_SCREEN_ADD("screen", RASTER)
- MCFG_SCREEN_REFRESH_RATE(60)
- MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
- MCFG_SCREEN_SIZE(400, 256)
- MCFG_SCREEN_VISIBLE_AREA(0, 400-1, 0, 256-1)
- MCFG_SCREEN_UPDATE_DRIVER(tmaster_state, screen_update_tmaster)
- MCFG_SCREEN_PALETTE("palette")
-
- MCFG_PALETTE_ADD("palette", 0x1000) // only 0x100 used
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
-
- MCFG_VIDEO_START_OVERRIDE(tmaster_state,galgames)
-
- /* sound hardware */
- MCFG_SPEAKER_STANDARD_MONO("mono")
-
- MCFG_OKIM6295_ADD("oki", XTAL_24MHz / 8, OKIM6295_PIN7_LOW) // clock frequency & pin 7 not verified
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
-MACHINE_CONFIG_END
-
-/*
- Each cartridge contains a PIC, that should provide, among other things, the following header:
-
- 4345 5331 3939 3700 0c10 ffb3 3c00 0000 "CES1997"
- fffe f2f7 8557 c119 0000 0000 2340 188e
-*/
-static MACHINE_CONFIG_DERIVED( galgame2, galgames )
-// MCFG_CPU_ADD("pic", PIC12C508, XTAL_24MHz / 2)
-MACHINE_CONFIG_END
-
-
/***************************************************************************
ROMs Loading
@@ -1687,168 +1082,6 @@ ROM_START( tm8k902 )
ROM_LOAD( "tm8k_sound.u8", 0x00000, 0x100000, CRC(c6070a60) SHA1(2dc20bf2217a36374b5a691133ad43f53dbe29ca) ) /* Mask rom labeled 5341-16513-03 U8 SOUND */
ROM_END
-/***************************************************************************
-
-Galaxy Games BIOS v. 1.90
-
-This is a multi-game cocktail cabinet released in 1998. Namco seems to have
-made some cartridges for it (or at least licensed their IP).
-
-Trackball-based. 'BIOS' has 7 built-in games. There are two LEDs on the PCB.
-
-More information here : http://www.cesgames.com/museum/galaxy/index.html
-
-----
-
-Board silkscreened 237-0211-00
- REV.-D
-
-Cartridge based mother board
-Holds up to 4 cartridges
-Chips labeled
- GALAXY U1 V1.90 12/1/98
- GALAXY U2 V1.90 12/1/98
-
-Motorola MC68HC000FN12
-24 MHz oscillator
-Xilinx XC5206
-Xilinx XC5202
-BT481AKPJ110 (Palette RAMDAC)
-NKK N341024SJ-15 x8 (128kB RAM)
-OKI M6295 8092352-2
-
-PAL16V8H-15 @ U24 Blue dot on it
-PAL16V8H-15 @ U25 Yellow dot on it
-PAL16V8H-15 @ U26 Red dot on it
-PAL16V8H-15 @ U27 Green dot on it
-PAL16V8H-15 @ U45 red dot on it
-
-4 known game carts where produced, these are:
-
-Star Pak 1: Seek the Peaks, 21 Thunder, Solar Solitaire, Prism Poker, Pharaoh's Tomb, Black Jack,
- Twenty One Thunder Plus, Power Pairs, Prism Poker Plus & Have A Cow
-Star Pak 2: Pack-Man, Ms.Pac-Man, Pharaoh's Tomb, Solar Solitaire, Power Pairs, Seek The peeks & Have A Cow
-Star Pak 3: Centipede, Great Wall, Ker-Chunk, Diamond Derby, Word Sleuth, Pull!, Astro Blast & Sweeper
-Star Pak 4: Berzerk, Neon Nightmare, Battle Checkers, Orbit, Deep Sea Shadow, Star Tiger & Orbit Freefall
-
-Copyright notice in rom state: Creative Electronics & Software Written by Keith M. Kolmos May 29,1998
-
-***************************************************************************/
-
-#define GALGAMES_BIOS_ROMS \
- ROM_SYSTEM_BIOS( 0, "0", "v1.90" ) \
- ROMX_LOAD( "galaxy.u2", 0x000000, 0x100000, CRC(e51ff184) SHA1(aaa795f2c15ec29b3ceeb5c917b643db0dbb7083), ROM_SKIP(1) | ROM_BIOS(1) ) \
- ROMX_LOAD( "galaxy.u1", 0x000001, 0x100000, CRC(c6d7bc6d) SHA1(93c032f9aa38cbbdda59a8a25ff9f38f7ad9c760), ROM_SKIP(1) | ROM_BIOS(1) )
-
-#define GALGAMES_MB_PALS \
- ROM_REGION( 0xa00, "pals", 0) \
- ROM_LOAD( "16v8h-blue.u24", 0x000, 0x117, NO_DUMP ) \
- ROM_LOAD( "16v8h-yellow.u25", 0x200, 0x117, NO_DUMP ) \
- ROM_LOAD( "16v8h-magenta.u26", 0x400, 0x117, NO_DUMP ) \
- ROM_LOAD( "16v8h-green.u27", 0x600, 0x117, NO_DUMP ) \
- ROM_LOAD( "16v8h-red.u45", 0x800, 0x117, NO_DUMP )
-
-ROM_START( galgbios )
- ROM_REGION( 0x200000, "maincpu", 0 )
- GALGAMES_BIOS_ROMS
-
- ROM_REGION( 0x200000, "blitter", 0 )
- ROM_COPY( "maincpu", 0x00000, 0, 0x200000 )
-
- ROM_REGION( 0x40000, "oki", ROMREGION_ERASE )
- // RAM, filled by the 68000 and fed to the OKI
-
- GALGAMES_MB_PALS
-ROM_END
-
-/***************************************************************************
-
-Galaxy Games StarPak 2
-
-NAMCO 307 Cartridge, has surface mount Flash chips in it:
-
-.u1 am29f800BB
-.u2 am29f800BB
-.u4 pic 12c508
-
-Board silkscreened 237-0209-00
- REV.-C
-
-***************************************************************************/
-
-ROM_START( galgame2 )
- ROM_REGION( 0x200000 * 2, "maincpu", 0 )
- GALGAMES_BIOS_ROMS
- ROM_LOAD16_BYTE( "namco.u2", 0x200000, 0x100000, CRC(f43c0c54) SHA1(4a13946c3d173b0e4ab25b01849574fa3302b417) )
- ROM_LOAD16_BYTE( "namco.u1", 0x200001, 0x100000, CRC(b8c34a8b) SHA1(40d3b35f573d2bd2ae1c7d876c55fc436864fa3f) )
-
- ROM_REGION( 0x9db, "pic", 0 )
- ROM_LOAD( "namco.u4", 0x000, 0x9db, CRC(63ec1224) SHA1(2966b2aa431e6b8d46cbba18a6fc4de7395caa04) )
-
- ROM_REGION( 0x200000 * 2, "blitter", 0 )
- ROM_COPY( "maincpu", 0x00000, 0, 0x200000 * 2 )
-
- ROM_REGION( 0x40000, "oki", ROMREGION_ERASE )
- // RAM, filled by the 68000 and fed to the OKI
-
- GALGAMES_MB_PALS
-ROM_END
-
-
-DRIVER_INIT_MEMBER(tmaster_state,galgames)
-{
- uint8_t *ROM = memregion("maincpu")->base();
- int cart;
-
- // RAM bank at 0x000000-0x03ffff and 0x200000-0x23ffff
- // ROM bank at 0x000000-0x1fffff and 0x200000-0x3fffff (bios)
-
- membank(GALGAMES_BANK_000000_R)->configure_entry(GALGAMES_RAM, m_galgames_ram);
- membank(GALGAMES_BANK_000000_R)->configure_entry(GALGAMES_ROM0, ROM+0x000000);
-
- membank(GALGAMES_BANK_000000_W)->configure_entry(GALGAMES_RAM, m_galgames_ram);
-
- membank(GALGAMES_BANK_200000_R)->configure_entry(GALGAMES_RAM, m_galgames_ram);
- membank(GALGAMES_BANK_200000_R)->configure_entry(GALGAMES_ROM0, ROM+0x000000);
-
- membank(GALGAMES_BANK_200000_W)->configure_entry(GALGAMES_RAM, m_galgames_ram);
-
- membank(GALGAMES_BANK_240000_R)->configure_entry(GALGAMES_ROM0, ROM+0x040000);
-
- // More ROM banks at 0x200000-0x3fffff (carts)
-
- for (cart = 1; cart <= 4; cart++)
- {
- uint8_t *CART = memregion("maincpu")->base();
-
- if (0x200000 * (cart+1) <= memregion("maincpu")->bytes())
- CART += 0x200000 * cart;
-
- membank(GALGAMES_BANK_200000_R)->configure_entry(GALGAMES_ROM0+cart, CART);
- membank(GALGAMES_BANK_240000_R)->configure_entry(GALGAMES_ROM0+cart, CART+0x040000);
- }
-}
-
-DRIVER_INIT_MEMBER(tmaster_state,galgame2)
-{
- uint16_t *ROM = (uint16_t *)memregion( "maincpu" )->base();
-
- // Patch BIOS to see the game code as first cartridge (until the PIC therein is emulated)
- ROM[0x118da/2] = 0x4a06;
- ROM[0x118dc/2] = 0x6704;
- ROM[0x118de/2] = 0x7000;
- ROM[0x118e0/2] = 0x6002;
- ROM[0x118e2/2] = 0x7001;
- ROM[0x118e4/2] = 0x4e71;
- ROM[0x118e6/2] = 0x4e71;
- ROM[0x118e8/2] = 0x4e71;
-
- // Cartdridge check on game selection screen
- ROM[0x12da0/2] = 0x4e71;
-
- DRIVER_INIT_CALL(galgames);
-}
-
GAME( 1996, tm, 0, tm, tm, driver_device, 0, ROT0, "Midway Games Inc. / CES Inc.", "Touchmaster (v3.00 Euro)", 0 )
GAME( 1996, tmdo, tm, tm, tm, driver_device, 0, ROT0, "Midway Games Inc. / CES Inc.", "Touchmaster (v2.2-01 Standard)", 0 )
GAME( 1996, tm2k, 0, tm, tm2k, driver_device, 0, ROT0, "Midway Games Inc.", "Touchmaster 2000 Plus (v4.63 Standard)", 0 )
@@ -1874,5 +1107,3 @@ GAME( 1999, tm7kmna, tm7k, tmds1204, tm4k, driver_device, 0, ROT
GAME( 1999, tm7keval, tm7k, tmds1204, tm4k, driver_device, 0, ROT0, "Midway Games Inc.", "Touchmaster 7000 (v8.1X Evaluation)", 0 )
GAME( 2000, tm8k, 0, tmds1204, tm4k, driver_device, 0, ROT0, "Midway Games Inc.", "Touchmaster 8000 (v9.04 Standard)", 0 )
GAME( 2000, tm8k902, tm8k, tmds1204, tm4k, driver_device, 0, ROT0, "Midway Games Inc.", "Touchmaster 8000 (v9.02 Standard)", 0 )
-GAME( 1998, galgbios, 0, galgames, galgames, tmaster_state, galgames, ROT0, "Creative Electronics & Software", "Galaxy Games (BIOS v1.90)", MACHINE_IS_BIOS_ROOT )
-GAME( 1998, galgame2, galgbios, galgame2, galgames, tmaster_state, galgame2, ROT0, "Creative Electronics & Software / Namco", "Galaxy Games StarPak 2", 0 )
diff --git a/src/mame/drivers/williams.cpp b/src/mame/drivers/williams.cpp
index fcefa160755..c08487a33b5 100644
--- a/src/mame/drivers/williams.cpp
+++ b/src/mame/drivers/williams.cpp
@@ -1864,6 +1864,24 @@ ROM_START( defenderw )
ROM_LOAD( "decoder.1", 0x0000, 0x0200, CRC(8dd98da5) SHA1(da979604f7a2aa8b5a6d4a5debd2e80f77569e35) )
ROM_END
+ROM_START( defenderj )
+ ROM_REGION( 0x19000, "maincpu", 0 )
+ ROM_LOAD( "DF1-1.E3", 0x0d000, 0x1000, CRC(8c04602b) SHA1(a8ed5afd0b276cebb479b1717666eaabbf75c6a5) ) //2532
+ ROM_LOAD( "DF2-1.E2", 0x0e000, 0x1000, BAD_DUMP CRC(b1018914) SHA1(f036f3ef21e8992a1e086024c95ce7950230069e) ) //2532
+ //ROM_LOAD( "defend.2", 0x0e000, 0x1000, CRC(89b75984) SHA1(a9481478da38f99efb67f0ecf82d084e14b93b42) ) // original defender ROM passes ROM test
+ ROM_LOAD( "DF3-1.E1", 0x0f000, 0x1000, CRC(94f51e9b) SHA1(a24cfc55de56a72758c76fe2a55f1ec6c353b16f) ) //2532
+ ROM_LOAD( "DF10-1.A1", 0x10000, 0x0800, CRC(12e2bd1c) SHA1(c2fdf2fced003a0acf037aa6fab141b04c1c81bd) ) //2716
+ ROM_LOAD( "DF7-1.B1", 0x10800, 0x0800, CRC(f1f88938) SHA1(26e48dfeefa0766837b1e762695b9532dbc8bc5e) ) //2716
+ ROM_LOAD( "DF9-1.A2", 0x11000, 0x0800, CRC(b649e306) SHA1(9d7bc3c89e5a53c575946f06702c722b864b1ff0) ) //2716
+ ROM_LOAD( "DF6-1.B2", 0x11800, 0x0800, CRC(9deaf6d9) SHA1(59b018ba0f3fe6eadfd387dc180ac281460358bc) ) //2716
+ ROM_LOAD( "DF8-1.A3", 0x12000, 0x0800, CRC(339e092e) SHA1(2f89951dbe55d80df43df8dcf497171f73e726d3) ) //2716
+ ROM_LOAD( "DF5-1.B3", 0x12800, 0x0800, CRC(a543b167) SHA1(9292b94b0d74e57e03aada4852ad1997c34122ff) ) //2716
+ ROM_LOAD( "DF4-1.C1", 0x16000, 0x0800, CRC(65f4efd1) SHA1(a960fd1559ed74b81deba434391e49fc6ec389ca) ) //2716
+
+ ROM_REGION( 0x10000, "soundcpu", 0 )
+ ROM_LOAD( "DF12.I3", 0xf800, 0x0800, CRC(f122d9c9) SHA1(70092fc354a2efbe7365be922fa36309b50d5c6f) ) //2716
+ROM_END
+
ROM_START( defndjeu )
ROM_REGION( 0x19000, "maincpu", 0 )
ROM_LOAD( "15", 0x0d000, 0x1000, CRC(706a24bd) SHA1(60cef3d4f7204eff42de2c08244863e83bc842b4) )
@@ -3159,6 +3177,7 @@ GAME( 1980, defender, 0, defender, defender, williams_state, defe
GAME( 1980, defenderg, defender, defender, defender, williams_state, defender, ROT0, "Williams", "Defender (Green label)", MACHINE_SUPPORTS_SAVE )
GAME( 1980, defenderb, defender, defender, defender, williams_state, defender, ROT0, "Williams", "Defender (Blue label)", MACHINE_SUPPORTS_SAVE )
GAME( 1980, defenderw, defender, defender, defender, williams_state, defender, ROT0, "Williams", "Defender (White label)", MACHINE_SUPPORTS_SAVE )
+GAME( 1980, defenderj, defender, defender, defender, williams_state, defender, ROT0, "Taito Corporation", "T.T. Defender", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // bad dump
GAME( 1980, defndjeu, defender, defender, defender, williams_state, defndjeu, ROT0, "bootleg (Jeutel)", "Defender (bootleg)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE )
GAME( 1980, tornado1, defender, defender, defender, williams_state, defndjeu, ROT0, "bootleg (Jeutel)", "Tornado (set 1, Defender bootleg)", MACHINE_SUPPORTS_SAVE )
GAME( 1980, tornado2, defender, defender, defender, williams_state, defndjeu, ROT0, "bootleg (Jeutel)", "Tornado (set 2, Defender bootleg)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // bad dump?
diff --git a/src/mame/drivers/witch.cpp b/src/mame/drivers/witch.cpp
index 080af26c1ce..6248da7343e 100644
--- a/src/mame/drivers/witch.cpp
+++ b/src/mame/drivers/witch.cpp
@@ -111,7 +111,6 @@ Sound
Mapped @0x8010-0x8016
Had to patch es8712.c to start playing on 0x8016 write and to prevent continuous looping.
There's a test on bit1 at offset 0 (0x8010), so this may be a "read status" kind of port.
- For now reading at 8010 always reports ready.
Ports
@@ -286,7 +285,6 @@ public:
DECLARE_WRITE8_MEMBER(write_a006);
DECLARE_WRITE8_MEMBER(write_a008);
DECLARE_READ8_MEMBER(prot_read_700x);
- DECLARE_READ8_MEMBER(read_8010);
DECLARE_WRITE8_MEMBER(xscroll_w);
DECLARE_WRITE8_MEMBER(yscroll_w);
DECLARE_DRIVER_INIT(witch);
@@ -460,12 +458,6 @@ READ8_MEMBER(witch_state::prot_read_700x)
return memregion("sub")->base()[0x7000+offset];
}
-/*
- * Status from ES8712?
- * BIT1 is zero when no sample is playing?
- */
-READ8_MEMBER(witch_state::read_8010){ return 0x00; }
-
WRITE8_MEMBER(witch_state::xscroll_w)
{
m_scrollx=data;
@@ -502,7 +494,7 @@ static ADDRESS_MAP_START( map_sub, AS_PROGRAM, 8, witch_state )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0x8001) AM_DEVREADWRITE("ym1", ym2203_device, read, write)
AM_RANGE(0x8008, 0x8009) AM_DEVREADWRITE("ym2", ym2203_device, read, write)
- AM_RANGE(0x8010, 0x8016) AM_READ(read_8010) AM_DEVWRITE("essnd", es8712_device, es8712_w)
+ AM_RANGE(0x8010, 0x8016) AM_DEVREADWRITE("essnd", es8712_device, read, write)
AM_RANGE(0xa000, 0xa003) AM_DEVREADWRITE("ppi1", i8255_device, read, write)
AM_RANGE(0xa004, 0xa007) AM_DEVREADWRITE("ppi2", i8255_device, read, write)
AM_RANGE(0xa008, 0xa008) AM_WRITE(write_a008)
diff --git a/src/mame/drivers/zx.cpp b/src/mame/drivers/zx.cpp
index cf2096e31b8..d78ec6d6a05 100644
--- a/src/mame/drivers/zx.cpp
+++ b/src/mame/drivers/zx.cpp
@@ -339,11 +339,15 @@ static MACHINE_CONFIG_START( zx80, zx_state )
MCFG_CASSETTE_ADD( "cassette" )
MCFG_CASSETTE_FORMATS(zx80_o_format)
MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED)
+ MCFG_CASSETTE_INTERFACE("zx80_cass")
+
+ /* software lists */
+ MCFG_SOFTWARE_LIST_ADD("cass_list", "zx80_cass")
/* internal ram */
MCFG_RAM_ADD(RAM_TAG)
MCFG_RAM_DEFAULT_SIZE("1K")
- MCFG_RAM_EXTRA_OPTIONS("16K,32K,48K")
+ MCFG_RAM_EXTRA_OPTIONS("1K,2K,3K,16K")
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( zx81, zx80 )
@@ -352,7 +356,16 @@ static MACHINE_CONFIG_DERIVED( zx81, zx80 )
MCFG_CPU_IO_MAP(zx81_io_map)
MCFG_CASSETTE_MODIFY( "cassette" )
- MCFG_CASSETTE_FORMATS(zx81_p_format)
+ MCFG_CASSETTE_FORMATS(zx81_cassette_formats)
+ MCFG_CASSETTE_INTERFACE("zx81_cass")
+
+ /* software lists */
+ MCFG_SOFTWARE_LIST_MODIFY("cass_list", "zx81_cass")
+
+ /* internal ram */
+ MCFG_RAM_MODIFY(RAM_TAG)
+ MCFG_RAM_DEFAULT_SIZE("1K")
+ MCFG_RAM_EXTRA_OPTIONS("16K,32K,48K")
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( zx81_spk, zx81 )
@@ -368,6 +381,10 @@ MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( ts1000, zx81 )
MCFG_PALETTE_MODIFY("palette")
MCFG_PALETTE_INIT_OWNER(zx_state, ts1000)
+
+ /* internal ram */
+ MCFG_RAM_MODIFY(RAM_TAG)
+ MCFG_RAM_DEFAULT_SIZE("2K")
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( ts1500, ts1000 )
@@ -473,6 +490,7 @@ ROM_END
/* Game Drivers */
+/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */
COMP( 1980, zx80, 0, 0, zx80, zx80, zx_state, zx, "Sinclair Research Ltd", "ZX-80", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW )
COMP( 1981, zx81, 0, 0, zx81, zx81, zx_state, zx, "Sinclair Research Ltd", "ZX-81", MACHINE_NO_SOUND_HW )
COMP( 1982, ts1000, zx81, 0, ts1000, zx81, zx_state, zx, "Timex Sinclair", "Timex Sinclair 1000", MACHINE_NO_SOUND_HW )
@@ -482,4 +500,4 @@ COMP( 1983, ringo470, zx81, 0, ts1000, zx81, zx_state, zx,
COMP( 1984, pc8300, zx81, 0, pc8300, pc8300, zx_state, zx, "Your Computer", "PC8300", MACHINE_NOT_WORKING )
COMP( 1983, pow3000, zx81, 0, pow3000, pow3000, zx_state, zx, "Creon Enterprises", "Power 3000", MACHINE_NOT_WORKING )
COMP( 1982, lambda, zx81, 0, pow3000, pow3000, zx_state, zx, "Lambda Electronics Ltd", "Lambda 8300", MACHINE_NOT_WORKING )
-COMP( 1997, zx97, zx81, 0, zx81, zx81, zx_state, zx, "Wilf Rigter", "ZX97", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW | MACHINE_UNOFFICIAL )
+COMP( 1997, zx97, zx81, 0, zx81, zx81, zx_state, zx, "Wilf Rigter", "ZX97", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW | MACHINE_UNOFFICIAL )
diff --git a/src/mame/includes/aerofgt.h b/src/mame/includes/aerofgt.h
index 7404cd3d689..621de27e2ad 100644
--- a/src/mame/includes/aerofgt.h
+++ b/src/mame/includes/aerofgt.h
@@ -29,7 +29,9 @@ public:
m_spr(*this, "vsystem_spr"),
m_spr_old(*this, "vsystem_spr_old"),
m_spr_old2(*this, "vsystem_spr_ol2"),
- m_soundlatch(*this, "soundlatch") { }
+ m_soundlatch(*this, "soundlatch"),
+ m_soundbank(*this, "soundbank"),
+ m_okibank(*this, "okibank") { }
/* memory pointers */
required_shared_ptr<uint16_t> m_bg1videoram;
@@ -53,7 +55,8 @@ public:
optional_device<vsystem_spr2_device> m_spr_old2; // or a pair of them..
optional_device<generic_latch_8_device> m_soundlatch;
-
+ optional_memory_bank m_soundbank;
+ optional_memory_bank m_okibank;
/* video-related */
tilemap_t *m_bg1_tilemap;
diff --git a/src/mame/includes/apple2.h b/src/mame/includes/apple2.h
index 7b51d874c48..0596bd91af2 100644
--- a/src/mame/includes/apple2.h
+++ b/src/mame/includes/apple2.h
@@ -286,6 +286,7 @@ public:
void apple2_refresh_delegates();
int apple2_pressed_specialkey(uint8_t key);
+ void langcard_touch(offs_t offset);
read8_delegate read_delegates_master[4];
write8_delegate write_delegates_master[3];
diff --git a/src/mame/includes/banctec.h b/src/mame/includes/banctec.h
deleted file mode 100644
index 69817f04c45..00000000000
--- a/src/mame/includes/banctec.h
+++ /dev/null
@@ -1,36 +0,0 @@
-// license:GPL-2.0+
-// copyright-holders:Felipe Sanches
-/*****************************************************************************
- *
- * includes/banctec.h
- *
- ****************************************************************************/
-
-#ifndef BANCTEC_H_
-#define BANCTEC_H_
-
-#include "video/mc6845.h"
-
-class banctec_state : public driver_device
-{
-public:
- banctec_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
- m_maincpu(*this, "maincpu"),
- m_gfxdecode(*this, "gfxdecode"),
- m_videoram(*this, "videoram") { }
-
- TILE_GET_INFO_MEMBER(get_bg_tile_info);
- MC6845_ON_UPDATE_ADDR_CHANGED(crtc_addr);
- virtual void machine_reset() override;
- virtual void video_start() override;
- uint32_t screen_update_banctec(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
-
- required_device<cpu_device> m_maincpu;
- required_device<gfxdecode_device> m_gfxdecode;
- required_shared_ptr<uint8_t> m_videoram;
-
- tilemap_t *m_bg_tilemap;
-};
-
-#endif /* BANCTEC_H_ */
diff --git a/src/mame/includes/battlex.h b/src/mame/includes/battlex.h
index 32bab998242..8689662c29e 100644
--- a/src/mame/includes/battlex.h
+++ b/src/mame/includes/battlex.h
@@ -46,4 +46,7 @@ public:
required_device<cpu_device> m_maincpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
+
+ DECLARE_VIDEO_START(dodgeman);
+ TILE_GET_INFO_MEMBER(get_dodgeman_bg_tile_info);
};
diff --git a/src/mame/includes/coco.h b/src/mame/includes/coco.h
index ccc7018b0aa..8853b3155eb 100644
--- a/src/mame/includes/coco.h
+++ b/src/mame/includes/coco.h
@@ -32,7 +32,6 @@
//**************************************************************************
INPUT_PORTS_EXTERN( coco_analog_control );
-INPUT_PORTS_EXTERN( coco_cart_autostart );
INPUT_PORTS_EXTERN( coco_rtc );
INPUT_PORTS_EXTERN( coco_beckerport );
@@ -58,7 +57,6 @@ SLOT_INTERFACE_EXTERN( coco_cart );
// inputs
#define CTRL_SEL_TAG "ctrl_sel"
#define HIRES_INTF_TAG "hires_intf"
-#define CART_AUTOSTART_TAG "cart_autostart"
#define BECKERPORT_TAG "beckerport"
#define JOYSTICK_RX_TAG "joystick_rx"
#define JOYSTICK_RY_TAG "joystick_ry"
diff --git a/src/mame/includes/decocass.h b/src/mame/includes/decocass.h
index 9f8beb4163b..a4f15a59a7e 100644
--- a/src/mame/includes/decocass.h
+++ b/src/mame/includes/decocass.h
@@ -184,6 +184,7 @@ public:
DECLARE_MACHINE_RESET(cflyball);
DECLARE_MACHINE_RESET(cmanhat);
DECLARE_MACHINE_RESET(cocean1a); /* 10 */
+ DECLARE_MACHINE_RESET(cfboy0a1); /* 12 */
uint32_t screen_update_decocass(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE8_MEMBER(decocass_coin_counter_w);
DECLARE_WRITE8_MEMBER(decocass_sound_command_w);
diff --git a/src/mame/includes/gcpinbal.h b/src/mame/includes/gcpinbal.h
index fc3e0d2b08a..c9f97ef746f 100644
--- a/src/mame/includes/gcpinbal.h
+++ b/src/mame/includes/gcpinbal.h
@@ -2,6 +2,7 @@
// copyright-holders:David Graves, R. Belmont
#include "machine/74157.h"
+#include "machine/eepromser.h"
#include "sound/okim6295.h"
#include "sound/msm5205.h"
#include "video/excellent_spr.h"
@@ -11,18 +12,19 @@ class gcpinbal_state : public driver_device
public:
enum
{
- TIMER_GCPINBAL_INTERRUPT1,
- TIMER_GCPINBAL_INTERRUPT3
+ TIMER_GCPINBAL_INTERRUPT1
};
gcpinbal_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
+ m_eeprom(*this, "eeprom"),
m_oki(*this, "oki"),
m_msm(*this, "msm"),
m_adpcm_select(*this, "adpcm_select"),
m_tilemapram(*this, "tilemapram"),
- m_ioc_ram(*this, "ioc_ram"),
+ m_d80010_ram(*this, "d80010"),
+ m_d80060_ram(*this, "d80060"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
m_sprgen(*this, "spritegen")
@@ -30,13 +32,15 @@ public:
/* devices */
required_device<cpu_device> m_maincpu;
+ required_device<eeprom_serial_93cxx_device> m_eeprom;
required_device<okim6295_device> m_oki;
required_device<msm6585_device> m_msm;
required_device<hct157_device> m_adpcm_select;
/* memory pointers */
required_shared_ptr<uint16_t> m_tilemapram;
- required_shared_ptr<uint16_t> m_ioc_ram;
+ required_shared_ptr<uint16_t> m_d80010_ram;
+ required_shared_ptr<uint16_t> m_d80060_ram;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
@@ -59,10 +63,14 @@ public:
uint32_t m_adpcm_end;
uint32_t m_adpcm_idle;
uint8_t m_adpcm_trigger;
- uint8_t m_adpcm_data;
- DECLARE_READ16_MEMBER(ioc_r);
- DECLARE_WRITE16_MEMBER(ioc_w);
+ DECLARE_WRITE16_MEMBER(d80010_w);
+ DECLARE_WRITE8_MEMBER(d80040_w);
+ DECLARE_WRITE16_MEMBER(d80060_w);
+ DECLARE_WRITE8_MEMBER(bank_w);
+ DECLARE_WRITE8_MEMBER(eeprom_w);
+ DECLARE_WRITE8_MEMBER(es8712_ack_w);
+ DECLARE_WRITE8_MEMBER(es8712_w);
DECLARE_READ16_MEMBER(gcpinbal_tilemaps_word_r);
DECLARE_WRITE16_MEMBER(gcpinbal_tilemaps_word_w);
TILE_GET_INFO_MEMBER(get_bg0_tile_info);
diff --git a/src/mame/includes/hng64.h b/src/mame/includes/hng64.h
index 5a914d5e5c7..212445d9035 100644
--- a/src/mame/includes/hng64.h
+++ b/src/mame/includes/hng64.h
@@ -5,6 +5,7 @@
#include "cpu/nec/v53.h"
#include "sound/l7a1045_l6028_dsp_a.h"
#include "video/poly.h"
+#include "cpu/tlcs870/tlcs870.h"
enum
{
diff --git a/src/mame/includes/intv.h b/src/mame/includes/intv.h
index 0b5b9ffdbcd..b5f0c2a335a 100644
--- a/src/mame/includes/intv.h
+++ b/src/mame/includes/intv.h
@@ -38,6 +38,7 @@ public:
m_maincpu(*this, "maincpu"),
m_sound(*this, "ay8914"),
m_stic(*this, "stic"),
+ m_crtc(*this, "crtc"),
m_cart(*this, "cartslot"),
m_intvkbd_dualport_ram(*this, "dualport_ram"),
m_videoram(*this, "videoram"),
@@ -54,6 +55,7 @@ public:
required_device<cpu_device> m_maincpu;
required_device<ay8914_device> m_sound;
required_device<stic_device> m_stic;
+ optional_device<tms9927_device> m_crtc;
optional_device<intv_cart_slot_device> m_cart;
optional_shared_ptr<uint16_t> m_intvkbd_dualport_ram;
optional_shared_ptr<uint8_t> m_videoram;
@@ -78,25 +80,26 @@ public:
uint8_t m_ram8[256];
// Keyboard Component
- DECLARE_READ8_MEMBER(intvkbd_tms9927_r);
- DECLARE_WRITE8_MEMBER(intvkbd_tms9927_w);
DECLARE_WRITE16_MEMBER(intvkbd_dualport16_w);
DECLARE_READ8_MEMBER(intvkbd_dualport8_lsb_r);
DECLARE_WRITE8_MEMBER(intvkbd_dualport8_lsb_w);
DECLARE_READ8_MEMBER(intvkbd_dualport8_msb_r);
DECLARE_WRITE8_MEMBER(intvkbd_dualport8_msb_w);
+ DECLARE_READ8_MEMBER(intvkbd_io_r);
+ DECLARE_WRITE8_MEMBER(intvkbd_io_w);
+ DECLARE_READ8_MEMBER(intvkbd_periph_r);
+ DECLARE_WRITE8_MEMBER(intvkbd_periph_w);
- uint8_t m_tms9927_num_rows;
- uint8_t m_tms9927_cursor_col;
- uint8_t m_tms9927_cursor_row;
- uint8_t m_tms9927_last_row;
+ bool m_printer_not_busy; // printer state
+ bool m_printer_no_paper; // printer state
+ bool m_printer_not_busy_enable; // printer interface state
int m_intvkbd_text_blanked;
int m_intvkbd_keyboard_col;
int m_tape_int_pending;
int m_tape_interrupts_enabled;
- int m_tape_unknown_write[6];
int m_tape_motor_mode;
+
DECLARE_DRIVER_INIT(intvecs);
DECLARE_DRIVER_INIT(intvkbd);
DECLARE_DRIVER_INIT(intv);
diff --git a/src/mame/includes/metro.h b/src/mame/includes/metro.h
index 0cf865a564b..b0c7b45d78f 100644
--- a/src/mame/includes/metro.h
+++ b/src/mame/includes/metro.h
@@ -168,7 +168,7 @@ public:
// vmetal
DECLARE_WRITE8_MEMBER(vmetal_control_w);
- DECLARE_WRITE8_MEMBER(vmetal_es8712_w);
+ DECLARE_WRITE8_MEMBER(vmetal_se_control_w);
DECLARE_DRIVER_INIT(karatour);
DECLARE_DRIVER_INIT(daitorid);
diff --git a/src/mame/includes/osborne1.h b/src/mame/includes/osborne1.h
index 56754a43e82..ae6cb2e010d 100644
--- a/src/mame/includes/osborne1.h
+++ b/src/mame/includes/osborne1.h
@@ -9,15 +9,20 @@
#ifndef OSBORNE1_H_
#define OSBORNE1_H_
-#include "emu.h"
#include "cpu/z80/z80.h"
+
#include "sound/speaker.h"
+
#include "bus/ieee488/ieee488.h"
+
#include "machine/6821pia.h"
#include "machine/6850acia.h"
#include "machine/ram.h"
#include "machine/wd_fdc.h"
+#include "video/mc6845.h"
+
+
class osborne1_state : public driver_device
{
public:
@@ -54,11 +59,12 @@ public:
m_bank_0xxx(*this, "bank_0xxx"),
m_bank_1xxx(*this, "bank_1xxx"),
m_bank_fxxx(*this, "bank_fxxx"),
+ m_p_chargen(*this, "chargen"),
m_video_timer(nullptr),
- m_p_chargen(nullptr),
m_tilemap(nullptr),
m_acia_rxc_txc_timer(nullptr)
- { }
+ {
+ }
DECLARE_WRITE8_MEMBER(bank_0xxx_w);
@@ -86,7 +92,7 @@ public:
DECLARE_DRIVER_INIT(osborne1);
virtual void machine_reset() override;
virtual void video_start() override;
- uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
required_device<cpu_device> m_maincpu;
required_device<gfxdecode_device> m_gfxdecode;
@@ -106,8 +112,8 @@ protected:
TILE_GET_INFO_MEMBER(get_tile_info);
- bool set_rom_mode(uint8_t value);
- bool set_bit_9(uint8_t value);
+ bool set_rom_mode(u8 value);
+ bool set_bit_9(u8 value);
void update_irq();
void update_acia_rxc_txc();
@@ -130,36 +136,55 @@ protected:
required_memory_bank m_bank_0xxx;
required_memory_bank m_bank_1xxx;
required_memory_bank m_bank_fxxx;
+ required_region_ptr<u8> m_p_chargen;
// configuration (reloaded on reset)
- uint8_t m_screen_pac;
- uint8_t m_acia_rxc_txc_div;
- uint8_t m_acia_rxc_txc_p_low;
- uint8_t m_acia_rxc_txc_p_high;
+ u8 m_screen_pac;
+ u8 m_acia_rxc_txc_div;
+ u8 m_acia_rxc_txc_p_low;
+ u8 m_acia_rxc_txc_p_high;
// bank switch control bits
- uint8_t m_ub4a_q;
- uint8_t m_ub6a_q;
- uint8_t m_rom_mode;
- uint8_t m_bit_9;
+ u8 m_ub4a_q;
+ u8 m_ub6a_q;
+ u8 m_rom_mode;
+ u8 m_bit_9;
// onboard video state
- uint8_t m_scroll_x;
- uint8_t m_scroll_y;
- uint8_t m_beep_state;
+ u8 m_scroll_x;
+ u8 m_scroll_y;
+ u8 m_beep_state;
emu_timer *m_video_timer;
bitmap_ind16 m_bitmap;
- uint8_t *m_p_chargen;
tilemap_t *m_tilemap;
// SCREEN-PAC registers
- uint8_t m_resolution;
- uint8_t m_hc_left;
+ u8 m_resolution;
+ u8 m_hc_left;
// serial state
- uint8_t m_acia_irq_state;
- uint8_t m_acia_rxc_txc_state;
+ u8 m_acia_irq_state;
+ u8 m_acia_rxc_txc_state;
emu_timer *m_acia_rxc_txc_timer;
};
+
+class osborne1nv_state : public osborne1_state
+{
+public:
+ osborne1nv_state(const machine_config &mconfig, device_type type, const char *tag) :
+ osborne1_state(mconfig, type, tag),
+ m_palette(*this, "palette"),
+ m_p_nuevo(*this, "nuevo")
+ {
+ }
+
+ MC6845_UPDATE_ROW(crtc_update_row);
+ MC6845_ON_UPDATE_ADDR_CHANGED(crtc_update_addr_changed);
+
+protected:
+ required_device<palette_device> m_palette;
+ required_region_ptr<u8> m_p_nuevo;
+};
+
#endif /* OSBORNE1_H_ */
diff --git a/src/mame/includes/polepos.h b/src/mame/includes/polepos.h
index cdfd6b4b704..c6c4f0dc5e3 100644
--- a/src/mame/includes/polepos.h
+++ b/src/mame/includes/polepos.h
@@ -106,8 +106,6 @@ public:
DECLARE_WRITE16_MEMBER(polepos_alpha16_w);
DECLARE_READ8_MEMBER(polepos_alpha_r);
DECLARE_WRITE8_MEMBER(polepos_alpha_w);
- DECLARE_CUSTOM_INPUT_MEMBER(high_port_r);
- DECLARE_CUSTOM_INPUT_MEMBER(low_port_r);
DECLARE_CUSTOM_INPUT_MEMBER(auto_start_r);
DECLARE_WRITE8_MEMBER(out_0);
DECLARE_WRITE8_MEMBER(out_1);
diff --git a/src/mame/includes/zx.h b/src/mame/includes/zx.h
index d8717e0371c..b695f82f9ab 100644
--- a/src/mame/includes/zx.h
+++ b/src/mame/includes/zx.h
@@ -15,6 +15,7 @@
#include "sound/wave.h"
#include "imagedev/cassette.h"
#include "formats/zx81_p.h"
+#include "formats/tzx_cas.h"
#include "machine/ram.h"
diff --git a/src/mame/layout/polepos.lay b/src/mame/layout/polepos.lay
index 50634fadfd5..91c82ed096b 100644
--- a/src/mame/layout/polepos.lay
+++ b/src/mame/layout/polepos.lay
@@ -52,7 +52,7 @@
<screen index="0">
<bounds x="0" y="0" width="640" height="480" />
</screen>
- <bezel element="shifter" inputtag="IN0L" inputmask="0x02">
+ <bezel element="shifter" inputtag="IN0" inputmask="0x02">
<bounds x="606" y="414" width="32" height="64" />
<color alpha="0.6" />
</bezel>
@@ -61,7 +61,7 @@
<screen index="0">
<bounds x="0" y="0" width="640" height="480" />
</screen>
- <bezel element="shifter" inputtag="IN0L" inputmask="0x02">
+ <bezel element="shifter" inputtag="IN0" inputmask="0x02">
<bounds x="2" y="414" width="32" height="64" />
<color alpha="0.6" />
</bezel>
diff --git a/src/mame/layout/whousetc.lay b/src/mame/layout/whousetc.lay
new file mode 100644
index 00000000000..25f01d2421d
--- /dev/null
+++ b/src/mame/layout/whousetc.lay
@@ -0,0 +1,801 @@
+<?xml version="1.0"?>
+<!--
+license:BSD-3-Clause
+copyright-holders:Vas Crabb
+Westinghouse Test Console Serial #5 layout
+-->
+<mamelayout version="2">
+
+ <element name="char" defstate="0">
+ <led16seg>
+ <color red="1.0" green="0.0" blue="0.0" />
+ </led16seg>
+ </element>
+
+ <element name="btn00">
+ <rect>
+ <bounds left="0" top="0" right="1" bottom="1" />
+ <color red="1.0" green="1.0" blue="1.0" />
+ </rect>
+ <rect>
+ <bounds left="0.05" top="0.05" right="0.95" bottom="0.95" />
+ <color red="0.9" green="0.9" blue="0.9" />
+ </rect>
+ <text string="MODE">
+ <bounds left="0.1" top="0.35" right="0.9" bottom="0.65" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ </element>
+
+ <element name="btn01">
+ <rect>
+ <bounds left="0" top="0" right="1" bottom="1" />
+ <color red="1.0" green="1.0" blue="1.0" />
+ </rect>
+ <rect>
+ <bounds left="0.05" top="0.05" right="0.95" bottom="0.5" />
+ <color red="1.0" green="1.0" blue="0.3" />
+ </rect>
+ <rect>
+ <bounds left="0.05" top="0.5" right="0.95" bottom="0.95" />
+ <color red="0.4" green="1.0" blue="1.0" />
+ </rect>
+ <text string="TRAP">
+ <bounds left="0.1" top="0.125" right="0.9" bottom="0.425" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ <text string="HEX">
+ <bounds left="0.1" top="0.575" right="0.9" bottom="0.875" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ </element>
+
+ <element name="btn02">
+ <rect>
+ <bounds left="0" top="0" right="1" bottom="1" />
+ <color red="1.0" green="1.0" blue="1.0" />
+ </rect>
+ <rect>
+ <bounds left="0.05" top="0.05" right="0.95" bottom="0.5" />
+ <color red="1.0" green="1.0" blue="0.3" />
+ </rect>
+ <rect>
+ <bounds left="0.05" top="0.5" right="0.95" bottom="0.95" />
+ <color red="0.4" green="1.0" blue="1.0" />
+ </rect>
+ <text string="ARM">
+ <bounds left="0.1" top="0.125" right="0.9" bottom="0.425" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ <text string="DEC">
+ <bounds left="0.1" top="0.575" right="0.9" bottom="0.875" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ </element>
+
+ <element name="btn03">
+ <rect>
+ <bounds left="0" top="0" right="1" bottom="1" />
+ <color red="1.0" green="1.0" blue="1.0" />
+ </rect>
+ <rect>
+ <bounds left="0.05" top="0.05" right="0.95" bottom="0.5" />
+ <color red="1.0" green="1.0" blue="0.3" />
+ </rect>
+ <rect>
+ <bounds left="0.05" top="0.5" right="0.95" bottom="0.95" />
+ <color red="0.4" green="1.0" blue="1.0" />
+ </rect>
+ <text string="RESET">
+ <bounds left="0.1" top="0.125" right="0.9" bottom="0.425" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ <text string="CLR">
+ <bounds left="0.1" top="0.575" right="0.9" bottom="0.875" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ </element>
+
+ <element name="btn10">
+ <rect>
+ <bounds left="0" top="0" right="1" bottom="1" />
+ <color red="1.0" green="1.0" blue="1.0" />
+ </rect>
+ <rect>
+ <bounds left="0.05" top="0.05" right="0.95" bottom="0.5" />
+ <color red="1.0" green="1.0" blue="0.3" />
+ </rect>
+ <rect>
+ <bounds left="0.05" top="0.5" right="0.95" bottom="0.95" />
+ <color red="0.4" green="1.0" blue="1.0" />
+ </rect>
+ <text string="MNE">
+ <bounds left="0.1" top="0.125" right="0.9" bottom="0.425" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ <text string="+">
+ <bounds left="0.1" top="0.575" right="0.9" bottom="0.875" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ </element>
+
+ <element name="btn11">
+ <rect>
+ <bounds left="0" top="0" right="1" bottom="1" />
+ <color red="1.0" green="1.0" blue="1.0" />
+ </rect>
+ <rect>
+ <bounds left="0.05" top="0.05" right="0.95" bottom="0.5" />
+ <color red="1.0" green="1.0" blue="0.3" />
+ </rect>
+ <rect>
+ <bounds left="0.05" top="0.5" right="0.95" bottom="0.95" />
+ <color red="0.4" green="1.0" blue="1.0" />
+ </rect>
+ <text string="HARD">
+ <bounds left="0.1" top="0.125" right="0.9" bottom="0.425" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ <text string="−">
+ <bounds left="0.1" top="0.575" right="0.9" bottom="0.875" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ </element>
+
+ <element name="btn12">
+ <rect>
+ <bounds left="0" top="0" right="1" bottom="1" />
+ <color red="1.0" green="1.0" blue="1.0" />
+ </rect>
+ <rect>
+ <bounds left="0.05" top="0.05" right="0.95" bottom="0.5" />
+ <color red="1.0" green="1.0" blue="0.3" />
+ </rect>
+ <rect>
+ <bounds left="0.05" top="0.5" right="0.95" bottom="0.95" />
+ <color red="0.4" green="1.0" blue="1.0" />
+ </rect>
+ <text string="TRACE">
+ <bounds left="0.1" top="0.125" right="0.9" bottom="0.425" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ <text string="×">
+ <bounds left="0.1" top="0.575" right="0.9" bottom="0.875" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ </element>
+
+ <element name="btn13">
+ <rect>
+ <bounds left="0" top="0" right="1" bottom="1" />
+ <color red="1.0" green="1.0" blue="1.0" />
+ </rect>
+ <rect>
+ <bounds left="0.05" top="0.05" right="0.95" bottom="0.5" />
+ <color red="1.0" green="1.0" blue="0.3" />
+ </rect>
+ <rect>
+ <bounds left="0.05" top="0.5" right="0.95" bottom="0.95" />
+ <color red="0.4" green="1.0" blue="1.0" />
+ </rect>
+ <text string="REL">
+ <bounds left="0.1" top="0.125" right="0.9" bottom="0.425" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ <text string="÷">
+ <bounds left="0.1" top="0.575" right="0.9" bottom="0.875" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ </element>
+
+ <element name="btn20">
+ <rect>
+ <bounds left="0" top="0" right="1" bottom="1" />
+ <color red="1.0" green="1.0" blue="1.0" />
+ </rect>
+ <rect>
+ <bounds left="0.05" top="0.05" right="0.95" bottom="0.5" />
+ <color red="1.0" green="1.0" blue="0.3" />
+ </rect>
+ <rect>
+ <bounds left="0.05" top="0.5" right="0.95" bottom="0.95" />
+ <color red="1.0" green="0.8" blue="0.7" />
+ </rect>
+ <text string="REC">
+ <bounds left="0.1" top="0.125" right="0.9" bottom="0.425" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ <text string="BCC">
+ <bounds left="0.1" top="0.575" right="0.9" bottom="0.875" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ </element>
+
+ <element name="btn21">
+ <rect>
+ <bounds left="0" top="0" right="1" bottom="1" />
+ <color red="1.0" green="1.0" blue="1.0" />
+ </rect>
+ <rect>
+ <bounds left="0.05" top="0.05" right="0.95" bottom="0.5" />
+ <color red="1.0" green="1.0" blue="0.3" />
+ </rect>
+ <rect>
+ <bounds left="0.05" top="0.5" right="0.95" bottom="0.95" />
+ <color red="1.0" green="0.8" blue="0.7" />
+ </rect>
+ <text string="SOFT">
+ <bounds left="0.1" top="0.125" right="0.9" bottom="0.425" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ <text string="LIST">
+ <bounds left="0.1" top="0.575" right="0.9" bottom="0.875" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ </element>
+
+ <element name="btn22">
+ <rect>
+ <bounds left="0" top="0" right="1" bottom="1" />
+ <color red="1.0" green="1.0" blue="1.0" />
+ </rect>
+ <rect>
+ <bounds left="0.05" top="0.05" right="0.95" bottom="0.5" />
+ <color red="1.0" green="1.0" blue="0.3" />
+ </rect>
+ <rect>
+ <bounds left="0.05" top="0.5" right="0.95" bottom="0.95" />
+ <color red="1.0" green="0.8" blue="0.7" />
+ </rect>
+ <text string="DISP">
+ <bounds left="0.1" top="0.125" right="0.9" bottom="0.425" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ <text string="VER">
+ <bounds left="0.1" top="0.575" right="0.9" bottom="0.875" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ </element>
+
+ <element name="btn23">
+ <rect>
+ <bounds left="0" top="0" right="1" bottom="1" />
+ <color red="1.0" green="1.0" blue="1.0" />
+ </rect>
+ <rect>
+ <bounds left="0.05" top="0.05" right="0.95" bottom="0.5" />
+ <color red="1.0" green="1.0" blue="0.3" />
+ </rect>
+ <rect>
+ <bounds left="0.05" top="0.5" right="0.95" bottom="0.95" />
+ <color red="1.0" green="0.8" blue="0.7" />
+ </rect>
+ <text string="STEP">
+ <bounds left="0.1" top="0.125" right="0.9" bottom="0.425" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ <text string="PROG">
+ <bounds left="0.1" top="0.575" right="0.9" bottom="0.875" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ </element>
+
+ <element name="btn30">
+ <rect>
+ <bounds left="0" top="0" right="1" bottom="1" />
+ <color red="1.0" green="1.0" blue="1.0" />
+ </rect>
+ <rect>
+ <bounds left="0.05" top="0.05" right="0.95" bottom="0.95" />
+ <color red="0.9" green="0.9" blue="0.9" />
+ </rect>
+ <text string="←">
+ <bounds left="0.1" top="0.125" right="0.9" bottom="0.425" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ <text string="↑">
+ <bounds left="0.1" top="0.575" right="0.9" bottom="0.875" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ </element>
+
+ <element name="btn31">
+ <rect>
+ <bounds left="0" top="0" right="1" bottom="1" />
+ <color red="1.0" green="1.0" blue="1.0" />
+ </rect>
+ <rect>
+ <bounds left="0.05" top="0.05" right="0.95" bottom="0.95" />
+ <color red="0.9" green="0.9" blue="0.9" />
+ </rect>
+ <text string="→">
+ <bounds left="0.1" top="0.125" right="0.9" bottom="0.425" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ <text string="↓">
+ <bounds left="0.1" top="0.575" right="0.9" bottom="0.875" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ </element>
+
+ <element name="btn32">
+ <rect>
+ <bounds left="0" top="0" right="1" bottom="1" />
+ <color red="1.0" green="1.0" blue="1.0" />
+ </rect>
+ <rect>
+ <bounds left="0.05" top="0.05" right="0.95" bottom="0.5" />
+ <color red="1.0" green="1.0" blue="0.3" />
+ </rect>
+ <rect>
+ <bounds left="0.05" top="0.5" right="0.95" bottom="0.95" />
+ <color red="1.0" green="0.8" blue="0.7" />
+ </rect>
+ <text string="X">
+ <bounds left="0.1" top="0.125" right="0.9" bottom="0.425" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ <text string="TRAN">
+ <bounds left="0.1" top="0.575" right="0.9" bottom="0.875" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ </element>
+
+ <element name="btn33">
+ <rect>
+ <bounds left="0" top="0" right="1" bottom="1" />
+ <color red="1.0" green="1.0" blue="1.0" />
+ </rect>
+ <rect>
+ <bounds left="0.05" top="0.05" right="0.95" bottom="0.95" />
+ <color red="0.9" green="0.9" blue="0.9" />
+ </rect>
+ <text string="ENTER">
+ <bounds left="0.1" top="0.35" right="0.9" bottom="0.65" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ </element>
+
+ <element name="btn04">
+ <rect>
+ <bounds left="0" top="0" right="1" bottom="1" />
+ <color red="1.0" green="1.0" blue="1.0" />
+ </rect>
+ <rect>
+ <bounds left="0.05" top="0.05" right="0.95" bottom="0.95" />
+ <color red="0.9" green="0.9" blue="0.9" />
+ </rect>
+ <text string="C">
+ <bounds left="0.0" top="0.2" right="0.8" bottom="1.0" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ <text string="MW">
+ <bounds left="0.5" top="0.0" right="1.0" bottom="0.25" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ </element>
+
+ <element name="btn05">
+ <rect>
+ <bounds left="0" top="0" right="1" bottom="1" />
+ <color red="1.0" green="1.0" blue="1.0" />
+ </rect>
+ <rect>
+ <bounds left="0.05" top="0.05" right="0.95" bottom="0.95" />
+ <color red="0.9" green="0.9" blue="0.9" />
+ </rect>
+ <text string="D">
+ <bounds left="0.0" top="0.2" right="0.8" bottom="1.0" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ <text string="IW">
+ <bounds left="0.5" top="0.0" right="1.0" bottom="0.25" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ </element>
+
+ <element name="btn06">
+ <rect>
+ <bounds left="0" top="0" right="1" bottom="1" />
+ <color red="1.0" green="1.0" blue="1.0" />
+ </rect>
+ <rect>
+ <bounds left="0.05" top="0.05" right="0.95" bottom="0.95" />
+ <color red="0.9" green="0.9" blue="0.9" />
+ </rect>
+ <text string="E">
+ <bounds left="0.0" top="0.2" right="0.8" bottom="1.0" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ <text string="OF">
+ <bounds left="0.5" top="0.0" right="1.0" bottom="0.25" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ </element>
+
+ <element name="btn07">
+ <rect>
+ <bounds left="0" top="0" right="1" bottom="1" />
+ <color red="1.0" green="1.0" blue="1.0" />
+ </rect>
+ <rect>
+ <bounds left="0.05" top="0.05" right="0.95" bottom="0.95" />
+ <color red="0.9" green="0.9" blue="0.9" />
+ </rect>
+ <text string="F">
+ <bounds left="0.0" top="0.2" right="0.8" bottom="1.0" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ <text string="IA">
+ <bounds left="0.5" top="0.0" right="1.0" bottom="0.25" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ </element>
+
+ <element name="btn14">
+ <rect>
+ <bounds left="0" top="0" right="1" bottom="1" />
+ <color red="1.0" green="1.0" blue="1.0" />
+ </rect>
+ <rect>
+ <bounds left="0.05" top="0.05" right="0.95" bottom="0.95" />
+ <color red="0.9" green="0.9" blue="0.9" />
+ </rect>
+ <text string="8">
+ <bounds left="0.0" top="0.2" right="0.8" bottom="1.0" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ <text string="XX">
+ <bounds left="0.5" top="0.0" right="1.0" bottom="0.25" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ </element>
+
+ <element name="btn15">
+ <rect>
+ <bounds left="0" top="0" right="1" bottom="1" />
+ <color red="1.0" green="1.0" blue="1.0" />
+ </rect>
+ <rect>
+ <bounds left="0.05" top="0.05" right="0.95" bottom="0.95" />
+ <color red="0.9" green="0.9" blue="0.9" />
+ </rect>
+ <text string="9">
+ <bounds left="0.0" top="0.2" right="0.8" bottom="1.0" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ <text string="HT">
+ <bounds left="0.5" top="0.0" right="1.0" bottom="0.25" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ </element>
+
+ <element name="btn16">
+ <rect>
+ <bounds left="0" top="0" right="1" bottom="1" />
+ <color red="1.0" green="1.0" blue="1.0" />
+ </rect>
+ <rect>
+ <bounds left="0.05" top="0.05" right="0.95" bottom="0.95" />
+ <color red="0.9" green="0.9" blue="0.9" />
+ </rect>
+ <text string="A">
+ <bounds left="0.0" top="0.2" right="0.8" bottom="1.0" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ <text string="MR">
+ <bounds left="0.5" top="0.0" right="1.0" bottom="0.25" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ </element>
+
+ <element name="btn17">
+ <rect>
+ <bounds left="0" top="0" right="1" bottom="1" />
+ <color red="1.0" green="1.0" blue="1.0" />
+ </rect>
+ <rect>
+ <bounds left="0.05" top="0.05" right="0.95" bottom="0.95" />
+ <color red="0.9" green="0.9" blue="0.9" />
+ </rect>
+ <text string="B">
+ <bounds left="0.0" top="0.2" right="0.8" bottom="1.0" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ <text string="IR">
+ <bounds left="0.5" top="0.0" right="1.0" bottom="0.25" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ </element>
+
+ <element name="btn24">
+ <rect>
+ <bounds left="0" top="0" right="1" bottom="1" />
+ <color red="1.0" green="1.0" blue="1.0" />
+ </rect>
+ <rect>
+ <bounds left="0.05" top="0.05" right="0.95" bottom="0.95" />
+ <color red="0.9" green="0.9" blue="0.9" />
+ </rect>
+ <text string="4">
+ <bounds left="0.1" top="0.1" right="0.9" bottom="0.9" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ </element>
+
+ <element name="btn25">
+ <rect>
+ <bounds left="0" top="0" right="1" bottom="1" />
+ <color red="1.0" green="1.0" blue="1.0" />
+ </rect>
+ <rect>
+ <bounds left="0.05" top="0.05" right="0.95" bottom="0.95" />
+ <color red="0.9" green="0.9" blue="0.9" />
+ </rect>
+ <text string="5">
+ <bounds left="0.1" top="0.1" right="0.9" bottom="0.9" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ </element>
+
+ <element name="btn26">
+ <rect>
+ <bounds left="0" top="0" right="1" bottom="1" />
+ <color red="1.0" green="1.0" blue="1.0" />
+ </rect>
+ <rect>
+ <bounds left="0.05" top="0.05" right="0.95" bottom="0.95" />
+ <color red="0.9" green="0.9" blue="0.9" />
+ </rect>
+ <text string="6">
+ <bounds left="0.1" top="0.1" right="0.9" bottom="0.9" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ </element>
+
+ <element name="btn27">
+ <rect>
+ <bounds left="0" top="0" right="1" bottom="1" />
+ <color red="1.0" green="1.0" blue="1.0" />
+ </rect>
+ <rect>
+ <bounds left="0.05" top="0.05" right="0.95" bottom="0.95" />
+ <color red="0.9" green="0.9" blue="0.9" />
+ </rect>
+ <text string="7">
+ <bounds left="0.1" top="0.1" right="0.9" bottom="0.9" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ </element>
+
+ <element name="btn34">
+ <rect>
+ <bounds left="0" top="0" right="1" bottom="1" />
+ <color red="1.0" green="1.0" blue="1.0" />
+ </rect>
+ <rect>
+ <bounds left="0.05" top="0.05" right="0.95" bottom="0.95" />
+ <color red="0.9" green="0.9" blue="0.9" />
+ </rect>
+ <text string="0">
+ <bounds left="0.1" top="0.1" right="0.9" bottom="0.9" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ </element>
+
+ <element name="btn35">
+ <rect>
+ <bounds left="0" top="0" right="1" bottom="1" />
+ <color red="1.0" green="1.0" blue="1.0" />
+ </rect>
+ <rect>
+ <bounds left="0.05" top="0.05" right="0.95" bottom="0.95" />
+ <color red="0.9" green="0.9" blue="0.9" />
+ </rect>
+ <text string="1">
+ <bounds left="0.1" top="0.1" right="0.9" bottom="0.9" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ </element>
+
+ <element name="btn36">
+ <rect>
+ <bounds left="0" top="0" right="1" bottom="1" />
+ <color red="1.0" green="1.0" blue="1.0" />
+ </rect>
+ <rect>
+ <bounds left="0.05" top="0.05" right="0.95" bottom="0.95" />
+ <color red="0.9" green="0.9" blue="0.9" />
+ </rect>
+ <text string="2">
+ <bounds left="0.1" top="0.1" right="0.9" bottom="0.9" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ </element>
+
+ <element name="btn37">
+ <rect>
+ <bounds left="0" top="0" right="1" bottom="1" />
+ <color red="1.0" green="1.0" blue="1.0" />
+ </rect>
+ <rect>
+ <bounds left="0.05" top="0.05" right="0.95" bottom="0.95" />
+ <color red="0.9" green="0.9" blue="0.9" />
+ </rect>
+ <text string="3">
+ <bounds left="0.1" top="0.1" right="0.9" bottom="0.9" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </text>
+ </element>
+
+ <element name="backdrop">
+ <rect>
+ <bounds left="0" top="0" right="1" bottom="1" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </rect>
+ </element>
+
+ <view name="Default Layout">
+
+ <bezel element="backdrop">
+ <bounds left="0" top="0" right="960" bottom="520" />
+ </bezel>
+
+ <bezel name="digit15" element="char">
+ <bounds left="10" top="10" right="50" bottom="70" />
+ </bezel>
+ <bezel name="digit14" element="char">
+ <bounds left="70" top="10" right="110" bottom="70" />
+ </bezel>
+ <bezel name="digit13" element="char">
+ <bounds left="130" top="10" right="170" bottom="70" />
+ </bezel>
+ <bezel name="digit12" element="char">
+ <bounds left="190" top="10" right="230" bottom="70" />
+ </bezel>
+
+ <bezel name="digit11" element="char">
+ <bounds left="250" top="10" right="290" bottom="70" />
+ </bezel>
+ <bezel name="digit10" element="char">
+ <bounds left="310" top="10" right="350" bottom="70" />
+ </bezel>
+ <bezel name="digit9" element="char">
+ <bounds left="370" top="10" right="410" bottom="70" />
+ </bezel>
+ <bezel name="digit8" element="char">
+ <bounds left="430" top="10" right="470" bottom="70" />
+ </bezel>
+
+ <bezel name="digit7" element="char">
+ <bounds left="490" top="10" right="530" bottom="70" />
+ </bezel>
+ <bezel name="digit6" element="char">
+ <bounds left="550" top="10" right="590" bottom="70" />
+ </bezel>
+ <bezel name="digit5" element="char">
+ <bounds left="610" top="10" right="650" bottom="70" />
+ </bezel>
+ <bezel name="digit4" element="char">
+ <bounds left="670" top="10" right="710" bottom="70" />
+ </bezel>
+
+ <bezel name="digit3" element="char">
+ <bounds left="730" top="10" right="770" bottom="70" />
+ </bezel>
+ <bezel name="digit2" element="char">
+ <bounds left="790" top="10" right="830" bottom="70" />
+ </bezel>
+ <bezel name="digit1" element="char">
+ <bounds left="850" top="10" right="890" bottom="70" />
+ </bezel>
+ <bezel name="digit0" element="char">
+ <bounds left="910" top="10" right="950" bottom="70" />
+ </bezel>
+
+ <bezel name="btn00" element="btn00" inputtag="row0" inputmask="0x01">
+ <bounds left="10" top="100" right="90" bottom="180" />
+ </bezel>
+ <bezel name="btn01" element="btn01" inputtag="row0" inputmask="0x02">
+ <bounds left="120" top="100" right="200" bottom="180" />
+ </bezel>
+ <bezel name="btn02" element="btn02" inputtag="row0" inputmask="0x04">
+ <bounds left="230" top="100" right="310" bottom="180" />
+ </bezel>
+ <bezel name="btn03" element="btn03" inputtag="row0" inputmask="0x08">
+ <bounds left="340" top="100" right="420" bottom="180" />
+ </bezel>
+
+ <bezel name="btn10" element="btn10" inputtag="row1" inputmask="0x01">
+ <bounds left="10" top="210" right="90" bottom="290" />
+ </bezel>
+ <bezel name="btn11" element="btn11" inputtag="row1" inputmask="0x02">
+ <bounds left="120" top="210" right="200" bottom="290" />
+ </bezel>
+ <bezel name="btn12" element="btn12" inputtag="row1" inputmask="0x04">
+ <bounds left="230" top="210" right="310" bottom="290" />
+ </bezel>
+ <bezel name="btn13" element="btn13" inputtag="row1" inputmask="0x08">
+ <bounds left="340" top="210" right="420" bottom="290" />
+ </bezel>
+
+ <bezel name="btn20" element="btn20" inputtag="row2" inputmask="0x01">
+ <bounds left="10" top="320" right="90" bottom="400" />
+ </bezel>
+ <bezel name="btn21" element="btn21" inputtag="row2" inputmask="0x02">
+ <bounds left="120" top="320" right="200" bottom="400" />
+ </bezel>
+ <bezel name="btn22" element="btn22" inputtag="row2" inputmask="0x04">
+ <bounds left="230" top="320" right="310" bottom="400" />
+ </bezel>
+ <bezel name="btn23" element="btn23" inputtag="row2" inputmask="0x08">
+ <bounds left="340" top="320" right="420" bottom="400" />
+ </bezel>
+
+ <bezel name="btn30" element="btn30" inputtag="row3" inputmask="0x01">
+ <bounds left="10" top="430" right="90" bottom="510" />
+ </bezel>
+ <bezel name="btn31" element="btn31" inputtag="row3" inputmask="0x02">
+ <bounds left="120" top="430" right="200" bottom="510" />
+ </bezel>
+ <bezel name="btn32" element="btn32" inputtag="row3" inputmask="0x04">
+ <bounds left="230" top="430" right="310" bottom="510" />
+ </bezel>
+ <bezel name="btn33" element="btn33" inputtag="row3" inputmask="0x08">
+ <bounds left="340" top="430" right="420" bottom="510" />
+ </bezel>
+
+ <bezel name="btn04" element="btn04" inputtag="row0" inputmask="0x10">
+ <bounds left="540" top="100" right="620" bottom="180" />
+ </bezel>
+ <bezel name="btn05" element="btn05" inputtag="row0" inputmask="0x20">
+ <bounds left="650" top="100" right="730" bottom="180" />
+ </bezel>
+ <bezel name="btn06" element="btn06" inputtag="row0" inputmask="0x40">
+ <bounds left="760" top="100" right="840" bottom="180" />
+ </bezel>
+ <bezel name="btn07" element="btn07" inputtag="row0" inputmask="0x80">
+ <bounds left="870" top="100" right="950" bottom="180" />
+ </bezel>
+
+ <bezel name="btn14" element="btn14" inputtag="row1" inputmask="0x10">
+ <bounds left="540" top="210" right="620" bottom="290" />
+ </bezel>
+ <bezel name="btn15" element="btn15" inputtag="row1" inputmask="0x20">
+ <bounds left="650" top="210" right="730" bottom="290" />
+ </bezel>
+ <bezel name="btn16" element="btn16" inputtag="row1" inputmask="0x40">
+ <bounds left="760" top="210" right="840" bottom="290" />
+ </bezel>
+ <bezel name="btn17" element="btn17" inputtag="row1" inputmask="0x80">
+ <bounds left="870" top="210" right="950" bottom="290" />
+ </bezel>
+
+ <bezel name="btn24" element="btn24" inputtag="row2" inputmask="0x10">
+ <bounds left="540" top="320" right="620" bottom="400" />
+ </bezel>
+ <bezel name="btn25" element="btn25" inputtag="row2" inputmask="0x20">
+ <bounds left="650" top="320" right="730" bottom="400" />
+ </bezel>
+ <bezel name="btn26" element="btn26" inputtag="row2" inputmask="0x40">
+ <bounds left="760" top="320" right="840" bottom="400" />
+ </bezel>
+ <bezel name="btn27" element="btn27" inputtag="row2" inputmask="0x80">
+ <bounds left="870" top="320" right="950" bottom="400" />
+ </bezel>
+
+ <bezel name="btn34" element="btn34" inputtag="row3" inputmask="0x10">
+ <bounds left="540" top="430" right="620" bottom="510" />
+ </bezel>
+ <bezel name="btn35" element="btn35" inputtag="row3" inputmask="0x20">
+ <bounds left="650" top="430" right="730" bottom="510" />
+ </bezel>
+ <bezel name="btn36" element="btn36" inputtag="row3" inputmask="0x40">
+ <bounds left="760" top="430" right="840" bottom="510" />
+ </bezel>
+ <bezel name="btn37" element="btn37" inputtag="row3" inputmask="0x80">
+ <bounds left="870" top="430" right="950" bottom="510" />
+ </bezel>
+
+ </view>
+</mamelayout>
diff --git a/src/mame/machine/apple2.cpp b/src/mame/machine/apple2.cpp
index 6ed41ea5d9b..3668f522be6 100644
--- a/src/mame/machine/apple2.cpp
+++ b/src/mame/machine/apple2.cpp
@@ -50,7 +50,33 @@ void apple2_state::apple2_setup_memory(const apple2_memmap_config *config)
apple2_update_memory();
}
+void apple2_state::langcard_touch(offs_t offset)
+{
+ uint32_t val, mask;
+
+ //logerror("language card bankswitch read, offset: $c08%0x\n", offset);
+
+ // determine which flags to change
+ mask = VAR_LCWRITE | VAR_LCRAM | VAR_LCRAM2;
+ val = 0;
+ if (offset & 0x01)
+ val |= VAR_LCWRITE;
+
+ switch(offset & 0x03)
+ {
+ case 0x03:
+ case 0x00:
+ val |= VAR_LCRAM;
+ break;
+ }
+
+ if ((offset & 0x08) == 0)
+ val |= VAR_LCRAM2;
+
+ // change the flags
+ apple2_setvar(val, mask);
+}
void apple2_state::apple2_update_memory()
{
@@ -348,64 +374,21 @@ READ8_MEMBER(apple2_state::apple2_c080_r)
offset &= 0x7F;
slot = offset / 0x10;
-
- if ((m_machinetype == APPLE_IIC) || (m_machinetype == APPLE_IICPLUS) || (m_machinetype == LASER128))
+
+ if (slot == 0)
{
- if (slot == 1)
- {
- offset &= 0xf;
- if (offset >= 8 && offset <= 0xb)
- {
- return m_acia1->read(space, offset-8);
- }
- }
- else if (slot == 2)
- {
- offset &= 0xf;
- if (offset >= 8 && offset <= 0xb)
- {
- return m_acia2->read(space, offset-8);
- }
- }
- }
-
- if ((m_machinetype == APPLE_IICPLUS) && (slot == 6))
- {
- offset &= 0xf;
- return m_iicpiwm->read(offset);
- }
-
- if ((m_machinetype == LASER128) && (slot == 5))
- {
- offset &= 0xf;
- uint8_t retval = m_exp_regs[offset];
-
- if (offset == 3)
- {
- retval = m_exp_ram[m_exp_liveptr&m_exp_addrmask];
- m_exp_liveptr++;
- m_exp_regs[0] = m_exp_liveptr & 0xff;
- m_exp_regs[1] = (m_exp_liveptr>>8) & 0xff;
- m_exp_regs[2] = ((m_exp_liveptr>>16) & 0xff) | m_exp_bankhior;
- }
-
- return retval;
+ langcard_touch(offset);
+ return 0;
}
-
- if ((m_machinetype == LASER128) && (slot == 6))
- {
- offset &= 0xf;
- return m_laserudc->read(offset);
- }
-
+
/* now identify the device */
- slotdevice = m_a2bus->get_a2bus_card(slot);
+ slotdevice = m_a2bus->get_a2bus_card(slot);
- /* and if we can, read from the slot */
- if (slotdevice != nullptr)
- {
- return slotdevice->read_c0nx(space, offset % 0x10);
- }
+ /* and if we can, read from the slot */
+ if (slotdevice != nullptr)
+ {
+ return slotdevice->read_c0nx(space, offset % 0x10);
+ }
}
return 0;
@@ -420,85 +403,9 @@ WRITE8_MEMBER(apple2_state::apple2_c080_w)
offset &= 0x7F;
slot = offset / 0x10;
- if ((m_machinetype == APPLE_IIC) || (m_machinetype == APPLE_IICPLUS) || (m_machinetype == LASER128))
- {
- if (slot == 1)
- {
- offset &= 0xf;
- if (offset >= 8 && offset <= 0xb)
- {
- m_acia1->write(space, offset-8, data);
- return;
- }
- }
- else if (slot == 2)
- {
- offset &= 0xf;
- if (offset >= 8 && offset <= 0xb)
- {
- m_acia2->write(space, offset-8, data);
- return;
- }
- }
- }
-
- if ((m_machinetype == APPLE_IICPLUS) && (slot == 6))
- {
- offset &= 0xf;
- m_iicpiwm->write(offset, data);
- return;
- }
-
- if ((m_machinetype == LASER128) && (slot == 5))
- {
- switch (offset & 0xf)
- {
- case 0:
- m_exp_wptr &= ~0xff;
- m_exp_wptr |= data;
- m_exp_regs[0] = m_exp_wptr & 0xff;
- m_exp_regs[1] = (m_exp_wptr>>8) & 0xff;
- m_exp_regs[2] = ((m_exp_wptr>>16) & 0xff) | m_exp_bankhior;
- m_exp_liveptr = m_exp_wptr;
- break;
-
- case 1:
- m_exp_wptr &= ~0xff00;
- m_exp_wptr |= (data<<8);
- m_exp_regs[0] = m_exp_wptr & 0xff;
- m_exp_regs[1] = (m_exp_wptr>>8) & 0xff;
- m_exp_regs[2] = ((m_exp_wptr>>16) & 0xff) | m_exp_bankhior;
- m_exp_liveptr = m_exp_wptr;
- break;
-
- case 2:
- m_exp_wptr &= ~0xff0000;
- m_exp_wptr |= (data<<16);
- m_exp_regs[0] = m_exp_wptr & 0xff;
- m_exp_regs[1] = (m_exp_wptr>>8) & 0xff;
- m_exp_regs[2] = ((m_exp_wptr>>16) & 0xff) | m_exp_bankhior;
- m_exp_liveptr = m_exp_wptr;
- break;
-
- case 3:
- // printf("Write %02x to RAM[%x]\n", data, m_liveptr);
- m_exp_ram[(m_exp_liveptr&m_exp_addrmask)] = data;
- m_exp_liveptr++;
- m_exp_regs[0] = m_exp_liveptr & 0xff;
- m_exp_regs[1] = (m_exp_liveptr>>8) & 0xff;
- m_exp_regs[2] = ((m_exp_liveptr>>16) & 0xff) | m_exp_bankhior;
- break;
-
- default:
- m_exp_regs[offset] = data;
- break;
- }
- }
-
- if ((m_machinetype == LASER128) && (slot == 6))
+ if (slot == 0)
{
- offset &= 0xf;
- m_laserudc->write(space, offset, data);
+ langcard_touch(offset);
return;
}
diff --git a/src/mame/machine/decocass.cpp b/src/mame/machine/decocass.cpp
index f1529ebba4e..94d38b9a5d9 100644
--- a/src/mame/machine/decocass.cpp
+++ b/src/mame/machine/decocass.cpp
@@ -430,6 +430,39 @@ MACHINE_RESET_MEMBER(decocass_state,cocean1a) /* 10 */
m_type1_outmap = MAKE_MAP(0,1,2,3,4,5,6,7);
}
+ /***************************************************************************
+ *
+ * TYPE1 DONGLE DP-1120/DP-2120 map for Flash Boy/The Deco Kid
+ *
+ * Latched bits = $24 (2 latch bits)
+ * Input bits that are passed uninverted = $08 (1 true bits)
+ * Input bits that are passed inverted = $00 (0 inverted bits)
+ * Remaining bits for addressing PROM = $D3 (5 bits)
+ * Latched bit #0:
+ * Input bit position = 2
+ * Output bit position = 2
+ * Type = Inverting latch
+ * Latched bit #1:
+ * Input bit position = 5
+ * Output bit position = 5
+ * Type = Non-inverting latch
+ *
+ ***************************************************************************/
+
+static uint8_t type1_map1120[8] = { T1PROM,T1PROM,T1LATCHINV,T1DIRECT,T1PROM,T1LATCH,T1PROM,T1PROM };
+
+
+MACHINE_RESET_MEMBER(decocass_state,cfboy0a1) /* 12 */
+{
+ decocass_state::machine_reset();
+ LOG(0,("dongle type #1 (DP-1120 map)\n"));
+ m_dongle_r = read8_delegate(FUNC(decocass_state::decocass_type1_r),this);
+ m_type1_map = type1_map1120;
+ m_type1_inmap = MAKE_MAP(0,1,2,3,4,5,6,7);
+ m_type1_outmap = MAKE_MAP(0,1,2,3,4,5,6,7);
+}
+
+
/***************************************************************************
*
diff --git a/src/mame/machine/egret.cpp b/src/mame/machine/egret.cpp
index 1aee97637e2..ee3352fb0ea 100644
--- a/src/mame/machine/egret.cpp
+++ b/src/mame/machine/egret.cpp
@@ -162,7 +162,7 @@ void egret_device::send_port(address_space &space, uint8_t offset, uint8_t data)
printf("EG-> VIA_CLOCK: %d (PC=%x)\n", ((data>>4)&1)^1, m_maincpu->pc());
#endif
via_clock = (data>>4) & 1;
- write_via_clock(via_clock^1);
+ write_via_clock(via_clock);
}
}
break;
diff --git a/src/mame/machine/intv.cpp b/src/mame/machine/intv.cpp
index 38498eccce1..594e9336049 100644
--- a/src/mame/machine/intv.cpp
+++ b/src/mame/machine/intv.cpp
@@ -2,10 +2,11 @@
// copyright-holders:Nathan Woods,Frank Palazzolo
#include "emu.h"
#include "video/stic.h"
+#include "video/tms9927.h"
#include "includes/intv.h"
#include "cpu/cp1610/cp1610.h"
-
+// Dual Port Memory handlers
WRITE16_MEMBER( intv_state::intvkbd_dualport16_w )
{
@@ -35,215 +36,450 @@ WRITE8_MEMBER( intv_state::intvkbd_dualport8_lsb_w )
RAM[offset] = data;
}
+READ8_MEMBER( intv_state::intvkbd_dualport8_msb_r )
+{
+ return (m_intvkbd_dualport_ram[offset+0x200]&0x0300)>>8;
+}
+WRITE8_MEMBER( intv_state::intvkbd_dualport8_msb_w )
+{
+ unsigned int mask = m_intvkbd_dualport_ram[offset+0x200] & 0x00ff;
+ m_intvkbd_dualport_ram[offset+0x200] = mask | ((data<<8)&0x0300);
+}
-READ8_MEMBER( intv_state::intvkbd_dualport8_msb_r )
+// I/O for the Tape Drive
+// (to be moved to a device)
+struct tape_drive_state_type
{
- unsigned char rv;
+ /* read state */
+ int read_data; /* 0x4000 */
+ int ready; /* 0x4001 */
+ int leader_detect; /* 0x4002 */
+ int tape_missing; /* 0x4003 */
+ int playing; /* 0x4004 */
+ int no_data; /* 0x4005 */
+
+ /* write state */
+ int motor_state; /* 0x4020-0x4022 */
+ int writing; /* 0x4023 */
+ int audio_b_mute; /* 0x4024 */
+ int audio_a_mute; /* 0x4025 */
+ int channel_select; /* 0x4026 */
+ int erase; /* 0x4027 */
+ int write_data; /* 0x4040 */
+
+ /* bit_counter */
+ int bit_counter;
+} tape_drive;
+
+//static const char *const tape_motor_mode_desc[8] =
+//{
+// "IDLE", "IDLE", "IDLE", "IDLE",
+// "EJECT", "PLAY/RECORD", "REWIND", "FF"
+//};
+
+
+READ8_MEMBER( intv_state::intvkbd_io_r )
+{
+ unsigned char rv = 0x00;
- if (offset < 0x100)
+ switch (offset)
{
- switch (offset)
- {
- case 0x000:
- rv = m_io_test->read() & 0x80;
- logerror("TAPE: Read %02x from 0x40%02x - XOR Data?\n",rv,offset);
- break;
- case 0x001:
- rv = (m_io_test->read() & 0x40) << 1;
- logerror("TAPE: Read %02x from 0x40%02x - Sense 1?\n",rv,offset);
- break;
- case 0x002:
- rv = (m_io_test->read() & 0x20) << 2;
- logerror("TAPE: Read %02x from 0x40%02x - Sense 2?\n",rv,offset);
- break;
- case 0x003:
- rv = (m_io_test->read() & 0x10) << 3;
- logerror("TAPE: Read %02x from 0x40%02x - Tape Present\n",rv,offset);
- break;
- case 0x004:
- rv = (m_io_test->read() & 0x08) << 4;
- logerror("TAPE: Read %02x from 0x40%02x - Comp (339/1)\n",rv,offset);
- break;
- case 0x005:
- rv = (m_io_test->read() & 0x04) << 5;
- logerror("TAPE: Read %02x from 0x40%02x - Clocked Comp (339/13)\n",rv,offset);
- break;
- case 0x006:
- if (m_sr1_int_pending)
- rv = 0x00;
- else
- rv = 0x80;
- logerror("TAPE: Read %02x from 0x40%02x - SR1 Int Pending\n",rv,offset);
- break;
- case 0x007:
- if (m_tape_int_pending)
- rv = 0x00;
- else
- rv = 0x80;
- logerror("TAPE: Read %02x from 0x40%02x - Tape? Int Pending\n",rv,offset);
- break;
- case 0x060: /* Keyboard Read */
- rv = 0xff;
- if (m_intvkbd_keyboard_col < 10)
- rv = m_intv_keyboard[m_intvkbd_keyboard_col]->read();
- break;
- case 0x80:
+ // These next 8 locations all map to bit7
+ case 0x000:
+ // "Data from Cassette"
+ // Tape drive does the decoding to bits
+ //rv = m_io_test->read() & 0x80;
+ rv = tape_drive.read_data << 7;
+ break;
+ case 0x001:
+ // "Watermark"
+ // 0 = Drive Busy Executing Command?, 1 = Drive Ok?
+ //rv = (m_io_test->read() & 0x40) << 1;
+ rv = tape_drive.ready << 7;
+ break;
+ case 0x002:
+ // "End of Tape"
+ // 0 = Recordable surface, 1 = Leader Detect
+ // (Leader is transparent, optical sensor)
+ //rv = (m_io_test->read() & 0x20) << 2;
+ rv = tape_drive.leader_detect << 7;
+ //logerror("TAPE: Read %02x from 0x40%02x - Sense 2?\n",rv,offset);
+ break;
+ case 0x003:
+ // "Cassette Present"
+ // 0 = Tape Present, 1 = Tape Not Present
+ //rv = (m_io_test->read() & 0x10) << 3;
+ rv = tape_drive.tape_missing << 7;
+ //logerror("TAPE: Read %02x from 0x40%02x - Tape Present\n",rv,offset);
+ break;
+ case 0x004:
+ // "NOT Inter Record Gap (IRG)"
+ // 0 = Not Playing/Recording?, 1 = Playing/Recording?
+ //rv = (m_io_test->read() & 0x08) << 4;
+ rv = tape_drive.playing << 7;
+ //logerror("TAPE: Read %02x from 0x40%02x - Comp (339/1)\n",rv,offset);
+ break;
+ case 0x005:
+ // "Dropout"
+ // 0 = Data Detect, 1 = No Data
+ //rv = (m_io_test->read() & 0x04) << 5;
+ rv = tape_drive.no_data << 7;
+ //logerror("TAPE: Read %02x from 0x40%02x - Clocked Comp (339/13)\n",rv,offset);
+ break;
+ case 0x006:
+ // "NOT Clock Interrupt"
+ if (m_sr1_int_pending)
rv = 0x00;
- logerror("TAPE: Read %02x from 0x40%02x, clear tape int pending\n",rv,offset);
- m_tape_int_pending = 0;
- break;
- case 0xa0:
+ else
+ rv = 0x80;
+ //logerror("TAPE: Read %02x from 0x40%02x - SR1 Int Pending\n",rv,offset);
+ break;
+ case 0x007:
+ // "NOT Tape Interrupt"
+ if (m_tape_int_pending)
rv = 0x00;
- logerror("TAPE: Read %02x from 0x40%02x, clear SR1 int pending\n",rv,offset);
- m_sr1_int_pending = 0;
- break;
- case 0xc0:
- case 0xc1:
- case 0xc2:
- case 0xc3:
- case 0xc4:
- case 0xc5:
- case 0xc6:
- case 0xc7:
- case 0xc8:
- case 0xc9:
- case 0xca:
- case 0xcb:
- case 0xcc:
- case 0xcd:
- case 0xce:
- case 0xcf:
- /* TMS9927 regs */
- rv = intvkbd_tms9927_r(space, offset-0xc0);
- break;
- default:
- rv = (m_intvkbd_dualport_ram[offset]&0x0300)>>8;
- logerror("Unknown read %02x from 0x40%02x\n",rv,offset);
- break;
- }
- return rv;
+ else
+ rv = 0x80;
+ //logerror("TAPE: Read %02x from 0x40%02x - Tape? Int Pending\n",rv,offset);
+ break;
+ case 0x060:
+ // "Read Keyboard"
+ rv = 0xff;
+ if (m_intvkbd_keyboard_col < 10)
+ rv = m_intv_keyboard[m_intvkbd_keyboard_col]->read();
+ break;
+ case 0x80:
+ // "Clear Tape Interrupt"
+ rv = 0x00;
+ //logerror("TAPE: Read %02x from 0x40%02x, clear tape int pending\n",rv,offset);
+ m_tape_int_pending = 0;
+ break;
+ case 0xa0:
+ // "Clear Clock Interrupt"
+ rv = 0x00;
+ //logerror("TAPE: Read %02x from 0x40%02x, clear SR1 int pending\n",rv,offset);
+ m_sr1_int_pending = 0;
+ break;
+ default:
+ //logerror("Unknown read %02x from 0x40%02x\n",rv,offset);
+ break;
}
+ return rv;
+}
+
+WRITE8_MEMBER( intv_state::intvkbd_io_w )
+{
+ switch (offset)
+ {
+ // Bits from offset $20 to $47 are all bit0, write only
+ // These are all set to zero by system reset
+ case 0x020:
+ // "Tape Drive Control: Enable"
+ tape_drive.motor_state &= 3;
+ if (data & 1)
+ tape_drive.motor_state |= 4;
+ //logerror("TAPE: Motor Mode: %s\n",tape_motor_mode_desc[m_tape_motor_mode]);
+ break;
+ case 0x021:
+ // "Tape Drive Control: Forward"
+ tape_drive.motor_state &= 5;
+ if (data & 1)
+ tape_drive.motor_state |= 2;
+ //logerror("TAPE: Motor Mode: %s\n",tape_motor_mode_desc[m_tape_motor_mode]);
+ break;
+ case 0x022:
+ // "Tape Drive Control: Fast"
+ tape_drive.motor_state &= 6;
+ if (data & 1)
+ tape_drive.motor_state |= 1;
+ //logerror("TAPE: Motor Mode: %s\n",tape_motor_mode_desc[m_tape_motor_mode]);
+ break;
+ case 0x023:
+ // "Tape Drive Control: Record"
+ // 0=Read, 1=Write
+ tape_drive.writing = (data & 1);
+ break;
+ case 0x024:
+ // "Tape Drive Control: Mute 1"
+ // 0=Enable Channel B Audio, 1=Mute
+ tape_drive.audio_b_mute = (data & 1);
+ break;
+ case 0x025:
+ // "Tape Drive Control: Mute 2"
+ // 0=Enable Channel A Audio, 1=Mute
+ tape_drive.audio_a_mute = (data & 1);
+ break;
+ case 0x026:
+ // "Tape Drive Control: Mode"
+ // If read mode:
+ // 0=Read Channel B Data, 1 = Read Channel A Data
+ // If write mode:
+ // 0=Write Channel B data, 1 = Record Channel B Audio
+ tape_drive.channel_select = (data & 1);
+ case 0x027:
+ break;
+ // "Tape Drive Control: Erase"
+ tape_drive.erase = (data & 1);
+ break;
+ case 0x040:
+ // Data to Tape
+ tape_drive.write_data = (data & 1);
+ break;
+ case 0x041:
+ // "Tape Interrupt Enable"
+ //if (data & 1)
+ //logerror("TAPE: Tape Interrupts Enabled\n");
+ //else
+ //logerror("TAPE: Tape Interrupts Disabled\n");
+ m_tape_interrupts_enabled = (data & 1);
+ break;
+ case 0x042:
+ // "NOT External Interrupt Enable"
+ //if (data & 1)
+ //logerror("TAPE: Cart Bus Interrupts Disabled\n");
+ //else
+ //logerror("TAPE: Cart Bus Interrupts Enabled\n");
+ break;
+ case 0x043:
+ // "NOT Blank Screen"
+ if (data & 0x01)
+ m_intvkbd_text_blanked = 0;
+ else
+ m_intvkbd_text_blanked = 1;
+ break;
+ case 0x044:
+ m_intvkbd_keyboard_col &= 0x0e;
+ m_intvkbd_keyboard_col |= (data&0x01);
+ break;
+ case 0x045:
+ m_intvkbd_keyboard_col &= 0x0d;
+ m_intvkbd_keyboard_col |= ((data&0x01)<<1);
+ break;
+ case 0x046:
+ m_intvkbd_keyboard_col &= 0x0b;
+ m_intvkbd_keyboard_col |= ((data&0x01)<<2);
+ break;
+ case 0x047:
+ m_intvkbd_keyboard_col &= 0x07;
+ m_intvkbd_keyboard_col |= ((data&0x01)<<3);
+ break;
+ case 0x80:
+ // "Clear Tape Interrupt"
+ //logerror("TAPE: Write to 0x40%02x, clear tape int pending\n",offset);
+ m_tape_int_pending = 0;
+ break;
+ case 0xa0:
+ // "Clear Clock Interrupt"
+ //logerror("TAPE: Write to 0x40%02x, clear SR1 int pending\n",offset);
+ m_sr1_int_pending = 0;
+ break;
+ default:
+ //logerror("%04X: Unknown write %02x to 0x40%02x\n",space.device().safe_pc(),data,offset);
+ break;
+ }
+}
+
+#if 0
+static int max_bits = 0;
+static unsigned char *tape_data;
+
+void get_tape_bit(int position, int channel, int *data_present, int *data)
+{
+ int byte = (position >> 2)*2 + channel;
+ int data_present_mask = 1 << ((3-(position % 4))*2 + 1);
+ int data_mask = 1 << ((3-(position % 4))*2);
+
+ //printf("%d\t0x%02x 0x%02x\n",byte,data_present_mask,data_mask);
+
+ if (tape_data[byte] & data_present_mask)
+ *data_present = 1;
+ else
+ *data_present = 0;
+
+ if (tape_data[byte] & data_mask)
+ *data = 1;
else
- return (m_intvkbd_dualport_ram[offset]&0x0300)>>8;
+ *data = 0;
}
-static const char *const tape_motor_mode_desc[8] =
+void set_tape_bit(int position, int data)
{
- "IDLE", "IDLE", "IDLE", "IDLE",
- "EJECT", "PLAY/RECORD", "REWIND", "FF"
-};
+ int byte = (position >> 2)*2 + 1;
+ int data_present_mask = 1 << ((3-(position % 4))*2 + 1);
+ int data_mask = 1 << ((3-(position % 4))*2);
-WRITE8_MEMBER( intv_state::intvkbd_dualport8_msb_w )
+ tape_data[byte] |= data_present_mask;
+ if (data)
+ tape_data[byte] |= data_mask;
+ else
+ tape_data[byte] &= (~data_mask);
+}
+#endif
+
+#if defined(LATER)
+int intvkbd_tape_init(int id)
+{
+ FILE *tapefile;
+ int filesize;
+
+ if (!(tapefile = image_fopen (IO_CASSETTE, id, OSD_FILETYPE_IMAGE, OSD_FOPEN_READ)))
+ {
+ return INIT_FAIL;
+ }
+
+ filesize = osd_fsize(tapefile);
+ tape_data = (unsigned char *)malloc(filesize);
+ osd_fread(tapefile, tape_data, filesize);
+
+ osd_fclose(tapefile);
+
+ max_bits = 2*filesize;
+
+ tape_drive.tape_missing = 0;
+ tape_drive.leader_detect = 0;
+ tape_drive.ready = 1;
+
+ tape_drive.bit_counter = 0;
+ return INIT_PASS;
+}
+
+void intvkbd_tape_exit(int id)
{
- unsigned int mask;
+ FILE *tapefile;
+ int filesize;
- if (offset < 0x100)
+ if (tape_data)
{
- switch (offset)
+ if (!(tapefile = image_fopen (IO_CASSETTE, id, OSD_FILETYPE_IMAGE, OSD_FOPEN_RW)))
{
- case 0x020:
- m_tape_motor_mode &= 3;
- if (data & 1)
- m_tape_motor_mode |= 4;
- logerror("TAPE: Motor Mode: %s\n",tape_motor_mode_desc[m_tape_motor_mode]);
- break;
- case 0x021:
- m_tape_motor_mode &= 5;
- if (data & 1)
- m_tape_motor_mode |= 2;
- logerror("TAPE: Motor Mode: %s\n",tape_motor_mode_desc[m_tape_motor_mode]);
- break;
- case 0x022:
- m_tape_motor_mode &= 6;
- if (data & 1)
- m_tape_motor_mode |= 1;
- logerror("TAPE: Motor Mode: %s\n",tape_motor_mode_desc[m_tape_motor_mode]);
- break;
- case 0x023:
- case 0x024:
- case 0x025:
- case 0x026:
- case 0x027:
- m_tape_unknown_write[offset - 0x23] = (data & 1);
- break;
- case 0x040:
- m_tape_unknown_write[5] = (data & 1);
- break;
- case 0x041:
- if (data & 1)
- logerror("TAPE: Tape Interrupts Enabled\n");
- else
- logerror("TAPE: Tape Interrupts Disabled\n");
- m_tape_interrupts_enabled = (data & 1);
- break;
- case 0x042:
- if (data & 1)
- logerror("TAPE: Cart Bus Interrupts Disabled\n");
- else
- logerror("TAPE: Cart Bus Interrupts Enabled\n");
- break;
- case 0x043:
- if (data & 0x01)
- m_intvkbd_text_blanked = 0;
- else
- m_intvkbd_text_blanked = 1;
- break;
- case 0x044:
- m_intvkbd_keyboard_col &= 0x0e;
- m_intvkbd_keyboard_col |= (data&0x01);
- break;
- case 0x045:
- m_intvkbd_keyboard_col &= 0x0d;
- m_intvkbd_keyboard_col |= ((data&0x01)<<1);
- break;
- case 0x046:
- m_intvkbd_keyboard_col &= 0x0b;
- m_intvkbd_keyboard_col |= ((data&0x01)<<2);
- break;
- case 0x047:
- m_intvkbd_keyboard_col &= 0x07;
- m_intvkbd_keyboard_col |= ((data&0x01)<<3);
- break;
- case 0x80:
- logerror("TAPE: Write to 0x40%02x, clear tape int pending\n",offset);
- m_tape_int_pending = 0;
- break;
- case 0xa0:
- logerror("TAPE: Write to 0x40%02x, clear SR1 int pending\n",offset);
- m_sr1_int_pending = 0;
- break;
- case 0xc0:
- case 0xc1:
- case 0xc2:
- case 0xc3:
- case 0xc4:
- case 0xc5:
- case 0xc6:
- case 0xc7:
- case 0xc8:
- case 0xc9:
- case 0xca:
- case 0xcb:
- case 0xcc:
- case 0xcd:
- case 0xce:
- case 0xcf:
- /* TMS9927 regs */
- intvkbd_tms9927_w(space, offset-0xc0, data);
- break;
- default:
- logerror("%04X: Unknown write %02x to 0x40%02x\n",space.device().safe_pc(),data,offset);
- break;
+ filesize = osd_fsize(tapefile);
+ osd_fwrite(tapefile, tape_data, filesize);
+ osd_fclose(tapefile);
+
+ free(tape_data);
+ tape_data = 0;
+
+ max_bits = 0;
+ tape_drive.tape_missing = 1;
+ tape_drive.bit_counter = 0;
+ }
+ }
+}
+
+void update_tape_drive(void)
+{
+ /* temp */
+
+ if (tape_drive.writing)
+ {
+ if (tape_drive.channel_select == 0) /* data */
+ {
+ set_tape_bit(tape_drive.bit_counter,tape_drive.write_data);
+ }
+ else
+ {
+ /* recording audio - TBD */
}
}
else
{
- mask = m_intvkbd_dualport_ram[offset] & 0x00ff;
- m_intvkbd_dualport_ram[offset] = mask | ((data<<8)&0x0300);
+ int channel;
+ int data_present;
+ int data;
+
+ channel = tape_drive.channel_select ^ 1;
+
+ get_tape_bit(tape_drive.bit_counter,channel,&data_present,&data);
+
+ tape_drive.no_data = data_present ^ 1;
+ tape_drive.read_data = data;
+
+ /* temporary */
+ tape_drive.playing = data_present ^ 1;
+ }
+
+ if (tape_drive.motor_state == 5) /* Playing */
+ {
+ tape_drive.bit_counter++;
+ if (tape_drive.bit_counter >= max_bits)
+ tape_drive.bit_counter = max_bits-1;
+ }
+
+ if (tape_drive.motor_state == 6) /* Rewinding */
+ {
+ tape_drive.bit_counter-=4;
+ //tape_drive.bit_counter--;
+ if (tape_drive.bit_counter < 0)
+ tape_drive.bit_counter = 0;
}
+ if (tape_drive.motor_state == 7) /* FastFwd */
+ {
+ tape_drive.bit_counter+=2;
+ //tape_drive.bit_counter++;
+ if (tape_drive.bit_counter >= max_bits)
+ tape_drive.bit_counter = max_bits-1;
+ }
+
+ if ((tape_drive.bit_counter == 0) || (tape_drive.bit_counter == max_bits-1))
+ tape_drive.leader_detect = 1;
+ else
+ tape_drive.leader_detect = 0;
}
+#endif
+////////////
+
+READ8_MEMBER( intv_state::intvkbd_periph_r )
+{
+ uint8_t value = 0;
+ switch(offset) {
+ case 0x06:
+ if (m_printer_not_busy_enable)
+ if (m_printer_not_busy)
+ value |= 0x80;
+ if (m_printer_no_paper)
+ value |= 0x10;
+ //logerror("PeriphRead: 0x%04x->0x%02x\n",offset,value);
+
+ // After one query of busy,
+ // next time the state is not_busy
+ if (!m_printer_not_busy)
+ m_printer_not_busy = true;
+
+ return value;
+ break;
+ case 0x07:
+
+ default:
+ //logerror("PeriphRead: 0x%04x->0x%02x\n",offset,0xff);
+ return 0xff;
+ break;
+ }
+}
+
+WRITE8_MEMBER( intv_state::intvkbd_periph_w )
+{
+ switch(offset) {
+ case 0x06:
+ //logerror("PeriphWrite: 0x%04x->0x%02x\n",offset,data);
+ if (data & 0x20)
+ m_printer_not_busy_enable = true;
+ else
+ m_printer_not_busy_enable = false;
+ break;
+ case 0x07:
+ //logerror("Printing: 0x%02x, %c\n",data,data);
+ // For testing, print to stdout
+ fputc(data, stdout);
+ fflush(stdout);
+ m_printer_not_busy = false;
+ break;
+ default:
+ //logerror("PeriphWrite: 0x%04x->0x%02x\n",offset,data);
+ break;
+ }
+}
READ16_MEMBER( intv_state::intv_stic_r )
{
@@ -322,6 +558,13 @@ void intv_state::machine_reset()
/* Set initial PC */
m_maincpu->set_state_int(CP1610_R7, 0x1000);
+
+ if (m_is_keybd)
+ {
+ m_printer_not_busy = true; // printer state
+ m_printer_no_paper = false; // printer state
+ m_printer_not_busy_enable = false; // printer interface state
+ }
}
void intv_state::machine_start()
@@ -346,12 +589,7 @@ void intv_state::machine_start()
save_item(NAME(m_intvkbd_keyboard_col));
save_item(NAME(m_tape_int_pending));
save_item(NAME(m_tape_interrupts_enabled));
- save_item(NAME(m_tape_unknown_write));
save_item(NAME(m_tape_motor_mode));
- save_item(NAME(m_tms9927_num_rows));
- save_item(NAME(m_tms9927_cursor_col));
- save_item(NAME(m_tms9927_cursor_row));
- save_item(NAME(m_tms9927_last_row));
}
if (m_cart && m_cart->exists())
@@ -436,3 +674,39 @@ INTERRUPT_GEN_MEMBER(intv_state::intv_interrupt)
m_stic->screenrefresh();
}
+
+#if defined(LATER)
+
+INTERRUPT_GEN( intvkbd_interrupt2 )
+{
+ static int tape_interrupt_divider = 0;
+
+ tape_interrupt_divider++;
+ tape_interrupt_divider = tape_interrupt_divider % 50;
+
+ if (tape_interrupt_divider == 0)
+ {
+#if 0
+ update_tape_drive();
+
+ /* do sr1 interrupt plus possible tape interrupt */
+ if (tape_interrupts_enabled)
+ tape_int_pending = 1;
+#endif
+ sr1_int_pending = 1;
+ cpu_set_irq_line(1, 0, PULSE_LINE);
+ }
+ else
+ {
+ update_tape_drive();
+
+ /* do only possible tape interrupt */
+ if (tape_interrupts_enabled)
+ {
+ tape_int_pending = 1;
+ cpu_set_irq_line(1, 0, PULSE_LINE);
+ }
+ }
+
+}
+#endif
diff --git a/src/mame/machine/ms7004.cpp b/src/mame/machine/ms7004.cpp
index 8f3ed681309..d09ce6a4332 100644
--- a/src/mame/machine/ms7004.cpp
+++ b/src/mame/machine/ms7004.cpp
@@ -5,7 +5,6 @@
for Cyrillic characters).
To do:
- - receive data from host (not used by KSM but used by other boards)
- connect LEDs and speaker
*/
@@ -27,7 +26,7 @@
// MACROS / CONSTANTS
//**************************************************************************
-#define MS7004_CPU_TAG "i8048"
+#define MS7004_CPU_TAG "i8035"
#define MS7004_SPK_TAG "beeper"
@@ -46,7 +45,11 @@ ROM_END
// ADDRESS_MAP
//-------------------------------------------------
-static ADDRESS_MAP_START( ms7004_map, AS_IO, 8, ms7004_device )
+static ADDRESS_MAP_START( ms7004_map, AS_PROGRAM, 8, ms7004_device )
+ AM_RANGE(0x0000, 0x07ff) AM_ROM
+ADDRESS_MAP_END
+
+static ADDRESS_MAP_START( ms7004_iomap, AS_IO, 8, ms7004_device )
AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE(p1_w)
AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(p2_w)
AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(t1_r)
@@ -58,8 +61,9 @@ ADDRESS_MAP_END
//-------------------------------------------------
static MACHINE_CONFIG_FRAGMENT( ms7004 )
- MCFG_CPU_ADD(MS7004_CPU_TAG, I8048, XTAL_4_608MHz)
- MCFG_CPU_IO_MAP(ms7004_map)
+ MCFG_CPU_ADD(MS7004_CPU_TAG, I8035, XTAL_4_608MHz)
+ MCFG_CPU_PROGRAM_MAP(ms7004_map)
+ MCFG_CPU_IO_MAP(ms7004_iomap)
MCFG_I8243_ADD("i8243", NOOP, WRITE8(ms7004_device, i8243_port_w))
@@ -388,7 +392,7 @@ void ms7004_device::device_reset()
WRITE_LINE_MEMBER( ms7004_device::write_rxd )
{
- DBG_LOG(1,0,("write_rxd %d\n", state));
+ m_maincpu->set_input_line(MCS48_INPUT_IRQ, state ? CLEAR_LINE : ASSERT_LINE);
}
//-------------------------------------------------
diff --git a/src/mame/machine/osborne1.cpp b/src/mame/machine/osborne1.cpp
index cb9f84f5bf3..5472ac30bce 100644
--- a/src/mame/machine/osborne1.cpp
+++ b/src/mame/machine/osborne1.cpp
@@ -9,6 +9,7 @@ There are three IRQ sources:
***************************************************************************/
+#include "emu.h"
#include "includes/osborne1.h"
@@ -269,7 +270,6 @@ DRIVER_INIT_MEMBER( osborne1_state, osborne1 )
m_bank_fxxx->configure_entries(0, 1, m_ram->pointer() + 0xF000, 0);
m_bank_fxxx->configure_entries(1, 1, m_ram->pointer() + 0x10000, 0);
- m_p_chargen = memregion("chargen")->base();
m_video_timer = timer_alloc(TIMER_VIDEO);
m_tilemap = &machine().tilemap().create(
*m_gfxdecode,
@@ -416,7 +416,7 @@ TIMER_CALLBACK_MEMBER(osborne1_state::video_callback)
// to a fixed value of 1 or 9 depending on the value of the HC-LEFT
// signal (set by bit 1 of the value written to 0x2400). Of course
// it depends on the value wrapping around to zero when it counts
- // past 0x7F
+ // past 0x7F.
uint16_t const col = hires ? ((m_scroll_x & 0x60) + (m_hc_left ? 0x09 : 0x01) + 0x17) : (m_scroll_x + 0x0B);
for (uint16_t x = 0; x < (hires ? 104 : 52); x++)
@@ -511,3 +511,26 @@ void osborne1_state::update_acia_rxc_txc()
attoseconds_t const divisor = (15974400 / 100) / m_acia_rxc_txc_div;
m_acia_rxc_txc_timer->adjust(attotime(0, dividend / divisor));
}
+
+
+MC6845_UPDATE_ROW(osborne1nv_state::crtc_update_row)
+{
+ rgb_t const *const palette = m_palette->palette()->entry_list_raw();
+ uint16_t const base = (ma >> 1) & 0xF80;
+ uint32_t *p = &bitmap.pix32(y);
+ for (uint8_t x = 0; x < x_count; ++x)
+ {
+ uint16_t const offset = base | ((ma + x) & 0x7F);
+ uint8_t const chr = m_ram->pointer()[0xF000 | offset];
+ uint8_t const clr = BIT(m_ram->pointer()[0x10000 | offset], 7) ? 2 : 1;
+
+ uint8_t const gfx = ((chr & 0x80) && (ra == 9)) ? 0xFF : m_p_nuevo[(ra << 7) | (chr & 0x7F)];
+
+ for (unsigned bit = 0; 8 > bit; ++bit)
+ *p++ = palette[BIT(gfx, 7 - bit) ? clr : 0];
+ }
+}
+
+MC6845_ON_UPDATE_ADDR_CHANGED(osborne1nv_state::crtc_update_addr_changed)
+{
+}
diff --git a/src/mame/mame.lst b/src/mame/mame.lst
index 05f1e864d53..857d8d64528 100644
--- a/src/mame/mame.lst
+++ b/src/mame/mame.lst
@@ -2581,6 +2581,7 @@ bldwolfj // (c) 1988 Data East Corporation (Japan)
@source:battlex.cpp
battlex // (c) 1982 Omori E. Co., Ltd.
+dodgeman //
@source:battlnts.cpp
battlnts // GX777 (c) 1987
@@ -10027,6 +10028,7 @@ ddsomb // 23/02/1996 (c) 1996 (Brazil)
ddsomh // 23/02/1996 (c) 1996 (Hispanic)
ddsomj // 19/06/1996 (c) 1996 (Japan)
ddsomjr1 // 06/02/1996 (c) 1996 (Japan)
+ddsomjr2 // 23/02/1996 (c) 1996 (Japan)
ddsomr1 // 23/02/1996 (c) 1996 (Euro)
ddsomr2 // 09/02/1996 (c) 1996 (Euro)
ddsomr3 // 08/02/1996 (c) 1996 (Euro)
@@ -10958,6 +10960,7 @@ cburnrub2 // 27
cdiscon1 // 19 1982.04 Disco No.1
cdsteljn // 14 1981.06 DS Telejan
cexplore // 18 1982.02 Explorer
+cfboy0a1 // DT-1[12]0-A-1 1981.08 Flash Boy (Japan) (DECO Cassette MD) (Ver 1) // version verified // vertical scrolling (early version)
cfghtice // 40 1984.04 Fighting Ice Hockey
cfishing // 25 1982.10 Fishing
cflyball // 35 1983.?? Flying Ball/Bampoline
@@ -11976,6 +11979,7 @@ deluxe5a // (c) 2000 ESD
deluxe5b // (c) 2000 ESD
deluxe4u // (c) 2000 ESD
hedpanic // (c) 2000 ESD
+hedpanica // (c) 1999 ESD
hedpanicf // (c) 2000 ESD + Fuuki, Co. Ltd.
hedpanico // (c) 1999 ESD
jumppop // (c) 2001 ESD
@@ -12971,6 +12975,11 @@ galeb //
@source:galgame.cpp
galgame // (c) 1971 Computer Recreations, Inc
+@source:galgames.cpp
+galgame2 // (c) 1998 Creative Electronics & Software (CES) / Namco
+galgame3 // (c) 1998 Creative Electronics & Software (CES) / Atari
+galgbios // (c) 1998 Creative Electronics & Software (CES)
+
@source:galivan.cpp
dangar // (c) 1986
dangara // (c) 1986
@@ -14038,6 +14047,7 @@ diamondpf //
diamondpg //
excalibr //
excalibrf //
+excalibrg //
genesisp //
genesispf //
genesispg //
@@ -14130,6 +14140,8 @@ venus // bootleg
@source:h19.cpp
h19 //
+super19 //
+watz19 //
@source:h8.cpp
h8 //
@@ -14725,6 +14737,7 @@ lhbv33c // (c) 1995
nkishusp // (c) 1998
ryukobou // (c) 1995
vbowl // (c) 1996
+vbowlhk // (c) 1996
vbowlj // (c) 1996
wlcc // (c) 1996
xymg // (c) 1996
@@ -20472,6 +20485,7 @@ mcombats // bootleg
missile // 035820-035825 (c) 1980, 1 ROM update to rev 2 board
missile1 // 035820-035825 (c) 1980
missile2 // 035820-035825 (c) 1980
+missilea // bootleg (Ugames)
missilem // hack
suprmatk // (c) 1980 + (c) 1981 Gencomp
suprmatkd // (c) 1980 + (c) 1981 Gencomp
@@ -29424,6 +29438,7 @@ osbexec // 1982 Osborne Executive
@source:osborne1.cpp
osborne1 // 1981 Osborne-1
+osborne1nv // 1984 Osborne-1 (Nuevo Video)
@source:osi.cpp
c1p //
@@ -31860,6 +31875,7 @@ route16c // (c) 1981 Tehkan/Sun + Centuri license
routex // bootleg
spacecho // bootleg
spacecho2 // bootleg
+speakhlp // bootleg
speakres // [Sun Electronics]
speakresb // bootleg
stratvox // [1980 Sun Electronics] Taito
@@ -32601,6 +32617,7 @@ puyopuy2 // (c) 1994 Compile + Sega license
ribbit // (c) 1991 Sega
soniccar // (c) 1991 Sega
sonicpop // (c) 1993 Sega
+sonicfgt // (c) 1993 Sega
stkclmns // (c) 1994 Sega
stkclmnsj // (c) 1994 Sega
tantr // (c) 1992 Sega
@@ -34510,6 +34527,7 @@ vfremix // 1995.06 Virtua Fighter Remix
vmahjong // 1997.02 Virtual Mahjong (Micronet)
winterht // 1997.10 Winter Heat (Data East)
znpwfv // 1997.12 Zen Nippon Pro Wrestling featuring Virtua
+znpwfvt // 1997.12 Zen Nippon Pro Wrestling featuring Virtua
@source:su2000.cpp
su2000 // (c) 1993 Virtuality
@@ -35179,6 +35197,7 @@ puzznicb // bootleg
puzznicba // bootleg
puzznici // bootleg
puzznicj // C20 (c) 1989 Taito Corporation (Japan)
+puzznicu // C20 (c) 1989 Taito America Corporation (US)
raimais // B36 (c) 1988 Taito Corporation (Japan)
raimaisj // B36 (c) 1988 Taito Corporation
raimaisjo // B36 (c) 1988 Taito Corporation
@@ -35522,6 +35541,9 @@ terracreo // (c) 1985
test410 //
test420 //
+@source:testconsole.cpp
+whousetc //
+
@source:tetrisp2.cpp
nndmseal // (c) 1997 I'Max/Jaleco
nndmseala // (c) 1997 I'Max/Jaleco
@@ -35795,8 +35817,6 @@ tk80bs //
990189v // 1980 TM 990/189 with Color Video Board
@source:tmaster.cpp
-galgame2 // (c) 1998 Creative Electronics & Software (CES) / Namco
-galgbios // (c) 1998 Creative Electronics & Software (CES)
tm // (c) 1996 Midway Games
tm2k // (c) 1996 Midway Games
tm2ka // (c) 1996 Midway Games
@@ -37353,6 +37373,7 @@ defence // bootleg
defender // (c) 1980
defenderb // (c) 1980
defenderg // (c) 1980
+defenderj // (c) 1980
defenderw // (c) 1980
defndjeu // bootleg
inferno // (c) 1984
diff --git a/src/mame/mess.flt b/src/mame/mess.flt
index d9ef0963233..51cc4bb559f 100644
--- a/src/mame/mess.flt
+++ b/src/mame/mess.flt
@@ -603,6 +603,7 @@ tek440x.cpp
tekxp33x.cpp
terak.cpp
test_t400.cpp
+testconsole.cpp
thomson.cpp
ti630.cpp
ti74.cpp
diff --git a/src/mame/video/battlex.cpp b/src/mame/video/battlex.cpp
index 1df5f45383f..5c15ba7379f 100644
--- a/src/mame/video/battlex.cpp
+++ b/src/mame/video/battlex.cpp
@@ -51,7 +51,15 @@ TILE_GET_INFO_MEMBER(battlex_state::get_bg_tile_info)
{
int tile = m_videoram[tile_index * 2] | (((m_videoram[tile_index * 2 + 1] & 0x01)) << 8);
int color = (m_videoram[tile_index * 2 + 1] & 0x0e) >> 1; // high bits unused
+
+ SET_TILE_INFO_MEMBER(0, tile, color, 0);
+}
+TILE_GET_INFO_MEMBER(battlex_state::get_dodgeman_bg_tile_info)
+{
+ int tile = m_videoram[tile_index * 2] | (((m_videoram[tile_index * 2 + 1] & 0x03)) << 8);
+ int color = (m_videoram[tile_index * 2 + 1] & 0x0c) >> 2; // high bits unused
+
SET_TILE_INFO_MEMBER(0, tile, color, 0);
}
@@ -60,6 +68,11 @@ void battlex_state::video_start()
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(battlex_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
}
+void battlex_state::video_start_dodgeman()
+{
+ m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(battlex_state::get_dodgeman_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
+}
+
void battlex_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{
gfx_element *gfx = m_gfxdecode->gfx(1);
diff --git a/src/mame/video/gcpinbal.cpp b/src/mame/video/gcpinbal.cpp
index a97370434a9..6fc85537f38 100644
--- a/src/mame/video/gcpinbal.cpp
+++ b/src/mame/video/gcpinbal.cpp
@@ -97,7 +97,6 @@ WRITE16_MEMBER(gcpinbal_state::gcpinbal_tilemaps_word_w)
uint32_t gcpinbal_state::screen_update_gcpinbal(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
int i;
- uint16_t tile_sets = 0;
uint8_t layer[3];
#ifdef MAME_DEBUG
@@ -120,16 +119,12 @@ uint32_t gcpinbal_state::screen_update_gcpinbal(screen_device &screen, bitmap_in
}
#endif
- m_scrollx[0] = m_ioc_ram[0x14 / 2];
- m_scrolly[0] = m_ioc_ram[0x16 / 2];
- m_scrollx[1] = m_ioc_ram[0x18 / 2];
- m_scrolly[1] = m_ioc_ram[0x1a / 2];
- m_scrollx[2] = m_ioc_ram[0x1c / 2];
- m_scrolly[2] = m_ioc_ram[0x1e / 2];
-
- tile_sets = m_ioc_ram[0x88 / 2];
- m_bg0_gfxset = (tile_sets & 0x400) ? 0x1000 : 0;
- m_bg1_gfxset = (tile_sets & 0x800) ? 0x1000 : 0;
+ m_scrollx[0] = m_d80010_ram[0x4 / 2];
+ m_scrolly[0] = m_d80010_ram[0x6 / 2];
+ m_scrollx[1] = m_d80010_ram[0x8 / 2];
+ m_scrolly[1] = m_d80010_ram[0xa / 2];
+ m_scrollx[2] = m_d80010_ram[0xc / 2];
+ m_scrolly[2] = m_d80010_ram[0xe / 2];
for (i = 0; i < 3; i++)
{
@@ -160,7 +155,7 @@ uint32_t gcpinbal_state::screen_update_gcpinbal(screen_device &screen, bitmap_in
#endif
m_tilemap[layer[2]]->draw(screen, bitmap, cliprect, 0, 4);
- int sprpri = (m_ioc_ram[0x68 / 2] & 0x8800) ? 0 : 1;
+ int sprpri = (m_d80060_ram[0x8 / 2] & 0x8800) ? 0 : 1;
m_sprgen->gcpinbal_draw_sprites(screen, bitmap, cliprect, m_gfxdecode, 16, sprpri);
#if 0
diff --git a/src/mame/video/intv.cpp b/src/mame/video/intv.cpp
index 29e769b85da..49d2360844e 100644
--- a/src/mame/video/intv.cpp
+++ b/src/mame/video/intv.cpp
@@ -1,108 +1,59 @@
// license:BSD-3-Clause
// copyright-holders:Nathan Woods,Frank Palazzolo
#include "emu.h"
+#include "video/tms9927.h"
#include "includes/intv.h"
void intv_state::video_start()
{
- m_tms9927_num_rows = 25;
}
-
-/* very rudimentary support for the tms9927 character generator IC */
-
-
-READ8_MEMBER( intv_state::intvkbd_tms9927_r )
-{
- uint8_t rv;
- switch (offset)
- {
- case 8:
- rv = m_tms9927_cursor_row;
- break;
- case 9:
- /* note: this is 1-based */
- rv = m_tms9927_cursor_col;
- break;
- case 11:
- m_tms9927_last_row = (m_tms9927_last_row + 1) % m_tms9927_num_rows;
- rv = m_tms9927_last_row;
- break;
- default:
- rv = 0;
- }
- return rv;
-}
-
-WRITE8_MEMBER( intv_state::intvkbd_tms9927_w )
-{
- switch (offset)
- {
- case 3:
- m_tms9927_num_rows = (data & 0x3f) + 1;
- break;
- case 6:
- m_tms9927_last_row = data;
- break;
- case 11:
- m_tms9927_last_row = (m_tms9927_last_row + 1) % m_tms9927_num_rows;
- break;
- case 12:
- /* note: this is 1-based */
- m_tms9927_cursor_col = data;
- break;
- case 13:
- m_tms9927_cursor_row = data;
- break;
- }
-}
-
-
uint32_t intv_state::screen_update_intv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_stic->screen_update(screen, bitmap, cliprect);
return 0;
}
-
uint32_t intv_state::screen_update_intvkbd(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- uint8_t *videoram = m_videoram;
- int x,y,offs;
- int current_row;
-// char c;
-
/* Draw the underlying INTV screen first */
m_stic->screen_update(screen, bitmap, cliprect);
/* if the intvkbd text is not blanked, overlay it */
if (!m_intvkbd_text_blanked)
{
- current_row = (m_tms9927_last_row + 1) % m_tms9927_num_rows;
- for(y=0;y<24;y++)
- {
- for(x=0;x<40;x++)
- {
- offs = current_row*64+x;
+ uint8_t *videoram = m_videoram;
+ int xoffset = STIC_OVERSCAN_LEFT_WIDTH*STIC_X_SCALE*INTVKBD_X_SCALE;
+ int yoffset = STIC_OVERSCAN_TOP_HEIGHT*STIC_Y_SCALE*INTVKBD_Y_SCALE;
+
+ rectangle cursor_rect;
+ m_crtc->cursor_bounds(cursor_rect);
+ int cursor_col = cursor_rect.min_x / 8;
+ int cursor_row = cursor_rect.min_y / 8;
- m_gfxdecode->gfx(0)->transpen(bitmap,cliprect,
- videoram[offs],
- 7, /* white */
- 0,0,
- x<<3,y<<3, 0);
- }
- if (current_row == m_tms9927_cursor_row)
- {
- /* draw the cursor as a solid white block */
- /* (should use a filled rect here!) */
+ int current_row = m_crtc->upscroll_offset() % 24;
+ for(int y=0;y<24;y++)
+ {
+ for(int x=0;x<40;x++)
+ {
+ if ((cursor_row == current_row) && (cursor_col == x+1)) {
+ /* draw the cursor as a solid white block */
m_gfxdecode->gfx(0)->transpen(bitmap,cliprect,
191, /* a block */
7, /* white */
0,0,
- (m_tms9927_cursor_col-1)<<3,y<<3, 0);
+ xoffset+(x<<3), yoffset+(y<<3), 0);
+ } else {
+ int offs = current_row*64+x;
+ m_gfxdecode->gfx(0)->transpen(bitmap,cliprect,
+ videoram[offs],
+ 7, /* white */
+ 0,0,
+ xoffset+(x<<3), yoffset+(y<<3), 0);
+ }
}
- current_row = (current_row + 1) % m_tms9927_num_rows;
+ current_row = (current_row + 1) % 24;
}
}
diff --git a/src/mame/video/n64.cpp b/src/mame/video/n64.cpp
index ac784a06431..66449ac7425 100644
--- a/src/mame/video/n64.cpp
+++ b/src/mame/video/n64.cpp
@@ -151,6 +151,8 @@ uint32_t n64_state::screen_update_n64(screen_device &screen, bitmap_rgb32 &bitma
}
*/
+ m_rdp->mark_frame();
+
if (n64->vi_blank)
{
bitmap.fill(0, screen.visible_area());
@@ -168,6 +170,7 @@ void n64_state::screen_eof_n64(screen_device &screen, bool state)
void n64_periphs::video_update(bitmap_rgb32 &bitmap)
{
+
if(vi_control & 0x40) /* Interlace */
{
field ^= 1;
@@ -1095,15 +1098,15 @@ uint32_t n64_rdp::get_log2(uint32_t lod_clamp)
/*****************************************************************************/
-uint32_t n64_rdp::read_data(uint32_t address)
+uint64_t n64_rdp::read_data(uint32_t address)
{
if (m_status & 0x1) // XBUS_DMEM_DMA enabled
{
- return m_dmem[(address & 0xfff) / 4];
+ return (uint64_t(m_dmem[(address & 0xfff) / 4]) << 32) | m_dmem[((address + 4) & 0xfff) / 4];
}
else
{
- return m_rdram[((address & 0xffffff) / 4)];
+ return (uint64_t(m_rdram[((address & 0xffffff) / 4)]) << 32) | m_rdram[(((address + 4) & 0xffffff) / 4)];
}
}
@@ -1192,39 +1195,38 @@ void n64_rdp::disassemble(char* buffer)
char drdy[32], dgdy[32], dbdy[32], dady[32];
char drde[32], dgde[32], dbde[32], dade[32];
- uint32_t cmd[64];
+ uint64_t cmd[32];
- const uint32_t length = m_cmd_ptr * 4;
+ const uint32_t length = m_cmd_ptr * 8;
if (length < 8)
{
sprintf(buffer, "ERROR: length = %d\n", length);
return;
}
- cmd[0] = m_cmd_data[m_cmd_cur+0];
- cmd[1] = m_cmd_data[m_cmd_cur+1];
+ cmd[0] = m_cmd_data[m_cmd_cur];
- const int32_t tile = (cmd[1] >> 24) & 0x7;
- sprintf(sl, "%4.2f", (float)((cmd[0] >> 12) & 0xfff) / 4.0f);
- sprintf(tl, "%4.2f", (float)((cmd[0] >> 0) & 0xfff) / 4.0f);
- sprintf(sh, "%4.2f", (float)((cmd[1] >> 12) & 0xfff) / 4.0f);
- sprintf(th, "%4.2f", (float)((cmd[1] >> 0) & 0xfff) / 4.0f);
+ const int32_t tile = (cmd[0] >> 56) & 0x7;
+ sprintf(sl, "%4.2f", (float)((cmd[0] >> 44) & 0xfff) / 4.0f);
+ sprintf(tl, "%4.2f", (float)((cmd[0] >> 32) & 0xfff) / 4.0f);
+ sprintf(sh, "%4.2f", (float)((cmd[0] >> 12) & 0xfff) / 4.0f);
+ sprintf(th, "%4.2f", (float)((cmd[0] >> 0) & 0xfff) / 4.0f);
- const char* format = s_image_format[(cmd[0] >> 21) & 0x7];
- const char* size = s_image_size[(cmd[0] >> 19) & 0x3];
+ const char* format = s_image_format[(cmd[0] >> 53) & 0x7];
+ const char* size = s_image_size[(cmd[0] >> 51) & 0x3];
- const uint32_t r = (cmd[1] >> 24) & 0xff;
- const uint32_t g = (cmd[1] >> 16) & 0xff;
- const uint32_t b = (cmd[1] >> 8) & 0xff;
- const uint32_t a = (cmd[1] >> 0) & 0xff;
+ const uint32_t r = (cmd[0] >> 24) & 0xff;
+ const uint32_t g = (cmd[0] >> 16) & 0xff;
+ const uint32_t b = (cmd[0] >> 8) & 0xff;
+ const uint32_t a = (cmd[0] >> 0) & 0xff;
- const uint32_t command = (cmd[0] >> 24) & 0x3f;
+ const uint32_t command = (cmd[0] >> 56) & 0x3f;
switch (command)
{
case 0x00: sprintf(buffer, "No Op"); break;
case 0x08: // Tri_NoShade
{
- const int32_t lft = (command >> 23) & 0x1;
+ const int32_t lft = (cmd[0] >> 55) & 0x1;
if (length != s_rdp_command_length[command])
{
@@ -1232,29 +1234,26 @@ void n64_rdp::disassemble(char* buffer)
return;
}
+ cmd[1] = m_cmd_data[m_cmd_cur+1];
cmd[2] = m_cmd_data[m_cmd_cur+2];
cmd[3] = m_cmd_data[m_cmd_cur+3];
- cmd[4] = m_cmd_data[m_cmd_cur+4];
- cmd[5] = m_cmd_data[m_cmd_cur+5];
- cmd[6] = m_cmd_data[m_cmd_cur+6];
- cmd[7] = m_cmd_data[m_cmd_cur+7];
-
- sprintf(yl, "%4.4f", (float)((cmd[0] >> 0) & 0x1fff) / 4.0f);
- sprintf(ym, "%4.4f", (float)((cmd[1] >> 16) & 0x1fff) / 4.0f);
- sprintf(yh, "%4.4f", (float)((cmd[1] >> 0) & 0x1fff) / 4.0f);
- sprintf(xl, "%4.4f", (float)(cmd[2] / 65536.0f));
- sprintf(dxldy, "%4.4f", (float)(cmd[3] / 65536.0f));
- sprintf(xh, "%4.4f", (float)(cmd[4] / 65536.0f));
- sprintf(dxhdy, "%4.4f", (float)(cmd[5] / 65536.0f));
- sprintf(xm, "%4.4f", (float)(cmd[6] / 65536.0f));
- sprintf(dxmdy, "%4.4f", (float)(cmd[7] / 65536.0f));
+
+ sprintf(yl, "%4.4f", (float)((cmd[0] >> 32) & 0x1fff) / 4.0f);
+ sprintf(ym, "%4.4f", (float)((cmd[0] >> 16) & 0x1fff) / 4.0f);
+ sprintf(yh, "%4.4f", (float)((cmd[0] >> 0) & 0x1fff) / 4.0f);
+ sprintf(xl, "%4.4f", (float)int32_t(cmd[1] >> 32) / 65536.0f);
+ sprintf(dxldy, "%4.4f", (float)int32_t(cmd[1]) / 65536.0f);
+ sprintf(xh, "%4.4f", (float)int32_t(cmd[2] >> 32) / 65536.0f);
+ sprintf(dxhdy, "%4.4f", (float)int32_t(cmd[2]) / 65536.0f);
+ sprintf(xm, "%4.4f", (float)int32_t(cmd[3] >> 32) / 65536.0f);
+ sprintf(dxmdy, "%4.4f", (float)int32_t(cmd[3]) / 65536.0f);
sprintf(buffer, "Tri_NoShade %d, XL: %s, XM: %s, XH: %s, YL: %s, YM: %s, YH: %s\n", lft, xl,xm,xh,yl,ym,yh);
break;
}
case 0x09: // Tri_NoShadeZ
{
- const int32_t lft = (command >> 23) & 0x1;
+ const int32_t lft = (cmd[0] >> 55) & 0x1;
if (length != s_rdp_command_length[command])
{
@@ -1262,29 +1261,26 @@ void n64_rdp::disassemble(char* buffer)
return;
}
+ cmd[1] = m_cmd_data[m_cmd_cur+1];
cmd[2] = m_cmd_data[m_cmd_cur+2];
cmd[3] = m_cmd_data[m_cmd_cur+3];
- cmd[4] = m_cmd_data[m_cmd_cur+4];
- cmd[5] = m_cmd_data[m_cmd_cur+5];
- cmd[6] = m_cmd_data[m_cmd_cur+6];
- cmd[7] = m_cmd_data[m_cmd_cur+7];
-
- sprintf(yl, "%4.4f", (float)((cmd[0] >> 0) & 0x1fff) / 4.0f);
- sprintf(ym, "%4.4f", (float)((cmd[1] >> 16) & 0x1fff) / 4.0f);
- sprintf(yh, "%4.4f", (float)((cmd[1] >> 0) & 0x1fff) / 4.0f);
- sprintf(xl, "%4.4f", (float)(cmd[2] / 65536.0f));
- sprintf(dxldy, "%4.4f", (float)(cmd[3] / 65536.0f));
- sprintf(xh, "%4.4f", (float)(cmd[4] / 65536.0f));
- sprintf(dxhdy, "%4.4f", (float)(cmd[5] / 65536.0f));
- sprintf(xm, "%4.4f", (float)(cmd[6] / 65536.0f));
- sprintf(dxmdy, "%4.4f", (float)(cmd[7] / 65536.0f));
+
+ sprintf(yl, "%4.4f", (float)((cmd[0] >> 32) & 0x1fff) / 4.0f);
+ sprintf(ym, "%4.4f", (float)((cmd[0] >> 16) & 0x1fff) / 4.0f);
+ sprintf(yh, "%4.4f", (float)((cmd[0] >> 0) & 0x1fff) / 4.0f);
+ sprintf(xl, "%4.4f", (float)int32_t(cmd[1] >> 32) / 65536.0f);
+ sprintf(dxldy, "%4.4f", (float)int32_t(cmd[1]) / 65536.0f);
+ sprintf(xh, "%4.4f", (float)int32_t(cmd[2] >> 32) / 65536.0f);
+ sprintf(dxhdy, "%4.4f", (float)int32_t(cmd[2]) / 65536.0f);
+ sprintf(xm, "%4.4f", (float)int32_t(cmd[3] >> 32) / 65536.0f);
+ sprintf(dxmdy, "%4.4f", (float)int32_t(cmd[3]) / 65536.0f);
sprintf(buffer, "Tri_NoShadeZ %d, XL: %s, XM: %s, XH: %s, YL: %s, YM: %s, YH: %s\n", lft, xl,xm,xh,yl,ym,yh);
break;
}
case 0x0a: // Tri_Tex
{
- const int32_t lft = (command >> 23) & 0x1;
+ const int32_t lft = (cmd[0] >> 55) & 0x1;
if (length < s_rdp_command_length[command])
{
@@ -1292,34 +1288,33 @@ void n64_rdp::disassemble(char* buffer)
return;
}
- for (int32_t i = 2; i < 24; i++)
+ for (int32_t i = 1; i < 12; i++)
{
cmd[i] = m_cmd_data[m_cmd_cur+i];
}
- sprintf(yl, "%4.4f", (float)((cmd[0] >> 0) & 0x1fff) / 4.0f);
- sprintf(ym, "%4.4f", (float)((cmd[1] >> 16) & 0x1fff) / 4.0f);
- sprintf(yh, "%4.4f", (float)((cmd[1] >> 0) & 0x1fff) / 4.0f);
- sprintf(xl, "%4.4f", (float)((int32_t)cmd[2] / 65536.0f));
- sprintf(dxldy, "%4.4f", (float)((int32_t)cmd[3] / 65536.0f));
- sprintf(xh, "%4.4f", (float)((int32_t)cmd[4] / 65536.0f));
- sprintf(dxhdy, "%4.4f", (float)((int32_t)cmd[5] / 65536.0f));
- sprintf(xm, "%4.4f", (float)((int32_t)cmd[6] / 65536.0f));
- sprintf(dxmdy, "%4.4f", (float)((int32_t)cmd[7] / 65536.0f));
-
- sprintf(s, "%4.4f", (float)(int32_t)((cmd[ 8] & 0xffff0000) | ((cmd[12] >> 16) & 0xffff)) / 65536.0f);
- sprintf(t, "%4.4f", (float)(int32_t)(((cmd[ 8] & 0xffff) << 16) | (cmd[12] & 0xffff)) / 65536.0f);
- sprintf(w, "%4.4f", (float)(int32_t)((cmd[ 9] & 0xffff0000) | ((cmd[13] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dsdx, "%4.4f", (float)(int32_t)((cmd[10] & 0xffff0000) | ((cmd[14] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dtdx, "%4.4f", (float)(int32_t)(((cmd[10] & 0xffff) << 16) | (cmd[14] & 0xffff)) / 65536.0f);
- sprintf(dwdx, "%4.4f", (float)(int32_t)((cmd[11] & 0xffff0000) | ((cmd[15] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dsde, "%4.4f", (float)(int32_t)((cmd[16] & 0xffff0000) | ((cmd[20] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dtde, "%4.4f", (float)(int32_t)(((cmd[16] & 0xffff) << 16) | (cmd[20] & 0xffff)) / 65536.0f);
- sprintf(dwde, "%4.4f", (float)(int32_t)((cmd[17] & 0xffff0000) | ((cmd[21] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dsdy, "%4.4f", (float)(int32_t)((cmd[18] & 0xffff0000) | ((cmd[22] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dtdy, "%4.4f", (float)(int32_t)(((cmd[18] & 0xffff) << 16) | (cmd[22] & 0xffff)) / 65536.0f);
- sprintf(dwdy, "%4.4f", (float)(int32_t)((cmd[19] & 0xffff0000) | ((cmd[23] >> 16) & 0xffff)) / 65536.0f);
-
+ sprintf(yl, "%4.4f", (float)((cmd[0] >> 32) & 0x1fff) / 4.0f);
+ sprintf(ym, "%4.4f", (float)((cmd[0] >> 16) & 0x1fff) / 4.0f);
+ sprintf(yh, "%4.4f", (float)((cmd[0] >> 0) & 0x1fff) / 4.0f);
+ sprintf(xl, "%4.4f", (float)int32_t(cmd[1] >> 32) / 65536.0f);
+ sprintf(dxldy, "%4.4f", (float)int32_t(cmd[1]) / 65536.0f);
+ sprintf(xh, "%4.4f", (float)int32_t(cmd[2] >> 32) / 65536.0f);
+ sprintf(dxhdy, "%4.4f", (float)int32_t(cmd[2]) / 65536.0f);
+ sprintf(xm, "%4.4f", (float)int32_t(cmd[3] >> 32) / 65536.0f);
+ sprintf(dxmdy, "%4.4f", (float)int32_t(cmd[3]) / 65536.0f);
+
+ sprintf(s, "%4.4f", (float)int32_t( ((cmd[4] >> 32) & 0xffff0000) | ((cmd[ 6] >> 48) & 0xffff)) / 65536.0f);
+ sprintf(t, "%4.4f", (float)int32_t((((cmd[4] >> 32) & 0x0000ffff) << 16) | ((cmd[ 6] >> 32) & 0xffff)) / 65536.0f);
+ sprintf(w, "%4.4f", (float)int32_t( (cmd[4] & 0xffff0000) | ((cmd[ 6] >> 16) & 0xffff)) / 65536.0f);
+ sprintf(dsdx, "%4.4f", (float)int32_t( ((cmd[5] >> 32) & 0xffff0000) | ((cmd[ 7] >> 48) & 0xffff)) / 65536.0f);
+ sprintf(dtdx, "%4.4f", (float)int32_t((((cmd[5] >> 32) & 0x0000ffff) << 16) | ((cmd[ 7] >> 32) & 0xffff)) / 65536.0f);
+ sprintf(dwdx, "%4.4f", (float)int32_t( (cmd[5] & 0xffff0000) | ((cmd[ 7] >> 16) & 0xffff)) / 65536.0f);
+ sprintf(dsde, "%4.4f", (float)int32_t( ((cmd[8] >> 32) & 0xffff0000) | ((cmd[10] >> 48) & 0xffff)) / 65536.0f);
+ sprintf(dtde, "%4.4f", (float)int32_t((((cmd[8] >> 32) & 0x0000ffff) << 16) | ((cmd[10] >> 32) & 0xffff)) / 65536.0f);
+ sprintf(dwde, "%4.4f", (float)int32_t( (cmd[8] & 0xffff0000) | ((cmd[10] >> 16) & 0xffff)) / 65536.0f);
+ sprintf(dsdy, "%4.4f", (float)int32_t( ((cmd[9] >> 32) & 0xffff0000) | ((cmd[11] >> 48) & 0xffff)) / 65536.0f);
+ sprintf(dtdy, "%4.4f", (float)int32_t((((cmd[9] >> 32) & 0x0000ffff) << 16) | ((cmd[11] >> 32) & 0xffff)) / 65536.0f);
+ sprintf(dwdy, "%4.4f", (float)int32_t( (cmd[9] & 0xffff0000) | ((cmd[11] >> 16) & 0xffff)) / 65536.0f);
buffer+=sprintf(buffer, "Tri_Tex %d, XL: %s, XM: %s, XH: %s, YL: %s, YM: %s, YH: %s\n", lft, xl,xm,xh,yl,ym,yh);
buffer+=sprintf(buffer, " ");
@@ -1334,7 +1329,7 @@ void n64_rdp::disassemble(char* buffer)
}
case 0x0b: // Tri_TexZ
{
- const int32_t lft = (command >> 23) & 0x1;
+ const int32_t lft = (cmd[0] >> 55) & 0x1;
if (length < s_rdp_command_length[command])
{
@@ -1342,34 +1337,33 @@ void n64_rdp::disassemble(char* buffer)
return;
}
- for (int32_t i = 2; i < 24; i++)
+ for (int32_t i = 1; i < 12; i++)
{
cmd[i] = m_cmd_data[m_cmd_cur+i];
}
- sprintf(yl, "%4.4f", (float)((cmd[0] >> 0) & 0x1fff) / 4.0f);
- sprintf(ym, "%4.4f", (float)((cmd[1] >> 16) & 0x1fff) / 4.0f);
- sprintf(yh, "%4.4f", (float)((cmd[1] >> 0) & 0x1fff) / 4.0f);
- sprintf(xl, "%4.4f", (float)((int32_t)cmd[2] / 65536.0f));
- sprintf(dxldy, "%4.4f", (float)((int32_t)cmd[3] / 65536.0f));
- sprintf(xh, "%4.4f", (float)((int32_t)cmd[4] / 65536.0f));
- sprintf(dxhdy, "%4.4f", (float)((int32_t)cmd[5] / 65536.0f));
- sprintf(xm, "%4.4f", (float)((int32_t)cmd[6] / 65536.0f));
- sprintf(dxmdy, "%4.4f", (float)((int32_t)cmd[7] / 65536.0f));
-
- sprintf(s, "%4.4f", (float)(int32_t)((cmd[ 8] & 0xffff0000) | ((cmd[12] >> 16) & 0xffff)) / 65536.0f);
- sprintf(t, "%4.4f", (float)(int32_t)(((cmd[ 8] & 0xffff) << 16) | (cmd[12] & 0xffff)) / 65536.0f);
- sprintf(w, "%4.4f", (float)(int32_t)((cmd[ 9] & 0xffff0000) | ((cmd[13] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dsdx, "%4.4f", (float)(int32_t)((cmd[10] & 0xffff0000) | ((cmd[14] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dtdx, "%4.4f", (float)(int32_t)(((cmd[10] & 0xffff) << 16) | (cmd[14] & 0xffff)) / 65536.0f);
- sprintf(dwdx, "%4.4f", (float)(int32_t)((cmd[11] & 0xffff0000) | ((cmd[15] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dsde, "%4.4f", (float)(int32_t)((cmd[16] & 0xffff0000) | ((cmd[20] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dtde, "%4.4f", (float)(int32_t)(((cmd[16] & 0xffff) << 16) | (cmd[20] & 0xffff)) / 65536.0f);
- sprintf(dwde, "%4.4f", (float)(int32_t)((cmd[17] & 0xffff0000) | ((cmd[21] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dsdy, "%4.4f", (float)(int32_t)((cmd[18] & 0xffff0000) | ((cmd[22] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dtdy, "%4.4f", (float)(int32_t)(((cmd[18] & 0xffff) << 16) | (cmd[22] & 0xffff)) / 65536.0f);
- sprintf(dwdy, "%4.4f", (float)(int32_t)((cmd[19] & 0xffff0000) | ((cmd[23] >> 16) & 0xffff)) / 65536.0f);
-
+ sprintf(yl, "%4.4f", (float)((cmd[0] >> 32) & 0x1fff) / 4.0f);
+ sprintf(ym, "%4.4f", (float)((cmd[0] >> 16) & 0x1fff) / 4.0f);
+ sprintf(yh, "%4.4f", (float)((cmd[0] >> 0) & 0x1fff) / 4.0f);
+ sprintf(xl, "%4.4f", (float)int32_t(cmd[1] >> 32) / 65536.0f);
+ sprintf(dxldy, "%4.4f", (float)int32_t(cmd[1]) / 65536.0f);
+ sprintf(xh, "%4.4f", (float)int32_t(cmd[2] >> 32) / 65536.0f);
+ sprintf(dxhdy, "%4.4f", (float)int32_t(cmd[2]) / 65536.0f);
+ sprintf(xm, "%4.4f", (float)int32_t(cmd[3] >> 32) / 65536.0f);
+ sprintf(dxmdy, "%4.4f", (float)int32_t(cmd[3]) / 65536.0f);
+
+ sprintf(s, "%4.4f", (float)int32_t( ((cmd[4] >> 32) & 0xffff0000) | ((cmd[ 6] >> 48) & 0xffff)) / 65536.0f);
+ sprintf(t, "%4.4f", (float)int32_t((((cmd[4] >> 32) & 0x0000ffff) << 16) | ((cmd[ 6] >> 32) & 0xffff)) / 65536.0f);
+ sprintf(w, "%4.4f", (float)int32_t( (cmd[4] & 0xffff0000) | ((cmd[ 6] >> 16) & 0xffff)) / 65536.0f);
+ sprintf(dsdx, "%4.4f", (float)int32_t( ((cmd[5] >> 32) & 0xffff0000) | ((cmd[ 7] >> 48) & 0xffff)) / 65536.0f);
+ sprintf(dtdx, "%4.4f", (float)int32_t((((cmd[5] >> 32) & 0x0000ffff) << 16) | ((cmd[ 7] >> 32) & 0xffff)) / 65536.0f);
+ sprintf(dwdx, "%4.4f", (float)int32_t( (cmd[5] & 0xffff0000) | ((cmd[ 7] >> 16) & 0xffff)) / 65536.0f);
+ sprintf(dsde, "%4.4f", (float)int32_t( ((cmd[8] >> 32) & 0xffff0000) | ((cmd[10] >> 48) & 0xffff)) / 65536.0f);
+ sprintf(dtde, "%4.4f", (float)int32_t((((cmd[8] >> 32) & 0x0000ffff) << 16) | ((cmd[10] >> 32) & 0xffff)) / 65536.0f);
+ sprintf(dwde, "%4.4f", (float)int32_t( (cmd[8] & 0xffff0000) | ((cmd[10] >> 16) & 0xffff)) / 65536.0f);
+ sprintf(dsdy, "%4.4f", (float)int32_t( ((cmd[9] >> 32) & 0xffff0000) | ((cmd[11] >> 48) & 0xffff)) / 65536.0f);
+ sprintf(dtdy, "%4.4f", (float)int32_t((((cmd[9] >> 32) & 0x0000ffff) << 16) | ((cmd[11] >> 32) & 0xffff)) / 65536.0f);
+ sprintf(dwdy, "%4.4f", (float)int32_t( (cmd[9] & 0xffff0000) | ((cmd[11] >> 16) & 0xffff)) / 65536.0f);
buffer+=sprintf(buffer, "Tri_TexZ %d, XL: %s, XM: %s, XH: %s, YL: %s, YM: %s, YH: %s\n", lft, xl,xm,xh,yl,ym,yh);
buffer+=sprintf(buffer, " ");
@@ -1392,36 +1386,37 @@ void n64_rdp::disassemble(char* buffer)
return;
}
- for (int32_t i = 2; i < 24; i++)
+ for (int32_t i = 1; i < 12; i++)
{
cmd[i] = m_cmd_data[i];
}
- sprintf(yl, "%4.4f", (float)((cmd[0] >> 0) & 0x1fff) / 4.0f);
- sprintf(ym, "%4.4f", (float)((cmd[1] >> 16) & 0x1fff) / 4.0f);
- sprintf(yh, "%4.4f", (float)((cmd[1] >> 0) & 0x1fff) / 4.0f);
- sprintf(xl, "%4.4f", (float)((int32_t)cmd[2] / 65536.0f));
- sprintf(dxldy, "%4.4f", (float)((int32_t)cmd[3] / 65536.0f));
- sprintf(xh, "%4.4f", (float)((int32_t)cmd[4] / 65536.0f));
- sprintf(dxhdy, "%4.4f", (float)((int32_t)cmd[5] / 65536.0f));
- sprintf(xm, "%4.4f", (float)((int32_t)cmd[6] / 65536.0f));
- sprintf(dxmdy, "%4.4f", (float)((int32_t)cmd[7] / 65536.0f));
- sprintf(rt, "%4.4f", (float)(int32_t)((cmd[8] & 0xffff0000) | ((cmd[12] >> 16) & 0xffff)) / 65536.0f);
- sprintf(gt, "%4.4f", (float)(int32_t)(((cmd[8] & 0xffff) << 16) | (cmd[12] & 0xffff)) / 65536.0f);
- sprintf(bt, "%4.4f", (float)(int32_t)((cmd[9] & 0xffff0000) | ((cmd[13] >> 16) & 0xffff)) / 65536.0f);
- sprintf(at, "%4.4f", (float)(int32_t)(((cmd[9] & 0xffff) << 16) | (cmd[13] & 0xffff)) / 65536.0f);
- sprintf(drdx, "%4.4f", (float)(int32_t)((cmd[10] & 0xffff0000) | ((cmd[14] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dgdx, "%4.4f", (float)(int32_t)(((cmd[10] & 0xffff) << 16) | (cmd[14] & 0xffff)) / 65536.0f);
- sprintf(dbdx, "%4.4f", (float)(int32_t)((cmd[11] & 0xffff0000) | ((cmd[15] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dadx, "%4.4f", (float)(int32_t)(((cmd[11] & 0xffff) << 16) | (cmd[15] & 0xffff)) / 65536.0f);
- sprintf(drde, "%4.4f", (float)(int32_t)((cmd[16] & 0xffff0000) | ((cmd[20] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dgde, "%4.4f", (float)(int32_t)(((cmd[16] & 0xffff) << 16) | (cmd[20] & 0xffff)) / 65536.0f);
- sprintf(dbde, "%4.4f", (float)(int32_t)((cmd[17] & 0xffff0000) | ((cmd[21] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dade, "%4.4f", (float)(int32_t)(((cmd[17] & 0xffff) << 16) | (cmd[21] & 0xffff)) / 65536.0f);
- sprintf(drdy, "%4.4f", (float)(int32_t)((cmd[18] & 0xffff0000) | ((cmd[22] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dgdy, "%4.4f", (float)(int32_t)(((cmd[18] & 0xffff) << 16) | (cmd[22] & 0xffff)) / 65536.0f);
- sprintf(dbdy, "%4.4f", (float)(int32_t)((cmd[19] & 0xffff0000) | ((cmd[23] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dady, "%4.4f", (float)(int32_t)(((cmd[19] & 0xffff) << 16) | (cmd[23] & 0xffff)) / 65536.0f);
+ sprintf(yl, "%4.4f", (float)((cmd[0] >> 32) & 0x1fff) / 4.0f);
+ sprintf(ym, "%4.4f", (float)((cmd[0] >> 16) & 0x1fff) / 4.0f);
+ sprintf(yh, "%4.4f", (float)((cmd[0] >> 0) & 0x1fff) / 4.0f);
+ sprintf(xl, "%4.4f", (float)int32_t(cmd[1] >> 32) / 65536.0f);
+ sprintf(dxldy, "%4.4f", (float)int32_t(cmd[1]) / 65536.0f);
+ sprintf(xh, "%4.4f", (float)int32_t(cmd[2] >> 32) / 65536.0f);
+ sprintf(dxhdy, "%4.4f", (float)int32_t(cmd[2]) / 65536.0f);
+ sprintf(xm, "%4.4f", (float)int32_t(cmd[3] >> 32) / 65536.0f);
+ sprintf(dxmdy, "%4.4f", (float)int32_t(cmd[3]) / 65536.0f);
+
+ sprintf(rt, "%4.4f", (float)int32_t( ((cmd[4] >> 32) & 0xffff0000) | ((cmd[ 6] >> 48) & 0xffff)) / 65536.0f);
+ sprintf(gt, "%4.4f", (float)int32_t((((cmd[4] >> 32) & 0x0000ffff) << 16) | ((cmd[ 6] >> 32) & 0xffff)) / 65536.0f);
+ sprintf(bt, "%4.4f", (float)int32_t( (cmd[4] & 0xffff0000) | ((cmd[ 6] >> 16) & 0xffff)) / 65536.0f);
+ sprintf(at, "%4.4f", (float)int32_t( ((cmd[4] & 0x0000ffff) << 16) | ( cmd[ 6] & 0xffff)) / 65536.0f);
+ sprintf(drdx, "%4.4f", (float)int32_t( ((cmd[5] >> 32) & 0xffff0000) | ((cmd[ 7] >> 48) & 0xffff)) / 65536.0f);
+ sprintf(dgdx, "%4.4f", (float)int32_t((((cmd[5] >> 32) & 0x0000ffff) << 16) | ((cmd[ 7] >> 32) & 0xffff)) / 65536.0f);
+ sprintf(dbdx, "%4.4f", (float)int32_t( (cmd[5] & 0xffff0000) | ((cmd[ 7] >> 16) & 0xffff)) / 65536.0f);
+ sprintf(dadx, "%4.4f", (float)int32_t( ((cmd[5] & 0x0000ffff) << 16) | ( cmd[ 7] & 0xffff)) / 65536.0f);
+ sprintf(drde, "%4.4f", (float)int32_t( ((cmd[8] >> 32) & 0xffff0000) | ((cmd[10] >> 48) & 0xffff)) / 65536.0f);
+ sprintf(dgde, "%4.4f", (float)int32_t((((cmd[8] >> 32) & 0x0000ffff) << 16) | ((cmd[10] >> 32) & 0xffff)) / 65536.0f);
+ sprintf(dbde, "%4.4f", (float)int32_t( (cmd[8] & 0xffff0000) | ((cmd[10] >> 16) & 0xffff)) / 65536.0f);
+ sprintf(dade, "%4.4f", (float)int32_t( ((cmd[8] & 0x0000ffff) << 16) | ( cmd[10] & 0xffff)) / 65536.0f);
+ sprintf(drdy, "%4.4f", (float)int32_t( ((cmd[9] >> 32) & 0xffff0000) | ((cmd[11] >> 48) & 0xffff)) / 65536.0f);
+ sprintf(dgdy, "%4.4f", (float)int32_t((((cmd[9] >> 32) & 0x0000ffff) << 16) | ((cmd[11] >> 32) & 0xffff)) / 65536.0f);
+ sprintf(dbdy, "%4.4f", (float)int32_t( (cmd[9] & 0xffff0000) | ((cmd[11] >> 16) & 0xffff)) / 65536.0f);
+ sprintf(dady, "%4.4f", (float)int32_t( ((cmd[9] & 0x0000ffff) << 16) | ( cmd[11] & 0xffff)) / 65536.0f);
buffer+=sprintf(buffer, "Tri_Shade %d, XL: %s, XM: %s, XH: %s, YL: %s, YM: %s, YH: %s\n", lft, xl,xm,xh,yl,ym,yh);
buffer+=sprintf(buffer, " ");
@@ -1444,36 +1439,37 @@ void n64_rdp::disassemble(char* buffer)
return;
}
- for (int32_t i = 2; i < 24; i++)
+ for (int32_t i = 1; i < 12; i++)
{
cmd[i] = m_cmd_data[i];
}
- sprintf(yl, "%4.4f", (float)((cmd[0] >> 0) & 0x1fff) / 4.0f);
- sprintf(ym, "%4.4f", (float)((cmd[1] >> 16) & 0x1fff) / 4.0f);
- sprintf(yh, "%4.4f", (float)((cmd[1] >> 0) & 0x1fff) / 4.0f);
- sprintf(xl, "%4.4f", (float)((int32_t)cmd[2] / 65536.0f));
- sprintf(dxldy, "%4.4f", (float)((int32_t)cmd[3] / 65536.0f));
- sprintf(xh, "%4.4f", (float)((int32_t)cmd[4] / 65536.0f));
- sprintf(dxhdy, "%4.4f", (float)((int32_t)cmd[5] / 65536.0f));
- sprintf(xm, "%4.4f", (float)((int32_t)cmd[6] / 65536.0f));
- sprintf(dxmdy, "%4.4f", (float)((int32_t)cmd[7] / 65536.0f));
- sprintf(rt, "%4.4f", (float)(int32_t)((cmd[8] & 0xffff0000) | ((cmd[12] >> 16) & 0xffff)) / 65536.0f);
- sprintf(gt, "%4.4f", (float)(int32_t)(((cmd[8] & 0xffff) << 16) | (cmd[12] & 0xffff)) / 65536.0f);
- sprintf(bt, "%4.4f", (float)(int32_t)((cmd[9] & 0xffff0000) | ((cmd[13] >> 16) & 0xffff)) / 65536.0f);
- sprintf(at, "%4.4f", (float)(int32_t)(((cmd[9] & 0xffff) << 16) | (cmd[13] & 0xffff)) / 65536.0f);
- sprintf(drdx, "%4.4f", (float)(int32_t)((cmd[10] & 0xffff0000) | ((cmd[14] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dgdx, "%4.4f", (float)(int32_t)(((cmd[10] & 0xffff) << 16) | (cmd[14] & 0xffff)) / 65536.0f);
- sprintf(dbdx, "%4.4f", (float)(int32_t)((cmd[11] & 0xffff0000) | ((cmd[15] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dadx, "%4.4f", (float)(int32_t)(((cmd[11] & 0xffff) << 16) | (cmd[15] & 0xffff)) / 65536.0f);
- sprintf(drde, "%4.4f", (float)(int32_t)((cmd[16] & 0xffff0000) | ((cmd[20] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dgde, "%4.4f", (float)(int32_t)(((cmd[16] & 0xffff) << 16) | (cmd[20] & 0xffff)) / 65536.0f);
- sprintf(dbde, "%4.4f", (float)(int32_t)((cmd[17] & 0xffff0000) | ((cmd[21] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dade, "%4.4f", (float)(int32_t)(((cmd[17] & 0xffff) << 16) | (cmd[21] & 0xffff)) / 65536.0f);
- sprintf(drdy, "%4.4f", (float)(int32_t)((cmd[18] & 0xffff0000) | ((cmd[22] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dgdy, "%4.4f", (float)(int32_t)(((cmd[18] & 0xffff) << 16) | (cmd[22] & 0xffff)) / 65536.0f);
- sprintf(dbdy, "%4.4f", (float)(int32_t)((cmd[19] & 0xffff0000) | ((cmd[23] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dady, "%4.4f", (float)(int32_t)(((cmd[19] & 0xffff) << 16) | (cmd[23] & 0xffff)) / 65536.0f);
+ sprintf(yl, "%4.4f", (float)((cmd[0] >> 32) & 0x1fff) / 4.0f);
+ sprintf(ym, "%4.4f", (float)((cmd[0] >> 16) & 0x1fff) / 4.0f);
+ sprintf(yh, "%4.4f", (float)((cmd[0] >> 0) & 0x1fff) / 4.0f);
+ sprintf(xl, "%4.4f", (float)int32_t(cmd[1] >> 32) / 65536.0f);
+ sprintf(dxldy, "%4.4f", (float)int32_t(cmd[1]) / 65536.0f);
+ sprintf(xh, "%4.4f", (float)int32_t(cmd[2] >> 32) / 65536.0f);
+ sprintf(dxhdy, "%4.4f", (float)int32_t(cmd[2]) / 65536.0f);
+ sprintf(xm, "%4.4f", (float)int32_t(cmd[3] >> 32) / 65536.0f);
+ sprintf(dxmdy, "%4.4f", (float)int32_t(cmd[3]) / 65536.0f);
+
+ sprintf(rt, "%4.4f", (float)int32_t( ((cmd[4] >> 32) & 0xffff0000) | ((cmd[ 6] >> 48) & 0xffff)) / 65536.0f);
+ sprintf(gt, "%4.4f", (float)int32_t((((cmd[4] >> 32) & 0x0000ffff) << 16) | ((cmd[ 6] >> 32) & 0xffff)) / 65536.0f);
+ sprintf(bt, "%4.4f", (float)int32_t( (cmd[4] & 0xffff0000) | ((cmd[ 6] >> 16) & 0xffff)) / 65536.0f);
+ sprintf(at, "%4.4f", (float)int32_t( ((cmd[4] & 0x0000ffff) << 16) | ( cmd[ 6] & 0xffff)) / 65536.0f);
+ sprintf(drdx, "%4.4f", (float)int32_t( ((cmd[5] >> 32) & 0xffff0000) | ((cmd[ 7] >> 48) & 0xffff)) / 65536.0f);
+ sprintf(dgdx, "%4.4f", (float)int32_t((((cmd[5] >> 32) & 0x0000ffff) << 16) | ((cmd[ 7] >> 32) & 0xffff)) / 65536.0f);
+ sprintf(dbdx, "%4.4f", (float)int32_t( (cmd[5] & 0xffff0000) | ((cmd[ 7] >> 16) & 0xffff)) / 65536.0f);
+ sprintf(dadx, "%4.4f", (float)int32_t( ((cmd[5] & 0x0000ffff) << 16) | ( cmd[ 7] & 0xffff)) / 65536.0f);
+ sprintf(drde, "%4.4f", (float)int32_t( ((cmd[8] >> 32) & 0xffff0000) | ((cmd[10] >> 48) & 0xffff)) / 65536.0f);
+ sprintf(dgde, "%4.4f", (float)int32_t((((cmd[8] >> 32) & 0x0000ffff) << 16) | ((cmd[10] >> 32) & 0xffff)) / 65536.0f);
+ sprintf(dbde, "%4.4f", (float)int32_t( (cmd[8] & 0xffff0000) | ((cmd[10] >> 16) & 0xffff)) / 65536.0f);
+ sprintf(dade, "%4.4f", (float)int32_t( ((cmd[8] & 0x0000ffff) << 16) | ( cmd[10] & 0xffff)) / 65536.0f);
+ sprintf(drdy, "%4.4f", (float)int32_t( ((cmd[9] >> 32) & 0xffff0000) | ((cmd[11] >> 48) & 0xffff)) / 65536.0f);
+ sprintf(dgdy, "%4.4f", (float)int32_t((((cmd[9] >> 32) & 0x0000ffff) << 16) | ((cmd[11] >> 32) & 0xffff)) / 65536.0f);
+ sprintf(dbdy, "%4.4f", (float)int32_t( (cmd[9] & 0xffff0000) | ((cmd[11] >> 16) & 0xffff)) / 65536.0f);
+ sprintf(dady, "%4.4f", (float)int32_t( ((cmd[9] & 0x0000ffff) << 16) | ( cmd[11] & 0xffff)) / 65536.0f);
buffer+=sprintf(buffer, "Tri_ShadeZ %d, XL: %s, XM: %s, XH: %s, YL: %s, YM: %s, YH: %s\n", lft, xl,xm,xh,yl,ym,yh);
buffer+=sprintf(buffer, " ");
@@ -1496,50 +1492,50 @@ void n64_rdp::disassemble(char* buffer)
return;
}
- for (int32_t i = 2; i < 40; i++)
+ for (int32_t i = 1; i < 20; i++)
{
cmd[i] = m_cmd_data[m_cmd_cur+i];
}
- sprintf(yl, "%4.4f", (float)((cmd[0] >> 0) & 0x1fff) / 4.0f);
- sprintf(ym, "%4.4f", (float)((cmd[1] >> 16) & 0x1fff) / 4.0f);
- sprintf(yh, "%4.4f", (float)((cmd[1] >> 0) & 0x1fff) / 4.0f);
- sprintf(xl, "%4.4f", (float)((int32_t)cmd[2] / 65536.0f));
- sprintf(dxldy, "%4.4f", (float)((int32_t)cmd[3] / 65536.0f));
- sprintf(xh, "%4.4f", (float)((int32_t)cmd[4] / 65536.0f));
- sprintf(dxhdy, "%4.4f", (float)((int32_t)cmd[5] / 65536.0f));
- sprintf(xm, "%4.4f", (float)((int32_t)cmd[6] / 65536.0f));
- sprintf(dxmdy, "%4.4f", (float)((int32_t)cmd[7] / 65536.0f));
- sprintf(rt, "%4.4f", (float)(int32_t)((cmd[8] & 0xffff0000) | ((cmd[12] >> 16) & 0xffff)) / 65536.0f);
- sprintf(gt, "%4.4f", (float)(int32_t)(((cmd[8] & 0xffff) << 16) | (cmd[12] & 0xffff)) / 65536.0f);
- sprintf(bt, "%4.4f", (float)(int32_t)((cmd[9] & 0xffff0000) | ((cmd[13] >> 16) & 0xffff)) / 65536.0f);
- sprintf(at, "%4.4f", (float)(int32_t)(((cmd[9] & 0xffff) << 16) | (cmd[13] & 0xffff)) / 65536.0f);
- sprintf(drdx, "%4.4f", (float)(int32_t)((cmd[10] & 0xffff0000) | ((cmd[14] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dgdx, "%4.4f", (float)(int32_t)(((cmd[10] & 0xffff) << 16) | (cmd[14] & 0xffff)) / 65536.0f);
- sprintf(dbdx, "%4.4f", (float)(int32_t)((cmd[11] & 0xffff0000) | ((cmd[15] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dadx, "%4.4f", (float)(int32_t)(((cmd[11] & 0xffff) << 16) | (cmd[15] & 0xffff)) / 65536.0f);
- sprintf(drde, "%4.4f", (float)(int32_t)((cmd[16] & 0xffff0000) | ((cmd[20] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dgde, "%4.4f", (float)(int32_t)(((cmd[16] & 0xffff) << 16) | (cmd[20] & 0xffff)) / 65536.0f);
- sprintf(dbde, "%4.4f", (float)(int32_t)((cmd[17] & 0xffff0000) | ((cmd[21] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dade, "%4.4f", (float)(int32_t)(((cmd[17] & 0xffff) << 16) | (cmd[21] & 0xffff)) / 65536.0f);
- sprintf(drdy, "%4.4f", (float)(int32_t)((cmd[18] & 0xffff0000) | ((cmd[22] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dgdy, "%4.4f", (float)(int32_t)(((cmd[18] & 0xffff) << 16) | (cmd[22] & 0xffff)) / 65536.0f);
- sprintf(dbdy, "%4.4f", (float)(int32_t)((cmd[19] & 0xffff0000) | ((cmd[23] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dady, "%4.4f", (float)(int32_t)(((cmd[19] & 0xffff) << 16) | (cmd[23] & 0xffff)) / 65536.0f);
-
- sprintf(s, "%4.4f", (float)(int32_t)((cmd[24] & 0xffff0000) | ((cmd[28] >> 16) & 0xffff)) / 65536.0f);
- sprintf(t, "%4.4f", (float)(int32_t)(((cmd[24] & 0xffff) << 16) | (cmd[28] & 0xffff)) / 65536.0f);
- sprintf(w, "%4.4f", (float)(int32_t)((cmd[25] & 0xffff0000) | ((cmd[29] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dsdx, "%4.4f", (float)(int32_t)((cmd[26] & 0xffff0000) | ((cmd[30] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dtdx, "%4.4f", (float)(int32_t)(((cmd[26] & 0xffff) << 16) | (cmd[30] & 0xffff)) / 65536.0f);
- sprintf(dwdx, "%4.4f", (float)(int32_t)((cmd[27] & 0xffff0000) | ((cmd[31] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dsde, "%4.4f", (float)(int32_t)((cmd[32] & 0xffff0000) | ((cmd[36] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dtde, "%4.4f", (float)(int32_t)(((cmd[32] & 0xffff) << 16) | (cmd[36] & 0xffff)) / 65536.0f);
- sprintf(dwde, "%4.4f", (float)(int32_t)((cmd[33] & 0xffff0000) | ((cmd[37] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dsdy, "%4.4f", (float)(int32_t)((cmd[34] & 0xffff0000) | ((cmd[38] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dtdy, "%4.4f", (float)(int32_t)(((cmd[34] & 0xffff) << 16) | (cmd[38] & 0xffff)) / 65536.0f);
- sprintf(dwdy, "%4.4f", (float)(int32_t)((cmd[35] & 0xffff0000) | ((cmd[39] >> 16) & 0xffff)) / 65536.0f);
-
+ sprintf(yl, "%4.4f", (float)((cmd[0] >> 32) & 0x1fff) / 4.0f);
+ sprintf(ym, "%4.4f", (float)((cmd[0] >> 16) & 0x1fff) / 4.0f);
+ sprintf(yh, "%4.4f", (float)((cmd[0] >> 0) & 0x1fff) / 4.0f);
+ sprintf(xl, "%4.4f", (float)int32_t(cmd[1] >> 32) / 65536.0f);
+ sprintf(dxldy, "%4.4f", (float)int32_t(cmd[1]) / 65536.0f);
+ sprintf(xh, "%4.4f", (float)int32_t(cmd[2] >> 32) / 65536.0f);
+ sprintf(dxhdy, "%4.4f", (float)int32_t(cmd[2]) / 65536.0f);
+ sprintf(xm, "%4.4f", (float)int32_t(cmd[3] >> 32) / 65536.0f);
+ sprintf(dxmdy, "%4.4f", (float)int32_t(cmd[3]) / 65536.0f);
+
+ sprintf(rt, "%4.4f", (float)int32_t( ((cmd[4] >> 32) & 0xffff0000) | ((cmd[ 6] >> 48) & 0xffff)) / 65536.0f);
+ sprintf(gt, "%4.4f", (float)int32_t((((cmd[4] >> 32) & 0x0000ffff) << 16) | ((cmd[ 6] >> 32) & 0xffff)) / 65536.0f);
+ sprintf(bt, "%4.4f", (float)int32_t( (cmd[4] & 0xffff0000) | ((cmd[ 6] >> 16) & 0xffff)) / 65536.0f);
+ sprintf(at, "%4.4f", (float)int32_t( ((cmd[4] & 0x0000ffff) << 16) | ( cmd[ 6] & 0xffff)) / 65536.0f);
+ sprintf(drdx, "%4.4f", (float)int32_t( ((cmd[5] >> 32) & 0xffff0000) | ((cmd[ 7] >> 48) & 0xffff)) / 65536.0f);
+ sprintf(dgdx, "%4.4f", (float)int32_t((((cmd[5] >> 32) & 0x0000ffff) << 16) | ((cmd[ 7] >> 32) & 0xffff)) / 65536.0f);
+ sprintf(dbdx, "%4.4f", (float)int32_t( (cmd[5] & 0xffff0000) | ((cmd[ 7] >> 16) & 0xffff)) / 65536.0f);
+ sprintf(dadx, "%4.4f", (float)int32_t( ((cmd[5] & 0x0000ffff) << 16) | ( cmd[ 7] & 0xffff)) / 65536.0f);
+ sprintf(drde, "%4.4f", (float)int32_t( ((cmd[8] >> 32) & 0xffff0000) | ((cmd[10] >> 48) & 0xffff)) / 65536.0f);
+ sprintf(dgde, "%4.4f", (float)int32_t((((cmd[8] >> 32) & 0x0000ffff) << 16) | ((cmd[10] >> 32) & 0xffff)) / 65536.0f);
+ sprintf(dbde, "%4.4f", (float)int32_t( (cmd[8] & 0xffff0000) | ((cmd[10] >> 16) & 0xffff)) / 65536.0f);
+ sprintf(dade, "%4.4f", (float)int32_t( ((cmd[8] & 0x0000ffff) << 16) | ( cmd[10] & 0xffff)) / 65536.0f);
+ sprintf(drdy, "%4.4f", (float)int32_t( ((cmd[9] >> 32) & 0xffff0000) | ((cmd[11] >> 48) & 0xffff)) / 65536.0f);
+ sprintf(dgdy, "%4.4f", (float)int32_t((((cmd[9] >> 32) & 0x0000ffff) << 16) | ((cmd[11] >> 32) & 0xffff)) / 65536.0f);
+ sprintf(dbdy, "%4.4f", (float)int32_t( (cmd[9] & 0xffff0000) | ((cmd[11] >> 16) & 0xffff)) / 65536.0f);
+ sprintf(dady, "%4.4f", (float)int32_t( ((cmd[9] & 0x0000ffff) << 16) | ( cmd[11] & 0xffff)) / 65536.0f);
+
+ sprintf(s, "%4.4f", (float)int32_t( ((cmd[4] >> 32) & 0xffff0000) | ((cmd[ 6] >> 48) & 0xffff)) / 65536.0f);
+ sprintf(t, "%4.4f", (float)int32_t((((cmd[4] >> 32) & 0x0000ffff) << 16) | ((cmd[ 6] >> 32) & 0xffff)) / 65536.0f);
+ sprintf(w, "%4.4f", (float)int32_t( (cmd[4] & 0xffff0000) | ((cmd[ 6] >> 16) & 0xffff)) / 65536.0f);
+ sprintf(dsdx, "%4.4f", (float)int32_t( ((cmd[5] >> 32) & 0xffff0000) | ((cmd[ 7] >> 48) & 0xffff)) / 65536.0f);
+ sprintf(dtdx, "%4.4f", (float)int32_t((((cmd[5] >> 32) & 0x0000ffff) << 16) | ((cmd[ 7] >> 32) & 0xffff)) / 65536.0f);
+ sprintf(dwdx, "%4.4f", (float)int32_t( (cmd[5] & 0xffff0000) | ((cmd[ 7] >> 16) & 0xffff)) / 65536.0f);
+ sprintf(dsde, "%4.4f", (float)int32_t( ((cmd[8] >> 32) & 0xffff0000) | ((cmd[10] >> 48) & 0xffff)) / 65536.0f);
+ sprintf(dtde, "%4.4f", (float)int32_t((((cmd[8] >> 32) & 0x0000ffff) << 16) | ((cmd[10] >> 32) & 0xffff)) / 65536.0f);
+ sprintf(dwde, "%4.4f", (float)int32_t( (cmd[8] & 0xffff0000) | ((cmd[10] >> 16) & 0xffff)) / 65536.0f);
+ sprintf(dsdy, "%4.4f", (float)int32_t( ((cmd[9] >> 32) & 0xffff0000) | ((cmd[11] >> 48) & 0xffff)) / 65536.0f);
+ sprintf(dtdy, "%4.4f", (float)int32_t((((cmd[9] >> 32) & 0x0000ffff) << 16) | ((cmd[11] >> 32) & 0xffff)) / 65536.0f);
+ sprintf(dwdy, "%4.4f", (float)int32_t( (cmd[9] & 0xffff0000) | ((cmd[11] >> 16) & 0xffff)) / 65536.0f);
buffer+=sprintf(buffer, "Tri_TexShade %d, XL: %s, XM: %s, XH: %s, YL: %s, YM: %s, YH: %s\n", lft, xl,xm,xh,yl,ym,yh);
buffer+=sprintf(buffer, " ");
@@ -1571,50 +1567,50 @@ void n64_rdp::disassemble(char* buffer)
return;
}
- for (int32_t i = 2; i < 40; i++)
+ for (int32_t i = 1; i < 20; i++)
{
cmd[i] = m_cmd_data[m_cmd_cur+i];
}
- sprintf(yl, "%4.4f", (float)((cmd[0] >> 0) & 0x1fff) / 4.0f);
- sprintf(ym, "%4.4f", (float)((cmd[1] >> 16) & 0x1fff) / 4.0f);
- sprintf(yh, "%4.4f", (float)((cmd[1] >> 0) & 0x1fff) / 4.0f);
- sprintf(xl, "%4.4f", (float)((int32_t)cmd[2] / 65536.0f));
- sprintf(dxldy, "%4.4f", (float)((int32_t)cmd[3] / 65536.0f));
- sprintf(xh, "%4.4f", (float)((int32_t)cmd[4] / 65536.0f));
- sprintf(dxhdy, "%4.4f", (float)((int32_t)cmd[5] / 65536.0f));
- sprintf(xm, "%4.4f", (float)((int32_t)cmd[6] / 65536.0f));
- sprintf(dxmdy, "%4.4f", (float)((int32_t)cmd[7] / 65536.0f));
- sprintf(rt, "%4.4f", (float)(int32_t)((cmd[8] & 0xffff0000) | ((cmd[12] >> 16) & 0xffff)) / 65536.0f);
- sprintf(gt, "%4.4f", (float)(int32_t)(((cmd[8] & 0xffff) << 16) | (cmd[12] & 0xffff)) / 65536.0f);
- sprintf(bt, "%4.4f", (float)(int32_t)((cmd[9] & 0xffff0000) | ((cmd[13] >> 16) & 0xffff)) / 65536.0f);
- sprintf(at, "%4.4f", (float)(int32_t)(((cmd[9] & 0xffff) << 16) | (cmd[13] & 0xffff)) / 65536.0f);
- sprintf(drdx, "%4.4f", (float)(int32_t)((cmd[10] & 0xffff0000) | ((cmd[14] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dgdx, "%4.4f", (float)(int32_t)(((cmd[10] & 0xffff) << 16) | (cmd[14] & 0xffff)) / 65536.0f);
- sprintf(dbdx, "%4.4f", (float)(int32_t)((cmd[11] & 0xffff0000) | ((cmd[15] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dadx, "%4.4f", (float)(int32_t)(((cmd[11] & 0xffff) << 16) | (cmd[15] & 0xffff)) / 65536.0f);
- sprintf(drde, "%4.4f", (float)(int32_t)((cmd[16] & 0xffff0000) | ((cmd[20] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dgde, "%4.4f", (float)(int32_t)(((cmd[16] & 0xffff) << 16) | (cmd[20] & 0xffff)) / 65536.0f);
- sprintf(dbde, "%4.4f", (float)(int32_t)((cmd[17] & 0xffff0000) | ((cmd[21] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dade, "%4.4f", (float)(int32_t)(((cmd[17] & 0xffff) << 16) | (cmd[21] & 0xffff)) / 65536.0f);
- sprintf(drdy, "%4.4f", (float)(int32_t)((cmd[18] & 0xffff0000) | ((cmd[22] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dgdy, "%4.4f", (float)(int32_t)(((cmd[18] & 0xffff) << 16) | (cmd[22] & 0xffff)) / 65536.0f);
- sprintf(dbdy, "%4.4f", (float)(int32_t)((cmd[19] & 0xffff0000) | ((cmd[23] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dady, "%4.4f", (float)(int32_t)(((cmd[19] & 0xffff) << 16) | (cmd[23] & 0xffff)) / 65536.0f);
-
- sprintf(s, "%4.4f", (float)(int32_t)((cmd[24] & 0xffff0000) | ((cmd[28] >> 16) & 0xffff)) / 65536.0f);
- sprintf(t, "%4.4f", (float)(int32_t)(((cmd[24] & 0xffff) << 16) | (cmd[28] & 0xffff)) / 65536.0f);
- sprintf(w, "%4.4f", (float)(int32_t)((cmd[25] & 0xffff0000) | ((cmd[29] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dsdx, "%4.4f", (float)(int32_t)((cmd[26] & 0xffff0000) | ((cmd[30] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dtdx, "%4.4f", (float)(int32_t)(((cmd[26] & 0xffff) << 16) | (cmd[30] & 0xffff)) / 65536.0f);
- sprintf(dwdx, "%4.4f", (float)(int32_t)((cmd[27] & 0xffff0000) | ((cmd[31] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dsde, "%4.4f", (float)(int32_t)((cmd[32] & 0xffff0000) | ((cmd[36] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dtde, "%4.4f", (float)(int32_t)(((cmd[32] & 0xffff) << 16) | (cmd[36] & 0xffff)) / 65536.0f);
- sprintf(dwde, "%4.4f", (float)(int32_t)((cmd[33] & 0xffff0000) | ((cmd[37] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dsdy, "%4.4f", (float)(int32_t)((cmd[34] & 0xffff0000) | ((cmd[38] >> 16) & 0xffff)) / 65536.0f);
- sprintf(dtdy, "%4.4f", (float)(int32_t)(((cmd[34] & 0xffff) << 16) | (cmd[38] & 0xffff)) / 65536.0f);
- sprintf(dwdy, "%4.4f", (float)(int32_t)((cmd[35] & 0xffff0000) | ((cmd[39] >> 16) & 0xffff)) / 65536.0f);
-
+ sprintf(yl, "%4.4f", (float)((cmd[0] >> 32) & 0x1fff) / 4.0f);
+ sprintf(ym, "%4.4f", (float)((cmd[0] >> 16) & 0x1fff) / 4.0f);
+ sprintf(yh, "%4.4f", (float)((cmd[0] >> 0) & 0x1fff) / 4.0f);
+ sprintf(xl, "%4.4f", (float)int32_t(cmd[1] >> 32) / 65536.0f);
+ sprintf(dxldy, "%4.4f", (float)int32_t(cmd[1]) / 65536.0f);
+ sprintf(xh, "%4.4f", (float)int32_t(cmd[2] >> 32) / 65536.0f);
+ sprintf(dxhdy, "%4.4f", (float)int32_t(cmd[2]) / 65536.0f);
+ sprintf(xm, "%4.4f", (float)int32_t(cmd[3] >> 32) / 65536.0f);
+ sprintf(dxmdy, "%4.4f", (float)int32_t(cmd[3]) / 65536.0f);
+
+ sprintf(rt, "%4.4f", (float)int32_t( ((cmd[4] >> 32) & 0xffff0000) | ((cmd[ 6] >> 48) & 0xffff)) / 65536.0f);
+ sprintf(gt, "%4.4f", (float)int32_t((((cmd[4] >> 32) & 0x0000ffff) << 16) | ((cmd[ 6] >> 32) & 0xffff)) / 65536.0f);
+ sprintf(bt, "%4.4f", (float)int32_t( (cmd[4] & 0xffff0000) | ((cmd[ 6] >> 16) & 0xffff)) / 65536.0f);
+ sprintf(at, "%4.4f", (float)int32_t( ((cmd[4] & 0x0000ffff) << 16) | ( cmd[ 6] & 0xffff)) / 65536.0f);
+ sprintf(drdx, "%4.4f", (float)int32_t( ((cmd[5] >> 32) & 0xffff0000) | ((cmd[ 7] >> 48) & 0xffff)) / 65536.0f);
+ sprintf(dgdx, "%4.4f", (float)int32_t((((cmd[5] >> 32) & 0x0000ffff) << 16) | ((cmd[ 7] >> 32) & 0xffff)) / 65536.0f);
+ sprintf(dbdx, "%4.4f", (float)int32_t( (cmd[5] & 0xffff0000) | ((cmd[ 7] >> 16) & 0xffff)) / 65536.0f);
+ sprintf(dadx, "%4.4f", (float)int32_t( ((cmd[5] & 0x0000ffff) << 16) | ( cmd[ 7] & 0xffff)) / 65536.0f);
+ sprintf(drde, "%4.4f", (float)int32_t( ((cmd[8] >> 32) & 0xffff0000) | ((cmd[10] >> 48) & 0xffff)) / 65536.0f);
+ sprintf(dgde, "%4.4f", (float)int32_t((((cmd[8] >> 32) & 0x0000ffff) << 16) | ((cmd[10] >> 32) & 0xffff)) / 65536.0f);
+ sprintf(dbde, "%4.4f", (float)int32_t( (cmd[8] & 0xffff0000) | ((cmd[10] >> 16) & 0xffff)) / 65536.0f);
+ sprintf(dade, "%4.4f", (float)int32_t( ((cmd[8] & 0x0000ffff) << 16) | ( cmd[10] & 0xffff)) / 65536.0f);
+ sprintf(drdy, "%4.4f", (float)int32_t( ((cmd[9] >> 32) & 0xffff0000) | ((cmd[11] >> 48) & 0xffff)) / 65536.0f);
+ sprintf(dgdy, "%4.4f", (float)int32_t((((cmd[9] >> 32) & 0x0000ffff) << 16) | ((cmd[11] >> 32) & 0xffff)) / 65536.0f);
+ sprintf(dbdy, "%4.4f", (float)int32_t( (cmd[9] & 0xffff0000) | ((cmd[11] >> 16) & 0xffff)) / 65536.0f);
+ sprintf(dady, "%4.4f", (float)int32_t( ((cmd[9] & 0x0000ffff) << 16) | ( cmd[11] & 0xffff)) / 65536.0f);
+
+ sprintf(s, "%4.4f", (float)int32_t( ((cmd[4] >> 32) & 0xffff0000) | ((cmd[ 6] >> 48) & 0xffff)) / 65536.0f);
+ sprintf(t, "%4.4f", (float)int32_t((((cmd[4] >> 32) & 0x0000ffff) << 16) | ((cmd[ 6] >> 32) & 0xffff)) / 65536.0f);
+ sprintf(w, "%4.4f", (float)int32_t( (cmd[4] & 0xffff0000) | ((cmd[ 6] >> 16) & 0xffff)) / 65536.0f);
+ sprintf(dsdx, "%4.4f", (float)int32_t( ((cmd[5] >> 32) & 0xffff0000) | ((cmd[ 7] >> 48) & 0xffff)) / 65536.0f);
+ sprintf(dtdx, "%4.4f", (float)int32_t((((cmd[5] >> 32) & 0x0000ffff) << 16) | ((cmd[ 7] >> 32) & 0xffff)) / 65536.0f);
+ sprintf(dwdx, "%4.4f", (float)int32_t( (cmd[5] & 0xffff0000) | ((cmd[ 7] >> 16) & 0xffff)) / 65536.0f);
+ sprintf(dsde, "%4.4f", (float)int32_t( ((cmd[8] >> 32) & 0xffff0000) | ((cmd[10] >> 48) & 0xffff)) / 65536.0f);
+ sprintf(dtde, "%4.4f", (float)int32_t((((cmd[8] >> 32) & 0x0000ffff) << 16) | ((cmd[10] >> 32) & 0xffff)) / 65536.0f);
+ sprintf(dwde, "%4.4f", (float)int32_t( (cmd[8] & 0xffff0000) | ((cmd[10] >> 16) & 0xffff)) / 65536.0f);
+ sprintf(dsdy, "%4.4f", (float)int32_t( ((cmd[9] >> 32) & 0xffff0000) | ((cmd[11] >> 48) & 0xffff)) / 65536.0f);
+ sprintf(dtdy, "%4.4f", (float)int32_t((((cmd[9] >> 32) & 0x0000ffff) << 16) | ((cmd[11] >> 32) & 0xffff)) / 65536.0f);
+ sprintf(dwdy, "%4.4f", (float)int32_t( (cmd[9] & 0xffff0000) | ((cmd[11] >> 16) & 0xffff)) / 65536.0f);
buffer+=sprintf(buffer, "Tri_TexShadeZ %d, XL: %s, XM: %s, XH: %s, YL: %s, YM: %s, YH: %s\n", lft, xl,xm,xh,yl,ym,yh);
buffer+=sprintf(buffer, " ");
@@ -1644,12 +1640,12 @@ void n64_rdp::disassemble(char* buffer)
sprintf(buffer, "ERROR: Texture_Rectangle length = %d\n", length);
return;
}
- cmd[2] = m_cmd_data[m_cmd_cur+2];
- cmd[3] = m_cmd_data[m_cmd_cur+3];
- sprintf(s, "%4.4f", (float)(int16_t)((cmd[2] >> 16) & 0xffff) / 32.0f);
- sprintf(t, "%4.4f", (float)(int16_t)((cmd[2] >> 0) & 0xffff) / 32.0f);
- sprintf(dsdx, "%4.4f", (float)(int16_t)((cmd[3] >> 16) & 0xffff) / 1024.0f);
- sprintf(dtdy, "%4.4f", (float)(int16_t)((cmd[3] >> 16) & 0xffff) / 1024.0f);
+
+ cmd[1] = m_cmd_data[m_cmd_cur+1];
+ sprintf(s, "%4.4f", (float)int16_t((cmd[1] >> 48) & 0xffff) / 32.0f);
+ sprintf(t, "%4.4f", (float)int16_t((cmd[1] >> 32) & 0xffff) / 32.0f);
+ sprintf(dsdx, "%4.4f", (float)int16_t((cmd[1] >> 16) & 0xffff) / 1024.0f);
+ sprintf(dtdy, "%4.4f", (float)int16_t((cmd[1] >> 0) & 0xffff) / 1024.0f);
if (command == 0x24)
sprintf(buffer, "Texture_Rectangle %d, %s, %s, %s, %s, %s, %s, %s, %s", tile, sh, th, sl, tl, s, t, dsdx, dtdy);
@@ -1663,24 +1659,24 @@ void n64_rdp::disassemble(char* buffer)
case 0x28: sprintf(buffer, "Sync_Tile"); break;
case 0x29: sprintf(buffer, "Sync_Full"); break;
case 0x2d: sprintf(buffer, "Set_Scissor %s, %s, %s, %s", sl, tl, sh, th); break;
- case 0x2e: sprintf(buffer, "Set_Prim_Depth %04X, %04X", (cmd[1] >> 16) & 0xffff, cmd[1] & 0xffff); break;
- case 0x2f: sprintf(buffer, "Set_Other_Modes %08X %08X", cmd[0], cmd[1]); break;
+ case 0x2e: sprintf(buffer, "Set_Prim_Depth %04X, %04X", uint32_t(cmd[0] >> 16) & 0xffff, (uint32_t)cmd[0] & 0xffff); break;
+ case 0x2f: sprintf(buffer, "Set_Other_Modes %08X %08X", uint32_t(cmd[0] >> 32), (uint32_t)cmd[0]); break;
case 0x30: sprintf(buffer, "Load_TLUT %d, %s, %s, %s, %s", tile, sl, tl, sh, th); break;
case 0x32: sprintf(buffer, "Set_Tile_Size %d, %s, %s, %s, %s", tile, sl, tl, sh, th); break;
- case 0x33: sprintf(buffer, "Load_Block %d, %03X, %03X, %03X, %03X", tile, (cmd[0] >> 12) & 0xfff, cmd[0] & 0xfff, (cmd[1] >> 12) & 0xfff, cmd[1] & 0xfff); break;
+ case 0x33: sprintf(buffer, "Load_Block %d, %03X, %03X, %03X, %03X", tile, uint32_t(cmd[0] >> 44) & 0xfff, uint32_t(cmd[0] >> 32) & 0xfff, uint32_t(cmd[0] >> 12) & 0xfff, uint32_t(cmd[1]) & 0xfff); break;
case 0x34: sprintf(buffer, "Load_Tile %d, %s, %s, %s, %s", tile, sl, tl, sh, th); break;
- case 0x35: sprintf(buffer, "Set_Tile %d, %s, %s, %d, %04X", tile, format, size, ((cmd[0] >> 9) & 0x1ff) * 8, (cmd[0] & 0x1ff) * 8); break;
+ case 0x35: sprintf(buffer, "Set_Tile %d, %s, %s, %d, %04X", tile, format, size, (uint32_t(cmd[0] >> 41) & 0x1ff) * 8, (uint32_t(cmd[0] >> 32) & 0x1ff) * 8); break;
case 0x36: sprintf(buffer, "Fill_Rectangle %s, %s, %s, %s", sh, th, sl, tl); break;
case 0x37: sprintf(buffer, "Set_Fill_Color R: %d, G: %d, B: %d, A: %d", r, g, b, a); break;
case 0x38: sprintf(buffer, "Set_Fog_Color R: %d, G: %d, B: %d, A: %d", r, g, b, a); break;
case 0x39: sprintf(buffer, "Set_Blend_Color R: %d, G: %d, B: %d, A: %d", r, g, b, a); break;
- case 0x3a: sprintf(buffer, "Set_Prim_Color %d, %d, R: %d, G: %d, B: %d, A: %d", (cmd[0] >> 8) & 0x1f, cmd[0] & 0xff, r, g, b, a); break;
+ case 0x3a: sprintf(buffer, "Set_Prim_Color %d, %d, R: %d, G: %d, B: %d, A: %d", uint32_t(cmd[0] >> 40) & 0x1f, uint32_t(cmd[0] >> 32) & 0xff, r, g, b, a); break;
case 0x3b: sprintf(buffer, "Set_Env_Color R: %d, G: %d, B: %d, A: %d", r, g, b, a); break;
- case 0x3c: sprintf(buffer, "Set_Combine %08X %08X", cmd[0], cmd[1]); break;
- case 0x3d: sprintf(buffer, "Set_Texture_Image %s, %s, %d, %08X", format, size, (cmd[0] & 0x1ff)+1, cmd[1]); break;
- case 0x3e: sprintf(buffer, "Set_Mask_Image %08X", cmd[1]); break;
- case 0x3f: sprintf(buffer, "Set_Color_Image %s, %s, %d, %08X", format, size, (cmd[0] & 0x1ff)+1, cmd[1]); break;
- default: sprintf(buffer, "Unknown (%08X %08X)", cmd[0], cmd[1]); break;
+ case 0x3c: sprintf(buffer, "Set_Combine %08X %08X", uint32_t(cmd[0] >> 32), (uint32_t)cmd[0]); break;
+ case 0x3d: sprintf(buffer, "Set_Texture_Image %s, %s, %d, %08X", format, size, (uint32_t(cmd[0] >> 32) & 0x1ff) + 1, (uint32_t)cmd[0]); break;
+ case 0x3e: sprintf(buffer, "Set_Mask_Image %08X", (uint32_t)cmd[0]); break;
+ case 0x3f: sprintf(buffer, "Set_Color_Image %s, %s, %d, %08X", format, size, (uint32_t(cmd[0] >> 32) & 0x1ff) + 1, (uint32_t)cmd[0]); break;
+ default: sprintf(buffer, "Unknown (%08X %08X)", uint32_t(cmd[0] >> 32), (uint32_t)cmd[0]); break;
}
}
@@ -1865,16 +1861,17 @@ void n64_rdp::compute_cvg_flip(extent_t* spans, int32_t* majorx, int32_t* minorx
}
}
+#define SIGN(x, numb) (((x) & ((1 << numb) - 1)) | -((x) & (1 << (numb - 1))))
+
void n64_rdp::draw_triangle(bool shade, bool texture, bool zbuffer, bool rect)
{
- const uint32_t* cmd_data = rect ? m_temp_rect_data : m_cmd_data;
+ const uint64_t* cmd_data = rect ? m_temp_rect_data : m_cmd_data;
const uint32_t fifo_index = rect ? 0 : m_cmd_cur;
- const uint32_t w1 = cmd_data[fifo_index + 0];
- const uint32_t w2 = cmd_data[fifo_index + 1];
+ const uint64_t w1 = cmd_data[fifo_index + 0];
- int32_t flip = (w1 & 0x00800000) ? 1 : 0;
- m_misc_state.m_max_level = ((w1 >> 19) & 7);
- int32_t tilenum = (w1 >> 16) & 0x7;
+ int32_t flip = int32_t(w1 >> 55) & 1;
+ m_misc_state.m_max_level = uint32_t(w1 >> 51) & 7;
+ int32_t tilenum = int32_t(w1 >> 48) & 0x7;
int32_t dsdiff = 0, dtdiff = 0, dwdiff = 0, drdiff = 0, dgdiff = 0, dbdiff = 0, dadiff = 0, dzdiff = 0;
int32_t dsdeh = 0, dtdeh = 0, dwdeh = 0, drdeh = 0, dgdeh = 0, dbdeh = 0, dadeh = 0, dzdeh = 0;
@@ -1886,36 +1883,33 @@ void n64_rdp::draw_triangle(bool shade, bool texture, bool zbuffer, bool rect)
int32_t maxxhx = 0;
int32_t minxhx = 0;
- int32_t shade_base = fifo_index + 8;
- int32_t texture_base = fifo_index + 8;
- int32_t zbuffer_base = fifo_index + 8;
+ int32_t shade_base = fifo_index + 4;
+ int32_t texture_base = fifo_index + 4;
+ int32_t zbuffer_base = fifo_index + 4;
if(shade)
{
- texture_base += 16;
- zbuffer_base += 16;
+ texture_base += 8;
+ zbuffer_base += 8;
}
if(texture)
{
- zbuffer_base += 16;
+ zbuffer_base += 8;
}
- uint32_t w3 = cmd_data[fifo_index + 2];
- uint32_t w4 = cmd_data[fifo_index + 3];
- uint32_t w5 = cmd_data[fifo_index + 4];
- uint32_t w6 = cmd_data[fifo_index + 5];
- uint32_t w7 = cmd_data[fifo_index + 6];
- uint32_t w8 = cmd_data[fifo_index + 7];
+ uint64_t w2 = cmd_data[fifo_index + 1];
+ uint64_t w3 = cmd_data[fifo_index + 2];
+ uint64_t w4 = cmd_data[fifo_index + 3];
- int32_t yl = (w1 & 0x3fff);
- int32_t ym = ((w2 >> 16) & 0x3fff);
- int32_t yh = ((w2 >> 0) & 0x3fff);
- int32_t xl = (int32_t)(w3 & 0x3fffffff);
- int32_t xh = (int32_t)(w5 & 0x3fffffff);
- int32_t xm = (int32_t)(w7 & 0x3fffffff);
+ int32_t yl = int32_t(w1 >> 32) & 0x3fff;
+ int32_t ym = int32_t(w1 >> 16) & 0x3fff;
+ int32_t yh = int32_t(w1 >> 0) & 0x3fff;
+ int32_t xl = (int32_t)(w2 >> 32) & 0x3fffffff;
+ int32_t xh = (int32_t)(w3 >> 32) & 0x3fffffff;
+ int32_t xm = (int32_t)(w4 >> 32) & 0x3fffffff;
// Inverse slopes in 16.16 format
- int32_t dxldy = (int32_t)(w4);
- int32_t dxhdy = (int32_t)(w6);
- int32_t dxmdy = (int32_t)(w8);
+ int32_t dxldy = (int32_t)w2;
+ int32_t dxhdy = (int32_t)w3;
+ int32_t dxmdy = (int32_t)w4;
if (yl & 0x2000) yl |= 0xffffc000;
if (ym & 0x2000) ym |= 0xffffc000;
@@ -1925,38 +1919,40 @@ void n64_rdp::draw_triangle(bool shade, bool texture, bool zbuffer, bool rect)
if (xm & 0x20000000) xm |= 0xc0000000;
if (xh & 0x20000000) xh |= 0xc0000000;
- int32_t r = (cmd_data[shade_base+0 ] & 0xffff0000) | ((cmd_data[shade_base+4 ] >> 16) & 0x0000ffff);
- int32_t g = ((cmd_data[shade_base+0 ] << 16) & 0xffff0000) | (cmd_data[shade_base+4 ] & 0x0000ffff);
- int32_t b = (cmd_data[shade_base+1 ] & 0xffff0000) | ((cmd_data[shade_base+5 ] >> 16) & 0x0000ffff);
- int32_t a = ((cmd_data[shade_base+1 ] << 16) & 0xffff0000) | (cmd_data[shade_base+5 ] & 0x0000ffff);
- const int32_t drdx = (cmd_data[shade_base+2 ] & 0xffff0000) | ((cmd_data[shade_base+6 ] >> 16) & 0x0000ffff);
- const int32_t dgdx = ((cmd_data[shade_base+2 ] << 16) & 0xffff0000) | (cmd_data[shade_base+6 ] & 0x0000ffff);
- const int32_t dbdx = (cmd_data[shade_base+3 ] & 0xffff0000) | ((cmd_data[shade_base+7 ] >> 16) & 0x0000ffff);
- const int32_t dadx = ((cmd_data[shade_base+3 ] << 16) & 0xffff0000) | (cmd_data[shade_base+7 ] & 0x0000ffff);
- const int32_t drde = (cmd_data[shade_base+8 ] & 0xffff0000) | ((cmd_data[shade_base+12] >> 16) & 0x0000ffff);
- const int32_t dgde = ((cmd_data[shade_base+8 ] << 16) & 0xffff0000) | (cmd_data[shade_base+12] & 0x0000ffff);
- const int32_t dbde = (cmd_data[shade_base+9 ] & 0xffff0000) | ((cmd_data[shade_base+13] >> 16) & 0x0000ffff);
- const int32_t dade = ((cmd_data[shade_base+9 ] << 16) & 0xffff0000) | (cmd_data[shade_base+13] & 0x0000ffff);
- const int32_t drdy = (cmd_data[shade_base+10] & 0xffff0000) | ((cmd_data[shade_base+14] >> 16) & 0x0000ffff);
- const int32_t dgdy = ((cmd_data[shade_base+10] << 16) & 0xffff0000) | (cmd_data[shade_base+14] & 0x0000ffff);
- const int32_t dbdy = (cmd_data[shade_base+11] & 0xffff0000) | ((cmd_data[shade_base+15] >> 16) & 0x0000ffff);
- const int32_t dady = ((cmd_data[shade_base+11] << 16) & 0xffff0000) | (cmd_data[shade_base+15] & 0x0000ffff);
- int32_t s = (cmd_data[texture_base+0 ] & 0xffff0000) | ((cmd_data[texture_base+4 ] >> 16) & 0x0000ffff);
- int32_t t = ((cmd_data[texture_base+0 ] << 16) & 0xffff0000) | (cmd_data[texture_base+4 ] & 0x0000ffff);
- int32_t w = (cmd_data[texture_base+1 ] & 0xffff0000) | ((cmd_data[texture_base+5 ] >> 16) & 0x0000ffff);
- const int32_t dsdx = (cmd_data[texture_base+2 ] & 0xffff0000) | ((cmd_data[texture_base+6 ] >> 16) & 0x0000ffff);
- const int32_t dtdx = ((cmd_data[texture_base+2 ] << 16) & 0xffff0000) | (cmd_data[texture_base+6 ] & 0x0000ffff);
- const int32_t dwdx = (cmd_data[texture_base+3 ] & 0xffff0000) | ((cmd_data[texture_base+7 ] >> 16) & 0x0000ffff);
- const int32_t dsde = (cmd_data[texture_base+8 ] & 0xffff0000) | ((cmd_data[texture_base+12] >> 16) & 0x0000ffff);
- const int32_t dtde = ((cmd_data[texture_base+8 ] << 16) & 0xffff0000) | (cmd_data[texture_base+12] & 0x0000ffff);
- const int32_t dwde = (cmd_data[texture_base+9 ] & 0xffff0000) | ((cmd_data[texture_base+13] >> 16) & 0x0000ffff);
- const int32_t dsdy = (cmd_data[texture_base+10] & 0xffff0000) | ((cmd_data[texture_base+14] >> 16) & 0x0000ffff);
- const int32_t dtdy = ((cmd_data[texture_base+10] << 16) & 0xffff0000) | (cmd_data[texture_base+14] & 0x0000ffff);
- const int32_t dwdy = (cmd_data[texture_base+11] & 0xffff0000) | ((cmd_data[texture_base+15] >> 16) & 0x0000ffff);
- int32_t z = cmd_data[zbuffer_base+0];
- const int32_t dzdx = cmd_data[zbuffer_base+1];
- const int32_t dzde = cmd_data[zbuffer_base+2];
- const int32_t dzdy = cmd_data[zbuffer_base+3];
+ int32_t r = int32_t(((cmd_data[shade_base] >> 32) & 0xffff0000) | ((cmd_data[shade_base + 2] >> 48) & 0x0000ffff));
+ int32_t g = int32_t(((cmd_data[shade_base] >> 16) & 0xffff0000) | ((cmd_data[shade_base + 2] >> 32) & 0x0000ffff));
+ int32_t b = int32_t( (cmd_data[shade_base] & 0xffff0000) | ((cmd_data[shade_base + 2] >> 16) & 0x0000ffff));
+ int32_t a = int32_t(((cmd_data[shade_base] << 16) & 0xffff0000) | (cmd_data[shade_base + 2] & 0x0000ffff));
+ const int32_t drdx = int32_t(((cmd_data[shade_base + 1] >> 32) & 0xffff0000) | ((cmd_data[shade_base + 3] >> 48) & 0x0000ffff));
+ const int32_t dgdx = int32_t(((cmd_data[shade_base + 1] >> 16) & 0xffff0000) | ((cmd_data[shade_base + 3] >> 32) & 0x0000ffff));
+ const int32_t dbdx = int32_t( (cmd_data[shade_base + 1] & 0xffff0000) | ((cmd_data[shade_base + 3] >> 16) & 0x0000ffff));
+ const int32_t dadx = int32_t(((cmd_data[shade_base + 1] << 16) & 0xffff0000) | (cmd_data[shade_base + 3] & 0x0000ffff));
+ const int32_t drde = int32_t(((cmd_data[shade_base + 4] >> 32) & 0xffff0000) | ((cmd_data[shade_base + 6] >> 48) & 0x0000ffff));
+ const int32_t dgde = int32_t(((cmd_data[shade_base + 4] >> 16) & 0xffff0000) | ((cmd_data[shade_base + 6] >> 32) & 0x0000ffff));
+ const int32_t dbde = int32_t( (cmd_data[shade_base + 4] & 0xffff0000) | ((cmd_data[shade_base + 6] >> 16) & 0x0000ffff));
+ const int32_t dade = int32_t(((cmd_data[shade_base + 4] << 16) & 0xffff0000) | (cmd_data[shade_base + 6] & 0x0000ffff));
+ const int32_t drdy = int32_t(((cmd_data[shade_base + 5] >> 32) & 0xffff0000) | ((cmd_data[shade_base + 7] >> 48) & 0x0000ffff));
+ const int32_t dgdy = int32_t(((cmd_data[shade_base + 5] >> 16) & 0xffff0000) | ((cmd_data[shade_base + 7] >> 32) & 0x0000ffff));
+ const int32_t dbdy = int32_t( (cmd_data[shade_base + 5] & 0xffff0000) | ((cmd_data[shade_base + 7] >> 16) & 0x0000ffff));
+ const int32_t dady = int32_t(((cmd_data[shade_base + 5] << 16) & 0xffff0000) | (cmd_data[shade_base + 7] & 0x0000ffff));
+
+ int32_t s = int32_t(((cmd_data[texture_base] >> 32) & 0xffff0000) | ((cmd_data[texture_base+ 2 ] >> 48) & 0x0000ffff));
+ int32_t t = int32_t(((cmd_data[texture_base] >> 16) & 0xffff0000) | ((cmd_data[texture_base+ 2 ] >> 32) & 0x0000ffff));
+ int32_t w = int32_t( (cmd_data[texture_base] & 0xffff0000) | ((cmd_data[texture_base+ 2 ] >> 16) & 0x0000ffff));
+ const int32_t dsdx = int32_t(((cmd_data[texture_base + 1] >> 32) & 0xffff0000) | ((cmd_data[texture_base + 3] >> 48) & 0x0000ffff));
+ const int32_t dtdx = int32_t(((cmd_data[texture_base + 1] >> 16) & 0xffff0000) | ((cmd_data[texture_base + 3] >> 32) & 0x0000ffff));
+ const int32_t dwdx = int32_t( (cmd_data[texture_base + 1] & 0xffff0000) | ((cmd_data[texture_base + 3] >> 16) & 0x0000ffff));
+ const int32_t dsde = int32_t(((cmd_data[texture_base + 4] >> 32) & 0xffff0000) | ((cmd_data[texture_base + 6] >> 48) & 0x0000ffff));
+ const int32_t dtde = int32_t(((cmd_data[texture_base + 4] >> 16) & 0xffff0000) | ((cmd_data[texture_base + 6] >> 32) & 0x0000ffff));
+ const int32_t dwde = int32_t( (cmd_data[texture_base + 4] & 0xffff0000) | ((cmd_data[texture_base + 6] >> 16) & 0x0000ffff));
+ const int32_t dsdy = int32_t(((cmd_data[texture_base + 5] >> 32) & 0xffff0000) | ((cmd_data[texture_base + 7] >> 48) & 0x0000ffff));
+ const int32_t dtdy = int32_t(((cmd_data[texture_base + 5] >> 16) & 0xffff0000) | ((cmd_data[texture_base + 7] >> 32) & 0x0000ffff));
+ const int32_t dwdy = int32_t( (cmd_data[texture_base + 5] & 0xffff0000) | ((cmd_data[texture_base + 7] >> 16) & 0x0000ffff));
+
+ int32_t z = int32_t(cmd_data[zbuffer_base] >> 32);
+ const int32_t dzdx = int32_t(cmd_data[zbuffer_base]);
+ const int32_t dzde = int32_t(cmd_data[zbuffer_base+1] >> 32);
+ const int32_t dzdy = int32_t(cmd_data[zbuffer_base+1]);
const int32_t dzdy_dz = (dzdy >> 16) & 0xffff;
const int32_t dzdx_dz = (dzdx >> 16) & 0xffff;
@@ -2215,207 +2211,180 @@ void n64_rdp::triangle(bool shade, bool texture, bool zbuffer)
m_pipe_clean = false;
}
-void n64_rdp::cmd_triangle(uint32_t w1, uint32_t w2)
+void n64_rdp::cmd_triangle(uint64_t w1)
{
triangle(false, false, false);
}
-void n64_rdp::cmd_triangle_z(uint32_t w1, uint32_t w2)
+void n64_rdp::cmd_triangle_z(uint64_t w1)
{
triangle(false, false, true);
}
-void n64_rdp::cmd_triangle_t(uint32_t w1, uint32_t w2)
+void n64_rdp::cmd_triangle_t(uint64_t w1)
{
triangle(false, true, false);
}
-void n64_rdp::cmd_triangle_tz(uint32_t w1, uint32_t w2)
+void n64_rdp::cmd_triangle_tz(uint64_t w1)
{
triangle(false, true, true);
}
-void n64_rdp::cmd_triangle_s(uint32_t w1, uint32_t w2)
+void n64_rdp::cmd_triangle_s(uint64_t w1)
{
triangle(true, false, false);
}
-void n64_rdp::cmd_triangle_sz(uint32_t w1, uint32_t w2)
+void n64_rdp::cmd_triangle_sz(uint64_t w1)
{
triangle(true, false, true);
}
-void n64_rdp::cmd_triangle_st(uint32_t w1, uint32_t w2)
+void n64_rdp::cmd_triangle_st(uint64_t w1)
{
triangle(true, true, false);
}
-void n64_rdp::cmd_triangle_stz(uint32_t w1, uint32_t w2)
+void n64_rdp::cmd_triangle_stz(uint64_t w1)
{
triangle(true, true, true);
}
-void n64_rdp::cmd_tex_rect(uint32_t w1, uint32_t w2)
+void n64_rdp::cmd_tex_rect(uint64_t w1)
{
- const uint32_t* data = m_cmd_data + m_cmd_cur;
+ const uint64_t* data = m_cmd_data + m_cmd_cur;
- const uint32_t w3 = data[2];
- const uint32_t w4 = data[3];
+ const uint64_t w2 = data[1];
- const int32_t tilenum = (w2 >> 24) & 0x7;
- const int32_t xh = (w2 >> 12) & 0xfff;
- const int32_t xl = (w1 >> 12) & 0xfff;
- const int32_t yh = (w2 >> 0) & 0xfff;
- int32_t yl = (w1 >> 0) & 0xfff;
+ const uint64_t tilenum = (w1 >> 24) & 0x7;
+ const uint64_t xh = (w1 >> 12) & 0xfff;
+ const uint64_t xl = (w1 >> 44) & 0xfff;
+ const uint64_t yh = (w1 >> 0) & 0xfff;
+ uint64_t yl = (w1 >> 32) & 0xfff;
- const int32_t s = (w3 >> 16) & 0xffff;
- const int32_t t = (w3 >> 0) & 0xffff;
- const int32_t dsdx = SIGN16((w4 >> 16) & 0xffff);
- const int32_t dtdy = SIGN16((w4 >> 0) & 0xffff);
+ const uint64_t s = (w2 >> 48) & 0xffff;
+ const uint64_t t = (w2 >> 32) & 0xffff;
+ const uint64_t dsdx = SIGN16((w2 >> 16) & 0xffff);
+ const uint64_t dtdy = SIGN16((w2 >> 0) & 0xffff);
if (m_other_modes.cycle_type == CYCLE_TYPE_FILL || m_other_modes.cycle_type == CYCLE_TYPE_COPY)
{
yl |= 3;
}
- const int32_t xlint = (xl >> 2) & 0x3ff;
- const int32_t xhint = (xh >> 2) & 0x3ff;
-
- uint32_t* ewdata = m_temp_rect_data;
- ewdata[0] = (0x24 << 24) | ((0x80 | tilenum) << 16) | yl; // command, flipped, tile, yl
- ewdata[1] = (yl << 16) | yh; // ym, yh
- ewdata[2] = (xlint << 16) | ((xl & 3) << 14); // xl, xl frac
- // ewdata[3] = 0; dxldy, dxldy frac
- ewdata[4] = (xhint << 16) | ((xh & 3) << 14); // xh, xh frac
- // ewdata[5] = 0; dxhdy, dxhdy frac
- ewdata[6] = (xlint << 16) | ((xl & 3) << 14); // xm, xm frac
- //ewdata[7] = 0; dxmdy, dxmdy frac
- memset(&ewdata[8], 0, 16 * sizeof(uint32_t)); // shade
- ewdata[24] = (s << 16) | t; // s, t
- // ewdata[25] = 0; w
- ewdata[26] = ((dsdx >> 5) << 16); // dsdx, dtdx
- // ewdata[27] = 0; dwdx
- // ewdata[28] = 0; s frac, t frac
- // ewdata[29] = 0; w frac
- ewdata[30] = ((dsdx & 0x1f) << 11) << 16; // dsdx frac, dtdx frac
- // ewdata[31] = 0; dwdx frac
- ewdata[32] = (dtdy >> 5) & 0xffff; // dsde, dtde
- // ewdata[33] = 0; dwde
- ewdata[34] = (dtdy >> 5) & 0xffff; // dsdy, dtdy
- // ewdata[35] = 0; dwdy
- ewdata[36] = (dtdy & 0x1f) << 11; // dsde frac, dtde frac
- // ewdata[37] = 0; dwde frac
- ewdata[38] = (dtdy & 0x1f) << 11; // dsdy frac, dtdy frac
- // ewdata[39] = 0; // dwdy frac
+ const uint64_t xlint = (xl >> 2) & 0x3ff;
+ const uint64_t xhint = (xh >> 2) & 0x3ff;
+
+ uint64_t* ewdata = m_temp_rect_data;
+ ewdata[0] = ((uint64_t)0x24 << 56) | ((0x80L | tilenum) << 48) | (yl << 32) | (yl << 16) | yh; // command, flipped, tile, yl
+ ewdata[1] = (xlint << 48) | ((xl & 3) << 46); // xl, xl frac, dxldy (0), dxldy frac (0)
+ ewdata[2] = (xhint << 48) | ((xh & 3) << 46); // xh, xh frac, dxhdy (0), dxhdy frac (0)
+ ewdata[3] = (xlint << 48) | ((xl & 3) << 46); // xm, xm frac, dxmdy (0), dxmdy frac (0)
+ memset(&ewdata[4], 0, 8 * sizeof(uint64_t)); // shade
+ ewdata[12] = (s << 48) | (t << 32); // s, t, w (0)
+ ewdata[13] = (dsdx >> 5) << 48; // dsdx, dtdx, dwdx (0)
+ ewdata[14] = 0; // s frac (0), t frac (0), w frac (0)
+ ewdata[15] = (dsdx & 0x1f) << 59; // dsdx frac, dtdx frac, dwdx frac (0)
+ ewdata[16] = ((dtdy >> 5) & 0xffff) << 32; // dsde, dtde, dwde (0)
+ ewdata[17] = ((dtdy >> 5) & 0xffff) << 32; // dsdy, dtdy, dwdy (0)
+ ewdata[18] = ((dtdy & 0x1f) << 11) << 32; // dsde frac, dtde frac, dwde frac (0)
+ ewdata[38] = ((dtdy & 0x1f) << 11) << 32; // dsdy frac, dtdy frac, dwdy frac (0)
// ewdata[40-43] = 0; // depth
draw_triangle(true, true, false, true);
}
-void n64_rdp::cmd_tex_rect_flip(uint32_t w1, uint32_t w2)
+void n64_rdp::cmd_tex_rect_flip(uint64_t w1)
{
- const uint32_t* data = m_cmd_data + m_cmd_cur;
+ const uint64_t* data = m_cmd_data + m_cmd_cur;
- const uint32_t w3 = data[2];
- const uint32_t w4 = data[3];
+ const uint64_t w2 = data[1];
- const int32_t tilenum = (w2 >> 24) & 0x7;
- const int32_t xh = (w2 >> 12) & 0xfff;
- const int32_t xl = (w1 >> 12) & 0xfff;
- const int32_t yh = (w2 >> 0) & 0xfff;
- int32_t yl = (w1 >> 0) & 0xfff;
+ const uint64_t tilenum = (w1 >> 56) & 0x7;
+ const uint64_t xh = (w1 >> 12) & 0xfff;
+ const uint64_t xl = (w1 >> 44) & 0xfff;
+ const uint64_t yh = (w1 >> 0) & 0xfff;
+ uint64_t yl = (w1 >> 32) & 0xfff;
- const int32_t s = (w3 >> 16) & 0xffff;
- const int32_t t = (w3 >> 0) & 0xffff;
- const int32_t dsdx = SIGN16((w4 >> 16) & 0xffff);
- const int32_t dtdy = SIGN16((w4 >> 0) & 0xffff);
+ const uint64_t s = (w2 >> 48) & 0xffff;
+ const uint64_t t = (w2 >> 32) & 0xffff;
+ const uint64_t dsdx = SIGN16((w2 >> 16) & 0xffff);
+ const uint64_t dtdy = SIGN16((w2 >> 0) & 0xffff);
if (m_other_modes.cycle_type == CYCLE_TYPE_FILL || m_other_modes.cycle_type == CYCLE_TYPE_COPY)
{
yl |= 3;
}
- const int32_t xlint = (xl >> 2) & 0x3ff;
- const int32_t xhint = (xh >> 2) & 0x3ff;
-
- uint32_t* ewdata = m_temp_rect_data;
- ewdata[0] = (0x25 << 24) | ((0x80 | tilenum) << 16) | yl; // command, flipped, tile, yl
- ewdata[1] = (yl << 16) | yh; // ym, yh
- ewdata[2] = (xlint << 16) | ((xl & 3) << 14); // xl, xl frac
- // ewdata[3] = 0; dxldy, dxldy frac
- ewdata[4] = (xhint << 16) | ((xh & 3) << 14); // xh, xh frac
- // ewdata[5] = 0; dxhdy, dxhdy frac
- ewdata[6] = (xlint << 16) | ((xl & 3) << 14); // xm, xm frac
- // ewdata[7] = 0; dxmdy, dxmdy frac
- memset(&ewdata[8], 0, 16 * sizeof(uint32_t)); // shade
- ewdata[24] = (s << 16) | t; // s, t
- // ewdata[25] = 0; // w
- ewdata[26] = (dtdy >> 5) & 0xffff; // dsdx, dtdx
- // ewdata[27] = 0; dwdx
- // ewdata[28] = 0; s frac, t frac
- // ewdata[29] = 0; w frac
- ewdata[30] = ((dtdy & 0x1f) << 11); // dsdx frac, dtdx frac
- // ewdata[31] = 0; dwdx frac
- ewdata[32] = (dsdx >> 5) << 16; // dsde, dtde
- // ewdata[33] = 0; dwde
- ewdata[34] = (dsdx >> 5) << 16; // dsdy, dtdy
- // ewdata[35] = 0; dwdy
- ewdata[36] = (dsdx & 0x1f) << 27; // dsde frac, dtde frac
- // ewdata[37] = 0; dwde frac
- ewdata[38] = (dsdx & 0x1f) << 27; // dsdy frac, dtdy frac
- // ewdata[39] = 0; // dwdy frac
- // ewdata[40-43] = 0; // depth
+ const uint64_t xlint = (xl >> 2) & 0x3ff;
+ const uint64_t xhint = (xh >> 2) & 0x3ff;
+
+ uint64_t* ewdata = m_temp_rect_data;
+ ewdata[0] = ((uint64_t)0x25 << 56) | ((0x80L | tilenum) << 48) | (yl << 32) | (yl << 16) | yh; // command, flipped, tile, yl
+ ewdata[1] = (xlint << 48) | ((xl & 3) << 46); // xl, xl frac, dxldy (0), dxldy frac (0)
+ ewdata[2] = (xhint << 48) | ((xh & 3) << 46); // xh, xh frac, dxhdy (0), dxhdy frac (0)
+ ewdata[3] = (xlint << 48) | ((xl & 3) << 46); // xm, xm frac, dxmdy (0), dxmdy frac (0)
+ memset(&ewdata[4], 0, 8 * sizeof(uint64_t)); // shade
+ ewdata[12] = (s << 48) | (t << 32); // s, t, w (0)
+ ewdata[13] = ((dtdy >> 5) & 0xffff) << 32; // dsdx, dtdx, dwdx (0)
+ ewdata[14] = 0; // s frac (0), t frac (0), w frac (0)
+ ewdata[15] = ((dtdy & 0x1f) << 43); // dsdx frac, dtdx frac, dwdx frac (0)
+ ewdata[16] = (dsdx >> 5) << 48; // dsde, dtde, dwde (0)
+ ewdata[17] = (dsdx >> 5) << 48; // dsdy, dtdy, dwdy (0)
+ ewdata[18] = (dsdx & 0x1f) << 59; // dsde frac, dtde frac, dwde frac (0)
+ ewdata[19] = (dsdx & 0x1f) << 59; // dsdy frac, dtdy frac, dwdy frac (0)
draw_triangle(true, true, false, true);
}
-void n64_rdp::cmd_sync_load(uint32_t w1, uint32_t w2)
+void n64_rdp::cmd_sync_load(uint64_t w1)
{
//wait("SyncLoad");
}
-void n64_rdp::cmd_sync_pipe(uint32_t w1, uint32_t w2)
+void n64_rdp::cmd_sync_pipe(uint64_t w1)
{
//wait("SyncPipe");
}
-void n64_rdp::cmd_sync_tile(uint32_t w1, uint32_t w2)
+void n64_rdp::cmd_sync_tile(uint64_t w1)
{
//wait("SyncTile");
}
-void n64_rdp::cmd_sync_full(uint32_t w1, uint32_t w2)
+void n64_rdp::cmd_sync_full(uint64_t w1)
{
//wait("SyncFull");
dp_full_sync(*m_machine);
}
-void n64_rdp::cmd_set_key_gb(uint32_t w1, uint32_t w2)
+void n64_rdp::cmd_set_key_gb(uint64_t w1)
{
- m_key_scale.set_b(w2 & 0xff);
- m_key_scale.set_g((w2 >> 16) & 0xff);
+ m_key_scale.set_b(uint32_t(w1 >> 0) & 0xff);
+ m_key_scale.set_g(uint32_t(w1 >> 16) & 0xff);
}
-void n64_rdp::cmd_set_key_r(uint32_t w1, uint32_t w2)
+void n64_rdp::cmd_set_key_r(uint64_t w1)
{
- m_key_scale.set_r(w2 & 0xff);
+ m_key_scale.set_r(uint32_t(w1 & 0xff));
}
-void n64_rdp::cmd_set_fill_color32(uint32_t w1, uint32_t w2)
+void n64_rdp::cmd_set_fill_color32(uint64_t w1)
{
//wait("SetFillColor");
- m_fill_color = w2;
+ m_fill_color = (uint32_t)w1;
}
-void n64_rdp::cmd_set_convert(uint32_t w1, uint32_t w2)
+void n64_rdp::cmd_set_convert(uint64_t w1)
{
if(!m_pipe_clean) { m_pipe_clean = true; wait("SetConvert"); }
- int32_t k0 = (w1 >> 13) & 0x1ff;
- int32_t k1 = (w1 >> 4) & 0x1ff;
- int32_t k2 = ((w1 & 0xf) << 5) | ((w2 >> 27) & 0x1f);
- int32_t k3 = (w2 >> 18) & 0x1ff;
- int32_t k4 = (w2 >> 9) & 0x1ff;
- int32_t k5 = w2 & 0x1ff;
+ int32_t k0 = int32_t(w1 >> 45) & 0x1ff;
+ int32_t k1 = int32_t(w1 >> 36) & 0x1ff;
+ int32_t k2 = int32_t(w1 >> 27) & 0x1ff;
+ int32_t k3 = int32_t(w1 >> 18) & 0x1ff;
+ int32_t k4 = int32_t(w1 >> 9) & 0x1ff;
+ int32_t k5 = int32_t(w1 >> 0) & 0x1ff;
k0 = (SIGN9(k0) << 1) + 1;
k1 = (SIGN9(k1) << 1) + 1;
@@ -2425,81 +2394,83 @@ void n64_rdp::cmd_set_convert(uint32_t w1, uint32_t w2)
set_yuv_factors(rgbaint_t(0, k0, k2, k3), rgbaint_t(0, 0, k1, 0), rgbaint_t(k4, k4, k4, k4), rgbaint_t(k5, k5, k5, k5));
}
-void n64_rdp::cmd_set_scissor(uint32_t w1, uint32_t w2)
+void n64_rdp::cmd_set_scissor(uint64_t w1)
{
- m_scissor.m_xh = ((w1 >> 12) & 0xfff) >> 2;
- m_scissor.m_yh = ((w1 >> 0) & 0xfff) >> 2;
- m_scissor.m_xl = ((w2 >> 12) & 0xfff) >> 2;
- m_scissor.m_yl = ((w2 >> 0) & 0xfff) >> 2;
+ m_scissor.m_xh = ((w1 >> 44) & 0xfff) >> 2;
+ m_scissor.m_yh = ((w1 >> 32) & 0xfff) >> 2;
+ m_scissor.m_xl = ((w1 >> 12) & 0xfff) >> 2;
+ m_scissor.m_yl = ((w1 >> 0) & 0xfff) >> 2;
// TODO: handle f & o?
}
-void n64_rdp::cmd_set_prim_depth(uint32_t w1, uint32_t w2)
+void n64_rdp::cmd_set_prim_depth(uint64_t w1)
{
- m_misc_state.m_primitive_z = w2 & 0x7fff0000;
- m_misc_state.m_primitive_dz = (uint16_t)(w1);
+ m_misc_state.m_primitive_z = (uint32_t)(w1 & 0x7fff0000);
+ m_misc_state.m_primitive_dz = (uint16_t)(w1 >> 32);
}
-void n64_rdp::cmd_set_other_modes(uint32_t w1, uint32_t w2)
+void n64_rdp::cmd_set_other_modes(uint64_t w1)
{
//wait("SetOtherModes");
- m_other_modes.cycle_type = (w1 >> 20) & 0x3; // 01
- m_other_modes.persp_tex_en = (w1 & 0x80000) ? 1 : 0; // 1
- m_other_modes.detail_tex_en = (w1 & 0x40000) ? 1 : 0; // 0
- m_other_modes.sharpen_tex_en = (w1 & 0x20000) ? 1 : 0; // 0
- m_other_modes.tex_lod_en = (w1 & 0x10000) ? 1 : 0; // 0
- m_other_modes.en_tlut = (w1 & 0x08000) ? 1 : 0; // 0
- m_other_modes.tlut_type = (w1 & 0x04000) ? 1 : 0; // 0
- m_other_modes.sample_type = (w1 & 0x02000) ? 1 : 0; // 1
- m_other_modes.mid_texel = (w1 & 0x01000) ? 1 : 0; // 0
- m_other_modes.bi_lerp0 = (w1 & 0x00800) ? 1 : 0; // 1
- m_other_modes.bi_lerp1 = (w1 & 0x00400) ? 1 : 0; // 1
- m_other_modes.convert_one = (w1 & 0x00200) ? 1 : 0; // 0
- m_other_modes.key_en = (w1 & 0x00100) ? 1 : 0; // 0
- m_other_modes.rgb_dither_sel = (w1 >> 6) & 0x3; // 00
- m_other_modes.alpha_dither_sel = (w1 >> 4) & 0x3; // 01
- m_other_modes.blend_m1a_0 = (w2 >> 30) & 0x3; // 11
- m_other_modes.blend_m1a_1 = (w2 >> 28) & 0x3; // 00
- m_other_modes.blend_m1b_0 = (w2 >> 26) & 0x3; // 10
- m_other_modes.blend_m1b_1 = (w2 >> 24) & 0x3; // 00
- m_other_modes.blend_m2a_0 = (w2 >> 22) & 0x3; // 00
- m_other_modes.blend_m2a_1 = (w2 >> 20) & 0x3; // 01
- m_other_modes.blend_m2b_0 = (w2 >> 18) & 0x3; // 00
- m_other_modes.blend_m2b_1 = (w2 >> 16) & 0x3; // 01
- m_other_modes.force_blend = (w2 >> 14) & 1; // 0
- m_other_modes.blend_shift = m_other_modes.force_blend ? 5 : 2;
- m_other_modes.alpha_cvg_select = (w2 >> 13) & 1; // 1
- m_other_modes.cvg_times_alpha = (w2 >> 12) & 1; // 0
- m_other_modes.z_mode = (w2 >> 10) & 0x3; // 00
- m_other_modes.cvg_dest = (w2 >> 8) & 0x3; // 00
- m_other_modes.color_on_cvg = (w2 >> 7) & 1; // 0
- m_other_modes.image_read_en = (w2 >> 6) & 1; // 1
- m_other_modes.z_update_en = (w2 >> 5) & 1; // 1
- m_other_modes.z_compare_en = (w2 >> 4) & 1; // 1
- m_other_modes.antialias_en = (w2 >> 3) & 1; // 1
- m_other_modes.z_source_sel = (w2 >> 2) & 1; // 0
- m_other_modes.dither_alpha_en = (w2 >> 1) & 1; // 0
- m_other_modes.alpha_compare_en = (w2) & 1; // 0
+ m_other_modes.cycle_type = (w1 >> 52) & 0x3; // 01
+ m_other_modes.persp_tex_en = (w1 >> 51) & 1; // 1
+ m_other_modes.detail_tex_en = (w1 >> 50) & 1; // 0
+ m_other_modes.sharpen_tex_en = (w1 >> 49) & 1; // 0
+ m_other_modes.tex_lod_en = (w1 >> 48) & 1; // 0
+ m_other_modes.en_tlut = (w1 >> 47) & 1; // 0
+ m_other_modes.tlut_type = (w1 >> 46) & 1; // 0
+ m_other_modes.sample_type = (w1 >> 45) & 1; // 1
+ m_other_modes.mid_texel = (w1 >> 44) & 1; // 0
+ m_other_modes.bi_lerp0 = (w1 >> 43) & 1; // 1
+ m_other_modes.bi_lerp1 = (w1 >> 42) & 1; // 1
+ m_other_modes.convert_one = (w1 >> 41) & 1; // 0
+ m_other_modes.key_en = (w1 >> 40) & 1; // 0
+ m_other_modes.rgb_dither_sel = (w1 >> 38) & 0x3; // 00
+ m_other_modes.alpha_dither_sel = (w1 >> 36) & 0x3; // 01
+ m_other_modes.blend_m1a_0 = (w1 >> 30) & 0x3; // 11
+ m_other_modes.blend_m1a_1 = (w1 >> 28) & 0x3; // 00
+ m_other_modes.blend_m1b_0 = (w1 >> 26) & 0x3; // 10
+ m_other_modes.blend_m1b_1 = (w1 >> 24) & 0x3; // 00
+ m_other_modes.blend_m2a_0 = (w1 >> 22) & 0x3; // 00
+ m_other_modes.blend_m2a_1 = (w1 >> 20) & 0x3; // 01
+ m_other_modes.blend_m2b_0 = (w1 >> 18) & 0x3; // 00
+ m_other_modes.blend_m2b_1 = (w1 >> 16) & 0x3; // 01
+ m_other_modes.force_blend = (w1 >> 14) & 1; // 0
+ m_other_modes.blend_shift = m_other_modes.force_blend ? 5 : 2;
+ m_other_modes.alpha_cvg_select = (w1 >> 13) & 1; // 1
+ m_other_modes.cvg_times_alpha = (w1 >> 12) & 1; // 0
+ m_other_modes.z_mode = (w1 >> 10) & 0x3; // 00
+ m_other_modes.cvg_dest = (w1 >> 8) & 0x3; // 00
+ m_other_modes.color_on_cvg = (w1 >> 7) & 1; // 0
+ m_other_modes.image_read_en = (w1 >> 6) & 1; // 1
+ m_other_modes.z_update_en = (w1 >> 5) & 1; // 1
+ m_other_modes.z_compare_en = (w1 >> 4) & 1; // 1
+ m_other_modes.antialias_en = (w1 >> 3) & 1; // 1
+ m_other_modes.z_source_sel = (w1 >> 2) & 1; // 0
+ m_other_modes.dither_alpha_en = (w1 >> 1) & 1; // 0
+ m_other_modes.alpha_compare_en = (w1 >> 0) & 1; // 0
m_other_modes.alpha_dither_mode = (m_other_modes.alpha_compare_en << 1) | m_other_modes.dither_alpha_en;
}
-void n64_rdp::cmd_load_tlut(uint32_t w1, uint32_t w2)
+void n64_rdp::cmd_load_tlut(uint64_t w1)
{
//wait("LoadTLUT");
n64_tile_t* tile = m_tiles;
- const int32_t tilenum = (w2 >> 24) & 0x7;
- const int32_t sl = tile[tilenum].sl = ((w1 >> 12) & 0xfff);
- const int32_t tl = tile[tilenum].tl = w1 & 0xfff;
- const int32_t sh = tile[tilenum].sh = ((w2 >> 12) & 0xfff);
- const int32_t th = tile[tilenum].th = w2 & 0xfff;
+ const int32_t tilenum = (w1 >> 24) & 0x7;
+ const int32_t sl = tile[tilenum].sl = int32_t(w1 >> 44) & 0xfff;
+ const int32_t tl = tile[tilenum].tl = int32_t(w1 >> 32) & 0xfff;
+ const int32_t sh = tile[tilenum].sh = int32_t(w1 >> 12) & 0xfff;
+ const int32_t th = tile[tilenum].th = int32_t(w1 >> 0) & 0xfff;
if (tl != th)
{
fatalerror("Load tlut: tl=%d, th=%d\n",tl,th);
}
+ m_capture.data_begin();
+
const int32_t count = ((sh >> 2) - (sl >> 2) + 1) << 2;
switch (m_misc_state.m_ti_size)
@@ -2519,6 +2490,7 @@ void n64_rdp::cmd_load_tlut(uint32_t w1, uint32_t w2)
if (dststart < 2048)
{
dst[dststart] = U_RREADIDX16(srcstart);
+ m_capture.data_block()->put16(dst[dststart]);
dst[dststart + 1] = dst[dststart];
dst[dststart + 2] = dst[dststart];
dst[dststart + 3] = dst[dststart];
@@ -2531,37 +2503,39 @@ void n64_rdp::cmd_load_tlut(uint32_t w1, uint32_t w2)
default: fatalerror("RDP: load_tlut: size = %d\n", m_misc_state.m_ti_size);
}
+ m_capture.data_end();
+
m_tiles[tilenum].sth = rgbaint_t(m_tiles[tilenum].sh, m_tiles[tilenum].sh, m_tiles[tilenum].th, m_tiles[tilenum].th);
m_tiles[tilenum].stl = rgbaint_t(m_tiles[tilenum].sl, m_tiles[tilenum].sl, m_tiles[tilenum].tl, m_tiles[tilenum].tl);
}
-void n64_rdp::cmd_set_tile_size(uint32_t w1, uint32_t w2)
+void n64_rdp::cmd_set_tile_size(uint64_t w1)
{
//wait("SetTileSize");
- const int32_t tilenum = (w2 >> 24) & 0x7;
+ const int32_t tilenum = int32_t(w1 >> 24) & 0x7;
- m_tiles[tilenum].sl = (w1 >> 12) & 0xfff;
- m_tiles[tilenum].tl = (w1 >> 0) & 0xfff;
- m_tiles[tilenum].sh = (w2 >> 12) & 0xfff;
- m_tiles[tilenum].th = (w2 >> 0) & 0xfff;
+ m_tiles[tilenum].sl = int32_t(w1 >> 44) & 0xfff;
+ m_tiles[tilenum].tl = int32_t(w1 >> 32) & 0xfff;
+ m_tiles[tilenum].sh = int32_t(w1 >> 12) & 0xfff;
+ m_tiles[tilenum].th = int32_t(w1 >> 0) & 0xfff;
m_tiles[tilenum].sth = rgbaint_t(m_tiles[tilenum].sh, m_tiles[tilenum].sh, m_tiles[tilenum].th, m_tiles[tilenum].th);
m_tiles[tilenum].stl = rgbaint_t(m_tiles[tilenum].sl, m_tiles[tilenum].sl, m_tiles[tilenum].tl, m_tiles[tilenum].tl);
}
-void n64_rdp::cmd_load_block(uint32_t w1, uint32_t w2)
+void n64_rdp::cmd_load_block(uint64_t w1)
{
//wait("LoadBlock");
n64_tile_t* tile = m_tiles;
- const int32_t tilenum = (w2 >> 24) & 0x7;
+ const int32_t tilenum = int32_t(w1 >> 24) & 0x7;
uint16_t* tc = get_tmem16();
- int32_t sl = tile[tilenum].sl = ((w1 >> 12) & 0xfff);
- int32_t tl = tile[tilenum].tl = ((w1 >> 0) & 0xfff);
- int32_t sh = tile[tilenum].sh = ((w2 >> 12) & 0xfff);
- const int32_t dxt = ((w2 >> 0) & 0xfff);
+ int32_t sl = tile[tilenum].sl = int32_t(w1 >> 44) & 0xfff;
+ int32_t tl = tile[tilenum].tl = int32_t(w1 >> 32) & 0xfff;
+ int32_t sh = tile[tilenum].sh = int32_t(w1 >> 12) & 0xfff;
+ const int32_t dxt = int32_t(w1 >> 0) & 0xfff;
if (sh < sl)
{
@@ -2584,6 +2558,8 @@ void n64_rdp::cmd_load_block(uint32_t w1, uint32_t w2)
const uint32_t src = (m_misc_state.m_ti_address >> 1) + (tl * tiwinwords) + slinwords;
+ m_capture.data_begin();
+
if (dxt != 0)
{
int32_t j = 0;
@@ -2608,6 +2584,12 @@ void n64_rdp::cmd_load_block(uint32_t w1, uint32_t w2)
tc[((ptr + 1) ^ t) & 0x7ff] = U_RREADIDX16(srcptr + 1);
tc[((ptr + 2) ^ t) & 0x7ff] = U_RREADIDX16(srcptr + 2);
tc[((ptr + 3) ^ t) & 0x7ff] = U_RREADIDX16(srcptr + 3);
+
+ m_capture.data_block()->put16(U_RREADIDX16(srcptr));
+ m_capture.data_block()->put16(U_RREADIDX16(srcptr+1));
+ m_capture.data_block()->put16(U_RREADIDX16(srcptr+2));
+ m_capture.data_block()->put16(U_RREADIDX16(srcptr+3));
+
j += dxt;
}
}
@@ -2636,6 +2618,10 @@ void n64_rdp::cmd_load_block(uint32_t w1, uint32_t w2)
tc[ptr] = ((first >> 8) << 8) | (sec >> 8);
tc[ptr | 0x400] = ((first & 0xff) << 8) | (sec & 0xff);
+ m_capture.data_block()->put16(U_RREADIDX16(srcptr));
+ m_capture.data_block()->put16(U_RREADIDX16(srcptr+1));
+ m_capture.data_block()->put16(U_RREADIDX16(srcptr+2));
+ m_capture.data_block()->put16(U_RREADIDX16(srcptr+3));
j += dxt;
}
}
@@ -2657,6 +2643,11 @@ void n64_rdp::cmd_load_block(uint32_t w1, uint32_t w2)
tc[ptr] = U_RREADIDX16(srcptr + 2);
tc[ptr | 0x400] = U_RREADIDX16(srcptr + 3);
+ m_capture.data_block()->put16(U_RREADIDX16(srcptr));
+ m_capture.data_block()->put16(U_RREADIDX16(srcptr+1));
+ m_capture.data_block()->put16(U_RREADIDX16(srcptr+2));
+ m_capture.data_block()->put16(U_RREADIDX16(srcptr+3));
+
j += dxt;
}
}
@@ -2674,6 +2665,11 @@ void n64_rdp::cmd_load_block(uint32_t w1, uint32_t w2)
tc[((ptr + 1) ^ WORD_ADDR_XOR) & 0x7ff] = U_RREADIDX16(srcptr + 1);
tc[((ptr + 2) ^ WORD_ADDR_XOR) & 0x7ff] = U_RREADIDX16(srcptr + 2);
tc[((ptr + 3) ^ WORD_ADDR_XOR) & 0x7ff] = U_RREADIDX16(srcptr + 3);
+
+ m_capture.data_block()->put16(U_RREADIDX16(srcptr));
+ m_capture.data_block()->put16(U_RREADIDX16(srcptr+1));
+ m_capture.data_block()->put16(U_RREADIDX16(srcptr+2));
+ m_capture.data_block()->put16(U_RREADIDX16(srcptr+3));
}
}
else if (tile[tilenum].format == FORMAT_YUV)
@@ -2692,6 +2688,11 @@ void n64_rdp::cmd_load_block(uint32_t w1, uint32_t w2)
sec = U_RREADIDX16(srcptr + 3);
tc[ptr] = ((first >> 8) << 8) | (sec >> 8);
tc[ptr | 0x400] = ((first & 0xff) << 8) | (sec & 0xff);
+
+ m_capture.data_block()->put16(U_RREADIDX16(srcptr));
+ m_capture.data_block()->put16(U_RREADIDX16(srcptr+1));
+ m_capture.data_block()->put16(U_RREADIDX16(srcptr+2));
+ m_capture.data_block()->put16(U_RREADIDX16(srcptr+3));
}
}
else
@@ -2706,25 +2707,32 @@ void n64_rdp::cmd_load_block(uint32_t w1, uint32_t w2)
ptr = ((tb + (i << 1) + 1) ^ WORD_ADDR_XOR) & 0x3ff;
tc[ptr] = U_RREADIDX16(srcptr + 2);
tc[ptr | 0x400] = U_RREADIDX16(srcptr + 3);
+
+ m_capture.data_block()->put16(U_RREADIDX16(srcptr));
+ m_capture.data_block()->put16(U_RREADIDX16(srcptr+1));
+ m_capture.data_block()->put16(U_RREADIDX16(srcptr+2));
+ m_capture.data_block()->put16(U_RREADIDX16(srcptr+3));
}
}
tile[tilenum].th = tl;
}
+ m_capture.data_end();
+
m_tiles[tilenum].sth = rgbaint_t(m_tiles[tilenum].sh, m_tiles[tilenum].sh, m_tiles[tilenum].th, m_tiles[tilenum].th);
m_tiles[tilenum].stl = rgbaint_t(m_tiles[tilenum].sl, m_tiles[tilenum].sl, m_tiles[tilenum].tl, m_tiles[tilenum].tl);
}
-void n64_rdp::cmd_load_tile(uint32_t w1, uint32_t w2)
+void n64_rdp::cmd_load_tile(uint64_t w1)
{
//wait("LoadTile");
n64_tile_t* tile = m_tiles;
- const int32_t tilenum = (w2 >> 24) & 0x7;
+ const int32_t tilenum = int32_t(w1 >> 24) & 0x7;
- tile[tilenum].sl = ((w1 >> 12) & 0xfff);
- tile[tilenum].tl = ((w1 >> 0) & 0xfff);
- tile[tilenum].sh = ((w2 >> 12) & 0xfff);
- tile[tilenum].th = ((w2 >> 0) & 0xfff);
+ tile[tilenum].sl = int32_t(w1 >> 44) & 0xfff;
+ tile[tilenum].tl = int32_t(w1 >> 32) & 0xfff;
+ tile[tilenum].sh = int32_t(w1 >> 12) & 0xfff;
+ tile[tilenum].th = int32_t(w1 >> 0) & 0xfff;
const int32_t sl = tile[tilenum].sl >> 2;
const int32_t tl = tile[tilenum].tl >> 2;
@@ -2746,6 +2754,8 @@ void n64_rdp::cmd_load_tile(uint32_t w1, uint32_t w2)
topad = 0; // ????
*/
+ m_capture.data_begin();
+
switch (m_misc_state.m_ti_size)
{
case PIXEL_SIZE_8BIT:
@@ -2762,7 +2772,9 @@ void n64_rdp::cmd_load_tile(uint32_t w1, uint32_t w2)
for (int32_t i = 0; i < width; i++)
{
- tc[((tline + i) ^ xorval8) & 0xfff] = U_RREADADDR8(src + s + i);
+ const uint8_t data = U_RREADADDR8(src + s + i);
+ m_capture.data_block()->put8(data);
+ tc[((tline + i) ^ xorval8) & 0xfff] = data;
}
}
break;
@@ -2783,8 +2795,10 @@ void n64_rdp::cmd_load_tile(uint32_t w1, uint32_t w2)
for (int32_t i = 0; i < width; i++)
{
- uint32_t taddr = (tline + i) ^ xorval16;
- tc[taddr & 0x7ff] = U_RREADIDX16(src + s + i);
+ const uint32_t taddr = (tline + i) ^ xorval16;
+ const uint16_t data = U_RREADIDX16(src + s + i);
+ m_capture.data_block()->put16(data);
+ tc[taddr & 0x7ff] = data;
}
}
}
@@ -2801,6 +2815,7 @@ void n64_rdp::cmd_load_tile(uint32_t w1, uint32_t w2)
{
uint32_t taddr = ((tline + i) ^ xorval8) & 0x7ff;
uint16_t yuvword = U_RREADIDX16(src + s + i);
+ m_capture.data_block()->put16(yuvword);
get_tmem8()[taddr] = yuvword >> 8;
get_tmem8()[taddr | 0x800] = yuvword & 0xff;
}
@@ -2823,6 +2838,7 @@ void n64_rdp::cmd_load_tile(uint32_t w1, uint32_t w2)
for (int32_t i = 0; i < width; i++)
{
uint32_t c = U_RREADIDX32(src + s + i);
+ m_capture.data_block()->put32(c);
uint32_t ptr = ((tline + i) ^ xorval32cur) & 0x3ff;
tc16[ptr] = c >> 16;
tc16[ptr | 0x400] = c & 0xffff;
@@ -2834,29 +2850,31 @@ void n64_rdp::cmd_load_tile(uint32_t w1, uint32_t w2)
default: fatalerror("RDP: load_tile: size = %d\n", m_misc_state.m_ti_size);
}
+ m_capture.data_end();
+
m_tiles[tilenum].sth = rgbaint_t(m_tiles[tilenum].sh, m_tiles[tilenum].sh, m_tiles[tilenum].th, m_tiles[tilenum].th);
m_tiles[tilenum].stl = rgbaint_t(m_tiles[tilenum].sl, m_tiles[tilenum].sl, m_tiles[tilenum].tl, m_tiles[tilenum].tl);
}
-void n64_rdp::cmd_set_tile(uint32_t w1, uint32_t w2)
+void n64_rdp::cmd_set_tile(uint64_t w1)
{
//wait("SetTile");
- const int32_t tilenum = (w2 >> 24) & 0x7;
+ const int32_t tilenum = int32_t(w1 >> 24) & 0x7;
n64_tile_t* tex_tile = &m_tiles[tilenum];
- tex_tile->format = (w1 >> 21) & 0x7;
- tex_tile->size = (w1 >> 19) & 0x3;
- tex_tile->line = (w1 >> 9) & 0x1ff;
- tex_tile->tmem = (w1 >> 0) & 0x1ff;
- tex_tile->palette = (w2 >> 20) & 0xf;
- tex_tile->ct = (w2 >> 19) & 0x1;
- tex_tile->mt = (w2 >> 18) & 0x1;
- tex_tile->mask_t = (w2 >> 14) & 0xf;
- tex_tile->shift_t = (w2 >> 10) & 0xf;
- tex_tile->cs = (w2 >> 9) & 0x1;
- tex_tile->ms = (w2 >> 8) & 0x1;
- tex_tile->mask_s = (w2 >> 4) & 0xf;
- tex_tile->shift_s = (w2 >> 0) & 0xf;
+ tex_tile->format = int32_t(w1 >> 53) & 0x7;
+ tex_tile->size = int32_t(w1 >> 51) & 0x3;
+ tex_tile->line = int32_t(w1 >> 41) & 0x1ff;
+ tex_tile->tmem = int32_t(w1 >> 32) & 0x1ff;
+ tex_tile->palette = int32_t(w1 >> 20) & 0xf;
+ tex_tile->ct = int32_t(w1 >> 19) & 0x1;
+ tex_tile->mt = int32_t(w1 >> 18) & 0x1;
+ tex_tile->mask_t = int32_t(w1 >> 14) & 0xf;
+ tex_tile->shift_t = int32_t(w1 >> 10) & 0xf;
+ tex_tile->cs = int32_t(w1 >> 9) & 0x1;
+ tex_tile->ms = int32_t(w1 >> 8) & 0x1;
+ tex_tile->mask_s = int32_t(w1 >> 4) & 0xf;
+ tex_tile->shift_s = int32_t(w1 >> 0) & 0xf;
tex_tile->lshift_s = (tex_tile->shift_s >= 11) ? (16 - tex_tile->shift_s) : 0;
tex_tile->rshift_s = (tex_tile->shift_s < 11) ? tex_tile->shift_s : 0;
@@ -2892,106 +2910,104 @@ void n64_rdp::cmd_set_tile(uint32_t w1, uint32_t w2)
//m_pending_mode_block = true;
}
-void n64_rdp::cmd_fill_rect(uint32_t w1, uint32_t w2)
+void n64_rdp::cmd_fill_rect(uint64_t w1)
{
//if(m_pending_mode_block) { wait("Block on pending mode-change"); m_pending_mode_block = false; }
- const uint32_t xh = (w2 >> 12) & 0xfff;
- const uint32_t xl = (w1 >> 12) & 0xfff;
- const uint32_t yh = (w2 >> 0) & 0xfff;
- uint32_t yl = (w1 >> 0) & 0xfff;
+ const uint64_t xh = (w1 >> 12) & 0xfff;
+ const uint64_t xl = (w1 >> 44) & 0xfff;
+ const uint64_t yh = (w1 >> 0) & 0xfff;
+ uint64_t yl = (w1 >> 32) & 0xfff;
if (m_other_modes.cycle_type == CYCLE_TYPE_FILL || m_other_modes.cycle_type == CYCLE_TYPE_COPY)
{
yl |= 3;
}
- const uint32_t xlint = (xl >> 2) & 0x3ff;
- const uint32_t xhint = (xh >> 2) & 0x3ff;
+ const uint64_t xlint = (xl >> 2) & 0x3ff;
+ const uint64_t xhint = (xh >> 2) & 0x3ff;
- uint32_t* ewdata = m_temp_rect_data;
- ewdata[0] = (0x3680 << 16) | yl;//command, flipped, tile, yl
- ewdata[1] = (yl << 16) | yh;//ym, yh
- ewdata[2] = (xlint << 16) | ((xl & 3) << 14);//xl, xl frac
- ewdata[3] = 0;//dxldy, dxldy frac
- ewdata[4] = (xhint << 16) | ((xh & 3) << 14);//xh, xh frac
- ewdata[5] = 0;//dxhdy, dxhdy frac
- ewdata[6] = (xlint << 16) | ((xl & 3) << 14);//xm, xm frac
- ewdata[7] = 0;//dxmdy, dxmdy frac
- memset(&ewdata[8], 0, 36 * sizeof(uint32_t));//shade, texture, depth
+ uint64_t* ewdata = m_temp_rect_data;
+ ewdata[0] = ((uint64_t)0x3680 << 48) | (yl << 32) | (yl << 16) | yh; // command, flipped, tile, yl, ym, yh
+ ewdata[1] = (xlint << 48) | ((xl & 3) << 46); // xl, xl frac, dxldy (0), dxldy frac (0)
+ ewdata[2] = (xhint << 48) | ((xh & 3) << 46); // xh, xh frac, dxhdy (0), dxhdy frac (0)
+ ewdata[3] = (xlint << 48) | ((xl & 3) << 46); // xm, xm frac, dxmdy (0), dxmdy frac (0)
+ memset(&ewdata[4], 0, 18 * sizeof(uint64_t));//shade, texture, depth
draw_triangle(false, false, false, true);
}
-void n64_rdp::cmd_set_fog_color(uint32_t w1, uint32_t w2)
+void n64_rdp::cmd_set_fog_color(uint64_t w1)
{
- m_fog_color.set(w2 & 0xff, (w2 >> 24) & 0xff, (w2 >> 16) & 0xff, (w2 >> 8) & 0xff);
+ m_fog_color.set(uint8_t(w1), uint8_t(w1 >> 24), uint8_t(w1 >> 16), uint8_t(w1 >> 8));
}
-void n64_rdp::cmd_set_blend_color(uint32_t w1, uint32_t w2)
+void n64_rdp::cmd_set_blend_color(uint64_t w1)
{
- m_blend_color.set(w2 & 0xff, (w2 >> 24) & 0xff, (w2 >> 16) & 0xff, (w2 >> 8) & 0xff);
+ m_blend_color.set(uint8_t(w1), uint8_t(w1 >> 24), uint8_t(w1 >> 16), uint8_t(w1 >> 8));
}
-void n64_rdp::cmd_set_prim_color(uint32_t w1, uint32_t w2)
+void n64_rdp::cmd_set_prim_color(uint64_t w1)
{
- m_misc_state.m_min_level = (w1 >> 8) & 0x1f;
- const uint8_t prim_lod_fraction = w1 & 0xff;
+ m_misc_state.m_min_level = uint32_t(w1 >> 40) & 0x1f;
+ const uint8_t prim_lod_fraction(w1 >> 32);
m_prim_lod_fraction.set(prim_lod_fraction, prim_lod_fraction, prim_lod_fraction, prim_lod_fraction);
- m_prim_color.set(w2 & 0xff, (w2 >> 24) & 0xff, (w2 >> 16) & 0xff, (w2 >> 8) & 0xff);
- m_prim_alpha.set(w2 & 0xff, w2 & 0xff, w2 & 0xff, w2 & 0xff);
+ const uint8_t alpha(w1);
+ m_prim_color.set(alpha, uint8_t(w1 >> 24), uint8_t(w1 >> 16), uint8_t(w1 >> 8));
+ m_prim_alpha.set(alpha, alpha, alpha, alpha);
}
-void n64_rdp::cmd_set_env_color(uint32_t w1, uint32_t w2)
+void n64_rdp::cmd_set_env_color(uint64_t w1)
{
- m_env_color.set(w2 & 0xff, (w2 >> 24) & 0xff, (w2 >> 16) & 0xff, (w2 >> 8) & 0xff);
- m_env_alpha.set(w2 & 0xff, w2 & 0xff, w2 & 0xff, w2 & 0xff);
+ const uint8_t alpha(w1);
+ m_env_color.set(alpha, uint8_t(w1 >> 24), uint8_t(w1 >> 16), uint8_t(w1 >> 8));
+ m_env_alpha.set(alpha, alpha, alpha, alpha);
}
-void n64_rdp::cmd_set_combine(uint32_t w1, uint32_t w2)
+void n64_rdp::cmd_set_combine(uint64_t w1)
{
- m_combine.sub_a_rgb0 = (w1 >> 20) & 0xf;
- m_combine.mul_rgb0 = (w1 >> 15) & 0x1f;
- m_combine.sub_a_a0 = (w1 >> 12) & 0x7;
- m_combine.mul_a0 = (w1 >> 9) & 0x7;
- m_combine.sub_a_rgb1 = (w1 >> 5) & 0xf;
- m_combine.mul_rgb1 = (w1 >> 0) & 0x1f;
+ m_combine.sub_a_rgb0 = uint32_t(w1 >> 52) & 0xf;
+ m_combine.mul_rgb0 = uint32_t(w1 >> 47) & 0x1f;
+ m_combine.sub_a_a0 = uint32_t(w1 >> 44) & 0x7;
+ m_combine.mul_a0 = uint32_t(w1 >> 41) & 0x7;
+ m_combine.sub_a_rgb1 = uint32_t(w1 >> 37) & 0xf;
+ m_combine.mul_rgb1 = uint32_t(w1 >> 32) & 0x1f;
- m_combine.sub_b_rgb0 = (w2 >> 28) & 0xf;
- m_combine.sub_b_rgb1 = (w2 >> 24) & 0xf;
- m_combine.sub_a_a1 = (w2 >> 21) & 0x7;
- m_combine.mul_a1 = (w2 >> 18) & 0x7;
- m_combine.add_rgb0 = (w2 >> 15) & 0x7;
- m_combine.sub_b_a0 = (w2 >> 12) & 0x7;
- m_combine.add_a0 = (w2 >> 9) & 0x7;
- m_combine.add_rgb1 = (w2 >> 6) & 0x7;
- m_combine.sub_b_a1 = (w2 >> 3) & 0x7;
- m_combine.add_a1 = (w2 >> 0) & 0x7;
+ m_combine.sub_b_rgb0 = uint32_t(w1 >> 28) & 0xf;
+ m_combine.sub_b_rgb1 = uint32_t(w1 >> 24) & 0xf;
+ m_combine.sub_a_a1 = uint32_t(w1 >> 21) & 0x7;
+ m_combine.mul_a1 = uint32_t(w1 >> 18) & 0x7;
+ m_combine.add_rgb0 = uint32_t(w1 >> 15) & 0x7;
+ m_combine.sub_b_a0 = uint32_t(w1 >> 12) & 0x7;
+ m_combine.add_a0 = uint32_t(w1 >> 9) & 0x7;
+ m_combine.add_rgb1 = uint32_t(w1 >> 6) & 0x7;
+ m_combine.sub_b_a1 = uint32_t(w1 >> 3) & 0x7;
+ m_combine.add_a1 = uint32_t(w1 >> 0) & 0x7;
}
-void n64_rdp::cmd_set_texture_image(uint32_t w1, uint32_t w2)
+void n64_rdp::cmd_set_texture_image(uint64_t w1)
{
- m_misc_state.m_ti_format = (w1 >> 21) & 0x7;
- m_misc_state.m_ti_size = (w1 >> 19) & 0x3;
- m_misc_state.m_ti_width = (w1 & 0x3ff) + 1;
- m_misc_state.m_ti_address = w2 & 0x01ffffff;
+ m_misc_state.m_ti_format = uint32_t(w1 >> 53) & 0x7;
+ m_misc_state.m_ti_size = uint32_t(w1 >> 51) & 0x3;
+ m_misc_state.m_ti_width = (uint32_t(w1 >> 32) & 0x3ff) + 1;
+ m_misc_state.m_ti_address = uint32_t(w1) & 0x01ffffff;
}
-void n64_rdp::cmd_set_mask_image(uint32_t w1, uint32_t w2)
+void n64_rdp::cmd_set_mask_image(uint64_t w1)
{
//wait("SetMaskImage");
- m_misc_state.m_zb_address = w2 & 0x01ffffff;
+ m_misc_state.m_zb_address = uint32_t(w1) & 0x01ffffff;
}
-void n64_rdp::cmd_set_color_image(uint32_t w1, uint32_t w2)
+void n64_rdp::cmd_set_color_image(uint64_t w1)
{
//wait("SetColorImage");
- m_misc_state.m_fb_format = (w1 >> 21) & 0x7;
- m_misc_state.m_fb_size = (w1 >> 19) & 0x3;
- m_misc_state.m_fb_width = (w1 & 0x3ff) + 1;
- m_misc_state.m_fb_address = w2 & 0x01ffffff;
+ m_misc_state.m_fb_format = uint32_t(w1 >> 53) & 0x7;
+ m_misc_state.m_fb_size = uint32_t(w1 >> 51) & 0x3;
+ m_misc_state.m_fb_width = (uint32_t(w1 >> 32) & 0x3ff) + 1;
+ m_misc_state.m_fb_address = uint32_t(w1) & 0x01ffffff;
if (m_misc_state.m_fb_format < 2 || m_misc_state.m_fb_format > 32) // Jet Force Gemini sets the format to 4, Intensity. Protection?
{
@@ -3001,12 +3017,12 @@ void n64_rdp::cmd_set_color_image(uint32_t w1, uint32_t w2)
/*****************************************************************************/
-void n64_rdp::cmd_invalid(uint32_t w1, uint32_t w2)
+void n64_rdp::cmd_invalid(uint64_t w1)
{
- fatalerror("n64_rdp::Invalid: %d, %08x %08x\n", (w1 >> 24) & 0x3f, w1, w2);
+ fatalerror("n64_rdp::Invalid: %d, %08x %08x\n", uint32_t(w1 >> 56) & 0x3f, uint32_t(w1 >> 32), (uint32_t)w1);
}
-void n64_rdp::cmd_noop(uint32_t w1, uint32_t w2)
+void n64_rdp::cmd_noop(uint64_t w1)
{
// Do nothing
}
@@ -3023,15 +3039,15 @@ void n64_rdp::process_command_list()
}
// load command data
- for(int32_t i = 0; i < length; i += 4)
+ for(int32_t i = 0; i < length; i += 8)
{
m_cmd_data[m_cmd_ptr++] = read_data((m_current & 0x1fffffff) + i);
}
m_current = m_end;
- uint32_t cmd = (m_cmd_data[0] >> 24) & 0x3f;
- uint32_t cmd_length = (m_cmd_ptr + 1) * 4;
+ uint32_t cmd = (m_cmd_data[0] >> 56) & 0x3f;
+ uint32_t cmd_length = uint32_t(m_cmd_ptr + 1) * 8;
set_status(get_status() &~ DP_STATUS_FREEZE);
@@ -3043,78 +3059,79 @@ void n64_rdp::process_command_list()
while (m_cmd_cur < m_cmd_ptr)
{
- cmd = (m_cmd_data[m_cmd_cur] >> 24) & 0x3f;
+ cmd = (m_cmd_data[m_cmd_cur] >> 56) & 0x3f;
- if (((m_cmd_ptr - m_cmd_cur) * 4) < s_rdp_command_length[cmd])
+ if (((m_cmd_ptr - m_cmd_cur) * 8) < s_rdp_command_length[cmd])
{
return;
//fatalerror("rdp_process_list: not enough rdp command data: cur = %d, ptr = %d, expected = %d\n", m_cmd_cur, m_cmd_ptr, s_rdp_command_length[cmd]);
}
+ m_capture.command(&m_cmd_data[m_cmd_cur], s_rdp_command_length[cmd] / 8);
+
if (LOG_RDP_EXECUTION)
{
char string[4000];
disassemble(string);
- fprintf(rdp_exec, "%08X: %08X %08X %s\n", m_start+(m_cmd_cur * 4), m_cmd_data[m_cmd_cur+0], m_cmd_data[m_cmd_cur+1], string);
+ fprintf(rdp_exec, "%08X: %08X%08X %s\n", m_start+(m_cmd_cur * 8), uint32_t(m_cmd_data[m_cmd_cur] >> 32), (uint32_t)m_cmd_data[m_cmd_cur], string);
fflush(rdp_exec);
}
// execute the command
- uint32_t w1 = m_cmd_data[m_cmd_cur+0];
- uint32_t w2 = m_cmd_data[m_cmd_cur+1];
+ uint64_t w = m_cmd_data[m_cmd_cur];
switch(cmd)
{
- case 0x00: cmd_noop(w1, w2); break;
+ case 0x00: cmd_noop(w); break;
- case 0x08: cmd_triangle(w1, w2); break;
- case 0x09: cmd_triangle_z(w1, w2); break;
- case 0x0a: cmd_triangle_t(w1, w2); break;
- case 0x0b: cmd_triangle_tz(w1, w2); break;
- case 0x0c: cmd_triangle_s(w1, w2); break;
- case 0x0d: cmd_triangle_sz(w1, w2); break;
- case 0x0e: cmd_triangle_st(w1, w2); break;
- case 0x0f: cmd_triangle_stz(w1, w2); break;
+ case 0x08: cmd_triangle(w); break;
+ case 0x09: cmd_triangle_z(w); break;
+ case 0x0a: cmd_triangle_t(w); break;
+ case 0x0b: cmd_triangle_tz(w); break;
+ case 0x0c: cmd_triangle_s(w); break;
+ case 0x0d: cmd_triangle_sz(w); break;
+ case 0x0e: cmd_triangle_st(w); break;
+ case 0x0f: cmd_triangle_stz(w); break;
- case 0x24: cmd_tex_rect(w1, w2); break;
- case 0x25: cmd_tex_rect_flip(w1, w2); break;
+ case 0x24: cmd_tex_rect(w); break;
+ case 0x25: cmd_tex_rect_flip(w); break;
- case 0x26: cmd_sync_load(w1, w2); break;
- case 0x27: cmd_sync_pipe(w1, w2); break;
- case 0x28: cmd_sync_tile(w1, w2); break;
- case 0x29: cmd_sync_full(w1, w2); break;
+ case 0x26: cmd_sync_load(w); break;
+ case 0x27: cmd_sync_pipe(w); break;
+ case 0x28: cmd_sync_tile(w); break;
+ case 0x29: cmd_sync_full(w); break;
- case 0x2a: cmd_set_key_gb(w1, w2); break;
- case 0x2b: cmd_set_key_r(w1, w2); break;
+ case 0x2a: cmd_set_key_gb(w); break;
+ case 0x2b: cmd_set_key_r(w); break;
- case 0x2c: cmd_set_convert(w1, w2); break;
- case 0x3c: cmd_set_combine(w1, w2); break;
- case 0x2d: cmd_set_scissor(w1, w2); break;
- case 0x2e: cmd_set_prim_depth(w1, w2); break;
- case 0x2f: cmd_set_other_modes(w1, w2); break;
+ case 0x2c: cmd_set_convert(w); break;
+ case 0x3c: cmd_set_combine(w); break;
+ case 0x2d: cmd_set_scissor(w); break;
+ case 0x2e: cmd_set_prim_depth(w); break;
+ case 0x2f: cmd_set_other_modes(w);break;
- case 0x30: cmd_load_tlut(w1, w2); break;
- case 0x33: cmd_load_block(w1, w2); break;
- case 0x34: cmd_load_tile(w1, w2); break;
+ case 0x30: cmd_load_tlut(w); break;
+ case 0x33: cmd_load_block(w); break;
+ case 0x34: cmd_load_tile(w); break;
- case 0x32: cmd_set_tile_size(w1, w2); break;
- case 0x35: cmd_set_tile(w1, w2); break;
+ case 0x32: cmd_set_tile_size(w); break;
+ case 0x35: cmd_set_tile(w); break;
- case 0x36: cmd_fill_rect(w1, w2); break;
+ case 0x36: cmd_fill_rect(w); break;
- case 0x37: cmd_set_fill_color32(w1, w2); break;
- case 0x38: cmd_set_fog_color(w1, w2); break;
- case 0x39: cmd_set_blend_color(w1, w2); break;
- case 0x3a: cmd_set_prim_color(w1, w2); break;
- case 0x3b: cmd_set_env_color(w1, w2); break;
+ case 0x37: cmd_set_fill_color32(w); break;
+ case 0x38: cmd_set_fog_color(w); break;
+ case 0x39: cmd_set_blend_color(w);break;
+ case 0x3a: cmd_set_prim_color(w); break;
+ case 0x3b: cmd_set_env_color(w); break;
- case 0x3d: cmd_set_texture_image(w1, w2); break;
- case 0x3e: cmd_set_mask_image(w1, w2); break;
- case 0x3f: cmd_set_color_image(w1, w2); break;
+ case 0x3d: cmd_set_texture_image(w); break;
+ case 0x3e: cmd_set_mask_image(w); break;
+ case 0x3f: cmd_set_color_image(w); break;
}
- m_cmd_cur += s_rdp_command_length[cmd] / 4;
+ m_cmd_cur += s_rdp_command_length[cmd] / 8;
};
m_cmd_ptr = 0;
m_cmd_cur = 0;
diff --git a/src/mame/video/n64.h b/src/mame/video/n64.h
index e1b0dd983ca..20eeab81fe2 100644
--- a/src/mame/video/n64.h
+++ b/src/mame/video/n64.h
@@ -6,6 +6,7 @@
#include "emu.h"
#include "includes/n64.h"
#include "video/poly.h"
+#include "pin64.h"
/*****************************************************************************/
@@ -128,7 +129,7 @@ class n64_rdp;
#include "video/rdpblend.h"
#include "video/rdptpipe.h"
-typedef void (*rdp_command_t)(uint32_t w1, uint32_t w2);
+typedef void (*rdp_command_t)(uint64_t w1);
class n64_rdp : public poly_manager<uint32_t, rdp_poly_state, 8, 32000>
{
@@ -163,7 +164,7 @@ public:
}
void process_command_list();
- uint32_t read_data(uint32_t address);
+ uint64_t read_data(uint32_t address);
void disassemble(char* buffer);
void set_machine(running_machine& machine) { m_machine = &machine; }
@@ -224,43 +225,43 @@ public:
bool z_compare(uint32_t zcurpixel, uint32_t dzcurpixel, uint32_t sz, uint16_t dzpix, rdp_span_aux* userdata, const rdp_poly_state &object);
// Commands
- void cmd_invalid(uint32_t w1, uint32_t w2);
- void cmd_noop(uint32_t w1, uint32_t w2);
- void cmd_triangle(uint32_t w1, uint32_t w2);
- void cmd_triangle_z(uint32_t w1, uint32_t w2);
- void cmd_triangle_t(uint32_t w1, uint32_t w2);
- void cmd_triangle_tz(uint32_t w1, uint32_t w2);
- void cmd_triangle_s(uint32_t w1, uint32_t w2);
- void cmd_triangle_sz(uint32_t w1, uint32_t w2);
- void cmd_triangle_st(uint32_t w1, uint32_t w2);
- void cmd_triangle_stz(uint32_t w1, uint32_t w2);
- void cmd_tex_rect(uint32_t w1, uint32_t w2);
- void cmd_tex_rect_flip(uint32_t w1, uint32_t w2);
- void cmd_sync_load(uint32_t w1, uint32_t w2);
- void cmd_sync_pipe(uint32_t w1, uint32_t w2);
- void cmd_sync_tile(uint32_t w1, uint32_t w2);
- void cmd_sync_full(uint32_t w1, uint32_t w2);
- void cmd_set_key_gb(uint32_t w1, uint32_t w2);
- void cmd_set_key_r(uint32_t w1, uint32_t w2);
- void cmd_set_fill_color32(uint32_t w1, uint32_t w2);
- void cmd_set_convert(uint32_t w1, uint32_t w2);
- void cmd_set_scissor(uint32_t w1, uint32_t w2);
- void cmd_set_prim_depth(uint32_t w1, uint32_t w2);
- void cmd_set_other_modes(uint32_t w1, uint32_t w2);
- void cmd_load_tlut(uint32_t w1, uint32_t w2);
- void cmd_set_tile_size(uint32_t w1, uint32_t w2);
- void cmd_load_block(uint32_t w1, uint32_t w2);
- void cmd_load_tile(uint32_t w1, uint32_t w2);
- void cmd_fill_rect(uint32_t w1, uint32_t w2);
- void cmd_set_tile(uint32_t w1, uint32_t w2);
- void cmd_set_fog_color(uint32_t w1, uint32_t w2);
- void cmd_set_blend_color(uint32_t w1, uint32_t w2);
- void cmd_set_prim_color(uint32_t w1, uint32_t w2);
- void cmd_set_env_color(uint32_t w1, uint32_t w2);
- void cmd_set_combine(uint32_t w1, uint32_t w2);
- void cmd_set_texture_image(uint32_t w1, uint32_t w2);
- void cmd_set_mask_image(uint32_t w1, uint32_t w2);
- void cmd_set_color_image(uint32_t w1, uint32_t w2);
+ void cmd_invalid(uint64_t w1);
+ void cmd_noop(uint64_t w1);
+ void cmd_triangle(uint64_t w1);
+ void cmd_triangle_z(uint64_t w1);
+ void cmd_triangle_t(uint64_t w1);
+ void cmd_triangle_tz(uint64_t w1);
+ void cmd_triangle_s(uint64_t w1);
+ void cmd_triangle_sz(uint64_t w1);
+ void cmd_triangle_st(uint64_t w1);
+ void cmd_triangle_stz(uint64_t w1);
+ void cmd_tex_rect(uint64_t w1);
+ void cmd_tex_rect_flip(uint64_t w1);
+ void cmd_sync_load(uint64_t w1);
+ void cmd_sync_pipe(uint64_t w1);
+ void cmd_sync_tile(uint64_t w1);
+ void cmd_sync_full(uint64_t w1);
+ void cmd_set_key_gb(uint64_t w1);
+ void cmd_set_key_r(uint64_t w1);
+ void cmd_set_fill_color32(uint64_t w1);
+ void cmd_set_convert(uint64_t w1);
+ void cmd_set_scissor(uint64_t w1);
+ void cmd_set_prim_depth(uint64_t w1);
+ void cmd_set_other_modes(uint64_t w1);
+ void cmd_load_tlut(uint64_t w1);
+ void cmd_set_tile_size(uint64_t w1);
+ void cmd_load_block(uint64_t w1);
+ void cmd_load_tile(uint64_t w1);
+ void cmd_fill_rect(uint64_t w1);
+ void cmd_set_tile(uint64_t w1);
+ void cmd_set_fog_color(uint64_t w1);
+ void cmd_set_blend_color(uint64_t w1);
+ void cmd_set_prim_color(uint64_t w1);
+ void cmd_set_env_color(uint64_t w1);
+ void cmd_set_combine(uint64_t w1);
+ void cmd_set_texture_image(uint64_t w1);
+ void cmd_set_mask_image(uint64_t w1);
+ void cmd_set_color_image(uint64_t w1);
void rgbaz_clip(int32_t sr, int32_t sg, int32_t sb, int32_t sa, int32_t* sz, rdp_span_aux* userdata);
void rgbaz_correct_triangle(int32_t offx, int32_t offy, int32_t* r, int32_t* g, int32_t* b, int32_t* a, int32_t* z, rdp_span_aux* userdata, const rdp_poly_state &object);
@@ -272,6 +273,8 @@ public:
uint16_t decompress_cvmask_frombyte(uint8_t x);
void lookup_cvmask_derivatives(uint32_t mask, uint8_t* offx, uint8_t* offy, rdp_span_aux* userdata);
+ void mark_frame() { m_capture.mark_frame(*m_machine); }
+
misc_state_t m_misc_state;
// Color constants
@@ -344,8 +347,8 @@ private:
uint32_t m_z_complete_dec_table[0x4000]; //the same for decompressed z values, 14b
uint8_t m_compressed_cvmasks[0x10000]; //16bit cvmask -> to byte
- uint32_t m_cmd_data[0x1000];
- uint32_t m_temp_rect_data[0x1000];
+ uint64_t m_cmd_data[0x800];
+ uint64_t m_temp_rect_data[0x800];
int32_t m_cmd_ptr;
int32_t m_cmd_cur;
@@ -367,6 +370,8 @@ private:
int32_t m_norm_point_rom[64];
int32_t m_norm_slope_rom[64];
+ pin64_t m_capture;
+
static uint32_t s_special_9bit_clamptable[512];
static const z_decompress_entry_t m_z_dec_table[8];
diff --git a/src/mame/video/pin64.cpp b/src/mame/video/pin64.cpp
new file mode 100644
index 00000000000..cbc9ad934dc
--- /dev/null
+++ b/src/mame/video/pin64.cpp
@@ -0,0 +1,506 @@
+// license:BSD-3-Clause
+// copyright-holders:Ryan Holtz
+
+#include "pin64.h"
+
+#define CAP_NAME "pin64_%d.cap"
+
+// pin64_fileutil_t members
+
+void pin64_fileutil_t::write(FILE* file, uint32_t data) {
+ if (!file)
+ return;
+
+ uint8_t temp(data >> 24);
+ fwrite(&temp, 1, 1, file);
+
+ temp = (uint8_t)(data >> 16);
+ fwrite(&temp, 1, 1, file);
+
+ temp = (uint8_t)(data >> 8);
+ fwrite(&temp, 1, 1, file);
+
+ temp = (uint8_t)data;
+ fwrite(&temp, 1, 1, file);
+}
+
+void pin64_fileutil_t::write(FILE* file, const uint8_t* data, uint32_t size) {
+ if (!file)
+ return;
+
+ fwrite(data, 1, size, file);
+}
+
+
+
+// pin64_data_t members
+
+void pin64_data_t::put8(uint8_t data) {
+ m_data.push_back(data);
+ m_offset++;
+}
+
+void pin64_data_t::put16(uint16_t data) {
+ put8((uint8_t)(data >> 8));
+ put8((uint8_t)data);
+}
+
+void pin64_data_t::put32(uint32_t data) {
+ put16((uint16_t)(data >> 16));
+ put16((uint16_t)data);
+}
+
+void pin64_data_t::put64(uint64_t data) {
+ put32((uint32_t)(data >> 32));
+ put32((uint32_t)data);
+}
+
+uint8_t pin64_data_t::get8() {
+ if (m_offset >= m_data.size())
+ fatalerror("PIN64: Call to pin64_data_t::get8() at end of block (requested offset %x, size %x)\n", m_offset, (uint32_t)m_data.size());
+
+ uint8_t ret = m_data[m_offset];
+ m_offset++;
+
+ return ret;
+}
+
+uint16_t pin64_data_t::get16() {
+ uint16_t ret = (uint16_t)get8() << 8;
+ return ret | get8();
+}
+
+uint32_t pin64_data_t::get32() {
+ uint32_t ret = (uint32_t)get16() << 16;
+ return ret | get16();
+}
+
+uint64_t pin64_data_t::get64() {
+ uint64_t ret = (uint64_t)get32() << 32;
+ return ret | get32();
+}
+
+uint8_t pin64_data_t::get8(uint32_t offset, bool temp_access) {
+ update_offset(offset, temp_access);
+
+ uint8_t ret = get8();
+ m_offset = m_old_offset;
+ return ret;
+}
+
+uint16_t pin64_data_t::get16(uint32_t offset, bool temp_access) {
+ update_offset(offset, temp_access);
+
+ uint16_t ret = get16();
+ m_offset = m_old_offset;
+ return ret;
+}
+
+uint32_t pin64_data_t::get32(uint32_t offset, bool temp_access) {
+ update_offset(offset, temp_access);
+
+ uint32_t ret = get32();
+ m_offset = m_old_offset;
+ return ret;
+}
+
+uint64_t pin64_data_t::get64(uint32_t offset, bool temp_access) {
+ update_offset(offset, temp_access);
+
+ uint32_t ret = get64();
+ m_offset = m_old_offset;
+ return ret;
+}
+
+void pin64_data_t::reset() {
+ m_old_offset = 0;
+ m_offset = 0;
+}
+
+void pin64_data_t::clear() {
+ reset();
+ m_data.clear();
+}
+
+void pin64_data_t::update_offset(uint32_t offset, bool update_current) {
+ m_old_offset = (update_current ? offset : m_offset);
+ m_offset = offset;
+}
+
+
+
+// pin64_printer_t members
+
+void pin64_printer_t::print_data(pin64_block_t* block) {
+ pin64_data_t* data = block->data();
+
+ printf(" CRC32: %08x\n", (uint32_t)block->crc32()); fflush(stdout);
+ printf(" Data Size: %08x\n", (uint32_t)data->size()); fflush(stdout);
+ printf(" Data: "); fflush(stdout);
+
+ const uint32_t data_size = data->size();
+ const uint32_t row_count = (data_size + 31) / 32;
+ const uint8_t* bytes = data->bytes();
+ for (uint32_t row = 0; row < row_count; row++) {
+ const uint32_t row_index = row * 32;
+ const uint32_t data_remaining = data_size - row_index;
+ const uint32_t col_count = (data_remaining > 32 ? 32 : data_remaining);
+ for (uint32_t col = 0; col < col_count; col++) {
+ printf("%02x ", bytes[row_index + col]); fflush(stdout);
+ }
+
+ if (row == (row_count - 1)) {
+ printf("\n"); fflush(stdout);
+ } else {
+ printf("\n "); fflush(stdout);
+ }
+ }
+
+ printf("\n"); fflush(stdout);
+}
+
+void pin64_printer_t::print_command(int cmd_start, int cmd, std::unordered_map<util::crc32_t, pin64_block_t*>& blocks, std::vector<util::crc32_t>& commands) {
+ pin64_block_t* block = blocks[commands[cmd]];
+ pin64_data_t* data = block->data();
+
+ printf(" Command %d:\n", cmd - cmd_start); fflush(stdout);
+ const uint32_t cmd_size(data->get32());
+ printf(" CRC32: %08x\n", (uint32_t)commands[cmd]); fflush(stdout);
+ printf(" Packet Data Size: %d words\n", cmd_size); fflush(stdout);
+ printf(" Packet Data: "); fflush(stdout);
+
+ bool load_command = false;
+ for (int i = 0; i < cmd_size; i++) {
+ const uint64_t cmd_entry(data->get64());
+ if (i == 0) {
+ const uint8_t top_byte = uint8_t(cmd_entry >> 56) & 0x3f;
+ if (top_byte == 0x30 || top_byte == 0x33 || top_byte == 0x34)
+ load_command = true;
+ }
+ printf("%08x%08x\n", uint32_t(cmd_entry >> 32), (uint32_t)cmd_entry); fflush(stdout);
+
+ if (i < (cmd_size - 1)) {
+ printf(" "); fflush(stdout);
+ }
+ }
+
+ printf(" Data Block Present: %s\n", load_command ? "Yes" : "No"); fflush(stdout);
+
+ if (load_command) {
+ printf(" Data Block CRC32: %08x\n", data->get32()); fflush(stdout);
+ }
+
+ data->reset();
+};
+
+
+
+// pin64_block_t members
+
+void pin64_block_t::finalize() {
+ if (m_data.size() > 0)
+ m_crc32 = util::crc32_creator::simple(m_data.bytes(), m_data.size());
+ else
+ m_crc32 = ~0;
+ m_data.reset();
+}
+
+void pin64_block_t::clear() {
+ m_crc32 = 0;
+ m_data.clear();
+}
+
+void pin64_block_t::write(FILE* file) {
+ pin64_fileutil_t::write(file, m_crc32);
+ pin64_fileutil_t::write(file, m_data.size());
+ if (m_data.size() > 0)
+ pin64_fileutil_t::write(file, m_data.bytes(), m_data.size());
+}
+
+uint32_t pin64_block_t::size() {
+ return sizeof(uint32_t) // data CRC32
+ + sizeof(uint32_t) // data size
+ + m_data.size(); // data
+}
+
+
+
+// pin64_t members
+
+const uint8_t pin64_t::CAP_ID[8] = { 'P', 'I', 'N', '6', '4', 'C', 'A', 'P' };
+
+pin64_t::~pin64_t() {
+ if (m_capture_file)
+ finish();
+
+ clear();
+}
+
+void pin64_t::start(int frames)
+{
+ if (m_capture_index == ~0)
+ init_capture_index();
+
+ if (m_capture_file)
+ fatalerror("PIN64: Call to start() while already capturing\n");
+
+ char name_buf[256];
+ sprintf(name_buf, CAP_NAME, m_capture_index);
+ m_capture_index++;
+
+ m_capture_file = fopen(name_buf, "wb");
+
+ m_capture_frames = frames;
+
+ m_frames.push_back(0);
+}
+
+void pin64_t::finish() {
+ if (!m_capture_file)
+ return;
+
+ finalize();
+ print();
+
+ write(m_capture_file);
+ fclose(m_capture_file);
+ m_capture_file = nullptr;
+
+ clear();
+}
+
+void pin64_t::finalize() {
+ finish_command();
+ data_end();
+}
+
+void pin64_t::play(int index) {
+}
+
+void pin64_t::mark_frame(running_machine& machine) {
+ if (m_capture_file) {
+ if (m_frames.size() == m_capture_frames && m_capture_frames > 0) {
+ printf("\n");
+ finish();
+ machine.popmessage("Done recording.");
+ } else {
+ printf("%d ", (uint32_t)m_commands.size());
+ m_frames.push_back((uint32_t)m_commands.size());
+ }
+ }
+
+#if PIN64_ENABLE_CAPTURE
+ if (machine.input().code_pressed_once(KEYCODE_N) && !m_capture_file) {
+ start(1);
+ machine.popmessage("Capturing PIN64 snapshot to pin64_%d.cap", m_capture_index - 1);
+ } else if (machine.input().code_pressed_once(KEYCODE_M)) {
+ if (m_capture_file) {
+ finish();
+ machine.popmessage("Done recording.");
+ } else {
+ start();
+ machine.popmessage("Recording PIN64 movie to pin64_%d.cap", m_capture_index - 1);
+ }
+ }
+#endif
+}
+
+void pin64_t::command(uint64_t* cmd_data, uint32_t size) {
+ if (!capturing())
+ return;
+
+ finish_command();
+
+ m_current_command = new pin64_block_t();
+ m_current_command->data()->put32(size);
+
+ for (uint32_t i = 0 ; i < size; i++)
+ m_current_command->data()->put64(cmd_data[i]);
+}
+
+void pin64_t::finish_command() {
+ if (!m_current_command)
+ return;
+
+ m_current_command->finalize();
+ if (m_blocks.find(m_current_command->crc32()) == m_blocks.end())
+ m_blocks[m_current_command->crc32()] = m_current_command;
+
+ m_commands.push_back(m_current_command->crc32());
+}
+
+void pin64_t::data_begin() {
+ if (!capturing())
+ return;
+
+ if (m_current_data)
+ data_end();
+
+ m_current_data = new pin64_block_t();
+}
+
+pin64_data_t* pin64_t::data_block() {
+ if (!capturing() || !m_current_data)
+ return &m_dummy_data;
+
+ return m_current_data->data();
+}
+
+void pin64_t::data_end() {
+ if (!capturing() || !m_current_data)
+ return;
+
+ m_current_data->finalize();
+ m_current_command->data()->put32(m_current_data->crc32());
+ finish_command();
+
+ if (m_blocks.find(m_current_data->crc32()) == m_blocks.end())
+ m_blocks[m_current_data->crc32()] = m_current_data;
+
+ m_current_data = nullptr;
+}
+
+size_t pin64_t::size() {
+ return header_size() + block_directory_size() + cmdlist_directory_size() + cmdlist_size();
+}
+
+size_t pin64_t::header_size() {
+ return sizeof(uint8_t) * 8 // "PIN64CAP"
+ + sizeof(uint32_t) // total file size
+ + sizeof(uint32_t) // start of block directory data
+ + sizeof(uint32_t) // start of command-list directory data
+ + sizeof(uint32_t) // start of blocks
+ + sizeof(uint32_t); // start of commands
+}
+
+size_t pin64_t::block_directory_size() {
+ return (m_blocks.size() + 1) * sizeof(uint32_t);
+}
+
+size_t pin64_t::cmdlist_directory_size() {
+ return (m_frames.size() + 1) * sizeof(uint16_t);
+}
+
+size_t pin64_t::blocks_size() {
+ size_t block_size = 0;
+ for (std::pair<util::crc32_t, pin64_block_t*> block_pair : m_blocks)
+ block_size += (block_pair.second)->size();
+
+ return block_size;
+}
+
+size_t pin64_t::cmdlist_size() {
+ return (m_commands.size() + 1) * sizeof(uint32_t);
+}
+
+void pin64_t::print()
+{
+ printf("Total Size: %9x bytes\n", (uint32_t)size()); fflush(stdout);
+ printf("Header Size: %9x bytes\n", (uint32_t)header_size()); fflush(stdout);
+ printf("Block Dir Size: %9x bytes\n", (uint32_t)block_directory_size()); fflush(stdout);
+ printf("Cmdlist Dir Size: %9x bytes\n", (uint32_t)cmdlist_directory_size()); fflush(stdout);
+ printf("Blocks Size: %9x bytes\n", (uint32_t)blocks_size()); fflush(stdout);
+ printf("Cmdlist Size: %9x bytes\n", (uint32_t)cmdlist_size()); fflush(stdout);
+
+ printf("Command-List Count: %d\n", (uint32_t)m_frames.size()); fflush(stdout);
+ for (int i = 0; i < m_frames.size(); i++) {
+ printf(" List %d:\n", i); fflush(stdout);
+
+ const int next_start = ((i == (m_frames.size() - 1)) ? m_commands.size() : m_frames[i+1]);
+ for (int cmd = m_frames[i]; cmd < next_start; cmd++) {
+ pin64_printer_t::print_command(m_frames[i], cmd, m_blocks, m_commands);
+ }
+ if (i == (m_frames.size() - 1)) {
+ printf("\n"); fflush(stdout);
+ }
+ }
+
+ printf("\nData Block Count: %d\n", (uint32_t)m_blocks.size()); fflush(stdout);
+ int i = 0;
+ for (std::pair<util::crc32_t, pin64_block_t*> block_pair : m_blocks) {
+ printf(" Block %d:\n", i); fflush(stdout);
+
+ pin64_printer_t::print_data((block_pair.second));
+ if (i == (m_blocks.size() - 1)) {
+ printf("\n"); fflush(stdout);
+ }
+ i++;
+ }
+}
+
+void pin64_t::write(FILE* file) {
+ const uint32_t size_total = size();
+ const uint32_t size_header = header_size();
+ const uint32_t size_block_dir = block_directory_size();
+ const uint32_t size_cmdlist_dir = cmdlist_directory_size();
+ const uint32_t size_blocks_dir = blocks_size();
+
+ pin64_fileutil_t::write(file, CAP_ID, 8);
+ pin64_fileutil_t::write(file, size_total);
+ pin64_fileutil_t::write(file, size_header);
+ pin64_fileutil_t::write(file, size_header + size_block_dir);
+ pin64_fileutil_t::write(file, size_header + size_block_dir + size_cmdlist_dir);
+ pin64_fileutil_t::write(file, size_header + size_block_dir + size_cmdlist_dir + size_blocks_dir);
+
+ write_data_directory(file);
+ write_cmdlist_directory(file);
+
+ for (std::pair<util::crc32_t, pin64_block_t*> block_pair : m_blocks)
+ (block_pair.second)->write(file);
+
+ pin64_fileutil_t::write(file, m_commands.size());
+ for (util::crc32_t crc : m_commands)
+ pin64_fileutil_t::write(file, crc);
+}
+
+void pin64_t::write_data_directory(FILE* file) {
+ pin64_fileutil_t::write(file, m_blocks.size());
+ size_t offset(header_size());
+ for (std::pair<util::crc32_t, pin64_block_t*> block_pair : m_blocks) {
+ pin64_fileutil_t::write(file, offset);
+ offset += (block_pair.second)->size();
+ }
+}
+
+void pin64_t::write_cmdlist_directory(FILE* file) {
+ pin64_fileutil_t::write(file, m_frames.size());
+ for (uint32_t frame : m_frames)
+ pin64_fileutil_t::write(file, frame);
+}
+
+void pin64_t::clear() {
+ if (m_capture_file != nullptr) {
+ fclose(m_capture_file);
+ m_capture_file = nullptr;
+ }
+
+ for (std::pair<util::crc32_t, pin64_block_t*> block_pair : m_blocks)
+ delete block_pair.second;
+
+ m_blocks.clear();
+ m_commands.clear();
+ m_frames.clear();
+
+ m_current_data = nullptr;
+ m_current_command = nullptr;
+}
+
+void pin64_t::init_capture_index()
+{
+ char name_buf[256];
+ bool found = true;
+
+ m_capture_index = 0;
+
+ do {
+ sprintf(name_buf, CAP_NAME, m_capture_index);
+
+ FILE* temp = fopen(name_buf, "rb");
+ if (temp == nullptr) {
+ break;
+ } else {
+ fclose(temp);
+ m_capture_index++;
+ }
+ } while(found);
+}
diff --git a/src/mame/video/pin64.h b/src/mame/video/pin64.h
new file mode 100644
index 00000000000..d8e82395f25
--- /dev/null
+++ b/src/mame/video/pin64.h
@@ -0,0 +1,180 @@
+// license:BSD-3-Clause
+// copyright-holders:Ryan Holtz
+#pragma once
+
+#ifndef PIN64_H
+#define PIN64_H
+
+#include <cstdio>
+#include <vector>
+#include <map>
+
+#define PIN64_ENABLE_CAPTURE (0)
+
+#include "emu.h"
+
+class pin64_fileutil_t {
+public:
+ static void write(FILE* file, uint32_t data);
+ static void write(FILE* file, const uint8_t* data, uint32_t size);
+};
+
+class pin64_command_t {
+public:
+ std::vector<uint8_t> data;
+};
+
+class pin64_data_t {
+public:
+ pin64_data_t()
+ : m_offset(0)
+ , m_old_offset(0) { }
+
+ void reset();
+ void clear();
+
+ // setters
+ virtual void put8(uint8_t data);
+ virtual void put16(uint16_t data);
+ virtual void put32(uint32_t data);
+ virtual void put64(uint64_t data);
+
+ // getters
+ virtual uint8_t get8();
+ virtual uint8_t get8(uint32_t offset, bool temp_access = false);
+ virtual uint16_t get16();
+ virtual uint16_t get16(uint32_t offset, bool temp_access = false);
+ virtual uint32_t get32();
+ virtual uint32_t get32(uint32_t offset, bool temp_access = false);
+ virtual uint64_t get64();
+ virtual uint64_t get64(uint32_t offset, bool temp_access = false);
+ virtual uint32_t offset() { return m_offset; }
+ uint8_t* bytes() { return (m_data.size() > 0) ? &m_data[0] : nullptr; }
+ uint32_t size() { return m_data.size(); }
+
+private:
+ void update_offset(uint32_t offset, bool temp_access = false);
+
+protected:
+ std::vector<uint8_t> m_data;
+
+ uint32_t m_offset;
+ uint32_t m_old_offset;
+};
+
+class pin64_dummy_data_t : public pin64_data_t {
+public:
+ void put8(uint8_t data) override { }
+ void put16(uint16_t data) override { }
+ void put32(uint32_t data) override { }
+ void put64(uint64_t data) override { }
+
+ uint8_t get8() override { return 0; }
+ uint8_t get8(uint32_t offset, bool update_current = true) override { return 0; }
+ uint16_t get16() override { return 0; }
+ uint16_t get16(uint32_t offset, bool update_current = true) override { return 0; }
+ uint32_t get32() override { return 0; }
+ uint32_t get32(uint32_t offset, bool update_current = true) override { return 0; }
+ uint64_t get64() override { return 0; }
+ uint64_t get64(uint32_t offset, bool update_current = true) override { return 0; }
+
+ uint32_t offset() override { return 0; }
+};
+
+class pin64_block_t {
+public:
+ pin64_block_t()
+ : m_crc32{0} { }
+ virtual ~pin64_block_t() { }
+
+ void finalize();
+ void clear();
+
+ void write(FILE* file);
+
+ // getters
+ uint32_t size();
+ pin64_data_t* data() { return &m_data; }
+ util::crc32_t crc32() const { return m_crc32; }
+
+protected:
+ util::crc32_t m_crc32;
+ pin64_data_t m_data;
+};
+
+class pin64_printer_t {
+public:
+ static void print_data(pin64_block_t* block);
+ static void print_command(int cmd_start, int cmd, std::unordered_map<util::crc32_t, pin64_block_t*>& blocks, std::vector<util::crc32_t>& commands);
+};
+
+class pin64_t
+{
+public:
+ pin64_t()
+ : m_capture_file(nullptr)
+ , m_capture_index(~0)
+ , m_capture_frames(0)
+ , m_current_data(nullptr)
+ , m_current_command(nullptr)
+ , m_playing(false)
+ { }
+ ~pin64_t();
+
+ void start(int frames = 0);
+ void finish();
+ void clear();
+ void print();
+
+ void mark_frame(running_machine& machine);
+ void play(int index);
+
+ void command(uint64_t* cmd_data, uint32_t size);
+
+ void data_begin();
+ pin64_data_t* data_block();
+ pin64_block_t& block() { return *m_current_data; }
+ void data_end();
+
+ bool capturing() const { return m_capture_file != nullptr; }
+ bool playing() const { return m_playing; }
+
+ size_t size();
+
+private:
+ void start_command_block();
+
+ void write(FILE* file);
+
+ size_t header_size();
+ size_t block_directory_size();
+ size_t cmdlist_directory_size();
+ size_t blocks_size();
+ size_t cmdlist_size();
+
+ void finish_command();
+
+ void write_data_directory(FILE* file);
+ void write_cmdlist_directory(FILE* file);
+ void init_capture_index();
+
+ void finalize();
+
+ FILE *m_capture_file;
+ int32_t m_capture_index;
+ int m_capture_frames;
+
+ pin64_block_t* m_current_data;
+ pin64_block_t* m_current_command;
+ std::unordered_map<util::crc32_t, pin64_block_t*> m_blocks;
+
+ std::vector<util::crc32_t> m_commands;
+ std::vector<uint32_t> m_frames;
+
+ bool m_playing;
+
+ pin64_dummy_data_t m_dummy_data;
+ static const uint8_t CAP_ID[8];
+};
+
+#endif // PIN64_H \ No newline at end of file
diff --git a/src/mame/video/stic.cpp b/src/mame/video/stic.cpp
index 20106936c97..705c895d9ae 100644
--- a/src/mame/video/stic.cpp
+++ b/src/mame/video/stic.cpp
@@ -924,7 +924,7 @@ WRITE16_MEMBER( stic_device::write )
case STIC_CSR + STIC_CSR1:
case STIC_CSR + STIC_CSR2:
case STIC_CSR + STIC_CSR3:
- logerror("Setting color_stack[%x] = %x (%x)\n", offset & (STIC_CSRS - 1),data & STIC_CSR_BG, space.device().safe_pc());
+ //logerror("Setting color_stack[%x] = %x (%x)\n", offset & (STIC_CSRS - 1),data & STIC_CSR_BG, space.device().safe_pc());
break;
// Border Color
case STIC_BCR: