summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Robbbert <robbbert@users.noreply.github.com>2012-09-26 11:50:21 +0000
committer Robbbert <robbbert@users.noreply.github.com>2012-09-26 11:50:21 +0000
commit378cf38b3e8ffdabb44f3485139e1e72d8054255 (patch)
tree660f37d14c5933b0b3105671f4d3355cdeedb795
parent3722c2ac148646cfba4820a5759e920112e9240c (diff)
SPECTRA - more wip
-rw-r--r--.gitattributes1
-rw-r--r--src/mame/drivers/spectra.c47
-rw-r--r--src/mame/layout/spectra.lay142
-rw-r--r--src/mame/mame.mak2
4 files changed, 180 insertions, 12 deletions
diff --git a/.gitattributes b/.gitattributes
index 6fd41ce552a..66b3448aa85 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -4410,6 +4410,7 @@ src/mame/layout/solarq.lay svneol=native#text/plain
src/mame/layout/sos.lay svneol=native#text/plain
src/mame/layout/spacewin.lay -text svneol=native#plain/text
src/mame/layout/spacwalk.lay svneol=native#text/plain
+src/mame/layout/spectra.lay svneol=native#text/plain
src/mame/layout/splus.lay svneol=native#text/plain
src/mame/layout/sspeedr.lay svneol=native#text/plain
src/mame/layout/sstrangr.lay svneol=native#text/plain
diff --git a/src/mame/drivers/spectra.c b/src/mame/drivers/spectra.c
index 694d2b08463..363f92c1716 100644
--- a/src/mame/drivers/spectra.c
+++ b/src/mame/drivers/spectra.c
@@ -14,7 +14,7 @@
#include "cpu/m6502/m6502.h"
#include "machine/6532riot.h"
#include "machine/nvram.h"
-//#include "spectra.lh"
+#include "spectra.lh"
class spectra_state : public driver_device
@@ -23,6 +23,7 @@ public:
spectra_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
+ m_p_ram(*this, "ram"),
m_samples(*this, "samples")
{ }
@@ -30,23 +31,27 @@ public:
DECLARE_READ8_MEMBER(portb_r);
DECLARE_WRITE8_MEMBER(porta_w);
DECLARE_WRITE8_MEMBER(portb_w);
+ TIMER_DEVICE_CALLBACK_MEMBER(nmitimer);
+ TIMER_DEVICE_CALLBACK_MEMBER(outtimer);
protected:
// devices
required_device<cpu_device> m_maincpu;
+ required_shared_ptr<UINT8> m_p_ram;
required_device<samples_device> m_samples;
// driver_device overrides
virtual void machine_reset();
-public:
- DECLARE_DRIVER_INIT(spectra);
+private:
+ UINT8 m_t_c;
+ UINT8 m_out_offs;
};
static ADDRESS_MAP_START( spectra_map, AS_PROGRAM, 8, spectra_state )
ADDRESS_MAP_UNMAP_HIGH
ADDRESS_MAP_GLOBAL_MASK(0xfff)
- AM_RANGE(0x0000, 0x00ff) AM_RAM AM_SHARE("nvram") // battery backed, 2x 5101L
+ AM_RANGE(0x0000, 0x00ff) AM_RAM AM_SHARE("ram") // battery backed, 2x 5101L
AM_RANGE(0x0100, 0x017f) AM_RAM // RIOT RAM
AM_RANGE(0x0180, 0x019f) AM_DEVREADWRITE_LEGACY("riot", riot6532_r, riot6532_w)
AM_RANGE(0x0400, 0x0fff) AM_ROM
@@ -57,10 +62,7 @@ INPUT_PORTS_END
void spectra_state::machine_reset()
{
-}
-
-DRIVER_INIT_MEMBER(spectra_state,spectra)
-{
+ m_t_c = 0;
}
READ8_MEMBER( spectra_state::porta_r )
@@ -70,7 +72,7 @@ READ8_MEMBER( spectra_state::porta_r )
READ8_MEMBER( spectra_state::portb_r )
{printf("ReadB ");
- return 0;
+ return 0x5a;
}
WRITE8_MEMBER( spectra_state::porta_w )
@@ -91,15 +93,36 @@ static const riot6532_interface riot6532_intf =
DEVCB_CPU_INPUT_LINE("maincpu", M6502_IRQ_LINE) // interrupt
};
+TIMER_DEVICE_CALLBACK_MEMBER( spectra_state::nmitimer)
+{
+ if (m_t_c > 0x80)
+ m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
+ else
+ m_t_c++;
+}
+
+TIMER_DEVICE_CALLBACK_MEMBER( spectra_state::outtimer)
+{
+ static const UINT8 patterns[16] = { 0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f, 0x38, 0x63, 0x01, 0x40, 0x08, 0 }; // 74C912
+ m_out_offs++;
+
+ if (m_out_offs < 0x28)
+ output_set_digit_value(m_out_offs, patterns[m_p_ram[m_out_offs]&15]);
+ else
+ m_out_offs = 0xff;
+}
+
static MACHINE_CONFIG_START( spectra, spectra_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", M6502, 3579545/4) // actually a 6503
MCFG_CPU_PROGRAM_MAP(spectra_map)
MCFG_RIOT6532_ADD("riot", 3579545/4, riot6532_intf) // R6532
- MCFG_NVRAM_ADD_0FILL("nvram")
+ MCFG_NVRAM_ADD_0FILL("ram")
+ MCFG_TIMER_DRIVER_ADD_PERIODIC("nmitimer", spectra_state, nmitimer, attotime::from_hz(120))
+ MCFG_TIMER_DRIVER_ADD_PERIODIC("outtimer", spectra_state, outtimer, attotime::from_hz(1200))
/* Video */
- //MCFG_DEFAULT_LAYOUT(layout_spectra)
+ MCFG_DEFAULT_LAYOUT(layout_spectra)
/* Sound */
MCFG_FRAGMENT_ADD( genpin_audio )
@@ -117,4 +140,4 @@ ROM_START(spectra)
ROM_END
-GAME(1979, spectra, 0, spectra, spectra, spectra_state, spectra, ROT0, "Valley", "Spectra IV", GAME_IS_SKELETON_MECHANICAL)
+GAME(1979, spectra, 0, spectra, spectra, driver_device, 0, ROT0, "Valley", "Spectra IV", GAME_IS_SKELETON_MECHANICAL)
diff --git a/src/mame/layout/spectra.lay b/src/mame/layout/spectra.lay
new file mode 100644
index 00000000000..fcaca936dbb
--- /dev/null
+++ b/src/mame/layout/spectra.lay
@@ -0,0 +1,142 @@
+<!-- spectra.lay -->
+
+<!-- 2012-09-26: Initial version. [Robbbert] -->
+
+<mamelayout version="2">
+
+ <element name="digit" defstate="0">
+ <led7seg>
+ <color red="1.0" green="0.0" blue="0.0" />
+ </led7seg>
+ </element>
+
+ <element name="background">
+ <rect>
+ <bounds left="0" top="0" right="1" bottom="1" />
+ <color red="0.0" green="0.0" blue="0.0" />
+ </rect>
+ </element>
+ <element name="P0"><text string="Ball / Match"><color red="1.0" green="1.0" blue="1.0" /></text></element>
+ <element name="P1"><text string="Credits"><color red="1.0" green="1.0" blue="1.0" /></text></element>
+ <element name="P3"><text string="Player 1"><color red="1.0" green="1.0" blue="1.0" /></text></element>
+ <element name="P4"><text string="Player 2"><color red="1.0" green="1.0" blue="1.0" /></text></element>
+ <element name="P5"><text string="Player 3"><color red="1.0" green="1.0" blue="1.0" /></text></element>
+ <element name="P6"><text string="Player 4"><color red="1.0" green="1.0" blue="1.0" /></text></element>
+
+ <view name="Default Layout">
+
+ <!-- Background -->
+ <backdrop element="background">
+ <bounds left="0" top="20" right="274" bottom="394" />
+ </backdrop>
+
+ <!-- LEDs -->
+
+ <!-- Player 1 Score -->
+
+ <bezel name="digit32" element="digit">
+ <bounds left="10" top="45" right="44" bottom="84" />
+ </bezel>
+ <bezel name="digit33" element="digit">
+ <bounds left="54" top="45" right="88" bottom="84" />
+ </bezel>
+ <bezel name="digit34" element="digit">
+ <bounds left="98" top="45" right="132" bottom="84" />
+ </bezel>
+ <bezel name="digit35" element="digit">
+ <bounds left="142" top="45" right="176" bottom="84" />
+ </bezel>
+ <bezel name="digit36" element="digit">
+ <bounds left="186" top="45" right="220" bottom="84" />
+ </bezel>
+ <bezel name="digit37" element="digit">
+ <bounds left="230" top="45" right="264" bottom="84" />
+ </bezel>
+
+ <!-- Player 2 Score -->
+ <bezel name="digit24" element="digit">
+ <bounds left="10" top="105" right="44" bottom="144" />
+ </bezel>
+ <bezel name="digit25" element="digit">
+ <bounds left="54" top="105" right="88" bottom="144" />
+ </bezel>
+ <bezel name="digit26" element="digit">
+ <bounds left="98" top="105" right="132" bottom="144" />
+ </bezel>
+ <bezel name="digit27" element="digit">
+ <bounds left="142" top="105" right="176" bottom="144" />
+ </bezel>
+ <bezel name="digit28" element="digit">
+ <bounds left="186" top="105" right="220" bottom="144" />
+ </bezel>
+ <bezel name="digit29" element="digit">
+ <bounds left="230" top="105" right="264" bottom="144" />
+ </bezel>
+
+ <!-- Player 3 Score -->
+ <bezel name="digit16" element="digit">
+ <bounds left="10" top="165" right="44" bottom="204" />
+ </bezel>
+ <bezel name="digit17" element="digit">
+ <bounds left="54" top="165" right="88" bottom="204" />
+ </bezel>
+ <bezel name="digit18" element="digit">
+ <bounds left="98" top="165" right="132" bottom="204" />
+ </bezel>
+ <bezel name="digit19" element="digit">
+ <bounds left="142" top="165" right="176" bottom="204" />
+ </bezel>
+ <bezel name="digit20" element="digit">
+ <bounds left="186" top="165" right="220" bottom="204" />
+ </bezel>
+ <bezel name="digit21" element="digit">
+ <bounds left="230" top="165" right="264" bottom="204" />
+ </bezel>
+
+ <!-- Player 4 Score -->
+ <bezel name="digit8" element="digit">
+ <bounds left="10" top="225" right="44" bottom="264" />
+ </bezel>
+ <bezel name="digit9" element="digit">
+ <bounds left="54" top="225" right="88" bottom="264" />
+ </bezel>
+ <bezel name="digit10" element="digit">
+ <bounds left="98" top="225" right="132" bottom="264" />
+ </bezel>
+ <bezel name="digit11" element="digit">
+ <bounds left="142" top="225" right="176" bottom="264" />
+ </bezel>
+ <bezel name="digit12" element="digit">
+ <bounds left="186" top="225" right="220" bottom="264" />
+ </bezel>
+ <bezel name="digit13" element="digit">
+ <bounds left="230" top="225" right="264" bottom="264" />
+ </bezel>
+
+ <!-- Credits and Balls -->
+ <bezel name="digit0" element="digit">
+ <bounds left="10" top="345" right="44" bottom="384" />
+ </bezel>
+ <bezel name="digit1" element="digit">
+ <bounds left="54" top="345" right="88" bottom="384" />
+ </bezel>
+ <bezel name="digit2" element="digit">
+ <bounds left="98" top="345" right="132" bottom="384" />
+ </bezel>
+ <bezel name="digit3" element="digit">
+ <bounds left="142" top="345" right="176" bottom="384" />
+ </bezel>
+ <bezel name="digit4" element="digit">
+ <bounds left="186" top="345" right="220" bottom="384" />
+ </bezel>
+ <bezel name="digit5" element="digit">
+ <bounds left="230" top="345" right="264" bottom="384" />
+ </bezel>
+ <bezel element="P0"><bounds left="200" right="258" top="330" bottom="342" /></bezel>
+ <bezel element="P1"><bounds left="30" right="88" top="330" bottom="342" /></bezel>
+ <bezel element="P3"><bounds left="100" right="180" top="30" bottom="42" /></bezel>
+ <bezel element="P4"><bounds left="100" right="180" top="90" bottom="102" /></bezel>
+ <bezel element="P5"><bounds left="100" right="180" top="150" bottom="162" /></bezel>
+ <bezel element="P6"><bounds left="100" right="180" top="210" bottom="222" /></bezel>
+ </view>
+</mamelayout>
diff --git a/src/mame/mame.mak b/src/mame/mame.mak
index e6cd46a0c16..9ca5fdcf144 100644
--- a/src/mame/mame.mak
+++ b/src/mame/mame.mak
@@ -2195,6 +2195,8 @@ $(DRIVERS)/segaybd.o: $(LAYOUT)/pdrift.lh
$(DRIVERS)/snookr10.o: $(LAYOUT)/snookr10.lh
+$(DRIVERS)/spectra.o: $(LAYOUT)/spectra.lh
+
$(DRIVERS)/splus.o: $(LAYOUT)/splus.lh
$(DRIVERS)/sspeedr.o: $(LAYOUT)/sspeedr.lh