diff options
Diffstat (limited to 'src')
690 files changed, 18552 insertions, 10629 deletions
diff --git a/src/build/makelist.py b/src/build/makelist.py index 1f94814bf88..144dc636c8d 100644 --- a/src/build/makelist.py +++ b/src/build/makelist.py @@ -11,7 +11,7 @@ drivlist = [] def parse_file(srcfile): try: - fp = open(srcfile, 'rb') + fp = open(srcfile, 'rt') except IOError: sys.stderr.write("Unable to open source file '%s'\n" % srcfile) return 1 diff --git a/src/build/png.py b/src/build/png.py index f096a1dbdf5..8d504ec8ea0 100644 --- a/src/build/png.py +++ b/src/build/png.py @@ -143,15 +143,16 @@ And now, my famous members """ # http://www.python.org/doc/2.2.3/whatsnew/node5.html -from __future__ import generators +from __future__ import generators,print_function __version__ = "0.0.17" from array import array -try: # See :pyver:old - import itertools +try: + from itertools import imap except ImportError: - pass + imap = map +from itertools import starmap import math # http://www.python.org/doc/2.4.4/lib/module-operator.html import operator @@ -1650,11 +1651,10 @@ class Reader: spb = 8//self.bitdepth out = array('B') mask = 2**self.bitdepth - 1 - shifts = map(self.bitdepth.__mul__, reversed(range(spb))) + shifts = list(map(self.bitdepth.__mul__, reversed(range(spb)))) for o in raw: - out.extend(map(lambda i: mask&(o>>i), shifts)) + out.extend(list(map(lambda i: mask&(o>>i), shifts))) return out[:width] - return itertools.imap(asvalues, rows) def serialtoflat(self, bytes, width=None): @@ -1915,8 +1915,8 @@ class Reader: while True: try: type, data = self.chunk(lenient=lenient) - except ValueError, e: - raise ChunkError(e.args[0]) + except ValueError: + raise ChunkError(sys.exc_info()[1].args[0]) if type == 'IEND': # http://www.w3.org/TR/PNG/#11IEND break @@ -1947,7 +1947,6 @@ class Reader: self.preamble(lenient=lenient) raw = iterdecomp(iteridat()) - if self.interlace: raw = array('B', itertools.chain(*raw)) arraycode = 'BH'[self.bitdepth>8] @@ -2062,10 +2061,10 @@ class Reader: meta['alpha'] = bool(self.trns) meta['bitdepth'] = 8 meta['planes'] = 3 + bool(self.trns) - plte = self.palette() + plte = list(self.palette()) def iterpal(pixels): for row in pixels: - row = map(plte.__getitem__, row) + row = list(map(plte.__getitem__, row)) yield array('B', itertools.chain(*row)) pixels = iterpal(pixels) elif self.trns: @@ -2779,5 +2778,5 @@ def _main(argv): if __name__ == '__main__': try: _main(sys.argv) - except Error, e: - print >>sys.stderr, e + except Error: + print (sys.exc_info()[1], file=e) diff --git a/src/build/png2bdc.py b/src/build/png2bdc.py index 58a5983ce97..4ffeb4c01ab 100644 --- a/src/build/png2bdc.py +++ b/src/build/png2bdc.py @@ -59,6 +59,13 @@ import os import png import sys +if sys.version_info >= (3,): + def b2p(v): + return bytes([v]) +else: + def b2p(v): + return chr(v) + ######################################## ## Helper classes @@ -117,27 +124,27 @@ def renderFontSaveCached(font, filename, hash32): CACHED_HEADER_SIZE = 16 try: - fp.write('f') - fp.write('o') - fp.write('n') - fp.write('t') - fp.write(chr(hash32 >> 24 & 0xff)) - fp.write(chr(hash32 >> 16 & 0xff)) - fp.write(chr(hash32 >> 8 & 0xff)) - fp.write(chr(hash32 >> 0 & 0xff)) - fp.write(chr(font.height >> 8 & 0xff)) - fp.write(chr(font.height >> 0 & 0xff)) - fp.write(chr(font.yOffs >> 8 & 0xff)) - fp.write(chr(font.yOffs >> 0 & 0xff)) - fp.write(chr(numChars >> 24 & 0xff)) - fp.write(chr(numChars >> 16 & 0xff)) - fp.write(chr(numChars >> 8 & 0xff)) - fp.write(chr(numChars >> 0 & 0xff)) + fp.write(b'f') + fp.write(b'o') + fp.write(b'n') + fp.write(b't') + fp.write(b2p(hash32 >> 24 & 0xff)) + fp.write(b2p(hash32 >> 16 & 0xff)) + fp.write(b2p(hash32 >> 8 & 0xff)) + fp.write(b2p(hash32 >> 0 & 0xff)) + fp.write(b2p(font.height >> 8 & 0xff)) + fp.write(b2p(font.height >> 0 & 0xff)) + fp.write(b2p(font.yOffs >> 8 & 0xff)) + fp.write(b2p(font.yOffs >> 0 & 0xff)) + fp.write(b2p(numChars >> 24 & 0xff)) + fp.write(b2p(numChars >> 16 & 0xff)) + fp.write(b2p(numChars >> 8 & 0xff)) + fp.write(b2p(numChars >> 0 & 0xff)) # Write a blank table at first (?) charTable = [0]*(numChars * CACHED_CHAR_SIZE) for i in range(numChars * CACHED_CHAR_SIZE): - fp.write(chr(charTable[i])) + fp.write(b2p(charTable[i])) # Loop over all characters tableIndex = 0 @@ -173,7 +180,7 @@ def renderFontSaveCached(font, filename, hash32): # Write the data for j in range(len(dBuffer)): - fp.write(chr(dBuffer[j])) + fp.write(b2p(dBuffer[j])) destIndex = tableIndex * CACHED_CHAR_SIZE charTable[destIndex + 0] = i >> 8 & 0xff @@ -193,12 +200,13 @@ def renderFontSaveCached(font, filename, hash32): # Seek back to the beginning and rewrite the table fp.seek(CACHED_HEADER_SIZE, 0) for i in range(numChars * CACHED_CHAR_SIZE): - fp.write(chr(charTable[i])) + fp.write(b2p(charTable[i])) fp.close() return 0 except: + print(sys.exc_info[1]) return 1 @@ -347,7 +355,7 @@ def main(): except: sys.stderr.write("Error reading PNG file.\n") return 1 - + error = bitmapToChars(pngObject, font) if error: return 1 diff --git a/src/emu/attotime.c b/src/emu/attotime.c index 7eec042e8dd..7f7b2005b94 100644 --- a/src/emu/attotime.c +++ b/src/emu/attotime.c @@ -20,8 +20,6 @@ const attotime attotime::zero(0, 0); const attotime attotime::never(ATTOTIME_MAX_SECONDS, 0); - - //************************************************************************** // CORE MATH FUNCTIONS //************************************************************************** @@ -34,7 +32,7 @@ const attotime attotime::never(ATTOTIME_MAX_SECONDS, 0); attotime &attotime::operator*=(UINT32 factor) { // if one of the items is attotime::never, return attotime::never - if (seconds >= ATTOTIME_MAX_SECONDS) + if (m_seconds >= ATTOTIME_MAX_SECONDS) return *this = never; // 0 times anything is zero @@ -43,7 +41,7 @@ attotime &attotime::operator*=(UINT32 factor) // split attoseconds into upper and lower halves which fit into 32 bits UINT32 attolo; - UINT32 attohi = divu_64x32_rem(attoseconds, ATTOSECONDS_PER_SECOND_SQRT, &attolo); + UINT32 attohi = divu_64x32_rem(m_attoseconds, ATTOSECONDS_PER_SECOND_SQRT, &attolo); // scale the lower half, then split into high/low parts UINT64 temp = mulu_32x32(attolo, factor); @@ -56,13 +54,13 @@ attotime &attotime::operator*=(UINT32 factor) temp = divu_64x32_rem(temp, ATTOSECONDS_PER_SECOND_SQRT, &reshi); // scale the seconds - temp += mulu_32x32(seconds, factor); + temp += mulu_32x32(m_seconds, factor); if (temp >= ATTOTIME_MAX_SECONDS) return *this = never; // build the result - seconds = temp; - attoseconds = (attoseconds_t)reslo + mul_32x32(reshi, ATTOSECONDS_PER_SECOND_SQRT); + m_seconds = temp; + m_attoseconds = (attoseconds_t)reslo + mul_32x32(reshi, ATTOSECONDS_PER_SECOND_SQRT); return *this; } @@ -74,7 +72,7 @@ attotime &attotime::operator*=(UINT32 factor) attotime &attotime::operator/=(UINT32 factor) { // if one of the items is attotime::never, return attotime::never - if (seconds >= ATTOTIME_MAX_SECONDS) + if (m_seconds >= ATTOTIME_MAX_SECONDS) return *this = never; // ignore divide by zero @@ -83,11 +81,11 @@ attotime &attotime::operator/=(UINT32 factor) // split attoseconds into upper and lower halves which fit into 32 bits UINT32 attolo; - UINT32 attohi = divu_64x32_rem(attoseconds, ATTOSECONDS_PER_SECOND_SQRT, &attolo); + UINT32 attohi = divu_64x32_rem(m_attoseconds, ATTOSECONDS_PER_SECOND_SQRT, &attolo); // divide the seconds and get the remainder UINT32 remainder; - seconds = divu_64x32_rem(seconds, factor, &remainder); + m_seconds = divu_64x32_rem(m_seconds, factor, &remainder); // combine the upper half of attoseconds with the remainder and divide that UINT64 temp = (INT64)attohi + mulu_32x32(remainder, ATTOSECONDS_PER_SECOND_SQRT); @@ -98,12 +96,12 @@ attotime &attotime::operator/=(UINT32 factor) UINT32 reslo = divu_64x32_rem(temp, factor, &remainder); // round based on the remainder - attoseconds = (attoseconds_t)reslo + mulu_32x32(reshi, ATTOSECONDS_PER_SECOND_SQRT); + m_attoseconds = (attoseconds_t)reslo + mulu_32x32(reshi, ATTOSECONDS_PER_SECOND_SQRT); if (remainder >= factor / 2) - if (++attoseconds >= ATTOSECONDS_PER_SECOND) + if (++m_attoseconds >= ATTOSECONDS_PER_SECOND) { - attoseconds = 0; - seconds++; + m_attoseconds = 0; + m_seconds++; } return *this; } @@ -126,33 +124,33 @@ const char *attotime::as_string(int precision) const // case 1: we want no precision; seconds only else if (precision == 0) - sprintf(buffer, "%d", seconds); + sprintf(buffer, "%d", m_seconds); // case 2: we want 9 or fewer digits of precision else if (precision <= 9) { - UINT32 upper = attoseconds / ATTOSECONDS_PER_SECOND_SQRT; + UINT32 upper = m_attoseconds / ATTOSECONDS_PER_SECOND_SQRT; int temp = precision; while (temp < 9) { upper /= 10; temp++; } - sprintf(buffer, "%d.%0*d", seconds, precision, upper); + sprintf(buffer, "%d.%0*d", m_seconds, precision, upper); } // case 3: more than 9 digits of precision else { UINT32 lower; - UINT32 upper = divu_64x32_rem(attoseconds, ATTOSECONDS_PER_SECOND_SQRT, &lower); + UINT32 upper = divu_64x32_rem(m_attoseconds, ATTOSECONDS_PER_SECOND_SQRT, &lower); int temp = precision; while (temp < 18) { lower /= 10; temp++; } - sprintf(buffer, "%d.%09d%0*d", seconds, upper, precision - 9, lower); + sprintf(buffer, "%d.%09d%0*d", m_seconds, upper, precision - 9, lower); } return buffer; } diff --git a/src/emu/attotime.h b/src/emu/attotime.h index e2bdf19adaf..845bcb365b2 100644 --- a/src/emu/attotime.h +++ b/src/emu/attotime.h @@ -39,8 +39,6 @@ #undef min #undef max - - //************************************************************************** // CONSTANTS //************************************************************************** @@ -90,35 +88,49 @@ class attotime public: // construction/destruction attotime() - : seconds(0), - attoseconds(0) { } + : m_seconds(0), + m_attoseconds(0) { } attotime(seconds_t secs, attoseconds_t attos) - : seconds(secs), - attoseconds(attos) { } + : m_seconds(secs), + m_attoseconds(attos) { } attotime(const attotime& that) - : seconds(that.seconds), - attoseconds(that.attoseconds) { } + : m_seconds(that.m_seconds), + m_attoseconds(that.m_attoseconds) { } // assignment attotime& operator=(const attotime& that) { - this->seconds = that.seconds; - this->attoseconds = that.attoseconds; + this->m_seconds = that.m_seconds; + this->m_attoseconds = that.m_attoseconds; return *this; } // queries - bool is_zero() const { return (seconds == 0 && attoseconds == 0); } - bool is_never() const { return (seconds >= ATTOTIME_MAX_SECONDS); } + bool is_zero() const { return (m_seconds == 0 && m_attoseconds == 0); } + bool is_never() const { return (m_seconds >= ATTOTIME_MAX_SECONDS); } // conversion to other forms - double as_double() const { return double(seconds) + ATTOSECONDS_TO_DOUBLE(attoseconds); } + double as_double() const { return double(m_seconds) + ATTOSECONDS_TO_DOUBLE(m_attoseconds); } attoseconds_t as_attoseconds() const; UINT64 as_ticks(UINT32 frequency) const; const char *as_string(int precision = 9) const; + // Needed by gba.c FIXME: this shouldn't be necessary? + + void normalize() + { + while (m_attoseconds >= ATTOSECONDS_PER_SECOND) + { + m_seconds++; + m_attoseconds -= ATTOSECONDS_PER_SECOND; + } + } + + attoseconds_t attoseconds() const { return m_attoseconds; } + seconds_t seconds() const { return m_seconds; } + // conversion from other forms static attotime from_double(double _time); static attotime from_ticks(UINT64 ticks, UINT32 frequency); @@ -135,8 +147,8 @@ public: attotime &operator/=(UINT32 factor); // members - seconds_t seconds; - attoseconds_t attoseconds; + seconds_t m_seconds; + attoseconds_t m_attoseconds; // constants static const attotime never; @@ -159,22 +171,22 @@ inline attotime operator+(const attotime &left, const attotime &right) attotime result; // if one of the items is never, return never - if (left.seconds >= ATTOTIME_MAX_SECONDS || right.seconds >= ATTOTIME_MAX_SECONDS) + if (left.m_seconds >= ATTOTIME_MAX_SECONDS || right.m_seconds >= ATTOTIME_MAX_SECONDS) return attotime::never; // add the seconds and attoseconds - result.attoseconds = left.attoseconds + right.attoseconds; - result.seconds = left.seconds + right.seconds; + result.m_attoseconds = left.m_attoseconds + right.m_attoseconds; + result.m_seconds = left.m_seconds + right.m_seconds; // normalize and return - if (result.attoseconds >= ATTOSECONDS_PER_SECOND) + if (result.m_attoseconds >= ATTOSECONDS_PER_SECOND) { - result.attoseconds -= ATTOSECONDS_PER_SECOND; - result.seconds++; + result.m_attoseconds -= ATTOSECONDS_PER_SECOND; + result.m_seconds++; } // overflow - if (result.seconds >= ATTOTIME_MAX_SECONDS) + if (result.m_seconds >= ATTOTIME_MAX_SECONDS) return attotime::never; return result; } @@ -182,22 +194,22 @@ inline attotime operator+(const attotime &left, const attotime &right) inline attotime &attotime::operator+=(const attotime &right) { // if one of the items is never, return never - if (this->seconds >= ATTOTIME_MAX_SECONDS || right.seconds >= ATTOTIME_MAX_SECONDS) + if (this->m_seconds >= ATTOTIME_MAX_SECONDS || right.m_seconds >= ATTOTIME_MAX_SECONDS) return *this = never; // add the seconds and attoseconds - attoseconds += right.attoseconds; - seconds += right.seconds; + m_attoseconds += right.m_attoseconds; + m_seconds += right.m_seconds; // normalize and return - if (this->attoseconds >= ATTOSECONDS_PER_SECOND) + if (this->m_attoseconds >= ATTOSECONDS_PER_SECOND) { - this->attoseconds -= ATTOSECONDS_PER_SECOND; - this->seconds++; + this->m_attoseconds -= ATTOSECONDS_PER_SECOND; + this->m_seconds++; } // overflow - if (this->seconds >= ATTOTIME_MAX_SECONDS) + if (this->m_seconds >= ATTOTIME_MAX_SECONDS) return *this = never; return *this; } @@ -213,18 +225,18 @@ inline attotime operator-(const attotime &left, const attotime &right) attotime result; // if time1 is never, return never - if (left.seconds >= ATTOTIME_MAX_SECONDS) + if (left.m_seconds >= ATTOTIME_MAX_SECONDS) return attotime::never; // add the seconds and attoseconds - result.attoseconds = left.attoseconds - right.attoseconds; - result.seconds = left.seconds - right.seconds; + result.m_attoseconds = left.m_attoseconds - right.m_attoseconds; + result.m_seconds = left.m_seconds - right.m_seconds; // normalize and return - if (result.attoseconds < 0) + if (result.m_attoseconds < 0) { - result.attoseconds += ATTOSECONDS_PER_SECOND; - result.seconds--; + result.m_attoseconds += ATTOSECONDS_PER_SECOND; + result.m_seconds--; } return result; } @@ -232,18 +244,18 @@ inline attotime operator-(const attotime &left, const attotime &right) inline attotime &attotime::operator-=(const attotime &right) { // if time1 is never, return never - if (this->seconds >= ATTOTIME_MAX_SECONDS) + if (this->m_seconds >= ATTOTIME_MAX_SECONDS) return *this = never; // add the seconds and attoseconds - attoseconds -= right.attoseconds; - seconds -= right.seconds; + m_attoseconds -= right.m_attoseconds; + m_seconds -= right.m_seconds; // normalize and return - if (this->attoseconds < 0) + if (this->m_attoseconds < 0) { - this->attoseconds += ATTOSECONDS_PER_SECOND; - this->seconds--; + this->m_attoseconds += ATTOSECONDS_PER_SECOND; + this->m_seconds--; } return *this; } @@ -284,32 +296,32 @@ inline attotime operator/(const attotime &left, UINT32 factor) inline bool operator==(const attotime &left, const attotime &right) { - return (left.seconds == right.seconds && left.attoseconds == right.attoseconds); + return (left.m_seconds == right.m_seconds && left.m_attoseconds == right.m_attoseconds); } inline bool operator!=(const attotime &left, const attotime &right) { - return (left.seconds != right.seconds || left.attoseconds != right.attoseconds); + return (left.m_seconds != right.m_seconds || left.m_attoseconds != right.m_attoseconds); } inline bool operator<(const attotime &left, const attotime &right) { - return (left.seconds < right.seconds || (left.seconds == right.seconds && left.attoseconds < right.attoseconds)); + return (left.m_seconds < right.m_seconds || (left.m_seconds == right.m_seconds && left.m_attoseconds < right.m_attoseconds)); } inline bool operator<=(const attotime &left, const attotime &right) { - return (left.seconds < right.seconds || (left.seconds == right.seconds && left.attoseconds <= right.attoseconds)); + return (left.m_seconds < right.m_seconds || (left.m_seconds == right.m_seconds && left.m_attoseconds <= right.m_attoseconds)); } inline bool operator>(const attotime &left, const attotime &right) { - return (left.seconds > right.seconds || (left.seconds == right.seconds && left.attoseconds > right.attoseconds)); + return (left.m_seconds > right.m_seconds || (left.m_seconds == right.m_seconds && left.m_attoseconds > right.m_attoseconds)); } inline bool operator>=(const attotime &left, const attotime &right) { - return (left.seconds > right.seconds || (left.seconds == right.seconds && left.attoseconds >= right.attoseconds)); + return (left.m_seconds > right.m_seconds || (left.m_seconds == right.m_seconds && left.m_attoseconds >= right.m_attoseconds)); } @@ -319,11 +331,11 @@ inline bool operator>=(const attotime &left, const attotime &right) inline attotime min(const attotime &left, const attotime &right) { - if (left.seconds > right.seconds) + if (left.m_seconds > right.m_seconds) return right; - if (left.seconds < right.seconds) + if (left.m_seconds < right.m_seconds) return left; - if (left.attoseconds > right.attoseconds) + if (left.m_attoseconds > right.m_attoseconds) return right; return left; } @@ -335,11 +347,11 @@ inline attotime min(const attotime &left, const attotime &right) inline attotime max(const attotime &left, const attotime &right) { - if (left.seconds > right.seconds) + if (left.m_seconds > right.m_seconds) return left; - if (left.seconds < right.seconds) + if (left.m_seconds < right.m_seconds) return right; - if (left.attoseconds > right.attoseconds) + if (left.m_attoseconds > right.m_attoseconds) return left; return right; } @@ -353,15 +365,15 @@ inline attotime max(const attotime &left, const attotime &right) inline attoseconds_t attotime::as_attoseconds() const { // positive values between 0 and 1 second - if (seconds == 0) - return attoseconds; + if (m_seconds == 0) + return m_attoseconds; // negative values between -1 and 0 seconds - else if (seconds == -1) - return attoseconds - ATTOSECONDS_PER_SECOND; + else if (m_seconds == -1) + return m_attoseconds - ATTOSECONDS_PER_SECOND; // out-of-range positive values - else if (seconds > 0) + else if (m_seconds > 0) return ATTOSECONDS_PER_SECOND; // out-of-range negative values @@ -377,8 +389,8 @@ inline attoseconds_t attotime::as_attoseconds() const inline UINT64 attotime::as_ticks(UINT32 frequency) const { - UINT32 fracticks = (attotime(0, attoseconds) * frequency).seconds; - return mulu_32x32(seconds, frequency) + fracticks; + UINT32 fracticks = (attotime(0, m_attoseconds) * frequency).m_seconds; + return mulu_32x32(m_seconds, frequency) + fracticks; } diff --git a/src/emu/bus/a2bus/ezcgi.c b/src/emu/bus/a2bus/ezcgi.c index c943f3cd979..e85db228ad2 100644 --- a/src/emu/bus/a2bus/ezcgi.c +++ b/src/emu/bus/a2bus/ezcgi.c @@ -45,7 +45,7 @@ MACHINE_CONFIG_END #define MSX2_VISIBLE_YBORDER_PIXELS 14 * 2 MACHINE_CONFIG_FRAGMENT( ezcgi9938 ) - MCFG_V9938_ADD(TMS_TAG, SCREEN_TAG, 0x30000) // 192K of VRAM + MCFG_V9938_ADD(TMS_TAG, SCREEN_TAG, 0x30000, XTAL_21_4772MHz) // 192K of VRAM / typical 9938 clock, not verified MCFG_V99X8_INTERRUPT_CALLBACK(WRITELINE(a2bus_ezcgi_9938_device, tms_irq_w)) MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) @@ -59,7 +59,7 @@ MACHINE_CONFIG_FRAGMENT( ezcgi9938 ) MACHINE_CONFIG_END MACHINE_CONFIG_FRAGMENT( ezcgi9958 ) - MCFG_V9958_ADD(TMS_TAG, SCREEN_TAG, 0x30000) // 192K of VRAM + MCFG_V9958_ADD(TMS_TAG, SCREEN_TAG, 0x30000, XTAL_21_4772MHz) // 192K of VRAM / typcial 9938/9958 clock, not verified MCFG_V99X8_INTERRUPT_CALLBACK(WRITELINE(a2bus_ezcgi_9958_device, tms_irq_w)) MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) diff --git a/src/emu/bus/c64/c128_partner.c b/src/emu/bus/c64/c128_partner.c index 07848e1c7d9..2a46b90cd3e 100644 --- a/src/emu/bus/c64/c128_partner.c +++ b/src/emu/bus/c64/c128_partner.c @@ -2,29 +2,29 @@ // copyright-holders:Curt Coder /********************************************************************** - Timeworks PARTNER 128 cartridge emulation + Timeworks PARTNER 128 cartridge emulation **********************************************************************/ /* - PCB Layout - ---------- + PCB Layout + ---------- - |---------------| - |LS74 SW CN| - |LS09 LS273| - |LS139 RAM | - |LS133 | - | LS240 | - |LS33 ROM | - |LS09 | - ||||||||||||||| + |---------------| + |LS74 SW * | + |LS09 LS273| + |LS139 RAM | + |LS133 | + | LS240 | + |LS33 ROM | + |LS09 | + ||||||||||||||| - ROM - Toshiba TMM24128AP 16Kx8 EPROM (blank label) - RAM - Sony CXK5864PN-15L 8Kx8 SRAM - SW - push button switch - CN - lead out to joystick port dongle + ROM - Toshiba TMM24128AP 16Kx8 EPROM (blank label) + RAM - Sony CXK5864PN-15L 8Kx8 SRAM + SW - push button switch + * - solder point for joystick port dongle */ @@ -45,6 +45,7 @@ const device_type C128_PARTNER = &device_creator<partner128_t>; WRITE_LINE_MEMBER( partner128_t::nmi_w ) { + m_ls74_d1 = state; } static INPUT_PORTS_START( c128_partner ) @@ -75,8 +76,14 @@ ioport_constructor partner128_t::device_input_ports() const partner128_t::partner128_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, C128_PARTNER, "PARTNER 128", tag, owner, clock, "c128_partner", __FILE__), device_c64_expansion_card_interface(mconfig, *this), - device_vcs_control_port_interface(mconfig, *this), - m_ram(*this, "ram") + //device_vcs_control_port_interface(mconfig, *this), + m_ram(*this, "ram"), + m_ram_a12_a7(0), + m_ls74_cd(0), + m_ls74_d1(0), + m_ls74_q1(0), + m_ls74_q2(0), + m_joyb2(0) { } @@ -89,6 +96,14 @@ void partner128_t::device_start() { // allocate memory m_ram.allocate(0x2000); + + // state saving + save_item(NAME(m_ram_a12_a7)); + save_item(NAME(m_ls74_cd)); + save_item(NAME(m_ls74_d1)); + save_item(NAME(m_ls74_q1)); + save_item(NAME(m_ls74_q2)); + save_item(NAME(m_joyb2)); } @@ -98,6 +113,13 @@ void partner128_t::device_start() void partner128_t::device_reset() { + m_ram_a12_a7 = 0; + + m_ls74_cd = 0; + m_ls74_q1 = 0; + m_ls74_q2 = 0; + + nmi_w(CLEAR_LINE); } @@ -107,6 +129,30 @@ void partner128_t::device_reset() UINT8 partner128_t::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2) { + if (!roml) + { + data = m_roml[offset & 0x3fff]; + } + + if (!io1) + { + if (BIT(offset, 7)) + { + data = m_roml[offset & 0x3fff]; + + m_ls74_q1 = m_ls74_d1; + } + else + { + data = m_ram[(m_ram_a12_a7 << 7) | (offset & 0x7f)]; + } + } + + if (m_ls74_q2 && ((offset & 0xff3a) == 0xff3a)) + { + data = 0x21; + } + return data; } @@ -117,6 +163,47 @@ UINT8 partner128_t::c64_cd_r(address_space &space, offs_t offset, UINT8 data, in void partner128_t::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2) { + if (!io1) + { + if (BIT(offset, 7)) + { + /* + + bit description + + 0 RAM A7 + 1 RAM A8 + 2 RAM A9 + 3 RAM A10 + 4 RAM A11 + 5 RAM A12 + 6 LS74 1Cd,2Cd + 7 N/C + + */ + + m_ram_a12_a7 = data & 0x3f; + + m_ls74_cd = BIT(data, 6); + + if (!m_ls74_cd) + { + m_ls74_q1 = 0; + m_ls74_q2 = 0; + + nmi_w(CLEAR_LINE); + } + } + else + { + m_ram[(m_ram_a12_a7 << 7) | (offset & 0x7f)] = data; + } + } + + if (sphi2 && ((offset & 0xfff0) == 0xd600)) + { + m_ram[(m_ram_a12_a7 << 7) | (offset & 0x7f)] = data; + } } @@ -128,3 +215,22 @@ int partner128_t::c64_game_r(offs_t offset, int sphi2, int ba, int rw) { return 1; } + + +//------------------------------------------------- +// vcs_joy_w - joystick write +//------------------------------------------------- + +void partner128_t::vcs_joy_w(UINT8 data) +{ + int joya2 = BIT(data, 2); + + if (!m_joyb2 && joya2) + { + m_ls74_q2 = m_ls74_q1; + + nmi_w(m_ls74_q2 ? ASSERT_LINE : CLEAR_LINE); + + m_joyb2 = joya2; + } +} diff --git a/src/emu/bus/c64/c128_partner.h b/src/emu/bus/c64/c128_partner.h index b91c92026dd..35b1d3ea0a4 100644 --- a/src/emu/bus/c64/c128_partner.h +++ b/src/emu/bus/c64/c128_partner.h @@ -24,8 +24,8 @@ // ======================> partner128_t class partner128_t : public device_t, - public device_c64_expansion_card_interface, - public device_vcs_control_port_interface + public device_c64_expansion_card_interface + //public device_vcs_control_port_interface { public: // construction/destruction @@ -47,9 +47,17 @@ protected: virtual int c64_game_r(offs_t offset, int sphi2, int ba, int rw); // device_vcs_control_port_interface overrides + virtual void vcs_joy_w(UINT8 data); private: optional_shared_ptr<UINT8> m_ram; + + int m_ram_a12_a7; + int m_ls74_cd; + int m_ls74_d1; + int m_ls74_q1; + int m_ls74_q2; + int m_joyb2; }; diff --git a/src/emu/bus/coleco/exp.c b/src/emu/bus/coleco/exp.c index e8be5dfe15d..c981406017e 100644 --- a/src/emu/bus/coleco/exp.c +++ b/src/emu/bus/coleco/exp.c @@ -114,6 +114,15 @@ bool colecovision_cartridge_slot_device::call_softlist_load(software_list_device void colecovision_cartridge_slot_device::get_default_card_software(std::string &result) { + if (open_image_file(mconfig().options())) + { + UINT32 length = core_fsize(m_file); + if (length == 0x100000 || length == 0x200000) + { + software_get_default_slot(result, "xin1"); + return; + } + } software_get_default_slot(result, "standard"); } @@ -138,8 +147,10 @@ UINT8 colecovision_cartridge_slot_device::bd_r(address_space &space, offs_t offs //------------------------------------------------- #include "std.h" +#include "xin1.h" SLOT_INTERFACE_START( colecovision_cartridges ) // the following need ROMs from the software list SLOT_INTERFACE_INTERNAL("standard", COLECOVISION_STANDARD) + SLOT_INTERFACE_INTERNAL("xin1", COLECOVISION_XIN1) SLOT_INTERFACE_END diff --git a/src/emu/bus/coleco/xin1.c b/src/emu/bus/coleco/xin1.c new file mode 100644 index 00000000000..e46b65eeadd --- /dev/null +++ b/src/emu/bus/coleco/xin1.c @@ -0,0 +1,71 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +/********************************************************************** + + ColecoVision X-in-1 cartridge emulation + +**********************************************************************/ + +#include "xin1.h" + + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type COLECOVISION_XIN1 = &device_creator<colecovision_xin1_cartridge_device>; + + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// colecovision_xin1_cartridge_device - constructor +//------------------------------------------------- + +colecovision_xin1_cartridge_device::colecovision_xin1_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, COLECOVISION_XIN1, "ColecoVision X-in-1 cartridge", tag, owner, clock, "colecovision_xin1", __FILE__), + device_colecovision_cartridge_interface(mconfig, *this), + m_current_offset(0) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void colecovision_xin1_cartridge_device::device_start() +{ +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void colecovision_xin1_cartridge_device::device_reset() +{ + m_current_offset = m_rom_size - 0x8000; +} + + +//------------------------------------------------- +// read - cartridge data read +//------------------------------------------------- + +UINT8 colecovision_xin1_cartridge_device::bd_r(address_space &space, offs_t offset, UINT8 data, int _8000, int _a000, int _c000, int _e000) +{ + if (!_8000 || !_a000 || !_c000 || !_e000) + { + data = m_rom[m_current_offset + offset]; + if (!_e000 && offset >= 0x7fc0) { + m_current_offset = (0x8000 * (offset - 0x7fc0)) % m_rom_size; + } + } + + return data; +} diff --git a/src/emu/bus/coleco/xin1.h b/src/emu/bus/coleco/xin1.h new file mode 100644 index 00000000000..79a940c646f --- /dev/null +++ b/src/emu/bus/coleco/xin1.h @@ -0,0 +1,48 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +/********************************************************************** + + ColecoVision X-in-1 cartridge emulation + +**********************************************************************/ + +#pragma once + +#ifndef __COLECOVISION_XIN1_CARTRIDGE__ +#define __COLECOVISION_XIN1_CARTRIDGE__ + +#include "exp.h" + + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> colecovision_xin1_cartridge_device + +class colecovision_xin1_cartridge_device : public device_t, + public device_colecovision_cartridge_interface +{ +public: + // construction/destruction + colecovision_xin1_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + + // device_colecovision_expansion_card_interface overrides + virtual UINT8 bd_r(address_space &space, offs_t offset, UINT8 data, int _8000, int _a000, int _c000, int _e000); + +private: + UINT32 m_current_offset; +}; + + +// device type definition +extern const device_type COLECOVISION_XIN1; + + +#endif diff --git a/src/emu/bus/dmv/k220.c b/src/emu/bus/dmv/k220.c index 432f0359716..de6092f3d71 100644 --- a/src/emu/bus/dmv/k220.c +++ b/src/emu/bus/dmv/k220.c @@ -63,8 +63,13 @@ ROM_START( dmv_k220 ) ROM_REGION(0x4000, "rom", 0) - ROM_LOAD( "ncr_32563_diagnostics_rom.bin", 0x0000, 0x2000, CRC(57445768) SHA1(59b615437444789bf10ba6768cd3c43a69c7ed7b)) - ROM_LOAD( "ncr_32564_diagnostics_rom.bin", 0x2000, 0x2000, CRC(172e0c60) SHA1(eedae538636009a5b86fc78e50a03c72eeb0e73b)) + ROM_SYSTEM_BIOS(0, "v4", "V 04.00") + ROMX_LOAD("34014.u17", 0x0000, 0x2000, CRC(552c2247) SHA1(7babd264ead2e04afe624c3035f211279c203f41), ROM_BIOS(1)) + ROMX_LOAD("34015.u18", 0x2000, 0x2000, CRC(d714f2d8) SHA1(1a7095401d63951ba9189bc3e384c26996113815), ROM_BIOS(1)) + + ROM_SYSTEM_BIOS(1, "v2", "V 02.00") + ROMX_LOAD("32563.u17", 0x0000, 0x2000, CRC(57445768) SHA1(59b615437444789bf10ba6768cd3c43a69c7ed7b), ROM_BIOS(2)) + ROMX_LOAD("32564.u18", 0x2000, 0x2000, CRC(172e0c60) SHA1(eedae538636009a5b86fc78e50a03c72eeb0e73b), ROM_BIOS(2)) ROM_REGION(0x0080, "prom", 0) ROM_LOAD( "u11.bin", 0x0000, 0x0080, NO_DUMP) // used for address decoding @@ -199,7 +204,7 @@ bool dmv_k220_device::read(offs_t offset, UINT8 &data) } else if ((m_portc & 0x02) && offset >= 0xf000 && offset < 0xf800) { - data = m_ram->base()[offset]; + data = m_ram->base()[offset & 0x7ff]; return true; } @@ -219,7 +224,7 @@ bool dmv_k220_device::write(offs_t offset, UINT8 data) } else if ((m_portc & 0x02) && offset >= 0xf000 && offset < 0xf800) { - m_ram->base()[offset] = data; + m_ram->base()[offset & 0x7ff] = data; return true; } diff --git a/src/emu/bus/isa/gus.c b/src/emu/bus/isa/gus.c index f9cba907c81..ad7d034a183 100644 --- a/src/emu/bus/isa/gus.c +++ b/src/emu/bus/isa/gus.c @@ -1438,7 +1438,7 @@ READ8_MEMBER(isa16_gus_device::joy_r) data = ioport("gus_joy")->read() | 0x0f; { - delta = ((new_time - m_joy_time) * 256 * 1000).seconds; + delta = ((new_time - m_joy_time) * 256 * 1000).seconds(); if (ioport("gus_joy_1")->read() < delta) data &= ~0x01; if (ioport("gus_joy_2")->read() < delta) data &= ~0x02; diff --git a/src/emu/bus/msx_cart/cartridge.c b/src/emu/bus/msx_cart/cartridge.c index 93e419235cd..7f990101a08 100644 --- a/src/emu/bus/msx_cart/cartridge.c +++ b/src/emu/bus/msx_cart/cartridge.c @@ -10,6 +10,7 @@ #include "disk.h" #include "dooly.h" #include "fmpac.h" +#include "fs_sr022.h" #include "halnote.h" #include "hfox.h" #include "holy_quran.h" @@ -39,6 +40,7 @@ SLOT_INTERFACE_START(msx_cart) SLOT_INTERFACE_INTERNAL("rtype", MSX_CART_RTYPE) SLOT_INTERFACE_INTERNAL("majutsushi", MSX_CART_MAJUTSUSHI) SLOT_INTERFACE_INTERNAL("fmpac", MSX_CART_FMPAC) + SLOT_INTERFACE_INTERNAL("fs_sr022", MSX_CART_FS_SR022) SLOT_INTERFACE_INTERNAL("superloderunner", MSX_CART_SUPERLODERUNNER) SLOT_INTERFACE_INTERNAL("synthesizer", MSX_CART_SYNTHESIZER) SLOT_INTERFACE_INTERNAL("cross_blaim", MSX_CART_CROSSBLAIM) diff --git a/src/emu/bus/msx_cart/fs_sr022.c b/src/emu/bus/msx_cart/fs_sr022.c new file mode 100644 index 00000000000..17325f479fd --- /dev/null +++ b/src/emu/bus/msx_cart/fs_sr022.c @@ -0,0 +1,72 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +#include "emu.h" +#include "fs_sr022.h" + + +const device_type MSX_CART_FS_SR022 = &device_creator<msx_cart_fs_sr022>; + + +msx_cart_fs_sr022::msx_cart_fs_sr022(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, MSX_CART_FS_SR022, "MSX Cartridge - FS-SR022", tag, owner, clock, "msx_cart_fs_sr022", __FILE__) + , msx_cart_interface(mconfig, *this) + , m_bunsetsu_rom(NULL) + , m_bunsetsu_address(0) +{ +} + + +void msx_cart_fs_sr022::device_start() +{ + save_item(NAME(m_bunsetsu_address)); +} + + +void msx_cart_fs_sr022::device_reset() +{ + m_bunsetsu_address = 0; +} + + +void msx_cart_fs_sr022::initialize_cartridge() +{ + if (get_rom_size() != 0x40000) + { + fatalerror("fs_sr022: Invalid ROM size\n"); + } + m_bunsetsu_rom = get_rom_base() + 0x20000; +} + + +READ8_MEMBER(msx_cart_fs_sr022::read_cart) +{ + if (offset >= 0x4000 && offset < 0xc000) + { + if (offset == 0xbfff) { + return m_bunsetsu_rom[m_bunsetsu_address++ & 0x1ffff]; + } + + return get_rom_base()[offset - 0x4000]; + } + return 0xff; +} + + +WRITE8_MEMBER(msx_cart_fs_sr022::write_cart) +{ + switch (offset) + { + case 0xbffc: + m_bunsetsu_address = (m_bunsetsu_address & 0xffff00) | data; + break; + + case 0xbffd: + m_bunsetsu_address = (m_bunsetsu_address & 0xff00ff) | (data << 8); + break; + + case 0xbffe: + m_bunsetsu_address = (m_bunsetsu_address & 0x00ffff) | (data << 16); + break; + } +} + diff --git a/src/emu/bus/msx_cart/fs_sr022.h b/src/emu/bus/msx_cart/fs_sr022.h new file mode 100644 index 00000000000..edae6296beb --- /dev/null +++ b/src/emu/bus/msx_cart/fs_sr022.h @@ -0,0 +1,33 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +#ifndef __MSX_CART_FS_SR022_H +#define __MSX_CART_FS_SR022_H + +#include "bus/msx_cart/cartridge.h" + + +extern const device_type MSX_CART_FS_SR022; + + +class msx_cart_fs_sr022 : public device_t + , public msx_cart_interface +{ +public: + msx_cart_fs_sr022(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + + virtual void initialize_cartridge(); + + virtual DECLARE_READ8_MEMBER(read_cart); + virtual DECLARE_WRITE8_MEMBER(write_cart); + +private: + const UINT8 *m_bunsetsu_rom; + UINT32 m_bunsetsu_address; +}; + + +#endif diff --git a/src/emu/bus/msx_cart/moonsound.c b/src/emu/bus/msx_cart/moonsound.c index d2b222f07de..cdae9385815 100644 --- a/src/emu/bus/msx_cart/moonsound.c +++ b/src/emu/bus/msx_cart/moonsound.c @@ -20,7 +20,7 @@ const device_type MSX_CART_MOONSOUND = &device_creator<msx_cart_moonsound>; msx_cart_moonsound::msx_cart_moonsound(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, MSX_CART_MOONSOUND, "MSX Cartridge - MoonSound", tag, owner, clock, "msx_cart_moonsound", __FILE__) + : device_t(mconfig, MSX_CART_MOONSOUND, "MSX Cartridge - MoonSound", tag, owner, clock, "msx_moonsound", __FILE__) , msx_cart_interface(mconfig, *this) , m_ymf278b(*this, "ymf278b") { diff --git a/src/emu/bus/nasbus/avc.c b/src/emu/bus/nasbus/avc.c index 35b86e09420..8960a19573f 100644 --- a/src/emu/bus/nasbus/avc.c +++ b/src/emu/bus/nasbus/avc.c @@ -25,6 +25,8 @@ static MACHINE_CONFIG_FRAGMENT( nascom_avc ) MCFG_SCREEN_RAW_PARAMS(16250000, 1024, 0, 768, 320, 0, 256) MCFG_SCREEN_UPDATE_DEVICE("mc6845", mc6845_device, screen_update) + MCFG_PALETTE_ADD_3BIT_RGB("palette") + MCFG_MC6845_ADD("mc6845", MC6845, "screen", XTAL_16MHz / 8) MCFG_MC6845_SHOW_BORDER_AREA(false) MCFG_MC6845_CHAR_WIDTH(6) @@ -36,18 +38,6 @@ machine_config_constructor nascom_avc_device::device_mconfig_additions() const return MACHINE_CONFIG_NAME( nascom_avc ); } -const rgb_t nascom_avc_device::m_palette[] = -{ - rgb_t::black, - rgb_t(0xff, 0x00, 0x00), - rgb_t(0x00, 0xff, 0x00), - rgb_t(0xff, 0xff, 0x00), - rgb_t(0x00, 0x00, 0xff), - rgb_t(0xff, 0x00, 0xff), - rgb_t(0x00, 0xff, 0xff), - rgb_t::white, -}; - //************************************************************************** // LIVE DEVICE @@ -61,6 +51,7 @@ nascom_avc_device::nascom_avc_device(const machine_config &mconfig, const char * device_t(mconfig, NASCOM_AVC, "Nascom Advanced Video Card", tag, owner, clock, "nascom_avc", __FILE__), device_nasbus_card_interface(mconfig, *this), m_crtc(*this, "mc6845"), + m_palette(*this, "palette"), m_control(0x80) { } @@ -130,7 +121,7 @@ MC6845_UPDATE_ROW( nascom_avc_device::crtc_update_row ) } // plot the pixel - bitmap.pix32(y, x) = m_palette[(b << 2) | (g << 1) | (r << 0)]; + bitmap.pix32(y, x) = m_palette->pen_color((b << 2) | (g << 1) | (r << 0)); } } diff --git a/src/emu/bus/nasbus/avc.h b/src/emu/bus/nasbus/avc.h index bcd22b09050..754781fc70e 100644 --- a/src/emu/bus/nasbus/avc.h +++ b/src/emu/bus/nasbus/avc.h @@ -41,14 +41,13 @@ protected: private: required_device<mc6845_device> m_crtc; + required_device<palette_device> m_palette; std::vector<UINT8> m_r_ram; std::vector<UINT8> m_g_ram; std::vector<UINT8> m_b_ram; UINT8 m_control; - - static const rgb_t m_palette[]; }; // device type definition diff --git a/src/emu/bus/pc_joy/pc_joy.c b/src/emu/bus/pc_joy/pc_joy.c index a8059c2f6da..99c3f5c1957 100644 --- a/src/emu/bus/pc_joy/pc_joy.c +++ b/src/emu/bus/pc_joy/pc_joy.c @@ -21,7 +21,7 @@ pc_joy_device::pc_joy_device(const machine_config &mconfig, const char *tag, dev READ8_MEMBER ( pc_joy_device::joy_port_r ) { - int delta = ((machine().time() - m_stime) * 256 * 1000).seconds; + int delta = ((machine().time() - m_stime) * 256 * 1000).seconds(); if(!m_dev) return 0xf0; diff --git a/src/emu/bus/ti99_peb/hfdc.c b/src/emu/bus/ti99_peb/hfdc.c index ed73221837a..5bbac318b6c 100644 --- a/src/emu/bus/ti99_peb/hfdc.c +++ b/src/emu/bus/ti99_peb/hfdc.c @@ -57,7 +57,7 @@ #include "emu.h" #include "peribox.h" #include "hfdc.h" -#include "machine/ti99_hd.h" +#include "formats/mfm_hd.h" #include "formats/ti99_dsk.h" // Format #define BUFFER "ram" @@ -1011,7 +1011,7 @@ static SLOT_INTERFACE_START( hfdc_floppies ) SLOT_INTERFACE_END static SLOT_INTERFACE_START( hfdc_harddisks ) - SLOT_INTERFACE( "generic", MFMHD_GENERIC ) // Generic high-level emulation + SLOT_INTERFACE( "generic", MFMHD_GENERIC ) // Generic hard disk (self-adapting to image) SLOT_INTERFACE( "st213", MFMHD_ST213 ) // Seagate ST-213 (10 MB) SLOT_INTERFACE( "st225", MFMHD_ST225 ) // Seagate ST-225 (20 MB) SLOT_INTERFACE( "st251", MFMHD_ST251 ) // Seagate ST-251 (40 MB) @@ -1019,12 +1019,12 @@ SLOT_INTERFACE_END MACHINE_CONFIG_FRAGMENT( ti99_hfdc ) MCFG_DEVICE_ADD(FDC_TAG, HDC9234, 0) - MCFG_HDC9234_INTRQ_CALLBACK(WRITELINE(myarc_hfdc_device, intrq_w)) - MCFG_HDC9234_DIP_CALLBACK(WRITELINE(myarc_hfdc_device, dip_w)) - MCFG_HDC9234_AUXBUS_OUT_CALLBACK(WRITE8(myarc_hfdc_device, auxbus_out)) - MCFG_HDC9234_DMARQ_CALLBACK(WRITELINE(myarc_hfdc_device, dmarq_w)) - MCFG_HDC9234_DMA_IN_CALLBACK(READ8(myarc_hfdc_device, read_buffer)) - MCFG_HDC9234_DMA_OUT_CALLBACK(WRITE8(myarc_hfdc_device, write_buffer)) + MCFG_HDC92X4_INTRQ_CALLBACK(WRITELINE(myarc_hfdc_device, intrq_w)) + MCFG_HDC92X4_DIP_CALLBACK(WRITELINE(myarc_hfdc_device, dip_w)) + MCFG_HDC92X4_AUXBUS_OUT_CALLBACK(WRITE8(myarc_hfdc_device, auxbus_out)) + MCFG_HDC92X4_DMARQ_CALLBACK(WRITELINE(myarc_hfdc_device, dmarq_w)) + MCFG_HDC92X4_DMA_IN_CALLBACK(READ8(myarc_hfdc_device, read_buffer)) + MCFG_HDC92X4_DMA_OUT_CALLBACK(WRITE8(myarc_hfdc_device, write_buffer)) MCFG_FLOPPY_DRIVE_ADD("f1", hfdc_floppies, "525dd", myarc_hfdc_device::floppy_formats) MCFG_FLOPPY_DRIVE_ADD("f2", hfdc_floppies, "525dd", myarc_hfdc_device::floppy_formats) @@ -1032,9 +1032,9 @@ MACHINE_CONFIG_FRAGMENT( ti99_hfdc ) MCFG_FLOPPY_DRIVE_ADD("f4", hfdc_floppies, NULL, myarc_hfdc_device::floppy_formats) // NB: Hard disks don't go without image (other than floppy drives) - MCFG_MFM_HARDDISK_CONN_ADD("h1", hfdc_harddisks, NULL, MFM_BYTE, 3000, 20, MFMHD_TI99_FORMAT) - MCFG_MFM_HARDDISK_CONN_ADD("h2", hfdc_harddisks, NULL, MFM_BYTE, 2000, 20, MFMHD_TI99_FORMAT) - MCFG_MFM_HARDDISK_CONN_ADD("h3", hfdc_harddisks, NULL, MFM_BYTE, 2000, 20, MFMHD_TI99_FORMAT) + MCFG_MFM_HARDDISK_CONN_ADD("h1", hfdc_harddisks, NULL, MFM_BYTE, 3000, 20, MFMHD_GEN_FORMAT) + MCFG_MFM_HARDDISK_CONN_ADD("h2", hfdc_harddisks, NULL, MFM_BYTE, 2000, 20, MFMHD_GEN_FORMAT) + MCFG_MFM_HARDDISK_CONN_ADD("h3", hfdc_harddisks, NULL, MFM_BYTE, 2000, 20, MFMHD_GEN_FORMAT) MCFG_DEVICE_ADD(CLOCK_TAG, MM58274C, 0) MCFG_MM58274C_MODE24(1) // 24 hour diff --git a/src/emu/bus/ti99_peb/hfdc.h b/src/emu/bus/ti99_peb/hfdc.h index d27a9f4c8bc..e4e466a89d4 100644 --- a/src/emu/bus/ti99_peb/hfdc.h +++ b/src/emu/bus/ti99_peb/hfdc.h @@ -17,9 +17,10 @@ #define __HFDC__ #include "imagedev/floppy.h" +#include "imagedev/mfmhd.h" + #include "machine/mm58274c.h" -#include "machine/hdc9234.h" -#include "machine/ti99_hd.h" +#include "machine/hdc92x4.h" extern const device_type TI99_HFDC; diff --git a/src/emu/bus/ti99_peb/pcode.h b/src/emu/bus/ti99_peb/pcode.h index 10f86debca8..4630d127f13 100644 --- a/src/emu/bus/ti99_peb/pcode.h +++ b/src/emu/bus/ti99_peb/pcode.h @@ -17,7 +17,7 @@ #include "emu.h" #include "peribox.h" -#include "machine/ti99/grom.h" +#include "bus/ti99x/grom.h" extern const device_type TI99_P_CODE; diff --git a/src/emu/bus/ti99_peb/peribox.h b/src/emu/bus/ti99_peb/peribox.h index 85c8bfcbdbc..7e48726f75c 100644 --- a/src/emu/bus/ti99_peb/peribox.h +++ b/src/emu/bus/ti99_peb/peribox.h @@ -14,7 +14,7 @@ #ifndef __PBOX__ #define __PBOX__ -#include "machine/ti99/ti99defs.h" +#include "bus/ti99x/ti99defs.h" extern const device_type PERIBOX; extern const device_type PERIBOX_SLOT; diff --git a/src/emu/bus/ti99_peb/tn_ide.c b/src/emu/bus/ti99_peb/tn_ide.c index c073f3443a7..10e69ace518 100644 --- a/src/emu/bus/ti99_peb/tn_ide.c +++ b/src/emu/bus/ti99_peb/tn_ide.c @@ -31,7 +31,6 @@ #include "peribox.h" #include "machine/ataintf.h" #include "tn_ide.h" -#include "machine/ti99_hd.h" #define CRU_BASE 0x1000 diff --git a/src/mess/machine/ti99/990_dk.c b/src/emu/bus/ti99x/990_dk.c index 5eb8ea58892..5eb8ea58892 100644 --- a/src/mess/machine/ti99/990_dk.c +++ b/src/emu/bus/ti99x/990_dk.c diff --git a/src/mess/machine/ti99/990_dk.h b/src/emu/bus/ti99x/990_dk.h index 2f83660ae75..2f83660ae75 100644 --- a/src/mess/machine/ti99/990_dk.h +++ b/src/emu/bus/ti99x/990_dk.h diff --git a/src/mess/machine/ti99/990_hd.c b/src/emu/bus/ti99x/990_hd.c index fa0cd00646b..fa0cd00646b 100644 --- a/src/mess/machine/ti99/990_hd.c +++ b/src/emu/bus/ti99x/990_hd.c diff --git a/src/mess/machine/ti99/990_hd.h b/src/emu/bus/ti99x/990_hd.h index 4c5e85f928d..4c5e85f928d 100644 --- a/src/mess/machine/ti99/990_hd.h +++ b/src/emu/bus/ti99x/990_hd.h diff --git a/src/mess/machine/ti99/990_tap.c b/src/emu/bus/ti99x/990_tap.c index 20ca2333f7b..20ca2333f7b 100644 --- a/src/mess/machine/ti99/990_tap.c +++ b/src/emu/bus/ti99x/990_tap.c diff --git a/src/mess/machine/ti99/990_tap.h b/src/emu/bus/ti99x/990_tap.h index 09e2e30da0a..09e2e30da0a 100644 --- a/src/mess/machine/ti99/990_tap.h +++ b/src/emu/bus/ti99x/990_tap.h diff --git a/src/mess/machine/ti99/mapper8.c b/src/emu/bus/ti99x/998board.c index c8c5d293660..987cac6de54 100644 --- a/src/mess/machine/ti99/mapper8.c +++ b/src/emu/bus/ti99x/998board.c @@ -193,15 +193,15 @@ ***************************************************************************/ -#include "mapper8.h" +#include "998board.h" #define TRACE_CRU 0 #define TRACE_MEM 0 #define TRACE_MAP 0 #define TRACE_CONFIG 0 #define TRACE_OSO 0 - -#define LOG logerror +#define TRACE_SPEECH 0 +#define TRACE_DETAIL 0 mainboard8_device::mainboard8_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : bus8z_device(mconfig, MAINBOARD8, "TI-99/8 Main board", tag, owner, clock, "ti998_mainboard", __FILE__), @@ -218,7 +218,7 @@ mainboard8_device::mainboard8_device(const machine_config &mconfig, const char * READ8Z_MEMBER(mainboard8_device::crureadz) { - if (TRACE_CRU) LOG("mainboard_998: read CRU %04x ignored\n", offset); + if (TRACE_CRU) logerror("%s: read CRU %04x ignored\n", tag(), offset); // Nothing here. } @@ -236,10 +236,10 @@ WRITE8_MEMBER(mainboard8_device::cruwrite) case 0: // Turn on/off the internal DSR m_dsr_selected = (data!=0); - if (TRACE_CRU) LOG("mainboard_998: DSR select = %d\n", data); + if (TRACE_CRU) logerror("%s: DSR select = %d\n", tag(), data); break; case 1: - if (TRACE_CRU) LOG("mainboard_998: System reset by CRU request\n"); + if (TRACE_CRU) logerror("%s: System reset by CRU request\n", tag()); machine().schedule_soft_reset(); break; } @@ -254,10 +254,10 @@ WRITE8_MEMBER(mainboard8_device::cruwrite) case 0: // Turn on/off the Hexbus DSR m_hexbus_selected = (data!=0); - if (TRACE_CRU) LOG("mainboard_998: Hexbus select = %d\n", data); + if (TRACE_CRU) logerror("%s: Hexbus select = %d\n", tag(), data); break; default: - if (TRACE_CRU) LOG("mainboard_998: Set CRU>%04x (Hexbus) to %d\n",offset,data); + if (TRACE_CRU) logerror("%s: Set CRU>%04x (Hexbus) to %d\n", tag(), offset,data); break; } return; @@ -265,14 +265,14 @@ WRITE8_MEMBER(mainboard8_device::cruwrite) if ((offset & 0xff00)>=0x0100) { - if (TRACE_CRU) LOG("mainboard_998: Set CRU>%04x (unknown) to %d\n",offset,data); + if (TRACE_CRU) logerror("%s: Set CRU>%04x (unknown) to %d\n", tag(), offset,data); return; } } void mainboard8_device::CRUS_set(bool state) { - if (TRACE_CRU) LOG("mainboard_998: set CRUS=%d\n", state); + if (TRACE_CRU) logerror("%s: set CRUS=%d\n", tag(), state); m_CRUS = state; } @@ -281,7 +281,7 @@ void mainboard8_device::CRUS_set(bool state) */ void mainboard8_device::PTGE_set(bool state) { - if (TRACE_CRU) LOG("mainboard_998: set PTGEN=%d\n", state? 1:0); + if (TRACE_CRU) logerror("%s: set PTGEN=%d\n", tag(), state? 1:0); m_PTGE = state; } @@ -296,7 +296,7 @@ READ8_MEMBER( mainboard8_device::readm ) { UINT8 value = 0; bool found = false; - if (TRACE_MEM) LOG("mainboard_998: read from %04x\n", offset); + if (TRACE_MEM) logerror("%s: read from %04x\n", tag(), offset); found = access_logical_r(space, offset, &value, mem_mask); m_waitcount = 2; @@ -365,7 +365,7 @@ READ8Z_MEMBER( mainboard8_device::readz ) { // Starts at 0x4000 in the image *value = m_rom1[0x4000 | (offset & 0x1fff)]; - if (TRACE_MEM) LOG("mainboard_998: (intDSR) %04x -> %02x\n", offset, *value); + if (TRACE_MEM) logerror("%s: (intDSR) %04x -> %02x\n", tag(), offset, *value); } else { @@ -379,7 +379,7 @@ READ8Z_MEMBER( mainboard8_device::readz ) { // Starts at 0x6000 in the image *value = m_rom1[0x6000 | (offset & 0x1fff)]; - if (TRACE_MEM) LOG("mainboard_998: (HexDSR) %04x -> %02x\n", offset, *value); + if (TRACE_MEM) logerror("%s: (HexDSR) %04x -> %02x\n", tag(), offset, *value); } } } @@ -388,7 +388,7 @@ READ8Z_MEMBER( mainboard8_device::readz ) { if (((offset & 0xfff0)==0xf870 && m_CRUS==false)||(((offset & 0xfff0)==0x8810 && m_CRUS==true))) { - if (TRACE_MEM) LOG("mainboard_998: read access to mapper ignored: %04x\n", offset); + if (TRACE_MEM) logerror("%s: read access to mapper ignored: %04x\n", tag(), offset); } } } @@ -410,18 +410,18 @@ WRITE8_MEMBER( mainboard8_device::write ) } else { - LOG("mainboard_998: Write access to Hexbus DSR address %06x ignored\n", offset); + logerror("%s: Write access to Hexbus DSR address %06x ignored\n", tag(), offset); } } else { if (m_dsr_selected) { - LOG("mainboard_998: Write access to internal DSR address %06x ignored\n", offset); + logerror("%s: Write access to internal DSR address %06x ignored\n", tag(), offset); } else { - LOG("mainboard_998: Write access to unmapped DSR space at address %06x ignored\n", offset); + logerror("%s: Write access to unmapped DSR space at address %06x ignored\n", tag(), offset); } } } @@ -449,7 +449,7 @@ void mainboard8_device::mapwrite(int offset, UINT8 data) int bankindx = (data & 0x0e)>>1; if (data & 1) { - if (TRACE_MAP) LOG("mainboard_998: load mapper from SRAM, bank %d\n", bankindx); + if (TRACE_MAP) logerror("%s: load mapper from SRAM, bank %d\n", tag(), bankindx); // Load from SRAM // In reality the CPU is put on HOLD during this transfer for (int i=0; i < 16; i++) @@ -457,12 +457,12 @@ void mainboard8_device::mapwrite(int offset, UINT8 data) int ptr = (bankindx << 6); m_pas_offset[i] = (m_sram[(i<<2) + ptr] << 24) | (m_sram[(i<<2)+ ptr+1] << 16) | (m_sram[(i<<2) + ptr+2] << 8) | (m_sram[(i<<2) + ptr+3]); - if (TRACE_MAP) LOG("mainboard_998: load %d=%08x\n", i, m_pas_offset[i]); + if (TRACE_MAP) logerror("%s: load %d=%08x\n", tag(), i, m_pas_offset[i]); } } else { - if (TRACE_MAP) LOG("mainboard_998: store mapper to SRAM, bank %d\n", bankindx); + if (TRACE_MAP) logerror("%s: store mapper to SRAM, bank %d\n", tag(), bankindx); // Store in SRAM for (int i=0; i < 16; i++) { @@ -471,7 +471,7 @@ void mainboard8_device::mapwrite(int offset, UINT8 data) m_sram[(i<<2) + ptr +1] = (m_pas_offset[i] >> 16)& 0xff; m_sram[(i<<2) + ptr +2] = (m_pas_offset[i] >> 8)& 0xff; m_sram[(i<<2) + ptr +3] = (m_pas_offset[i])& 0xff; - if (TRACE_MAP) LOG("mainboard_998: save %d=%08x\n", i, m_pas_offset[i]); + if (TRACE_MAP) logerror("%s: save %d=%08x\n", tag(), i, m_pas_offset[i]); } } } @@ -487,10 +487,10 @@ bool mainboard8_device::access_logical_r(address_space& space, offs_t offset, UI logically_addressed_device *ldev = m_logcomp.first(); bus8z_device *bdev = NULL; - if (TRACE_MEM) LOG("mainboard_998: offset=%04x; CRUS=%d, PTGEN=%d\n", offset, m_CRUS? 1:0, m_PTGE? 0:1); + if (TRACE_MEM) logerror("%s: offset=%04x; CRUS=%d, PTGEN=%d\n", tag(), offset, m_CRUS? 1:0, m_PTGE? 0:1); while (ldev != NULL) { - if (TRACE_MEM) LOG("mainboard_998: checking node=%s\n", ldev->m_config->name); + if (TRACE_MEM) logerror("%s: checking node=%s\n", tag(), ldev->m_config->name); // Check the mode if (((ldev->m_config->mode == NATIVE) && (m_CRUS==false)) || ((ldev->m_config->mode == TI99EM) && (m_CRUS==true)) @@ -502,21 +502,21 @@ bool mainboard8_device::access_logical_r(address_space& space, offs_t offset, UI { case MAP8_SRAM: *value = m_sram[offset & ~ldev->m_config->address_mask]; - if (TRACE_MEM) LOG("mainboard_998: (SRAM) %04x -> %02x\n", offset, *value); + if (TRACE_MEM) logerror("%s: (SRAM) %04x -> %02x\n", tag(), offset, *value); break; case MAP8_ROM0: // Starts at 0000 *value = m_rom0[offset & ~ldev->m_config->address_mask]; - if (TRACE_MEM) LOG("mainboard_998: (ROM0) %04x -> %02x\n", offset, *value); + if (TRACE_MEM) logerror("%s: (ROM0) %04x -> %02x\n", tag(), offset, *value); break; case MAP8_DEV: // device bdev = static_cast<bus8z_device*>(ldev->m_device); bdev->readz(space, offset, value, mem_mask); - if (TRACE_MEM) LOG("mainboard_998: (dev %s) %04x -> %02x\n", ldev->m_config->name, offset, *value); + if (TRACE_MEM) logerror("%s: (dev %s) %04x -> %02x\n", tag(), ldev->m_config->name, offset, *value); break; default: - if (TRACE_MEM) LOG("mainboard_998: Invalid kind for read access: %d\n", ldev->m_kind); + if (TRACE_MEM) logerror("%s: Invalid kind for read access: %d\n", tag(), ldev->m_kind); } found = true; if (ldev->m_config->stop==STOP) break; @@ -546,19 +546,19 @@ bool mainboard8_device::access_logical_w(address_space& space, offs_t offset, UI { case MAP8_SRAM: m_sram[offset & ~ldev->m_config->address_mask] = data; - if (TRACE_MEM) LOG("mainboard_998: (SRAM) %04x <- %02x\n", offset, data); + if (TRACE_MEM) logerror("%s: (SRAM) %04x <- %02x\n", tag(), offset, data); break; case MAP8_ROM0: - if (TRACE_MEM) LOG("mainboard_998: (ROM0) %04x <- %02x (ignored)\n", offset, data); + if (TRACE_MEM) logerror("%s: (ROM0) %04x <- %02x (ignored)\n", tag(), offset, data); break; case MAP8_DEV: // device bdev = static_cast<bus8z_device*>(ldev->m_device); bdev->write(space, offset, data, mem_mask); - if (TRACE_MEM) LOG("mainboard_998: (dev %s) %04x <- %02x\n", ldev->m_config->name, offset, data); + if (TRACE_MEM) logerror("%s: (dev %s) %04x <- %02x\n", tag(), ldev->m_config->name, offset, data); break; default: - if (TRACE_MEM) LOG("mainboard_998: Invalid kind for write access: %d\n", ldev->m_kind); + if (TRACE_MEM) logerror("%s: Invalid kind for write access: %d\n", tag(), ldev->m_kind); } found = true; if (ldev->m_config->stop==STOP) break; @@ -583,34 +583,34 @@ void mainboard8_device::access_physical_r( address_space& space, offs_t pas_addr { case MAP8_DRAM: *value = m_dram[pas_address & ~pdev->m_config->address_mask]; - if (TRACE_MEM) LOG("mainboard_998: (DRAM) %06x -> %02x\n", pas_address, *value); + if (TRACE_MEM) logerror("%s: (DRAM) %06x -> %02x\n", tag(), pas_address, *value); break; case MAP8_ROM1A0: // Starts at 0000 in the image, 8K *value = m_rom1[pas_address & 0x1fff]; - if (TRACE_MEM) LOG("mainboard_998: (ROM) %06x -> %02x\n", pas_address, *value); + if (TRACE_MEM) logerror("%s: (ROM) %06x -> %02x\n", tag(), pas_address, *value); break; case MAP8_ROM1C0: // Starts at 2000 in the image, 8K *value = m_rom1[0x2000 | (pas_address & 0x1fff)]; - if (TRACE_MEM) LOG("mainboard_998: (ROM) %06x -> %02x\n", pas_address, *value); + if (TRACE_MEM) logerror("%s: (ROM) %06x -> %02x\n", tag(), pas_address, *value); break; case MAP8_PCODE: *value = m_pcode[pas_address & 0x3fff]; - if (TRACE_MEM) LOG("mainboard_998: (PCDOE) %06x -> %02x\n", pas_address, *value); + if (TRACE_MEM) logerror("%s: (PCODE) %06x -> %02x\n", tag(), pas_address, *value); break; case MAP8_INTS: // Interrupt sense - LOG("mainboard_998: ILSENSE not implemented.\n"); + logerror("%s: ILSENSE not implemented.\n", tag()); break; case MAP8_DEV: // devices bdev = static_cast<bus8z_device*>(pdev->m_device); bdev->readz(space, pas_address, value, mem_mask); - if (TRACE_MEM) LOG("mainboard_998: (dev %s) %06x -> %02x\n", pdev->m_config->name, pas_address, *value); + if (TRACE_MEM) logerror("%s: (dev %s) %06x -> %02x\n", tag(), pdev->m_config->name, pas_address, *value); break; default: - LOG("mainboard_998: Invalid kind for physical read access: %d\n", pdev->m_kind); + logerror("%s: Invalid kind for physical read access: %d\n", tag(), pdev->m_kind); } if (pdev->m_config->stop==STOP) break; } @@ -631,27 +631,27 @@ void mainboard8_device::access_physical_w( address_space& space, offs_t pas_addr { case MAP8_DRAM: m_dram[pas_address & ~pdev->m_config->address_mask] = data; - if (TRACE_MEM) LOG("mainboard_998: (DRAM) %06x <- %02x\n", pas_address, data); + if (TRACE_MEM) logerror("%s: (DRAM) %06x <- %02x\n", tag(), pas_address, data); break; case MAP8_ROM1A0: case MAP8_ROM1C0: - if (TRACE_MEM) LOG("mainboard_998: (ROM1) %06x <- %02x (ignored)\n", pas_address, data); + if (TRACE_MEM) logerror("%s: (ROM1) %06x <- %02x (ignored)\n", tag(), pas_address, data); break; case MAP8_PCODE: - if (TRACE_MEM) LOG("mainboard_998: (PCODE) %06x <- %02x (ignored)\n", pas_address, data); + if (TRACE_MEM) logerror("%s: (PCODE) %06x <- %02x (ignored)\n", tag(), pas_address, data); break; case MAP8_INTS: // Interrupt sense - LOG("ti99_8: write to ilsense ignored\n"); + logerror("%s: write to ilsense ignored\n", tag()); break; case MAP8_DEV: // devices bdev = static_cast<bus8z_device*>(pdev->m_device); - if (TRACE_MEM) LOG("mainboard_998: (dev %s) %06x <- %02x\n", pdev->m_config->name, pas_address, data); + if (TRACE_MEM) logerror("%s: (dev %s) %06x <- %02x\n", tag(), pdev->m_config->name, pas_address, data); bdev->write(space, pas_address, data, mem_mask); break; default: - LOG("mainboard_998: Invalid kind for physical write access: %d\n", pdev->m_kind); + logerror("%s: Invalid kind for physical write access: %d\n", tag(), pdev->m_kind); } if (pdev->m_config->stop==STOP) break; } @@ -684,7 +684,7 @@ void mainboard8_device::clock_in(int clock) */ void mainboard8_device::device_start() { - LOG("ti99_8: Starting mapper\n"); + logerror("%s: Starting mapper\n", tag()); // String values of the pseudo constants, used in the configuration. const char *const pseudodev[7] = { SRAMNAME, ROM0NAME, ROM1A0NAME, ROM1C0NAME, DRAMNAME, PCODENAME, INTSNAME }; @@ -737,24 +737,24 @@ void mainboard8_device::device_start() { logically_addressed_device *ad = new logically_addressed_device(kind, (device_t*)dev, entry[i]); m_logcomp.append(*ad); - if (TRACE_CONFIG) LOG("mainboard_998: Device %s mounted into logical address space.\n", entry[i].name); + if (TRACE_CONFIG) logerror("%s: Device %s mounted into logical address space.\n", tag(), entry[i].name); } else { physically_addressed_device *ad = new physically_addressed_device(kind, (device_t*)dev, entry[i]); m_physcomp.append(*ad); - if (TRACE_CONFIG) LOG("mainboard_998: Device %s mounted into physical address space.\n", entry[i].name); + if (TRACE_CONFIG) logerror("%s: Device %s mounted into physical address space.\n", tag(), entry[i].name); } } else { - if (TRACE_CONFIG) LOG("mainboard_998: Device %s not found.\n", entry[i].name); + if (TRACE_CONFIG) logerror("%s: Device %s not found.\n", tag(), entry[i].name); } } } } - if (TRACE_CONFIG) LOG("Mapper logical device count = %d\n", m_logcomp.count()); - if (TRACE_CONFIG) LOG("Mapper physical device count = %d\n", m_physcomp.count()); + if (TRACE_CONFIG) logerror("%s: Mapper logical device count = %d\n", tag(), m_logcomp.count()); + if (TRACE_CONFIG) logerror("%s: Mapper physical device count = %d\n", tag(), m_physcomp.count()); m_dsr_selected = false; m_CRUS = true; @@ -861,7 +861,6 @@ enum ti998_oso_device::ti998_oso_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, OSO, "OSO Hexbus interface", tag, owner, clock, "ti998_oso", __FILE__) { - if (TRACE_OSO) LOG("ti998/oso: Creating OSO\n"); } READ8_MEMBER( ti998_oso_device::read ) @@ -872,23 +871,23 @@ READ8_MEMBER( ti998_oso_device::read ) { case 0: // read 5FF8: read data register - if (TRACE_OSO) LOG("ti998/oso: Read data register = %02x\n", value); + if (TRACE_OSO) logerror("%s: Read data register = %02x\n", tag(), value); value = m_data; break; case 1: // read 5FFA: read status register value = m_status; - if (TRACE_OSO) LOG("ti998/oso: Read status %02x\n", value); + if (TRACE_OSO) logerror("%s: Read status %02x\n", tag(), value); break; case 2: // read 5FFC: read control register value = m_control; - if (TRACE_OSO) LOG("ti998/oso: Read control register = %02x\n", value); + if (TRACE_OSO) logerror("%s: Read control register = %02x\n", tag(), value); break; case 3: // read 5FFE: read transmit register value = m_xmit; - if (TRACE_OSO) LOG("ti998/oso: Read transmit register = %02x\n", value); + if (TRACE_OSO) logerror("%s: Read transmit register = %02x\n", tag(), value); break; } return value; @@ -901,7 +900,7 @@ WRITE8_MEMBER( ti998_oso_device::write ) { case 0: // write 5FF8: write transmit register - if (TRACE_OSO) LOG("ti998/oso: Write transmit register %02x\n", data); + if (TRACE_OSO) logerror("%s: Write transmit register %02x\n", tag(), data); m_xmit = data; // We set the status register directly in order to prevent lock-ups // until we have a complete Hexbus implementation @@ -909,12 +908,12 @@ WRITE8_MEMBER( ti998_oso_device::write ) break; case 1: // write 5FFA: write control register - if (TRACE_OSO) LOG("ti998/oso: Write control register %02x\n", data); + if (TRACE_OSO) logerror("%s: Write control register %02x\n", tag(), data); m_control = data; break; default: // write 5FFC, 5FFE: undefined - if (TRACE_OSO) LOG("ti998/oso: Invalid write on %04x: %02x\n", (offset<<1) | 0x5ff0, data); + if (TRACE_OSO) logerror("%s: Invalid write on %04x: %02x\n", tag(), (offset<<1) | 0x5ff0, data); break; } } @@ -925,3 +924,153 @@ void ti998_oso_device::device_start() } const device_type OSO = &device_creator<ti998_oso_device>; + + +// ======================================================================== + +/**************************************************************************** + + TI-99/8 Speech synthesizer subsystem + + The TI-99/8 contains a speech synthesizer inside the console, so we cannot + reuse the spchsyn implementation of the P-Box speech synthesizer. + Accordingly, this is not a ti_expansion_card_device. + + For comments on real timing see ti99/spchsyn.c + + Note that before the REAL_TIMING can be used we must first establish + the set_address logic in 998board. + +*****************************************************************************/ + +#define TMS5220_ADDRESS_MASK 0x3FFFFUL /* 18-bit mask for tms5220 address */ +#define SPEECHSYN_TAG "speechsyn" +#define REAL_TIMING 0 + +ti998_spsyn_device::ti998_spsyn_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) +: bus8z_device(mconfig, SPEECH8, "TI-99/8 Onboard Speech synthesizer", tag, owner, clock, "ti998_speech", __FILE__), + m_ready(*this) +{ +} + +/* + Memory read +*/ +#if REAL_TIMING +// ====== This is the version with real timing ======= +READ8Z_MEMBER( ti998_spsyn_device::readz ) +{ + m_vsp->wsq_w(TRUE); + m_vsp->rsq_w(FALSE); + *value = m_vsp->read(offset) & 0xff; + if (TRACE_SPEECH) logerror("%s: read value = %02x\n", tag(), *value); +} + +/* + Memory write +*/ +WRITE8_MEMBER( ti998_spsyn_device::write ) +{ + m_vsp->rsq_w(m_vsp, TRUE); + m_vsp->wsq_w(m_vsp, FALSE); + if (TRACE_SPEECH) logerror("%s: write value = %02x\n", tag(), data); + m_vsp->write(offset, data); +} + +#else +// ====== This is the version without real timing ======= + +READ8Z_MEMBER( ti998_spsyn_device::readz ) +{ + machine().device("maincpu")->execute().adjust_icount(-(18+3)); /* this is just a minimum, it can be more */ + *value = m_vsp->status_r(space, offset, 0xff) & 0xff; + if (TRACE_SPEECH) logerror("%s: read value = %02x\n", tag(), *value); +} + +/* + Memory write +*/ +WRITE8_MEMBER( ti998_spsyn_device::write ) +{ + machine().device("maincpu")->execute().adjust_icount(-(54+3)); /* this is just an approx. minimum, it can be much more */ + + /* RN: the stupid design of the tms5220 core means that ready is cleared */ + /* when there are 15 bytes in FIFO. It should be 16. Of course, if */ + /* it were the case, we would need to store the value on the bus, */ + /* which would be more complex. */ + if (!m_vsp->readyq_r()) + { + attotime time_to_ready = attotime::from_double(m_vsp->time_to_ready()); + int cycles_to_ready = machine().device<cpu_device>("maincpu")->attotime_to_cycles(time_to_ready); + if (TRACE_SPEECH && TRACE_DETAIL) logerror("%s: time to ready: %f -> %d\n", tag(), time_to_ready.as_double(), (int) cycles_to_ready); + + machine().device("maincpu")->execute().adjust_icount(-cycles_to_ready); + machine().scheduler().timer_set(attotime::zero, FUNC_NULL); + } + if (TRACE_SPEECH) logerror("%s: write value = %02x\n", tag(), data); + m_vsp->data_w(space, offset, data); +} +#endif + +/**************************************************************************/ + +WRITE_LINE_MEMBER( ti998_spsyn_device::speech8_ready ) +{ + // The TMS5200 implementation uses TRUE/FALSE, not ASSERT/CLEAR semantics + m_ready((state==0)? ASSERT_LINE : CLEAR_LINE); + if (TRACE_SPEECH) logerror("%s: READY = %d\n", tag(), (state==0)); + +#if REAL_TIMING + // Need to do that here (see explanations in spchsyn.c) + if (state==0) + { + m_vsp->rsq_w(TRUE); + m_vsp->wsq_w(TRUE); + } +#endif +} + +void ti998_spsyn_device::device_start() +{ + m_ready.resolve_safe(); + m_vsp = subdevice<tms5220_device>(SPEECHSYN_TAG); + speechrom_device* mem = subdevice<speechrom_device>("vsm"); + mem->set_reverse_bit_order(true); +} + +void ti998_spsyn_device::device_reset() +{ + if (TRACE_SPEECH) logerror("%s: reset\n", tag()); +} + +// Unlike the TI-99/4A, the 99/8 uses the CD2501ECD +// The CD2501ECD is a tms5200/cd2501e with the rate control from the tms5220c added in. +// (it's probably actually a tms5220c die with the cd2501e/tms5200 lpc rom masked onto it) +MACHINE_CONFIG_FRAGMENT( ti998_speech ) + MCFG_DEVICE_ADD("vsm", SPEECHROM, 0) + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD(SPEECHSYN_TAG, CD2501ECD, 640000L) + MCFG_TMS52XX_READYQ_HANDLER(WRITELINE(ti998_spsyn_device, speech8_ready)) + MCFG_TMS52XX_SPEECHROM("vsm") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) +MACHINE_CONFIG_END + +/* Verified on a real machine: TI-99/8 uses the same speech rom contents + as the TI speech synthesizer. */ +ROM_START( ti998_speech ) + ROM_REGION(0x8000, "vsm", 0) + ROM_LOAD("cd2325a.vsm", 0x0000, 0x4000, CRC(1f58b571) SHA1(0ef4f178716b575a1c0c970c56af8a8d97561ffe)) + ROM_LOAD("cd2326a.vsm", 0x4000, 0x4000, CRC(65d00401) SHA1(a367242c2c96cebf0e2bf21862f3f6734b2b3020)) +ROM_END + +machine_config_constructor ti998_spsyn_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( ti998_speech ); +} + +const rom_entry *ti998_spsyn_device::device_rom_region() const +{ + return ROM_NAME( ti998_speech ); +} +const device_type SPEECH8 = &device_creator<ti998_spsyn_device>; diff --git a/src/mess/machine/ti99/mapper8.h b/src/emu/bus/ti99x/998board.h index 4683a0d150e..87332491b97 100644 --- a/src/mess/machine/ti99/mapper8.h +++ b/src/emu/bus/ti99x/998board.h @@ -2,13 +2,14 @@ // copyright-holders:Michael Zapf /**************************************************************************** - TI-99/8 Address decoder and mapper + TI-99/8 main board logic - See mapper8.c for documentation + This component implements the address decoder and mapper logic from the + TI-99/8 console. - Michael Zapf + See 998board.c for documentation - February 2012: Rewritten as class + Michael Zapf *****************************************************************************/ @@ -17,11 +18,14 @@ #include "emu.h" #include "ti99defs.h" +#include "sound/tms5220.h" extern const device_type MAINBOARD8; extern const device_type OSO; +extern const device_type SPEECH8; #define OSO_TAG "oso" +#define SPEECHSYN_TAG "speechsyn" #define NATIVE 0 #define TI99EM 1 @@ -132,6 +136,53 @@ private: UINT8 m_xmit; }; +/* + Speech support +*/ +#define MCFG_SPEECH8_READY_CALLBACK(_write) \ + devcb = &ti998_spsyn_device::set_ready_wr_callback(*device, DEVCB_##_write); + +class ti998_spsyn_device : public bus8z_device +{ +public: + ti998_spsyn_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + template<class _Object> static devcb_base &set_ready_wr_callback(device_t &device, _Object object) { return downcast<ti998_spsyn_device &>(device).m_ready.set_callback(object); } + + DECLARE_READ8Z_MEMBER(readz); + DECLARE_WRITE8_MEMBER(write); + + DECLARE_READ8Z_MEMBER(crureadz) { }; + DECLARE_WRITE8_MEMBER(cruwrite) { }; + + DECLARE_WRITE_LINE_MEMBER( speech8_ready ); + + DECLARE_READ8_MEMBER( spchrom_read ); + DECLARE_WRITE8_MEMBER( spchrom_load_address ); + DECLARE_WRITE8_MEMBER( spchrom_read_and_branch ); + +protected: + virtual void device_start(); + virtual void device_reset(void); + virtual const rom_entry *device_rom_region() const; + virtual machine_config_constructor device_mconfig_additions() const; + +private: + tms5220_device *m_vsp; +// UINT8 *m_speechrom; // pointer to speech ROM data +// int m_load_pointer; // which 4-bit nibble will be affected by load address +// int m_rombits_count; // current bit position in ROM +// UINT32 m_sprom_address; // 18 bit pointer in ROM +// UINT32 m_sprom_length; // length of data pointed by speechrom_data, from 0 to 2^18 + + // Ready line to the CPU + devcb_write_line m_ready; +}; + +#define MCFG_TISPEECH8_ADD(_tag, _conf) \ + MCFG_DEVICE_ADD(_tag, TI99_SPEECH8, 0) \ + MCFG_DEVICE_CONFIG(_conf) + /* Main class diff --git a/src/mess/machine/ti99/datamux.c b/src/emu/bus/ti99x/datamux.c index a18b448f354..a18b448f354 100644 --- a/src/mess/machine/ti99/datamux.c +++ b/src/emu/bus/ti99x/datamux.c diff --git a/src/mess/machine/ti99/datamux.h b/src/emu/bus/ti99x/datamux.h index 7bc52972602..7bc52972602 100644 --- a/src/mess/machine/ti99/datamux.h +++ b/src/emu/bus/ti99x/datamux.h diff --git a/src/mess/machine/ti99/genboard.c b/src/emu/bus/ti99x/genboard.c index 76c5695f178..76c5695f178 100644 --- a/src/mess/machine/ti99/genboard.c +++ b/src/emu/bus/ti99x/genboard.c diff --git a/src/mess/machine/ti99/genboard.h b/src/emu/bus/ti99x/genboard.h index 7728552aea8..7728552aea8 100644 --- a/src/mess/machine/ti99/genboard.h +++ b/src/emu/bus/ti99x/genboard.h diff --git a/src/mess/machine/ti99/grom.c b/src/emu/bus/ti99x/grom.c index 3c20eeb35d7..3c20eeb35d7 100644 --- a/src/mess/machine/ti99/grom.c +++ b/src/emu/bus/ti99x/grom.c diff --git a/src/mess/machine/ti99/grom.h b/src/emu/bus/ti99x/grom.h index 19a9a973b81..19a9a973b81 100644 --- a/src/mess/machine/ti99/grom.h +++ b/src/emu/bus/ti99x/grom.h diff --git a/src/mess/machine/ti99/gromport.c b/src/emu/bus/ti99x/gromport.c index 427dc929b8a..427dc929b8a 100644 --- a/src/mess/machine/ti99/gromport.c +++ b/src/emu/bus/ti99x/gromport.c diff --git a/src/mess/machine/ti99/gromport.h b/src/emu/bus/ti99x/gromport.h index 367b68ba2b6..367b68ba2b6 100644 --- a/src/mess/machine/ti99/gromport.h +++ b/src/emu/bus/ti99x/gromport.h diff --git a/src/mess/machine/ti99/handset.c b/src/emu/bus/ti99x/handset.c index 4b41ea0bd06..4b41ea0bd06 100644 --- a/src/mess/machine/ti99/handset.c +++ b/src/emu/bus/ti99x/handset.c diff --git a/src/mess/machine/ti99/handset.h b/src/emu/bus/ti99x/handset.h index ccecd741034..ccecd741034 100644 --- a/src/mess/machine/ti99/handset.h +++ b/src/emu/bus/ti99x/handset.h diff --git a/src/mess/machine/ti99/joyport.c b/src/emu/bus/ti99x/joyport.c index d49345e0b0a..d49345e0b0a 100644 --- a/src/mess/machine/ti99/joyport.c +++ b/src/emu/bus/ti99x/joyport.c diff --git a/src/mess/machine/ti99/joyport.h b/src/emu/bus/ti99x/joyport.h index 6d19148fad7..6d19148fad7 100644 --- a/src/mess/machine/ti99/joyport.h +++ b/src/emu/bus/ti99x/joyport.h diff --git a/src/mess/machine/ti99/mecmouse.c b/src/emu/bus/ti99x/mecmouse.c index 6afcec642d4..6afcec642d4 100644 --- a/src/mess/machine/ti99/mecmouse.c +++ b/src/emu/bus/ti99x/mecmouse.c diff --git a/src/mess/machine/ti99/mecmouse.h b/src/emu/bus/ti99x/mecmouse.h index 8a915b681ab..8a915b681ab 100644 --- a/src/mess/machine/ti99/mecmouse.h +++ b/src/emu/bus/ti99x/mecmouse.h diff --git a/src/mess/machine/ti99/ti99defs.h b/src/emu/bus/ti99x/ti99defs.h index fbb7c73645c..fbb7c73645c 100644 --- a/src/mess/machine/ti99/ti99defs.h +++ b/src/emu/bus/ti99x/ti99defs.h diff --git a/src/mess/machine/ti99/videowrp.c b/src/emu/bus/ti99x/videowrp.c index d42349947f8..d42349947f8 100644 --- a/src/mess/machine/ti99/videowrp.c +++ b/src/emu/bus/ti99x/videowrp.c diff --git a/src/mess/machine/ti99/videowrp.h b/src/emu/bus/ti99x/videowrp.h index 3de151e92ff..c38a8e7f152 100644 --- a/src/mess/machine/ti99/videowrp.h +++ b/src/emu/bus/ti99x/videowrp.h @@ -165,7 +165,7 @@ protected: #define MCFG_TI_V9938_ADD(_tag, _rate, _screen, _blank, _x, _y, _class, _int) \ MCFG_DEVICE_ADD(_tag, V9938VIDEO, 0) \ - MCFG_V9938_ADD(VDP_TAG, _screen, 0x20000) \ + MCFG_V9938_ADD(VDP_TAG, _screen, 0x20000, XTAL_21_4772MHz) /* typical 9938 clock, not verified */ \ MCFG_V99X8_INTERRUPT_CALLBACK(WRITELINE(_class, _int)) \ MCFG_SCREEN_ADD(_screen, RASTER) \ MCFG_SCREEN_REFRESH_RATE(_rate) \ diff --git a/src/emu/cpu/arcompact/arcompact_make.py b/src/emu/cpu/arcompact/arcompact_make.py index dba815b9f70..080fd72b426 100644 --- a/src/emu/cpu/arcompact/arcompact_make.py +++ b/src/emu/cpu/arcompact/arcompact_make.py @@ -1,351 +1,352 @@ #!/usr/bin/python +from __future__ import print_function import sys def EmitGroup04_Handle_NZ_Flags(f, funcname, opname): - print >>f, " if (result & 0x80000000) { STATUS32_SET_N; }" - print >>f, " else { STATUS32_CLEAR_N; }" - print >>f, " if (result == 0x00000000) { STATUS32_SET_Z; }" - print >>f, " else { STATUS32_CLEAR_Z; }" + print(" if (result & 0x80000000) { STATUS32_SET_N; }", file=f) + print(" else { STATUS32_CLEAR_N; }", file=f) + print(" if (result == 0x00000000) { STATUS32_SET_Z; }", file=f) + print(" else { STATUS32_CLEAR_Z; }", file=f) def EmitGroup04_Handle_NZC_LSR1_Flags(f, funcname, opname): - print >>f, " if (result & 0x80000000) { STATUS32_SET_N; }" - print >>f, " else { STATUS32_CLEAR_N; }" - print >>f, " if (result == 0x00000000) { STATUS32_SET_Z; }" - print >>f, " else { STATUS32_CLEAR_Z; }" - print >>f, " if (c == 0x00000001) { STATUS32_SET_C; }" - print >>f, " else { STATUS32_CLEAR_C; }" + print(" if (result & 0x80000000) { STATUS32_SET_N; }", file=f) + print(" else { STATUS32_CLEAR_N; }", file=f) + print(" if (result == 0x00000000) { STATUS32_SET_Z; }", file=f) + print(" else { STATUS32_CLEAR_Z; }", file=f) + print(" if (c == 0x00000001) { STATUS32_SET_C; }", file=f) + print(" else { STATUS32_CLEAR_C; }", file=f) def EmitGroup04_Handle_NZCV_ADD_Flags(f, funcname, opname): - print >>f, " if (result & 0x80000000) { STATUS32_SET_N; }" - print >>f, " else { STATUS32_CLEAR_N; }" - print >>f, " if (result == 0x00000000) { STATUS32_SET_Z; }" - print >>f, " else { STATUS32_CLEAR_Z; }" - print >>f, " if ((b & 0x80000000) == (c & 0x80000000))" - print >>f, " {" - print >>f, " if ((result & 0x80000000) != (b & 0x80000000))" - print >>f, " {" - print >>f, " STATUS32_SET_V;" - print >>f, " }" - print >>f, " else" - print >>f, " {" - print >>f, " STATUS32_CLEAR_V;" - print >>f, " }" - print >>f, " }" - print >>f, " if (b < c)" - print >>f, " {" - print >>f, " STATUS32_SET_C;" - print >>f, " }" - print >>f, " else" - print >>f, " {" - print >>f, " STATUS32_CLEAR_C;" - print >>f, " }" + print(" if (result & 0x80000000) { STATUS32_SET_N; }", file=f) + print(" else { STATUS32_CLEAR_N; }", file=f) + print(" if (result == 0x00000000) { STATUS32_SET_Z; }", file=f) + print(" else { STATUS32_CLEAR_Z; }", file=f) + print(" if ((b & 0x80000000) == (c & 0x80000000))", file=f) + print(" {", file=f) + print(" if ((result & 0x80000000) != (b & 0x80000000))", file=f) + print(" {", file=f) + print(" STATUS32_SET_V;", file=f) + print(" }", file=f) + print(" else", file=f) + print(" {", file=f) + print(" STATUS32_CLEAR_V;", file=f) + print(" }", file=f) + print(" }", file=f) + print(" if (b < c)", file=f) + print(" {", file=f) + print(" STATUS32_SET_C;", file=f) + print(" }", file=f) + print(" else", file=f) + print(" {", file=f) + print(" STATUS32_CLEAR_C;", file=f) + print(" }", file=f) def EmitGroup04_no_Flags(f, funcname, opname): - print >>f, " // no flag changes" + print(" // no flag changes", file=f) def EmitGroup04_unsupported_Flags(f, funcname, opname): - print >>f, " arcompact_fatal(\"arcompact_handle%s (%s) (F set)\\n\"); // not yet supported" % (funcname, opname) + print(" arcompact_fatal(\"arcompact_handle%s (%s) (F set)\\n\"); // not yet supported" % (funcname, opname), file=f) def EmitGroup04_Flaghandler(f,funcname, opname, flagcondition, flaghandler): if flagcondition == -1: - print >>f, " if (F)" - print >>f, " {" + print(" if (F)", file=f) + print(" {", file=f) flaghandler(f, funcname, opname) - print >>f, " }" + print(" }", file=f) elif flagcondition == 0: - print >>f, " if (0)" - print >>f, " {" + print(" if (0)", file=f) + print(" {", file=f) flaghandler(f, funcname, opname) - print >>f, " }" + print(" }", file=f) elif flagcondition == 1: - print >>f, " if (1)" - print >>f, " {" + print(" if (1)", file=f) + print(" {", file=f) flaghandler(f, funcname, opname) - print >>f, " }" + print(" }", file=f) def EmitGroup04_u5fragment(f,funcname, opname, opexecute, opwrite, opwrite_alt, ignore_a, breg_is_dst_only, flagcondition, flaghandler): - print >>f, " int size = 4;" + print(" int size = 4;", file=f) if breg_is_dst_only == 0: - print >>f, " UINT32 limm = 0;" + print(" UINT32 limm = 0;", file=f) - print >>f, "/* int got_limm = 0; */" - print >>f, " " - print >>f, " COMMON32_GET_breg;" + print("/* int got_limm = 0; */", file=f) + print(" ", file=f) + print(" COMMON32_GET_breg;", file=f) if flagcondition == -1: - print >>f, " COMMON32_GET_F;" + print(" COMMON32_GET_F;", file=f) - print >>f, " COMMON32_GET_u6;" + print(" COMMON32_GET_u6;", file=f) if ignore_a == 0: - print >>f, " COMMON32_GET_areg;" + print(" COMMON32_GET_areg;", file=f) elif ignore_a == 1: - print >>f, " //COMMON32_GET_areg; // areg is reserved / not used" + print(" //COMMON32_GET_areg; // areg is reserved / not used", file=f) elif ignore_a == 2: - print >>f, " //COMMON32_GET_areg; // areg bits already used as opcode select" + print(" //COMMON32_GET_areg; // areg bits already used as opcode select", file=f) elif ignore_a == 3: - print >>f, " //COMMON32_GET_areg; // areg bits already used as condition code select" - print >>f, " " + print(" //COMMON32_GET_areg; // areg bits already used as condition code select", file=f) + print(" ", file=f) - print >>f, " UINT32 c;" + print(" UINT32 c;", file=f) if breg_is_dst_only == 0: - print >>f, " UINT32 b;" - print >>f, " " - print >>f, " /* is having b as LIMM valid here? LIMM vs. fixed u6 value makes no sense */" - print >>f, " if (breg == LIMM_REG)" - print >>f, " {" - print >>f, " GET_LIMM_32;" - print >>f, " size = 8;" - print >>f, "/* got_limm = 1; */" - print >>f, " b = limm;" - print >>f, " }" - print >>f, " else" - print >>f, " {" - print >>f, " b = m_regs[breg];" - print >>f, " }" + print(" UINT32 b;", file=f) + print(" ", file=f) + print(" /* is having b as LIMM valid here? LIMM vs. fixed u6 value makes no sense */", file=f) + print(" if (breg == LIMM_REG)", file=f) + print(" {", file=f) + print(" GET_LIMM_32;", file=f) + print(" size = 8;", file=f) + print("/* got_limm = 1; */", file=f) + print(" b = limm;", file=f) + print(" }", file=f) + print(" else", file=f) + print(" {", file=f) + print(" b = m_regs[breg];", file=f) + print(" }", file=f) - print >>f, " " - print >>f, " c = u;" - print >>f, " " - print >>f, " /* todo: if areg = LIMM then there is no result (but since that register can never be read, I guess it doesn't matter if we store it there anyway?) */" + print(" ", file=f) + print(" c = u;", file=f) + print(" ", file=f) + print(" /* todo: if areg = LIMM then there is no result (but since that register can never be read, I guess it doesn't matter if we store it there anyway?) */", file=f) def EmitGroup04(f,funcname, opname, opexecute, opwrite, opwrite_alt, ignore_a, breg_is_dst_only, flagcondition, flaghandler): # the mode 0x00 handler - print >>f, "ARCOMPACT_RETTYPE arcompact_device::arcompact_handle%s_p00(OPS_32)" % funcname - print >>f, "{" - print >>f, " int size = 4;" + print("ARCOMPACT_RETTYPE arcompact_device::arcompact_handle%s_p00(OPS_32)" % funcname, file=f) + print("{", file=f) + print(" int size = 4;", file=f) - print >>f, " UINT32 limm = 0;" + print(" UINT32 limm = 0;", file=f) - print >>f, " int got_limm = 0;" - print >>f, " " - print >>f, " COMMON32_GET_breg;" + print(" int got_limm = 0;", file=f) + print(" ", file=f) + print(" COMMON32_GET_breg;", file=f) if flagcondition == -1: - print >>f, " COMMON32_GET_F;" + print(" COMMON32_GET_F;", file=f) - print >>f, " COMMON32_GET_creg;" + print(" COMMON32_GET_creg;", file=f) if ignore_a == 0: - print >>f, " COMMON32_GET_areg;" + print(" COMMON32_GET_areg;", file=f) elif ignore_a == 1: - print >>f, " //COMMON32_GET_areg; // areg is reserved / not used" + print(" //COMMON32_GET_areg; // areg is reserved / not used", file=f) elif ignore_a == 2: - print >>f, " //COMMON32_GET_areg; // areg bits already used as opcode select" + print(" //COMMON32_GET_areg; // areg bits already used as opcode select", file=f) - print >>f, " " + print(" ", file=f) - print >>f, " UINT32 c;" + print(" UINT32 c;", file=f) if breg_is_dst_only == 0: - print >>f, " UINT32 b;" - print >>f, " " - print >>f, " if (breg == LIMM_REG)" - print >>f, " {" - print >>f, " GET_LIMM_32;" - print >>f, " size = 8;" - print >>f, " got_limm = 1;" - print >>f, " b = limm;" - print >>f, " }" - print >>f, " else" - print >>f, " {" - print >>f, " b = m_regs[breg];" - print >>f, " }" + print(" UINT32 b;", file=f) + print(" ", file=f) + print(" if (breg == LIMM_REG)", file=f) + print(" {", file=f) + print(" GET_LIMM_32;", file=f) + print(" size = 8;", file=f) + print(" got_limm = 1;", file=f) + print(" b = limm;", file=f) + print(" }", file=f) + print(" else", file=f) + print(" {", file=f) + print(" b = m_regs[breg];", file=f) + print(" }", file=f) - print >>f, " " - print >>f, " if (creg == LIMM_REG)" - print >>f, " {" - print >>f, " if (!got_limm)" - print >>f, " {" - print >>f, " GET_LIMM_32;" - print >>f, " size = 8;" - print >>f, " }" - print >>f, " c = limm;" - print >>f, " }" - print >>f, " else" - print >>f, " {" - print >>f, " c = m_regs[creg];" - print >>f, " }" - print >>f, " /* todo: is the limm, limm syntax valid? (it's pointless.) */" - print >>f, " /* todo: if areg = LIMM then there is no result (but since that register can never be read, I guess it doesn't matter if we store it there anyway?) */" - print >>f, " %s" % opexecute - print >>f, " %s" % opwrite - print >>f, " " + print(" ", file=f) + print(" if (creg == LIMM_REG)", file=f) + print(" {", file=f) + print(" if (!got_limm)", file=f) + print(" {", file=f) + print(" GET_LIMM_32;", file=f) + print(" size = 8;", file=f) + print(" }", file=f) + print(" c = limm;", file=f) + print(" }", file=f) + print(" else", file=f) + print(" {", file=f) + print(" c = m_regs[creg];", file=f) + print(" }", file=f) + print(" /* todo: is the limm, limm syntax valid? (it's pointless.) */", file=f) + print(" /* todo: if areg = LIMM then there is no result (but since that register can never be read, I guess it doesn't matter if we store it there anyway?) */", file=f) + print(" %s" % opexecute, file=f) + print(" %s" % opwrite, file=f) + print(" ", file=f) EmitGroup04_Flaghandler(f,funcname,opname,flagcondition,flaghandler) - print >>f, " return m_pc + (size >> 0);" - print >>f, "}" - print >>f, "" - print >>f, "" + print(" return m_pc + (size >> 0);", file=f) + print("}", file=f) + print("", file=f) + print("", file=f) # the mode 0x01 handler - print >>f, "ARCOMPACT_RETTYPE arcompact_device::arcompact_handle%s_p01(OPS_32)" % funcname - print >>f, "{" + print("ARCOMPACT_RETTYPE arcompact_device::arcompact_handle%s_p01(OPS_32)" % funcname, file=f) + print("{", file=f) EmitGroup04_u5fragment(f,funcname, opname, opexecute, opwrite, opwrite_alt, ignore_a, breg_is_dst_only, flagcondition, flaghandler) - print >>f, " %s" % opexecute - print >>f, " %s" % opwrite - print >>f, " " + print(" %s" % opexecute, file=f) + print(" %s" % opwrite, file=f) + print(" ", file=f) EmitGroup04_Flaghandler(f,funcname,opname,flagcondition,flaghandler) - print >>f, " return m_pc + (size >> 0);" - print >>f, "}" - print >>f, "" - print >>f, "" + print(" return m_pc + (size >> 0);", file=f) + print("}", file=f) + print("", file=f) + print("", file=f) # the mode 0x10 handler - print >>f, "ARCOMPACT_RETTYPE arcompact_device::arcompact_handle%s_p10(OPS_32)" % funcname + print("ARCOMPACT_RETTYPE arcompact_device::arcompact_handle%s_p10(OPS_32)" % funcname, file=f) if ignore_a == 2: - print >>f, "{" - print >>f, " int size = 4;" - print >>f, " arcompact_fatal(\"illegal arcompact_handle%s_p10 (ares bits already used as opcode select, can't be used as s12) (%s)\\n\");" % (funcname, opname) - print >>f, " return m_pc + (size >> 0);" - print >>f, "}" + print("{", file=f) + print(" int size = 4;", file=f) + print(" arcompact_fatal(\"illegal arcompact_handle%s_p10 (ares bits already used as opcode select, can't be used as s12) (%s)\\n\");" % (funcname, opname), file=f) + print(" return m_pc + (size >> 0);", file=f) + print("}", file=f) else: - print >>f, "{" - print >>f, " int size = 4;" + print("{", file=f) + print(" int size = 4;", file=f) if breg_is_dst_only == 0: - print >>f, " UINT32 limm = 0;" + print(" UINT32 limm = 0;", file=f) - print >>f, "/* int got_limm = 0; */" - print >>f, " " - print >>f, " COMMON32_GET_breg;" + print("/* int got_limm = 0; */", file=f) + print(" ", file=f) + print(" COMMON32_GET_breg;", file=f) if flagcondition == -1: - print >>f, " COMMON32_GET_F;" + print(" COMMON32_GET_F;", file=f) - print >>f, " COMMON32_GET_s12;" + print(" COMMON32_GET_s12;", file=f) # areg can't be used here, it's used for s12 bits - print >>f, " " - print >>f, " UINT32 c;" + print(" ", file=f) + print(" UINT32 c;", file=f) if breg_is_dst_only == 0: - print >>f, " UINT32 b;" - print >>f, " " - print >>f, " /* is having b as LIMM valid here? LIMM vs. fixed u6 value makes no sense */" - print >>f, " if (breg == LIMM_REG)" - print >>f, " {" - print >>f, " GET_LIMM_32;" - print >>f, " size = 8;" - print >>f, "/* got_limm = 1; */" - print >>f, " b = limm;" - print >>f, " }" - print >>f, " else" - print >>f, " {" - print >>f, " b = m_regs[breg];" - print >>f, " }" + print(" UINT32 b;", file=f) + print(" ", file=f) + print(" /* is having b as LIMM valid here? LIMM vs. fixed u6 value makes no sense */", file=f) + print(" if (breg == LIMM_REG)", file=f) + print(" {", file=f) + print(" GET_LIMM_32;", file=f) + print(" size = 8;", file=f) + print("/* got_limm = 1; */", file=f) + print(" b = limm;", file=f) + print(" }", file=f) + print(" else", file=f) + print(" {", file=f) + print(" b = m_regs[breg];", file=f) + print(" }", file=f) - print >>f, " " - print >>f, " c = (UINT32)S;" - print >>f, " " - print >>f, " /* todo: if areg = LIMM then there is no result (but since that register can never be read, I guess it doesn't matter if we store it there anyway?) */" - print >>f, " %s" % opexecute - print >>f, " %s" % opwrite_alt - print >>f, " " + print(" ", file=f) + print(" c = (UINT32)S;", file=f) + print(" ", file=f) + print(" /* todo: if areg = LIMM then there is no result (but since that register can never be read, I guess it doesn't matter if we store it there anyway?) */", file=f) + print(" %s" % opexecute, file=f) + print(" %s" % opwrite_alt, file=f) + print(" ", file=f) EmitGroup04_Flaghandler(f,funcname,opname,flagcondition,flaghandler) - print >>f, " return m_pc + (size >> 0);" - print >>f, "}" - print >>f, "" - print >>f, "" + print(" return m_pc + (size >> 0);", file=f) + print("}", file=f) + print("", file=f) + print("", file=f) # the mode 0x11 m0 handler - print >>f, "ARCOMPACT_RETTYPE arcompact_device::arcompact_handle%s_p11_m0(OPS_32)" % funcname + print("ARCOMPACT_RETTYPE arcompact_device::arcompact_handle%s_p11_m0(OPS_32)" % funcname, file=f) if ignore_a == 2: - print >>f, "{" - print >>f, " int size = 4;" - print >>f, " arcompact_fatal(\"illegal arcompact_handle%s_p11_m0 (ares bits already used as opcode select, can't be used as Q condition) (%s)\\n\");" % (funcname, opname) - print >>f, " return m_pc + (size >> 0);" - print >>f, "}" + print("{", file=f) + print(" int size = 4;", file=f) + print(" arcompact_fatal(\"illegal arcompact_handle%s_p11_m0 (ares bits already used as opcode select, can't be used as Q condition) (%s)\\n\");" % (funcname, opname), file=f) + print(" return m_pc + (size >> 0);", file=f) + print("}", file=f) else: - print >>f, "{" - print >>f, " int size = 4;" - print >>f, " arcompact_fatal(\"arcompact_handle%s_p11_m0 (%s)\\n\");" % (funcname, opname) - print >>f, " return m_pc + (size >> 0);" - print >>f, "}" - print >>f, "" - print >>f, "" + print("{", file=f) + print(" int size = 4;", file=f) + print(" arcompact_fatal(\"arcompact_handle%s_p11_m0 (%s)\\n\");" % (funcname, opname), file=f) + print(" return m_pc + (size >> 0);", file=f) + print("}", file=f) + print("", file=f) + print("", file=f) # the mode 0x11 m1 handler - print >>f, "ARCOMPACT_RETTYPE arcompact_device::arcompact_handle%s_p11_m1(OPS_32)" % funcname + print("ARCOMPACT_RETTYPE arcompact_device::arcompact_handle%s_p11_m1(OPS_32)" % funcname, file=f) if ignore_a == 2: - print >>f, "{" - print >>f, " int size = 4;" - print >>f, " arcompact_fatal(\"illegal arcompact_handle%s_p11_m1 (ares bits already used as opcode select, can't be used as Q condition) (%s)\\n\");" % (funcname, opname) - print >>f, " return m_pc + (size >> 0);" - print >>f, "}" + print("{", file=f) + print(" int size = 4;", file=f) + print(" arcompact_fatal(\"illegal arcompact_handle%s_p11_m1 (ares bits already used as opcode select, can't be used as Q condition) (%s)\\n\");" % (funcname, opname), file=f) + print(" return m_pc + (size >> 0);", file=f) + print("}", file=f) else: - print >>f, "{" + print("{", file=f) EmitGroup04_u5fragment(f,funcname, opname, opexecute, opwrite, opwrite_alt, 3, breg_is_dst_only, flagcondition, flaghandler) - print >>f, " COMMON32_GET_CONDITION;" - print >>f, " if (!check_condition(condition))" - print >>f, " return m_pc + (size>>0);" - print >>f, "" - print >>f, " %s" % opexecute - print >>f, " %s" % opwrite_alt - print >>f, " " + print(" COMMON32_GET_CONDITION;", file=f) + print(" if (!check_condition(condition))", file=f) + print(" return m_pc + (size>>0);", file=f) + print("", file=f) + print(" %s" % opexecute, file=f) + print(" %s" % opwrite_alt, file=f) + print(" ", file=f) EmitGroup04_Flaghandler(f,funcname,opname,flagcondition,flaghandler) - print >>f, " return m_pc + (size >> 0);" - print >>f, "}" - print >>f, "" - print >>f, "" + print(" return m_pc + (size >> 0);", file=f) + print("}", file=f) + print("", file=f) + print("", file=f) # xxx_S c, b, u3 format opcodes (note c is destination) def EmitGroup0d(f,funcname, opname, opexecute, opwrite): - print >>f, "ARCOMPACT_RETTYPE arcompact_device::arcompact_handle%s(OPS_16)" % funcname - print >>f, "{" - print >>f, " int u, breg, creg;" - print >>f, "" - print >>f, " COMMON16_GET_u3;" - print >>f, " COMMON16_GET_breg;" - print >>f, " COMMON16_GET_creg;" - print >>f, "" - print >>f, " REG_16BIT_RANGE(breg);" - print >>f, " REG_16BIT_RANGE(creg);" - print >>f, "" - print >>f, " %s" % opexecute - print >>f, " %s" % opwrite - print >>f, "" - print >>f, " return m_pc + (2 >> 0);" - print >>f, "}" - print >>f, "" - print >>f, "" + print("ARCOMPACT_RETTYPE arcompact_device::arcompact_handle%s(OPS_16)" % funcname, file=f) + print("{", file=f) + print(" int u, breg, creg;", file=f) + print("", file=f) + print(" COMMON16_GET_u3;", file=f) + print(" COMMON16_GET_breg;", file=f) + print(" COMMON16_GET_creg;", file=f) + print("", file=f) + print(" REG_16BIT_RANGE(breg);", file=f) + print(" REG_16BIT_RANGE(creg);", file=f) + print("", file=f) + print(" %s" % opexecute, file=f) + print(" %s" % opwrite, file=f) + print("", file=f) + print(" return m_pc + (2 >> 0);", file=f) + print("}", file=f) + print("", file=f) + print("", file=f) # xxx_S b <- b,c format opcodes def EmitGroup0f(f,funcname, opname, opexecute, opwrite): - print >>f, "ARCOMPACT_RETTYPE arcompact_device::arcompact_handle%s(OPS_16)"% funcname - print >>f, "{" - print >>f, " int breg, creg;" - print >>f, "" - print >>f, " COMMON16_GET_breg;" - print >>f, " COMMON16_GET_creg;" - print >>f, "" - print >>f, " REG_16BIT_RANGE(breg);" - print >>f, " REG_16BIT_RANGE(creg);" - print >>f, "" - print >>f, " %s" % opexecute - print >>f, " %s" % opwrite - print >>f, "" - print >>f, " return m_pc + (2 >> 0);" - print >>f, "}" - print >>f, "" - print >>f, "" + print("ARCOMPACT_RETTYPE arcompact_device::arcompact_handle%s(OPS_16)"% funcname, file=f) + print("{", file=f) + print(" int breg, creg;", file=f) + print("", file=f) + print(" COMMON16_GET_breg;", file=f) + print(" COMMON16_GET_creg;", file=f) + print("", file=f) + print(" REG_16BIT_RANGE(breg);", file=f) + print(" REG_16BIT_RANGE(creg);", file=f) + print("", file=f) + print(" %s" % opexecute, file=f) + print(" %s" % opwrite, file=f) + print("", file=f) + print(" return m_pc + (2 >> 0);", file=f) + print("}", file=f) + print("", file=f) + print("", file=f) # xxx_S b, b, u5 format opcodes def EmitGroup17(f,funcname, opname, opexecute): - print >>f, "ARCOMPACT_RETTYPE arcompact_device::arcompact_handle%s(OPS_16)" % funcname - print >>f, "{" - print >>f, " int breg, u;" - print >>f, " " - print >>f, " COMMON16_GET_breg;" - print >>f, " COMMON16_GET_u5;" - print >>f, " " - print >>f, " REG_16BIT_RANGE(breg);" - print >>f, " " - print >>f, " %s" % opexecute - print >>f, " " - print >>f, " return m_pc + (2 >> 0);" - print >>f, "}" - print >>f, "" - print >>f, "" + print("ARCOMPACT_RETTYPE arcompact_device::arcompact_handle%s(OPS_16)" % funcname, file=f) + print("{", file=f) + print(" int breg, u;", file=f) + print(" ", file=f) + print(" COMMON16_GET_breg;", file=f) + print(" COMMON16_GET_u5;", file=f) + print(" ", file=f) + print(" REG_16BIT_RANGE(breg);", file=f) + print(" ", file=f) + print(" %s" % opexecute, file=f) + print(" ", file=f) + print(" return m_pc + (2 >> 0);", file=f) + print("}", file=f) + print("", file=f) + print("", file=f) diff --git a/src/emu/cpu/h8/h8make.py b/src/emu/cpu/h8/h8make.py index 4cd435df373..929b5d14c4e 100644 --- a/src/emu/cpu/h8/h8make.py +++ b/src/emu/cpu/h8/h8make.py @@ -1,5 +1,7 @@ #!/usr/bin/python +from __future__ import print_function + USAGE = """ Usage: %s h8.lst <type> h8.inc (type = o/h/s20/s26) @@ -45,45 +47,45 @@ def has_eat(ins): return False def save_full_one(f, t, name, source): - print >>f, "void %s::%s_full()" % (t, name) - print >>f, "{" + print("void %s::%s_full()" % (t, name), file=f) + print("{", file=f) substate = 1 for line in source: if has_memory(line): - print >>f, "\tif(icount <= bcount) { inst_substate = %d; return; }" % substate - print >>f, line + print("\tif(icount <= bcount) { inst_substate = %d; return; }" % substate, file=f) + print(line, file=f) substate += 1 elif has_eat(line): - print >>f, "\tif(icount) icount = bcount; inst_substate = %d; return;" % substate + print("\tif(icount) icount = bcount; inst_substate = %d; return;" % substate, file=f) substate += 1 else: - print >>f, line - print >>f, "}" - print >>f + print(line, file=f) + print("}", file=f) + print("", file=f) def save_partial_one(f, t, name, source): - print >>f, "void %s::%s_partial()" % (t, name) - print >>f, "{" - print >>f, "switch(inst_substate) {" - print >>f, "case 0:" + print("void %s::%s_partial()" % (t, name), file=f) + print("{", file=f) + print("switch(inst_substate) {", file=f) + print("case 0:", file=f) substate = 1 for line in source: if has_memory(line): - print >>f, "\tif(icount <= bcount) { inst_substate = %d; return; }" % substate - print >>f, "case %d:;" % substate - print >>f, line + print("\tif(icount <= bcount) { inst_substate = %d; return; }" % substate, file=f) + print("case %d:;" % substate, file=f) + print(line, file=f) substate += 1 elif has_eat(line): - print >>f, "\tif(icount) icount = bcount; inst_substate = %d; return;" % substate - print >>f, "case %d:;" % substate + print("\tif(icount) icount = bcount; inst_substate = %d; return;" % substate, file=f) + print("case %d:;" % substate, file=f) substate += 1 else: - print >>f, line - print >>f, "\tbreak;" - print >>f, "}" - print >>f, "\tinst_substate = 0;" - print >>f, "}" - print >>f + print(line, file=f) + print("\tbreak;", file=f) + print("}", file=f) + print("\tinst_substate = 0;", file=f) + print("}", file=f) + print("", file=f) class Hash: def __init__(self, premask): @@ -185,7 +187,7 @@ class Opcode: else: flags = "%d" % size - print >>f, "\t{ %d, 0x%08x, 0x%08x, 0x%04x, 0x%04x, \"%s\", DASM_%s, DASM_%s, %s }, // %s" % ( slot, val, mask, val2, mask2, self.name, self.am1 if self.am1 != "-" else "none", self.am2 if self.am2 != "-" else "none", flags, "needed" if self.needed else "inherited") + print("\t{ %d, 0x%08x, 0x%08x, 0x%04x, 0x%04x, \"%s\", DASM_%s, DASM_%s, %s }, // %s" % ( slot, val, mask, val2, mask2, self.name, self.am1 if self.am1 != "-" else "none", self.am2 if self.am2 != "-" else "none", flags, "needed" if self.needed else "inherited"), file=f) class Special: def __init__(self, val, name, otype, dtype): @@ -244,7 +246,7 @@ class DispatchStep: return True def source(self): - start = self.pos / 2 + start = self.pos // 2 end = start + self.skip s = [] for i in range(start, end+1): @@ -345,13 +347,13 @@ class OpcodeList: h = self.get(d.id) def save_dasm(self, f, dname): - print >>f, "const %s::disasm_entry %s::disasm_entries[] = {" % (dname, dname) + print("const %s::disasm_entry %s::disasm_entries[] = {" % (dname, dname), file=f) for opc in self.opcode_info: if opc.enabled: opc.save_dasm(f) - print >>f, "\t{ 0, 0, 0, 0, 0, \"illegal\", 0, 0, 2 }," - print >>f, "};" - print >>f + print("\t{ 0, 0, 0, 0, 0, \"illegal\", 0, 0, 2 },", file=f) + print("};", file=f) + print("", file=f) def save_opcodes(self, f, t): for opc in self.opcode_info: @@ -370,24 +372,24 @@ class OpcodeList: save_partial_one(f, t, "dispatch_" + dsp.name, dsp.source()) def save_exec(self, f, t, dtype, v): - print >>f, "void %s::do_exec_%s()" % (t, v) - print >>f, "{" - print >>f, "\tswitch(inst_state >> 16) {" + print("void %s::do_exec_%s()" % (t, v), file=f) + print("{", file=f) + print("\tswitch(inst_state >> 16) {", file=f) for i in range(0, len(self.dispatch_info)+2): if i == 1: - print >>f, "\tcase 0x01: {" - print >>f, "\t\tswitch(inst_state & 0xffff) {" + print("\tcase 0x01: {", file=f) + print("\t\tswitch(inst_state & 0xffff) {", file=f) for sta in self.states_info: if sta.enabled: - print >>f, "\t\tcase 0x%02x: state_%s_%s(); break;" % (sta.val & 0xffff, sta.name, v) - print >>f, "\t\t}" - print >>f, "\t\tbreak;" - print >>f, "\t}" + print("\t\tcase 0x%02x: state_%s_%s(); break;" % (sta.val & 0xffff, sta.name, v), file=f) + print("\t\t}", file=f) + print("\t\tbreak;", file=f) + print("\t}", file=f) else: if i == 0 or self.dispatch_info[i-2].enabled: - print >>f, "\tcase 0x%02x: {" % i + print("\tcase 0x%02x: {" % i, file=f) h = self.get(i) - print >>f, "\t\tswitch((inst_state >> 8) & 0x%02x) {" % h.mask + print("\t\tswitch((inst_state >> 8) & 0x%02x) {" % h.mask, file=f) for val, h2 in sorted(h.d.items()): if h2.enabled: fmask = h2.premask | (h.mask ^ 0xff) @@ -398,16 +400,16 @@ class OpcodeList: s += 1 while s & fmask: s += s & fmask - print >>f, "\t\t%s{" % c + print("\t\t%s{" % c, file=f) if h2.mask == 0x00: n = h2.d[0] if n.is_dispatch(): - print >>f, "\t\t\tdispatch_%s_%s();" % (n.name, v) + print("\t\t\tdispatch_%s_%s();" % (n.name, v), file=f) else: - print >>f, "\t\t\t%s_%s();" % (n.function_name(), v) - print >>f, "\t\t\tbreak;" + print("\t\t\t%s_%s();" % (n.function_name(), v), file=f) + print("\t\t\tbreak;", file=f) else: - print >>f, "\t\t\tswitch(inst_state & 0x%02x) {" % h2.mask + print("\t\t\tswitch(inst_state & 0x%02x) {" % h2.mask, file=f) if i == 0: mpos = 1 else: @@ -427,23 +429,23 @@ class OpcodeList: while s & fmask: s += s & fmask if n.is_dispatch(): - print >>f, "\t\t\t%sdispatch_%s_%s(); break;" % (c, n.name, v) + print("\t\t\t%sdispatch_%s_%s(); break;" % (c, n.name, v), file=f) else: - print >>f, "\t\t\t%s%s_%s(); break;" % (c, n.function_name(), v) - print >>f, "\t\t\tdefault: illegal(); break;" - print >>f, "\t\t\t}" - print >>f, "\t\t\tbreak;" - print >>f, "\t\t}" - print >>f, "\t\tdefault: illegal(); break;" - print >>f, "\t\t}" - print >>f, "\t\tbreak;" - print >>f, "\t}" - print >>f, "\t}" - print >>f, "}" + print("\t\t\t%s%s_%s(); break;" % (c, n.function_name(), v), file=f) + print("\t\t\tdefault: illegal(); break;", file=f) + print("\t\t\t}", file=f) + print("\t\t\tbreak;", file=f) + print("\t\t}", file=f) + print("\t\tdefault: illegal(); break;", file=f) + print("\t\t}", file=f) + print("\t\tbreak;", file=f) + print("\t}", file=f) + print("\t}", file=f) + print("}", file=f) def main(argv): if len(argv) != 4: - print USAGE % argv[0] + print(USAGE % argv[0]) return 1 dtype = name_to_type(argv[2]) diff --git a/src/emu/cpu/m6502/m6502make.py b/src/emu/cpu/m6502/m6502make.py index 591d01268ca..4ac62e90ce9 100755 --- a/src/emu/cpu/m6502/m6502make.py +++ b/src/emu/cpu/m6502/m6502make.py @@ -1,5 +1,7 @@ #!/usr/bin/python +from __future__ import print_function + USAGE = """ Usage: %s device_name {opc.lst|-} disp.lst device.inc @@ -52,7 +54,7 @@ def load_disp(fname): def emit(f, text): """write string to file""" - print >>f, text, + print(text, file=f) FULL_PROLOG="""\ void %(device)s::%(opcode)s_full() @@ -252,7 +254,7 @@ def main(argv): if len(argv) != 5: - print USAGE % argv[0] + print(USAGE % argv[0]) return 1 device_name = argv[1] diff --git a/src/emu/cpu/m68000/m68kfpu.inc b/src/emu/cpu/m68000/m68kfpu.inc index 217a418a006..32d0179e6c2 100644 --- a/src/emu/cpu/m68000/m68kfpu.inc +++ b/src/emu/cpu/m68000/m68kfpu.inc @@ -988,6 +988,12 @@ static void WRITE_EA_32(m68000_base_device *m68k, int ea, UINT32 data) { switch (reg) { + case 0: // (xxx).W + { + UINT32 ea = OPER_I_16(m68k); + m68ki_write_32(m68k, ea, data); + break; + } case 1: // (xxx).L { UINT32 d1 = OPER_I_16(m68k); diff --git a/src/emu/cpu/mcs96/mcs96make.py b/src/emu/cpu/mcs96/mcs96make.py index 8381e63dc2f..72d8f36cfa6 100644 --- a/src/emu/cpu/mcs96/mcs96make.py +++ b/src/emu/cpu/mcs96/mcs96make.py @@ -1,5 +1,7 @@ #!/usr/bin/python +from __future__ import print_function + USAGE = """ Usage: %s mcs96ops.lst mcs96.inc @@ -7,12 +9,12 @@ Usage: import sys def save_full_one(f, t, name, source): - print >>f, "void %s_device::%s_full()" % (t, name) - print >>f, "{" + print("void %s_device::%s_full()" % (t, name), file=f) + print("{", file=f) for line in source: - print >>f, line - print >>f, "}" - print >>f + print(line, file=f) + print("}", file=f) + print("", file=f) class Opcode: def __init__(self, rng, name, amode, is_196, ea): @@ -113,7 +115,7 @@ class OpcodeList: self.opcode_per_id[i] = inf def save_dasm(self, f, t): - print >>f, "const %s_device::disasm_entry %s_device::disasm_entries[0x100] = {" % (t, t) + print("const %s_device::disasm_entry %s_device::disasm_entries[0x100] = {" % (t, t), file=f) for i in range(0, 0x100): if i in self.opcode_per_id: opc = self.opcode_per_id[i] @@ -126,11 +128,11 @@ class OpcodeList: flags = "DASMFLAG_STEP_OUT" else: flags = "0" - print >>f, "\t{ \"%s\", %s, DASM_%s, %s }," % (opc.name, alt, opc.amode, flags) + print("\t{ \"%s\", %s, DASM_%s, %s }," % (opc.name, alt, opc.amode, flags), file=f) else: - print >>f, "\t{ \"???\", NULL, DASM_none, 0 }," - print >>f, "};" - print >>f + print("\t{ \"???\", NULL, DASM_none, 0 },", file=f) + print("};", file=f) + print("", file=f) def save_opcodes(self, f, t): pf = "" @@ -146,9 +148,9 @@ class OpcodeList: save_full_one(f, t, "fetch_noirq", self.fetch_noirq.source) def save_exec(self, f, t): - print >>f, "void %s_device::do_exec_full()" % t - print >>f, "{" - print >>f, "\tswitch(inst_state) {" + print("void %s_device::do_exec_full()" % t, file=f) + print("{", file=f) + print("\tswitch(inst_state) {", file=f) for i in range(0x000, 0x200): opc = None if i >= 0x100 and i-0x100+0xfe00 in self.opcode_per_id: @@ -159,15 +161,15 @@ class OpcodeList: nm = opc.name + "_" + opc.amode if opc.is_196: nm += "_196" - print >>f, "\tcase 0x%03x: %s_full(); break;" % (i, nm) - print >>f, "\tcase 0x200: fetch_full(); break;" - print >>f, "\tcase 0x201: fetch_noirq_full(); break;" - print >>f, "\t}" - print >>f, "}" + print("\tcase 0x%03x: %s_full(); break;" % (i, nm), file=f) + print("\tcase 0x200: fetch_full(); break;", file=f) + print("\tcase 0x201: fetch_noirq_full(); break;", file=f) + print("\t}", file=f) + print("}", file=f) def main(argv): if len(argv) != 4: - print USAGE % argv[0] + print(USAGE % argv[0]) return 1 t = argv[1] diff --git a/src/emu/cpu/pdp8/pdp8.c b/src/emu/cpu/pdp8/pdp8.c new file mode 100644 index 00000000000..dd2fd6fc6b3 --- /dev/null +++ b/src/emu/cpu/pdp8/pdp8.c @@ -0,0 +1,249 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +/* + First-gen DEC PDP-8 emulator skeleton + + Written by MooglyGuy +*/ + +#include "emu.h" +#include "debugger.h" +#include "pdp8.h" + +CPU_DISASSEMBLE( pdp8 ); + +#define OP ((op >> 011) & 07) + +#define MR_IND ((op >> 010) & 01) +#define MR_PAGE ((op >> 07) & 01) +#define MR_ADDR (op & 0177) + +#define IOT_DEVICE ((op >> 03) & 077) +#define IOT_IOP1 (op & 01) +#define IOT_IOP2 ((op >> 01) & 01) +#define IOT_IOP4 ((op >> 02) & 01) + +#define OPR_GROUP ((op >> 010) & 01) +#define OPR_CLA ((op >> 07) & 01) +#define OPR_CLL ((op >> 06) & 01) +#define OPR_CMA ((op >> 05) & 01) +#define OPR_CML ((op >> 04) & 01) +#define OPR_ROR ((op >> 03) & 01) +#define OPR_ROL ((op >> 02) & 01) +#define OPR_ROT2 ((op >> 01) & 01) +#define OPR_IAC (op & 01) + +#define OPR_SMA OPR_CLL +#define OPR_SZA OPR_CMA +#define OPR_SNL OPR_CML +#define OPR_REVSKIP OPR_ROR +#define OPR_OSR OPR_ROL +#define OPR_HLT OPR_ROT2 + +#define OPR_GROUP_MASK 0401 +#define OPR_GROUP1_VAL 0000 +#define OPR_GROUP2_VAL 0400 + +const device_type PDP8CPU = &device_creator<pdp8_device>; + +//------------------------------------------------- +// pdp8_device - constructor +//------------------------------------------------- + +pdp8_device::pdp8_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : cpu_device(mconfig, PDP8CPU, "PDP8CPU", tag, owner, clock, "pdp8_cpu", __FILE__), + m_program_config("program", ENDIANNESS_BIG, 12, 12), + m_pc(0), + m_ac(0), + m_mb(0), + m_ma(0), + m_sr(0), + m_l(0), + m_ir(0), + m_halt(true), + m_icount(0) +{ + // Allocate & setup +} + + +void pdp8_device::device_start() +{ + m_program = &space(AS_PROGRAM); + + // register our state for the debugger + std::string tempstr; + state_add(STATE_GENPC, "GENPC", m_pc).noshow(); + state_add(STATE_GENFLAGS, "GENFLAGS", m_l).callimport().callexport().formatstr("%1s").noshow(); + state_add(PDP8_PC, "PC", m_pc).mask(0xfff); + state_add(PDP8_AC, "AC", m_ac).mask(0xfff); + state_add(PDP8_MB, "MB", m_mb).mask(0xfff); + state_add(PDP8_MA, "MA", m_ma).mask(0xfff); + state_add(PDP8_SR, "SR", m_sr).mask(0xfff); + state_add(PDP8_L, "L", m_l).mask(0xf); + state_add(PDP8_IR, "IR", m_ir).mask(0xff); + state_add(PDP8_HALT, "HLT", m_halt).mask(0xf); + + // setup regtable + save_item(NAME(m_pc)); + save_item(NAME(m_ac)); + save_item(NAME(m_mb)); + save_item(NAME(m_ma)); + save_item(NAME(m_sr)); + save_item(NAME(m_l)); + save_item(NAME(m_ir)); + save_item(NAME(m_halt)); + + // set our instruction counter + m_icountptr = &m_icount; +} + +void pdp8_device::device_stop() +{ +} + +void pdp8_device::device_reset() +{ + m_pc = 0; + m_ac = 0; + m_mb = 0; + m_ma = 0; + m_sr = 0; + m_l = 0; + m_ir = 0; + m_halt = true; +} + + +//------------------------------------------------- +// memory_space_config - return the configuration +// of the specified address space, or NULL if +// the space doesn't exist +//------------------------------------------------- + +const address_space_config *pdp8_device::memory_space_config(address_spacenum spacenum) const +{ + if (spacenum == AS_PROGRAM) + { + return &m_program_config; + } + return NULL; +} + + +//------------------------------------------------- +// state_string_export - export state as a string +// for the debugger +//------------------------------------------------- + +void pdp8_device::state_string_export(const device_state_entry &entry, std::string &str) +{ + switch (entry.index()) + { + case STATE_GENFLAGS: + strprintf(str, "%c", m_halt ? 'H' : '.'); + break; + } +} + + +//------------------------------------------------- +// disasm_min_opcode_bytes - return the length +// of the shortest instruction, in bytes +//------------------------------------------------- + +UINT32 pdp8_device::disasm_min_opcode_bytes() const +{ + return 2; +} + + +//------------------------------------------------- +// disasm_max_opcode_bytes - return the length +// of the longest instruction, in bytes +//------------------------------------------------- + +UINT32 pdp8_device::disasm_max_opcode_bytes() const +{ + return 2; +} + + +//------------------------------------------------- +// disasm_disassemble - call the disassembly +// helper function +//------------------------------------------------- + +offs_t pdp8_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) +{ + extern CPU_DISASSEMBLE( pdp8 ); + return CPU_DISASSEMBLE_NAME(pdp8)(this, buffer, pc, oprom, opram, options); +} + + +//************************************************************************** +// CORE EXECUTION LOOP +//************************************************************************** + +//------------------------------------------------- +// execute_min_cycles - return minimum number of +// cycles it takes for one instruction to execute +//------------------------------------------------- + +UINT32 pdp8_device::execute_min_cycles() const +{ + return 1; // TODO +} + + +//------------------------------------------------- +// execute_max_cycles - return maximum number of +// cycles it takes for one instruction to execute +//------------------------------------------------- + +UINT32 pdp8_device::execute_max_cycles() const +{ + return 3; // TODO +} + + +//------------------------------------------------- +// execute_input_lines - return the number of +// input/interrupt lines +//------------------------------------------------- + +UINT32 pdp8_device::execute_input_lines() const +{ + return 0; // TODO +} + + +//------------------------------------------------- +// execute_set_input - set the state of an input +// line during execution +//------------------------------------------------- + +void pdp8_device::execute_set_input(int inputnum, int state) +{ + // TODO +} + + +//------------------------------------------------- +// execute_run - execute a timeslice's worth of +// opcodes +//------------------------------------------------- + +void pdp8_device::execute_run() +{ + while (m_icount > 0) + { + m_pc &= 07777; + + debugger_instruction_hook(this, m_pc); + + UINT16 op = m_program->read_word(m_pc); + + --m_icount; + } +} diff --git a/src/emu/cpu/pdp8/pdp8.h b/src/emu/cpu/pdp8/pdp8.h new file mode 100644 index 00000000000..58332770dad --- /dev/null +++ b/src/emu/cpu/pdp8/pdp8.h @@ -0,0 +1,113 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +/* + First-gen DEC PDP-8 CPU emulator + + Written by MooglyGuy +*/ + +#pragma once + +#ifndef __PDP8_H__ +#define __PDP8_H__ + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> pdp8_device + +// Used by core CPU interface +class pdp8_device : public cpu_device +{ +public: + // construction/destruction + pdp8_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + virtual void device_stop(); + + // device_execute_interface overrides + virtual UINT32 execute_min_cycles() const; + virtual UINT32 execute_max_cycles() const; + virtual UINT32 execute_input_lines() const; + virtual void execute_run(); + virtual void execute_set_input(int inputnum, int state); + + // device_memory_interface overrides + virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const; + + // device_disasm_interface overrides + virtual UINT32 disasm_min_opcode_bytes() const; + virtual UINT32 disasm_max_opcode_bytes() const; + virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options); + + // device_state_interface overrides + virtual void state_string_export(const device_state_entry &entry, std::string &str); + + // address spaces + const address_space_config m_program_config; + + enum state + { + FETCH, + DEFER, + EXECUTE, + WORD_COUNT, + CURRENT_ADDR, + BREAK + } + + enum opcode + { + AND = 0, + TAD, + ISZ, + DCA, + JMS, + JMP, + IOT, + OPR + } +private: + // CPU registers + UINT16 m_pc; + UINT16 m_ac; + UINT16 m_mb; + UINT16 m_ma; + UINT16 m_sr; + UINT8 m_l; + UINT8 m_ir; + bool m_halt; + + // other internal states + int m_icount; + + // address spaces + address_space *m_program; +}; + +// device type definition +extern const device_type PDP8CPU; + +/*************************************************************************** + REGISTER ENUMERATION +***************************************************************************/ + +enum +{ + PDP8_PC = 1, + PDP8_AC, + PDP8_MB, + PDP8_MA, + PDP8_SR, + PDP8_L, + PDP8_IR, + PDP8_HALT +}; + +CPU_DISASSEMBLE( pdp8 ); + +#endif /* __PDP8_H__ */ diff --git a/src/emu/cpu/pdp8/pdp8dasm.c b/src/emu/cpu/pdp8/pdp8dasm.c new file mode 100644 index 00000000000..18a7e3e769b --- /dev/null +++ b/src/emu/cpu/pdp8/pdp8dasm.c @@ -0,0 +1,174 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +/* + First-gen DEC PDP-8 disassembler + + Written by MooglyGuy +*/ + +#include "emu.h" + +static char *output; + +offs_t pdp8_dasm_one(char *buffer, offs_t pc, UINT16 op) +{ + UINT8 opcode = (op >> 011) & 07; + UINT16 current_page = pc & 07600; + UINT16 zero_addr = op & 0177; + UINT16 current_addr = current_page | zero_addr; + bool indirect = (op & 0400) ? true : false; + bool zero_page = (op & 0200) ? false : true; + + output = buffer; + + switch (opcode) + { + case 0: + output += sprintf(buffer, "AND %c %05o", indirect ? 'I' : ' ', zero_page ? zero_addr : current_addr); + break; + case 1: + output += sprintf(buffer, "TAD %c %05o", indirect ? 'I' : ' ', zero_page ? zero_addr : current_addr); + break; + case 2: + output += sprintf(buffer, "ISZ %c %05o", indirect ? 'I' : ' ', zero_page ? zero_addr : current_addr); + break; + case 3: + output += sprintf(buffer, "DCA %c %05o", indirect ? 'I' : ' ', zero_page ? zero_addr : current_addr); + break; + case 4: + output += sprintf(buffer, "JMS %c %05o", indirect ? 'I' : ' ', zero_page ? zero_addr : current_addr); + break; + case 5: + output += sprintf(buffer, "JMP %c %05o", indirect ? 'I' : ' ', zero_page ? zero_addr : current_addr); + break; + case 6: + output += sprintf(buffer, "IOT %03o %01o", (op >> 03) & 077, op & 07); + break; + case 7: + { + bool group2 = ((op & 0401) == 0400); + if (!group2) + { + if (!(op & 0377)) + { + output += sprintf(buffer, "NOP "); + } + else + { + if (op & 0200) + { + output += sprintf(buffer, "CLA "); + } + if (op & 0100) + { + output += sprintf(buffer, "CLL "); + } + if (op & 040) + { + output += sprintf(buffer, "CMA "); + } + if (op & 020) + { + output += sprintf(buffer, "CML "); + } + if (op & 01) + { + output += sprintf(buffer, "IAC "); + } + if (op & 010) + { + if (op & 02) + { + output += sprintf(buffer, "RTR "); + } + else + { + output += sprintf(buffer, "RAR "); + } + } + if (op & 04) + { + if (op & 02) + { + output += sprintf(buffer, "RTL "); + } + else + { + output += sprintf(buffer, "RAL "); + } + } + } + } + else + { + if (!(op & 0377)) + { + output += sprintf(buffer, "NOP "); + } + else + { + if (op & 010) + { + if (!(op & 0160)) + { + output += sprintf(buffer, "SKP "); + } + else + { + if (op & 0100) + { + output += sprintf(buffer, "SPA "); + } + if (op & 040) + { + output += sprintf(buffer, "SNA "); + } + if (op & 020) + { + output += sprintf(buffer, "SZL "); + } + } + } + else + { + if (op & 0100) + { + output += sprintf(buffer, "SMA "); + } + if (op & 040) + { + output += sprintf(buffer, "SZA "); + } + if (op & 020) + { + output += sprintf(buffer, "SNL "); + } + } + if (op & 0200) + { + output += sprintf(buffer, "CLA "); + } + if (op & 04) + { + output += sprintf(buffer, "OSR "); + } + if (op & 02) + { + output += sprintf(buffer, "HLT "); + } + } + } + } + } + + return 2 | DASMFLAG_SUPPORTED; +} + +/*****************************************************************************/ + +CPU_DISASSEMBLE( pdp8 ) +{ + UINT16 op = (*(UINT8 *)(opram + 0) << 8) | + (*(UINT8 *)(opram + 1) << 0); + return pdp8_dasm_one(buffer, pc, op); +} diff --git a/src/emu/cpu/powerpc/ppccom.c b/src/emu/cpu/powerpc/ppccom.c index 6f91b4a96e8..a98872029ec 100644 --- a/src/emu/cpu/powerpc/ppccom.c +++ b/src/emu/cpu/powerpc/ppccom.c @@ -2650,7 +2650,7 @@ void ppc_device::ppc4xx_spu_timer_reset() attotime charperiod = clockperiod * (divisor * 16 * bpc); m_spu.timer->adjust(charperiod, 0, charperiod); if (PRINTF_SPU) - printf("ppc4xx_spu_timer_reset: baud rate = %.0f\n", ATTOSECONDS_TO_HZ(charperiod.attoseconds) * bpc); + printf("ppc4xx_spu_timer_reset: baud rate = %.0f\n", ATTOSECONDS_TO_HZ(charperiod.attoseconds()) * bpc); } /* otherwise, disable the timer */ diff --git a/src/emu/cpu/ucom4/ucom4.c b/src/emu/cpu/ucom4/ucom4.c index 569047e9bf0..1d3da737b77 100644 --- a/src/emu/cpu/ucom4/ucom4.c +++ b/src/emu/cpu/ucom4/ucom4.c @@ -26,6 +26,7 @@ // uCOM-43 products: 2000x8 ROM, RAM size custom, supports full instruction set const device_type NEC_D553 = &device_creator<upd553_cpu_device>; // 42-pin PMOS, 35 pins for I/O, Open Drain output, 96x4 RAM +const device_type NEC_D557L = &device_creator<upd557l_cpu_device>; // 28-pin PMOS, 21 pins for I/O, Open Drain output, 96x4 RAM const device_type NEC_D650 = &device_creator<upd650_cpu_device>; // 42-pin CMOS, 35 pins for I/O, push-pull output, 96x4 RAM // uCOM-44 products: 1000x8 ROM, 64x4 RAM, does not support external interrupt @@ -61,6 +62,10 @@ upd553_cpu_device::upd553_cpu_device(const machine_config &mconfig, const char * : ucom4_cpu_device(mconfig, NEC_D553, "uPD553", tag, owner, clock, NEC_UCOM43, 3 /* stack levels */, 11 /* prg width */, ADDRESS_MAP_NAME(program_2k), 7 /* data width */, ADDRESS_MAP_NAME(data_96x4), "upd553", __FILE__) { } +upd557l_cpu_device::upd557l_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : ucom4_cpu_device(mconfig, NEC_D557L, "uPD557L", tag, owner, clock, NEC_UCOM43, 3, 11, ADDRESS_MAP_NAME(program_2k), 7, ADDRESS_MAP_NAME(data_96x4), "upd557l", __FILE__) +{ } + upd650_cpu_device::upd650_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : ucom4_cpu_device(mconfig, NEC_D650, "uPD650", tag, owner, clock, NEC_UCOM43, 3, 11, ADDRESS_MAP_NAME(program_2k), 7, ADDRESS_MAP_NAME(data_96x4), "upd650", __FILE__) { } @@ -208,6 +213,90 @@ void ucom4_cpu_device::device_reset() //------------------------------------------------- +// i/o handling +//------------------------------------------------- + +// default: +// A,B are inputs, C,D are input/output, E,F,G,H,I are output + +UINT8 ucom4_cpu_device::input_r(int index) +{ + index &= 0xf; + UINT8 inp = 0; + + switch (index) + { + case NEC_UCOM4_PORTA: inp = m_read_a(index, 0xff); break; + case NEC_UCOM4_PORTB: inp = m_read_b(index, 0xff); break; + case NEC_UCOM4_PORTC: inp = m_read_c(index, 0xff) | m_port_out[index]; break; + case NEC_UCOM4_PORTD: inp = m_read_d(index, 0xff) | m_port_out[index]; break; + + default: + logerror("%s read from unknown port %c at $%03X\n", tag(), 'A' + index, m_prev_pc); + break; + } + + return inp & 0xf; +} + +void ucom4_cpu_device::output_w(int index, UINT8 data) +{ + index &= 0xf; + data &= 0xf; + + switch (index) + { + case NEC_UCOM4_PORTC: m_write_c(index, data, 0xff); break; + case NEC_UCOM4_PORTD: m_write_d(index, data, 0xff); break; + case NEC_UCOM4_PORTE: m_write_e(index, data, 0xff); break; + case NEC_UCOM4_PORTF: m_write_f(index, data, 0xff); break; + case NEC_UCOM4_PORTG: m_write_g(index, data, 0xff); break; + case NEC_UCOM4_PORTH: m_write_h(index, data, 0xff); break; + case NEC_UCOM4_PORTI: m_write_i(index, data & 7, 0xff); break; + + default: + logerror("%s write to unknown port %c = $%X at $%03X\n", tag(), 'A' + index, data, m_prev_pc); + break; + } + + m_port_out[index] = data; +} + +// uPD557L: +// ports B,H,I are stripped, port G is reduced to 1 pin + +UINT8 upd557l_cpu_device::input_r(int index) +{ + index &= 0xf; + + if (index == NEC_UCOM4_PORTB) + logerror("%s read from unknown port %c at $%03X\n", tag(), 'A' + index, m_prev_pc); + else + return ucom4_cpu_device::input_r(index); + + return 0; +} + +void upd557l_cpu_device::output_w(int index, UINT8 data) +{ + index &= 0xf; + data &= 0xf; + + if (index == NEC_UCOM4_PORTH || index == NEC_UCOM4_PORTI) + logerror("%s write to unknown port %c = $%X at $%03X\n", tag(), 'A' + index, data, m_prev_pc); + else + { + // only G0 for port G + if (index == NEC_UCOM4_PORTG) + data &= 1; + + ucom4_cpu_device::output_w(index, data); + } +} + + + +//------------------------------------------------- // interrupt //------------------------------------------------- diff --git a/src/emu/cpu/ucom4/ucom4.h b/src/emu/cpu/ucom4/ucom4.h index 47305a4638a..9b0651b6703 100644 --- a/src/emu/cpu/ucom4/ucom4.h +++ b/src/emu/cpu/ucom4/ucom4.h @@ -207,6 +207,9 @@ protected: devcb_write8 m_write_h; devcb_write8 m_write_i; + virtual UINT8 input_r(int index); + virtual void output_w(int index, UINT8 data); + // misc internal helpers void increment_pc(); void fetch_arg(); @@ -216,8 +219,6 @@ protected: void ram_w(UINT8 data); void pop_stack(); void push_stack(); - virtual UINT8 input_r(int index); - virtual void output_w(int index, UINT8 data); bool check_op_43(); TIMER_CALLBACK_MEMBER( simple_timer_cb ); @@ -318,13 +319,21 @@ public: }; -class upd650_cpu_device : public ucom4_cpu_device +class upd557l_cpu_device : public ucom4_cpu_device { public: - upd650_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + upd557l_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); protected: virtual UINT8 input_r(int index); + virtual void output_w(int index, UINT8 data); +}; + + +class upd650_cpu_device : public ucom4_cpu_device +{ +public: + upd650_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); }; @@ -337,6 +346,7 @@ public: extern const device_type NEC_D553; +extern const device_type NEC_D557L; extern const device_type NEC_D650; extern const device_type NEC_D552; diff --git a/src/emu/cpu/ucom4/ucom4op.c b/src/emu/cpu/ucom4/ucom4op.c index d208fcaf80f..a9c5c0fe892 100644 --- a/src/emu/cpu/ucom4/ucom4op.c +++ b/src/emu/cpu/ucom4/ucom4op.c @@ -34,57 +34,9 @@ void ucom4_cpu_device::push_stack() m_stack[0] = m_pc; } -UINT8 ucom4_cpu_device::input_r(int index) -{ - index &= 0xf; - UINT8 inp = 0xf; - - switch (index) - { - case NEC_UCOM4_PORTA: inp = m_read_a(index, 0xff); break; - case NEC_UCOM4_PORTB: inp = m_read_b(index, 0xff); break; - case NEC_UCOM4_PORTC: inp = m_read_c(index, 0xff) | m_port_out[index]; break; - case NEC_UCOM4_PORTD: inp = m_read_d(index, 0xff) | m_port_out[index]; break; - default: - logerror("%s read from unknown port %c at $%03X\n", tag(), 'A' + index, m_prev_pc); - break; - } - return inp & 0xf; -} - -UINT8 upd650_cpu_device::input_r(int index) -{ - // bidirectional ports are 'push-pull', meaning it will output 0 when it's read - if ((index & 0xf) == NEC_UCOM4_PORTC || (index & 0xf) == NEC_UCOM4_PORTD) - output_w(index, 0); - - return ucom4_cpu_device::input_r(index); -} - -void ucom4_cpu_device::output_w(int index, UINT8 data) -{ - index &= 0xf; - data &= 0xf; - - switch (index) - { - case NEC_UCOM4_PORTC: m_write_c(index, data, 0xff); break; - case NEC_UCOM4_PORTD: m_write_d(index, data, 0xff); break; - case NEC_UCOM4_PORTE: m_write_e(index, data, 0xff); break; - case NEC_UCOM4_PORTF: m_write_f(index, data, 0xff); break; - case NEC_UCOM4_PORTG: m_write_g(index, data, 0xff); break; - case NEC_UCOM4_PORTH: m_write_h(index, data, 0xff); break; - case NEC_UCOM4_PORTI: m_write_i(index, data & 7, 0xff); break; - - default: - logerror("%s write to unknown port %c = $%X at $%03X\n", tag(), 'A' + index, data & 0xf, m_prev_pc); - break; - } - - m_port_out[index] = data; -} +// basic instruction set void ucom4_cpu_device::op_illegal() { @@ -92,9 +44,6 @@ void ucom4_cpu_device::op_illegal() } - -// basic instruction set - // Load void ucom4_cpu_device::op_li() diff --git a/src/emu/cpu/v810/v810.c b/src/emu/cpu/v810/v810.c index 9e6db000949..fa41ce71986 100644 --- a/src/emu/cpu/v810/v810.c +++ b/src/emu/cpu/v810/v810.c @@ -636,7 +636,7 @@ UINT32 v810_device::opRETI(UINT32 op) UINT32 v810_device::opHALT(UINT32 op) { - printf("V810: HALT @ %X",PC-2); + printf("V810: HALT @ %X\n",PC-2); return clkIF; } diff --git a/src/emu/device.c b/src/emu/device.c index 6e4385b510b..2fd68e6ed8e 100644 --- a/src/emu/device.c +++ b/src/emu/device.c @@ -333,7 +333,7 @@ attotime device_t::clocks_to_attotime(UINT64 numclocks) const UINT64 device_t::attotime_to_clocks(const attotime &duration) const { - return mulu_32x32(duration.seconds, m_clock) + (UINT64)duration.attoseconds / (UINT64)m_attoseconds_per_clock; + return mulu_32x32(duration.seconds(), m_clock) + (UINT64)duration.attoseconds() / (UINT64)m_attoseconds_per_clock; } diff --git a/src/emu/emuopts.c b/src/emu/emuopts.c index fa7e48f934d..ad955994899 100644 --- a/src/emu/emuopts.c +++ b/src/emu/emuopts.c @@ -202,6 +202,10 @@ const options_entry emu_options::s_option_entries[] = emu_options::emu_options() : core_options() +, m_coin_impulse(0) +, m_joystick_contradictory(false) +, m_sleep(true) +, m_refresh_speed(false) { add_entries(emu_options::s_option_entries); } @@ -380,6 +384,8 @@ bool emu_options::parse_slot_devices(int argc, char *argv[], std::string &error_ result = core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string); } while (num != options_count()); + update_cached_options(); + return result; } @@ -393,7 +399,9 @@ bool emu_options::parse_command_line(int argc, char *argv[], std::string &error_ { // parse as normal core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string); - return parse_slot_devices(argc, argv, error_string, NULL, NULL); + bool result = parse_slot_devices(argc, argv, error_string, NULL, NULL); + update_cached_options(); + return result; } @@ -468,6 +476,8 @@ void emu_options::parse_standard_inis(std::string &error_string) // Re-evaluate slot options after loading ini files update_slot_options(); + + update_cached_options(); } @@ -570,3 +580,19 @@ const char *emu_options::sub_value(std::string &buffer, const char *name, const buffer.clear(); return buffer.c_str(); } + + +//------------------------------------------------- +// update_cached_options - to prevent tagmap +// lookups keep copies of frequently requested +// options in member variables. +//------------------------------------------------- + +void emu_options::update_cached_options() +{ + m_coin_impulse = int_value(OPTION_COIN_IMPULSE); + m_joystick_contradictory = bool_value(OPTION_JOYSTICK_CONTRADICTORY); + m_sleep = bool_value(OPTION_SLEEP); + m_refresh_speed = bool_value(OPTION_REFRESHSPEED); +} + diff --git a/src/emu/emuopts.h b/src/emu/emuopts.h index 855e8eb19af..45a4dab160f 100644 --- a/src/emu/emuopts.h +++ b/src/emu/emuopts.h @@ -266,9 +266,9 @@ public: int frameskip() const { return int_value(OPTION_FRAMESKIP); } int seconds_to_run() const { return int_value(OPTION_SECONDS_TO_RUN); } bool throttle() const { return bool_value(OPTION_THROTTLE); } - bool sleep() const { return bool_value(OPTION_SLEEP); } + bool sleep() const { return m_sleep; } float speed() const { return float_value(OPTION_SPEED); } - bool refresh_speed() const { return bool_value(OPTION_REFRESHSPEED); } + bool refresh_speed() const { return m_refresh_speed; } // core rotation options bool rotate() const { return bool_value(OPTION_ROTATE); } @@ -327,8 +327,8 @@ public: bool ui_active() const { return bool_value(OPTION_UI_ACTIVE); } bool offscreen_reload() const { return bool_value(OPTION_OFFSCREEN_RELOAD); } bool natural_keyboard() const { return bool_value(OPTION_NATURAL_KEYBOARD); } - bool joystick_contradictory() const { return bool_value(OPTION_JOYSTICK_CONTRADICTORY); } - int coin_impulse() const { return int_value(OPTION_COIN_IMPULSE); } + bool joystick_contradictory() const { return m_joystick_contradictory; } + int coin_impulse() const { return m_coin_impulse; } // core debugging options bool log() const { return bool_value(OPTION_LOG); } @@ -382,7 +382,16 @@ private: // INI parsing helper bool parse_one_ini(const char *basename, int priority, std::string *error_string = NULL); + // cache frequently used options in members + void update_cached_options(); + static const options_entry s_option_entries[]; + + // cached options + int m_coin_impulse; + bool m_joystick_contradictory; + bool m_sleep; + bool m_refresh_speed; }; diff --git a/src/emu/emupal.c b/src/emu/emupal.c index ff71fb29a68..b1bda17bc98 100644 --- a/src/emu/emupal.c +++ b/src/emu/emupal.c @@ -966,16 +966,6 @@ void palette_device::palette_init_RRRRRGGGGGGBBBBB(palette_device &palette) palette.set_pen_color(i, rgbexpand<5,6,5>(i, 11, 5, 0)); } - -rgb_t raw_to_rgb_converter::BBGGRRII_decoder(UINT32 raw) -{ - UINT8 i = raw & 3; - UINT8 r = pal4bit(((raw >> 0) & 0x0c) | i); - UINT8 g = pal4bit(((raw >> 2) & 0x0c) | i); - UINT8 b = pal4bit(((raw >> 4) & 0x0c) | i); - return rgb_t(r, g, b); -} - rgb_t raw_to_rgb_converter::IRRRRRGGGGGBBBBB_decoder(UINT32 raw) { UINT8 i = (raw >> 15) & 1; diff --git a/src/emu/emupal.h b/src/emu/emupal.h index abf7720757a..1b6bfb296a5 100644 --- a/src/emu/emupal.h +++ b/src/emu/emupal.h @@ -119,8 +119,14 @@ #define PALETTE_FORMAT_BBGGGRRR raw_to_rgb_converter(1, &raw_to_rgb_converter::standard_rgb_decoder<3,3,2, 0,3,6>) #define PALETTE_FORMAT_RRRGGGBB raw_to_rgb_converter(1, &raw_to_rgb_converter::standard_rgb_decoder<3,3,2, 5,2,0>) -// standard 2-2-2-2 formats -#define PALETTE_FORMAT_BBGGRRII raw_to_rgb_converter(1, &raw_to_rgb_converter::BBGGRRII_decoder) +// data-inverted 3-3-2 formats +#define PALETTE_FORMAT_BBGGGRRR_inverted raw_to_rgb_converter(1, &raw_to_rgb_converter::inverted_rgb_decoder<3,3,2, 0,3,6>) +#define PALETTE_FORMAT_RRRGGGBB_inverted raw_to_rgb_converter(1, &raw_to_rgb_converter::inverted_rgb_decoder<3,3,2, 5,2,0>) + +// standard 3-3-3 formats +#define PALETTE_FORMAT_xxxxxxxBBBGGGRRR raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_rgb_decoder<3,3,3, 0,3,6>) +#define PALETTE_FORMAT_xxxxxxxRRRBBBGGG raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_rgb_decoder<3,3,3, 6,0,3>) +#define PALETTE_FORMAT_xxxxxxxRRRGGGBBB raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_rgb_decoder<3,3,3, 6,3,0>) // standard 4-4-4 formats #define PALETTE_FORMAT_xxxxBBBBGGGGRRRR raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_rgb_decoder<4,4,4, 0,4,8>) @@ -140,12 +146,16 @@ #define PALETTE_FORMAT_xRRRRRGGGGGBBBBB raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_rgb_decoder<5,5,5, 10,5,0>) #define PALETTE_FORMAT_xGGGGGRRRRRBBBBB raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_rgb_decoder<5,5,5, 5,10,0>) #define PALETTE_FORMAT_xGGGGGBBBBBRRRRR raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_rgb_decoder<5,5,5, 0,10,5>) -#define PALETTE_FORMAT_RRRRRGGGGGBBBBBx raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_rgb_decoder<5,5,5, 11,6,1>) +#define PALETTE_FORMAT_BBBBBRRRRRGGGGGx raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_rgb_decoder<5,5,5, 6,1,11>) #define PALETTE_FORMAT_GGGGGRRRRRBBBBBx raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_rgb_decoder<5,5,5, 6,11,1>) +#define PALETTE_FORMAT_RRRRRGGGGGBBBBBx raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_rgb_decoder<5,5,5, 11,6,1>) #define PALETTE_FORMAT_RRRRGGGGBBBBRGBx raw_to_rgb_converter(2, &raw_to_rgb_converter::RRRRGGGGBBBBRGBx_decoder) #define PALETTE_FORMAT_xRGBRRRRGGGGBBBB_bit0 raw_to_rgb_converter(2, &raw_to_rgb_converter::xRGBRRRRGGGGBBBB_bit0_decoder) #define PALETTE_FORMAT_xRGBRRRRGGGGBBBB_bit4 raw_to_rgb_converter(2, &raw_to_rgb_converter::xRGBRRRRGGGGBBBB_bit4_decoder) +// data-inverted 5-5-5 formats +#define PALETTE_FORMAT_xRRRRRBBBBBGGGGG_inverted raw_to_rgb_converter(2, &raw_to_rgb_converter::inverted_rgb_decoder<5,5,5, 10,0,5>) + // standard 5-6-5 formats #define PALETTE_FORMAT_RRRRRGGGGGGBBBBB raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_rgb_decoder<5,6,5, 11,5,0>) #define PALETTE_FORMAT_BBBBBGGGGGGRRRRR raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_rgb_decoder<5,6,5, 0,5,11>) @@ -318,6 +328,17 @@ public: UINT8 b = palexpand<_BlueBits>(raw >> _BlueShift); return rgb_t(r, g, b); } + + // data-inverted generic raw-to-RGB conversion helpers + template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift> + static rgb_t inverted_rgb_decoder(UINT32 raw) + { + UINT8 r = palexpand<_RedBits>(~raw >> _RedShift); + UINT8 g = palexpand<_GreenBits>(~raw >> _GreenShift); + UINT8 b = palexpand<_BlueBits>(~raw >> _BlueShift); + return rgb_t(r, g, b); + } + template<int _IntBits, int _RedBits, int _GreenBits, int _BlueBits, int _IntShift, int _RedShift, int _GreenShift, int _BlueShift> static rgb_t standard_irgb_decoder(UINT32 raw) { @@ -329,7 +350,6 @@ public: } // other standard decoders - static rgb_t BBGGRRII_decoder(UINT32 raw); static rgb_t IRRRRRGGGGGBBBBB_decoder(UINT32 raw); static rgb_t RRRRGGGGBBBBRGBx_decoder(UINT32 raw); // bits 3/2/1 are LSb static rgb_t xRGBRRRRGGGGBBBB_bit0_decoder(UINT32 raw); // bits 14/13/12 are LSb diff --git a/src/emu/imagedev/floppy.c b/src/emu/imagedev/floppy.c index 8fea5c24566..c4a61514b89 100644 --- a/src/emu/imagedev/floppy.c +++ b/src/emu/imagedev/floppy.c @@ -262,7 +262,7 @@ void floppy_image_device::setup_write(floppy_image_format_t *_output_format) void floppy_image_device::commit_image() { image_dirty = false; - if(!output_format) + if(!output_format || !output_format->supports_save()) return; io_generic io; // Do _not_ remove this cast otherwise the pointer will be incorrect when used by the ioprocs. diff --git a/src/emu/machine/ti99_hd.c b/src/emu/imagedev/mfmhd.c index f6f3344f94a..cfcdbed0353 100644 --- a/src/emu/machine/ti99_hd.c +++ b/src/emu/imagedev/mfmhd.c @@ -2,37 +2,286 @@ // copyright-holders:Michael Zapf /************************************************************************* - Hard disk emulation + MFM Hard disk emulation + ----------------------- + + This is a low-level emulation of a hard disk drive. Unlike high-level + emulations which just deliver the data bytes, this implementation + considers all bytes on a track, including gaps, CRC, interleave, and more. + + The actual data are stored on a CHD file, however, only as a sequence + of sector contents. The other metadata (like gap information, interleave) + are stored as metadata information in the CHD. + + To provide the desired low-level emulation grade, the tracks must be + reconstructed from the sector contents in the CHD. This is done in + the call_load method. + + Usually, more than one sector of a track is read, so when a track is + reconstructed, the track image is retained for later accesses. + + This implementation also features a LRU cache for the track images, + implemented by the class mfmhd_trackimage_cache, also contained in this + source file. The LRU cache stores the most recently accessed track images. + When lines must be evicted, they are stored back into the CHD file. This + is done in the call_unload method. Beside the sector contents, call_unload + also saves track layout metadata which have been detected during usage. + + The architecture can be imagined like this: + + [host system] ---- [controller] --- [harddisk] --- [track cache] + | + [format] ---- [CHD] + + Encodings + --------- + The goal of this implementation is to provide an emulation that is very + close to the original, similar to the grade achieved for the floppy + emulation. This means that the track image does not contain a byte + sequence but a sequence of MFM cell values. Unlike the floppy emulation, + we do not define the cells by time intervals but simply by a sequence of + bits which represent the MFM cell contents; this is also due to the fact + that the cell rate is more than 10 times higher than with floppy media. + + There are four options for encodings which differ by overhead and + emulation precision. + + - MFM_BITS: MFM cells are transferred bit by bit for reading and writing + - MFM_BYTE: MFM cells are transferred in clusters of 16 cells, thus + encoding a full data byte (with 8 clock bits interleaved) + - SEPARATED: 16 bits are transferred in one go, with the 8 clock bits in the + first byte, and the 8 data bits in the second byte + - SEPARATED_SIMPLE: Similar to SEPARATED, but instead of the clock bits, + 0x00 is used for normal data, and 0xff is used for marks. + + Following the specification of MFM, the data byte 0x67 is encoded as follows: + + MFM_BITS / MFM_BYTE: 1001010010010101 = 0x9495 + SEPARATED: 10001000 01100111 = 0x8867 + SEPARATED_SIMPLE: 00000000 01100111 = 0x0067 + + The ID Address Mark (0xA1) is encoded this way: + + MFM_BITS / MFM_BYTE: 0100010010001001 = 0x4489 + SEPARATED: 00001010 10100001 = 0x0AA1 + SEPARATED_SIMPLE: 11111111 10100001 = 0xFFA1 + + If the CPU load by the emulation is already very high, the + SEPARATED(_SIMPLE) options are recommended. The MFM_BITS option is closest + to the real processing, but causes a high load. MFM_BYTE is a good + compromise between speed and precision. + + + Drive definition + ---------------- + Hard disk drives are defined by subclassing mfm_harddisk_device, as can + be seen for the offered Seagate drive implementations. + + The following parameters must be set in the constructor of the subclass: + + - Number of physical cylinders. These can be more than the number of + cylinders that are used for data. Some drives have cylinders near the + spindle that are used as park positions. + + - Number of cylinders used for data. This is the number of the highest + cylinder plus 1 (counting from 0). + + - Landing zone: Cylinder number where the head is parked. Should be higher + than the number of usable cylinders. + + - Heads: Number of heads. + + - Time for one cylinder seek step in milliseconds: This is the time the + drive heads need to step one cylinder inwards or outwards. This time + includes the settling time. + + - Maximum seek time in milliseconds: This is the time the drive needs to + seek from cylinder 0 to the maximum cylinder. This time includes the + settling time and is typically far less than the one cylinder time + multiplied by the number of cylinders, because the settling time only + occurs once. These delay values are calculated in call_load. + + If the number of physical cylinders is set to 0, the cylinder and head + count in taken from the metadata of the mounted CHD file. This allows for + using all kinds of CHD images that can be handled by the controller, + without having to define a proper drive for them. + + The predefined drives are + + ST-213: Seagate hard disk drive, 10 MB capacity + ST-225: Seagate hard disk drive, 20 MB capacity + ST-251: Seagate hard disk drive, 40 MB capacity + + generic: Hard disk with 0 physical cylinders, which can be used for + all CHDs that can be handled by the controller. + + The ST-xxx drives require to mount a CHD that exactly matches their + geometry. + + + Track image cache + ----------------- + Since the reconstruction of the track takes some time, and we don't want + to create unnecessary effort, track images (sector contents plus all + preambles and gaps encoded as selected) are kept in a cache. Whenever a + track shall be read, the cache is consulted first to retrieve a copy. + If no recent copy is available, the track is loaded from the CHD, set up + by the format implementation (see lib/formats/mfm_hd.c). The least + recently used track is evicted from the cache and written back to the CHD + (also by means of the format implementation). + + When the emulation is stopped, all cache lines are evicted and written back. + If the emulation is killed before, cache contents may possibly not be + written back, so changes may be lost. To alleviate this issue, the cache + writes back one line every 5 seconds so that changes are automatically + committed after some time. + + This cache is not related to caches on real hard drives. It is a pure + emulation artifact, intended to keep conversion efforts as low as possible. + + + Interface + --------- + There are three outgoing lines, used as callbacks to the controller: + - READY: asserted when the drive has completed its spinup. + - INDEX: asserted when the index hole passes by. Unlike the floppy + implementation, this hard disk implementation produces a + zero-length pulse (assert/clear). This must be considered for + the controller emulation. + - SEEK COMPLETE: asserted when the read/write heads have settled over the + target cylinder. This line is important for controller that want + to employ buffered steps. + + There are two data transfer methods: + + - read(attotime &from_when, const attotime &limit, UINT16 &data) + + Delivers the MFM cells at the given point in time. The cells are returned + in the data parameter. The behavior depends on the chosen encoding: + + MFM_BITS: data contains 0x0000 or 0x0001 + MFM_BYTE: data contains a set of 16 consecutive cells at the given time + SEPARATED: data contains the clock bits in the MSB, the data bits in the LSB + SEPARATED_SIMPLE: data contains 0x00 or 0xFF in the MSB (normal or mark) + and the data bits in the LSB. + + When the limit is exceeded, the method returns true, otherwise false. + + - write(attotime &from_when, const attotime &limit, UINT16 cdata, bool wpcom=false, bool reduced_wc=false) + + Writes the MFM cells at the given point in time. cdata contains the + cells according to the encoding (see above). The controller also has + to set wpcom to true to indicate write precompensation, and reduced_wc + to true to indicate a reduced write current; otherwise, these settings + are assumed to be false. The wpcom and rwc settings do not affect the + recording of the data bytes in this emulation, but the drive will store + the cylinder with the lowest number where wpcom (or rwc) occured and + store this in the CHD. + + These methods are used to move and select the heads: + + - step_w(line_state line) + - direction_in_w(line_state line) + - headsel_w(int head) + + Some status lines: + + - ready_r + - seek_complete_r + - trk00_r + + These reflect the values that are also passed by the callback routines + listed above and can be used for a polling scheme. Track00 is not available + as a callback. It indicates whether track 0 has been reached. + + + Configuration + ------------- + For a working example please refer to emu/bus/ti99_peb/hfdc.c. + + According to the MAME/MESS concept of slot devices, the settings are + passed over the slot to the slot device, in this case, the hard disk drive. + + This means that when we add a slot (the connector), we also have to + pass the desired parameters for the drive. + + MCFG_MFM_HARDDISK_CONN_ADD(_tag, _slot_intf, _def_slot, _enc, _spinupms, _cache, _format) + + Specific parameters: + + _enc: Select an encoding from the values as listed above. + _spinupms: Number of milliseconds until the drive announces READY. Many + drives like the included Seagate drives require a pretty long + powerup time (10-20 seconds). In some computer systems, the + user is therefore asked to turn on the drive first so that + on first access by the system, the drive may have completed + its powerup. In MAME/MESS we cannot turn on components earlier, + thus we do not define the spinup time inside the drive + implementation but at this point. + _cache: Number of tracks to be stored in the LRU track cache + _format: Format to be used for the drive. Must be a subclass of + mfmhd_image_format_t, for example, mfmhd_generic_format. The format + is specified by its format creator identifier (e.g. MFMHD_GEN_FORMAT). + + Metadata + -------- + We have three sets of metadata information. The first one is the + declaration of cylinders, heads, sectors, and sector size. It is stored + by the tag GDDD in the CHD. + The second is the declaration of interleave, skew, write precompensation, + and reduced write current. + + Write precompensation is a modification of the timing used for the inner + cylinders. Although write precompensation (wpcom for short) can be applied + at every write operation, it is usually only used starting from some + cylinder, going towards the spindle, applied to the whole tracks. + The value defined here is the first cylinder where wpcom is applied. + Reduced write current (rwc) is a modification of the electrical current + used for writing data. The value defined here is the first cylinder where + rwc is applied. + + Both wpcom and rwc have an effect on the physical device, but this is not + emulated. For that reason we store the information as additional metadata + inside the CHD. It is not relevant for the functionality of the emulated + hard disk. The write operations + + When wpcom or rwc are not used, their value is defined to be -1. + + Interleave affects the order how sectors are arranged on the track; skew + is the number of sectors that the sector sequence is shifted on the + next cylinder (cylinder skew) or head (head skew). These values are used + to compensate for the delay that occurs when the read/write heads are moved + from one cylinder to the next, or switched from one head to the next. + + These parameters are stored by the tag GDDI on the CHD. + + The third set refers to the specification of gaps and sync fields on the + track. These values may change only on first use (when undefined) or when + the hard disk is reformatted with a different controller or driver. These + parameters are also stored by the GDDI tag as a second record. + Michael Zapf - April 2010 - February 2012: Rewritten as class - April 2015: Rewritten with deeper emulation detail + August 2015 References: [1] ST225 OEM Manual, Seagate **************************************************************************/ -// TODO: Define format by a file -// Save interleave in CHD - #include "emu.h" #include "formats/imageutl.h" #include "harddisk.h" - -#include "ti99_hd.h" +#include "mfmhd.h" #define TRACE_STEPS 0 #define TRACE_SIGNALS 0 #define TRACE_READ 0 #define TRACE_WRITE 0 #define TRACE_CACHE 0 -#define TRACE_RWTRACK 0 #define TRACE_BITS 0 #define TRACE_DETAIL 0 #define TRACE_TIMING 0 -#define TRACE_IMAGE 0 #define TRACE_STATE 1 #define TRACE_CONFIG 1 @@ -51,15 +300,11 @@ enum STEP_SETTLE }; -#define TRACKSLOTS 5 - -#define OFFLIMIT -1 - std::string mfm_harddisk_device::tts(const attotime &t) { char buf[256]; - int nsec = t.attoseconds / ATTOSECONDS_PER_NANOSECOND; - sprintf(buf, "%4d.%03d,%03d,%03d", int(t.seconds), nsec/1000000, (nsec/1000)%1000, nsec % 1000); + int nsec = t.attoseconds() / ATTOSECONDS_PER_NANOSECOND; + sprintf(buf, "%4d.%03d,%03d,%03d", int(t.seconds()), nsec/1000000, (nsec/1000)%1000, nsec % 1000); return buf; } @@ -68,19 +313,19 @@ mfm_harddisk_device::mfm_harddisk_device(const machine_config &mconfig, device_t device_slot_card_interface(mconfig, *this) { m_spinupms = 10000; - m_cachelines = TRACKSLOTS; + m_cachelines = 5; m_max_cylinders = 0; m_phys_cylinders = 0; // We will get this value for generic drives from the image m_max_heads = 0; m_cell_size = 100; m_rpm = 3600; // MFM drives have a revolution rate of 3600 rpm (i.e. 60/sec) - m_trackimage_size = (int)((60000000000L / (m_rpm * m_cell_size)) / 16 + 1); + m_trackimage_size = (int)((60000000000ULL / (m_rpm * m_cell_size)) / 16 + 1); m_cache = NULL; // We will calculate default values from the time specs later. m_seeknext_time = 0; m_maxseek_time = 0; m_actual_cylinders = 0; - m_park_pos = 0; + m_landing_zone = 0; m_interleave = 0; } @@ -98,7 +343,7 @@ void mfm_harddisk_device::device_start() m_rev_time = attotime::from_hz(m_rpm/60); m_index_timer->adjust(attotime::from_hz(m_rpm/60), 0, attotime::from_hz(m_rpm/60)); - m_current_cylinder = m_park_pos; // Park position + m_current_cylinder = m_landing_zone; // Park position m_spinup_timer->adjust(attotime::from_msec(m_spinupms)); m_cache = global_alloc(mfmhd_trackimage_cache); @@ -131,6 +376,12 @@ void mfm_harddisk_device::device_stop() bool mfm_harddisk_device::call_load() { bool loaded = harddisk_image_device::call_load(); + + std::string devtag(tag()); + devtag += ":format"; + + m_format->set_tag(devtag); + if (loaded==IMAGE_INIT_PASS) { std::string metadata; @@ -153,35 +404,81 @@ bool mfm_harddisk_device::call_load() if (TRACE_CONFIG) logerror("%s: CHD metadata: %s\n", tag(), metadata.c_str()); // Parse the metadata - int imagecyls; - int imageheads; - int imagesecpt; - int imagesecsz; + mfmhd_layout_params param; + param.encoding = m_encoding; + if (TRACE_CONFIG) logerror("%s: Set encoding to %d\n", tag(), m_encoding); - if (sscanf(metadata.c_str(), HARD_DISK_METADATA_FORMAT, &imagecyls, &imageheads, &imagesecpt, &imagesecsz) != 4) + if (sscanf(metadata.c_str(), HARD_DISK_METADATA_FORMAT, ¶m.cylinders, ¶m.heads, ¶m.sectors_per_track, ¶m.sector_size) != 4) { logerror("%s: Invalid CHD metadata\n", tag()); return IMAGE_INIT_FAIL; } - if (TRACE_CONFIG) logerror("%s: CHD image has geometry cyl=%d, head=%d, sect=%d, size=%d\n", tag(), imagecyls, imageheads, imagesecpt, imagesecsz); + if (TRACE_CONFIG) logerror("%s: CHD image has geometry cyl=%d, head=%d, sect=%d, size=%d\n", tag(), param.cylinders, param.heads, param.sectors_per_track, param.sector_size); + + if (m_max_cylinders != 0 && (param.cylinders != m_max_cylinders || param.heads != m_max_heads)) + { + throw emu_fatalerror("Image geometry does not fit this kind of hard drive: drive=(%d,%d), image=(%d,%d)", m_max_cylinders, m_max_heads, param.cylinders, param.heads); + } + + // MDM format specs + param.interleave = 0; + param.cylskew = 0; + param.headskew = 0; + param.write_precomp_cylinder = -1; + param.reduced_wcurr_cylinder = -1; + + state = chdfile->read_metadata(MFM_HARD_DISK_METADATA_TAG, 0, metadata); + if (state != CHDERR_NONE) + { + logerror("%s: Failed to read CHD sector arrangement/recording specs, applying defaults\n", tag()); + } + else + { + sscanf(metadata.c_str(), MFMHD_REC_METADATA_FORMAT, ¶m.interleave, ¶m.cylskew, ¶m.headskew, ¶m.write_precomp_cylinder, ¶m.reduced_wcurr_cylinder); + } + + if (!param.sane_rec()) + { + if (TRACE_CONFIG) logerror("%s: Sector arrangement/recording specs have invalid values, applying defaults\n", tag()); + param.reset_rec(); + } + else + if (TRACE_CONFIG) logerror("%s: MFM HD rec specs: interleave=%d, cylskew=%d, headskew=%d, wpcom=%d, rwc=%d\n", + tag(), param.interleave, param.cylskew, param.headskew, param.write_precomp_cylinder, param.reduced_wcurr_cylinder); - if (m_max_cylinders != 0 && (imagecyls != m_max_cylinders || imageheads != m_max_heads)) + state = chdfile->read_metadata(MFM_HARD_DISK_METADATA_TAG, 1, metadata); + if (state != CHDERR_NONE) { - throw emu_fatalerror("Image geometry does not fit this kind of hard drive: drive=(%d,%d), image=(%d,%d)", m_max_cylinders, m_max_heads, imagecyls, imageheads); + logerror("%s: Failed to read CHD track gap specs, applying defaults\n", tag()); + } + else + { + sscanf(metadata.c_str(), MFMHD_GAP_METADATA_FORMAT, ¶m.gap1, ¶m.gap2, ¶m.gap3, ¶m.sync, ¶m.headerlen, ¶m.ecctype); } - m_cache->init(chdfile, tag(), m_trackimage_size, imagecyls, imageheads, imagesecpt, m_cachelines, m_encoding, m_format); + if (!param.sane_gap()) + { + if (TRACE_CONFIG) logerror("%s: MFM HD gap specs have invalid values, applying defaults\n", tag()); + param.reset_gap(); + } + else + if (TRACE_CONFIG) logerror("%s: MFM HD gap specs: gap1=%d, gap2=%d, gap3=%d, sync=%d, headerlen=%d, ecctype=%d\n", + tag(), param.gap1, param.gap2, param.gap3, param.sync, param.headerlen, param.ecctype); + + m_format->set_layout_params(param); + + m_cache->init(this, m_trackimage_size, m_cachelines); // Head timing // We assume that the real times are 80% of the max times // The single-step time includes the settle time, so does the max time // From that we calculate the actual cylinder-by-cylinder time and the settle time - m_actual_cylinders = m_cache->get_cylinders(); - if (m_phys_cylinders == 0) m_phys_cylinders = m_actual_cylinders+1; + m_actual_cylinders = param.cylinders; - m_park_pos = m_phys_cylinders-1; + if (m_phys_cylinders == 0) m_phys_cylinders = m_actual_cylinders+1; + if (m_landing_zone == 0) m_landing_zone = m_phys_cylinders-1; float realnext = (m_seeknext_time==0)? 10 : (m_seeknext_time * 0.8); float realmax = (m_maxseek_time==0)? (m_actual_cylinders * 0.2) : (m_maxseek_time * 0.8); @@ -192,8 +489,7 @@ bool mfm_harddisk_device::call_load() m_settle_time = attotime::from_usec((int)settle_us); m_step_time = attotime::from_usec((int)step_us); - m_current_cylinder = m_park_pos; - m_interleave = m_format->get_interleave(); + m_current_cylinder = m_landing_zone; } else { @@ -202,19 +498,48 @@ bool mfm_harddisk_device::call_load() return loaded; } +const char *MFMHD_REC_METADATA_FORMAT = "IL:%d,CSKEW:%d,HSKEW:%d,WPCOM:%d,RWC:%d"; +const char *MFMHD_GAP_METADATA_FORMAT = "GAP1:%d,GAP2:%d,GAP3:%d,SYNC:%d,HLEN:%d,ECC:%d"; + void mfm_harddisk_device::call_unload() { + mfmhd_layout_params* params = m_format->get_current_params(); + mfmhd_layout_params* oldparams = m_format->get_initial_params(); + if (m_cache!=NULL) { m_cache->cleanup(); - if (m_interleave != m_format->get_interleave()) + if (m_format->save_param(MFMHD_IL) && !params->equals_rec(oldparams)) { - logerror("%s: Interleave changed from %d to %d; committing to CHD\n", tag(), m_interleave, m_format->get_interleave()); + logerror("%s: MFM HD sector arrangement and recording specs have changed; updating CHD metadata\n", tag()); + chd_file* chdfile = get_chd_file(); + std::string metadata; + + strprintf(metadata, MFMHD_REC_METADATA_FORMAT, params->interleave, params->cylskew, params->headskew, params->write_precomp_cylinder, params->reduced_wcurr_cylinder); + + chd_error err = chdfile->write_metadata(MFM_HARD_DISK_METADATA_TAG, 0, metadata, 0); + if (err != CHDERR_NONE) + { + logerror("%s: Failed to save MFM HD sector arrangement/recording specs to CHD\n", tag()); + } } - } - // TODO: If interleave changed, commit that to CHD + if (m_format->save_param(MFMHD_GAP1) && !params->equals_gap(oldparams)) + { + logerror("%s: MFM HD track gap specs have changed; updating CHD metadata\n", tag()); + chd_file* chdfile = get_chd_file(); + std::string metadata; + + strprintf(metadata, MFMHD_GAP_METADATA_FORMAT, params->gap1, params->gap2, params->gap3, params->sync, params->headerlen, params->ecctype); + + chd_error err = chdfile->write_metadata(MFM_HARD_DISK_METADATA_TAG, 1, metadata, 0); + if (err != CHDERR_NONE) + { + logerror("%s: Failed to save MFM HD track gap specs to CHD\n", tag()); + } + } + } harddisk_image_device::call_unload(); } @@ -294,6 +619,11 @@ void mfm_harddisk_device::device_timer(emu_timer &timer, device_timer_id id, int m_seek_timer->adjust(m_settle_time); if (TRACE_STEPS && TRACE_DETAIL) logerror("%s: Arrived at target cylinder %d, settling ...\n", tag(), m_current_cylinder); } + else + { + // need to move the head again + head_move(); + } break; case STEP_SETTLE: // Do we have new step pulses? @@ -502,7 +832,7 @@ bool mfm_harddisk_device::read(attotime &from_when, const attotime &limit, UINT1 Returns true if the time limit will be exceeded before writing the bit or complete byte. */ -bool mfm_harddisk_device::write(attotime &from_when, const attotime &limit, UINT16 cdata) +bool mfm_harddisk_device::write(attotime &from_when, const attotime &limit, UINT16 cdata, bool wpcom, bool reduced_wc) { UINT16* track = m_cache->get_trackimage(m_current_cylinder, m_current_head); @@ -533,10 +863,40 @@ bool mfm_harddisk_device::write(attotime &from_when, const attotime &limit, UINT track[bytepos] = cdata; } - if (TRACE_WRITE) if ((bitpos&0x0f)==0) logerror("%s: Wrote data=%04x (c=%d,h=%d) at position %04x\n", tag(), track[bytepos], m_current_cylinder, m_current_head, bytepos); + // Update our cylinders for reduced write current and write precompensation. + // We assume that write precompensation and reduced write current occur + // at some cylinder and continue up to the innermost cylinder. + mfmhd_layout_params* params = m_format->get_current_params(); + + if (reduced_wc && (params->reduced_wcurr_cylinder == -1 || m_current_cylinder < params->reduced_wcurr_cylinder)) + params->reduced_wcurr_cylinder = m_current_cylinder; + + if (wpcom && (params->write_precomp_cylinder == -1 || m_current_cylinder < params->write_precomp_cylinder)) + params->write_precomp_cylinder = m_current_cylinder; + + if (TRACE_WRITE) if ((bitpos&0x0f)==0) logerror("%s: Wrote data=%04x (c=%d,h=%d) at position %04x, wpcom=%d, rwc=%d\n", tag(), track[bytepos], m_current_cylinder, m_current_head, bytepos, wpcom, reduced_wc); return false; } +chd_error mfm_harddisk_device::load_track(UINT16* data, int cylinder, int head) +{ + chd_error state = m_format->load(m_chd, data, m_trackimage_size, cylinder, head); + return state; +} + +void mfm_harddisk_device::write_track(UINT16* data, int cylinder, int head) +{ + m_format->save(m_chd, data, m_trackimage_size, cylinder, head); +} + +int mfm_harddisk_device::get_actual_heads() +{ + return m_format->get_current_params()->heads; +} + +/* + The generic HD takes any kind of CHD HD image and magically creates enough heads and cylinders. +*/ mfm_hd_generic_device::mfm_hd_generic_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : mfm_harddisk_device(mconfig, MFMHD_GENERIC, "Generic MFM hard disk", tag, owner, clock, "mfm_harddisk", __FILE__) { @@ -552,7 +912,7 @@ mfm_hd_st213_device::mfm_hd_st213_device(const machine_config &mconfig, const ch { m_phys_cylinders = 670; m_max_cylinders = 615; // 0..614 - m_park_pos = 620; + m_landing_zone = 620; m_max_heads = 2; m_seeknext_time = 20; // time for one step including settle time m_maxseek_time = 150; @@ -565,7 +925,7 @@ mfm_hd_st225_device::mfm_hd_st225_device(const machine_config &mconfig, const ch { m_phys_cylinders = 670; m_max_cylinders = 615; - m_park_pos = 620; + m_landing_zone = 620; m_max_heads = 4; m_seeknext_time = 20; m_maxseek_time = 150; @@ -578,7 +938,7 @@ mfm_hd_st251_device::mfm_hd_st251_device(const machine_config &mconfig, const ch { m_phys_cylinders = 821; m_max_cylinders = 820; - m_park_pos = 820; + m_landing_zone = 820; m_max_heads = 6; m_seeknext_time = 8; m_maxseek_time = 70; @@ -595,14 +955,12 @@ const device_type MFMHD_ST251 = &device_creator<mfm_hd_st251_device>; mfmhd_trackimage_cache::mfmhd_trackimage_cache(): m_tracks(NULL) { - m_current_crc = 0; - m_tracksize = 0; } mfmhd_trackimage_cache::~mfmhd_trackimage_cache() { mfmhd_trackimage* current = m_tracks; - if (TRACE_CACHE) logerror("%s: MFM HD cache destroy\n", tag()); + if (TRACE_CACHE) logerror("%s: MFM HD cache destroy\n", m_mfmhd->tag()); while (current != NULL) { @@ -621,8 +979,7 @@ void mfmhd_trackimage_cache::write_back_one() { if (current->dirty) { - // write_track(m_chd, current->encdata, m_tracksize, current->cylinder, current->head); - m_format->save(tag(), m_chd, current->encdata, m_encoding, m_tracksize, current->cylinder, current->head, m_cylinders, m_heads, m_sectors_per_track); + m_mfmhd->write_track(current->encdata, current->cylinder, current->head); current->dirty = false; break; } @@ -634,16 +991,15 @@ void mfmhd_trackimage_cache::write_back_one() void mfmhd_trackimage_cache::cleanup() { mfmhd_trackimage* current = m_tracks; - if (TRACE_CACHE) logerror("%s: MFM HD cache cleanup\n", tag()); + if (TRACE_CACHE) logerror("%s: MFM HD cache cleanup\n", m_mfmhd->tag()); // Still dirty? while (current != NULL) { - if (TRACE_CACHE) logerror("%s: MFM HD cache: evict line cylinder=%d head=%d\n", tag(), current->cylinder, current->head); + if (TRACE_CACHE) logerror("%s: MFM HD cache: evict line cylinder=%d head=%d\n", m_mfmhd->tag(), current->cylinder, current->head); if (current->dirty) { - // write_track(m_chd, current->encdata, m_tracksize, current->cylinder, current->head); - m_format->save(tag(), m_chd, current->encdata, m_encoding, m_tracksize, current->cylinder, current->head, m_cylinders, m_heads, m_sectors_per_track); + m_mfmhd->write_track(current->encdata, current->cylinder, current->head); current->dirty = false; } mfmhd_trackimage* currenttmp = current->next; @@ -665,48 +1021,39 @@ const char *encnames[] = { "MFM_BITS","MFM_BYTE","SEPARATE","SSIMPLE " }; /* Initialize the cache by loading the first <trackslots> tracks. */ -void mfmhd_trackimage_cache::init(chd_file* chdfile, const char* dtag, int tracksize, int imagecyl, int imageheads, int imagesecpt, int trackslots, mfmhd_enc_t encoding, mfmhd_image_format_t* format) +void mfmhd_trackimage_cache::init(mfm_harddisk_device* mfmhd, int tracksize, int trackslots) { - m_encoding = encoding; - m_tagdev = dtag; + if (TRACE_CACHE) logerror("%s: MFM HD cache init; cache size is %d tracks\n", mfmhd->tag(), trackslots); - if (TRACE_CACHE) logerror("%s: MFM HD cache init; using encoding %s; cache size is %d tracks\n", m_tagdev, encnames[encoding], trackslots); chd_error state = CHDERR_NONE; + mfmhd_trackimage* previous = NULL; mfmhd_trackimage* current = NULL; - std::string metadata; - m_tracksize = tracksize; - m_chd = chdfile; - m_format = format; - m_cylinders = imagecyl; - m_heads = imageheads; - m_sectors_per_track = imagesecpt; + m_mfmhd = mfmhd; // Load some tracks into the cache int track = 0; int head = 0; int cylinder = 0; + while (track < trackslots) { - if (TRACE_CACHE && TRACE_DETAIL) logerror("%s: MFM HD allocate cache slot\n", tag()); + if (TRACE_CACHE && TRACE_DETAIL) logerror("%s: MFM HD allocate cache slot\n", mfmhd->tag()); previous = current; current = global_alloc(mfmhd_trackimage); current->encdata = global_alloc_array(UINT16, tracksize); // Load the first tracks into the slots - // state = load_track(m_chd, current->encdata, m_tracksize, cylinder, head); - - state = m_format->load(tag(), m_chd, current->encdata, m_encoding, m_tracksize, cylinder, head, m_cylinders, m_heads, m_sectors_per_track); + state = m_mfmhd->load_track(current->encdata, cylinder, head); + if (state != CHDERR_NONE) throw emu_fatalerror("Cannot load (c=%d,h=%d) from hard disk", cylinder, head); current->dirty = false; current->cylinder = cylinder; current->head = head; - if (state != CHDERR_NONE) throw emu_fatalerror("Cannot load (c=%d,h=%d) from hard disk", cylinder, head); - // We will read all heads per cylinder first, then go to the next cylinder. - if (++head >= m_heads) + if (++head >= mfmhd->get_actual_heads()) { head = 0; cylinder++; @@ -771,17 +1118,15 @@ UINT16* mfmhd_trackimage_cache::get_trackimage(int cylinder, int head) // previous points to the second to last element current = previous->next; - if (TRACE_CACHE) logerror("%s: MFM HD cache: evict line (c=%d,h=%d)\n", tag(), current->cylinder, current->head); + if (TRACE_CACHE) logerror("%s: MFM HD cache: evict line (c=%d,h=%d)\n", m_mfmhd->tag(), current->cylinder, current->head); if (current->dirty) { - // write_track(m_chd, current->encdata, m_tracksize, current->cylinder, current->head); - m_format->save(tag(), m_chd, current->encdata, m_encoding, m_tracksize, current->cylinder, current->head, m_cylinders, m_heads, m_sectors_per_track); + m_mfmhd->write_track(current->encdata, current->cylinder, current->head); current->dirty = false; } - // state = load_track(m_chd, current->encdata, m_tracksize, cylinder, head); - state = m_format->load(tag(), m_chd, current->encdata, m_encoding, m_tracksize, cylinder, head, m_cylinders, m_heads, m_sectors_per_track); + state = m_mfmhd->load_track(current->encdata, cylinder, head); current->dirty = false; current->cylinder = cylinder; @@ -829,466 +1174,3 @@ void mfm_harddisk_connector::device_config_complete() } const device_type MFM_HD_CONNECTOR = &device_creator<mfm_harddisk_connector>; - -// ================================================================ - -mfmhd_image_format_t::mfmhd_image_format_t() -{ -}; - -mfmhd_image_format_t::~mfmhd_image_format_t() -{ -}; - -void mfmhd_image_format_t::mfm_encode(UINT16* trackimage, int& position, UINT8 byte, int count) -{ - mfm_encode_mask(trackimage, position, byte, count, 0x00); -} - -void mfmhd_image_format_t::mfm_encode_a1(UINT16* trackimage, int& position) -{ - m_current_crc = 0xffff; - mfm_encode_mask(trackimage, position, 0xa1, 1, 0x04); - // 0x443b; CRC for A1 -} - -void mfmhd_image_format_t::mfm_encode_mask(UINT16* trackimage, int& position, UINT8 byte, int count, int mask) -{ - UINT16 encclock = 0; - UINT16 encdata = 0; - UINT8 thisbyte = byte; - bool mark = (mask != 0x00); - - m_current_crc = ccitt_crc16_one(m_current_crc, byte); - - for (int i=0; i < 8; i++) - { - encdata <<= 1; - encclock <<= 1; - - if (m_encoding == MFM_BITS || m_encoding == MFM_BYTE) - { - // skip one position for later interleaving - encdata <<= 1; - encclock <<= 1; - } - - if (thisbyte & 0x80) - { - // Encoding 1 => 01 - encdata |= 1; - m_lastbit = true; - } - else - { - // Encoding 0 => x0 - // If the bit in the mask is set, suppress the clock bit - // Also, if we use the simplified encoding, don't set the clock bits - if (m_lastbit == false && m_encoding != SEPARATED_SIMPLE && (mask & 0x80) == 0) encclock |= 1; - m_lastbit = false; - } - mask <<= 1; - // For simplified encoding, set all clock bits to indicate a mark - if (m_encoding == SEPARATED_SIMPLE && mark) encclock |= 1; - thisbyte <<= 1; - } - - if (m_encoding == MFM_BITS || m_encoding == MFM_BYTE) - encclock <<= 1; - else - encclock <<= 8; - - trackimage[position++] = (encclock | encdata); - - // When we write the byte multiple times, check whether the next encoding - // differs from the previous because of the last bit - - if (m_encoding == MFM_BITS || m_encoding == MFM_BYTE) - { - encclock &= 0x7fff; - if ((byte & 0x80)==0 && m_lastbit==false) encclock |= 0x8000; - } - - for (int j=1; j < count; j++) - { - trackimage[position++] = (encclock | encdata); - m_current_crc = ccitt_crc16_one(m_current_crc, byte); - } -} - -UINT8 mfmhd_image_format_t::mfm_decode(UINT16 raw) -{ - unsigned int value = 0; - - for (int i=0; i < 8; i++) - { - value <<= 1; - - value |= (raw & 0x4000); - raw <<= 2; - } - return (value >> 14) & 0xff; -} - -/* - For debugging. Outputs the byte array in a xxd-like way. -*/ -void mfmhd_image_format_t::showtrack(UINT16* enctrack, int length) -{ - for (int i=0; i < length; i+=16) - { - logerror("%07x: ", i); - for (int j=0; j < 16; j++) - { - logerror("%04x ", enctrack[i+j]); - } - logerror(" "); - logerror("\n"); - } -} - -// ====================================================================== -// TI-99-specific format -// ====================================================================== - -const mfmhd_format_type MFMHD_TI99_FORMAT = &mfmhd_image_format_creator<ti99_mfmhd_format>; - -enum -{ - SEARCH_A1=0, - FOUND_A1, - DAM_FOUND, - CHECK_CRC -}; - - -/* - Calculate the ident byte from the cylinder. The specification does not - define idents beyond cylinder 1023, but formatting programs seem to - continue with 0xfd for cylinders between 1024 and 2047. -*/ -UINT8 ti99_mfmhd_format::cylinder_to_ident(int cylinder) -{ - if (cylinder < 256) return 0xfe; - if (cylinder < 512) return 0xff; - if (cylinder < 768) return 0xfc; - return 0xfd; -} - -/* - Returns the linear sector number, given the CHS data. - - C,H,S - | 0,0,0 | 0,0,1 | 0,0,2 | ... - | 0,1,0 | 0,1,1 | 0,1,2 | ... - ... - | 1,0,0 | ... - ... -*/ -int ti99_mfmhd_format::chs_to_lba(int cylinder, int head, int sector) -{ - if ((cylinder < m_cylinders) && (head < m_heads) && (sector < m_sectors_per_track)) - { - return (cylinder * m_heads + head) * m_sectors_per_track + sector; - } - else return -1; -} - -chd_error ti99_mfmhd_format::load(const char* tagdev, chd_file* chdfile, UINT16* trackimage, mfmhd_enc_t encoding, int tracksize, int cylinder, int head, int cylcnt, int headcnt, int sect_per_track) -{ - chd_error state = CHDERR_NONE; - - int sectorcount = 32; - int size = 256; - int interleave = 4; - - m_encoding = encoding; - m_cylinders = cylcnt; - m_heads = headcnt; - m_sectors_per_track = sect_per_track; - m_tagdev = tagdev; - - UINT8 sector_content[1024]; - - if (TRACE_RWTRACK) logerror("%s: MFM HD cache: load track (c=%d,h=%d) from CHD\n", tag(), cylinder, head); - - m_lastbit = false; - int position = 0; // will be incremented by each encode call - - // According to MDM5 formatting: - // gap0=16 gap1=16 gap2=3 gap3=22 sync=13 count=32 size=2 - - // HFDC manual: When using the hard disk format, the values for GAP0 and GAP1 must - // both be set to the same number and loaded in the appropriate registers. - - // Gap 1 - mfm_encode(trackimage, position, 0x4e, 16); - - int sec_il_start = 0; - int sec_number = 0; - int identfield = 0; - int cylfield = 0; - int headfield = 0; - int sizefield = (size >> 7)-1; - - // Round up - int delta = (sectorcount + interleave-1) / interleave; - - if (TRACE_DETAIL) logerror("%s: cyl=%d head=%d: sector sequence = ", tag(), cylinder, head); - for (int sector = 0; sector < sectorcount; sector++) - { - if (TRACE_DETAIL) logerror("%02d ", sec_number); - - // Sync gap - mfm_encode(trackimage, position, 0x00, 13); - - // Write IDAM - mfm_encode_a1(trackimage, position); - - // Write header - identfield = cylinder_to_ident(cylinder); - cylfield = cylinder & 0xff; - headfield = ((cylinder & 0x700)>>4) | (head&0x0f); - - mfm_encode(trackimage, position, identfield); - mfm_encode(trackimage, position, cylfield); - mfm_encode(trackimage, position, headfield); - mfm_encode(trackimage, position, sec_number); - mfm_encode(trackimage, position, sizefield); - // logerror("%s: Created header (%02x,%02x,%02x,%02x)\n", tag(), identfield, cylfield, headfield, sector); - - // Write CRC for header. - int crc = m_current_crc; - mfm_encode(trackimage, position, (crc >> 8) & 0xff); - mfm_encode(trackimage, position, crc & 0xff); - - // Gap 2 - mfm_encode(trackimage, position, 0x4e, 3); - - // Sync - mfm_encode(trackimage, position, 0x00, 13); - - // Write DAM - mfm_encode_a1(trackimage, position); - mfm_encode(trackimage, position, 0xfb); - - // Get sector content from CHD - int lbaposition = chs_to_lba(cylinder, head, sec_number); - if (lbaposition>=0) - { - chd_error state = chdfile->read_units(lbaposition, sector_content); - if (state != CHDERR_NONE) break; - } - else - { - logerror("%s: Invalid CHS data (%d,%d,%d); not loading from CHD\n", tag(), cylinder, head, sector); - } - - for (int i=0; i < size; i++) - mfm_encode(trackimage, position, sector_content[i]); - - // Write CRC for content. - crc = m_current_crc; - mfm_encode(trackimage, position, (crc >> 8) & 0xff); - mfm_encode(trackimage, position, crc & 0xff); - - // Gap 3 - mfm_encode(trackimage, position, 0x00, 3); - mfm_encode(trackimage, position, 0x4e, 19); - - // Calculate next sector number - sec_number += delta; - if (sec_number >= sectorcount) sec_number = ++sec_il_start; - } - if (TRACE_DETAIL) logerror("\n"); - - // Gap 4 - if (state == CHDERR_NONE) - { - // Fill the rest with 0x4e - mfm_encode(trackimage, position, 0x4e, tracksize-position); - if (TRACE_IMAGE) - { - showtrack(trackimage, tracksize); - } - } - return state; -} - -chd_error ti99_mfmhd_format::save(const char* tagdev, chd_file* chdfile, UINT16* trackimage, mfmhd_enc_t encoding, int tracksize, int current_cylinder, int current_head, int cylcnt, int headcnt, int sect_per_track) -{ - if (TRACE_CACHE) logerror("%s: MFM HD cache: write back (c=%d,h=%d) to CHD\n", tag(), current_cylinder, current_head); - - UINT8 buffer[1024]; // for header or sector content - - int bytepos = 0; - int state = SEARCH_A1; - int count = 0; - int pos = 0; - UINT16 crc = 0; - UINT8 byte; - bool search_header = true; - - int ident = 0; - int cylinder = 0; - int head = 0; - int sector = 0; - - int headerpos = 0; - - int calc_interleave = 0; - int interleave_prec = -1; - bool check_interleave = true; - - chd_error chdstate = CHDERR_NONE; - - m_encoding = encoding; - m_cylinders = cylcnt; - m_heads = headcnt; - m_sectors_per_track = sect_per_track; - m_tagdev = tagdev; - - if (TRACE_IMAGE) - { - for (int i=0; i < tracksize; i++) - { - if ((i % 16)==0) logerror("\n%04x: ", i); - logerror("%02x ", (m_encoding==MFM_BITS || m_encoding==MFM_BYTE)? mfm_decode(trackimage[i]) : (trackimage[i]&0xff)); - } - logerror("\n"); - } - - // We have to go through the bytes of the track and save a sector as soon as one shows up - while (bytepos < tracksize) - { - switch (state) - { - case SEARCH_A1: - if (((m_encoding==MFM_BITS || m_encoding==MFM_BYTE) && trackimage[bytepos]==0x4489) - || (m_encoding==SEPARATED && trackimage[bytepos]==0x0aa1) - || (m_encoding==SEPARATED_SIMPLE && trackimage[bytepos]==0xffa1)) - { - state = FOUND_A1; - count = search_header? 7 : 259; - crc = 0x443b; // init value with a1 - pos = 0; - } - bytepos++; - break; - - case FOUND_A1: - // read next values into array - if (m_encoding==MFM_BITS || m_encoding==MFM_BYTE) - { - byte = mfm_decode(trackimage[bytepos]); - } - else byte = (trackimage[bytepos] & 0xff); - - crc = ccitt_crc16_one(crc, byte); - // logerror("%s: MFM HD: Byte = %02x, CRC=%04x\n", tag(), byte, crc); - - // Put byte into buffer - // but not the data mark and the CRC - if (search_header || (count > 2 && count < 259)) buffer[pos++] = byte; - - if (--count == 0) - { - if (crc==0) - { - if (search_header) - { - // Found a header - ident = buffer[0]; - // Highest three bits are in the head field - cylinder = buffer[1] | ((buffer[2]&0x70)<<4); - head = buffer[2] & 0x0f; - sector = buffer[3]; - int identexp = cylinder_to_ident(cylinder); - - if (identexp != ident) - { - logerror("%s: MFM HD: Field error; ident = %02x (expected %02x) for sector chs=(%d,%d,%d)\n", tag(), ident, identexp, cylinder, head, sector); - } - - if (cylinder != current_cylinder) - { - logerror("%s: MFM HD: Sector header of sector %d defines cylinder = %02x (should be %02x)\n", tag(), sector, cylinder, current_cylinder); - } - - if (head != current_head) - { - logerror("%s: MFM HD: Sector header of sector %d defines head = %02x (should be %02x)\n", tag(), sector, head, current_head); - } - - // Count the sectors for the interleave - if (check_interleave) - { - if (interleave_prec == -1) interleave_prec = sector; - else - { - if (sector == interleave_prec+1) check_interleave = false; - calc_interleave++; - } - } - - if (calc_interleave == 0) calc_interleave = sector - buffer[3]; - // size = buffer[4]; - search_header = false; - if (TRACE_DETAIL) logerror("%s: MFM HD: Found sector chs=(%d,%d,%d)\n", tag(), cylinder, head, sector); - headerpos = pos; - } - else - { - // Sector contents - // Write the sectors to the CHD - int lbaposition = chs_to_lba(cylinder, head, sector); - if (lbaposition>=0) - { - if (TRACE_DETAIL) logerror("%s: MFM HD: Writing sector chs=(%d,%d,%d) to CHD\n", tag(), current_cylinder, current_head, sector); - chdstate = chdfile->write_units(chs_to_lba(current_cylinder, current_head, sector), buffer); - - if (chdstate != CHDERR_NONE) - { - logerror("%s: MFM HD: Write error while writing sector chs=(%d,%d,%d)\n", tag(), cylinder, head, sector); - } - } - else - { - logerror("%s: Invalid CHS data in track image: (%d,%d,%d); not saving to CHD\n", tag(), cylinder, head, sector); - } - - search_header = true; - } - } - else - { - logerror("%s: MFM HD: CRC error in %s of (%d,%d,%d)\n", tag(), search_header? "header" : "data", cylinder, head, sector); - search_header = true; - } - // search next A1 - state = SEARCH_A1; - - if (!search_header && (pos - headerpos) > 30) - { - logerror("%s: MFM HD: Error; missing DAM; searching next header\n", tag()); - search_header = true; - } - } - bytepos++; - break; - } - } - - if (check_interleave == false) - { - // Successfully determined the interleave - m_interleave = calc_interleave; - } - - if (TRACE_CACHE) - { - logerror("%s: MFM HD cache: write back complete (c=%d,h=%d), interleave = %d\n", tag(), current_cylinder, current_head, m_interleave); - } - - return chdstate; -} diff --git a/src/emu/machine/ti99_hd.h b/src/emu/imagedev/mfmhd.h index b004ea7cafb..c15b892423d 100644 --- a/src/emu/machine/ti99_hd.h +++ b/src/emu/imagedev/mfmhd.h @@ -2,43 +2,23 @@ // copyright-holders:Michael Zapf /**************************************************************************** - Hard disk support - See ti99_hd.c for documentation + MFM hard disk emulation - Michael Zapf + See mfmhd.c for documentation - February 2012: Rewritten as class + Michael Zapf + August 2015 *****************************************************************************/ -#ifndef __TI99_HD__ -#define __TI99_HD__ +#ifndef __MFMHD__ +#define __MFMHD__ #include "emu.h" #include "imagedev/harddriv.h" +#include "formats/mfm_hd.h" -/* - Determine how data are passed from the hard disk to the controller. We - allow for different degrees of hardware emulation. -*/ -enum mfmhd_enc_t -{ - MFM_BITS, // One bit at a time - MFM_BYTE, // One data byte with interleaved clock bits - SEPARATED, // 8 clock bits (most sig byte), one data byte (least sig byte) - SEPARATED_SIMPLE // MSB: 00/FF (standard / mark) clock, LSB: one data byte -}; - -class mfmhd_image_format_t; - -// Pointer to its alloc function -typedef mfmhd_image_format_t *(*mfmhd_format_type)(); - -template<class _FormatClass> -mfmhd_image_format_t *mfmhd_image_format_creator() -{ - return new _FormatClass(); -} +class mfm_harddisk_device; class mfmhd_trackimage { @@ -55,31 +35,15 @@ class mfmhd_trackimage_cache public: mfmhd_trackimage_cache(); ~mfmhd_trackimage_cache(); - void init(chd_file* chdfile, const char* tag, int tracksize, int imagecyls, int imageheads, int imagesecpt, int trackslots, mfmhd_enc_t encoding, mfmhd_image_format_t* format); + void init(mfm_harddisk_device* mfmhd, int tracksize, int trackslots); UINT16* get_trackimage(int cylinder, int head); void mark_current_as_dirty(); void cleanup(); void write_back_one(); - int get_cylinders() { return m_cylinders; } private: - chd_file* m_chd; - - const char* m_tagdev; - mfmhd_trackimage* m_tracks; - mfmhd_enc_t m_encoding; - mfmhd_image_format_t* m_format; - - bool m_lastbit; - int m_current_crc; - int m_cylinders; - int m_heads; - int m_sectors_per_track; - int m_sectorsize; - int m_tracksize; - - void showtrack(UINT16* enctrack, int length); - const char* tag() { return m_tagdev; } + mfm_harddisk_device* m_mfmhd; + mfmhd_trackimage* m_tracks; }; class mfm_harddisk_device : public harddisk_image_device, @@ -110,14 +74,11 @@ public: line_state seek_complete_r() { return m_seek_complete? ASSERT_LINE : CLEAR_LINE; } ; line_state trk00_r() { return m_current_cylinder==0? ASSERT_LINE : CLEAR_LINE; } - // Common routine for read/write - bool find_position(attotime &from_when, const attotime &limit, int &bytepos, int &bitpos); - // Data output towards controller bool read(attotime &from_when, const attotime &limit, UINT16 &data); // Data input from controller - bool write(attotime &from_when, const attotime &limit, UINT16 data); + bool write(attotime &from_when, const attotime &limit, UINT16 cdata, bool wpcom=false, bool reduced_wc=false); // Step void step_w(line_state line); @@ -129,9 +90,16 @@ public: bool call_load(); void call_unload(); - // Tells us the time when the track ends (next index pulse) + // Tells us the time when the track ends (next index pulse). Needed by the controller. attotime track_end_time(); + // Access the tracks on the image. Used as a callback from the cache. + chd_error load_track(UINT16* data, int cylinder, int head); + void write_track(UINT16* data, int cylinder, int head); + + // Delivers the number of heads according to the loaded image + int get_actual_heads(); + protected: void device_start(); void device_stop(); @@ -149,7 +117,10 @@ protected: int m_phys_cylinders; int m_actual_cylinders; // after reading the CHD int m_max_heads; - int m_park_pos; + int m_landing_zone; + int m_precomp_cyl; + int m_redwc_cyl; + int m_maxseek_time; int m_seeknext_time; @@ -185,6 +156,9 @@ private: void prepare_track(int cylinder, int head); void head_move(); void recalibrate(); + + // Common routine for read/write + bool find_position(attotime &from_when, const attotime &limit, int &bytepos, int &bitpos); }; /* @@ -261,7 +235,7 @@ extern const device_type MFM_HD_CONNECTOR; _tag = Tag of the connector _slot_intf = Selection of hard drives _def_slot = Default hard drive - _enc = Encoding (see comments in ti99_hd.c) + _enc = Encoding (see comments in mfm_hd.c) _spinupms = Spinup time in milliseconds (some configurations assume that the user has turned on the hard disk before turning on the system. We cannot emulate this, so we allow for shorter times) @@ -273,53 +247,4 @@ extern const device_type MFM_HD_CONNECTOR; static_cast<mfm_harddisk_connector *>(device)->configure(_enc, _spinupms, _cache, _format); -/* - Hard disk format -*/ -class mfmhd_image_format_t -{ -public: - mfmhd_image_format_t(); - virtual ~mfmhd_image_format_t(); - - // Load the image. - virtual chd_error load(const char* tagdev, chd_file* chdfile, UINT16* trackimage, mfmhd_enc_t encoding, int tracksize, int cylinder, int head, int cylcnt, int headcnt, int sect_per_track) = 0; - - // Save the image. - virtual chd_error save(const char* tagdev, chd_file* chdfile, UINT16* trackimage, mfmhd_enc_t encoding, int tracksize, int cylinder, int head, int cylcnt, int headcnt, int sect_per_track) = 0; - - // Return the recent interleave of the image - int get_interleave() { return m_interleave; } - -protected: - bool m_lastbit; - int m_current_crc; - mfmhd_enc_t m_encoding; - const char* m_tagdev; - int m_cylinders; - int m_heads; - int m_sectors_per_track; - int m_interleave; - - void mfm_encode(UINT16* trackimage, int& position, UINT8 byte, int count=1); - void mfm_encode_a1(UINT16* trackimage, int& position); - void mfm_encode_mask(UINT16* trackimage, int& position, UINT8 byte, int count, int mask); - UINT8 mfm_decode(UINT16 raw); - const char* tag() { return m_tagdev; } - void showtrack(UINT16* enctrack, int length); -}; - -class ti99_mfmhd_format : public mfmhd_image_format_t -{ -public: - ti99_mfmhd_format() {}; - chd_error load(const char* tagdev, chd_file* chdfile, UINT16* trackimage, mfmhd_enc_t encoding, int tracksize, int cylinder, int head, int cylcnt, int headcnt, int sect_per_track); - chd_error save(const char* tagdev, chd_file* chdfile, UINT16* trackimage, mfmhd_enc_t encoding, int tracksize, int cylinder, int head, int cylcnt, int headcnt, int sect_per_track); -private: - UINT8 cylinder_to_ident(int cylinder); - int chs_to_lba(int cylinder, int head, int sector); -}; - -extern const mfmhd_format_type MFMHD_TI99_FORMAT; - #endif diff --git a/src/emu/ioport.c b/src/emu/ioport.c index b085104b9b5..1514462e579 100644 --- a/src/emu/ioport.c +++ b/src/emu/ioport.c @@ -2902,12 +2902,11 @@ g_profiler.start(PROFILER_INPUT); ioport_field *mouse_field = NULL; if (mouse_button && mouse_target != NULL) { - const char *tag = NULL; + ioport_port *port = NULL; ioport_value mask; float x, y; - if (mouse_target->map_point_input(mouse_target_x, mouse_target_y, tag, mask, x, y)) + if (mouse_target->map_point_input(mouse_target_x, mouse_target_y, port, mask, x, y)) { - ioport_port *port = machine().root_device().ioport(tag); if (port != NULL) mouse_field = port->field(mask); } @@ -3443,9 +3442,11 @@ void ioport_manager::playback_frame(const attotime &curtime) if (m_playback_file.is_open()) { // first the absolute time - attotime readtime; - playback_read(readtime.seconds); - playback_read(readtime.attoseconds); + seconds_t seconds_temp; + attoseconds_t attoseconds_temp; + playback_read(seconds_temp); + playback_read(attoseconds_temp); + attotime readtime(seconds_temp, attoseconds_temp); if (readtime != curtime) playback_end("Out of sync"); @@ -3582,8 +3583,8 @@ void ioport_manager::record_frame(const attotime &curtime) if (m_record_file.is_open()) { // first the absolute time - record_write(curtime.seconds); - record_write(curtime.attoseconds); + record_write(curtime.seconds()); + record_write(curtime.attoseconds()); // then the current speed record_write(UINT32(machine().video().speed_percent() * double(1 << 20))); diff --git a/src/emu/ioport.h b/src/emu/ioport.h index 4839fe34272..623a3083253 100644 --- a/src/emu/ioport.h +++ b/src/emu/ioport.h @@ -1200,7 +1200,6 @@ public: const char *tag() const { return m_tag.c_str(); } int modcount() const { return m_modcount; } ioport_value active() const { return m_active; } - ioport_value active_safe(ioport_value defval) const { return (this == NULL) ? defval : active(); } ioport_port_live &live() const { assert(m_live != NULL); return *m_live; } // read/write to the port diff --git a/src/emu/machine.c b/src/emu/machine.c index 23991cbe98f..06e112e758d 100644 --- a/src/emu/machine.c +++ b/src/emu/machine.c @@ -275,6 +275,8 @@ void running_machine::start() if ((debug_flags & DEBUG_FLAG_ENABLED) != 0) debugger_init(*this); + m_render->resolve_tags(); + // call the game driver's init function // this is where decryption is done and memory maps are altered // so this location in the init order is important @@ -848,7 +850,7 @@ void running_machine::base_datetime(system_time &systime) void running_machine::current_datetime(system_time &systime) { - systime.set(m_base_time + this->time().seconds); + systime.set(m_base_time + this->time().seconds()); } diff --git a/src/emu/machine/fdc_pll.c b/src/emu/machine/fdc_pll.c index 32df60be493..cf616468a12 100644 --- a/src/emu/machine/fdc_pll.c +++ b/src/emu/machine/fdc_pll.c @@ -5,11 +5,11 @@ std::string fdc_pll_t::tts(attotime t) { char buf[256]; - bool neg = t.seconds < 0; + bool neg = t.seconds() < 0; if(neg) t = attotime::zero - t; - int nsec = t.attoseconds / ATTOSECONDS_PER_NANOSECOND; - sprintf(buf, "%c%3d.%03d,%03d,%03d", neg ? '-' : ' ', int(t.seconds), nsec/1000000, (nsec/1000)%1000, nsec % 1000); + int nsec = t.attoseconds() / ATTOSECONDS_PER_NANOSECOND; + sprintf(buf, "%c%3d.%03d,%03d,%03d", neg ? '-' : ' ', int(t.seconds()), nsec/1000000, (nsec/1000)%1000, nsec % 1000); return buf; } @@ -80,7 +80,7 @@ int fdc_pll_t::get_next_bit(attotime &tm, floppy_image_device *floppy, const att attotime delta = edge - (next - period/2); - if(delta.seconds < 0) + if(delta.seconds() < 0) phase_adjust = attotime::zero - ((attotime::zero - delta)*65)/100; else phase_adjust = (delta*65)/100; diff --git a/src/emu/machine/hdc9234.c b/src/emu/machine/hdc92x4.c index 4247f17aa51..b9be2b36f6c 100644 --- a/src/emu/machine/hdc9234.c +++ b/src/emu/machine/hdc92x4.c @@ -2,26 +2,24 @@ // copyright-holders:Michael Zapf /************************************************************************** - HDC9234 Hard and Floppy Disk Controller + HDC 9224 and HDC 9234 Hard and Floppy Disk Controller Standard Microsystems Corporation (SMC) This controller handles MFM and FM encoded floppy disks and hard disks. - A variant, the HDC9224, is used in some DEC systems. - - The HDC9234 is used in the Myarc HFDC card for the TI99/4A. References: [1] SMC HDC9234 preliminary data book (1988) + [2] SMC HDC9224 data book - The HDC9234 controller is also referred to as the "Universal Disk Controller" (UDC) + The HDC 9224 / 9234 controller is also referred to as the "Universal Disk Controller" (UDC) by the data book - Michael Zapf, July 2015 + Michael Zapf, August 2015 ***************************************************************************/ #include "emu.h" -#include "hdc9234.h" +#include "hdc92x4.h" #include "formats/imageutl.h" // Per-command debugging @@ -410,30 +408,30 @@ enum SUCCESS }; -const hdc9234_device::cmddef hdc9234_device::s_command[] = +const hdc92x4_device::cmddef hdc92x4_device::s_command[] = { - { 0x00, 0xff, &hdc9234_device::reset_controller }, - { 0x01, 0xff, &hdc9234_device::drive_deselect }, - { 0x02, 0xfe, &hdc9234_device::restore_drive }, - { 0x04, 0xfc, &hdc9234_device::step_drive }, - { 0x08, 0xf8, &hdc9234_device::tape_backup }, - { 0x10, 0xf0, &hdc9234_device::poll_drives }, - { 0x20, 0xe0, &hdc9234_device::drive_select }, - { 0x40, 0xf0, &hdc9234_device::set_register_pointer }, - { 0x50, 0xf8, &hdc9234_device::seek_read_id }, - { 0x58, 0xfe, &hdc9234_device::read_sectors }, - { 0x5a, 0xfe, &hdc9234_device::read_track }, - { 0x5c, 0xfc, &hdc9234_device::read_sectors }, - { 0x60, 0xe0, &hdc9234_device::format_track }, - { 0x80, 0x80, &hdc9234_device::write_sectors }, + { 0x00, 0xff, &hdc92x4_device::reset_controller }, + { 0x01, 0xff, &hdc92x4_device::drive_deselect }, + { 0x02, 0xfe, &hdc92x4_device::restore_drive }, + { 0x04, 0xfc, &hdc92x4_device::step_drive }, + { 0x08, 0xf8, &hdc92x4_device::tape_backup }, + { 0x10, 0xf0, &hdc92x4_device::poll_drives }, + { 0x20, 0xe0, &hdc92x4_device::drive_select }, + { 0x40, 0xf0, &hdc92x4_device::set_register_pointer }, + { 0x50, 0xf8, &hdc92x4_device::seek_read_id }, + { 0x58, 0xfe, &hdc92x4_device::read_sectors }, + { 0x5a, 0xfe, &hdc92x4_device::read_track }, + { 0x5c, 0xfc, &hdc92x4_device::read_sectors }, + { 0x60, 0xe0, &hdc92x4_device::format_track }, + { 0x80, 0x80, &hdc92x4_device::write_sectors }, { 0, 0, 0 } }; /* - Standard constructor. + Standard constructor for the base class and the two variants */ -hdc9234_device::hdc9234_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, HDC9234, "SMC HDC9234 Universal Disk Controller", tag, owner, clock, "hdc9234", __FILE__), +hdc92x4_device::hdc92x4_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) + : device_t(mconfig, type, name, tag, owner, clock, shortname, source), m_out_intrq(*this), m_out_dmarq(*this), m_out_dip(*this), @@ -444,10 +442,23 @@ hdc9234_device::hdc9234_device(const machine_config &mconfig, const char *tag, d { } +hdc9224_device::hdc9224_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : hdc92x4_device(mconfig, HDC9224, "SMC HDC9224 Universal Disk Controller", tag, owner, clock, "hdc9224", __FILE__) +{ + m_is_hdc9234 = false; +} + +hdc9234_device::hdc9234_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : hdc92x4_device(mconfig, HDC9234, "SMC HDC9234 Universal Disk Controller", tag, owner, clock, "hdc9234", __FILE__) +{ + m_is_hdc9234 = true; +} + + /* Set or reset some bits. */ -void hdc9234_device::set_bits(UINT8& byte, int mask, bool set) +void hdc92x4_device::set_bits(UINT8& byte, int mask, bool set) { if (set) byte |= mask; else byte &= ~mask; @@ -456,7 +467,7 @@ void hdc9234_device::set_bits(UINT8& byte, int mask, bool set) /* Tell whether the controller is in FM mode. */ -bool hdc9234_device::fm_mode() +bool hdc92x4_device::fm_mode() { return ((m_register_w[MODE]&MO_DENSITY)!=0); } @@ -464,7 +475,7 @@ bool hdc9234_device::fm_mode() /* Are we back on track 0? */ -bool hdc9234_device::on_track00() +bool hdc92x4_device::on_track00() { return (m_register_r[DRIVE_STATUS] & HDC_DS_TRK00)!=0; } @@ -472,7 +483,7 @@ bool hdc9234_device::on_track00() /* Seek completed? */ -bool hdc9234_device::seek_complete() +bool hdc92x4_device::seek_complete() { return (m_register_r[DRIVE_STATUS] & HDC_DS_SKCOM)!=0; } @@ -480,7 +491,7 @@ bool hdc9234_device::seek_complete() /* Index hole? */ -bool hdc9234_device::index_hole() +bool hdc92x4_device::index_hole() { return (m_register_r[DRIVE_STATUS] & HDC_DS_INDEX)!=0; } @@ -488,7 +499,7 @@ bool hdc9234_device::index_hole() /* Drive ready? */ -bool hdc9234_device::drive_ready() +bool hdc92x4_device::drive_ready() { return (m_register_r[DRIVE_STATUS] & HDC_DS_READY)!=0; } @@ -496,7 +507,7 @@ bool hdc9234_device::drive_ready() /* Doing a track read? */ -bool hdc9234_device::reading_track() +bool hdc92x4_device::reading_track() { return (current_command() & 0xfe) == 0x5a; } @@ -511,42 +522,42 @@ bool hdc9234_device::reading_track() This is true for the desired cyl/head, current cyl/head, and the header fields on the track. */ -int hdc9234_device::desired_head() +int hdc92x4_device::desired_head() { return m_register_w[DESIRED_HEAD] & 0x0f; } -int hdc9234_device::desired_cylinder() +int hdc92x4_device::desired_cylinder() { return (m_register_w[DESIRED_CYLINDER] & 0xff) | ((m_register_w[DESIRED_HEAD] & 0x70) << 4); } -int hdc9234_device::desired_sector() +int hdc92x4_device::desired_sector() { return m_register_w[DESIRED_SECTOR] & 0xff; } -int hdc9234_device::current_head() +int hdc92x4_device::current_head() { return m_register_r[CURRENT_HEAD] & 0x0f; } -int hdc9234_device::current_cylinder() +int hdc92x4_device::current_cylinder() { return (m_register_r[CURRENT_CYLINDER] & 0xff) | ((m_register_r[CURRENT_HEAD] & 0x70) << 4); } -int hdc9234_device::current_sector() +int hdc92x4_device::current_sector() { return m_register_r[CURRENT_SECTOR] & 0xff; } -UINT8 hdc9234_device::current_command() +UINT8 hdc92x4_device::current_command() { return m_register_w[COMMAND]; } -bool hdc9234_device::using_floppy() +bool hdc92x4_device::using_floppy() { return (m_selected_drive_type == TYPE_FLOPPY5 || m_selected_drive_type == TYPE_FLOPPY8); } @@ -554,7 +565,7 @@ bool hdc9234_device::using_floppy() /* Delivers the step time (in microseconds) minus the pulse width */ -int hdc9234_device::step_time() +int hdc92x4_device::step_time() { int time = 0; int index = m_register_w[MODE] & MO_STEPRATE; @@ -574,7 +585,7 @@ int hdc9234_device::step_time() /* Delivers the pulse width time (in microseconds) */ -int hdc9234_device::pulse_width() +int hdc92x4_device::pulse_width() { int time = 0; // Get seek time. @@ -593,7 +604,7 @@ int hdc9234_device::pulse_width() /* Delivers the sector size */ -int hdc9234_device::calc_sector_size() +int hdc92x4_device::calc_sector_size() { return 128 << (m_register_r[CURRENT_SIZE] & 3); } @@ -603,26 +614,27 @@ int hdc9234_device::calc_sector_size() // We can wait for a given time period or for a line to be set or cleared // =========================================================================== -void hdc9234_device::wait_time(emu_timer *tm, int microsec, int next_substate) +void hdc92x4_device::wait_time(emu_timer *tm, int microsec, int next_substate) { - if (TRACE_DELAY) logerror("%s: Delay by %d microsec\n", tag(), microsec); - tm->adjust(attotime::from_usec(microsec)); - m_substate = next_substate; + wait_time(tm, attotime::from_usec(microsec), next_substate); } -void hdc9234_device::wait_time(emu_timer *tm, const attotime &delay, int param) +void hdc92x4_device::wait_time(emu_timer *tm, const attotime &delay, int param) { if (TRACE_DELAY) logerror("%s: [%s] Delaying by %4.2f microsecs\n", tag(), ttsn().c_str(), delay.as_double()*1000000); tm->adjust(delay); m_substate = param; + m_state_after_line = UNDEF; + m_timed_wait = true; } /* Set the hook for line level handling */ -void hdc9234_device::wait_line(int line, line_state level, int substate, bool stopwrite) +void hdc92x4_device::wait_line(int line, line_state level, int substate, bool stopwrite) { bool line_at_level = true; + m_timed_wait = false; if (line == SEEKCOMP_LINE && (seek_complete() == (level==ASSERT_LINE))) { @@ -675,7 +687,7 @@ void hdc9234_device::wait_line(int line, line_state level, int substate, bool st (must have saved that value before!) - steps to that location during OUTPUT2 times */ -void hdc9234_device::read_id(int& cont, bool implied_seek, bool wait_seek_complete) +void hdc92x4_device::read_id(int& cont, bool implied_seek, bool wait_seek_complete) { cont = CONTINUE; @@ -795,7 +807,7 @@ void hdc9234_device::read_id(int& cont, bool implied_seek, bool wait_seek_comple contents of the DESIRED_HEAD/CYLINDER/SECTOR registers - checks the CRC */ -void hdc9234_device::verify(int& cont) +void hdc92x4_device::verify(int& cont) { cont = CONTINUE; @@ -909,7 +921,7 @@ void hdc9234_device::verify(int& cont) - transfers the contents of the current sector into memory via DMA (read) or via DMA to the sector (write) */ -void hdc9234_device::data_transfer(int& cont) +void hdc92x4_device::data_transfer(int& cont) { cont = CONTINUE; @@ -1090,7 +1102,7 @@ void hdc9234_device::data_transfer(int& cont) +-----+-----+-----+-----+-----+-----+-----+-----+ */ -void hdc9234_device::reset_controller() +void hdc92x4_device::reset_controller() { logerror("%s: RESET command\n", tag()); device_reset(); @@ -1107,7 +1119,7 @@ void hdc9234_device::reset_controller() | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | +-----+-----+-----+-----+-----+-----+-----+-----+ */ -void hdc9234_device::drive_deselect() +void hdc92x4_device::drive_deselect() { if (TRACE_SELECT) logerror("%s: DESELECT command\n", tag()); m_selected_drive_number = NODRIVE; @@ -1127,7 +1139,7 @@ void hdc9234_device::drive_deselect() | 0 | 0 | 0 | 0 | 0 | 0 | 1 |skcom| +-----+-----+-----+-----+-----+-----+-----+-----+ */ -void hdc9234_device::restore_drive() +void hdc92x4_device::restore_drive() { int cont = CONTINUE; bool buffered_step = current_command() & 1; @@ -1181,7 +1193,7 @@ void hdc9234_device::restore_drive() break; case STEP_ON: - if (TRACE_RESTORE && TRACE_SUBSTATES) logerror("%s: substate STEP_ON\n", tag()); + if (TRACE_RESTORE && TRACE_SUBSTATES) logerror("%s: [%s] substate STEP_ON\n", tag(), ttsn().c_str()); // Increase step count m_seek_count++; @@ -1196,7 +1208,7 @@ void hdc9234_device::restore_drive() break; case STEP_OFF: - if (TRACE_RESTORE && TRACE_SUBSTATES) logerror("%s: substate STEP_OFF\n", tag()); + if (TRACE_RESTORE && TRACE_SUBSTATES) logerror("%s: [%s] substate STEP_OFF\n", tag(), ttsn().c_str()); set_bits(m_output2, OUT2_STEPPULSE, false); wait_time(m_timer, step_time(), RESTORE_CHECK); cont = WAIT; @@ -1231,7 +1243,7 @@ void hdc9234_device::restore_drive() +-----+-----+-----+-----+-----+-----+-----+-----+ */ -void hdc9234_device::step_drive() +void hdc92x4_device::step_drive() { int cont = CONTINUE; @@ -1281,7 +1293,7 @@ void hdc9234_device::step_drive() TAPE BACKUP Not implemented */ -void hdc9234_device::tape_backup() +void hdc92x4_device::tape_backup() { logerror("%s: TAPE BACKUP command %02x not implemented\n", tag(), current_command()); set_command_done(TC_SUCCESS); @@ -1304,7 +1316,7 @@ void hdc9234_device::tape_backup() This command only sets the select lines but does not process parameters like head load times or drive types. */ -void hdc9234_device::poll_drives() +void hdc92x4_device::poll_drives() { UINT8 drivebit = 0; if (m_substate == UNDEF) @@ -1387,7 +1399,7 @@ void hdc9234_device::poll_drives() +-----+-----+-----+-----+-----+-----+-----+-----+ */ -void hdc9234_device::drive_select() +void hdc92x4_device::drive_select() { int cont = CONTINUE; int head_load_delay = 0; @@ -1448,7 +1460,7 @@ void hdc9234_device::drive_select() Sets the pointer to the read and write registers. On read or write accesses, the pointer is increased until it reaches the DATA register. */ -void hdc9234_device::set_register_pointer() +void hdc92x4_device::set_register_pointer() { m_register_pointer = current_command() & 0xf; if (TRACE_SETPTR) logerror("%s: SET REGISTER POINTER command; start reg=%d\n", tag(), m_register_pointer); @@ -1477,7 +1489,7 @@ void hdc9234_device::set_register_pointer() All combinations of flags are legal ([1], p.12). */ -void hdc9234_device::seek_read_id() +void hdc92x4_device::seek_read_id() { if (m_substate == UNDEF) { @@ -1539,7 +1551,7 @@ void hdc9234_device::seek_read_id() +-----+-----+-----+-----+-----+--------+------+------+ */ -void hdc9234_device::read_sectors() +void hdc92x4_device::read_sectors() { m_logical = (current_command() & 0x04)!=0; @@ -1593,7 +1605,7 @@ void hdc9234_device::read_sectors() +-----+-----+-----+-----+-----+-----+-----+------+ */ -void hdc9234_device::read_track() +void hdc92x4_device::read_track() { if (m_substate == UNDEF) { @@ -1698,16 +1710,16 @@ void hdc9234_device::read_track() 7 6 5 4 3 2 1 0 +-----+-----+-----+------+-----+-----+-----+------+ - | 0 | 1 | 1 |Normal|RedWC| Precompensation | + | 0 | 1 | 1 |DelMrk|RedWC| Precompensation | +-----+-----+-----+------+-----+-----+-----+------+ */ -void hdc9234_device::format_track() +void hdc92x4_device::format_track() { if (m_substate == UNDEF) { if (TRACE_FORMAT) logerror("%s: FORMAT TRACK command %02x, head = %d\n", tag(), current_command(), desired_head()); m_substate = WAITINDEX0; - m_deleted = (current_command() & 0x10)==0; + m_deleted = (current_command() & 0x10)!=0; m_reduced_write_current = (current_command() & 0x08)!=0; m_precompensation = (current_command() & 0x07); m_write = true; @@ -1793,13 +1805,10 @@ void hdc9234_device::format_track() 7 6 5 4 3 2 1 0 +-----+------+-------+------+-----+-----+-----+------+ - | 1 |NoSeek|Logical|Normal|RedWC| Precompensation | + | 1 |NoSeek|Logical|DelMrk|RedWC| Precompensation | +-----+------+-------+------+-----+-----+-----+------+ - - Write physical: typical value 11000000 - Write logical : typical value 10110000 */ -void hdc9234_device::write_sectors() +void hdc92x4_device::write_sectors() { m_logical = (current_command() & 0x20)!=0; @@ -1809,7 +1818,7 @@ void hdc9234_device::write_sectors() m_multi_sector = (m_register_w[SECTOR_COUNT] != 1); m_substate = READ_ID; - m_deleted = (current_command() & 0x10)==0; + m_deleted = (current_command() & 0x10)!=0; m_reduced_write_current = (current_command() & 0x08)!=0; m_precompensation = (current_command() & 0x07); // Important for DATA TRANSFER @@ -1880,20 +1889,20 @@ void hdc9234_device::write_sectors() =========================================================================== */ -std::string hdc9234_device::tts(const attotime &t) +std::string hdc92x4_device::tts(const attotime &t) { char buf[256]; - int nsec = t.attoseconds / ATTOSECONDS_PER_NANOSECOND; - sprintf(buf, "%4d.%03d,%03d,%03d", int(t.seconds), nsec/1000000, (nsec/1000)%1000, nsec % 1000); + int nsec = t.attoseconds() / ATTOSECONDS_PER_NANOSECOND; + sprintf(buf, "%4d.%03d,%03d,%03d", int(t.seconds()), nsec/1000000, (nsec/1000)%1000, nsec % 1000); return buf; } -std::string hdc9234_device::ttsn() +std::string hdc92x4_device::ttsn() { return tts(machine().time()); } -bool hdc9234_device::found_mark(int state) +bool hdc92x4_device::found_mark(int state) { bool ismark = false; if (using_floppy()) @@ -1930,7 +1939,7 @@ bool hdc9234_device::found_mark(int state) The controller starts to read bits from the disk. This method takes an argument for the state machine called at the end. */ -void hdc9234_device::live_start(int state) +void hdc92x4_device::live_start(int state) { if (TRACE_LIVE) logerror("%s: [%s] Live start substate=%02x\n", tag(), ttsn().c_str(), state); m_live_state.time = machine().time(); @@ -1956,7 +1965,7 @@ void hdc9234_device::live_start(int state) if (TRACE_LIVE) logerror("%s: [%s] Live start end\n", tag(), ttsn().c_str()); // delete } -void hdc9234_device::live_run() +void hdc92x4_device::live_run() { if (using_floppy()) live_run_until(attotime::never); else live_run_hd_until(attotime::never); @@ -1970,7 +1979,7 @@ void hdc9234_device::live_run() THIS IS THE FLOPPY-ONLY LIVE_RUN */ -void hdc9234_device::live_run_until(attotime limit) +void hdc92x4_device::live_run_until(attotime limit) { int slot = 0; @@ -2504,9 +2513,9 @@ void hdc9234_device::live_run_until(attotime limit) write_on_track(encode((m_live_state.crc >> 8) & 0xff), 1, WRITE_DATA_CRC); } else - // Write a filler byte so that the last CRC bit is saved correctly (why actually?) - // write_on_track(encode(0xff), 1, WRITE_DONE); - m_live_state.state = WRITE_DONE; + // Write a filler byte so that the last CRC bit is saved correctly + // Without, the last bit of the CRC value may be flipped + write_on_track(encode(0xff), 1, WRITE_DONE); break; @@ -2801,7 +2810,7 @@ void hdc9234_device::live_run_until(attotime limit) [1], section "Drive select", table This is currently unsupported; hard disks are forced to MFM */ -void hdc9234_device::live_run_hd_until(attotime limit) +void hdc92x4_device::live_run_hd_until(attotime limit) { int slot = 0; if (TRACE_LIVE) logerror("%s: live_run_hd\n", tag()); @@ -3402,7 +3411,7 @@ void hdc9234_device::live_run_hd_until(attotime limit) Results in a new checkpoint and a live position at machine time or behind. As a side effect, portions of the track may be re-read */ -void hdc9234_device::live_sync() +void hdc92x4_device::live_sync() { // Do we have some time set? if (!m_live_state.time.is_never()) @@ -3454,7 +3463,7 @@ void hdc9234_device::live_sync() } } -void hdc9234_device::live_abort() +void hdc92x4_device::live_abort() { if (!m_live_state.time.is_never() && m_live_state.time > machine().time()) { @@ -3475,7 +3484,7 @@ void hdc9234_device::live_abort() comprised by WRITE_TRACK_(NEXT_)BYTE Arguments: byte to be written, number, state on return */ -void hdc9234_device::write_on_track(UINT16 encoded, int repeat, int next_state) +void hdc92x4_device::write_on_track(UINT16 encoded, int repeat, int next_state) { m_live_state.repeat = repeat; m_live_state.state = WRITE_TRACK_BYTE; @@ -3488,7 +3497,7 @@ void hdc9234_device::write_on_track(UINT16 encoded, int repeat, int next_state) only intended for skipping bytes. Arguments: number, state on return */ -void hdc9234_device::skip_on_track(int repeat, int next_state) +void hdc92x4_device::skip_on_track(int repeat, int next_state) { m_live_state.bit_counter = 0; m_live_state.repeat = repeat; @@ -3496,7 +3505,7 @@ void hdc9234_device::skip_on_track(int repeat, int next_state) m_live_state.return_state = next_state; } -UINT8 hdc9234_device::get_data_from_encoding(UINT16 raw) +UINT8 hdc92x4_device::get_data_from_encoding(UINT16 raw) { unsigned int value = 0; @@ -3511,7 +3520,7 @@ UINT8 hdc9234_device::get_data_from_encoding(UINT16 raw) return (value >> 14) & 0xff; } -void hdc9234_device::rollback() +void hdc92x4_device::rollback() { m_live_state = m_checkpoint_state; m_pll = m_checkpoint_pll; @@ -3521,7 +3530,7 @@ void hdc9234_device::rollback() Wait for real time to catch up. This way we pretend that the last operation actually needed the real time. */ -void hdc9234_device::wait_for_realtime(int state) +void hdc92x4_device::wait_for_realtime(int state) { m_live_state.next_state = state; m_timer->adjust(m_live_state.time - machine().time()); @@ -3535,7 +3544,7 @@ void hdc9234_device::wait_for_realtime(int state) rightmost bit; the shift register is a member of m_live_state. Also, the CRC is updated. */ -bool hdc9234_device::read_one_bit(const attotime &limit) +bool hdc92x4_device::read_one_bit(const attotime &limit) { // Get the next bit from the phase-locked loop. int bit = m_pll.get_next_bit(m_live_state.time, m_floppy, limit); @@ -3549,7 +3558,7 @@ bool hdc9234_device::read_one_bit(const attotime &limit) // value < 100: big trouble for controller, will fail if (UNRELIABLE_MEDIA) { - if ((machine().time().attoseconds % 1009)==0) bit = 0; + if ((machine().time().attoseconds() % 1009)==0) bit = 0; } // Push into shift register @@ -3574,7 +3583,7 @@ bool hdc9234_device::read_one_bit(const attotime &limit) return false; } -bool hdc9234_device::write_one_bit(const attotime &limit) +bool hdc92x4_device::write_one_bit(const attotime &limit) { bool bit = (m_live_state.shift_reg & 0x8000)!=0; @@ -3594,7 +3603,7 @@ bool hdc9234_device::write_one_bit(const attotime &limit) return false; } -UINT16 hdc9234_device::encode(UINT8 byte) +UINT16 hdc92x4_device::encode(UINT8 byte) { UINT16 raw; UINT8 check_pos; @@ -3640,12 +3649,12 @@ UINT16 hdc9234_device::encode(UINT8 byte) return raw; } -void hdc9234_device::encode_again() +void hdc92x4_device::encode_again() { encode_raw(m_live_state.shift_reg_save); } -void hdc9234_device::encode_raw(UINT16 raw) +void hdc92x4_device::encode_raw(UINT16 raw) { m_live_state.bit_counter = 16; m_live_state.shift_reg = m_live_state.shift_reg_save = raw; @@ -3662,7 +3671,7 @@ void hdc9234_device::encode_raw(UINT16 raw) When writing, the controller generates the proper output bitstream, so we have to set it from its own state (fm/mfm and device type). */ -void hdc9234_device::pll_reset(const attotime &when, bool output) +void hdc92x4_device::pll_reset(const attotime &when, bool output) { m_pll.reset(when); @@ -3677,7 +3686,7 @@ void hdc9234_device::pll_reset(const attotime &when, bool output) m_pll.set_clock(attotime::from_nsec(8000 >> (~m_clock_divider & 0x03))); } -void hdc9234_device::checkpoint() +void hdc92x4_device::checkpoint() { // Commit bits from pll buffer to disk until live time (if there is something to write) // For HD we do not use a PLL in this implementation @@ -3700,7 +3709,7 @@ void hdc9234_device::checkpoint() Updates the CRC and the shift register. Also, the time is updated. */ -bool hdc9234_device::read_from_mfmhd(const attotime &limit) +bool hdc92x4_device::read_from_mfmhd(const attotime &limit) { UINT16 data = 0; bool offlimit = m_harddisk->read(m_live_state.time, limit, data); @@ -3768,7 +3777,7 @@ bool hdc9234_device::read_from_mfmhd(const attotime &limit) Return false: valid return Updates the CRC and the shift register. Also, the time is updated. */ -bool hdc9234_device::write_to_mfmhd(const attotime &limit) +bool hdc92x4_device::write_to_mfmhd(const attotime &limit) { UINT16 data = 0; int count; @@ -3785,7 +3794,7 @@ bool hdc9234_device::write_to_mfmhd(const attotime &limit) data = m_live_state.shift_reg; count = 16; } - offlimit = m_harddisk->write(m_live_state.time, limit, data); + offlimit = m_harddisk->write(m_live_state.time, limit, data, m_precompensation != 0, m_reduced_write_current); if (offlimit) return true; m_live_state.bit_counter -= count; @@ -3811,7 +3820,7 @@ bool hdc9234_device::write_to_mfmhd(const attotime &limit) return false; } -UINT16 hdc9234_device::encode_hd(UINT8 byte) +UINT16 hdc92x4_device::encode_hd(UINT8 byte) { UINT16 cells; UINT8 check_pos; @@ -3855,7 +3864,7 @@ UINT16 hdc9234_device::encode_hd(UINT8 byte) return cells; } -UINT16 hdc9234_device::encode_a1_hd() +UINT16 hdc92x4_device::encode_a1_hd() { UINT16 cells = 0; @@ -3886,7 +3895,7 @@ UINT16 hdc9234_device::encode_a1_hd() Read a byte of data from the controller The address (offset) encodes the C/D* line (command and /data) */ -READ8_MEMBER( hdc9234_device::read ) +READ8_MEMBER( hdc92x4_device::read ) { UINT8 reply = 0; @@ -3922,7 +3931,7 @@ READ8_MEMBER( hdc9234_device::read ) The operation terminates immediately, and the controller picks up the values stored in this phase at a later time. */ -WRITE8_MEMBER( hdc9234_device::write ) +WRITE8_MEMBER( hdc92x4_device::write ) { if ((offset & 1) == 0) { @@ -3946,7 +3955,7 @@ WRITE8_MEMBER( hdc9234_device::write ) /* When the commit period has passed, process the command or register access */ -void hdc9234_device::process_command() +void hdc92x4_device::process_command() { if (m_substate == REGISTER_ACCESS) { @@ -4006,7 +4015,7 @@ void hdc9234_device::process_command() auxbus_out(); } -void hdc9234_device::reenter_command_processing() +void hdc92x4_device::reenter_command_processing() { if (TRACE_DELAY) logerror("%s: Re-enter command processing; live state = %02x\n", tag(), m_live_state.state); // Do we have a live run on the track? @@ -4028,7 +4037,7 @@ void hdc9234_device::reenter_command_processing() /* Assert Command Done status bit, triggering interrupts as needed */ -void hdc9234_device::set_command_done(int flags) +void hdc92x4_device::set_command_done(int flags) { // Do another output, then set the flag auxbus_out(); @@ -4057,7 +4066,7 @@ void hdc9234_device::set_command_done(int flags) /* Preserve previously set termination code */ -void hdc9234_device::set_command_done() +void hdc92x4_device::set_command_done() { set_command_done(-1); } @@ -4065,7 +4074,7 @@ void hdc9234_device::set_command_done() /* Auxiliary bus operation. - The auxbus of the HDC9234 is used to poll the drive status of the cur- + The auxbus of the HDC92x4 is used to poll the drive status of the cur- rently selected drive, to transmit DMA address bytes, to output the OUTPUT1 register, and to output the OUTPUT2 register. @@ -4108,7 +4117,7 @@ void hdc9234_device::set_command_done() Read the drive status over the auxbus (as said, let the controller board push the values into the controller) */ -void hdc9234_device::auxbus_in(UINT8 data) +void hdc92x4_device::auxbus_in(UINT8 data) { // Kill unwanted input via auxbus until we are initialized. if (!m_initialized) @@ -4133,12 +4142,12 @@ void hdc9234_device::auxbus_in(UINT8 data) if (prevskcom != seek_complete()) seek_complete_handler(); } -bool hdc9234_device::waiting_for_line(int line, int level) +bool hdc92x4_device::waiting_for_line(int line, int level) { return (m_event_line == line && m_state_after_line != UNDEF && m_line_level == level); } -bool hdc9234_device::waiting_for_other_line(int line) +bool hdc92x4_device::waiting_for_other_line(int line) { return (m_state_after_line != UNDEF && m_event_line != line); } @@ -4146,7 +4155,7 @@ bool hdc9234_device::waiting_for_other_line(int line) /* Handlers for incoming signal lines. */ -void hdc9234_device::index_handler() +void hdc92x4_device::index_handler() { int level = index_hole()? ASSERT_LINE : CLEAR_LINE; if (TRACE_LINES) logerror("%s: [%s] Index handler; level=%d\n", tag(), ttsn().c_str(), level); @@ -4176,12 +4185,12 @@ void hdc9234_device::index_handler() { // Live processing waits for INDEX // For harddisk we will continue processing on the falling edge - if (!waiting_for_other_line(INDEX_LINE) && (using_floppy() || level == CLEAR_LINE)) + if (!m_timed_wait && !waiting_for_other_line(INDEX_LINE) && (using_floppy() || level == CLEAR_LINE)) reenter_command_processing(); } } -void hdc9234_device::ready_handler() +void hdc92x4_device::ready_handler() { int level = drive_ready()? ASSERT_LINE : CLEAR_LINE; if (TRACE_LINES) logerror("%s: [%s] Ready handler; level=%d\n", tag(), ttsn().c_str(), level); @@ -4208,7 +4217,7 @@ void hdc9234_device::ready_handler() } } -void hdc9234_device::seek_complete_handler() +void hdc92x4_device::seek_complete_handler() { int level = seek_complete()? ASSERT_LINE : CLEAR_LINE; if (TRACE_LINES) logerror("%s: [%s] Seek complete handler; level=%d\n", tag(), ttsn().c_str(), level); @@ -4250,7 +4259,7 @@ void hdc9234_device::seek_complete_handler() Step = Step pulse Head = desired head */ -void hdc9234_device::auxbus_out() +void hdc92x4_device::auxbus_out() { // prepare output2 set_bits(m_output2, OUT2_DRVSEL3I, (m_output1 & OUT1_DRVSEL3)==0); @@ -4270,7 +4279,7 @@ void hdc9234_device::auxbus_out() } } -void hdc9234_device::dma_address_out(UINT8 addrub, UINT8 addrhb, UINT8 addrlb) +void hdc92x4_device::dma_address_out(UINT8 addrub, UINT8 addrhb, UINT8 addrlb) { if (TRACE_DMA) logerror("%s: Setting DMA address %06x\n", tag(), (addrub<<16 | addrhb<<8 | addrlb)&0xffffff); m_out_auxbus((offs_t)HDC_OUTPUT_DMA_ADDR, addrub); @@ -4286,7 +4295,7 @@ void hdc9234_device::dma_address_out(UINT8 addrub, UINT8 addrhb, UINT8 addrlb) - when the READY_CHANGE bit is set to 1 in the ISR and ST_RDYCHNG is set to 1 (ready change: 1->0 or 0->1) */ -void hdc9234_device::set_interrupt(line_state intr) +void hdc92x4_device::set_interrupt(line_state intr) { if (intr == ASSERT_LINE) { @@ -4308,7 +4317,7 @@ void hdc9234_device::set_interrupt(line_state intr) /* DMA acknowledge line. */ -WRITE_LINE_MEMBER( hdc9234_device::dmaack ) +WRITE_LINE_MEMBER( hdc92x4_device::dmaack ) { if (state==ASSERT_LINE) { @@ -4321,7 +4330,7 @@ WRITE_LINE_MEMBER( hdc9234_device::dmaack ) This is pretty simple here, compared to wd17xx, because index and ready callbacks have to be tied to the controller board outside the chip. */ -void hdc9234_device::connect_floppy_drive(floppy_image_device* floppy) +void hdc92x4_device::connect_floppy_drive(floppy_image_device* floppy) { m_floppy = floppy; } @@ -4329,7 +4338,7 @@ void hdc9234_device::connect_floppy_drive(floppy_image_device* floppy) /* Connect the current hard drive. */ -void hdc9234_device::connect_hard_drive(mfm_harddisk_device* harddisk) +void hdc92x4_device::connect_hard_drive(mfm_harddisk_device* harddisk) { m_harddisk = harddisk; m_hd_encoding = m_harddisk->get_encoding(); @@ -4342,7 +4351,7 @@ void hdc9234_device::connect_hard_drive(mfm_harddisk_device* harddisk) at some time and make it a device of its own. line: CD0 (0) and CD1(1), value 0 or 1 */ -void hdc9234_device::set_clock_divider(int line, int value) +void hdc92x4_device::set_clock_divider(int line, int value) { set_bits(m_clock_divider, (line==0)? 1 : 2, value&1); } @@ -4350,9 +4359,10 @@ void hdc9234_device::set_clock_divider(int line, int value) /* This is reached when a timer has expired */ -void hdc9234_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +void hdc92x4_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { live_sync(); + m_timed_wait = false; switch (id) { @@ -4362,16 +4372,13 @@ void hdc9234_device::device_timer(emu_timer &timer, device_timer_id id, int para case COM_TIMER: process_command(); break; - /* case LIVE_TIMER: - live_run(); - break; */ } } /* Reset the controller. Negative logic, but we use ASSERT_LINE. */ -WRITE_LINE_MEMBER( hdc9234_device::reset ) +WRITE_LINE_MEMBER( hdc92x4_device::reset ) { if (state == ASSERT_LINE) { @@ -4380,7 +4387,7 @@ WRITE_LINE_MEMBER( hdc9234_device::reset ) } } -void hdc9234_device::device_start() +void hdc92x4_device::device_start() { m_out_intrq.resolve_safe(); m_out_dip.resolve_safe(); @@ -4397,7 +4404,7 @@ void hdc9234_device::device_start() m_live_state.state = IDLE; } -void hdc9234_device::device_reset() +void hdc92x4_device::device_reset() { m_clock_divider = 0; m_deleted = false; @@ -4425,6 +4432,7 @@ void hdc9234_device::device_reset() m_state_after_line = UNDEF; m_stop_after_index = false; m_substate = UNDEF; + m_timed_wait = false; m_track_delta = 0; m_transfer_enabled = true; m_wait_for_index = false; @@ -4438,4 +4446,5 @@ void hdc9234_device::device_reset() m_out_dmarq(CLEAR_LINE); } +const device_type HDC9224 = &device_creator<hdc9224_device>; const device_type HDC9234 = &device_creator<hdc9234_device>; diff --git a/src/emu/machine/hdc9234.h b/src/emu/machine/hdc92x4.h index 5398e32a099..da3c5b6d954 100644 --- a/src/emu/machine/hdc9234.h +++ b/src/emu/machine/hdc92x4.h @@ -1,17 +1,18 @@ // license:BSD-3-Clause // copyright-holders:Michael Zapf /* - HDC9234 Hard and Floppy Disk Controller - For details see hdc9234.c + HDC9224 / HDC9234 Hard and Floppy Disk Controller + For details see hdc92x4.c */ -#ifndef __HDC9234_H__ -#define __HDC9234_H__ +#ifndef __HDC92X4_H__ +#define __HDC92X4_H__ #include "emu.h" #include "imagedev/floppy.h" +#include "imagedev/mfmhd.h" #include "fdc_pll.h" -#include "ti99_hd.h" +extern const device_type HDC9224; extern const device_type HDC9234; /* @@ -44,41 +45,41 @@ enum //=================================================================== /* Interrupt line. To be connected with the controller PCB. */ -#define MCFG_HDC9234_INTRQ_CALLBACK(_write) \ - devcb = &hdc9234_device::set_intrq_wr_callback(*device, DEVCB_##_write); +#define MCFG_HDC92X4_INTRQ_CALLBACK(_write) \ + devcb = &hdc92x4_device::set_intrq_wr_callback(*device, DEVCB_##_write); /* DMA request line. To be connected with the controller PCB. */ -#define MCFG_HDC9234_DMARQ_CALLBACK(_write) \ - devcb = &hdc9234_device::set_dmarq_wr_callback(*device, DEVCB_##_write); +#define MCFG_HDC92X4_DMARQ_CALLBACK(_write) \ + devcb = &hdc92x4_device::set_dmarq_wr_callback(*device, DEVCB_##_write); /* DMA in progress line. To be connected with the controller PCB. */ -#define MCFG_HDC9234_DIP_CALLBACK(_write) \ - devcb = &hdc9234_device::set_dip_wr_callback(*device, DEVCB_##_write); +#define MCFG_HDC92X4_DIP_CALLBACK(_write) \ + devcb = &hdc92x4_device::set_dip_wr_callback(*device, DEVCB_##_write); /* Auxiliary Bus. These 8 lines need to be connected to external latches and to a counter circuitry which works together with the external RAM. We use the S0/S1 lines as address lines. */ -#define MCFG_HDC9234_AUXBUS_OUT_CALLBACK(_write) \ - devcb = &hdc9234_device::set_auxbus_wr_callback(*device, DEVCB_##_write); +#define MCFG_HDC92X4_AUXBUS_OUT_CALLBACK(_write) \ + devcb = &hdc92x4_device::set_auxbus_wr_callback(*device, DEVCB_##_write); /* Callback to read the contents of the external RAM via the data bus. Note that the address must be set and automatically increased by external circuitry. */ -#define MCFG_HDC9234_DMA_IN_CALLBACK(_read) \ - devcb = &hdc9234_device::set_dma_rd_callback(*device, DEVCB_##_read); +#define MCFG_HDC92X4_DMA_IN_CALLBACK(_read) \ + devcb = &hdc92x4_device::set_dma_rd_callback(*device, DEVCB_##_read); /* Callback to write the contents of the external RAM via the data bus. Note that the address must be set and automatically increased by external circuitry. */ -#define MCFG_HDC9234_DMA_OUT_CALLBACK(_write) \ - devcb = &hdc9234_device::set_dma_wr_callback(*device, DEVCB_##_write); +#define MCFG_HDC92X4_DMA_OUT_CALLBACK(_write) \ + devcb = &hdc92x4_device::set_dma_wr_callback(*device, DEVCB_##_write); //=================================================================== -class hdc9234_device : public device_t +class hdc92x4_device : public device_t { public: - hdc9234_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + hdc92x4_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); // Accesors from the CPU side DECLARE_READ8_MEMBER( read ); @@ -87,12 +88,12 @@ public: DECLARE_WRITE_LINE_MEMBER( dmaack ); // Callbacks - template<class _Object> static devcb_base &set_intrq_wr_callback(device_t &device, _Object object) { return downcast<hdc9234_device &>(device).m_out_intrq.set_callback(object); } - template<class _Object> static devcb_base &set_dmarq_wr_callback(device_t &device, _Object object) { return downcast<hdc9234_device &>(device).m_out_dmarq.set_callback(object); } - template<class _Object> static devcb_base &set_dip_wr_callback(device_t &device, _Object object) { return downcast<hdc9234_device &>(device).m_out_dip.set_callback(object); } - template<class _Object> static devcb_base &set_auxbus_wr_callback(device_t &device, _Object object) { return downcast<hdc9234_device &>(device).m_out_auxbus.set_callback(object); } - template<class _Object> static devcb_base &set_dma_rd_callback(device_t &device, _Object object) { return downcast<hdc9234_device &>(device).m_in_dma.set_callback(object); } - template<class _Object> static devcb_base &set_dma_wr_callback(device_t &device, _Object object) { return downcast<hdc9234_device &>(device).m_out_dma.set_callback(object); } + template<class _Object> static devcb_base &set_intrq_wr_callback(device_t &device, _Object object) { return downcast<hdc92x4_device &>(device).m_out_intrq.set_callback(object); } + template<class _Object> static devcb_base &set_dmarq_wr_callback(device_t &device, _Object object) { return downcast<hdc92x4_device &>(device).m_out_dmarq.set_callback(object); } + template<class _Object> static devcb_base &set_dip_wr_callback(device_t &device, _Object object) { return downcast<hdc92x4_device &>(device).m_out_dip.set_callback(object); } + template<class _Object> static devcb_base &set_auxbus_wr_callback(device_t &device, _Object object) { return downcast<hdc92x4_device &>(device).m_out_auxbus.set_callback(object); } + template<class _Object> static devcb_base &set_dma_rd_callback(device_t &device, _Object object) { return downcast<hdc92x4_device &>(device).m_in_dma.set_callback(object); } + template<class _Object> static devcb_base &set_dma_wr_callback(device_t &device, _Object object) { return downcast<hdc92x4_device &>(device).m_out_dma.set_callback(object); } // auxbus_in is intended to read events from the drives // In the real chip the status is polled; to avoid unnecessary load @@ -117,7 +118,8 @@ protected: void device_start(); void device_reset(); -private: + bool m_is_hdc9234; + devcb_write_line m_out_intrq; // INT line devcb_write_line m_out_dmarq; // DMA request line devcb_write_line m_out_dip; // DMA in progress line @@ -202,6 +204,7 @@ private: line_state m_line_level; int m_event_line; int m_state_after_line; + bool m_timed_wait; // ============================================== // Live state machine @@ -308,7 +311,7 @@ private: int m_substate; - typedef void (hdc9234_device::*cmdfunc)(void); + typedef void (hdc92x4_device::*cmdfunc)(void); typedef struct { @@ -465,4 +468,20 @@ private: void write_sectors(); }; +// ===================================================== +// Subclasses: the two variants +// ===================================================== + +class hdc9224_device : public hdc92x4_device +{ +public: + hdc9224_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +class hdc9234_device : public hdc92x4_device +{ +public: + hdc9234_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + #endif diff --git a/src/emu/machine/intelfsh.c b/src/emu/machine/intelfsh.c index fa5a6abfdbd..b7e6e00601e 100644 --- a/src/emu/machine/intelfsh.c +++ b/src/emu/machine/intelfsh.c @@ -93,6 +93,7 @@ const device_type FUJITSU_29DL16X = &device_creator<fujitsu_29dl16x_device>; const device_type INTEL_E28F400B = &device_creator<intel_e28f400b_device>; const device_type MACRONIX_29L001MC = &device_creator<macronix_29l001mc_device>; const device_type MACRONIX_29LV160TMC = &device_creator<macronix_29lv160tmc_device>; +const device_type TMS_29F040 = &device_creator<tms_29f040_device>; const device_type PANASONIC_MN63F805MNP = &device_creator<panasonic_mn63f805mnp_device>; const device_type SANYO_LE26FV10N1TS = &device_creator<sanyo_le26fv10n1ts_device>; @@ -166,6 +167,7 @@ intelfsh_device::intelfsh_device(const machine_config &mconfig, device_type type m_type(variant), m_size(0), m_bits(8), + m_addrmask(0), m_device_id(0), m_maker_id(0), m_sector_is_4k(false), @@ -215,6 +217,7 @@ intelfsh_device::intelfsh_device(const machine_config &mconfig, device_type type case FLASH_AMD_29F080: m_bits = 8; m_size = 0x100000; + m_addrmask = 0x7ff; m_maker_id = MFG_AMD; m_device_id = 0xd5; map = ADDRESS_MAP_NAME( memory_map8_8Mb ); @@ -369,6 +372,14 @@ intelfsh_device::intelfsh_device(const machine_config &mconfig, device_type type m_device_id = 0x04; map = ADDRESS_MAP_NAME( memory_map8_4Mb ); break; + case FLASH_TMS_29F040: + m_bits = 8; + m_addrmask = 0x7fff; + m_size = 0x80000; + m_maker_id = MFG_AMD; + m_device_id = 0xa4; + map = ADDRESS_MAP_NAME( memory_map8_4Mb ); + break; } int addrbits; @@ -465,6 +476,10 @@ intel_28f320j5_device::intel_28f320j5_device(const machine_config &mconfig, cons sst_39vf400a_device::sst_39vf400a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : intelfsh16_device(mconfig, SST_39VF400A, "SST 39VF400A Flash", tag, owner, clock, FLASH_SST_39VF400A, "sst_39vf400a", __FILE__) { } + +tms_29f040_device::tms_29f040_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : intelfsh8_device(mconfig, TMS_29F040, "Texas Instruments 29F040 Flash", tag, owner, clock, FLASH_TMS_29F040, "tms_29f040", __FILE__) { } + //------------------------------------------------- // device_start - device-specific startup //------------------------------------------------- @@ -761,7 +776,8 @@ void intelfsh_device::write_full(UINT32 address, UINT32 data) { m_flash_mode = FM_READAMDID2; } - else if( ( address & 0x7ff ) == 0x2aa && ( data & 0xff ) == 0x55 && m_type == FLASH_AMD_29F080 ) + // for AMD 29F080 address bits A11-A19 don't care, for TMS 29F040 address bits A15-A18 don't care + else if( ( address & m_addrmask ) == ( 0xaaaa & m_addrmask ) && ( data & 0xff ) == 0x55 && m_addrmask ) { m_flash_mode = FM_READAMDID2; } @@ -833,20 +849,20 @@ void intelfsh_device::write_full(UINT32 address, UINT32 data) m_flash_mode = FM_BANKSELECT; } - // for AMD 29F080 address bits A11-A19 don't care - else if(( address & 0x7ff ) == 0x555 && ( data & 0xff ) == 0x80 && m_type == FLASH_AMD_29F080 ) + // for AMD 29F080 address bits A11-A19 don't care, for TMS 29F040 address bits A15-A18 don't care + else if(( address & m_addrmask ) == ( 0x5555 & m_addrmask ) && ( data & 0xff ) == 0x80 && m_addrmask ) { m_flash_mode = FM_ERASEAMD1; } - else if(( address & 0x7ff ) == 0x555 && ( data & 0xff ) == 0x90 && m_type == FLASH_AMD_29F080 ) + else if(( address & m_addrmask ) == ( 0x5555 & m_addrmask ) && ( data & 0xff ) == 0x90 && m_addrmask ) { m_flash_mode = FM_READAMDID3; } - else if(( address & 0x7ff ) == 0x555 && ( data & 0xff ) == 0xa0 && m_type == FLASH_AMD_29F080 ) + else if(( address & m_addrmask ) == ( 0x5555 & m_addrmask ) && ( data & 0xff ) == 0xa0 && m_addrmask ) { m_flash_mode = FM_BYTEPROGRAM; } - else if(( address & 0x7ff ) == 0x555 && ( data & 0xff ) == 0xf0 && m_type == FLASH_AMD_29F080 ) + else if(( address & m_addrmask ) == ( 0x5555 & m_addrmask ) && ( data & 0xff ) == 0xf0 && m_addrmask ) { m_flash_mode = FM_NORMAL; } diff --git a/src/emu/machine/intelfsh.h b/src/emu/machine/intelfsh.h index 1dbaab76fea..5e4b86f10d2 100644 --- a/src/emu/machine/intelfsh.h +++ b/src/emu/machine/intelfsh.h @@ -90,6 +90,9 @@ #define MCFG_SST_39VF400A_ADD(_tag) \ MCFG_DEVICE_ADD(_tag, SST_39VF400A, 0) +#define MCFG_TMS_29F040_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, TMS_29F040, 0) + //************************************************************************** // TYPE DEFINITIONS //************************************************************************** @@ -126,6 +129,7 @@ public: FLASH_SANYO_LE26FV10N1TS, FLASH_SST_28SF040, FLASH_SST_39VF020, + FLASH_TMS_29F040, // 16-bit variants FLASH_SHARP_LH28F400 = 0x1000, @@ -163,6 +167,7 @@ protected: UINT32 m_type; INT32 m_size; UINT8 m_bits; + UINT32 m_addrmask; UINT16 m_device_id; UINT8 m_maker_id; bool m_sector_is_4k; @@ -338,6 +343,12 @@ public: sst_39vf020_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); }; +class tms_29f040_device : public intelfsh8_device +{ +public: + tms_29f040_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + // 16-bit variants class sharp_lh28f400_device : public intelfsh16_device { @@ -398,6 +409,7 @@ extern const device_type FUJITSU_29DL16X; extern const device_type INTEL_E28F400B; extern const device_type MACRONIX_29L001MC; extern const device_type MACRONIX_29LV160TMC; +extern const device_type TMS_29F040; extern const device_type PANASONIC_MN63F805MNP; extern const device_type SANYO_LE26FV10N1TS; diff --git a/src/emu/machine/jvsdev.c b/src/emu/machine/jvsdev.c index 204d874ca9a..3357ce90f55 100644 --- a/src/emu/machine/jvsdev.c +++ b/src/emu/machine/jvsdev.c @@ -244,7 +244,7 @@ bool jvs_device::swoutputs(UINT8 id, UINT8 val) return false; } -void jvs_device::handle_output(const char *tag, UINT8 id, UINT8 val) +void jvs_device::handle_output(ioport_port *port, UINT8 id, UINT8 val) { UINT32 m = 1 << id; switch(val) { @@ -253,5 +253,8 @@ void jvs_device::handle_output(const char *tag, UINT8 id, UINT8 val) case 2: jvs_outputs ^= m; break; } - machine().root_device().ioport(tag)->write_safe(jvs_outputs, m); + if (port) + { + port->write(jvs_outputs, m); + } } diff --git a/src/emu/machine/jvsdev.h b/src/emu/machine/jvsdev.h index fcbb8c08926..97382ea1655 100644 --- a/src/emu/machine/jvsdev.h +++ b/src/emu/machine/jvsdev.h @@ -23,7 +23,7 @@ public: protected: UINT32 jvs_outputs; - void handle_output(const char *tag, UINT8 id, UINT8 val); + void handle_output(ioport_port *port, UINT8 id, UINT8 val); // device-level overrides virtual void device_start(); diff --git a/src/emu/machine/ldpr8210.c b/src/emu/machine/ldpr8210.c index b52b3b38f4d..967dac974e7 100644 --- a/src/emu/machine/ldpr8210.c +++ b/src/emu/machine/ldpr8210.c @@ -249,7 +249,7 @@ void pioneer_pr8210_device::control_w(UINT8 data) // log the deltas for debugging if (LOG_SERIAL) { - int usecdiff = (int)(delta.attoseconds / ATTOSECONDS_IN_USEC(1)); + int usecdiff = (int)(delta.attoseconds() / ATTOSECONDS_IN_USEC(1)); printf("bitdelta = %5d (%d) - accum = %04X\n", usecdiff, longpulse, m_accumulator); } diff --git a/src/emu/machine/netlist.c b/src/emu/machine/netlist.c index 8db7fa3feb4..2f782802151 100644 --- a/src/emu/machine/netlist.c +++ b/src/emu/machine/netlist.c @@ -175,11 +175,11 @@ void netlist_mame_stream_input_t::custom_netlist_additions(netlist::setup_t &set if (snd_in == NULL) snd_in = dynamic_cast<NETLIB_NAME(sound_in) *>(setup.register_dev("NETDEV_SOUND_IN", "STREAM_INPUT")); - pstring sparam = pstring::sprintf("STREAM_INPUT.CHAN%d", m_channel); + pstring sparam = pformat("STREAM_INPUT.CHAN%1")(m_channel); setup.register_param(sparam, m_param_name); - sparam = pstring::sprintf("STREAM_INPUT.MULT%d", m_channel); + sparam = pformat("STREAM_INPUT.MULT%1")(m_channel); setup.register_param(sparam, m_mult); - sparam = pstring::sprintf("STREAM_INPUT.OFFSET%d", m_channel); + sparam = pformat("STREAM_INPUT.OFFSET%1")(m_channel); setup.register_param(sparam, m_offset); } @@ -210,7 +210,7 @@ void netlist_mame_stream_output_t::device_start() void netlist_mame_stream_output_t::custom_netlist_additions(netlist::setup_t &setup) { //NETLIB_NAME(sound_out) *snd_out; - pstring sname = pstring::sprintf("STREAM_OUT_%d", m_channel); + pstring sname = pformat("STREAM_OUT_%1")(m_channel); //snd_out = dynamic_cast<NETLIB_NAME(sound_out) *>(setup.register_dev("nld_sound_out", sname)); setup.register_dev("NETDEV_SOUND_OUT", sname); @@ -255,8 +255,6 @@ ADDRESS_MAP_END netlist_mame_device_t::netlist_mame_device_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, NETLIST_CORE, "Netlist core device", tag, owner, clock, "netlist_core", __FILE__), m_icount(0), - m_div(0), - m_rem(0), m_old(netlist::netlist_time::zero), m_netlist(NULL), m_setup(NULL), @@ -267,8 +265,6 @@ netlist_mame_device_t::netlist_mame_device_t(const machine_config &mconfig, cons netlist_mame_device_t::netlist_mame_device_t(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *file) : device_t(mconfig, type, name, tag, owner, clock, shortname, file), m_icount(0), - m_div(0), - m_rem(0), m_old(netlist::netlist_time::zero), m_netlist(NULL), m_setup(NULL), @@ -326,17 +322,17 @@ void netlist_mame_device_t::device_start() save_state(); m_old = netlist::netlist_time::zero; - m_rem = 0; + m_rem = netlist::netlist_time::zero; } void netlist_mame_device_t::device_clock_changed() { //printf("device_clock_changed\n"); - m_div = netlist::netlist_time::from_hz(clock()).as_raw(); + m_div = netlist::netlist_time::from_hz(clock()); //m_rem = 0; //NL_VERBOSE_OUT(("Setting clock %" I64FMT "d and divisor %d\n", clock(), m_div)); - NL_VERBOSE_OUT(("Setting clock %d and divisor %d\n", clock(), m_div)); + NL_VERBOSE_OUT(("Setting clock %d and divisor %f\n", clock(), m_div.as_double())); //printf("Setting clock %d and divisor %d\n", clock(), m_div); } @@ -345,7 +341,7 @@ void netlist_mame_device_t::device_reset() { LOG_DEV_CALLS(("device_reset\n")); m_old = netlist::netlist_time::zero; - m_rem = 0; + m_rem = netlist::netlist_time::zero; netlist().do_reset(); } @@ -383,9 +379,12 @@ void netlist_mame_device_t::device_timer(emu_timer &timer, device_timer_id id, i ATTR_HOT ATTR_ALIGN void netlist_mame_device_t::update_time_x() { - const netlist::netlist_time delta = netlist().time() - m_old + netlist::netlist_time::from_raw(m_rem); - m_old = netlist().time(); - m_icount -= divu_64x32_rem(delta.as_raw(), m_div, &m_rem); + const netlist::netlist_time newt = netlist().time(); + const netlist::netlist_time delta = newt - m_old + m_rem; + const UINT64 d = delta / m_div; + m_old = newt; + m_rem = delta - (m_div * d); + m_icount -= d; } ATTR_HOT ATTR_ALIGN void netlist_mame_device_t::check_mame_abort_slice() @@ -405,29 +404,35 @@ ATTR_COLD void netlist_mame_device_t::save_state() case DT_DOUBLE: { double *td = s->resolved<double>(); - if (td != NULL) save_pointer(td, s->m_name, s->m_count); + if (td != NULL) save_pointer(td, s->m_name.cstr(), s->m_count); } break; case DT_FLOAT: { float *td = s->resolved<float>(); - if (td != NULL) save_pointer(td, s->m_name, s->m_count); + if (td != NULL) save_pointer(td, s->m_name.cstr(), s->m_count); } break; +#if (PHAS_INT128) + case DT_INT128: + // FIXME: we are cheating here + save_pointer((char *) s->m_ptr, s->m_name.cstr(), s->m_count * sizeof(INT128)); + break; +#endif case DT_INT64: - save_pointer((INT64 *) s->m_ptr, s->m_name, s->m_count); + save_pointer((INT64 *) s->m_ptr, s->m_name.cstr(), s->m_count); break; case DT_INT16: - save_pointer((INT16 *) s->m_ptr, s->m_name, s->m_count); + save_pointer((INT16 *) s->m_ptr, s->m_name.cstr(), s->m_count); break; case DT_INT8: - save_pointer((INT8 *) s->m_ptr, s->m_name, s->m_count); + save_pointer((INT8 *) s->m_ptr, s->m_name.cstr(), s->m_count); break; case DT_INT: - save_pointer((int *) s->m_ptr, s->m_name, s->m_count); + save_pointer((int *) s->m_ptr, s->m_name.cstr(), s->m_count); break; case DT_BOOLEAN: - save_pointer((bool *) s->m_ptr, s->m_name, s->m_count); + save_pointer((bool *) s->m_ptr, s->m_name.cstr(), s->m_count); break; case DT_CUSTOM: break; @@ -470,11 +475,11 @@ void netlist_mame_cpu_device_t::device_start() netlist::net_t *n = netlist().m_nets[i]; if (n->isFamily(netlist::object_t::LOGIC)) { - state_add(i*2, n->name(), downcast<netlist::logic_net_t *>(n)->Q_state_ptr()); + state_add(i*2, n->name().cstr(), downcast<netlist::logic_net_t *>(n)->Q_state_ptr()); } else { - state_add(i*2+1, n->name(), downcast<netlist::analog_net_t *>(n)->Q_Analog_state_ptr()).formatstr("%20s"); + state_add(i*2+1, n->name().cstr(), downcast<netlist::analog_net_t *>(n)->Q_Analog_state_ptr()).formatstr("%20s"); } } @@ -529,13 +534,13 @@ ATTR_HOT void netlist_mame_cpu_device_t::execute_run() m_genPC++; m_genPC &= 255; debugger_instruction_hook(this, m_genPC); - netlist().process_queue(netlist::netlist_time::from_raw(m_div)); + netlist().process_queue(m_div); update_time_x(); } } else { - netlist().process_queue(netlist::netlist_time::from_raw(m_div) * m_icount); + netlist().process_queue(m_div * m_icount); update_time_x(); } } @@ -623,9 +628,9 @@ void netlist_mame_sound_device_t::sound_stream_update(sound_stream &stream, stre netlist::netlist_time cur = netlist().time(); - netlist().process_queue(netlist::netlist_time::from_raw(m_div) * samples); + netlist().process_queue(m_div * samples); - cur += (netlist::netlist_time::from_raw(m_div) * samples); + cur += (m_div * samples); for (int i=0; i < m_num_outputs; i++) { @@ -638,9 +643,13 @@ void netlist_mame_sound_device_t::sound_stream_update(sound_stream &stream, stre // memregion source support // ---------------------------------------------------------------------------------------- -bool netlist_source_memregion_t::parse(netlist::setup_t *setup, const pstring name) +bool netlist_source_memregion_t::parse(netlist::setup_t &setup, const pstring &name) { - const char *mem = (const char *)downcast<netlist_mame_t &>(setup->netlist()).machine().root_device().memregion(m_name.cstr())->base(); - netlist::parser_t p(*setup); - return p.parse(mem, name); + // FIXME: preprocessor should be a stream! + memory_region *mem = downcast<netlist_mame_t &>(setup.netlist()).machine().root_device().memregion(m_name.cstr()); + pimemstream istrm(mem->base(),mem->bytes() ); + pomemstream ostrm; + + pimemstream istrm2(ppreprocessor().process(istrm, ostrm)); + return netlist::parser_t(istrm2, setup).parse(name); } diff --git a/src/emu/machine/netlist.h b/src/emu/machine/netlist.h index ed93abbed3d..d3818ab1955 100644 --- a/src/emu/machine/netlist.h +++ b/src/emu/machine/netlist.h @@ -68,7 +68,7 @@ public: { } - bool parse(netlist::setup_t *setup, const pstring name); + bool parse(netlist::setup_t &setup, const pstring &name); private: pstring m_name; }; @@ -143,13 +143,13 @@ protected: //virtual void device_debug_setup(); virtual void device_clock_changed(); - UINT32 m_div; + netlist::netlist_time m_div; private: void save_state(); /* timing support here - so sound can hijack it ... */ - UINT32 m_rem; + netlist::netlist_time m_rem; netlist::netlist_time m_old; netlist_mame_t * m_netlist; @@ -648,9 +648,9 @@ public: for (int i = 0; i < MAX_INPUT_CHANNELS; i++) { - register_param(pstring::sprintf("CHAN%d", i), m_param_name[i], ""); - register_param(pstring::sprintf("MULT%d", i), m_param_mult[i], 1.0); - register_param(pstring::sprintf("OFFSET%d", i), m_param_offset[i], 0.0); + register_param(pformat("CHAN%1")(i), m_param_name[i], ""); + register_param(pformat("MULT%1")(i), m_param_mult[i], 1.0); + register_param(pformat("OFFSET%1")(i), m_param_offset[i], 0.0); } m_num_channel = 0; } diff --git a/src/emu/machine/tmp68301.c b/src/emu/machine/tmp68301.c index 26a4d2fea70..955a10c463b 100644 --- a/src/emu/machine/tmp68301.c +++ b/src/emu/machine/tmp68301.c @@ -82,17 +82,20 @@ READ16_MEMBER(tmp68301_device::pdir_r) WRITE16_MEMBER(tmp68301_device::pdir_w) { - m_pdir = data; + COMBINE_DATA(&m_pdir); } READ16_MEMBER(tmp68301_device::pdr_r) { - return m_in_parallel_cb(0) & ~m_pdir; + return (m_in_parallel_cb(0) & ~m_pdir) | (m_pdr & m_pdir); } WRITE16_MEMBER(tmp68301_device::pdr_w) { - m_out_parallel_cb(0, data & m_pdir, mem_mask); + UINT16 old = m_pdr; + COMBINE_DATA(&m_pdr); + m_pdr = (old & ~m_pdir) | (m_pdr & m_pdir); + m_out_parallel_cb(0, m_pdr, mem_mask); } @@ -105,6 +108,7 @@ tmp68301_device::tmp68301_device(const machine_config &mconfig, const char *tag, m_iisr(0), m_scr(0), m_pdir(0), + m_pdr(0), m_space_config("regs", ENDIANNESS_LITTLE, 16, 10, 0, NULL, *ADDRESS_MAP_NAME(tmp68301_regs)) { memset(m_regs, 0, sizeof(m_regs)); @@ -133,6 +137,7 @@ void tmp68301_device::device_start() save_item(NAME(m_iisr)); save_item(NAME(m_scr)); save_item(NAME(m_pdir)); + save_item(NAME(m_pdr)); } //------------------------------------------------- diff --git a/src/emu/machine/tmp68301.h b/src/emu/machine/tmp68301.h index d7a49a434b7..b96296d31f2 100644 --- a/src/emu/machine/tmp68301.h +++ b/src/emu/machine/tmp68301.h @@ -78,6 +78,7 @@ private: UINT16 m_iisr; UINT16 m_scr; UINT16 m_pdir; + UINT16 m_pdr; inline UINT16 read_word(offs_t address); inline void write_word(offs_t address, UINT16 data); diff --git a/src/emu/machine/tms6100.c b/src/emu/machine/tms6100.c index 9cedc12c10a..6c5a58673dd 100644 --- a/src/emu/machine/tms6100.c +++ b/src/emu/machine/tms6100.c @@ -88,6 +88,11 @@ #define TMS6100_READ_PENDING 0x01 #define TMS6100_NEXT_READ_IS_DUMMY 0x02 +/* Variants */ + +#define TMS6110_IS_TMS6100 (1) +#define TMS6110_IS_M58819 (2) + const device_type TMS6100 = &device_creator<tms6100_device>; @@ -136,15 +141,15 @@ void tms6100_device::device_start() save_item(NAME(m_m0)); save_item(NAME(m_m1)); save_item(NAME(m_state)); - //save_item(NAME(m_variant)); - //tms6100_set_variant(tms, TMS6110_IS_TMS6100); + save_item(NAME(m_variant)); + set_variant(TMS6110_IS_TMS6100); } void m58819_device::device_start() { tms6100_device::device_start(); - //tms6100_set_variant(tms, TMS6110_IS_M58819); + set_variant(TMS6110_IS_M58819); } //------------------------------------------------- @@ -165,6 +170,11 @@ void tms6100_device::device_reset() m_data = 0; } +void tms6100_device::set_variant(int variant) +{ + m_variant = variant; +} + WRITE_LINE_MEMBER(tms6100_device::tms6100_m0_w) { if (state != m_m0) @@ -199,15 +209,14 @@ WRITE_LINE_MEMBER(tms6100_device::tms6100_romclock_w) else { /* read bit at address */ - /* if (m_variant == TMS6110_IS_M58819) + if (m_variant == TMS6110_IS_M58819) { m_data = (m_rom[m_address >> 3] >> (7-(m_address & 0x07))) & 1; } else // m_variant == (TMS6110_IS_TMS6100 || TMS6110_IS_TMS6125) { - */ - m_data = (m_rom[m_address >> 3] >> (m_address & 0x07)) & 1; - /* } */ + m_data = (m_rom[m_address >> 3] >> (m_address & 0x07)) & 1; + } m_address++; } m_state &= ~TMS6100_READ_PENDING; diff --git a/src/emu/machine/tms6100.h b/src/emu/machine/tms6100.h index 2838adf63cf..4aed02a846b 100644 --- a/src/emu/machine/tms6100.h +++ b/src/emu/machine/tms6100.h @@ -25,6 +25,7 @@ protected: virtual void device_config_complete(); virtual void device_start(); virtual void device_reset(); + void set_variant(int variant); private: // internal state required_region_ptr<UINT8> m_rom; @@ -37,7 +38,7 @@ private: UINT8 m_tms_clock; UINT8 m_data; UINT8 m_state; - //UINT8 m_variant; + UINT8 m_variant; }; diff --git a/src/emu/machine/upd765.c b/src/emu/machine/upd765.c index 5a40d63aad3..e1ce769880e 100644 --- a/src/emu/machine/upd765.c +++ b/src/emu/machine/upd765.c @@ -2187,12 +2187,12 @@ std::string upd765_family_device::tts(attotime t) { char buf[256]; const char *sign = ""; - if(t.seconds < 0) { + if(t.seconds() < 0) { t = attotime::zero-t; sign = "-"; } - int nsec = t.attoseconds / ATTOSECONDS_PER_NANOSECOND; - sprintf(buf, "%s%04d.%03d,%03d,%03d", sign, int(t.seconds), nsec/1000000, (nsec/1000)%1000, nsec % 1000); + int nsec = t.attoseconds() / ATTOSECONDS_PER_NANOSECOND; + sprintf(buf, "%s%04d.%03d,%03d,%03d", sign, int(t.seconds()), nsec/1000000, (nsec/1000)%1000, nsec % 1000); return buf; } diff --git a/src/emu/machine/wd_fdc.c b/src/emu/machine/wd_fdc.c index 06d6df35f92..8b27486c79a 100644 --- a/src/emu/machine/wd_fdc.c +++ b/src/emu/machine/wd_fdc.c @@ -203,8 +203,8 @@ void wd_fdc_t::dden_w(bool _dden) std::string wd_fdc_t::tts(const attotime &t) { char buf[256]; - int nsec = t.attoseconds / ATTOSECONDS_PER_NANOSECOND; - sprintf(buf, "%4d.%03d,%03d,%03d", int(t.seconds), nsec/1000000, (nsec/1000)%1000, nsec % 1000); + int nsec = t.attoseconds() / ATTOSECONDS_PER_NANOSECOND; + sprintf(buf, "%4d.%03d,%03d,%03d", int(t.seconds()), nsec/1000000, (nsec/1000)%1000, nsec % 1000); return buf; } diff --git a/src/emu/machine/z80ctc.c b/src/emu/machine/z80ctc.c index aee057c2c1a..8ab638a5e8d 100644 --- a/src/emu/machine/z80ctc.c +++ b/src/emu/machine/z80ctc.c @@ -364,7 +364,7 @@ UINT8 z80ctc_device::ctc_channel::read() { attotime period = ((m_mode & PRESCALER) == PRESCALER_16) ? m_device->m_period16 : m_device->m_period256; - VPRINTF(("CTC clock %f\n",ATTOSECONDS_TO_HZ(period.attoseconds))); + VPRINTF(("CTC clock %f\n",ATTOSECONDS_TO_HZ(period.attoseconds()))); if (m_timer != NULL) return ((int)(m_timer->remaining().as_double() / period.as_double()) + 1) & 0xff; diff --git a/src/emu/memory.c b/src/emu/memory.c index 790597ed295..bf251912004 100644 --- a/src/emu/memory.c +++ b/src/emu/memory.c @@ -2311,6 +2311,30 @@ void address_space::install_bank_generic(offs_t addrstart, offs_t addrend, offs_ } +void address_space::install_bank_generic(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, memory_bank *rbank, memory_bank *wbank) +{ + VPRINTF(("address_space::install_readwrite_bank(%s-%s mask=%s mirror=%s, read=\"%s\" / write=\"%s\")\n", + core_i64_hex_format(addrstart, m_addrchars), core_i64_hex_format(addrend, m_addrchars), + core_i64_hex_format(addrmask, m_addrchars), core_i64_hex_format(addrmirror, m_addrchars), + (rbank != NULL) ? rbank->tag() : "(none)", (wbank != NULL) ? wbank->tag() : "(none)")); + + // map the read bank + if (rbank != NULL) + { + read().map_range(addrstart, addrend, addrmask, addrmirror, rbank->index()); + } + + // map the write bank + if (wbank != NULL) + { + write().map_range(addrstart, addrend, addrmask, addrmirror, wbank->index()); + } + + // update the memory dump + generate_memdump(machine()); +} + + //------------------------------------------------- // install_ram_generic - install a simple fixed // RAM region into the given address space diff --git a/src/emu/memory.h b/src/emu/memory.h index ff02476fc7f..3352621263d 100644 --- a/src/emu/memory.h +++ b/src/emu/memory.h @@ -374,6 +374,9 @@ public: void install_read_bank(offs_t addrstart, offs_t addrend, const char *tag) { install_read_bank(addrstart, addrend, 0, 0, tag); } void install_write_bank(offs_t addrstart, offs_t addrend, const char *tag) { install_write_bank(addrstart, addrend, 0, 0, tag); } void install_readwrite_bank(offs_t addrstart, offs_t addrend, const char *tag) { install_readwrite_bank(addrstart, addrend, 0, 0, tag); } + void install_read_bank(offs_t addrstart, offs_t addrend, memory_bank *bank) { install_read_bank(addrstart, addrend, 0, 0, bank); } + void install_write_bank(offs_t addrstart, offs_t addrend, memory_bank *bank) { install_write_bank(addrstart, addrend, 0, 0, bank); } + void install_readwrite_bank(offs_t addrstart, offs_t addrend, memory_bank *bank) { install_readwrite_bank(addrstart, addrend, 0, 0, bank); } void *install_rom(offs_t addrstart, offs_t addrend, void *baseptr = NULL) { return install_rom(addrstart, addrend, 0, 0, baseptr); } void *install_writeonly(offs_t addrstart, offs_t addrend, void *baseptr = NULL) { return install_writeonly(addrstart, addrend, 0, 0, baseptr); } void *install_ram(offs_t addrstart, offs_t addrend, void *baseptr = NULL) { return install_ram(addrstart, addrend, 0, 0, baseptr); } @@ -385,6 +388,9 @@ public: void install_read_bank(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, const char *tag) { install_bank_generic(addrstart, addrend, addrmask, addrmirror, tag, NULL); } void install_write_bank(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, const char *tag) { install_bank_generic(addrstart, addrend, addrmask, addrmirror, NULL, tag); } void install_readwrite_bank(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, const char *tag) { install_bank_generic(addrstart, addrend, addrmask, addrmirror, tag, tag); } + void install_read_bank(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, memory_bank *bank) { install_bank_generic(addrstart, addrend, addrmask, addrmirror, bank, NULL); } + void install_write_bank(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, memory_bank *bank) { install_bank_generic(addrstart, addrend, addrmask, addrmirror, NULL, bank); } + void install_readwrite_bank(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, memory_bank *bank) { install_bank_generic(addrstart, addrend, addrmask, addrmirror, bank, bank); } void *install_rom(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, void *baseptr = NULL) { return install_ram_generic(addrstart, addrend, addrmask, addrmirror, ROW_READ, baseptr); } void *install_writeonly(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, void *baseptr = NULL) { return install_ram_generic(addrstart, addrend, addrmask, addrmirror, ROW_WRITE, baseptr); } void *install_ram(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, void *baseptr = NULL) { return install_ram_generic(addrstart, addrend, addrmask, addrmirror, ROW_READWRITE, baseptr); } @@ -446,6 +452,7 @@ private: void unmap_generic(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read_or_write readorwrite, bool quiet); void *install_ram_generic(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read_or_write readorwrite, void *baseptr); void install_bank_generic(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, const char *rtag, const char *wtag); + void install_bank_generic(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, memory_bank *rbank, memory_bank *wbank); void bind_and_install_handler(const address_map_entry &entry, read_or_write readorwrite, device_t *device); void adjust_addresses(offs_t &start, offs_t &end, offs_t &mask, offs_t &mirror); void *find_backing_memory(offs_t addrstart, offs_t addrend); diff --git a/src/emu/netlist/analog/nld_bjt.c b/src/emu/netlist/analog/nld_bjt.c index 57c2d89c870..5f5a3611b97 100644 --- a/src/emu/netlist/analog/nld_bjt.c +++ b/src/emu/netlist/analog/nld_bjt.c @@ -5,9 +5,9 @@ * */ -#include <solver/nld_solver.h> -#include "nld_bjt.h" -#include "../nl_setup.h" +#include "solver/nld_solver.h" +#include "analog/nld_bjt.h" +#include "nl_setup.h" NETLIB_NAMESPACE_DEVICES_START() diff --git a/src/emu/netlist/analog/nld_bjt.h b/src/emu/netlist/analog/nld_bjt.h index eab013b99c6..520321f2db2 100644 --- a/src/emu/netlist/analog/nld_bjt.h +++ b/src/emu/netlist/analog/nld_bjt.h @@ -8,7 +8,7 @@ #ifndef NLD_BJT_H_ #define NLD_BJT_H_ -#include "../nl_base.h" +#include "nl_base.h" #include "nld_twoterm.h" // ----------------------------------------------------------------------------- diff --git a/src/emu/netlist/analog/nld_fourterm.c b/src/emu/netlist/analog/nld_fourterm.c index 58d173e6554..b217ff21f3a 100644 --- a/src/emu/netlist/analog/nld_fourterm.c +++ b/src/emu/netlist/analog/nld_fourterm.c @@ -5,9 +5,9 @@ * */ -#include <solver/nld_solver.h> +#include "solver/nld_solver.h" #include "nld_fourterm.h" -#include "../nl_setup.h" +#include "nl_setup.h" NETLIB_NAMESPACE_DEVICES_START() diff --git a/src/emu/netlist/analog/nld_fourterm.h b/src/emu/netlist/analog/nld_fourterm.h index 7ed6965a393..591df68dd79 100644 --- a/src/emu/netlist/analog/nld_fourterm.h +++ b/src/emu/netlist/analog/nld_fourterm.h @@ -9,7 +9,7 @@ #define NLD_FOURTERM_H_ -#include "../nl_base.h" +#include "nl_base.h" #include "nld_twoterm.h" // ---------------------------------------------------------------------------------------- diff --git a/src/emu/netlist/analog/nld_opamps.c b/src/emu/netlist/analog/nld_opamps.c index 3aecce08b2a..d0b9e5da023 100644 --- a/src/emu/netlist/analog/nld_opamps.c +++ b/src/emu/netlist/analog/nld_opamps.c @@ -6,7 +6,7 @@ */ #include "nld_opamps.h" -#include "../devices/net_lib.h" +#include "devices/net_lib.h" NETLIST_START(opamp_lm3900) diff --git a/src/emu/netlist/analog/nld_opamps.h b/src/emu/netlist/analog/nld_opamps.h index 5dc0730357a..2cee8696bca 100644 --- a/src/emu/netlist/analog/nld_opamps.h +++ b/src/emu/netlist/analog/nld_opamps.h @@ -10,8 +10,8 @@ #ifndef NLD_OPAMPS_H_ #define NLD_OPAMPS_H_ -#include "../nl_base.h" -#include "../nl_setup.h" +#include "nl_base.h" +#include "nl_setup.h" #include "nld_twoterm.h" #include "nld_fourterm.h" diff --git a/src/emu/netlist/analog/nld_switches.c b/src/emu/netlist/analog/nld_switches.c index cf5dcd09c4b..6166463c6f8 100644 --- a/src/emu/netlist/analog/nld_switches.c +++ b/src/emu/netlist/analog/nld_switches.c @@ -6,7 +6,7 @@ */ #include "nld_switches.h" -#include "../nl_setup.h" +#include "nl_setup.h" #define R_OFF (1.0 / netlist().gmin()) #define R_ON 0.01 diff --git a/src/emu/netlist/analog/nld_switches.h b/src/emu/netlist/analog/nld_switches.h index 79dc989c948..6cec34ceb4c 100644 --- a/src/emu/netlist/analog/nld_switches.h +++ b/src/emu/netlist/analog/nld_switches.h @@ -10,7 +10,7 @@ #ifndef NLD_SWITCHES_H_ #define NLD_SWITCHES_H_ -#include "../nl_base.h" +#include "nl_base.h" #include "nld_twoterm.h" // ---------------------------------------------------------------------------------------- diff --git a/src/emu/netlist/analog/nld_twoterm.h b/src/emu/netlist/analog/nld_twoterm.h index d29b11f0db7..c38242cd90f 100644 --- a/src/emu/netlist/analog/nld_twoterm.h +++ b/src/emu/netlist/analog/nld_twoterm.h @@ -33,7 +33,7 @@ #ifndef NLD_TWOTERM_H_ #define NLD_TWOTERM_H_ -#include "../nl_base.h" +#include "nl_base.h" // ----------------------------------------------------------------------------- // Macros diff --git a/src/emu/netlist/devices/net_lib.c b/src/emu/netlist/devices/net_lib.c index b33a069a832..3b8edc8ac84 100644 --- a/src/emu/netlist/devices/net_lib.c +++ b/src/emu/netlist/devices/net_lib.c @@ -10,7 +10,7 @@ #include "net_lib.h" #include "nld_system.h" -#include "../nl_factory.h" +#include "nl_factory.h" NETLIST_START(diode_models) NET_MODEL("D _(IS=1e-15 N=1)") diff --git a/src/emu/netlist/devices/net_lib.h b/src/emu/netlist/devices/net_lib.h index 75564746a66..eed3bd6120f 100644 --- a/src/emu/netlist/devices/net_lib.h +++ b/src/emu/netlist/devices/net_lib.h @@ -11,7 +11,7 @@ #ifndef NET_LIB_H #define NET_LIB_H -#include "../nl_base.h" +#include "nl_base.h" #include "nld_signal.h" #include "nld_system.h" @@ -56,17 +56,17 @@ #include "nld_log.h" -#include "../macro/nlm_cd4xxx.h" -#include "../macro/nlm_ttl74xx.h" -#include "../macro/nlm_opamp.h" -#include "../macro/nlm_other.h" +#include "macro/nlm_cd4xxx.h" +#include "macro/nlm_ttl74xx.h" +#include "macro/nlm_opamp.h" +#include "macro/nlm_other.h" -#include "../analog/nld_bjt.h" -#include "../analog/nld_fourterm.h" -#include "../analog/nld_switches.h" -#include "../analog/nld_twoterm.h" -#include "../analog/nld_opamps.h" -#include "../solver/nld_solver.h" +#include "analog/nld_bjt.h" +#include "analog/nld_fourterm.h" +#include "analog/nld_switches.h" +#include "analog/nld_twoterm.h" +#include "analog/nld_opamps.h" +#include "solver/nld_solver.h" #include "nld_legacy.h" diff --git a/src/emu/netlist/devices/nld_4020.h b/src/emu/netlist/devices/nld_4020.h index d4814471fc1..78d7199db1b 100644 --- a/src/emu/netlist/devices/nld_4020.h +++ b/src/emu/netlist/devices/nld_4020.h @@ -27,7 +27,7 @@ #ifndef NLD_4020_H_ #define NLD_4020_H_ -#include "../nl_base.h" +#include "nl_base.h" #include "nld_cmos.h" /* FIXME: only used in mario.c */ diff --git a/src/emu/netlist/devices/nld_4066.h b/src/emu/netlist/devices/nld_4066.h index e9fc1bfec26..abfe321a7c4 100644 --- a/src/emu/netlist/devices/nld_4066.h +++ b/src/emu/netlist/devices/nld_4066.h @@ -24,7 +24,7 @@ #ifndef NLD_4066_H_ #define NLD_4066_H_ -#include "../nl_base.h" +#include "nl_base.h" #include "nld_cmos.h" #define CD4066_GATE(_name) \ diff --git a/src/emu/netlist/devices/nld_74107.h b/src/emu/netlist/devices/nld_74107.h index 89f59822f22..b0b38ee66fd 100644 --- a/src/emu/netlist/devices/nld_74107.h +++ b/src/emu/netlist/devices/nld_74107.h @@ -59,7 +59,7 @@ #ifndef NLD_74107_H_ #define NLD_74107_H_ -#include "../nl_base.h" +#include "nl_base.h" #define TTL_74107A(_name, _CLK, _J, _K, _CLRQ) \ NET_REGISTER_DEV(TTL_74107A, _name) \ diff --git a/src/emu/netlist/devices/nld_74123.h b/src/emu/netlist/devices/nld_74123.h index 8772103b521..7539c9ce6c3 100644 --- a/src/emu/netlist/devices/nld_74123.h +++ b/src/emu/netlist/devices/nld_74123.h @@ -49,9 +49,9 @@ #ifndef NLD_74123_H_ #define NLD_74123_H_ -#include "../nl_base.h" +#include "nl_base.h" #include "nld_system.h" -#include "../analog/nld_twoterm.h" +#include "analog/nld_twoterm.h" #define TTL_74123(_name) \ NET_REGISTER_DEV(TTL_74123, _name) diff --git a/src/emu/netlist/devices/nld_74153.h b/src/emu/netlist/devices/nld_74153.h index fe59759b1f7..54364ac5671 100644 --- a/src/emu/netlist/devices/nld_74153.h +++ b/src/emu/netlist/devices/nld_74153.h @@ -45,7 +45,7 @@ #ifndef NLD_74153_H_ #define NLD_74153_H_ -#include "../nl_base.h" +#include "nl_base.h" #define TTL_74153(_name, _C0, _C1, _C2, _C3, _A, _B, _G) \ NET_REGISTER_DEV(TTL_74153, _name) \ diff --git a/src/emu/netlist/devices/nld_74192.h b/src/emu/netlist/devices/nld_74192.h index d5be6346cb2..a8b26335eb2 100644 --- a/src/emu/netlist/devices/nld_74192.h +++ b/src/emu/netlist/devices/nld_74192.h @@ -29,7 +29,7 @@ #ifndef NLD_74192_H_ #define NLD_74192_H_ -#include "../nl_base.h" +#include "nl_base.h" #include "nld_9316.h" #define TTL_74192(_name) \ diff --git a/src/emu/netlist/devices/nld_74193.h b/src/emu/netlist/devices/nld_74193.h index d97095b7230..f7cecbc984c 100644 --- a/src/emu/netlist/devices/nld_74193.h +++ b/src/emu/netlist/devices/nld_74193.h @@ -26,7 +26,7 @@ #ifndef NLD_74193_H_ #define NLD_74193_H_ -#include "../nl_base.h" +#include "nl_base.h" #define TTL_74193(_name) \ NET_REGISTER_DEV(TTL_74193, _name) diff --git a/src/emu/netlist/devices/nld_7448.h b/src/emu/netlist/devices/nld_7448.h index f5bbdf50704..e633858dad5 100644 --- a/src/emu/netlist/devices/nld_7448.h +++ b/src/emu/netlist/devices/nld_7448.h @@ -24,7 +24,7 @@ #ifndef NLD_7448_H_ #define NLD_7448_H_ -#include "../nl_base.h" +#include "nl_base.h" #define TTL_7448(_name, _A0, _A1, _A2, _A3, _LTQ, _BIQ, _RBIQ) \ NET_REGISTER_DEV(TTL_7448, _name) \ diff --git a/src/emu/netlist/devices/nld_7483.h b/src/emu/netlist/devices/nld_7483.h index 9bbefc88b1d..b50edf11210 100644 --- a/src/emu/netlist/devices/nld_7483.h +++ b/src/emu/netlist/devices/nld_7483.h @@ -27,7 +27,7 @@ #ifndef NLD_7483_H_ #define NLD_7483_H_ -#include "../nl_base.h" +#include "nl_base.h" #define TTL_7483(_name, _A1, _A2, _A3, _A4, _B1, _B2, _B3, _B4, _CI) \ NET_REGISTER_DEV(TTL_7483, _name) \ diff --git a/src/emu/netlist/devices/nld_7490.h b/src/emu/netlist/devices/nld_7490.h index 72650c3dcbe..f5513dc2390 100644 --- a/src/emu/netlist/devices/nld_7490.h +++ b/src/emu/netlist/devices/nld_7490.h @@ -55,7 +55,7 @@ #ifndef NLD_7490_H_ #define NLD_7490_H_ -#include "../nl_base.h" +#include "nl_base.h" #define TTL_7490(_name, _A, _B, _R1, _R2, _R91, _R92) \ NET_REGISTER_DEV(TTL_7490, _name) \ diff --git a/src/emu/netlist/devices/nld_7493.c b/src/emu/netlist/devices/nld_7493.c index 83a7ae1012c..b7979152f09 100644 --- a/src/emu/netlist/devices/nld_7493.c +++ b/src/emu/netlist/devices/nld_7493.c @@ -6,7 +6,7 @@ */ #include "nld_7493.h" -#include "../nl_setup.h" +#include "nl_setup.h" NETLIB_NAMESPACE_DEVICES_START() diff --git a/src/emu/netlist/devices/nld_7493.h b/src/emu/netlist/devices/nld_7493.h index a54593c7c1f..39a969d3b02 100644 --- a/src/emu/netlist/devices/nld_7493.h +++ b/src/emu/netlist/devices/nld_7493.h @@ -57,7 +57,7 @@ #ifndef NLD_7493_H_ #define NLD_7493_H_ -#include "../nl_base.h" +#include "nl_base.h" #define TTL_7493(_name, _CLKA, _CLKB, _R1, _R2) \ NET_REGISTER_DEV(TTL_7493, _name) \ diff --git a/src/emu/netlist/devices/nld_74ls629.c b/src/emu/netlist/devices/nld_74ls629.c index 5ee1e1679db..ce8a0dd3b79 100644 --- a/src/emu/netlist/devices/nld_74ls629.c +++ b/src/emu/netlist/devices/nld_74ls629.c @@ -40,7 +40,7 @@ #include "nld_74ls629.h" -#include "../nl_setup.h" +#include "nl_setup.h" NETLIB_NAMESPACE_DEVICES_START() diff --git a/src/emu/netlist/devices/nld_74ls629.h b/src/emu/netlist/devices/nld_74ls629.h index 11c74bb8246..433c2c32a11 100644 --- a/src/emu/netlist/devices/nld_74ls629.h +++ b/src/emu/netlist/devices/nld_74ls629.h @@ -28,8 +28,8 @@ #ifndef NLD_74LS629_H_ #define NLD_74LS629_H_ -#include "../nl_base.h" -#include "../analog/nld_twoterm.h" +#include "nl_base.h" +#include "analog/nld_twoterm.h" #define SN74LS629(_name, _cap) \ NET_REGISTER_DEV(SN74LS629, _name) \ diff --git a/src/emu/netlist/devices/nld_82S16.h b/src/emu/netlist/devices/nld_82S16.h index 0c0963498c9..b6d8f6565d6 100644 --- a/src/emu/netlist/devices/nld_82S16.h +++ b/src/emu/netlist/devices/nld_82S16.h @@ -24,7 +24,7 @@ #ifndef NLD_82S16_H_ #define NLD_82S16_H_ -#include "../nl_base.h" +#include "nl_base.h" #define TTL_82S16(_name) \ NET_REGISTER_DEV(TTL_82S16, _name) diff --git a/src/emu/netlist/devices/nld_9310.h b/src/emu/netlist/devices/nld_9310.h index 4ab59ea038e..00c39605ac2 100644 --- a/src/emu/netlist/devices/nld_9310.h +++ b/src/emu/netlist/devices/nld_9310.h @@ -45,7 +45,7 @@ #ifndef NLD_9310_H_ #define NLD_9310_H_ -#include "../nl_base.h" +#include "nl_base.h" #define TTL_9310(_name, _CLK, _ENP, _ENT, _CLRQ, _LOADQ, _A, _B, _C, _D) \ NET_REGISTER_DEV(TTL_9310, _name) \ diff --git a/src/emu/netlist/devices/nld_9316.h b/src/emu/netlist/devices/nld_9316.h index ec6791ed63b..e4d7a901c99 100644 --- a/src/emu/netlist/devices/nld_9316.h +++ b/src/emu/netlist/devices/nld_9316.h @@ -49,7 +49,7 @@ #ifndef NLD_9316_H_ #define NLD_9316_H_ -#include "../nl_base.h" +#include "nl_base.h" #define TTL_9316(_name, _CLK, _ENP, _ENT, _CLRQ, _LOADQ, _A, _B, _C, _D) \ NET_REGISTER_DEV(TTL_9316, _name) \ diff --git a/src/emu/netlist/devices/nld_cmos.h b/src/emu/netlist/devices/nld_cmos.h index e3783ade423..6883993a794 100644 --- a/src/emu/netlist/devices/nld_cmos.h +++ b/src/emu/netlist/devices/nld_cmos.h @@ -8,8 +8,8 @@ #ifndef NLD_CMOS_H_ #define NLD_CMOS_H_ -#include "../nl_base.h" -#include "../analog/nld_twoterm.h" +#include "nl_base.h" +#include "analog/nld_twoterm.h" NETLIB_NAMESPACE_DEVICES_START() diff --git a/src/emu/netlist/devices/nld_legacy.c b/src/emu/netlist/devices/nld_legacy.c index d6b926545fe..834dda31110 100644 --- a/src/emu/netlist/devices/nld_legacy.c +++ b/src/emu/netlist/devices/nld_legacy.c @@ -6,7 +6,7 @@ */ #include "nld_legacy.h" -#include "../nl_setup.h" +#include "nl_setup.h" NETLIB_NAMESPACE_DEVICES_START() diff --git a/src/emu/netlist/devices/nld_legacy.h b/src/emu/netlist/devices/nld_legacy.h index 62cdd8b02ca..8180ae7f774 100644 --- a/src/emu/netlist/devices/nld_legacy.h +++ b/src/emu/netlist/devices/nld_legacy.h @@ -13,7 +13,7 @@ #ifndef NLD_LEGACY_H_ #define NLD_LEGACY_H_ -#include "../nl_base.h" +#include "nl_base.h" NETLIB_NAMESPACE_DEVICES_START() diff --git a/src/emu/netlist/devices/nld_log.c b/src/emu/netlist/devices/nld_log.c index f6061cc3aab..ac8a3fdbbc6 100644 --- a/src/emu/netlist/devices/nld_log.c +++ b/src/emu/netlist/devices/nld_log.c @@ -5,8 +5,6 @@ * */ -#include <cstdio> - #include "nld_log.h" //#include "sound/wavwrite.h" @@ -18,8 +16,8 @@ NETLIB_START(log) { register_input("I", m_I); - pstring filename = pstring::sprintf("%s.log", name().cstr()); - m_file = fopen(filename, "w"); + pstring filename = pformat("%1.log")(name()); + m_strm = palloc(pofilestream(filename)); } NETLIB_RESET(log) @@ -28,12 +26,15 @@ NETLIB_RESET(log) NETLIB_UPDATE(log) { - std::fprintf(static_cast<FILE *>(m_file), "%20.9e %e\n", netlist().time().as_double(), (nl_double) INPANALOG(m_I)); + /* use pstring::sprintf, it is a LOT faster */ +// m_strm->writeline(pstring::sprintf("%20.9e %e", netlist().time().as_double(), (nl_double) INPANALOG(m_I)).cstr()); + m_strm->writeline(pformat("%1 %2").e(netlist().time().as_double(),".9").e((nl_double) INPANALOG(m_I)).cstr()); } NETLIB_NAME(log)::~NETLIB_NAME(log)() { - std::fclose(static_cast<FILE *>(m_file)); + m_strm->close(); + pfree(m_strm); } NETLIB_START(logD) @@ -48,7 +49,7 @@ NETLIB_RESET(logD) NETLIB_UPDATE(logD) { - std::fprintf(static_cast<FILE *>(m_file), "%e %e\n", netlist().time().as_double(), (nl_double) (INPANALOG(m_I) - INPANALOG(m_I2))); + m_strm->writeline(pstring::sprintf("%e %e", netlist().time().as_double(), (nl_double) (INPANALOG(m_I) - INPANALOG(m_I2))).cstr()); } // FIXME: Implement wav later, this must be clock triggered device where the input to be written diff --git a/src/emu/netlist/devices/nld_log.h b/src/emu/netlist/devices/nld_log.h index 9f7431ed1ee..eb3ae97d75e 100644 --- a/src/emu/netlist/devices/nld_log.h +++ b/src/emu/netlist/devices/nld_log.h @@ -18,9 +18,10 @@ #ifndef NLD_LOG_H_ #define NLD_LOG_H_ -#include "../nl_base.h" +#include "nl_base.h" +#include "plib/pstream.h" -#define LOG(_name, _I) \ +#define LOG(_name, _I) \ NET_REGISTER_DEV(??PG, _name) \ NET_CONNECT(_name, I, _I) @@ -30,7 +31,7 @@ NETLIB_DEVICE(log, ~NETLIB_NAME(log)(); analog_input_t m_I; protected: - void * m_file; + pofilestream *m_strm; ); #define LOGD(_name, _I, _I2) \ diff --git a/src/emu/netlist/devices/nld_mm5837.c b/src/emu/netlist/devices/nld_mm5837.c index e45c0bf8198..129456c8784 100644 --- a/src/emu/netlist/devices/nld_mm5837.c +++ b/src/emu/netlist/devices/nld_mm5837.c @@ -7,7 +7,7 @@ #include <solver/nld_solver.h> #include "nld_mm5837.h" -#include "../nl_setup.h" +#include "nl_setup.h" #define R_LOW (1000) #define R_HIGH (1000) diff --git a/src/emu/netlist/devices/nld_mm5837.h b/src/emu/netlist/devices/nld_mm5837.h index e5aad3daa81..33b42640e92 100644 --- a/src/emu/netlist/devices/nld_mm5837.h +++ b/src/emu/netlist/devices/nld_mm5837.h @@ -19,8 +19,8 @@ #ifndef NLD_MM5837_H_ #define NLD_MM5837_H_ -#include "../nl_base.h" -#include "../analog/nld_twoterm.h" +#include "nl_base.h" +#include "analog/nld_twoterm.h" #define MM5837_DIP(_name) \ NET_REGISTER_DEV(MM5837_DIP, _name) diff --git a/src/emu/netlist/devices/nld_ne555.c b/src/emu/netlist/devices/nld_ne555.c index 6705081eb3a..efa6d25aec8 100644 --- a/src/emu/netlist/devices/nld_ne555.c +++ b/src/emu/netlist/devices/nld_ne555.c @@ -7,7 +7,7 @@ #include <solver/nld_solver.h> #include "nld_ne555.h" -#include "../nl_setup.h" +#include "nl_setup.h" #define R_OFF (1E20) #define R_ON (25) // Datasheet states a maximum discharge of 200mA, R = 5V / 0.2 diff --git a/src/emu/netlist/devices/nld_ne555.h b/src/emu/netlist/devices/nld_ne555.h index f02c7763ebd..11228ffd447 100644 --- a/src/emu/netlist/devices/nld_ne555.h +++ b/src/emu/netlist/devices/nld_ne555.h @@ -19,8 +19,8 @@ #ifndef NLD_NE555_H_ #define NLD_NE555_H_ -#include "../nl_base.h" -#include "../analog/nld_twoterm.h" +#include "nl_base.h" +#include "analog/nld_twoterm.h" #define NE555(_name) \ NET_REGISTER_DEV(NE555, _name) diff --git a/src/emu/netlist/devices/nld_r2r_dac.h b/src/emu/netlist/devices/nld_r2r_dac.h index 843c827a538..15b1e7fa364 100644 --- a/src/emu/netlist/devices/nld_r2r_dac.h +++ b/src/emu/netlist/devices/nld_r2r_dac.h @@ -46,8 +46,8 @@ #ifndef NLD_R2R_DAC_H_ #define NLD_R2R_DAC_H_ -#include "../nl_base.h" -#include "../analog/nld_twoterm.h" +#include "nl_base.h" +#include "analog/nld_twoterm.h" #define R2R_DAC(_name, _VIN, _R, _N) \ NET_REGISTER_DEV(R2R_DAC, _name) \ diff --git a/src/emu/netlist/devices/nld_signal.h b/src/emu/netlist/devices/nld_signal.h index 0cf2bc7c238..fa8e9e6265b 100644 --- a/src/emu/netlist/devices/nld_signal.h +++ b/src/emu/netlist/devices/nld_signal.h @@ -8,7 +8,7 @@ #ifndef NLD_SIGNAL_H_ #define NLD_SIGNAL_H_ -#include "../nl_base.h" +#include "nl_base.h" // ---------------------------------------------------------------------------------------- // MACROS diff --git a/src/emu/netlist/devices/nld_system.c b/src/emu/netlist/devices/nld_system.c index a0c21ee6a2a..565b1c81dd1 100644 --- a/src/emu/netlist/devices/nld_system.c +++ b/src/emu/netlist/devices/nld_system.c @@ -299,7 +299,7 @@ NETLIB_START(function) register_output("Q", m_Q); for (int i=0; i < m_N; i++) - register_input(pstring::sprintf("A%d", i), m_I[i]); + register_input(pformat("A%1")(i), m_I[i]); pstring_list_t cmds(m_func.Value(), " "); m_precompiled.clear(); diff --git a/src/emu/netlist/devices/nld_system.h b/src/emu/netlist/devices/nld_system.h index 27ed157b3f2..d3f1aff8935 100644 --- a/src/emu/netlist/devices/nld_system.h +++ b/src/emu/netlist/devices/nld_system.h @@ -9,10 +9,10 @@ #ifndef NLD_SYSTEM_H_ #define NLD_SYSTEM_H_ -#include "../nl_setup.h" -#include "../nl_base.h" -#include "../nl_factory.h" -#include "../analog/nld_twoterm.h" +#include "nl_setup.h" +#include "nl_base.h" +#include "nl_factory.h" +#include "analog/nld_twoterm.h" // ----------------------------------------------------------------------------- // Macros @@ -478,7 +478,7 @@ public: ATTR_COLD factory_lib_entry_t(setup_t &setup, const pstring &name, const pstring &classname, const pstring &def_param) - : base_factory_t(name, classname, def_param), m_setup(setup) { } + : base_factory_t(name, classname, def_param), m_setup(setup) { printf("devname %s\n", classname.cstr()); } class dummy : public device_t { diff --git a/src/emu/netlist/devices/nld_truthtable.c b/src/emu/netlist/devices/nld_truthtable.c index 4ae30d23cbf..1f6a9a19117 100644 --- a/src/emu/netlist/devices/nld_truthtable.c +++ b/src/emu/netlist/devices/nld_truthtable.c @@ -6,7 +6,7 @@ */ #include "nld_truthtable.h" -#include "../plib/plists.h" +#include "plib/plists.h" NETLIB_NAMESPACE_DEVICES_START() @@ -135,8 +135,8 @@ void truthtable_desc_t::help(unsigned cur, pstring_list_t list, { // cutoff previous inputs and outputs for ignore if (m_outs[nstate] != ~0U && m_outs[nstate] != val) - fatalerror_e("Error in truthtable: State %04x already set, %d != %d\n", - (UINT32) nstate, m_outs[nstate], val); + fatalerror_e(pformat("Error in truthtable: State %1 already set, %2 != %3\n") + .x(nstate,"04")(m_outs[nstate])(val) ); m_outs[nstate] = val; for (unsigned j=0; j<m_NO; j++) m_timing[nstate * m_NO + j] = timing_index[j]; @@ -231,7 +231,7 @@ void truthtable_desc_t::setup(const pstring_list_t &truthtable, UINT32 disabled_ for (UINT32 i=0; i<m_size; i++) { if (m_outs[i] == ~0U) - fatalerror_e("truthtable: found element not set %04x\n", i); + throw fatalerror_e(pformat("truthtable: found element not set %1\n").x(i) ); m_outs[i] |= ((ign[i] & ~disabled_ignore) << m_NO); } *m_initialized = true; @@ -264,7 +264,7 @@ netlist_base_factory_truthtable_t *nl_tt_factory_create(const unsigned ni, const ENTRY(9); ENTRY(10); default: - pstring msg = pstring::sprintf("unable to create truthtable<%d,%d,%d>", ni, no, has_state); + pstring msg = pformat("unable to create truthtable<%1,%2,%3>")(ni)(no)(has_state); nl_assert_always(false, msg.cstr()); } return NULL; diff --git a/src/emu/netlist/devices/nld_truthtable.h b/src/emu/netlist/devices/nld_truthtable.h index fdf2aa58fe2..1044d58e9b2 100644 --- a/src/emu/netlist/devices/nld_truthtable.h +++ b/src/emu/netlist/devices/nld_truthtable.h @@ -10,8 +10,8 @@ #ifndef NLD_TRUTHTABLE_H_ #define NLD_TRUTHTABLE_H_ -#include "../nl_base.h" -#include "../nl_factory.h" +#include "nl_base.h" +#include "nl_factory.h" #define NETLIB_TRUTHTABLE(_name, _nIN, _nOUT, _state) \ class NETLIB_NAME(_name) : public nld_truthtable_t<_nIN, _nOUT, _state> \ diff --git a/src/emu/netlist/macro/nlm_cd4xxx.h b/src/emu/netlist/macro/nlm_cd4xxx.h index e841fb89afc..94c5d04aef8 100644 --- a/src/emu/netlist/macro/nlm_cd4xxx.h +++ b/src/emu/netlist/macro/nlm_cd4xxx.h @@ -1,7 +1,7 @@ #ifndef NLD_CD4XXX_H_ #define NLD_CD4XXX_H_ -#include "../nl_setup.h" +#include "nl_setup.h" /* * Devices: diff --git a/src/emu/netlist/macro/nlm_opamp.h b/src/emu/netlist/macro/nlm_opamp.h index 5b24ffc4842..8612f72e453 100644 --- a/src/emu/netlist/macro/nlm_opamp.h +++ b/src/emu/netlist/macro/nlm_opamp.h @@ -1,7 +1,7 @@ #ifndef NLM_OPAMP_H_ #define NLM_OPAMP_H_ -#include "../nl_setup.h" +#include "nl_setup.h" #ifndef __PLIB_PREPROCESSOR__ diff --git a/src/emu/netlist/macro/nlm_other.h b/src/emu/netlist/macro/nlm_other.h index 3bf574d6973..cc104968ed3 100644 --- a/src/emu/netlist/macro/nlm_other.h +++ b/src/emu/netlist/macro/nlm_other.h @@ -1,7 +1,7 @@ #ifndef NLM_OTHER_H_ #define NLM_OTHER_H_ -#include "../nl_setup.h" +#include "nl_setup.h" #ifndef __PLIB_PREPROCESSOR__ diff --git a/src/emu/netlist/macro/nlm_ttl74xx.h b/src/emu/netlist/macro/nlm_ttl74xx.h index d322588eb52..0fed60235c1 100644 --- a/src/emu/netlist/macro/nlm_ttl74xx.h +++ b/src/emu/netlist/macro/nlm_ttl74xx.h @@ -1,7 +1,7 @@ #ifndef NLD_TTL74XX_H_ #define NLD_TTL74XX_H_ -#include "../nl_setup.h" +#include "nl_setup.h" #ifndef __PLIB_PREPROCESSOR__ diff --git a/src/emu/netlist/nl_base.c b/src/emu/netlist/nl_base.c index 0c0b8e4d0fd..e7ef9d66a64 100644 --- a/src/emu/netlist/nl_base.c +++ b/src/emu/netlist/nl_base.c @@ -8,7 +8,6 @@ #include <solver/nld_solver.h> #include <cstring> #include <algorithm> -#include <cstdio> #include "plib/palloc.h" @@ -20,24 +19,6 @@ const netlist::netlist_time netlist::netlist_time::zero = netlist::netlist_time: namespace netlist { -//============================================================ -// Exceptions -//============================================================ - -// emu_fatalerror is a generic fatal exception that provides an error string -fatalerror_e::fatalerror_e(const char *format, ...) -{ - va_list ap; - va_start(ap, format); - m_text = pstring(format).vprintf(ap); - fprintf(stderr, "%s\n", m_text.cstr()); - va_end(ap); -} - -fatalerror_e::fatalerror_e(const char *format, va_list ap) -{ - m_text = pstring(format).vprintf(ap); -} // ---------------------------------------------------------------------------------------- // logic_family_ttl_t @@ -121,7 +102,7 @@ void queue_t::on_pre_save() pstring p = this->listptr()[i].object()->name(); int n = p.len(); n = std::min(63, n); - std::strncpy(m_names[i].m_buf, p, n); + std::strncpy(m_names[i].m_buf, p.cstr(), n); m_names[i].m_buf[n] = 0; } } diff --git a/src/emu/netlist/nl_base.h b/src/emu/netlist/nl_base.h index 940c5f54052..bfaaee9b44f 100644 --- a/src/emu/netlist/nl_base.h +++ b/src/emu/netlist/nl_base.h @@ -252,11 +252,11 @@ virtual logic_family_desc_t *default_logic_family() //============================================================ #if defined(MAME_DEBUG) -#define nl_assert(x) do { if (!(x)) throw fatalerror_e("assert: %s:%d: %s", __FILE__, __LINE__, #x); } while (0) +#define nl_assert(x) do { if (1) if (!(x)) throw fatalerror_e(pformat("assert: %1:%2: %3")(__FILE__)(__LINE__)(#x) ); } while (0) #else -#define nl_assert(x) do { if (0) if (!(x)) throw fatalerror_e("assert: %s:%d: %s", __FILE__, __LINE__, #x); } while (0) +#define nl_assert(x) do { if (0) if (!(x)) throw fatalerror_e(pformat("assert: %1:%2: %3")(__FILE__)(__LINE__)(#x) ); } while (0) #endif -#define nl_assert_always(x, msg) do { if (!(x)) throw fatalerror_e("Fatal error: %s\nCaused by assert: %s:%d: %s", msg, __FILE__, __LINE__, #x); } while (0) +#define nl_assert_always(x, msg) do { if (!(x)) throw fatalerror_e(pformat("Fatal error: %1\nCaused by assert: %2:%3: %4")(msg)(__FILE__)(__LINE__)(#x)); } while (0) // ----------------------------------------------------------------------------- @@ -284,16 +284,11 @@ namespace netlist // Exceptions //============================================================ - class fatalerror_e : public std::exception + class fatalerror_e : public pexception { public: - fatalerror_e(const char *format, ...) ATTR_PRINTF(2,3); - fatalerror_e(const char *format, va_list ap); + fatalerror_e(const pstring &text) : pexception(text) { } virtual ~fatalerror_e() throw() {} - - const pstring &text() { return m_text; } - private: - pstring m_text; }; class logic_output_t; diff --git a/src/emu/netlist/nl_factory.h b/src/emu/netlist/nl_factory.h index 7df0385fbff..b758941dd71 100644 --- a/src/emu/netlist/nl_factory.h +++ b/src/emu/netlist/nl_factory.h @@ -73,13 +73,13 @@ namespace netlist const pstring &def_param) { if (!add(name, palloc(factory_t< _C >(name, classname, def_param)))) - error(pstring::sprintf("factory already contains %s", name.cstr())); + error("factory already contains " + name); } ATTR_COLD void register_device(base_factory_t *factory) { if (!add(factory->name(), factory)) - error(pstring::sprintf("factory already contains %s", factory->name().cstr())); + error("factory already contains " + factory->name()); } //ATTR_COLD device_t *new_device_by_classname(const pstring &classname) const; diff --git a/src/emu/netlist/nl_parser.c b/src/emu/netlist/nl_parser.c index dbdabbff725..f77b97a2741 100644 --- a/src/emu/netlist/nl_parser.c +++ b/src/emu/netlist/nl_parser.c @@ -25,7 +25,7 @@ namespace netlist // A netlist parser // ---------------------------------------------------------------------------------------- -ATTR_COLD void parser_t::verror(pstring msg, int line_num, pstring line) +ATTR_COLD void parser_t::verror(const pstring &msg, int line_num, const pstring &line) { m_setup.netlist().error("line %d: error: %s\n\t\t%s\n", line_num, msg.cstr(), line.cstr()); @@ -34,14 +34,8 @@ ATTR_COLD void parser_t::verror(pstring msg, int line_num, pstring line) } -bool parser_t::parse(const char *buf, const pstring nlname) +bool parser_t::parse(const pstring nlname) { - ppreprocessor prepro; - - pstring processed = prepro.process(buf); - m_buf = processed.cstr(); - - reset(m_buf); set_identifier_chars("abcdefghijklmnopqrstuvwvxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890_.-"); set_number_chars(".0123456789", "0123456789eE-."); //FIXME: processing of numbers char ws[5]; @@ -303,7 +297,7 @@ void parser_t::net_c() if (n.is(m_tok_param_right)) break; if (!n.is(m_tok_comma)) - error("expected a comma, found <%s>", n.str().cstr()); + error(pformat("expected a comma, found <%1>")(n.str()) ); } } @@ -323,15 +317,15 @@ void parser_t::dippins() if (n.is(m_tok_param_right)) break; if (!n.is(m_tok_comma)) - error("expected a comma, found <%s>", n.str().cstr()); + error(pformat("expected a comma, found <%1>")(n.str()) ); } if ((pins.size() % 2) == 1) error("You must pass an equal number of pins to DIPPINS"); unsigned n = pins.size(); for (unsigned i = 0; i < n / 2; i++) { - m_setup.register_alias(pstring::sprintf("%d", i+1), pins[i*2]); - m_setup.register_alias(pstring::sprintf("%d", n-i), pins[i*2 + 1]); + m_setup.register_alias(pformat("%1")(i+1), pins[i*2]); + m_setup.register_alias(pformat("%1")(n-i), pins[i*2 + 1]); } } diff --git a/src/emu/netlist/nl_parser.h b/src/emu/netlist/nl_parser.h index 89c2ba4e1e1..73c6cf66837 100644 --- a/src/emu/netlist/nl_parser.h +++ b/src/emu/netlist/nl_parser.h @@ -18,11 +18,12 @@ namespace netlist { P_PREVENT_COPYING(parser_t) public: - parser_t(setup_t &setup) - : ptokenizer(), m_setup(setup), m_buf(NULL) {} + parser_t(pistream &strm, setup_t &setup) + : ptokenizer(strm), m_setup(setup), m_buf(NULL) {} - bool parse(const char *buf, const pstring nlname = ""); + bool parse(const pstring nlname = ""); + protected: void parse_netlist(const pstring &nlname); void net_alias(); void dippins(); @@ -38,11 +39,10 @@ namespace netlist void net_local_source(); void net_truthtable_start(); - protected: /* for debugging messages */ netlist_t &netlist() { return m_setup.netlist(); } - virtual void verror(pstring msg, int line_num, pstring line); + virtual void verror(const pstring &msg, int line_num, const pstring &line); private: nl_double eval_param(const token_t tok); diff --git a/src/emu/netlist/nl_setup.c b/src/emu/netlist/nl_setup.c index 9ed22058530..a25566d3d85 100644 --- a/src/emu/netlist/nl_setup.c +++ b/src/emu/netlist/nl_setup.c @@ -5,8 +5,7 @@ * */ -#include <solver/nld_solver.h> -#include <cstdio> +#include "solver/nld_solver.h" #include "plib/palloc.h" #include "nl_base.h" @@ -141,7 +140,7 @@ device_t *setup_t::register_dev(const pstring &classname, const pstring &name) void setup_t::register_model(const pstring &model_in) { - int pos = model_in.find(' '); + int pos = model_in.find(" "); if (pos < 0) netlist().error("Unable to parse model: %s", model_in.cstr()); pstring model = model_in.left(pos).trim().ucase(); @@ -171,8 +170,8 @@ void setup_t::register_dippins_arr(const pstring &terms) unsigned n = list.size(); for (unsigned i = 0; i < n / 2; i++) { - register_alias(pstring::sprintf("%d", i+1), list[i * 2]); - register_alias(pstring::sprintf("%d", n-i), list[i * 2 + 1]); + register_alias(pformat("%1")(i+1), list[i * 2]); + register_alias(pformat("%1")(n-i), list[i * 2 + 1]); } } @@ -244,7 +243,7 @@ void setup_t::register_object(device_t &dev, const pstring &name, object_t &obj) { NL_VERBOSE_OUT(("Found parameter ... %s : %s\n", name.cstr(), val.cstr())); double vald = 0; - if (std::sscanf(val.cstr(), "%lf", &vald) != 1) + if (sscanf(val.cstr(), "%lf", &vald) != 1) netlist().error("Invalid number conversion %s : %s\n", name.cstr(), val.cstr()); dynamic_cast<param_double_t &>(param).initial(vald); } @@ -254,7 +253,7 @@ void setup_t::register_object(device_t &dev, const pstring &name, object_t &obj) { NL_VERBOSE_OUT(("Found parameter ... %s : %s\n", name.cstr(), val.cstr())); double vald = 0; - if (std::sscanf(val.cstr(), "%lf", &vald) != 1) + if (sscanf(val.cstr(), "%lf", &vald) != 1) netlist().error("Invalid number conversion %s : %s\n", name.cstr(), val.cstr()); dynamic_cast<param_int_t &>(param).initial((int) vald); } @@ -333,7 +332,7 @@ void setup_t::remove_connections(const pstring pin) void setup_t::register_frontier(const pstring attach, const double r_IN, const double r_OUT) { static int frontier_cnt = 0; - pstring frontier_name = pstring::sprintf("frontier_%d", frontier_cnt); + pstring frontier_name = pformat("frontier_%1")(frontier_cnt); frontier_cnt++; device_t *front = register_dev("FRONTIER_DEV", frontier_name); register_param(frontier_name + ".RIN", r_IN); @@ -363,7 +362,7 @@ void setup_t::register_frontier(const pstring attach, const double r_IN, const d void setup_t::register_param(const pstring ¶m, const double value) { // FIXME: there should be a better way - register_param(param, pstring::sprintf("%.9e", value)); + register_param(param, pformat("%1").e(value,".9")); } void setup_t::register_param(const pstring ¶m, const pstring &value) @@ -479,7 +478,7 @@ devices::nld_base_proxy *setup_t::get_d_a_proxy(core_terminal_t &out) { // create a new one ... devices::nld_base_d_to_a_proxy *new_proxy = out_cast.logic_family()->create_d_a_proxy(&out_cast); - pstring x = pstring::sprintf("proxy_da_%s_%d", out.name().cstr(), m_proxy_cnt); + pstring x = pformat("proxy_da_%1_%2")(out.name())(m_proxy_cnt); m_proxy_cnt++; register_dev(new_proxy, x); @@ -511,7 +510,7 @@ void setup_t::connect_input_output(core_terminal_t &in, core_terminal_t &out) logic_input_t &incast = dynamic_cast<logic_input_t &>(in); devices::nld_a_to_d_proxy *proxy = palloc(devices::nld_a_to_d_proxy(&incast)); incast.set_proxy(proxy); - pstring x = pstring::sprintf("proxy_ad_%s_%d", in.name().cstr(), m_proxy_cnt); + pstring x = pformat("proxy_ad_%1_%2")(in.name())( m_proxy_cnt); m_proxy_cnt++; register_dev(proxy, x); @@ -550,7 +549,7 @@ void setup_t::connect_terminal_input(terminal_t &term, core_terminal_t &inp) NL_VERBOSE_OUT(("connect_terminal_input: connecting proxy\n")); devices::nld_a_to_d_proxy *proxy = palloc(devices::nld_a_to_d_proxy(&incast)); incast.set_proxy(proxy); - pstring x = pstring::sprintf("proxy_ad_%s_%d", inp.name().cstr(), m_proxy_cnt); + pstring x = pformat("proxy_ad_%1_%2")(inp.name())(m_proxy_cnt); m_proxy_cnt++; register_dev(proxy, x); @@ -800,8 +799,7 @@ void setup_t::resolve_inputs() { core_terminal_t *term = m_terminals.value_at(i); if (!term->has_net()) - errstr += pstring::sprintf("Found terminal %s without a net\n", - term->name().cstr()); + errstr += pformat("Found terminal %1 without a net\n")(term->name()); else if (term->net().num_cons() == 0) netlist().warning("Found terminal %s without connections", term->name().cstr()); @@ -956,10 +954,11 @@ void setup_t::model_parse(const pstring &model_in, model_map_t &map) if (!remainder.endsWith(")")) netlist().error("Model error %s\n", model.cstr()); remainder = remainder.left(remainder.len() - 1); + pstring_list_t pairs(remainder," ", true); for (unsigned i=0; i<pairs.size(); i++) { - int pose = pairs[i].find('='); + int pose = pairs[i].find("="); if (pose < 0) netlist().error("Model error on pair %s\n", model.cstr()); map[pairs[i].left(pose).ucase()] = pairs[i].substr(pose+1); @@ -985,8 +984,8 @@ nl_double setup_t::model_value(model_map_t &map, const pstring &entity) pstring tmp = model_value_str(map, entity); nl_double factor = NL_FCONST(1.0); - char numfac = *(tmp.right(1).cstr()); - switch (numfac) + pstring numfac = tmp.right(1); + switch (numfac.code_at(0)) { case 'M': factor = 1e6; break; case 'k': factor = 1e3; break; @@ -997,8 +996,8 @@ nl_double setup_t::model_value(model_map_t &map, const pstring &entity) case 'f': factor = 1e-15; break; case 'a': factor = 1e-18; break; default: - if (numfac < '0' || numfac > '9') - fatalerror_e("Unknown number factor <%c> in: %s", numfac, entity.cstr()); + if (numfac < "0" || numfac > "9") + fatalerror_e(pformat("Unknown number factor <%1> in: %2")(numfac)(entity)); } if (factor != NL_FCONST(1.0)) tmp = tmp.left(tmp.len() - 1); @@ -1013,7 +1012,7 @@ void setup_t::include(const pstring &netlist_name) { for (std::size_t i=0; i < m_sources.size(); i++) { - if (m_sources[i]->parse(this, netlist_name)) + if (m_sources[i]->parse(*this, netlist_name)) return; } netlist().error("unable to find %s in source collection", netlist_name.cstr()); @@ -1023,16 +1022,31 @@ void setup_t::include(const pstring &netlist_name) // base sources // ---------------------------------------------------------------------------------------- -bool netlist_source_string_t::parse(setup_t *setup, const pstring name) +bool source_string_t::parse(setup_t &setup, const pstring &name) +{ + pimemstream istrm(m_str.cstr(), m_str.len()); + pomemstream ostrm; + + pimemstream istrm2(ppreprocessor().process(istrm, ostrm)); + return parser_t(istrm2, setup).parse(name); +} + +bool source_mem_t::parse(setup_t &setup, const pstring &name) { - parser_t p(*setup); - return p.parse(m_str, name); + pimemstream istrm(m_str.cstr(), m_str.len()); + pomemstream ostrm; + + pimemstream istrm2(ppreprocessor().process(istrm, ostrm)); + return parser_t(istrm2, setup).parse(name); } -bool netlist_source_mem_t::parse(setup_t *setup, const pstring name) +bool source_file_t::parse(setup_t &setup, const pstring &name) { - parser_t p(*setup); - return p.parse(m_str, name); + pifilestream istrm(m_filename); + pomemstream ostrm; + + pimemstream istrm2(ppreprocessor().process(istrm, ostrm)); + return parser_t(istrm2, setup).parse(name); } } diff --git a/src/emu/netlist/nl_setup.h b/src/emu/netlist/nl_setup.h index 900fb810878..9f1fbdb9e6f 100644 --- a/src/emu/netlist/nl_setup.h +++ b/src/emu/netlist/nl_setup.h @@ -98,7 +98,7 @@ namespace netlist virtual ~source_t() { } - virtual bool parse(setup_t *setup, const pstring name) = 0; + virtual bool parse(setup_t &setup, const pstring &name) = 0; private: }; @@ -232,21 +232,6 @@ namespace netlist source_t::list_t m_sources; plist_t<pstring> m_lib; -#if 0 - template <class T> - void remove_start_with(T &hm, pstring &sw) - { - for (std::size_t i = hm.size() - 1; i >= 0; i--) - { - pstring x = hm[i]->name(); - if (sw.equals(x.substr(0, sw.len()))) - { - NL_VERBOSE_OUT(("removing %s\n", hm[i]->name().cstr())); - hm.remove(hm[i]); - } - } - } -#endif }; // ---------------------------------------------------------------------------------------- @@ -254,31 +239,46 @@ namespace netlist // ---------------------------------------------------------------------------------------- - class netlist_source_string_t : public setup_t::source_t + class source_string_t : public setup_t::source_t { public: - netlist_source_string_t(pstring source) + source_string_t(const pstring &source) : setup_t::source_t(), m_str(source) { } - bool parse(setup_t *setup, const pstring name); + bool parse(setup_t &setup, const pstring &name); private: pstring m_str; }; + class source_file_t : public setup_t::source_t + { + public: + + source_file_t(const pstring &filename) + : setup_t::source_t(), m_filename(filename) + { + } - class netlist_source_mem_t : public setup_t::source_t + bool parse(setup_t &setup, const pstring &name); + + private: + pstring m_filename; + }; + + class source_mem_t : public setup_t::source_t { public: - netlist_source_mem_t(const char *mem) + source_mem_t(const char *mem) : setup_t::source_t(), m_str(mem) { } - bool parse(setup_t *setup, const pstring name); + bool parse(setup_t &setup, const pstring &name); + private: pstring m_str; }; @@ -293,11 +293,11 @@ namespace netlist { } - bool parse(setup_t *setup, const pstring name) + bool parse(setup_t &setup, const pstring &name) { if (name == m_setup_func_name) { - m_setup_func(*setup); + m_setup_func(setup); return true; } else diff --git a/src/emu/netlist/nl_time.h b/src/emu/netlist/nl_time.h index 4473b67d2c8..ddb3c85d14e 100644 --- a/src/emu/netlist/nl_time.h +++ b/src/emu/netlist/nl_time.h @@ -23,7 +23,8 @@ // net_list_time // ---------------------------------------------------------------------------------------- -#define RESOLUTION NETLIST_INTERNAL_RES +#undef ATTR_HOT +#define ATTR_HOT namespace netlist { @@ -31,71 +32,73 @@ namespace netlist { public: +#if (PHAS_INT128) + typedef UINT128 INTERNALTYPE; + static const pstate_data_type_e STATETYPE = DT_INT128; +#else typedef UINT64 INTERNALTYPE; + static const pstate_data_type_e STATETYPE = DT_INT64; +#endif + static const INTERNALTYPE RESOLUTION = NETLIST_INTERNAL_RES; - ATTR_HOT /* inline */ netlist_time() : m_time(0) {} + ATTR_HOT netlist_time() : m_time(0) {} + ATTR_HOT netlist_time(const netlist_time &rhs) : m_time(rhs.m_time) {} - ATTR_HOT friend /* inline */ const netlist_time operator-(const netlist_time &left, const netlist_time &right); - ATTR_HOT friend /* inline */ const netlist_time operator+(const netlist_time &left, const netlist_time &right); - ATTR_HOT friend /* inline */ const netlist_time operator*(const netlist_time &left, const UINT32 factor); - ATTR_HOT friend /* inline */ UINT32 operator/(const netlist_time &left, const netlist_time &right); - ATTR_HOT friend /* inline */ bool operator>(const netlist_time &left, const netlist_time &right); - ATTR_HOT friend /* inline */ bool operator<(const netlist_time &left, const netlist_time &right); - ATTR_HOT friend /* inline */ bool operator>=(const netlist_time &left, const netlist_time &right); - ATTR_HOT friend /* inline */ bool operator<=(const netlist_time &left, const netlist_time &right); - ATTR_HOT friend /* inline */ bool operator!=(const netlist_time &left, const netlist_time &right); + ATTR_HOT friend const netlist_time operator-(const netlist_time &left, const netlist_time &right); + ATTR_HOT friend const netlist_time operator+(const netlist_time &left, const netlist_time &right); + ATTR_HOT friend const netlist_time operator*(const netlist_time &left, const UINT64 factor); + ATTR_HOT friend UINT64 operator/(const netlist_time &left, const netlist_time &right); + ATTR_HOT friend bool operator>(const netlist_time &left, const netlist_time &right); + ATTR_HOT friend bool operator<(const netlist_time &left, const netlist_time &right); + ATTR_HOT friend bool operator>=(const netlist_time &left, const netlist_time &right); + ATTR_HOT friend bool operator<=(const netlist_time &left, const netlist_time &right); + ATTR_HOT friend bool operator!=(const netlist_time &left, const netlist_time &right); - ATTR_HOT /* inline */ const netlist_time &operator=(const netlist_time &right) { m_time = right.m_time; return *this; } - ATTR_HOT /* inline */ const netlist_time &operator=(const double &right) { m_time = (INTERNALTYPE) ( right * (double) RESOLUTION); return *this; } + ATTR_HOT const netlist_time &operator=(const netlist_time &right) { m_time = right.m_time; return *this; } - // issues with ISO C++ standard - //ATTR_HOT /* inline */ operator double() const { return as_double(); } + ATTR_HOT const netlist_time &operator+=(const netlist_time &right) { m_time += right.m_time; return *this; } - ATTR_HOT /* inline */ const netlist_time &operator+=(const netlist_time &right) { m_time += right.m_time; return *this; } - - ATTR_HOT /* inline */ INTERNALTYPE as_raw() const { return m_time; } - ATTR_HOT /* inline */ double as_double() const { return (double) m_time / (double) RESOLUTION; } + ATTR_HOT INTERNALTYPE as_raw() const { return m_time; } + ATTR_HOT double as_double() const { return (double) m_time / (double) RESOLUTION; } // for save states .... - ATTR_HOT /* inline */ INTERNALTYPE *get_internaltype_ptr() { return &m_time; } + ATTR_HOT INTERNALTYPE *get_internaltype_ptr() { return &m_time; } - ATTR_HOT static /* inline */ const netlist_time from_nsec(const int ns) { return netlist_time((UINT64) ns * (RESOLUTION / U64(1000000000))); } - ATTR_HOT static /* inline */ const netlist_time from_usec(const int us) { return netlist_time((UINT64) us * (RESOLUTION / U64(1000000))); } - ATTR_HOT static /* inline */ const netlist_time from_msec(const int ms) { return netlist_time((UINT64) ms * (RESOLUTION / U64(1000))); } - ATTR_HOT static /* inline */ const netlist_time from_hz(const UINT64 hz) { return netlist_time(RESOLUTION / hz); } - ATTR_HOT static /* inline */ const netlist_time from_double(const double t) { return netlist_time((INTERNALTYPE) ( t * (double) RESOLUTION)); } - ATTR_HOT static /* inline */ const netlist_time from_raw(const INTERNALTYPE raw) { return netlist_time(raw); } + ATTR_HOT static const netlist_time from_nsec(const INTERNALTYPE ns) { return netlist_time(ns * (RESOLUTION / U64(1000000000))); } + ATTR_HOT static const netlist_time from_usec(const INTERNALTYPE us) { return netlist_time(us * (RESOLUTION / U64(1000000))); } + ATTR_HOT static const netlist_time from_msec(const INTERNALTYPE ms) { return netlist_time(ms * (RESOLUTION / U64(1000))); } + ATTR_HOT static const netlist_time from_hz(const INTERNALTYPE hz) { return netlist_time(RESOLUTION / hz); } + ATTR_HOT static const netlist_time from_double(const double t) { return netlist_time((INTERNALTYPE) ( t * (double) RESOLUTION)); } + ATTR_HOT static const netlist_time from_raw(const INTERNALTYPE raw) { return netlist_time(raw); } static const netlist_time zero; protected: - ATTR_HOT /* inline */ netlist_time(const INTERNALTYPE val) : m_time(val) {} + ATTR_HOT netlist_time(const INTERNALTYPE val) : m_time(val) {} private: INTERNALTYPE m_time; }; - #undef RESOLUTION - ATTR_HOT inline const netlist_time operator-(const netlist_time &left, const netlist_time &right) { - return netlist_time::from_raw(left.m_time - right.m_time); + return netlist_time(left.m_time - right.m_time); } - ATTR_HOT inline const netlist_time operator*(const netlist_time &left, const UINT32 factor) + ATTR_HOT inline const netlist_time operator*(const netlist_time &left, const UINT64 factor) { - return netlist_time::from_raw(left.m_time * factor); + return netlist_time(left.m_time * factor); } - ATTR_HOT inline UINT32 operator/(const netlist_time &left, const netlist_time &right) + ATTR_HOT inline UINT64 operator/(const netlist_time &left, const netlist_time &right) { return left.m_time / right.m_time; } ATTR_HOT inline const netlist_time operator+(const netlist_time &left, const netlist_time &right) { - return netlist_time::from_raw(left.m_time + right.m_time); + return netlist_time(left.m_time + right.m_time); } ATTR_HOT inline bool operator<(const netlist_time &left, const netlist_time &right) @@ -127,7 +130,7 @@ namespace netlist template<> ATTR_COLD inline void pstate_manager_t::save_item(netlist::netlist_time &nlt, const void *owner, const pstring &stname) { - save_state_ptr(stname, DT_INT64, owner, sizeof(netlist::netlist_time::INTERNALTYPE), 1, nlt.get_internaltype_ptr(), false); + save_state_ptr(stname, netlist::netlist_time::STATETYPE, owner, sizeof(netlist::netlist_time::INTERNALTYPE), 1, nlt.get_internaltype_ptr(), false); } diff --git a/src/emu/netlist/plib/palloc.c b/src/emu/netlist/plib/palloc.c index 2ed54bd0b35..5746264322b 100644 --- a/src/emu/netlist/plib/palloc.c +++ b/src/emu/netlist/plib/palloc.c @@ -8,6 +8,16 @@ #include "pconfig.h" #include "palloc.h" +//============================================================ +// Exceptions +//============================================================ + +pexception::pexception(const pstring &text) +{ + m_text = text; + fprintf(stderr, "%s\n", m_text.cstr()); +} + #if (PSTANDALONE) #include <stdlib.h> #include <xmmintrin.h> diff --git a/src/emu/netlist/plib/palloc.h b/src/emu/netlist/plib/palloc.h index badbc681486..26f76255e76 100644 --- a/src/emu/netlist/plib/palloc.h +++ b/src/emu/netlist/plib/palloc.h @@ -8,9 +8,26 @@ #ifndef PALLOC_H_ #define PALLOC_H_ -#include <cstdio> +#include <exception> #include "pconfig.h" +#include "pstring.h" + +//============================================================ +// exception base +//============================================================ + +class pexception : public std::exception +{ +public: + pexception(const pstring &text); + virtual ~pexception() throw() {} + + const pstring &text() { return m_text; } + +private: + pstring m_text; +}; //============================================================ // Memory allocation diff --git a/src/emu/netlist/plib/pconfig.h b/src/emu/netlist/plib/pconfig.h index c06fe3e3d2f..021bb7ff72d 100644 --- a/src/emu/netlist/plib/pconfig.h +++ b/src/emu/netlist/plib/pconfig.h @@ -19,6 +19,18 @@ #define PSTANDALONE (0) #endif +//#define PHAS_INT128 (0) + +#ifndef PHAS_INT128 +#define PHAS_INT128 (0) +#endif + +#if (PHAS_INT128) +typedef __uint128_t UINT128; +typedef __int128_t INT128; +#endif + + #if !(PSTANDALONE) #include "osdcore.h" #include "eminline.h" @@ -45,7 +57,6 @@ _name(const _name &); \ _name &operator=(const _name &); - //============================================================ // Compiling standalone //============================================================ diff --git a/src/emu/netlist/plib/plists.h b/src/emu/netlist/plib/plists.h index bbb553eb12a..af3521bd7db 100644 --- a/src/emu/netlist/plib/plists.h +++ b/src/emu/netlist/plib/plists.h @@ -499,8 +499,7 @@ public: } p = p->m_next; } - //FXIME: throw a standard exception - //nl_assert_always(false, "element not found"); + throw pexception("element not found"); } } @@ -581,12 +580,12 @@ public: pstring col = ""; int i = 0; - while (i<str.len()) + while (i<str.blen()) { int p = -1; for (std::size_t j=0; j < onstrl.size(); j++) { - if (std::strncmp(onstrl[j].cstr(), &(str.cstr()[i]), onstrl[j].len())==0) + if (std::memcmp(onstrl[j].cstr(), &(str.cstr()[i]), onstrl[j].blen())==0) { p = j; break; @@ -596,14 +595,16 @@ public: { if (col != "") temp.add(col); + col = ""; temp.add(onstrl[p]); - i += onstrl[p].len(); + i += onstrl[p].blen(); } else { - col += str.cstr()[i]; - i++; + pstring::traits::code_t c = pstring::traits::code(str.cstr() + i); + col += c; + i+=pstring::traits::codelen(c); } } if (col != "") @@ -640,9 +641,9 @@ struct phash_functor<pstring> phash_functor(const pstring &v) { /* modified djb2 */ - const char *string = v.cstr(); + const pstring::mem_t *string = v.cstr(); unsigned result = 5381; - for (UINT8 c = *string; c != 0; c = *string++) + for (pstring::mem_t c = *string; c != 0; c = *string++) result = ((result << 5) + result ) ^ (result >> (32 - 5)) ^ c; //result = (result*33) ^ c; m_hash = result; diff --git a/src/emu/netlist/plib/pparser.c b/src/emu/netlist/plib/pparser.c index 9ea2505c327..7e05c8a29e0 100644 --- a/src/emu/netlist/plib/pparser.c +++ b/src/emu/netlist/plib/pparser.c @@ -5,7 +5,6 @@ * */ -#include <cstdio> #include <cstdarg> #include "pparser.h" @@ -26,19 +25,13 @@ pstring ptokenizer::currentline_str() { - char buf[300]; - int bufp = 0; - const char *p = m_line_ptr; - while (*p && *p != 10) - buf[bufp++] = *p++; - buf[bufp] = 0; - return pstring(buf); + return m_cur_line; } void ptokenizer::skipeol() { - char c = getc(); + pstring::code_t c = getc(); while (c) { if (c == 10) @@ -53,17 +46,19 @@ void ptokenizer::skipeol() } -unsigned char ptokenizer::getc() +pstring::code_t ptokenizer::getc() { - if (*m_px == 10) + if (m_px >= m_cur_line.len()) { - m_line++; - m_line_ptr = m_px + 1; + if (m_strm.readline(m_cur_line)) + { + m_cur_line += "\n"; + m_px = 0; + } + else + return 0; } - if (*m_px) - return *(m_px++); - else - return *m_px; + return m_cur_line.code_at(m_px++); } void ptokenizer::ungetc() @@ -80,7 +75,7 @@ void ptokenizer::require_token(const token_t tok, const token_id_t &token_num) { if (!tok.is(token_num)) { - error("Error: expected token <%s> got <%s>\n", m_tokens[token_num.id()].cstr(), tok.str().cstr()); + error(pformat("Expected token <%1> got <%2>")(m_tokens[token_num.id()])(tok.str()) ); } } @@ -89,7 +84,7 @@ pstring ptokenizer::get_string() token_t tok = get_token(); if (!tok.is_type(STRING)) { - error("Error: expected a string, got <%s>\n", tok.str().cstr()); + error(pformat("Expected a string, got <%1>")(tok.str()) ); } return tok.str(); } @@ -99,7 +94,7 @@ pstring ptokenizer::get_identifier() token_t tok = get_token(); if (!tok.is_type(IDENTIFIER)) { - error("Error: expected an identifier, got <%s>\n", tok.str().cstr()); + error(pformat("Expected an identifier, got <%1>")(tok.str()) ); } return tok.str(); } @@ -109,7 +104,7 @@ pstring ptokenizer::get_identifier_or_number() token_t tok = get_token(); if (!(tok.is_type(IDENTIFIER) || tok.is_type(NUMBER))) { - error("Error: expected an identifier, got <%s>\n", tok.str().cstr()); + error(pformat("Expected an identifier, got <%1>")(tok.str()) ); } return tok.str(); } @@ -119,12 +114,12 @@ double ptokenizer::get_number_double() token_t tok = get_token(); if (!tok.is_type(NUMBER)) { - error("Error: expected a number, got <%s>\n", tok.str().cstr()); + error(pformat("Expected a number, got <%1>")(tok.str()) ); } bool err = false; double ret = tok.str().as_double(&err); if (err) - error("Error: expected a number, got <%s>\n", tok.str().cstr()); + error(pformat("Expected a number, got <%1>")(tok.str()) ); return ret; } @@ -133,12 +128,12 @@ long ptokenizer::get_number_long() token_t tok = get_token(); if (!tok.is_type(NUMBER)) { - error("Error: expected a long int, got <%s>\n", tok.str().cstr()); + error(pformat("Expected a long int, got <%1>")(tok.str()) ); } bool err = false; long ret = tok.str().as_long(&err); if (err) - error("Error: expected a long int, got <%s>\n", tok.str().cstr()); + error(pformat("Expected a long int, got <%1>")(tok.str()) ); return ret; } @@ -165,14 +160,16 @@ ptokenizer::token_t ptokenizer::get_token() skipeol(); } else + { return ret; + } } } ptokenizer::token_t ptokenizer::get_token_internal() { /* skip ws */ - char c = getc(); + pstring::code_t c = getc(); while (m_whitespace.find(c)>=0) { c = getc(); @@ -255,16 +252,9 @@ ptokenizer::token_t ptokenizer::get_token_internal() } -ATTR_COLD void ptokenizer::error(const char *format, ...) +ATTR_COLD void ptokenizer::error(const pstring &errs) { - va_list ap; - va_start(ap, format); - - pstring errmsg1 = pstring(format).vprintf(ap); - va_end(ap); - - verror(errmsg1, currentline_no(), currentline_str()); - + verror("Error: " + errs, currentline_no(), currentline_str()); //throw error; } @@ -273,6 +263,7 @@ ATTR_COLD void ptokenizer::error(const char *format, ...) // ---------------------------------------------------------------------------------------- ppreprocessor::ppreprocessor() +: m_ifflag(0), m_level(0), m_lineno(0) { m_expr_sep.add("!"); m_expr_sep.add("("); @@ -285,12 +276,12 @@ ppreprocessor::ppreprocessor() m_expr_sep.add(" "); m_expr_sep.add("\t"); - m_defines.add(define_t("__PLIB_PREPROCESSOR__", "1")); + m_defines.add("__PLIB_PREPROCESSOR__", define_t("__PLIB_PREPROCESSOR__", "1")); } void ppreprocessor::error(const pstring &err) { - fprintf(stderr, "PREPRO ERROR: %s\n", err.cstr()); + throw pexception("PREPRO ERROR: " + err); } @@ -367,12 +358,11 @@ double ppreprocessor::expr(const pstring_list_t &sexpr, std::size_t &start, int ppreprocessor::define_t *ppreprocessor::get_define(const pstring &name) { - for (std::size_t i = 0; i<m_defines.size(); i++) - { - if (m_defines[i].m_name == name) - return &m_defines[i]; - } - return NULL; + int idx = m_defines.index_of(name); + if (idx >= 0) + return &m_defines.value_at(idx); + else + return NULL; } pstring ppreprocessor::replace_macros(const pstring &line) @@ -387,7 +377,7 @@ pstring ppreprocessor::replace_macros(const pstring &line) else ret.cat(elems[i]); } - return pstring(ret.cstr()); + return ret; } static pstring catremainder(const pstring_list_t &elems, std::size_t start, pstring sep) @@ -401,91 +391,92 @@ static pstring catremainder(const pstring_list_t &elems, std::size_t start, pstr return pstring(ret.cstr()); } -pstring ppreprocessor::process(const pstring &contents) +pstring ppreprocessor::process_line(const pstring &line) { - pstringbuffer ret = ""; - pstring_list_t lines(contents,"\n", false); - UINT32 ifflag = 0; // 31 if levels - int level = 0; - - std::size_t i=0; - while (i<lines.size()) + pstring lt = line.replace("\t"," ").trim(); + pstringbuffer ret; + m_lineno++; + // FIXME ... revise and extend macro handling + if (lt.startsWith("#")) { - pstring line = lines[i]; - pstring lt = line.replace("\t"," ").trim(); - // FIXME ... revise and extend macro handling - if (lt.startsWith("#")) + pstring_list_t lti(lt, " ", true); + if (lti[0].equals("#if")) { - pstring_list_t lti(lt, " ", true); - if (lti[0].equals("#if")) - { - level++; - std::size_t start = 0; - lt = replace_macros(lt); - pstring_list_t t = pstring_list_t::splitexpr(lt.substr(3).replace(" ",""), m_expr_sep); - int val = expr(t, start, 0); - if (val == 0) - ifflag |= (1 << level); - } - else if (lti[0].equals("#ifdef")) - { - level++; - if (get_define(lti[1]) == NULL) - ifflag |= (1 << level); - } - else if (lti[0].equals("#ifndef")) - { - level++; - if (get_define(lti[1]) != NULL) - ifflag |= (1 << level); - } - else if (lti[0].equals("#else")) - { - ifflag ^= (1 << level); - } - else if (lti[0].equals("#endif")) - { - ifflag &= ~(1 << level); - level--; - } - else if (lti[0].equals("#include")) - { - // ignore - } - else if (lti[0].equals("#pragma")) + m_level++; + std::size_t start = 0; + lt = replace_macros(lt); + pstring_list_t t = pstring_list_t::splitexpr(lt.substr(3).replace(" ",""), m_expr_sep); + int val = expr(t, start, 0); + if (val == 0) + m_ifflag |= (1 << m_level); + } + else if (lti[0].equals("#ifdef")) + { + m_level++; + if (get_define(lti[1]) == NULL) + m_ifflag |= (1 << m_level); + } + else if (lti[0].equals("#ifndef")) + { + m_level++; + if (get_define(lti[1]) != NULL) + m_ifflag |= (1 << m_level); + } + else if (lti[0].equals("#else")) + { + m_ifflag ^= (1 << m_level); + } + else if (lti[0].equals("#endif")) + { + m_ifflag &= ~(1 << m_level); + m_level--; + } + else if (lti[0].equals("#include")) + { + // ignore + } + else if (lti[0].equals("#pragma")) + { + if (m_ifflag == 0 && lti.size() > 3 && lti[1].equals("NETLIST")) { - if (ifflag == 0 && lti.size() > 3 && lti[1].equals("NETLIST")) - { - if (lti[2].equals("warning")) - error("NETLIST: " + catremainder(lti, 3, " ")); - } + if (lti[2].equals("warning")) + error("NETLIST: " + catremainder(lti, 3, " ")); } - else if (lti[0].equals("#define")) + } + else if (lti[0].equals("#define")) + { + if (m_ifflag == 0) { - if (ifflag == 0) - { - if (lti.size() != 3) - error(pstring::sprintf("PREPRO: only simple defines allowed: %s", line.cstr())); - m_defines.add(define_t(lti[1], lti[2])); - } + if (lti.size() != 3) + error("PREPRO: only simple defines allowed: %s" + line); + m_defines.add(lti[1], define_t(lti[1], lti[2])); } - else - error(pstring::sprintf("unknown directive on line %" SIZETFMT ": %s\n", SIZET_PRINTF(i), line.cstr())); } else + error(pformat("unknown directive on line %1: %2")(m_lineno)(line)); + } + else + { + lt = replace_macros(lt); + if (m_ifflag == 0) { - //if (ifflag == 0 && level > 0) - // fprintf(stderr, "conditional: %s\n", line.cstr()); - lt = replace_macros(lt); - if (ifflag == 0) - { - ret.cat(lt); - ret.cat("\n"); - } + ret.cat(lt); + ret.cat("\n"); } - i++; } - return pstring(ret.cstr()); + return ret; +} + + +postream & ppreprocessor::process_i(pistream &istrm, postream &ostrm) +{ + pstring line; + while (istrm.readline(line)) + { + line = process_line(line); + ostrm.writeline(line); + } + return ostrm; } diff --git a/src/emu/netlist/plib/pparser.h b/src/emu/netlist/plib/pparser.h index 15d81294a09..e425af17569 100644 --- a/src/emu/netlist/plib/pparser.h +++ b/src/emu/netlist/plib/pparser.h @@ -11,6 +11,7 @@ #include "pconfig.h" #include "pstring.h" #include "plists.h" +#include "pstream.h" class ptokenizer { @@ -18,8 +19,8 @@ class ptokenizer public: virtual ~ptokenizer() {} - ptokenizer() - : m_line(1), m_line_ptr(NULL), m_px(NULL), m_string('"') + ptokenizer(pistream &strm) + : m_strm(strm), m_lineno(1), m_px(0), m_string('"') {} enum token_type @@ -78,7 +79,7 @@ public: }; - int currentline_no() { return m_line; } + int currentline_no() { return m_lineno; } pstring currentline_str(); /* tokenizer stuff follows ... */ @@ -111,23 +112,24 @@ public: } token_t get_token_internal(); - void error(const char *format, ...) ATTR_PRINTF(2,3); - - void reset(const char *p) { m_px = p; m_line = 1; m_line_ptr = p; } + void error(const pstring &errs); protected: - virtual void verror(pstring msg, int line_num, pstring line) = 0; + virtual void verror(const pstring &msg, int line_num, const pstring &line) = 0; private: void skipeol(); - unsigned char getc(); + pstring::code_t getc(); void ungetc(); - bool eof() { return *m_px == 0; } - int m_line; - const char * m_line_ptr; - const char * m_px; + bool eof() { return m_strm.eof(); } + + pistream &m_strm; + + int m_lineno; + pstring m_cur_line; + unsigned m_px; /* tokenizer stuff follows ... */ @@ -162,10 +164,16 @@ public: ppreprocessor(); virtual ~ppreprocessor() {} - pstring process(const pstring &contents); + template<class ISTR, class OSTR> + OSTR &process(ISTR &istrm, OSTR &ostrm) + { + return dynamic_cast<OSTR &>(process_i(istrm, ostrm)); + } protected: + postream &process_i(pistream &istrm, postream &ostrm); + double expr(const pstring_list_t &sexpr, std::size_t &start, int prio); define_t *get_define(const pstring &name); @@ -176,8 +184,15 @@ protected: private: - plist_t<define_t> m_defines; + pstring process_line(const pstring &line); + + phashmap_t<pstring, define_t> m_defines; pstring_list_t m_expr_sep; + + //pstringbuffer m_ret; + UINT32 m_ifflag; // 31 if levels + int m_level; + int m_lineno; }; #endif /* PPARSER_H_ */ diff --git a/src/emu/netlist/plib/pstate.c b/src/emu/netlist/plib/pstate.c index 326eb13fe49..cf2c863ed11 100644 --- a/src/emu/netlist/plib/pstate.c +++ b/src/emu/netlist/plib/pstate.c @@ -25,6 +25,9 @@ ATTR_COLD void pstate_manager_t::save_state_ptr(const pstring &stname, const pst "NOT_SUPPORTED", "DT_CUSTOM", "DT_DOUBLE", +#if (PHAS_INT128) + "DT_INT128", +#endif "DT_INT64", "DT_INT16", "DT_INT8", diff --git a/src/emu/netlist/plib/pstate.h b/src/emu/netlist/plib/pstate.h index 0350b0fe309..b42d3dac882 100644 --- a/src/emu/netlist/plib/pstate.h +++ b/src/emu/netlist/plib/pstate.h @@ -32,6 +32,9 @@ enum pstate_data_type_e { NOT_SUPPORTED, DT_CUSTOM, DT_DOUBLE, +#if (PHAS_INT128) + DT_INT128, +#endif DT_INT64, DT_INT16, DT_INT8, @@ -63,6 +66,10 @@ NETLIST_SAVE_TYPE(double, DT_DOUBLE); NETLIST_SAVE_TYPE(float, DT_FLOAT); NETLIST_SAVE_TYPE(INT8, DT_INT8); NETLIST_SAVE_TYPE(UINT8, DT_INT8); +#if (PHAS_INT128) +NETLIST_SAVE_TYPE(INT128, DT_INT128); +NETLIST_SAVE_TYPE(UINT128, DT_INT128); +#endif NETLIST_SAVE_TYPE(INT64, DT_INT64); NETLIST_SAVE_TYPE(UINT64, DT_INT64); NETLIST_SAVE_TYPE(bool, DT_BOOLEAN); diff --git a/src/emu/netlist/plib/pstream.c b/src/emu/netlist/plib/pstream.c new file mode 100644 index 00000000000..07ef55730da --- /dev/null +++ b/src/emu/netlist/plib/pstream.c @@ -0,0 +1,267 @@ +// license:GPL-2.0+ +// copyright-holders:Couriersud +/* + * pstream.c + * + */ + +#include <cstdio> +#include <cstring> +#include <cstdlib> +#include <algorithm> + +#include "pstream.h" +#include "palloc.h" + +// ----------------------------------------------------------------------------- +// Input file stream +// ----------------------------------------------------------------------------- + +pifilestream::pifilestream(const pstring &fname) : pistream(0), m_pos(0) +{ + m_file = fopen(fname.cstr(), "rb"); + if (m_file == NULL) + { + set_flag(FLAG_ERROR); + set_flag(FLAG_EOF); + set_flag(FLAG_CLOSED); + } + else + { + if (ftell((FILE *) m_file) >= 0) + { + if (fseek((FILE *) m_file, 0, SEEK_SET) >= 0) + set_flag(FLAG_SEEKABLE); + } + } +} + +pifilestream::~pifilestream() +{ + if (!closed()) + close(); +} + +void pifilestream::close() +{ + fclose((FILE *) m_file); + set_flag(FLAG_CLOSED); +} + +unsigned pifilestream::vread(void *buf, unsigned n) +{ + std::size_t r = fread(buf, 1, n, (FILE *) m_file); + if (r < n) + { + if (feof((FILE *) m_file)) + set_flag(FLAG_EOF); + if (ferror((FILE *) m_file)) + set_flag(FLAG_ERROR); + } + m_pos += r; + return r; +} + +void pifilestream::vseek(pos_type n) +{ + check_seekable(); + if (fseek((FILE *) m_file, SEEK_SET, n) < 0) + set_flag(FLAG_ERROR); + else + m_pos = n; + if (feof((FILE *) m_file)) + set_flag(FLAG_EOF); + else + clear_flag(FLAG_EOF); + if (ferror((FILE *) m_file)) + set_flag(FLAG_ERROR); +} + +pifilestream::pos_type pifilestream::vtell() +{ + long ret = ftell((FILE *) m_file); + if (ret < 0) + { + return m_pos; + } + else + return ret; +} + +// ----------------------------------------------------------------------------- +// Output file stream +// ----------------------------------------------------------------------------- + +pofilestream::pofilestream(const pstring &fname) : postream(0), m_pos(0) +{ + m_file = fopen(fname.cstr(), "wb"); + if (m_file == NULL) + { + set_flag(FLAG_ERROR); + set_flag(FLAG_CLOSED); + } + else + { + if (ftell((FILE *) m_file) >= 0) + { + if (fseek((FILE *) m_file, 0, SEEK_SET) >= 0) + set_flag(FLAG_SEEKABLE); + } + } +} + +pofilestream::~pofilestream() +{ + if (!closed()) + close(); +} + +void pofilestream::close() +{ + fclose((FILE *) m_file); + set_flag(FLAG_CLOSED); +} + +void pofilestream::vwrite(const void *buf, unsigned n) +{ + std::size_t r = fwrite(buf, 1, n, (FILE *) m_file); + if (r < n) + { + if (ferror((FILE *) m_file)) + set_flag(FLAG_ERROR); + } + m_pos += r; +} + +void pofilestream::vseek(pos_type n) +{ + check_seekable(); + if (fseek((FILE *) m_file, SEEK_SET, n) < 0) + set_flag(FLAG_ERROR); + else + { + m_pos = n; + if (ferror((FILE *) m_file)) + set_flag(FLAG_ERROR); + } +} + +pifilestream::pos_type pofilestream::vtell() +{ + long ret = ftell((FILE *) m_file); + if (ret < 0) + { + return m_pos; + } + else + return ret; +} + +// ----------------------------------------------------------------------------- +// Memory stream +// ----------------------------------------------------------------------------- + +pimemstream::pimemstream(const void *mem, const pos_type len) + : pistream(FLAG_SEEKABLE), m_pos(0), m_len(len), m_mem((char *) mem) +{ +} + +pimemstream::pimemstream(const pomemstream &ostrm) +: pistream(FLAG_SEEKABLE), m_pos(0), m_len(ostrm.size()), m_mem((char *) ostrm.memory()) +{ +} + +pimemstream::~pimemstream() +{ +} + +unsigned pimemstream::vread(void *buf, unsigned n) +{ + unsigned ret = (m_pos + n <= m_len) ? n : m_len - m_pos; + + if (ret > 0) + { + memcpy(buf, m_mem + m_pos, ret); + m_pos += ret; + } + + if (ret < n) + set_flag(FLAG_EOF); + + return ret; +} + +void pimemstream::vseek(pos_type n) +{ + m_pos = (n>=m_len) ? m_len : n; + clear_flag(FLAG_EOF); + +} + +pimemstream::pos_type pimemstream::vtell() +{ + return m_pos; +} + +// ----------------------------------------------------------------------------- +// Output memory stream +// ----------------------------------------------------------------------------- + +pomemstream::pomemstream() +: postream(FLAG_SEEKABLE), m_pos(0), m_capacity(1024), m_size(0) +{ + m_mem = palloc_array(char, m_capacity); +} + +pomemstream::~pomemstream() +{ + pfree_array(m_mem); +} + +void pomemstream::vwrite(const void *buf, unsigned n) +{ + if (m_pos + n >= m_capacity) + { + while (m_pos + n >= m_capacity) + m_capacity *= 2; + char *o = m_mem; + m_mem = palloc_array(char, m_capacity); + if (m_mem == NULL) + { + set_flag(FLAG_ERROR); + return; + } + memcpy(m_mem, o, m_pos); + pfree_array(o); + } + + memcpy(m_mem + m_pos, buf, n); + m_pos += n; + m_size = std::max(m_pos, m_size); +} + +void pomemstream::vseek(pos_type n) +{ + m_pos = n; + m_size = std::max(m_pos, m_size); + if (m_size >= m_capacity) + { + while (m_size >= m_capacity) + m_capacity *= 2; + char *o = m_mem; + m_mem = palloc_array(char, m_capacity); + if (m_mem == NULL) + { + set_flag(FLAG_ERROR); + return; + } + memcpy(m_mem, o, m_pos); + pfree_array(o); + } +} + +pstream::pos_type pomemstream::vtell() +{ + return m_pos; +} + diff --git a/src/emu/netlist/plib/pstream.h b/src/emu/netlist/plib/pstream.h new file mode 100644 index 00000000000..d0cfd8e21d8 --- /dev/null +++ b/src/emu/netlist/plib/pstream.h @@ -0,0 +1,307 @@ +// license:GPL-2.0+ +// copyright-holders:Couriersud +/* + * pstream.h + */ + +#ifndef _PSTREAM_H_ +#define _PSTREAM_H_ + +#include <cstdarg> +#include <cstddef> +#include <stdexcept> + +#include "pconfig.h" +#include "pstring.h" +#include "palloc.h" + +// ----------------------------------------------------------------------------- +// pstream: things common to all streams +// ----------------------------------------------------------------------------- + +class pstream +{ + P_PREVENT_COPYING(pstream); +public: + + typedef long unsigned pos_type; + + static const pos_type SEEK_EOF = (pos_type) -1; + + pstream(unsigned flags) : m_flags(flags) + { + } + virtual ~pstream() + { + } + + bool bad() const { return ((m_flags & FLAG_ERROR) != 0); } + bool seekable() const { return ((m_flags & FLAG_SEEKABLE) != 0); } + + void seek(pos_type n) + { + check_seekable(); + return vseek(n); + } + + pos_type tell() + { + return vtell(); + } + +protected: + virtual void vseek(pos_type n) = 0; + virtual pos_type vtell() = 0; + + static const unsigned FLAG_EOF = 0x01; + static const unsigned FLAG_ERROR = 0x02; + static const unsigned FLAG_SEEKABLE = 0x04; + static const unsigned FLAG_CLOSED = 0x08; /* convenience flag */ + + bool closed() { return ((m_flags & FLAG_CLOSED) != 0); } + + void set_flag(unsigned flag) + { + m_flags |= flag; + } + void clear_flag(unsigned flag) + { + m_flags &= ~flag; + } + + void check_not_eof() const + { + if (m_flags & FLAG_EOF) + throw pexception("unexpected eof"); + } + + void check_seekable() const + { + if (!(m_flags & FLAG_SEEKABLE)) + throw pexception("stream is not seekable"); + } + + unsigned flags() const { return m_flags; } +private: + + unsigned m_flags; +}; + +// ----------------------------------------------------------------------------- +// pistream: input stream +// ----------------------------------------------------------------------------- + +class pistream : public pstream +{ + P_PREVENT_COPYING(pistream); +public: + + pistream(unsigned flags) : pstream(flags) {} + virtual ~pistream() {} + + bool eof() const { return ((flags() & FLAG_EOF) != 0) || bad(); } + + /* this digests linux & dos/windows text files */ + + bool readline(pstring &line) + { + UINT8 c = 0; + pstringbuffer buf; + if (!this->read(c)) + { + line = ""; + return false; + } + while (true) + { + if (c == 10) + break; + else if (c != 13) /* ignore CR */ + buf += c; + if (!this->read(c)) + break; + } + line = buf; + return true; + } + + bool read(UINT8 &c) + { + return (read(&c, 1) == 1); + } + + unsigned read(void *buf, unsigned n) + { + return vread(buf, n); + } + +protected: + /* read up to n bytes from stream */ + virtual unsigned vread(void *buf, unsigned n) = 0; + +private: +}; + +// ----------------------------------------------------------------------------- +// postream: output stream +// ----------------------------------------------------------------------------- + +class postream : public pstream +{ + P_PREVENT_COPYING(postream); +public: + + postream(unsigned flags) : pstream(flags) {} + virtual ~postream() {} + + /* this digests linux & dos/windows text files */ + + void writeline(const pstring &line) + { + write(line.cstr(), line.blen()); + write(10); + } + + void write(const pstring &text) + { + write(text.cstr(), text.blen()); + } + + void write(const char c) + { + write(&c, 1); + } + + void write(const void *buf, unsigned n) + { + vwrite(buf, n); + } + +protected: + /* write n bytes to stream */ + virtual void vwrite(const void *buf, unsigned n) = 0; + +private: +}; + +// ----------------------------------------------------------------------------- +// pomemstream: output string stream +// ----------------------------------------------------------------------------- + +class pomemstream : public postream +{ + P_PREVENT_COPYING(pomemstream); +public: + + pomemstream(); + virtual ~pomemstream(); + + char *memory() const { return m_mem; } + unsigned size() const { return m_size; } + +protected: + /* write n bytes to stream */ + virtual void vwrite(const void *buf, unsigned n); + virtual void vseek(pos_type n); + virtual pos_type vtell(); + +private: + pos_type m_pos; + pos_type m_capacity; + pos_type m_size; + char *m_mem; +}; + +// ----------------------------------------------------------------------------- +// pofilestream: file output stream +// ----------------------------------------------------------------------------- + +class pofilestream : public postream +{ + P_PREVENT_COPYING(pofilestream); +public: + + pofilestream(const pstring &fname); + virtual ~pofilestream(); + + void close(); + +protected: + /* write n bytes to stream */ + virtual void vwrite(const void *buf, unsigned n); + virtual void vseek(pos_type n); + virtual pos_type vtell(); + +private: + void *m_file; + pos_type m_pos; +}; + +// ----------------------------------------------------------------------------- +// pifilestream: file input stream +// ----------------------------------------------------------------------------- + +class pifilestream : public pistream +{ + P_PREVENT_COPYING(pifilestream); +public: + + pifilestream(const pstring &fname); + virtual ~pifilestream(); + + void close(); + +protected: + /* read up to n bytes from stream */ + virtual unsigned vread(void *buf, unsigned n); + virtual void vseek(pos_type n); + virtual pos_type vtell(); + +private: + void *m_file; + pos_type m_pos; +}; + +// ----------------------------------------------------------------------------- +// pimemstream: input memory stream +// ----------------------------------------------------------------------------- + +class pimemstream : public pistream +{ + P_PREVENT_COPYING(pimemstream); +public: + + pimemstream(const void *mem, const pos_type len); + pimemstream(const pomemstream &ostrm); + virtual ~pimemstream(); + +protected: + /* read up to n bytes from stream */ + virtual unsigned vread(void *buf, unsigned n); + virtual void vseek(pos_type n); + virtual pos_type vtell(); + +private: + pos_type m_pos; + pos_type m_len; + char *m_mem; +}; + +// ----------------------------------------------------------------------------- +// pistringstream: input string stream +// ----------------------------------------------------------------------------- + +class pistringstream : public pimemstream +{ + P_PREVENT_COPYING(pistringstream); +public: + + pistringstream(const pstring &str) : pimemstream(str.cstr(), str.len()), m_str(str) { } + +private: + /* only needed for a reference till destruction */ + pstring m_str; +}; + + +#endif /* _PSTREAM_H_ */ diff --git a/src/emu/netlist/plib/pstring.c b/src/emu/netlist/plib/pstring.c index e5f73ffa17b..f2583787f3e 100644 --- a/src/emu/netlist/plib/pstring.c +++ b/src/emu/netlist/plib/pstring.c @@ -5,22 +5,21 @@ * */ -#include <cstdio> #include <cstring> //FIXME:: pstring should be locale free #include <cctype> #include <cstdlib> +#include <cstdio> #include <algorithm> #include "pstring.h" #include "palloc.h" -// The following will work on linux, however not on Windows .... - -//pblockpool *pstring::m_pool = new pblockpool; -//pstring::str_t *pstring::m_zero = new(pstring::m_pool, 0) pstring::str_t(0); +template<> +pstr_t pstring_t<putf8_traits>::m_zero = pstr_t(0); +template<> +pstr_t pstring_t<pu8_traits>::m_zero = pstr_t(0); -pstring::str_t pstring::m_zero = str_t(0); /* * Uncomment the following to override defaults @@ -45,15 +44,17 @@ pstring::str_t pstring::m_zero = str_t(0); #endif #endif -pstring::~pstring() +template<typename F> +pstring_t<F>::~pstring_t() { sfree(m_ptr); } -void pstring::pcat(const char *s) +template<typename F> +void pstring_t<F>::pcat(const mem_t *s) { int slen = strlen(s); - str_t *n = salloc(m_ptr->len() + slen); + pstr_t *n = salloc(m_ptr->len() + slen); if (m_ptr->len() > 0) std::memcpy(n->str(), m_ptr->str(), m_ptr->len()); if (slen > 0) @@ -63,9 +64,49 @@ void pstring::pcat(const char *s) m_ptr = n; } -void pstring::pcopy(const char *from, int size) +template<typename F> +void pstring_t<F>::pcat(const pstring_t &s) +{ + int slen = s.blen(); + pstr_t *n = salloc(m_ptr->len() + slen); + if (m_ptr->len() > 0) + std::memcpy(n->str(), m_ptr->str(), m_ptr->len()); + if (slen > 0) + std::memcpy(n->str() + m_ptr->len(), s.cstr(), slen); + *(n->str() + n->len()) = 0; + sfree(m_ptr); + m_ptr = n; +} + +template<typename F> +int pstring_t<F>::pcmp(const pstring_t &right) const +{ + long l = std::min(blen(), right.blen()); + if (l == 0) + { + if (blen() == 0 && right.blen() == 0) + return 0; + else if (right.blen() == 0) + return 1; + else + return -1; + } + int ret = memcmp(m_ptr->str(), right.cstr(), l); + if (ret == 0) + ret = this->blen() - right.blen(); + if (ret < 0) + return -1; + else if (ret > 0) + return 1; + else + return 0; +} + + +template<typename F> +void pstring_t<F>::pcopy(const mem_t *from, int size) { - str_t *n = salloc(size); + pstr_t *n = salloc(size); if (size > 0) std::memcpy(n->str(), from, size); *(n->str() + size) = 0; @@ -73,78 +114,124 @@ void pstring::pcopy(const char *from, int size) m_ptr = n; } -const pstring pstring::substr(unsigned int start, int count) const +template<typename F> +const pstring_t<F> pstring_t<F>::substr(int start, int count) const { - pstring ret; + pstring_t ret; unsigned alen = len(); + if (start < 0) + start = 0; if (start >= alen) return ret; if (count <0 || start + count > alen) count = alen - start; - ret.pcopy(cstr() + start, count); + const char *p = cstr(); + if (count <= 0) + ret.pcopy(p, 0); + else + { + //FIXME: Trait to tell which one + //ret.pcopy(cstr() + start, count); + // find start + for (int i=0; i<start; i++) + p += F::codelen(p); + const char *e = p; + for (int i=0; i<count; i++) + e += F::codelen(e); + ret.pcopy(p, e-p); + } return ret; } -const pstring pstring::ucase() const +template<typename F> +const pstring_t<F> pstring_t<F>::ucase() const { - pstring ret = *this; - ret.pcopy(cstr(), len()); + pstring_t ret = *this; + ret.pcopy(cstr(), blen()); for (int i=0; i<ret.len(); i++) ret.m_ptr->str()[i] = toupper((unsigned) ret.m_ptr->str()[i]); return ret; } -int pstring::find_first_not_of(const pstring &no) const +template<typename F> +int pstring_t<F>::find_first_not_of(const pstring_t &no) const { - for (int i=0; i < len(); i++) + char *t = m_ptr->str(); + unsigned nolen = no.len(); + unsigned tlen = len(); + for (int i=0; i < tlen; i++) { + char *n = no.m_ptr->str(); bool f = true; - for (int j=0; j < no.len(); j++) - if (m_ptr->str()[i] == no.m_ptr->str()[j]) + for (int j=0; j < nolen; j++) + { + if (F::code(t) == F::code(n)) f = false; + n += F::codelen(t); + } if (f) return i; + t += F::codelen(t); } return -1; } -int pstring::find_last_not_of(const pstring &no) const +template<typename F> +int pstring_t<F>::find_last_not_of(const pstring_t &no) const { - for (int i=len() - 1; i >= 0; i--) + char *t = m_ptr->str(); + unsigned nolen = no.len(); + unsigned tlen = len(); + int last_found = -1; + for (int i=0; i < tlen; i++) { + char *n = no.m_ptr->str(); bool f = true; - for (int j=0; j < no.len(); j++) - if (m_ptr->str()[i] == no.m_ptr->str()[j]) + for (int j=0; j < nolen; j++) + { + if (F::code(t) == F::code(n)) f = false; + n += F::codelen(t); + } if (f) - return i; + last_found = i; + t += F::codelen(t); } - return -1; + return last_found; } -pstring pstring::replace(const pstring &search, const pstring &replace) const +template<typename F> +pstring_t<F> pstring_t<F>::replace(const pstring_t &search, const pstring_t &replace) const { - pstring ret = ""; + // FIXME: use this pstringbuffer ret = ""; + pstring_t ret = ""; + const int slen = search.blen(); + const int tlen = blen(); - if (search.len() == 0) + if (slen == 0 || tlen < slen ) return *this; int i = 0; - while (i<len()) + while (i < tlen - slen + 1) { - if (strncmp(cstr()+i,search.cstr(),search.len()) == 0) + if (memcmp(cstr()+i,search.cstr(),slen) == 0) { ret += replace; - i += search.len(); + i += slen; } else { - ret += *(cstr() + i); + /* avoid adding a code, cat a string ... */ + mem_t buf[2] = { *(cstr() + i), 0 }; + ret = ret.cat(buf); i++; } } + ret = ret.cat(cstr() + i); return ret; } -const pstring pstring::ltrim(const pstring &ws) const + +template<typename F> +const pstring_t<F> pstring_t<F>::ltrim(const pstring_t &ws) const { int f = find_first_not_of(ws); if (f>=0) @@ -153,7 +240,8 @@ const pstring pstring::ltrim(const pstring &ws) const return ""; } -const pstring pstring::rtrim(const pstring &ws) const +template<typename F> +const pstring_t<F> pstring_t<F>::rtrim(const pstring_t &ws) const { int f = find_last_not_of(ws); if (f>=0) @@ -162,32 +250,26 @@ const pstring pstring::rtrim(const pstring &ws) const return ""; } -void pstring::pcopy(const char *from) +template<typename F> +const pstring_t<F> pstring_t<F>::rpad(const pstring_t &ws, const int cnt) const { - pcopy(from, strlen(from)); + // FIXME: pstringbuffer ret(*this); + + pstring_t ret(*this); + while (ret.len() < cnt) + ret += ws; + return pstring_t(ret).substr(0, cnt); } -//------------------------------------------------- -// pcmpi - compare a character array to an nstring -//------------------------------------------------- -int pstring::pcmpi(const char *lhs, const char *rhs, int count) const +template<typename F> +void pstring_t<F>::pcopy(const mem_t *from) { - // loop while equal until we hit the end of strings - int index; - for (index = 0; index < count; index++) - if (lhs[index] == 0 || std::tolower(lhs[index]) != std::tolower(rhs[index])) - break; - - // determine the final result - if (index < count) - return std::tolower(lhs[index]) - std::tolower(rhs[index]); - if (lhs[index] == 0) - return 0; - return 1; + pcopy(from, strlen(from)); } -double pstring::as_double(bool *error) const +template<typename F> +double pstring_t<F>::as_double(bool *error) const { double ret; char *e = NULL; @@ -201,7 +283,8 @@ double pstring::as_double(bool *error) const return ret; } -long pstring::as_long(bool *error) const +template<typename F> +long pstring_t<F>::as_long(bool *error) const { long ret; char *e = NULL; @@ -209,7 +292,7 @@ long pstring::as_long(bool *error) const if (error != NULL) *error = false; if (startsWith("0x")) - ret = strtol(&(cstr()[2]), &e, 16); + ret = strtol(substr(2).cstr(), &e, 16); else ret = strtol(cstr(), &e, 10); if (*e != 0) @@ -218,20 +301,12 @@ long pstring::as_long(bool *error) const return ret; } -const pstring pstring::vprintf(va_list args) const -{ - // sprintf into the temporary buffer - char tempbuf[4096]; - std::vsprintf(tempbuf, cstr(), args); - - return pstring(tempbuf); -} - // ---------------------------------------------------------------------------------------- // static stuff ... // ---------------------------------------------------------------------------------------- -void pstring::sfree(str_t *s) +template<typename F> +void pstring_t<F>::sfree(pstr_t *s) { s->m_ref_count--; if (s->m_ref_count == 0 && s != &m_zero) @@ -241,16 +316,18 @@ void pstring::sfree(str_t *s) } } -pstring::str_t *pstring::salloc(int n) +template<typename F> +pstr_t *pstring_t<F>::salloc(int n) { - int size = sizeof(str_t) + n + 1; - str_t *p = (str_t *) palloc_array(char, size); + int size = sizeof(pstr_t) + n + 1; + pstr_t *p = (pstr_t *) palloc_array(char, size); // str_t *p = (str_t *) _mm_malloc(size, 8); p->init(n); return p; } -void pstring::resetmem() +template<typename F> +void pstring_t<F>::resetmem() { // Release the 0 string } @@ -259,41 +336,107 @@ void pstring::resetmem() // pstring ... // ---------------------------------------------------------------------------------------- -const pstring pstring::sprintf(const char *format, ...) +const pstring::type_t pstring::vprintf(va_list args) const +{ + // sprintf into the temporary buffer + char tempbuf[4096]; + std::vsprintf(tempbuf, cstr(), args); + + return type_t(tempbuf); +} + + +const pstring::type_t pstring::sprintf(const char *format, ...) { va_list ap; va_start(ap, format); - pstring ret = pstring(format).vprintf(ap); + type_t ret = pstring(format).vprintf(ap); va_end(ap); return ret; } +template<typename F> +int pstring_t<F>::find(const pstring_t &search, unsigned start) const +{ + const unsigned tlen = len(); + const unsigned slen = search.len(); + const char *s = search.cstr(); + const unsigned startt = std::min(start, tlen); + const char *t = cstr(); + for (int i=0; i<startt; i++) + t += F::codelen(t); + for (int i=0; i <= (int) tlen - (int) startt - (int) slen; i++) + { + if (F::code(t) == F::code(s)) + if (std::memcmp(t,s,search.blen())==0) + return i+startt; + t += F::codelen(t); + } + return -1; +} -int pstring::find(const char *search, int start) const +template<typename F> +int pstring_t<F>::find(const mem_t *search, unsigned start) const { - int alen = len(); - const char *result = std::strstr(cstr() + std::min(start, alen), search); - return (result != NULL) ? (result - cstr()) : -1; + const unsigned tlen = len(); + unsigned slen = 0; + unsigned sblen = 0; + const mem_t *x = search; + while (*x != 0) + { + slen++; + const unsigned sl = F::codelen(x); + x += sl; + sblen += sl; + } + const char *s = search; + const unsigned startt = std::min(start, tlen); + const char *t = cstr(); + for (int i=0; i<startt; i++) + t += F::codelen(t); + for (int i=0; i <= (int) tlen - (int) startt - (int) slen; i++) + { + if (F::code(t) == F::code(s)) + if (std::memcmp(t,s,sblen)==0) + return i+startt; + t += F::codelen(t); + } + return -1; } -int pstring::find(const char search, int start) const +template<typename F> +bool pstring_t<F>::startsWith(const pstring_t &arg) const { - int alen = len(); - const char *result = std::strchr(cstr() + std::min(start, alen), search); - return (result != NULL) ? (result - cstr()) : -1; + if (arg.blen() > blen()) + return false; + else + return (memcmp(arg.cstr(), cstr(), arg.len()) == 0); } -bool pstring::startsWith(const char *arg) const +template<typename F> +bool pstring_t<F>::endsWith(const pstring_t &arg) const { - return (pcmp(cstr(), arg, std::strlen(arg)) == 0); + if (arg.blen() > blen()) + return false; + else + return (memcmp(cstr()+this->len()-arg.len(), arg.cstr(), arg.len()) == 0); } -int pstring::pcmp(const char *left, const char *right, int count) const + +template<typename F> +bool pstring_t<F>::startsWith(const mem_t *arg) const { - if (count < 0) - return std::strcmp(left, right); + int alen = strlen(arg); + if (alen > blen()) + return false; else - return std::strncmp(left, right, count); + return (memcmp(arg, cstr(), alen) == 0); +} + +template<typename F> +int pstring_t<F>::pcmp(const mem_t *right) const +{ + return std::strcmp(m_ptr->str(), right); } // ---------------------------------------------------------------------------------------- @@ -314,6 +457,7 @@ void pstringbuffer::resize(const std::size_t size) while (m_size <= size) m_size *= 2; m_ptr = palloc_array(char, m_size); + *m_ptr = 0; m_len = 0; } else if (m_size < size) @@ -321,7 +465,7 @@ void pstringbuffer::resize(const std::size_t size) while (m_size < size) m_size *= 2; char *new_buf = palloc_array(char, m_size); - std::strncpy(new_buf, m_ptr, m_len + 1); + std::memcpy(new_buf, m_ptr, m_len + 1); pfree_array(m_ptr); m_ptr = new_buf; } @@ -331,30 +475,72 @@ void pstringbuffer::pcopy(const char *from) { std::size_t nl = strlen(from) + 1; resize(nl); - std::strncpy(m_ptr, from, nl); + std::memcpy(m_ptr, from, nl); } void pstringbuffer::pcopy(const pstring &from) { - std::size_t nl = from.len() + 1; + std::size_t nl = from.blen() + 1; resize(nl); - std::strncpy(m_ptr, from.cstr(), nl); + std::memcpy(m_ptr, from.cstr(), nl); } void pstringbuffer::pcat(const char *s) { - std::size_t slen = std::strlen(s); - std::size_t nl = m_len + slen + 1; + const std::size_t slen = std::strlen(s); + const std::size_t nl = m_len + slen + 1; resize(nl); - std::strncpy(m_ptr + m_len, s, slen + 1); + std::memcpy(m_ptr + m_len, s, slen + 1); m_len += slen; } void pstringbuffer::pcat(const pstring &s) { - std::size_t slen = s.len(); - std::size_t nl = m_len + slen + 1; + const std::size_t slen = s.blen(); + const std::size_t nl = m_len + slen + 1; resize(nl); - std::strncpy(m_ptr + m_len, s.cstr(), slen + 1); + std::memcpy(m_ptr + m_len, s.cstr(), slen); m_len += slen; + m_ptr[m_len] = 0; +} + +pformat::pformat(const pstring &fmt) +: m_arg(0) +{ + memcpy(m_str, fmt.cstr(), fmt.blen() + 1); +} + +pformat::pformat(const char *fmt) +: m_arg(0) +{ + strncpy(m_str, fmt, sizeof(m_str) - 1); + m_str[sizeof(m_str) - 1] = 0; } + +void pformat::format_element(const char *f, const char *l, const char *fmt_spec, ...) +{ + va_list ap; + va_start(ap, fmt_spec); + char fmt[30] = "%"; + char search[10] = ""; + char buf[1024]; + strcat(fmt, f); + strcat(fmt, l); + strcat(fmt, fmt_spec); + int nl = vsprintf(buf, fmt, ap); + m_arg++; + int sl = sprintf(search, "%%%d", m_arg); + char *p = strstr(m_str, search); + if (p != NULL) + { + // Make room + memmove(p+nl, p+sl, strlen(p) + 1 - sl); + memcpy(p, buf, nl); + } + va_end(ap); +} + + +template struct pstring_t<pu8_traits>; +template struct pstring_t<putf8_traits>; + diff --git a/src/emu/netlist/plib/pstring.h b/src/emu/netlist/plib/pstring.h index 7a7b536e98a..f59cefb9341 100644 --- a/src/emu/netlist/plib/pstring.h +++ b/src/emu/netlist/plib/pstring.h @@ -19,138 +19,141 @@ // It uses reference counts and only uses new memory when a string changes. // ---------------------------------------------------------------------------------------- -struct pstring + struct pstr_t + { + //str_t() : m_ref_count(1), m_len(0) { m_str[0] = 0; } + pstr_t(const int alen) + { + init(alen); + } + void init(const int alen) + { + m_ref_count = 1; + m_len = alen; + m_str[0] = 0; + } + char *str() { return &m_str[0]; } + int len() const { return m_len; } + int m_ref_count; + private: + int m_len; + char m_str[1]; + }; + + +template <typename F> +struct pstring_t { public: + typedef F traits; + + typedef typename traits::mem_t mem_t; + typedef typename traits::code_t code_t; + // simple construction/destruction - pstring() + pstring_t() { init(); } - ~pstring(); + ~pstring_t(); // construction with copy - pstring(const char *string) {init(); if (string != NULL && *string != 0) pcopy(string); } - pstring(const pstring &string) {init(); pcopy(string); } + pstring_t(const mem_t *string) {init(); if (string != NULL && *string != 0) pcopy(string); } + pstring_t(const pstring_t &string) {init(); pcopy(string); } // assignment operators - pstring &operator=(const char *string) { pcopy(string); return *this; } - pstring &operator=(const pstring &string) { pcopy(string); return *this; } + pstring_t &operator=(const mem_t *string) { pcopy(string); return *this; } + pstring_t &operator=(const pstring_t &string) { pcopy(string); return *this; } - // C string conversion operators and helpers - operator const char *() const { return m_ptr->str(); } - const char *cstr() const { return m_ptr->str(); } + // C string conversion helpers + const mem_t *cstr() const { return m_ptr->str(); } // concatenation operators - pstring& operator+=(const char c) { char buf[2] = { c, 0 }; pcat(buf); return *this; } - pstring& operator+=(const pstring &string) { pcat(string.cstr()); return *this; } - pstring& operator+=(const char *string) { pcat(string); return *this; } - friend pstring operator+(const pstring &lhs, const pstring &rhs) { return pstring(lhs) += rhs; } - friend pstring operator+(const pstring &lhs, const char *rhs) { return pstring(lhs) += rhs; } - friend pstring operator+(const pstring &lhs, const char rhs) { return pstring(lhs) += rhs; } - friend pstring operator+(const char *lhs, const pstring &rhs) { return pstring(lhs) += rhs; } + pstring_t& operator+=(const pstring_t &string) { pcat(string); return *this; } + pstring_t& operator+=(const mem_t *string) { pcat(string); return *this; } + friend pstring_t operator+(const pstring_t &lhs, const pstring_t &rhs) { return pstring_t(lhs) += rhs; } + friend pstring_t operator+(const pstring_t &lhs, const mem_t *rhs) { return pstring_t(lhs) += rhs; } + friend pstring_t operator+(const mem_t *lhs, const pstring_t &rhs) { return pstring_t(lhs) += rhs; } // comparison operators - bool operator==(const char *string) const { return (pcmp(string) == 0); } - bool operator==(const pstring &string) const { return (pcmp(string.cstr()) == 0); } - bool operator!=(const char *string) const { return (pcmp(string) != 0); } - bool operator!=(const pstring &string) const { return (pcmp(string.cstr()) != 0); } - bool operator<(const char *string) const { return (pcmp(string) < 0); } - bool operator<(const pstring &string) const { return (pcmp(string.cstr()) < 0); } - bool operator<=(const char *string) const { return (pcmp(string) <= 0); } - bool operator<=(const pstring &string) const { return (pcmp(string.cstr()) <= 0); } - bool operator>(const char *string) const { return (pcmp(string) > 0); } - bool operator>(const pstring &string) const { return (pcmp(string.cstr()) > 0); } - bool operator>=(const char *string) const { return (pcmp(string) >= 0); } - bool operator>=(const pstring &string) const { return (pcmp(string.cstr()) >= 0); } + bool operator==(const mem_t *string) const { return (pcmp(string) == 0); } + bool operator==(const pstring_t &string) const { return (pcmp(string) == 0); } + bool operator!=(const mem_t *string) const { return (pcmp(string) != 0); } + bool operator!=(const pstring_t &string) const { return (pcmp(string) != 0); } - int len() const { return m_ptr->len(); } + bool operator<(const mem_t *string) const { return (pcmp(string) < 0); } + bool operator<(const pstring_t &string) const { return (pcmp(string) < 0); } + bool operator<=(const mem_t *string) const { return (pcmp(string) <= 0); } + bool operator<=(const pstring_t &string) const { return (pcmp(string) <= 0); } + bool operator>(const mem_t *string) const { return (pcmp(string) > 0); } + bool operator>(const pstring_t &string) const { return (pcmp(string) > 0); } + bool operator>=(const mem_t *string) const { return (pcmp(string) >= 0); } + bool operator>=(const pstring_t &string) const { return (pcmp(string) >= 0); } - bool equals(const pstring &string) const { return (pcmp(string.cstr(), m_ptr->str()) == 0); } - bool iequals(const pstring &string) const { return (pcmpi(string.cstr(), m_ptr->str()) == 0); } + bool equals(const pstring_t &string) const { return (pcmp(string) == 0); } - int cmp(const pstring &string) const { return pcmp(string.cstr()); } - int cmpi(const pstring &string) const { return pcmpi(cstr(), string.cstr()); } + int cmp(const pstring_t &string) const { return pcmp(string); } + int cmp(const mem_t *string) const { return pcmp(string); } - int find(const char *search, int start = 0) const; + bool startsWith(const pstring_t &arg) const; + bool startsWith(const mem_t *arg) const; - int find(const char search, int start = 0) const; + bool endsWith(const pstring_t &arg) const; + bool endsWith(const mem_t *arg) const { return endsWith(pstring_t(arg)); } - // various + pstring_t replace(const pstring_t &search, const pstring_t &replace) const; - bool startsWith(const pstring &arg) const { return (pcmp(cstr(), arg.cstr(), arg.len()) == 0); } - bool startsWith(const char *arg) const; + const pstring_t cat(const pstring_t &s) const { return *this + s; } + const pstring_t cat(const mem_t *s) const { return *this + s; } - bool endsWith(const pstring &arg) const { return (this->right(arg.len()) == arg); } - bool endsWith(const char *arg) const { return endsWith(pstring(arg)); } + unsigned blen() const { return m_ptr->len(); } - pstring replace(const pstring &search, const pstring &replace) const; + // conversions - // these return nstring ... - const pstring cat(const pstring &s) const { return *this + s; } - const pstring cat(const char *s) const { return *this + s; } + double as_double(bool *error = NULL) const; + long as_long(bool *error = NULL) const; - const pstring substr(unsigned int start, int count = -1) const ; + /* + * everything below MAY not work for utf8. + * Example a=s.find(EUROSIGN); b=s.substr(a,1); will deliver invalid utf8 + */ - const pstring left(unsigned int count) const { return substr(0, count); } - const pstring right(unsigned int count) const { return substr(len() - count, count); } + unsigned len() const + { + return F::len(m_ptr); + } - int find_first_not_of(const pstring &no) const; - int find_last_not_of(const pstring &no) const; + pstring_t& operator+=(const code_t c) { mem_t buf[F::MAXCODELEN+1] = { 0 }; F::encode(c, buf); pcat(buf); return *this; } + friend pstring_t operator+(const pstring_t &lhs, const mem_t rhs) { return pstring_t(lhs) += rhs; } - const pstring ltrim(const pstring &ws = " \t\n\r") const; - const pstring rtrim(const pstring &ws = " \t\n\r") const; - const pstring trim(const pstring &ws = " \t\n\r") const { return this->ltrim(ws).rtrim(ws); } + int find(const pstring_t &search, unsigned start = 0) const; + int find(const mem_t *search, unsigned start = 0) const; + int find(const code_t search, unsigned start = 0) const { mem_t buf[F::MAXCODELEN+1] = { 0 }; F::encode(search, buf); return find(buf, start); }; - const pstring rpad(const pstring &ws, const int cnt) const - { - // FIXME: slow! - pstring ret = *this; - while (ret.len() < cnt) - ret += ws; - return ret.substr(0, cnt); - } + const pstring_t substr(int start, int count = -1) const ; - const pstring ucase() const; + const pstring_t left(unsigned count) const { return substr(0, count); } + const pstring_t right(unsigned count) const { return substr((int) len() - (int) count, count); } - // conversions + int find_first_not_of(const pstring_t &no) const; + int find_last_not_of(const pstring_t &no) const; - double as_double(bool *error = NULL) const; + // FIXME: + code_t code_at(const unsigned pos) const { return F::code(F::nthcode(m_ptr->str(),pos)); } - long as_long(bool *error = NULL) const; + const pstring_t ltrim(const pstring_t &ws = " \t\n\r") const; + const pstring_t rtrim(const pstring_t &ws = " \t\n\r") const; + const pstring_t trim(const pstring_t &ws = " \t\n\r") const { return this->ltrim(ws).rtrim(ws); } - // printf using string as format ... + const pstring_t rpad(const pstring_t &ws, const int cnt) const; - const pstring vprintf(va_list args) const; + const pstring_t ucase() const; - // static - static const pstring sprintf(const char *format, ...) ATTR_PRINTF(1,2); static void resetmem(); protected: - struct str_t - { - //str_t() : m_ref_count(1), m_len(0) { m_str[0] = 0; } - str_t(const int alen) - { - init(alen); - } - void init(const int alen) - { - m_ref_count = 1; - m_len = alen; - m_str[0] = 0; - } - char *str() { return &m_str[0]; } - int len() { return m_len; } - int m_ref_count; - private: - int m_len; - char m_str[1]; - }; - - str_t *m_ptr; + pstr_t *m_ptr; private: void init() @@ -159,32 +162,154 @@ private: m_ptr->m_ref_count++; } - int pcmp(const char *right) const - { - return pcmp(m_ptr->str(), right); - } + int pcmp(const pstring_t &right) const; - int pcmp(const char *left, const char *right, int count = -1) const; + int pcmp(const mem_t *right) const; - int pcmpi(const char *lhs, const char *rhs, int count = -1) const; + void pcopy(const mem_t *from, int size); - void pcopy(const char *from, int size); + void pcopy(const mem_t *from); - void pcopy(const char *from); - - void pcopy(const pstring &from) + void pcopy(const pstring_t &from) { sfree(m_ptr); m_ptr = from.m_ptr; m_ptr->m_ref_count++; } - void pcat(const char *s); + void pcat(const mem_t *s); + void pcat(const pstring_t &s); + + static pstr_t *salloc(int n); + static void sfree(pstr_t *s); + + static pstr_t m_zero; +}; + +struct pu8_traits +{ + static const unsigned MAXCODELEN = 1; /* in memory units */ + typedef char mem_t; + typedef char code_t; + static unsigned len(const pstr_t *p) { return p->len(); } + static unsigned codelen(const mem_t *p) { return 1; } + static unsigned codelen(const code_t c) { return 1; } + static code_t code(const mem_t *p) { return *p; } + static void encode(const code_t c, mem_t *p) { *p = c; } + static const mem_t *nthcode(const mem_t *p, const unsigned n) { return &(p[n]); } +}; + +/* No checking, this may deliver invalid codes */ +struct putf8_traits +{ + static const unsigned MAXCODELEN = 4; /* in memory units, RFC 3629 */ + typedef char mem_t; + typedef unsigned code_t; + static unsigned len(pstr_t *p) + { + unsigned ret = 0; + unsigned char *c = (unsigned char *) p->str(); + while (*c) + { + if (!((*c & 0xC0) == 0x80)) + ret++; + c++; + } + return ret; + } + static unsigned codelen(const mem_t *p) + { + unsigned char *p1 = (unsigned char *) p; + if ((*p1 & 0x80) == 0x00) + return 1; + else if ((*p1 & 0xE0) == 0xC0) + return 2; + else if ((*p1 & 0xF0) == 0xE0) + return 3; + else if ((*p1 & 0xF8) == 0xF0) + return 4; + else + { + return 1; // not correct + } + } + static unsigned codelen(const code_t c) + { + if (c < 0x0080) + return 1; + else if (c < 0x800) + return 2; + else if (c < 0x10000) + return 3; + else /* U+10000 U+1FFFFF */ + return 4; /* no checks */ + } + static code_t code(const mem_t *p) + { + unsigned char *p1 = (unsigned char *)p; + if ((*p1 & 0x80) == 0x00) + return (code_t) *p1; + else if ((*p1 & 0xE0) == 0xC0) + return ((p1[0] & 0x3f) << 6) | ((p1[1] & 0x3f)); + else if ((*p1 & 0xF0) == 0xE0) + return ((p1[0] & 0x1f) << 12) | ((p1[1] & 0x3f) << 6) | ((p1[2] & 0x3f) << 0); + else if ((*p1 & 0xF8) == 0xF0) + return ((p1[0] & 0x0f) << 18) | ((p1[1] & 0x3f) << 12) | ((p1[2] & 0x3f) << 6) | ((p1[3] & 0x3f) << 0); + else + return *p1; // not correct + } + static void encode(const code_t c, mem_t *p) + { + unsigned char *m = (unsigned char*)p; + if (c < 0x0080) + { + m[0] = c; + } + else if (c < 0x800) + { + m[0] = 0xC0 | (c >> 6); + m[1] = 0x80 | (c & 0x3f); + } + else if (c < 0x10000) + { + m[0] = 0xE0 | (c >> 12); + m[1] = 0x80 | ((c>>6) & 0x3f); + m[2] = 0x80 | (c & 0x3f); + } + else /* U+10000 U+1FFFFF */ + { + m[0] = 0xF0 | (c >> 18); + m[1] = 0x80 | ((c>>12) & 0x3f); + m[2] = 0x80 | ((c>>6) & 0x3f); + m[3] = 0x80 | (c & 0x3f); + } + } + static const mem_t *nthcode(const mem_t *p, const unsigned n) + { + const mem_t *p1 = p; + int i = n; + while (i-- > 0) + p1 += codelen(p1); + return p1; + } +}; - static str_t *salloc(int n); - static void sfree(str_t *s); +struct pstring : public pstring_t<putf8_traits> +{ +public: + + typedef pstring_t<putf8_traits> type_t; + + // simple construction/destruction + pstring() : type_t() { } + + // construction with copy + pstring(const mem_t *string) : type_t(string) { } + pstring(const type_t &string) : type_t(string) { } + + const type_t vprintf(va_list args) const; + static const type_t sprintf(const char *format, ...) ATTR_PRINTF(1,2); - static str_t m_zero; }; // ---------------------------------------------------------------------------------------- @@ -197,6 +322,7 @@ private: struct pstringbuffer { public: + static const int DEFAULT_SIZE = 2048; // simple construction/destruction pstringbuffer() @@ -214,28 +340,23 @@ public: // assignment operators pstringbuffer &operator=(const char *string) { pcopy(string); return *this; } pstringbuffer &operator=(const pstring &string) { pcopy(string); return *this; } - pstringbuffer &operator=(const pstringbuffer &string) { pcopy(string.cstr()); return *this; } + pstringbuffer &operator=(const pstringbuffer &string) { pcopy(string); return *this; } - // C string conversion operators and helpers - operator const char *() const { return m_ptr; } + // C string conversion helpers const char *cstr() const { return m_ptr; } operator pstring() const { return pstring(m_ptr); } // concatenation operators - pstringbuffer& operator+=(const char c) { char buf[2] = { c, 0 }; pcat(buf); return *this; } - pstringbuffer& operator+=(const pstring &string) { pcat(string.cstr()); return *this; } + pstringbuffer& operator+=(const UINT8 c) { char buf[2] = { c, 0 }; pcat(buf); return *this; } + pstringbuffer& operator+=(const pstring &string) { pcat(string); return *this; } + pstringbuffer& operator+=(const char *string) { pcat(string); return *this; } std::size_t len() const { return m_len; } void cat(const pstring &s) { pcat(s); } void cat(const char *s) { pcat(s); } - pstring substr(unsigned int start, int count = -1) - { - return pstring(m_ptr).substr(start, count); - } - private: void init() @@ -258,5 +379,155 @@ private: }; +template <typename T> +struct ptype_treats +{ +}; + +template<> +struct ptype_treats<char> +{ + typedef short cast_type; + static const bool is_signed = true; + static const char *size_specifier() { return "h"; } +}; + +template<> +struct ptype_treats<short> +{ + typedef short cast_type; + static const bool is_signed = true; + static const char *size_specifier() { return "h"; } +}; + +template<> +struct ptype_treats<int> +{ + typedef int cast_type; + static const bool is_signed = true; + static const char *size_specifier() { return ""; } +}; + +template<> +struct ptype_treats<long> +{ + typedef long cast_type; + static const bool is_signed = true; + static const char *size_specifier() { return "l"; } +}; + +template<> +struct ptype_treats<long long> +{ + typedef long long cast_type; + static const bool is_signed = true; + static const char *size_specifier() { return "ll"; } +}; + +template<> +struct ptype_treats<unsigned char> +{ + typedef unsigned short cast_type; + static const bool is_signed = false; + static const char *size_specifier() { return "h"; } +}; + +template<> +struct ptype_treats<unsigned short> +{ + typedef unsigned short cast_type; + static const bool is_signed = false; + static const char *size_specifier() { return "h"; } +}; + +template<> +struct ptype_treats<unsigned int> +{ + typedef unsigned int cast_type; + static const bool is_signed = false; + static const char *size_specifier() { return ""; } +}; + +template<> +struct ptype_treats<unsigned long> +{ + typedef unsigned long cast_type; + static const bool is_signed = false; + static const char *size_specifier() { return "l"; } +}; + +template<> +struct ptype_treats<unsigned long long> +{ + typedef unsigned long long cast_type; + static const bool is_signed = false; + static const char *size_specifier() { return "ll"; } +}; + +template <typename P> +class pformat_base +{ +public: + + virtual ~pformat_base() { } + + P &operator ()(const double x, const char *f = "") { format_element(f, "", "g", x); return static_cast<P &>(*this); } + P & e(const double x, const char *f = "") { format_element(f, "", "e", x); return static_cast<P &>(*this); } + P & f(const double x, const char *f = "") { format_element(f, "", "f", x); return static_cast<P &>(*this); } + + P &operator ()(const char *x, const char *f = "") { format_element(f, "", "s", x); return static_cast<P &>(*this); } + P &operator ()(const void *x, const char *f = "") { format_element(f, "", "p", x); return static_cast<P &>(*this); } + P &operator ()(const pstring &x, const char *f = "") { format_element(f, "", "s", x.cstr() ); return static_cast<P &>(*this); } + + template<typename T> + P &operator ()(const T x, const char *f = "") + { + if (ptype_treats<T>::is_signed) + format_element(f, ptype_treats<T>::size_specifier(), "d", (typename ptype_treats<T>::cast_type) x); + else + format_element(f, ptype_treats<T>::size_specifier(), "u", (typename ptype_treats<T>::cast_type) x); + return static_cast<P &>(*this); + } + + template<typename T> + P &x(const T x, const char *f = "") + { + format_element(f, ptype_treats<T>::size_specifier(), "x", x); + return static_cast<P &>(*this); + } + + template<typename T> + P &o(const T x, const char *f = "") + { + format_element(f, ptype_treats<T>::size_specifier(), "o", x); + return static_cast<P &>(*this); + } + +protected: + + virtual void format_element(const char *f, const char *l, const char *fmt_spec, ...) = 0; + +}; + +class pformat : public pformat_base<pformat> +{ +public: + pformat(const pstring &fmt); + pformat(const char *fmt); + + operator pstring() const { return m_str; } + + const char *cstr() { return m_str; } + + +protected: + void format_element(const char *f, const char *l, const char *fmt_spec, ...); + +private: + + char m_str[2048]; + unsigned m_arg; +}; + #endif /* _PSTRING_H_ */ diff --git a/src/emu/netlist/solver/mat_cr.h b/src/emu/netlist/solver/mat_cr.h index 195e856784b..21f68366bc9 100644 --- a/src/emu/netlist/solver/mat_cr.h +++ b/src/emu/netlist/solver/mat_cr.h @@ -11,7 +11,7 @@ #define MAT_CR_H_ #include <algorithm> -#include "../plib/pconfig.h" +#include "plib/pconfig.h" template<int _storage_N> struct mat_cr_t diff --git a/src/emu/netlist/solver/nld_ms_direct.h b/src/emu/netlist/solver/nld_ms_direct.h index f64514a1c7c..5263c3e5f9c 100644 --- a/src/emu/netlist/solver/nld_ms_direct.h +++ b/src/emu/netlist/solver/nld_ms_direct.h @@ -10,7 +10,7 @@ #include <algorithm> -#include "../solver/nld_solver.h" +#include "solver/nld_solver.h" NETLIB_NAMESPACE_DEVICES_START() @@ -277,7 +277,7 @@ ATTR_COLD void matrix_solver_direct_t<m_N, _storage_N>::vsetup(analog_net_t::lis for (unsigned k = 0; k < N(); k++) { - pstring num = pstring::sprintf("%d", k); + pstring num = pformat("%1")(k); save(m_terms[k]->go(),"GO" + num, m_terms[k]->count()); save(m_terms[k]->gt(),"GT" + num, m_terms[k]->count()); diff --git a/src/emu/netlist/solver/nld_ms_direct1.h b/src/emu/netlist/solver/nld_ms_direct1.h index d2009846053..85bb0388168 100644 --- a/src/emu/netlist/solver/nld_ms_direct1.h +++ b/src/emu/netlist/solver/nld_ms_direct1.h @@ -8,8 +8,8 @@ #ifndef NLD_MS_DIRECT1_H_ #define NLD_MS_DIRECT1_H_ -#include "../solver/nld_ms_direct.h" -#include "../solver/nld_solver.h" +#include "solver/nld_ms_direct.h" +#include "solver/nld_solver.h" NETLIB_NAMESPACE_DEVICES_START() diff --git a/src/emu/netlist/solver/nld_ms_direct2.h b/src/emu/netlist/solver/nld_ms_direct2.h index 79f9e55d908..10060f2a767 100644 --- a/src/emu/netlist/solver/nld_ms_direct2.h +++ b/src/emu/netlist/solver/nld_ms_direct2.h @@ -8,8 +8,8 @@ #ifndef NLD_MS_DIRECT2_H_ #define NLD_MS_DIRECT2_H_ -#include "../solver/nld_ms_direct.h" -#include "../solver/nld_solver.h" +#include "solver/nld_ms_direct.h" +#include "solver/nld_solver.h" NETLIB_NAMESPACE_DEVICES_START() diff --git a/src/emu/netlist/solver/nld_ms_gmres.h b/src/emu/netlist/solver/nld_ms_gmres.h index 102549b9194..9b8eca08b78 100644 --- a/src/emu/netlist/solver/nld_ms_gmres.h +++ b/src/emu/netlist/solver/nld_ms_gmres.h @@ -14,10 +14,10 @@ #include <algorithm> -#include "../solver/mat_cr.h" -#include "../solver/nld_ms_direct.h" -#include "../solver/nld_solver.h" -#include "../solver/vector_base.h" +#include "solver/mat_cr.h" +#include "solver/nld_ms_direct.h" +#include "solver/nld_solver.h" +#include "solver/vector_base.h" NETLIB_NAMESPACE_DEVICES_START() diff --git a/src/emu/netlist/solver/nld_ms_sor.h b/src/emu/netlist/solver/nld_ms_sor.h index 82c10c5c9d8..d91fe1d1412 100644 --- a/src/emu/netlist/solver/nld_ms_sor.h +++ b/src/emu/netlist/solver/nld_ms_sor.h @@ -14,8 +14,8 @@ #include <algorithm> -#include "../solver/nld_ms_direct.h" -#include "../solver/nld_solver.h" +#include "solver/nld_ms_direct.h" +#include "solver/nld_solver.h" NETLIB_NAMESPACE_DEVICES_START() diff --git a/src/emu/netlist/solver/nld_ms_sor_mat.h b/src/emu/netlist/solver/nld_ms_sor_mat.h index d5ce05ef8b1..ffdb2813f89 100644 --- a/src/emu/netlist/solver/nld_ms_sor_mat.h +++ b/src/emu/netlist/solver/nld_ms_sor_mat.h @@ -14,8 +14,8 @@ #include <algorithm> -#include "../solver/nld_ms_direct.h" -#include "../solver/nld_solver.h" +#include "solver/nld_ms_direct.h" +#include "solver/nld_solver.h" NETLIB_NAMESPACE_DEVICES_START() diff --git a/src/emu/netlist/solver/nld_solver.c b/src/emu/netlist/solver/nld_solver.c index 9bae485e2f9..ce3bb36826b 100644 --- a/src/emu/netlist/solver/nld_solver.c +++ b/src/emu/netlist/solver/nld_solver.c @@ -44,7 +44,7 @@ #include "nld_ms_sor_mat.h" #include "nld_ms_gmres.h" //#include "nld_twoterm.h" -#include "../nl_lists.h" +#include "nl_lists.h" #if HAS_OPENMP #include "omp.h" @@ -170,7 +170,7 @@ ATTR_COLD void matrix_solver_t::setup(analog_net_t::list_t &nets) if (net_proxy_output == NULL) { net_proxy_output = palloc(analog_output_t); - net_proxy_output->init_object(*this, this->name() + "." + pstring::sprintf("m%" SIZETFMT, SIZET_PRINTF(m_inps.size()))); + net_proxy_output->init_object(*this, this->name() + "." + pformat("m%1")(m_inps.size())); m_inps.add(net_proxy_output); net_proxy_output->m_proxied_net = &p->net().as_analog(); } @@ -477,7 +477,7 @@ ATTR_COLD void NETLIB_NAME(solver)::post_start() m_params.m_accuracy = m_accuracy.Value(); m_params.m_gs_loops = m_gs_loops.Value(); m_params.m_nr_loops = m_nr_loops.Value(); - m_params.m_nt_sync_delay = m_sync_delay.Value(); + m_params.m_nt_sync_delay = netlist_time::from_double(m_sync_delay.Value()); m_params.m_lte = m_lte.Value(); m_params.m_sor = m_sor.Value(); @@ -584,7 +584,7 @@ ATTR_COLD void NETLIB_NAME(solver)::post_start() break; } - register_sub(pstring::sprintf("Solver_%" SIZETFMT,SIZET_PRINTF(m_mat_solvers.size())), *ms); + register_sub(pformat("Solver_%1")(m_mat_solvers.size()), *ms); ms->vsetup(groups[i]); diff --git a/src/emu/netlist/solver/nld_solver.h b/src/emu/netlist/solver/nld_solver.h index 682483dfde3..67e76f45e1c 100644 --- a/src/emu/netlist/solver/nld_solver.h +++ b/src/emu/netlist/solver/nld_solver.h @@ -8,8 +8,8 @@ #ifndef NLD_SOLVER_H_ #define NLD_SOLVER_H_ -#include "../nl_setup.h" -#include "../nl_base.h" +#include "nl_setup.h" +#include "nl_base.h" //#define ATTR_ALIGNED(N) __attribute__((aligned(N))) #define ATTR_ALIGNED(N) ATTR_ALIGN diff --git a/src/emu/netlist/solver/vector_base.h b/src/emu/netlist/solver/vector_base.h index c5b86cdb5e8..be0d59692a3 100644 --- a/src/emu/netlist/solver/vector_base.h +++ b/src/emu/netlist/solver/vector_base.h @@ -11,7 +11,7 @@ #define VECTOR_BASE_H_ #include <algorithm> -#include "../plib/pconfig.h" +#include "plib/pconfig.h" #if 0 template <unsigned _storage_N> diff --git a/src/emu/netlist/tools/nl_convert.c b/src/emu/netlist/tools/nl_convert.c index 59871b96bdf..85490bab5b6 100644 --- a/src/emu/netlist/tools/nl_convert.c +++ b/src/emu/netlist/tools/nl_convert.c @@ -149,7 +149,7 @@ const pstring nl_convert_base_t::get_nl_val(const double val) break; i++; } - return pstring::sprintf(m_units[i].m_func.cstr(), val / m_units[i].m_mult); + return pformat(m_units[i].m_func.cstr())(val / m_units[i].m_mult); } } double nl_convert_base_t::get_sp_unit(const pstring &unit) @@ -181,21 +181,21 @@ double nl_convert_base_t::get_sp_val(const pstring &sin) nl_convert_base_t::unit_t nl_convert_base_t::m_units[] = { {"T", "", 1.0e12 }, {"G", "", 1.0e9 }, - {"MEG", "RES_M(%g)", 1.0e6 }, - {"k", "RES_K(%g)", 1.0e3 }, /* eagle */ - {"K", "RES_K(%g)", 1.0e3 }, - {"", "%g", 1.0e0 }, - {"M", "CAP_M(%g)", 1.0e-3 }, - {"u", "CAP_U(%g)", 1.0e-6 }, /* eagle */ - {"U", "CAP_U(%g)", 1.0e-6 }, - {"??", "CAP_U(%g)", 1.0e-6 }, - {"N", "CAP_N(%g)", 1.0e-9 }, - {"P", "CAP_P(%g)", 1.0e-12}, - {"F", "%ge-15", 1.0e-15}, - - {"MIL", "%e", 25.4e-6}, - - {"-", "%g", 1.0 } + {"MEG", "RES_M(%1)", 1.0e6 }, + {"k", "RES_K(%1)", 1.0e3 }, /* eagle */ + {"K", "RES_K(%1)", 1.0e3 }, + {"", "%1", 1.0e0 }, + {"M", "CAP_M(%1)", 1.0e-3 }, + {"u", "CAP_U(%1)", 1.0e-6 }, /* eagle */ + {"U", "CAP_U(%1)", 1.0e-6 }, + {"??", "CAP_U(%1)", 1.0e-6 }, + {"N", "CAP_N(%1)", 1.0e-9 }, + {"P", "CAP_P(%1)", 1.0e-12}, + {"F", "%1e-15", 1.0e-15}, + + {"MIL", "%1", 25.4e-6}, + + {"-", "%1", 1.0 } }; @@ -235,7 +235,7 @@ void nl_convert_spice_t::process_line(const pstring &line) { pstring_list_t tt(line, " ", true); double val = 0.0; - switch (tt[0].cstr()[0]) + switch (tt[0].code_at(0)) { case ';': out("// %s\n", line.substr(1).cstr()); @@ -280,9 +280,9 @@ void nl_convert_spice_t::process_line(const pstring &line) pins = m[1].left(3); } add_device("QBJT_EB", tt[0], m[0]); - add_term(tt[1], tt[0] + "." + pins[0]); - add_term(tt[2], tt[0] + "." + pins[1]); - add_term(tt[3], tt[0] + "." + pins[2]); + add_term(tt[1], tt[0] + "." + pins.code_at(0)); + add_term(tt[2], tt[0] + "." + pins.code_at(1)); + add_term(tt[3], tt[0] + "." + pins.code_at(2)); } break; case 'R': @@ -345,7 +345,7 @@ void nl_convert_spice_t::process_line(const pstring &line) add_device(tname, xname); for (std::size_t i=1; i < tt.size() - 1; i++) { - pstring term = pstring::sprintf("%s.%" SIZETFMT, xname.cstr(), SIZET_PRINTF(i)); + pstring term = pformat("%1.%2")(xname)(i); add_term(tt[i], term); } break; @@ -356,11 +356,11 @@ void nl_convert_spice_t::process_line(const pstring &line) } } - +//FIXME: should accept a stream as well void nl_convert_eagle_t::convert(const pstring &contents) { - eagle_tokenizer tok(*this); - tok.reset(contents.cstr()); + pistringstream istrm(contents); + eagle_tokenizer tok(*this, istrm); out("NETLIST_START(dummy)\n"); add_term("GND", "GND"); @@ -397,7 +397,7 @@ void nl_convert_eagle_t::convert(const pstring &contents) tok.require_token(tok.m_tok_SEMICOLON); token = tok.get_token(); } - switch (name.cstr()[0]) + switch (name.code_at(0)) { case 'Q': { @@ -439,7 +439,7 @@ void nl_convert_eagle_t::convert(const pstring &contents) break; } default: - tok.error("// IGNORED %s\n", name.cstr()); + tok.error("// IGNORED " + name); } } diff --git a/src/emu/netlist/tools/nl_convert.h b/src/emu/netlist/tools/nl_convert.h index d2e2d238718..5772f334d44 100644 --- a/src/emu/netlist/tools/nl_convert.h +++ b/src/emu/netlist/tools/nl_convert.h @@ -165,8 +165,8 @@ public: class eagle_tokenizer : public ptokenizer { public: - eagle_tokenizer(nl_convert_eagle_t &convert) - : ptokenizer(), m_convert(convert) + eagle_tokenizer(nl_convert_eagle_t &convert, pistream &strm) + : ptokenizer(strm), m_convert(convert) { set_identifier_chars("abcdefghijklmnopqrstuvwvxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890_.-"); set_number_chars(".0123456789", "0123456789eE-."); //FIXME: processing of numbers @@ -196,7 +196,7 @@ public: protected: - void verror(pstring msg, int line_num, pstring line) + void verror(const pstring &msg, int line_num, const pstring &line) { m_convert.out("%s (line %d): %s\n", msg.cstr(), line_num, line.cstr()); } diff --git a/src/emu/render.c b/src/emu/render.c index 57fcc418e97..6ee9e871c43 100644 --- a/src/emu/render.c +++ b/src/emu/render.c @@ -1394,9 +1394,9 @@ render_primitive_list &render_target::get_primitives() bool render_target::map_point_container(INT32 target_x, INT32 target_y, render_container &container, float &container_x, float &container_y) { - const char *input_tag; + ioport_port *input_port; ioport_value input_mask; - return map_point_internal(target_x, target_y, &container, container_x, container_y, input_tag, input_mask); + return map_point_internal(target_x, target_y, &container, container_x, container_y, input_port, input_mask); } @@ -1406,9 +1406,9 @@ bool render_target::map_point_container(INT32 target_x, INT32 target_y, render_c // container, if possible //------------------------------------------------- -bool render_target::map_point_input(INT32 target_x, INT32 target_y, const char *&input_tag, ioport_value &input_mask, float &input_x, float &input_y) +bool render_target::map_point_input(INT32 target_x, INT32 target_y, ioport_port *&input_port, ioport_value &input_mask, float &input_x, float &input_y) { - return map_point_internal(target_x, target_y, NULL, input_x, input_y, input_tag, input_mask); + return map_point_internal(target_x, target_y, NULL, input_x, input_y, input_port, input_mask);; } @@ -1467,6 +1467,22 @@ void render_target::debug_top(render_container &container) //------------------------------------------------- +// resolve_tags - resolve tag lookups +//------------------------------------------------- + +void render_target::resolve_tags() +{ + for (layout_file *file = m_filelist.first(); file != NULL; file = file->next()) + { + for (layout_view *view = file->first_view(); view != NULL; view = view->next()) + { + view->resolve_tags(); + } + } +} + + +//------------------------------------------------- // update_layer_config - recompute after a layer // config change //------------------------------------------------- @@ -1861,7 +1877,7 @@ void render_target::add_element_primitives(render_primitive_list &list, const ob // mapping points //------------------------------------------------- -bool render_target::map_point_internal(INT32 target_x, INT32 target_y, render_container *container, float &mapped_x, float &mapped_y, const char *&mapped_input_tag, ioport_value &mapped_input_mask) +bool render_target::map_point_internal(INT32 target_x, INT32 target_y, render_container *container, float &mapped_x, float &mapped_y, ioport_port *&mapped_input_port, ioport_value &mapped_input_mask) { // compute the visible width/height INT32 viswidth, visheight; @@ -1875,7 +1891,7 @@ bool render_target::map_point_internal(INT32 target_x, INT32 target_y, render_co // default to point not mapped mapped_x = -1.0; mapped_y = -1.0; - mapped_input_tag = NULL; + mapped_input_port = NULL; mapped_input_mask = 0; // convert target coordinates to float @@ -1926,7 +1942,7 @@ bool render_target::map_point_internal(INT32 target_x, INT32 target_y, render_co // point successfully mapped mapped_x = (target_fx - item->bounds().x0) / (item->bounds().x1 - item->bounds().x0); mapped_y = (target_fy - item->bounds().y0) / (item->bounds().y1 - item->bounds().y0); - mapped_input_tag = item->input_tag_and_mask(mapped_input_mask); + mapped_input_port = item->input_tag_and_mask(mapped_input_mask); return true; } } @@ -2589,6 +2605,19 @@ void render_manager::invalidate_all(void *refptr) //------------------------------------------------- +// resolve_tags - resolve tag lookups +//------------------------------------------------- + +void render_manager::resolve_tags() +{ + for (render_target *target = m_targetlist.first(); target != NULL; target = target->next()) + { + target->resolve_tags(); + } +} + + +//------------------------------------------------- // container_alloc - allocate a new container //------------------------------------------------- diff --git a/src/emu/render.h b/src/emu/render.h index 8598a565be2..ada65f344f2 100644 --- a/src/emu/render.h +++ b/src/emu/render.h @@ -436,7 +436,7 @@ private: void get_scaled(UINT32 dwidth, UINT32 dheight, render_texinfo &texinfo, render_primitive_list &primlist); const rgb_t *get_adjusted_palette(render_container &container); - static const int MAX_TEXTURE_SCALES = 8; + static const int MAX_TEXTURE_SCALES = 16; // a scaled_texture contains a single scaled entry for a texture struct scaled_texture @@ -651,7 +651,7 @@ public: // hit testing bool map_point_container(INT32 target_x, INT32 target_y, render_container &container, float &container_x, float &container_y); - bool map_point_input(INT32 target_x, INT32 target_y, const char *&input_tag, ioport_value &input_mask, float &input_x, float &input_y); + bool map_point_input(INT32 target_x, INT32 target_y, ioport_port *&input_port, ioport_value &input_mask, float &input_x, float &input_y); // reference tracking void invalidate_all(void *refptr); @@ -661,6 +661,9 @@ public: void debug_free(render_container &container); void debug_top(render_container &container); + // resolve tag lookups + void resolve_tags(); + private: // internal helpers void update_layer_config(); @@ -668,7 +671,7 @@ private: bool load_layout_file(const char *dirname, const char *filename); void add_container_primitives(render_primitive_list &list, const object_transform &xform, render_container &container, int blendmode); void add_element_primitives(render_primitive_list &list, const object_transform &xform, layout_element &element, int state, int blendmode); - bool map_point_internal(INT32 target_x, INT32 target_y, render_container *container, float &mapped_x, float &mapped_y, const char *&mapped_input_tag, ioport_value &mapped_input_mask); + bool map_point_internal(INT32 target_x, INT32 target_y, render_container *container, float &mapped_x, float &mapped_y, ioport_port *&mapped_input_port, ioport_value &mapped_input_mask); // config callbacks void config_load(xml_data_node &targetnode); @@ -760,6 +763,9 @@ public: // reference tracking void invalidate_all(void *refptr); + // resolve tag lookups + void resolve_tags(); + private: // containers render_container *container_alloc(screen_device *screen = NULL); diff --git a/src/emu/rendlay.c b/src/emu/rendlay.c index cb229846299..6733ecbcb92 100644 --- a/src/emu/rendlay.c +++ b/src/emu/rendlay.c @@ -2304,6 +2304,22 @@ void layout_view::recompute(render_layer_config layerconfig) } +//----------------------------- +// resolve_tags - resolve tags +//----------------------------- + +void layout_view::resolve_tags() +{ + for (item_layer layer = ITEM_LAYER_FIRST; layer < ITEM_LAYER_MAX; layer++) + { + for (item *curitem = first_item(layer); curitem != NULL; curitem = curitem->next()) + { + curitem->resolve_tags(); + } + } +} + + //************************************************************************** // LAYOUT VIEW ITEM @@ -2316,6 +2332,7 @@ void layout_view::recompute(render_layer_config layerconfig) layout_view::item::item(running_machine &machine, xml_data_node &itemnode, simple_list<layout_element> &elemlist) : m_next(NULL), m_element(NULL), + m_input_port(NULL), m_input_mask(0), m_screen(NULL), m_orientation(ROT0) @@ -2365,6 +2382,11 @@ layout_view::item::item(running_machine &machine, xml_data_node &itemnode, simpl if (m_element == NULL) throw emu_fatalerror("Layout item of type %s require an element tag", itemnode.name); } + + if (has_input()) + { + m_input_port = m_element->machine().root_device().ioport(m_input_tag.c_str()); + } } @@ -2387,6 +2409,7 @@ render_container *layout_view::item::screen_container(running_machine &machine) return (m_screen != NULL) ? &m_screen->container() : NULL; } + //------------------------------------------------- // state - fetch state based on configured source //------------------------------------------------- @@ -2404,18 +2427,31 @@ int layout_view::item::state() const // if configured to an input, fetch the input value else if (m_input_tag[0] != 0) { - ioport_port *port = m_element->machine().root_device().ioport(m_input_tag.c_str()); - if (port != NULL) + if (m_input_port != NULL) { - ioport_field *field = port->field(m_input_mask); + ioport_field *field = m_input_port->field(m_input_mask); if (field != NULL) - state = ((port->read() ^ field->defvalue()) & m_input_mask) ? 1 : 0; + state = ((m_input_port->read() ^ field->defvalue()) & m_input_mask) ? 1 : 0; } } return state; } +//--------------------------------------------- +// resolve_tags - resolve tags, if any are set +//--------------------------------------------- + + +void layout_view::item::resolve_tags() +{ + if (has_input()) + { + m_input_port = m_element->machine().root_device().ioport(m_input_tag.c_str()); + } +} + + //************************************************************************** // LAYOUT FILE diff --git a/src/emu/rendlay.h b/src/emu/rendlay.h index 068fc5cfec0..537d1155286 100644 --- a/src/emu/rendlay.h +++ b/src/emu/rendlay.h @@ -208,17 +208,21 @@ public: int orientation() const { return m_orientation; } render_container *screen_container(running_machine &machine) const; bool has_input() const { return !m_input_tag.empty(); } - const char *input_tag_and_mask(ioport_value &mask) const { mask = m_input_mask; return m_input_tag.c_str(); } + ioport_port *input_tag_and_mask(ioport_value &mask) const { mask = m_input_mask; return m_input_port; }; // fetch state based on configured source int state() const; + // resolve tags, if any + void resolve_tags(); + private: // internal state item * m_next; // link to next item layout_element * m_element; // pointer to the associated element (non-screens only) std::string m_output_name; // name of this item std::string m_input_tag; // input tag of this item + ioport_port * m_input_port; // input port of this item ioport_value m_input_mask; // input mask of this item screen_device * m_screen; // pointer to screen int m_orientation; // orientation of this item @@ -245,6 +249,9 @@ public: // operations void recompute(render_layer_config layerconfig); + // resolve tags, if any + void resolve_tags(); + private: // internal state layout_view * m_next; // pointer to next layout in the list diff --git a/src/emu/save.h b/src/emu/save.h index 85bb660540c..41cc4a07fb4 100644 --- a/src/emu/save.h +++ b/src/emu/save.h @@ -250,9 +250,9 @@ template<> inline void save_manager::save_item(device_t *device, const char *module, const char *tag, int index, attotime &value, const char *name) { std::string tempstr = std::string(name).append(".attoseconds"); - save_memory(device, module, tag, index, tempstr.c_str(), &value.attoseconds, sizeof(value.attoseconds)); + save_memory(device, module, tag, index, tempstr.c_str(), &value.m_attoseconds, sizeof(value.m_attoseconds)); tempstr.assign(name).append(".seconds"); - save_memory(device, module, tag, index, tempstr.c_str(), &value.seconds, sizeof(value.seconds)); + save_memory(device, module, tag, index, tempstr.c_str(), &value.m_seconds, sizeof(value.m_seconds)); } diff --git a/src/emu/schedule.c b/src/emu/schedule.c index dbd22f24960..3b480d4c3c3 100644 --- a/src/emu/schedule.c +++ b/src/emu/schedule.c @@ -194,7 +194,7 @@ void emu_timer::adjust(attotime start_delay, INT32 param, const attotime &period m_enabled = true; // clamp negative times to 0 - if (start_delay.seconds < 0) + if (start_delay.seconds() < 0) start_delay = attotime::zero; // set the start and expire times @@ -452,11 +452,11 @@ void device_scheduler::timeslice() { // only process if this CPU is executing or truly halted (not yielding) // and if our target is later than the CPU's current time (coarse check) - if (EXPECTED((exec->m_suspend == 0 || exec->m_eatcycles) && target.seconds >= exec->m_localtime.seconds)) + if (EXPECTED((exec->m_suspend == 0 || exec->m_eatcycles) && target.seconds() >= exec->m_localtime.seconds())) { // compute how many attoseconds to execute this CPU - attoseconds_t delta = target.attoseconds - exec->m_localtime.attoseconds; - if (delta < 0 && target.seconds > exec->m_localtime.seconds) + attoseconds_t delta = target.attoseconds() - exec->m_localtime.attoseconds(); + if (delta < 0 && target.seconds() > exec->m_localtime.seconds()) delta += ATTOSECONDS_PER_SECOND; assert(delta == (target - exec->m_localtime).as_attoseconds()); @@ -564,7 +564,7 @@ void device_scheduler::trigger(int trigid, const attotime &after) void device_scheduler::boost_interleave(const attotime ×lice_time, const attotime &boost_duration) { // ignore timeslices > 1 second - if (timeslice_time.seconds > 0) + if (timeslice_time.seconds() > 0) return; add_scheduling_quantum(timeslice_time, boost_duration); } @@ -941,10 +941,11 @@ inline void device_scheduler::execute_timers() void device_scheduler::add_scheduling_quantum(const attotime &quantum, const attotime &duration) { - assert(quantum.seconds == 0); + assert(quantum.seconds() == 0); attotime curtime = time(); attotime expire = curtime + duration; + const attoseconds_t quantum_attos = quantum.attoseconds(); // figure out where to insert ourselves, expiring any quanta that are out-of-date quantum_slot *insert_after = NULL; @@ -957,20 +958,20 @@ void device_scheduler::add_scheduling_quantum(const attotime &quantum, const att m_quantum_allocator.reclaim(m_quantum_list.detach(*quant)); // if this quantum is shorter than us, we need to be inserted afterwards - else if (quant->m_requested <= quantum.attoseconds) + else if (quant->m_requested <= quantum_attos) insert_after = quant; } // if we found an exact match, just take the maximum expiry time - if (insert_after != NULL && insert_after->m_requested == quantum.attoseconds) + if (insert_after != NULL && insert_after->m_requested == quantum_attos) insert_after->m_expire = max(insert_after->m_expire, expire); // otherwise, allocate a new quantum and insert it after the one we picked else { quantum_slot &quant = *m_quantum_allocator.alloc(); - quant.m_requested = quantum.attoseconds; - quant.m_actual = MAX(quantum.attoseconds, m_quantum_minimum); + quant.m_requested = quantum_attos; + quant.m_actual = MAX(quantum_attos, m_quantum_minimum); quant.m_expire = expire; m_quantum_list.insert_after(quant, insert_after); } diff --git a/src/emu/screen.c b/src/emu/screen.c index 12bf4280dd8..c3bb09e320a 100644 --- a/src/emu/screen.c +++ b/src/emu/screen.c @@ -63,6 +63,8 @@ screen_device::screen_device(const machine_config &mconfig, const char *tag, dev m_curtexture(0), m_changed(true), m_last_partial_scan(0), + m_color(rgb_t(0xff, 0xff, 0xff, 0xff)), + m_brightness(0xff), m_frame_period(DEFAULT_FRAME_PERIOD.as_attoseconds()), m_scantime(1), m_pixeltime(1), @@ -356,6 +358,7 @@ void screen_device::device_start() save_item(NAME(m_visarea.max_y)); save_item(NAME(m_last_partial_scan)); save_item(NAME(m_frame_period)); + save_item(NAME(m_brightness)); save_item(NAME(m_scantime)); save_item(NAME(m_pixeltime)); save_item(NAME(m_vblank_period)); @@ -366,6 +369,17 @@ void screen_device::device_start() //------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void screen_device::device_reset() +{ + // reset brightness to default + m_brightness = 0xff; +} + + +//------------------------------------------------- // device_stop - clean up before the machine goes // away //------------------------------------------------- @@ -884,9 +898,12 @@ bool screen_device::update_quads() m_curbitmap = 1 - m_curbitmap; } + // brightness adjusted render color + rgb_t color = m_color - rgb_t(0, 0xff - m_brightness, 0xff - m_brightness, 0xff - m_brightness); + // create an empty container with a single quad m_container->empty(); - m_container->add_quad(0.0f, 0.0f, 1.0f, 1.0f, rgb_t(0xff,0xff,0xff,0xff), m_texture[m_curtexture], PRIMFLAG_BLENDMODE(BLENDMODE_NONE) | PRIMFLAG_SCREENTEX(1)); + m_container->add_quad(0.0f, 0.0f, 1.0f, 1.0f, color, m_texture[m_curtexture], PRIMFLAG_BLENDMODE(BLENDMODE_NONE) | PRIMFLAG_SCREENTEX(1)); } } diff --git a/src/emu/screen.h b/src/emu/screen.h index 682dd0ce049..29eff3465df 100644 --- a/src/emu/screen.h +++ b/src/emu/screen.h @@ -186,10 +186,12 @@ public: render_container &container() const { assert(m_container != NULL); return *m_container; } bitmap_ind8 &priority() { return m_priority; } palette_device *palette() { return m_palette; } + // dynamic configuration void configure(int width, int height, const rectangle &visarea, attoseconds_t frame_period); void reset_origin(int beamy = 0, int beamx = 0); void set_visible_area(int min_x, int max_x, int min_y, int max_y); + void set_brightness(UINT8 brightness) { m_brightness = brightness; } // beam positioning and state int vpos() const; @@ -239,6 +241,7 @@ private: // device-level overrides virtual void device_validity_check(validity_checker &valid) const; virtual void device_start(); + virtual void device_reset(); virtual void device_stop(); virtual void device_post_load(); virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); @@ -284,6 +287,8 @@ private: INT32 m_last_partial_scan; // scanline of last partial update bitmap_argb32 m_screen_overlay_bitmap; // screen overlay bitmap UINT32 m_unique_id; // unique id for this screen_device + rgb_t m_color; // render color + UINT8 m_brightness; // global brightness // screen timing attoseconds_t m_frame_period; // attoseconds per frame diff --git a/src/emu/softlist.c b/src/emu/softlist.c index fdfd980aeea..c2e8dba671a 100644 --- a/src/emu/softlist.c +++ b/src/emu/softlist.c @@ -625,14 +625,6 @@ void software_list_device::internal_validity_check(validity_checker &valid) for (const rom_entry *data = part->romdata(); data->_name != NULL; data++) if (data->_hashdata != NULL) { - // make sure it's all lowercase - for (const char *str = data->_name; *str; str++) - if (tolower((UINT8)*str) != *str) - { - osd_printf_error("%s: %s has upper case ROM name %s\n", filename(), swinfo->shortname(), data->_name); - break; - } - // make sure the hash is valid hash_collection hashes; if (!hashes.from_internal_string(data->_hashdata)) diff --git a/src/emu/sound.c b/src/emu/sound.c index d2543154bf6..84ab4821c7c 100644 --- a/src/emu/sound.c +++ b/src/emu/sound.c @@ -118,7 +118,7 @@ sound_stream::sound_stream(device_t &device, int inputs, int outputs, int sample attotime sound_stream::sample_time() const { - return attotime(m_device.machine().sound().last_update().seconds, 0) + attotime(0, m_output_sampindex * m_attoseconds_per_sample); + return attotime(m_device.machine().sound().last_update().seconds(), 0) + attotime(0, m_output_sampindex * m_attoseconds_per_sample); } @@ -264,20 +264,20 @@ void sound_stream::update() { // determine the number of samples since the start of this second attotime time = m_device.machine().time(); - INT32 update_sampindex = INT32(time.attoseconds / m_attoseconds_per_sample); + INT32 update_sampindex = INT32(time.attoseconds() / m_attoseconds_per_sample); // if we're ahead of the last update, then adjust upwards attotime last_update = m_device.machine().sound().last_update(); - if (time.seconds > last_update.seconds) + if (time.seconds() > last_update.seconds()) { - assert(time.seconds == last_update.seconds + 1); + assert(time.seconds() == last_update.seconds() + 1); update_sampindex += m_sample_rate; } // if we're behind the last update, then adjust downwards - if (time.seconds < last_update.seconds) + if (time.seconds() < last_update.seconds()) { - assert(time.seconds == last_update.seconds - 1); + assert(time.seconds() == last_update.seconds() - 1); update_sampindex -= m_sample_rate; } @@ -297,7 +297,7 @@ void sound_stream::sync_update(void *, INT32) { update(); attotime time = m_device.machine().time(); - attoseconds_t next_edge = m_attoseconds_per_sample - (time.attoseconds % m_attoseconds_per_sample); + attoseconds_t next_edge = m_attoseconds_per_sample - (time.attoseconds() % m_attoseconds_per_sample); m_sync_timer->adjust(attotime(0, next_edge)); } @@ -514,7 +514,7 @@ void sound_stream::recompute_sample_rate_data() if (m_synchronous) { attotime time = m_device.machine().time(); - attoseconds_t next_edge = m_attoseconds_per_sample - (time.attoseconds % m_attoseconds_per_sample); + attoseconds_t next_edge = m_attoseconds_per_sample - (time.attoseconds() % m_attoseconds_per_sample); m_sync_timer->adjust(attotime(0, next_edge)); } } @@ -584,7 +584,7 @@ void sound_stream::postload() memset(&m_output[outputnum].m_buffer[0], 0, m_output_bufalloc * sizeof(m_output[outputnum].m_buffer[0])); // recompute the sample indexes to make sense - m_output_sampindex = m_device.machine().sound().last_update().attoseconds / m_attoseconds_per_sample; + m_output_sampindex = m_device.machine().sound().last_update().attoseconds() / m_attoseconds_per_sample; m_output_update_sampindex = m_output_sampindex; m_output_base_sampindex = m_output_sampindex - m_max_samples_per_update; } @@ -817,7 +817,7 @@ sound_manager::sound_manager(running_machine &machine) m_attenuation(0), m_nosound_mode(machine.osd().no_sound()), m_wavfile(NULL), - m_update_attoseconds(STREAMS_UPDATE_ATTOTIME.attoseconds), + m_update_attoseconds(STREAMS_UPDATE_ATTOTIME.attoseconds()), m_last_update(attotime::zero) { // get filename for WAV file or AVI file if specified @@ -1083,9 +1083,9 @@ void sound_manager::update(void *ptr, int param) // see if we ticked over to the next second attotime curtime = machine().time(); bool second_tick = false; - if (curtime.seconds != m_last_update.seconds) + if (curtime.seconds() != m_last_update.seconds()) { - assert(curtime.seconds == m_last_update.seconds + 1); + assert(curtime.seconds() == m_last_update.seconds() + 1); second_tick = true; } diff --git a/src/emu/sound/nes_apu.c b/src/emu/sound/nes_apu.c index 95a68e9c3b1..cd2dfa8e4cb 100644 --- a/src/emu/sound/nes_apu.c +++ b/src/emu/sound/nes_apu.c @@ -143,9 +143,9 @@ void nesapu_device::device_start() int rate = clock() / 4; /* Initialize global variables */ - m_samps_per_sync = rate / ATTOSECONDS_TO_HZ(machine().first_screen()->frame_period().attoseconds); + m_samps_per_sync = rate / ATTOSECONDS_TO_HZ(machine().first_screen()->frame_period().attoseconds()); m_buffer_size = m_samps_per_sync; - m_real_rate = m_samps_per_sync * ATTOSECONDS_TO_HZ(machine().first_screen()->frame_period().attoseconds); + m_real_rate = m_samps_per_sync * ATTOSECONDS_TO_HZ(machine().first_screen()->frame_period().attoseconds()); m_apu_incsize = (float) (clock() / (float) m_real_rate); /* Use initializer calls */ diff --git a/src/emu/sound/rf5c400.c b/src/emu/sound/rf5c400.c index 91f9cf0d761..730c6240056 100644 --- a/src/emu/sound/rf5c400.c +++ b/src/emu/sound/rf5c400.c @@ -413,6 +413,18 @@ WRITE16_MEMBER( rf5c400_device::rf5c400_w ) case 0x08: // relative to env attack (channel no) case 0x09: // relative to env attack (0x0c00/ 0x1c00) + case 0x11: // ? counter for 0x13? + { + break; + } + case 0x13: // ? bujutsu writes sample data here + { + break; + } + + case 0x14: // ? related to 0x11/0x13 ? + break; + case 0x21: // reverb(character).w case 0x32: // reverb(pre-lpf).w case 0x2B: // reverb(level).w diff --git a/src/emu/sound/tms5110.c b/src/emu/sound/tms5110.c index c5861e2d7c6..2ba0e140a01 100644 --- a/src/emu/sound/tms5110.c +++ b/src/emu/sound/tms5110.c @@ -66,6 +66,52 @@ #include "emu.h" #include "tms5110.h" +static INT16 clip_analog(INT16 cliptemp); + +/* *****optional defines***** */ + +/* Hacky improvements which don't match patent: */ +/* Interpolation shift logic: + * One of the following two lines should be used, and the other commented + * The second line is more accurate mathematically but not accurate to the patent + */ +#define INTERP_SHIFT >> m_coeff->interp_coeff[m_IP] +//define INTERP_SHIFT / (1<<m_coeff->interp_coeff[m_IP]) + +/* Other hacks */ +/* HACK?: if defined, outputs the low 4 bits of the lattice filter to the i/o + * or clip logic, even though the real hardware doesn't do this, partially verified by decap */ +#undef ALLOW_4_LSB + + +/* *****configuration of chip connection stuff***** */ +/* must be defined; if 0, output the waveform as if it was tapped on the speaker pin as usual, if 1, output the waveform as if it was tapped on the i/o pin (volume is much lower in the latter case) */ +#define FORCE_DIGITAL 0 + + +/* *****debugging defines***** */ +#undef VERBOSE +// above is general, somewhat obsolete, catch all for debugs which don't fit elsewhere +#undef DEBUG_PARSE_FRAME_DUMP +// above dumps each frame to stderr: be sure to select one of the options below if you define it! +#undef DEBUG_PARSE_FRAME_DUMP_BIN +// dumps each speech frame as binary +#undef DEBUG_PARSE_FRAME_DUMP_HEX +// dumps each speech frame as hex +#undef DEBUG_FRAME_ERRORS +// above dumps info if a frame ran out of data +#undef DEBUG_COMMAND_DUMP +// above dumps all command writes and PDC-related state machine changes, plus command writes to VSMs +#undef DEBUG_GENERATION +// above dumps debug information related to the sample generation loop, i.e. whether interpolation is inhibited or not, and what the current and target values for each frame are. +#undef DEBUG_GENERATION_VERBOSE +// above dumps MUCH MORE debug information related to the sample generation loop, namely the excitation, energy, pitch, k*, and output values for EVERY SINGLE SAMPLE during a frame. +#undef DEBUG_LATTICE +// above dumps the lattice filter state data each sample. +#undef DEBUG_CLIP +// above dumps info to stderr whenever the analog clip hardware is (or would be) clipping the signal. + + #define MAX_SAMPLE_CHUNK 512 /* 6 Variants, from tms5110r.inc */ @@ -175,14 +221,23 @@ void tms5110_device::register_for_save_states() save_item(NAME(m_talk_status)); save_item(NAME(m_state)); - save_item(NAME(m_old_energy)); - save_item(NAME(m_old_pitch)); - save_item(NAME(m_old_k)); + save_item(NAME(m_address)); + save_item(NAME(m_next_is_address)); + save_item(NAME(m_schedule_dummy_read)); + save_item(NAME(m_addr_bit)); + save_item(NAME(m_CTL_buffer)); - save_item(NAME(m_new_energy)); - save_item(NAME(m_new_pitch)); - save_item(NAME(m_new_k)); + save_item(NAME(m_OLDE)); + save_item(NAME(m_OLDP)); + save_item(NAME(m_new_frame_energy_idx)); + save_item(NAME(m_new_frame_pitch_idx)); + save_item(NAME(m_new_frame_k_idx)); +#ifdef PERFECT_INTERPOLATION_HACK + save_item(NAME(m_old_frame_energy_idx)); + save_item(NAME(m_old_frame_pitch_idx)); + save_item(NAME(m_old_frame_k_idx)); +#endif save_item(NAME(m_current_energy)); save_item(NAME(m_current_pitch)); save_item(NAME(m_current_k)); @@ -191,22 +246,68 @@ void tms5110_device::register_for_save_states() save_item(NAME(m_target_pitch)); save_item(NAME(m_target_k)); - save_item(NAME(m_interp_count)); - save_item(NAME(m_sample_count)); - save_item(NAME(m_pitch_count)); + save_item(NAME(m_previous_energy)); - save_item(NAME(m_next_is_address)); - save_item(NAME(m_address)); - save_item(NAME(m_schedule_dummy_read)); - save_item(NAME(m_addr_bit)); - save_item(NAME(m_CTL_buffer)); + save_item(NAME(m_subcycle)); + save_item(NAME(m_subc_reload)); + save_item(NAME(m_PC)); + save_item(NAME(m_IP)); + save_item(NAME(m_inhibit)); + save_item(NAME(m_pitch_count)); + save_item(NAME(m_u)); save_item(NAME(m_x)); save_item(NAME(m_RNG)); + save_item(NAME(m_excitation_data)); + + save_item(NAME(m_digital_select)); + + save_item(NAME(m_speech_rom_bitnum)); + + save_item(NAME(m_romclk_hack_timer_started)); + save_item(NAME(m_romclk_hack_state)); + + save_item(NAME(m_variant)); } +/********************************************************************************************** + + printbits helper function: takes a long int input and prints the resulting bits to stderr + +***********************************************************************************************/ +#ifdef DEBUG_PARSE_FRAME_DUMP_BIN +static void printbits(long data, int num) +{ + int i; + for (i=(num-1); i>=0; i--) + fprintf(stderr,"%0ld", (data>>i)&1); +} +#endif +#ifdef DEBUG_PARSE_FRAME_DUMP_HEX +static void printbits(long data, int num) +{ + switch((num-1)&0xFC) + { + case 0: + fprintf(stderr,"%0lx", data); + break; + case 4: + fprintf(stderr,"%02lx", data); + break; + case 8: + fprintf(stderr,"%03lx", data); + break; + case 12: + fprintf(stderr,"%04lx", data); + break; + default: + fprintf(stderr,"%04lx", data); + break; + } +} +#endif /****************************************************************************************** @@ -284,218 +385,195 @@ void tms5110_device::perform_dummy_read() void tms5110_device::process(INT16 *buffer, unsigned int size) { int buf_count=0; - int i, interp_period, bitout; - INT16 Y11, cliptemp; + int i, bitout, zpar; + INT32 this_sample; /* if we're not speaking, fill with nothingness */ if (!m_speaking_now) goto empty; - /* if we're to speak, but haven't started */ - if (!m_talk_status) - { - /* a "dummy read" is mentioned in the tms5200 datasheet */ - /* The Bagman speech roms data are organized in such a way that - ** the bit at address 0 is NOT a speech data. The bit at address 1 - ** is the speech data. It seems that the tms5110 performs a dummy read - ** just before it executes a SPEAK command. - ** This has been moved to command logic ... - ** perform_dummy_read(); - */ - - /* clear out the new frame parameters (it will become old frame just before the first call to parse_frame() ) */ - m_new_energy = 0; - m_new_pitch = 0; - for (i = 0; i < m_coeff->num_k; i++) - m_new_k[i] = 0; - - m_talk_status = 1; - } - - /* loop until the buffer is full or we've stopped speaking */ while ((size > 0) && m_speaking_now) { - int current_val; + /* if it is the appropriate time to update the old energy/pitch indices, + * i.e. when IP=7, PC=12, T=17, subcycle=2, do so. Since IP=7 PC=12 T=17 + * is JUST BEFORE the transition to IP=0 PC=0 T=0 sybcycle=(0 or 1), + * which happens 4 T-cycles later), we change on the latter. + * The indices are updated here ~12 PCs before the new frame is applied. + */ + if ((m_IP == 0) && (m_PC == 0) && (m_subcycle < 2)) + { + m_OLDE = (m_new_frame_energy_idx == 0); + m_OLDP = (m_new_frame_pitch_idx == 0); + } - /* if we're ready for a new frame */ - if ((m_interp_count == 0) && (m_sample_count == 0)) + /* if we're ready for a new frame to be applied, i.e. when IP=0, PC=12, Sub=1 + * (In reality, the frame was really loaded incrementally during the entire IP=0 + * PC=x time period, but it doesn't affect anything until IP=0 PC=12 happens) + */ + if ((m_IP == 0) && (m_PC == 12) && (m_subcycle == 1)) { - /* remember previous frame */ - m_old_energy = m_new_energy; - m_old_pitch = m_new_pitch; + // HACK for regression testing, be sure to comment out before release! + //m_RNG = 0x1234; + // end HACK + +#ifdef PERFECT_INTERPOLATION_HACK + /* remember previous frame energy, pitch, and coefficients */ + m_old_frame_energy_idx = m_new_frame_energy_idx; + m_old_frame_pitch_idx = m_new_frame_pitch_idx; for (i = 0; i < m_coeff->num_k; i++) - m_old_k[i] = m_new_k[i]; - + m_old_frame_k_idx[i] = m_new_frame_k_idx[i]; +#endif - /* if the old frame was a stop frame, exit and do not process any more frames */ - if (m_old_energy == COEFF_ENERGY_SENTINEL) + /* if the talk status was clear last frame, halt speech now. */ + if (m_talk_status == 0) { - if (DEBUG_5110) logerror("processing frame: stop frame\n"); - m_target_energy = m_current_energy = 0; - m_speaking_now = m_talk_status = 0; - m_interp_count = m_sample_count = m_pitch_count = 0; - goto empty; +#ifdef DEBUG_GENERATION + fprintf(stderr,"tms5110_process: processing frame: talk status = 0 caused by stop frame or buffer empty, halting speech.\n"); +#endif + if (m_speaking_now == 1) // we're done, set all coeffs to idle state but keep going for a bit... + { + m_new_frame_energy_idx = 0; + m_new_frame_pitch_idx = 0; + for (i = 0; i < 4; i++) + m_new_frame_k_idx[i] = 0; + for (i = 4; i < 7; i++) + m_new_frame_k_idx[i] = 0xF; + for (i = 7; i < m_coeff->num_k; i++) + m_new_frame_k_idx[i] = 0x7; + m_speaking_now = 2; // wait 8 extra interp periods before shutting down so we can interpolate everything to zero state + } + else // m_speaking_now == 2 // now we're really done. + { + m_speaking_now = 0; // finally halt speech + goto empty; + } + //m_speaking_now = 0; // finally halt speech + //goto empty; } + - /* Parse a new frame into the new_energy, new_pitch and new_k[] */ - parse_frame(); - - - /* Set old target as new start of frame */ - m_current_energy = m_old_energy; - m_current_pitch = m_old_pitch; + /* Parse a new frame into the new_target_energy, new_target_pitch and new_target_k[], + * but only if we're not just about to end speech */ + if (m_speaking_now == 1) parse_frame(); +#ifdef DEBUG_PARSE_FRAME_DUMP + fprintf(stderr,"\n"); +#endif - for (i = 0; i < m_coeff->num_k; i++) - m_current_k[i] = m_old_k[i]; + /* if the new frame is a stop frame, unset talk status */ + /** TODO: investigate this later! **/ + if (NEW_FRAME_STOP_FLAG == 1) + m_talk_status = 0; + /* in all cases where interpolation would be inhibited, set the inhibit flag; otherwise clear it. + Interpolation inhibit cases: + * Old frame was voiced, new is unvoiced + * Old frame was silence/zero energy, new has nonzero energy + * Old frame was unvoiced, new is voiced (note this is the case on the patent but may not be correct on the real final chip) + */ + if ( ((OLD_FRAME_UNVOICED_FLAG == 0) && (NEW_FRAME_UNVOICED_FLAG == 1)) + || ((OLD_FRAME_UNVOICED_FLAG == 1) && (NEW_FRAME_UNVOICED_FLAG == 0)) /* this line needs further investigation, starwars tie fighters may sound better without it */ + || ((OLD_FRAME_SILENCE_FLAG == 1) && (NEW_FRAME_SILENCE_FLAG == 0)) ) + m_inhibit = 1; + else // normal frame, normal interpolation + m_inhibit = 0; + + /* load new frame targets from tables, using parsed indices */ + m_target_energy = m_coeff->energytable[m_new_frame_energy_idx]; + m_target_pitch = m_coeff->pitchtable[m_new_frame_pitch_idx]; + zpar = NEW_FRAME_UNVOICED_FLAG; // find out if parameters k5-k10 should be zeroed + for (i = 0; i < 4; i++) + m_target_k[i] = m_coeff->ktable[i][m_new_frame_k_idx[i]]; + for (i = 4; i < m_coeff->num_k; i++) + m_target_k[i] = (m_coeff->ktable[i][m_new_frame_k_idx[i]] * (1-zpar)); + +#ifdef DEBUG_GENERATION + /* Debug info for current parsed frame */ + fprintf(stderr, "OLDE: %d; OLDP: %d; ", m_OLDE, m_OLDP); + fprintf(stderr,"Processing frame: "); + if (m_inhibit == 0) + fprintf(stderr, "Normal Frame\n"); + else + fprintf(stderr,"Interpolation Inhibited\n"); + fprintf(stderr,"*** current Energy, Pitch and Ks = %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d\n",m_current_energy, m_current_pitch, m_current_k[0], m_current_k[1], m_current_k[2], m_current_k[3], m_current_k[4], m_current_k[5], m_current_k[6], m_current_k[7], m_current_k[8], m_current_k[9]); + fprintf(stderr,"*** target Energy(idx), Pitch, and Ks = %04d(%x),%04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d\n",m_target_energy, m_new_frame_energy_idx, m_target_pitch, m_target_k[0], m_target_k[1], m_target_k[2], m_target_k[3], m_target_k[4], m_target_k[5], m_target_k[6], m_target_k[7], m_target_k[8], m_target_k[9]); +#endif - /* is this the stop (ramp down) frame? */ - if (m_new_energy == COEFF_ENERGY_SENTINEL) + /* if TS is now 0, ramp the energy down to 0. Is this really correct to hardware? */ + if (m_talk_status == 0) { - /*logerror("processing frame: ramp down\n");*/ +#ifdef DEBUG_GENERATION + fprintf(stderr,"Talk status is 0, forcing target energy to 0\n"); +#endif m_target_energy = 0; - m_target_pitch = m_old_pitch; - for (i = 0; i < m_coeff->num_k; i++) - m_target_k[i] = m_old_k[i]; - } - else if ((m_old_energy == 0) && (m_new_energy != 0)) /* was the old frame a zero-energy frame? */ - { - /* if so, and if the new frame is non-zero energy frame then the new parameters - should become our current and target parameters immediately, - i.e. we should NOT interpolate them slowly in. - */ - - /*logerror("processing non-zero energy frame after zero-energy frame\n");*/ - m_target_energy = m_new_energy; - m_target_pitch = m_current_pitch = m_new_pitch; - for (i = 0; i < m_coeff->num_k; i++) - m_target_k[i] = m_current_k[i] = m_new_k[i]; - } - else if ((m_old_pitch == 0) && (m_new_pitch != 0)) /* is this a change from unvoiced to voiced frame ? */ - { - /* if so, then the new parameters should become our current and target parameters immediately, - i.e. we should NOT interpolate them slowly in. - */ - /*if (DEBUG_5110) logerror("processing frame: UNVOICED->VOICED frame change\n");*/ - m_target_energy = m_new_energy; - m_target_pitch = m_current_pitch = m_new_pitch; - for (i = 0; i < m_coeff->num_k; i++) - m_target_k[i] = m_current_k[i] = m_new_k[i]; } - else if ((m_old_pitch != 0) && (m_new_pitch == 0)) /* is this a change from voiced to unvoiced frame ? */ + } + else // Not a new frame, just interpolate the existing frame. + { + int inhibit_state = ((m_inhibit==1)&&(m_IP != 0)); // disable inhibit when reaching the last interp period, but don't overwrite the m_inhibit value +#ifdef PERFECT_INTERPOLATION_HACK + int samples_per_frame = m_subc_reload?175:266; // either (13 A cycles + 12 B cycles) * 7 interps for normal SPEAK/SPKEXT, or (13*2 A cycles + 12 B cycles) * 7 interps for SPKSLOW + //int samples_per_frame = m_subc_reload?200:304; // either (13 A cycles + 12 B cycles) * 8 interps for normal SPEAK/SPKEXT, or (13*2 A cycles + 12 B cycles) * 8 interps for SPKSLOW + int current_sample = (m_subcycle - m_subc_reload)+(m_PC*(3-m_subc_reload))+((m_subc_reload?25:38)*((m_IP-1)&7)); + + zpar = OLD_FRAME_UNVOICED_FLAG; + //fprintf(stderr, "CS: %03d", current_sample); + // reset the current energy, pitch, etc to what it was at frame start + m_current_energy = m_coeff->energytable[m_old_frame_energy_idx]; + m_current_pitch = m_coeff->pitchtable[m_old_frame_pitch_idx]; + for (i = 0; i < 4; i++) + m_current_k[i] = m_coeff->ktable[i][m_old_frame_k_idx[i]]; + for (i = 4; i < m_coeff->num_k; i++) + m_current_k[i] = (m_coeff->ktable[i][m_old_frame_k_idx[i]] * (1-zpar)); + // now adjust each value to be exactly correct for each of the samples per frame + if (m_IP != 0) // if we're still interpolating... { - /* if so, then the new parameters should become our current and target parameters immediately, - i.e. we should NOT interpolate them slowly in. - */ - /*if (DEBUG_5110) logerror("processing frame: VOICED->UNVOICED frame change\n");*/ - m_target_energy = m_new_energy; - m_target_pitch = m_current_pitch = m_new_pitch; + m_current_energy += (((m_target_energy - m_current_energy)*(1-inhibit_state))*current_sample)/samples_per_frame; + m_current_pitch += (((m_target_pitch - m_current_pitch)*(1-inhibit_state))*current_sample)/samples_per_frame; for (i = 0; i < m_coeff->num_k; i++) - m_target_k[i] = m_current_k[i] = m_new_k[i]; + m_current_k[i] += (((m_target_k[i] - m_current_k[i])*(1-inhibit_state))*current_sample)/samples_per_frame; } - else + else // we're done, play this frame for 1/8 frame. { - /*logerror("processing frame: Normal\n");*/ - /*logerror("*** Energy = %d\n",current_energy);*/ - /*logerror("proc: %d %d\n",last_fbuf_head,fbuf_head);*/ - - m_target_energy = m_new_energy; - m_target_pitch = m_new_pitch; + m_current_energy = m_target_energy; + m_current_pitch = m_target_pitch; for (i = 0; i < m_coeff->num_k; i++) - m_target_k[i] = m_new_k[i]; + m_current_k[i] = m_target_k[i]; } - } - else - { - interp_period = m_sample_count / 25; - switch(m_interp_count) +#else + //Updates to parameters only happen on subcycle '2' (B cycle) of PCs. + if (m_subcycle == 2) { - /* PC=X X cycle, rendering change (change for next cycle which chip is actually doing) */ - case 0: /* PC=0, A cycle, nothing happens (calc energy) */ - break; - case 1: /* PC=0, B cycle, nothing happens (update energy) */ - break; - case 2: /* PC=1, A cycle, update energy (calc pitch) */ - m_current_energy += ((m_target_energy - m_current_energy) >> m_coeff->interp_coeff[interp_period]); - break; - case 3: /* PC=1, B cycle, nothing happens (update pitch) */ - break; - case 4: /* PC=2, A cycle, update pitch (calc K1) */ - m_current_pitch += ((m_target_pitch - m_current_pitch) >> m_coeff->interp_coeff[interp_period]); - break; - case 5: /* PC=2, B cycle, nothing happens (update K1) */ - break; - case 6: /* PC=3, A cycle, update K1 (calc K2) */ - m_current_k[0] += ((m_target_k[0] - m_current_k[0]) >> m_coeff->interp_coeff[interp_period]); - break; - case 7: /* PC=3, B cycle, nothing happens (update K2) */ - break; - case 8: /* PC=4, A cycle, update K2 (calc K3) */ - m_current_k[1] += ((m_target_k[1] - m_current_k[1]) >> m_coeff->interp_coeff[interp_period]); - break; - case 9: /* PC=4, B cycle, nothing happens (update K3) */ - break; - case 10: /* PC=5, A cycle, update K3 (calc K4) */ - m_current_k[2] += ((m_target_k[2] - m_current_k[2]) >> m_coeff->interp_coeff[interp_period]); - break; - case 11: /* PC=5, B cycle, nothing happens (update K4) */ - break; - case 12: /* PC=6, A cycle, update K4 (calc K5) */ - m_current_k[3] += ((m_target_k[3] - m_current_k[3]) >> m_coeff->interp_coeff[interp_period]); - break; - case 13: /* PC=6, B cycle, nothing happens (update K5) */ - break; - case 14: /* PC=7, A cycle, update K5 (calc K6) */ - m_current_k[4] += ((m_target_k[4] - m_current_k[4]) >> m_coeff->interp_coeff[interp_period]); - break; - case 15: /* PC=7, B cycle, nothing happens (update K6) */ - break; - case 16: /* PC=8, A cycle, update K6 (calc K7) */ - m_current_k[5] += ((m_target_k[5] - m_current_k[5]) >> m_coeff->interp_coeff[interp_period]); - break; - case 17: /* PC=8, B cycle, nothing happens (update K7) */ - break; - case 18: /* PC=9, A cycle, update K7 (calc K8) */ - m_current_k[6] += ((m_target_k[6] - m_current_k[6]) >> m_coeff->interp_coeff[interp_period]); - break; - case 19: /* PC=9, B cycle, nothing happens (update K8) */ - break; - case 20: /* PC=10, A cycle, update K8 (calc K9) */ - m_current_k[7] += ((m_target_k[7] - m_current_k[7]) >> m_coeff->interp_coeff[interp_period]); - break; - case 21: /* PC=10, B cycle, nothing happens (update K9) */ - break; - case 22: /* PC=11, A cycle, update K9 (calc K10) */ - m_current_k[8] += ((m_target_k[8] - m_current_k[8]) >> m_coeff->interp_coeff[interp_period]); - break; - case 23: /* PC=11, B cycle, nothing happens (update K10) */ - break; - case 24: /* PC=12, A cycle, update K10 (do nothing) */ - m_current_k[9] += ((m_target_k[9] - m_current_k[9]) >> m_coeff->interp_coeff[interp_period]); - break; + switch(m_PC) + { + case 0: /* PC = 0, B cycle, write updated energy */ + m_current_energy += (((m_target_energy - m_current_energy)*(1-inhibit_state)) INTERP_SHIFT); + break; + case 1: /* PC = 1, B cycle, write updated pitch */ + m_current_pitch += (((m_target_pitch - m_current_pitch)*(1-inhibit_state)) INTERP_SHIFT); + break; + case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: + /* PC = 2 through 11, B cycle, write updated K1 through K10 */ + m_current_k[m_PC-2] += (((m_target_k[m_PC-2] - m_current_k[m_PC-2])*(1-inhibit_state)) INTERP_SHIFT); + break; + case 12: /* PC = 12, do nothing */ + break; + } } +#endif } - - /* calculate the output */ - - if (m_current_energy == 0) + // calculate the output + if (OLD_FRAME_UNVOICED_FLAG == 1) { - /* generate silent samples here */ - current_val = 0x00; - } - else if (m_old_pitch == 0) - { - /* generate unvoiced samples here */ - if (m_RNG&1) - current_val = -64; /* according to the patent it is (either + or -) half of the maximum value in the chirp table */ + // generate unvoiced samples here + if (m_RNG & 1) + m_excitation_data = ~0x3F; /* according to the patent it is (either + or -) half of the maximum value in the chirp table, so either 01000000(0x40) or 11000000(0xC0)*/ else - current_val = 64; - + m_excitation_data = 0x40; } - else + else /* (OLD_FRAME_UNVOICED_FLAG == 0) */ { // generate voiced samples here /* US patent 4331836 Figure 14B shows, and logic would hold, that a pitch based chirp @@ -505,88 +583,237 @@ void tms5110_device::process(INT16 *buffer, unsigned int size) * disabled, forcing all samples beyond 51d to be == 51d */ if (m_pitch_count >= 51) - current_val = (INT8)m_coeff->chirptable[51]; + m_excitation_data = (INT8)m_coeff->chirptable[51]; else /*m_pitch_count < 51*/ - current_val = (INT8)m_coeff->chirptable[m_pitch_count]; + m_excitation_data = (INT8)m_coeff->chirptable[m_pitch_count]; } - /* Update LFSR *20* times every sample, like patent shows */ - for (i=0; i<20; i++) + // Update LFSR *20* times every sample (once per T cycle), like patent shows + for (i=0; i<20; i++) + { + bitout = ((m_RNG >> 12) & 1) ^ + ((m_RNG >> 3) & 1) ^ + ((m_RNG >> 2) & 1) ^ + ((m_RNG >> 0) & 1); + m_RNG <<= 1; + m_RNG |= bitout; + } + this_sample = lattice_filter(); /* execute lattice filter */ +#ifdef DEBUG_GENERATION_VERBOSE + //fprintf(stderr,"C:%01d; ",m_subcycle); + fprintf(stderr,"IP:%01d PC:%02d X:%04d E:%03d P:%03d Pc:%03d ",m_IP, m_PC, m_excitation_data, m_current_energy, m_current_pitch, m_pitch_count); + //fprintf(stderr,"X:%04d E:%03d P:%03d Pc:%03d ", m_excitation_data, m_current_energy, m_current_pitch, m_pitch_count); + for (i=0; i<10; i++) + fprintf(stderr,"K%d:%04d ", i+1, m_current_k[i]); + fprintf(stderr,"Out:%06d", this_sample); + fprintf(stderr,"\n"); +#endif + /* next, force result to 14 bits (since its possible that the addition at the final (k1) stage of the lattice overflowed) */ + while (this_sample > 16383) this_sample -= 32768; + while (this_sample < -16384) this_sample += 32768; + if (m_digital_select == 0) // analog SPK pin output is only 8 bits, with clipping + buffer[buf_count] = clip_analog(this_sample); + else // digital I/O pin output is 12 bits { - bitout = ((m_RNG>>12)&1) ^ - ((m_RNG>>10)&1) ^ - ((m_RNG>> 9)&1) ^ - ((m_RNG>> 0)&1); - m_RNG >>= 1; - m_RNG |= (bitout<<12); +#ifdef ALLOW_4_LSB + // input: ssss ssss ssss ssss ssnn nnnn nnnn nnnn + // N taps: ^ = 0x2000; + // output: ssss ssss ssss ssss snnn nnnn nnnn nnnN + buffer[buf_count] = (this_sample<<1)|((this_sample&0x2000)>>13); +#else + this_sample &= ~0xF; + // input: ssss ssss ssss ssss ssnn nnnn nnnn 0000 + // N taps: ^^ ^^^ = 0x3E00; + // output: ssss ssss ssss ssss snnn nnnn nnnN NNNN + buffer[buf_count] = (this_sample<<1)|((this_sample&0x3E00)>>9); +#endif } + // Update all counts - /* Lattice filter here */ - - Y11 = (current_val * 64 * m_current_energy) / 512; - - for (i = m_coeff->num_k - 1; i >= 0; i--) + m_subcycle++; + if ((m_subcycle == 2) && (m_PC == 12)) { - Y11 = Y11 - ((m_current_k[i] * m_x[i]) / 512); - m_x[i+1] = m_x[i] + ((m_current_k[i] * Y11) / 512); + /* Circuit 412 in the patent acts a reset, resetting the pitch counter to 0 + * if INHIBIT was true during the most recent frame transition. + * The exact time this occurs is betwen IP=7, PC=12 sub=0, T=t12 + * and m_IP = 0, PC=0 sub=0, T=t12, a period of exactly 20 cycles, + * which overlaps the time OLDE and OLDP are updated at IP=7 PC=12 T17 + * (and hence INHIBIT itself 2 t-cycles later). We do it here because it is + * convenient and should make no difference in output. + */ + if ((m_IP == 7)&&(m_inhibit==1)) m_pitch_count = 0; + m_subcycle = m_subc_reload; + m_PC = 0; + m_IP++; + m_IP&=0x7; } + else if (m_subcycle == 3) + { + m_subcycle = m_subc_reload; + m_PC++; + } + m_pitch_count++; + if (m_pitch_count >= m_current_pitch) m_pitch_count = 0; + m_pitch_count &= 0x1FF; + buf_count++; + size--; + } - m_x[0] = Y11; - +empty: - /* clipping & wrapping, just like the patent */ + while (size > 0) + { + m_subcycle++; + if ((m_subcycle == 2) && (m_PC == 12)) + { + m_subcycle = m_subc_reload; + m_PC = 0; + m_IP++; + m_IP&=0x7; + } + else if (m_subcycle == 3) + { + m_subcycle = m_subc_reload; + m_PC++; + } + buffer[buf_count] = -1; /* should be just -1; actual chip outputs -1 every idle sample; (cf note in data sheet, p 10, table 4) */ + buf_count++; + size--; + } +} - /* YL10 - YL4 ==> DA6 - DA0 */ - cliptemp = Y11 / 16; +/********************************************************************************************** - /* M58817 seems to be different */ - if (m_coeff->subtype & (SUBTYPE_M58817)) - cliptemp = cliptemp / 2; + clip_analog -- clips the 14 bit return value from the lattice filter to its final 10 bit value (-512 to 511), and upshifts/range extends this to 16 bits - if (cliptemp > 511) cliptemp = -512 + (cliptemp-511); - else if (cliptemp < -512) cliptemp = 511 - (cliptemp+512); +***********************************************************************************************/ - if (cliptemp > 127) - buffer[buf_count] = 127*256; - else if (cliptemp < -128) - buffer[buf_count] = -128*256; - else - buffer[buf_count] = cliptemp *256; +static INT16 clip_analog(INT16 cliptemp) +{ + /* clipping, just like the patent shows: + * the top 10 bits of this result are visible on the digital output IO pin. + * next, if the top 3 bits of the 14 bit result are all the same, the lowest of those 3 bits plus the next 7 bits are the signed analog output, otherwise the low bits are all forced to match the inverse of the topmost bit, i.e.: + * 1x xxxx xxxx xxxx -> 0b10000000 + * 11 1bcd efgh xxxx -> 0b1bcdefgh + * 00 0bcd efgh xxxx -> 0b0bcdefgh + * 0x xxxx xxxx xxxx -> 0b01111111 + */ +#ifdef DEBUG_CLIP + if ((cliptemp > 2047) || (cliptemp < -2048)) fprintf(stderr,"clipping cliptemp to range; was %d\n", cliptemp); +#endif + if (cliptemp > 2047) cliptemp = 2047; + else if (cliptemp < -2048) cliptemp = -2048; + /* at this point the analog output is tapped */ +#ifdef ALLOW_4_LSB + // input: ssss snnn nnnn nnnn + // N taps: ^^^ ^ = 0x0780 + // output: snnn nnnn nnnn NNNN + return (cliptemp << 4)|((cliptemp&0x780)>>7); // upshift and range adjust +#else + cliptemp &= ~0xF; + // input: ssss snnn nnnn 0000 + // N taps: ^^^ ^^^^ = 0x07F0 + // P taps: ^ = 0x0400 + // output: snnn nnnn NNNN NNNP + return (cliptemp << 4)|((cliptemp&0x7F0)>>3)|((cliptemp&0x400)>>10); // upshift and range adjust +#endif +} - /* Update all counts */ - m_sample_count = (m_sample_count + 1) % 200; +/********************************************************************************************** - if (m_current_pitch != 0) - { - m_pitch_count++; - if (m_pitch_count >= m_current_pitch) - m_pitch_count = 0; - } - else - m_pitch_count = 0; + matrix_multiply -- does the proper multiply and shift + a is the k coefficient and is clamped to 10 bits (9 bits plus a sign) + b is the running result and is clamped to 14 bits. + output is 14 bits, but note the result LSB bit is always 1. + Because the low 4 bits of the result are trimmed off before + output, this makes almost no difference in the computation. - m_interp_count = (m_interp_count + 1) % 25; +**********************************************************************************************/ +static INT32 matrix_multiply(INT32 a, INT32 b) +{ + INT32 result; + while (a>511) { a-=1024; } + while (a<-512) { a+=1024; } + while (b>16383) { b-=32768; } + while (b<-16384) { b+=32768; } + result = ((a*b)>>9)|1;//&(~1); +#ifdef VERBOSE + if (result>16383) fprintf(stderr,"matrix multiplier overflowed! a: %x, b: %x, result: %x", a, b, result); + if (result<-16384) fprintf(stderr,"matrix multiplier underflowed! a: %x, b: %x, result: %x", a, b, result); +#endif + return result; +} - buf_count++; - size--; - } +/********************************************************************************************** -empty: + lattice_filter -- executes one 'full run' of the lattice filter on a specific byte of + excitation data, and specific values of all the current k constants, and returns the + resulting sample. - while (size > 0) - { - m_sample_count = (m_sample_count + 1) % 200; - m_interp_count = (m_interp_count + 1) % 25; +***********************************************************************************************/ - buffer[buf_count] = 0x00; - buf_count++; - size--; - } +INT32 tms5110_device::lattice_filter() +{ + // Lattice filter here + // Aug/05/07: redone as unrolled loop, for clarity - LN + /* Originally Copied verbatim from table I in US patent 4,209,804, now updated to be in same order as the actual chip does it, not that it matters. + notation equivalencies from table: + Yn(i) == m_u[n-1] + Kn = m_current_k[n-1] + bn = m_x[n-1] + */ + /* + int ep = matrix_multiply(m_previous_energy, (m_excitation_data<<6)); //Y(11) + m_u[10] = ep; + for (int i = 0; i < 10; i++) + { + int ii = 10-i; // for m = 10, this would be 11 - i, and since i is from 1 to 10, then ii ranges from 10 to 1 + //int jj = ii+1; // this variable, even on the fortran version, is never used. it probably was intended to be used on the two lines below the next one to save some redundant additions on each. + ep = ep - (((m_current_k[ii-1] * m_x[ii-1])>>9)|1); // subtract reflection from lower stage 'top of lattice' + m_u[ii-1] = ep; + m_x[ii] = m_x[ii-1] + (((m_current_k[ii-1] * ep)>>9)|1); // add reflection from upper stage 'bottom of lattice' + } + m_x[0] = ep; // feed the last section of the top of the lattice directly to the bottom of the lattice + */ + m_u[10] = matrix_multiply(m_previous_energy, (m_excitation_data<<6)); //Y(11) + m_u[9] = m_u[10] - matrix_multiply(m_current_k[9], m_x[9]); + m_u[8] = m_u[9] - matrix_multiply(m_current_k[8], m_x[8]); + m_u[7] = m_u[8] - matrix_multiply(m_current_k[7], m_x[7]); + m_u[6] = m_u[7] - matrix_multiply(m_current_k[6], m_x[6]); + m_u[5] = m_u[6] - matrix_multiply(m_current_k[5], m_x[5]); + m_u[4] = m_u[5] - matrix_multiply(m_current_k[4], m_x[4]); + m_u[3] = m_u[4] - matrix_multiply(m_current_k[3], m_x[3]); + m_u[2] = m_u[3] - matrix_multiply(m_current_k[2], m_x[2]); + m_u[1] = m_u[2] - matrix_multiply(m_current_k[1], m_x[1]); + m_u[0] = m_u[1] - matrix_multiply(m_current_k[0], m_x[0]); + m_x[9] = m_x[8] + matrix_multiply(m_current_k[8], m_u[8]); + m_x[8] = m_x[7] + matrix_multiply(m_current_k[7], m_u[7]); + m_x[7] = m_x[6] + matrix_multiply(m_current_k[6], m_u[6]); + m_x[6] = m_x[5] + matrix_multiply(m_current_k[5], m_u[5]); + m_x[5] = m_x[4] + matrix_multiply(m_current_k[4], m_u[4]); + m_x[4] = m_x[3] + matrix_multiply(m_current_k[3], m_u[3]); + m_x[3] = m_x[2] + matrix_multiply(m_current_k[2], m_u[2]); + m_x[2] = m_x[1] + matrix_multiply(m_current_k[1], m_u[1]); + m_x[1] = m_x[0] + matrix_multiply(m_current_k[0], m_u[0]); + m_x[0] = m_u[0]; + m_previous_energy = m_current_energy; +#ifdef DEBUG_LATTICE + int i; + fprintf(stderr,"V:%04d ", m_u[10]); + for (i = 9; i >= 0; i--) + { + fprintf(stderr,"Y%d:%04d ", i+1, m_u[i]); + fprintf(stderr,"b%d:%04d ", i+1, m_x[i]); + if ((i % 5) == 0) fprintf(stderr,"\n"); + } +#endif + return m_u[0]; } + /****************************************************************************************** PDC_set -- set Processor Data Clock. Execute CTL_pins command on hi-lo transition. @@ -595,12 +822,15 @@ empty: void tms5110_device::PDC_set(int data) { + int i; if (m_PDC != (data & 0x1) ) { m_PDC = data & 0x1; if (m_PDC == 0) /* toggling 1->0 processes command on CTL_pins */ { - if (DEBUG_5110) logerror("PDC falling edge: "); +#ifdef DEBUG_COMMAND_DUMP + fprintf(stderr,"PDC falling edge(%02X): ",m_state); +#endif /* first pdc toggles output, next toggles input */ switch (m_state) { @@ -608,26 +838,36 @@ void tms5110_device::PDC_set(int data) /* continue */ break; case CTL_STATE_NEXT_TTALK_OUTPUT: - if (DEBUG_5110) logerror("Switching CTL bus direction to output for Test Talk\n"); +#ifdef DEBUG_COMMAND_DUMP + fprintf(stderr,"Switching CTL bus direction to output for Test Talk\n"); +#endif m_state = CTL_STATE_TTALK_OUTPUT; return; case CTL_STATE_TTALK_OUTPUT: - if (DEBUG_5110) logerror("Switching CTL bus direction back to input from Test Talk\n"); +#ifdef DEBUG_COMMAND_DUMP + fprintf(stderr,"Switching CTL bus direction back to input from Test Talk\n"); +#endif m_state = CTL_STATE_INPUT; return; case CTL_STATE_NEXT_OUTPUT: - if (DEBUG_5110) logerror("Switching CTL bus direction for Read Bit Buffer Output\n"); +#ifdef DEBUG_COMMAND_DUMP + fprintf(stderr,"Switching CTL bus direction for Read Bit Buffer Output\n"); +#endif m_state = CTL_STATE_OUTPUT; return; case CTL_STATE_OUTPUT: - if (DEBUG_5110) logerror("Switching CTL bus direction back to input from Read Bit Buffer Output\n"); +#ifdef DEBUG_COMMAND_DUMP + fprintf(stderr,"Switching CTL bus direction back to input from Read Bit Buffer Output\n"); +#endif m_state = CTL_STATE_INPUT; return; } /* the only real commands we handle now are SPEAK and RESET */ if (m_next_is_address) { - if (DEBUG_5110) logerror("Loading address nybble %02x to VSMs\n", m_CTL_pins); +#ifdef DEBUG_COMMAND_DUMP + fprintf(stderr,"Loading address nybble %02x to VSMs\n", m_CTL_pins); +#endif m_next_is_address = FALSE; m_address = m_address | ((m_CTL_pins & 0x0F)<<m_addr_bit); m_addr_bit = (m_addr_bit + 4) % 12; @@ -636,39 +876,66 @@ void tms5110_device::PDC_set(int data) } else { - if (DEBUG_5110) logerror("Got command nybble %02x: ", m_CTL_pins); +#ifdef DEBUG_COMMAND_DUMP + fprintf(stderr,"Got command nybble %02x: ", m_CTL_pins); +#endif switch (m_CTL_pins & 0xe) /*CTL1 - don't care*/ { case TMS5110_CMD_RESET: - if (DEBUG_5110) logerror("RESET\n"); +#ifdef DEBUG_COMMAND_DUMP + fprintf(stderr,"RESET\n"); +#endif perform_dummy_read(); reset(); break; case TMS5110_CMD_LOAD_ADDRESS: - if (DEBUG_5110) logerror("LOAD ADDRESS\n"); +#ifdef DEBUG_COMMAND_DUMP + fprintf(stderr,"LOAD ADDRESS\n"); +#endif m_next_is_address = TRUE; break; case TMS5110_CMD_OUTPUT: - if (DEBUG_5110) logerror("OUTPUT (from read-bit buffer)\n"); +#ifdef DEBUG_COMMAND_DUMP + fprintf(stderr,"OUTPUT (from read-bit buffer)\n"); +#endif m_state = CTL_STATE_NEXT_OUTPUT; break; case TMS5110_CMD_SPKSLOW: - if (DEBUG_5110) logerror("SPKSLOW (todo: this isn't implemented right yet)\n"); +#ifdef DEBUG_COMMAND_DUMP + fprintf(stderr,"SPKSLOW\n"); +#endif perform_dummy_read(); m_speaking_now = 1; - //should FIFO be cleared now ????? there is no fifo! the fifo is a lie! + m_talk_status = 1; /* start immediately */ + /* clear out variables before speaking */ + m_subc_reload = 0; // SPKSLOW means this is 0 + m_subcycle = m_subc_reload; + m_PC = 0; + m_IP = 0; + m_new_frame_energy_idx = 0; + m_new_frame_pitch_idx = 0; + for (i = 0; i < 4; i++) + m_new_frame_k_idx[i] = 0; + for (i = 4; i < 7; i++) + m_new_frame_k_idx[i] = 0xF; + for (i = 7; i < m_coeff->num_k; i++) + m_new_frame_k_idx[i] = 0x7; break; case TMS5110_CMD_READ_BIT: - if (DEBUG_5110) logerror("READ BIT\n"); +#ifdef DEBUG_COMMAND_DUMP + fprintf(stderr,"READ BIT\n"); +#endif if (m_schedule_dummy_read) perform_dummy_read(); else { - if (DEBUG_5110) logerror("actually reading a bit now\n"); +#ifdef DEBUG_COMMAND_DUMP + fprintf(stderr,"actually reading a bit now\n"); +#endif request_bits(1); m_CTL_buffer >>= 1; m_CTL_buffer |= (extract_bits(1)<<3); @@ -677,14 +944,31 @@ void tms5110_device::PDC_set(int data) break; case TMS5110_CMD_SPEAK: - if (DEBUG_5110) logerror("SPEAK\n"); +#ifdef DEBUG_COMMAND_DUMP + fprintf(stderr,"SPEAK\n"); +#endif perform_dummy_read(); m_speaking_now = 1; - //should FIFO be cleared now ????? there is no fifo! the fifo is a lie! + m_talk_status = 1; /* start immediately */ + /* clear out variables before speaking */ + m_subc_reload = 1; // SPEAK means this is 1 + m_subcycle = m_subc_reload; + m_PC = 0; + m_IP = 0; + m_new_frame_energy_idx = 0; + m_new_frame_pitch_idx = 0; + for (i = 0; i < 4; i++) + m_new_frame_k_idx[i] = 0; + for (i = 4; i < 7; i++) + m_new_frame_k_idx[i] = 0xF; + for (i = 7; i < m_coeff->num_k; i++) + m_new_frame_k_idx[i] = 0x7; break; case TMS5110_CMD_READ_BRANCH: - if (DEBUG_5110) logerror("READ AND BRANCH\n"); +#ifdef DEBUG_COMMAND_DUMP + fprintf(stderr,"READ AND BRANCH\n"); +#endif new_int_write(0,1,1,0); new_int_write(1,1,1,0); new_int_write(0,1,1,0); @@ -695,12 +979,16 @@ void tms5110_device::PDC_set(int data) break; case TMS5110_CMD_TEST_TALK: - if (DEBUG_5110) logerror("TEST TALK\n"); +#ifdef DEBUG_COMMAND_DUMP + fprintf(stderr,"TEST TALK\n"); +#endif m_state = CTL_STATE_NEXT_TTALK_OUTPUT; break; default: - logerror("tms5110.c: unknown command: 0x%02x\n", m_CTL_pins); +#ifdef DEBUG_COMMAND_DUMP + fprintf(stderr,"tms5110.c: unknown command: 0x%02x\n", m_CTL_pins); +#endif break; } @@ -719,15 +1007,11 @@ void tms5110_device::PDC_set(int data) void tms5110_device::parse_frame() { - int bits, indx, i, rep_flag; -#if (DEBUG_5110) - int ene; -#endif - + int bits, i, rep_flag; + /** TODO: get rid of bits handling here and move into extract_bits (as in tms5220.c) **/ /* count the total number of bits available */ bits = m_fifo_count; - /* attempt to extract the energy index */ bits -= m_coeff->energy_bits; if (bits < 0) @@ -735,33 +1019,37 @@ void tms5110_device::parse_frame() request_bits( -bits ); /* toggle M0 to receive needed bits */ bits = 0; } - indx = extract_bits(m_coeff->energy_bits); - m_new_energy = m_coeff->energytable[indx]; -#if (DEBUG_5110) - ene = indx; + // attempt to extract the energy index + m_new_frame_energy_idx = extract_bits(m_coeff->energy_bits); +#ifdef DEBUG_PARSE_FRAME_DUMP + printbits(m_new_frame_energy_idx,m_coeff->energy_bits); + fprintf(stderr," "); #endif - /* if the energy index is 0 or 15, we're done */ + /* if the energy index is 0 or 15, we're done if ((indx == 0) || (indx == 15)) { if (DEBUG_5110) logerror(" (4-bit energy=%d frame)\n",m_new_energy); - /* clear the k's */ + // clear the k's if (indx == 0) { for (i = 0; i < m_coeff->num_k; i++) m_new_k[i] = 0; } - /* clear fifo if stop frame encountered */ + // clear fifo if stop frame encountered if (indx == 15) { if (DEBUG_5110) logerror(" (4-bit energy=%d STOP frame)\n",m_new_energy); m_fifo_head = m_fifo_tail = m_fifo_count = 0; } return; - } + }*/ + // if the energy index is 0 or 15, we're done + if ((m_new_frame_energy_idx == 0) || (m_new_frame_energy_idx == 15)) + return; /* attempt to extract the repeat flag */ @@ -772,6 +1060,10 @@ void tms5110_device::parse_frame() bits = 0; } rep_flag = extract_bits(1); +#ifdef DEBUG_PARSE_FRAME_DUMP + printbits(rep_flag, 1); + fprintf(stderr," "); +#endif /* attempt to extract the pitch */ bits -= m_coeff->pitch_bits; @@ -780,71 +1072,64 @@ void tms5110_device::parse_frame() request_bits( -bits ); /* toggle M0 to receive needed bits */ bits = 0; } - indx = extract_bits(m_coeff->pitch_bits); - m_new_pitch = m_coeff->pitchtable[indx]; - - /* if this is a repeat frame, just copy the k's */ + m_new_frame_pitch_idx = extract_bits(m_coeff->pitch_bits); +#ifdef DEBUG_PARSE_FRAME_DUMP + printbits(m_new_frame_pitch_idx,m_coeff->pitch_bits); + fprintf(stderr," "); +#endif + // if this is a repeat frame, just do nothing, it will reuse the old coefficients if (rep_flag) - { - //actually, we do nothing because the k's were already loaded (on parsing the previous frame) - - if (DEBUG_5110) logerror(" (10-bit energy=%d pitch=%d rep=%d frame)\n", m_new_energy, m_new_pitch, rep_flag); return; - } - - /* if the pitch index was zero, we need 4 k's */ - if (indx == 0) + // extract first 4 K coefficients + for (i = 0; i < 4; i++) { /* attempt to extract 4 K's */ - bits -= 18; + bits -= m_coeff->kbits[i]; if (bits < 0) { - request_bits( -bits ); /* toggle M0 to receive needed bits */ - bits = 0; + request_bits( -bits ); /* toggle M0 to receive needed bits */ + bits = 0; } - for (i = 0; i < 4; i++) - m_new_k[i] = m_coeff->ktable[i][extract_bits(m_coeff->kbits[i])]; - - /* and clear the rest of the new_k[] */ - for (i = 4; i < m_coeff->num_k; i++) - m_new_k[i] = 0; + m_new_frame_k_idx[i] = extract_bits(m_coeff->kbits[i]); +#ifdef DEBUG_PARSE_FRAME_DUMP + printbits(m_new_frame_k_idx[i],m_coeff->kbits[i]); + fprintf(stderr," "); +#endif + } - if (DEBUG_5110) logerror(" (28-bit energy=%d pitch=%d rep=%d 4K frame)\n", m_new_energy, m_new_pitch, rep_flag); + // if the pitch index was zero, we only need 4 K's... + if (m_new_frame_pitch_idx == 0) + { + /* and the rest of the coefficients are zeroed, but that's done in the generator code */ return; } - /* else we need 10 K's */ - bits -= 39; - if (bits < 0) + // If we got here, we need the remaining 6 K's + for (i = 4; i < m_coeff->num_k; i++) { + bits -= m_coeff->kbits[i]; + if (bits < 0) + { request_bits( -bits ); /* toggle M0 to receive needed bits */ - bits = 0; - } -#if (DEBUG_5110) - printf("FrameDump %02d ", ene); - for (i = 0; i < m_coeff->num_k; i++) - { - int x; - x = extract_bits( m_coeff->kbits[i]); - m_new_k[i] = m_coeff->ktable[i][x]; - printf("%02d ", x); - } - printf("\n"); -#else - for (i = 0; i < m_coeff->num_k; i++) - { - int x; - x = extract_bits( m_coeff->kbits[i]); - m_new_k[i] = m_coeff->ktable[i][x]; + bits = 0; + } + m_new_frame_k_idx[i] = extract_bits(m_coeff->kbits[i]); +#ifdef DEBUG_PARSE_FRAME_DUMP + printbits(m_new_frame_k_idx[i],m_coeff->kbits[i]); + fprintf(stderr," "); +#endif } +#ifdef VERBOSE + if (m_speak_external) + logerror("Parsed a frame successfully in FIFO - %d bits remaining\n", (m_fifo_count*8)-(m_fifo_bits_taken)); + else + logerror("Parsed a frame successfully in ROM\n"); #endif - if (DEBUG_5110) logerror(" (49-bit energy=%d pitch=%d rep=%d 10K frame)\n", m_new_energy, m_new_pitch, rep_flag); - + return; } - #if 0 /*This is an example word TEN taken from the TMS5110A datasheet*/ static const unsigned int example_word_TEN[619]={ @@ -981,6 +1266,7 @@ void m58817_device::device_start() void tms5110_device::device_reset() { + m_digital_select = FORCE_DIGITAL; // assume analog output /* initialize the FIFO */ memset(m_fifo, 0, sizeof(m_fifo)); m_fifo_head = m_fifo_tail = m_fifo_count = 0; @@ -993,18 +1279,25 @@ void tms5110_device::device_reset() m_PDC = 0; /* initialize the energy/pitch/k states */ - m_old_energy = m_new_energy = m_current_energy = m_target_energy = 0; - m_old_pitch = m_new_pitch = m_current_pitch = m_target_pitch = 0; - memset(m_old_k, 0, sizeof(m_old_k)); - memset(m_new_k, 0, sizeof(m_new_k)); +#ifdef PERFECT_INTERPOLATION_HACK + m_old_frame_energy_idx = m_old_frame_pitch_idx = 0; + memset(m_old_frame_k_idx, 0, sizeof(m_old_frame_k_idx)); +#endif + m_new_frame_energy_idx = m_current_energy = m_target_energy = m_previous_energy = 0; + m_new_frame_pitch_idx = m_current_pitch = m_target_pitch = 0; + memset(m_new_frame_k_idx, 0, sizeof(m_new_frame_k_idx)); memset(m_current_k, 0, sizeof(m_current_k)); memset(m_target_k, 0, sizeof(m_target_k)); /* initialize the sample generators */ - m_interp_count = m_sample_count = m_pitch_count = 0; + m_inhibit = 1; + m_subcycle = m_pitch_count = m_PC = 0; + m_subc_reload = 1; + m_OLDE = m_OLDP = 1; + m_IP = 0; + m_RNG = 0x1FFF; + memset(m_u, 0, sizeof(m_u)); memset(m_x, 0, sizeof(m_x)); - m_next_is_address = FALSE; - m_address = 0; if (m_table != NULL) { /* legacy interface */ @@ -1017,6 +1310,8 @@ void tms5110_device::device_reset() */ m_schedule_dummy_read = FALSE; } + m_next_is_address = FALSE; + m_address = 0; m_addr_bit = 0; } diff --git a/src/emu/sound/tms5110.h b/src/emu/sound/tms5110.h index 43863042940..2cddb63d8ea 100644 --- a/src/emu/sound/tms5110.h +++ b/src/emu/sound/tms5110.h @@ -94,6 +94,7 @@ private: int extract_bits(int count); void request_bits(int no); void perform_dummy_read(); + INT32 lattice_filter(); void process(INT16 *buffer, unsigned int size); void PDC_set(int data); void parse_frame(); @@ -108,8 +109,7 @@ private: UINT8 m_PDC; UINT8 m_CTL_pins; UINT8 m_speaking_now; - - + // UINT8 m_talk_status is a protected member, see above UINT8 m_state; /* Rom interface */ @@ -131,31 +131,66 @@ private: devcb_write_line m_romclk_cb; // rom clock - Only used to drive the data lines /* these contain data describing the current and previous voice frames */ - UINT16 m_old_energy; - UINT16 m_old_pitch; - INT32 m_old_k[10]; +#define OLD_FRAME_SILENCE_FLAG m_OLDE // 1 if E=0, 0 otherwise. +#define OLD_FRAME_UNVOICED_FLAG m_OLDP // 1 if P=0 (unvoiced), 0 if voiced + UINT8 m_OLDE; + UINT8 m_OLDP; - UINT16 m_new_energy; - UINT16 m_new_pitch; - INT32 m_new_k[10]; +#define NEW_FRAME_STOP_FLAG (m_new_frame_energy_idx == 0xF) // 1 if this is a stop (Energy = 0xF) frame +#define NEW_FRAME_SILENCE_FLAG (m_new_frame_energy_idx == 0) // ditto as above +#define NEW_FRAME_UNVOICED_FLAG (m_new_frame_pitch_idx == 0) // ditto as above + UINT8 m_new_frame_energy_idx; + UINT8 m_new_frame_pitch_idx; + UINT8 m_new_frame_k_idx[10]; /* these are all used to contain the current state of the sound generation */ - UINT16 m_current_energy; - UINT16 m_current_pitch; +#ifndef PERFECT_INTERPOLATION_HACK + INT16 m_current_energy; + INT16 m_current_pitch; + INT16 m_current_k[10]; + + INT16 m_target_energy; + INT16 m_target_pitch; + INT16 m_target_k[10]; +#else + UINT8 m_old_frame_energy_idx; + UINT8 m_old_frame_pitch_idx; + UINT8 m_old_frame_k_idx[10]; + + INT32 m_current_energy; + INT32 m_current_pitch; INT32 m_current_k[10]; - UINT16 m_target_energy; - UINT16 m_target_pitch; + INT32 m_target_energy; + INT32 m_target_pitch; INT32 m_target_k[10]; +#endif - UINT8 m_interp_count; /* number of interp periods (0-7) */ - UINT8 m_sample_count; /* sample number within interp (0-24) */ - INT32 m_pitch_count; + UINT16 m_previous_energy; /* needed for lattice filter to match patent */ - INT32 m_x[11]; + UINT8 m_subcycle; /* contains the current subcycle for a given PC: 0 is A' (only used on SPKSLOW mode on 51xx), 1 is A, 2 is B */ + UINT8 m_subc_reload; /* contains 1 for normal speech, 0 when SPKSLOW is active */ + UINT8 m_PC; /* current parameter counter (what param is being interpolated), ranges from 0 to 12 */ + /* TODO/NOTE: the current interpolation period, counts 1,2,3,4,5,6,7,0 for divide by 8,8,8,4,4,2,2,1 */ + UINT8 m_IP; /* the current interpolation period */ + UINT8 m_inhibit; /* If 1, interpolation is inhibited until the DIV1 period */ + UINT16 m_pitch_count; /* pitch counter; provides chirp rom address */ + + INT32 m_u[11]; + INT32 m_x[10]; INT32 m_RNG; /* the random noise generator configuration is: 1 + x + x^3 + x^4 + x^13 */ + INT16 m_excitation_data; + + /* The TMS51xx has two different ways of providing output data: the + analog speaker pins (which were usually used) and the Digital I/O pin. + The internal DAC used to feed the analog pins is only 8 bits, and has the + funny clipping/clamping logic, while the digital pin gives full 10 bit + resolution of the output data. + TODO: add a way to set/reset this other than the FORCE_DIGITAL define + */ + UINT8 m_digital_select; INT32 m_speech_rom_bitnum; diff --git a/src/emu/sound/tms5110r.inc b/src/emu/sound/tms5110r.inc index 41abe5caea4..7e370853db0 100644 --- a/src/emu/sound/tms5110r.inc +++ b/src/emu/sound/tms5110r.inc @@ -47,7 +47,7 @@ T0280B 0281A = 1979 speak & spell, also == TMS5100, uses old chirp ?????? ????? (no decap; likely 'T0280D 0281D') = 1980 speak & spell, 1981 speak & spell compact, changed energy table, otherwise same as above, uses old chirp T0280F 2801A = 1980 speak & math, 1980 speak and read, uses old chirp - ?????? ????? (no decap; likely 'T0280F 2802') = touch and tell, language translator; uses a unique chirp rom. + T0280F 2802 = touch and tell, language translator; uses a unique chirp rom. ?????? ????? = TMS5110 T0280F 5110A = TMS5110AN2L @@ -70,7 +70,6 @@ #define MAX_K 10 #define MAX_SCALE_BITS 6 #define MAX_SCALE (1<<MAX_SCALE_BITS) -#define COEFF_ENERGY_SENTINEL (511) #define MAX_CHIRP_SIZE 52 struct tms5100_coeffs @@ -92,21 +91,13 @@ struct tms5100_coeffs #define TI_0280_PATENT_ENERGY \ /* E */\ { 0, 0, 1, 1, 2, 3, 5, 7, \ - 10, 15, 21, 30, 43, 61, 86, COEFF_ENERGY_SENTINEL }, // last rom value is actually really 0, but the tms5110.c code still requires the sentinel value to function correctly, until it is properly updated or merged with tms5220.c + 10, 15, 21, 30, 43, 61, 86, 0 }, -#define TI_0280_LATER_ENERGY \ - /* E */\ - { 0, 1, 2, 3, 4, 6, 8, 11, \ - 16, 23, 33, 47, 63, 85,114, COEFF_ENERGY_SENTINEL }, // last rom value is actually really 0, but the tms5110.c code still requires the sentinel value to function correctly, until it is properly updated or merged with tms5220.c - -//technically this is the same as above, but tms5220.c expects the 0 rather than needing a sentinel value -//TODO: when tms5110.c no longer needs sentinel, get rid of this and merge with above. -#define TI_0285_LATER_ENERGY \ +#define TI_028X_LATER_ENERGY \ /* E */\ { 0, 1, 2, 3, 4, 6, 8, 11, \ 16, 23, 33, 47, 63, 85,114, 0 }, - /* pitch */ #define TI_0280_2801_PATENT_PITCH \ /* P */\ @@ -307,14 +298,13 @@ struct tms5100_coeffs 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ 0x00, 0x00, 0x00, 0x00 }, -//TODO: Fix me! below is INACCURATE, no decap of 2802 yet! #define TI_2802_CHIRP \ /* Chirp table */\ - { 0x00, 0xa3, 0xbe, 0xee, 0x38, 0x78, 0x7f, 0x3e,\ - 0xe2, 0xe0, 0x26, 0x19, 0xce, 0x06, 0x1e, 0xd0,\ - 0x12, 0xcd, 0xea, 0xde, 0xda, 0x02, 0xff, 0x06,\ - 0xfe, 0x00, 0xfe, 0xfb, 0xfd, 0xfd, 0x00, 0x00,\ - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00,\ + { 0x00, 0xa5, 0xbd, 0xee, 0x34, 0x73, 0x7e, 0x3d,\ + 0xe8, 0xea, 0x34, 0x24, 0xd1, 0x01, 0x13, 0xc3,\ + 0x0c, 0xd2, 0xe7, 0xdd, 0xd9, 0x00, 0x00, 0x00,\ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ 0x00, 0x00, 0x00, 0x00 }, @@ -328,6 +318,11 @@ struct tms5100_coeffs 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ 0x00, 0x00, 0x00, 0x00 }, +/* Interpolation Table */ +#define TI_INTERP \ + /* interpolation shift coefficients */\ + { 0, 3, 3, 3, 2, 2, 1, 1 } + /* TMS5100/TMC0281: (Die revs A, B; 1977?-1981?) The TMS5100NL was decapped and imaged by digshadow in April, 2013. @@ -357,8 +352,7 @@ static const struct tms5100_coeffs T0280B_0281A_coeff = TI_0280_PATENT_LPC }, TI_0280_PATENT_CHIRP - /* interpolation coefficients */ - { 3, 3, 3, 2, 2, 1, 1, 0 } + TI_INTERP }; /* TMS5110A/TMC0281D: @@ -376,14 +370,13 @@ static const struct tms5100_coeffs T0280D_0281D_coeff = 4, 5, { 5, 5, 4, 4, 4, 4, 4, 3, 3, 3 }, - TI_0280_LATER_ENERGY + TI_028X_LATER_ENERGY TI_0280_2801_PATENT_PITCH { TI_0280_PATENT_LPC }, TI_0280_PATENT_CHIRP - /* interpolation coefficients */ - { 3, 3, 3, 2, 2, 1, 1, 0 } + TI_INTERP }; /* TMC0280/CD2801: @@ -412,14 +405,13 @@ static const struct tms5100_coeffs T0280F_2801A_coeff = 4, 5, { 5, 5, 4, 4, 4, 4, 4, 3, 3, 3 }, - TI_0280_LATER_ENERGY + TI_028X_LATER_ENERGY TI_0280_2801_PATENT_PITCH { TI_2801_2501E_LPC }, TI_2801_CHIRP - /* interpolation coefficients */ - { 3, 3, 3, 2, 2, 1, 1, 0 } + TI_INTERP }; /* Mitsubishi M58817 @@ -436,14 +428,13 @@ static const struct tms5100_coeffs M58817_coeff = 4, 5, { 5, 5, 4, 4, 4, 4, 4, 3, 3, 3 }, - TI_0280_LATER_ENERGY + TI_028X_LATER_ENERGY TI_0280_2801_PATENT_PITCH { TI_2801_2501E_LPC }, TI_2801_CHIRP - /* interpolation coefficients */ - { 3, 3, 3, 2, 2, 1, 1, 0 } + TI_INTERP }; /* CD2802: @@ -451,6 +442,7 @@ static const struct tms5100_coeffs M58817_coeff = Used in Touch and Tell only (and Vocaid?), this chip has a unique pitch, LPC and chirp table. Has the 'alternate' interpolation behavior. Digitally dumped via PROMOUT by PlgDavid in 2014 + Decapped by Sean Riddle in 2015 */ static const struct tms5100_coeffs T0280F_2802_coeff = { @@ -460,14 +452,13 @@ static const struct tms5100_coeffs T0280F_2802_coeff = 4, 5, { 5, 5, 4, 4, 4, 4, 4, 3, 3, 3 }, - TI_0280_LATER_ENERGY + TI_028X_LATER_ENERGY TI_2802_PITCH { TI_2802_LPC }, TI_2802_CHIRP - /* interpolation coefficients */ - { 3, 3, 3, 2, 2, 1, 1, 0 } + TI_INTERP }; /* TMS5110A: @@ -492,14 +483,13 @@ static const struct tms5100_coeffs tms5110a_coeff = 4, 5, { 5, 5, 4, 4, 4, 4, 4, 3, 3, 3 }, - TI_0280_LATER_ENERGY + TI_028X_LATER_ENERGY TI_5110_PITCH { TI_5110_5220_LPC }, TI_LATER_CHIRP - /* interpolation coefficients */ - { 3, 3, 3, 2, 2, 1, 1, 0 } + TI_INTERP }; /* The following coefficients come from US Patent 4,335,277 and 4,581,757. @@ -518,7 +508,7 @@ static const struct tms5100_coeffs pat4335277_coeff = 4, 6, { 5, 5, 4, 4, 4, 4, 4, 3, 3, 3 }, - TI_0285_LATER_ENERGY + TI_028X_LATER_ENERGY TI_2501E_PITCH { /* K1dc */ @@ -554,8 +544,7 @@ static const struct tms5100_coeffs pat4335277_coeff = { -205, -132, -59, 14, 87, 160, 234, 307 }, }, TI_0280_PATENT_CHIRP - /* interpolation coefficients */ - { 3, 3, 3, 2, 2, 1, 1, 0 } + TI_INTERP }; /* TMS5200/CD2501E @@ -591,14 +580,13 @@ static const struct tms5100_coeffs T0285_2501E_coeff = 4, 6, { 5, 5, 4, 4, 4, 4, 4, 3, 3, 3 }, - TI_0285_LATER_ENERGY + TI_028X_LATER_ENERGY TI_2501E_PITCH { TI_2801_2501E_LPC }, TI_LATER_CHIRP - /* interpolation coefficients */ - { 0, 3, 3, 3, 2, 2, 1, 1 } + TI_INTERP }; /* TMS5220/5220C: @@ -620,14 +608,13 @@ static const struct tms5100_coeffs tms5220_coeff = 4, 6, { 5, 5, 4, 4, 4, 4, 4, 3, 3, 3 }, - TI_0285_LATER_ENERGY + TI_028X_LATER_ENERGY TI_5220_PITCH { TI_5110_5220_LPC }, TI_LATER_CHIRP - /* interpolation coefficients */ - { 0, 3, 3, 3, 2, 2, 1, 1 } + TI_INTERP }; /* The following Sanyo VLM5030 coefficients are derived from decaps of the chip diff --git a/src/emu/sound/tms5220.c b/src/emu/sound/tms5220.c index d71344a01e8..a78565c6a5b 100644 --- a/src/emu/sound/tms5220.c +++ b/src/emu/sound/tms5220.c @@ -353,6 +353,8 @@ void tms5220_device::set_variant(int variant) void tms5220_device::register_for_save_states() { + save_item(NAME(m_variant)); + save_item(NAME(m_fifo)); save_item(NAME(m_fifo_head)); save_item(NAME(m_fifo_tail)); @@ -747,10 +749,12 @@ void tms5220_device::process(INT16 *buffer, unsigned int size) /* loop until the buffer is full or we've stopped speaking */ while ((size > 0) && m_speaking_now) { - /* if it is the appropriate time to update the old energy/pitch idxes, + /* if it is the appropriate time to update the old energy/pitch indices, * i.e. when IP=7, PC=12, T=17, subcycle=2, do so. Since IP=7 PC=12 T=17 * is JUST BEFORE the transition to IP=0 PC=0 T=0 sybcycle=(0 or 1), - * which happens 4 T-cycles later), we change on the latter.*/ + * which happens 4 T-cycles later), we change on the latter. + * The indices are updated here ~12 PCs before the new frame is applied. + */ if ((m_IP == 0) && (m_PC == 0) && (m_subcycle < 2)) { m_OLDE = (m_new_frame_energy_idx == 0); @@ -784,18 +788,35 @@ void tms5220_device::process(INT16 *buffer, unsigned int size) #ifdef DEBUG_GENERATION fprintf(stderr,"tms5220_process: processing frame: talk status = 0 caused by stop frame or buffer empty, halting speech.\n"); #endif - m_speaking_now = 0; // finally halt speech - goto empty; + if (m_speaking_now == 1) // we're done, set all coeffs to idle state but keep going for a bit... + { + m_new_frame_energy_idx = 0; + m_new_frame_pitch_idx = 0; + for (i = 0; i < 4; i++) + m_new_frame_k_idx[i] = 0; + for (i = 4; i < 7; i++) + m_new_frame_k_idx[i] = 0xF; + for (i = 7; i < m_coeff->num_k; i++) + m_new_frame_k_idx[i] = 0x7; + m_speaking_now = 2; // wait 8 extra interp periods before shutting down so we can interpolate everything to zero state + } + else // m_speaking_now == 2 // now we're really done. + { + m_speaking_now = 0; // finally halt speech + goto empty; + } } - /* Parse a new frame into the new_target_energy, new_target_pitch and new_target_k[] */ - parse_frame(); + /* Parse a new frame into the new_target_energy, new_target_pitch and new_target_k[], + * but only if we're not just about to end speech */ + if (m_speaking_now == 1) parse_frame(); #ifdef DEBUG_PARSE_FRAME_DUMP fprintf(stderr,"\n"); #endif /* if the new frame is a stop frame, set an interrupt and set talk status to 0 */ + /** TODO: investigate this later! **/ if (NEW_FRAME_STOP_FLAG == 1) { m_talk_status = m_speak_external = 0; @@ -1264,7 +1285,7 @@ void tms5220_device::process_command(unsigned char cmd) void tms5220_device::parse_frame() { - int indx, i, rep_flag; + int i, rep_flag; // We actually don't care how many bits are left in the fifo here; the frame subpart will be processed normally, and any bits extracted 'past the end' of the fifo will be read as zeroes; the fifo being emptied will set the /BE latch which will halt speech exactly as if a stop frame had been encountered (instead of whatever partial frame was read); the same exact circuitry is used for both on the real chip, see us patent 4335277 sheet 16, gates 232a (decode stop frame) and 232b (decode /BE plus DDIS (decode disable) which is active during speak external). @@ -1272,12 +1293,12 @@ void tms5220_device::parse_frame() has a 2 bit rate preceding it, grab two bits here and store them as the rate; */ if ((TMS5220_HAS_RATE_CONTROL) && (m_c_variant_rate & 0x04)) { - indx = extract_bits(2); + i = extract_bits(2); #ifdef DEBUG_PARSE_FRAME_DUMP - printbits(indx,2); + printbits(i,2); fprintf(stderr," "); #endif - m_IP = reload_table[indx]; + m_IP = reload_table[i]; } else // non-5220C and 5220C in fixed rate mode m_IP = reload_table[m_c_variant_rate&0x3]; diff --git a/src/emu/sound/tms5220.h b/src/emu/sound/tms5220.h index 7150ce5457b..177f82bdecf 100644 --- a/src/emu/sound/tms5220.h +++ b/src/emu/sound/tms5220.h @@ -172,6 +172,15 @@ private: UINT8 m_data_register; /* data register, used by read command */ UINT8 m_RDB_flag; /* whether we should read data register or status register */ + /* The TMS52xx has two different ways of providing output data: the + analog speaker pin (which was usually used) and the Digital I/O pin. + The internal DAC used to feed the analog pin is only 8 bits, and has the + funny clipping/clamping logic, while the digital pin gives full 10 bit + resolution of the output data. + TODO: add a way to set/reset this other than the FORCE_DIGITAL define + */ + UINT8 m_digital_select; + /* io_ready: page 3 of the datasheet specifies that READY will be asserted until * data is available or processed by the system. */ @@ -185,15 +194,6 @@ private: UINT8 m_read_latch; UINT8 m_write_latch; - /* The TMS52xx has two different ways of providing output data: the - analog speaker pin (which was usually used) and the Digital I/O pin. - The internal DAC used to feed the analog pin is only 8 bits, and has the - funny clipping/clamping logic, while the digital pin gives full 10 bit - resolution of the output data. - TODO: add a way to set/reset this other than the FORCE_DIGITAL define - */ - UINT8 m_digital_select; - sound_stream *m_stream; int m_clock; emu_timer *m_timer_io_ready; diff --git a/src/emu/sound/wave.c b/src/emu/sound/wave.c index 6728b7cafab..76f9bdda8d6 100644 --- a/src/emu/sound/wave.c +++ b/src/emu/sound/wave.c @@ -16,7 +16,6 @@ ****************************************************************************/ #include "emu.h" -#include "imagedev/cassette.h" #include "wave.h" #define ALWAYS_PLAY_SOUND 0 @@ -60,6 +59,7 @@ void wave_device::device_start() machine().sound().stream_alloc(*this, 0, 2, machine().sample_rate()); else machine().sound().stream_alloc(*this, 0, 1, machine().sample_rate()); + m_cass = machine().device<cassette_image_device>(m_cassette_tag); } //------------------------------------------------- @@ -68,8 +68,6 @@ void wave_device::device_start() void wave_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) { - cassette_image_device *cass = machine().device<cassette_image_device>(m_cassette_tag); - cassette_image *cassette; cassette_state state; double time_index; double duration; @@ -77,20 +75,20 @@ void wave_device::sound_stream_update(sound_stream &stream, stream_sample_t **in stream_sample_t *right_buffer = NULL; int i; - speaker_device_iterator spkiter(cass->machine().root_device()); + speaker_device_iterator spkiter(m_cass->machine().root_device()); int speakers = spkiter.count(); if (speakers>1) right_buffer = outputs[1]; - state = cass->get_state(); + state = m_cass->get_state(); state = (cassette_state)(state & (CASSETTE_MASK_UISTATE | CASSETTE_MASK_MOTOR | CASSETTE_MASK_SPEAKER)); - if (cass->exists() && (ALWAYS_PLAY_SOUND || (state == (CASSETTE_PLAY | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED)))) + if (m_cass->exists() && (ALWAYS_PLAY_SOUND || (state == (CASSETTE_PLAY | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED)))) { - cassette = cass->get_image(); - time_index = cass->get_position(); - duration = ((double) samples) / cass->machine().sample_rate(); + cassette_image *cassette = m_cass->get_image(); + time_index = m_cass->get_position(); + duration = ((double) samples) / m_cass->machine().sample_rate(); cassette_get_samples(cassette, 0, time_index, duration, samples, 2, left_buffer, CASSETTE_WAVEFORM_16BIT); if (speakers > 1) diff --git a/src/emu/sound/wave.h b/src/emu/sound/wave.h index 77d78d95328..d4ff4865551 100644 --- a/src/emu/sound/wave.h +++ b/src/emu/sound/wave.h @@ -5,6 +5,8 @@ #ifndef __WAVE_H__ #define __WAVE_H__ +#include "imagedev/cassette.h" + /***************************************************************************** * CassetteWave interface @@ -28,6 +30,7 @@ protected: private: const char *m_cassette_tag; + cassette_image_device *m_cass; }; extern const device_type WAVE; diff --git a/src/emu/ui/devopt.c b/src/emu/ui/devopt.c index 0bf4e5f40c3..75b6c899576 100644 --- a/src/emu/ui/devopt.c +++ b/src/emu/ui/devopt.c @@ -110,7 +110,7 @@ void ui_menu_device_config::populate() strcatprintf(str,"%d " UTF8_MULTIPLY " %d (%s) %f" UTF8_NBSP "Hz\n", visarea.width(), visarea.height(), (machine().system().flags & ORIENTATION_SWAP_XY) ? "V" : "H", - ATTOSECONDS_TO_HZ(screen->frame_period().attoseconds)); + ATTOSECONDS_TO_HZ(screen->frame_period().attoseconds())); } } } diff --git a/src/emu/ui/miscmenu.c b/src/emu/ui/miscmenu.c index be611f9c6e6..88e74458c5e 100644 --- a/src/emu/ui/miscmenu.c +++ b/src/emu/ui/miscmenu.c @@ -205,7 +205,7 @@ void ui_menu_bookkeeping::handle() /* if the time has rolled over another second, regenerate */ curtime = machine().time(); - if (prevtime.seconds != curtime.seconds) + if (prevtime.seconds() != curtime.seconds()) { reset(UI_MENU_RESET_SELECT_FIRST); prevtime = curtime; @@ -236,10 +236,10 @@ void ui_menu_bookkeeping::populate() int ctrnum; /* show total time first */ - if (prevtime.seconds >= 60 * 60) - strcatprintf(tempstring, "Uptime: %d:%02d:%02d\n\n", prevtime.seconds / (60 * 60), (prevtime.seconds / 60) % 60, prevtime.seconds % 60); + if (prevtime.seconds() >= 60 * 60) + strcatprintf(tempstring, "Uptime: %d:%02d:%02d\n\n", prevtime.seconds() / (60 * 60), (prevtime.seconds() / 60) % 60, prevtime.seconds() % 60); else - strcatprintf(tempstring,"Uptime: %d:%02d\n\n", (prevtime.seconds / 60) % 60, prevtime.seconds % 60); + strcatprintf(tempstring,"Uptime: %d:%02d\n\n", (prevtime.seconds() / 60) % 60, prevtime.seconds() % 60); /* show tickets at the top */ if (tickets > 0) diff --git a/src/emu/ui/ui.c b/src/emu/ui/ui.c index 8cb98399b04..95b51f24bab 100644 --- a/src/emu/ui/ui.c +++ b/src/emu/ui/ui.c @@ -1251,7 +1251,7 @@ std::string &ui_manager::game_info_astring(std::string &str) strcatprintf(str, "%d " UTF8_MULTIPLY " %d (%s) %f" UTF8_NBSP "Hz\n", visarea.width(), visarea.height(), (machine().system().flags & ORIENTATION_SWAP_XY) ? "V" : "H", - ATTOSECONDS_TO_HZ(screen->frame_period().attoseconds)); + ATTOSECONDS_TO_HZ(screen->frame_period().attoseconds())); } } } @@ -2084,8 +2084,8 @@ static INT32 slider_refresh(running_machine &machine, void *arg, std::string *st screen->configure(width, height, visarea, HZ_TO_ATTOSECONDS(defrefresh + (double)newval * 0.001)); } if (str != NULL) - strprintf(*str,"%.3ffps", ATTOSECONDS_TO_HZ(machine.first_screen()->frame_period().attoseconds)); - refresh = ATTOSECONDS_TO_HZ(machine.first_screen()->frame_period().attoseconds); + strprintf(*str,"%.3ffps", ATTOSECONDS_TO_HZ(machine.first_screen()->frame_period().attoseconds())); + refresh = ATTOSECONDS_TO_HZ(machine.first_screen()->frame_period().attoseconds()); return floor((refresh - defrefresh) * 1000.0 + 0.5); } diff --git a/src/emu/video.c b/src/emu/video.c index 2ce890d44e4..adc2888b2e7 100644 --- a/src/emu/video.c +++ b/src/emu/video.c @@ -239,7 +239,7 @@ void video_manager::frame_update(bool debug) update_frameskip(); // update speed computations - if (!debug) + if (!debug && !skipped_it) recompute_speed(current_time); // call the end-of-frame callback @@ -381,7 +381,7 @@ void video_manager::begin_recording(const char *name, movie_format format) // build up information about this new movie avi_movie_info info; info.video_format = 0; - info.video_timescale = 1000 * ((machine().first_screen() != NULL) ? ATTOSECONDS_TO_HZ(machine().first_screen()->frame_period().attoseconds) : screen_device::DEFAULT_FRAME_RATE); + info.video_timescale = 1000 * ((machine().first_screen() != NULL) ? ATTOSECONDS_TO_HZ(machine().first_screen()->frame_period().attoseconds()) : screen_device::DEFAULT_FRAME_RATE); info.video_sampletime = 1000; info.video_numsamples = 0; info.video_width = m_snap_bitmap.width(); @@ -447,7 +447,7 @@ void video_manager::begin_recording(const char *name, movie_format format) if (filerr == FILERR_NONE) { // start the capture - int rate = (machine().first_screen() != NULL) ? ATTOSECONDS_TO_HZ(machine().first_screen()->frame_period().attoseconds) : screen_device::DEFAULT_FRAME_RATE; + int rate = (machine().first_screen() != NULL) ? ATTOSECONDS_TO_HZ(machine().first_screen()->frame_period().attoseconds()) : screen_device::DEFAULT_FRAME_RATE; png_error pngerr = mng_capture_start(*m_mng_file, m_snap_bitmap, rate); if (pngerr != PNGERR_NONE) { @@ -540,12 +540,12 @@ void video_manager::exit() m_snap_bitmap.reset(); // print a final result if we have at least 2 seconds' worth of data - if (m_overall_emutime.seconds >= 1) + if (m_overall_emutime.seconds() >= 1) { osd_ticks_t tps = osd_ticks_per_second(); double final_real_time = (double)m_overall_real_seconds + (double)m_overall_real_ticks / (double)tps; double final_emu_time = m_overall_emutime.as_double(); - osd_printf_info("Average speed: %.2f%% (%d seconds)\n", 100 * final_emu_time / final_real_time, (m_overall_emutime + attotime(0, ATTOSECONDS_PER_SECOND / 2)).seconds); + osd_printf_info("Average speed: %.2f%% (%d seconds)\n", 100 * final_emu_time / final_real_time, (m_overall_emutime + attotime(0, ATTOSECONDS_PER_SECOND / 2)).seconds()); } } @@ -962,7 +962,7 @@ void video_manager::update_refresh_speed() screen_device_iterator iter(machine().root_device()); for (screen_device *screen = iter.first(); screen != NULL; screen = iter.next()) { - attoseconds_t period = screen->frame_period().attoseconds; + attoseconds_t period = screen->frame_period().attoseconds(); if (period != 0) min_frame_period = MIN(min_frame_period, period); } @@ -1034,7 +1034,7 @@ void video_manager::recompute_speed(const attotime &emutime) } // if we're past the "time-to-execute" requested, signal an exit - if (m_seconds_to_run != 0 && emutime.seconds >= m_seconds_to_run) + if (m_seconds_to_run != 0 && emutime.seconds() >= m_seconds_to_run) { #ifdef MAME_DEBUG if (g_tagmap_counter_enabled) diff --git a/src/emu/video/315_5313.c b/src/emu/video/315_5313.c index 0153c2ad05b..a612c384e99 100644 --- a/src/emu/video/315_5313.c +++ b/src/emu/video/315_5313.c @@ -1141,9 +1141,9 @@ UINT16 sega315_5313_device::get_hposition() time_elapsed_since_megadriv_scanline_timer = m_megadriv_scanline_timer->time_elapsed(); - if (time_elapsed_since_megadriv_scanline_timer.attoseconds<(ATTOSECONDS_PER_SECOND/m_framerate /m_total_scanlines)) + if (time_elapsed_since_megadriv_scanline_timer.attoseconds() < (ATTOSECONDS_PER_SECOND/m_framerate /m_total_scanlines)) { - value4 = (UINT16)(MAX_HPOSITION*((double)(time_elapsed_since_megadriv_scanline_timer.attoseconds) / (double)(ATTOSECONDS_PER_SECOND/m_framerate /m_total_scanlines))); + value4 = (UINT16)(MAX_HPOSITION*((double)(time_elapsed_since_megadriv_scanline_timer.attoseconds()) / (double)(ATTOSECONDS_PER_SECOND/m_framerate /m_total_scanlines))); } else /* in some cases (probably due to rounding errors) we get some stupid results (the odd huge value where the time elapsed is much higher than the scanline time??!).. hopefully by clamping the result to the maximum we limit errors */ { @@ -2735,7 +2735,7 @@ void sega315_5313_device::vdp_handle_eof() visarea.set(0, scr_width - 1, 0, m_visible_scanlines - 1); - m_screen->configure(480, m_total_scanlines, visarea, m_screen->frame_period().attoseconds); + m_screen->configure(480, m_total_scanlines, visarea, m_screen->frame_period().attoseconds()); } diff --git a/src/emu/video/ef9345.c b/src/emu/video/ef9345.c index 22ade42300c..ca8062bbb95 100644 --- a/src/emu/video/ef9345.c +++ b/src/emu/video/ef9345.c @@ -244,7 +244,7 @@ void ef9345_device::set_video_mode(void) rectangle visarea = m_screen->visible_area(); visarea.max_x = new_width - 1; - m_screen->configure(new_width, m_screen->height(), visarea, m_screen->frame_period().attoseconds); + m_screen->configure(new_width, m_screen->height(), visarea, m_screen->frame_period().attoseconds()); } //border color diff --git a/src/emu/video/h63484.c b/src/emu/video/h63484.c index dd949cbc222..906c01573e4 100644 --- a/src/emu/video/h63484.c +++ b/src/emu/video/h63484.c @@ -531,7 +531,7 @@ inline void h63484_device::recompute_parameters() rectangle visarea = m_screen->visible_area(); visarea.set((m_hsw + m_hds) * ppmc, (m_hsw + m_hds + m_hdw) * ppmc - 1, m_vds, vbstart - 1); - attoseconds_t frame_period = m_screen->frame_period().attoseconds; // TODO: use clock() to calculate the frame_period + attoseconds_t frame_period = m_screen->frame_period().attoseconds(); // TODO: use clock() to calculate the frame_period m_screen->configure(m_hc * ppmc, m_vc, visarea, frame_period); } diff --git a/src/emu/video/i8275.c b/src/emu/video/i8275.c index 59f50b04f70..4f75d7cbc1a 100644 --- a/src/emu/video/i8275.c +++ b/src/emu/video/i8275.c @@ -666,7 +666,7 @@ void i8275_device::recompute_parameters() int horiz_pix_total = (CHARACTERS_PER_ROW + HRTC_COUNT) * m_hpixels_per_column; int vert_pix_total = (CHARACTER_ROWS_PER_FRAME + VRTC_ROW_COUNT) * SCANLINES_PER_ROW; - attoseconds_t refresh = m_screen->frame_period().attoseconds; + attoseconds_t refresh = m_screen->frame_period().attoseconds(); int max_visible_x = (CHARACTERS_PER_ROW * m_hpixels_per_column) - 1; int max_visible_y = (CHARACTER_ROWS_PER_FRAME * SCANLINES_PER_ROW) - 1; diff --git a/src/emu/video/scn2674.c b/src/emu/video/scn2674.c index ee1b9a10d79..8dbc0f403e0 100644 --- a/src/emu/video/scn2674.c +++ b/src/emu/video/scn2674.c @@ -568,7 +568,7 @@ void scn2674_device::recompute_parameters() m_hpixels_per_column = m_gfx_enabled ? m_gfx_hpixels_per_column : m_text_hpixels_per_column; int horiz_pix_total = ((m_IR1_equalizing_constant + (m_IR2_horz_sync_width << 1)) << 1) * m_hpixels_per_column; int vert_pix_total = m_IR4_rows_per_screen * m_IR0_scanline_per_char_row + m_IR3_vert_front_porch + m_IR3_vert_back_porch + m_IR7_vsync_width; - attoseconds_t refresh = m_screen->frame_period().attoseconds; + attoseconds_t refresh = m_screen->frame_period().attoseconds(); int max_visible_x = (m_IR5_character_per_row * m_hpixels_per_column) - 1; int max_visible_y = (m_IR4_rows_per_screen * m_IR0_scanline_per_char_row) - 1; diff --git a/src/emu/video/v9938.h b/src/emu/video/v9938.h index 1393765ace3..4430c2ba4d5 100644 --- a/src/emu/video/v9938.h +++ b/src/emu/video/v9938.h @@ -17,12 +17,12 @@ // DEVICE CONFIGURATION MACROS //************************************************************************** -#define MCFG_V9938_ADD(_tag, _screen, _vramsize) \ - MCFG_DEVICE_ADD(_tag, V9938, 0) \ +#define MCFG_V9938_ADD(_tag, _screen, _vramsize, _clock) \ + MCFG_DEVICE_ADD(_tag, V9938, _clock) \ MCFG_VIDEO_SET_SCREEN(_screen) \ v9938_device::static_set_vram_size(*device, _vramsize); -#define MCFG_V9958_ADD(_tag, _screen, _vramsize) \ - MCFG_DEVICE_ADD(_tag, V9958, 0) \ +#define MCFG_V9958_ADD(_tag, _screen, _vramsize, _clock) \ + MCFG_DEVICE_ADD(_tag, V9958, _clock) \ MCFG_VIDEO_SET_SCREEN(_screen) \ v9938_device::static_set_vram_size(*device, _vramsize); diff --git a/src/emu/video/voodoo.c b/src/emu/video/voodoo.c index db140118995..1874fccad29 100644 --- a/src/emu/video/voodoo.c +++ b/src/emu/video/voodoo.c @@ -2095,8 +2095,8 @@ static void cmdfifo_w(voodoo_state *v, cmdfifo_info *f, offs_t offset, UINT32 da v->pci.op_end_time = v->device->machine().time() + attotime(0, (attoseconds_t)cycles * v->attoseconds_per_cycle); if (LOG_FIFO_VERBOSE) logerror("VOODOO.%d.FIFO:direct write start at %d.%08X%08X end at %d.%08X%08X\n", v->index, - v->device->machine().time().seconds, (UINT32)(v->device->machine().time().attoseconds >> 32), (UINT32)v->device->machine().time().attoseconds, - v->pci.op_end_time.seconds, (UINT32)(v->pci.op_end_time.attoseconds >> 32), (UINT32)v->pci.op_end_time.attoseconds); + v->device->machine().time().seconds(), (UINT32)(v->device->machine().time().attoseconds() >> 32), (UINT32)v->device->machine().time().attoseconds(), + v->pci.op_end_time.seconds(), (UINT32)(v->pci.op_end_time.attoseconds() >> 32), (UINT32)v->pci.op_end_time.attoseconds()); } } } @@ -2585,7 +2585,7 @@ static INT32 register_w(voodoo_state *v, offs_t offset, UINT32 data) if (v->reg[hSync].u != 0 && v->reg[vSync].u != 0 && v->reg[videoDimensions].u != 0) { int hvis, vvis, htotal, vtotal, hbp, vbp; - attoseconds_t refresh = v->screen->frame_period().attoseconds; + attoseconds_t refresh = v->screen->frame_period().attoseconds(); attoseconds_t stdperiod, medperiod, vgaperiod; attoseconds_t stddiff, meddiff, vgadiff; rectangle visarea; @@ -3569,8 +3569,8 @@ static void flush_fifos(voodoo_state *v, attotime current_time) if (!v->pci.op_pending) fatalerror("flush_fifos called with no pending operation\n"); if (LOG_FIFO_VERBOSE) logerror("VOODOO.%d.FIFO:flush_fifos start -- pending=%d.%08X%08X cur=%d.%08X%08X\n", v->index, - v->pci.op_end_time.seconds, (UINT32)(v->pci.op_end_time.attoseconds >> 32), (UINT32)v->pci.op_end_time.attoseconds, - current_time.seconds, (UINT32)(current_time.attoseconds >> 32), (UINT32)current_time.attoseconds); + v->pci.op_end_time.seconds(), (UINT32)(v->pci.op_end_time.attoseconds() >> 32), (UINT32)v->pci.op_end_time.attoseconds(), + current_time.seconds(), (UINT32)(current_time.attoseconds() >> 32), (UINT32)current_time.attoseconds()); /* loop while we still have cycles to burn */ while (v->pci.op_end_time <= current_time) @@ -3667,12 +3667,12 @@ static void flush_fifos(voodoo_state *v, attotime current_time) v->pci.op_end_time += attotime(0, (attoseconds_t)cycles * v->attoseconds_per_cycle); if (LOG_FIFO_VERBOSE) logerror("VOODOO.%d.FIFO:update -- pending=%d.%08X%08X cur=%d.%08X%08X\n", v->index, - v->pci.op_end_time.seconds, (UINT32)(v->pci.op_end_time.attoseconds >> 32), (UINT32)v->pci.op_end_time.attoseconds, - current_time.seconds, (UINT32)(current_time.attoseconds >> 32), (UINT32)current_time.attoseconds); + v->pci.op_end_time.seconds(), (UINT32)(v->pci.op_end_time.attoseconds() >> 32), (UINT32)v->pci.op_end_time.attoseconds(), + current_time.seconds(), (UINT32)(current_time.attoseconds() >> 32), (UINT32)current_time.attoseconds()); } if (LOG_FIFO_VERBOSE) logerror("VOODOO.%d.FIFO:flush_fifos end -- pending command complete at %d.%08X%08X\n", v->index, - v->pci.op_end_time.seconds, (UINT32)(v->pci.op_end_time.attoseconds >> 32), (UINT32)v->pci.op_end_time.attoseconds); + v->pci.op_end_time.seconds(), (UINT32)(v->pci.op_end_time.attoseconds() >> 32), (UINT32)v->pci.op_end_time.attoseconds()); in_flush = FALSE; } @@ -3782,8 +3782,8 @@ WRITE32_MEMBER( voodoo_device::voodoo_w ) v->pci.op_end_time = machine().time() + attotime(0, (attoseconds_t)cycles * v->attoseconds_per_cycle); if (LOG_FIFO_VERBOSE) logerror("VOODOO.%d.FIFO:direct write start at %d.%08X%08X end at %d.%08X%08X\n", v->index, - machine().time().seconds, (UINT32)(machine().time().attoseconds >> 32), (UINT32)machine().time().attoseconds, - v->pci.op_end_time.seconds, (UINT32)(v->pci.op_end_time.attoseconds >> 32), (UINT32)v->pci.op_end_time.attoseconds); + machine().time().seconds(), (UINT32)(machine().time().attoseconds() >> 32), (UINT32)machine().time().attoseconds(), + v->pci.op_end_time.seconds(), (UINT32)(v->pci.op_end_time.attoseconds() >> 32), (UINT32)v->pci.op_end_time.attoseconds()); } g_profiler.stop(); return; diff --git a/src/lib/formats/mfm_hd.c b/src/lib/formats/mfm_hd.c new file mode 100644 index 00000000000..ed50e60deb2 --- /dev/null +++ b/src/lib/formats/mfm_hd.c @@ -0,0 +1,750 @@ +// license:LGPL-2.1+ +// copyright-holders:Michael Zapf +/************************************************************************* + + Hard disk emulation: Format implementation + ------------------------------------------ + + This is the format implementation for MFM hard disks, similar to the + modular format concept of floppy drives in MAME/MESS. + + The base class is mfmhd_image_format_t; it contains some methods for + encoding and decoding MFM. Although MFM hard disks should also be able to + manage FM recording, we do not plan for FM recording here. + + The encode/decode methods rely on a parameter "encoding"; + see imagedev/mfmhd.c for a discussion. Essentially, it determines whether + data are read bitwise or bytewise, and whether clock bits are separated + or interleaved. + + The base class is abstract; you must create a subclass to use it. This + file delivers one subclass called mfmhd_generic_format. + + In order to use this format, you must pass the creator identifier to the + macro MCFG_MFM_HARDDISK_CONN_ADD. See emu/bus/ti99_peb/hfdc.c for an + example. + + + Generic MFM format + ------------------ + The heart of this class are the methods load and save. They are designed + to read sector data from a CHD file and reconstruct the track image (load), + or to take a track image, isolate the sector data, and store them + into the CHD (save). + + Rebuilding the track image means to create sector headers, allocate gaps, + add sync areas, and CRC values. Also, the sectors must be arranged + according to the "interleave" parameter and the "skew" parameters for + heads and cylinders. While the skews are commonly set to 0, the interleave + is often used to fine-tune the transfer speed between the drive hardware + and the host system. + + Also, the format allows for two header setups. + a) PC-AT-compatible header: four bytes long (ident, cylinder, head, sector); + the sector size is always 512 bytes. + b) Custom headers: five bytes long (..., sector size). The custom headers + are used in non-PC systems. + + ECC: While floppy drives make use of a CRC field to check the data integrity, + hard disks use an ECC (error correcting code). The ECC length is 4 bytes + or longer, depending on the desired correction capability. The ECC length + can also be specified for this format. + + However, for this version, we do not support ECC computation, but instead + we use CRC. This is indicated by setting the "ECC length" parameter to -1. + + Format autodetect + ----------------- + While formatting a hard disk, format parameters are likely to change, so + we have to find out about the new layout and store the metadata into the + CHD if they were modified. + + This is done in the save method. This method does not only retrieve the + sector contents but also counts the gap bytes and sync bytes so that + they can be stored in the CHD. + + - Interleave detection: save counts the number of sectors between sector + number n and sector number n+1. + + - Skew detection: Skew is determined by three tracks: (cyl,head)= + (0,0), (1,0), and (0,1). For this purpose we use the m_secnumber list. + + - Header length is detemined by the first sector on (0,0). This is done + by checking the header against the following two CRC bytes. If they + match for 4 bytes, we have an AT-style header, else a custom header. + + - Gap and sync lengths are determined by the first track (0,0). They are + actually not expected to change, unless they are undefined before first + use, or the controller or its driver changes. We assume that track + (0,0) is actually rewritten during reformatting. + + Since write precompensation and reduced write current cannot be seen + on the track image directly, those two values have to be set by the + hard disk device itseltf. + + Inhibit autodetect + ------------------ + In case we do not want the format to detect the layout but want to ensure + an immutable format, the save_param method may be overwritten to return + false for all or a particular group of parameters. The generic format + offers a save_param method which always returns true. + + The effect of inhibiting the autodetection is that the layout parameters + as found on the CHD are used if available; otherwise defaults are used. + + Defaults + -------- + The generic format defines a method get_default which returns safe values + for layout parameters. It can be overwritten for specific formats. + + Debugging + --------- + There is a set of debug flags (starting with TRACE_) that can be set to 1; + after recompiling you will get additional output. Since this class is not + a descendant of device_t we do not have a tag for output; for a better + overview in the logfile the hard disk device passes its tag to the base + class. + + + TODO + ---- + - Add ECC computation + + + Michael Zapf + August 2015 + +**************************************************************************/ + +#include "emu.h" +#include "mfm_hd.h" +#include "imageutl.h" + +#define TRACE_RWTRACK 0 +#define TRACE_LAYOUT 0 +#define TRACE_IMAGE 0 +#define TRACE_DETAIL 0 +#define TRACE_FORMAT 0 + +/* + Accept the new layout parameters and reset the sector number fields + used for skew calculation. +*/ +void mfmhd_image_format_t::set_layout_params(mfmhd_layout_params param) +{ + m_param = m_param_old = param; + m_secnumber[0] = m_secnumber[1] = m_secnumber[2] = -1; +} + +/* + Encode some value with data-type clock bits. +*/ +void mfmhd_image_format_t::mfm_encode(UINT16* trackimage, int& position, UINT8 byte, int count) +{ + mfm_encode_mask(trackimage, position, byte, count, 0x00); +} + +/* + Encode an A1 value with mark-type clock bits. +*/ +void mfmhd_image_format_t::mfm_encode_a1(UINT16* trackimage, int& position) +{ + m_current_crc = 0xffff; + mfm_encode_mask(trackimage, position, 0xa1, 1, 0x04); +} + +/* + Encode a byte value with a given clock bit mask. Used by both mfm_encode + and mfm_encode_a1 methods. +*/ +void mfmhd_image_format_t::mfm_encode_mask(UINT16* trackimage, int& position, UINT8 byte, int count, int mask) +{ + UINT16 encclock = 0; + UINT16 encdata = 0; + UINT8 thisbyte = byte; + bool mark = (mask != 0x00); + + m_current_crc = ccitt_crc16_one(m_current_crc, byte); + + for (int i=0; i < 8; i++) + { + encdata <<= 1; + encclock <<= 1; + + if (m_param.encoding == MFM_BITS || m_param.encoding == MFM_BYTE) + { + // skip one position for later interleaving + encdata <<= 1; + encclock <<= 1; + } + + if (thisbyte & 0x80) + { + // Encoding 1 => 01 + encdata |= 1; + m_lastbit = true; + } + else + { + // Encoding 0 => x0 + // If the bit in the mask is set, suppress the clock bit + // Also, if we use the simplified encoding, don't set the clock bits + if (m_lastbit == false && m_param.encoding != SEPARATED_SIMPLE && (mask & 0x80) == 0) encclock |= 1; + m_lastbit = false; + } + mask <<= 1; + // For simplified encoding, set all clock bits to indicate a mark + if (m_param.encoding == SEPARATED_SIMPLE && mark) encclock |= 1; + thisbyte <<= 1; + } + + if (m_param.encoding == MFM_BITS || m_param.encoding == MFM_BYTE) + encclock <<= 1; + else + encclock <<= 8; + + trackimage[position++] = (encclock | encdata); + + // When we write the byte multiple times, check whether the next encoding + // differs from the previous because of the last bit + + if (m_param.encoding == MFM_BITS || m_param.encoding == MFM_BYTE) + { + encclock &= 0x7fff; + if ((byte & 0x80)==0 && m_lastbit==false) encclock |= 0x8000; + } + + for (int j=1; j < count; j++) + { + trackimage[position++] = (encclock | encdata); + m_current_crc = ccitt_crc16_one(m_current_crc, byte); + } +} + +/* + Decode an MFM cell pattern into a byte value. + Clock bits and data bits are assumed to be interleaved (cdcdcdcdcdcdcdcd); + the 8 data bits are returned. +*/ +UINT8 mfmhd_image_format_t::mfm_decode(UINT16 raw) +{ + unsigned int value = 0; + + for (int i=0; i < 8; i++) + { + value <<= 1; + + value |= (raw & 0x4000); + raw <<= 2; + } + return (value >> 14) & 0xff; +} + +/* + For debugging. Outputs the byte array in a xxd-like way. +*/ +void mfmhd_image_format_t::showtrack(UINT16* enctrack, int length) +{ + for (int i=0; i < length; i+=16) + { + logerror("%07x: ", i); + for (int j=0; j < 16; j++) + { + logerror("%04x ", enctrack[i+j]); + } + logerror(" "); + logerror("\n"); + } +} + +// ====================================================================== +// Generic MFM HD format +// ====================================================================== + +const mfmhd_format_type MFMHD_GEN_FORMAT = &mfmhd_image_format_creator<mfmhd_generic_format>; + +/* + Calculate the ident byte from the cylinder. The specification does not + define idents beyond cylinder 1023, but formatting programs seem to + continue with 0xfd for cylinders between 1024 and 2047. +*/ +UINT8 mfmhd_generic_format::cylinder_to_ident(int cylinder) +{ + if (cylinder < 256) return 0xfe; + if (cylinder < 512) return 0xff; + if (cylinder < 768) return 0xfc; + return 0xfd; +} + +/* + Returns the linear sector number, given the CHS data. + + C,H,S + | 0,0,0 | 0,0,1 | 0,0,2 | ... + | 0,1,0 | 0,1,1 | 0,1,2 | ... + ... + | 1,0,0 | ... + ... +*/ +int mfmhd_generic_format::chs_to_lba(int cylinder, int head, int sector) +{ + if ((cylinder < m_param.cylinders) && (head < m_param.heads) && (sector < m_param.sectors_per_track)) + { + return (cylinder * m_param.heads + head) * m_param.sectors_per_track + sector; + } + else return -1; +} + +chd_error mfmhd_generic_format::load(chd_file* chdfile, UINT16* trackimage, int tracksize, int cylinder, int head) +{ + chd_error state = CHDERR_NONE; + UINT8 sector_content[16384]; + + int sectorcount = m_param.sectors_per_track; + int size = m_param.sector_size; + int position = 0; // will be incremented by each encode call + int sec_number = 0; + int identfield = 0; + int cylfield = 0; + int headfield = 0; + int sizefield = (size >> 7)-1; + + // If we don't have interleave data in the CHD, take a default + if (m_param.interleave==0) + { + m_param.interleave = get_default(MFMHD_IL); + m_param.cylskew = get_default(MFMHD_CSKEW); + m_param.headskew = get_default(MFMHD_HSKEW); + } + + int sec_il_start = (m_param.cylskew * cylinder + m_param.headskew * head) % sectorcount; + int delta = (sectorcount + m_param.interleave-1) / m_param.interleave; + + if (TRACE_RWTRACK) logerror("%s: Load track (c=%d,h=%d) from CHD, interleave=%d, cylskew=%d, headskew=%d\n", tag(), cylinder, head, m_param.interleave, m_param.cylskew, m_param.headskew); + + m_lastbit = false; + + if (m_param.sync==0) + { + m_param.gap1 = get_default(MFMHD_GAP1); + m_param.gap2 = get_default(MFMHD_GAP2); + m_param.gap3 = get_default(MFMHD_GAP3); + m_param.sync = get_default(MFMHD_SYNC); + m_param.headerlen = get_default(MFMHD_HLEN); + m_param.ecctype = get_default(MFMHD_ECC); + } + + // Gap 1 + mfm_encode(trackimage, position, 0x4e, m_param.gap1); + + if (TRACE_LAYOUT) logerror("%s: cyl=%d head=%d: sector sequence = ", tag(), cylinder, head); + + sec_number = sec_il_start; + for (int sector = 0; sector < sectorcount; sector++) + { + if (TRACE_LAYOUT) logerror("%02d ", sec_number); + + // Sync gap + mfm_encode(trackimage, position, 0x00, m_param.sync); + + // Write IDAM + mfm_encode_a1(trackimage, position); + + // Write header + identfield = cylinder_to_ident(cylinder); + cylfield = cylinder & 0xff; + headfield = head & 0x0f; + if (m_param.headerlen==5) + headfield |= ((cylinder & 0x700)>>4); + + mfm_encode(trackimage, position, identfield); + mfm_encode(trackimage, position, cylfield); + mfm_encode(trackimage, position, headfield); + mfm_encode(trackimage, position, sec_number); + if (m_param.headerlen==5) + mfm_encode(trackimage, position, sizefield); + + // Write CRC for header. + int crc = m_current_crc; + mfm_encode(trackimage, position, (crc >> 8) & 0xff); + mfm_encode(trackimage, position, crc & 0xff); + + // Gap 2 + mfm_encode(trackimage, position, 0x4e, m_param.gap2); + + // Sync + mfm_encode(trackimage, position, 0x00, m_param.sync); + + // Write DAM + mfm_encode_a1(trackimage, position); + mfm_encode(trackimage, position, 0xfb); + + // Get sector content from CHD + int lbaposition = chs_to_lba(cylinder, head, sec_number); + if (lbaposition>=0) + { + chd_error state = chdfile->read_units(lbaposition, sector_content); + if (state != CHDERR_NONE) break; + } + else + { + logerror("%s: Invalid CHS data (%d,%d,%d); not loading from CHD\n", tag(), cylinder, head, sector); + } + + for (int i=0; i < size; i++) + mfm_encode(trackimage, position, sector_content[i]); + + // Write CRC for content. + crc = m_current_crc; + mfm_encode(trackimage, position, (crc >> 8) & 0xff); + mfm_encode(trackimage, position, crc & 0xff); + + // Gap 3 + mfm_encode(trackimage, position, 0x00, 3); + mfm_encode(trackimage, position, 0x4e, m_param.gap3-3); + + // Calculate next sector number + sec_number += delta; + if (sec_number >= sectorcount) + { + sec_il_start = (sec_il_start+1) % delta; + sec_number = sec_il_start; + } + } + if (TRACE_LAYOUT) logerror("\n"); + + // Gap 4 + if (state == CHDERR_NONE) + { + // Fill the rest with 0x4e + mfm_encode(trackimage, position, 0x4e, tracksize-position); + if (TRACE_IMAGE) showtrack(trackimage, tracksize); + } + return state; +} + +/* + State names for analyzing the track image. +*/ +enum +{ + SEARCH_A1=0, + FOUND_A1, + DAM_FOUND, + CHECK_CRC +}; + +chd_error mfmhd_generic_format::save(chd_file* chdfile, UINT16* trackimage, int tracksize, int current_cylinder, int current_head) +{ + if (TRACE_RWTRACK) logerror("%s: write back (c=%d,h=%d) to CHD\n", tag(), current_cylinder, current_head); + + UINT8 buffer[16384]; // for header or sector content + + int bytepos = 0; + int state = SEARCH_A1; + int count = 0; + int pos = 0; + UINT16 crc = 0; + UINT8 byte; + bool search_header = true; + + int ident = 0; + int cylinder = 0; + int head = 0; + int sector = 0; + int size = 0; + + int headerpos = 0; + + int interleave = 0; + int interleave_prec = -1; + bool check_interleave = true; + bool check_skew = true; + + int gap1 = 0; + int ecctype = 0; + + // if (current_cylinder==0 && current_head==0) showtrack(trackimage, tracksize); + + // If we want to detect gaps, we only do it on cylinder 0, head 0 + // This makes it safer to detect the header length + // (There is indeed some chance that we falsely assume a header length of 4 + // because the two bytes behind happen to be a valid CRC value) + if (save_param(MFMHD_GAP1) && current_cylinder==0 && current_head==0) + { + m_param.gap1 = 0; + m_param.gap2 = 0; + m_param.gap3 = 0; + m_param.sync = 0; + // 4-byte headers are used for the IBM-AT format + // 5-byte headers are used in other formats + m_param.headerlen = 4; + m_param.ecctype = 0; + } + + // AT format implies 512 bytes per sector + int sector_length = 512; + + // Only check once + bool countgap1 = (m_param.gap1==0); + bool countgap2 = false; + bool countgap3 = false; + bool countsync = false; + + chd_error chdstate = CHDERR_NONE; + + if (TRACE_IMAGE) + { + for (int i=0; i < tracksize; i++) + { + if ((i % 16)==0) logerror("\n%04x: ", i); + logerror("%02x ", (m_param.encoding==MFM_BITS || m_param.encoding==MFM_BYTE)? mfm_decode(trackimage[i]) : (trackimage[i]&0xff)); + } + logerror("\n"); + } + + // We have to go through the bytes of the track and save a sector as soon as one shows up + + while (bytepos < tracksize) + { + // Decode the next 16 bits + if (m_param.encoding==MFM_BITS || m_param.encoding==MFM_BYTE) + { + byte = mfm_decode(trackimage[bytepos]); + } + else byte = (trackimage[bytepos] & 0xff); + + switch (state) + { + case SEARCH_A1: + // Counting gaps and sync + if (countgap2) + { + if (byte == 0x4e) m_param.gap2++; + else if (byte == 0) { countsync = true; countgap2 = false; } + } + + if (countsync) + { + if (byte == 0) m_param.sync++; + else countsync = false; + } + + if (countgap3) + { + if (byte != 0x00 || m_param.gap3 < 4) m_param.gap3++; + else countgap3 = false; + } + + if (((m_param.encoding==MFM_BITS || m_param.encoding==MFM_BYTE) && trackimage[bytepos]==0x4489) + || (m_param.encoding==SEPARATED && trackimage[bytepos]==0x0aa1) + || (m_param.encoding==SEPARATED_SIMPLE && trackimage[bytepos]==0xffa1)) + { + state = FOUND_A1; + count = (search_header? m_param.headerlen : (sector_length+1)) + 2; + crc = 0x443b; // init value with a1 + pos = 0; + } + bytepos++; + break; + + case FOUND_A1: + crc = ccitt_crc16_one(crc, byte); + // logerror("%s: MFM HD: Byte = %02x, CRC=%04x\n", tag(), byte, crc); + + // Put byte into buffer + // but not the data mark and the CRC + if (search_header || (count > 2 && count < sector_length+3)) buffer[pos++] = byte; + + // Stop counting gap1 + if (search_header && countgap1) + { + gap1 = bytepos-1; + countgap1 = false; + } + + if (--count == 0) + { + if (crc==0) + { + if (search_header) + { + // Found a header + ident = buffer[0]; + cylinder = buffer[1]; + // For non-PC-AT formats, highest three bits are in the head field + if (m_param.headerlen == 5) cylinder |= ((buffer[2]&0x70)<<4); + else + { + logerror("%s: Unexpected header size: %d, cylinder=%d, position=%04x\n", tag(), m_param.headerlen, cylinder, bytepos); + showtrack(trackimage, tracksize); + } + + head = buffer[2] & 0x0f; + sector = buffer[3]; + int identexp = cylinder_to_ident(cylinder); + + if (identexp != ident) + { + logerror("%s: Field error; ident = %02x (expected %02x) for sector chs=(%d,%d,%d)\n", tag(), ident, identexp, cylinder, head, sector); + } + + if (cylinder != current_cylinder) + { + logerror("%s: Sector header of sector %d defines cylinder = %02x (should be %02x)\n", tag(), sector, cylinder, current_cylinder); + } + + if (head != current_head) + { + logerror("%s: Sector header of sector %d defines head = %02x (should be %02x)\n", tag(), sector, head, current_head); + } + + // Check skew + // We compare the beginning of this track with the track on the next head and the track on the next cylinder + if (check_skew && cylinder < 2 && head < 2) + { + m_secnumber[cylinder*2 + head] = sector; + check_skew=false; + } + + // Count the sectors for the interleave + if (check_interleave) + { + if (interleave_prec == -1) interleave_prec = sector; + else + { + if (sector == interleave_prec+1) check_interleave = false; + interleave++; + } + } + + if (interleave == 0) interleave = sector - buffer[3]; + + // When we have 4-byte headers, the sector length is 512 bytes + if (m_param.headerlen == 5) + { + size = buffer[4]; + sector_length = 128 << (size&0x07); + ecctype = (size&0xf0)>>4; + } + + search_header = false; + if (TRACE_DETAIL) logerror("%s: Found sector chs=(%d,%d,%d)\n", tag(), cylinder, head, sector); + headerpos = pos; + // Start the GAP2 counter (if not already determined) + if (m_param.gap2==0) countgap2 = true; + } + else + { + // Sector contents + // Write the sectors to the CHD + int lbaposition = chs_to_lba(cylinder, head, sector); + if (lbaposition>=0) + { + if (TRACE_DETAIL) logerror("%s: Writing sector chs=(%d,%d,%d) to CHD\n", tag(), current_cylinder, current_head, sector); + chdstate = chdfile->write_units(chs_to_lba(current_cylinder, current_head, sector), buffer); + + if (chdstate != CHDERR_NONE) + { + logerror("%s: Write error while writing sector chs=(%d,%d,%d)\n", tag(), cylinder, head, sector); + } + } + else + { + logerror("%s: Invalid CHS data in track image: (%d,%d,%d); not saving to CHD\n", tag(), cylinder, head, sector); + } + if (m_param.gap3==0) countgap3 = true; + search_header = true; + } + } + else + { + // Let's test for a 5-byte header + if (search_header && m_param.headerlen==4 && current_cylinder==0 && current_head==0) + { + if (TRACE_DETAIL) logerror("%s: CRC error for 4-byte header; trying 5 bytes\n", tag()); + m_param.headerlen=5; + count = 1; + bytepos++; + break; + } + else + { + logerror("%s: CRC error in %s of (%d,%d,%d)\n", tag(), search_header? "header" : "data", cylinder, head, sector); + search_header = true; + } + } + // search next A1 + state = SEARCH_A1; + + if (!search_header && (pos - headerpos) > 30) + { + logerror("%s: Error; missing DAM; searching next header\n", tag()); + search_header = true; + } + } + bytepos++; + break; + } + } + + if (check_interleave == false && save_param(MFMHD_IL)) + { + // Successfully determined the interleave + m_param.interleave = interleave; + if (TRACE_FORMAT) + if (current_cylinder==0 && current_head==0) logerror("%s: Determined interleave = %d\n", tag(), m_param.interleave); + } + + if (check_skew == false) + { + if (m_secnumber[0] != -1) + { + if (m_secnumber[1] != -1) + { + if (save_param(MFMHD_HSKEW)) m_param.headskew = m_secnumber[1]-m_secnumber[0]; + if (TRACE_FORMAT) logerror("%s: Determined head skew = %d\n", tag(), m_param.headskew); + } + if (m_secnumber[2] != -1) + { + if (save_param(MFMHD_CSKEW)) m_param.cylskew = m_secnumber[2]-m_secnumber[0]; + if (TRACE_FORMAT) logerror("%s: Determined cylinder skew = %d\n", tag(), m_param.cylskew); + } + } + } + + gap1 -= m_param.sync; + ecctype = -1; // lock to CRC until we have a support for ECC + + if (current_cylinder==0 && current_head==0) + { + // If we want to detect gaps, store the new value into the param object + // The other gaps have already been written directly to the param object above, + // unless save_param returned false (or we were not on cylinder 0, head 0) + if (save_param(MFMHD_GAP1)) m_param.gap1 = gap1; + if (save_param(MFMHD_ECC)) m_param.ecctype = ecctype; + } + return chdstate; +} + +/* + Deliver default values. +*/ +int mfmhd_generic_format::get_default(mfmhd_param_t type) +{ + switch (type) + { + case MFMHD_IL: return 4; + case MFMHD_HSKEW: + case MFMHD_CSKEW: return 0; + case MFMHD_WPCOM: // Write precompensation cylinder (-1 = none) + case MFMHD_RWC: return -1; // Reduced write current cylinder (-1 = none) + case MFMHD_GAP1: return 16; + case MFMHD_GAP2: return 3; + case MFMHD_GAP3: return 18; + case MFMHD_SYNC: return 13; + case MFMHD_HLEN: return 5; + case MFMHD_ECC: return -1; // -1: use CRC instead of ECC + } + return -1; +} diff --git a/src/lib/formats/mfm_hd.h b/src/lib/formats/mfm_hd.h new file mode 100644 index 00000000000..dfa4d3ffba7 --- /dev/null +++ b/src/lib/formats/mfm_hd.h @@ -0,0 +1,212 @@ +// license:LGPL-2.1+ +// copyright-holders:Michael Zapf +/**************************************************************************** + + Hard disk support + See mfm_hd.c for documentation + + Michael Zapf + + February 2012: Rewritten as class + +*****************************************************************************/ + +#ifndef __MFMHDFMT__ +#define __MFMHDFMT__ + +#include "emu.h" +#include "chd.h" + +const chd_metadata_tag MFM_HARD_DISK_METADATA_TAG = CHD_MAKE_TAG('G','D','D','I'); + +extern const char *MFMHD_REC_METADATA_FORMAT; +extern const char *MFMHD_GAP_METADATA_FORMAT; + +/* + Determine how data are passed from the hard disk to the controller. We + allow for different degrees of hardware emulation. +*/ +enum mfmhd_enc_t +{ + MFM_BITS, // One bit at a time + MFM_BYTE, // One data byte with interleaved clock bits + SEPARATED, // 8 clock bits (most sig byte), one data byte (least sig byte) + SEPARATED_SIMPLE // MSB: 00/FF (standard / mark) clock, LSB: one data byte +}; + +class mfmhd_image_format_t; + +// Pointer to its alloc function +typedef mfmhd_image_format_t *(*mfmhd_format_type)(); + +template<class _FormatClass> +mfmhd_image_format_t *mfmhd_image_format_creator() +{ + return new _FormatClass(); +} + +/* + Parameters for the track layout +*/ +class mfmhd_layout_params +{ +public: + // Geometry params. These are fixed for the device. However, sector sizes + // could be changed, but we do not support this (yet). These are defined + // in the CHD and must match those of the device. They are stored by the GDDD tag. + // The encoding is not stored in the CHD but is also supposed to be immutable. + int cylinders; + int heads; + int sectors_per_track; + int sector_size; + mfmhd_enc_t encoding; + + // Parameters like interleave, precompensation, write current can be changed + // on every write operation. They are stored by the GDDI tag (first record). + int interleave; + int cylskew; + int headskew; + int write_precomp_cylinder; // if -1, no wpcom on the disks + int reduced_wcurr_cylinder; // if -1, no rwc on the disks + + // Parameters for the track layout that are supposed to be the same for + // all tracks and that do not change (until the next reformat). + // Also, they do not have any influence on the CHD file. + // They are stored by the GDDI tag (second record). + int gap1; + int gap2; + int gap3; + int sync; + int headerlen; + int ecctype; // -1 is CRC + + bool sane_rec() + { + return ((interleave > 0 && interleave < 32) && (cylskew >= 0 && cylskew < 32) && (headskew >= 0 && headskew < 32) + && (write_precomp_cylinder >= -1 && write_precomp_cylinder < 100000) + && (reduced_wcurr_cylinder >= -1 && reduced_wcurr_cylinder < 100000)); + } + + void reset_rec() + { + interleave = cylskew = headskew = 0; + write_precomp_cylinder = reduced_wcurr_cylinder = -1; + } + + bool sane_gap() + { + return ((gap1 >= 1 && gap1 < 1000) && (gap2 >= 1 && gap2 < 20) && (gap3 >= 1 && gap3 < 1000) + && (sync >= 10 && sync < 20) + && (headerlen >= 4 && headerlen<=5) && (ecctype>=-1 && ecctype < 10)); + } + + void reset_gap() + { + gap1 = gap2 = gap3 = sync = headerlen = ecctype = 0; + } + + bool equals_rec(mfmhd_layout_params* other) + { + return ((interleave == other->interleave) && + (cylskew == other->cylskew) && + (headskew == other->headskew) && + (write_precomp_cylinder == other->write_precomp_cylinder) && + (reduced_wcurr_cylinder == other->reduced_wcurr_cylinder)); + } + + bool equals_gap(mfmhd_layout_params* other) + { + return ((gap1 == other->gap1) && + (gap2 == other->gap2) && + (gap3 == other->gap3) && + (sync == other->sync) && + (headerlen == other->headerlen) && + (ecctype == other->ecctype)); + } +}; + +enum mfmhd_param_t +{ + MFMHD_IL, + MFMHD_HSKEW, + MFMHD_CSKEW, + MFMHD_WPCOM, + MFMHD_RWC, + MFMHD_GAP1, + MFMHD_GAP2, + MFMHD_GAP3, + MFMHD_SYNC, + MFMHD_HLEN, + MFMHD_ECC +}; + +/* + Hard disk format +*/ +class mfmhd_image_format_t +{ +public: + mfmhd_image_format_t() { m_devtag = std::string("mfmhd_image_format_t"); }; + virtual ~mfmhd_image_format_t() {}; + + // Load the image. + virtual chd_error load(chd_file* chdfile, UINT16* trackimage, int tracksize, int cylinder, int head) = 0; + + // Save the image. + virtual chd_error save(chd_file* chdfile, UINT16* trackimage, int tracksize, int cylinder, int head) = 0; + + // Return the original parameters of the image + mfmhd_layout_params* get_initial_params() { return &m_param_old; } + + // Return the recent parameters of the image + mfmhd_layout_params* get_current_params() { return &m_param; } + + // Set the track layout parameters (and reset the skew detection values) + void set_layout_params(mfmhd_layout_params param); + + // Concrete format shall decide whether we want to save the retrieved parameters or not. + virtual bool save_param(mfmhd_param_t type) =0; + + // Accept a tag for log output, since this is not a device instance + void set_tag(std::string tag) { m_devtag = tag; } + +protected: + bool m_lastbit; + int m_current_crc; + int m_secnumber[4]; // used to determine the skew values + std::string m_devtag; + + mfmhd_layout_params m_param, m_param_old; + + void mfm_encode(UINT16* trackimage, int& position, UINT8 byte, int count=1); + void mfm_encode_a1(UINT16* trackimage, int& position); + void mfm_encode_mask(UINT16* trackimage, int& position, UINT8 byte, int count, int mask); + UINT8 mfm_decode(UINT16 raw); + + // Deliver defaults. + virtual int get_default(mfmhd_param_t type) =0; + + // Debugging + void showtrack(UINT16* enctrack, int length); + virtual const char* tag() { return m_devtag.c_str(); } +}; + +class mfmhd_generic_format : public mfmhd_image_format_t +{ +public: + mfmhd_generic_format() { m_devtag = std::string("mfmhd_generic_format"); }; + chd_error load(chd_file* chdfile, UINT16* trackimage, int tracksize, int cylinder, int head); + chd_error save(chd_file* chdfile, UINT16* trackimage, int tracksize, int cylinder, int head); + + // Yes, we want to save all parameters + virtual bool save_param(mfmhd_param_t type) { return true; } + virtual int get_default(mfmhd_param_t type); + +protected: + virtual UINT8 cylinder_to_ident(int cylinder); + virtual int chs_to_lba(int cylinder, int head, int sector); +}; + +extern const mfmhd_format_type MFMHD_GEN_FORMAT; + +#endif diff --git a/src/lib/formats/ti99_dsk.c b/src/lib/formats/ti99_dsk.c index 599cbe4eda3..d83853e0a5d 100644 --- a/src/lib/formats/ti99_dsk.c +++ b/src/lib/formats/ti99_dsk.c @@ -79,7 +79,7 @@ bool ti99_floppy_format::check_for_address_marks(UINT8* trackdata, int encoding) while (i < 5) { if (trackdata[40 + 13 + i*340] != 0xfe) break; - if (trackdata[40 + 57 + i*340] != 0xfb && trackdata[40 + 57 + i*334] != 0xf8) break; + if (trackdata[40 + 57 + i*340] != 0xfb && trackdata[40 + 57 + i*340] != 0xf8) break; i++; } } @@ -410,8 +410,7 @@ void ti99_floppy_format::generate_track_mfm(int track, int head, int cell_size, // IDAM for (int j=0; j < 3; j++) raw_w(buffer, 16, 0x4489); // 3 times A1 - mfm_w(buffer, 8, 0xfe); - i += 3; + i += 2; } else { @@ -420,8 +419,7 @@ void ti99_floppy_format::generate_track_mfm(int track, int head, int cell_size, // DAM for (int j=0; j < 3; j++) raw_w(buffer, 16, 0x4489); // 3 times A1 - mfm_w(buffer, 8, 0xfb); - i += 3; + i += 2; } else { diff --git a/src/mame/arcade.lst b/src/mame/arcade.lst index 7f322c5c159..b331d6ffe55 100644 --- a/src/mame/arcade.lst +++ b/src/mame/arcade.lst @@ -3005,6 +3005,7 @@ gunsmoke // 11/1985 (c) 1985 (World) gunsmokeb gunsmokeu // 11/1985 (c) 1985 + Romstar (US) gunsmokeua // 11/1985 (c) 1985 (US) +gunsmokeub // 11/1985 (c) 1985 (US) gunsmokej // 11/1985 (c) 1985 (Japan) sectionz // 12/1985 (c) 1985 sectionza // 12/1985 (c) 1985 @@ -3037,6 +3038,7 @@ whizz // (c) 1989 Philko (NOT A CAPCOM GAME but runs on modified Sidea avengers // 2/1987 (c) 1987 (US) avengers2 // 2/1987 (c) 1987 (US) buraiken // 2/1987 (c) 1987 (Japan) +buraikenb // 2/1987 (c) 1987 (Japan) bionicc // 3/1987 (c) 1987 (Euro) bionicc1 // 3/1987 (c) 1987 (US) bionicc2 // 3/1987 (c) 1987 (US) @@ -3840,7 +3842,7 @@ soulclbrwb // 1998.?? Soul Calibur (World, SOC14/VER.B) soulclbrub // 1998.?? Soul Calibur (US, SOC13/VER.B) soulclbrjb // 1998.?? Soul Calibur (Japan, SOC11/VER.B) soulclbrja // 1998.?? Soul Calibur (Japan, SOC11/VER.A2) - // 1998.07 Techno Drive +technodr // 1998.07 Techno Drive mdhorse // 1998.11 Derby Quiz My Dream Horse (Japan, MDH1/VER.A2) // 1998.12 Attack Pla Rail tenkomor // 1998.?? Tenkomori Shooting (Asia, TKM2/VER.A1) @@ -6141,10 +6143,12 @@ ragtime // MBD (c) 1992 (Japan, v1.5) ragtimea // MBD (c) 1992 (Japan, v1.3) dblewing // MBE (c) 1993 Mitchell fghthist // MBF (c) 1993 Data East Corporation (World) DE-0380-2 PCB -fghthistu // MBF (c) 1993 Data East Corporation (US) DE-0395-1 PCB +fghthista // MBF (c) 1993 Data East Corporation (World) DE-0380-2 PCB +fghthistu // MBF (c) 1993 Data East Corporation (US) DE-0396-0 PCB fghthistua // MBF (c) 1993 Data East Corporation (US) DE-0395-1 PCB +fghthistub // MBF (c) 1993 Data East Corporation (US) DE-0395-1 PCB +fghthistuc // MBF (c) 1993 Data East Corporation (US) DE-0380-2 PCB fghthistj // MBF (c) 1993 Data East Corporation (Japan) DE-0395-1 PCB -fghthistub // MBF (c) 1993 Data East Corporation (US) DE-0380-2 PCB fghthistja // MBF (c) 1993 Data East Corporation (Japan) DE-0380-2 PCB fghthistjb // MBF (c) 1993 Data East Corporation (Japan) DE-0380-1 PCB hvysmsh // MBG (c) 1993 Data East Corporation (World) @@ -8295,6 +8299,7 @@ sf2049 // (c) 1999 Atari Games sf2049se // (c) 1999 Atari Games sf2049te // (c) 1999 Atari Games warfa // (c) 1999 Atari Games +warfaa // (c) 1999 Atari Games nbashowt // (c) 1998 Midway Games nbanfl // (c) 1999 Midway Games nbagold // (c) 2000 Midway Games @@ -8719,6 +8724,7 @@ jitsupro // (c) 1989 (Japan) plusalph // (c) 1989 stdragon // (c) 1989 stdragona // (c) 1989 +stdragonb // bootleg rodland // (c) 1990 rodlandj // (c) 1990 (Japan) rittam // Prototype or hack of Rod-Land @@ -8727,7 +8733,8 @@ avspirit // (c) 1991 phantasm // (c) 1991 (Japan) monkelf // bootleg edf // (c) 1991 -edfu // (c) 1991 +edfa // (c) 1991 +edfu // (c) 1991 (North America) edfbl // (c) 1991 64street // (c) 1991 64streetj // (c) 1991 (Japan) @@ -9031,6 +9038,7 @@ galpani3hk // (c) 1995 Kaneko (Hong Kong) berlwall // (c) 1991 Kaneko berlwallt // (c) 1991 Kaneko berlwallk // (c) 1991 Kaneko (Korea, Inter license) +packbang // (c) 1994 Kaneko (prototype) mgcrystl // (c) 1991 Kaneko (World) mgcrystlo // (c) 1991 Kaneko (World) mgcrystlj // (c) 1991 Kaneko + distributed by Atlus (Japan) @@ -9523,6 +9531,7 @@ puzzlet // (c) 2000 Yunizu Corporation (Japan) spcforce // (c) 1980 Venture Line spcforc2 // bootleg meteor // (c) 1981 Venture Line +meteors // (c) 1981 Amusement World looping // (c) 1982 Video Games GmbH loopingv // (c) 1982 Video Games GmbH (Venture Line license) loopingva // (c) 1982 Video Games GmbH (Venture Line license) @@ -9893,6 +9902,7 @@ starzan // (c) 2000? // IGS027A Cpu Games slqz3 // (c) 1999 +fruitpar // (c) 200? zhongguo // (c) 2000 sdwx // (c) 2002 sddz // (c) 200? @@ -10338,6 +10348,8 @@ ringking2 // (c) 1985 Data East USA ringking3 // (c) 1985 Data East USA ringkingw // (c) 1985 Wood Place Inc. dlair // (c) 1983 Cinematronics +dlair_1 // (c) 1983 Cinematronics +dlair_2 // (c) 1983 Cinematronics dlairf // (c) 1983 Cinematronics dlaire // (c) 1983 Cinematronics dlaird // (c) 1983 Cinematronics @@ -10391,9 +10403,9 @@ taxidriv // [1984 Graphic Techno] xyonix // [1989 Philko] gt507uk // (c) 1986 Grayhound Electronics gtsers8 // (c) 1984 Greyhound Electronics +gtsers8a // (c) 1984 Greyhound Electronics gtsers9 // (c) 1984 Greyhound Electronics gtsers10 // (c) 1984 Greyhound Electronics -gtsers10a // (c) 1984 Greyhound Electronics gtsers11 // (c) 1984 Greyhound Electronics gtsers11a // (c) 1984 Greyhound Electronics gtsers12 // (c) 1984 Greyhound Electronics @@ -10710,6 +10722,8 @@ riviera // (c) 1987 Merit rivieraa // (c) 1986 Merit rivierab // (c) 1986 Merit americna // (c) 1987 Merit +americnaa // (c) 1987 Merit +meritjp // (c) 1987 Merit dodgecty // (c) 1988 Merit dodgectya // (c) 1986 Merit dodgectyb // (c) 1986 Merit @@ -11334,6 +11348,7 @@ pepp0540 // (c) 1987 IGT - International Game Technology pepp0542 // (c) 1987 IGT - International Game Technology pepp0542a // (c) 1987 IGT - International Game Technology pepp0550 // (c) 1987 IGT - International Game Technology +pepp0555 // (c) 1987 IGT - International Game Technology pepp0568 // (c) 1987 IGT - International Game Technology pepp0585 // (c) 1987 IGT - International Game Technology pepp0713 // (c) 1987 IGT - International Game Technology @@ -11375,6 +11390,7 @@ pebe0014 // (c) 1994 IGT - International Game Technology pebe0014a // (c) 1994 IGT - International Game Technology peke0017 // (c) 1994 IGT - International Game Technology peke1012 // (c) 1994 IGT - International Game Technology +peke1012a // (c) 1994 IGT - International Game Technology peke1013 // (c) 1994 IGT - International Game Technology peps0014 // (c) 1996 IGT - International Game Technology peps0021 // (c) 1996 IGT - International Game Technology @@ -11781,6 +11797,7 @@ showhand // (c) 2000 Astro Corp. showhanc // (c) 2000 Astro Corp. skilldrp // (c) 2002 Astro Corp. speeddrp // (c) 2003 Astro Corp. +dinodino // (c) 2003? Astro Corp. astoneag // (c) 2004? Astro Corp. winbingo // (c) 2005? Astro Corp. winbingoa // (c) 2005? Astro Corp. @@ -12249,7 +12266,7 @@ ssjkrpkr // (c) 1982 Southern Systems & Assembly, Ltd. fastdrwp // Stern? dphlunka // SMS Manufacturing Corp? dphlunkb // SMS Manufacturing Corp? -//pkii_dm // Unknown Poker PKII/DM (misplaced roms) +pkii_dm // Unknown Poker PKII/DM // Sanki Denshi Kogyo pachifev // (c) 1983? @@ -32160,3 +32177,5 @@ amusco // 1987, Amusco. cocoloco // 198?, Petaco S.A. alinvade + +joystand // 1997 Yuvo diff --git a/src/mame/audio/atarijsa.c b/src/mame/audio/atarijsa.c index 69180d61031..b4a8cc67501 100644 --- a/src/mame/audio/atarijsa.c +++ b/src/mame/audio/atarijsa.c @@ -629,6 +629,7 @@ atari_jsa_i_device::atari_jsa_i_device(const machine_config &mconfig, const char : atari_jsa_base_device(mconfig, ATARI_JSA_I, "Atari JSA I Sound Board", tag, owner, clock, "atjsa1", 2), m_pokey(*this, "pokey"), m_tms5220(*this, "tms"), + m_jsai(*this, "JSAI"), m_pokey_volume(1.0), m_tms5220_volume(1.0) { @@ -653,7 +654,7 @@ READ8_MEMBER( atari_jsa_i_device::rdio_r ) // 0x01 = coin 1 // - UINT8 result = ioport("JSAI")->read(); + UINT8 result = m_jsai->read(); if (!m_test_read_cb()) result ^= 0x80; if (m_tms5220 != NULL && m_tms5220->readyq_r() == 0) @@ -841,6 +842,7 @@ void atari_jsa_i_device::update_all_volumes() atari_jsa_ii_device::atari_jsa_ii_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : atari_jsa_oki_base_device(mconfig, ATARI_JSA_II, "Atari JSA II Sound Board", tag, owner, clock, "atjsa2", 1) + , m_jsaii(*this, "JSAII") { } @@ -863,7 +865,7 @@ READ8_MEMBER( atari_jsa_ii_device::rdio_r ) // 0x01 = coin 1 // - UINT8 result = ioport("JSAII")->read(); + UINT8 result = m_jsaii->read(); if (!m_test_read_cb()) result ^= 0x80; @@ -904,11 +906,13 @@ ioport_constructor atari_jsa_ii_device::device_input_ports() const atari_jsa_iii_device::atari_jsa_iii_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : atari_jsa_oki_base_device(mconfig, ATARI_JSA_III, "Atari JSA III Sound Board", tag, owner, clock, "atjsa3", 1) + , m_jsaiii(*this, "JSAIII") { } atari_jsa_iii_device::atari_jsa_iii_device(const machine_config &mconfig, device_type devtype, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, int channels) : atari_jsa_oki_base_device(mconfig, devtype, name, tag, owner, clock, shortname, channels) + , m_jsaiii(*this, "JSAIII") { } @@ -931,7 +935,7 @@ READ8_MEMBER( atari_jsa_iii_device::rdio_r ) // 0x01 = coin R (active high) // - UINT8 result = ioport("JSAIII")->read(); + UINT8 result = m_jsaiii->read(); if (!m_test_read_cb()) result ^= 0x90; return result; diff --git a/src/mame/audio/atarijsa.h b/src/mame/audio/atarijsa.h index e1866d1c75c..3ae12a653dc 100644 --- a/src/mame/audio/atarijsa.h +++ b/src/mame/audio/atarijsa.h @@ -200,6 +200,7 @@ protected: // devices optional_device<pokey_device> m_pokey; optional_device<tms5220_device> m_tms5220; + required_ioport m_jsai; // internal state double m_pokey_volume; @@ -222,6 +223,8 @@ protected: // device level overrides virtual machine_config_constructor device_mconfig_additions() const; virtual ioport_constructor device_input_ports() const; + + required_ioport m_jsaii; }; @@ -245,6 +248,8 @@ protected: // device level overrides virtual machine_config_constructor device_mconfig_additions() const; virtual ioport_constructor device_input_ports() const; + + required_ioport m_jsaiii; }; diff --git a/src/mame/audio/cage.c b/src/mame/audio/cage.c index 9f3718e5114..7253f46de74 100644 --- a/src/mame/audio/cage.c +++ b/src/mame/audio/cage.c @@ -337,7 +337,7 @@ void atari_cage_device::update_serial() m_serial_period_per_word = bit_clock_period * (8 * (((tms32031_io_regs[SPORT_GLOBAL_CTL] >> 18) & 3) + 1)); /* compute the step value to stretch this to the sample_rate */ - freq = ATTOSECONDS_TO_HZ(m_serial_period_per_word.attoseconds) / DAC_BUFFER_CHANNELS; + freq = ATTOSECONDS_TO_HZ(m_serial_period_per_word.attoseconds()) / DAC_BUFFER_CHANNELS; if (freq > 0 && freq < 100000) { dmadac_set_frequency(&m_dmadac[0], DAC_BUFFER_CHANNELS, freq); @@ -409,7 +409,7 @@ WRITE32_MEMBER( atari_cage_device::tms32031_io_w ) case SPORT_DATA_TX: #if (DAC_BUFFER_CHANNELS == 4) - if ((int)ATTOSECONDS_TO_HZ(m_serial_period_per_word.attoseconds) == 22050*4 && (tms32031_io_regs[SPORT_RX_CTL] & 0xff) == 0x62) + if ((int)ATTOSECONDS_TO_HZ(m_serial_period_per_word.attoseconds()) == 22050*4 && (tms32031_io_regs[SPORT_RX_CTL] & 0xff) == 0x62) tms32031_io_regs[SPORT_RX_CTL] ^= 0x800; #endif break; diff --git a/src/mame/audio/dcs.c b/src/mame/audio/dcs.c index 591a17647eb..3e41f761ade 100644 --- a/src/mame/audio/dcs.c +++ b/src/mame/audio/dcs.c @@ -1955,7 +1955,7 @@ void dcs_audio_device::recompute_sample_rate() /* now put it down to samples, so we know what the channel frequency has to be */ sample_period = sample_period * (16 * m_channels); - dmadac_set_frequency(&m_dmadac[0], m_channels, ATTOSECONDS_TO_HZ(sample_period.attoseconds)); + dmadac_set_frequency(&m_dmadac[0], m_channels, ATTOSECONDS_TO_HZ(sample_period.attoseconds())); dmadac_enable(&m_dmadac[0], m_channels, 1); /* fire off a timer which will hit every half-buffer */ diff --git a/src/mame/audio/micro3d.c b/src/mame/audio/micro3d.c index e0ba3722bc9..b2bd2cb09ec 100644 --- a/src/mame/audio/micro3d.c +++ b/src/mame/audio/micro3d.c @@ -343,7 +343,7 @@ WRITE8_MEMBER(micro3d_state::micro3d_sound_io_w) { case 0x01: { - micro3d_sound_device *noise = machine().device<micro3d_sound_device>(data & 4 ? "noise_2" : "noise_1"); + micro3d_sound_device *noise = (data & 4) ? m_noise_2 : m_noise_1; noise->noise_sh_w(data); break; } @@ -360,7 +360,7 @@ READ8_MEMBER(micro3d_state::micro3d_sound_io_r) { switch (offset) { - case 0x01: return (m_sound_port_latch[offset] & 0x7f) | ioport("SOUND_SW")->read(); + case 0x01: return (m_sound_port_latch[offset] & 0x7f) | m_sound_sw->read(); case 0x03: return (m_sound_port_latch[offset] & 0xf7) | (m_upd7759->busy_r() ? 0x08 : 0); default: return 0; } diff --git a/src/mame/audio/targ.c b/src/mame/audio/targ.c index 3ebfe9b2708..ab66fe7246b 100644 --- a/src/mame/audio/targ.c +++ b/src/mame/audio/targ.c @@ -36,7 +36,13 @@ static const INT16 sine_wave[32] = void exidy_state::adjust_sample(UINT8 freq) { m_tone_freq = freq; - + + if (!m_samples->playing(3)) + { + m_samples->set_volume(3, 0); + m_samples->start_raw(3, sine_wave, 32, 1000, true); + } + if ((m_tone_freq == 0xff) || (m_tone_freq == 0x00)) m_samples->set_volume(3, 0); else @@ -136,8 +142,13 @@ void exidy_state::common_audio_start(int freq) m_tone_freq = 0; m_tone_active = 0; - m_samples->set_volume(3, 0); - m_samples->start_raw(3, sine_wave, 32, 1000, true); + /* start_raw can't be called here: chan.source will be set by + samples_device::device_start and then nulled out by samples_device::device_reset + at the soft_reset stage of init_machine() and will never be set again. + Thus, I've moved it to exidy_state::adjust_sample() were it will be set after + machine initialization. */ + //m_samples->set_volume(3, 0); + //m_samples->start_raw(3, sine_wave, 32, 1000, true); save_item(NAME(m_port_1_last)); save_item(NAME(m_port_2_last)); diff --git a/src/mame/drivers/1945kiii.c b/src/mame/drivers/1945kiii.c index fdcd17cc4f0..44564dccd8a 100644 --- a/src/mame/drivers/1945kiii.c +++ b/src/mame/drivers/1945kiii.c @@ -70,7 +70,6 @@ public: required_shared_ptr<UINT16> m_spriteram_1; required_shared_ptr<UINT16> m_spriteram_2; required_shared_ptr<UINT16> m_bgram; -// UINT16 * m_paletteram16; // currently this uses generic palette handling /* video-related */ tilemap_t *m_bg_tilemap; @@ -162,7 +161,7 @@ static ADDRESS_MAP_START( k3_map, AS_PROGRAM, 16, k3_state ) AM_RANGE(0x000000, 0x0fffff) AM_ROM // ROM AM_RANGE(0x100000, 0x10ffff) AM_RAM // Main Ram - AM_RANGE(0x200000, 0x200fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") // palette + AM_RANGE(0x200000, 0x200fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0x240000, 0x240fff) AM_RAM AM_SHARE("spritera1") AM_RANGE(0x280000, 0x280fff) AM_RAM AM_SHARE("spritera2") AM_RANGE(0x2c0000, 0x2c0fff) AM_RAM_WRITE(k3_bgram_w) AM_SHARE("bgram") diff --git a/src/mame/drivers/8080bw.c b/src/mame/drivers/8080bw.c index 31bac5abeee..a17fe5f1665 100644 --- a/src/mame/drivers/8080bw.c +++ b/src/mame/drivers/8080bw.c @@ -421,6 +421,8 @@ static MACHINE_CONFIG_DERIVED_CLASS( invadpt2, mw8080bw_root, _8080bw_state ) MCFG_SCREEN_MODIFY("screen") MCFG_SCREEN_UPDATE_DRIVER(_8080bw_state, screen_update_invadpt2) + MCFG_PALETTE_ADD_3BIT_RBG("palette") + /* sound hardware */ MCFG_FRAGMENT_ADD(invaders_samples_audio) MACHINE_CONFIG_END @@ -623,6 +625,8 @@ static MACHINE_CONFIG_DERIVED_CLASS( cosmo, mw8080bw_root, _8080bw_state ) MCFG_SCREEN_MODIFY("screen") MCFG_SCREEN_UPDATE_DRIVER(_8080bw_state, screen_update_cosmo) + MCFG_PALETTE_ADD_3BIT_RGB("palette") + /* sound hardware */ MCFG_FRAGMENT_ADD(invaders_samples_audio) MACHINE_CONFIG_END @@ -784,6 +788,8 @@ MACHINE_CONFIG_START( spacecom, _8080bw_state ) MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 28*8-1) MCFG_SCREEN_UPDATE_DRIVER(_8080bw_state, screen_update_spacecom) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + /* sound hardware */ MCFG_FRAGMENT_ADD(invaders_audio) MACHINE_CONFIG_END @@ -893,6 +899,8 @@ static MACHINE_CONFIG_DERIVED_CLASS( invrvnge, mw8080bw_root, _8080bw_state ) MCFG_SCREEN_MODIFY("screen") MCFG_SCREEN_UPDATE_DRIVER(_8080bw_state, screen_update_invadpt2) + MCFG_PALETTE_ADD_3BIT_RBG("palette") + /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") @@ -1056,6 +1064,8 @@ static MACHINE_CONFIG_DERIVED_CLASS( lrescue, mw8080bw_root, _8080bw_state ) MCFG_SCREEN_MODIFY("screen") MCFG_SCREEN_UPDATE_DRIVER(_8080bw_state, screen_update_invadpt2) + MCFG_PALETTE_ADD_3BIT_RBG("palette") + /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") @@ -1385,6 +1395,8 @@ static MACHINE_CONFIG_DERIVED_CLASS( schaser, mw8080bw_root, _8080bw_state ) MCFG_SCREEN_MODIFY("screen") MCFG_SCREEN_UPDATE_DRIVER(_8080bw_state, screen_update_schaser) + MCFG_PALETTE_ADD_3BIT_RBG("palette") + /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") @@ -1490,6 +1502,8 @@ static MACHINE_CONFIG_DERIVED_CLASS( schasercv, mw8080bw_root, _8080bw_state ) MCFG_SCREEN_MODIFY("screen") MCFG_SCREEN_UPDATE_DRIVER(_8080bw_state, screen_update_schasercv) + MCFG_PALETTE_ADD_3BIT_RBG("palette") + /* sound hardware */ MCFG_FRAGMENT_ADD(invaders_samples_audio) @@ -1570,6 +1584,9 @@ static MACHINE_CONFIG_DERIVED_CLASS( sflush, mw8080bw_root, _8080bw_state ) /* video hardware */ MCFG_SCREEN_MODIFY("screen") MCFG_SCREEN_UPDATE_DRIVER(_8080bw_state, screen_update_sflush) + + MCFG_PALETTE_ADD("palette", 8) + MCFG_PALETTE_INIT_OWNER(_8080bw_state, sflush) MACHINE_CONFIG_END @@ -1670,6 +1687,8 @@ static MACHINE_CONFIG_DERIVED_CLASS( lupin3, mw8080bw_root, _8080bw_state ) MCFG_SCREEN_MODIFY("screen") MCFG_SCREEN_UPDATE_DRIVER(_8080bw_state, screen_update_indianbt) + MCFG_PALETTE_ADD_3BIT_RGB("palette") + /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") @@ -1714,6 +1733,8 @@ static MACHINE_CONFIG_DERIVED_CLASS( lupin3a, mw8080bw_root, _8080bw_state ) MCFG_SCREEN_MODIFY("screen") MCFG_SCREEN_UPDATE_DRIVER(_8080bw_state, screen_update_lupin3) + MCFG_PALETTE_ADD_3BIT_RBG("palette") + /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") @@ -1865,6 +1886,8 @@ static MACHINE_CONFIG_DERIVED_CLASS( polaris, mw8080bw_root, _8080bw_state ) MCFG_SCREEN_MODIFY("screen") MCFG_SCREEN_UPDATE_DRIVER(_8080bw_state, screen_update_polaris) + MCFG_PALETTE_ADD_3BIT_RBG("palette") + /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") @@ -1989,6 +2012,8 @@ static MACHINE_CONFIG_DERIVED_CLASS( ballbomb, mw8080bw_root, _8080bw_state ) MCFG_SCREEN_MODIFY("screen") MCFG_SCREEN_UPDATE_DRIVER(_8080bw_state, screen_update_ballbomb) + MCFG_PALETTE_ADD_3BIT_RBG("palette") + /* sound hardware */ MCFG_FRAGMENT_ADD(invaders_samples_audio) @@ -2230,6 +2255,8 @@ static MACHINE_CONFIG_DERIVED_CLASS( indianbt, mw8080bw_root, _8080bw_state ) MCFG_SCREEN_MODIFY("screen") MCFG_SCREEN_UPDATE_DRIVER(_8080bw_state, screen_update_indianbt) + MCFG_PALETTE_ADD_3BIT_RGB("palette") + /* sound hardware */ MCFG_FRAGMENT_ADD(invaders_samples_audio) @@ -2253,6 +2280,8 @@ static MACHINE_CONFIG_DERIVED_CLASS( indianbtbr, mw8080bw_root, _8080bw_state ) MCFG_SCREEN_MODIFY("screen") MCFG_SCREEN_UPDATE_DRIVER(_8080bw_state, screen_update_indianbt) + MCFG_PALETTE_ADD_3BIT_RGB("palette") + /* sound hardware */ MCFG_FRAGMENT_ADD(invaders_samples_audio) MACHINE_CONFIG_END @@ -2324,6 +2353,8 @@ static MACHINE_CONFIG_DERIVED_CLASS( steelwkr, mw8080bw_root, _8080bw_state ) MCFG_SCREEN_MODIFY("screen") MCFG_SCREEN_UPDATE_DRIVER(_8080bw_state, screen_update_invadpt2) + MCFG_PALETTE_ADD_3BIT_RBG("palette") + /* sound hardware */ MCFG_FRAGMENT_ADD(invaders_samples_audio) MACHINE_CONFIG_END @@ -2499,6 +2530,8 @@ MACHINE_CONFIG_START( shuttlei, _8080bw_state ) MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 24*8-1) MCFG_SCREEN_UPDATE_DRIVER(_8080bw_state, screen_update_shuttlei) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + /* sound hardware */ MCFG_FRAGMENT_ADD(invaders_samples_audio) MACHINE_CONFIG_END diff --git a/src/mame/drivers/88games.c b/src/mame/drivers/88games.c index 08536b0cb12..81695376892 100644 --- a/src/mame/drivers/88games.c +++ b/src/mame/drivers/88games.c @@ -285,10 +285,7 @@ void _88games_state::machine_start() save_item(NAME(m_videobank)); save_item(NAME(m_zoomreadroms)); save_item(NAME(m_speech_chip)); - save_item(NAME(m_layer_colorbase)); save_item(NAME(m_k88games_priority)); - save_item(NAME(m_sprite_colorbase)); - save_item(NAME(m_zoom_colorbase)); } void _88games_state::machine_reset() @@ -297,11 +294,6 @@ void _88games_state::machine_reset() m_zoomreadroms = 0; m_speech_chip = 0; m_k88games_priority = 0; - m_layer_colorbase[0] = 64; - m_layer_colorbase[1] = 0; - m_layer_colorbase[2] = 16; - m_sprite_colorbase = 32; - m_zoom_colorbase = 48; } static MACHINE_CONFIG_START( 88games, _88games_state ) @@ -336,6 +328,7 @@ static MACHINE_CONFIG_START( 88games, _88games_state ) MCFG_DEVICE_ADD("k051960", K051960, 0) MCFG_GFX_PALETTE("palette") + MCFG_K051960_SCREEN_TAG("screen") MCFG_K051960_CB(_88games_state, sprite_callback) MCFG_DEVICE_ADD("k051316", K051316, 0) diff --git a/src/mame/drivers/aerofgt.c b/src/mame/drivers/aerofgt.c index 9a758583b3c..67f50891279 100644 --- a/src/mame/drivers/aerofgt.c +++ b/src/mame/drivers/aerofgt.c @@ -2739,7 +2739,7 @@ GAME( 1997, wbbc97, 0, wbbc97, wbbc97, driver_device, 0, ROT0, "C GAME( 1991, karatblz, 0, karatblz, karatblz, driver_device, 0, ROT0, "Video System Co.", "Karate Blazers (World)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) GAME( 1991, karatblzu,karatblz, karatblz, karatblz, driver_device, 0, ROT0, "Video System Co.", "Karate Blazers (US)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) -GAME( 1991, karatblzj,karatblz, karatblz, karatblz, driver_device, 0, ROT0, "Video System Co.", "Karate Blazers (Japan)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) +GAME( 1991, karatblzj,karatblz, karatblz, karatblz, driver_device, 0, ROT0, "Video System Co.", "Toshin Blazers (Japan)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) GAME( 1991, karatblzbl,karatblz,karatblzbl,karatblz,driver_device, 0, ROT0, "bootleg", "Karate Blazers (bootleg)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL | MACHINE_NO_SOUND ) GAME( 1991, turbofrc, 0, turbofrc, turbofrc, driver_device, 0, ROT270, "Video System Co.", "Turbo Force (old revision)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) diff --git a/src/mame/drivers/ajax.c b/src/mame/drivers/ajax.c index 00f89e2a64d..f9a8bcb9e6c 100644 --- a/src/mame/drivers/ajax.c +++ b/src/mame/drivers/ajax.c @@ -167,9 +167,8 @@ WRITE8_MEMBER(ajax_state::volume_callback1) static MACHINE_CONFIG_START( ajax, ajax_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", KONAMI, 3000000) /* 12/4 MHz*/ + MCFG_CPU_ADD("maincpu", KONAMI, XTAL_24MHz/2/4) /* 052001 12/4 MHz*/ MCFG_CPU_PROGRAM_MAP(ajax_main_map) - MCFG_CPU_VBLANK_INT_DRIVER("screen", ajax_state, ajax_interrupt) /* IRQs triggered by the 051960 */ MCFG_CPU_ADD("sub", M6809, 3000000) /* ? */ MCFG_CPU_PROGRAM_MAP(ajax_sub_map) @@ -181,10 +180,9 @@ static MACHINE_CONFIG_START( ajax, ajax_state ) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(64*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(14*8, (64-14)*8-1, 2*8, 30*8-1 ) + MCFG_SCREEN_RAW_PARAMS(XTAL_24MHz/3, 528, 112, 400, 256, 16, 240) +// 6MHz dotclock is more realistic, however needs drawing updates. replace when ready +// MCFG_SCREEN_RAW_PARAMS(XTAL_24MHz/4, 396, hbend, hbstart, 256, 16, 240) MCFG_SCREEN_UPDATE_DRIVER(ajax_state, screen_update_ajax) MCFG_SCREEN_PALETTE("palette") @@ -198,7 +196,9 @@ static MACHINE_CONFIG_START( ajax, ajax_state ) MCFG_DEVICE_ADD("k051960", K051960, 0) MCFG_GFX_PALETTE("palette") + MCFG_K051960_SCREEN_TAG("screen") MCFG_K051960_CB(ajax_state, sprite_callback) + MCFG_K051960_IRQ_HANDLER(INPUTLINE("maincpu", KONAMI_IRQ_LINE)) MCFG_DEVICE_ADD("k051316", K051316, 0) MCFG_GFX_PALETTE("palette") diff --git a/src/mame/drivers/aliens.c b/src/mame/drivers/aliens.c index 83731fc67d0..79c0776aea3 100644 --- a/src/mame/drivers/aliens.c +++ b/src/mame/drivers/aliens.c @@ -16,11 +16,6 @@ Preliminary driver by: #include "includes/konamipt.h" #include "includes/aliens.h" -INTERRUPT_GEN_MEMBER(aliens_state::aliens_interrupt) -{ - if (m_k051960->k051960_is_irq_enabled()) - device.execute().set_input_line(KONAMI_IRQ_LINE, HOLD_LINE); -} WRITE8_MEMBER(aliens_state::aliens_coin_counter_w) { @@ -90,7 +85,7 @@ WRITE8_MEMBER(aliens_state::k052109_051960_w) static ADDRESS_MAP_START( aliens_map, AS_PROGRAM, 8, aliens_state ) AM_RANGE(0x0000, 0x03ff) AM_DEVICE("bank0000", address_map_bank_device, amap8) AM_RANGE(0x0400, 0x1fff) AM_RAM - AM_RANGE(0x2000, 0x3fff) AM_ROMBANK("bank1") /* banked ROM */ + AM_RANGE(0x2000, 0x3fff) AM_ROMBANK("rombank") /* banked ROM */ AM_RANGE(0x5f80, 0x5f80) AM_READ_PORT("DSW3") AM_RANGE(0x5f81, 0x5f81) AM_READ_PORT("P1") AM_RANGE(0x5f82, 0x5f82) AM_READ_PORT("P2") @@ -179,8 +174,8 @@ WRITE8_MEMBER(aliens_state::volume_callback) void aliens_state::machine_start() { - membank("bank1")->configure_entries(0, 24, memregion("maincpu")->base(), 0x2000); - membank("bank1")->set_entry(0); + m_rombank->configure_entries(0, 24, memregion("maincpu")->base(), 0x2000); + m_rombank->set_entry(0); } void aliens_state::machine_reset() @@ -190,15 +185,14 @@ void aliens_state::machine_reset() WRITE8_MEMBER( aliens_state::banking_callback ) { - membank("bank1")->set_entry(data & 0x1f); + m_rombank->set_entry(data & 0x1f); } static MACHINE_CONFIG_START( aliens, aliens_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", KONAMI, XTAL_24MHz/8) /* 052001 (verified on pcb) */ + MCFG_CPU_ADD("maincpu", KONAMI, XTAL_24MHz/2/4) /* 052001 (verified on pcb) */ MCFG_CPU_PROGRAM_MAP(aliens_map) - MCFG_CPU_VBLANK_INT_DRIVER("screen", aliens_state, aliens_interrupt) MCFG_KONAMICPU_LINE_CB(WRITE8(aliens_state, banking_callback)) MCFG_CPU_ADD("audiocpu", Z80, XTAL_3_579545MHz) /* verified on pcb */ @@ -213,10 +207,9 @@ static MACHINE_CONFIG_START( aliens, aliens_state ) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(59.17) /* verified on pcb */ - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(64*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(14*8, (64-14)*8-1, 2*8, 30*8-1 ) + MCFG_SCREEN_RAW_PARAMS(XTAL_24MHz/3, 528, 112, 400, 256, 16, 240) // measured 59.17 +// 6MHz dotclock is more realistic, however needs drawing updates. replace when ready +// MCFG_SCREEN_RAW_PARAMS(XTAL_24MHz/4, 396, hbend, hbstart, 256, 16, 240) MCFG_SCREEN_UPDATE_DRIVER(aliens_state, screen_update_aliens) MCFG_SCREEN_PALETTE("palette") @@ -230,7 +223,9 @@ static MACHINE_CONFIG_START( aliens, aliens_state ) MCFG_DEVICE_ADD("k051960", K051960, 0) MCFG_GFX_PALETTE("palette") + MCFG_K051960_SCREEN_TAG("screen") MCFG_K051960_CB(aliens_state, sprite_callback) + MCFG_K051960_IRQ_HANDLER(INPUTLINE("maincpu", KONAMI_IRQ_LINE)) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") diff --git a/src/mame/drivers/amspdwy.c b/src/mame/drivers/amspdwy.c index 0cd096dc5d6..9a846b1dc95 100644 --- a/src/mame/drivers/amspdwy.c +++ b/src/mame/drivers/amspdwy.c @@ -77,7 +77,7 @@ WRITE8_MEMBER(amspdwy_state::amspdwy_sound_w) static ADDRESS_MAP_START( amspdwy_map, AS_PROGRAM, 8, amspdwy_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0x801f) AM_WRITE(amspdwy_paletteram_w) AM_SHARE("palette") + AM_RANGE(0x8000, 0x801f) AM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0x9000, 0x93ff) AM_MIRROR(0x0400) AM_RAM_WRITE(amspdwy_videoram_w) AM_SHARE("videoram") AM_RANGE(0x9800, 0x9bff) AM_RAM_WRITE(amspdwy_colorram_w) AM_SHARE("colorram") AM_RANGE(0x9c00, 0x9fff) AM_RAM // unused? @@ -272,7 +272,7 @@ static MACHINE_CONFIG_START( amspdwy, amspdwy_state ) MCFG_GFXDECODE_ADD("gfxdecode", "palette", amspdwy) MCFG_PALETTE_ADD("palette", 32) - MCFG_PALETTE_FORMAT(BBGGGRRR) + MCFG_PALETTE_FORMAT(BBGGGRRR_inverted) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") diff --git a/src/mame/drivers/amusco.c b/src/mame/drivers/amusco.c index de0ba5cea5a..1cd32549340 100644 --- a/src/mame/drivers/amusco.c +++ b/src/mame/drivers/amusco.c @@ -97,7 +97,6 @@ public: DECLARE_WRITE16_MEMBER(amusco_videoram_w); TILE_GET_INFO_MEMBER(get_bg_tile_info); virtual void video_start(); - DECLARE_PALETTE_INIT(amusco); DECLARE_READ8_MEMBER(mc6845_r); DECLARE_WRITE8_MEMBER(mc6845_w); DECLARE_WRITE16_MEMBER(vram_w); @@ -113,7 +112,6 @@ public: INTERRUPT_GEN_MEMBER(amusco_timer_irq); UINT16 m_mc6845_address; UINT16 m_video_update_address; - DECLARE_PALETTE_INIT(amusco_palette_init); }; @@ -125,18 +123,6 @@ WRITE16_MEMBER(amusco_state::amusco_videoram_w) { } -PALETTE_INIT_MEMBER(amusco_state, amusco_palette_init) -{ - int i; - - for (i = 0; i < 8; i++) - { - palette.set_pen_color(i, pal1bit(i >> 2), pal1bit(i >> 0), pal1bit(i >> 1)); - } -} - - - TILE_GET_INFO_MEMBER(amusco_state::get_bg_tile_info) { /* - bits - @@ -166,10 +152,6 @@ UINT32 amusco_state::screen_update_amusco(screen_device &screen, bitmap_ind16 &b return 0; } -PALETTE_INIT_MEMBER(amusco_state, amusco) -{ -} - /************************** * Read / Write Handlers * @@ -528,8 +510,7 @@ static MACHINE_CONFIG_START( amusco, amusco_state ) MCFG_SCREEN_PALETTE("palette") MCFG_GFXDECODE_ADD("gfxdecode", "palette", amusco) - MCFG_PALETTE_ADD("palette", 8) - MCFG_PALETTE_INIT_OWNER(amusco_state, amusco_palette_init) + MCFG_PALETTE_ADD_3BIT_GBR("palette") MCFG_MC6845_ADD("crtc", R6545_1, "screen", CRTC_CLOCK) /* guess */ MCFG_MC6845_SHOW_BORDER_AREA(false) @@ -540,7 +521,6 @@ static MACHINE_CONFIG_START( amusco, amusco_state ) MCFG_SPEAKER_STANDARD_MONO("mono") MCFG_SOUND_ADD("sn", SN76489, SND_CLOCK) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) - MACHINE_CONFIG_END diff --git a/src/mame/drivers/astinvad.c b/src/mame/drivers/astinvad.c index 4e4fe8e092d..4f4be0977a2 100644 --- a/src/mame/drivers/astinvad.c +++ b/src/mame/drivers/astinvad.c @@ -57,6 +57,7 @@ public: m_maincpu(*this, "maincpu"), m_ppi8255_0(*this, "ppi8255_0"), m_ppi8255_1(*this, "ppi8255_1"), + m_palette(*this, "palette"), m_videoram(*this, "videoram"), m_samples(*this, "samples"), m_screen(*this, "screen"){ } @@ -64,6 +65,7 @@ public: required_device<cpu_device> m_maincpu; optional_device<i8255_device> m_ppi8255_0; optional_device<i8255_device> m_ppi8255_1; + required_device<palette_device> m_palette; required_shared_ptr<UINT8> m_videoram; UINT8 * m_colorram; @@ -144,17 +146,16 @@ WRITE8_MEMBER(astinvad_state::spaceint_videoram_w) void astinvad_state::plot_byte( bitmap_rgb32 &bitmap, UINT8 y, UINT8 x, UINT8 data, UINT8 color ) { - pen_t fore_pen = rgb_t(pal1bit(color >> 0), pal1bit(color >> 2), pal1bit(color >> 1)); UINT8 flip_xor = m_screen_flip & 7; - bitmap.pix32(y, x + (0 ^ flip_xor)) = (data & 0x01) ? fore_pen : 0; - bitmap.pix32(y, x + (1 ^ flip_xor)) = (data & 0x02) ? fore_pen : 0; - bitmap.pix32(y, x + (2 ^ flip_xor)) = (data & 0x04) ? fore_pen : 0; - bitmap.pix32(y, x + (3 ^ flip_xor)) = (data & 0x08) ? fore_pen : 0; - bitmap.pix32(y, x + (4 ^ flip_xor)) = (data & 0x10) ? fore_pen : 0; - bitmap.pix32(y, x + (5 ^ flip_xor)) = (data & 0x20) ? fore_pen : 0; - bitmap.pix32(y, x + (6 ^ flip_xor)) = (data & 0x40) ? fore_pen : 0; - bitmap.pix32(y, x + (7 ^ flip_xor)) = (data & 0x80) ? fore_pen : 0; + bitmap.pix32(y, x + (0 ^ flip_xor)) = (data & 0x01) ? m_palette->pen_color(color) : rgb_t::black; + bitmap.pix32(y, x + (1 ^ flip_xor)) = (data & 0x02) ? m_palette->pen_color(color) : rgb_t::black; + bitmap.pix32(y, x + (2 ^ flip_xor)) = (data & 0x04) ? m_palette->pen_color(color) : rgb_t::black; + bitmap.pix32(y, x + (3 ^ flip_xor)) = (data & 0x08) ? m_palette->pen_color(color) : rgb_t::black; + bitmap.pix32(y, x + (4 ^ flip_xor)) = (data & 0x10) ? m_palette->pen_color(color) : rgb_t::black; + bitmap.pix32(y, x + (5 ^ flip_xor)) = (data & 0x20) ? m_palette->pen_color(color) : rgb_t::black; + bitmap.pix32(y, x + (6 ^ flip_xor)) = (data & 0x40) ? m_palette->pen_color(color) : rgb_t::black; + bitmap.pix32(y, x + (7 ^ flip_xor)) = (data & 0x80) ? m_palette->pen_color(color) : rgb_t::black; } @@ -170,7 +171,7 @@ UINT32 astinvad_state::screen_update_astinvad(screen_device &screen, bitmap_rgb3 { UINT8 color = color_prom[((y & 0xf8) << 2) | (x >> 3)] >> (m_screen_flip ? 0 : 4); UINT8 data = m_videoram[(((y ^ m_screen_flip) + yoffs) << 5) | ((x ^ m_screen_flip) >> 3)]; - plot_byte(bitmap, y, x, data, m_screen_red ? 1 : color); + plot_byte(bitmap, y, x, data, m_screen_red ? 1 : color & 0x07); } return 0; @@ -651,6 +652,8 @@ static MACHINE_CONFIG_START( kamikaze, astinvad_state ) MCFG_SCREEN_RAW_PARAMS(VIDEO_CLOCK, 320, 0, 256, 256, 32, 256) MCFG_SCREEN_UPDATE_DRIVER(astinvad_state, screen_update_astinvad) + MCFG_PALETTE_ADD_3BIT_RBG("palette") + /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") @@ -695,6 +698,8 @@ static MACHINE_CONFIG_START( spaceint, astinvad_state ) MCFG_SCREEN_REFRESH_RATE(60) MCFG_SCREEN_UPDATE_DRIVER(astinvad_state, screen_update_spaceint) + MCFG_PALETTE_ADD_3BIT_RBG("palette") + /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") diff --git a/src/mame/drivers/astrcorp.c b/src/mame/drivers/astrcorp.c index 76cf1ad76b2..caa7bbfe118 100644 --- a/src/mame/drivers/astrcorp.c +++ b/src/mame/drivers/astrcorp.c @@ -21,6 +21,7 @@ Year + Game PCB ID CPU Video Chips 02 Skill Drop GA None JX-1689F1028N ASTRO V02 pLSI1016-60LJ 02? Keno 21 ? ASTRO V102? ASTRO V05 ASTRO F02? not dumped 03 Speed Drop None JX-1689HP ASTRO V05 pLSI1016-60LJ +03? Dino Dino T-3802A ASTRO V102PX-010? ASTRO V05 ASTRO F02 2003-03-12 Encrypted 04? Stone Age L1 ASTRO V102PX-012? ASTRO V05x2 ASTRO F02 2004-09-04 Encrypted 05? Zoo M1.1 ASTRO V102PX-005? ASTRO V06 ASTRO F02 2005-02-18 Encrypted 05? Win Win Bingo M1.2 ASTRO V102PX-006? ASTRO V06 ASTRO F02 2005-09-17 Encrypted @@ -47,17 +48,25 @@ class astrocorp_state : public driver_device public: astrocorp_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_spriteram(*this, "spriteram"), m_maincpu(*this, "maincpu"), m_oki(*this, "oki"), m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_spriteram(*this, "spriteram") + { } - /* memory pointers */ + // devices + required_device<cpu_device> m_maincpu; + required_device<okim6295_device> m_oki; + required_device<gfxdecode_device> m_gfxdecode; + required_device<screen_device> m_screen; + required_device<palette_device> m_palette; + + // memory pointers required_shared_ptr<UINT16> m_spriteram; - /* video-related */ + // video-related bitmap_ind16 m_bitmap; UINT16 m_screen_enable; UINT16 m_draw_sprites; @@ -76,11 +85,6 @@ public: UINT32 screen_update_astrocorp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_DEVICE_CALLBACK_MEMBER(skilldrp_scanline); void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); - required_device<cpu_device> m_maincpu; - required_device<okim6295_device> m_oki; - required_device<gfxdecode_device> m_gfxdecode; - required_device<screen_device> m_screen; - required_device<palette_device> m_palette; }; /*************************************************************************** @@ -92,8 +96,8 @@ VIDEO_START_MEMBER(astrocorp_state,astrocorp) m_screen->register_screen_bitmap(m_bitmap); save_item(NAME(m_bitmap)); - save_item (NAME(m_screen_enable)); - save_item (NAME(m_draw_sprites)); + save_item(NAME(m_screen_enable)); + save_item(NAME(m_draw_sprites)); } /*************************************************************************** @@ -1121,6 +1125,53 @@ ROM_START( astoneag ) ROM_LOAD( "93c46.ic99", 0x0000, 0x0080, CRC(2fd85a9b) SHA1(3240e40debf5af15f08072b76d6910808d3d282f) ) ROM_END +/*************************************************************************** + +Dino Dino +Astro Corp. + +PCB Layout +---------- + +ASTRO T-3802A PCB with ASTRO F02 2003-03-12 +|--------------------------------------------| +| |------| TDA2003 | +|ULN2003 |ASTRO | V62C51864 VOL | +| |F02 | ROM4 | +| |------| ROM2 | +|ULN2003 ROM3 M6295 | +| |-------| | +|8 |ASTRO | | +|L |V102PX | ROM5| +|I |-010 | | +|N |-------| |------| | +|E |ASTRO | | +|R ROM1 |V05 | | +| |------| | +| V62C51864 | +| 24MHz| +| 93C46 6116 6116 HM628128 | +| SW1 6116 6116 HM628128 | +|--------------------------------------------| + +***************************************************************************/ + +ROM_START( dinodino ) + ROM_REGION( 0x40000, "maincpu", 0 ) + ROM_LOAD16_BYTE( "dd_rom1.u20", 0x00000, 0x20000, CRC(056613dd) SHA1(e8481177b1dacda222fe4fae2b50841ddb0c87ba) ) + ROM_LOAD16_BYTE( "dd_rom2.u19", 0x00001, 0x20000, CRC(575519c5) SHA1(249fe33b6ea0bc154125a988315f571a30b9375c) ) + + ROM_REGION( 0x400000, "sprites", 0 ) + ROM_LOAD( "dd_rom3.u26", 0x000000, 0x200000, CRC(47c95b43) SHA1(43e9a13c38f2f7d13dd4dcb105c65e43b18ccdbf) ) + ROM_LOAD( "dd_rom4.u24", 0x200000, 0x200000, CRC(2cf4be21) SHA1(831d7d125c4161b42b017a69fc05e30a51172620) ) + + ROM_REGION( 0x80000, "oki", 0 ) + ROM_LOAD( "dd_rom5.u33", 0x00000, 0x80000, CRC(482e456a) SHA1(c7111522383c4e1fd98b0f759153be98dcbe06c1) ) + + ROM_REGION16_BE( 0x80, "eeprom", 0 ) + ROM_LOAD( "93c46.u10", 0x0000, 0x0080, CRC(6769bfb8) SHA1(bf6b905805c2c61a89fbc4c046b23069431e4709) ) +ROM_END + DRIVER_INIT_MEMBER(astrocorp_state,showhand) { @@ -1308,6 +1359,7 @@ GAME( 2002, skilldrp, 0, skilldrp, skilldrp, driver_device, 0, GAME( 2003, speeddrp, 0, speeddrp, skilldrp, driver_device, 0, ROT0, "Astro Corp.", "Speed Drop (Ver. 1.06)", MACHINE_SUPPORTS_SAVE ) // Encrypted games (not working): +GAME( 2003?, dinodino, 0, skilldrp, skilldrp, driver_device, 0, ROT0, "Astro Corp.", "Dino Dino", MACHINE_NOT_WORKING ) GAME( 2004?, astoneag, 0, skilldrp, skilldrp, astrocorp_state, astoneag, ROT0, "Astro Corp.", "Stone Age (Astro, Ver. ENG.03.A)", MACHINE_NOT_WORKING ) GAME( 2005?, winbingo, 0, skilldrp, skilldrp, driver_device, 0, ROT0, "Astro Corp.", "Win Win Bingo (set 1)", MACHINE_NOT_WORKING ) GAME( 2005?, winbingoa, winbingo, skilldrp, skilldrp, driver_device, 0, ROT0, "Astro Corp.", "Win Win Bingo (set 2)", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/astrocde.c b/src/mame/drivers/astrocde.c index 3b5544c8785..0012d083afd 100644 --- a/src/mame/drivers/astrocde.c +++ b/src/mame/drivers/astrocde.c @@ -231,10 +231,11 @@ WRITE8_MEMBER(astrocde_state::seawolf2_sound_2_w)// Port 41 * *************************************/ +IOPORT_ARRAY_MEMBER(astrocde_state::trackball_inputs) { "TRACKX2", "TRACKY2", "TRACKX1", "TRACKY1" }; + CUSTOM_INPUT_MEMBER(astrocde_state::ebases_trackball_r) { - static const char *const names[] = { "TRACKX2", "TRACKY2", "TRACKX1", "TRACKY1" }; - return ioport(names[m_input_select])->read(); + return m_trackball[m_input_select]->read(); } @@ -261,7 +262,7 @@ READ8_MEMBER(astrocde_state::spacezap_io_r) { coin_counter_w(machine(), 0, (offset >> 8) & 1); coin_counter_w(machine(), 1, (offset >> 9) & 1); - return ioport("P3HANDLE")->read_safe(0xff); + return m_p3handle ? m_p3handle->read() : 0xff; } @@ -394,51 +395,32 @@ READ8_MEMBER(astrocde_state::profpac_io_2_r) } -WRITE8_MEMBER(astrocde_state::profpac_banksw_w) +WRITE8_MEMBER(astrocde_state::demndrgn_banksw_w) { int bank = (data >> 5) & 3; + m_bank4000->set_bank(bank); + m_bank8000->set_entry(bank); +} - /* this is accessed from I/O space but modifies program space, so we normalize here */ - address_space &prog_space = space.device().memory().space(AS_PROGRAM); - - /* remember the banking bits for save state support */ - m_profpac_bank = data; - - /* set the main banking */ - prog_space.install_read_bank(0x4000, 0xbfff, "bank1"); - membank("bank1")->set_base(memregion("user1")->base() + 0x8000 * bank); - /* bank 0 reads video RAM in the 4000-7FFF range */ - if (bank == 0) - prog_space.install_read_handler(0x4000, 0x7fff, read8_delegate(FUNC(astrocde_state::profpac_videoram_r), this)); +WRITE8_MEMBER(astrocde_state::profpac_banksw_w) +{ + demndrgn_banksw_w(space, 0, data); - /* if we have a 640k EPROM board, map that on top of the 4000-7FFF range if specified */ - if ((data & 0x80) && memregion("user2")->base() != NULL) + if (data & 0x80) { /* Note: There is a jumper which could change the base offset to 0xa8 instead */ - bank = data - 0x80; + int bank = data - 0x80; /* if the bank is in range, map the appropriate bank */ if (bank < 0x28) - { - prog_space.install_read_bank(0x4000, 0x7fff, "bank2"); - membank("bank2")->set_base(memregion("user2")->base() + 0x4000 * bank); - } + m_bank4000->set_bank(4 + bank); else - prog_space.unmap_read(0x4000, 0x7fff); + m_bank4000->set_bank(4 + 0x28); } } -void astrocde_state::profbank_banksw_restore() -{ - address_space &space = m_maincpu->space(AS_IO); - - profpac_banksw_w(space, 0, m_profpac_bank); -} - - - /************************************* * * Demons & Dragons specific input/output @@ -456,10 +438,12 @@ READ8_MEMBER(astrocde_state::demndrgn_io_r) } +IOPORT_ARRAY_MEMBER(astrocde_state::joystick_inputs) { "MOVEX", "MOVEY" }; + + CUSTOM_INPUT_MEMBER(astrocde_state::demndragn_joystick_r) { - static const char *const names[] = { "MOVEX", "MOVEY" }; - return ioport(names[m_input_select])->read(); + return m_joystick[m_input_select]->read(); } @@ -581,26 +565,35 @@ static ADDRESS_MAP_START( robby_map, AS_PROGRAM, 8, astrocde_state ) ADDRESS_MAP_END -static ADDRESS_MAP_START( profpac_map, AS_PROGRAM, 8, astrocde_state ) +static ADDRESS_MAP_START( demndrgn_map, AS_PROGRAM, 8, astrocde_state ) AM_RANGE(0x0000, 0x3fff) AM_ROM AM_RANGE(0x0000, 0x3fff) AM_WRITE(astrocade_funcgen_w) - AM_RANGE(0x4000, 0x7fff) AM_READWRITE(profpac_videoram_r, profpac_videoram_w) - AM_RANGE(0x4000, 0xbfff) AM_ROMBANK("bank1") + AM_RANGE(0x4000, 0x7fff) AM_DEVREAD("bank4000", address_map_bank_device, read8) AM_WRITE(profpac_videoram_w) + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank8000") AM_RANGE(0xc000, 0xdfff) AM_ROM - AM_RANGE(0xe000, 0xe1ff) AM_READWRITE(protected_ram_r, protected_ram_w) AM_SHARE("protected_ram") AM_RANGE(0xe000, 0xe7ff) AM_RAM AM_SHARE("nvram") AM_RANGE(0xe800, 0xffff) AM_RAM ADDRESS_MAP_END -static ADDRESS_MAP_START( demndrgn_map, AS_PROGRAM, 8, astrocde_state ) - AM_RANGE(0x0000, 0x3fff) AM_ROM - AM_RANGE(0x0000, 0x3fff) AM_WRITE(astrocade_funcgen_w) - AM_RANGE(0x4000, 0x7fff) AM_READWRITE(profpac_videoram_r, profpac_videoram_w) - AM_RANGE(0x4000, 0xbfff) AM_ROMBANK("bank1") - AM_RANGE(0xc000, 0xdfff) AM_ROM - AM_RANGE(0xe000, 0xe7ff) AM_RAM AM_SHARE("nvram") - AM_RANGE(0xe800, 0xffff) AM_RAM +static ADDRESS_MAP_START( profpac_map, AS_PROGRAM, 8, astrocde_state ) + AM_RANGE(0xe000, 0xe1ff) AM_READWRITE(protected_ram_r, protected_ram_w) AM_SHARE("protected_ram") + AM_IMPORT_FROM(demndrgn_map) +ADDRESS_MAP_END + + +static ADDRESS_MAP_START( bank4000_map, AS_PROGRAM, 8, astrocde_state ) + AM_RANGE(0x0000, 0x3fff) AM_READ(profpac_videoram_r) + AM_RANGE(0x4000, 0x7fff) AM_ROM AM_REGION("banks", 0x08000) + AM_RANGE(0x8000, 0xbfff) AM_ROM AM_REGION("banks", 0x10000) + AM_RANGE(0xc000, 0xffff) AM_ROM AM_REGION("banks", 0x18000) +ADDRESS_MAP_END + + +static ADDRESS_MAP_START( profpac_bank4000_map, AS_PROGRAM, 8, astrocde_state ) + AM_RANGE(0x10000, 0xaffff) AM_ROM AM_REGION("epromboard", 0) + AM_RANGE(0xb0000, 0xb3fff) AM_READNOP + AM_IMPORT_FROM(bank4000_map) ADDRESS_MAP_END @@ -656,7 +649,7 @@ static ADDRESS_MAP_START( port_map_16col_pattern_nosound, AS_IO, 8, astrocde_sta AM_RANGE(0x00bf, 0x00bf) AM_MIRROR(0xff00) AM_WRITE(profpac_page_select_w) AM_RANGE(0x00c3, 0x00c3) AM_MIRROR(0xff00) AM_READ(profpac_intercept_r) AM_RANGE(0x00c0, 0x00c5) AM_MIRROR(0xff00) AM_WRITE(profpac_screenram_ctrl_w) - AM_RANGE(0x00f3, 0x00f3) AM_MIRROR(0xff00) AM_WRITE(profpac_banksw_w) + AM_RANGE(0x00f3, 0x00f3) AM_MIRROR(0xff00) AM_WRITE(demndrgn_banksw_w) AM_RANGE(0xa55b, 0xa55b) AM_WRITE(protected_ram_enable_w) ADDRESS_MAP_END @@ -1250,6 +1243,13 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( astrocade_16color_base, astrocade_base ) /* basic machine hardware */ + MCFG_DEVICE_ADD("bank4000", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(bank4000_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) + MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(16) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x4000) + MCFG_NVRAM_ADD_0FILL("nvram") /* video hardware */ @@ -1417,6 +1417,10 @@ static MACHINE_CONFIG_DERIVED( profpac, astrocade_16color_base ) MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(profpac_map) MCFG_CPU_IO_MAP(port_map_16col_pattern) + + MCFG_DEVICE_MODIFY("bank4000") + MCFG_DEVICE_PROGRAM_MAP(profpac_bank4000_map) + MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(20) MACHINE_CONFIG_END @@ -1573,7 +1577,7 @@ ROM_START( profpac ) ROM_LOAD( "pps2", 0x2000, 0x2000, CRC(8a9a6653) SHA1(b730b24088dcfddbe954670ff9212b7383c923f6) ) ROM_LOAD( "pps9", 0xc000, 0x2000, CRC(17a0b418) SHA1(8b7ed84090dbc5181deef6f55ec755c05d4c0d5e) ) - ROM_REGION( 0x20000, "user1", ROMREGION_ERASEFF ) + ROM_REGION( 0x20000, "banks", ROMREGION_ERASEFF ) ROM_LOAD( "pps3", 0x04000, 0x2000, CRC(15717fd8) SHA1(ffbb156f417d20478117b39de28a15680993b528) ) ROM_LOAD( "pps4", 0x06000, 0x2000, CRC(36540598) SHA1(33c797c690801afded45091d822347e1ecc72b54) ) ROM_LOAD( "pps5", 0x08000, 0x2000, CRC(8dc89a59) SHA1(fb4d3ba40697425d69ee19bfdcf00aea1df5fa80) ) @@ -1581,7 +1585,7 @@ ROM_START( profpac ) ROM_LOAD( "pps7", 0x0c000, 0x2000, CRC(f9c26aba) SHA1(201b930cca9669114ffc97978cade69587e34a0f) ) ROM_LOAD( "pps8", 0x0e000, 0x2000, CRC(4d201e41) SHA1(786b30cd7a7db55bdde05909d7a1a7f122b6e546) ) - ROM_REGION( 0xa0000, "user2", ROMREGION_ERASEFF ) + ROM_REGION( 0xa0000, "epromboard", ROMREGION_ERASEFF ) ROM_LOAD( "ppq1", 0x00000, 0x4000, CRC(dddc2ccc) SHA1(d81caaa639f63d971a0d3199b9da6359211edf3d) ) ROM_LOAD( "ppq2", 0x04000, 0x4000, CRC(33bbcabe) SHA1(f9455868c70f479ede0e0621f21f69da165d9b7a) ) ROM_LOAD( "ppq3", 0x08000, 0x4000, CRC(3534d895) SHA1(24fb14c6b31b7f27e0737605cfbf963d29dd3fc5) ) @@ -1617,7 +1621,7 @@ ROM_START( demndrgn ) ROM_LOAD( "dd-x2.bin", 0x2000, 0x2000, CRC(0c63b624) SHA1(3eaeb4e0820e9dda7233a13bb146acc44402addd) ) ROM_LOAD( "dd-x9.bin", 0xc000, 0x2000, CRC(3792d632) SHA1(da053df344f39a8f25a2c57fb1a908131c10f248) ) - ROM_REGION( 0x20000, "user1", ROMREGION_ERASEFF ) + ROM_REGION( 0x20000, "banks", ROMREGION_ERASEFF ) ROM_LOAD( "dd-x5.bin", 0x08000, 0x2000, CRC(e377e831) SHA1(f53e74b3138611f9385845d6bdeab891b5d15931) ) ROM_LOAD( "dd-x6.bin", 0x0a000, 0x2000, CRC(0fcb46ad) SHA1(5611135f9e341bd394d6da7912167b05fff17a93) ) ROM_LOAD( "dd-x7.bin", 0x0c000, 0x2000, CRC(0675e4fa) SHA1(59668e32271ff9bac0b4411cc0c541d2825ee145) ) @@ -1640,7 +1644,7 @@ ROM_START( tenpindx ) ROM_REGION( 0x4000, "sub", 0 ) ROM_LOAD( "tpd_axfd.bin", 0x0000, 0x4000, CRC(0aed11f3) SHA1(09575cceda38178a77c6753074be82825d368334) ) - ROM_REGION( 0x20000, "user1", ROMREGION_ERASEFF ) + ROM_REGION( 0x20000, "banks", ROMREGION_ERASEFF ) ROM_LOAD( "tpd_x3.bin", 0x04000, 0x2000, CRC(d4645f6d) SHA1(185bcd58f1ba69e26274475c57219de0353267e1) ) ROM_LOAD( "tpd_x4.bin", 0x06000, 0x2000, CRC(acf474ba) SHA1(b324dccac0991660f8ba2a70cbbdb06c9d25c361) ) ROM_LOAD( "tpd_x5.bin", 0x08000, 0x2000, CRC(e206913f) SHA1(bb9476516bca7bf7066df058db36e4fdd52a6ed2) ) @@ -1731,9 +1735,9 @@ DRIVER_INIT_MEMBER(astrocde_state,profpac) iospace.install_read_handler(0x14, 0x14, 0x0fff, 0xff00, read8_delegate(FUNC(astrocde_state::profpac_io_1_r), this)); iospace.install_read_handler(0x15, 0x15, 0x77ff, 0xff00, read8_delegate(FUNC(astrocde_state::profpac_io_2_r), this)); - /* reset banking */ - profpac_banksw_w(iospace, 0, 0); - machine().save().register_postload(save_prepost_delegate(FUNC(astrocde_state::profbank_banksw_restore), this)); + /* configure banking */ + m_bank8000->configure_entries(0, 4, memregion("banks")->base() + 0x4000, 0x8000); + m_bank8000->set_entry(0); } @@ -1747,9 +1751,9 @@ DRIVER_INIT_MEMBER(astrocde_state,demndrgn) iospace.install_read_port(0x1d, 0x1d, 0x0000, 0xff00, "FIREY"); iospace.install_write_handler(0x97, 0x97, 0x0000, 0xff00, write8_delegate(FUNC(astrocde_state::demndrgn_sound_w), this)); - /* reset banking */ - profpac_banksw_w(iospace, 0, 0); - machine().save().register_postload(save_prepost_delegate(FUNC(astrocde_state::profbank_banksw_restore), this)); + /* configure banking */ + m_bank8000->configure_entries(0, 4, memregion("banks")->base() + 0x4000, 0x8000); + m_bank8000->set_entry(0); } @@ -1768,9 +1772,9 @@ DRIVER_INIT_MEMBER(astrocde_state,tenpindx) iospace.install_write_handler(0x68, 0x68, 0x0000, 0xff00, write8_delegate(FUNC(astrocde_state::tenpindx_lights_w), this)); iospace.install_write_handler(0x97, 0x97, 0x0000, 0xff00, write8_delegate(FUNC(astrocde_state::tenpindx_sound_w), this)); - /* reset banking */ - profpac_banksw_w(iospace, 0, 0); - machine().save().register_postload(save_prepost_delegate(FUNC(astrocde_state::profbank_banksw_restore), this)); + /* configure banking */ + m_bank8000->configure_entries(0, 4, memregion("banks")->base() + 0x4000, 0x8000); + m_bank8000->set_entry(0); } diff --git a/src/mame/drivers/atarisy2.c b/src/mame/drivers/atarisy2.c index ffc31e358f9..1486979e4f9 100644 --- a/src/mame/drivers/atarisy2.c +++ b/src/mame/drivers/atarisy2.c @@ -751,7 +751,7 @@ WRITE8_MEMBER(atarisy2_state::coincount_w) /* full memory map derived from schematics */ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, atarisy2_state ) AM_RANGE(0x0000, 0x0fff) AM_RAM - AM_RANGE(0x1000, 0x11ff) AM_MIRROR(0x0200) AM_RAM_WRITE(paletteram_w) AM_SHARE("paletteram") + AM_RANGE(0x1000, 0x11ff) AM_MIRROR(0x0200) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0x1400, 0x1403) AM_MIRROR(0x007c) AM_READWRITE(adc_r, bankselect_w) AM_RANGE(0x1480, 0x1487) AM_MIRROR(0x0078) AM_WRITE(adc_strobe_w) AM_RANGE(0x1580, 0x1581) AM_MIRROR(0x001e) AM_WRITE(int0_ack_w) @@ -1203,6 +1203,7 @@ static MACHINE_CONFIG_START( atarisy2, atarisy2_state ) /* video hardware */ MCFG_GFXDECODE_ADD("gfxdecode", "palette", atarisy2) MCFG_PALETTE_ADD("palette", 256) + MCFG_PALETTE_FORMAT_CLASS(2, atarisy2_state, RRRRGGGGBBBBIIII) MCFG_TILEMAP_ADD_STANDARD("playfield", "gfxdecode", 2, atarisy2_state, get_playfield_tile_info, 8,8, SCAN_ROWS, 128,64) MCFG_TILEMAP_ADD_STANDARD_TRANSPEN("alpha", "gfxdecode", 2, atarisy2_state, get_alpha_tile_info, 8,8, SCAN_ROWS, 64,48, 0) diff --git a/src/mame/drivers/battlnts.c b/src/mame/drivers/battlnts.c index 48a22234455..d3596e2d1b5 100644 --- a/src/mame/drivers/battlnts.c +++ b/src/mame/drivers/battlnts.c @@ -217,13 +217,10 @@ void battlnts_state::machine_start() m_rombank->configure_entries(0, 4, &ROM[0x10000], 0x4000); save_item(NAME(m_spritebank)); - save_item(NAME(m_layer_colorbase)); } void battlnts_state::machine_reset() { - m_layer_colorbase[0] = 0; - m_layer_colorbase[1] = 0; m_spritebank = 0; } diff --git a/src/mame/drivers/big10.c b/src/mame/drivers/big10.c index ee763a08b45..e72d2d8eae8 100644 --- a/src/mame/drivers/big10.c +++ b/src/mame/drivers/big10.c @@ -244,7 +244,7 @@ static MACHINE_CONFIG_START( big10, big10_state ) MCFG_NVRAM_ADD_0FILL("nvram") /* video hardware */ - MCFG_V9938_ADD("v9938", "screen", VDP_MEM) + MCFG_V9938_ADD("v9938", "screen", VDP_MEM, MASTER_CLOCK) MCFG_V99X8_INTERRUPT_CALLBACK(WRITELINE(big10_state, big10_vdp_interrupt)) MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/drivers/bionicc.c b/src/mame/drivers/bionicc.c index d0a5ae960b6..7b50e17bbe7 100644 --- a/src/mame/drivers/bionicc.c +++ b/src/mame/drivers/bionicc.c @@ -148,7 +148,7 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, bionicc_state ) AM_RANGE(0xfec000, 0xfecfff) AM_RAM_WRITE(bionicc_txvideoram_w) AM_SHARE("txvideoram") AM_RANGE(0xff0000, 0xff3fff) AM_RAM_WRITE(bionicc_fgvideoram_w) AM_SHARE("fgvideoram") AM_RANGE(0xff4000, 0xff7fff) AM_RAM_WRITE(bionicc_bgvideoram_w) AM_SHARE("bgvideoram") - AM_RANGE(0xff8000, 0xff87ff) AM_RAM_WRITE(bionicc_paletteram_w) AM_SHARE("paletteram") + AM_RANGE(0xff8000, 0xff87ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0xffc000, 0xfffff7) AM_RAM /* working RAM */ AM_RANGE(0xfffff8, 0xfffff9) AM_READWRITE(hacked_soundcommand_r, hacked_soundcommand_w) /* hack */ AM_RANGE(0xfffffa, 0xffffff) AM_READWRITE(hacked_controls_r, hacked_controls_w) /* hack */ @@ -372,6 +372,7 @@ static MACHINE_CONFIG_START( bionicc, bionicc_state ) MCFG_DEVICE_ADD("spritegen", TIGEROAD_SPRITE, 0) MCFG_PALETTE_ADD("palette", 1024) + MCFG_PALETTE_FORMAT_CLASS(2, bionicc_state, RRRRGGGGBBBBIIII) MCFG_BUFFERED_SPRITERAM16_ADD("spriteram") diff --git a/src/mame/drivers/bladestl.c b/src/mame/drivers/bladestl.c index 263f39aed2b..14f8fc0a641 100644 --- a/src/mame/drivers/bladestl.c +++ b/src/mame/drivers/bladestl.c @@ -282,7 +282,6 @@ void bladestl_state::machine_start() m_rombank->configure_entries(0, 4, memregion("maincpu")->base(), 0x2000); save_item(NAME(m_spritebank)); - save_item(NAME(m_layer_colorbase)); save_item(NAME(m_last_track)); } @@ -290,8 +289,6 @@ void bladestl_state::machine_reset() { int i; - m_layer_colorbase[0] = 0; - m_layer_colorbase[1] = 1; m_spritebank = 0; for (i = 0; i < 4 ; i++) diff --git a/src/mame/drivers/blockhl.c b/src/mame/drivers/blockhl.c index 452b89f1046..3c258d3f7d7 100644 --- a/src/mame/drivers/blockhl.c +++ b/src/mame/drivers/blockhl.c @@ -4,61 +4,137 @@ Block Hole (GX973) (c) 1989 Konami - driver by Nicola Salmoria + Original driver by Nicola Salmoria Notes: - Quarth works, but Block Hole crashes when it reaches the title screen. An - interrupt happens, and after rti the ROM bank is not the same as before so - it jumps to garbage code. - If you want to see this happen, place a breakpoint at 0x8612, and trace - after that. - The code is almost identical in the two versions, it looks like Quarth is - working just because luckily the interrupt doesn't happen at that point. - It seems that the interrupt handler trashes the selected ROM bank and forces - it to 0. To prevent crashes, I only generate interrupts when the ROM bank is - already 0. There might be another interrupt enable register, but I haven't - found it. + - To advance to the next screen in service mode, press P1 and P2 start + simultaneously + + Todo: + - How is the sound irq cleared (currently using HOLD_LINE)? + - Do bit 2 and 7 of the bankswitch port have any meaning? + - Verify raw screen parameters *******************************************************************************/ #include "emu.h" +#include "cpu/m6809/konami.h" #include "cpu/z80/z80.h" -#include "cpu/m6809/konami.h" /* for the callback and the firq irq definition */ +#include "machine/bankdev.h" +#include "video/k052109.h" +#include "video/k051960.h" #include "sound/2151intf.h" #include "includes/konamipt.h" -#include "includes/blockhl.h" -INTERRUPT_GEN_MEMBER(blockhl_state::blockhl_interrupt) +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class blockhl_state : public driver_device { - if (m_k052109->is_irq_enabled() && m_rombank == 0) /* kludge to prevent crashes */ - device.execute().set_input_line(KONAMI_IRQ_LINE, HOLD_LINE); -} +public: + blockhl_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_bank5800(*this, "bank5800"), + m_audiocpu(*this, "audiocpu"), + m_k052109(*this, "k052109"), + m_k051960(*this, "k051960"), + m_rombank(*this, "rombank") { } + + K052109_CB_MEMBER(tile_callback); + K051960_CB_MEMBER(sprite_callback); + UINT32 screen_update_blockhl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_READ8_MEMBER(k052109_051960_r); + DECLARE_WRITE8_MEMBER(k052109_051960_w); + + DECLARE_WRITE8_MEMBER(sound_irq_w); + + DECLARE_WRITE8_MEMBER(banking_callback); + +protected: + virtual void machine_start(); + +private: + required_device<cpu_device> m_maincpu; + required_device<address_map_bank_device> m_bank5800; + required_device<cpu_device> m_audiocpu; + required_device<k052109_device> m_k052109; + required_device<k051960_device> m_k051960; + required_memory_bank m_rombank; +}; + + +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** + +static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, blockhl_state ) + AM_RANGE(0x1f84, 0x1f84) AM_WRITE(soundlatch_byte_w) + AM_RANGE(0x1f88, 0x1f88) AM_WRITE(sound_irq_w) + AM_RANGE(0x1f8c, 0x1f8c) AM_WRITE(watchdog_reset_w) + AM_RANGE(0x1f94, 0x1f94) AM_READ_PORT("DSW3") + AM_RANGE(0x1f95, 0x1f95) AM_READ_PORT("P1") + AM_RANGE(0x1f96, 0x1f96) AM_READ_PORT("P2") + AM_RANGE(0x1f97, 0x1f97) AM_READ_PORT("DSW1") + AM_RANGE(0x1f98, 0x1f98) AM_READ_PORT("DSW2") + AM_RANGE(0x0000, 0x3fff) AM_READWRITE(k052109_051960_r, k052109_051960_w) + AM_RANGE(0x4000, 0x57ff) AM_RAM + AM_RANGE(0x5800, 0x5fff) AM_DEVICE("bank5800", address_map_bank_device, amap8) + AM_RANGE(0x6000, 0x7fff) AM_ROMBANK("rombank") + AM_RANGE(0x8000, 0xffff) AM_ROM AM_REGION("maincpu", 0x8000) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( bank5800_map, AS_PROGRAM, 8, blockhl_state ) + AM_RANGE(0x0000, 0x07ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") + AM_RANGE(0x0800, 0x0fff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( audio_map, AS_PROGRAM, 8, blockhl_state ) + AM_RANGE(0x0000, 0x7fff) AM_ROM + AM_RANGE(0x8000, 0x87ff) AM_RAM + AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r) + AM_RANGE(0xc000, 0xc001) AM_DEVREADWRITE("ymsnd", ym2151_device, read, write) + AM_RANGE(0xe00c, 0xe00d) AM_WRITENOP // leftover from missing 007232? +ADDRESS_MAP_END + -READ8_MEMBER(blockhl_state::bankedram_r) +//************************************************************************** +// VIDEO EMULATION +//************************************************************************** + +K052109_CB_MEMBER( blockhl_state::tile_callback ) { - if (m_palette_selected) - return m_paletteram[offset]; - else - return m_ram[offset]; + static const int layer_colorbase[] = { 0 / 16, 256 / 16, 512 / 16 }; + + *code |= ((*color & 0x0f) << 8); + *color = layer_colorbase[layer] + ((*color & 0xe0) >> 5); } -WRITE8_MEMBER(blockhl_state::bankedram_w) +K051960_CB_MEMBER( blockhl_state::sprite_callback ) { - if (m_palette_selected) - m_palette->write(space, offset, data); - else - m_ram[offset] = data; + enum { sprite_colorbase = 768 / 16 }; + + *priority = (*color & 0x10) ? GFX_PMASK_1 : 0; + *color = sprite_colorbase + (*color & 0x0f); } -WRITE8_MEMBER(blockhl_state::blockhl_sh_irqtrigger_w) +UINT32 blockhl_state::screen_update_blockhl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - m_audiocpu->set_input_line_and_vector(0, HOLD_LINE, 0xff); -} + screen.priority().fill(0, cliprect); + m_k052109->tilemap_update(); + m_k052109->tilemap_draw(screen, bitmap, cliprect, 2, TILEMAP_DRAW_OPAQUE, 0); // tile 2 + m_k052109->tilemap_draw(screen, bitmap, cliprect, 1, 0, 1); // tile 1 + m_k051960->k051960_sprites_draw(bitmap, cliprect, screen.priority(), -1, -1); + m_k052109->tilemap_draw(screen, bitmap, cliprect, 0, 0, 0); // tile 0 -/* special handlers to combine 052109 & 051960 */ -READ8_MEMBER(blockhl_state::k052109_051960_r) + return 0; +} + +// special handlers to combine 052109 & 051960 +READ8_MEMBER( blockhl_state::k052109_051960_r ) { if (m_k052109->get_rmrd_line() == CLEAR_LINE) { @@ -73,7 +149,7 @@ READ8_MEMBER(blockhl_state::k052109_051960_r) return m_k052109->read(space, offset); } -WRITE8_MEMBER(blockhl_state::k052109_051960_w) +WRITE8_MEMBER( blockhl_state::k052109_051960_w ) { if (offset >= 0x3800 && offset < 0x3808) m_k051960->k051937_w(space, offset - 0x3800, data); @@ -84,56 +160,84 @@ WRITE8_MEMBER(blockhl_state::k052109_051960_w) } -static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, blockhl_state ) - AM_RANGE(0x1f84, 0x1f84) AM_WRITE(soundlatch_byte_w) - AM_RANGE(0x1f88, 0x1f88) AM_WRITE(blockhl_sh_irqtrigger_w) - AM_RANGE(0x1f8c, 0x1f8c) AM_WRITE(watchdog_reset_w) - AM_RANGE(0x1f94, 0x1f94) AM_READ_PORT("DSW3") - AM_RANGE(0x1f95, 0x1f95) AM_READ_PORT("P1") - AM_RANGE(0x1f96, 0x1f96) AM_READ_PORT("P2") - AM_RANGE(0x1f97, 0x1f97) AM_READ_PORT("DSW1") - AM_RANGE(0x1f98, 0x1f98) AM_READ_PORT("DSW2") - AM_RANGE(0x0000, 0x3fff) AM_READWRITE(k052109_051960_r, k052109_051960_w) - AM_RANGE(0x4000, 0x57ff) AM_RAM - AM_RANGE(0x5800, 0x5fff) AM_READWRITE(bankedram_r, bankedram_w) AM_SHARE("ram") - AM_RANGE(0x6000, 0x7fff) AM_ROMBANK("bank1") - AM_RANGE(0x8000, 0xffff) AM_ROM -ADDRESS_MAP_END +//************************************************************************** +// AUDIO EMULATION +//************************************************************************** -static ADDRESS_MAP_START( audio_map, AS_PROGRAM, 8, blockhl_state ) - AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0x87ff) AM_RAM - AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r) - AM_RANGE(0xc000, 0xc001) AM_DEVREADWRITE("ymsnd", ym2151_device, read, write) - AM_RANGE(0xe00c, 0xe00d) AM_WRITENOP /* leftover from missing 007232? */ -ADDRESS_MAP_END +WRITE8_MEMBER( blockhl_state::sound_irq_w ) +{ + m_audiocpu->set_input_line(INPUT_LINE_IRQ0, HOLD_LINE); +} + + +//************************************************************************** +// MACHINE EMULATION +//************************************************************************** + +void blockhl_state::machine_start() +{ + // the first 0x8000 are banked, the remaining 0x8000 are directly accessible + m_rombank->configure_entries(0, 4, memregion("maincpu")->base(), 0x2000); +} + +WRITE8_MEMBER( blockhl_state::banking_callback ) +{ + // bits 0-1 = ROM bank + m_rombank->set_entry(data & 0x03); + // bit 2, unknown (always 0) -/*************************************************************************** + // bits 3/4 = coin counters + coin_counter_w(machine(), 0, data & 0x08); + coin_counter_w(machine(), 1, data & 0x10); + + // bit 5 = select palette RAM or work RAM at 5800-5fff + m_bank5800->set_bank(BIT(data, 5)); + + // bit 6 = enable char ROM reading through the video RAM + m_k052109->set_rmrd_line(BIT(data, 6) ? ASSERT_LINE : CLEAR_LINE); + + // bit 7, unknown (always 1) +} - Input Ports -***************************************************************************/ +//************************************************************************** +// INPUTS +//************************************************************************** static INPUT_PORTS_START( blockhl ) PORT_START("P1") - KONAMI8_B123_START(1) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_4WAY PORT_PLAYER(1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_4WAY PORT_PLAYER(1) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_4WAY PORT_PLAYER(1) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) // joy down, can be tested in service mode + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(1) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) // button 2, can be tested in service mode + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) // button 3, can be tested in service mode + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_START1) PORT_START("P2") - KONAMI8_B123_START(2) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_4WAY PORT_PLAYER(2) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_4WAY PORT_PLAYER(2) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_4WAY PORT_PLAYER(2) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) // joy down, can be tested in service mode + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(2) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) // button 2, can be tested in service mode + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) // button 3, can be tested in service mode + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_START2) PORT_START("DSW1") - KONAMI_COINAGE_LOC(DEF_STR( Free_Play ), "No Coin B", SW1) - /* "No Coin B" = coins produce sound, but no effect on coin counter */ + KONAMI_COINAGE_LOC(DEF_STR( Free_Play ), "Void", SW1) + // "Void" = coins produce sound, but no effect on coin counter PORT_START("DSW2") PORT_DIPNAME( 0x01, 0x01, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:1") PORT_DIPSETTING( 0x01, "1" ) PORT_DIPSETTING( 0x00, "2" ) - PORT_DIPUNUSED_DIPLOC( 0x02, 0x02, "SW2:2" ) /* Listed as "Unused" */ - PORT_DIPUNUSED_DIPLOC( 0x04, 0x04, "SW2:3" ) /* Listed as "Unused" */ - PORT_DIPUNUSED_DIPLOC( 0x08, 0x08, "SW2:4" ) /* Listed as "Unused" */ - PORT_DIPUNUSED_DIPLOC( 0x10, 0x10, "SW2:5" ) /* Listed as "Unused" */ + PORT_DIPUNUSED_DIPLOC( 0x02, IP_ACTIVE_LOW, "SW2:2" ) + PORT_DIPUNUSED_DIPLOC( 0x04, IP_ACTIVE_LOW, "SW2:3" ) + PORT_DIPUNUSED_DIPLOC( 0x08, IP_ACTIVE_LOW, "SW2:4" ) + PORT_DIPUNUSED_DIPLOC( 0x10, IP_ACTIVE_LOW, "SW2:5" ) PORT_DIPNAME( 0x60, 0x40, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:6,7") PORT_DIPSETTING( 0x60, DEF_STR( Easy ) ) PORT_DIPSETTING( 0x40, DEF_STR( Normal ) ) @@ -144,86 +248,44 @@ static INPUT_PORTS_START( blockhl ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_START("DSW3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) + 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_BIT(0x08, IP_ACTIVE_LOW, IPT_UNKNOWN) PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW3:1") PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPUNUSED_DIPLOC( 0x20, 0x20, "SW3:2" ) /* Listed as "Unused" */ - PORT_SERVICE_DIPLOC(0x40, IP_ACTIVE_LOW, "SW3:3" ) - PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW3:4" ) /* Listed as "Unused" */ + PORT_DIPUNUSED_DIPLOC( 0x20, IP_ACTIVE_LOW, "SW3:2" ) + PORT_SERVICE_DIPLOC( 0x40, IP_ACTIVE_LOW, "SW3:3" ) + PORT_DIPUNUSED_DIPLOC( 0x80, IP_ACTIVE_LOW, "SW3:4" ) INPUT_PORTS_END -/*************************************************************************** - - Machine Driver - -***************************************************************************/ - -void blockhl_state::machine_start() -{ - UINT8 *ROM = memregion("maincpu")->base(); - - membank("bank1")->configure_entries(0, 4, &ROM[0x10000], 0x2000); - - m_paletteram.resize(m_palette->entries() * 2); - m_palette->basemem().set(m_paletteram, ENDIANNESS_BIG, 2); - - save_item(NAME(m_paletteram)); - save_item(NAME(m_palette_selected)); - save_item(NAME(m_rombank)); -} - -void blockhl_state::machine_reset() -{ - m_palette_selected = 0; - m_rombank = 0; -} - -WRITE8_MEMBER( blockhl_state::banking_callback ) -{ - /* bits 0-1 = ROM bank */ - m_rombank = data & 0x03; - membank("bank1")->set_entry(m_rombank); - - /* bits 3/4 = coin counters */ - coin_counter_w(machine(), 0, data & 0x08); - coin_counter_w(machine(), 1, data & 0x10); - - /* bit 5 = select palette RAM or work RAM at 5800-5fff */ - m_palette_selected = ~data & 0x20; - - /* bit 6 = enable char ROM reading through the video RAM */ - m_k052109->set_rmrd_line((data & 0x40) ? ASSERT_LINE : CLEAR_LINE); - - /* bit 7 used but unknown */ - - /* other bits unknown */ - - if ((data & 0x84) != 0x80) - logerror("%04x: setlines %02x\n", machine().device("maincpu")->safe_pc(), data); -} +//************************************************************************** +// MACHINE DEFINTIONS +//************************************************************************** static MACHINE_CONFIG_START( blockhl, blockhl_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", KONAMI,3000000) /* Konami custom 052526 */ + // basic machine hardware + MCFG_CPU_ADD("maincpu", KONAMI, XTAL_24MHz/8) // Konami 052526 MCFG_CPU_PROGRAM_MAP(main_map) - MCFG_CPU_VBLANK_INT_DRIVER("screen", blockhl_state, blockhl_interrupt) MCFG_KONAMICPU_LINE_CB(WRITE8(blockhl_state, banking_callback)) - MCFG_CPU_ADD("audiocpu", Z80, 3579545) + MCFG_DEVICE_ADD("bank5800", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(bank5800_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) + MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(12) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x0800) + + MCFG_CPU_ADD("audiocpu", Z80, XTAL_3_579545MHz) MCFG_CPU_PROGRAM_MAP(audio_map) - /* video hardware */ + // video hardware MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(64*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(14*8, (64-14)*8-1, 2*8, 30*8-1 ) + MCFG_SCREEN_RAW_PARAMS(XTAL_24MHz/3, 528, 112, 400, 256, 16, 240) +// 6MHz dotclock is more realistic, however needs drawing updates. replace when ready +// MCFG_SCREEN_RAW_PARAMS(XTAL_24MHz/4, 396, hbend, hbstart, 256, 16, 240) MCFG_SCREEN_UPDATE_DRIVER(blockhl_state, screen_update_blockhl) MCFG_SCREEN_PALETTE("palette") @@ -233,81 +295,79 @@ static MACHINE_CONFIG_START( blockhl, blockhl_state ) MCFG_DEVICE_ADD("k052109", K052109, 0) MCFG_GFX_PALETTE("palette") + MCFG_K052109_SCREEN_TAG("screen") MCFG_K052109_CB(blockhl_state, tile_callback) + MCFG_K052109_IRQ_HANDLER(INPUTLINE("maincpu", KONAMI_IRQ_LINE)) MCFG_DEVICE_ADD("k051960", K051960, 0) MCFG_GFX_PALETTE("palette") + MCFG_K051960_SCREEN_TAG("screen") MCFG_K051960_CB(blockhl_state, sprite_callback) - /* sound hardware */ + // sound hardware MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_YM2151_ADD("ymsnd", 3579545) + MCFG_YM2151_ADD("ymsnd", XTAL_3_579545MHz) MCFG_SOUND_ROUTE(0, "mono", 0.60) MCFG_SOUND_ROUTE(1, "mono", 0.60) MACHINE_CONFIG_END -/*************************************************************************** - - Game ROMs - -***************************************************************************/ +//************************************************************************** +// ROM DEFINITIONS +//************************************************************************** ROM_START( blockhl ) - ROM_REGION( 0x18000, "maincpu", 0 ) /* code + banked roms + space for banked RAM */ - ROM_LOAD( "973l02.e21", 0x10000, 0x08000, CRC(e14f849a) SHA1(d44cf178cc98998b72ed32c6e20b6ebdf1f97579) ) - ROM_CONTINUE( 0x08000, 0x08000 ) + ROM_REGION( 0x10000, "maincpu", 0 ) // code + banked roms + ROM_LOAD( "973l02.e21", 0x00000, 0x10000, CRC(e14f849a) SHA1(d44cf178cc98998b72ed32c6e20b6ebdf1f97579) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for the sound CPU */ - ROM_LOAD( "973d01.g6", 0x0000, 0x8000, CRC(eeee9d92) SHA1(6c6c324b1f6f4fba0aa12e0d1fc5dbab133ef669) ) + ROM_REGION( 0x08000, "audiocpu", 0 ) // 32k for the sound CPU + ROM_LOAD( "973d01.g6", 0x00000, 0x08000, CRC(eeee9d92) SHA1(6c6c324b1f6f4fba0aa12e0d1fc5dbab133ef669) ) - ROM_REGION( 0x20000, "k052109", 0 ) /* tiles */ + ROM_REGION( 0x20000, "k052109", 0 ) // tiles ROM_LOAD32_BYTE( "973f07.k15", 0x00000, 0x08000, CRC(1a8cd9b4) SHA1(7cb7944d24ac51fa6b610542d9dec68697cacf0f) ) ROM_LOAD32_BYTE( "973f08.k18", 0x00001, 0x08000, CRC(952b51a6) SHA1(017575738d444b688b137cad5611638d53be84f2) ) ROM_LOAD32_BYTE( "973f09.k20", 0x00002, 0x08000, CRC(77841594) SHA1(e1bfdc5bb598d865868d578ef7faba8078becd7a) ) ROM_LOAD32_BYTE( "973f10.k23", 0x00003, 0x08000, CRC(09039fab) SHA1(a9dea17aacf4484d21ef3b16470263447b51b6b5) ) - ROM_REGION( 0x20000, "k051960", 0 ) /* sprites */ + ROM_REGION( 0x20000, "k051960", 0 ) // sprites ROM_LOAD32_BYTE( "973f06.k12", 0x00000, 0x08000, CRC(51acfdb6) SHA1(94d243f341b490684f5297d95d4835bd522ece35) ) ROM_LOAD32_BYTE( "973f05.k9", 0x00001, 0x08000, CRC(4cfea298) SHA1(4772b5b99f5fd8174d8884bd84173512e1edabf4) ) ROM_LOAD32_BYTE( "973f04.k7", 0x00002, 0x08000, CRC(69ca41bd) SHA1(9b0b1c888efd2f2d5525f14778e18fb4a7353eb6) ) ROM_LOAD32_BYTE( "973f03.k4", 0x00003, 0x08000, CRC(21e98472) SHA1(8c697d369a1f57be0825c33b4e9107ce1b02a130) ) - ROM_REGION( 0x0100, "proms", 0 ) /* PROMs */ - ROM_LOAD( "973a11.h10", 0x0000, 0x0100, CRC(46d28fe9) SHA1(9d0811a928c8907785ef483bfbee5445506b3ec8) ) /* priority encoder (not used) */ + ROM_REGION( 0x0100, "priority", 0 ) // priority encoder (not used) + ROM_LOAD( "973a11.h10", 0x0000, 0x0100, CRC(46d28fe9) SHA1(9d0811a928c8907785ef483bfbee5445506b3ec8) ) ROM_END ROM_START( quarth ) - ROM_REGION( 0x18000, "maincpu", 0 ) /* code + banked roms + space for banked RAM */ - ROM_LOAD( "973j02.e21", 0x10000, 0x08000, CRC(27a90118) SHA1(51309385b93db29b9277d14252166c4ea1746303) ) - ROM_CONTINUE( 0x08000, 0x08000 ) + ROM_REGION( 0x10000, "maincpu", 0 ) // code + banked roms + ROM_LOAD( "973j02.e21", 0x00000, 0x10000, CRC(27a90118) SHA1(51309385b93db29b9277d14252166c4ea1746303) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for the sound CPU */ - ROM_LOAD( "973d01.g6", 0x0000, 0x8000, CRC(eeee9d92) SHA1(6c6c324b1f6f4fba0aa12e0d1fc5dbab133ef669) ) + ROM_REGION( 0x08000, "audiocpu", 0 ) // 32k for the sound CPU + ROM_LOAD( "973d01.g6", 0x00000, 0x08000, CRC(eeee9d92) SHA1(6c6c324b1f6f4fba0aa12e0d1fc5dbab133ef669) ) - ROM_REGION( 0x20000, "k052109", 0 ) /* tiles */ + ROM_REGION( 0x20000, "k052109", 0 ) // tiles ROM_LOAD32_BYTE( "973e07.k15", 0x00000, 0x08000, CRC(0bd6b0f8) SHA1(6c59cf637354fe2df424eaa89feb9c1bc1f66a92) ) ROM_LOAD32_BYTE( "973e08.k18", 0x00001, 0x08000, CRC(104d0d5f) SHA1(595698911513113d01e5b565f5b073d1bd033d3f) ) ROM_LOAD32_BYTE( "973e09.k20", 0x00002, 0x08000, CRC(bd3a6f24) SHA1(eb45db3a6a52bb2b25df8c2dace877e59b4130a6) ) ROM_LOAD32_BYTE( "973e10.k23", 0x00003, 0x08000, CRC(cf5e4b86) SHA1(43348753894c1763b26dbfc70245dac92048db8f) ) - ROM_REGION( 0x20000, "k051960", 0 ) /* sprites */ + ROM_REGION( 0x20000, "k051960", 0 ) // sprites ROM_LOAD32_BYTE( "973e06.k12", 0x00000, 0x08000, CRC(0d58af85) SHA1(2efd661d614fb305a14cfe1aa4fb17714f215d4f) ) ROM_LOAD32_BYTE( "973e05.k9", 0x00001, 0x08000, CRC(15d822cb) SHA1(70ecad5e0a461df0da6e6eb23f43a7b643297f0d) ) ROM_LOAD32_BYTE( "973e04.k7", 0x00002, 0x08000, CRC(d70f4a2c) SHA1(25f835a17bacf2b8debb2eb8a3cff90cab3f402a) ) ROM_LOAD32_BYTE( "973e03.k4", 0x00003, 0x08000, CRC(2c5a4b4b) SHA1(e2991dd78b9cd96cf93ebd6de0d4e060d346ab9c) ) - ROM_REGION( 0x0100, "proms", 0 ) /* PROMs */ - ROM_LOAD( "973a11.h10", 0x0000, 0x0100, CRC(46d28fe9) SHA1(9d0811a928c8907785ef483bfbee5445506b3ec8) ) /* priority encoder (not used) */ + ROM_REGION( 0x0100, "priority", 0 ) // priority encoder (not used) + ROM_LOAD( "973a11.h10", 0x0000, 0x0100, CRC(46d28fe9) SHA1(9d0811a928c8907785ef483bfbee5445506b3ec8) ) ROM_END -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ +//************************************************************************** +// GAME DRIVERS +//************************************************************************** -GAME( 1989, blockhl, 0, blockhl, blockhl, driver_device, 0, ROT0, "Konami", "Block Hole", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, quarth, blockhl, blockhl, blockhl, driver_device, 0, ROT0, "Konami", "Quarth (Japan)", MACHINE_SUPPORTS_SAVE ) +// YEAR NAME PARENT MACHINE INPUT CLASS INIT ROT COMPANY FULLNAME FLAGS +GAME( 1989, blockhl, 0, blockhl, blockhl, driver_device, 0, ROT0, "Konami", "Block Hole", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, quarth, blockhl, blockhl, blockhl, driver_device, 0, ROT0, "Konami", "Quarth (Japan)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/bogeyman.c b/src/mame/drivers/bogeyman.c index 5cf257cec55..bddda1d5862 100644 --- a/src/mame/drivers/bogeyman.c +++ b/src/mame/drivers/bogeyman.c @@ -52,7 +52,7 @@ static ADDRESS_MAP_START( bogeyman_map, AS_PROGRAM, 8, bogeyman_state ) AM_RANGE(0x2000, 0x20ff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram") AM_RANGE(0x2100, 0x21ff) AM_RAM_WRITE(colorram_w) AM_SHARE("colorram") AM_RANGE(0x2800, 0x2bff) AM_RAM AM_SHARE("spriteram") - AM_RANGE(0x3000, 0x300f) AM_RAM_WRITE(paletteram_w) AM_SHARE("palette") + AM_RANGE(0x3000, 0x300f) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0x3800, 0x3800) AM_READ_PORT("P1") AM_WRITE(ay8910_control_w) AM_RANGE(0x3801, 0x3801) AM_READ_PORT("P2") AM_WRITE(ay8910_latch_w) AM_RANGE(0x3802, 0x3802) AM_READ_PORT("DSW1") @@ -232,7 +232,6 @@ static MACHINE_CONFIG_START( bogeyman, bogeyman_state ) MCFG_CPU_PROGRAM_MAP(bogeyman_map) MCFG_CPU_PERIODIC_INT_DRIVER(bogeyman_state, irq0_line_hold, 16*60) // Controls sound - // video hardware MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) @@ -245,7 +244,7 @@ static MACHINE_CONFIG_START( bogeyman, bogeyman_state ) MCFG_GFXDECODE_ADD("gfxdecode", "palette", bogeyman) MCFG_PALETTE_ADD("palette", 16+256) - MCFG_PALETTE_FORMAT(BBGGGRRR) + MCFG_PALETTE_FORMAT(BBGGGRRR_inverted) MCFG_PALETTE_INIT_OWNER(bogeyman_state, bogeyman) // sound hardware diff --git a/src/mame/drivers/bottom9.c b/src/mame/drivers/bottom9.c index 910eef0e07a..d5e1fa3479c 100644 --- a/src/mame/drivers/bottom9.c +++ b/src/mame/drivers/bottom9.c @@ -323,6 +323,7 @@ static MACHINE_CONFIG_START( bottom9, bottom9_state ) MCFG_DEVICE_ADD("k051960", K051960, 0) MCFG_GFX_PALETTE("palette") + MCFG_K051960_SCREEN_TAG("screen") MCFG_K051960_CB(bottom9_state, sprite_callback) MCFG_DEVICE_ADD("k051316", K051316, 0) diff --git a/src/mame/drivers/btime.c b/src/mame/drivers/btime.c index 83a9f2d8af6..b1524a4fce1 100644 --- a/src/mame/drivers/btime.c +++ b/src/mame/drivers/btime.c @@ -192,7 +192,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(btime_state::audio_nmi_gen) static ADDRESS_MAP_START( btime_map, AS_PROGRAM, 8, btime_state ) AM_RANGE(0x0000, 0x07ff) AM_RAM AM_SHARE("rambase") - AM_RANGE(0x0c00, 0x0c0f) AM_RAM_WRITE(btime_paletteram_w) AM_SHARE("palette") + AM_RANGE(0x0c00, 0x0c0f) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0x1000, 0x13ff) AM_RAM AM_SHARE("videoram") AM_RANGE(0x1400, 0x17ff) AM_RAM AM_SHARE("colorram") AM_RANGE(0x1800, 0x1bff) AM_READWRITE(btime_mirrorvideoram_r, btime_mirrorvideoram_w) @@ -227,7 +227,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( tisland_map, AS_PROGRAM, 8, btime_state ) AM_RANGE(0x0000, 0x07ff) AM_RAM AM_SHARE("rambase") - AM_RANGE(0x0c00, 0x0c0f) AM_RAM_WRITE(btime_paletteram_w) AM_SHARE("palette") + AM_RANGE(0x0c00, 0x0c0f) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0x1000, 0x13ff) AM_RAM AM_SHARE("videoram") AM_RANGE(0x1400, 0x17ff) AM_RAM AM_SHARE("colorram") AM_RANGE(0x1800, 0x1bff) AM_READWRITE(btime_mirrorvideoram_r, btime_mirrorvideoram_w) @@ -304,7 +304,7 @@ static ADDRESS_MAP_START( bnj_map, AS_PROGRAM, 8, btime_state ) AM_RANGE(0x5200, 0x53ff) AM_RAM AM_RANGE(0x5400, 0x5400) AM_WRITE(bnj_scroll1_w) AM_RANGE(0x5800, 0x5800) AM_WRITE(bnj_scroll2_w) - AM_RANGE(0x5c00, 0x5c0f) AM_RAM_WRITE(btime_paletteram_w) AM_SHARE("palette") + AM_RANGE(0x5c00, 0x5c0f) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0xa000, 0xffff) AM_ROM ADDRESS_MAP_END @@ -1310,7 +1310,7 @@ static MACHINE_CONFIG_START( btime, btime_state ) MCFG_PALETTE_ADD("palette", 16) MCFG_PALETTE_INIT_OWNER(btime_state,btime) - MCFG_PALETTE_FORMAT(BBGGGRRR) + MCFG_PALETTE_FORMAT(BBGGGRRR_inverted) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") diff --git a/src/mame/drivers/calorie.c b/src/mame/drivers/calorie.c index c733a89f395..50049962e05 100644 --- a/src/mame/drivers/calorie.c +++ b/src/mame/drivers/calorie.c @@ -100,7 +100,6 @@ public: /* memory pointers */ required_shared_ptr<UINT8> m_fg_ram; required_shared_ptr<UINT8> m_sprites; -// UINT8 * m_paletteram; // currently this uses generic palette handling /* video-related */ tilemap_t *m_bg_tilemap; diff --git a/src/mame/drivers/capbowl.c b/src/mame/drivers/capbowl.c index fb7cb01c4e5..f3d1deae057 100644 --- a/src/mame/drivers/capbowl.c +++ b/src/mame/drivers/capbowl.c @@ -437,13 +437,13 @@ ROM_END ROM_START( bowlrama ) ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "u6", 0x08000, 0x08000, CRC(7103ad55) SHA1(92dccc5e6df3e18fc8cdcb67ef14d50ce5eb8b2c) ) + ROM_LOAD( "bowl-o-rama_rev_1.0_u6.u6", 0x08000, 0x08000, CRC(7103ad55) SHA1(92dccc5e6df3e18fc8cdcb67ef14d50ce5eb8b2c) ) ROM_REGION( 0x10000, "audiocpu", 0 ) - ROM_LOAD( "u30", 0x8000, 0x8000, CRC(f3168834) SHA1(40b7fbe9c15cc4442f4394b71c0666185afe4c8d) ) + ROM_LOAD( "bowl-o-rama_rev_1.0_u30.u30", 0x08000, 0x08000, CRC(f3168834) SHA1(40b7fbe9c15cc4442f4394b71c0666185afe4c8d) ) ROM_REGION( 0x40000, "gfx1", 0 ) - ROM_LOAD( "ux7", 0x00000, 0x40000, CRC(8727432a) SHA1(a81d366c5f8df0bdb97e795bba7752e6526ddba0) ) + ROM_LOAD( "bowl-o-rama_rev_1.0_ux7.ux7", 0x00000, 0x40000, CRC(8727432a) SHA1(a81d366c5f8df0bdb97e795bba7752e6526ddba0) ) /* located on daughter card add-on */ ROM_END @@ -473,5 +473,5 @@ GAME( 1988, capbowl, 0, capbowl, capbowl, capbowl_state, capbowl, ROT27 GAME( 1988, capbowl2, capbowl, capbowl, capbowl, capbowl_state, capbowl, ROT270, "Incredible Technologies / Capcom", "Capcom Bowling (set 2)", MACHINE_SUPPORTS_SAVE ) GAME( 1988, capbowl3, capbowl, capbowl, capbowl, capbowl_state, capbowl, ROT270, "Incredible Technologies / Capcom", "Capcom Bowling (set 3)", MACHINE_SUPPORTS_SAVE ) GAME( 1988, capbowl4, capbowl, capbowl, capbowl, capbowl_state, capbowl, ROT270, "Incredible Technologies / Capcom", "Capcom Bowling (set 4)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, clbowl, capbowl, capbowl, capbowl, capbowl_state, capbowl, ROT270, "Incredible Technologies / Capcom", "Coors Light Bowling", MACHINE_SUPPORTS_SAVE ) -GAME( 1991, bowlrama, 0, bowlrama, capbowl, driver_device, 0, ROT270, "P&P Marketing", "Bowl-O-Rama", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, clbowl, capbowl, capbowl, capbowl, capbowl_state, capbowl, ROT270, "Incredible Technologies / Capcom", "Coors Light Bowling", MACHINE_SUPPORTS_SAVE ) +GAME( 1991, bowlrama, 0, bowlrama, capbowl, driver_device, 0, ROT270, "P&P Marketing", "Bowl-O-Rama Rev 1.0", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/cchance.c b/src/mame/drivers/cchance.c index 40333a90227..0fd606a3051 100644 --- a/src/mame/drivers/cchance.c +++ b/src/mame/drivers/cchance.c @@ -164,6 +164,12 @@ static INPUT_PORTS_START( cchance ) PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + + // These ports are required in tnzs_state + PORT_START("IN1") + PORT_START("IN2") + PORT_START("DSWA") + PORT_START("DSWB") INPUT_PORTS_END static const gfx_layout cchance_layout = diff --git a/src/mame/drivers/chihiro.c b/src/mame/drivers/chihiro.c index 881732b088d..e4e6b65e79f 100644 --- a/src/mame/drivers/chihiro.c +++ b/src/mame/drivers/chihiro.c @@ -376,7 +376,7 @@ Thanks to Alex, Mr Mudkips, and Philip Burke for this info. #include "debug/debugcmd.h" #include "debug/debugcpu.h" #include "includes/chihiro.h" - +#include "includes/xbox.h" // for now, make buggy GCC/Mingw STFU about I64FMT #if (defined(__MINGW32__) && (__GNUC__ >= 5)) @@ -386,337 +386,40 @@ Thanks to Alex, Mr Mudkips, and Philip Burke for this info. #endif #define LOG_PCI -//#define LOG_OHCI //#define LOG_BASEBOARD -//#define USB_ENABLED - -struct OHCIEndpointDescriptor { - int mps; // MaximumPacketSize - int f; // Format - int k; // sKip - int s; // Speed - int d; // Direction - int en; // EndpointNumber - int fa; // FunctionAddress - UINT32 tailp; // TDQueueTailPointer - UINT32 headp; // TDQueueHeadPointer - UINT32 nexted; // NextED - int c; // toggleCarry - int h; // Halted - UINT32 word0; -}; - -struct OHCITransferDescriptor { - int cc; // ConditionCode - int ec; // ErrorCount - int t; // DataToggle - int di; // DelayInterrupt - int dp; // Direction/PID - int r; // bufferRounding - UINT32 cbp; // CurrentBufferPointer - UINT32 nexttd; // NextTD - UINT32 be; // BufferEnd - UINT32 word0; -}; - -struct OHCIIsochronousTransferDescriptor { - int cc; // ConditionCode - int fc; // FrameCount - int di; // DelayInterrupt - int sf; // StartingFrame - UINT32 bp0; // BufferPage0 - UINT32 nexttd; // NextTD - UINT32 be; // BufferEnd - UINT32 offset[8]; // Offset/PacketStatusWord -}; - -enum OHCIRegisters { - HcRevision=0, - HcControl, - HcCommandStatus, - HcInterruptStatus, - HcInterruptEnable, - HcInterruptDisable, - HcHCCA, - HcPeriodCurrentED, - HcControlHeadED, - HcControlCurrentED, - HcBulkHeadED, - HcBulkCurrentED, - HcDoneHead, - HcFmInterval, - HcFmRemaining, - HcFmNumber, - HcPeriodicStart, - HcLSThreshold, - HcRhDescriptorA, - HcRhDescriptorB, - HcRhStatus, - HcRhPortStatus1 -}; - -enum OHCIHostControllerFunctionalState { - UsbReset=0, - UsbResume, - UsbOperational, - UsbSuspend -}; - -enum OHCIInterrupt { - SchedulingOverrun=1, - WritebackDoneHead=2, - StartofFrame=4, - ResumeDetected=8, - UnrecoverableError=16, - FrameNumberOverflow=32, - RootHubStatusChange=64, - OwnershipChange=0x40000000, - MasterInterruptEnable=0x80000000 -}; - -enum OHCICompletionCode { - NoError=0, - CRC, - BitStuffing, - DataToggleMismatch, - Stall, - DeviceNotResponding, - PIDCheckFailure, - UnexpectedPID, - DataOverrun, - DataUnderrun, - BufferOverrun=12, - BufferUnderrun, - NotAccessed=14 -}; - -struct USBSetupPacket { - UINT8 bmRequestType; - UINT8 bRequest; - UINT16 wValue; - UINT16 wIndex; - UINT16 wLength; -}; -struct USBStandardDeviceDscriptor { - UINT8 bLength; - UINT8 bDescriptorType; - UINT16 bcdUSB; - UINT8 bDeviceClass; - UINT8 bDeviceSubClass; - UINT8 bDeviceProtocol; - UINT8 bMaxPacketSize0; - UINT16 idVendor; - UINT16 idProduct; - UINT16 bcdDevice; - UINT8 iManufacturer; - UINT8 iProduct; - UINT8 iSerialNumber; - UINT8 bNumConfigurations; -}; - -struct USBStandardConfigurationDescriptor { - UINT8 bLength; - UINT8 bDescriptorType; - UINT16 wTotalLength; - UINT8 bNumInterfaces; - UINT8 bConfigurationValue; - UINT8 iConfiguration; - UINT8 bmAttributes; - UINT8 MaxPower; -}; - -struct USBStandardInterfaceDescriptor { - UINT8 bLength; - UINT8 bDescriptorType; - UINT8 bInterfaceNumber; - UINT8 bAlternateSetting; - UINT8 bNumEndpoints; - UINT8 bInterfaceClass; - UINT8 bInterfaceSubClass; - UINT8 bInterfaceProtocol; - UINT8 iInterface; -}; - -struct USBStandardEndpointDescriptor { - UINT8 bLength; - UINT8 bDescriptorType; - UINT8 bEndpointAddress; - UINT8 bmAttributes; - UINT16 wMaxPacketSize; - UINT8 bInterval; -}; - -enum USBPid { - SetupPid=0, - OutPid, - InPid -}; - -enum USBRequestCode { - GET_STATUS=0, - CLEAR_FEATURE=1, - SET_FEATURE=3, - SET_ADDRESS=5, - GET_DESCRIPTOR=6, - SET_DESCRIPTOR=7, - GET_CONFIGURATION=8, - SET_CONFIGURATION=9, - GET_INTERFACE=10, - SET_INTERFACE=11, - SYNCH_FRAME=12 -}; - -enum USBDescriptorType { - DEVICE=1, - CONFIGURATION=2, - STRING=3, - INTERFACE=4, - ENDPOINT=5 -}; - -class ohci_function_device { -public: - ohci_function_device(); - void execute_reset(); - int execute_transfer(int address, int endpoint, int pid, UINT8 *buffer, int size); -private: - int address; - int controldir; - int remain; - UINT8 *position; -}; - -class chihiro_state : public driver_device +class chihiro_state : public xbox_base_state { public: chihiro_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - nvidia_nv2a(NULL), - debug_irq_active(false), - debug_irq_number(0), - dimm_board_memory(NULL), - dimm_board_memory_size(0), + xbox_base_state(mconfig, type, tag), usbhack_index(-1), usbhack_counter(0), - m_maincpu(*this, "maincpu") { } - - DECLARE_READ32_MEMBER(geforce_r); - DECLARE_WRITE32_MEMBER(geforce_w); - DECLARE_READ32_MEMBER(usbctrl_r); - DECLARE_WRITE32_MEMBER(usbctrl_w); - DECLARE_READ32_MEMBER(smbus_r); - DECLARE_WRITE32_MEMBER(smbus_w); + dimm_board_memory(NULL), + dimm_board_memory_size(0) { } + DECLARE_READ32_MEMBER(mediaboard_r); DECLARE_WRITE32_MEMBER(mediaboard_w); - DECLARE_READ32_MEMBER(audio_apu_r); - DECLARE_WRITE32_MEMBER(audio_apu_w); - DECLARE_READ32_MEMBER(audio_ac93_r); - DECLARE_WRITE32_MEMBER(audio_ac93_w); - DECLARE_READ32_MEMBER(dummy_r); - DECLARE_WRITE32_MEMBER(dummy_w); - - void smbus_register_device(int address, int(*handler)(chihiro_state &chs, int command, int rw, int data)); - int smbus_pic16lc(int command, int rw, int data); - int smbus_cx25871(int command, int rw, int data); - int smbus_eeprom(int command, int rw, int data); - void usb_ohci_plug(int port, ohci_function_device *function); - void usb_ohci_interrupts(); - void usb_ohci_read_endpoint_descriptor(UINT32 address); - void usb_ohci_writeback_endpoint_descriptor(UINT32 address); - void usb_ohci_read_transfer_descriptor(UINT32 address); - void usb_ohci_writeback_transfer_descriptor(UINT32 address); - void usb_ohci_read_isochronous_transfer_descriptor(UINT32 address); + + virtual void machine_start(); void baseboard_ide_event(int type, UINT8 *read, UINT8 *write); UINT8 *baseboard_ide_dimmboard(UINT32 lba); void dword_write_le(UINT8 *addr, UINT32 d); void word_write_le(UINT8 *addr, UINT16 d); - void debug_generate_irq(int irq, bool active); - - void vblank_callback(screen_device &screen, bool state); - UINT32 screen_update_callback(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - - virtual void machine_start(); - DECLARE_WRITE_LINE_MEMBER(chihiro_pic8259_1_set_int_line); - DECLARE_READ8_MEMBER(get_slave_ack); - DECLARE_WRITE_LINE_MEMBER(chihiro_pit8254_out0_changed); - DECLARE_WRITE_LINE_MEMBER(chihiro_pit8254_out2_changed); - IRQ_CALLBACK_MEMBER(irq_callback); - TIMER_CALLBACK_MEMBER(audio_apu_timer); - TIMER_CALLBACK_MEMBER(usb_ohci_timer); + virtual void hack_eeprom(); + virtual void hack_usb(); struct chihiro_devices { - pic8259_device *pic8259_1; - pic8259_device *pic8259_2; bus_master_ide_controller_device *ide; naomi_gdrom_board *dimmboard; } chihiro_devs; - struct smbus_state { - int status; - int control; - int address; - int data; - int command; - int rw; - int(*devices[128])(chihiro_state &chs, int command, int rw, int data); - UINT32 words[256 / 4]; - } smbusst; - struct apu_state { - UINT32 memory[0x60000 / 4]; - UINT32 gpdsp_sgaddress; // global processor scatter-gather - UINT32 gpdsp_sgblocks; - UINT32 gpdsp_address; - UINT32 epdsp_sgaddress; // encoder processor scatter-gather - UINT32 epdsp_sgblocks; - UINT32 unknown_sgaddress; - UINT32 unknown_sgblocks; - int voice_number; - UINT32 voices_heap_blockaddr[1024]; - UINT64 voices_active[4]; //one bit for each voice: 1 playing 0 not - UINT32 voicedata_address; - int voices_frequency[256]; // sample rate - int voices_position[256]; // position in samples * 1000 - int voices_position_start[256]; // position in samples * 1000 - int voices_position_end[256]; // position in samples * 1000 - int voices_position_increment[256]; // position increment every 1ms * 1000 - emu_timer *timer; - address_space *space; - } apust; - struct ac97_state { - UINT32 mixer_regs[0x80 / 4]; - UINT32 controller_regs[0x38 / 4]; - } ac97st; - struct ohci_state { - UINT32 hc_regs[255]; - struct { - ohci_function_device *function; - int delay; - } ports[4 + 1]; - emu_timer *timer; - int state; - UINT32 framenumber; - UINT32 nextinterupted; - UINT32 nextbulked; - int interruptbulkratio; - int writebackdonehadcounter; - address_space *space; - UINT8 buffer[1024]; - OHCIEndpointDescriptor endpoint_descriptor; - OHCITransferDescriptor transfer_descriptor; - OHCIIsochronousTransferDescriptor isochronous_transfer_descriptor; - } ohcist; - UINT8 pic16lc_buffer[0xff]; - nv2a_renderer *nvidia_nv2a; - bool debug_irq_active; - int debug_irq_number; - UINT8 *dimm_board_memory; - UINT32 dimm_board_memory_size; int usbhack_index; int usbhack_counter; - required_device<cpu_device> m_maincpu; + UINT8 *dimm_board_memory; + UINT32 dimm_board_memory_size; }; -/* jamtable instructions for Chihiro (different from console) +/* jamtable instructions for Chihiro (different from Xbox console) St. Instr. Comment 0x01 POKEPCI PCICONF[OP2] := OP1 0x02 OUTB PORT[OP2] := OP1 @@ -843,343 +546,10 @@ static void jamtable_disasm_command(running_machine &machine, int ref, int param jamtable_disasm(machine, space, (UINT32)addr, (UINT32)size); } -static void dump_string_command(running_machine &machine, int ref, int params, const char **param) -{ - chihiro_state *state = machine.driver_data<chihiro_state>(); - address_space &space = state->m_maincpu->space(); - UINT64 addr; - offs_t address; - UINT32 length, maximumlength; - offs_t buffer; - - if (params < 1) - return; - if (!debug_command_parameter_number(machine, param[0], &addr)) - return; - address = (offs_t)addr; - if (!debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &address)) - { - debug_console_printf(machine, "Address is unmapped.\n"); - return; - } - length = space.read_word_unaligned(address); - maximumlength = space.read_word_unaligned(address + 2); - buffer = space.read_dword_unaligned(address + 4); - debug_console_printf(machine, "Length %d word\n", length); - debug_console_printf(machine, "MaximumLength %d word\n", maximumlength); - debug_console_printf(machine, "Buffer %08X byte* ", buffer); - if (!debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &buffer)) - { - debug_console_printf(machine, "\nBuffer is unmapped.\n"); - return; - } - if (length > 256) - length = 256; - for (int a = 0; a < length; a++) - { - UINT8 c = space.read_byte(buffer + a); - debug_console_printf(machine, "%c", c); - } - debug_console_printf(machine, "\n"); -} - -static void dump_process_command(running_machine &machine, int ref, int params, const char **param) -{ - chihiro_state *state = machine.driver_data<chihiro_state>(); - address_space &space = state->m_maincpu->space(); - UINT64 addr; - offs_t address; - - if (params < 1) - return; - if (!debug_command_parameter_number(machine, param[0], &addr)) - return; - address = (offs_t)addr; - if (!debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &address)) - { - debug_console_printf(machine, "Address is unmapped.\n"); - return; - } - debug_console_printf(machine, "ReadyListHead {%08X,%08X} _LIST_ENTRY\n", space.read_dword_unaligned(address), space.read_dword_unaligned(address + 4)); - debug_console_printf(machine, "ThreadListHead {%08X,%08X} _LIST_ENTRY\n", space.read_dword_unaligned(address + 8), space.read_dword_unaligned(address + 12)); - debug_console_printf(machine, "StackCount %d dword\n", space.read_dword_unaligned(address + 16)); - debug_console_printf(machine, "ThreadQuantum %d dword\n", space.read_dword_unaligned(address + 20)); - debug_console_printf(machine, "BasePriority %d byte\n", space.read_byte(address + 24)); - debug_console_printf(machine, "DisableBoost %d byte\n", space.read_byte(address + 25)); - debug_console_printf(machine, "DisableQuantum %d byte\n", space.read_byte(address + 26)); - debug_console_printf(machine, "_padding %d byte\n", space.read_byte(address + 27)); -} - -static void dump_list_command(running_machine &machine, int ref, int params, const char **param) -{ - chihiro_state *state = machine.driver_data<chihiro_state>(); - address_space &space = state->m_maincpu->space(); - UINT64 addr, offs, start, old; - offs_t address, offset; - - if (params < 1) - return; - if (!debug_command_parameter_number(machine, param[0], &addr)) - return; - offs = 0; - offset = 0; - if (params >= 2) - { - if (!debug_command_parameter_number(machine, param[1], &offs)) - return; - offset = (offs_t)offs; - } - start = addr; - address = (offs_t)addr; - if (!debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &address)) - { - debug_console_printf(machine, "Address is unmapped.\n"); - return; - } - if (params >= 2) - debug_console_printf(machine, "Entry Object\n"); - else - debug_console_printf(machine, "Entry\n"); - for (int num = 0; num < 32; num++) - { - if (params >= 2) - debug_console_printf(machine, "%08X %08X\n", (UINT32)addr, (offs_t)addr - offset); - else - debug_console_printf(machine, "%08X\n", (UINT32)addr); - old = addr; - addr = space.read_dword_unaligned(address); - if (addr == start) - break; - if (addr == old) - break; - address = (offs_t)addr; - if (!debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &address)) - break; - } -} - -static void dump_dpc_command(running_machine &machine, int ref, int params, const char **param) -{ - chihiro_state *state = machine.driver_data<chihiro_state>(); - address_space &space = state->m_maincpu->space(); - UINT64 addr; - offs_t address; - - if (params < 1) - return; - if (!debug_command_parameter_number(machine, param[0], &addr)) - return; - address = (offs_t)addr; - if (!debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &address)) - { - debug_console_printf(machine, "Address is unmapped.\n"); - return; - } - debug_console_printf(machine, "Type %d word\n", space.read_word_unaligned(address)); - debug_console_printf(machine, "Inserted %d byte\n", space.read_byte(address + 2)); - debug_console_printf(machine, "Padding %d byte\n", space.read_byte(address + 3)); - debug_console_printf(machine, "DpcListEntry {%08X,%08X} _LIST_ENTRY\n", space.read_dword_unaligned(address + 4), space.read_dword_unaligned(address + 8)); - debug_console_printf(machine, "DeferredRoutine %08X dword\n", space.read_dword_unaligned(address + 12)); - debug_console_printf(machine, "DeferredContext %08X dword\n", space.read_dword_unaligned(address + 16)); - debug_console_printf(machine, "SystemArgument1 %08X dword\n", space.read_dword_unaligned(address + 20)); - debug_console_printf(machine, "SystemArgument2 %08X dword\n", space.read_dword_unaligned(address + 24)); -} - -static void dump_timer_command(running_machine &machine, int ref, int params, const char **param) -{ - chihiro_state *state = machine.driver_data<chihiro_state>(); - address_space &space = state->m_maincpu->space(); - UINT64 addr; - offs_t address; - - if (params < 1) - return; - if (!debug_command_parameter_number(machine, param[0], &addr)) - return; - address = (offs_t)addr; - if (!debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &address)) - { - debug_console_printf(machine, "Address is unmapped.\n"); - return; - } - debug_console_printf(machine, "Header.Type %d byte\n", space.read_byte(address)); - debug_console_printf(machine, "Header.Absolute %d byte\n", space.read_byte(address + 1)); - debug_console_printf(machine, "Header.Size %d byte\n", space.read_byte(address + 2)); - debug_console_printf(machine, "Header.Inserted %d byte\n", space.read_byte(address + 3)); - debug_console_printf(machine, "Header.SignalState %08X dword\n", space.read_dword_unaligned(address + 4)); - debug_console_printf(machine, "Header.WaitListEntry {%08X,%08X} _LIST_ENTRY\n", space.read_dword_unaligned(address + 8), space.read_dword_unaligned(address + 12)); - debug_console_printf(machine, "DueTime %" I64FMT "x qword\n", (INT64)space.read_qword_unaligned(address + 16)); - debug_console_printf(machine, "TimerListEntry {%08X,%08X} _LIST_ENTRY\n", space.read_dword_unaligned(address + 24), space.read_dword_unaligned(address + 28)); - debug_console_printf(machine, "Dpc %08X dword\n", space.read_dword_unaligned(address + 32)); - debug_console_printf(machine, "Period %d dword\n", space.read_dword_unaligned(address + 36)); -} - -static void curthread_command(running_machine &machine, int ref, int params, const char **param) -{ - chihiro_state *state = machine.driver_data<chihiro_state>(); - address_space &space = state->m_maincpu->space(); - UINT64 fsbase; - UINT32 kthrd, topstack, tlsdata; - offs_t address; - - fsbase = state->m_maincpu->state_int(44); - address = (offs_t)fsbase + 0x28; - if (!debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &address)) - { - debug_console_printf(machine, "Address is unmapped.\n"); - return; - } - kthrd = space.read_dword_unaligned(address); - debug_console_printf(machine, "Current thread is %08X\n", kthrd); - address = (offs_t)kthrd + 0x1c; - if (!debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &address)) - return; - topstack = space.read_dword_unaligned(address); - debug_console_printf(machine, "Current thread stack top is %08X\n", topstack); - address = (offs_t)kthrd + 0x28; - if (!debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &address)) - return; - tlsdata = space.read_dword_unaligned(address); - if (tlsdata == 0) - address = (offs_t)topstack - 0x210 - 8; - else - address = (offs_t)tlsdata - 8; - if (!debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &address)) - return; - debug_console_printf(machine, "Current thread function is %08X\n", space.read_dword_unaligned(address)); -} - -static void generate_irq_command(running_machine &machine, int ref, int params, const char **param) -{ - UINT64 irq; - chihiro_state *chst = machine.driver_data<chihiro_state>(); - - if (params < 1) - return; - if (!debug_command_parameter_number(machine, param[0], &irq)) - return; - if (irq > 15) - return; - if (irq == 2) - return; - chst->debug_generate_irq((int)irq, true); -} - -static void nv2a_combiners_command(running_machine &machine, int ref, int params, const char **param) -{ - int en; - - chihiro_state *chst = machine.driver_data<chihiro_state>(); - en = chst->nvidia_nv2a->toggle_register_combiners_usage(); - if (en != 0) - debug_console_printf(machine, "Register combiners enabled\n"); - else - debug_console_printf(machine, "Register combiners disabled\n"); -} - -static void waitvblank_command(running_machine &machine, int ref, int params, const char **param) -{ - int en; - - chihiro_state *chst = machine.driver_data<chihiro_state>(); - en = chst->nvidia_nv2a->toggle_wait_vblank_support(); - if (en != 0) - debug_console_printf(machine, "Vblank method enabled\n"); - else - debug_console_printf(machine, "Vblank method disabled\n"); -} - -static void grab_texture_command(running_machine &machine, int ref, int params, const char **param) -{ - UINT64 type; - chihiro_state *chst = machine.driver_data<chihiro_state>(); - - if (params < 2) - return; - if (!debug_command_parameter_number(machine, param[0], &type)) - return; - if ((param[1][0] == 0) || (strlen(param[1]) > 127)) - return; - chst->nvidia_nv2a->debug_grab_texture((int)type, param[1]); -} - -static void grab_vprog_command(running_machine &machine, int ref, int params, const char **param) -{ - chihiro_state *chst = machine.driver_data<chihiro_state>(); - UINT32 instruction[4]; - FILE *fil; - - if (params < 1) - return; - if ((param[0][0] == 0) || (strlen(param[0]) > 127)) - return; - if ((fil = fopen(param[0], "wb")) == NULL) - return; - for (int n = 0; n < 136; n++) { - chst->nvidia_nv2a->debug_grab_vertex_program_slot(n, instruction); - fwrite(instruction, sizeof(UINT32), 4, fil); - } - fclose(fil); -} - -static void vprogdis_command(running_machine &machine, int ref, int params, const char **param) -{ - UINT64 address, length, type; - UINT32 instruction[4]; - offs_t addr; - vertex_program_disassembler vd; - char line[64]; - chihiro_state *chst = machine.driver_data<chihiro_state>(); - address_space &space = chst->m_maincpu->space(); - - if (params < 2) - return; - if (!debug_command_parameter_number(machine, param[0], &address)) - return; - if (!debug_command_parameter_number(machine, param[1], &length)) - return; - type = 0; - if (params > 2) - if (!debug_command_parameter_number(machine, param[2], &type)) - return; - while (length > 0) { - if (type == 1) { - addr = (offs_t)address; - if (!debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &addr)) - return; - instruction[0] = space.read_dword_unaligned(address); - instruction[1] = space.read_dword_unaligned(address + 4); - instruction[2] = space.read_dword_unaligned(address + 8); - instruction[3] = space.read_dword_unaligned(address + 12); - } - else - chst->nvidia_nv2a->debug_grab_vertex_program_slot((int)address, instruction); - while (vd.disassemble(instruction, line) != 0) - debug_console_printf(machine, "%s\n", line); - if (type == 1) - address = address + 4 * 4; - else - address++; - length--; - } -} - static void help_command(running_machine &machine, int ref, int params, const char **param) { debug_console_printf(machine, "Available Chihiro commands:\n"); debug_console_printf(machine, " chihiro jamdis,<start>,<size> -- Disassemble <size> bytes of JamTable instructions starting at <start>\n"); - debug_console_printf(machine, " chihiro dump_string,<address> -- Dump _STRING object at <address>\n"); - debug_console_printf(machine, " chihiro dump_process,<address> -- Dump _PROCESS object at <address>\n"); - debug_console_printf(machine, " chihiro dump_list,<address>[,<offset>] -- Dump _LIST_ENTRY chain starting at <address>\n"); - debug_console_printf(machine, " chihiro dump_dpc,<address> -- Dump _KDPC object at <address>\n"); - debug_console_printf(machine, " chihiro dump_timer,<address> -- Dump _KTIMER object at <address>\n"); - debug_console_printf(machine, " chihiro curthread -- Print information about current thread\n"); - debug_console_printf(machine, " chihiro irq,<number> -- Generate interrupt with irq number 0-15\n"); - debug_console_printf(machine, " chihiro nv2a_combiners -- Toggle use of register combiners\n"); - debug_console_printf(machine, " chihiro waitvblank -- Toggle support for wait vblank method\n"); - debug_console_printf(machine, " chihiro grab_texture,<type>,<filename> -- Save to <filename> the next used texture of type <type>\n"); - debug_console_printf(machine, " chihiro grab_vprog,<filename> -- save current vertex program instruction slots to <filename>\n"); - debug_console_printf(machine, " chihiro vprogdis,<address>,<length>[,<type>] -- disassemble <lenght> vertex program instructions at <address> of <type>\n"); debug_console_printf(machine, " chihiro help -- this list\n"); } @@ -1189,168 +559,19 @@ static void chihiro_debug_commands(running_machine &machine, int ref, int params return; if (strcmp("jamdis", param[0]) == 0) jamtable_disasm_command(machine, ref, params - 1, param + 1); - else if (strcmp("dump_string", param[0]) == 0) - dump_string_command(machine, ref, params - 1, param + 1); - else if (strcmp("dump_process", param[0]) == 0) - dump_process_command(machine, ref, params - 1, param + 1); - else if (strcmp("dump_list", param[0]) == 0) - dump_list_command(machine, ref, params - 1, param + 1); - else if (strcmp("dump_dpc", param[0]) == 0) - dump_dpc_command(machine, ref, params - 1, param + 1); - else if (strcmp("dump_timer", param[0]) == 0) - dump_timer_command(machine, ref, params - 1, param + 1); - else if (strcmp("curthread", param[0]) == 0) - curthread_command(machine, ref, params - 1, param + 1); - else if (strcmp("irq", param[0]) == 0) - generate_irq_command(machine, ref, params - 1, param + 1); - else if (strcmp("nv2a_combiners", param[0]) == 0) - nv2a_combiners_command(machine, ref, params - 1, param + 1); - else if (strcmp("waitvblank", param[0]) == 0) - waitvblank_command(machine, ref, params - 1, param + 1); - else if (strcmp("grab_texture", param[0]) == 0) - grab_texture_command(machine, ref, params - 1, param + 1); - else if (strcmp("grab_vprog", param[0]) == 0) - grab_vprog_command(machine, ref, params - 1, param + 1); - else if (strcmp("vprogdis", param[0]) == 0) - vprogdis_command(machine, ref, params - 1, param + 1); else help_command(machine, ref, params - 1, param + 1); } -void chihiro_state::debug_generate_irq(int irq, bool active) -{ - int state; - - if (active) - { - debug_irq_active = true; - debug_irq_number = irq; - state = 1; - } - else - { - debug_irq_active = false; - state = 0; - } - switch (irq) - { - case 0: - chihiro_devs.pic8259_1->ir0_w(state); - break; - case 1: - chihiro_devs.pic8259_1->ir1_w(state); - break; - case 3: - chihiro_devs.pic8259_1->ir3_w(state); - break; - case 4: - chihiro_devs.pic8259_1->ir4_w(state); - break; - case 5: - chihiro_devs.pic8259_1->ir5_w(state); - break; - case 6: - chihiro_devs.pic8259_1->ir6_w(state); - break; - case 7: - chihiro_devs.pic8259_1->ir7_w(state); - break; - case 8: - chihiro_devs.pic8259_2->ir0_w(state); - break; - case 9: - chihiro_devs.pic8259_2->ir1_w(state); - break; - case 10: - chihiro_devs.pic8259_2->ir2_w(state); - break; - case 11: - chihiro_devs.pic8259_2->ir3_w(state); - break; - case 12: - chihiro_devs.pic8259_2->ir4_w(state); - break; - case 13: - chihiro_devs.pic8259_2->ir5_w(state); - break; - case 14: - chihiro_devs.pic8259_2->ir6_w(state); - break; - case 15: - chihiro_devs.pic8259_2->ir7_w(state); - break; - } -} - -void chihiro_state::vblank_callback(screen_device &screen, bool state) -{ - if (nvidia_nv2a->vblank_callback(screen, state)) - chihiro_devs.pic8259_1->ir3_w(1); // IRQ 3 - else - chihiro_devs.pic8259_1->ir3_w(0); // IRQ 3 -} - -UINT32 chihiro_state::screen_update_callback(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - return nvidia_nv2a->screen_update_callback(screen, bitmap, cliprect); -} - -READ32_MEMBER(chihiro_state::geforce_r) -{ - return nvidia_nv2a->geforce_r(space, offset, mem_mask); -} - -WRITE32_MEMBER(chihiro_state::geforce_w) -{ - nvidia_nv2a->geforce_w(space, offset, data, mem_mask); -} - -static UINT32 geforce_pci_r(device_t *busdevice, device_t *device, int function, int reg, UINT32 mem_mask) -{ -#ifdef LOG_PCI - // logerror(" bus:1 device:NV_2A function:%d register:%d mask:%08X\n",function,reg,mem_mask); -#endif - return 0; -} - -static void geforce_pci_w(device_t *busdevice, device_t *device, int function, int reg, UINT32 data, UINT32 mem_mask) +void chihiro_state::hack_eeprom() { -#ifdef LOG_PCI - // logerror(" bus:1 device:NV_2A function:%d register:%d data:%08X mask:%08X\n",function,reg,data,mem_mask); -#endif + // 8003b744,3b744=0x90 0x90 + m_maincpu->space(0).write_byte(0x3b744, 0x90); + m_maincpu->space(0).write_byte(0x3b745, 0x90); + m_maincpu->space(0).write_byte(0x3b766, 0xc9); + m_maincpu->space(0).write_byte(0x3b767, 0xc3); } -/* - * ohci usb controller (placeholder for now) - */ - -#ifdef LOG_OHCI -static const char *const usbregnames[] = { - "HcRevision", - "HcControl", - "HcCommandStatus", - "HcInterruptStatus", - "HcInterruptEnable", - "HcInterruptDisable", - "HcHCCA", - "HcPeriodCurrentED", - "HcControlHeadED", - "HcControlCurrentED", - "HcBulkHeadED", - "HcBulkCurrentED", - "HcDoneHead", - "HcFmInterval", - "HcFmRemaining", - "HcFmNumber", - "HcPeriodicStart", - "HcLSThreshold", - "HcRhDescriptorA", - "HcRhDescriptorB", - "HcRhStatus", - "HcRhPortStatus[1]" -}; -#endif - static const struct { const char *game_name; struct { @@ -1360,720 +581,24 @@ static const struct { } hacks[2] = { { "chihiro", { { 0x6a79f, 0x01 }, { 0x6a7a0, 0x00 }, { 0x6b575, 0x00 }, { 0x6b576, 0x00 }, { 0x6b5af, 0x75 }, { 0x6b78a, 0x75 }, { 0x6b7ca, 0x00 }, { 0x6b7b8, 0x00 }, { 0x8f5b2, 0x75 }, { 0x79a9e, 0x74 }, { 0x79b80, 0x74 }, { 0x79b97, 0x74 }, { 0, 0 } } }, { "outr2", { { 0x12e4cf, 0x01 }, { 0x12e4d0, 0x00 }, { 0x4793e, 0x01 }, { 0x4793f, 0x00 }, { 0x47aa3, 0x01 }, { 0x47aa4, 0x00 }, { 0x14f2b6, 0x84 }, { 0x14f2d1, 0x75 }, { 0x8732f, 0x7d }, { 0x87384, 0x7d }, { 0x87388, 0xeb }, { 0, 0 } } } }; -READ32_MEMBER(chihiro_state::usbctrl_r) +void chihiro_state::hack_usb() { - UINT32 ret; + int p; -#ifdef LOG_OHCI - if (offset >= 0x54 / 4) - logerror("usb controller 0 register HcRhPortStatus[%d] read\n", (offset - 0x54 / 4) + 1); + if (usbhack_counter == 0) + p = 0; + else if (usbhack_counter == 1) // after game loaded + p = usbhack_index; else - logerror("usb controller 0 register %s read\n", usbregnames[offset]); -#endif - ret=ohcist.hc_regs[offset]; - if (offset == 0) { /* hacks needed until usb (and jvs) is implemented */ -#ifdef USB_ENABLED -#else - int p; - - if (usbhack_counter == 0) - p = 0; - else if (usbhack_counter == 1) // after game loaded - p = usbhack_index; - else - p = -1; - if (p >= 0) { - for (int a = 0; a < 16; a++) { - if (hacks[p].modify[a].address == 0) - break; - m_maincpu->space(0).write_byte(hacks[p].modify[a].address, hacks[p].modify[a].write_byte); - } + p = -1; + if (p >= 0) { + for (int a = 0; a < 16; a++) { + if (hacks[p].modify[a].address == 0) + break; + m_maincpu->space(0).write_byte(hacks[p].modify[a].address, hacks[p].modify[a].write_byte); } - usbhack_counter++; -#endif - } - return ret; -} - -WRITE32_MEMBER(chihiro_state::usbctrl_w) -{ -#ifdef USB_ENABLED - UINT32 old = ohcist.hc_regs[offset]; -#endif - -#ifdef LOG_OHCI - if (offset >= 0x54 / 4) - logerror("usb controller 0 register HcRhPortStatus[%d] write %08X\n", (offset - 0x54 / 4) + 1, data); - else - logerror("usb controller 0 register %s write %08X\n", usbregnames[offset], data); -#endif -#ifdef USB_ENABLED - if (offset == HcRhStatus) { - if (data & 0x80000000) - ohcist.hc_regs[HcRhStatus] &= ~0x8000; - if (data & 0x00020000) - ohcist.hc_regs[HcRhStatus] &= ~0x0002; - if (data & 0x00010000) - ohcist.hc_regs[HcRhStatus] &= ~0x0001; - return; - } - if (offset == HcControl) { - int hcfs; - - hcfs = (data >> 6) & 3; - if (hcfs == UsbOperational) { - ohcist.timer->enable(); - ohcist.timer->adjust(attotime::from_msec(1), 0, attotime::from_msec(1)); - ohcist.writebackdonehadcounter = 7; - } - else - ohcist.timer->enable(false); - ohcist.state = hcfs; - ohcist.interruptbulkratio = (data & 3) + 1; - } - if (offset == HcCommandStatus) { - if (data & 1) - ohcist.hc_regs[HcControl] |= 3 << 6; - ohcist.hc_regs[HcCommandStatus] |= data; - return; - } - if (offset == HcInterruptStatus) { - ohcist.hc_regs[HcInterruptStatus] &= ~data; - usb_ohci_interrupts(); - return; - } - if (offset == HcInterruptEnable) { - ohcist.hc_regs[HcInterruptEnable] |= data; - usb_ohci_interrupts(); - return; - } - if (offset == HcInterruptDisable) { - ohcist.hc_regs[HcInterruptEnable] &= ~data; - usb_ohci_interrupts(); - return; - } - if (offset >= HcRhPortStatus1) { - int port = offset - HcRhPortStatus1 + 1; // port 0 not used - // bit 0 ClearPortEnable: 1 clears PortEnableStatus - // bit 1 SetPortEnable: 1 sets PortEnableStatus - // bit 2 SetPortSuspend: 1 sets PortSuspendStatus - // bit 3 ClearSuspendStatus: 1 clears PortSuspendStatus - // bit 4 SetPortReset: 1 sets PortResetStatus - if (data & 0x10) { - ohcist.hc_regs[offset] |= 0x10; - ohcist.ports[port].function->execute_reset(); - // after 10ms set PortResetStatusChange and clear PortResetStatus and set PortEnableStatus - ohcist.ports[port].delay = 10; - } - // bit 8 SetPortPower: 1 sets PortPowerStatus - // bit 9 ClearPortPower: 1 clears PortPowerStatus - // bit 16 1 clears ConnectStatusChange - // bit 17 1 clears PortEnableStatusChange - // bit 18 1 clears PortSuspendStatusChange - // bit 19 1 clears PortOverCurrentIndicatorChange - // bit 20 1 clears PortResetStatusChange - if (ohcist.hc_regs[offset] != old) - ohcist.hc_regs[HcInterruptStatus] |= RootHubStatusChange; - usb_ohci_interrupts(); - return; - } -#endif - ohcist.hc_regs[offset] = data; -} - -TIMER_CALLBACK_MEMBER(chihiro_state::usb_ohci_timer) -{ - UINT32 hcca; - int changed = 0; - int list = 1; - bool cont = false; - int pid, remain, mps; - - hcca = ohcist.hc_regs[HcHCCA]; - if (ohcist.state == UsbOperational) { - // increment frame number - ohcist.framenumber = (ohcist.framenumber + 1) & 0xffff; - ohcist.space->write_dword(hcca + 0x80, ohcist.framenumber); - ohcist.hc_regs[HcFmNumber] = ohcist.framenumber; - } - // port reset delay - for (int p = 1; p <= 4; p++) { - if (ohcist.ports[p].delay > 0) { - ohcist.ports[p].delay--; - if (ohcist.ports[p].delay == 0) { - ohcist.hc_regs[HcRhPortStatus1 + p - 1] = (ohcist.hc_regs[HcRhPortStatus1 + p - 1] & ~(1 << 4)) | (1 << 20) | (1 << 1); // bit 1 PortEnableStatus - changed = 1; - } - } - } - if (ohcist.state == UsbOperational) { - while (list >= 0) - { - // select list, do transfer - if (list == 0) { - if (ohcist.hc_regs[HcControl] & (1 << 2)) { - // periodic - if (ohcist.hc_regs[HcControl] & (1 << 3)) { - // isochronous - } - } - list = -1; - } - if (list == 1) { - // control - if (ohcist.hc_regs[HcControl] & (1 << 4)) { - cont = true; - while (cont == true) { - // if current endpoint descriptor is not 0 use it, otherwise ... - if (ohcist.hc_regs[HcControlCurrentED] == 0) { - // ... check the filled bit ... - if (ohcist.hc_regs[HcCommandStatus] & (1 << 1)) { - // ... if 1 start processing from the head of the list - ohcist.hc_regs[HcControlCurrentED] = ohcist.hc_regs[HcControlHeadED]; - ohcist.hc_regs[HcCommandStatus] &= ~(1 << 1); - // but if the list is empty, go to the next list - if (ohcist.hc_regs[HcControlCurrentED] == 0) - cont = false; - } - else - cont = false; - } - if (cont == true) { - // service endpoint descriptor - usb_ohci_read_endpoint_descriptor(ohcist.hc_regs[HcControlCurrentED]); - // only if it is not halted and not to be skipped - if (!(ohcist.endpoint_descriptor.h | ohcist.endpoint_descriptor.k)) { - // compare the Endpoint Descriptor?s TailPointer and NextTransferDescriptor fields. - if (ohcist.endpoint_descriptor.headp != ohcist.endpoint_descriptor.tailp) { - UINT32 a, b; - // service transfer descriptor - usb_ohci_read_transfer_descriptor(ohcist.endpoint_descriptor.headp); - // get pid - if (ohcist.endpoint_descriptor.d == 1) - pid=OutPid; // out - else if (ohcist.endpoint_descriptor.d == 2) - pid=InPid; // in - else { - pid = ohcist.transfer_descriptor.dp; // 0 setup 1 out 2 in - } - // determine how much data to transfer - // setup pid must be 8 bytes - a = ohcist.transfer_descriptor.be & 0xfff; - b = ohcist.transfer_descriptor.cbp & 0xfff; - if ((ohcist.transfer_descriptor.be ^ ohcist.transfer_descriptor.cbp) & 0xfffff000) - a |= 0x1000; - remain = a - b + 1; - if (pid == InPid) { - mps = ohcist.endpoint_descriptor.mps; - if (remain < mps) - mps = remain; - } - else { - mps = ohcist.endpoint_descriptor.mps; - } - if (ohcist.transfer_descriptor.cbp == 0) - mps = 0; - b = ohcist.transfer_descriptor.cbp; - // if sending ... - if (pid != InPid) { - // ... get mps bytes - for (int c = 0; c < mps; c++) { - ohcist.buffer[c] = ohcist.space->read_byte(b); - b++; - if ((b & 0xfff) == 0) - b = ohcist.transfer_descriptor.be & 0xfffff000; - } - } - // should check for time available - // execute transaction - mps=ohcist.ports[1].function->execute_transfer(ohcist.endpoint_descriptor.fa, ohcist.endpoint_descriptor.en, pid, ohcist.buffer, mps); - // if receiving ... - if (pid == InPid) { - // ... store mps bytes - for (int c = 0; c < mps; c++) { - ohcist.space->write_byte(b,ohcist.buffer[c]); - b++; - if ((b & 0xfff) == 0) - b = ohcist.transfer_descriptor.be & 0xfffff000; - } - } - // status writeback (CompletionCode field, DataToggleControl field, CurrentBufferPointer field, ErrorCount field) - ohcist.transfer_descriptor.cc = NoError; - ohcist.transfer_descriptor.t = (ohcist.transfer_descriptor.t ^ 1) | 2; - ohcist.transfer_descriptor.cbp = b; - ohcist.transfer_descriptor.ec = 0; - if ((remain == mps) || (mps == 0)) { - // retire transfer descriptor - a = ohcist.endpoint_descriptor.headp; - ohcist.endpoint_descriptor.headp = ohcist.transfer_descriptor.nexttd; - ohcist.transfer_descriptor.nexttd = ohcist.hc_regs[HcDoneHead]; - ohcist.hc_regs[HcDoneHead] = a; - ohcist.endpoint_descriptor.c = ohcist.transfer_descriptor.t & 1; - if (ohcist.transfer_descriptor.di != 7) { - if (ohcist.transfer_descriptor.di < ohcist.writebackdonehadcounter) - ohcist.writebackdonehadcounter = ohcist.transfer_descriptor.di; - } - usb_ohci_writeback_transfer_descriptor(a); - usb_ohci_writeback_endpoint_descriptor(ohcist.hc_regs[HcControlCurrentED]); - } else { - usb_ohci_writeback_transfer_descriptor(ohcist.endpoint_descriptor.headp); - } - } else - ohcist.hc_regs[HcControlCurrentED] = ohcist.endpoint_descriptor.nexted; - } else - ohcist.hc_regs[HcControlCurrentED] = ohcist.endpoint_descriptor.nexted; - // one bulk every n control transfers - ohcist.interruptbulkratio--; - if (ohcist.interruptbulkratio <= 0) { - ohcist.interruptbulkratio = (ohcist.hc_regs[HcControl] & 3) + 1; - cont = false; - } - } - } - } - list = 2; - } - if (list == 2) { - // bulk - if (ohcist.hc_regs[HcControl] & (1 << 5)) { - ohcist.hc_regs[HcCommandStatus] &= ~(1 << 2); - if (ohcist.hc_regs[HcControlCurrentED] == 0) - list = 0; - else if (ohcist.hc_regs[HcControl] & (1 << 4)) - list = 1; - else - list = 0; - } - } - } - if (ohcist.framenumber == 0) - ohcist.hc_regs[HcInterruptStatus] |= FrameNumberOverflow; - ohcist.hc_regs[HcInterruptStatus] |= StartofFrame; - if ((ohcist.writebackdonehadcounter != 0) && (ohcist.writebackdonehadcounter != 7)) - ohcist.writebackdonehadcounter--; - if ((ohcist.writebackdonehadcounter == 0) && ((ohcist.hc_regs[HcInterruptStatus] & WritebackDoneHead) == 0)) { - UINT32 b = 0; - - if ((ohcist.hc_regs[HcInterruptStatus] & ohcist.hc_regs[HcInterruptEnable]) != WritebackDoneHead) - b = 1; - ohcist.hc_regs[HcInterruptStatus] |= WritebackDoneHead; - ohcist.space->write_dword(hcca + 0x84, ohcist.hc_regs[HcDoneHead] | b); - ohcist.hc_regs[HcDoneHead] = 0; - ohcist.writebackdonehadcounter = 7; - } - } - if (changed != 0) { - ohcist.hc_regs[HcInterruptStatus] |= RootHubStatusChange; - } - usb_ohci_interrupts(); -} - -void chihiro_state::usb_ohci_plug(int port, ohci_function_device *function) -{ - if ((port > 0) && (port <= 4)) { - ohcist.ports[port].function = function; - ohcist.hc_regs[HcRhPortStatus1+port-1] = 1; - } -} - -static USBStandardDeviceDscriptor devdesc = {18,1,0x201,0xff,0x34,0x56,64,0x100,0x101,0x301,0,0,0,1}; - -ohci_function_device::ohci_function_device() -{ - address = 0; - controldir = 0; - remain = 0; - position = NULL; -} - -void ohci_function_device::execute_reset() -{ - address = 0; -} - -int ohci_function_device::execute_transfer(int address, int endpoint, int pid, UINT8 *buffer, int size) -{ - if (endpoint == 0) { - if (pid == SetupPid) { - struct USBSetupPacket *p=(struct USBSetupPacket *)buffer; - // define direction - controldir = p->bmRequestType & 128; - // case !=0, in data stage and out status stage - // case ==0, out data stage and in status stage - position = NULL; - remain = p->wLength; - if ((p->bmRequestType & 0x60) == 0) { - switch (p->bRequest) { - case GET_DESCRIPTOR: - if ((p->wValue >> 8) == 1) { // device descriptor - //p->wValue & 255; - position = (UINT8 *)&devdesc; - remain = sizeof(devdesc); - } - break; - case SET_ADDRESS: - //p->wValue; - break; - default: - break; - } - } - } - else if (pid == InPid) { - // case !=0, give data - // case ==0, nothing - if (size > remain) - size = remain; - if (controldir != 0) { - if (position != NULL) - memcpy(buffer, position, size); - position = position + size; - remain = remain - size; - } - } - else if (pid == OutPid) { - // case !=0, nothing - // case ==0, give data - if (size > remain) - size = remain; - if (controldir == 0) { - if (position != NULL) - memcpy(position, buffer, size); - position = position + size; - remain = remain - size; - } - } - } - return size; -} - -void chihiro_state::usb_ohci_interrupts() -{ - if (((ohcist.hc_regs[HcInterruptStatus] & ohcist.hc_regs[HcInterruptEnable]) != 0) && ((ohcist.hc_regs[HcInterruptEnable] & MasterInterruptEnable) != 0)) - chihiro_devs.pic8259_1->ir1_w(1); - else - chihiro_devs.pic8259_1->ir1_w(0); -} - -void chihiro_state::usb_ohci_read_endpoint_descriptor(UINT32 address) -{ - UINT32 w; - - w = ohcist.space->read_dword(address); - ohcist.endpoint_descriptor.word0 = w; - ohcist.endpoint_descriptor.fa = w & 0x7f; - ohcist.endpoint_descriptor.en = (w >> 7) & 15; - ohcist.endpoint_descriptor.d = (w >> 11) & 3; - ohcist.endpoint_descriptor.s = (w >> 13) & 1; - ohcist.endpoint_descriptor.k = (w >> 14) & 1; - ohcist.endpoint_descriptor.f = (w >> 15) & 1; - ohcist.endpoint_descriptor.mps = (w >> 16) & 0x7ff; - ohcist.endpoint_descriptor.tailp = ohcist.space->read_dword(address + 4); - w = ohcist.space->read_dword(address + 8); - ohcist.endpoint_descriptor.headp = w & 0xfffffffc; - ohcist.endpoint_descriptor.h = w & 1; - ohcist.endpoint_descriptor.c = (w >> 1) & 1; - ohcist.endpoint_descriptor.nexted = ohcist.space->read_dword(address + 12); -} - -void chihiro_state::usb_ohci_writeback_endpoint_descriptor(UINT32 address) -{ - UINT32 w; - - w = ohcist.endpoint_descriptor.word0 & 0xf8000000; - w = w | (ohcist.endpoint_descriptor.mps << 16) | (ohcist.endpoint_descriptor.f << 15) | (ohcist.endpoint_descriptor.k << 14) | (ohcist.endpoint_descriptor.s << 13) | (ohcist.endpoint_descriptor.d << 11) | (ohcist.endpoint_descriptor.en << 7) | ohcist.endpoint_descriptor.fa; - ohcist.space->write_dword(address, w); - w = ohcist.endpoint_descriptor.headp | (ohcist.endpoint_descriptor.c << 1) | ohcist.endpoint_descriptor.h; - ohcist.space->write_dword(address + 8, w); -} - -void chihiro_state::usb_ohci_read_transfer_descriptor(UINT32 address) -{ - UINT32 w; - - w = ohcist.space->read_dword(address); - ohcist.transfer_descriptor.word0 = w; - ohcist.transfer_descriptor.cc = (w >> 28) & 15; - ohcist.transfer_descriptor.ec= (w >> 26) & 3; - ohcist.transfer_descriptor.t= (w >> 24) & 3; - ohcist.transfer_descriptor.di= (w >> 21) & 7; - ohcist.transfer_descriptor.dp= (w >> 19) & 3; - ohcist.transfer_descriptor.r = (w >> 18) & 1; - ohcist.transfer_descriptor.cbp = ohcist.space->read_dword(address + 4); - ohcist.transfer_descriptor.nexttd = ohcist.space->read_dword(address + 8); - ohcist.transfer_descriptor.be = ohcist.space->read_dword(address + 12); -} - -void chihiro_state::usb_ohci_writeback_transfer_descriptor(UINT32 address) -{ - UINT32 w; - - w = ohcist.transfer_descriptor.word0 & 0x0003ffff; - w = w | (ohcist.transfer_descriptor.cc << 28) | (ohcist.transfer_descriptor.ec << 26) | (ohcist.transfer_descriptor.t << 24) | (ohcist.transfer_descriptor.di << 21) | (ohcist.transfer_descriptor.dp << 19) | (ohcist.transfer_descriptor.r << 18); - ohcist.space->write_dword(address, w); - ohcist.space->write_dword(address + 4, ohcist.transfer_descriptor.cbp); - ohcist.space->write_dword(address + 8, ohcist.transfer_descriptor.nexttd); -} - -void chihiro_state::usb_ohci_read_isochronous_transfer_descriptor(UINT32 address) -{ - UINT32 w; - - w = ohcist.space->read_dword(address); - ohcist.isochronous_transfer_descriptor.cc = (w >> 28) & 15; - ohcist.isochronous_transfer_descriptor.fc = (w >> 24) & 7; - ohcist.isochronous_transfer_descriptor.di = (w >> 21) & 7; - ohcist.isochronous_transfer_descriptor.sf = w & 0xffff; - ohcist.isochronous_transfer_descriptor.bp0 = ohcist.space->read_dword(address + 4) & 0xfffff000; - ohcist.isochronous_transfer_descriptor.nexttd = ohcist.space->read_dword(address + 8); - ohcist.isochronous_transfer_descriptor.be = ohcist.space->read_dword(address + 12); - w = ohcist.space->read_dword(address + 16); - ohcist.isochronous_transfer_descriptor.offset[0] = w & 0xffff; - ohcist.isochronous_transfer_descriptor.offset[1] = (w >> 16) & 0xffff; - w = ohcist.space->read_dword(address + 20); - ohcist.isochronous_transfer_descriptor.offset[2] = w & 0xffff; - ohcist.isochronous_transfer_descriptor.offset[3] = (w >> 16) & 0xffff; - w = ohcist.space->read_dword(address + 24); - ohcist.isochronous_transfer_descriptor.offset[4] = w & 0xffff; - ohcist.isochronous_transfer_descriptor.offset[5] = (w >> 16) & 0xffff; - w = ohcist.space->read_dword(address + 28); - ohcist.isochronous_transfer_descriptor.offset[6] = w & 0xffff; - ohcist.isochronous_transfer_descriptor.offset[7] = (w >> 16) & 0xffff; -} - -/* - * Audio - */ - -READ32_MEMBER(chihiro_state::audio_apu_r) -{ - logerror("Audio_APU: read from %08X mask %08X\n", 0xfe800000 + offset * 4, mem_mask); - if (offset == 0x20010 / 4) // some kind of internal counter or state value - return 0x20 + 4 + 8 + 0x48 + 0x80; - return apust.memory[offset]; -} - -WRITE32_MEMBER(chihiro_state::audio_apu_w) -{ - //UINT32 old; - UINT32 v; - - logerror("Audio_APU: write at %08X mask %08X value %08X\n", 0xfe800000 + offset * 4, mem_mask, data); - //old = apust.memory[offset]; - apust.memory[offset] = data; - if (offset == 0x02040 / 4) // address of memory area with scatter-gather info (gpdsp scratch dma) - apust.gpdsp_sgaddress = data; - if (offset == 0x020d4 / 4) { // block count (gpdsp) - apust.gpdsp_sgblocks = data; - apust.gpdsp_address = apust.space->read_dword(apust.gpdsp_sgaddress); // memory address of first block - apust.timer->enable(); - apust.timer->adjust(attotime::from_msec(1), 0, attotime::from_msec(1)); - } - if (offset == 0x02048 / 4) // (epdsp scratch dma) - apust.epdsp_sgaddress = data; - if (offset == 0x020dc / 4) // (epdsp) - apust.epdsp_sgblocks = data; - if (offset == 0x0204c / 4) // address of memory area with information about blocks - apust.unknown_sgaddress = data; - if (offset == 0x020e0 / 4) // block count - 1 - apust.unknown_sgblocks = data; - if (offset == 0x0202c / 4) { // address of memory area with 0x80 bytes for each voice - apust.voicedata_address = data; - return; - } - if (offset == 0x04024 / 4) // offset in memory area indicated by 0x204c (analog output ?) - return; - if (offset == 0x04034 / 4) // size - return; - if (offset == 0x04028 / 4) // offset in memory area indicated by 0x204c (digital output ?) - return; - if (offset == 0x04038 / 4) // size - return; - if (offset == 0x20804 / 4) { // block number for scatter-gather heap that stores sampled audio to be played - if (data >= 1024) { - logerror("Audio_APU: sg block number too high, increase size of voices_heap_blockaddr\n"); - apust.memory[offset] = 1023; - } - return; - } - if (offset == 0x20808 / 4) { // block address for scatter-gather heap that stores sampled audio to be played - apust.voices_heap_blockaddr[apust.memory[0x20804 / 4]] = data; - return; - } - if (offset == 0x202f8 / 4) { // voice number for parameters ? - apust.voice_number = data; - return; - } - if (offset == 0x202fc / 4) // 1 when accessing voice parameters 0 otherwise - return; - if (offset == 0x20304 / 4) { // format - /* - bits 28-31 sample format: - 0 8-bit pcm - 5 16-bit pcm - 10 adpcm ? - 14 24-bit pcm - 15 32-bit pcm - bits 16-20 number of channels - 1: - 0 mono - 1 stereo - */ - return; - } - if (offset == 0x2037c / 4) { // value related to sample rate - INT16 v = (INT16)(data >> 16); // upper 16 bits as a signed 16 bit value - float vv = ((float)v) / 4096.0f; // divide by 4096 - float vvv = powf(2, vv); // two to the vv - int f = vvv*48000.0f; // sample rate - apust.voices_frequency[apust.voice_number] = f; - return; - } - if (offset == 0x203a0 / 4) // start offset of data in scatter-gather heap - return; - if (offset == 0x203a4 / 4) { // first sample to play - apust.voices_position_start[apust.voice_number] = data * 1000; - return; - } - if (offset == 0x203dc / 4) { // last sample to play - apust.voices_position_end[apust.voice_number] = data * 1000; - return; - } - if (offset == 0x2010c / 4) // voice processor 0 idle 1 not idle ? - return; - if (offset == 0x20124 / 4) { // voice number to activate ? - v = apust.voice_number; - apust.voices_active[v >> 6] |= ((UINT64)1 << (v & 63)); - apust.voices_position[v] = apust.voices_position_start[apust.voice_number]; - apust.voices_position_increment[apust.voice_number] = apust.voices_frequency[apust.voice_number]; - return; - } - if (offset == 0x20128 / 4) { // voice number to deactivate ? - v = apust.voice_number; - apust.voices_active[v >> 6] &= ~(1 << (v & 63)); - return; - } - if (offset == 0x20140 / 4) // voice number to ? - return; - if ((offset >= 0x20200 / 4) && (offset < 0x20280 / 4)) // headroom for each of the 32 mixbins - return; - if (offset == 0x20280 / 4) // hrtf headroom ? - return; -} - -READ32_MEMBER(chihiro_state::audio_ac93_r) -{ - UINT32 ret = 0; - - logerror("Audio_AC3: read from %08X mask %08X\n", 0xfec00000 + offset * 4, mem_mask); - if (offset < 0x80 / 4) - { - ret = ac97st.mixer_regs[offset]; - } - if ((offset >= 0x100 / 4) && (offset <= 0x138 / 4)) - { - offset = offset - 0x100 / 4; - if (offset == 0x18 / 4) - { - ac97st.controller_regs[offset] &= ~0x02000000; // REGRST: register reset - } - if (offset == 0x30 / 4) - { - ac97st.controller_regs[offset] |= 0x100; // PCRDY: primary codec ready - } - if (offset == 0x34 / 4) - { - ac97st.controller_regs[offset] &= ~1; // CAS: codec access semaphore - } - ret = ac97st.controller_regs[offset]; - } - return ret; -} - -WRITE32_MEMBER(chihiro_state::audio_ac93_w) -{ - logerror("Audio_AC3: write at %08X mask %08X value %08X\n", 0xfec00000 + offset * 4, mem_mask, data); - if (offset < 0x80 / 4) - { - COMBINE_DATA(ac97st.mixer_regs + offset); - } - if ((offset >= 0x100 / 4) && (offset <= 0x138 / 4)) - { - offset = offset - 0x100 / 4; - COMBINE_DATA(ac97st.controller_regs + offset); } -} - -TIMER_CALLBACK_MEMBER(chihiro_state::audio_apu_timer) -{ - int cmd; - int bb, b, v; - UINT64 bv; - UINT32 phys; - - cmd = apust.space->read_dword(apust.gpdsp_address + 0x800 + 0x10); - if (cmd == 3) - apust.space->write_dword(apust.gpdsp_address + 0x800 + 0x10, 0); - /*else - logerror("Audio_APU: unexpected value at address %d\n",apust.gpdsp_address+0x800+0x10);*/ - for (b = 0; b < 4; b++) { - bv = 1; - for (bb = 0; bb < 64; bb++) { - if (apust.voices_active[b] & bv) { - v = bb + (b << 6); - apust.voices_position[v] += apust.voices_position_increment[v]; - while (apust.voices_position[v] >= apust.voices_position_end[v]) - apust.voices_position[v] = apust.voices_position_start[v] + apust.voices_position[v] - apust.voices_position_end[v] - 1000; - phys = apust.voicedata_address + 0x80 * v; - apust.space->write_dword(phys + 0x58, apust.voices_position[v] / 1000); - } - bv = bv << 1; - } - } -} - -static UINT32 hubintiasbridg_pci_r(device_t *busdevice, device_t *device, int function, int reg, UINT32 mem_mask) -{ -#ifdef LOG_PCI - // logerror(" bus:0 function:%d register:%d mask:%08X\n",function,reg,mem_mask); -#endif - if ((function == 0) && (reg == 8)) - return 0xb4; // 0:1:0 revision id must be at least 0xb4, otherwise usb will require a hub - return 0; -} - -static void hubintiasbridg_pci_w(device_t *busdevice, device_t *device, int function, int reg, UINT32 data, UINT32 mem_mask) -{ -#ifdef LOG_PCI - if (reg >= 16) logerror(" bus:0 function:%d register:%d data:%08X mask:%08X\n", function, reg, data, mem_mask); -#endif -} - -/* - * dummy for non connected devices - */ - -static UINT32 dummy_pci_r(device_t *busdevice, device_t *device, int function, int reg, UINT32 mem_mask) -{ -#ifdef LOG_PCI - // logerror(" bus:0 function:%d register:%d mask:%08X\n",function,reg,mem_mask); -#endif - return 0; -} - -static void dummy_pci_w(device_t *busdevice, device_t *device, int function, int reg, UINT32 data, UINT32 mem_mask) -{ -#ifdef LOG_PCI - if (reg >= 16) logerror(" bus:0 function:%d register:%d data:%08X mask:%08X\n", function, reg, data, mem_mask); -#endif -} - -READ32_MEMBER(chihiro_state::dummy_r) -{ - return 0; -} - -WRITE32_MEMBER(chihiro_state::dummy_w) -{ + usbhack_counter++; } // ======================> ide_baseboard_device @@ -2271,7 +796,7 @@ void chihiro_state::baseboard_ide_event(int type, UINT8 *read_buffer, UINT8 *wri // clear write_buffer[0] = write_buffer[1] = write_buffer[2] = write_buffer[3] = 0; // irq 10 active - chihiro_devs.pic8259_2->ir2_w(1); + xbox_base_devs.pic8259_2->ir2_w(1); } UINT8 *chihiro_state::baseboard_ide_dimmboard(UINT32 lba) @@ -2282,192 +807,6 @@ UINT8 *chihiro_state::baseboard_ide_dimmboard(UINT32 lba) return NULL; } -/* - * PIC & PIT - */ - -WRITE_LINE_MEMBER(chihiro_state::chihiro_pic8259_1_set_int_line) -{ - m_maincpu->set_input_line(0, state ? HOLD_LINE : CLEAR_LINE); -} - -READ8_MEMBER(chihiro_state::get_slave_ack) -{ - if (offset == 2) { // IRQ = 2 - return chihiro_devs.pic8259_2->acknowledge(); - } - return 0x00; -} - -IRQ_CALLBACK_MEMBER(chihiro_state::irq_callback) -{ - int r = 0; - r = chihiro_devs.pic8259_2->acknowledge(); - if (r == 0) - { - r = chihiro_devs.pic8259_1->acknowledge(); - } - if (debug_irq_active) - debug_generate_irq(debug_irq_number, false); - return r; -} - -WRITE_LINE_MEMBER(chihiro_state::chihiro_pit8254_out0_changed) -{ - if (chihiro_devs.pic8259_1) - { - chihiro_devs.pic8259_1->ir0_w(state); - } -} - -WRITE_LINE_MEMBER(chihiro_state::chihiro_pit8254_out2_changed) -{ - //chihiro_speaker_set_input( state ? 1 : 0 ); -} - -/* - * SMbus devices - */ - -int smbus_callback_pic16lc(chihiro_state &chs, int command, int rw, int data) -{ - return chs.smbus_pic16lc(command, rw, data); -} - -int chihiro_state::smbus_pic16lc(int command, int rw, int data) -{ - if (rw == 1) { // read - if (command == 0) { - if (pic16lc_buffer[0] == 'D') - pic16lc_buffer[0] = 'X'; - else if (pic16lc_buffer[0] == 'X') - pic16lc_buffer[0] = 'B'; - else if (pic16lc_buffer[0] == 'B') - pic16lc_buffer[0] = 'D'; - } - logerror("pic16lc: %d %d %d\n", command, rw, pic16lc_buffer[command]); - return pic16lc_buffer[command]; - } - else - if (command == 0) - pic16lc_buffer[0] = 'B'; - else - pic16lc_buffer[command] = (UINT8)data; - logerror("pic16lc: %d %d %d\n", command, rw, data); - return 0; -} - -int smbus_callback_cx25871(chihiro_state &chs, int command, int rw, int data) -{ - return chs.smbus_cx25871(command, rw, data); -} - -int chihiro_state::smbus_cx25871(int command, int rw, int data) -{ - logerror("cx25871: %d %d %d\n", command, rw, data); - return 0; -} - -// let's try to fake the missing eeprom -static int dummyeeprom[256]={0x94,0x18,0x10,0x59,0x83,0x58,0x15,0xDA,0xDF,0xCC,0x1D,0x78,0x20,0x8A,0x61,0xB8,0x08,0xB4,0xD6,0xA8, - 0x9E,0x77,0x9C,0xEB,0xEA,0xF8,0x93,0x6E,0x3E,0xD6,0x9C,0x49,0x6B,0xB5,0x6E,0xAB,0x6D,0xBC,0xB8,0x80,0x68,0x9D,0xAA,0xCD,0x0B,0x83, - 0x17,0xEC,0x2E,0xCE,0x35,0xA8,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x61,0x62,0x63,0xAA,0xBB,0xCC,0xDD,0xEE,0xFF,0x00,0x00, - 0x4F,0x6E,0x6C,0x69,0x6E,0x65,0x6B,0x65,0x79,0x69,0x6E,0x76,0x61,0x6C,0x69,0x64,0x00,0x03,0x80,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF, - 0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; - -int smbus_callback_eeprom(chihiro_state &chs, int command, int rw, int data) -{ - return chs.smbus_eeprom(command, rw, data); -} - -int chihiro_state::smbus_eeprom(int command, int rw, int data) -{ - if (command >= 112) - return 0; - if (rw == 1) { // if reading - // 8003b744,3b744=0x90 0x90 - // hack to avoid hanging if eeprom contents are not correct - // this would need dumping the serial eeprom on the xbox board - if (command == 0) { - m_maincpu->space(0).write_byte(0x3b744, 0x90); - m_maincpu->space(0).write_byte(0x3b745, 0x90); - m_maincpu->space(0).write_byte(0x3b766, 0xc9); - m_maincpu->space(0).write_byte(0x3b767, 0xc3); - } - data = dummyeeprom[command] + dummyeeprom[command + 1] * 256; - logerror("eeprom: %d %d %d\n", command, rw, data); - return data; - } - logerror("eeprom: %d %d %d\n", command, rw, data); - dummyeeprom[command] = data; - return 0; -} - -/* - * SMbus controller - */ - -void chihiro_state::smbus_register_device(int address, int(*handler)(chihiro_state &chs, int command, int rw, int data)) -{ - if (address < 128) - smbusst.devices[address] = handler; -} - -READ32_MEMBER(chihiro_state::smbus_r) -{ - if ((offset == 0) && (mem_mask == 0xff)) // 0 smbus status - smbusst.words[offset] = (smbusst.words[offset] & ~mem_mask) | ((smbusst.status << 0) & mem_mask); - if ((offset == 1) && ((mem_mask == 0x00ff0000) || (mem_mask == 0xffff0000))) // 6 smbus data - smbusst.words[offset] = (smbusst.words[offset] & ~mem_mask) | ((smbusst.data << 16) & mem_mask); - return smbusst.words[offset]; -} - -WRITE32_MEMBER(chihiro_state::smbus_w) -{ - COMBINE_DATA(smbusst.words); - if ((offset == 0) && (mem_mask == 0xff)) // 0 smbus status - { - if (!((smbusst.status ^ data) & 0x10)) // clearing interrupt - chihiro_devs.pic8259_2->ir3_w(0); // IRQ 11 - smbusst.status &= ~data; - } - if ((offset == 0) && (mem_mask == 0xff0000)) // 2 smbus control - { - data = data >> 16; - smbusst.control = data; - int cycletype = smbusst.control & 7; - if (smbusst.control & 8) { // start - if ((cycletype & 6) == 2) - { - if (smbusst.devices[smbusst.address]) - if (smbusst.rw == 0) - smbusst.devices[smbusst.address](*this, smbusst.command, smbusst.rw, smbusst.data); - else - smbusst.data = smbusst.devices[smbusst.address](*this, smbusst.command, smbusst.rw, smbusst.data); - else - logerror("SMBUS: access to missing device at address %d\n", smbusst.address); - smbusst.status |= 0x10; - if (smbusst.control & 0x10) - { - chihiro_devs.pic8259_2->ir3_w(1); // IRQ 11 - } - } - } - } - if ((offset == 1) && (mem_mask == 0xff)) // 4 smbus address - { - smbusst.address = data >> 1; - smbusst.rw = data & 1; - } - if ((offset == 1) && ((mem_mask == 0x00ff0000) || (mem_mask == 0xffff0000))) // 6 smbus data - { - data = data >> 16; - smbusst.data = data; - } - if ((offset == 2) && (mem_mask == 0xff)) // 8 smbus command - smbusst.command = data; -} - READ32_MEMBER(chihiro_state::mediaboard_r) { UINT32 r; @@ -2494,29 +833,16 @@ WRITE32_MEMBER(chihiro_state::mediaboard_w) logerror("I/O port write %04x mask %08X value %08X\n", offset * 4 + 0x4000, mem_mask, data); // irq 10 if ((offset == 0x38) && ACCESSING_BITS_8_15) - chihiro_devs.pic8259_2->ir2_w(0); + xbox_base_devs.pic8259_2->ir2_w(0); } -static ADDRESS_MAP_START(xbox_map, AS_PROGRAM, 32, chihiro_state) - AM_RANGE(0x00000000, 0x07ffffff) AM_RAM // 128 megabytes - AM_RANGE(0xf0000000, 0xf0ffffff) AM_RAM - AM_RANGE(0xfd000000, 0xfdffffff) AM_RAM AM_READWRITE(geforce_r, geforce_w) - AM_RANGE(0xfed00000, 0xfed003ff) AM_READWRITE(usbctrl_r, usbctrl_w) - AM_RANGE(0xfe800000, 0xfe85ffff) AM_READWRITE(audio_apu_r, audio_apu_w) - AM_RANGE(0xfec00000, 0xfec001ff) AM_READWRITE(audio_ac93_r, audio_ac93_w) - AM_RANGE(0xff000000, 0xffffffff) AM_ROM AM_REGION("bios", 0) AM_MIRROR(0x00f80000) +static ADDRESS_MAP_START(chihiro_map, AS_PROGRAM, 32, chihiro_state) + AM_IMPORT_FROM(xbox_base_map) ADDRESS_MAP_END -static ADDRESS_MAP_START(xbox_map_io, AS_IO, 32, chihiro_state) - AM_RANGE(0x0020, 0x0023) AM_DEVREADWRITE8("pic8259_1", pic8259_device, read, write, 0xffffffff) - AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE8("pit8254", pit8254_device, read, write, 0xffffffff) - AM_RANGE(0x00a0, 0x00a3) AM_DEVREADWRITE8("pic8259_2", pic8259_device, read, write, 0xffffffff) - AM_RANGE(0x01f0, 0x01f7) AM_DEVREADWRITE("ide", bus_master_ide_controller_device, read_cs0, write_cs0) - AM_RANGE(0x0cf8, 0x0cff) AM_DEVREADWRITE("pcibus", pci_bus_legacy_device, read, write) +static ADDRESS_MAP_START(chihiro_map_io, AS_IO, 32, chihiro_state) + AM_IMPORT_FROM(xbox_base_map_io) AM_RANGE(0x4000, 0x40ff) AM_READWRITE(mediaboard_r, mediaboard_w) - AM_RANGE(0x8000, 0x80ff) AM_READWRITE(dummy_r, dummy_w) - AM_RANGE(0xc000, 0xc0ff) AM_READWRITE(smbus_r, smbus_w) - AM_RANGE(0xff60, 0xff67) AM_DEVREADWRITE("ide", bus_master_ide_controller_device, bmdma_r, bmdma_w) ADDRESS_MAP_END static INPUT_PORTS_START(chihiro) @@ -2524,45 +850,14 @@ INPUT_PORTS_END void chihiro_state::machine_start() { - nvidia_nv2a = auto_alloc(machine(), nv2a_renderer(machine())); - memset(pic16lc_buffer, 0, sizeof(pic16lc_buffer)); - pic16lc_buffer[0] = 'B'; - pic16lc_buffer[4] = 0; // A/V connector, 2=vga - smbus_register_device(0x10, smbus_callback_pic16lc); - smbus_register_device(0x45, smbus_callback_cx25871); - smbus_register_device(0x54, smbus_callback_eeprom); - chihiro_devs.pic8259_1 = machine().device<pic8259_device>("pic8259_1"); - chihiro_devs.pic8259_2 = machine().device<pic8259_device>("pic8259_2"); + xbox_base_state::machine_start(); chihiro_devs.ide = machine().device<bus_master_ide_controller_device>("ide"); chihiro_devs.dimmboard = machine().device<naomi_gdrom_board>("rom_board"); if (chihiro_devs.dimmboard != NULL) { dimm_board_memory = chihiro_devs.dimmboard->memory(dimm_board_memory_size); } - memset(apust.memory, 0, sizeof(apust.memory)); - memset(apust.voices_heap_blockaddr, 0, sizeof(apust.voices_heap_blockaddr)); - memset(apust.voices_active, 0, sizeof(apust.voices_active)); - memset(apust.voices_position, 0, sizeof(apust.voices_position)); - memset(apust.voices_position_start, 0, sizeof(apust.voices_position_start)); - memset(apust.voices_position_end, 0, sizeof(apust.voices_position_end)); - memset(apust.voices_position_increment, 0, sizeof(apust.voices_position_increment)); - apust.space = &m_maincpu->space(); - apust.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(chihiro_state::audio_apu_timer), this), (void *)"APU Timer"); - apust.timer->enable(false); if (machine().debug_flags & DEBUG_FLAG_ENABLED) debug_console_register_command(machine(), "chihiro", CMDFLAG_NONE, 0, 1, 4, chihiro_debug_commands); - memset(&ohcist, 0, sizeof(ohcist)); -#ifdef USB_ENABLED - ohcist.hc_regs[HcRevision] = 0x10; - ohcist.hc_regs[HcFmInterval] = 0x2edf; - ohcist.hc_regs[HcLSThreshold] = 0x628; - ohcist.hc_regs[HcRhDescriptorA] = 4; - ohcist.interruptbulkratio = 1; - ohcist.writebackdonehadcounter = 7; - ohcist.space = &m_maincpu->space(); - ohcist.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(chihiro_state::usb_ohci_timer), this), (void *)"USB OHCI Timer"); - ohcist.timer->enable(false); - usb_ohci_plug(1, new ohci_function_device()); // test connect -#endif usbhack_index = -1; for (int a = 1; a < 2; a++) if (strcmp(machine().basename(), hacks[a].game_name) == 0) { @@ -2571,72 +866,23 @@ void chihiro_state::machine_start() } usbhack_counter = 0; // savestates - save_item(NAME(debug_irq_active)); - save_item(NAME(debug_irq_number)); - save_item(NAME(smbusst.status)); - save_item(NAME(smbusst.control)); - save_item(NAME(smbusst.address)); - save_item(NAME(smbusst.data)); - save_item(NAME(smbusst.command)); - save_item(NAME(smbusst.rw)); - save_item(NAME(smbusst.words)); - save_item(NAME(pic16lc_buffer)); save_item(NAME(usbhack_counter)); - nvidia_nv2a->start(&m_maincpu->space()); - nvidia_nv2a->savestate_items(); } static SLOT_INTERFACE_START(ide_baseboard) SLOT_INTERFACE("bb", IDE_BASEBOARD) SLOT_INTERFACE_END -static MACHINE_CONFIG_START(chihiro_base, chihiro_state) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", PENTIUM3, 733333333) /* Wrong! family 6 model 8 stepping 10 */ - MCFG_CPU_PROGRAM_MAP(xbox_map) - MCFG_CPU_IO_MAP(xbox_map_io) - MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(chihiro_state, irq_callback) - - MCFG_QUANTUM_TIME(attotime::from_hz(6000)) - - MCFG_PCI_BUS_LEGACY_ADD("pcibus", 0) - MCFG_PCI_BUS_LEGACY_DEVICE(0, "PCI Bridge Device - Host Bridge", dummy_pci_r, dummy_pci_w) - MCFG_PCI_BUS_LEGACY_DEVICE(1, "HUB Interface - ISA Bridge", hubintiasbridg_pci_r, hubintiasbridg_pci_w) - MCFG_PCI_BUS_LEGACY_DEVICE(2, "OHCI USB Controller 1", dummy_pci_r, dummy_pci_w) - MCFG_PCI_BUS_LEGACY_DEVICE(3, "OHCI USB Controller 2", dummy_pci_r, dummy_pci_w) - MCFG_PCI_BUS_LEGACY_DEVICE(4, "MCP Networking Adapter", dummy_pci_r, dummy_pci_w) - MCFG_PCI_BUS_LEGACY_DEVICE(5, "MCP APU", dummy_pci_r, dummy_pci_w) - MCFG_PCI_BUS_LEGACY_DEVICE(6, "AC`97 Audio Codec Interface", dummy_pci_r, dummy_pci_w) - MCFG_PCI_BUS_LEGACY_DEVICE(9, "IDE Controller", dummy_pci_r, dummy_pci_w) - MCFG_PCI_BUS_LEGACY_DEVICE(30, "AGP Host to PCI Bridge", dummy_pci_r, dummy_pci_w) - MCFG_PCI_BUS_LEGACY_ADD("agpbus", 1) - MCFG_PCI_BUS_LEGACY_SIBLING("pcibus") - MCFG_PCI_BUS_LEGACY_DEVICE(0, "NV2A GeForce 3MX Integrated GPU/Northbridge", geforce_pci_r, geforce_pci_w) - MCFG_PIC8259_ADD("pic8259_1", WRITELINE(chihiro_state, chihiro_pic8259_1_set_int_line), VCC, READ8(chihiro_state, get_slave_ack)) - MCFG_PIC8259_ADD("pic8259_2", DEVWRITELINE("pic8259_1", pic8259_device, ir2_w), GND, NULL) - - MCFG_DEVICE_ADD("pit8254", PIT8254, 0) - MCFG_PIT8253_CLK0(1125000) /* heartbeat IRQ */ - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(chihiro_state, chihiro_pit8254_out0_changed)) - MCFG_PIT8253_CLK1(1125000) /* (unused) dram refresh */ - MCFG_PIT8253_CLK2(1125000) /* (unused) pio port c pin 4, and speaker polling enough */ - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(chihiro_state, chihiro_pit8254_out2_changed)) - - MCFG_BUS_MASTER_IDE_CONTROLLER_ADD("ide", ide_baseboard, NULL, "bb", true) - MCFG_ATA_INTERFACE_IRQ_HANDLER(DEVWRITELINE("pic8259_2", pic8259_device, ir6_w)) - MCFG_BUS_MASTER_IDE_CONTROLLER_SPACE("maincpu", AS_PROGRAM) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 479) - MCFG_SCREEN_UPDATE_DRIVER(chihiro_state, screen_update_callback) - MCFG_SCREEN_VBLANK_DRIVER(chihiro_state, vblank_callback) - - MCFG_PALETTE_ADD("palette", 65536) +static MACHINE_CONFIG_DERIVED_CLASS(chihiro_base, xbox_base, chihiro_state) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(chihiro_map) + MCFG_CPU_IO_MAP(chihiro_map_io) + + //MCFG_BUS_MASTER_IDE_CONTROLLER_ADD("ide", ide_baseboard, NULL, "bb", true) + MCFG_DEVICE_MODIFY("ide:0") + MCFG_DEVICE_SLOT_INTERFACE(ide_baseboard, NULL, true) + MCFG_DEVICE_MODIFY("ide:1") + MCFG_DEVICE_SLOT_INTERFACE(ide_baseboard, "bb", true) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED(chihirogd, chihiro_base) @@ -2650,7 +896,7 @@ MACHINE_CONFIG_END ROMX_LOAD(name, offset, length, hash, ROM_BIOS(bios+1)) /* Note '+1' */ #define CHIHIRO_BIOS \ - ROM_REGION( 0x1000000, "bios", 0) \ + ROM_REGION( 0x80000, "bios", 0) \ ROM_SYSTEM_BIOS( 0, "bios0", "Chihiro Bios" ) \ ROM_LOAD_BIOS( 0, "chihiro_xbox_bios.bin", 0x000000, 0x80000, CRC(66232714) SHA1(b700b0041af8f84835e45d1d1250247bf7077188) ) \ ROM_REGION( 0x404080, "others", 0) \ diff --git a/src/mame/drivers/chqflag.c b/src/mame/drivers/chqflag.c index 06213dea834..4c9761dedf7 100644 --- a/src/mame/drivers/chqflag.c +++ b/src/mame/drivers/chqflag.c @@ -23,16 +23,6 @@ #include "chqflag.lh" -TIMER_DEVICE_CALLBACK_MEMBER(chqflag_state::chqflag_scanline) -{ - int scanline = param; - - if(scanline == 240 && m_k051960->k051960_is_irq_enabled()) // vblank irq - m_maincpu->set_input_line(KONAMI_IRQ_LINE, HOLD_LINE); - else if(((scanline % 32) == 0) && (m_k051960->k051960_is_nmi_enabled())) // timer irq - m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); -} - /* these trampolines are less confusing than nested address_map_bank_devices */ READ8_MEMBER(chqflag_state::k051316_1_ramrom_r) { @@ -297,9 +287,8 @@ void chqflag_state::machine_reset() static MACHINE_CONFIG_START( chqflag, chqflag_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", KONAMI,XTAL_24MHz/8) /* 052001 (verified on pcb) */ + MCFG_CPU_ADD("maincpu", KONAMI, XTAL_24MHz/2/4) /* 052001 (verified on pcb) */ MCFG_CPU_PROGRAM_MAP(chqflag_map) - MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", chqflag_state, chqflag_scanline, "screen", 0, 1) MCFG_CPU_ADD("audiocpu", Z80, XTAL_3_579545MHz) /* verified on pcb */ MCFG_CPU_PROGRAM_MAP(chqflag_sound_map) @@ -314,12 +303,10 @@ static MACHINE_CONFIG_START( chqflag, chqflag_state ) MCFG_QUANTUM_TIME(attotime::from_hz(600)) /* video hardware */ - //TODO: Vsync 59.17hz Hsync 15.13 / 15.19khz MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(64*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(12*8, (64-14)*8-1, 2*8, 30*8-1 ) + MCFG_SCREEN_RAW_PARAMS(XTAL_24MHz/3, 528, 96, 400, 256, 16, 240) // measured Vsync 59.17hz Hsync 15.13 / 15.19khz +// 6MHz dotclock is more realistic, however needs drawing updates. replace when ready +// MCFG_SCREEN_RAW_PARAMS(XTAL_24MHz/4, 396, hbend, hbstart, 256, 16, 240) MCFG_SCREEN_UPDATE_DRIVER(chqflag_state, screen_update_chqflag) MCFG_SCREEN_PALETTE("palette") @@ -329,7 +316,10 @@ static MACHINE_CONFIG_START( chqflag, chqflag_state ) MCFG_DEVICE_ADD("k051960", K051960, 0) MCFG_GFX_PALETTE("palette") + MCFG_K051960_SCREEN_TAG("screen") MCFG_K051960_CB(chqflag_state, sprite_callback) + MCFG_K051960_IRQ_HANDLER(INPUTLINE("maincpu", KONAMI_IRQ_LINE)) + MCFG_K051960_NMI_HANDLER(INPUTLINE("maincpu", INPUT_LINE_NMI)) MCFG_DEVICE_ADD("k051316_1", K051316, 0) MCFG_GFX_PALETTE("palette") diff --git a/src/mame/drivers/cinemat.c b/src/mame/drivers/cinemat.c index bf7f197536d..5729cfefa4d 100644 --- a/src/mame/drivers/cinemat.c +++ b/src/mame/drivers/cinemat.c @@ -266,7 +266,7 @@ READ8_MEMBER(cinemat_state::qb3_frame_r) { attotime next_update = m_screen->time_until_update(); attotime frame_period = m_screen->frame_period(); - int percent = next_update.attoseconds / (frame_period.attoseconds / 100); + int percent = next_update.attoseconds() / (frame_period.attoseconds() / 100); /* note this is just an approximation... */ return (percent >= 10); diff --git a/src/mame/drivers/cmmb.c b/src/mame/drivers/cmmb.c index 8f0c64f65a4..089cd521148 100644 --- a/src/mame/drivers/cmmb.c +++ b/src/mame/drivers/cmmb.c @@ -70,7 +70,6 @@ public: DECLARE_READ8_MEMBER(cmmb_charram_r); DECLARE_WRITE8_MEMBER(cmmb_charram_w); - DECLARE_WRITE8_MEMBER(cmmb_paletteram_w); DECLARE_READ8_MEMBER(cmmb_input_r); DECLARE_WRITE8_MEMBER(cmmb_output_w); DECLARE_READ8_MEMBER(kludge_r); @@ -128,13 +127,6 @@ WRITE8_MEMBER(cmmb_state::cmmb_charram_w) m_gfxdecode->gfx(1)->mark_dirty(offset >> 5); } - -WRITE8_MEMBER(cmmb_state::cmmb_paletteram_w) -{ - /* RGB output is inverted */ - m_palette->write(space, offset, UINT8(~data), mem_mask); -} - READ8_MEMBER(cmmb_state::cmmb_input_r) { //printf("%02x R\n",offset); @@ -193,7 +185,7 @@ static ADDRESS_MAP_START( cmmb_map, AS_PROGRAM, 8, cmmb_state ) AM_RANGE(0x0000, 0x01ff) AM_RAM /* zero page address */ // AM_RANGE(0x13c0, 0x13ff) AM_RAM //spriteram AM_RANGE(0x1000, 0x13ff) AM_RAM AM_SHARE("videoram") - AM_RANGE(0x2480, 0x249f) AM_RAM_WRITE(cmmb_paletteram_w) AM_SHARE("palette") + AM_RANGE(0x2480, 0x249f) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0x4000, 0x400f) AM_READWRITE(cmmb_input_r,cmmb_output_w) //i/o AM_RANGE(0x4900, 0x4900) AM_READ(kludge_r) AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank1") @@ -340,7 +332,7 @@ static MACHINE_CONFIG_START( cmmb, cmmb_state ) MCFG_GFXDECODE_ADD("gfxdecode", "palette", cmmb) MCFG_PALETTE_ADD("palette", 512) - MCFG_PALETTE_FORMAT(RRRGGGBB) + MCFG_PALETTE_FORMAT(RRRGGGBB_inverted) /* sound hardware */ // MCFG_SPEAKER_STANDARD_MONO("mono") diff --git a/src/mame/drivers/cobra.c b/src/mame/drivers/cobra.c index 3bb07f1201c..352c2d8ac70 100644 --- a/src/mame/drivers/cobra.c +++ b/src/mame/drivers/cobra.c @@ -615,7 +615,11 @@ public: m_ata(*this, "ata"), m_screen(*this, "screen"), m_palette(*this, "palette"), - m_generic_paletteram_32(*this, "paletteram") + m_generic_paletteram_32(*this, "paletteram"), + m_main_ram(*this, "main_ram"), + m_sub_ram(*this, "sub_ram"), + m_gfx_ram0(*this, "gfx_main_ram_0"), + m_gfx_ram1(*this, "gfx_main_ram_1") { } @@ -628,6 +632,10 @@ public: required_device<screen_device> m_screen; required_device<palette_device> m_palette; required_shared_ptr<UINT32> m_generic_paletteram_32; + required_shared_ptr<UINT64> m_main_ram; + required_shared_ptr<UINT32> m_sub_ram; + required_shared_ptr<UINT64> m_gfx_ram0; + required_shared_ptr<UINT64> m_gfx_ram1; DECLARE_READ64_MEMBER(main_comram_r); DECLARE_WRITE64_MEMBER(main_comram_w); @@ -1569,6 +1577,25 @@ WRITE64_MEMBER(cobra_state::main_fifo_w) } #endif + if (m_main_debug_state == 0x6b) + { + // install HD patches for bujutsu + if (strcmp(space.machine().system().name, "bujutsu") == 0) + { + UINT32 *main_ram = (UINT32*)(UINT64*)m_main_ram; + UINT32 *sub_ram = (UINT32*)m_sub_ram; + UINT32 *gfx_ram = (UINT32*)(UINT64*)m_gfx_ram0; + + main_ram[(0x0005ac^4) / 4] = 0x60000000; // skip IRQ fail + main_ram[(0x001ec4^4) / 4] = 0x60000000; // waiting for IRQ? + main_ram[(0x001f00^4) / 4] = 0x60000000; // waiting for IRQ? + + sub_ram[0x568 / 4] = 0x60000000; // skip IRQ fail + + gfx_ram[(0x38632c^4) / 4] = 0x38600000; // skip check_one_scene() + } + } + m_main_debug_state = 0; m_main_debug_state_wc = 0; } @@ -1616,7 +1643,7 @@ WRITE32_MEMBER(cobra_state::main_cpu_dc_store) } static ADDRESS_MAP_START( cobra_main_map, AS_PROGRAM, 64, cobra_state ) - AM_RANGE(0x00000000, 0x003fffff) AM_RAM + AM_RANGE(0x00000000, 0x003fffff) AM_RAM AM_SHARE("main_ram") AM_RANGE(0x07c00000, 0x07ffffff) AM_RAM AM_RANGE(0x80000cf8, 0x80000cff) AM_READWRITE(main_mpc106_r, main_mpc106_w) AM_RANGE(0xc0000000, 0xc03fffff) AM_RAM AM_SHARE("gfx_main_ram_0") // GFX board main ram, bank 0 @@ -1956,7 +1983,7 @@ WRITE8_MEMBER(cobra_state::sub_jvs_w) } static ADDRESS_MAP_START( cobra_sub_map, AS_PROGRAM, 32, cobra_state ) - AM_RANGE(0x00000000, 0x003fffff) AM_MIRROR(0x80000000) AM_RAM // Main RAM + AM_RANGE(0x00000000, 0x003fffff) AM_MIRROR(0x80000000) AM_RAM AM_SHARE("sub_ram") // Main RAM AM_RANGE(0x70000000, 0x7003ffff) AM_MIRROR(0x80000000) AM_READWRITE(sub_comram_r, sub_comram_w) // Double buffered shared RAM between Main and Sub // AM_RANGE(0x78000000, 0x780000ff) AM_MIRROR(0x80000000) AM_NOP // SCSI controller (unused) AM_RANGE(0x78040000, 0x7804ffff) AM_MIRROR(0x80000000) AM_DEVREADWRITE16("rfsnd", rf5c400_device, rf5c400_r, rf5c400_w, 0xffffffff) diff --git a/src/mame/drivers/coolridr.c b/src/mame/drivers/coolridr.c index cc2f946089c..c7e27a852b8 100644 --- a/src/mame/drivers/coolridr.c +++ b/src/mame/drivers/coolridr.c @@ -280,6 +280,9 @@ to the same bank as defined through A20. */ +// http://www.nicozon.net/watch/sm7834644 (first part is Aqua Stage video?) +// http://www.system16.com/hardware.php?id=841 has a picture of Aqua Stage showing the wide aspect + #include "emu.h" #include "cpu/sh2/sh2.h" @@ -287,6 +290,7 @@ to the same bank as defined through A20. #include "sound/scsp.h" #include "machine/nvram.h" #include "rendlay.h" +#include "aquastge.lh" #define CLIPMAXX_FULL (496-1) #define CLIPMAXY_FULL (384-1) @@ -3942,4 +3946,4 @@ DRIVER_INIT_MEMBER(coolridr_state, aquastge) } GAME( 1995, coolridr, 0, coolridr, coolridr, coolridr_state, coolridr, ROT0, "Sega", "Cool Riders",MACHINE_IMPERFECT_SOUND) // region is set in test mode, this set is for Japan, USA and Export (all regions) -GAME( 1995, aquastge, 0, aquastge, aquastge, coolridr_state, aquastge, ROT0, "Sega", "Aqua Stage",MACHINE_NOT_WORKING) +GAMEL( 1995, aquastge, 0, aquastge, aquastge, coolridr_state, aquastge, ROT0, "Sega", "Aqua Stage",MACHINE_NOT_WORKING, layout_aquastge) diff --git a/src/mame/drivers/cps1.c b/src/mame/drivers/cps1.c index 39be29b31be..6e2b53990a3 100644 --- a/src/mame/drivers/cps1.c +++ b/src/mame/drivers/cps1.c @@ -3053,7 +3053,7 @@ static INPUT_PORTS_START( sfzch ) PORT_DIPSETTING( 0xff, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_START("IN1") /* Player 1 */ + PORT_START("IN1") /* Player 1 & 2 */ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) PORT_8WAY PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(1) PORT_8WAY PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(1) PORT_8WAY @@ -3062,16 +3062,17 @@ static INPUT_PORTS_START( sfzch ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_PLAYER(1) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3) PORT_PLAYER(1) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4) PORT_PLAYER(1) - - PORT_START("IN2") /* Player 2 */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) PORT_8WAY - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(2) PORT_8WAY - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(2) PORT_8WAY - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_PLAYER(2) PORT_8WAY - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(2) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_PLAYER(2) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3) PORT_PLAYER(2) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4) PORT_PLAYER(2) + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) PORT_8WAY + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(2) PORT_8WAY + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(2) PORT_8WAY + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_PLAYER(2) PORT_8WAY + PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(2) + PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_PLAYER(2) + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3) PORT_PLAYER(2) + PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON4) PORT_PLAYER(2) + + PORT_START("IN2") /* Read by wofch */ + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("IN3") /* Player 4 - not used */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) diff --git a/src/mame/drivers/cps3.c b/src/mame/drivers/cps3.c index 4381da90605..0ceb465acb9 100644 --- a/src/mame/drivers/cps3.c +++ b/src/mame/drivers/cps3.c @@ -1011,7 +1011,7 @@ void cps3_state::cps3_draw_tilemapsprite_line(int tmnum, int drawline, bitmap_rg UINT32 cps3_state::screen_update_cps3(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { int y,x, count; - attoseconds_t period = screen.frame_period().attoseconds; + attoseconds_t period = screen.frame_period().attoseconds(); rectangle visarea = screen.visible_area(); int bg_drawn[4] = { 0, 0, 0, 0 }; diff --git a/src/mame/drivers/crimfght.c b/src/mame/drivers/crimfght.c index 3ad21a566b7..7624d29161e 100644 --- a/src/mame/drivers/crimfght.c +++ b/src/mame/drivers/crimfght.c @@ -16,16 +16,10 @@ #include "emu.h" #include "cpu/z80/z80.h" #include "cpu/m6809/konami.h" /* for the callback and the firq irq definition */ - #include "sound/2151intf.h" #include "includes/konamipt.h" #include "includes/crimfght.h" -INTERRUPT_GEN_MEMBER(crimfght_state::crimfght_interrupt) -{ - if (m_k051960->k051960_is_irq_enabled()) - device.execute().set_input_line(KONAMI_IRQ_LINE, HOLD_LINE); -} WRITE8_MEMBER(crimfght_state::crimfght_coin_w) { @@ -33,23 +27,6 @@ WRITE8_MEMBER(crimfght_state::crimfght_coin_w) coin_counter_w(machine(), 1, data & 2); } -WRITE8_MEMBER(crimfght_state::crimfght_sh_irqtrigger_w) -{ - soundlatch_byte_w(space, offset, data); - m_audiocpu->set_input_line(0, HOLD_LINE); -} - -WRITE8_MEMBER(crimfght_state::crimfght_snd_bankswitch_w) -{ - /* b1: bank for channel A */ - /* b0: bank for channel B */ - - int bank_A = BIT(data, 1); - int bank_B = BIT(data, 0); - - m_k007232->set_bank(bank_A, bank_B ); -} - READ8_MEMBER(crimfght_state::k052109_051960_r) { if (m_k052109->get_rmrd_line() == CLEAR_LINE) @@ -75,11 +52,35 @@ WRITE8_MEMBER(crimfght_state::k052109_051960_w) m_k051960->k051960_w(space, offset - 0x3c00, data); } -/********************************************/ +WRITE8_MEMBER(crimfght_state::sound_w) +{ + // writing the latch asserts the irq line + soundlatch_write(0, data); + m_audiocpu->set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE); +} + +IRQ_CALLBACK_MEMBER( crimfght_state::audiocpu_irq_ack ) +{ + // irq ack cycle clears irq via flip-flop u86 + m_audiocpu->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE); + return 0xff; +} + +WRITE8_MEMBER(crimfght_state::ym2151_ct_w) +{ + // ne output from the 007232 is connected to a ls399 which + // has inputs connected to the ct1 and ct2 outputs from + // the ym2151 used to select the bank + + int bank_a = BIT(data, 1); + int bank_b = BIT(data, 0); + + m_k007232->set_bank(bank_a, bank_b); +} static ADDRESS_MAP_START( crimfght_map, AS_PROGRAM, 8, crimfght_state ) - AM_RANGE(0x0000, 0x03ff) AM_RAMBANK("bank1") /* banked RAM */ - AM_RANGE(0x0400, 0x1fff) AM_RAM /* RAM */ + AM_RANGE(0x0000, 0x03ff) AM_DEVICE("bank0000", address_map_bank_device, amap8) + AM_RANGE(0x0400, 0x1fff) AM_RAM AM_RANGE(0x3f80, 0x3f80) AM_READ_PORT("SYSTEM") AM_RANGE(0x3f81, 0x3f81) AM_READ_PORT("P1") AM_RANGE(0x3f82, 0x3f82) AM_READ_PORT("P2") @@ -88,19 +89,25 @@ static ADDRESS_MAP_START( crimfght_map, AS_PROGRAM, 8, crimfght_state ) AM_RANGE(0x3f85, 0x3f85) AM_READ_PORT("P3") AM_RANGE(0x3f86, 0x3f86) AM_READ_PORT("P4") AM_RANGE(0x3f87, 0x3f87) AM_READ_PORT("DSW1") - AM_RANGE(0x3f88, 0x3f88) AM_READ(watchdog_reset_r) AM_WRITE(crimfght_coin_w) /* watchdog reset */ - AM_RANGE(0x3f8c, 0x3f8c) AM_WRITE(crimfght_sh_irqtrigger_w) /* cause interrupt on audio CPU? */ + AM_RANGE(0x3f88, 0x3f88) AM_MIRROR(0x03) AM_READ(watchdog_reset_r) AM_WRITE(crimfght_coin_w) // 051550 + AM_RANGE(0x3f8c, 0x3f8c) AM_MIRROR(0x03) AM_WRITE(sound_w) AM_RANGE(0x2000, 0x5fff) AM_READWRITE(k052109_051960_r, k052109_051960_w) /* video RAM + sprite RAM */ - AM_RANGE(0x6000, 0x7fff) AM_ROMBANK("bank2") /* banked ROM */ - AM_RANGE(0x8000, 0xffff) AM_ROM /* ROM */ + AM_RANGE(0x6000, 0x7fff) AM_ROMBANK("rombank") /* banked ROM */ + AM_RANGE(0x8000, 0xffff) AM_ROM AM_REGION("maincpu", 0x18000) ADDRESS_MAP_END +static ADDRESS_MAP_START( bank0000_map, AS_PROGRAM, 8, crimfght_state ) + AM_RANGE(0x0000, 0x03ff) AM_RAM + AM_RANGE(0x0400, 0x07ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") +ADDRESS_MAP_END + +// full memory map derived from schematics static ADDRESS_MAP_START( crimfght_sound_map, AS_PROGRAM, 8, crimfght_state ) - AM_RANGE(0x0000, 0x7fff) AM_ROM /* ROM 821l01.h4 */ - AM_RANGE(0x8000, 0x87ff) AM_RAM /* RAM */ - AM_RANGE(0xa000, 0xa001) AM_DEVREADWRITE("ymsnd", ym2151_device, read, write) /* YM2151 */ - AM_RANGE(0xc000, 0xc000) AM_READ(soundlatch_byte_r) /* soundlatch_byte_r */ - AM_RANGE(0xe000, 0xe00d) AM_DEVREADWRITE("k007232", k007232_device, read, write) /* 007232 registers */ + AM_RANGE(0x0000, 0x7fff) AM_ROM + AM_RANGE(0x8000, 0x87ff) AM_MIRROR(0x1800) AM_RAM + AM_RANGE(0xa000, 0xa001) AM_MIRROR(0x1ffe) AM_DEVREADWRITE("ymsnd", ym2151_device, read, write) + AM_RANGE(0xc000, 0xc000) AM_MIRROR(0x1fff) AM_READ(soundlatch_byte_r) + AM_RANGE(0xe000, 0xe00f) AM_MIRROR(0x1ff0) AM_DEVREADWRITE("k007232", k007232_device, read, write) ADDRESS_MAP_END /*************************************************************************** @@ -111,48 +118,64 @@ ADDRESS_MAP_END static INPUT_PORTS_START( crimfght ) PORT_START("DSW1") - PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:1,2,3,4") - PORT_DIPSETTING( 0x02, DEF_STR( 4C_1C ) ) - PORT_DIPSETTING( 0x05, DEF_STR( 3C_1C ) ) - PORT_DIPSETTING( 0x08, DEF_STR( 2C_1C ) ) - PORT_DIPSETTING( 0x04, DEF_STR( 3C_2C ) ) - PORT_DIPSETTING( 0x01, DEF_STR( 4C_3C ) ) - PORT_DIPSETTING( 0x0f, DEF_STR( 1C_1C ) ) - PORT_DIPSETTING( 0x03, DEF_STR( 3C_4C ) ) - PORT_DIPSETTING( 0x07, DEF_STR( 2C_3C ) ) - PORT_DIPSETTING( 0x0e, DEF_STR( 1C_2C ) ) - PORT_DIPSETTING( 0x06, DEF_STR( 2C_5C ) ) - PORT_DIPSETTING( 0x0d, DEF_STR( 1C_3C ) ) - PORT_DIPSETTING( 0x0c, DEF_STR( 1C_4C ) ) - PORT_DIPSETTING( 0x0b, DEF_STR( 1C_5C ) ) - PORT_DIPSETTING( 0x0a, DEF_STR( 1C_6C ) ) - PORT_DIPSETTING( 0x09, DEF_STR( 1C_7C ) ) - PORT_DIPSETTING( 0x00, "1 Coin/99 Credits" ) - PORT_DIPUNUSED_DIPLOC( 0xf0, 0xf0, "SW1:5,6,7,8" ) /* Manual says these are unused */ + PORT_DIPNAME(0x0f, 0x0f, DEF_STR( Coin_A )) PORT_DIPLOCATION("SW1:1,2,3,4") + PORT_DIPSETTING( 0x02, DEF_STR( 4C_1C )) + PORT_DIPSETTING( 0x05, DEF_STR( 3C_1C )) + PORT_DIPSETTING( 0x08, DEF_STR( 2C_1C )) + PORT_DIPSETTING( 0x04, DEF_STR( 3C_2C )) + PORT_DIPSETTING( 0x01, DEF_STR( 4C_3C )) + PORT_DIPSETTING( 0x0f, DEF_STR( 1C_1C )) + PORT_DIPSETTING( 0x03, DEF_STR( 3C_4C )) + PORT_DIPSETTING( 0x07, DEF_STR( 2C_3C )) + PORT_DIPSETTING( 0x0e, DEF_STR( 1C_2C )) + PORT_DIPSETTING( 0x06, DEF_STR( 2C_5C )) + PORT_DIPSETTING( 0x0d, DEF_STR( 1C_3C )) + PORT_DIPSETTING( 0x0c, DEF_STR( 1C_4C )) + PORT_DIPSETTING( 0x0b, DEF_STR( 1C_5C )) + PORT_DIPSETTING( 0x0a, DEF_STR( 1C_6C )) + PORT_DIPSETTING( 0x09, DEF_STR( 1C_7C )) + PORT_DIPSETTING( 0x00, "Void") + PORT_DIPNAME(0xf0, 0x00, "Coin B (unused)") PORT_DIPLOCATION("SW1:5,6,7,8") + PORT_DIPSETTING( 0x20, DEF_STR( 4C_1C )) + PORT_DIPSETTING( 0x50, DEF_STR( 3C_1C )) + PORT_DIPSETTING( 0x80, DEF_STR( 2C_1C )) + PORT_DIPSETTING( 0x40, DEF_STR( 3C_2C )) + PORT_DIPSETTING( 0x10, DEF_STR( 4C_3C )) + PORT_DIPSETTING( 0xf0, DEF_STR( 1C_1C )) + PORT_DIPSETTING( 0x30, DEF_STR( 3C_4C )) + PORT_DIPSETTING( 0x70, DEF_STR( 2C_3C )) + PORT_DIPSETTING( 0xe0, DEF_STR( 1C_2C )) + PORT_DIPSETTING( 0x60, DEF_STR( 2C_5C )) + PORT_DIPSETTING( 0xd0, DEF_STR( 1C_3C )) + PORT_DIPSETTING( 0xc0, DEF_STR( 1C_4C )) + PORT_DIPSETTING( 0xb0, DEF_STR( 1C_5C )) + PORT_DIPSETTING( 0xa0, DEF_STR( 1C_6C )) + PORT_DIPSETTING( 0x90, DEF_STR( 1C_7C )) + PORT_DIPSETTING( 0x00, "Void") PORT_START("DSW2") - PORT_DIPUNKNOWN_DIPLOC( 0x01, 0x01, "SW2:1" ) /* Manual says these are unused */ - PORT_DIPUNKNOWN_DIPLOC( 0x02, 0x02, "SW2:2" ) /* Manual says these are unused */ - PORT_DIPUNKNOWN_DIPLOC( 0x04, 0x04, "SW2:3" ) /* Manual says these are unused */ - PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x08, "SW2:4" ) /* Manual says these are unused */ - PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x10, "SW2:5" ) /* Manual says these are unused */ - PORT_DIPNAME( 0x60, 0x40, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:6,7") - PORT_DIPSETTING( 0x60, DEF_STR( Easy ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Normal ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Difficult ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Very_Difficult ) ) - PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:8") - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPUNUSED_DIPLOC(0x01, 0x01, "SW2:1") + PORT_DIPUNUSED_DIPLOC(0x02, 0x02, "SW2:2") + PORT_DIPUNUSED_DIPLOC(0x04, 0x04, "SW2:3") + PORT_DIPUNUSED_DIPLOC(0x08, 0x08, "SW2:4") + PORT_DIPUNUSED_DIPLOC(0x10, 0x10, "SW2:5") + PORT_DIPNAME(0x60, 0x40, DEF_STR( Difficulty )) PORT_DIPLOCATION("SW2:6,7") + PORT_DIPSETTING( 0x60, DEF_STR( Easy )) + PORT_DIPSETTING( 0x40, DEF_STR( Normal )) + PORT_DIPSETTING( 0x20, DEF_STR( Difficult )) + PORT_DIPSETTING( 0x00, DEF_STR( Very_Difficult )) + PORT_DIPNAME(0x80, 0x00, DEF_STR( Demo_Sounds )) PORT_DIPLOCATION("SW2:8") + PORT_DIPSETTING( 0x80, DEF_STR( Off )) + PORT_DIPSETTING( 0x00, DEF_STR( On )) PORT_START("DSW3") - PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW3:1") - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPUNKNOWN_DIPLOC( 0x02, 0x02, "SW3:2" ) /* Manual says these are unused */ - PORT_SERVICE_DIPLOC( 0x04, IP_ACTIVE_HIGH, "SW3:3" ) - PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x08, "SW3:4" ) /* Manual says these are unused */ - PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_DIPNAME(0x01, 0x01, DEF_STR( Flip_Screen )) PORT_DIPLOCATION("SW3:1") + PORT_DIPSETTING( 0x01, DEF_STR( Off )) + PORT_DIPSETTING( 0x00, DEF_STR( On )) + PORT_DIPUNUSED_DIPLOC(0x02, IP_ACTIVE_LOW, "SW3:2") + PORT_SERVICE_DIPLOC( 0x04, IP_ACTIVE_LOW, "SW3:3") + PORT_DIPUNUSED_DIPLOC(0x08, IP_ACTIVE_LOW, "SW3:4") + PORT_BIT(0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, crimfght_state, system_r, 0) PORT_START("P1") KONAMI8_B12_UNK(1) @@ -167,14 +190,14 @@ static INPUT_PORTS_START( crimfght ) KONAMI8_B12_UNK(4) PORT_START("SYSTEM") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN4 ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE2 ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE3 ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE4 ) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_COIN1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_COIN2) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_COIN3) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_COIN4) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_SERVICE1) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_SERVICE2) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_SERVICE3) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_SERVICE4) INPUT_PORTS_END static INPUT_PORTS_START( crimfghtj ) @@ -226,28 +249,35 @@ WRITE8_MEMBER(crimfght_state::volume_callback) void crimfght_state::machine_start() { - UINT8 *ROM = memregion("maincpu")->base(); - - membank("bank2")->configure_entries(0, 12, &ROM[0x10000], 0x2000); - membank("bank2")->set_entry(0); + m_rombank->configure_entries(0, 16, memregion("maincpu")->base(), 0x2000); + m_rombank->set_entry(0); } WRITE8_MEMBER( crimfght_state::banking_callback ) { + m_rombank->set_entry(data & 0x0f); + /* bit 5 = select work RAM or palette */ - if (data & 0x20) - { - m_maincpu->space(AS_PROGRAM).install_read_bank(0x0000, 0x03ff, "bank3"); - m_maincpu->space(AS_PROGRAM).install_write_handler(0x0000, 0x03ff, write8_delegate(FUNC(palette_device::write), m_palette.target())); - membank("bank3")->set_base(&m_paletteram[0]); - } - else - m_maincpu->space(AS_PROGRAM).install_readwrite_bank(0x0000, 0x03ff, "bank1"); /* RAM */ + m_woco = BIT(data, 5); + m_bank0000->set_bank(m_woco); /* bit 6 = enable char ROM reading through the video RAM */ - m_k052109->set_rmrd_line((data & 0x40) ? ASSERT_LINE : CLEAR_LINE); + m_rmrd = BIT(data, 6); + m_k052109->set_rmrd_line(m_rmrd ? ASSERT_LINE : CLEAR_LINE); + + m_init = BIT(data, 7); +} - membank("bank2")->set_entry(data & 0x0f); +CUSTOM_INPUT_MEMBER( crimfght_state::system_r ) +{ + UINT8 data = 0; + + data |= 1 << 4; // VCC + data |= m_woco << 5; + data |= m_rmrd << 6; + data |= m_init << 7; + + return data >> 4; } static MACHINE_CONFIG_START( crimfght, crimfght_state ) @@ -255,18 +285,24 @@ static MACHINE_CONFIG_START( crimfght, crimfght_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", KONAMI, XTAL_24MHz/8) /* 052001 (verified on pcb) */ MCFG_CPU_PROGRAM_MAP(crimfght_map) - MCFG_CPU_VBLANK_INT_DRIVER("screen", crimfght_state, crimfght_interrupt) MCFG_KONAMICPU_LINE_CB(WRITE8(crimfght_state, banking_callback)) MCFG_CPU_ADD("audiocpu", Z80, XTAL_3_579545MHz) /* verified on pcb */ MCFG_CPU_PROGRAM_MAP(crimfght_sound_map) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE(DEVICE_SELF, crimfght_state, audiocpu_irq_ack) + + MCFG_DEVICE_ADD("bank0000", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(bank0000_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) + MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(11) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x400) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(59.17) /* verified on pcb */ - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(64*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(12*8-2, (64-12)*8-3, 2*8, 30*8-1 ) + MCFG_SCREEN_RAW_PARAMS(XTAL_24MHz/3, 528, 96, 416, 256, 16, 240) // measured 59.17 +// 6MHz dotclock is more realistic, however needs drawing updates. replace when ready +// MCFG_SCREEN_RAW_PARAMS(XTAL_24MHz/4, 396, hbend, hbstart, 256, 16, 240) MCFG_SCREEN_UPDATE_DRIVER(crimfght_state, screen_update_crimfght) MCFG_SCREEN_PALETTE("palette") @@ -280,13 +316,15 @@ static MACHINE_CONFIG_START( crimfght, crimfght_state ) MCFG_DEVICE_ADD("k051960", K051960, 0) MCFG_GFX_PALETTE("palette") + MCFG_K051960_SCREEN_TAG("screen") MCFG_K051960_CB(crimfght_state, sprite_callback) + MCFG_K051960_IRQ_HANDLER(INPUTLINE("maincpu", KONAMI_IRQ_LINE)) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") MCFG_YM2151_ADD("ymsnd", XTAL_3_579545MHz) /* verified on pcb */ - MCFG_YM2151_PORT_WRITE_HANDLER(WRITE8(crimfght_state,crimfght_snd_bankswitch_w)) + MCFG_YM2151_PORT_WRITE_HANDLER(WRITE8(crimfght_state, ym2151_ct_w)) MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) @@ -305,9 +343,8 @@ MACHINE_CONFIG_END ***************************************************************************/ ROM_START( crimfght ) - ROM_REGION( 0x28000, "maincpu", 0 ) /* code + banked roms */ - ROM_LOAD( "821l02.f24", 0x10000, 0x18000, CRC(588e7da6) SHA1(285febb3bcca31f82b34af3695a59eafae01cd30) ) - ROM_CONTINUE( 0x08000, 0x08000 ) + ROM_REGION( 0x20000, "maincpu", 0 ) /* code + banked roms */ + ROM_LOAD( "821l02.f24", 0x00000, 0x20000, CRC(588e7da6) SHA1(285febb3bcca31f82b34af3695a59eafae01cd30) ) ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for the sound CPU */ ROM_LOAD( "821l01.h4", 0x0000, 0x8000, CRC(0faca89e) SHA1(21c9c6d736b398a29e8709e1187c5bf3cacdc99d) ) @@ -328,9 +365,8 @@ ROM_START( crimfght ) ROM_END ROM_START( crimfghtj ) - ROM_REGION( 0x28000, "maincpu", 0 ) /* code + banked roms */ - ROM_LOAD( "821p02.f24", 0x10000, 0x18000, CRC(f33fa2e1) SHA1(00fc9e8250fa51386f3af2fca0f137bec9e1c220) ) - ROM_CONTINUE( 0x08000, 0x08000 ) + ROM_REGION( 0x20000, "maincpu", 0 ) /* code + banked roms */ + ROM_LOAD( "821p02.f24", 0x00000, 0x20000, CRC(f33fa2e1) SHA1(00fc9e8250fa51386f3af2fca0f137bec9e1c220) ) ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for the sound CPU */ ROM_LOAD( "821l01.h4", 0x0000, 0x8000, CRC(0faca89e) SHA1(21c9c6d736b398a29e8709e1187c5bf3cacdc99d) ) @@ -351,9 +387,8 @@ ROM_START( crimfghtj ) ROM_END ROM_START( crimfght2 ) -ROM_REGION( 0x28000, "maincpu", 0 ) /* code + banked roms */ - ROM_LOAD( "821r02.f24", 0x10000, 0x18000, CRC(4ecdd923) SHA1(78e5260c4bb9b18d7818fb6300d7e1d3a577fb63) ) - ROM_CONTINUE( 0x08000, 0x08000 ) + ROM_REGION( 0x20000, "maincpu", 0 ) /* code + banked roms */ + ROM_LOAD( "821r02.f24", 0x00000, 0x20000, CRC(4ecdd923) SHA1(78e5260c4bb9b18d7818fb6300d7e1d3a577fb63) ) ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for the sound CPU */ ROM_LOAD( "821l01.h4", 0x0000, 0x8000, CRC(0faca89e) SHA1(21c9c6d736b398a29e8709e1187c5bf3cacdc99d) ) diff --git a/src/mame/drivers/csplayh5.c b/src/mame/drivers/csplayh5.c index 734fc060e2c..914c0de6bae 100644 --- a/src/mame/drivers/csplayh5.c +++ b/src/mame/drivers/csplayh5.c @@ -484,7 +484,7 @@ static MACHINE_CONFIG_START( csplayh5, csplayh5_state ) MCFG_NVRAM_ADD_0FILL("nvram") /* video hardware */ - MCFG_V9958_ADD("v9958", "screen", 0x20000) + MCFG_V9958_ADD("v9958", "screen", 0x20000, XTAL_21_4772MHz) // typical 9958 clock, not verified MCFG_V99X8_INTERRUPT_CALLBACK(WRITELINE(csplayh5_state, csplayh5_vdp0_interrupt)) MCFG_SCREEN_ADD("screen",RASTER) diff --git a/src/mame/drivers/dai3wksi.c b/src/mame/drivers/dai3wksi.c index 64c3a069c2c..9ef942150e4 100644 --- a/src/mame/drivers/dai3wksi.c +++ b/src/mame/drivers/dai3wksi.c @@ -58,6 +58,7 @@ public: m_ic79(*this, "ic79"), m_ic80(*this, "ic80"), m_ic81(*this, "ic81"), + m_palette(*this, "palette"), m_dai3wksi_videoram(*this, "videoram"), m_in2(*this, "IN2") { } @@ -69,6 +70,7 @@ public: optional_device<sn76477_device> m_ic79; optional_device<sn76477_device> m_ic80; optional_device<sn76477_device> m_ic81; + required_device<palette_device> m_palette; /* video */ required_shared_ptr<UINT8> m_dai3wksi_videoram; @@ -140,29 +142,10 @@ static const UINT8 vr_prom2[64*8*2]={ 3, 3,3,2,2,6,6,6,6, 6,6,6,6,6,6,6,6, 3,3,3,3,3,3,3,3, 7,7,7,7,7,7,7,7, 3,3,3,3,3,3,3,3, 2,2,2,2,2,2,2,2, 6,6,6,6,6,6,6,6, 4,4,4,4,4,4,4, }; - -static void dai3wksi_get_pens(pen_t *pens) -{ - offs_t i; - - for (i = 0; i <= 7; i++) - { - pens[i] = rgb_t(pal1bit(i >> 1), pal1bit(i >> 2), pal1bit(i >> 0)); - } -} - - UINT32 dai3wksi_state::screen_update_dai3wksi(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - offs_t offs; - pen_t pens[8]; - - dai3wksi_get_pens(pens); - - for (offs = 0; offs < m_dai3wksi_videoram.bytes(); offs++) + for (offs_t offs = 0; offs < m_dai3wksi_videoram.bytes(); offs++) { - offs_t i; - UINT8 x = offs << 2; UINT8 y = offs >> 6; UINT8 data = m_dai3wksi_videoram[offs]; @@ -181,9 +164,9 @@ UINT32 dai3wksi_state::screen_update_dai3wksi(screen_device &screen, bitmap_rgb3 color = vr_prom1[value]; } - for (i = 0; i <= 3; i++) + for (int i = 0; i <= 3; i++) { - pen_t pen = (data & (1 << i)) ? pens[color] : pens[0]; + rgb_t pen = (data & (1 << i)) ? m_palette->pen_color(color) : rgb_t::black; if (m_dai3wksi_flipscreen) bitmap.pix32(255-y, 255-x) = pen; @@ -428,6 +411,8 @@ static MACHINE_CONFIG_START( dai3wksi, dai3wksi_state ) MCFG_SCREEN_REFRESH_RATE(60) MCFG_SCREEN_UPDATE_DRIVER(dai3wksi_state, screen_update_dai3wksi) + MCFG_PALETTE_ADD_3BIT_BRG("palette") + MCFG_SPEAKER_STANDARD_MONO("mono") #if (USE_SAMPLES) diff --git a/src/mame/drivers/ddealer.c b/src/mame/drivers/ddealer.c index e40c86a935d..a553c25df63 100644 --- a/src/mame/drivers/ddealer.c +++ b/src/mame/drivers/ddealer.c @@ -143,7 +143,6 @@ public: required_shared_ptr<UINT16> m_back_vram; required_shared_ptr<UINT16> m_work_ram; required_shared_ptr<UINT16> m_mcu_shared_ram; -// UINT16 * m_paletteram16; // currently this uses generic palette handling /* video-related */ tilemap_t *m_back_tilemap; @@ -480,7 +479,7 @@ static ADDRESS_MAP_START( ddealer, AS_PROGRAM, 16, ddealer_state ) AM_RANGE(0x080008, 0x080009) AM_READ_PORT("DSW1") AM_RANGE(0x08000a, 0x08000b) AM_READ_PORT("UNK") AM_RANGE(0x084000, 0x084003) AM_DEVWRITE8("ymsnd", ym2203_device, write, 0x00ff) // ym ? - AM_RANGE(0x088000, 0x0887ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") // palette ram + AM_RANGE(0x088000, 0x0887ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0x08c000, 0x08cfff) AM_RAM_WRITE(ddealer_vregs_w) AM_SHARE("vregs") // palette ram /* this might actually be 1 tilemap with some funky rowscroll / columnscroll enabled, I'm not sure */ diff --git a/src/mame/drivers/deco32.c b/src/mame/drivers/deco32.c index b5a0ca5e1a6..ef6a5da15e2 100644 --- a/src/mame/drivers/deco32.c +++ b/src/mame/drivers/deco32.c @@ -223,6 +223,60 @@ Notes: PROM.9J Fujitsu MB7124 compatible with 82S147 Labelled 'LN-00' + + +Fighter's History +Data East, 1993 + +PCB Layout +---------- + +DE-0396-0 DEC-22VO +|-----------------------------------------------------| +| TA8205AH Z80 MBF-05 2M-8M*| +| 6164 YM2151 MBF-04 8M*| +| LJ02 52* MBF-03 4M-16M*| +| YM3012 32.220MHz MBF-02 16M*| +| JP1 MBF-07 93C45 4M-16M*| +|CN2 MBF-06 16M*| +| M6295(1) 52* | +| M6295(2) | +| |-----| |-----| | +|J | 75 | 153* | 52 | | +|A | | |-----| | | | +|M |-----| | 153 | |-----| | +|M | | 28MHz | +|A |-----| | +| PAL* | +| 99* KT-00 |-----| 6164 MBF-01 | +| | 74 | 6164 | +| | | MBF-00 | +| |-----| |-----| |-----| | +| | 153 | | 200 | |-----| 6164 | +| | | | | | 141 | 6164 | +| |-----| |-----| | | VE-01A | +|TEST_SW |-----| VE-00 |-----| | +| | 101 | | +| CN4 LH52250 LH52250 LJ01-3 | | | +| CN3* LH52250 LH52250 LJ00-3 |-----| | +|-----------------------------------------------------| + +This PCB is very close to the DE-397-0 listed above + + Custom ICs- + DE # Package Type Additional #'s (for reference of scratched-off chips on other PCB's) + ------------------------------------------------------------------------------------------------------ + 101 (CPU) 100 Pin PQFP 9321EV 301811 + 141 160 Pin PQFP 24220F008 + 74 160 Pin PQFP 24220F009 + 52 128 Pin PQFP 9313EV 211771 VC5259-0001 + 153 (x2) 144 Pin PQFP L7A0888 9312 + 75 100 Pin PQFP L7A0680 9143 + 200 100 Pin PQFP JAPAN 9315PP002 (chip is darker black) + +NOTE: There are several unpopulated locations (denoted by *) for additional rom chips + or more custom ICs. + ***************************************************************************/ #include "emu.h" @@ -355,8 +409,10 @@ WRITE32_MEMBER(deco32_state::fghthist_eeprom_w) } } + /**********************************************************************************/ + READ32_MEMBER(dragngun_state::service_r) { // logerror("%08x:Read service\n",space.device().safe_pc()); @@ -372,7 +428,6 @@ READ32_MEMBER(dragngun_state::lockload_gun_mirror_r) return ioport("IN3")->read() | ioport("LIGHT0_X")->read() | (ioport("LIGHT0_X")->read()<<16) | (ioport("LIGHT0_X")->read()<<24); //((machine().rand()%0xff)<<16); } - READ32_MEMBER(dragngun_state::lightgun_r) { /* Ports 0-3 are read, but seem unused */ @@ -409,8 +464,8 @@ WRITE32_MEMBER(dragngun_state::eeprom_w) logerror("%s:Write control 1 %08x %08x\n",machine().describe_context(),offset,data); } -/**********************************************************************************/ +/**********************************************************************************/ WRITE32_MEMBER(deco32_state::tattass_control_w) @@ -543,14 +598,15 @@ WRITE32_MEMBER(deco32_state::tattass_control_w) //logerror("%08x: %08x data\n",data,mem_mask); } + /**********************************************************************************/ + UINT16 deco32_state::port_b_nslasher(int unused) { return (m_eeprom->do_read()); } - void deco32_state::nslasher_sound_cb( address_space &space, UINT16 data, UINT16 mem_mask ) { /* bit 1 of nslasher_sound_irq specifies IRQ command writes */ @@ -572,9 +628,6 @@ void deco32_state::tattass_sound_cb( address_space &space, UINT16 data, UINT16 m m_decobsmt->bsmt_comms_w(space, 0, soundcommand); } - - - WRITE32_MEMBER(deco32_state::nslasher_eeprom_w) { if (ACCESSING_BITS_0_7) @@ -588,10 +641,9 @@ WRITE32_MEMBER(deco32_state::nslasher_eeprom_w) } - - /**********************************************************************************/ + READ32_MEMBER(deco32_state::spriteram_r) { return m_spriteram16[offset] ^ 0xffff0000; @@ -767,7 +819,6 @@ static ADDRESS_MAP_START( fghthsta_memmap, AS_PROGRAM, 32, deco32_state ) AM_RANGE(0x1e0000, 0x1e001f) AM_DEVREADWRITE("tilegen2", deco16ic_device, pf_control_dword_r, pf_control_dword_w) AM_RANGE(0x200000, 0x207fff) AM_READWRITE(fghthist_protection_region_0_146_r, fghthist_protection_region_0_146_w) AM_SHARE("prot32ram") // only maps on 16-bits - ADDRESS_MAP_END @@ -1014,7 +1065,6 @@ static ADDRESS_MAP_START( nslasher_map, AS_PROGRAM, 32, deco32_state ) AM_RANGE(0x200000, 0x207fff) AM_READWRITE16(nslasher_protection_region_0_104_r, nslasher_protection_region_0_104_w, 0xffff0000) AM_RANGE(0x200000, 0x207fff) AM_READ16(nslasher_debug_r, 0x0000ffff) // seems to be debug switches / code activated by this? - ADDRESS_MAP_END /******************************************************************************/ @@ -1949,6 +1999,31 @@ static MACHINE_CONFIG_START( fghthsta, deco32_state ) /* DE-0395-1 PCB */ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.35) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( fghthistz, fghthsta ) + MCFG_DEVICE_REMOVE("audiocpu") + + MCFG_CPU_ADD("audiocpu", Z80, 32220000/9) + MCFG_CPU_PROGRAM_MAP(nslasher_sound) + MCFG_CPU_IO_MAP(nslasher_io_sound) + + MCFG_SOUND_MODIFY("ymsnd") + //MCFG_YM2151_IRQ_HANDLER(WRITELINE(deco32_state,sound_irq_nslasher)) + MCFG_YM2151_IRQ_HANDLER(INPUTLINE("audiocpu",0)) + + MCFG_YM2151_PORT_WRITE_HANDLER(WRITE8(deco32_state,sound_bankswitch_w)) + MCFG_SOUND_ROUTE(0, "lspeaker", 0.40) + MCFG_SOUND_ROUTE(1, "rspeaker", 0.40) + /* + MCFG_DEVICE_REMOVE("ioprot") + MCFG_DECO146_ADD("ioprot") + MCFG_DECO146_SET_PORTA_CALLBACK( deco32_state, port_a_fghthist ) + MCFG_DECO146_SET_PORTB_CALLBACK( deco32_state, port_b_fghthist ) + MCFG_DECO146_SET_PORTC_CALLBACK( deco32_state, port_c_fghthist ) + MCFG_DECO146_SET_INTERFACE_SCRAMBLE_INTERLEAVE + MCFG_DECO146_SET_USE_MAGIC_ADDRESS_XOR + MCFG_DECO146_SET_SOUNDLATCH_CALLBACK(deco32_state, nslasher_sound_cb) + */ +MACHINE_CONFIG_END DECO16IC_BANK_CB_MEMBER(dragngun_state::bank_1_callback) { @@ -2324,7 +2399,6 @@ static MACHINE_CONFIG_START( nslasher, deco32_state ) MCFG_DECO146_SET_SOUNDLATCH_CALLBACK(deco32_state, nslasher_sound_cb) MCFG_DECO146_SET_INTERFACE_SCRAMBLE_INTERLEAVE - /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") @@ -2356,9 +2430,9 @@ static MACHINE_CONFIG_DERIVED( nslasheru, nslasher ) MCFG_DECO146_SET_PORTB_CALLBACK( deco32_state, port_b_nslasher ) MCFG_DECO146_SET_SOUNDLATCH_CALLBACK(deco32_state, deco32_sound_cb) MCFG_DECO146_SET_INTERFACE_SCRAMBLE_INTERLEAVE - MACHINE_CONFIG_END + /**********************************************************************************/ ROM_START( captaven ) @@ -2883,8 +2957,8 @@ ROM_END ROM_START( fghthist ) /* DE-0380-2 PCB */ ROM_REGION(0x100000, "maincpu", 0 ) /* ARM 32 bit code */ - ROM_LOAD32_WORD( "kx00-unknown.bin", 0x000000, 0x80000, CRC(fe5eaba1) SHA1(c8a3784af487a1bbd2150abf4b1c8f3ad33da8a4) ) /* Version 43-07, Overseas */ - ROM_LOAD32_WORD( "kx01-unknown.bin", 0x000002, 0x80000, CRC(3fb8d738) SHA1(2fca7a3ea483f01c97fb28a0adfa6d7980d8236c) ) + ROM_LOAD32_WORD( "kx00-3.1f", 0x000000, 0x80000, CRC(fe5eaba1) SHA1(c8a3784af487a1bbd2150abf4b1c8f3ad33da8a4) ) /* Version 43-07, Overseas */ + ROM_LOAD32_WORD( "kx01-3.2f", 0x000002, 0x80000, CRC(3fb8d738) SHA1(2fca7a3ea483f01c97fb28a0adfa6d7980d8236c) ) ROM_REGION(0x10000, "audiocpu", 0 ) /* Sound CPU */ ROM_LOAD( "kx02.18k", 0x00000, 0x10000, CRC(5fd2309c) SHA1(2fb7af54d5cd9bf7dd6fb4f6b82aa52b03294f1f) ) @@ -2915,7 +2989,75 @@ ROM_START( fghthist ) /* DE-0380-2 PCB */ ROM_LOAD( "ve-01.4d", 0x0200, 0x0104, NO_DUMP ) /* PAL16L8 is read protected */ ROM_END -ROM_START( fghthistu ) /* DE-0395-1 PCB */ +ROM_START( fghthista ) /* DE-0380-2 PCB */ + ROM_REGION(0x100000, "maincpu", 0 ) /* ARM 32 bit code */ + ROM_LOAD32_WORD( "kx00-2.1f", 0x000000, 0x80000, CRC(a7c36bbd) SHA1(590937818343da53a6bccbd3ea1d7102abd4f27e) ) /* Version 43-05, Overseas */ + ROM_LOAD32_WORD( "kx01-2.2f", 0x000002, 0x80000, CRC(bdc60bb1) SHA1(e621c5cf357f49aa62deef4da1e2227021f552ce) ) + + ROM_REGION(0x10000, "audiocpu", 0 ) /* Sound CPU */ + ROM_LOAD( "kx02.18k", 0x00000, 0x10000, CRC(5fd2309c) SHA1(2fb7af54d5cd9bf7dd6fb4f6b82aa52b03294f1f) ) + + ROM_REGION( 0x100000, "gfx1", 0 ) + ROM_LOAD( "mbf00-8.8a", 0x000000, 0x100000, CRC(d3e9b580) SHA1(fc4676e0ecc6c32441ff66fa1f990cc3158237db) ) /* Encrypted tiles */ + + ROM_REGION( 0x100000, "gfx2", 0 ) + ROM_LOAD( "mbf01-8.9a", 0x000000, 0x100000, CRC(0c6ed2eb) SHA1(8e37ef4b1f0b6d3370a08758bfd602cb5f221282) ) /* Encrypted tiles */ + + ROM_REGION( 0x800000, "gfx3", 0 ) /* Sprites */ + ROM_LOAD16_BYTE( "mbf02-16.16d", 0x000001, 0x200000, CRC(c19c5953) SHA1(e6ed26f932c6c86bbd1fc4c000aa2f510c268009) ) + ROM_LOAD16_BYTE( "mbf04-16.18d", 0x000000, 0x200000, CRC(f6a23fd7) SHA1(74e5559f17cd591aa25d2ed6c34ac9ed89e2e9ba) ) + ROM_LOAD16_BYTE( "mbf03-16.17d", 0x400001, 0x200000, CRC(37d25c75) SHA1(8219d31091b4317190618edd8acc49f97cba6a1e) ) + ROM_LOAD16_BYTE( "mbf05-16.19d", 0x400000, 0x200000, CRC(137be66d) SHA1(3fde345183ce04a7a65b4cedfd050d771df7d026) ) + + ROM_REGION(0x80000, "oki1", 0 ) + ROM_LOAD( "mbf06.15k", 0x000000, 0x80000, CRC(fb513903) SHA1(7727a49ff7977f159ed36d097020edef3b5b36ba) ) + + ROM_REGION(0x80000, "oki2", 0 ) + ROM_LOAD( "mbf07.16k", 0x000000, 0x80000, CRC(51d4adc7) SHA1(22106ed7a05db94adc5a783ce34529e29d24d41a) ) + + ROM_REGION(512, "proms", 0 ) + ROM_LOAD( "kt-00.8j", 0, 512, CRC(7294354b) SHA1(14fe42ad5d26d022c0fe9a46a4a9017af2296f40) ) /* MB7124H type prom */ + + ROM_REGION( 0x0400, "plds", 0 ) + ROM_LOAD( "ve-00.3d", 0x0000, 0x0104, NO_DUMP ) /* PAL16L8 is read protected */ + ROM_LOAD( "ve-01.4d", 0x0200, 0x0104, NO_DUMP ) /* PAL16L8 is read protected */ +ROM_END + +ROM_START( fghthistu ) /* DE-0396-0 PCB */ + ROM_REGION(0x100000, "maincpu", 0 ) /* ARM 32 bit code */ + ROM_LOAD32_WORD( "lj00-3.1f", 0x000000, 0x80000, CRC(17543d60) SHA1(ff206e8552587b41d075b3c99f9ad733f1c2b5e0) ) /* Version 42-09, US */ + ROM_LOAD32_WORD( "lj01-3.2f", 0x000002, 0x80000, CRC(e255d48f) SHA1(30444832cfed7eeb6082010eb219362adbafb826) ) + + ROM_REGION(0x10000, "audiocpu", 0 ) /* Sound CPU */ + ROM_LOAD( "lj02-.17k", 0x00000, 0x10000, CRC(146a1063) SHA1(d16734c2443bf38add54040b9dd2628ba523638d) ) + + ROM_REGION( 0x100000, "gfx1", 0 ) + ROM_LOAD( "mbf00-8.8a", 0x000000, 0x100000, CRC(d3e9b580) SHA1(fc4676e0ecc6c32441ff66fa1f990cc3158237db) ) /* Encrypted tiles */ + + ROM_REGION( 0x100000, "gfx2", 0 ) + ROM_LOAD( "mbf01-8.9a", 0x000000, 0x100000, CRC(0c6ed2eb) SHA1(8e37ef4b1f0b6d3370a08758bfd602cb5f221282) ) /* Encrypted tiles */ + + ROM_REGION( 0x800000, "gfx3", 0 ) /* Sprites */ + ROM_LOAD16_BYTE( "mbf02-16.16d", 0x000001, 0x200000, CRC(c19c5953) SHA1(e6ed26f932c6c86bbd1fc4c000aa2f510c268009) ) + ROM_LOAD16_BYTE( "mbf04-16.18d", 0x000000, 0x200000, CRC(f6a23fd7) SHA1(74e5559f17cd591aa25d2ed6c34ac9ed89e2e9ba) ) + ROM_LOAD16_BYTE( "mbf03-16.17d", 0x400001, 0x200000, CRC(37d25c75) SHA1(8219d31091b4317190618edd8acc49f97cba6a1e) ) + ROM_LOAD16_BYTE( "mbf05-16.19d", 0x400000, 0x200000, CRC(137be66d) SHA1(3fde345183ce04a7a65b4cedfd050d771df7d026) ) + + ROM_REGION(0x80000, "oki1", 0 ) + ROM_LOAD( "mbf06.15k", 0x000000, 0x80000, CRC(fb513903) SHA1(7727a49ff7977f159ed36d097020edef3b5b36ba) ) + + ROM_REGION(0x80000, "oki2", 0 ) + ROM_LOAD( "mbf07.16k", 0x000000, 0x80000, CRC(51d4adc7) SHA1(22106ed7a05db94adc5a783ce34529e29d24d41a) ) + + ROM_REGION(512, "proms", 0 ) + ROM_LOAD( "kt-00.8j", 0, 512, CRC(7294354b) SHA1(14fe42ad5d26d022c0fe9a46a4a9017af2296f40) ) /* MB7124H type prom */ + + ROM_REGION( 0x0400, "plds", 0 ) + ROM_LOAD( "ve-00.3d", 0x0000, 0x0104, NO_DUMP ) /* PAL16L8 is read protected */ + ROM_LOAD( "ve-01.4d", 0x0200, 0x0104, NO_DUMP ) /* PAL16L8 is read protected */ +ROM_END + +ROM_START( fghthistua ) /* DE-0395-1 PCB */ ROM_REGION(0x100000, "maincpu", 0 ) /* ARM 32 bit code */ ROM_LOAD32_WORD( "le00-1.1f", 0x000000, 0x80000, CRC(fccacafb) SHA1(b7236a90a09dbd5870a16aa4e4eac5ab5c098418) ) /* Version 42-06, US */ ROM_LOAD32_WORD( "le01-1.2f", 0x000002, 0x80000, CRC(06a3c326) SHA1(3d8842fb69def93fc544e89fd0e56ada416157dc) ) @@ -2949,7 +3091,7 @@ ROM_START( fghthistu ) /* DE-0395-1 PCB */ ROM_LOAD( "ve-01a.4d", 0x0200, 0x0104, NO_DUMP ) /* PAL16L8 is read protected */ ROM_END -ROM_START( fghthistua ) /* DE-0395-1 PCB */ +ROM_START( fghthistub ) /* DE-0395-1 PCB */ ROM_REGION(0x100000, "maincpu", 0 ) /* ARM 32 bit code */ ROM_LOAD32_WORD( "le00.1f", 0x000000, 0x80000, CRC(a5c410eb) SHA1(e2b0cb2351782e1155ecc4029010beb7326fd874) ) /* Version 42-05, US */ ROM_LOAD32_WORD( "le01.2f", 0x000002, 0x80000, CRC(7e148aa2) SHA1(b21e16604c4d29611f91d629deb9f041eaf41e9b) ) @@ -2983,7 +3125,7 @@ ROM_START( fghthistua ) /* DE-0395-1 PCB */ ROM_LOAD( "ve-01a.4d", 0x0200, 0x0104, NO_DUMP ) /* PAL16L8 is read protected */ ROM_END -ROM_START( fghthistub ) /* DE-0380-2 PCB */ +ROM_START( fghthistuc ) /* DE-0380-2 PCB */ ROM_REGION(0x100000, "maincpu", 0 ) /* ARM 32 bit code */ ROM_LOAD32_WORD( "kz00-1.1f", 0x000000, 0x80000, CRC(3a3dd15c) SHA1(689b51adf73402b12191a75061b8e709468c91bc) ) /* Version 42-03, US */ ROM_LOAD32_WORD( "kz01-1.2f", 0x000002, 0x80000, CRC(86796cd6) SHA1(c397c07d7a1d03ba96ccb2fe7a0ad25b8331e945) ) @@ -3707,7 +3849,6 @@ DRIVER_INIT_MEMBER(dragngun_state,dragngunj) ROM[0x1a1b4/4]=0xe1a00000; // bl $ee000: NOP test switch lock } - DRIVER_INIT_MEMBER(deco32_state,fghthist) { deco56_decrypt_gfx(machine(), "gfx1"); @@ -3800,12 +3941,18 @@ GAME( 1991, captavenuu, captaven, captaven, captaven, deco32_state, captaven, GAME( 1991, captavenua, captaven, captaven, captaven, deco32_state, captaven, ROT0, "Data East Corporation", "Captain America and The Avengers (US Rev 1.4)", MACHINE_SUPPORTS_SAVE ) GAME( 1991, captavenj, captaven, captaven, captaven, deco32_state, captaven, ROT0, "Data East Corporation", "Captain America and The Avengers (Japan Rev 0.2)", MACHINE_SUPPORTS_SAVE ) -GAME( 1993, fghthist, 0, fghthist, fghthist, deco32_state, fghthist, ROT0, "Data East Corporation", "Fighter's History (World ver 43-07, DE-0380-2 PCB)", MACHINE_SUPPORTS_SAVE ) -GAME( 1993, fghthistu, fghthist, fghthsta, fghthist, deco32_state, fghthist, ROT0, "Data East Corporation", "Fighter's History (US ver 42-06, DE-0395-1 PCB)", MACHINE_SUPPORTS_SAVE ) -GAME( 1993, fghthistua, fghthist, fghthsta, fghthist, deco32_state, fghthist, ROT0, "Data East Corporation", "Fighter's History (US ver 42-05, DE-0395-1 PCB)", MACHINE_SUPPORTS_SAVE ) -GAME( 1993, fghthistub, fghthist, fghthist, fghthist, deco32_state, fghthist, ROT0, "Data East Corporation", "Fighter's History (US ver 42-03, DE-0380-2 PCB)", MACHINE_SUPPORTS_SAVE ) +// DE-0396-0 PCB sets (uses a Z80) +GAME( 1993, fghthistu, fghthist, fghthistz,fghthist, deco32_state, fghthist, ROT0, "Data East Corporation", "Fighter's History (US ver 42-09, DE-0396-0 PCB)", MACHINE_SUPPORTS_SAVE ) +// DE-0395-1 PCB sets +GAME( 1993, fghthistua, fghthist, fghthsta, fghthist, deco32_state, fghthist, ROT0, "Data East Corporation", "Fighter's History (US ver 42-06, DE-0395-1 PCB)", MACHINE_SUPPORTS_SAVE ) +GAME( 1993, fghthistub, fghthist, fghthsta, fghthist, deco32_state, fghthist, ROT0, "Data East Corporation", "Fighter's History (US ver 42-05, DE-0395-1 PCB)", MACHINE_SUPPORTS_SAVE ) GAME( 1993, fghthistj, fghthist, fghthsta, fghthist, deco32_state, fghthist, ROT0, "Data East Corporation", "Fighter's History (Japan ver 41-07, DE-0395-1 PCB)", MACHINE_SUPPORTS_SAVE ) +// DE-0380-2 PCB sets +GAME( 1993, fghthist, 0, fghthist, fghthist, deco32_state, fghthist, ROT0, "Data East Corporation", "Fighter's History (World ver 43-07, DE-0380-2 PCB)", MACHINE_SUPPORTS_SAVE ) +GAME( 1993, fghthista, fghthist, fghthist, fghthist, deco32_state, fghthist, ROT0, "Data East Corporation", "Fighter's History (World ver 43-05, DE-0380-2 PCB)", MACHINE_SUPPORTS_SAVE ) +GAME( 1993, fghthistuc, fghthist, fghthist, fghthist, deco32_state, fghthist, ROT0, "Data East Corporation", "Fighter's History (US ver 42-03, DE-0380-2 PCB)", MACHINE_SUPPORTS_SAVE ) GAME( 1993, fghthistja, fghthist, fghthist, fghthist, deco32_state, fghthist, ROT0, "Data East Corporation", "Fighter's History (Japan ver 41-05, DE-0380-2 PCB)", MACHINE_SUPPORTS_SAVE ) +// DE-0380-1 PCB sets GAME( 1993, fghthistjb, fghthist, fghthist, fghthist, deco32_state, fghthist, ROT0, "Data East Corporation", "Fighter's History (Japan ver 41-04, DE-0380-1 PCB)", MACHINE_SUPPORTS_SAVE ) GAME( 1994, nslasher, 0, nslasher, nslasher, deco32_state, nslasher, ROT0, "Data East Corporation", "Night Slashers (Korea Rev 1.3)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/diverboy.c b/src/mame/drivers/diverboy.c index 9e79927d06d..c9d698cd6da 100644 --- a/src/mame/drivers/diverboy.c +++ b/src/mame/drivers/diverboy.c @@ -70,7 +70,6 @@ public: /* memory pointers */ required_shared_ptr<UINT16> m_spriteram; -// UINT16 * m_paletteram; // currently this uses generic palette handling /* devices */ required_device<cpu_device> m_audiocpu; diff --git a/src/mame/drivers/djmain.c b/src/mame/drivers/djmain.c index 2bbdf3750a2..600fa4a4011 100644 --- a/src/mame/drivers/djmain.c +++ b/src/mame/drivers/djmain.c @@ -86,23 +86,6 @@ hard drive 3.5 adapter long 3.5 IDE cable 3.5 adapter PCB * *************************************/ -WRITE32_MEMBER(djmain_state::paletteram32_w) -{ - int r,g,b; - - COMBINE_DATA(&m_generic_paletteram_32[offset]); - data = m_generic_paletteram_32[offset]; - - r = (data >> 0) & 0xff; - g = (data >> 8) & 0xff; - b = (data >> 16) & 0xff; - - m_palette->set_pen_color(offset, rgb_t(r, g, b)); -} - - -//--------- - void djmain_state::sndram_set_bank() { m_sndram = memregion("shared")->base() + 0x80000 * m_sndram_bank; @@ -396,8 +379,7 @@ WRITE_LINE_MEMBER( djmain_state::ide_interrupt ) static ADDRESS_MAP_START( maincpu_djmain, AS_PROGRAM, 32, djmain_state ) AM_RANGE(0x000000, 0x0fffff) AM_ROM // PRG ROM AM_RANGE(0x400000, 0x40ffff) AM_RAM // WORK RAM - AM_RANGE(0x480000, 0x48443f) AM_RAM_WRITE(paletteram32_w) // COLOR RAM - AM_SHARE("paletteram") + AM_RANGE(0x480000, 0x48443f) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") // COLOR RAM AM_RANGE(0x500000, 0x57ffff) AM_READWRITE(sndram_r, sndram_w) // SOUND RAM AM_RANGE(0x580000, 0x58003f) AM_DEVREADWRITE("k056832", k056832_device, long_r, long_w) // VIDEO REG (tilemap) AM_RANGE(0x590000, 0x590007) AM_WRITE(unknown590000_w) // ?? @@ -1416,6 +1398,7 @@ static MACHINE_CONFIG_START( djmainj, djmain_state ) MCFG_SCREEN_UPDATE_DRIVER(djmain_state, screen_update_djmain) MCFG_PALETTE_ADD("palette", 0x4440/4) + MCFG_PALETTE_FORMAT(XBGR) MCFG_GFXDECODE_ADD("gfxdecode", "palette", djmain) MCFG_DEVICE_ADD("k056832", K056832, 0) diff --git a/src/mame/drivers/dominob.c b/src/mame/drivers/dominob.c index 26c46b559fd..ff0f05a0730 100644 --- a/src/mame/drivers/dominob.c +++ b/src/mame/drivers/dominob.c @@ -82,7 +82,6 @@ public: required_shared_ptr<UINT8> m_videoram; required_shared_ptr<UINT8> m_spriteram; required_shared_ptr<UINT8> m_bgram; -// UINT8 * m_paletteram; // currently this uses generic palette handling /* input-related */ //UINT8 m_paddle_select; diff --git a/src/mame/drivers/drtomy.c b/src/mame/drivers/drtomy.c index 97f01c4a398..1f86b1df772 100644 --- a/src/mame/drivers/drtomy.c +++ b/src/mame/drivers/drtomy.c @@ -30,7 +30,6 @@ public: required_shared_ptr<UINT16> m_videoram_fg; required_shared_ptr<UINT16> m_videoram_bg; required_shared_ptr<UINT16> m_spriteram; -// UINT16 * m_paletteram16; // currently this uses generic palette handling /* video-related */ tilemap_t *m_tilemap_bg; @@ -175,7 +174,7 @@ static ADDRESS_MAP_START( drtomy_map, AS_PROGRAM, 16, drtomy_state ) AM_RANGE(0x000000, 0x03ffff) AM_ROM /* ROM */ AM_RANGE(0x100000, 0x100fff) AM_RAM_WRITE(drtomy_vram_fg_w) AM_SHARE("videorafg") /* Video RAM FG */ AM_RANGE(0x101000, 0x101fff) AM_RAM_WRITE(drtomy_vram_bg_w) AM_SHARE("videorabg") /* Video RAM BG */ - AM_RANGE(0x200000, 0x2007ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") /* Palette */ + AM_RANGE(0x200000, 0x2007ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0x440000, 0x440fff) AM_RAM AM_SHARE("spriteram") /* Sprite RAM */ AM_RANGE(0x700000, 0x700001) AM_READ_PORT("DSW1") AM_RANGE(0x700002, 0x700003) AM_READ_PORT("DSW2") diff --git a/src/mame/drivers/dynadice.c b/src/mame/drivers/dynadice.c index 49b23b0bed2..f1cb6167279 100644 --- a/src/mame/drivers/dynadice.c +++ b/src/mame/drivers/dynadice.c @@ -52,7 +52,6 @@ public: /* memory pointers */ required_shared_ptr<UINT8> m_videoram; // UINT8 * m_nvram; // currently this uses generic nvram handling -// UINT8 * m_paletteram; // currently this uses generic palette handling /* video-related */ tilemap_t *m_bg_tilemap; @@ -68,7 +67,6 @@ public: virtual void machine_start(); virtual void machine_reset(); virtual void video_start(); - DECLARE_PALETTE_INIT(dynadice); UINT32 screen_update_dynadice(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); required_device<cpu_device> m_maincpu; required_device<gfxdecode_device> m_gfxdecode; @@ -227,13 +225,6 @@ UINT32 dynadice_state::screen_update_dynadice(screen_device &screen, bitmap_ind1 return 0; } -PALETTE_INIT_MEMBER(dynadice_state, dynadice) -{ - int i; - for(i = 0; i < 8; i++) - palette.set_pen_color(i, pal1bit(i >> 1), pal1bit(i >> 2), pal1bit(i >> 0)); -} - void dynadice_state::machine_start() { save_item(NAME(m_ay_data)); @@ -268,8 +259,7 @@ static MACHINE_CONFIG_START( dynadice, dynadice_state ) MCFG_SCREEN_PALETTE("palette") MCFG_GFXDECODE_ADD("gfxdecode", "palette", dynadice) - MCFG_PALETTE_ADD("palette", 8) - MCFG_PALETTE_INIT_OWNER(dynadice_state, dynadice) + MCFG_PALETTE_ADD_3BIT_BRG("palette") MCFG_SPEAKER_STANDARD_MONO("mono") diff --git a/src/mame/drivers/dynduke.c b/src/mame/drivers/dynduke.c index bd97e60d24b..803e2c501fa 100644 --- a/src/mame/drivers/dynduke.c +++ b/src/mame/drivers/dynduke.c @@ -92,7 +92,7 @@ static ADDRESS_MAP_START( slave_map, AS_PROGRAM, 16, dynduke_state ) AM_RANGE(0x00000, 0x05fff) AM_RAM AM_RANGE(0x06000, 0x067ff) AM_RAM_WRITE(background_w) AM_SHARE("back_data") AM_RANGE(0x06800, 0x06fff) AM_RAM_WRITE(foreground_w) AM_SHARE("fore_data") - AM_RANGE(0x07000, 0x07fff) AM_RAM_WRITE(paletteram_w) AM_SHARE("paletteram") + AM_RANGE(0x07000, 0x07fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0x08000, 0x08fff) AM_RAM AM_SHARE("share1") AM_RANGE(0x0a000, 0x0a001) AM_WRITE(gfxbank_w) AM_RANGE(0x0c000, 0x0c001) AM_WRITENOP @@ -300,8 +300,9 @@ static MACHINE_CONFIG_START( dynduke, dynduke_state ) MCFG_SCREEN_PALETTE("palette") MCFG_GFXDECODE_ADD("gfxdecode", "palette", dynduke) - MCFG_PALETTE_ADD("palette", 2048) + MCFG_PALETTE_ADD("palette", 2048) + MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR) // sound hardware SEIBU_SOUND_SYSTEM_YM3812_INTERFACE(14318180/4,1320000) diff --git a/src/mame/drivers/firebeat.c b/src/mame/drivers/firebeat.c index 448cab4dd11..4c057bd62be 100644 --- a/src/mame/drivers/firebeat.c +++ b/src/mame/drivers/firebeat.c @@ -136,13 +136,10 @@ #include "sound/ymz280b.h" #include "sound/cdda.h" #include "sound/rf5c400.h" +#include "video/k057714.h" #include "firebeat.lh" -#define DUMP_VRAM 0 -#define PRINT_GCU 0 - - struct IBUTTON_SUBKEY { UINT8 identifier[8]; @@ -155,717 +152,6 @@ struct IBUTTON IBUTTON_SUBKEY subkey[3]; }; -#define MCFG_FIREBEAT_GCU_CPU_TAG(_tag) \ - firebeat_gcu_device::static_set_cpu_tag(*device, _tag); - -class firebeat_gcu_device : public device_t -{ -public: - firebeat_gcu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - static void static_set_cpu_tag(device_t &device, const char *tag) { downcast<firebeat_gcu_device &>(device).m_cputag = tag; } - - int draw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - DECLARE_READ32_MEMBER(read); - DECLARE_WRITE32_MEMBER(write); - - struct framebuffer - { - UINT32 base; - int width; - int height; - }; - -protected: - virtual void device_start(); - virtual void device_stop(); - virtual void device_reset(); - -private: - void execute_command(UINT32 *cmd); - void execute_display_list(UINT32 addr); - void draw_object(UINT32 *cmd); - void fill_rect(UINT32 *cmd); - void draw_character(UINT32 *cmd); - void fb_config(UINT32 *cmd); - - UINT32 *m_vram; - UINT32 m_vram_read_addr; - UINT32 m_vram_fifo0_addr; - UINT32 m_vram_fifo1_addr; - UINT32 m_vram_fifo0_mode; - UINT32 m_vram_fifo1_mode; - UINT32 m_command_fifo0[4]; - UINT32 m_command_fifo0_ptr; - UINT32 m_command_fifo1[4]; - UINT32 m_command_fifo1_ptr; - - const char* m_cputag; - device_t* m_cpu; - - framebuffer m_frame[4]; - UINT32 m_fb_origin_x; - UINT32 m_fb_origin_y; -}; - -const device_type FIREBEAT_GCU = &device_creator<firebeat_gcu_device>; - -firebeat_gcu_device::firebeat_gcu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, FIREBEAT_GCU, "FireBeat GCU", tag, owner, clock, "firebeat_gcu", __FILE__) -{ -} - -READ32_MEMBER(firebeat_gcu_device::read) -{ - int reg = offset * 4; - - // VRAM Read - if (reg >= 0x80 && reg < 0x100) - { - return m_vram[m_vram_read_addr + offset - 0x20]; - } - - switch (reg) - { - case 0x78: // GCU Status - /* ppd checks bits 0x0041 of the upper halfword on interrupt */ - return 0xffff0005; - - default: - break; - } - - return 0xffffffff; -} - -WRITE32_MEMBER(firebeat_gcu_device::write) -{ - int reg = offset * 4; - - switch (reg) - { - case 0x10: - /* IRQ clear/enable; ppd writes bit off then on in response to interrupt */ - /* it enables bits 0x41, but 0x01 seems to be the one it cares about */ - if (ACCESSING_BITS_16_31 && (data & 0x00010000) == 0) - m_cpu->execute().set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE); - if (ACCESSING_BITS_0_15) -#if PRINT_GCU - printf("%s_w: %02X, %08X, %08X\n", basetag(), reg, data, mem_mask); -#endif - break; - - case 0x14: // ? - break; - - case 0x18: // ? - break; - - case 0x20: // Framebuffer 0 Origin(?) - break; - - case 0x24: // Framebuffer 1 Origin(?) - break; - - case 0x28: // Framebuffer 2 Origin(?) - break; - - case 0x2c: // Framebuffer 3 Origin(?) - break; - - case 0x30: // Framebuffer 0 Dimensions - if (ACCESSING_BITS_16_31) - m_frame[0].height = (data >> 16) & 0xffff; - if (ACCESSING_BITS_0_15) - m_frame[0].width = data & 0xffff; - break; - - case 0x34: // Framebuffer 1 Dimensions - if (ACCESSING_BITS_16_31) - m_frame[1].height = (data >> 16) & 0xffff; - if (ACCESSING_BITS_0_15) - m_frame[1].width = data & 0xffff; - break; - - case 0x38: // Framebuffer 2 Dimensions - if (ACCESSING_BITS_16_31) - m_frame[2].height = (data >> 16) & 0xffff; - if (ACCESSING_BITS_0_15) - m_frame[2].width = data & 0xffff; - break; - - case 0x3c: // Framebuffer 3 Dimensions - if (ACCESSING_BITS_16_31) - m_frame[3].height = (data >> 16) & 0xffff; - if (ACCESSING_BITS_0_15) - m_frame[3].width = data & 0xffff; - break; - - case 0x40: // Framebuffer 0 Base - m_frame[0].base = data; -#if PRINT_GCU - printf("%s FB0 Base: %08X\n", basetag(), data); -#endif - break; - - case 0x44: // Framebuffer 1 Base - m_frame[1].base = data; -#if PRINT_GCU - printf("%s FB1 Base: %08X\n", basetag(), data); -#endif - break; - - case 0x48: // Framebuffer 2 Base - m_frame[2].base = data; -#if PRINT_GCU - printf("%s FB2 Base: %08X\n", basetag(), data); -#endif - break; - - case 0x4c: // Framebuffer 3 Base - m_frame[3].base = data; -#if PRINT_GCU - printf("%s FB3 Base: %08X\n", basetag(), data); -#endif - break; - - case 0x5c: // VRAM Read Address - m_vram_read_addr = (data & 0xffffff) / 2; - break; - - case 0x60: // VRAM Port 0 Write Address - m_vram_fifo0_addr = (data & 0xffffff) / 2; - break; - - case 0x68: // VRAM Port 0/1 Mode - if (ACCESSING_BITS_16_31) - m_vram_fifo0_mode = data >> 16; - if (ACCESSING_BITS_0_15) - m_vram_fifo1_mode = data & 0xffff; - break; - - case 0x70: // VRAM Port 0 Write FIFO - if (m_vram_fifo0_mode & 0x100) - { - // write to command fifo - m_command_fifo0[m_command_fifo0_ptr] = data; - m_command_fifo0_ptr++; - - // execute when filled - if (m_command_fifo0_ptr >= 4) - { - //printf("GCU FIFO0 exec: %08X %08X %08X %08X\n", m_command_fifo0[0], m_command_fifo0[1], m_command_fifo0[2], m_command_fifo0[3]); - execute_command(m_command_fifo0); - m_command_fifo0_ptr = 0; - } - } - else - { - // write to VRAM fifo - m_vram[m_vram_fifo0_addr] = data; - m_vram_fifo0_addr++; - } - break; - - case 0x64: // VRAM Port 1 Write Address - m_vram_fifo1_addr = (data & 0xffffff) / 2; - printf("GCU FIFO1 addr = %08X\n", data); - break; - - case 0x74: // VRAM Port 1 Write FIFO - printf("GCU FIFO1 write = %08X\n", data); - - if (m_vram_fifo1_mode & 0x100) - { - // write to command fifo - m_command_fifo1[m_command_fifo1_ptr] = data; - m_command_fifo1_ptr++; - - // execute when filled - if (m_command_fifo1_ptr >= 4) - { - printf("GCU FIFO1 exec: %08X %08X %08X %08X\n", m_command_fifo1[0], m_command_fifo1[1], m_command_fifo1[2], m_command_fifo1[3]); - m_command_fifo1_ptr = 0; - } - } - else - { - // write to VRAM fifo - m_vram[m_vram_fifo1_addr] = data; - m_vram_fifo1_addr++; - } - break; - - default: - //printf("%s_w: %02X, %08X, %08X\n", basetag(), reg, data, mem_mask); - break; - } -} - -int firebeat_gcu_device::draw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - UINT16 *vram16 = (UINT16*)m_vram; - - int x = 0; - int y = 0; - int width = m_frame[0].width; - int height = m_frame[0].height; - - if (width != 0 && height != 0) - { - rectangle visarea = screen.visible_area(); - if ((visarea.max_x+1) != width || (visarea.max_y+1) != height) - { - visarea.max_x = width-1; - visarea.max_y = height-1; - screen.configure(width, height, visarea, screen.frame_period().attoseconds); - } - } - - int fb_pitch = 1024; - - for (int j=0; j < height; j++) - { - UINT16 *d = &bitmap.pix16(j, x); - int li = ((j+y) * fb_pitch) + x; - UINT32 fbaddr0 = m_frame[0].base + li; - UINT32 fbaddr1 = m_frame[1].base + li; -// UINT32 fbaddr2 = m_frame[2].base + li; -// UINT32 fbaddr3 = m_frame[3].base + li; - - for (int i=0; i < width; i++) - { - UINT16 pix0 = vram16[fbaddr0 ^ NATIVE_ENDIAN_VALUE_LE_BE(1,0)]; - UINT16 pix1 = vram16[fbaddr1 ^ NATIVE_ENDIAN_VALUE_LE_BE(1,0)]; -// UINT16 pix2 = vram16[fbaddr2 ^ NATIVE_ENDIAN_VALUE_LE_BE(1,0)]; -// UINT16 pix3 = vram16[fbaddr3 ^ NATIVE_ENDIAN_VALUE_LE_BE(1,0)]; - - if (pix0 & 0x8000) - { - d[i] = pix0 & 0x7fff; - } - else - { - d[i] = pix1 & 0x7fff; - } - - fbaddr0++; - fbaddr1++; -// fbaddr2++; -// fbaddr3++; - } - } - - return 0; -} - -void firebeat_gcu_device::draw_object(UINT32 *cmd) -{ - // 0x00: xxx----- -------- -------- -------- command (5) - // 0x00: ---x---- -------- -------- -------- 0: absolute coordinates - // 1: relative coordinates from framebuffer origin - // 0x00: ----xx-- -------- -------- -------- ? - // 0x00: -------- xxxxxxxx xxxxxxxx xxxxxxxx object data address in vram - - // 0x01: -------- -------- ------xx xxxxxxxx object x - // 0x01: -------- xxxxxxxx xxxxxx-- -------- object y - // 0x01: -----x-- -------- -------- -------- object x flip - // 0x01: ----x--- -------- -------- -------- object y flip - // 0x01: --xx---- -------- -------- -------- object alpha enable (different blend modes?) - // 0x01: -x------ -------- -------- -------- object transparency enable (?) - - // 0x02: -------- -------- ------xx xxxxxxxx object width - // 0x02: -------- -----xxx xxxxxx-- -------- object x scale - - // 0x03: -------- -------- ------xx xxxxxxxx object height - // 0x03: -------- -----xxx xxxxxx-- -------- object y scale - - int x = cmd[1] & 0x3ff; - int y = (cmd[1] >> 10) & 0x3fff; - int width = (cmd[2] & 0x3ff) + 1; - int height = (cmd[3] & 0x3ff) + 1; - int xscale = (cmd[2] >> 10) & 0x1ff; - int yscale = (cmd[3] >> 10) & 0x1ff; - bool xflip = (cmd[1] & 0x04000000) ? true : false; - bool yflip = (cmd[1] & 0x08000000) ? true : false; - bool alpha_enable = (cmd[1] & 0x30000000) ? true : false; - bool trans_enable = (cmd[1] & 0x40000000) ? true : false; - UINT32 address = cmd[0] & 0xffffff; - int alpha_level = (cmd[2] >> 27) & 0x1f; - bool relative_coords = (cmd[0] & 0x10000000) ? true : false; - - if (relative_coords) - { - x += m_fb_origin_x; - y += m_fb_origin_y; - } - - UINT16 *vram16 = (UINT16*)m_vram; - - if (xscale == 0 || yscale == 0) - { - return; - } - -#if PRINT_GCU - printf("%s Draw Object %08X, x %d, y %d, w %d, h %d [%08X %08X %08X %08X]\n", basetag(), address, x, y, width, height, cmd[0], cmd[1], cmd[2], cmd[3]); -#endif - - width = (((width * 65536) / xscale) * 64) / 65536; - height = (((height * 65536) / yscale) * 64) / 65536; - - int fb_pitch = 1024; - - int v = 0; - for (int j=0; j < height; j++) - { - int index; - int xinc; - UINT32 fbaddr = ((j+y) * fb_pitch) + x; - - if (yflip) - { - index = address + ((height - 1 - (v >> 6)) * 1024); - } - else - { - index = address + ((v >> 6) * 1024); - } - - if (xflip) - { - fbaddr += width; - xinc = -1; - } - else - { - xinc = 1; - } - - int u = 0; - for (int i=0; i < width; i++) - { - UINT16 pix = vram16[((index + (u >> 6)) ^ NATIVE_ENDIAN_VALUE_LE_BE(1,0)) & 0xffffff]; - bool draw = !trans_enable || (trans_enable && (pix & 0x8000)); - if (alpha_enable) - { - if (draw) - { - if ((pix & 0x7fff) != 0) - { - UINT16 srcpix = vram16[fbaddr ^ NATIVE_ENDIAN_VALUE_LE_BE(1,0)]; - - UINT32 sr = (srcpix >> 10) & 0x1f; - UINT32 sg = (srcpix >> 5) & 0x1f; - UINT32 sb = (srcpix >> 0) & 0x1f; - UINT32 r = (pix >> 10) & 0x1f; - UINT32 g = (pix >> 5) & 0x1f; - UINT32 b = (pix >> 0) & 0x1f; - - sr += (r * alpha_level) >> 4; - sg += (g * alpha_level) >> 4; - sb += (b * alpha_level) >> 4; - - if (sr > 0x1f) sr = 0x1f; - if (sg > 0x1f) sg = 0x1f; - if (sb > 0x1f) sb = 0x1f; - - vram16[fbaddr ^ NATIVE_ENDIAN_VALUE_LE_BE(1,0)] = (sr << 10) | (sg << 5) | sb | 0x8000; - } - } - } - else - { - if (draw) - { - vram16[fbaddr ^ NATIVE_ENDIAN_VALUE_LE_BE(1,0)] = pix | 0x8000; - } - } - - fbaddr += xinc; - u += xscale; - } - - v += yscale; - } -} - -void firebeat_gcu_device::fill_rect(UINT32 *cmd) -{ - // 0x00: xxx----- -------- -------- -------- command (4) - // 0x00: ---x---- -------- -------- -------- 0: absolute coordinates - // 1: relative coordinates from framebuffer origin - // 0x00: ----xx-- -------- -------- -------- ? - // 0x00: -------- -------- ------xx xxxxxxxx width - // 0x00: -------- ----xxxx xxxxxx-- -------- height - - // 0x01: -------- -------- ------xx xxxxxxxx x - // 0x01: -------- xxxxxxxx xxxxxx-- -------- y - - // 0x02: xxxxxxxx xxxxxxxx -------- -------- fill pattern pixel 0 - // 0x02: -------- -------- xxxxxxxx xxxxxxxx fill pattern pixel 1 - - // 0x03: xxxxxxxx xxxxxxxx -------- -------- fill pattern pixel 2 - // 0x03: -------- -------- xxxxxxxx xxxxxxxx fill pattern pixel 3 - - int x = cmd[1] & 0x3ff; - int y = (cmd[1] >> 10) & 0x3fff; - int width = (cmd[0] & 0x3ff) + 1; - int height = ((cmd[0] >> 10) & 0x3ff) + 1; - bool relative_coords = (cmd[0] & 0x10000000) ? true : false; - - if (relative_coords) - { - x += m_fb_origin_x; - y += m_fb_origin_y; - } - - UINT16 color[4]; - color[0] = (cmd[2] >> 16); - color[1] = (cmd[2] & 0xffff); - color[2] = (cmd[3] >> 16); - color[3] = (cmd[3] & 0xffff); - -#if PRINT_GCU - printf("%s Fill Rect x %d, y %d, w %d, h %d, %08X %08X [%08X %08X %08X %08X]\n", basetag(), x, y, width, height, cmd[2], cmd[3], cmd[0], cmd[1], cmd[2], cmd[3]); -#endif - - int x1 = x; - int x2 = x + width; - int y1 = y; - int y2 = y + height; - - UINT16 *vram16 = (UINT16*)m_vram; - - int fb_pitch = 1024; - - for (int j=y1; j < y2; j++) - { - UINT32 fbaddr = j * fb_pitch; - for (int i=x1; i < x2; i++) - { - vram16[(fbaddr+i) ^ NATIVE_ENDIAN_VALUE_LE_BE(1,0)] = color[i&3]; - } - } -} - -void firebeat_gcu_device::draw_character(UINT32 *cmd) -{ - // 0x00: xxx----- -------- -------- -------- command (7) - // 0x00: ---x---- -------- -------- -------- 0: absolute coordinates - // 1: relative coordinates from framebuffer base (unverified, should be same as other operations) - // 0x00: -------- xxxxxxxx xxxxxxxx xxxxxxxx character data address in vram - - // 0x01: -------- -------- ------xx xxxxxxxx character x - // 0x01: -------- ----xxxx xxxxxx-- -------- character y - - // 0x02: xxxxxxxx xxxxxxxx -------- -------- color 0 - // 0x02: -------- -------- xxxxxxxx xxxxxxxx color 1 - - // 0x03: xxxxxxxx xxxxxxxx -------- -------- color 2 - // 0x03: -------- -------- xxxxxxxx xxxxxxxx color 3 - - int x = cmd[1] & 0x3ff; - int y = (cmd[1] >> 10) & 0x3ff; - UINT32 address = cmd[0] & 0xffffff; - UINT16 color[4]; - bool relative_coords = (cmd[0] & 0x10000000) ? true : false; - - if (relative_coords) - { - x += m_fb_origin_x; - y += m_fb_origin_y; - } - - color[0] = cmd[2] >> 16; - color[1] = cmd[2] & 0xffff; - color[2] = cmd[3] >> 16; - color[3] = cmd[3] & 0xffff; - -#if PRINT_GCU - printf("%s Draw Char %08X, x %d, y %d\n", basetag(), address, x, y); -#endif - - UINT16 *vram16 = (UINT16*)m_vram; - int fb_pitch = 1024; - - for (int j=0; j < 8; j++) - { - UINT32 fbaddr = (y+j) * fb_pitch; - UINT16 line = vram16[address ^ NATIVE_ENDIAN_VALUE_LE_BE(1,0)]; - - address += 4; - - for (int i=0; i < 8; i++) - { - int p = (line >> ((7-i) * 2)) & 3; - vram16[(fbaddr+x+i) ^ NATIVE_ENDIAN_VALUE_LE_BE(1,0)] = color[p] | 0x8000; - } - } -} - -void firebeat_gcu_device::fb_config(UINT32 *cmd) -{ - // 0x00: xxx----- -------- -------- -------- command (3) - - // 0x01: -------- -------- -------- -------- unused? - - // 0x02: -------- -------- ------xx xxxxxxxx Framebuffer Origin X - - // 0x03: -------- -------- --xxxxxx xxxxxxxx Framebuffer Origin Y - -#if PRINT_GCU - printf("%s FB Config %08X %08X %08X %08X\n", basetag(), cmd[0], cmd[1], cmd[2], cmd[3]); -#endif - - m_fb_origin_x = cmd[2] & 0x3ff; - m_fb_origin_y = cmd[3] & 0x3fff; -} - -void firebeat_gcu_device::execute_display_list(UINT32 addr) -{ - bool end = false; - - int counter = 0; - -#if PRINT_GCU - printf("%s Exec Display List %08X\n", basetag(), addr); -#endif - - addr /= 2; - while (!end && counter < 0x1000 && addr < (0x2000000/4)) - { - UINT32 *cmd = &m_vram[addr]; - addr += 4; - - int command = (cmd[0] >> 29) & 0x7; - - switch (command) - { - case 0: // NOP? - break; - - case 1: // Execute display list - execute_display_list(cmd[0] & 0xffffff); - break; - - case 2: // End of display list - end = true; - break; - - case 3: // Framebuffer config - fb_config(cmd); - break; - - case 4: // Fill rectangle - fill_rect(cmd); - break; - - case 5: // Draw object - draw_object(cmd); - break; - - case 7: // Draw 8x8 character (2 bits per pixel) - draw_character(cmd); - break; - - default: - printf("GCU Unknown command %08X %08X %08X %08X\n", cmd[0], cmd[1], cmd[2], cmd[3]); - break; - } - counter++; - }; -} - -void firebeat_gcu_device::execute_command(UINT32* cmd) -{ - int command = (cmd[0] >> 29) & 0x7; - -#if PRINT_GCU - printf("%s Exec Command %08X, %08X, %08X, %08X\n", basetag(), cmd[0], cmd[1], cmd[2], cmd[3]); -#endif - - switch (command) - { - case 0: // NOP? - break; - - case 1: // Execute display list - execute_display_list(cmd[0] & 0xffffff); - break; - - case 2: // End of display list - break; - - case 3: // Framebuffer config - fb_config(cmd); - break; - - case 4: // Fill rectangle - fill_rect(cmd); - break; - - case 5: // Draw object - draw_object(cmd); - break; - - case 7: // Draw 8x8 character (2 bits per pixel) - draw_character(cmd); - break; - - default: - printf("GCU Unknown command %08X %08X %08X %08X\n", cmd[0], cmd[1], cmd[2], cmd[3]); - break; - } -} - -void firebeat_gcu_device::device_start() -{ - m_cpu = machine().device(m_cputag); - - m_vram = auto_alloc_array(machine(), UINT32, 0x2000000/4); - memset(m_vram, 0, 0x2000000); -} - -void firebeat_gcu_device::device_reset() -{ - m_vram_read_addr = 0; - m_command_fifo0_ptr = 0; - m_command_fifo1_ptr = 0; - m_vram_fifo0_addr = 0; - m_vram_fifo1_addr = 0; - - for (int i=0; i < 4; i++) - { - m_frame[i].base = 0; - m_frame[i].width = 0; - m_frame[i].height = 0; - } -} - -void firebeat_gcu_device::device_stop() -{ -#if DUMP_VRAM - char filename[200]; - sprintf(filename, "%s_vram.bin", basetag()); - printf("dumping %s\n", filename); - FILE *file = fopen(filename, "wb"); - int i; - - for (i=0; i < 0x2000000/4; i++) - { - fputc((m_vram[i] >> 24) & 0xff, file); - fputc((m_vram[i] >> 16) & 0xff, file); - fputc((m_vram[i] >> 8) & 0xff, file); - fputc((m_vram[i] >> 0) & 0xff, file); - } - - fclose(file); -#endif -} - - - #define PRINT_SPU_MEM 0 @@ -901,8 +187,8 @@ public: optional_device<midi_keyboard_device> m_kbd0; optional_device<midi_keyboard_device> m_kbd1; required_device<ata_interface_device> m_ata; - required_device<firebeat_gcu_device> m_gcu0; - required_device<firebeat_gcu_device> m_gcu1; + required_device<k057714_device> m_gcu0; + required_device<k057714_device> m_gcu1; optional_device<ata_interface_device> m_spuata; UINT8 m_extend_board_irq_enable; @@ -960,6 +246,7 @@ public: DECLARE_READ16_MEMBER(spu_unk_r); DECLARE_WRITE16_MEMBER(spu_irq_ack_w); DECLARE_WRITE16_MEMBER(spu_220000_w); + DECLARE_WRITE16_MEMBER(spu_sdram_bank_w); DECLARE_READ16_MEMBER(m68k_spu_share_r); DECLARE_WRITE16_MEMBER(m68k_spu_share_w); DECLARE_WRITE_LINE_MEMBER(spu_ata_interrupt); @@ -1624,6 +911,14 @@ WRITE32_MEMBER(firebeat_state::ppc_spu_share_w) if (offset == 0xff) // address 0x3fe triggers M68K interrupt { m_audiocpu->set_input_line(INPUT_LINE_IRQ4, ASSERT_LINE); + + printf("SPU command %02X%02X\n", m_spu_shared_ram[0], m_spu_shared_ram[1]); + + UINT16 cmd = ((UINT16)(m_spu_shared_ram[0]) << 8) | m_spu_shared_ram[1]; + if (cmd == 0x1110) + { + printf(" [%02X %02X %02X %02X %02X]\n", m_spu_shared_ram[0x10], m_spu_shared_ram[0x11], m_spu_shared_ram[0x12], m_spu_shared_ram[0x13], m_spu_shared_ram[0x14]); + } } } if (ACCESSING_BITS_0_7) @@ -1685,6 +980,7 @@ READ16_MEMBER(firebeat_state::spu_unk_r) UINT16 r = 0; r |= 0x80; // if set, uses ATA PIO mode, otherwise DMA + r |= 0x01; // enable SDRAM test return r; } @@ -1707,6 +1003,10 @@ WRITE16_MEMBER(firebeat_state::spu_220000_w) // IRQ2 handler 5 sets all bits } +WRITE16_MEMBER(firebeat_state::spu_sdram_bank_w) +{ +} + WRITE_LINE_MEMBER(firebeat_state::spu_ata_interrupt) { m_audiocpu->set_input_line(INPUT_LINE_IRQ6, state); @@ -1744,8 +1044,8 @@ static ADDRESS_MAP_START( firebeat_map, AS_PROGRAM, 32, firebeat_state ) AM_RANGE(0x7dc00000, 0x7dc0000f) AM_DEVREADWRITE8("duart_com", pc16552_device, read, write, 0xffffffff) AM_RANGE(0x7e000000, 0x7e00003f) AM_DEVREADWRITE8("rtc", rtc65271_device, rtc_r, rtc_w, 0xffffffff) AM_RANGE(0x7e000100, 0x7e00013f) AM_DEVREADWRITE8("rtc", rtc65271_device, xram_r, xram_w, 0xffffffff) - AM_RANGE(0x7e800000, 0x7e8000ff) AM_DEVREADWRITE("gcu0", firebeat_gcu_device, read, write) - AM_RANGE(0x7e800100, 0x7e8001ff) AM_DEVREADWRITE("gcu1", firebeat_gcu_device, read, write) + AM_RANGE(0x7e800000, 0x7e8000ff) AM_DEVREADWRITE("gcu0", k057714_device, read, write) + AM_RANGE(0x7e800100, 0x7e8001ff) AM_DEVREADWRITE("gcu1", k057714_device, read, write) AM_RANGE(0x7fe00000, 0x7fe0000f) AM_READWRITE(ata_command_r, ata_command_w) AM_RANGE(0x7fe80000, 0x7fe8000f) AM_READWRITE(ata_control_r, ata_control_w) AM_RANGE(0x7ff80000, 0x7fffffff) AM_ROM AM_REGION("user1", 0) /* System BIOS */ @@ -1757,10 +1057,13 @@ static ADDRESS_MAP_START( spu_map, AS_PROGRAM, 16, firebeat_state ) AM_RANGE(0x200000, 0x200001) AM_READ(spu_unk_r) AM_RANGE(0x220000, 0x220001) AM_WRITE(spu_220000_w) AM_RANGE(0x230000, 0x230001) AM_WRITE(spu_irq_ack_w) + AM_RANGE(0x260000, 0x260001) AM_WRITE(spu_sdram_bank_w) AM_RANGE(0x280000, 0x2807ff) AM_READWRITE(m68k_spu_share_r, m68k_spu_share_w) AM_RANGE(0x300000, 0x30000f) AM_DEVREADWRITE("spu_ata", ata_interface_device, read_cs0, write_cs0) AM_RANGE(0x340000, 0x34000f) AM_DEVREADWRITE("spu_ata", ata_interface_device, read_cs1, write_cs1) AM_RANGE(0x400000, 0x400fff) AM_DEVREADWRITE("rf5c400", rf5c400_device, rf5c400_r, rf5c400_w) + AM_RANGE(0x800000, 0x83ffff) AM_RAM // SDRAM + AM_RANGE(0xfc0000, 0xffffff) AM_RAM // SDRAM ADDRESS_MAP_END /*****************************************************************************/ @@ -1967,11 +1270,11 @@ static MACHINE_CONFIG_START( firebeat, firebeat_state ) /* video hardware */ MCFG_PALETTE_ADD_RRRRRGGGGGBBBBB("palette") - MCFG_DEVICE_ADD("gcu0", FIREBEAT_GCU, 0) - MCFG_FIREBEAT_GCU_CPU_TAG("maincpu") + MCFG_DEVICE_ADD("gcu0", K057714, 0) + MCFG_K057714_CPU_TAG("maincpu") - MCFG_DEVICE_ADD("gcu1", FIREBEAT_GCU, 0) - MCFG_FIREBEAT_GCU_CPU_TAG("maincpu") + MCFG_DEVICE_ADD("gcu1", K057714, 0) + MCFG_K057714_CPU_TAG("maincpu") MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -2027,11 +1330,11 @@ static MACHINE_CONFIG_START( firebeat2, firebeat_state ) /* video hardware */ MCFG_PALETTE_ADD_RRRRRGGGGGBBBBB("palette") - MCFG_DEVICE_ADD("gcu0", FIREBEAT_GCU, 0) - MCFG_FIREBEAT_GCU_CPU_TAG("maincpu") + MCFG_DEVICE_ADD("gcu0", K057714, 0) + MCFG_K057714_CPU_TAG("maincpu") - MCFG_DEVICE_ADD("gcu1", FIREBEAT_GCU, 0) - MCFG_FIREBEAT_GCU_CPU_TAG("maincpu") + MCFG_DEVICE_ADD("gcu1", K057714, 0) + MCFG_K057714_CPU_TAG("maincpu") MCFG_SCREEN_ADD("lscreen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -2091,6 +1394,17 @@ MACHINE_CONFIG_END /*****************************************************************************/ /* Security dongle is a Dallas DS1411 RS232 Adapter with a DS1991 Multikey iButton */ +/* popn7 supports 8 different dongles: + - Manufacture + - Service + - Event + - Oversea + - No Hardware + - Rental + - Debug + - Normal +*/ + enum { DS1991_STATE_NORMAL, @@ -2420,7 +1734,7 @@ ROM_START( popn7 ) ROM_LOAD16_WORD_SWAP("a02jaa03.21e", 0x00000, 0x80000, CRC(43ecc093) SHA1(637df5b546cf7409dd4752dc471674fe2a046599)) ROM_REGION(0xc0, "user2", ROMREGION_ERASE00) // Security dongle - ROM_LOAD("gcb00-ja", 0x00, 0xc0, CRC(cc28625a) SHA1(e7de79ae72fdbd22328c9de74dfa17b5e6ae43b6)) + ROM_LOAD("gcb00-ja", 0x00, 0xc0, CRC(d0a58c74) SHA1(fc1d8ad2f9d16743dc10b6e61a5a88ffa9c9dd2f)) ROM_REGION(0x80000, "audiocpu", 0) // SPU 68K program ROM_LOAD16_WORD_SWAP("a02jaa04.3q", 0x00000, 0x80000, CRC(8c6000dd) SHA1(94ab2a66879839411eac6c673b25143d15836683)) diff --git a/src/mame/drivers/gaelco2.c b/src/mame/drivers/gaelco2.c index 3e6db9f94be..f11ebe45a23 100644 --- a/src/mame/drivers/gaelco2.c +++ b/src/mame/drivers/gaelco2.c @@ -204,12 +204,12 @@ ROM_END BANG ============================================================================*/ -READ16_MEMBER(gaelco2_state::p1_gun_x){return (ioport("LIGHT0_X")->read() * 320 / 0x100) + 1;} -READ16_MEMBER(gaelco2_state::p1_gun_y){return (ioport("LIGHT0_Y")->read() * 240 / 0x100) - 4;} -READ16_MEMBER(gaelco2_state::p2_gun_x){return (ioport("LIGHT1_X")->read() * 320 / 0x100) + 1;} -READ16_MEMBER(gaelco2_state::p2_gun_y){return (ioport("LIGHT1_Y")->read() * 240 / 0x100) - 4;} +READ16_MEMBER(bang_state::p1_gun_x){return (m_light0_x->read() * 320 / 0x100) + 1;} +READ16_MEMBER(bang_state::p1_gun_y){return (m_light0_y->read() * 240 / 0x100) - 4;} +READ16_MEMBER(bang_state::p2_gun_x){return (m_light1_x->read() * 320 / 0x100) + 1;} +READ16_MEMBER(bang_state::p2_gun_y){return (m_light1_y->read() * 240 / 0x100) - 4;} -static ADDRESS_MAP_START( bang_map, AS_PROGRAM, 16, gaelco2_state ) +static ADDRESS_MAP_START( bang_map, AS_PROGRAM, 16, bang_state ) AM_RANGE(0x000000, 0x0fffff) AM_ROM /* ROM */ AM_RANGE(0x202890, 0x2028ff) AM_DEVREADWRITE("gaelco", gaelco_cg1v_device, gaelcosnd_r, gaelcosnd_w) /* Sound Registers */ AM_RANGE(0x200000, 0x20ffff) AM_RAM_WRITE(gaelco2_vram_w) AM_SHARE("spriteram") /* Video RAM */ @@ -263,11 +263,11 @@ static INPUT_PORTS_START( bang ) PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, -6.0 / 240, 0) PORT_SENSITIVITY(35) PORT_KEYDELTA(15) PORT_PLAYER(2) INPUT_PORTS_END -static MACHINE_CONFIG_START( bang, gaelco2_state ) +static MACHINE_CONFIG_START( bang, bang_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", M68000, 30000000/2) /* 15 MHz */ MCFG_CPU_PROGRAM_MAP(bang_map) - MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", gaelco2_state, bang_irq, "screen", 0, 1) + MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", bang_state, bang_irq, "screen", 0, 1) MCFG_EEPROM_SERIAL_93C66_ADD("eeprom") @@ -1060,7 +1060,7 @@ ROM_END WORLD RALLY 2 ============================================================================*/ -static ADDRESS_MAP_START( wrally2_map, AS_PROGRAM, 16, gaelco2_state ) +static ADDRESS_MAP_START( wrally2_map, AS_PROGRAM, 16, wrally2_state ) AM_RANGE(0x000000, 0x0fffff) AM_ROM /* ROM */ AM_RANGE(0x202890, 0x2028ff) AM_DEVREADWRITE("gaelco", gaelco_gae1_device, gaelcosnd_r, gaelcosnd_w) /* Sound Registers */ AM_RANGE(0x200000, 0x20ffff) AM_RAM_WRITE(gaelco2_vram_w) AM_SHARE("spriteram") /* Video RAM */ @@ -1086,7 +1086,7 @@ static INPUT_PORTS_START( wrally2 ) PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 Acc.") PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 Gear") PORT_TOGGLE - PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, gaelco2_state,wrally2_analog_bit_r, (void *)0) /* ADC_1 serial input */ + PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, wrally2_state,wrally2_analog_bit_r, (void *)0) /* ADC_1 serial input */ PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START1 ) PORT_SERVICE_DIPLOC( 0x0100, IP_ACTIVE_LOW, "SW2:1" ) PORT_DIPNAME( 0x0200, 0x0000, "Coin mechanism" ) PORT_DIPLOCATION("SW2:2") @@ -1144,7 +1144,7 @@ static INPUT_PORTS_START( wrally2 ) PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 Acc.") PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 Gear") PORT_TOGGLE - PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, gaelco2_state,wrally2_analog_bit_r, (void *)1) /* ADC_2 serial input */ + PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, wrally2_state,wrally2_analog_bit_r, (void *)1) /* ADC_2 serial input */ PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START2 ) PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_COIN2 ) @@ -1167,7 +1167,7 @@ static INPUT_PORTS_START( wrally2 ) PORT_BIT( 0xff, 0x8A, IPT_PADDLE_V ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(25) PORT_REVERSE PORT_NAME("P2 Wheel") INPUT_PORTS_END -static MACHINE_CONFIG_START( wrally2, gaelco2_state ) +static MACHINE_CONFIG_START( wrally2, wrally2_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", M68000, 26000000/2) /* 13 MHz */ MCFG_CPU_PROGRAM_MAP(wrally2_map) @@ -1415,7 +1415,7 @@ GAME( 1995, wrally2, 0, wrally2, wrally2, driver_device, 0, ROT GAME( 1996, maniacsq, 0, maniacsq, maniacsq, driver_device, 0, ROT0, "Gaelco", "Maniac Square (unprotected)", 0 ) GAME( 1996, snowboar, 0, snowboar, snowboar, driver_device, 0, ROT0, "Gaelco", "Snow Board Championship (Version 2.1)", MACHINE_UNEMULATED_PROTECTION | MACHINE_NOT_WORKING ) GAME( 1996, snowboara,snowboar, snowboar, snowboar, gaelco2_state, snowboar, ROT0, "Gaelco", "Snow Board Championship (Version 2.0)", MACHINE_UNEMULATED_PROTECTION | MACHINE_NOT_WORKING ) -GAME( 1998, bang, 0, bang, bang, gaelco2_state, bang, ROT0, "Gaelco", "Bang!", 0 ) -GAME( 1998, bangj, bang, bang, bang, gaelco2_state, bang, ROT0, "Gaelco", "Gun Gabacho (Japan)", 0 ) +GAME( 1998, bang, 0, bang, bang, bang_state, bang, ROT0, "Gaelco", "Bang!", 0 ) +GAME( 1998, bangj, bang, bang, bang, bang_state, bang, ROT0, "Gaelco", "Gun Gabacho (Japan)", 0 ) GAME( 1999, grtesoro, 0, maniacsq, maniacsq, driver_device, 0, ROT0, "Nova Desitec", "Gran Tesoro? / Play 2000 (v5.01) (Italy)", MACHINE_UNEMULATED_PROTECTION | MACHINE_NOT_WORKING ) GAME( 1999, grtesoro4, grtesoro,maniacsq, maniacsq, driver_device, 0, ROT0, "Nova Desitec", "Gran Tesoro? / Play 2000 (v4.0) (Italy)", MACHINE_UNEMULATED_PROTECTION | MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/gaelco3d.c b/src/mame/drivers/gaelco3d.c index b74fe069cf9..da02df07eb6 100644 --- a/src/mame/drivers/gaelco3d.c +++ b/src/mame/drivers/gaelco3d.c @@ -677,7 +677,7 @@ WRITE32_MEMBER(gaelco3d_state::adsp_tx_callback) /* now put it down to samples, so we know what the channel frequency has to be */ sample_period *= 16 * SOUND_CHANNELS; - dmadac_set_frequency(&m_dmadac[0], SOUND_CHANNELS, ATTOSECONDS_TO_HZ(sample_period.attoseconds)); + dmadac_set_frequency(&m_dmadac[0], SOUND_CHANNELS, ATTOSECONDS_TO_HZ(sample_period.attoseconds())); dmadac_enable(&m_dmadac[0], SOUND_CHANNELS, 1); /* fire off a timer wich will hit every half-buffer */ diff --git a/src/mame/drivers/galaxi.c b/src/mame/drivers/galaxi.c index 71207043253..f22f0176fa8 100644 --- a/src/mame/drivers/galaxi.c +++ b/src/mame/drivers/galaxi.c @@ -68,7 +68,6 @@ public: required_shared_ptr<UINT16> m_bg3_ram; required_shared_ptr<UINT16> m_bg4_ram; required_shared_ptr<UINT16> m_fg_ram; -// UINT16 * m_paletteram; // currently this uses generic palette handling // UINT16 * m_nvram; // currently this uses generic nvram handling /* video-related */ diff --git a/src/mame/drivers/galpanic.c b/src/mame/drivers/galpanic.c index 5aa4eb0ccf4..ba02735d3ab 100644 --- a/src/mame/drivers/galpanic.c +++ b/src/mame/drivers/galpanic.c @@ -132,7 +132,7 @@ static ADDRESS_MAP_START( galpanic_map, AS_PROGRAM, 16, galpanic_state ) AM_RANGE(0x400000, 0x400001) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff) AM_RANGE(0x500000, 0x51ffff) AM_RAM AM_SHARE("fgvideoram") AM_RANGE(0x520000, 0x53ffff) AM_RAM_WRITE(galpanic_bgvideoram_w) AM_SHARE("bgvideoram") /* + work RAM */ - AM_RANGE(0x600000, 0x6007ff) AM_RAM_WRITE(galpanic_paletteram_w) AM_SHARE("paletteram") /* 1024 colors, but only 512 seem to be used */ + AM_RANGE(0x600000, 0x6007ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") /* 1024 colors, but only 512 seem to be used */ AM_RANGE(0x700000, 0x701fff) AM_DEVREADWRITE("pandora", kaneko_pandora_device, spriteram_LSB_r, spriteram_LSB_w) AM_RANGE(0x702000, 0x704fff) AM_RAM AM_RANGE(0x800000, 0x800001) AM_READ_PORT("DSW1") @@ -235,7 +235,8 @@ static MACHINE_CONFIG_START( galpanic, galpanic_state ) MCFG_GFXDECODE_ADD("gfxdecode", "palette", galpanic) MCFG_PALETTE_ADD("palette", 1024 + 32768) - MCFG_PALETTE_INIT_OWNER(galpanic_state,galpanic) + MCFG_PALETTE_FORMAT(GGGGGRRRRRBBBBBx) // fg palette ram, bit 0 seems to be a transparency flag for the front bitmap + MCFG_PALETTE_INIT_OWNER(galpanic_state, galpanic) MCFG_DEVICE_ADD("pandora", KANEKO_PANDORA, 0) MCFG_KANEKO_PANDORA_OFFSETS(0, -16) diff --git a/src/mame/drivers/gei.c b/src/mame/drivers/gei.c index 54e886dabef..60d60384c01 100644 --- a/src/mame/drivers/gei.c +++ b/src/mame/drivers/gei.c @@ -730,15 +730,14 @@ static INPUT_PORTS_START( getrivia ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_START("IN1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON5 ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CODE(KEYCODE_Z) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CODE(KEYCODE_X) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CODE(KEYCODE_C) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_CODE(KEYCODE_V) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_CODE(KEYCODE_B) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) - INPUT_PORTS_END static INPUT_PORTS_START( sextriv1 ) @@ -898,57 +897,8 @@ static INPUT_PORTS_START( gt103 ) PORT_INCLUDE(trivia_standard) INPUT_PORTS_END -static INPUT_PORTS_START( gt103a ) - PORT_START("DSWA") - PORT_DIPNAME( 0x03, 0x01, "Questions" ) PORT_DIPLOCATION("SW1:1,22") - PORT_DIPSETTING( 0x00, "4" ) - PORT_DIPSETTING( 0x01, "5" ) -// PORT_DIPSETTING( 0x02, "5" ) - PORT_DIPSETTING( 0x03, "6" ) - PORT_DIPNAME( 0x04, 0x00, "Show Answer" ) PORT_DIPLOCATION("SW1:3") - PORT_DIPSETTING( 0x04, DEF_STR( No ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x08, 0x00, "Max Coins" ) PORT_DIPLOCATION("SW1:4") - PORT_DIPSETTING( 0x08, "30" ) - PORT_DIPSETTING( 0x00, "10" ) - PORT_DIPNAME( 0x10, 0x00, "Timeout" ) PORT_DIPLOCATION("SW1:5") - PORT_DIPSETTING( 0x10, DEF_STR( No ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x20, 0x00, "Tickets" ) PORT_DIPLOCATION("SW1:6") - PORT_DIPSETTING( 0x20, DEF_STR( No ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x40, 0x40, "No Coins" ) PORT_DIPLOCATION("SW1:7") - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:8") - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - - PORT_START("IN0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2) PORT_CONDITION("DSWA", 0x40, EQUALS, 0x40) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_IMPULSE(2) PORT_CONDITION("DSWA", 0x40, EQUALS, 0x00) PORT_NAME ("Start in no coins mode") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(2) PORT_CONDITION("DSWA", 0x40, EQUALS, 0x40) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("DSWA", 0x40, EQUALS, 0x00) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("ticket", ticket_dispenser_device, line_r) /* ticket status */ - PORT_SERVICE( 0x08, IP_ACTIVE_LOW ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) - - PORT_START("IN1") /* IN1 */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON5 ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) -INPUT_PORTS_END - static INPUT_PORTS_START( quiz ) - PORT_INCLUDE( gt103a ) + PORT_INCLUDE( getrivia ) PORT_MODIFY("DSWA") PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) /* no tickets */ @@ -1030,19 +980,9 @@ static INPUT_PORTS_START(geimulti) INPUT_PORTS_END static INPUT_PORTS_START(sprtauth) - PORT_INCLUDE(getrivia) - - PORT_MODIFY("IN0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(2) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("ticket", ticket_dispenser_device, line_r) /* ticket status */ - PORT_SERVICE( 0x08, IP_ACTIVE_LOW ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_INCLUDE(trivia_standard) - PORT_MODIFY("DSWA") + PORT_START("DSWA") PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:1,2,3,4") PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) ) PORT_DIPSETTING( 0x07, DEF_STR( 7C_1C ) ) @@ -1072,7 +1012,6 @@ static INPUT_PORTS_START(sprtauth) PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:8") PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - INPUT_PORTS_END @@ -1648,15 +1587,24 @@ ROM_START( gt507uk ) ROM_LOAD( "pop_music", 0x30000, 0x8000, CRC(884fec7c) SHA1(b389216c17f516df4e15eee46246719dd4acb587) ) ROM_END -ROM_START( gtsers8 ) +ROM_START( gtsers8 ) /* TRIV-3 PCB, stickered 256 TRIV #8 4/85 */ ROM_REGION( 0x38000, "maincpu", 0 ) ROM_LOAD( "prog1_versionc", 0x00000, 0x4000, CRC(340246a4) SHA1(d655e1cf2b1e87a05e87ff6af4b794e6d54a2a52) ) ROM_LOAD( "science", 0x10000, 0x8000, CRC(2f940ebd) SHA1(bead4988ac0a97d70f2a3c0b40a05968436de2ed) ) ROM_LOAD( "general", 0x18000, 0x8000, CRC(1efa01c3) SHA1(801ef5ab55184e488b08ef99ebd641ea4f7edb24) ) ROM_LOAD( "sports", 0x20000, 0x8000, CRC(6bd1ba9a) SHA1(7caac1bd438a9b1d11fb33e11814b5d76951211a) ) - ROM_LOAD( "soccer", 0x28000, 0x8000, CRC(f821f860) SHA1(b0437ef5d31c507c6499c1fb732d2ba3b9beb151) ) - ROM_LOAD( "potpourri", 0x30000, 0x8000, CRC(f2968a28) SHA1(87c08c59dfee71e7bf071f09c3017c750a1c5694) ) - /* Missing Alternate question set: "Adult Sex" */ + ROM_LOAD( "entertainment+", 0x28000, 0x8000, CRC(07068c9f) SHA1(1aedc78d071281ec8b08488cd82655d41a77cf6b) ) /* Labeled as ENTR 2* */ + ROM_LOAD( "adult_sex", 0x30000, 0x8000, CRC(bc8ea9c3) SHA1(6aa4c5468508a50843d3f40b320fc06149fdd292) ) +ROM_END + +ROM_START( gtsers8a ) /* TRIV-3 PCB, stickered 256 TRIV #8 4/85 */ + ROM_REGION( 0x38000, "maincpu", 0 ) + ROM_LOAD( "prog1_versionc", 0x00000, 0x4000, CRC(340246a4) SHA1(d655e1cf2b1e87a05e87ff6af4b794e6d54a2a52) ) + ROM_LOAD( "science", 0x10000, 0x8000, CRC(2f940ebd) SHA1(bead4988ac0a97d70f2a3c0b40a05968436de2ed) ) + ROM_LOAD( "general", 0x18000, 0x8000, CRC(1efa01c3) SHA1(801ef5ab55184e488b08ef99ebd641ea4f7edb24) ) + ROM_LOAD( "sports", 0x20000, 0x8000, CRC(6bd1ba9a) SHA1(7caac1bd438a9b1d11fb33e11814b5d76951211a) ) + ROM_LOAD( "entertainment+", 0x28000, 0x8000, CRC(07068c9f) SHA1(1aedc78d071281ec8b08488cd82655d41a77cf6b) ) /* Labeled as ENTR 2* */ + ROM_LOAD( "potpourri", 0x30000, 0x8000, CRC(f2968a28) SHA1(87c08c59dfee71e7bf071f09c3017c750a1c5694) ) /* Listed as an alternate question set */ ROM_END ROM_START( gtsers9 ) /* TRIV-3 PCB, stickered 256 TRIV #9 7/85 */ @@ -1677,17 +1625,8 @@ ROM_START( gtsers10 ) /* TRIV-3 PCB, stickered 256 TRIV #10 8/85 */ ROM_LOAD( "new_tv_mash", 0x18000, 0x8000, CRC(f73240c6) SHA1(78020644074da719414133a86a91c1328e5d8929) ) ROM_LOAD( "new_entrtnmnt", 0x20000, 0x8000, CRC(0f54340c) SHA1(1ca4c23b542339791a2d8f4a9a857f755feca8a1) ) ROM_LOAD( "new_sports", 0x28000, 0x8000, CRC(19eff1a3) SHA1(8e024ae6cc572176c90d819a438ace7b2512dbf2) ) - ROM_LOAD( "new_science", 0x30000, 0x8000, CRC(2c46e355) SHA1(387ab389abaaea8e870b00039dd884237f7dd9c6) ) -ROM_END - -ROM_START( gtsers10a ) /* TRIV-3 PCB, stickered 256 TRIV #10 8/85 */ - ROM_REGION( 0x38000, "maincpu", 0 ) - ROM_LOAD( "prog1_versionc", 0x00000, 0x4000, CRC(340246a4) SHA1(d655e1cf2b1e87a05e87ff6af4b794e6d54a2a52) ) /* Also found with program v5.03 (not dumped) */ - ROM_LOAD( "new_general", 0x10000, 0x8000, CRC(ba1f5b92) SHA1(7e94be0ef6904331d3a6b266e5887e9a15c5e7f9) ) - ROM_LOAD( "new_tv_mash", 0x18000, 0x8000, CRC(f73240c6) SHA1(78020644074da719414133a86a91c1328e5d8929) ) - ROM_LOAD( "new_entrtnmnt", 0x20000, 0x8000, CRC(0f54340c) SHA1(1ca4c23b542339791a2d8f4a9a857f755feca8a1) ) - ROM_LOAD( "new_sports", 0x28000, 0x8000, CRC(19eff1a3) SHA1(8e024ae6cc572176c90d819a438ace7b2512dbf2) ) ROM_LOAD( "adult_sex_3", 0x30000, 0x8000, CRC(2c46e355) SHA1(387ab389abaaea8e870b00039dd884237f7dd9c6) ) /* Listed as an alternate question set */ + /* Missing "new_science" */ ROM_END ROM_START( gtsers11 ) /* TRIV-3 PCB, stickered 256 TRIV #11 8/85 */ @@ -1712,7 +1651,7 @@ ROM_END ROM_START( gtsers12 ) ROM_REGION( 0x38000, "maincpu", 0 ) - ROM_LOAD( "prog1_versionc", 0x00000, 0x4000, CRC(340246a4) SHA1(d655e1cf2b1e87a05e87ff6af4b794e6d54a2a52) ) + ROM_LOAD( "program_v5.03", 0x00000, 0x4000, CRC(888b7d9b) SHA1(e5ed4f22bff99c26cd6ef9a06cb386221e84bbf5) ) ROM_LOAD( "new_science_2+", 0x10000, 0x8000, CRC(3bd80fb8) SHA1(9a196595bc5dc6ed5ee5853786839ed4847fa436) ) /* Labeled as NEW SCNE 2* */ ROM_LOAD( "adult_sex_4+", 0x18000, 0x8000, CRC(9c32730e) SHA1(9d060e49a4c1dd8d978619b1c357c9e8238e5c96) ) /* Labeled as ADULT SEX 4* */ ROM_LOAD( "cops_&_robbers", 0x20000, 0x8000, CRC(8b367c33) SHA1(013468157bf469c9cf138809fdc45b3ba60a423b) ) @@ -1748,28 +1687,28 @@ ROM_START( gt103a1 ) /* Need to verify which series these belong to */ ROM_LOAD( "history-geog", 0x10000, 0x8000, CRC(c9a70fc3) SHA1(4021e5d702844416e8c798ed0a57c9ecd20b1d4b) ) ROM_LOAD( "n.f.l._football", 0x18000, 0x8000, CRC(d676b7cd) SHA1(d652d2441adb500f7af526d110d0335ea453d75b) ) ROM_LOAD( "rock_music", 0x20000, 0x8000, CRC(7f11733a) SHA1(d4d0dee75518edf986cb1241ade45ccb4840f088) ) - ROM_LOAD( "entertainment", 0x28000, 0x8000, CRC(07068c9f) SHA1(1aedc78d071281ec8b08488cd82655d41a77cf6b) ) + ROM_LOAD( "soccer", 0x28000, 0x8000, CRC(f821f860) SHA1(b0437ef5d31c507c6499c1fb732d2ba3b9beb151) ) ROM_LOAD( "horrors", 0x30000, 0x8000, CRC(5f7b262a) SHA1(047480d6bf5c6d0603d538b84c996bd226f07f77) ) ROM_END ROM_START( gt103aa ) ROM_REGION( 0x38000, "maincpu", 0 ) ROM_LOAD( "t_3a-8_1.bin", 0x00000, 0x4000, CRC(02aef306) SHA1(1ffc10c79a55d41ea36bcaab13cb3f02cb3f9712) ) /* "Park" alternate version sets here */ - ROM_LOAD( "entertainment_alt", 0x10000, 0x8000, CRC(9a6628b9) SHA1(c0cb7e974329d4d5b91f107296d21a674e35a51b) ) + ROM_LOAD( "entertainment_alt", 0x10000, 0x8000, CRC(9a6628b9) SHA1(c0cb7e974329d4d5b91f107296d21a674e35a51b) ) /* From series 8 */ ROM_LOAD( "general_alt", 0x18000, 0x8000, CRC(df34f7f9) SHA1(329d123eea711d5135dc02dd7b89b220ce8ddd28) ) - ROM_LOAD( "science_alt", 0x20000, 0x8000, CRC(9eaebd18) SHA1(3a4d787cb006dbb23ce346577cb1bb5e543ba52c) ) - ROM_LOAD( "science_alt2", 0x28000, 0x8000, CRC(ac93d348) SHA1(55550ba6b5daffdf9653854075ad4f8398a5e621) ) + ROM_LOAD( "science_alt", 0x20000, 0x8000, CRC(9eaebd18) SHA1(3a4d787cb006dbb23ce346577cb1bb5e543ba52c) ) /* From series 8 */ + ROM_LOAD( "science_alt2", 0x28000, 0x8000, CRC(ac93d348) SHA1(55550ba6b5daffdf9653854075ad4f8398a5e621) ) /* From series 8 */ ROM_LOAD( "sports_alt2", 0x30000, 0x8000, CRC(40207845) SHA1(2dddb9685dcefabfde07057a639aa9d08da2329e) ) ROM_END ROM_START( gt103ab ) ROM_REGION( 0x38000, "maincpu", 0 ) - ROM_LOAD( "t_3a-8_1.rom", 0x00000, 0x4000, CRC(02aef306) SHA1(1ffc10c79a55d41ea36bcaab13cb3f02cb3f9712) ) /* "Park" alternate version sets here */ - ROM_LOAD( "new_science_2_alt", 0x10000, 0x8000, CRC(3bd80fb8) SHA1(9a196595bc5dc6ed5ee5853786839ed4847fa436) ) + ROM_LOAD( "t_3a-8_1.bin", 0x00000, 0x4000, CRC(02aef306) SHA1(1ffc10c79a55d41ea36bcaab13cb3f02cb3f9712) ) /* "Park" alternate version sets here */ + ROM_LOAD( "new_science_2_alt", 0x10000, 0x8000, CRC(95836bfb) SHA1(deb546bcd9109efd2b1f405354916e439cd0749b) ) ROM_LOAD( "adult_sex_2_alt", 0x18000, 0x8000, CRC(8c0eacc8) SHA1(ddaa25548d161394b41c65a2db57a9fcf793062b) ) ROM_LOAD( "adult_sex_3_alt", 0x20000, 0x8000, CRC(63cbd1d6) SHA1(8dcd5546dc8688d6b8404d5cf63d8a59acc9bf4c) ) - ROM_LOAD( "adult_sex_4_alt", 0x28000, 0x8000, CRC(36a75071) SHA1(f08d31f241e1dc9b94b940cd2872a692f6f8475b) ) - ROM_LOAD( "rock-n-roll_alt", 0x30000, 0x8000, CRC(8eb83052) SHA1(93e3c1ae6c2048fb44ecafe1013b6a96da38fa84) ) + ROM_LOAD( "rock-n-roll_alt", 0x28000, 0x8000, CRC(8eb83052) SHA1(93e3c1ae6c2048fb44ecafe1013b6a96da38fa84) ) + ROM_LOAD( "cops_&_robbers_alt",0x30000, 0x8000, CRC(5176751a) SHA1(fbf0aeceeedb8a93c12920fecf6268893b393541) ) ROM_END ROM_START( gt103asx ) /* Not sure there was ever an all Adult Trivia version. These are just the collection from all the series combined here */ @@ -1959,19 +1898,19 @@ GAME( 1984, gtsers5, gtsers1, getrivia, getrivia, driver_device, 0, ROT0 GAME( 1984, gtsers7, gtsers1, getrivia, getrivia, driver_device, 0, ROT0, "Greyhound Electronics", "Trivia (Questions Series 7)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) GAME( 1984, gtsersa, gtsers1, getrivia, getrivia, driver_device, 0, ROT0, "Greyhound Electronics", "Trivia (Alt revision questions set 1)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) GAME( 1984, gtsersb, gtsers1, getrivia, getrivia, driver_device, 0, ROT0, "Greyhound Electronics", "Trivia (Alt revision questions set 2)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) -GAME( 1984, gtsers8, 0, findout, gt103a, driver_device, 0, ROT0, "Greyhound Electronics", "Trivia (Questions Series 8)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) -GAME( 1984, gtsers9, gtsers8, findout, gt103a, driver_device, 0, ROT0, "Greyhound Electronics", "Trivia (Questions Series 9)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) -GAME( 1984, gtsers10, gtsers8, findout, gt103a, driver_device, 0, ROT0, "Greyhound Electronics", "Trivia (Questions Series 10)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) -GAME( 1984, gtsers10a,gtsers8, findout, gt103a, driver_device, 0, ROT0, "Greyhound Electronics", "Trivia (Questions Series 10 Alt Question Rom)",MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) -GAME( 1984, gtsers11, gtsers8, findout, gt103a, driver_device, 0, ROT0, "Greyhound Electronics", "Trivia (Questions Series 11)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) -GAME( 1984, gtsers11a,gtsers8, findout, gt103a, driver_device, 0, ROT0, "Greyhound Electronics", "Trivia (Questions Series 11 Alt Question Rom)",MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) -GAME( 1984, gtsers12, gtsers8, findout, gt103a, driver_device, 0, ROT0, "Greyhound Electronics", "Trivia (Questions Series 12)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) -GAME( 1986, gtsers14, gtsers8, findout, gt103, driver_device, 0, ROT0, "Greyhound Electronics", "Trivia (Questions Series 14)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) -GAME( 1986, gtsers15, gtsers8, findout, gt103, driver_device, 0, ROT0, "Greyhound Electronics", "Trivia (Questions Series 15)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) -GAME( 1984, gt103a1, gtsers8, findout, gt103a, driver_device, 0, ROT0, "Greyhound Electronics", "Trivia (Unsorted question roms)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) -GAME( 1984, gt103aa, gtsers8, findout, gt103a, driver_device, 0, ROT0, "Greyhound Electronics", "Trivia (Version 1.03a Alt questions 1)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) -GAME( 1984, gt103ab, gtsers8, findout, gt103a, driver_device, 0, ROT0, "Greyhound Electronics", "Trivia (Version 1.03a Alt questions 2)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) -GAME( 1984, gt103asx, gtsers8, findout, gt103a, driver_device, 0, ROT0, "Greyhound Electronics", "Trivia (Version 1.03a Sex questions)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) +GAME( 1984, gtsers8, 0, findout, getrivia, driver_device, 0, ROT0, "Greyhound Electronics", "Trivia (Questions Series 8)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) +GAME( 1984, gtsers8a, gtsers8, findout, getrivia, driver_device, 0, ROT0, "Greyhound Electronics", "Trivia (Questions Series 8 Alt Question Rom)",MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) +GAME( 1984, gtsers9, gtsers8, findout, getrivia, driver_device, 0, ROT0, "Greyhound Electronics", "Trivia (Questions Series 9)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) +GAME( 1984, gtsers10, gtsers8, findout, getrivia, driver_device, 0, ROT0, "Greyhound Electronics", "Trivia (Questions Series 10)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) +GAME( 1984, gtsers11, gtsers8, findout, getrivia, driver_device, 0, ROT0, "Greyhound Electronics", "Trivia (Questions Series 11)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) +GAME( 1984, gtsers11a,gtsers8, findout, getrivia, driver_device, 0, ROT0, "Greyhound Electronics", "Trivia (Questions Series 11 Alt Question Rom)",MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) +GAME( 1984, gtsers12, gtsers8, findout, gt103, driver_device, 0, ROT0, "Greyhound Electronics", "Trivia (Questions Series 12)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) +GAME( 1986, gtsers14, gtsers8, findout, gt103, driver_device, 0, ROT0, "Greyhound Electronics", "Trivia (Questions Series 14)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) +GAME( 1986, gtsers15, gtsers8, findout, gt103, driver_device, 0, ROT0, "Greyhound Electronics", "Trivia (Questions Series 15)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) +GAME( 1984, gt103a1, gtsers8, findout, getrivia, driver_device, 0, ROT0, "Greyhound Electronics", "Trivia (Unsorted question roms)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) +GAME( 1984, gt103aa, gtsers8, findout, getrivia, driver_device, 0, ROT0, "Greyhound Electronics", "Trivia (Version 1.03a Alt questions 1)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) +GAME( 1984, gt103ab, gtsers8, findout, getrivia, driver_device, 0, ROT0, "Greyhound Electronics", "Trivia (Version 1.03a Alt questions 2)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) +GAME( 1984, gt103asx, gtsers8, findout, getrivia, driver_device, 0, ROT0, "Greyhound Electronics", "Trivia (Version 1.03a Sex questions)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) GAME( 1985, sextriv1, 0, getrivia, sextriv1, driver_device, 0, ROT0, "Kinky Kit and Game Co.", "Sexual Trivia (Version 1.02SB, set 1)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) GAME( 1985, sextriv2, sextriv1, getrivia, sextriv1, driver_device, 0, ROT0, "Kinky Kit and Game Co.", "Sexual Trivia (Version 1.02SB, set 2)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) diff --git a/src/mame/drivers/go2000.c b/src/mame/drivers/go2000.c index 862dcc08aaf..8e87eec9e6c 100644 --- a/src/mame/drivers/go2000.c +++ b/src/mame/drivers/go2000.c @@ -52,7 +52,6 @@ public: /* memory pointers */ required_shared_ptr<UINT16> m_videoram; required_shared_ptr<UINT16> m_videoram2; -// UINT16 * m_paletteram; // currently this uses generic palette handling /* devices */ required_device<cpu_device> m_soundcpu; diff --git a/src/mame/drivers/good.c b/src/mame/drivers/good.c index 0af9943ea47..1169896b980 100644 --- a/src/mame/drivers/good.c +++ b/src/mame/drivers/good.c @@ -51,7 +51,6 @@ public: required_shared_ptr<UINT16> m_fg_tilemapram; required_shared_ptr<UINT16> m_bg_tilemapram; UINT16 * m_sprites; -// UINT16 * m_paletteram; // currently this uses generic palette handling /* video-related */ tilemap_t *m_bg_tilemap; diff --git a/src/mame/drivers/gradius3.c b/src/mame/drivers/gradius3.c index c4b87e6c794..94b4e5f2ed5 100644 --- a/src/mame/drivers/gradius3.c +++ b/src/mame/drivers/gradius3.c @@ -307,6 +307,7 @@ static MACHINE_CONFIG_START( gradius3, gradius3_state ) MCFG_DEVICE_ADD("k051960", K051960, 0) MCFG_GFX_PALETTE("palette") + MCFG_K051960_SCREEN_TAG("screen") MCFG_K051960_CB(gradius3_state, sprite_callback) MCFG_K051960_PLANEORDER(K051960_PLANEORDER_GRADIUS3) @@ -412,50 +413,50 @@ ROM_START( gradius3j ) ROM_END ROM_START( gradius3js ) - ROM_REGION( 0x40000, "maincpu", 0 ) - ROM_LOAD16_BYTE( "945_s13.f15", 0x00000, 0x20000, CRC(70c240a2) SHA1(82dc391572e1f61b0182cb031654d71adcdd5f6e) ) - ROM_LOAD16_BYTE( "945_s12.e15", 0x00001, 0x20000, CRC(bbc300d4) SHA1(e1ca98bc591575285d7bd2d4fefdf35fed10dcb6) ) - - ROM_REGION( 0x100000, "sub", 0 ) - ROM_LOAD16_BYTE( "945_m09.r17", 0x000000, 0x20000, CRC(b4a6df25) SHA1(85533cf140d28f6f81c0b49b8061bda0924a613a) ) - ROM_LOAD16_BYTE( "945_m08.n17", 0x000001, 0x20000, CRC(74e981d2) SHA1(e7b47a2da01ff73293d2100c48fdf00b33125af5) ) - ROM_LOAD16_BYTE( "945_l06b.r11", 0x040000, 0x20000, CRC(83772304) SHA1(a90c75a3de670b6ec5e0fc201876d463b4a76766) ) - ROM_LOAD16_BYTE( "945_l06a.n11", 0x040001, 0x20000, CRC(e1fd75b6) SHA1(6160d80a2f1bf550e85d6253cf521a96f5a644cc) ) - ROM_LOAD16_BYTE( "945_l07c.r15", 0x080000, 0x20000, CRC(c1e399b6) SHA1(e95bd478dd3beea0175bf9ee4cededb111c4ace1) ) - ROM_LOAD16_BYTE( "945_l07a.n15", 0x080001, 0x20000, CRC(96222d04) SHA1(b55700f683a556b0e73dbac9c7b4ce485420d21c) ) - ROM_LOAD16_BYTE( "945_l07d.r13", 0x0c0000, 0x20000, CRC(4c16d4bd) SHA1(01dcf169b78a1e495214b10181401d1920b0c924) ) - ROM_LOAD16_BYTE( "945_l07b.n13", 0x0c0001, 0x20000, CRC(5e209d01) SHA1(0efa1bbfdc7e2ba1e0bb96245e2bfe961258b446) ) - - ROM_REGION( 0x10000, "audiocpu", 0 ) - ROM_LOAD( "945_m05.d9", 0x00000, 0x10000, CRC(c8c45365) SHA1(b9a7b736b52bca42c7b8c8ed64c8df73e0116158) ) - - ROM_REGION( 0x200000, "k051960", 0 ) /* graphics (addressable by the main CPU) */ + ROM_REGION( 0x40000, "maincpu", 0 ) + ROM_LOAD16_BYTE( "945_s13.f15", 0x00000, 0x20000, CRC(70c240a2) SHA1(82dc391572e1f61b0182cb031654d71adcdd5f6e) ) + ROM_LOAD16_BYTE( "945_s12.e15", 0x00001, 0x20000, CRC(bbc300d4) SHA1(e1ca98bc591575285d7bd2d4fefdf35fed10dcb6) ) + + ROM_REGION( 0x100000, "sub", 0 ) + ROM_LOAD16_BYTE( "945_m09.r17", 0x000000, 0x20000, CRC(b4a6df25) SHA1(85533cf140d28f6f81c0b49b8061bda0924a613a) ) + ROM_LOAD16_BYTE( "945_m08.n17", 0x000001, 0x20000, CRC(74e981d2) SHA1(e7b47a2da01ff73293d2100c48fdf00b33125af5) ) + ROM_LOAD16_BYTE( "945_l06b.r11", 0x040000, 0x20000, CRC(83772304) SHA1(a90c75a3de670b6ec5e0fc201876d463b4a76766) ) + ROM_LOAD16_BYTE( "945_l06a.n11", 0x040001, 0x20000, CRC(e1fd75b6) SHA1(6160d80a2f1bf550e85d6253cf521a96f5a644cc) ) + ROM_LOAD16_BYTE( "945_l07c.r15", 0x080000, 0x20000, CRC(c1e399b6) SHA1(e95bd478dd3beea0175bf9ee4cededb111c4ace1) ) + ROM_LOAD16_BYTE( "945_l07a.n15", 0x080001, 0x20000, CRC(96222d04) SHA1(b55700f683a556b0e73dbac9c7b4ce485420d21c) ) + ROM_LOAD16_BYTE( "945_l07d.r13", 0x0c0000, 0x20000, CRC(4c16d4bd) SHA1(01dcf169b78a1e495214b10181401d1920b0c924) ) + ROM_LOAD16_BYTE( "945_l07b.n13", 0x0c0001, 0x20000, CRC(5e209d01) SHA1(0efa1bbfdc7e2ba1e0bb96245e2bfe961258b446) ) + + ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_LOAD( "945_m05.d9", 0x00000, 0x10000, CRC(c8c45365) SHA1(b9a7b736b52bca42c7b8c8ed64c8df73e0116158) ) + + ROM_REGION( 0x200000, "k051960", 0 ) /* graphics (addressable by the main CPU) */ ROM_LOAD32_BYTE( "945_A02A.K2", 0x000000, 0x20000, CRC(fbb81511) SHA1(e7988d52e323e46117f5080c469daf9b119f28a0) ) - ROM_LOAD32_BYTE( "945_A02C.M2", 0x000001, 0x20000, CRC(031b55e8) SHA1(64ed8dee60bf012df7c1ed496af1c75263c052a6) ) - ROM_LOAD32_BYTE( "945_A01A.E2", 0x000002, 0x20000, CRC(bace5abb) SHA1(b32df63294c0730f463335b1b760494389c60062) ) - ROM_LOAD32_BYTE( "945_A01C.H2", 0x000003, 0x20000, CRC(d91b29a6) SHA1(0c3027a08996f4c2b86dd88695241b21c8dffd64) ) - ROM_LOAD32_BYTE( "945_A02B.K4", 0x080000, 0x20000, CRC(c0fed4ab) SHA1(f01975b13759cae7c8dfd24f9b3f4ac960d32957) ) - ROM_LOAD32_BYTE( "945_A02D.M4", 0x080001, 0x20000, CRC(d462817c) SHA1(00137e38454e7c3548a1a9553c5ee644916b3959) ) - ROM_LOAD32_BYTE( "945_A01B.E4", 0x080002, 0x20000, CRC(b426090e) SHA1(06a671a648e3255146fe0c325d5451d4f75f08aa) ) - ROM_LOAD32_BYTE( "945_A01D.H4", 0x080003, 0x20000, CRC(3990c09a) SHA1(1f6a089c1d03fb95d4d96fecc0379bde26ee2b9d) ) - - ROM_LOAD32_BYTE( "945_l04a.k6", 0x100000, 0x20000, CRC(884e21ee) SHA1(ce86dd3a06775e5b1aa09db010dcb674e67828e7) ) - ROM_LOAD32_BYTE( "945_l04c.m6", 0x100001, 0x20000, CRC(45bcd921) SHA1(e51a8a71362a6fb55124aa1dce74519c0a3c6e3f) ) - ROM_LOAD32_BYTE( "945_l03a.e6", 0x100002, 0x20000, CRC(a67ef087) SHA1(fd63474f3bbde5dfc53ed4c1db25d6411a8b54d2) ) - ROM_LOAD32_BYTE( "945_l03c.h6", 0x100003, 0x20000, CRC(a56be17a) SHA1(1d387736144c30fcb5de54235331ab1ff70c356e) ) - ROM_LOAD32_BYTE( "945_l04b.k8", 0x180000, 0x20000, CRC(843bc67d) SHA1(cdf8421083f24ab27867ed5d08d8949da192b2b9) ) - ROM_LOAD32_BYTE( "945_l04d.m8", 0x180001, 0x20000, CRC(0a98d08e) SHA1(1e0ca51a2d45c01fa3f11950ddd387f41ddae691) ) - ROM_LOAD32_BYTE( "945_l03b.e8", 0x180002, 0x20000, CRC(933e68b9) SHA1(f3a39446ca77d17fdbd938bd5f718ae9d5570879) ) - ROM_LOAD32_BYTE( "945_l03d.h8", 0x180003, 0x20000, CRC(f375e87b) SHA1(6427b966795c907c8e516244872fe52217da62c4) ) - - ROM_REGION( 0x0100, "proms", 0 ) - ROM_LOAD( "945l14.j28", 0x0000, 0x0100, CRC(c778c189) SHA1(847eaf379ba075c25911c6f83dd63ff390534f60) ) /* priority encoder (not used) */ - - ROM_REGION( 0x80000, "k007232", 0 ) /* 007232 samples */ + ROM_LOAD32_BYTE( "945_A02C.M2", 0x000001, 0x20000, CRC(031b55e8) SHA1(64ed8dee60bf012df7c1ed496af1c75263c052a6) ) + ROM_LOAD32_BYTE( "945_A01A.E2", 0x000002, 0x20000, CRC(bace5abb) SHA1(b32df63294c0730f463335b1b760494389c60062) ) + ROM_LOAD32_BYTE( "945_A01C.H2", 0x000003, 0x20000, CRC(d91b29a6) SHA1(0c3027a08996f4c2b86dd88695241b21c8dffd64) ) + ROM_LOAD32_BYTE( "945_A02B.K4", 0x080000, 0x20000, CRC(c0fed4ab) SHA1(f01975b13759cae7c8dfd24f9b3f4ac960d32957) ) + ROM_LOAD32_BYTE( "945_A02D.M4", 0x080001, 0x20000, CRC(d462817c) SHA1(00137e38454e7c3548a1a9553c5ee644916b3959) ) + ROM_LOAD32_BYTE( "945_A01B.E4", 0x080002, 0x20000, CRC(b426090e) SHA1(06a671a648e3255146fe0c325d5451d4f75f08aa) ) + ROM_LOAD32_BYTE( "945_A01D.H4", 0x080003, 0x20000, CRC(3990c09a) SHA1(1f6a089c1d03fb95d4d96fecc0379bde26ee2b9d) ) + + ROM_LOAD32_BYTE( "945_l04a.k6", 0x100000, 0x20000, CRC(884e21ee) SHA1(ce86dd3a06775e5b1aa09db010dcb674e67828e7) ) + ROM_LOAD32_BYTE( "945_l04c.m6", 0x100001, 0x20000, CRC(45bcd921) SHA1(e51a8a71362a6fb55124aa1dce74519c0a3c6e3f) ) + ROM_LOAD32_BYTE( "945_l03a.e6", 0x100002, 0x20000, CRC(a67ef087) SHA1(fd63474f3bbde5dfc53ed4c1db25d6411a8b54d2) ) + ROM_LOAD32_BYTE( "945_l03c.h6", 0x100003, 0x20000, CRC(a56be17a) SHA1(1d387736144c30fcb5de54235331ab1ff70c356e) ) + ROM_LOAD32_BYTE( "945_l04b.k8", 0x180000, 0x20000, CRC(843bc67d) SHA1(cdf8421083f24ab27867ed5d08d8949da192b2b9) ) + ROM_LOAD32_BYTE( "945_l04d.m8", 0x180001, 0x20000, CRC(0a98d08e) SHA1(1e0ca51a2d45c01fa3f11950ddd387f41ddae691) ) + ROM_LOAD32_BYTE( "945_l03b.e8", 0x180002, 0x20000, CRC(933e68b9) SHA1(f3a39446ca77d17fdbd938bd5f718ae9d5570879) ) + ROM_LOAD32_BYTE( "945_l03d.h8", 0x180003, 0x20000, CRC(f375e87b) SHA1(6427b966795c907c8e516244872fe52217da62c4) ) + + ROM_REGION( 0x0100, "proms", 0 ) + ROM_LOAD( "945l14.j28", 0x0000, 0x0100, CRC(c778c189) SHA1(847eaf379ba075c25911c6f83dd63ff390534f60) ) /* priority encoder (not used) */ + + ROM_REGION( 0x80000, "k007232", 0 ) /* 007232 samples */ ROM_LOAD( "945_A10A.C14", 0x00000, 0x20000, CRC(ec717414) SHA1(8c63d5fe01d0833529fca91bc80cdbd8a04174c0) ) ROM_LOAD( "945_A10B.C16", 0x20000, 0x20000, CRC(709e30e4) SHA1(27fcea720cd2498f1870c9290d30dcb3dd81d5e5) ) - ROM_LOAD( "945_l11a.c18", 0x40000, 0x20000, CRC(6043f4eb) SHA1(1c2e9ace1cfdde504b7b6158e3c3f54dc5ae33d4) ) - ROM_LOAD( "945_l11b.c20", 0x60000, 0x20000, CRC(89ea3baf) SHA1(8edcbaa7969185cfac48c02559826d1b8b081f3f) ) + ROM_LOAD( "945_l11a.c18", 0x40000, 0x20000, CRC(6043f4eb) SHA1(1c2e9ace1cfdde504b7b6158e3c3f54dc5ae33d4) ) + ROM_LOAD( "945_l11b.c20", 0x60000, 0x20000, CRC(89ea3baf) SHA1(8edcbaa7969185cfac48c02559826d1b8b081f3f) ) ROM_END ROM_START( gradius3a ) diff --git a/src/mame/drivers/gunsmoke.c b/src/mame/drivers/gunsmoke.c index c8750b309ee..6e831a3138d 100644 --- a/src/mame/drivers/gunsmoke.c +++ b/src/mame/drivers/gunsmoke.c @@ -48,13 +48,13 @@ Stephh's notes (based on the games Z80 code and some tests) : You can enter 8 chars for your initials. -3) 'gunsmokeu' +3) 'gunsmokeub' - US version licensed to Romstar. You can enter 3 chars for your initials. -4) 'gunsmokeua' +4) 'gunsmokeu' - US version licensed to Romstar. You can enter 3 chars for your initials. @@ -211,7 +211,7 @@ static INPUT_PORTS_START( gunsmoke ) PORT_DIPSETTING( 0x80, DEF_STR( On ) ) INPUT_PORTS_END -static INPUT_PORTS_START( gunsmokeua ) +static INPUT_PORTS_START( gunsmokeu ) PORT_INCLUDE(gunsmoke) // Same as 'gunsmoke', but "Lives" Dip Switch instead of "Demonstration" Dip Switch @@ -340,242 +340,293 @@ MACHINE_CONFIG_END ROM_START( gunsmoke ) ROM_REGION( 0x20000, "maincpu", 0 ) - ROM_LOAD( "09n_gs03.bin", 0x00000, 0x8000, CRC(40a06cef) SHA1(3e2a52d476298b7252f0adaefdb42090351e921c) ) /* Code 0000-7fff */ - ROM_LOAD( "10n_gs04.bin", 0x10000, 0x8000, CRC(8d4b423f) SHA1(149274c2ed1526ca1f419fdf8a24059ff138f7f2) ) /* Paged code */ - ROM_LOAD( "12n_gs05.bin", 0x18000, 0x8000, CRC(2b5667fb) SHA1(5b689bca1e76d803b4cae22feaa7744fa528e93f) ) /* Paged code */ + ROM_LOAD( "gs03.09n", 0x00000, 0x8000, CRC(40a06cef) SHA1(3e2a52d476298b7252f0adaefdb42090351e921c) ) /* Code 0000-7fff */ // gse_03 ? + ROM_LOAD( "gs04.10n", 0x10000, 0x8000, CRC(8d4b423f) SHA1(149274c2ed1526ca1f419fdf8a24059ff138f7f2) ) /* Paged code */ + ROM_LOAD( "gs05.12n", 0x18000, 0x8000, CRC(2b5667fb) SHA1(5b689bca1e76d803b4cae22feaa7744fa528e93f) ) /* Paged code */ ROM_REGION( 0x10000, "audiocpu", 0 ) - ROM_LOAD( "14h_gs02.bin", 0x00000, 0x8000, CRC(cd7a2c38) SHA1(c76c471f694b76015370f0eacf5350e652f526ff) ) + ROM_LOAD( "gs02.14h", 0x00000, 0x8000, CRC(cd7a2c38) SHA1(c76c471f694b76015370f0eacf5350e652f526ff) ) ROM_REGION( 0x04000, "gfx1", 0 ) - ROM_LOAD( "11f_gs01.bin", 0x00000, 0x4000, CRC(b61ece9b) SHA1(eb3fc62644cc5b5a2b9cbe67c393d4a0e2a59ca9) ) /* Characters */ + ROM_LOAD( "gs01.11f", 0x00000, 0x4000, CRC(b61ece9b) SHA1(eb3fc62644cc5b5a2b9cbe67c393d4a0e2a59ca9) ) /* Characters */ ROM_REGION( 0x40000, "gfx2", 0 ) - ROM_LOAD( "06c_gs13.bin", 0x00000, 0x8000, CRC(f6769fc5) SHA1(d192ec176425327ca4b7e25fc8432fc47837ba29) ) /* 32x32 tiles planes 2-3 */ - ROM_LOAD( "05c_gs12.bin", 0x08000, 0x8000, CRC(d997b78c) SHA1(3b4a9b6f9e57ecfb4ab9734379bd0ee765fd6daa) ) - ROM_LOAD( "04c_gs11.bin", 0x10000, 0x8000, CRC(125ba58e) SHA1(cf6931653cebd051564bed8121ab8713a55095c5) ) - ROM_LOAD( "02c_gs10.bin", 0x18000, 0x8000, CRC(f469c13c) SHA1(54eda52d6fce58771c0adfe2c88292a41d5a9b99) ) - ROM_LOAD( "06a_gs09.bin", 0x20000, 0x8000, CRC(539f182d) SHA1(4190c0adbecc57b92f4d002e121acb77e8c5d8d8) ) /* 32x32 tiles planes 0-1 */ - ROM_LOAD( "05a_gs08.bin", 0x28000, 0x8000, CRC(e87e526d) SHA1(d10068addf30322424a85bbc6382cb762ae3fbe2) ) - ROM_LOAD( "04a_gs07.bin", 0x30000, 0x8000, CRC(4382c0d2) SHA1(8615e62bc57b40d082f6ca211d64f22185bed1fd) ) - ROM_LOAD( "02a_gs06.bin", 0x38000, 0x8000, CRC(4cafe7a6) SHA1(fe501f3a5e9ce9e82e9708f1cd297f4c94ef0f81) ) + ROM_LOAD( "gs13.06c", 0x00000, 0x8000, CRC(f6769fc5) SHA1(d192ec176425327ca4b7e25fc8432fc47837ba29) ) /* 32x32 tiles planes 2-3 */ + ROM_LOAD( "gs12.05c", 0x08000, 0x8000, CRC(d997b78c) SHA1(3b4a9b6f9e57ecfb4ab9734379bd0ee765fd6daa) ) + ROM_LOAD( "gs11.04c", 0x10000, 0x8000, CRC(125ba58e) SHA1(cf6931653cebd051564bed8121ab8713a55095c5) ) + ROM_LOAD( "gs10.02c", 0x18000, 0x8000, CRC(f469c13c) SHA1(54eda52d6fce58771c0adfe2c88292a41d5a9b99) ) + ROM_LOAD( "gs09.06a", 0x20000, 0x8000, CRC(539f182d) SHA1(4190c0adbecc57b92f4d002e121acb77e8c5d8d8) ) /* 32x32 tiles planes 0-1 */ + ROM_LOAD( "gs08.05a", 0x28000, 0x8000, CRC(e87e526d) SHA1(d10068addf30322424a85bbc6382cb762ae3fbe2) ) + ROM_LOAD( "gs07.04a", 0x30000, 0x8000, CRC(4382c0d2) SHA1(8615e62bc57b40d082f6ca211d64f22185bed1fd) ) + ROM_LOAD( "gs06.02a", 0x38000, 0x8000, CRC(4cafe7a6) SHA1(fe501f3a5e9ce9e82e9708f1cd297f4c94ef0f81) ) ROM_REGION( 0x40000, "gfx3", 0 ) - ROM_LOAD( "06n_gs22.bin", 0x00000, 0x8000, CRC(dc9c508c) SHA1(920505dd4c63b177918feb4e54cca8a7948ec9d9) ) /* Sprites planes 2-3 */ - ROM_LOAD( "04n_gs21.bin", 0x08000, 0x8000, CRC(68883749) SHA1(c7bf2bf49c53feddf8f30b4001dc2d59b52b1c28) ) /* Sprites planes 2-3 */ - ROM_LOAD( "03n_gs20.bin", 0x10000, 0x8000, CRC(0be932ed) SHA1(1c5af5884a23112dbc36579515d1cb497992da2f) ) /* Sprites planes 2-3 */ - ROM_LOAD( "01n_gs19.bin", 0x18000, 0x8000, CRC(63072f93) SHA1(cb3a2729782cf2855558d081fe92d28366228b8e) ) /* Sprites planes 2-3 */ - ROM_LOAD( "06l_gs18.bin", 0x20000, 0x8000, CRC(f69a3c7c) SHA1(e9eb9dfa7d53aa7b728150f91d05bfc3bf6f1e75) ) /* Sprites planes 0-1 */ - ROM_LOAD( "04l_gs17.bin", 0x28000, 0x8000, CRC(4e98562a) SHA1(0341b8a79be1d71a57d0d76ed890e15f9f92259e) ) /* Sprites planes 0-1 */ - ROM_LOAD( "03l_gs16.bin", 0x30000, 0x8000, CRC(0d99c3b3) SHA1(436c566b76f632242448671e3b6319f7d9f65322) ) /* Sprites planes 0-1 */ - ROM_LOAD( "01l_gs15.bin", 0x38000, 0x8000, CRC(7f14270e) SHA1(dd06c333c2ea097e25185a1423cd61e1b7afc42b) ) /* Sprites planes 0-1 */ + ROM_LOAD( "gs22.06n", 0x00000, 0x8000, CRC(dc9c508c) SHA1(920505dd4c63b177918feb4e54cca8a7948ec9d9) ) /* Sprites planes 2-3 */ + ROM_LOAD( "gs21.04n", 0x08000, 0x8000, CRC(68883749) SHA1(c7bf2bf49c53feddf8f30b4001dc2d59b52b1c28) ) /* Sprites planes 2-3 */ + ROM_LOAD( "gs20.03n", 0x10000, 0x8000, CRC(0be932ed) SHA1(1c5af5884a23112dbc36579515d1cb497992da2f) ) /* Sprites planes 2-3 */ + ROM_LOAD( "gs19.01n", 0x18000, 0x8000, CRC(63072f93) SHA1(cb3a2729782cf2855558d081fe92d28366228b8e) ) /* Sprites planes 2-3 */ + ROM_LOAD( "gs18.06l", 0x20000, 0x8000, CRC(f69a3c7c) SHA1(e9eb9dfa7d53aa7b728150f91d05bfc3bf6f1e75) ) /* Sprites planes 0-1 */ + ROM_LOAD( "gs17.04l", 0x28000, 0x8000, CRC(4e98562a) SHA1(0341b8a79be1d71a57d0d76ed890e15f9f92259e) ) /* Sprites planes 0-1 */ + ROM_LOAD( "gs16.03l", 0x30000, 0x8000, CRC(0d99c3b3) SHA1(436c566b76f632242448671e3b6319f7d9f65322) ) /* Sprites planes 0-1 */ + ROM_LOAD( "gs15.01l", 0x38000, 0x8000, CRC(7f14270e) SHA1(dd06c333c2ea097e25185a1423cd61e1b7afc42b) ) /* Sprites planes 0-1 */ ROM_REGION( 0x8000, "gfx4", 0 ) /* background tilemaps */ - ROM_LOAD( "11c_gs14.bin", 0x00000, 0x8000, CRC(0af4f7eb) SHA1(24a98fdeedeeaf1035b4af52d5a8dd5e47a5e62d) ) + ROM_LOAD( "gs14.11c", 0x00000, 0x8000, CRC(0af4f7eb) SHA1(24a98fdeedeeaf1035b4af52d5a8dd5e47a5e62d) ) ROM_REGION( 0x0a00, "proms", 0 ) - ROM_LOAD( "03b_g-01.bin", 0x0000, 0x0100, CRC(02f55589) SHA1(8a3f98304aedf3aba1c08b615bf457752a480edc) ) /* red component */ - ROM_LOAD( "04b_g-02.bin", 0x0100, 0x0100, CRC(e1e36dd9) SHA1(5bd88a35898a2d973045bdde8311aac3a12826de) ) /* green component */ - ROM_LOAD( "05b_g-03.bin", 0x0200, 0x0100, CRC(989399c0) SHA1(e408e391f49ed0c7b9e16479fea44b809440fefc) ) /* blue component */ - ROM_LOAD( "09d_g-04.bin", 0x0300, 0x0100, CRC(906612b5) SHA1(7b727a6200c088538180758320ede84aa7e5b96d) ) /* char lookup table */ - ROM_LOAD( "14a_g-06.bin", 0x0400, 0x0100, CRC(4a9da18b) SHA1(fed3b81b56aab2ed0a21ed1fcebe3f1ae095a13b) ) /* tile lookup table */ - ROM_LOAD( "15a_g-07.bin", 0x0500, 0x0100, CRC(cb9394fc) SHA1(8ad0fde6a8ef8326d2da4b6dbf3b51f5f6c668c8) ) /* tile palette bank */ - ROM_LOAD( "09f_g-09.bin", 0x0600, 0x0100, CRC(3cee181e) SHA1(3f95bdb12391cb9b3673191bda8d09c84b36b4d3) ) /* sprite lookup table */ - ROM_LOAD( "08f_g-08.bin", 0x0700, 0x0100, CRC(ef91cdd2) SHA1(90b9191c9f10a153d64055a4238eb6e15b8c12bc) ) /* sprite palette bank */ - ROM_LOAD( "02j_g-10.bin", 0x0800, 0x0100, CRC(0eaf5158) SHA1(bafd4108708f66cd7b280e47152b108f3e254fc9) ) /* video timing (not used) */ - ROM_LOAD( "01f_g-05.bin", 0x0900, 0x0100, CRC(25c90c2a) SHA1(42893572bab757ec01e181fc418cb911638d37e0) ) /* priority? (not used) */ + ROM_LOAD( "g-01.03b", 0x0000, 0x0100, CRC(02f55589) SHA1(8a3f98304aedf3aba1c08b615bf457752a480edc) ) /* red component */ + ROM_LOAD( "g-02.04b", 0x0100, 0x0100, CRC(e1e36dd9) SHA1(5bd88a35898a2d973045bdde8311aac3a12826de) ) /* green component */ + ROM_LOAD( "g-03.05b", 0x0200, 0x0100, CRC(989399c0) SHA1(e408e391f49ed0c7b9e16479fea44b809440fefc) ) /* blue component */ + ROM_LOAD( "g-04.09d", 0x0300, 0x0100, CRC(906612b5) SHA1(7b727a6200c088538180758320ede84aa7e5b96d) ) /* char lookup table */ + ROM_LOAD( "g-06.14a", 0x0400, 0x0100, CRC(4a9da18b) SHA1(fed3b81b56aab2ed0a21ed1fcebe3f1ae095a13b) ) /* tile lookup table */ + ROM_LOAD( "g-07.15a", 0x0500, 0x0100, CRC(cb9394fc) SHA1(8ad0fde6a8ef8326d2da4b6dbf3b51f5f6c668c8) ) /* tile palette bank */ + ROM_LOAD( "g-09.09f", 0x0600, 0x0100, CRC(3cee181e) SHA1(3f95bdb12391cb9b3673191bda8d09c84b36b4d3) ) /* sprite lookup table */ + ROM_LOAD( "g-08.08f", 0x0700, 0x0100, CRC(ef91cdd2) SHA1(90b9191c9f10a153d64055a4238eb6e15b8c12bc) ) /* sprite palette bank */ + ROM_LOAD( "g-10.02j", 0x0800, 0x0100, CRC(0eaf5158) SHA1(bafd4108708f66cd7b280e47152b108f3e254fc9) ) /* video timing (not used) */ + ROM_LOAD( "g-05.01f", 0x0900, 0x0100, CRC(25c90c2a) SHA1(42893572bab757ec01e181fc418cb911638d37e0) ) /* priority? (not used) */ ROM_END ROM_START( gunsmokeb ) ROM_REGION( 0x20000, "maincpu", 0 ) ROM_LOAD( "3.ic85", 0x00000, 0x8000, CRC(ae6f4b75) SHA1(f4ee4f7a7d507ceaef9ce8165704fd80c8c1e8ba) ) /* Code 0000-7fff */ - ROM_LOAD( "10n_gs04.bin", 0x10000, 0x8000, CRC(8d4b423f) SHA1(149274c2ed1526ca1f419fdf8a24059ff138f7f2) ) /* Paged code */ - ROM_LOAD( "12n_gs05.bin", 0x18000, 0x8000, CRC(2b5667fb) SHA1(5b689bca1e76d803b4cae22feaa7744fa528e93f) ) /* Paged code */ + ROM_LOAD( "gs04.10n", 0x10000, 0x8000, CRC(8d4b423f) SHA1(149274c2ed1526ca1f419fdf8a24059ff138f7f2) ) /* Paged code */ + ROM_LOAD( "gs05.12n", 0x18000, 0x8000, CRC(2b5667fb) SHA1(5b689bca1e76d803b4cae22feaa7744fa528e93f) ) /* Paged code */ ROM_REGION( 0x10000, "audiocpu", 0 ) - ROM_LOAD( "14h_gs02.bin", 0x00000, 0x8000, CRC(cd7a2c38) SHA1(c76c471f694b76015370f0eacf5350e652f526ff) ) + ROM_LOAD( "gs02.14h", 0x00000, 0x8000, CRC(cd7a2c38) SHA1(c76c471f694b76015370f0eacf5350e652f526ff) ) ROM_REGION( 0x04000, "gfx1", 0 ) - ROM_LOAD( "11f_gs01.bin", 0x00000, 0x4000, CRC(b61ece9b) SHA1(eb3fc62644cc5b5a2b9cbe67c393d4a0e2a59ca9) ) /* Characters */ + ROM_LOAD( "gs01.11f", 0x00000, 0x4000, CRC(b61ece9b) SHA1(eb3fc62644cc5b5a2b9cbe67c393d4a0e2a59ca9) ) /* Characters */ ROM_REGION( 0x40000, "gfx2", 0 ) - ROM_LOAD( "06c_gs13.bin", 0x00000, 0x8000, CRC(f6769fc5) SHA1(d192ec176425327ca4b7e25fc8432fc47837ba29) ) /* 32x32 tiles planes 2-3 */ - ROM_LOAD( "05c_gs12.bin", 0x08000, 0x8000, CRC(d997b78c) SHA1(3b4a9b6f9e57ecfb4ab9734379bd0ee765fd6daa) ) - ROM_LOAD( "04c_gs11.bin", 0x10000, 0x8000, CRC(125ba58e) SHA1(cf6931653cebd051564bed8121ab8713a55095c5) ) - ROM_LOAD( "02c_gs10.bin", 0x18000, 0x8000, CRC(f469c13c) SHA1(54eda52d6fce58771c0adfe2c88292a41d5a9b99) ) - ROM_LOAD( "06a_gs09.bin", 0x20000, 0x8000, CRC(539f182d) SHA1(4190c0adbecc57b92f4d002e121acb77e8c5d8d8) ) /* 32x32 tiles planes 0-1 */ - ROM_LOAD( "05a_gs08.bin", 0x28000, 0x8000, CRC(e87e526d) SHA1(d10068addf30322424a85bbc6382cb762ae3fbe2) ) - ROM_LOAD( "04a_gs07.bin", 0x30000, 0x8000, CRC(4382c0d2) SHA1(8615e62bc57b40d082f6ca211d64f22185bed1fd) ) - ROM_LOAD( "02a_gs06.bin", 0x38000, 0x8000, CRC(4cafe7a6) SHA1(fe501f3a5e9ce9e82e9708f1cd297f4c94ef0f81) ) + ROM_LOAD( "gs13.06c", 0x00000, 0x8000, CRC(f6769fc5) SHA1(d192ec176425327ca4b7e25fc8432fc47837ba29) ) /* 32x32 tiles planes 2-3 */ + ROM_LOAD( "gs12.05c", 0x08000, 0x8000, CRC(d997b78c) SHA1(3b4a9b6f9e57ecfb4ab9734379bd0ee765fd6daa) ) + ROM_LOAD( "gs11.04c", 0x10000, 0x8000, CRC(125ba58e) SHA1(cf6931653cebd051564bed8121ab8713a55095c5) ) + ROM_LOAD( "gs10.02c", 0x18000, 0x8000, CRC(f469c13c) SHA1(54eda52d6fce58771c0adfe2c88292a41d5a9b99) ) + ROM_LOAD( "gs09.06a", 0x20000, 0x8000, CRC(539f182d) SHA1(4190c0adbecc57b92f4d002e121acb77e8c5d8d8) ) /* 32x32 tiles planes 0-1 */ + ROM_LOAD( "gs08.05a", 0x28000, 0x8000, CRC(e87e526d) SHA1(d10068addf30322424a85bbc6382cb762ae3fbe2) ) + ROM_LOAD( "gs07.04a", 0x30000, 0x8000, CRC(4382c0d2) SHA1(8615e62bc57b40d082f6ca211d64f22185bed1fd) ) + ROM_LOAD( "gs06.02a", 0x38000, 0x8000, CRC(4cafe7a6) SHA1(fe501f3a5e9ce9e82e9708f1cd297f4c94ef0f81) ) ROM_REGION( 0x40000, "gfx3", 0 ) - ROM_LOAD( "06n_gs22.bin", 0x00000, 0x8000, CRC(dc9c508c) SHA1(920505dd4c63b177918feb4e54cca8a7948ec9d9) ) /* Sprites planes 2-3 */ - ROM_LOAD( "04n_gs21.bin", 0x08000, 0x8000, CRC(68883749) SHA1(c7bf2bf49c53feddf8f30b4001dc2d59b52b1c28) ) /* Sprites planes 2-3 */ - ROM_LOAD( "03n_gs20.bin", 0x10000, 0x8000, CRC(0be932ed) SHA1(1c5af5884a23112dbc36579515d1cb497992da2f) ) /* Sprites planes 2-3 */ - ROM_LOAD( "01n_gs19.bin", 0x18000, 0x8000, CRC(63072f93) SHA1(cb3a2729782cf2855558d081fe92d28366228b8e) ) /* Sprites planes 2-3 */ - ROM_LOAD( "06l_gs18.bin", 0x20000, 0x8000, CRC(f69a3c7c) SHA1(e9eb9dfa7d53aa7b728150f91d05bfc3bf6f1e75) ) /* Sprites planes 0-1 */ - ROM_LOAD( "04l_gs17.bin", 0x28000, 0x8000, CRC(4e98562a) SHA1(0341b8a79be1d71a57d0d76ed890e15f9f92259e) ) /* Sprites planes 0-1 */ - ROM_LOAD( "03l_gs16.bin", 0x30000, 0x8000, CRC(0d99c3b3) SHA1(436c566b76f632242448671e3b6319f7d9f65322) ) /* Sprites planes 0-1 */ - ROM_LOAD( "01l_gs15.bin", 0x38000, 0x8000, CRC(7f14270e) SHA1(dd06c333c2ea097e25185a1423cd61e1b7afc42b) ) /* Sprites planes 0-1 */ + ROM_LOAD( "gs22.06n", 0x00000, 0x8000, CRC(dc9c508c) SHA1(920505dd4c63b177918feb4e54cca8a7948ec9d9) ) /* Sprites planes 2-3 */ + ROM_LOAD( "gs21.04n", 0x08000, 0x8000, CRC(68883749) SHA1(c7bf2bf49c53feddf8f30b4001dc2d59b52b1c28) ) /* Sprites planes 2-3 */ + ROM_LOAD( "gs20.03n", 0x10000, 0x8000, CRC(0be932ed) SHA1(1c5af5884a23112dbc36579515d1cb497992da2f) ) /* Sprites planes 2-3 */ + ROM_LOAD( "gs19.01n", 0x18000, 0x8000, CRC(63072f93) SHA1(cb3a2729782cf2855558d081fe92d28366228b8e) ) /* Sprites planes 2-3 */ + ROM_LOAD( "gs18.06l", 0x20000, 0x8000, CRC(f69a3c7c) SHA1(e9eb9dfa7d53aa7b728150f91d05bfc3bf6f1e75) ) /* Sprites planes 0-1 */ + ROM_LOAD( "gs17.04l", 0x28000, 0x8000, CRC(4e98562a) SHA1(0341b8a79be1d71a57d0d76ed890e15f9f92259e) ) /* Sprites planes 0-1 */ + ROM_LOAD( "gs16.03l", 0x30000, 0x8000, CRC(0d99c3b3) SHA1(436c566b76f632242448671e3b6319f7d9f65322) ) /* Sprites planes 0-1 */ + ROM_LOAD( "gs15.01l", 0x38000, 0x8000, CRC(7f14270e) SHA1(dd06c333c2ea097e25185a1423cd61e1b7afc42b) ) /* Sprites planes 0-1 */ ROM_REGION( 0x8000, "gfx4", 0 ) /* background tilemaps */ - ROM_LOAD( "11c_gs14.bin", 0x00000, 0x8000, CRC(0af4f7eb) SHA1(24a98fdeedeeaf1035b4af52d5a8dd5e47a5e62d) ) + ROM_LOAD( "gs14.11c", 0x00000, 0x8000, CRC(0af4f7eb) SHA1(24a98fdeedeeaf1035b4af52d5a8dd5e47a5e62d) ) ROM_REGION( 0x0a00, "proms", 0 ) - ROM_LOAD( "03b_g-01.bin", 0x0000, 0x0100, CRC(02f55589) SHA1(8a3f98304aedf3aba1c08b615bf457752a480edc) ) /* red component */ - ROM_LOAD( "04b_g-02.bin", 0x0100, 0x0100, CRC(e1e36dd9) SHA1(5bd88a35898a2d973045bdde8311aac3a12826de) ) /* green component */ - ROM_LOAD( "05b_g-03.bin", 0x0200, 0x0100, CRC(989399c0) SHA1(e408e391f49ed0c7b9e16479fea44b809440fefc) ) /* blue component */ - ROM_LOAD( "09d_g-04.bin", 0x0300, 0x0100, CRC(906612b5) SHA1(7b727a6200c088538180758320ede84aa7e5b96d) ) /* char lookup table */ - ROM_LOAD( "14a_g-06.bin", 0x0400, 0x0100, CRC(4a9da18b) SHA1(fed3b81b56aab2ed0a21ed1fcebe3f1ae095a13b) ) /* tile lookup table */ - ROM_LOAD( "15a_g-07.bin", 0x0500, 0x0100, CRC(cb9394fc) SHA1(8ad0fde6a8ef8326d2da4b6dbf3b51f5f6c668c8) ) /* tile palette bank */ - ROM_LOAD( "09f_g-09.bin", 0x0600, 0x0100, CRC(3cee181e) SHA1(3f95bdb12391cb9b3673191bda8d09c84b36b4d3) ) /* sprite lookup table */ - ROM_LOAD( "08f_g-08.bin", 0x0700, 0x0100, CRC(ef91cdd2) SHA1(90b9191c9f10a153d64055a4238eb6e15b8c12bc) ) /* sprite palette bank */ - ROM_LOAD( "02j_g-10.bin", 0x0800, 0x0100, CRC(0eaf5158) SHA1(bafd4108708f66cd7b280e47152b108f3e254fc9) ) /* video timing (not used) */ - ROM_LOAD( "01f_g-05.bin", 0x0900, 0x0100, CRC(25c90c2a) SHA1(42893572bab757ec01e181fc418cb911638d37e0) ) /* priority? (not used) */ + ROM_LOAD( "g-01.03b", 0x0000, 0x0100, CRC(02f55589) SHA1(8a3f98304aedf3aba1c08b615bf457752a480edc) ) /* red component */ + ROM_LOAD( "g-02.04b", 0x0100, 0x0100, CRC(e1e36dd9) SHA1(5bd88a35898a2d973045bdde8311aac3a12826de) ) /* green component */ + ROM_LOAD( "g-03.05b", 0x0200, 0x0100, CRC(989399c0) SHA1(e408e391f49ed0c7b9e16479fea44b809440fefc) ) /* blue component */ + ROM_LOAD( "g-04.09d", 0x0300, 0x0100, CRC(906612b5) SHA1(7b727a6200c088538180758320ede84aa7e5b96d) ) /* char lookup table */ + ROM_LOAD( "g-06.14a", 0x0400, 0x0100, CRC(4a9da18b) SHA1(fed3b81b56aab2ed0a21ed1fcebe3f1ae095a13b) ) /* tile lookup table */ + ROM_LOAD( "g-07.15a", 0x0500, 0x0100, CRC(cb9394fc) SHA1(8ad0fde6a8ef8326d2da4b6dbf3b51f5f6c668c8) ) /* tile palette bank */ + ROM_LOAD( "g-09.09f", 0x0600, 0x0100, CRC(3cee181e) SHA1(3f95bdb12391cb9b3673191bda8d09c84b36b4d3) ) /* sprite lookup table */ + ROM_LOAD( "g-08.08f", 0x0700, 0x0100, CRC(ef91cdd2) SHA1(90b9191c9f10a153d64055a4238eb6e15b8c12bc) ) /* sprite palette bank */ + ROM_LOAD( "g-10.02j", 0x0800, 0x0100, CRC(0eaf5158) SHA1(bafd4108708f66cd7b280e47152b108f3e254fc9) ) /* video timing (not used) */ + ROM_LOAD( "g-05.01f", 0x0900, 0x0100, CRC(25c90c2a) SHA1(42893572bab757ec01e181fc418cb911638d37e0) ) /* priority? (not used) */ ROM_END ROM_START( gunsmokej ) ROM_REGION( 0x20000, "maincpu", 0 ) - ROM_LOAD( "gs03_9n.rom", 0x00000, 0x8000, CRC(b56b5df6) SHA1(0295a3ef491b6b8ee9c198fd08dddc29d88bbef6) ) /* Code 0000-7fff */ - ROM_LOAD( "10n_gs04.bin", 0x10000, 0x8000, CRC(8d4b423f) SHA1(149274c2ed1526ca1f419fdf8a24059ff138f7f2) ) /* Paged code */ - ROM_LOAD( "12n_gs05.bin", 0x18000, 0x8000, CRC(2b5667fb) SHA1(5b689bca1e76d803b4cae22feaa7744fa528e93f) ) /* Paged code */ + ROM_LOAD( "gsj_03.09n", 0x00000, 0x8000, CRC(b56b5df6) SHA1(0295a3ef491b6b8ee9c198fd08dddc29d88bbef6) ) /* Code 0000-7fff */ + ROM_LOAD( "gs04.10n", 0x10000, 0x8000, CRC(8d4b423f) SHA1(149274c2ed1526ca1f419fdf8a24059ff138f7f2) ) /* Paged code */ + ROM_LOAD( "gs05.12n", 0x18000, 0x8000, CRC(2b5667fb) SHA1(5b689bca1e76d803b4cae22feaa7744fa528e93f) ) /* Paged code */ ROM_REGION( 0x10000, "audiocpu", 0 ) - ROM_LOAD( "14h_gs02.bin", 0x00000, 0x8000, CRC(cd7a2c38) SHA1(c76c471f694b76015370f0eacf5350e652f526ff) ) + ROM_LOAD( "gs02.14h", 0x00000, 0x8000, CRC(cd7a2c38) SHA1(c76c471f694b76015370f0eacf5350e652f526ff) ) ROM_REGION( 0x04000, "gfx1", 0 ) - ROM_LOAD( "11f_gs01.bin", 0x00000, 0x4000, CRC(b61ece9b) SHA1(eb3fc62644cc5b5a2b9cbe67c393d4a0e2a59ca9) ) /* Characters */ + ROM_LOAD( "gs01.11f", 0x00000, 0x4000, CRC(b61ece9b) SHA1(eb3fc62644cc5b5a2b9cbe67c393d4a0e2a59ca9) ) /* Characters */ ROM_REGION( 0x40000, "gfx2", 0 ) - ROM_LOAD( "06c_gs13.bin", 0x00000, 0x8000, CRC(f6769fc5) SHA1(d192ec176425327ca4b7e25fc8432fc47837ba29) ) /* 32x32 tiles planes 2-3 */ - ROM_LOAD( "05c_gs12.bin", 0x08000, 0x8000, CRC(d997b78c) SHA1(3b4a9b6f9e57ecfb4ab9734379bd0ee765fd6daa) ) - ROM_LOAD( "04c_gs11.bin", 0x10000, 0x8000, CRC(125ba58e) SHA1(cf6931653cebd051564bed8121ab8713a55095c5) ) - ROM_LOAD( "02c_gs10.bin", 0x18000, 0x8000, CRC(f469c13c) SHA1(54eda52d6fce58771c0adfe2c88292a41d5a9b99) ) - ROM_LOAD( "06a_gs09.bin", 0x20000, 0x8000, CRC(539f182d) SHA1(4190c0adbecc57b92f4d002e121acb77e8c5d8d8) ) /* 32x32 tiles planes 0-1 */ - ROM_LOAD( "05a_gs08.bin", 0x28000, 0x8000, CRC(e87e526d) SHA1(d10068addf30322424a85bbc6382cb762ae3fbe2) ) - ROM_LOAD( "04a_gs07.bin", 0x30000, 0x8000, CRC(4382c0d2) SHA1(8615e62bc57b40d082f6ca211d64f22185bed1fd) ) - ROM_LOAD( "02a_gs06.bin", 0x38000, 0x8000, CRC(4cafe7a6) SHA1(fe501f3a5e9ce9e82e9708f1cd297f4c94ef0f81) ) + ROM_LOAD( "gs13.06c", 0x00000, 0x8000, CRC(f6769fc5) SHA1(d192ec176425327ca4b7e25fc8432fc47837ba29) ) /* 32x32 tiles planes 2-3 */ + ROM_LOAD( "gs12.05c", 0x08000, 0x8000, CRC(d997b78c) SHA1(3b4a9b6f9e57ecfb4ab9734379bd0ee765fd6daa) ) + ROM_LOAD( "gs11.04c", 0x10000, 0x8000, CRC(125ba58e) SHA1(cf6931653cebd051564bed8121ab8713a55095c5) ) + ROM_LOAD( "gs10.02c", 0x18000, 0x8000, CRC(f469c13c) SHA1(54eda52d6fce58771c0adfe2c88292a41d5a9b99) ) + ROM_LOAD( "gs09.06a", 0x20000, 0x8000, CRC(539f182d) SHA1(4190c0adbecc57b92f4d002e121acb77e8c5d8d8) ) /* 32x32 tiles planes 0-1 */ + ROM_LOAD( "gs08.05a", 0x28000, 0x8000, CRC(e87e526d) SHA1(d10068addf30322424a85bbc6382cb762ae3fbe2) ) + ROM_LOAD( "gs07.04a", 0x30000, 0x8000, CRC(4382c0d2) SHA1(8615e62bc57b40d082f6ca211d64f22185bed1fd) ) + ROM_LOAD( "gs06.02a", 0x38000, 0x8000, CRC(4cafe7a6) SHA1(fe501f3a5e9ce9e82e9708f1cd297f4c94ef0f81) ) ROM_REGION( 0x40000, "gfx3", 0 ) - ROM_LOAD( "06n_gs22.bin", 0x00000, 0x8000, CRC(dc9c508c) SHA1(920505dd4c63b177918feb4e54cca8a7948ec9d9) ) /* Sprites planes 2-3 */ - ROM_LOAD( "04n_gs21.bin", 0x08000, 0x8000, CRC(68883749) SHA1(c7bf2bf49c53feddf8f30b4001dc2d59b52b1c28) ) /* Sprites planes 2-3 */ - ROM_LOAD( "03n_gs20.bin", 0x10000, 0x8000, CRC(0be932ed) SHA1(1c5af5884a23112dbc36579515d1cb497992da2f) ) /* Sprites planes 2-3 */ - ROM_LOAD( "01n_gs19.bin", 0x18000, 0x8000, CRC(63072f93) SHA1(cb3a2729782cf2855558d081fe92d28366228b8e) ) /* Sprites planes 2-3 */ - ROM_LOAD( "06l_gs18.bin", 0x20000, 0x8000, CRC(f69a3c7c) SHA1(e9eb9dfa7d53aa7b728150f91d05bfc3bf6f1e75) ) /* Sprites planes 0-1 */ - ROM_LOAD( "04l_gs17.bin", 0x28000, 0x8000, CRC(4e98562a) SHA1(0341b8a79be1d71a57d0d76ed890e15f9f92259e) ) /* Sprites planes 0-1 */ - ROM_LOAD( "03l_gs16.bin", 0x30000, 0x8000, CRC(0d99c3b3) SHA1(436c566b76f632242448671e3b6319f7d9f65322) ) /* Sprites planes 0-1 */ - ROM_LOAD( "01l_gs15.bin", 0x38000, 0x8000, CRC(7f14270e) SHA1(dd06c333c2ea097e25185a1423cd61e1b7afc42b) ) /* Sprites planes 0-1 */ + ROM_LOAD( "gs22.06n", 0x00000, 0x8000, CRC(dc9c508c) SHA1(920505dd4c63b177918feb4e54cca8a7948ec9d9) ) /* Sprites planes 2-3 */ + ROM_LOAD( "gs21.04n", 0x08000, 0x8000, CRC(68883749) SHA1(c7bf2bf49c53feddf8f30b4001dc2d59b52b1c28) ) /* Sprites planes 2-3 */ + ROM_LOAD( "gs20.03n", 0x10000, 0x8000, CRC(0be932ed) SHA1(1c5af5884a23112dbc36579515d1cb497992da2f) ) /* Sprites planes 2-3 */ + ROM_LOAD( "gs19.01n", 0x18000, 0x8000, CRC(63072f93) SHA1(cb3a2729782cf2855558d081fe92d28366228b8e) ) /* Sprites planes 2-3 */ + ROM_LOAD( "gs18.06l", 0x20000, 0x8000, CRC(f69a3c7c) SHA1(e9eb9dfa7d53aa7b728150f91d05bfc3bf6f1e75) ) /* Sprites planes 0-1 */ + ROM_LOAD( "gs17.04l", 0x28000, 0x8000, CRC(4e98562a) SHA1(0341b8a79be1d71a57d0d76ed890e15f9f92259e) ) /* Sprites planes 0-1 */ + ROM_LOAD( "gs16.03l", 0x30000, 0x8000, CRC(0d99c3b3) SHA1(436c566b76f632242448671e3b6319f7d9f65322) ) /* Sprites planes 0-1 */ + ROM_LOAD( "gs15.01l", 0x38000, 0x8000, CRC(7f14270e) SHA1(dd06c333c2ea097e25185a1423cd61e1b7afc42b) ) /* Sprites planes 0-1 */ ROM_REGION( 0x8000, "gfx4", 0 ) /* background tilemaps */ - ROM_LOAD( "11c_gs14.bin", 0x00000, 0x8000, CRC(0af4f7eb) SHA1(24a98fdeedeeaf1035b4af52d5a8dd5e47a5e62d) ) + ROM_LOAD( "gs14.11c", 0x00000, 0x8000, CRC(0af4f7eb) SHA1(24a98fdeedeeaf1035b4af52d5a8dd5e47a5e62d) ) ROM_REGION( 0x0a00, "proms", 0 ) - ROM_LOAD( "03b_g-01.bin", 0x0000, 0x0100, CRC(02f55589) SHA1(8a3f98304aedf3aba1c08b615bf457752a480edc) ) /* red component */ - ROM_LOAD( "04b_g-02.bin", 0x0100, 0x0100, CRC(e1e36dd9) SHA1(5bd88a35898a2d973045bdde8311aac3a12826de) ) /* green component */ - ROM_LOAD( "05b_g-03.bin", 0x0200, 0x0100, CRC(989399c0) SHA1(e408e391f49ed0c7b9e16479fea44b809440fefc) ) /* blue component */ - ROM_LOAD( "09d_g-04.bin", 0x0300, 0x0100, CRC(906612b5) SHA1(7b727a6200c088538180758320ede84aa7e5b96d) ) /* char lookup table */ - ROM_LOAD( "14a_g-06.bin", 0x0400, 0x0100, CRC(4a9da18b) SHA1(fed3b81b56aab2ed0a21ed1fcebe3f1ae095a13b) ) /* tile lookup table */ - ROM_LOAD( "15a_g-07.bin", 0x0500, 0x0100, CRC(cb9394fc) SHA1(8ad0fde6a8ef8326d2da4b6dbf3b51f5f6c668c8) ) /* tile palette bank */ - ROM_LOAD( "09f_g-09.bin", 0x0600, 0x0100, CRC(3cee181e) SHA1(3f95bdb12391cb9b3673191bda8d09c84b36b4d3) ) /* sprite lookup table */ - ROM_LOAD( "08f_g-08.bin", 0x0700, 0x0100, CRC(ef91cdd2) SHA1(90b9191c9f10a153d64055a4238eb6e15b8c12bc) ) /* sprite palette bank */ - ROM_LOAD( "02j_g-10.bin", 0x0800, 0x0100, CRC(0eaf5158) SHA1(bafd4108708f66cd7b280e47152b108f3e254fc9) ) /* video timing (not used) */ - ROM_LOAD( "01f_g-05.bin", 0x0900, 0x0100, CRC(25c90c2a) SHA1(42893572bab757ec01e181fc418cb911638d37e0) ) /* priority? (not used) */ + ROM_LOAD( "g-01.03b", 0x0000, 0x0100, CRC(02f55589) SHA1(8a3f98304aedf3aba1c08b615bf457752a480edc) ) /* red component */ + ROM_LOAD( "g-02.04b", 0x0100, 0x0100, CRC(e1e36dd9) SHA1(5bd88a35898a2d973045bdde8311aac3a12826de) ) /* green component */ + ROM_LOAD( "g-03.05b", 0x0200, 0x0100, CRC(989399c0) SHA1(e408e391f49ed0c7b9e16479fea44b809440fefc) ) /* blue component */ + ROM_LOAD( "g-04.09d", 0x0300, 0x0100, CRC(906612b5) SHA1(7b727a6200c088538180758320ede84aa7e5b96d) ) /* char lookup table */ + ROM_LOAD( "g-06.14a", 0x0400, 0x0100, CRC(4a9da18b) SHA1(fed3b81b56aab2ed0a21ed1fcebe3f1ae095a13b) ) /* tile lookup table */ + ROM_LOAD( "g-07.15a", 0x0500, 0x0100, CRC(cb9394fc) SHA1(8ad0fde6a8ef8326d2da4b6dbf3b51f5f6c668c8) ) /* tile palette bank */ + ROM_LOAD( "g-09.09f", 0x0600, 0x0100, CRC(3cee181e) SHA1(3f95bdb12391cb9b3673191bda8d09c84b36b4d3) ) /* sprite lookup table */ + ROM_LOAD( "g-08.08f", 0x0700, 0x0100, CRC(ef91cdd2) SHA1(90b9191c9f10a153d64055a4238eb6e15b8c12bc) ) /* sprite palette bank */ + ROM_LOAD( "g-10.02j", 0x0800, 0x0100, CRC(0eaf5158) SHA1(bafd4108708f66cd7b280e47152b108f3e254fc9) ) /* video timing (not used) */ + ROM_LOAD( "g-05.01f", 0x0900, 0x0100, CRC(25c90c2a) SHA1(42893572bab757ec01e181fc418cb911638d37e0) ) /* priority? (not used) */ ROM_END ROM_START( gunsmokeu ) ROM_REGION( 0x20000, "maincpu", 0 ) - ROM_LOAD( "9n_gs03.bin", 0x00000, 0x8000, CRC(592f211b) SHA1(8de44b3cafa3d2ce9aba515cf3ec4bac0bcdeb5b) ) /* Code 0000-7fff */ - ROM_LOAD( "10n_gs04.bin", 0x10000, 0x8000, CRC(8d4b423f) SHA1(149274c2ed1526ca1f419fdf8a24059ff138f7f2) ) /* Paged code */ - ROM_LOAD( "12n_gs05.bin", 0x18000, 0x8000, CRC(2b5667fb) SHA1(5b689bca1e76d803b4cae22feaa7744fa528e93f) ) /* Paged code */ + ROM_LOAD( "gsa_03.9n", 0x00000, 0x8000, CRC(51dc3f76) SHA1(2a188fee73c3662b665b56a825eb908b7b42dcd0) ) /* Code 0000-7fff */ + ROM_LOAD( "gs04.10n", 0x10000, 0x8000, CRC(5ecf31b8) SHA1(34ec9727330821a45b497c78c970a1a4f14ff4ee) ) /* Paged code */ + ROM_LOAD( "gs05.12n", 0x18000, 0x8000, CRC(1c9aca13) SHA1(eb92c373d2241aea4c59248e1b82717733105ac0) ) /* Paged code */ ROM_REGION( 0x10000, "audiocpu", 0 ) - ROM_LOAD( "14h_gs02.bin", 0x00000, 0x8000, CRC(cd7a2c38) SHA1(c76c471f694b76015370f0eacf5350e652f526ff) ) + ROM_LOAD( "gs02.14h", 0x00000, 0x8000, CRC(cd7a2c38) SHA1(c76c471f694b76015370f0eacf5350e652f526ff) ) ROM_REGION( 0x04000, "gfx1", 0 ) - ROM_LOAD( "11f_gs01.bin", 0x00000, 0x4000, CRC(b61ece9b) SHA1(eb3fc62644cc5b5a2b9cbe67c393d4a0e2a59ca9) ) /* Characters */ + ROM_LOAD( "gs01.11f", 0x00000, 0x4000, CRC(b61ece9b) SHA1(eb3fc62644cc5b5a2b9cbe67c393d4a0e2a59ca9) ) /* Characters */ ROM_REGION( 0x40000, "gfx2", 0 ) - ROM_LOAD( "06c_gs13.bin", 0x00000, 0x8000, CRC(f6769fc5) SHA1(d192ec176425327ca4b7e25fc8432fc47837ba29) ) /* 32x32 tiles planes 2-3 */ - ROM_LOAD( "05c_gs12.bin", 0x08000, 0x8000, CRC(d997b78c) SHA1(3b4a9b6f9e57ecfb4ab9734379bd0ee765fd6daa) ) - ROM_LOAD( "04c_gs11.bin", 0x10000, 0x8000, CRC(125ba58e) SHA1(cf6931653cebd051564bed8121ab8713a55095c5) ) - ROM_LOAD( "02c_gs10.bin", 0x18000, 0x8000, CRC(f469c13c) SHA1(54eda52d6fce58771c0adfe2c88292a41d5a9b99) ) - ROM_LOAD( "06a_gs09.bin", 0x20000, 0x8000, CRC(539f182d) SHA1(4190c0adbecc57b92f4d002e121acb77e8c5d8d8) ) /* 32x32 tiles planes 0-1 */ - ROM_LOAD( "05a_gs08.bin", 0x28000, 0x8000, CRC(e87e526d) SHA1(d10068addf30322424a85bbc6382cb762ae3fbe2) ) - ROM_LOAD( "04a_gs07.bin", 0x30000, 0x8000, CRC(4382c0d2) SHA1(8615e62bc57b40d082f6ca211d64f22185bed1fd) ) - ROM_LOAD( "02a_gs06.bin", 0x38000, 0x8000, CRC(4cafe7a6) SHA1(fe501f3a5e9ce9e82e9708f1cd297f4c94ef0f81) ) + ROM_LOAD( "gs13.06c", 0x00000, 0x8000, CRC(f6769fc5) SHA1(d192ec176425327ca4b7e25fc8432fc47837ba29) ) /* 32x32 tiles planes 2-3 */ + ROM_LOAD( "gs12.05c", 0x08000, 0x8000, CRC(d997b78c) SHA1(3b4a9b6f9e57ecfb4ab9734379bd0ee765fd6daa) ) + ROM_LOAD( "gs11.04c", 0x10000, 0x8000, CRC(125ba58e) SHA1(cf6931653cebd051564bed8121ab8713a55095c5) ) + ROM_LOAD( "gs10.02c", 0x18000, 0x8000, CRC(f469c13c) SHA1(54eda52d6fce58771c0adfe2c88292a41d5a9b99) ) + ROM_LOAD( "gs09.06a", 0x20000, 0x8000, CRC(539f182d) SHA1(4190c0adbecc57b92f4d002e121acb77e8c5d8d8) ) /* 32x32 tiles planes 0-1 */ + ROM_LOAD( "gs08.05a", 0x28000, 0x8000, CRC(e87e526d) SHA1(d10068addf30322424a85bbc6382cb762ae3fbe2) ) + ROM_LOAD( "gs07.04a", 0x30000, 0x8000, CRC(4382c0d2) SHA1(8615e62bc57b40d082f6ca211d64f22185bed1fd) ) + ROM_LOAD( "gs06.02a", 0x38000, 0x8000, CRC(4cafe7a6) SHA1(fe501f3a5e9ce9e82e9708f1cd297f4c94ef0f81) ) ROM_REGION( 0x40000, "gfx3", 0 ) - ROM_LOAD( "06n_gs22.bin", 0x00000, 0x8000, CRC(dc9c508c) SHA1(920505dd4c63b177918feb4e54cca8a7948ec9d9) ) /* Sprites planes 2-3 */ - ROM_LOAD( "04n_gs21.bin", 0x08000, 0x8000, CRC(68883749) SHA1(c7bf2bf49c53feddf8f30b4001dc2d59b52b1c28) ) /* Sprites planes 2-3 */ - ROM_LOAD( "03n_gs20.bin", 0x10000, 0x8000, CRC(0be932ed) SHA1(1c5af5884a23112dbc36579515d1cb497992da2f) ) /* Sprites planes 2-3 */ - ROM_LOAD( "01n_gs19.bin", 0x18000, 0x8000, CRC(63072f93) SHA1(cb3a2729782cf2855558d081fe92d28366228b8e) ) /* Sprites planes 2-3 */ - ROM_LOAD( "06l_gs18.bin", 0x20000, 0x8000, CRC(f69a3c7c) SHA1(e9eb9dfa7d53aa7b728150f91d05bfc3bf6f1e75) ) /* Sprites planes 0-1 */ - ROM_LOAD( "04l_gs17.bin", 0x28000, 0x8000, CRC(4e98562a) SHA1(0341b8a79be1d71a57d0d76ed890e15f9f92259e) ) /* Sprites planes 0-1 */ - ROM_LOAD( "03l_gs16.bin", 0x30000, 0x8000, CRC(0d99c3b3) SHA1(436c566b76f632242448671e3b6319f7d9f65322) ) /* Sprites planes 0-1 */ - ROM_LOAD( "01l_gs15.bin", 0x38000, 0x8000, CRC(7f14270e) SHA1(dd06c333c2ea097e25185a1423cd61e1b7afc42b) ) /* Sprites planes 0-1 */ + ROM_LOAD( "gs22.06n", 0x00000, 0x8000, CRC(dc9c508c) SHA1(920505dd4c63b177918feb4e54cca8a7948ec9d9) ) /* Sprites planes 2-3 */ + ROM_LOAD( "gs21.04n", 0x08000, 0x8000, CRC(68883749) SHA1(c7bf2bf49c53feddf8f30b4001dc2d59b52b1c28) ) /* Sprites planes 2-3 */ + ROM_LOAD( "gs20.03n", 0x10000, 0x8000, CRC(0be932ed) SHA1(1c5af5884a23112dbc36579515d1cb497992da2f) ) /* Sprites planes 2-3 */ + ROM_LOAD( "gs19.01n", 0x18000, 0x8000, CRC(63072f93) SHA1(cb3a2729782cf2855558d081fe92d28366228b8e) ) /* Sprites planes 2-3 */ + ROM_LOAD( "gs18.06l", 0x20000, 0x8000, CRC(f69a3c7c) SHA1(e9eb9dfa7d53aa7b728150f91d05bfc3bf6f1e75) ) /* Sprites planes 0-1 */ + ROM_LOAD( "gs17.04l", 0x28000, 0x8000, CRC(4e98562a) SHA1(0341b8a79be1d71a57d0d76ed890e15f9f92259e) ) /* Sprites planes 0-1 */ + ROM_LOAD( "gs16.03l", 0x30000, 0x8000, CRC(0d99c3b3) SHA1(436c566b76f632242448671e3b6319f7d9f65322) ) /* Sprites planes 0-1 */ + ROM_LOAD( "gs15.01l", 0x38000, 0x8000, CRC(7f14270e) SHA1(dd06c333c2ea097e25185a1423cd61e1b7afc42b) ) /* Sprites planes 0-1 */ ROM_REGION( 0x8000, "gfx4", 0 ) /* background tilemaps */ - ROM_LOAD( "11c_gs14.bin", 0x00000, 0x8000, CRC(0af4f7eb) SHA1(24a98fdeedeeaf1035b4af52d5a8dd5e47a5e62d) ) + ROM_LOAD( "gs14.11c", 0x00000, 0x8000, CRC(0af4f7eb) SHA1(24a98fdeedeeaf1035b4af52d5a8dd5e47a5e62d) ) ROM_REGION( 0x0a00, "proms", 0 ) - ROM_LOAD( "03b_g-01.bin", 0x0000, 0x0100, CRC(02f55589) SHA1(8a3f98304aedf3aba1c08b615bf457752a480edc) ) /* red component */ - ROM_LOAD( "04b_g-02.bin", 0x0100, 0x0100, CRC(e1e36dd9) SHA1(5bd88a35898a2d973045bdde8311aac3a12826de) ) /* green component */ - ROM_LOAD( "05b_g-03.bin", 0x0200, 0x0100, CRC(989399c0) SHA1(e408e391f49ed0c7b9e16479fea44b809440fefc) ) /* blue component */ - ROM_LOAD( "09d_g-04.bin", 0x0300, 0x0100, CRC(906612b5) SHA1(7b727a6200c088538180758320ede84aa7e5b96d) ) /* char lookup table */ - ROM_LOAD( "14a_g-06.bin", 0x0400, 0x0100, CRC(4a9da18b) SHA1(fed3b81b56aab2ed0a21ed1fcebe3f1ae095a13b) ) /* tile lookup table */ - ROM_LOAD( "15a_g-07.bin", 0x0500, 0x0100, CRC(cb9394fc) SHA1(8ad0fde6a8ef8326d2da4b6dbf3b51f5f6c668c8) ) /* tile palette bank */ - ROM_LOAD( "09f_g-09.bin", 0x0600, 0x0100, CRC(3cee181e) SHA1(3f95bdb12391cb9b3673191bda8d09c84b36b4d3) ) /* sprite lookup table */ - ROM_LOAD( "08f_g-08.bin", 0x0700, 0x0100, CRC(ef91cdd2) SHA1(90b9191c9f10a153d64055a4238eb6e15b8c12bc) ) /* sprite palette bank */ - ROM_LOAD( "02j_g-10.bin", 0x0800, 0x0100, CRC(0eaf5158) SHA1(bafd4108708f66cd7b280e47152b108f3e254fc9) ) /* video timing (not used) */ - ROM_LOAD( "01f_g-05.bin", 0x0900, 0x0100, CRC(25c90c2a) SHA1(42893572bab757ec01e181fc418cb911638d37e0) ) /* priority? (not used) */ + ROM_LOAD( "g-01.03b", 0x0000, 0x0100, CRC(02f55589) SHA1(8a3f98304aedf3aba1c08b615bf457752a480edc) ) /* red component */ + ROM_LOAD( "g-02.04b", 0x0100, 0x0100, CRC(e1e36dd9) SHA1(5bd88a35898a2d973045bdde8311aac3a12826de) ) /* green component */ + ROM_LOAD( "g-03.05b", 0x0200, 0x0100, CRC(989399c0) SHA1(e408e391f49ed0c7b9e16479fea44b809440fefc) ) /* blue component */ + ROM_LOAD( "g-04.09d", 0x0300, 0x0100, CRC(906612b5) SHA1(7b727a6200c088538180758320ede84aa7e5b96d) ) /* char lookup table */ + ROM_LOAD( "g-06.14a", 0x0400, 0x0100, CRC(4a9da18b) SHA1(fed3b81b56aab2ed0a21ed1fcebe3f1ae095a13b) ) /* tile lookup table */ + ROM_LOAD( "g-07.15a", 0x0500, 0x0100, CRC(cb9394fc) SHA1(8ad0fde6a8ef8326d2da4b6dbf3b51f5f6c668c8) ) /* tile palette bank */ + ROM_LOAD( "g-09.09f", 0x0600, 0x0100, CRC(3cee181e) SHA1(3f95bdb12391cb9b3673191bda8d09c84b36b4d3) ) /* sprite lookup table */ + ROM_LOAD( "g-08.08f", 0x0700, 0x0100, CRC(ef91cdd2) SHA1(90b9191c9f10a153d64055a4238eb6e15b8c12bc) ) /* sprite palette bank */ + ROM_LOAD( "g-10.02j", 0x0800, 0x0100, CRC(0eaf5158) SHA1(bafd4108708f66cd7b280e47152b108f3e254fc9) ) /* video timing (not used) */ + ROM_LOAD( "g-05.01f", 0x0900, 0x0100, CRC(25c90c2a) SHA1(42893572bab757ec01e181fc418cb911638d37e0) ) /* priority? (not used) */ ROM_END + + + ROM_START( gunsmokeua ) + ROM_REGION( 0x20000, "maincpu", 0 ) // has a small extra piece of code at 0x2f00 and a jump to it at 0x297b, otherwise the same as gunsmokeub including the datecode, chip had an 'A' stamped on it, bugfix? + ROM_LOAD( "gsr_03a.9n", 0x00000, 0x8000, CRC(2f6e6ad7) SHA1(e9e4a367c240a35a1ba2eeaec9458996f7926f16) ) /* Code 0000-7fff */ + ROM_LOAD( "gs04.10n", 0x10000, 0x8000, CRC(8d4b423f) SHA1(149274c2ed1526ca1f419fdf8a24059ff138f7f2) ) /* Paged code */ + ROM_LOAD( "gs05.12n", 0x18000, 0x8000, CRC(2b5667fb) SHA1(5b689bca1e76d803b4cae22feaa7744fa528e93f) ) /* Paged code */ + + ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_LOAD( "gs02.14h", 0x00000, 0x8000, CRC(cd7a2c38) SHA1(c76c471f694b76015370f0eacf5350e652f526ff) ) + + ROM_REGION( 0x04000, "gfx1", 0 ) + ROM_LOAD( "gs01.11f", 0x00000, 0x4000, CRC(b61ece9b) SHA1(eb3fc62644cc5b5a2b9cbe67c393d4a0e2a59ca9) ) /* Characters */ + + ROM_REGION( 0x40000, "gfx2", 0 ) + ROM_LOAD( "gs13.06c", 0x00000, 0x8000, CRC(f6769fc5) SHA1(d192ec176425327ca4b7e25fc8432fc47837ba29) ) /* 32x32 tiles planes 2-3 */ + ROM_LOAD( "gs12.05c", 0x08000, 0x8000, CRC(d997b78c) SHA1(3b4a9b6f9e57ecfb4ab9734379bd0ee765fd6daa) ) + ROM_LOAD( "gs11.04c", 0x10000, 0x8000, CRC(125ba58e) SHA1(cf6931653cebd051564bed8121ab8713a55095c5) ) + ROM_LOAD( "gs10.02c", 0x18000, 0x8000, CRC(f469c13c) SHA1(54eda52d6fce58771c0adfe2c88292a41d5a9b99) ) + ROM_LOAD( "gs09.06a", 0x20000, 0x8000, CRC(539f182d) SHA1(4190c0adbecc57b92f4d002e121acb77e8c5d8d8) ) /* 32x32 tiles planes 0-1 */ + ROM_LOAD( "gs08.05a", 0x28000, 0x8000, CRC(e87e526d) SHA1(d10068addf30322424a85bbc6382cb762ae3fbe2) ) + ROM_LOAD( "gs07.04a", 0x30000, 0x8000, CRC(4382c0d2) SHA1(8615e62bc57b40d082f6ca211d64f22185bed1fd) ) + ROM_LOAD( "gs06.02a", 0x38000, 0x8000, CRC(4cafe7a6) SHA1(fe501f3a5e9ce9e82e9708f1cd297f4c94ef0f81) ) + + ROM_REGION( 0x40000, "gfx3", 0 ) + ROM_LOAD( "gs22.06n", 0x00000, 0x8000, CRC(dc9c508c) SHA1(920505dd4c63b177918feb4e54cca8a7948ec9d9) ) /* Sprites planes 2-3 */ + ROM_LOAD( "gs21.04n", 0x08000, 0x8000, CRC(68883749) SHA1(c7bf2bf49c53feddf8f30b4001dc2d59b52b1c28) ) /* Sprites planes 2-3 */ + ROM_LOAD( "gs20.03n", 0x10000, 0x8000, CRC(0be932ed) SHA1(1c5af5884a23112dbc36579515d1cb497992da2f) ) /* Sprites planes 2-3 */ + ROM_LOAD( "gs19.01n", 0x18000, 0x8000, CRC(63072f93) SHA1(cb3a2729782cf2855558d081fe92d28366228b8e) ) /* Sprites planes 2-3 */ + ROM_LOAD( "gs18.06l", 0x20000, 0x8000, CRC(f69a3c7c) SHA1(e9eb9dfa7d53aa7b728150f91d05bfc3bf6f1e75) ) /* Sprites planes 0-1 */ + ROM_LOAD( "gs17.04l", 0x28000, 0x8000, CRC(4e98562a) SHA1(0341b8a79be1d71a57d0d76ed890e15f9f92259e) ) /* Sprites planes 0-1 */ + ROM_LOAD( "gs16.03l", 0x30000, 0x8000, CRC(0d99c3b3) SHA1(436c566b76f632242448671e3b6319f7d9f65322) ) /* Sprites planes 0-1 */ + ROM_LOAD( "gs15.01l", 0x38000, 0x8000, CRC(7f14270e) SHA1(dd06c333c2ea097e25185a1423cd61e1b7afc42b) ) /* Sprites planes 0-1 */ + + ROM_REGION( 0x8000, "gfx4", 0 ) /* background tilemaps */ + ROM_LOAD( "gs14.11c", 0x00000, 0x8000, CRC(0af4f7eb) SHA1(24a98fdeedeeaf1035b4af52d5a8dd5e47a5e62d) ) + + ROM_REGION( 0x0a00, "proms", 0 ) + ROM_LOAD( "g-01.03b", 0x0000, 0x0100, CRC(02f55589) SHA1(8a3f98304aedf3aba1c08b615bf457752a480edc) ) /* red component */ + ROM_LOAD( "g-02.04b", 0x0100, 0x0100, CRC(e1e36dd9) SHA1(5bd88a35898a2d973045bdde8311aac3a12826de) ) /* green component */ + ROM_LOAD( "g-03.05b", 0x0200, 0x0100, CRC(989399c0) SHA1(e408e391f49ed0c7b9e16479fea44b809440fefc) ) /* blue component */ + ROM_LOAD( "g-04.09d", 0x0300, 0x0100, CRC(906612b5) SHA1(7b727a6200c088538180758320ede84aa7e5b96d) ) /* char lookup table */ + ROM_LOAD( "g-06.14a", 0x0400, 0x0100, CRC(4a9da18b) SHA1(fed3b81b56aab2ed0a21ed1fcebe3f1ae095a13b) ) /* tile lookup table */ + ROM_LOAD( "g-07.15a", 0x0500, 0x0100, CRC(cb9394fc) SHA1(8ad0fde6a8ef8326d2da4b6dbf3b51f5f6c668c8) ) /* tile palette bank */ + ROM_LOAD( "g-09.09f", 0x0600, 0x0100, CRC(3cee181e) SHA1(3f95bdb12391cb9b3673191bda8d09c84b36b4d3) ) /* sprite lookup table */ + ROM_LOAD( "g-08.08f", 0x0700, 0x0100, CRC(ef91cdd2) SHA1(90b9191c9f10a153d64055a4238eb6e15b8c12bc) ) /* sprite palette bank */ + ROM_LOAD( "g-10.02j", 0x0800, 0x0100, CRC(0eaf5158) SHA1(bafd4108708f66cd7b280e47152b108f3e254fc9) ) /* video timing (not used) */ + ROM_LOAD( "g-05.01f", 0x0900, 0x0100, CRC(25c90c2a) SHA1(42893572bab757ec01e181fc418cb911638d37e0) ) /* priority? (not used) */ +ROM_END + +ROM_START( gunsmokeub ) ROM_REGION( 0x20000, "maincpu", 0 ) - ROM_LOAD( "gs03.9n", 0x00000, 0x8000, CRC(51dc3f76) SHA1(2a188fee73c3662b665b56a825eb908b7b42dcd0) ) /* Code 0000-7fff */ - ROM_LOAD( "gs04.10n", 0x10000, 0x8000, CRC(5ecf31b8) SHA1(34ec9727330821a45b497c78c970a1a4f14ff4ee) ) /* Paged code */ - ROM_LOAD( "gs05.12n", 0x18000, 0x8000, CRC(1c9aca13) SHA1(eb92c373d2241aea4c59248e1b82717733105ac0) ) /* Paged code */ + ROM_LOAD( "gsr_03.9n", 0x00000, 0x8000, CRC(592f211b) SHA1(8de44b3cafa3d2ce9aba515cf3ec4bac0bcdeb5b) ) /* Code 0000-7fff */ + ROM_LOAD( "gs04.10n", 0x10000, 0x8000, CRC(8d4b423f) SHA1(149274c2ed1526ca1f419fdf8a24059ff138f7f2) ) /* Paged code */ + ROM_LOAD( "gs05.12n", 0x18000, 0x8000, CRC(2b5667fb) SHA1(5b689bca1e76d803b4cae22feaa7744fa528e93f) ) /* Paged code */ ROM_REGION( 0x10000, "audiocpu", 0 ) - ROM_LOAD( "14h_gs02.bin", 0x00000, 0x8000, CRC(cd7a2c38) SHA1(c76c471f694b76015370f0eacf5350e652f526ff) ) + ROM_LOAD( "gs02.14h", 0x00000, 0x8000, CRC(cd7a2c38) SHA1(c76c471f694b76015370f0eacf5350e652f526ff) ) ROM_REGION( 0x04000, "gfx1", 0 ) - ROM_LOAD( "11f_gs01.bin", 0x00000, 0x4000, CRC(b61ece9b) SHA1(eb3fc62644cc5b5a2b9cbe67c393d4a0e2a59ca9) ) /* Characters */ + ROM_LOAD( "gs01.11f", 0x00000, 0x4000, CRC(b61ece9b) SHA1(eb3fc62644cc5b5a2b9cbe67c393d4a0e2a59ca9) ) /* Characters */ ROM_REGION( 0x40000, "gfx2", 0 ) - ROM_LOAD( "06c_gs13.bin", 0x00000, 0x8000, CRC(f6769fc5) SHA1(d192ec176425327ca4b7e25fc8432fc47837ba29) ) /* 32x32 tiles planes 2-3 */ - ROM_LOAD( "05c_gs12.bin", 0x08000, 0x8000, CRC(d997b78c) SHA1(3b4a9b6f9e57ecfb4ab9734379bd0ee765fd6daa) ) - ROM_LOAD( "04c_gs11.bin", 0x10000, 0x8000, CRC(125ba58e) SHA1(cf6931653cebd051564bed8121ab8713a55095c5) ) - ROM_LOAD( "02c_gs10.bin", 0x18000, 0x8000, CRC(f469c13c) SHA1(54eda52d6fce58771c0adfe2c88292a41d5a9b99) ) - ROM_LOAD( "06a_gs09.bin", 0x20000, 0x8000, CRC(539f182d) SHA1(4190c0adbecc57b92f4d002e121acb77e8c5d8d8) ) /* 32x32 tiles planes 0-1 */ - ROM_LOAD( "05a_gs08.bin", 0x28000, 0x8000, CRC(e87e526d) SHA1(d10068addf30322424a85bbc6382cb762ae3fbe2) ) - ROM_LOAD( "04a_gs07.bin", 0x30000, 0x8000, CRC(4382c0d2) SHA1(8615e62bc57b40d082f6ca211d64f22185bed1fd) ) - ROM_LOAD( "02a_gs06.bin", 0x38000, 0x8000, CRC(4cafe7a6) SHA1(fe501f3a5e9ce9e82e9708f1cd297f4c94ef0f81) ) + ROM_LOAD( "gs13.06c", 0x00000, 0x8000, CRC(f6769fc5) SHA1(d192ec176425327ca4b7e25fc8432fc47837ba29) ) /* 32x32 tiles planes 2-3 */ + ROM_LOAD( "gs12.05c", 0x08000, 0x8000, CRC(d997b78c) SHA1(3b4a9b6f9e57ecfb4ab9734379bd0ee765fd6daa) ) + ROM_LOAD( "gs11.04c", 0x10000, 0x8000, CRC(125ba58e) SHA1(cf6931653cebd051564bed8121ab8713a55095c5) ) + ROM_LOAD( "gs10.02c", 0x18000, 0x8000, CRC(f469c13c) SHA1(54eda52d6fce58771c0adfe2c88292a41d5a9b99) ) + ROM_LOAD( "gs09.06a", 0x20000, 0x8000, CRC(539f182d) SHA1(4190c0adbecc57b92f4d002e121acb77e8c5d8d8) ) /* 32x32 tiles planes 0-1 */ + ROM_LOAD( "gs08.05a", 0x28000, 0x8000, CRC(e87e526d) SHA1(d10068addf30322424a85bbc6382cb762ae3fbe2) ) + ROM_LOAD( "gs07.04a", 0x30000, 0x8000, CRC(4382c0d2) SHA1(8615e62bc57b40d082f6ca211d64f22185bed1fd) ) + ROM_LOAD( "gs06.02a", 0x38000, 0x8000, CRC(4cafe7a6) SHA1(fe501f3a5e9ce9e82e9708f1cd297f4c94ef0f81) ) ROM_REGION( 0x40000, "gfx3", 0 ) - ROM_LOAD( "06n_gs22.bin", 0x00000, 0x8000, CRC(dc9c508c) SHA1(920505dd4c63b177918feb4e54cca8a7948ec9d9) ) /* Sprites planes 2-3 */ - ROM_LOAD( "04n_gs21.bin", 0x08000, 0x8000, CRC(68883749) SHA1(c7bf2bf49c53feddf8f30b4001dc2d59b52b1c28) ) /* Sprites planes 2-3 */ - ROM_LOAD( "03n_gs20.bin", 0x10000, 0x8000, CRC(0be932ed) SHA1(1c5af5884a23112dbc36579515d1cb497992da2f) ) /* Sprites planes 2-3 */ - ROM_LOAD( "01n_gs19.bin", 0x18000, 0x8000, CRC(63072f93) SHA1(cb3a2729782cf2855558d081fe92d28366228b8e) ) /* Sprites planes 2-3 */ - ROM_LOAD( "06l_gs18.bin", 0x20000, 0x8000, CRC(f69a3c7c) SHA1(e9eb9dfa7d53aa7b728150f91d05bfc3bf6f1e75) ) /* Sprites planes 0-1 */ - ROM_LOAD( "04l_gs17.bin", 0x28000, 0x8000, CRC(4e98562a) SHA1(0341b8a79be1d71a57d0d76ed890e15f9f92259e) ) /* Sprites planes 0-1 */ - ROM_LOAD( "03l_gs16.bin", 0x30000, 0x8000, CRC(0d99c3b3) SHA1(436c566b76f632242448671e3b6319f7d9f65322) ) /* Sprites planes 0-1 */ - ROM_LOAD( "01l_gs15.bin", 0x38000, 0x8000, CRC(7f14270e) SHA1(dd06c333c2ea097e25185a1423cd61e1b7afc42b) ) /* Sprites planes 0-1 */ + ROM_LOAD( "gs22.06n", 0x00000, 0x8000, CRC(dc9c508c) SHA1(920505dd4c63b177918feb4e54cca8a7948ec9d9) ) /* Sprites planes 2-3 */ + ROM_LOAD( "gs21.04n", 0x08000, 0x8000, CRC(68883749) SHA1(c7bf2bf49c53feddf8f30b4001dc2d59b52b1c28) ) /* Sprites planes 2-3 */ + ROM_LOAD( "gs20.03n", 0x10000, 0x8000, CRC(0be932ed) SHA1(1c5af5884a23112dbc36579515d1cb497992da2f) ) /* Sprites planes 2-3 */ + ROM_LOAD( "gs19.01n", 0x18000, 0x8000, CRC(63072f93) SHA1(cb3a2729782cf2855558d081fe92d28366228b8e) ) /* Sprites planes 2-3 */ + ROM_LOAD( "gs18.06l", 0x20000, 0x8000, CRC(f69a3c7c) SHA1(e9eb9dfa7d53aa7b728150f91d05bfc3bf6f1e75) ) /* Sprites planes 0-1 */ + ROM_LOAD( "gs17.04l", 0x28000, 0x8000, CRC(4e98562a) SHA1(0341b8a79be1d71a57d0d76ed890e15f9f92259e) ) /* Sprites planes 0-1 */ + ROM_LOAD( "gs16.03l", 0x30000, 0x8000, CRC(0d99c3b3) SHA1(436c566b76f632242448671e3b6319f7d9f65322) ) /* Sprites planes 0-1 */ + ROM_LOAD( "gs15.01l", 0x38000, 0x8000, CRC(7f14270e) SHA1(dd06c333c2ea097e25185a1423cd61e1b7afc42b) ) /* Sprites planes 0-1 */ ROM_REGION( 0x8000, "gfx4", 0 ) /* background tilemaps */ - ROM_LOAD( "11c_gs14.bin", 0x00000, 0x8000, CRC(0af4f7eb) SHA1(24a98fdeedeeaf1035b4af52d5a8dd5e47a5e62d) ) + ROM_LOAD( "gs14.11c", 0x00000, 0x8000, CRC(0af4f7eb) SHA1(24a98fdeedeeaf1035b4af52d5a8dd5e47a5e62d) ) ROM_REGION( 0x0a00, "proms", 0 ) - ROM_LOAD( "03b_g-01.bin", 0x0000, 0x0100, CRC(02f55589) SHA1(8a3f98304aedf3aba1c08b615bf457752a480edc) ) /* red component */ - ROM_LOAD( "04b_g-02.bin", 0x0100, 0x0100, CRC(e1e36dd9) SHA1(5bd88a35898a2d973045bdde8311aac3a12826de) ) /* green component */ - ROM_LOAD( "05b_g-03.bin", 0x0200, 0x0100, CRC(989399c0) SHA1(e408e391f49ed0c7b9e16479fea44b809440fefc) ) /* blue component */ - ROM_LOAD( "09d_g-04.bin", 0x0300, 0x0100, CRC(906612b5) SHA1(7b727a6200c088538180758320ede84aa7e5b96d) ) /* char lookup table */ - ROM_LOAD( "14a_g-06.bin", 0x0400, 0x0100, CRC(4a9da18b) SHA1(fed3b81b56aab2ed0a21ed1fcebe3f1ae095a13b) ) /* tile lookup table */ - ROM_LOAD( "15a_g-07.bin", 0x0500, 0x0100, CRC(cb9394fc) SHA1(8ad0fde6a8ef8326d2da4b6dbf3b51f5f6c668c8) ) /* tile palette bank */ - ROM_LOAD( "09f_g-09.bin", 0x0600, 0x0100, CRC(3cee181e) SHA1(3f95bdb12391cb9b3673191bda8d09c84b36b4d3) ) /* sprite lookup table */ - ROM_LOAD( "08f_g-08.bin", 0x0700, 0x0100, CRC(ef91cdd2) SHA1(90b9191c9f10a153d64055a4238eb6e15b8c12bc) ) /* sprite palette bank */ - ROM_LOAD( "02j_g-10.bin", 0x0800, 0x0100, CRC(0eaf5158) SHA1(bafd4108708f66cd7b280e47152b108f3e254fc9) ) /* video timing (not used) */ - ROM_LOAD( "01f_g-05.bin", 0x0900, 0x0100, CRC(25c90c2a) SHA1(42893572bab757ec01e181fc418cb911638d37e0) ) /* priority? (not used) */ + ROM_LOAD( "g-01.03b", 0x0000, 0x0100, CRC(02f55589) SHA1(8a3f98304aedf3aba1c08b615bf457752a480edc) ) /* red component */ + ROM_LOAD( "g-02.04b", 0x0100, 0x0100, CRC(e1e36dd9) SHA1(5bd88a35898a2d973045bdde8311aac3a12826de) ) /* green component */ + ROM_LOAD( "g-03.05b", 0x0200, 0x0100, CRC(989399c0) SHA1(e408e391f49ed0c7b9e16479fea44b809440fefc) ) /* blue component */ + ROM_LOAD( "g-04.09d", 0x0300, 0x0100, CRC(906612b5) SHA1(7b727a6200c088538180758320ede84aa7e5b96d) ) /* char lookup table */ + ROM_LOAD( "g-06.14a", 0x0400, 0x0100, CRC(4a9da18b) SHA1(fed3b81b56aab2ed0a21ed1fcebe3f1ae095a13b) ) /* tile lookup table */ + ROM_LOAD( "g-07.15a", 0x0500, 0x0100, CRC(cb9394fc) SHA1(8ad0fde6a8ef8326d2da4b6dbf3b51f5f6c668c8) ) /* tile palette bank */ + ROM_LOAD( "g-09.09f", 0x0600, 0x0100, CRC(3cee181e) SHA1(3f95bdb12391cb9b3673191bda8d09c84b36b4d3) ) /* sprite lookup table */ + ROM_LOAD( "g-08.08f", 0x0700, 0x0100, CRC(ef91cdd2) SHA1(90b9191c9f10a153d64055a4238eb6e15b8c12bc) ) /* sprite palette bank */ + ROM_LOAD( "g-10.02j", 0x0800, 0x0100, CRC(0eaf5158) SHA1(bafd4108708f66cd7b280e47152b108f3e254fc9) ) /* video timing (not used) */ + ROM_LOAD( "g-05.01f", 0x0900, 0x0100, CRC(25c90c2a) SHA1(42893572bab757ec01e181fc418cb911638d37e0) ) /* priority? (not used) */ ROM_END /* Game Drivers */ @@ -589,5 +640,6 @@ ROM_END GAME( 1985, gunsmoke, 0, gunsmoke, gunsmoke, driver_device, 0, ROT270, "Capcom", "Gun.Smoke (World, 851115)", MACHINE_SUPPORTS_SAVE ) // GSE_03 GAME( 1985, gunsmokeb, gunsmoke, gunsmoke, gunsmoke, driver_device, 0, ROT270, "bootleg", "Gun.Smoke (World, 851115) (bootleg)", MACHINE_SUPPORTS_SAVE ) // based on above version, warning message patched out GAME( 1985, gunsmokej, gunsmoke, gunsmoke, gunsmoke, driver_device, 0, ROT270, "Capcom", "Gun.Smoke (Japan, 851115)", MACHINE_SUPPORTS_SAVE ) // GSJ_03 -GAME( 1985, gunsmokeu, gunsmoke, gunsmoke, gunsmoke, driver_device, 0, ROT270, "Capcom (Romstar license)", "Gun.Smoke (US, 851115)", MACHINE_SUPPORTS_SAVE ) // GSR_03 -GAME( 1986, gunsmokeua, gunsmoke, gunsmoke, gunsmokeua, driver_device, 0, ROT270, "Capcom (Romstar license)", "Gun.Smoke (US, 860408)", MACHINE_SUPPORTS_SAVE ) // GSA_03 +GAME( 1986, gunsmokeu, gunsmoke, gunsmoke, gunsmokeu, driver_device, 0, ROT270, "Capcom (Romstar license)", "Gun.Smoke (US, 860408)", MACHINE_SUPPORTS_SAVE ) // GSA_03 +GAME( 1985, gunsmokeua, gunsmoke, gunsmoke, gunsmoke, driver_device, 0, ROT270, "Capcom (Romstar license)", "Gun.Smoke (US, 851115, set 1)", MACHINE_SUPPORTS_SAVE ) // GSR_03 (03A on the chip) +GAME( 1986, gunsmokeub, gunsmoke, gunsmoke, gunsmoke, driver_device, 0, ROT270, "Capcom (Romstar license)", "Gun.Smoke (US, 851115, set 2)", MACHINE_SUPPORTS_SAVE ) // GSR_03 diff --git a/src/mame/drivers/harddriv.c b/src/mame/drivers/harddriv.c index c172cca7118..95a60fb7134 100644 --- a/src/mame/drivers/harddriv.c +++ b/src/mame/drivers/harddriv.c @@ -355,6 +355,8 @@ harddriv_state::harddriv_state(const machine_config &mconfig, const char *tag, d m_ds3dac2(*this, "ds3dac2"), m_harddriv_sound(*this, "harddriv_sound"), m_jsa(*this, "jsa"), + m_screen(*this, "screen"), + m_duartn68681(*this, "duartn68681"), m_hd34010_host_access(0), m_dsk_pio_access(0), m_msp_ram(*this, "msp_ram"), @@ -384,6 +386,11 @@ harddriv_state::harddriv_state(const machine_config &mconfig, const char *tag, d m_gsp_control_hi(*this, "gsp_control_hi"), m_gsp_paletteram_lo(*this, "gsp_palram_lo"), m_gsp_paletteram_hi(*this, "gsp_palram_hi"), + m_in0(*this, "IN0"), + m_sw1(*this, "SW1"), + m_a80000(*this, "a80000"), + m_8badc(*this, "8BADC"), + m_12badc(*this, "12BADC"), m_irq_state(0), m_gsp_irq_state(0), m_msp_irq_state(0), @@ -499,9 +506,18 @@ class harddriv_new_state : public driver_device public: harddriv_new_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) + , m_mainpcb(*this, "mainpcb") + , m_leftpcb(*this, "leftpcb") + , m_rightpcb(*this, "rightpcb") { } TIMER_DEVICE_CALLBACK_MEMBER(hack_timer); + DECLARE_WRITE_LINE_MEMBER(tx_a); + + required_device<harddriv_state> m_mainpcb; + optional_device<harddriv_state> m_leftpcb; + optional_device<harddriv_state> m_rightpcb; + }; @@ -777,40 +793,40 @@ static INPUT_PORTS_START( harddriv ) PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN3 ) /* aux coin */ PORT_BIT( 0xfff8, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC0") /* b00000 - 8 bit ADC 0 - gas pedal */ + PORT_START("mainpcb:8BADC.0") /* b00000 - 8 bit ADC 0 - gas pedal */ PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(20) PORT_NAME("Gas Pedal") - PORT_START("mainpcb:8BADC1") /* b00000 - 8 bit ADC 1 - clutch pedal */ + PORT_START("mainpcb:8BADC.1") /* b00000 - 8 bit ADC 1 - clutch pedal */ PORT_BIT( 0xff, 0x00, IPT_PEDAL3 ) PORT_SENSITIVITY(25) PORT_KEYDELTA(100) PORT_NAME("Clutch Pedal") - PORT_START("mainpcb:8BADC2") /* b00000 - 8 bit ADC 2 - seat */ + PORT_START("mainpcb:8BADC.2") /* b00000 - 8 bit ADC 2 - seat */ PORT_BIT( 0xff, 0x80, IPT_SPECIAL ) - PORT_START("mainpcb:8BADC3") /* b00000 - 8 bit ADC 3 - shifter lever Y */ + PORT_START("mainpcb:8BADC.3") /* b00000 - 8 bit ADC 3 - shifter lever Y */ PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(128) PORT_CODE_DEC(KEYCODE_R) PORT_CODE_INC(KEYCODE_F) PORT_NAME("Shifter Lever Y") - PORT_START("mainpcb:8BADC4") /* b00000 - 8 bit ADC 4 - shifter lever X*/ + PORT_START("mainpcb:8BADC.4") /* b00000 - 8 bit ADC 4 - shifter lever X*/ PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(128) PORT_CODE_DEC(KEYCODE_D) PORT_CODE_INC(KEYCODE_G) PORT_NAME("Shifter Lever X") - PORT_START("mainpcb:8BADC5") /* b00000 - 8 bit ADC 5 - wheel */ + PORT_START("mainpcb:8BADC.5") /* b00000 - 8 bit ADC 5 - wheel */ PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(25) PORT_KEYDELTA(5) PORT_NAME("Wheel") - PORT_START("mainpcb:8BADC6") /* b00000 - 8 bit ADC 6 - line volts */ + PORT_START("mainpcb:8BADC.6") /* b00000 - 8 bit ADC 6 - line volts */ PORT_BIT( 0xff, 0x80, IPT_SPECIAL ) - PORT_START("mainpcb:8BADC7") /* b00000 - 8 bit ADC 7 - shift force */ + PORT_START("mainpcb:8BADC.7") /* b00000 - 8 bit ADC 7 - shift force */ PORT_BIT( 0xff, 0x80, IPT_SPECIAL ) - PORT_START("mainpcb:12BADC0") /* b80000 - 12 bit ADC 0 - steering wheel */ + PORT_START("mainpcb:12BADC.0") /* b80000 - 12 bit ADC 0 - steering wheel */ PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(25) PORT_KEYDELTA(5) PORT_NAME("Steering Wheel") - PORT_START("mainpcb:12BADC1") /* b80000 - 12 bit ADC 1 - force brake */ + PORT_START("mainpcb:12BADC.1") /* b80000 - 12 bit ADC 1 - force brake */ PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_SENSITIVITY(25) PORT_KEYDELTA(40) PORT_REVERSE PORT_NAME("Force Brake") - PORT_START("mainpcb:12BADC2") /* b80000 - 12 bit ADC 2 */ + PORT_START("mainpcb:12BADC.2") /* b80000 - 12 bit ADC 2 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:12BADC3") /* b80000 - 12 bit ADC 3 */ + PORT_START("mainpcb:12BADC.3") /* b80000 - 12 bit ADC 3 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) INPUT_PORTS_END @@ -861,40 +877,40 @@ static INPUT_PORTS_START( racedriv ) PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN3 ) /* aux coin */ PORT_BIT( 0xfff8, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC0") /* b00000 - 8 bit ADC 0 - gas pedal */ + PORT_START("mainpcb:8BADC.0") /* b00000 - 8 bit ADC 0 - gas pedal */ PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(20) PORT_NAME("Gas Pedal") - PORT_START("mainpcb:8BADC1") /* b00000 - 8 bit ADC 1 - clutch pedal */ + PORT_START("mainpcb:8BADC.1") /* b00000 - 8 bit ADC 1 - clutch pedal */ PORT_BIT( 0xff, 0x00, IPT_PEDAL3 ) PORT_SENSITIVITY(25) PORT_KEYDELTA(100) PORT_NAME("Clutch Pedal") - PORT_START("mainpcb:8BADC2") /* b00000 - 8 bit ADC 2 - seat */ + PORT_START("mainpcb:8BADC.2") /* b00000 - 8 bit ADC 2 - seat */ PORT_BIT( 0xff, 0x80, IPT_SPECIAL ) - PORT_START("mainpcb:8BADC3") /* b00000 - 8 bit ADC 3 - shifter lever Y */ + PORT_START("mainpcb:8BADC.3") /* b00000 - 8 bit ADC 3 - shifter lever Y */ PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(128) PORT_CODE_DEC(KEYCODE_R) PORT_CODE_INC(KEYCODE_F) PORT_NAME("Shifter Lever Y") - PORT_START("mainpcb:8BADC4") /* b00000 - 8 bit ADC 4 - shifter lever X*/ + PORT_START("mainpcb:8BADC.4") /* b00000 - 8 bit ADC 4 - shifter lever X*/ PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(128) PORT_CODE_DEC(KEYCODE_D) PORT_CODE_INC(KEYCODE_G) PORT_NAME("Shifter Lever X") - PORT_START("mainpcb:8BADC5") /* b00000 - 8 bit ADC 5 - wheel */ + PORT_START("mainpcb:8BADC.5") /* b00000 - 8 bit ADC 5 - wheel */ PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(25) PORT_KEYDELTA(5) PORT_NAME("Wheel") - PORT_START("mainpcb:8BADC6") /* b00000 - 8 bit ADC 6 - line volts */ + PORT_START("mainpcb:8BADC.6") /* b00000 - 8 bit ADC 6 - line volts */ PORT_BIT( 0xff, 0x80, IPT_SPECIAL ) - PORT_START("mainpcb:8BADC7") /* b00000 - 8 bit ADC 7 */ + PORT_START("mainpcb:8BADC.7") /* b00000 - 8 bit ADC 7 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:12BADC0") /* b80000 - 12 bit ADC 0 - steering wheel */ + PORT_START("mainpcb:12BADC.0") /* b80000 - 12 bit ADC 0 - steering wheel */ PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(25) PORT_KEYDELTA(5) PORT_NAME("Steering Wheel") - PORT_START("mainpcb:12BADC1") /* b80000 - 12 bit ADC 1 - force brake */ + PORT_START("mainpcb:12BADC.1") /* b80000 - 12 bit ADC 1 - force brake */ PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_SENSITIVITY(25) PORT_KEYDELTA(40) PORT_REVERSE PORT_NAME("Force Brake") - PORT_START("mainpcb:12BADC2") /* b80000 - 12 bit ADC 2 */ + PORT_START("mainpcb:12BADC.2") /* b80000 - 12 bit ADC 2 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:12BADC3") /* b80000 - 12 bit ADC 3 */ + PORT_START("mainpcb:12BADC.3") /* b80000 - 12 bit ADC 3 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) INPUT_PORTS_END @@ -991,39 +1007,39 @@ static INPUT_PORTS_START( racedrivc ) PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_SPECIAL ) /* center edge on steering wheel */ PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC0") /* b00000 - 8 bit ADC 0 - gas pedal */ + PORT_START("mainpcb:8BADC.0") /* b00000 - 8 bit ADC 0 - gas pedal */ PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(20) PORT_NAME("Gas Pedal") - PORT_START("mainpcb:8BADC1") /* b00000 - 8 bit ADC 1 - clutch pedal */ + PORT_START("mainpcb:8BADC.1") /* b00000 - 8 bit ADC 1 - clutch pedal */ PORT_BIT( 0xff, 0x00, IPT_PEDAL3 ) PORT_SENSITIVITY(25) PORT_KEYDELTA(100) PORT_NAME("Clutch Pedal") - PORT_START("mainpcb:8BADC2") /* b00000 - 8 bit ADC 2 */ + PORT_START("mainpcb:8BADC.2") /* b00000 - 8 bit ADC 2 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC3") /* b00000 - 8 bit ADC 3 */ + PORT_START("mainpcb:8BADC.3") /* b00000 - 8 bit ADC 3 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC4") /* b00000 - 8 bit ADC 4 */ + PORT_START("mainpcb:8BADC.4") /* b00000 - 8 bit ADC 4 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC5") /* b00000 - 8 bit ADC 5 */ + PORT_START("mainpcb:8BADC.5") /* b00000 - 8 bit ADC 5 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC6") /* b00000 - 8 bit ADC 6 - force brake */ + PORT_START("mainpcb:8BADC.6") /* b00000 - 8 bit ADC 6 - force brake */ PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_SENSITIVITY(25) PORT_KEYDELTA(40) PORT_REVERSE PORT_NAME("Force Brake") - PORT_START("mainpcb:8BADC7") /* b00000 - 8 bit ADC 7 */ + PORT_START("mainpcb:8BADC.7") /* b00000 - 8 bit ADC 7 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:12BADC0") /* 400000 - steering wheel */ + PORT_START("mainpcb:12BADC.0") /* 400000 - steering wheel */ PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(25) PORT_KEYDELTA(5) PORT_NAME("Steering Wheel") /* dummy ADC ports to end up with the same number as the full version */ - PORT_START("mainpcb:12BADC1") + PORT_START("mainpcb:12BADC.1") PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:12BADC2") + PORT_START("mainpcb:12BADC.2") PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:12BADC3") + PORT_START("mainpcb:12BADC.3") PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) INPUT_PORTS_END @@ -1073,40 +1089,40 @@ static INPUT_PORTS_START( stunrun ) PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_START1 ) PORT_BIT( 0xfff8, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC0") /* b00000 - 8 bit ADC 0 */ + PORT_START("mainpcb:8BADC.0") /* b00000 - 8 bit ADC 0 */ PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) - PORT_START("mainpcb:8BADC1") /* b00000 - 8 bit ADC 1 */ + PORT_START("mainpcb:8BADC.1") /* b00000 - 8 bit ADC 1 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC2") /* b00000 - 8 bit ADC 2 */ + PORT_START("mainpcb:8BADC.2") /* b00000 - 8 bit ADC 2 */ PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) - PORT_START("mainpcb:8BADC3") /* b00000 - 8 bit ADC 3 */ + PORT_START("mainpcb:8BADC.3") /* b00000 - 8 bit ADC 3 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC4") /* b00000 - 8 bit ADC 4 */ + PORT_START("mainpcb:8BADC.4") /* b00000 - 8 bit ADC 4 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC5") /* b00000 - 8 bit ADC 5 */ + PORT_START("mainpcb:8BADC.5") /* b00000 - 8 bit ADC 5 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC6") /* b00000 - 8 bit ADC 6 */ + PORT_START("mainpcb:8BADC.6") /* b00000 - 8 bit ADC 6 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC7") /* b00000 - 8 bit ADC 7 */ + PORT_START("mainpcb:8BADC.7") /* b00000 - 8 bit ADC 7 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:12BADC0") /* b80000 - 12 bit ADC 0 */ + PORT_START("mainpcb:12BADC.0") /* b80000 - 12 bit ADC 0 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:12BADC1") /* b80000 - 12 bit ADC 1 */ + PORT_START("mainpcb:12BADC.1") /* b80000 - 12 bit ADC 1 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:12BADC2") /* b80000 - 12 bit ADC 2 */ + PORT_START("mainpcb:12BADC.2") /* b80000 - 12 bit ADC 2 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:12BADC3") /* b80000 - 12 bit ADC 3 */ + PORT_START("mainpcb:12BADC.3") /* b80000 - 12 bit ADC 3 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) /* stunrun has its own coins */ @@ -1163,40 +1179,40 @@ static INPUT_PORTS_START( steeltal ) PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Real Helicopter Flight") PORT_BIT( 0xfff0, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC0") /* b00000 - 8 bit ADC 0 */ + PORT_START("mainpcb:8BADC.0") /* b00000 - 8 bit ADC 0 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC1") /* b00000 - 8 bit ADC 1 */ + PORT_START("mainpcb:8BADC.1") /* b00000 - 8 bit ADC 1 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) /* volume control */ - PORT_START("mainpcb:8BADC2") /* b00000 - 8 bit ADC 2 */ + PORT_START("mainpcb:8BADC.2") /* b00000 - 8 bit ADC 2 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC3") /* b00000 - 8 bit ADC 3 */ + PORT_START("mainpcb:8BADC.3") /* b00000 - 8 bit ADC 3 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC4") /* b00000 - 8 bit ADC 4 */ + PORT_START("mainpcb:8BADC.4") /* b00000 - 8 bit ADC 4 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC5") /* b00000 - 8 bit ADC 5 */ + PORT_START("mainpcb:8BADC.5") /* b00000 - 8 bit ADC 5 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC6") /* b00000 - 8 bit ADC 6 */ + PORT_START("mainpcb:8BADC.6") /* b00000 - 8 bit ADC 6 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC7") /* b00000 - 8 bit ADC 7 */ + PORT_START("mainpcb:8BADC.7") /* b00000 - 8 bit ADC 7 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:12BADC0") /* b80000 - 12 bit ADC 0 */ + PORT_START("mainpcb:12BADC.0") /* b80000 - 12 bit ADC 0 */ PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) /* left/right */ - PORT_START("mainpcb:12BADC1") /* b80000 - 12 bit ADC 1 */ + PORT_START("mainpcb:12BADC.1") /* b80000 - 12 bit ADC 1 */ PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) /* up/down */ - PORT_START("mainpcb:12BADC2") /* b80000 - 12 bit ADC 2 */ + PORT_START("mainpcb:12BADC.2") /* b80000 - 12 bit ADC 2 */ PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Z ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_NAME("Collective") PORT_REVERSE /* collective */ - PORT_START("mainpcb:12BADC3") /* b80000 - 12 bit ADC 3 */ + PORT_START("mainpcb:12BADC.3") /* b80000 - 12 bit ADC 3 */ PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_NAME("Rudder") PORT_PLAYER(2) /* rudder */ /* steeltal has its own coins */ @@ -1260,39 +1276,39 @@ static INPUT_PORTS_START( strtdriv ) PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_SPECIAL ) /* center edge on steering wheel */ PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC0") /* b00000 - 8 bit ADC 0 - gas pedal */ + PORT_START("mainpcb:8BADC.0") /* b00000 - 8 bit ADC 0 - gas pedal */ PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(20) PORT_NAME("Gas Pedal") - PORT_START("mainpcb:8BADC1") /* b00000 - 8 bit ADC 1 */ + PORT_START("mainpcb:8BADC.1") /* b00000 - 8 bit ADC 1 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC2") /* b00000 - 8 bit ADC 2 - voice mic */ + PORT_START("mainpcb:8BADC.2") /* b00000 - 8 bit ADC 2 - voice mic */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC3") /* b00000 - 8 bit ADC 3 - volume */ + PORT_START("mainpcb:8BADC.3") /* b00000 - 8 bit ADC 3 - volume */ PORT_BIT( 0xff, 0X80, IPT_UNUSED ) - PORT_START("mainpcb:8BADC4") /* b00000 - 8 bit ADC 4 - elevator */ + PORT_START("mainpcb:8BADC.4") /* b00000 - 8 bit ADC 4 - elevator */ PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_NAME("Elevator") PORT_REVERSE /* up/down */ - PORT_START("mainpcb:8BADC5") /* b00000 - 8 bit ADC 5 - canopy */ + PORT_START("mainpcb:8BADC.5") /* b00000 - 8 bit ADC 5 - canopy */ PORT_BIT( 0xff, 0X80, IPT_UNUSED ) - PORT_START("mainpcb:8BADC6") /* b00000 - 8 bit ADC 6 - brake */ + PORT_START("mainpcb:8BADC.6") /* b00000 - 8 bit ADC 6 - brake */ PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_SENSITIVITY(25) PORT_KEYDELTA(40) PORT_NAME("Brake") PORT_REVERSE - PORT_START("mainpcb:8BADC7") /* b00000 - 8 bit ADC 7 - seat adjust */ + PORT_START("mainpcb:8BADC.7") /* b00000 - 8 bit ADC 7 - seat adjust */ PORT_BIT( 0xff, 0X80, IPT_UNUSED ) - PORT_START("mainpcb:12BADC0") /* 400000 - steering wheel */ + PORT_START("mainpcb:12BADC.0") /* 400000 - steering wheel */ PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(25) PORT_KEYDELTA(5) PORT_NAME("Steering Wheel") /* dummy ADC ports to end up with the same number as the full version */ - PORT_START("mainpcb:12BADC1") /* FAKE */ + PORT_START("mainpcb:12BADC.1") /* FAKE */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:12BADC2") /* FAKE */ + PORT_START("mainpcb:12BADC.2") /* FAKE */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:12BADC3") /* FAKE */ + PORT_START("mainpcb:12BADC.3") /* FAKE */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) INPUT_PORTS_END @@ -1350,39 +1366,39 @@ static INPUT_PORTS_START( hdrivair ) PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_SPECIAL ) /* center edge on steering wheel */ PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC0") /* b00000 - 8 bit ADC 0 - gas pedal */ + PORT_START("mainpcb:8BADC.0") /* b00000 - 8 bit ADC 0 - gas pedal */ PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(20) PORT_NAME("Gas Pedal") - PORT_START("mainpcb:8BADC1") /* b00000 - 8 bit ADC 1 */ + PORT_START("mainpcb:8BADC.1") /* b00000 - 8 bit ADC 1 */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC2") /* b00000 - 8 bit ADC 2 - voice mic */ + PORT_START("mainpcb:8BADC.2") /* b00000 - 8 bit ADC 2 - voice mic */ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:8BADC3") /* b00000 - 8 bit ADC 3 - volume */ + PORT_START("mainpcb:8BADC.3") /* b00000 - 8 bit ADC 3 - volume */ PORT_BIT( 0xff, 0X80, IPT_UNUSED ) - PORT_START("mainpcb:8BADC4") /* b00000 - 8 bit ADC 4 - elevator */ + PORT_START("mainpcb:8BADC.4") /* b00000 - 8 bit ADC 4 - elevator */ PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_REVERSE PORT_NAME("Elevator") /* up/down */ - PORT_START("mainpcb:8BADC5") /* b00000 - 8 bit ADC 5 - canopy */ + PORT_START("mainpcb:8BADC.5") /* b00000 - 8 bit ADC 5 - canopy */ PORT_BIT( 0xff, 0X80, IPT_UNUSED ) - PORT_START("mainpcb:8BADC6") /* b00000 - 8 bit ADC 6 - brake */ + PORT_START("mainpcb:8BADC.6") /* b00000 - 8 bit ADC 6 - brake */ PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_SENSITIVITY(25) PORT_KEYDELTA(40) PORT_REVERSE PORT_NAME("Brake") - PORT_START("mainpcb:8BADC7") /* b00000 - 8 bit ADC 7 - seat adjust */ + PORT_START("mainpcb:8BADC.7") /* b00000 - 8 bit ADC 7 - seat adjust */ PORT_BIT( 0xff, 0X80, IPT_UNUSED ) - PORT_START("mainpcb:12BADC0") /* 400000 - steering wheel */ + PORT_START("mainpcb:12BADC.0") /* 400000 - steering wheel */ PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(25) PORT_KEYDELTA(5) PORT_REVERSE PORT_NAME("Steering Wheel") /* dummy ADC ports to end up with the same number as the full version */ - PORT_START("mainpcb:12BADC1") + PORT_START("mainpcb:12BADC.1") PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:12BADC2") + PORT_START("mainpcb:12BADC.2") PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("mainpcb:12BADC3") + PORT_START("mainpcb:12BADC.3") PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) INPUT_PORTS_END @@ -1986,13 +2002,11 @@ static MACHINE_CONFIG_START( steeltalp_machine, harddriv_new_state ) MCFG_DEVICE_ADD("mainpcb", STEELTALP_BOARD_DEVICE, 0) MACHINE_CONFIG_END -WRITE_LINE_MEMBER(racedriv_board_device_state::tx_a) +WRITE_LINE_MEMBER(harddriv_new_state::tx_a) { // passive connection, one way, to both screens - mc68681_device* left = machine().device<mc68681_device>(":leftpcb:duartn68681"); - mc68681_device* right = machine().device<mc68681_device>(":rightpcb:duartn68681"); - left->rx_a_w(state); - right->rx_a_w(state); + m_leftpcb->m_duartn68681->rx_a_w(state); + m_rightpcb->m_duartn68681->rx_a_w(state); } static MACHINE_CONFIG_START( racedriv_panorama_machine, harddriv_new_state ) @@ -2002,7 +2016,7 @@ static MACHINE_CONFIG_START( racedriv_panorama_machine, harddriv_new_state ) // MCFG_QUANTUM_TIME(attotime::from_hz(100000)) MCFG_DEVICE_MODIFY("mainpcb:duartn68681") - MCFG_MC68681_A_TX_CALLBACK(WRITELINE(racedriv_board_device_state,tx_a )) + MCFG_MC68681_A_TX_CALLBACK(DEVWRITELINE(DEVICE_SELF_OWNER, harddriv_new_state,tx_a)) MCFG_TIMER_DRIVER_ADD_PERIODIC("hack_timer", harddriv_new_state, hack_timer, attotime::from_hz(60)) // MCFG_QUANTUM_TIME(attotime::from_hz(60000)) @@ -2012,13 +2026,9 @@ MACHINE_CONFIG_END // by forcing them to stay in sync using this ugly method everything works much better. TIMER_DEVICE_CALLBACK_MEMBER(harddriv_new_state::hack_timer) { - screen_device* middle = machine().device<screen_device>(":mainpcb:screen"); - screen_device* left = machine().device<screen_device>(":leftpcb:screen"); - screen_device* right = machine().device<screen_device>(":rightpcb:screen"); - - left->reset_origin(0, 0); - middle->reset_origin(0, 0); - right->reset_origin(0, 0); + m_leftpcb->m_screen->reset_origin(0, 0); + m_mainpcb->m_screen->reset_origin(0, 0); + m_rightpcb->m_screen->reset_origin(0, 0); } /************************************* diff --git a/src/mame/drivers/hng64.c b/src/mame/drivers/hng64.c index 83a5fc202c2..c0c8cc70c10 100644 --- a/src/mame/drivers/hng64.c +++ b/src/mame/drivers/hng64.c @@ -503,20 +503,6 @@ READ8_MEMBER(hng64_state::hng64_com_share_r) return m_com_shared[offset]; } -WRITE32_MEMBER(hng64_state::hng64_pal_w) -{ - UINT32 *paletteram = m_generic_paletteram_32; - int r, g, b/*, a*/; - - COMBINE_DATA(&paletteram[offset]); - - b = ((paletteram[offset] & 0x000000ff) >>0); - g = ((paletteram[offset] & 0x0000ff00) >>8); - r = ((paletteram[offset] & 0x00ff0000) >>16); - //a = ((paletteram[offset] & 0xff000000) >>24); - m_palette->set_pen_color(offset,rgb_t(r,g,b)); -} - READ32_MEMBER(hng64_state::hng64_sysregs_r) { UINT16 rtc_addr; @@ -827,7 +813,7 @@ WRITE32_MEMBER(hng64_state::tcram_w) m_screen_dis = 0; visarea.set(min_x, min_x + max_x - 1, min_y, min_y + max_y - 1); - m_screen->configure(HTOTAL, VTOTAL, visarea, m_screen->frame_period().attoseconds ); + m_screen->configure(HTOTAL, VTOTAL, visarea, m_screen->frame_period().attoseconds() ); } } @@ -983,7 +969,7 @@ static ADDRESS_MAP_START( hng_map, AS_PROGRAM, 32, hng64_state ) AM_RANGE(0x20010000, 0x20010013) AM_RAM AM_SHARE("spriteregs") AM_RANGE(0x20100000, 0x2017ffff) AM_RAM_WRITE(hng64_videoram_w) AM_SHARE("videoram") // Tilemap AM_RANGE(0x20190000, 0x20190037) AM_RAM_WRITE(hng64_vregs_w) AM_SHARE("videoregs") - AM_RANGE(0x20200000, 0x20203fff) AM_RAM_WRITE(hng64_pal_w) AM_SHARE("paletteram") + AM_RANGE(0x20200000, 0x20203fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0x20208000, 0x2020805f) AM_READWRITE(tcram_r, tcram_w) AM_SHARE("tcram") // Transition Control AM_RANGE(0x20300000, 0x203001ff) AM_WRITE16(dl_w,0xffffffff) // 3d Display List AM_RANGE(0x20300200, 0x20300203) AM_WRITE(dl_upload_w) // 3d Display List Upload @@ -1581,6 +1567,7 @@ static MACHINE_CONFIG_START(hng64, hng64_state) MCFG_SCREEN_VBLANK_DRIVER(hng64_state, screen_eof_hng64) MCFG_PALETTE_ADD("palette", 0x1000) + MCFG_PALETTE_FORMAT(XRGB) MCFG_FRAGMENT_ADD( hng64_audio ) MCFG_FRAGMENT_ADD( hng64_network ) diff --git a/src/mame/drivers/igs_m027.c b/src/mame/drivers/igs_m027.c index 9a3fb5ef665..fbaaee1b032 100644 --- a/src/mame/drivers/igs_m027.c +++ b/src/mame/drivers/igs_m027.c @@ -67,6 +67,7 @@ public: DECLARE_DRIVER_INIT(klxyj); DECLARE_DRIVER_INIT(fearless); DECLARE_DRIVER_INIT(slqz3); + DECLARE_DRIVER_INIT(fruitpar); TILE_GET_INFO_MEMBER(get_tx_tilemap_tile_info); TILE_GET_INFO_MEMBER(get_bg_tilemap_tile_info); virtual void video_start(); @@ -454,7 +455,7 @@ IGS PCB-0239-11-EE | | | | | 62256 IGS027A | -| | +| 55857G | | U29 | | 8255 | | | @@ -471,7 +472,7 @@ IGS PCB-0239-11-EE ROM_START( slqz3 ) ROM_REGION( 0x04000, "maincpu", 0 ) - /* Internal rom of IGS027A ARM based MCU */ + /* Internal rom of IGS027A type G ARM based MCU */ ROM_LOAD( "slqz3_igs027a", 0x00000, 0x4000, NO_DUMP ) ROM_REGION( 0x200000, "user1", 0 ) // external ARM data / prg @@ -488,6 +489,56 @@ ROM_END +/*************************************************************************** + +Fruit Paradise +IGS + +PCB Layout +---------- + +IGS PCB-0331-02-FG +|--------------------------------------------| +|PC817 7805 W4102.U28| +|ULN2004 ULN2004 TDA1020 VOL M6295 | +|ULN2004 PAL 62257 3.6VBATT| +|ULN2004 82C55 22MHz | +|ULN2004 | +|8 V214.U23 | +|L |--------| | +|I PC817(x20) |IGS027A | | +|N |--------| |55857G | | +|E M4101.U13 | | |--------| | +|R | IGS031 | | +| | | | +| TEXT.U12 |--------| | +|DSW1 | +|DSW2 ULN2004 61256 | +|DSW3 PC817(x13) PC817 PC817 | +| |--| JAMMA |--| | +|-------| |---------------------------| |--| + +***************************************************************************/ + +ROM_START( fruitpar ) + ROM_REGION( 0x04000, "maincpu", 0 ) + /* Internal rom of IGS027A type G ARM based MCU */ + ROM_LOAD( "fruitpar_igs027a", 0x00000, 0x4000, NO_DUMP ) + + ROM_REGION( 0x80000, "user1", 0 ) // external ARM data / prg + ROM_LOAD( "fruit_paradise_v214.u23", 0x00000, 0x80000, CRC(e37bc4e0) SHA1(f5580e6007dc60f32efd3b3e7e64c5ee446ede8a) ) + + ROM_REGION( 0x480000, "gfx1", 0 ) + ROM_LOAD( "igs_m4101.u13", 0x000000, 0x400000, CRC(84899398) SHA1(badac65af6e03c490798f4368eb2b15db8c590d0) ) // FIXED BITS (xxxxxxx0xxxxxxxx) + ROM_LOAD( "paradise_text.u12", 0x400000, 0x080000, CRC(bdaa4407) SHA1(845eead0902c81290c2b5d7543ac9dfda375fdd1) ) + + ROM_REGION( 0x80000, "oki", 0 ) + ROM_LOAD( "igs_w4102.u28", 0x00000, 0x80000, CRC(558cab25) SHA1(0280b37a14589329f0385c048e5742b9e89bd587) ) +ROM_END + + + + ROM_START( sdwx ) ROM_REGION( 0x04000, "maincpu", 0 ) /* Internal rom of IGS027A ARM based MCU */ @@ -1006,6 +1057,13 @@ DRIVER_INIT_MEMBER(igs_m027_state,slqz3) pgm_create_dummy_internal_arm_region(); } +DRIVER_INIT_MEMBER(igs_m027_state,fruitpar) +{ + fruitpar_decrypt(machine()); + //sdwx_gfx_decrypt(machine()); + pgm_create_dummy_internal_arm_region(); +} + /*************************************************************************** Game Drivers @@ -1013,6 +1071,7 @@ DRIVER_INIT_MEMBER(igs_m027_state,slqz3) ***************************************************************************/ GAME( 1999, slqz3, 0, igs_majhong, sdwx, igs_m027_state, slqz3, ROT0, "IGS", "Mahjong Shuang Long Qiang Zhu 3 (China, VS107C)", MACHINE_IS_SKELETON ) +GAME( 200?, fruitpar, 0, igs_majhong, sdwx, igs_m027_state, fruitpar, ROT0, "IGS", "Fruit Paradise (V214)", MACHINE_IS_SKELETON ) GAME( 2002, sdwx, 0, igs_majhong, sdwx, igs_m027_state, sdwx, ROT0, "IGS", "Sheng Dan Wu Xian", MACHINE_IS_SKELETON ) // aka Christmas 5 Line? GAME( 200?, sddz, 0, igs_majhong, sdwx, igs_m027_state, sddz, ROT0, "IGS", "Super Dou Di Zhu", MACHINE_IS_SKELETON ) GAME( 2000, zhongguo, 0, igs_majhong, sdwx, igs_m027_state, zhongguo, ROT0, "IGS", "Zhong Guo Chu Da D", MACHINE_IS_SKELETON ) diff --git a/src/mame/drivers/iteagle.c b/src/mame/drivers/iteagle.c index 2a46dddc9b4..d277082c207 100644 --- a/src/mame/drivers/iteagle.c +++ b/src/mame/drivers/iteagle.c @@ -7,18 +7,18 @@ by Ted Green & R. Belmont Known games on this hardware and their security chip IDs: + * ITVP-1 (c) 1998 Virtual Pool * E2-LED0 (c) 2000 Golden Tee Fore! * E2-BBH0 (c) 2000 Big Buck Hunter * G42-US-U (c) 2001 Golden Tee Fore! 2002 * BB15-US (c) 2002 Big Buck Hunter: Shooter's Challenge (AKA Big Buck Hunter v1.5) * BBH2-US (c) 2002 Big Buck Hunter II: Sportsman's Paradise - * CK1-US (C) 2002 Carnival King + * CK1-US (c) 2002 Carnival King * G43-US-U (c) 2002 Golden Tee Fore! 2003 * G44-US-U (c) 2003 Golden Tee Fore! 2004 * G45-US-U (c) 2004 Golden Tee Fore! 2005 * CW-US-U (c) 2005 Big Buck Hunter: Call of the Wild * G4C-US-U (c) 2006 Golden Tee Complete - * ???????? (c) ???? Virtual Pool (not on IT's website master list but known to exist) Valid regions: US = USA, CAN = Canada, ENG = England, EUR = Euro, SWD = Sweden, AUS = Australia, NZ = New Zealand, SA = South Africa @@ -246,7 +246,7 @@ static MACHINE_CONFIG_DERIVED( virtpool, iteagle ) MCFG_VOODOO_PCI_FBMEM(4) MCFG_VOODOO_PCI_TMUMEM(4, 4) MCFG_DEVICE_MODIFY(PCI_ID_FPGA) - MCFG_ITEAGLE_FPGA_INIT(0x01000202, 0x0c0b0d) + MCFG_ITEAGLE_FPGA_INIT(0x01000202, 0x080808) MCFG_DEVICE_MODIFY(PCI_ID_EEPROM) MCFG_ITEAGLE_EEPROM_INIT(0x0202, 0x7) MACHINE_CONFIG_END @@ -556,7 +556,7 @@ ROM_END *************************************/ GAME( 2000, iteagle, 0, iteagle, iteagle, driver_device, 0, ROT0, "Incredible Technologies", "Eagle BIOS", MACHINE_IS_BIOS_ROOT ) -GAME( 1998, virtpool, iteagle, virtpool, virtpool, driver_device, 0, ROT0, "Incredible Technologies", "Virtual Pool", MACHINE_NOT_WORKING ) +GAME( 1998, virtpool, iteagle, virtpool, virtpool, driver_device, 0, ROT0, "Incredible Technologies", "Virtual Pool", 0 ) GAME( 2002, carnking, iteagle, carnking, iteagle, driver_device, 0, ROT0, "Incredible Technologies", "Carnival King (v1.00.11)", MACHINE_NOT_WORKING ) GAME( 2000, gtfore01, iteagle, gtfore01, iteagle, driver_device, 0, ROT0, "Incredible Technologies", "Golden Tee Fore! (v1.00.25)", 0 ) GAME( 2001, gtfore02, iteagle, gtfore02, iteagle, driver_device, 0, ROT0, "Incredible Technologies", "Golden Tee Fore! 2002 (v2.01.06)", 0 ) diff --git a/src/mame/drivers/itech8.c b/src/mame/drivers/itech8.c index ca3596935ff..4c275d7ceb8 100644 --- a/src/mame/drivers/itech8.c +++ b/src/mame/drivers/itech8.c @@ -504,7 +504,6 @@ #include "machine/6821pia.h" #include "machine/6522via.h" #include "machine/nvram.h" -#include "machine/ticket.h" #include "includes/itech8.h" #include "sound/2203intf.h" #include "sound/2608intf.h" @@ -519,6 +518,8 @@ +IOPORT_ARRAY_MEMBER(itech8_state::analog_inputs) { "AN_C", "AN_D", "AN_E", "AN_F" }; + /************************************* * * Interrupt handling @@ -747,7 +748,7 @@ WRITE8_MEMBER(itech8_state::pia_portb_out) /* bit 5 controls the coin counter */ /* bit 6 controls the diagnostic sound LED */ m_pia_portb_data = data; - machine().device<ticket_dispenser_device>("ticket")->write(space, 0, (data & 0x10) << 3); + m_ticket->write(space, 0, (data & 0x10) << 3); coin_counter_w(machine(), 0, (data & 0x20) >> 5); } @@ -761,7 +762,7 @@ WRITE8_MEMBER(itech8_state::ym2203_portb_out) /* bit 6 controls the diagnostic sound LED */ /* bit 7 controls the ticket dispenser */ m_pia_portb_data = data; - machine().device<ticket_dispenser_device>("ticket")->write(machine().driver_data()->generic_space(), 0, data & 0x80); + m_ticket->write(machine().driver_data()->generic_space(), 0, data & 0x80); coin_counter_w(machine(), 0, (data & 0x20) >> 5); } diff --git a/src/mame/drivers/jack.c b/src/mame/drivers/jack.c index 81acce89abf..c8f3340e2d6 100644 --- a/src/mame/drivers/jack.c +++ b/src/mame/drivers/jack.c @@ -186,7 +186,7 @@ static ADDRESS_MAP_START( jack_map, AS_PROGRAM, 8, jack_state ) AM_RANGE(0xb504, 0xb504) AM_READ_PORT("IN2") AM_RANGE(0xb505, 0xb505) AM_READ_PORT("IN3") AM_RANGE(0xb506, 0xb507) AM_READWRITE(jack_flipscreen_r, jack_flipscreen_w) - AM_RANGE(0xb600, 0xb61f) AM_WRITE(jack_paletteram_w) AM_SHARE("palette") + AM_RANGE(0xb600, 0xb61f) AM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0xb800, 0xbbff) AM_RAM_WRITE(jack_videoram_w) AM_SHARE("videoram") AM_RANGE(0xbc00, 0xbfff) AM_RAM_WRITE(jack_colorram_w) AM_SHARE("colorram") AM_RANGE(0xc000, 0xffff) AM_ROM @@ -922,7 +922,7 @@ static MACHINE_CONFIG_START( jack, jack_state ) MCFG_GFXDECODE_ADD("gfxdecode", "palette", jack) MCFG_PALETTE_ADD("palette", 32) - MCFG_PALETTE_FORMAT(BBGGGRRR) + MCFG_PALETTE_FORMAT(BBGGGRRR_inverted) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") @@ -979,10 +979,9 @@ static MACHINE_CONFIG_DERIVED( joinem, jack ) MCFG_GFXDECODE_MODIFY("gfxdecode", joinem) - MCFG_PALETTE_MODIFY("palette") - MCFG_PALETTE_ENTRIES(0x40) - MCFG_PALETTE_INIT_OWNER(jack_state,joinem) - MCFG_PALETTE_FORMAT(BBGGGRRR) + MCFG_DEVICE_REMOVE("palette") + MCFG_PALETTE_ADD("palette", 64) + MCFG_PALETTE_INIT_OWNER(jack_state, joinem) MCFG_VIDEO_START_OVERRIDE(jack_state,joinem) MACHINE_CONFIG_END @@ -999,7 +998,7 @@ static MACHINE_CONFIG_DERIVED( unclepoo, joinem ) MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1) MCFG_PALETTE_MODIFY("palette") - MCFG_PALETTE_ENTRIES(0x100) + MCFG_PALETTE_ENTRIES(256) MACHINE_CONFIG_END diff --git a/src/mame/drivers/jollyjgr.c b/src/mame/drivers/jollyjgr.c index b45d3f18d57..c02763727e2 100644 --- a/src/mame/drivers/jollyjgr.c +++ b/src/mame/drivers/jollyjgr.c @@ -116,7 +116,8 @@ public: m_bulletram(*this, "bulletram"), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_bm_palette(*this, "bm_palette") { } /* memory pointers */ required_shared_ptr<UINT8> m_videoram; @@ -144,13 +145,14 @@ public: virtual void machine_reset(); virtual void video_start(); DECLARE_PALETTE_INIT(jollyjgr); - UINT32 screen_update_jollyjgr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - UINT32 screen_update_fspider(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + UINT32 screen_update_jollyjgr(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + UINT32 screen_update_fspider(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(jollyjgr_interrupt); - void draw_bitmap( bitmap_ind16 &bitmap ); + void draw_bitmap( bitmap_rgb32 &bitmap ); required_device<cpu_device> m_maincpu; required_device<gfxdecode_device> m_gfxdecode; required_device<palette_device> m_palette; + required_device<palette_device> m_bm_palette; }; @@ -415,13 +417,12 @@ INPUT_PORTS_END * *************************************/ +/* tilemap / sprites palette */ PALETTE_INIT_MEMBER(jollyjgr_state, jollyjgr) { const UINT8 *color_prom = memregion("proms")->base(); - int i; - /* tilemap / sprites palette */ - for (i = 0; i < 32; i++) + for (int i = 0; i < 32; i++) { int bit0, bit1, bit2, r, g, b; @@ -443,10 +444,6 @@ PALETTE_INIT_MEMBER(jollyjgr_state, jollyjgr) palette.set_pen_color(i, rgb_t(r,g,b)); color_prom++; } - - /* bitmap palette */ - for (i = 0;i < 8;i++) - palette.set_pen_color(32 + i, pal1bit(i >> 0), pal1bit(i >> 1), pal1bit(i >> 2)); } /* Tilemap is the same as in Galaxian */ @@ -465,7 +462,7 @@ void jollyjgr_state::video_start() m_bg_tilemap->set_scroll_cols(32); } -void jollyjgr_state::draw_bitmap( bitmap_ind16 &bitmap ) +void jollyjgr_state::draw_bitmap( bitmap_rgb32 &bitmap ) { int x, y, count; int i, bit0, bit1, bit2; @@ -486,13 +483,13 @@ void jollyjgr_state::draw_bitmap( bitmap_ind16 &bitmap ) if(color) { if(m_flip_x && m_flip_y) - bitmap.pix16(y, x * 8 + i) = color + 32; + bitmap.pix32(y, x * 8 + i) = m_bm_palette->pen_color(color); else if(m_flip_x && !m_flip_y) - bitmap.pix16(255 - y, x * 8 + i) = color + 32; + bitmap.pix32(255 - y, x * 8 + i) = m_bm_palette->pen_color(color); else if(!m_flip_x && m_flip_y) - bitmap.pix16(y, 255 - x * 8 - i) = color + 32; + bitmap.pix32(y, 255 - x * 8 - i) = m_bm_palette->pen_color(color); else - bitmap.pix16(255 - y, 255 - x * 8 - i) = color + 32; + bitmap.pix32(255 - y, 255 - x * 8 - i) = m_bm_palette->pen_color(color); } } @@ -501,12 +498,12 @@ void jollyjgr_state::draw_bitmap( bitmap_ind16 &bitmap ) } } -UINT32 jollyjgr_state::screen_update_jollyjgr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +UINT32 jollyjgr_state::screen_update_jollyjgr(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { UINT8 *spriteram = m_spriteram; int offs; - bitmap.fill(32, cliprect); + bitmap.fill(m_bm_palette->pen_color(0), cliprect); if(m_pri) //used in Frog & Spiders level 3 { @@ -556,7 +553,7 @@ UINT32 jollyjgr_state::screen_update_jollyjgr(screen_device &screen, bitmap_ind1 return 0; } -UINT32 jollyjgr_state::screen_update_fspider(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +UINT32 jollyjgr_state::screen_update_fspider(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { // Draw bg and sprites screen_update_jollyjgr(screen, bitmap, cliprect); @@ -569,8 +566,8 @@ UINT32 jollyjgr_state::screen_update_fspider(screen_device &screen, bitmap_ind16 UINT8 sy=~m_bulletram[offs]; UINT8 sx=~m_bulletram[offs|1]; UINT16 bc=(offs<4)? - 32+7: // player, white - 32+3; // enemy, yellow + 7: // player, white + 3; // enemy, yellow if (m_flip_y) sy^=0xff; if (m_flip_x) sx+=8; @@ -578,7 +575,7 @@ UINT32 jollyjgr_state::screen_update_fspider(screen_device &screen, bitmap_ind16 if (sy>=cliprect.min_y && sy<=cliprect.max_y) for (int x=sx-4;x<sx;x++) if (x>=cliprect.min_x && x<=cliprect.max_x) - bitmap.pix16(sy, x)=bc; + bitmap.pix32(sy, x) = m_bm_palette->pen_color(bc); } return 0; @@ -653,13 +650,11 @@ void jollyjgr_state::machine_reset() } static MACHINE_CONFIG_START( jollyjgr, jollyjgr_state ) - /* basic machine hardware */ MCFG_CPU_ADD("maincpu", Z80, 3579545) /* 3,579545 MHz */ MCFG_CPU_PROGRAM_MAP(jollyjgr_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", jollyjgr_state, jollyjgr_interrupt) - /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -667,11 +662,11 @@ static MACHINE_CONFIG_START( jollyjgr, jollyjgr_state ) MCFG_SCREEN_SIZE(256, 256) MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) MCFG_SCREEN_UPDATE_DRIVER(jollyjgr_state, screen_update_jollyjgr) - MCFG_SCREEN_PALETTE("palette") MCFG_GFXDECODE_ADD("gfxdecode", "palette", jollyjgr) - MCFG_PALETTE_ADD("palette", 32+8) /* 32 for tilemap and sprites + 8 for the bitmap */ + MCFG_PALETTE_ADD("palette", 32) // tilemap and sprites MCFG_PALETTE_INIT_OWNER(jollyjgr_state, jollyjgr) + MCFG_PALETTE_ADD_3BIT_RGB("bm_palette") // bitmap /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") @@ -681,13 +676,11 @@ static MACHINE_CONFIG_START( jollyjgr, jollyjgr_state ) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( fspider, jollyjgr ) - MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(fspider_map) MCFG_SCREEN_MODIFY("screen") MCFG_SCREEN_UPDATE_DRIVER(jollyjgr_state, screen_update_fspider) - MACHINE_CONFIG_END /************************************* diff --git a/src/mame/drivers/joystand.c b/src/mame/drivers/joystand.c new file mode 100644 index 00000000000..338d3282592 --- /dev/null +++ b/src/mame/drivers/joystand.c @@ -0,0 +1,687 @@ +// license:BSD-3-Clause +// copyright-holders:Luca Elia +/*************************************************************************** + +Joy Stand Private +Yuvo 1999 (31st October, 1999) + +driver by Luca Elia + +This is a sticker machine with camera, printer and light pen. + +PCB Layout +---------- + +Main board + +JSP-NM515 +|---------------------------------------------------------| +|TA8201A POWER-IN TD62083 TD62083 CONTROL | +| JRC3404 D71055 D71055 T531A| +|SP JRC3404 CN10 | +|VR2 JRC3404 JSP001 JSP-FRM JSP003B TC551001| +|VR1 M6295 JSP-MAP | +|CAM-IN JRC2235 JSP002 C46M1 TMP68301 JSP004B TC551001| +|PRN-IN JRC2233 YM2413 | +|VR3 JRC3404 JSP-XCT | +|VR4 16MHz 32.767kHz| +|VR5 SONY_A1585Q M548262 M548262 M6242B| +| 3.579545MHz M548262 M548262 3V_BATT| +| JRC2240 D6951 M548262 M548262 | +|RGB-OUT D6951 M548262 M548262 JACK| +| D6951 XC3042A | +| SONY_CXA1645M KM68257 KM68257 JRC2903 | +|SV-OUT D6901 LIGHTPEN| +| JRC2244 D6901 XC3030A XC3030A XC3030A | +| JRC2244 D6901 CN11 PRN_CONT| +|---------------------------------------------------------| +Notes: + Main CPU is Toshiba TMP68301 @ 16MHz + No custom chips, using only Xilinx XC30xx FPGA + Sound Oki M6295 @ 1MHz [16/16], YM2413 @ 3.579545MHz + PALs type PALCE16V8H + EPROMs are 27C040/27C020 + CN10/11 - Connector for sub-board + Many other connectors for camera, printer, lightpen etc. + + +Sub board + +JSP-NS515 +MODEL-NP001 +9.10.31 +|-------------------------------| +| J2 | +| | +| JSP-SUB | +| | +| |-| |-| | +|JSP005 JSP007A | | | | | +| | | | | | +| | | | | | +| | | | | | +|JSP006 JSP008A | | | | | +| | | | | | +| |-| |-| | +| J1 | +|-------------------------------| + + +Cart board + +NS514-F040DD +|---------------------| +| U1 U2 U3 U4 U5 U6 | +| | +| U7 U8 U9 U10 U11 U12| +| | +-| |-| + |------------------| + Notes: + U* - TMS29F040 (TSOP32, x12) + + +Notes: + +- To unlock some hidden items in test mode, go in the option menu and move: + left, right, left, left + +***************************************************************************/ + +#include "emu.h" +#include "cpu/m68000/m68000.h" +#include "machine/tmp68301.h" +#include "machine/msm6242.h" +#include "machine/eepromser.h" +#include "machine/intelfsh.h" +#include "sound/2413intf.h" +#include "sound/okim6295.h" + +class joystand_state : public driver_device +{ +public: + joystand_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_tmp68301(*this, "tmp68301"), + m_palette(*this, "palette"), + m_bg15_palette(*this, "bg15_palette"), + m_gfxdecode(*this, "gfxdecode"), + m_eeprom(*this, "eeprom"), + m_cart_u1(*this, "cart.u1"), + m_cart_u2(*this, "cart.u2"), + m_cart_u3(*this, "cart.u3"), + m_cart_u4(*this, "cart.u4"), + m_cart_u5(*this, "cart.u5"), + m_cart_u6(*this, "cart.u6"), + m_cart_u7(*this, "cart.u7"), + m_cart_u8(*this, "cart.u8"), + m_cart_u9(*this, "cart.u9"), + m_cart_u10(*this, "cart.u10"), + m_cart_u11(*this, "cart.u11"), + m_cart_u12(*this, "cart.u12"), + m_oki(*this, "oki"), + m_bg1_ram(*this, "bg1_ram"), + m_bg2_ram(*this, "bg2_ram"), + m_bg15_0_ram(*this, "bg15_0_ram"), + m_bg15_1_ram(*this, "bg15_1_ram"), + m_scroll(*this, "scroll"), + m_enable(*this, "enable"), + m_outputs(*this, "outputs") + { } + + // devices + required_device<cpu_device> m_maincpu; + required_device<tmp68301_device> m_tmp68301; + required_device<palette_device> m_palette; + required_device<palette_device> m_bg15_palette; + required_device<gfxdecode_device> m_gfxdecode; + required_device<eeprom_serial_93cxx_device> m_eeprom; + required_device<intelfsh8_device> m_cart_u1; + required_device<intelfsh8_device> m_cart_u2; + required_device<intelfsh8_device> m_cart_u3; + required_device<intelfsh8_device> m_cart_u4; + required_device<intelfsh8_device> m_cart_u5; + required_device<intelfsh8_device> m_cart_u6; + required_device<intelfsh8_device> m_cart_u7; + required_device<intelfsh8_device> m_cart_u8; + required_device<intelfsh8_device> m_cart_u9; + required_device<intelfsh8_device> m_cart_u10; + required_device<intelfsh8_device> m_cart_u11; + required_device<intelfsh8_device> m_cart_u12; + intelfsh8_device *m_cart_flash[12]; + required_device<okim6295_device> m_oki; + + // memory pointers + required_shared_ptr<UINT16> m_bg1_ram; + required_shared_ptr<UINT16> m_bg2_ram; + required_shared_ptr<UINT16> m_bg15_0_ram; + required_shared_ptr<UINT16> m_bg15_1_ram; + required_shared_ptr<UINT16> m_scroll; + required_shared_ptr<UINT16> m_enable; + required_shared_ptr<UINT16> m_outputs; + + // tilemaps + tilemap_t *m_bg1_tmap; + tilemap_t *m_bg2_tmap; + DECLARE_WRITE16_MEMBER(bg1_w); + DECLARE_WRITE16_MEMBER(bg2_w); + TILE_GET_INFO_MEMBER(get_bg1_tile_info); + TILE_GET_INFO_MEMBER(get_bg2_tile_info); + + // r5g5b5 layers + bitmap_rgb32 m_bg15_bitmap[2]; + DECLARE_WRITE16_MEMBER(bg15_0_w); + DECLARE_WRITE16_MEMBER(bg15_1_w); + static const rgb_t BG15_TRANSPARENT; + void draw_bg15_tile(address_space &space, int x, int y, UINT16 code); + void draw_bg15_tilemap(); + bool bg15_tiles_dirty; + + // eeprom + DECLARE_READ16_MEMBER(eeprom_r); + DECLARE_WRITE16_MEMBER(eeprom_w); + + // cart + DECLARE_READ16_MEMBER(cart_r); + DECLARE_WRITE16_MEMBER(cart_w); + + // misc + DECLARE_READ16_MEMBER(fpga_r); + DECLARE_WRITE16_MEMBER(oki_bank_w); + DECLARE_READ16_MEMBER(e00000_r); + DECLARE_READ16_MEMBER(e00020_r); + DECLARE_WRITE16_MEMBER(outputs_w); + + // screen updates + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + virtual void video_start(); + + // machine + virtual void machine_start(); + virtual void machine_reset(); + INTERRUPT_GEN_MEMBER(joystand_interrupt); +}; + +const rgb_t joystand_state::BG15_TRANSPARENT = 0x99999999; + +/*************************************************************************** + + Tilemaps + +***************************************************************************/ + +TILE_GET_INFO_MEMBER(joystand_state::get_bg1_tile_info) +{ + UINT32 code = (m_bg1_ram[tile_index * 2 + 0] << 16) | m_bg1_ram[tile_index * 2 + 1]; + SET_TILE_INFO_MEMBER(0, code & 0x00ffffff, code >> 24, 0); +} + +TILE_GET_INFO_MEMBER(joystand_state::get_bg2_tile_info) +{ + UINT32 code = (m_bg2_ram[tile_index * 2 + 0] << 16) | m_bg2_ram[tile_index * 2 + 1]; + SET_TILE_INFO_MEMBER(0, code & 0x00ffffff, code >> 24, 0); +} + +WRITE16_MEMBER(joystand_state::bg1_w) +{ + COMBINE_DATA(&m_bg1_ram[offset]); + m_bg1_tmap->mark_tile_dirty(offset/2); +} + +WRITE16_MEMBER(joystand_state::bg2_w) +{ + COMBINE_DATA(&m_bg2_ram[offset]); + m_bg2_tmap->mark_tile_dirty(offset/2); +} + +/*************************************************************************** + + r5g5b5 Layers + +***************************************************************************/ + +// pixel-based +WRITE16_MEMBER(joystand_state::bg15_0_w) +{ + UINT16 val = COMBINE_DATA(&m_bg15_0_ram[offset]); + m_bg15_bitmap[0].pix32(offset >> 9, offset & 0x1ff) = (val & 0x8000) ? BG15_TRANSPARENT : m_bg15_palette->pen_color(val & 0x7fff); +} + +// tile-based +void joystand_state::draw_bg15_tile(address_space &space, int x, int y, UINT16 code) +{ + x *= 16; + y *= 16; + int srcaddr = 0x800000 + (code % (0x800 * 6)) * 16 * 16 * 2; + + for (int ty = 0; ty < 16; ++ty) + { + for (int tx = 0; tx < 16; ++tx) + { + UINT16 val = space.read_word(srcaddr + ty * 16 * 2 + tx * 2); + m_bg15_bitmap[1].pix32(y + ty , x + tx) = (val & 0x8000) ? BG15_TRANSPARENT : m_bg15_palette->pen_color(val & 0x7fff); + } + } +} + +void joystand_state::draw_bg15_tilemap() +{ + if (!bg15_tiles_dirty) + return; + + bg15_tiles_dirty = false; + + address_space &space = m_maincpu->space(AS_PROGRAM); + UINT16 *src = m_bg15_1_ram + 2/2; + for (int y = 0; y < 0x10; ++y) + { + for (int x = 0; x < 0x20; ++x) + { + draw_bg15_tile(space, x, y, *src); + src += 8/2; + } + src += 0x100/2; + } +} + +WRITE16_MEMBER(joystand_state::bg15_1_w) +{ + UINT16 code = COMBINE_DATA(&m_bg15_1_ram[offset]); + if ((offset & 0x83) == 0x01) + draw_bg15_tile(space, (offset/4) & 0x1f, offset/0x100, code); +} + +/*************************************************************************** + + Screen Update + +***************************************************************************/ + +void joystand_state::video_start() +{ + m_bg1_tmap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(joystand_state::get_bg1_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 0x40, 0x20); + m_bg2_tmap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(joystand_state::get_bg2_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 0x40, 0x40); + + m_bg1_tmap->set_transparent_pen(0xf); + m_bg2_tmap->set_transparent_pen(0xf); + + for (int i = 0; i < 2; ++i) + { + m_bg15_bitmap[i].allocate(0x200, 0x200); + m_bg15_bitmap[i].fill(BG15_TRANSPARENT); + } + + bg15_tiles_dirty = true; +} + +UINT32 joystand_state::screen_update( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect ) +{ + int layers_ctrl = -1; + +#ifdef MAME_DEBUG + if (machine().input().code_pressed(KEYCODE_Z)) + { + int msk = 0; + if (machine().input().code_pressed(KEYCODE_Q)) msk |= 1; + if (machine().input().code_pressed(KEYCODE_W)) msk |= 2; + if (machine().input().code_pressed(KEYCODE_A)) msk |= 4; + if (machine().input().code_pressed(KEYCODE_S)) msk |= 8; + if (msk != 0) layers_ctrl &= msk; + } +#endif + + m_bg1_tmap->set_scrollx(0, 0); + m_bg1_tmap->set_scrolly(0, 0); + + m_bg2_tmap->set_scrollx(0, m_scroll[0] - 0xa); + m_bg2_tmap->set_scrolly(0, m_scroll[1]); + + draw_bg15_tilemap(); + + bitmap.fill(m_palette->black_pen(), cliprect); + if (layers_ctrl & 4) copybitmap_trans(bitmap, m_bg15_bitmap[0], 0, 0, 1, 0, cliprect, BG15_TRANSPARENT); + if (layers_ctrl & 8) copybitmap_trans(bitmap, m_bg15_bitmap[1], 0, 0, 0, 0, cliprect, BG15_TRANSPARENT); + if (layers_ctrl & 1) m_bg1_tmap->draw(screen, bitmap, cliprect, 0, 0); + if (layers_ctrl & 2) m_bg2_tmap->draw(screen, bitmap, cliprect, 0, 0); + + popmessage("S0: %04X S1: %04X EN: %04X OUT: %04X", m_scroll[0], m_scroll[1], m_enable[0], m_outputs[0]); + return 0; +} + +/*************************************************************************** + + Memory Maps + +***************************************************************************/ + +READ16_MEMBER(joystand_state::fpga_r) +{ + return 0xffff; +} + +WRITE16_MEMBER(joystand_state::oki_bank_w) +{ + if (ACCESSING_BITS_0_7) + m_oki->set_bank_base(((data >> 6) & 3) * 0x40000); +} + +READ16_MEMBER(joystand_state::eeprom_r) +{ + // mask 0x0020 ? (active low) + // mask 0x0040 ? "" + return (m_eeprom->do_read() & 1) << 3; +} +WRITE16_MEMBER(joystand_state::eeprom_w) +{ + if (ACCESSING_BITS_8_15) + { + // latch the data bit + m_eeprom->di_write ( (data & 0x0004) ? ASSERT_LINE : CLEAR_LINE ); + + // reset line asserted: reset. + m_eeprom->cs_write ( (data & 0x0001) ? ASSERT_LINE : CLEAR_LINE ); + + // clock line asserted: write latch or select next bit to read + m_eeprom->clk_write( (data & 0x0002) ? ASSERT_LINE : CLEAR_LINE ); + + // mask 0x1000 ? + } +} + +WRITE16_MEMBER(joystand_state::outputs_w) +{ + COMBINE_DATA(&m_outputs[0]); + if (ACCESSING_BITS_8_15) + { + coin_counter_w(machine(), 0, BIT(data, 0)); // coin counter 1 + coin_counter_w(machine(), 1, BIT(data, 1)); // coin counter 2 + + output_set_value("blocker", BIT(data, 2)); + output_set_value("error_lamp", BIT(data, 3)); // counter error + output_set_value("photo_lamp", BIT(data, 4)); // during photo + } + if (ACCESSING_BITS_8_15) + { + output_set_value("ok_button_led", BIT(data, 8)); + output_set_value("cancel_button_led", BIT(data, 9)); + } +} + +// carts + +// copy slot +READ16_MEMBER(joystand_state::e00000_r) +{ + return ioport("COPY")->read(); +} +// master slot +READ16_MEMBER(joystand_state::e00020_r) +{ + return ioport("MASTER")->read(); +} + +READ16_MEMBER(joystand_state::cart_r) +{ + int which = offset / 0x80000; + int addr = offset & 0x7ffff; + return (m_cart_flash[which * 2 + 0]->read(addr) << 8) | m_cart_flash[which * 2 + 1]->read(addr); +} + +WRITE16_MEMBER(joystand_state::cart_w) +{ + int which = offset / 0x80000; + int addr = offset & 0x7ffff; + + if (ACCESSING_BITS_0_7) + m_cart_flash[which * 2 + 1]->write(addr, data & 0xff); + if (ACCESSING_BITS_8_15) + m_cart_flash[which * 2 + 0]->write(addr, data >> 8); + + bg15_tiles_dirty = true; +} + +static ADDRESS_MAP_START( joystand_map, AS_PROGRAM, 16, joystand_state ) + AM_RANGE(0x000000, 0x07ffff) AM_ROM + AM_RANGE(0x100000, 0x13ffff) AM_RAM + AM_RANGE(0x200000, 0x200003) AM_DEVWRITE8("ym2413", ym2413_device, write, 0x00ff) + AM_RANGE(0x200008, 0x200009) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff) + AM_RANGE(0x200010, 0x200011) AM_READ_PORT("IN0") // r/w + AM_RANGE(0x200012, 0x200013) AM_RAM_WRITE(outputs_w) AM_SHARE("outputs") // r/w + AM_RANGE(0x200014, 0x200015) AM_READWRITE(fpga_r, oki_bank_w) // r/w +// AM_RANGE(0x200016, 0x200017) // write $9190 at boot + + AM_RANGE(0x400000, 0x47ffff) AM_RAM_WRITE(bg15_0_w) AM_SHARE("bg15_0_ram") // r5g5b5 200x200 pixel-based + AM_RANGE(0x480000, 0x4fffff) AM_RAM // more rgb layers? (writes at offset 0) + AM_RANGE(0x500000, 0x57ffff) AM_RAM // "" + AM_RANGE(0x580000, 0x5fffff) AM_RAM // "" + + AM_RANGE(0x600000, 0x603fff) AM_RAM_WRITE(bg2_w) AM_SHARE("bg2_ram") + AM_RANGE(0x604000, 0x605fff) AM_RAM_WRITE(bg1_w) AM_SHARE("bg1_ram") + AM_RANGE(0x606000, 0x607fff) AM_RAM_WRITE(bg15_1_w) AM_SHARE("bg15_1_ram") // r5g5b5 200x200 tile-based + AM_RANGE(0x608000, 0x609fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") + AM_RANGE(0x60c000, 0x60c003) AM_RAM AM_SHARE("scroll") // write + AM_RANGE(0x60c00c, 0x60c00d) AM_RAM AM_SHARE("enable") // write + + AM_RANGE(0x800000, 0xdfffff) AM_READWRITE(cart_r, cart_w) // r/w (cart flash) +// AM_RANGE(0xe00080, 0xe00081) // write (bit 0 = cart? bit 1 = ? bit 3 = ?) + AM_RANGE(0xe00000, 0xe00001) AM_READ(e00000_r) // copy slot + AM_RANGE(0xe00020, 0xe00021) AM_READ(e00020_r) // master slot + + AM_RANGE(0xe80040, 0xe8005f) AM_DEVREADWRITE8("rtc", msm6242_device, read, write,0x00ff) + + AM_RANGE(0xfffc00, 0xffffff) AM_DEVREADWRITE("tmp68301", tmp68301_device, regs_r, regs_w) // TMP68301 Registers +ADDRESS_MAP_END + + +static INPUT_PORTS_START( joystand ) + // Cart status: + // mask 0x1000 -> cart flash addressing (0 = sequential, 1 = interleaved even/odd) + // mask 0x6000 == 0 -> cart present? + // mask 0x8000 -> cart ready? + + PORT_START("MASTER") + PORT_CONFNAME( 0x1000, 0x1000, "Master Flash Addressing" ) + PORT_CONFSETTING( 0x1000, "Interleaved" ) + PORT_CONFSETTING( 0x0000, "Sequential" ) + PORT_CONFNAME( 0x2000, 0x0000, "Master Slot Sense 1" ) + PORT_CONFSETTING( 0x2000, "Empty" ) + PORT_CONFSETTING( 0x0000, "Cart" ) + PORT_CONFNAME( 0x4000, 0x0000, "Master Slot Sense 2" ) + PORT_CONFSETTING( 0x4000, "Empty" ) + PORT_CONFSETTING( 0x0000, "Cart" ) + PORT_BIT( 0x8fff, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("COPY") + PORT_CONFNAME( 0x1000, 0x1000, "Copy Flash Addressing" ) + PORT_CONFSETTING( 0x1000, "Interleaved" ) + PORT_CONFSETTING( 0x0000, "Sequential" ) + PORT_CONFNAME( 0x2000, 0x2000, "Copy Slot Sense 1" ) + PORT_CONFSETTING( 0x2000, "Empty" ) + PORT_CONFSETTING( 0x0000, "Cart" ) + PORT_CONFNAME( 0x4000, 0x4000, "Copy Slot Sense 2" ) + PORT_CONFSETTING( 0x4000, "Empty" ) + PORT_CONFSETTING( 0x0000, "Cart" ) + PORT_BIT( 0x8fff, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("IN0") + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) // up + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) // down + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) // left + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) // right + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) // ok + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) // cancel + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_COIN1 ) // coin + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_SERVICE1 ) // service + PORT_SERVICE_NO_TOGGLE( 0x0400, IP_ACTIVE_LOW ) // test + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN ) +INPUT_PORTS_END + + +static const gfx_layout layout_8x8x4 = +{ + 8,8, + RGN_FRAC(1,1), + 4, + { STEP4(0, 1) }, + { STEP8(0, 4) }, + { STEP8(0, 4*8) }, + 8*8*4 +}; + +static const gfx_layout layout_16x16x8 = +{ + 16,16, + RGN_FRAC(1,1), + 8, + { STEP8(0, 1) }, + { STEP16(0, 8) }, + { STEP16(0, 8*16) }, + 16*16*8 +}; + +static GFXDECODE_START( joystand ) + GFXDECODE_ENTRY( "tiles", 0, layout_8x8x4, 0, 0x100 ) + GFXDECODE_ENTRY( "cart.u5", 0, layout_16x16x8, 0, 0x10 ) + GFXDECODE_ENTRY( "cart.u6", 0, layout_16x16x8, 0, 0x10 ) + GFXDECODE_ENTRY( "cart.u3", 0, layout_16x16x8, 0, 0x10 ) + GFXDECODE_ENTRY( "cart.u4", 0, layout_16x16x8, 0, 0x10 ) + GFXDECODE_ENTRY( "cart.u1", 0, layout_16x16x8, 0, 0x10 ) + GFXDECODE_ENTRY( "cart.u2", 0, layout_16x16x8, 0, 0x10 ) +GFXDECODE_END + + +void joystand_state::machine_start() +{ + m_cart_flash[0] = m_cart_u11; m_cart_flash[1] = m_cart_u5; + m_cart_flash[2] = m_cart_u12; m_cart_flash[3] = m_cart_u6; + m_cart_flash[4] = m_cart_u9; m_cart_flash[5] = m_cart_u3; + m_cart_flash[6] = m_cart_u10; m_cart_flash[7] = m_cart_u4; + m_cart_flash[8] = m_cart_u7; m_cart_flash[9] = m_cart_u1; + m_cart_flash[10] = m_cart_u8; m_cart_flash[11] = m_cart_u2; +} + +void joystand_state::machine_reset() +{ +} + +INTERRUPT_GEN_MEMBER(joystand_state::joystand_interrupt) +{ + // VBlank is connected to INT1 (external interrupts pin 1) + m_tmp68301->external_interrupt_1(); +} + +static MACHINE_CONFIG_START( joystand, joystand_state ) + + // basic machine hardware + MCFG_CPU_ADD("maincpu", M68000, XTAL_16MHz) // !! TMP68301 !! + MCFG_CPU_PROGRAM_MAP(joystand_map) + MCFG_CPU_VBLANK_INT_DRIVER("screen", joystand_state, joystand_interrupt) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("tmp68301",tmp68301_device,irq_callback) + + MCFG_DEVICE_ADD("tmp68301", TMP68301, 0) + MCFG_TMP68301_IN_PARALLEL_CB(READ16(joystand_state, eeprom_r)) + MCFG_TMP68301_OUT_PARALLEL_CB(WRITE16(joystand_state, eeprom_w)) + + // video hardware + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_UPDATE_DRIVER(joystand_state, screen_update) + MCFG_SCREEN_SIZE(0x200, 0x100) + MCFG_SCREEN_VISIBLE_AREA(0x40, 0x40+0x178-1, 0x10, 0x100-1) + + MCFG_PALETTE_ADD("palette", 0x1000) + MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", joystand) + + MCFG_PALETTE_ADD_RRRRRGGGGGBBBBB("bg15_palette") + + // sound hardware + MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_SOUND_ADD("ym2413", YM2413, XTAL_3_579545MHz) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) + + MCFG_OKIM6295_ADD("oki", XTAL_16MHz / 16, OKIM6295_PIN7_HIGH) // pin 7 not verified + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + // cart + MCFG_TMS_29F040_ADD("cart.u1") + MCFG_TMS_29F040_ADD("cart.u2") + MCFG_TMS_29F040_ADD("cart.u3") + MCFG_TMS_29F040_ADD("cart.u4") + MCFG_TMS_29F040_ADD("cart.u5") + MCFG_TMS_29F040_ADD("cart.u6") + MCFG_TMS_29F040_ADD("cart.u7") + MCFG_TMS_29F040_ADD("cart.u8") + MCFG_TMS_29F040_ADD("cart.u9") + MCFG_TMS_29F040_ADD("cart.u10") + MCFG_TMS_29F040_ADD("cart.u11") + MCFG_TMS_29F040_ADD("cart.u12") + + // devices + MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") + MCFG_DEVICE_ADD("rtc", MSM6242, XTAL_32_768kHz) +MACHINE_CONFIG_END + + +/*************************************************************************** + + Machine driver(s) + +***************************************************************************/ + +ROM_START( joystand ) + ROM_REGION( 0x80000, "maincpu", 0 ) + ROM_LOAD16_BYTE( "yuvo_jsp003b.ic3", 0x00000, 0x40000, CRC(0c85bc77) SHA1(ad8ec80b02e82cf43e3f0732cc6e5468c6d21297) ) + ROM_LOAD16_BYTE( "yuvo_jsp004b.ic63", 0x00001, 0x40000, CRC(333396e5) SHA1(fc605890676efed476b67abcd1fcb8d509324be2) ) + + ROM_REGION( 0x180000, "tiles", 0 ) + ROM_LOAD16_BYTE( "yuvo_jsp005.2j", 0x000000, 0x80000, CRC(98caff66) SHA1(e201bb0119bc6560b7def40d42d2ef5b788ca3d4) ) + ROM_LOAD16_BYTE( "yuvo_jsp006.4j", 0x000001, 0x80000, CRC(6c9f8048) SHA1(3fd6effa83b0e429b97d55041697f1b5ee6eafe2) ) + ROM_LOAD16_BYTE( "yuvo_jsp007a.2g", 0x100000, 0x40000, CRC(ccfd5b72) SHA1(29bf14c888731d63f5d6705d0efb840f1de0fc91) ) // 1xxxxxxxxxxxxxxxxx = 0xFF + ROM_LOAD16_BYTE( "yuvo_jsp008a.4g", 0x100001, 0x40000, CRC(fdaf369c) SHA1(488741b9f2c5ccd27ee1aa5120834ec8b161d6b1) ) // 1xxxxxxxxxxxxxxxxx = 0xFF + + ROM_REGION( 0x80000, "cart.u1", 0 ) + ROM_LOAD( "jsp.u1", 0x00000, 0x80000, CRC(5478b779) SHA1(5d76645de2833cefb20374480572f06ef496ce30) ) + ROM_REGION( 0x80000, "cart.u2", 0 ) + ROM_LOAD( "jsp.u2", 0x00000, 0x80000, CRC(adba9522) SHA1(574e925b35ef3f732989f712caf3f92e16106c22) ) + ROM_REGION( 0x80000, "cart.u3", 0 ) + ROM_LOAD( "jsp.u3", 0x00000, 0x80000, CRC(6e293f82) SHA1(e29099c5337c5e7b4776da01a3bd45141b4900b9) ) + ROM_REGION( 0x80000, "cart.u4", 0 ) + ROM_LOAD( "jsp.u4", 0x00000, 0x80000, CRC(4caab540) SHA1(5cd88dc93c57d3ae9a6b3773222d8f6001b74634) ) + ROM_REGION( 0x80000, "cart.u5", 0 ) + ROM_LOAD( "jsp.u5", 0x00000, 0x80000, CRC(2cfee501) SHA1(2f07179accca0181d20bb0af797194a8ddad4f7a) ) + ROM_REGION( 0x80000, "cart.u6", 0 ) + ROM_LOAD( "jsp.u6", 0x00000, 0x80000, CRC(6069d711) SHA1(e969dcc4b5da6951b4140a78fa7cda350167ca66) ) + ROM_REGION( 0x80000, "cart.u7", 0 ) + ROM_LOAD( "jsp.u7", 0x00000, 0x80000, CRC(9f58df4d) SHA1(e4933087204624c021420bf632a6ddfd7b26179c) ) + ROM_REGION( 0x80000, "cart.u8", 0 ) + ROM_LOAD( "jsp.u8", 0x00000, 0x80000, CRC(829ddce6) SHA1(614ac45d55abe487aaa0e5ca7354926caaa03346) ) + ROM_REGION( 0x80000, "cart.u9", 0 ) + ROM_LOAD( "jsp.u9", 0x00000, 0x80000, CRC(e5ee5d8d) SHA1(ea6ea2fe4fc8b9eaf556453b430c85434ddf1570) ) + ROM_REGION( 0x80000, "cart.u10", 0 ) + ROM_LOAD( "jsp.u10", 0x00000, 0x80000, CRC(97234b84) SHA1(06a5dc290e925f5d6a8bade89d970964f32c9945) ) + ROM_REGION( 0x80000, "cart.u11", 0 ) + ROM_LOAD( "jsp.u11", 0x00000, 0x80000, CRC(8b138563) SHA1(8a2092d80d02ac685014540837b9aa38dfe0eb47) ) + ROM_REGION( 0x80000, "cart.u12", 0 ) + ROM_LOAD( "jsp.u12", 0x00000, 0x80000, CRC(10001cab) SHA1(5de49061f9ab81a4dc7e3405132ecec35a63248d) ) + + ROM_REGION( 0x100000, "oki", 0 ) + ROM_LOAD( "yuvo_jsp001.ic14", 0x00000, 0x80000, CRC(bf2b4557) SHA1(932b96f4b3553e9d52509d678c7c2d4dcfc32cd7) ) + ROM_LOAD( "yuvo_jsp002.ic13", 0x80000, 0x80000, CRC(0eb6db96) SHA1(e5f88f5357709def987f807d1a2d21514b5aa107) ) // 1ST AND 2ND HALF IDENTICAL + + ROM_REGION( 0x117, "pld", 0 ) + ROM_LOAD( "jsp-frm.ic100", 0x000, 0x117, NO_DUMP ) + ROM_LOAD( "jsp-map.ic4", 0x000, 0x117, NO_DUMP ) + ROM_LOAD( "jsp-sub.1f", 0x000, 0x117, NO_DUMP ) + ROM_LOAD( "jsp-xct.ic5", 0x000, 0x117, NO_DUMP ) +ROM_END + +GAME( 1997, joystand, 0, joystand, joystand, driver_device, 0, ROT0, "Yuvo", "Joy Stand Private", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/junofrst.c b/src/mame/drivers/junofrst.c index 2df085620a9..b83d1d1770b 100644 --- a/src/mame/drivers/junofrst.c +++ b/src/mame/drivers/junofrst.c @@ -291,7 +291,7 @@ WRITE8_MEMBER(junofrst_state::irq_enable_w) static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, junofrst_state ) AM_RANGE(0x0000, 0x7fff) AM_RAM AM_SHARE("videoram") - AM_RANGE(0x8000, 0x800f) AM_RAM AM_SHARE("paletteram") + AM_RANGE(0x8000, 0x800f) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0x8010, 0x8010) AM_READ_PORT("DSW2") AM_RANGE(0x801c, 0x801c) AM_READ(watchdog_reset_r) AM_RANGE(0x8020, 0x8020) AM_READ_PORT("SYSTEM") @@ -423,6 +423,9 @@ static MACHINE_CONFIG_START( junofrst, junofrst_state ) MCFG_MACHINE_START_OVERRIDE(junofrst_state,junofrst) MCFG_MACHINE_RESET_OVERRIDE(junofrst_state,junofrst) + MCFG_PALETTE_ADD("palette", 16) + MCFG_PALETTE_FORMAT(BBGGGRRR) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) diff --git a/src/mame/drivers/kaneko16.c b/src/mame/drivers/kaneko16.c index de8f73fefc3..6916ab977e6 100644 --- a/src/mame/drivers/kaneko16.c +++ b/src/mame/drivers/kaneko16.c @@ -36,6 +36,7 @@ Year + Game PCB Notes 94 Great 1000 Miles Rally Z09AF-005 TBSOP01 MCU protection (EEPROM handling etc.) Bonk's Adventure Z09AF-003 TBSOP01 MCU protection (EEPROM handling, 68k code snippet, data) Blood Warrior Z09AF-005 TBSOP01 MCU protection (EEPROM handling etc.) + Pack'n Bang Bang BW-002 (prototype) 95 Great 1000 Miles Rally 2 M201F00138 TBSOP02 MCU protection (EEPROM handling etc.) ---------------------------------------------------------------------------------------- @@ -84,6 +85,14 @@ Dip locations verified from manual for: - interrupt timing/behaviour - replace sample bank copying with new ADDRESS MAP system for OKI and do banking like CPUs +Non-Bugs (happen on real PCB) + +[packbang] + - Game crashes or gives you a corrupt stage if you attempt to continue on a bonus stage (due to buggy prototype code) + - Background fading appears inverted, fading to a black screen during levels, this is correct + - Some screens shown on the flyer (enemy select etc.) are never shown, the flyer probably shows a different version + of the game. The backgrounds used can be viewed in test mode. + ***************************************************************************/ #include "emu.h" @@ -1428,6 +1437,98 @@ INPUT_PORTS_END /*************************************************************************** + Pack'n Bang Bang +***************************************************************************/ + +static INPUT_PORTS_START( packbang ) + PORT_START("P1") /* 680000.w */ + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) + PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) + PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("P2") /* 680002.w */ + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) + PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) + PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("SYSTEM") /* 680000.w */ + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_START1 ) + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_START2 ) + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2) + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(2) + PORT_SERVICE_NO_TOGGLE( 0x1000, IP_ACTIVE_LOW ) + PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_TILT ) + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_SERVICE1 ) + PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("UNK") /* ? - 680006.w */ + 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_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("DSW1") + PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:1") + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPUNUSED_DIPLOC( 0x02, 0x02, "SW1:2" ) /* Listed as "Unused" */ + PORT_DIPNAME( 0x1c, 0x1c, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:3,4,5") + PORT_DIPSETTING( 0x00, DEF_STR( 4C_1C ) ) + PORT_DIPSETTING( 0x04, DEF_STR( 3C_1C ) ) + PORT_DIPSETTING( 0x0c, DEF_STR( 2C_1C ) ) + PORT_DIPSETTING( 0x1c, DEF_STR( 1C_1C ) ) + PORT_DIPSETTING( 0x08, DEF_STR( 2C_3C ) ) + PORT_DIPSETTING( 0x18, DEF_STR( 1C_2C ) ) + PORT_DIPSETTING( 0x14, DEF_STR( 1C_3C ) ) + PORT_DIPSETTING( 0x10, DEF_STR( 1C_4C ) ) + PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW1:6,7,8") + PORT_DIPSETTING( 0x60, DEF_STR( 2C_1C ) ) + PORT_DIPSETTING( 0xe0, DEF_STR( 1C_1C ) ) + PORT_DIPSETTING( 0x40, DEF_STR( 2C_3C ) ) + PORT_DIPSETTING( 0xc0, DEF_STR( 1C_2C ) ) + PORT_DIPSETTING( 0xa0, DEF_STR( 1C_3C ) ) + PORT_DIPSETTING( 0x80, DEF_STR( 1C_4C ) ) + PORT_DIPSETTING( 0x20, DEF_STR( 1C_5C ) ) + PORT_DIPSETTING( 0x00, DEF_STR( 1C_6C ) ) + + PORT_START("DSW2") + PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:1,2") + PORT_DIPSETTING( 0x02, DEF_STR( Easy ) ) + PORT_DIPSETTING( 0x03, DEF_STR( Normal ) ) + PORT_DIPSETTING( 0x01, DEF_STR( Hard ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) + PORT_DIPNAME( 0x04, 0x04, "Timer Speed" ) PORT_DIPLOCATION("SW2:3") + PORT_DIPSETTING( 0x00, "Slow" ) + PORT_DIPSETTING( 0x04, "Standard" ) + PORT_DIPNAME( 0x18, 0x18, DEF_STR( Language ) ) PORT_DIPLOCATION("SW2:4,5") + PORT_DIPSETTING( 0x00, "Invalid" ) // Japanese text, Korean Kaneko logo 'Unusued' according to test mode + PORT_DIPSETTING( 0x08, DEF_STR( Korea ) ) + PORT_DIPSETTING( 0x10, DEF_STR( Japan ) ) + PORT_DIPSETTING( 0x18, DEF_STR( World ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW2:6") + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:7") + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x40, DEF_STR( On ) ) + PORT_SERVICE_DIPLOC(0x80, IP_ACTIVE_LOW, "SW2:8" ) +INPUT_PORTS_END + +/*************************************************************************** Shogun Warriors ***************************************************************************/ @@ -2592,6 +2693,30 @@ ROM_START( berlwallk ) ROM_LOAD( "bw_u54.u54", 0x400, 0x0117, NO_DUMP) ROM_END +ROM_START( packbang ) /* same PCB as Berlin Wall - BW-002 */ + ROM_REGION( 0x040000, "maincpu", 0 ) /* 68000 Code */ + ROM_LOAD16_BYTE( "bbp0x3.u23", 0x000000, 0x020000, CRC(105e978a) SHA1(d2aa72a25b70726ebe4b16bfe16da149bb37cd85) ) /* hand written checksum on label - 527B */ + ROM_LOAD16_BYTE( "bbp1x3.u39", 0x000001, 0x020000, CRC(465d36f5) SHA1(d3bc9e5d444e086652d2bc562d9adfb8a1fd0d2d) ) /* hand written checksum on label - C5C8 */ + + ROM_REGION( 0x120000, "gfx1", 0 ) /* Sprites */ + ROM_LOAD( "bb.u84", 0x000000, 0x080000, CRC(97837aaa) SHA1(303780621afea01f9e4d1386229c7421307562ec) ) + ROM_LOAD( "pb_spr_ext_9_20_ver.u83", 0x080000, 0x040000, CRC(666a1217) SHA1(0d7b08d63b229d70b7e9e77a36516a695533c4cb) ) /* hand written label plus checksum BA63 */ + + ROM_REGION( 0x080000, "gfx2", 0 ) /* Tiles (Scrambled) */ + ROM_LOAD( "bbbox1.u77", 0x000000, 0x080000, CRC(b2ffd081) SHA1(e4b8b60ed0c5f2e0709477cc840864e1c0a351ea) ) // 1ST AND 2ND HALF IDENTICAL + + ROM_REGION( 0x400000, "gfx3", 0 ) /* High Color Background */ + ROM_LOAD16_BYTE( "bb.u73", 0x000000, 0x080000, CRC(896d88cb) SHA1(7546e64149d8d8e3425d9112a7a63b2d2e59b8bb) ) + ROM_LOAD16_BYTE( "bb.u65", 0x000001, 0x080000, CRC(fe17c5b5) SHA1(daea65bd87d2137526250d521f36f122f733fd9d) ) // FIXED BITS (xxxxxxx0) + ROM_LOAD16_BYTE( "bb.u74", 0x100000, 0x080000, CRC(b01e77b9) SHA1(73f3adaf6468f4e9c54bff63268af1765cfc5f67) ) + ROM_LOAD16_BYTE( "bb.u66", 0x100001, 0x080000, CRC(caec5098) SHA1(9966cd643abe498f84a9e01bc32003f4654584de) ) // FIXED BITS (xxxxxxx0) + ROM_LOAD16_BYTE( "bb.u75", 0x200000, 0x080000, CRC(5cb4669f) SHA1(ab061f5b34435dca46f710ea8118c919a3a9f87c) ) + ROM_LOAD16_BYTE( "bb.u67", 0x200001, 0x080000, CRC(ce5c9417) SHA1(30aca496d1f4218b44a32b3630e58889f0c54564) ) // FIXED BITS (xxxxxxx0) + + ROM_REGION( 0x040000, "oki", 0 ) /* Samples */ + ROM_LOAD( "bw000.u46", 0x000000, 0x040000, CRC(d8fe869d) SHA1(75e9044c4164ca6db9519fcff8eca6c8a2d8d5d1) ) +ROM_END + /*************************************************************************** @@ -3961,8 +4086,7 @@ DRIVER_INIT_MEMBER( kaneko16_shogwarr_state, brapboys ) GAME( 1991, berlwall, 0, berlwall, berlwall, kaneko16_berlwall_state, berlwall, ROT0, "Kaneko", "The Berlin Wall", MACHINE_SUPPORTS_SAVE ) GAME( 1991, berlwallt,berlwall, berlwall, berlwallt,kaneko16_berlwall_state, berlwall, ROT0, "Kaneko", "The Berlin Wall (bootleg ?)", MACHINE_SUPPORTS_SAVE ) GAME( 1991, berlwallk,berlwall, berlwall, berlwallk,kaneko16_berlwall_state, berlwall, ROT0, "Kaneko (Inter license)", "The Berlin Wall (Korea)", MACHINE_SUPPORTS_SAVE ) - - +GAME( 1994, packbang, 0, berlwall, packbang, kaneko16_berlwall_state, berlwall, ROT90, "Kaneko", "Pack'n Bang Bang (prototype)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS ) // priorities between stages? GAME( 1991, mgcrystl, 0, mgcrystl, mgcrystl, kaneko16_state, kaneko16, ROT0, "Kaneko", "Magical Crystals (World, 92/01/10)", MACHINE_SUPPORTS_SAVE ) GAME( 1991, mgcrystlo,mgcrystl, mgcrystl, mgcrystl, kaneko16_state, kaneko16, ROT0, "Kaneko", "Magical Crystals (World, 91/12/10)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/kas89.c b/src/mame/drivers/kas89.c index e7a2de7eb93..7c7d4bf1919 100644 --- a/src/mame/drivers/kas89.c +++ b/src/mame/drivers/kas89.c @@ -765,7 +765,7 @@ static MACHINE_CONFIG_START( kas89, kas89_state ) MCFG_NVRAM_ADD_0FILL("nvram") /* video hardware */ - MCFG_V9938_ADD("v9938", "screen", VDP_MEM) + MCFG_V9938_ADD("v9938", "screen", VDP_MEM, MASTER_CLOCK) MCFG_V99X8_INTERRUPT_CALLBACK(WRITELINE(kas89_state,kas89_vdp_interrupt)) MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/drivers/konamigx.c b/src/mame/drivers/konamigx.c index f34515a1f65..cb1b3116baf 100644 --- a/src/mame/drivers/konamigx.c +++ b/src/mame/drivers/konamigx.c @@ -982,7 +982,7 @@ static ADDRESS_MAP_START( gx_base_memmap, AS_PROGRAM, 32, konamigx_state ) ADDRESS_MAP_END static ADDRESS_MAP_START( gx_type1_map, AS_PROGRAM, 32, konamigx_state ) - AM_RANGE(0xd90000, 0xd97fff) AM_RAM_WRITE(konamigx_palette_w) AM_SHARE("paletteram") + AM_RANGE(0xd90000, 0xd97fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0xdc0000, 0xdc1fff) AM_RAM // LAN RAM? (Racin' Force has, Open Golf doesn't) AM_RANGE(0xdd0000, 0xdd00ff) AM_READNOP AM_WRITENOP // LAN board AM_RANGE(0xdda000, 0xddafff) AM_WRITE_PORT("ADC-WRPORT") @@ -1002,7 +1002,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( gx_type2_map, AS_PROGRAM, 32, konamigx_state ) AM_RANGE(0xcc0000, 0xcc0003) AM_WRITE(esc_w) - AM_RANGE(0xd90000, 0xd97fff) AM_RAM_WRITE(konamigx_palette_w) AM_SHARE("paletteram") + AM_RANGE(0xd90000, 0xd97fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_IMPORT_FROM(gx_base_memmap) ADDRESS_MAP_END @@ -1587,6 +1587,7 @@ static MACHINE_CONFIG_START( konamigx, konamigx_state ) MCFG_SCREEN_UPDATE_DRIVER(konamigx_state, screen_update_konamigx) MCFG_PALETTE_ADD("palette", 8192) + MCFG_PALETTE_FORMAT(XRGB) MCFG_PALETTE_ENABLE_SHADOWS() MCFG_PALETTE_ENABLE_HILIGHTS() @@ -1754,8 +1755,8 @@ static MACHINE_CONFIG_DERIVED( gxtype3, konamigx ) MCFG_DEVICE_MODIFY("k055673") MCFG_K055673_CONFIG("gfx2", 0, K055673_LAYOUT_GX6, -132, -23) - MCFG_PALETTE_MODIFY("palette") - MCFG_PALETTE_ENTRIES(16384) + MCFG_DEVICE_REMOVE("palette") + MCFG_PALETTE_ADD("palette", 16384) MCFG_PALETTE_ENABLE_SHADOWS() MCFG_PALETTE_ENABLE_HILIGHTS() @@ -1796,8 +1797,8 @@ static MACHINE_CONFIG_DERIVED( gxtype4, konamigx ) MCFG_SCREEN_VISIBLE_AREA(0, 384-1, 16, 32*8-1-16) MCFG_SCREEN_UPDATE_DRIVER(konamigx_state, screen_update_konamigx_right) - MCFG_PALETTE_MODIFY("palette") - MCFG_PALETTE_ENTRIES(8192) + MCFG_DEVICE_REMOVE("palette") + MCFG_PALETTE_ADD("palette", 8192) MCFG_PALETTE_ENABLE_SHADOWS() MCFG_PALETTE_ENABLE_HILIGHTS() diff --git a/src/mame/drivers/konendev.c b/src/mame/drivers/konendev.c index 0609b62bd3d..492eb0218fa 100644 --- a/src/mame/drivers/konendev.c +++ b/src/mame/drivers/konendev.c @@ -37,65 +37,123 @@ #include "emu.h" #include "cpu/powerpc/ppc.h" #include "sound/ymz280b.h" +#include "video/k057714.h" +#include "machine/nvram.h" +#include "machine/eepromser.h" class konendev_state : public driver_device { public: konendev_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu") + m_maincpu(*this, "maincpu"), + m_gcu(*this, "gcu"), + m_eeprom(*this, "eeprom") { } protected: // devices required_device<cpu_device> m_maincpu; + required_device<k057714_device> m_gcu; + required_device<eeprom_serial_93cxx_device> m_eeprom; public: DECLARE_DRIVER_INIT(konendev); + DECLARE_DRIVER_INIT(enchlamp); - DECLARE_READ32_MEMBER(gcu_r); - DECLARE_WRITE32_MEMBER(gcu_w); + DECLARE_READ32_MEMBER(mcu2_r); + DECLARE_READ32_MEMBER(ifu2_r); + DECLARE_READ32_MEMBER(unk_78800004_r); + DECLARE_READ32_MEMBER(unk_78a00000_r); + DECLARE_READ32_MEMBER(unk_78e00000_r); + DECLARE_WRITE32_MEMBER(eeprom_w); UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); }; UINT32 konendev_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - return 0; + return m_gcu->draw(screen, bitmap, cliprect); } -// VERY similar to the Firebeat GCU, probably the same -READ32_MEMBER(konendev_state::gcu_r) +READ32_MEMBER(konendev_state::mcu2_r) { - int reg = offset << 2; + UINT32 r = 0; - switch (reg) + if (ACCESSING_BITS_24_31) { - // Status register - case 0x78: - return rand(); + r |= 0x11000000; // MCU2 version + } + if (ACCESSING_BITS_16_23) + { + r |= (m_eeprom->do_read() ? 0x2 : 0) << 16; + } + if (ACCESSING_BITS_8_15) + { + r &= ~0x4000; // MCU2 presence + r &= ~0x2000; // IFU2 presence + r &= ~0x1000; // FMU2 presence + } + if (ACCESSING_BITS_0_7) + { + r |= 0x40; // logic door } - return 0; + return r; } -WRITE32_MEMBER(konendev_state::gcu_w) +READ32_MEMBER(konendev_state::ifu2_r) { - int reg = offset << 2; + UINT32 r = 0; - switch (reg) + if (ACCESSING_BITS_0_7) { - default: - osd_printf_debug("[%x] %.4x\n", reg, data); + r |= 0x11; // IFU2 version + } + + return r; +} + +READ32_MEMBER(konendev_state::unk_78800004_r) +{ + return 0xffffffff; +} + +READ32_MEMBER(konendev_state::unk_78a00000_r) +{ + return 0xffffffff; +} + +READ32_MEMBER(konendev_state::unk_78e00000_r) +{ + return 0xffffffff; +} + +WRITE32_MEMBER(konendev_state::eeprom_w) +{ + if (ACCESSING_BITS_0_7) + { + m_eeprom->di_write((data & 0x04) ? 1 : 0); + m_eeprom->clk_write((data & 0x02) ? ASSERT_LINE : CLEAR_LINE); + m_eeprom->cs_write((data & 0x01) ? ASSERT_LINE : CLEAR_LINE); } } static ADDRESS_MAP_START( konendev_map, AS_PROGRAM, 32, konendev_state ) AM_RANGE(0x00000000, 0x00ffffff) AM_RAM - AM_RANGE(0x78000000, 0x78000003) AM_READNOP - AM_RANGE(0x78100000, 0x7810001b) AM_RAM - AM_RANGE(0x78a00014, 0x78a00017) AM_WRITENOP - AM_RANGE(0x79800000, 0x798000ff) AM_READWRITE(gcu_r, gcu_w) + AM_RANGE(0x78000000, 0x78000003) AM_READ(mcu2_r) + AM_RANGE(0x78100000, 0x78100003) AM_WRITE(eeprom_w) + AM_RANGE(0x78800000, 0x78800003) AM_READ(ifu2_r) + AM_RANGE(0x78800004, 0x78800007) AM_READ(unk_78800004_r) + AM_RANGE(0x78a00000, 0x78a0001f) AM_READ(unk_78a00000_r) + AM_RANGE(0x78e00000, 0x78e00003) AM_READ(unk_78e00000_r) +// AM_RANGE(0x78000000, 0x78000003) AM_READNOP +// AM_RANGE(0x78100000, 0x7810001b) AM_RAM +// AM_RANGE(0x78a00014, 0x78a00017) AM_WRITENOP + AM_RANGE(0x79800000, 0x798000ff) AM_DEVREADWRITE("gcu", k057714_device, read, write) + AM_RANGE(0x7a000000, 0x7a01ffff) AM_RAM AM_SHARE("nvram0") + AM_RANGE(0x7a100000, 0x7a11ffff) AM_RAM AM_SHARE("nvram1") + AM_RANGE(0x7e000000, 0x7f7fffff) AM_ROM AM_REGION("flash", 0) AM_RANGE(0x7ff00000, 0x7fffffff) AM_ROM AM_REGION("program", 0) ADDRESS_MAP_END @@ -121,6 +179,14 @@ static MACHINE_CONFIG_START( konendev, konendev_state ) MCFG_SCREEN_UPDATE_DRIVER(konendev_state, screen_update) MCFG_SCREEN_PALETTE("palette") + MCFG_DEVICE_ADD("gcu", K057714, 0) + MCFG_K057714_CPU_TAG("maincpu") + + MCFG_NVRAM_ADD_0FILL("nvram0") + MCFG_NVRAM_ADD_0FILL("nvram1") + + MCFG_EEPROM_SERIAL_93C56_ADD("eeprom") + /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") @@ -137,8 +203,11 @@ ROM_START( enchlamp ) ROM_LOAD32_WORD_SWAP( "enl5rg26_01h.bin", 0x00000, 0x100000, CRC(fed5b988) SHA1(49442decd9b40f0a382c4fc7b231958f526ddbd1) ) ROM_LOAD32_WORD_SWAP( "enl5rg26_02l.bin", 0x00002, 0x100000, CRC(d0e42c9f) SHA1(10ff944ec0a626d47ec12be291ff5fe001342ed4) ) - ROM_REGION( 0x1800000, "flash", 0 ) + ROM_REGION32_BE( 0x1800000, "flash", ROMREGION_ERASE00 ) ROM_LOAD( "enl5r211.fmu.bin", 0x0000, 0x1800000, CRC(592c3c7f) SHA1(119b3c6223d656981c399c399d7edccfdbb50dc7) ) + + ROM_REGION32_BE( 0x100, "eeprom", 0 ) + ROM_LOAD( "93c56.u98", 0x00, 0x100, CRC(b2521a6a) SHA1(f44711545bee7e9c772a3dc23b79f0ea8059ec50) ) // empty eeprom with Konami header ROM_END @@ -150,6 +219,8 @@ ROM_START( whiterus ) ROM_REGION( 0x200000, "others", 0 ) ROM_LOAD( "u190.4 2v02s502.ifu_rus (95 7)", 0x0000, 0x080000, CRC(36122a98) SHA1(3d2c40c9d504358d890364e26c9562e40314d8a4) ) ROM_LOAD( "2v02s502_ifu.bin", 0x0000, 0x080000, CRC(36122a98) SHA1(3d2c40c9d504358d890364e26c9562e40314d8a4) ) // was in 2V02S502_IFU.zip looks similar to above tho + + ROM_REGION32_BE( 0x1800000, "flash", ROMREGION_ERASE00 ) ROM_END /* Partial sets */ @@ -158,92 +229,131 @@ ROM_START( aadvent ) ROM_REGION32_BE( 0x200000, "program", 0 ) ROM_LOAD32_WORD_SWAP( "afa5re26_01h.bin", 0x00000, 0x100000, CRC(65ce6f7a) SHA1(018742f13fea4c52f822e7f12e8efd0aff61a713) ) ROM_LOAD32_WORD_SWAP( "afa5re26_02l.bin", 0x00002, 0x100000, CRC(73945b3a) SHA1(5ace9c439048f3555fe631917c15bee76362e784) ) + + ROM_REGION32_BE( 0x1800000, "flash", ROMREGION_ERASE00 ) ROM_END ROM_START( dragnfly ) ROM_REGION32_BE( 0x200000, "program", 0 ) ROM_LOAD32_WORD_SWAP( "drf5re26_01h.bin", 0x00000, 0x100000, CRC(ef6f1b69) SHA1(007a41cd1b08705184f69ce3e0e6c63bc2301e25) ) ROM_LOAD32_WORD_SWAP( "drf5re26_02l.bin", 0x00002, 0x100000, CRC(00e00c29) SHA1(a92d7220bf46655222ddc5d1c276dc469343f4c5) ) + + ROM_REGION32_BE( 0x1800000, "flash", ROMREGION_ERASE00 ) ROM_END ROM_START( gypmagic ) ROM_REGION32_BE( 0x200000, "program", 0 ) ROM_LOAD32_WORD_SWAP( "gym5rc26_01h.bin", 0x00000, 0x080000, CRC(8643be94) SHA1(fc63872a55ac2229652566bd9795ce9bf8442fee) ) ROM_LOAD32_WORD_SWAP( "gym5rc26_02l.bin", 0x00002, 0x080000, CRC(4ee33c46) SHA1(9e0ef66e9d53a47827d04e6a89d13d37429e0c16) ) + + ROM_REGION32_BE( 0x1800000, "flash", ROMREGION_ERASE00 ) ROM_END ROM_START( incanp ) ROM_REGION32_BE( 0x200000, "program", 0 ) ROM_LOAD32_WORD_SWAP( "inp5rg26_01h.bin", 0x00000, 0x100000, CRC(8434222e) SHA1(d03710e18f5b9e45db32685778a21a5dc598d043) ) ROM_LOAD32_WORD_SWAP( "inp5rg26_02l.bin", 0x00002, 0x100000, CRC(50c37109) SHA1(a638587f37f63b3f63ee51f541d991c3784c09f7) ) + + ROM_REGION32_BE( 0x1800000, "flash", ROMREGION_ERASE00 ) ROM_END ROM_START( jestmagi ) ROM_REGION32_BE( 0x200000, "program", 0 ) ROM_LOAD32_WORD_SWAP( "jem5rc26_01h.bin", 0x00000, 0x080000, CRC(9145324c) SHA1(366baa22bde1b8da19dba756829305d0fd69b4ff) ) ROM_LOAD32_WORD_SWAP( "jem5rc26_02l.bin", 0x00002, 0x080000, CRC(cb49f466) SHA1(e3987de2e640fe8116d66d2c1755e6500dedf8a5) ) + + ROM_REGION32_BE( 0x1800000, "flash", ROMREGION_ERASE00 ) ROM_END ROM_START( luckfoun ) ROM_REGION32_BE( 0x200000, "program", 0 ) ROM_LOAD32_WORD_SWAP( "luf5rd26_01h.bin", 0x00000, 0x080000, CRC(68b3d50a) SHA1(9b3d2a9f5d72db091e79b036017bd5d07f9fed00) ) ROM_LOAD32_WORD_SWAP( "luf5rd26_02l.bin", 0x00002, 0x080000, CRC(e7e9b8cd) SHA1(d8c421b0d58775f5a0ccae6395a604091b0acf1d) ) + + ROM_REGION32_BE( 0x1800000, "flash", ROMREGION_ERASE00 ) ROM_END ROM_START( mohicans ) ROM_REGION32_BE( 0x200000, "program", 0 ) ROM_LOAD32_WORD_SWAP( "moh5rf26_01h.bin", 0x00000, 0x100000, CRC(527dda20) SHA1(0a71484421738517c17d76e9bf92943b57cc4cc8) ) ROM_LOAD32_WORD_SWAP( "moh5rf26_02l.bin", 0x00002, 0x100000, CRC(a9bd3846) SHA1(02d80ff6c20e3732ae582de5d4392d4d6d8ba955) ) + + ROM_REGION32_BE( 0x1800000, "flash", ROMREGION_ERASE00 ) ROM_END ROM_START( monshow ) ROM_REGION32_BE( 0x200000, "program", 0 ) ROM_LOAD32_WORD_SWAP( "tms5rc26_01h.bin", 0x00000, 0x100000, CRC(8209aafe) SHA1(e48a0524ad93a9b657d3efe67f7b5e1067b37e48) ) ROM_LOAD32_WORD_SWAP( "tms5rc26_02l.bin", 0x00002, 0x100000, CRC(78de8c59) SHA1(ad73bc926f5874d257171dfa6b727cb31e33bce9) ) + + ROM_REGION32_BE( 0x1800000, "flash", ROMREGION_ERASE00 ) ROM_END ROM_START( romanl ) ROM_REGION32_BE( 0x200000, "program", 0 ) ROM_LOAD32_WORD_SWAP( "rol5rg26_01h.bin", 0x00000, 0x100000, CRC(d441d30c) SHA1(025111699a7e29781bbb4d0f4151c808e3d06235) ) ROM_LOAD32_WORD_SWAP( "rol5rg26_02l.bin", 0x00002, 0x100000, CRC(08bd72ca) SHA1(a082cffeb1bccc8ec468a618eaabba7dac89882c) ) + + ROM_REGION32_BE( 0x1800000, "flash", ROMREGION_ERASE00 ) ROM_END ROM_START( safemon ) ROM_REGION32_BE( 0x200000, "program", 0 ) ROM_LOAD32_WORD_SWAP( "sam5rj26_01h.bin", 0x00000, 0x080000, CRC(7f82693f) SHA1(1c8540d209ab17f4fca5ff74bc687c83ec315208) ) ROM_LOAD32_WORD_SWAP( "sam5rj26_02l.bin", 0x00002, 0x080000, CRC(73bd981e) SHA1(f01b97201bd877c601cf3c742a6e0963de8e48dc) ) + + ROM_REGION32_BE( 0x1800000, "flash", ROMREGION_ERASE00 ) ROM_END ROM_START( showqn ) ROM_REGION32_BE( 0x200000, "program", 0 ) ROM_LOAD32_WORD_SWAP( "shq_1h.bin", 0x00000, 0x080000, CRC(3fc44415) SHA1(f0be1b90a2a374f9fb9e059e834bbdbf714b6607) ) ROM_LOAD32_WORD_SWAP( "shq_2l.bin", 0x00002, 0x080000, CRC(38a03281) SHA1(1b4552b0ce347df4d87e398111bbf72f126a8ec1) ) + + ROM_REGION32_BE( 0x1800000, "flash", ROMREGION_ERASE00 ) ROM_END ROM_START( spiceup ) ROM_REGION32_BE( 0x200000, "program", 0 ) ROM_LOAD32_WORD_SWAP( "siu5rc26_01h.bin", 0x00000, 0x100000, CRC(373bc2b1) SHA1(af3740fdcd028f162440701c952a3a87805bc65b) ) ROM_LOAD32_WORD_SWAP( "siu5rc26_02l.bin", 0x00002, 0x100000, CRC(2e584321) SHA1(ca98092dde76338117e989e774db2db672d87bfa) ) + + ROM_REGION32_BE( 0x1800000, "flash", ROMREGION_ERASE00 ) ROM_END ROM_START( sultanw ) ROM_REGION32_BE( 0x200000, "program", 0 ) ROM_LOAD32_WORD_SWAP( "suw5rc26_01h.bin", 0x00000, 0x100000, CRC(27760529) SHA1(b8970a706df52ee5792bbd7a4e719f2be87662ac) ) ROM_LOAD32_WORD_SWAP( "suw5rc26_02l.bin", 0x00002, 0x100000, CRC(1c98fd4d) SHA1(58ff948c0deba0bffb8866b15f46518524516501) ) + + ROM_REGION32_BE( 0x1800000, "flash", ROMREGION_ERASE00 ) ROM_END ROM_START( konzero ) ROM_REGION32_BE( 0x200000, "program", 0 ) ROM_LOAD32_WORD_SWAP( "rmclr_h.bin", 0x00000, 0x080000, CRC(b9237061) SHA1(0eb311e8e1c872d6a9c38726efb17ddf4713bc7d) ) ROM_LOAD32_WORD_SWAP( "rmclr_l.bin", 0x00002, 0x080000, CRC(2806299c) SHA1(a069f4477b310f99ff1ff48f622dc30862589127) ) + + ROM_REGION32_BE( 0x1800000, "flash", ROMREGION_ERASE00 ) + + ROM_REGION32_BE( 0x100, "eeprom", 0 ) + ROM_LOAD( "93c56.u98", 0x00, 0x100, CRC(b2521a6a) SHA1(f44711545bee7e9c772a3dc23b79f0ea8059ec50) ) // empty eeprom with Konami header ROM_END DRIVER_INIT_MEMBER(konendev_state,konendev) { } +DRIVER_INIT_MEMBER(konendev_state,enchlamp) +{ + UINT32 *rom = (UINT32*)memregion("program")->base(); + rom[0x24/4] = 0x00002743; // patch flash checksum for now + + rom[0] = 0xd43eb930; // new checksum for program rom +} + // has a flash dump? -GAME( 200?, enchlamp, 0, konendev, konendev, konendev_state, konendev, ROT0, "Konami", "Enchanted Lamp (Konami Endeavour)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +GAME( 200?, enchlamp, 0, konendev, konendev, konendev_state, enchlamp, ROT0, "Konami", "Enchanted Lamp (Konami Endeavour)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) // missing flash but has other interesting files GAME( 200?, whiterus, 0, konendev, konendev, konendev_state, konendev, ROT0, "Konami", "White Russia (Konami Endeavour)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/kurukuru.c b/src/mame/drivers/kurukuru.c index 048fe8d335a..346924720b2 100644 --- a/src/mame/drivers/kurukuru.c +++ b/src/mame/drivers/kurukuru.c @@ -554,7 +554,7 @@ static MACHINE_CONFIG_START( kurukuru, kurukuru_state ) MCFG_NVRAM_ADD_0FILL("nvram") /* video hardware */ - MCFG_V9938_ADD("v9938", "screen", VDP_MEM) + MCFG_V9938_ADD("v9938", "screen", VDP_MEM, MAIN_CLOCK) MCFG_V99X8_INTERRUPT_CALLBACK(WRITELINE(kurukuru_state,kurukuru_vdp_interrupt)) MCFG_SCREEN_ADD("screen",RASTER) diff --git a/src/mame/drivers/lethalj.c b/src/mame/drivers/lethalj.c index 47704031630..f4454127dc8 100644 --- a/src/mame/drivers/lethalj.c +++ b/src/mame/drivers/lethalj.c @@ -142,7 +142,6 @@ Pin #11(+) | | R | #include "emu.h" #include "cpu/tms34010/tms34010.h" #include "includes/lethalj.h" -#include "machine/ticket.h" #include "sound/okim6295.h" @@ -162,7 +161,7 @@ Pin #11(+) | | R | CUSTOM_INPUT_MEMBER(lethalj_state::cclownz_paddle) { - int value = ioport("PADDLE")->read(); + int value = m_paddle->read(); return ((value << 4) & 0xf00) | (value & 0x00f); } @@ -177,14 +176,14 @@ CUSTOM_INPUT_MEMBER(lethalj_state::cclownz_paddle) WRITE16_MEMBER(lethalj_state::ripribit_control_w) { coin_counter_w(machine(), 0, data & 1); - machine().device<ticket_dispenser_device>("ticket")->write(space, 0, ((data >> 1) & 1) << 7); + m_ticket->write(space, 0, ((data >> 1) & 1) << 7); output_set_lamp_value(0, (data >> 2) & 1); } WRITE16_MEMBER(lethalj_state::cfarm_control_w) { - machine().device<ticket_dispenser_device>("ticket")->write(space, 0, ((data >> 0) & 1) << 7); + m_ticket->write(space, 0, ((data >> 0) & 1) << 7); output_set_lamp_value(0, (data >> 2) & 1); output_set_lamp_value(1, (data >> 3) & 1); output_set_lamp_value(2, (data >> 4) & 1); @@ -194,7 +193,7 @@ WRITE16_MEMBER(lethalj_state::cfarm_control_w) WRITE16_MEMBER(lethalj_state::cclownz_control_w) { - machine().device<ticket_dispenser_device>("ticket")->write(space, 0, ((data >> 0) & 1) << 7); + m_ticket->write(space, 0, ((data >> 0) & 1) << 7); output_set_lamp_value(0, (data >> 2) & 1); output_set_lamp_value(1, (data >> 4) & 1); output_set_lamp_value(2, (data >> 5) & 1); diff --git a/src/mame/drivers/liberate.c b/src/mame/drivers/liberate.c index 24d30fab933..9e0b2b7d644 100644 --- a/src/mame/drivers/liberate.c +++ b/src/mame/drivers/liberate.c @@ -237,7 +237,7 @@ WRITE8_MEMBER(liberate_state::prosport_charram_w) *************************************/ static ADDRESS_MAP_START( prosport_map, AS_PROGRAM, 8, liberate_state ) - AM_RANGE(0x0200, 0x021f) AM_RAM_WRITE(prosport_paletteram_w) AM_SHARE("paletteram") + AM_RANGE(0x0200, 0x021f) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0x0000, 0x03ff) AM_MIRROR(0x2000) AM_RAM AM_RANGE(0x0400, 0x07ff) AM_RAM_WRITE(prosport_bg_vram_w) AM_SHARE("bg_vram") AM_RANGE(0x0800, 0x1fff) AM_READWRITE(prosport_charram_r,prosport_charram_w) //0x1e00-0x1fff isn't charram! @@ -836,6 +836,7 @@ static MACHINE_CONFIG_START( prosport, liberate_state ) MCFG_GFXDECODE_ADD("gfxdecode", "palette", prosport) MCFG_PALETTE_ADD("palette", 256) + MCFG_PALETTE_FORMAT(BBGGGRRR_inverted) MCFG_VIDEO_START_OVERRIDE(liberate_state,prosport) diff --git a/src/mame/drivers/lwings.c b/src/mame/drivers/lwings.c index 6a00f0699f9..762264188fd 100644 --- a/src/mame/drivers/lwings.c +++ b/src/mame/drivers/lwings.c @@ -847,6 +847,12 @@ static MACHINE_CONFIG_DERIVED( avengers, trojan ) MCFG_VIDEO_START_OVERRIDE(lwings_state,avengers) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( avengersb, avengers ) + /* video hardware */ + MCFG_VIDEO_START_OVERRIDE(lwings_state,avengersb) +MACHINE_CONFIG_END + + /************************************* * * ROM definition(s) @@ -1054,7 +1060,7 @@ ROM_START( trojan ) ROM_REGION( 0x10000, "soundcpu", 0 ) ROM_LOAD( "tb02.15h", 0x0000, 0x8000, CRC(21154797) SHA1(e1a3006746cc2d692ecd4369cc0a77c596abd60b) ) - ROM_REGION( 0x10000, "adpcm", 0 ) /* 64k for ADPCM CPU (CPU not emulated) */ + ROM_REGION( 0x10000, "adpcm", 0 ) /* 64k for ADPCM CPU */ ROM_LOAD( "tb01.6d", 0x0000, 0x4000, CRC(1c0f91b2) SHA1(163bf6aa1936994659661653eabdc368199b0070) ) ROM_REGION( 0x04000, "gfx1", 0 ) @@ -1101,7 +1107,7 @@ ROM_START( trojana ) ROM_REGION( 0x10000, "soundcpu", 0 ) ROM_LOAD( "tb02.15h", 0x0000, 0x8000, CRC(21154797) SHA1(e1a3006746cc2d692ecd4369cc0a77c596abd60b) ) - ROM_REGION( 0x10000, "adpcm", 0 ) /* 64k for ADPCM CPU (CPU not emulated) */ + ROM_REGION( 0x10000, "adpcm", 0 ) /* 64k for ADPCM CPU */ ROM_LOAD( "tb01.6d", 0x0000, 0x4000, CRC(1c0f91b2) SHA1(163bf6aa1936994659661653eabdc368199b0070) ) ROM_REGION( 0x04000, "gfx1", 0 ) @@ -1148,7 +1154,7 @@ ROM_START( trojanr ) ROM_REGION( 0x10000, "soundcpu", 0 ) ROM_LOAD( "tb02.15h", 0x0000, 0x8000, CRC(21154797) SHA1(e1a3006746cc2d692ecd4369cc0a77c596abd60b) ) - ROM_REGION( 0x10000, "adpcm", 0 ) /* 64k for ADPCM CPU (CPU not emulated) */ + ROM_REGION( 0x10000, "adpcm", 0 ) /* 64k for ADPCM CPU */ ROM_LOAD( "tb01.6d", 0x0000, 0x4000, CRC(1c0f91b2) SHA1(163bf6aa1936994659661653eabdc368199b0070) ) ROM_REGION( 0x04000, "gfx1", 0 ) @@ -1195,7 +1201,7 @@ ROM_START( trojanj ) ROM_REGION( 0x10000, "soundcpu", 0 ) ROM_LOAD( "tb02.15h", 0x0000, 0x8000, CRC(21154797) SHA1(e1a3006746cc2d692ecd4369cc0a77c596abd60b) ) - ROM_REGION( 0x10000, "adpcm", 0 ) /* 64k for ADPCM CPU (CPU not emulated) */ + ROM_REGION( 0x10000, "adpcm", 0 ) /* 64k for ADPCM CPU */ ROM_LOAD( "tb01.6d", 0x0000, 0x4000, CRC(1c0f91b2) SHA1(163bf6aa1936994659661653eabdc368199b0070) ) ROM_REGION( 0x04000, "gfx1", 0 ) @@ -1242,7 +1248,7 @@ ROM_START( trojanb ) ROM_REGION( 0x10000, "soundcpu", 0 ) ROM_LOAD( "2.6q", 0x0000, 0x8000, CRC(21154797) SHA1(e1a3006746cc2d692ecd4369cc0a77c596abd60b) ) - ROM_REGION( 0x10000, "adpcm", 0 ) /* 64k for ADPCM CPU (CPU not emulated) */ + ROM_REGION( 0x10000, "adpcm", 0 ) /* 64k for ADPCM CPU */ ROM_LOAD( "1.3f", 0x0000, 0x8000, CRC(83c715b2) SHA1(0c69c086657f91828a639ff7c72c703a27ade710) ) // different ROM_REGION( 0x04000, "gfx1", 0 ) @@ -1290,7 +1296,7 @@ ROM_START( avengers ) ROM_REGION( 0x10000, "soundcpu", 0 ) ROM_LOAD( "02.15h", 0x0000, 0x8000, CRC(107a2e17) SHA1(5aae2f4ac9f15ccb4122f3ba9fba588438d62f4f) ) /* ?? */ - ROM_REGION( 0x10000, "adpcm", 0 ) /* ADPCM CPU (not emulated) */ + ROM_REGION( 0x10000, "adpcm", 0 ) /* ADPCM CPU */ ROM_LOAD( "01.6d", 0x0000, 0x8000, CRC(c1e5d258) SHA1(88ed978e6df72ce22f9371930360aa9cde73abe9) ) /* adpcm player - "Talker" ROM */ ROM_REGION( 0x08000, "gfx1", 0 ) @@ -1337,7 +1343,7 @@ ROM_START( avengers2 ) ROM_REGION( 0x10000, "soundcpu", 0 ) ROM_LOAD( "02.15h", 0x0000, 0x8000, CRC(107a2e17) SHA1(5aae2f4ac9f15ccb4122f3ba9fba588438d62f4f) ) /* MISSING from this set */ - ROM_REGION( 0x10000, "adpcm", 0 ) /* ADPCM CPU (not emulated) */ + ROM_REGION( 0x10000, "adpcm", 0 ) /* ADPCM CPU */ ROM_LOAD( "01.6d", 0x0000, 0x8000, CRC(c1e5d258) SHA1(88ed978e6df72ce22f9371930360aa9cde73abe9) ) /* adpcm player - "Talker" ROM */ ROM_REGION( 0x08000, "gfx1", 0 ) @@ -1384,7 +1390,7 @@ ROM_START( buraiken ) ROM_REGION( 0x10000, "soundcpu", 0 ) ROM_LOAD( "02.15h", 0x0000, 0x8000, CRC(107a2e17) SHA1(5aae2f4ac9f15ccb4122f3ba9fba588438d62f4f) ) - ROM_REGION( 0x10000, "adpcm", 0 ) /* ADPCM CPU (not emulated) */ + ROM_REGION( 0x10000, "adpcm", 0 ) /* ADPCM CPU */ ROM_LOAD( "01.6d", 0x0000, 0x8000, CRC(c1e5d258) SHA1(88ed978e6df72ce22f9371930360aa9cde73abe9) ) /* adpcm player - "Talker" ROM */ ROM_REGION( 0x08000, "gfx1", 0 ) @@ -1424,6 +1430,59 @@ ROM_END +ROM_START( buraikenb ) + ROM_REGION( 0x20000, "maincpu", 0 ) /* 64k for code + 3*16k for the banked ROMs images */ + ROM_LOAD( "a4", 0x00000, 0x8000, CRC(b4ac7928) SHA1(4a525532f634dd9e800dc3dbd1230a5c431f869a) ) + ROM_LOAD( "a6", 0x10000, 0x8000, CRC(b1c6d40d) SHA1(d150adace829130ebf99b8beeedde0e673124984) ) + ROM_LOAD( "av_05.12n", 0x18000, 0x8000, CRC(9a214b42) SHA1(e13d47dcf9fa055fef467a10751badffcc3b8734) ) + + ROM_REGION( 0x10000, "soundcpu", 0 ) + ROM_LOAD( "a2", 0x0000, 0x8000, CRC(5e991c96) SHA1(1866f38043f61244b65213544fa5ec5d6d82f96f) ) + + ROM_REGION( 0x10000, "adpcm", 0 ) /* ADPCM CPU */ + ROM_LOAD( "01.6d", 0x0000, 0x8000, CRC(c1e5d258) SHA1(88ed978e6df72ce22f9371930360aa9cde73abe9) ) /* adpcm player - "Talker" ROM */ + + ROM_REGION( 0x08000, "gfx1", 0 ) + ROM_LOAD( "03.8k", 0x00000, 0x8000, CRC(efb5883e) SHA1(08aebf579f2c5ff472db66597cde1c6871d7d757) ) /* characters */ + + ROM_REGION( 0x40000, "gfx2", 0 ) /* tiles */ + ROM_LOAD( "13.6b", 0x00000, 0x8000, CRC(9b5ff305) SHA1(8843c757e040b58efd36299eb3c56d9c51362b20) ) /* plane 1 */ + ROM_LOAD( "09.6a", 0x08000, 0x8000, CRC(08323355) SHA1(c5778c6835f2801fba0250cea21796ea201642f7) ) + ROM_LOAD( "12.4b", 0x10000, 0x8000, CRC(6d5261ba) SHA1(667e3b8df871c3052bde7a3c79daa7f70eaa0b8b) ) /* plane 2 */ + ROM_LOAD( "08.4a", 0x18000, 0x8000, CRC(a13d9f54) SHA1(e1bcb6d12cdfc9ad780f131272d12d9af751f429) ) + ROM_LOAD( "11.3b", 0x20000, 0x8000, CRC(a2911d8b) SHA1(f51ef7bb8a275fdd92a9a9ad516218d2f8c3e1fb) ) /* plane 3 */ + ROM_LOAD( "07.3a", 0x28000, 0x8000, CRC(cde78d32) SHA1(8cb69b7a25e935073887628565cb4f9787186ea9) ) + ROM_LOAD( "14.8b", 0x30000, 0x8000, CRC(44ac2671) SHA1(60baa541debd8aa7d32a512906d0d6c6e9955968) ) /* plane 4 */ + ROM_LOAD( "10.8a", 0x38000, 0x8000, CRC(b1a717cb) SHA1(2730764ece0e9231955b9c07de537f1f97729599) ) + + ROM_REGION( 0x40000, "gfx3", 0 ) /* sprites */ + ROM_LOAD( "18.7l", 0x00000, 0x8000, CRC(3c876a17) SHA1(1f06b695b78a2e1db151f3c5baa1bb17ccef951e) ) /* planes 0,1 */ + ROM_LOAD( "16.3l", 0x08000, 0x8000, CRC(4b1ff3ac) SHA1(5166f2a2c9ba2483a4e340d756303cba46b7de88) ) + ROM_LOAD( "17.5l", 0x10000, 0x8000, CRC(4eb543ef) SHA1(5dfdd2568a50b179e724643880d79f79d831be19) ) + ROM_LOAD( "15.2l", 0x18000, 0x8000, CRC(8041de7f) SHA1(c301b20edad1981dd20cd6d4f7de703d9dc80b83) ) + ROM_LOAD( "22.7n", 0x20000, 0x8000, CRC(bdaa8b22) SHA1(9a03d20cc7010f9b7c602db86808d54fdd7e228d) ) /* planes 2,3 */ + ROM_LOAD( "20.3n", 0x28000, 0x8000, CRC(566e3059) SHA1(cf3e5cfcb5ebbff3f9a8e1da9f7242a7a00fee83) ) + ROM_LOAD( "21.5n", 0x30000, 0x8000, CRC(301059aa) SHA1(c529ad83d4e4139ce4d4d912c00aef9ece297706) ) + ROM_LOAD( "19.2n", 0x38000, 0x8000, CRC(a00485ec) SHA1(cc24e7243f55bdfaedeabb7dddf7e1ef32811c45) ) + + ROM_REGION( 0x10000, "gfx4", 0 ) + ROM_LOAD( "av_25.15n", 0x00000, 0x8000, CRC(88a505a7) SHA1(ef4371e082b2370fcbfc96bfef5a94910acd9eff) ) /* planes 0,1 */ + ROM_LOAD( "av_24.13n", 0x08000, 0x8000, CRC(1f4463c8) SHA1(04cdb0187dcbdd4f5f53e60c856d4925ade8d7df) ) /* planes 2,3 */ + + ROM_REGION( 0x08000, "gfx5", 0 ) + ROM_LOAD( "23.9n", 0x0000, 0x8000, CRC(c0a93ef6) SHA1(2dc9cd4eb142d74aea8d151904cb60a0767c6393) ) /* Tile Map */ + + ROM_REGION( 0x0200, "proms", 0 ) + ROM_LOAD( "tbb_2bpr.7j", 0x0000, 0x0100, CRC(d96bcc98) SHA1(99e69a624d5586e5eedacd2083fa68b36e7b5e40) ) /* timing (not used) */ + ROM_LOAD( "tbb_1bpr.1e", 0x0100, 0x0100, CRC(5052fa9d) SHA1(8cd240f4795a7ae76499573c09069dba37182be2) ) /* priority (not used) */ +ROM_END + + +DRIVER_INIT_MEMBER(lwings_state, avengersb) +{ + /* set up protection handlers */ + m_maincpu->space(AS_PROGRAM).install_write_handler(0xf80c, 0xf80c, write8_delegate(FUNC(lwings_state::soundlatch_byte_w), this)); +} /************************************* @@ -1449,3 +1508,4 @@ GAME( 1986, trojanb, trojan, trojan, trojanls, driver_device, 0, ROT0, "b GAME( 1987, avengers, 0, avengers, avengers, driver_device, 0, ROT90, "Capcom", "Avengers (US set 1)", MACHINE_SUPPORTS_SAVE ) GAME( 1987, avengers2, avengers, avengers, avengers, driver_device, 0, ROT90, "Capcom", "Avengers (US set 2)", MACHINE_SUPPORTS_SAVE ) GAME( 1987, buraiken, avengers, avengers, avengers, driver_device, 0, ROT90, "Capcom", "Hissatsu Buraiken (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, buraikenb, avengers, avengersb,avengers, lwings_state, avengersb, ROT90, "Capcom", "Hissatsu Buraiken (Japan, bootleg?)", MACHINE_SUPPORTS_SAVE ) // unprotected at least diff --git a/src/mame/drivers/macrossp.c b/src/mame/drivers/macrossp.c index 242f56fe407..140f8ec37e2 100644 --- a/src/mame/drivers/macrossp.c +++ b/src/mame/drivers/macrossp.c @@ -9,9 +9,6 @@ Driver by David Haywood TODO: - what is the 'bios' rom for? it appears to be data tables and is very different between games but we don't map it anywhere - - priorities - - zooming is wrong - - is alpha REALLY alpha or sprite flicker? - convert tilemaps to devices? 68020 interrupts @@ -293,19 +290,6 @@ Notes: /*** VARIOUS READ / WRITE HANDLERS *******************************************/ -WRITE32_MEMBER(macrossp_state::paletteram32_macrossp_w) -{ - int r,g,b; - COMBINE_DATA(&m_paletteram[offset]); - - b = ((m_paletteram[offset] & 0x0000ff00) >>8); - g = ((m_paletteram[offset] & 0x00ff0000) >>16); - r = ((m_paletteram[offset] & 0xff000000) >>24); - - m_palette->set_pen_color(offset, rgb_t(r,g,b)); -} - - READ32_MEMBER(macrossp_state::macrossp_soundstatus_r) { // logerror("%08x read soundstatus\n", space.device().safe_pc()); @@ -338,44 +322,14 @@ READ16_MEMBER(macrossp_state::macrossp_soundcmd_r) return soundlatch_word_r(space, offset, mem_mask); } -void macrossp_state::update_colors( ) +WRITE16_MEMBER(macrossp_state::palette_fade_w) { - int i, r, g, b; - - for (i = 0; i < 0x1000; i++) - { - b = ((m_paletteram[i] & 0x0000ff00) >> 8); - g = ((m_paletteram[i] & 0x00ff0000) >> 16); - r = ((m_paletteram[i] & 0xff000000) >> 24); - - if (m_fade_effect > b) - b = 0; - else - b -= m_fade_effect; - - if (m_fade_effect > g) - g = 0; - else - g -= m_fade_effect; - - if (m_fade_effect > r) - r = 0; - else - r -= m_fade_effect; - - m_palette->set_pen_color(i, rgb_t(r, g, b)); - } -} - -WRITE32_MEMBER(macrossp_state::macrossp_palette_fade_w) -{ - m_fade_effect = ((data & 0xff00) >> 8) - 0x28; //it writes two times, first with a -0x28 then with the proper data - // popmessage("%02x",fade_effect); - - if (m_old_fade != m_fade_effect) + // 0xff is written a few times on startup + if (data >> 8 != 0xff) { - m_old_fade = m_fade_effect; - update_colors(); + // range seems to be 40 (brightest) to 252 (darkest) + UINT8 fade = ((data >> 8) - 40) / 212.0 * 255.0; + m_screen->set_brightness(0xff - fade); } } @@ -401,13 +355,13 @@ static ADDRESS_MAP_START( macrossp_map, AS_PROGRAM, 32, macrossp_state ) AM_RANGE(0x91c200, 0x91c3ff) AM_RAM AM_SHARE("text_linezoom") /* W/O? */ AM_RANGE(0x91d000, 0x91d00b) AM_RAM AM_SHARE("text_videoregs") /* W/O? */ - AM_RANGE(0xa00000, 0xa03fff) AM_RAM_WRITE(paletteram32_macrossp_w) AM_SHARE("paletteram") + AM_RANGE(0xa00000, 0xa03fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0xb00000, 0xb00003) AM_READ_PORT("INPUTS") AM_RANGE(0xb00004, 0xb00007) AM_READ(macrossp_soundstatus_r) AM_WRITENOP // irq related? AM_RANGE(0xb00008, 0xb0000b) AM_WRITENOP // irq related? AM_RANGE(0xb0000c, 0xb0000f) AM_READ_PORT("DSW") AM_WRITENOP - AM_RANGE(0xb00010, 0xb00013) AM_WRITE(macrossp_palette_fade_w) // macrossp palette fade + AM_RANGE(0xb00010, 0xb00013) AM_WRITE16(palette_fade_w, 0x0000ffff) AM_RANGE(0xb00020, 0xb00023) AM_WRITENOP AM_RANGE(0xc00000, 0xc00003) AM_WRITE(macrossp_soundcmd_w) @@ -574,16 +528,12 @@ void macrossp_state::machine_start() { save_item(NAME(m_sndpending)); save_item(NAME(m_snd_toggle)); - save_item(NAME(m_fade_effect)); - save_item(NAME(m_old_fade)); } void macrossp_state::machine_reset() { m_sndpending = 0; m_snd_toggle = 0; - m_fade_effect = 0; - m_old_fade = 0; } static MACHINE_CONFIG_START( macrossp, macrossp_state ) @@ -607,8 +557,9 @@ static MACHINE_CONFIG_START( macrossp, macrossp_state ) MCFG_SCREEN_VBLANK_DRIVER(macrossp_state, screen_eof_macrossp) MCFG_GFXDECODE_ADD("gfxdecode", "palette", macrossp) - MCFG_PALETTE_ADD("palette", 0x1000) + MCFG_PALETTE_ADD("palette", 4096) + MCFG_PALETTE_FORMAT(RGBX) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") @@ -761,5 +712,5 @@ DRIVER_INIT_MEMBER(macrossp_state,quizmoon) #endif } -GAME( 1996, macrossp, 0, macrossp, macrossp, macrossp_state, macrossp, ROT270, "MOSS / Banpresto", "Macross Plus", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE ) -GAME( 1997, quizmoon, 0, quizmoon, quizmoon, macrossp_state, quizmoon, ROT0, "Banpresto", "Quiz Bisyoujo Senshi Sailor Moon - Chiryoku Tairyoku Toki no Un", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE ) +GAME( 1996, macrossp, 0, macrossp, macrossp, macrossp_state, macrossp, ROT270, "MOSS / Banpresto", "Macross Plus", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE ) +GAME( 1997, quizmoon, 0, quizmoon, quizmoon, macrossp_state, quizmoon, ROT0, "Banpresto", "Quiz Bisyoujo Senshi Sailor Moon - Chiryoku Tairyoku Toki no Un", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/magic10.c b/src/mame/drivers/magic10.c index 8964f8099a0..0753a1aeecd 100644 --- a/src/mame/drivers/magic10.c +++ b/src/mame/drivers/magic10.c @@ -99,8 +99,7 @@ public: m_vregs(*this, "vregs"), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"), - m_generic_paletteram_16(*this, "paletteram") { } + m_palette(*this, "palette") { } tilemap_t *m_layer0_tilemap; tilemap_t *m_layer1_tilemap; @@ -114,7 +113,6 @@ public: DECLARE_WRITE16_MEMBER(layer0_videoram_w); DECLARE_WRITE16_MEMBER(layer1_videoram_w); DECLARE_WRITE16_MEMBER(layer2_videoram_w); - DECLARE_WRITE16_MEMBER(paletteram_w); DECLARE_READ16_MEMBER(magic102_r); DECLARE_READ16_MEMBER(hotslot_copro_r); DECLARE_WRITE16_MEMBER(hotslot_copro_w); @@ -132,7 +130,6 @@ public: required_device<cpu_device> m_maincpu; required_device<gfxdecode_device> m_gfxdecode; required_device<palette_device> m_palette; - required_shared_ptr<UINT16> m_generic_paletteram_16; }; @@ -158,13 +155,6 @@ WRITE16_MEMBER(magic10_state::layer2_videoram_w) m_layer2_tilemap->mark_tile_dirty(offset >> 1); } -WRITE16_MEMBER(magic10_state::paletteram_w) -{ - data = COMBINE_DATA(&m_generic_paletteram_16[offset]); - m_palette->set_pen_color( offset, pal4bit(data >> 4), pal4bit(data >> 0), pal4bit(data >> 8)); -} - - TILE_GET_INFO_MEMBER(magic10_state::get_layer0_tile_info) { SET_TILE_INFO_MEMBER(1, @@ -302,7 +292,7 @@ static ADDRESS_MAP_START( magic10_map, AS_PROGRAM, 16, magic10_state ) AM_RANGE(0x101000, 0x101fff) AM_RAM_WRITE(layer0_videoram_w) AM_SHARE("layer0_videoram") AM_RANGE(0x102000, 0x103fff) AM_RAM_WRITE(layer2_videoram_w) AM_SHARE("layer2_videoram") AM_RANGE(0x200000, 0x2007ff) AM_RAM AM_SHARE("nvram") - AM_RANGE(0x300000, 0x3001ff) AM_RAM_WRITE(paletteram_w) AM_SHARE("paletteram") + AM_RANGE(0x300000, 0x3001ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0x400000, 0x400001) AM_READ_PORT("INPUTS") AM_RANGE(0x400002, 0x400003) AM_READ_PORT("DSW") AM_RANGE(0x400008, 0x400009) AM_WRITE(magic10_out_w) @@ -318,7 +308,7 @@ static ADDRESS_MAP_START( magic10a_map, AS_PROGRAM, 16, magic10_state ) AM_RANGE(0x101000, 0x101fff) AM_RAM_WRITE(layer0_videoram_w) AM_SHARE("layer0_videoram") AM_RANGE(0x102000, 0x103fff) AM_RAM_WRITE(layer2_videoram_w) AM_SHARE("layer2_videoram") AM_RANGE(0x200000, 0x2007ff) AM_RAM AM_SHARE("nvram") - AM_RANGE(0x300000, 0x3001ff) AM_RAM_WRITE(paletteram_w) AM_SHARE("paletteram") + AM_RANGE(0x300000, 0x3001ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0x500000, 0x500001) AM_READ_PORT("INPUTS") AM_RANGE(0x500002, 0x500003) AM_READ_PORT("DSW") AM_RANGE(0x500008, 0x500009) AM_WRITE(magic10_out_w) @@ -334,7 +324,7 @@ static ADDRESS_MAP_START( magic102_map, AS_PROGRAM, 16, magic10_state ) AM_RANGE(0x101000, 0x101fff) AM_RAM_WRITE(layer0_videoram_w) AM_SHARE("layer0_videoram") AM_RANGE(0x102000, 0x103fff) AM_RAM_WRITE(layer2_videoram_w) AM_SHARE("layer2_videoram") AM_RANGE(0x200000, 0x2007ff) AM_RAM AM_SHARE("nvram") - AM_RANGE(0x400000, 0x4001ff) AM_RAM_WRITE(paletteram_w) AM_SHARE("paletteram") + AM_RANGE(0x400000, 0x4001ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0x500000, 0x500001) AM_READ(magic102_r) AM_RANGE(0x500004, 0x500005) AM_READNOP // gives credits AM_RANGE(0x500006, 0x500007) AM_READNOP // gives credits @@ -353,7 +343,7 @@ static ADDRESS_MAP_START( hotslot_map, AS_PROGRAM, 16, magic10_state ) AM_RANGE(0x101000, 0x101fff) AM_RAM_WRITE(layer0_videoram_w) AM_SHARE("layer0_videoram") AM_RANGE(0x102000, 0x103fff) AM_RAM_WRITE(layer2_videoram_w) AM_SHARE("layer2_videoram") AM_RANGE(0x200000, 0x2007ff) AM_RAM AM_SHARE("nvram") - AM_RANGE(0x400000, 0x4001ff) AM_RAM_WRITE(paletteram_w) AM_SHARE("paletteram") + AM_RANGE(0x400000, 0x4001ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0x500004, 0x500005) AM_READWRITE(hotslot_copro_r, hotslot_copro_w) // copro comm AM_RANGE(0x500006, 0x500011) AM_RAM AM_RANGE(0x500012, 0x500013) AM_READ_PORT("IN0") @@ -372,7 +362,7 @@ static ADDRESS_MAP_START( sgsafari_map, AS_PROGRAM, 16, magic10_state ) AM_RANGE(0x101000, 0x101fff) AM_RAM_WRITE(layer0_videoram_w) AM_SHARE("layer0_videoram") AM_RANGE(0x102000, 0x103fff) AM_RAM_WRITE(layer2_videoram_w) AM_SHARE("layer2_videoram") AM_RANGE(0x200000, 0x203fff) AM_RAM AM_SHARE("nvram") - AM_RANGE(0x300000, 0x3001ff) AM_RAM_WRITE(paletteram_w) AM_SHARE("paletteram") + AM_RANGE(0x300000, 0x3001ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0x500002, 0x500003) AM_READ_PORT("DSW1") AM_RANGE(0x500008, 0x500009) AM_WRITE(magic10_out_w) AM_RANGE(0x50000a, 0x50000b) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff) @@ -743,9 +733,10 @@ static MACHINE_CONFIG_START( magic10, magic10_state ) MCFG_SCREEN_UPDATE_DRIVER(magic10_state, screen_update_magic10) MCFG_SCREEN_PALETTE("palette") - MCFG_PALETTE_ADD("palette", 0x100) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", magic10) + MCFG_PALETTE_ADD("palette", 256) + MCFG_PALETTE_FORMAT(xxxxBBBBRRRRGGGG) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", magic10) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") diff --git a/src/mame/drivers/mainevt.c b/src/mame/drivers/mainevt.c index 5d63550de55..840da8b536b 100644 --- a/src/mame/drivers/mainevt.c +++ b/src/mame/drivers/mainevt.c @@ -51,7 +51,7 @@ INTERRUPT_GEN_MEMBER(mainevt_state::dv_interrupt) WRITE8_MEMBER(mainevt_state::mainevt_bankswitch_w) { /* bit 0-1 ROM bank select */ - membank("bank1")->set_entry(data & 0x03); + m_rombank->set_entry(data & 0x03); /* TODO: bit 5 = select work RAM or palette? */ //palette_selected = data & 0x20; @@ -170,7 +170,7 @@ static ADDRESS_MAP_START( mainevt_map, AS_PROGRAM, 8, mainevt_state ) AM_RANGE(0x4000, 0x5dff) AM_RAM AM_RANGE(0x5e00, 0x5fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") - AM_RANGE(0x6000, 0x7fff) AM_ROMBANK("bank1") + AM_RANGE(0x6000, 0x7fff) AM_ROMBANK("rombank") AM_RANGE(0x8000, 0xffff) AM_ROM ADDRESS_MAP_END @@ -194,7 +194,7 @@ static ADDRESS_MAP_START( devstors_map, AS_PROGRAM, 8, mainevt_state ) AM_RANGE(0x4000, 0x5dff) AM_RAM AM_RANGE(0x5e00, 0x5fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") - AM_RANGE(0x6000, 0x7fff) AM_ROMBANK("bank1") + AM_RANGE(0x6000, 0x7fff) AM_ROMBANK("rombank") AM_RANGE(0x8000, 0xffff) AM_ROM ADDRESS_MAP_END @@ -380,9 +380,7 @@ WRITE8_MEMBER(mainevt_state::volume_callback) void mainevt_state::machine_start() { - UINT8 *ROM = memregion("maincpu")->base(); - - membank("bank1")->configure_entries(0, 4, &ROM[0x10000], 0x2000); + m_rombank->configure_entries(0, 4, memregion("maincpu")->base(), 0x2000); save_item(NAME(m_nmi_enable)); } @@ -428,14 +426,13 @@ static MACHINE_CONFIG_START( mainevt, mainevt_state ) MCFG_PALETTE_ENABLE_SHADOWS() MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR) - MCFG_VIDEO_START_OVERRIDE(mainevt_state,mainevt) - MCFG_DEVICE_ADD("k052109", K052109, 0) MCFG_GFX_PALETTE("palette") MCFG_K052109_CB(mainevt_state, mainevt_tile_callback) MCFG_DEVICE_ADD("k051960", K051960, 0) MCFG_GFX_PALETTE("palette") + MCFG_K051960_SCREEN_TAG("screen") MCFG_K051960_CB(mainevt_state, mainevt_sprite_callback) /* sound hardware */ @@ -475,14 +472,13 @@ static MACHINE_CONFIG_START( devstors, mainevt_state ) MCFG_PALETTE_ENABLE_SHADOWS() MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR) - MCFG_VIDEO_START_OVERRIDE(mainevt_state,dv) - MCFG_DEVICE_ADD("k052109", K052109, 0) MCFG_GFX_PALETTE("palette") MCFG_K052109_CB(mainevt_state, dv_tile_callback) MCFG_DEVICE_ADD("k051960", K051960, 0) MCFG_GFX_PALETTE("palette") + MCFG_K051960_SCREEN_TAG("screen") MCFG_K051960_CB(mainevt_state, dv_sprite_callback) MCFG_K051733_ADD("k051733") @@ -510,11 +506,10 @@ MACHINE_CONFIG_END ROM_START( mainevt ) /* 4 players - English title screen - No "Warning" message in the ROM */ - ROM_REGION( 0x40000, "maincpu", 0 ) - ROM_LOAD( "799y02.k11", 0x10000, 0x08000, CRC(e2e7dbd5) SHA1(80314cd42a9f47f7bb82a2160fb5ef2ddc6dff30) ) - ROM_CONTINUE( 0x08000, 0x08000 ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "799y02.k11", 0x00000, 0x10000, CRC(e2e7dbd5) SHA1(80314cd42a9f47f7bb82a2160fb5ef2ddc6dff30) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_REGION( 0x8000, "audiocpu", 0 ) ROM_LOAD( "799c01.f7", 0x00000, 0x08000, CRC(447c4c5c) SHA1(86e42132793c59cc6feece143516f7ecd4ed14e8) ) ROM_REGION( 0x20000, "k052109", 0 ) /* tiles */ @@ -538,11 +533,10 @@ ROM_START( mainevt ) /* 4 players - English title screen - No "Warning" messa ROM_END ROM_START( mainevto ) /* 4 players - English title screen - No "Warning" message in the ROM */ - ROM_REGION( 0x40000, "maincpu", 0 ) - ROM_LOAD( "799f02.k11", 0x10000, 0x08000, CRC(c143596b) SHA1(5da7efaf0f7c7a493cc242eae115f278bc9c134b) ) - ROM_CONTINUE( 0x08000, 0x08000 ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "799f02.k11", 0x00000, 0x10000, CRC(c143596b) SHA1(5da7efaf0f7c7a493cc242eae115f278bc9c134b) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_REGION( 0x8000, "audiocpu", 0 ) ROM_LOAD( "799c01.f7", 0x00000, 0x08000, CRC(447c4c5c) SHA1(86e42132793c59cc6feece143516f7ecd4ed14e8) ) ROM_REGION( 0x20000, "k052109", 0 ) /* tiles */ @@ -566,11 +560,10 @@ ROM_START( mainevto ) /* 4 players - English title screen - No "Warning" messa ROM_END ROM_START( mainevt2p ) /* 2 players - English title screen - "Warning" message in the ROM (not displayed) */ - ROM_REGION( 0x40000, "maincpu", 0 ) - ROM_LOAD( "799x02.k11", 0x10000, 0x08000, CRC(42cfc650) SHA1(2d1918ebc0d93a2356ad995a6854dbde7c3b8daf) ) - ROM_CONTINUE( 0x08000, 0x08000 ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "799x02.k11", 0x00000, 0x10000, CRC(42cfc650) SHA1(2d1918ebc0d93a2356ad995a6854dbde7c3b8daf) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_REGION( 0x8000, "audiocpu", 0 ) ROM_LOAD( "799c01.f7", 0x00000, 0x08000, CRC(447c4c5c) SHA1(86e42132793c59cc6feece143516f7ecd4ed14e8) ) ROM_REGION( 0x20000, "k052109", 0 ) /* tiles */ @@ -594,11 +587,10 @@ ROM_START( mainevt2p ) /* 2 players - English title screen - "Warning" message ROM_END ROM_START( ringohja ) /* 2 players - Japan title screen - "Warning" message in the ROM (displayed) */ - ROM_REGION( 0x40000, "maincpu", 0 ) - ROM_LOAD( "799n02.k11", 0x10000, 0x08000, CRC(f9305dd0) SHA1(7135053be9d46ac9c09ab63eca1eb71825a71a13) ) - ROM_CONTINUE( 0x08000, 0x08000 ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "799n02.k11", 0x00000, 0x10000, CRC(f9305dd0) SHA1(7135053be9d46ac9c09ab63eca1eb71825a71a13) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_REGION( 0x8000, "audiocpu", 0 ) ROM_LOAD( "799c01.f7", 0x00000, 0x08000, CRC(447c4c5c) SHA1(86e42132793c59cc6feece143516f7ecd4ed14e8) ) ROM_REGION( 0x20000, "k052109", 0 ) /* tiles */ @@ -623,11 +615,10 @@ ROM_END ROM_START( devstors ) - ROM_REGION( 0x40000, "maincpu", 0 ) - ROM_LOAD( "890z02.k11", 0x10000, 0x08000, CRC(ebeb306f) SHA1(838fcfe95dfedd61f21f34301d48e337db765ab2) ) - ROM_CONTINUE( 0x08000, 0x08000 ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "890z02.k11", 0x00000, 0x10000, CRC(ebeb306f) SHA1(838fcfe95dfedd61f21f34301d48e337db765ab2) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_REGION( 0x8000, "audiocpu", 0 ) ROM_LOAD( "890k01.f7", 0x00000, 0x08000, CRC(d44b3eb0) SHA1(26109fc56668b65f1a5aa6d8ec2c08fd70ca7c51) ) ROM_REGION( 0x40000, "k052109", 0 ) /* tiles */ @@ -648,11 +639,10 @@ ROM_START( devstors ) ROM_END ROM_START( devstors2 ) - ROM_REGION( 0x40000, "maincpu", 0 ) - ROM_LOAD( "890x02.k11", 0x10000, 0x08000, CRC(e58ebb35) SHA1(4253b6a7128534cc0866bc910a271d91ac8b40fd) ) - ROM_CONTINUE( 0x08000, 0x08000 ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "890x02.k11", 0x00000, 0x10000, CRC(e58ebb35) SHA1(4253b6a7128534cc0866bc910a271d91ac8b40fd) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_REGION( 0x8000, "audiocpu", 0 ) ROM_LOAD( "890k01.f7", 0x00000, 0x08000, CRC(d44b3eb0) SHA1(26109fc56668b65f1a5aa6d8ec2c08fd70ca7c51) ) ROM_REGION( 0x40000, "k052109", 0 ) /* tiles */ @@ -673,11 +663,10 @@ ROM_START( devstors2 ) ROM_END ROM_START( devstors3 ) - ROM_REGION( 0x40000, "maincpu", 0 ) - ROM_LOAD( "890v02.k11", 0x10000, 0x08000, CRC(52f4ccdd) SHA1(074e526ed170a5f2083c8c0808734291a2ea7403) ) - ROM_CONTINUE( 0x08000, 0x08000 ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "890v02.k11", 0x00000, 0x10000, CRC(52f4ccdd) SHA1(074e526ed170a5f2083c8c0808734291a2ea7403) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_REGION( 0x8000, "audiocpu", 0 ) ROM_LOAD( "890k01.f7", 0x00000, 0x08000, CRC(d44b3eb0) SHA1(26109fc56668b65f1a5aa6d8ec2c08fd70ca7c51) ) ROM_REGION( 0x40000, "k052109", 0 ) /* tiles */ @@ -698,11 +687,10 @@ ROM_START( devstors3 ) ROM_END ROM_START( garuka ) - ROM_REGION( 0x40000, "maincpu", 0 ) - ROM_LOAD( "890w02.k11", 0x10000, 0x08000, CRC(b2f6f538) SHA1(95dad3258a2e4c5648d0fc22c06fa3e2da3b5ed1) ) - ROM_CONTINUE( 0x08000, 0x08000 ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "890w02.k11", 0x00000, 0x10000, CRC(b2f6f538) SHA1(95dad3258a2e4c5648d0fc22c06fa3e2da3b5ed1) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) + ROM_REGION( 0x8000, "audiocpu", 0 ) ROM_LOAD( "890k01.f7", 0x00000, 0x08000, CRC(d44b3eb0) SHA1(26109fc56668b65f1a5aa6d8ec2c08fd70ca7c51) ) ROM_REGION( 0x40000, "k052109", 0 ) /* tiles */ diff --git a/src/mame/drivers/mcr68.c b/src/mame/drivers/mcr68.c index b83fd31409e..1736a5fb1f5 100644 --- a/src/mame/drivers/mcr68.c +++ b/src/mame/drivers/mcr68.c @@ -308,7 +308,7 @@ static ADDRESS_MAP_START( mcr68_map, AS_PROGRAM, 16, mcr68_state ) AM_RANGE(0x070000, 0x070fff) AM_RAM_WRITE(mcr68_videoram_w) AM_SHARE("videoram") AM_RANGE(0x071000, 0x071fff) AM_RAM AM_RANGE(0x080000, 0x080fff) AM_RAM AM_SHARE("spriteram") - AM_RANGE(0x090000, 0x09007f) AM_WRITE(mcr68_paletteram_w) AM_SHARE("paletteram") + AM_RANGE(0x090000, 0x09007f) AM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0x0a0000, 0x0a000f) AM_READWRITE(mcr68_6840_upper_r, mcr68_6840_upper_w) AM_RANGE(0x0b0000, 0x0bffff) AM_WRITE(watchdog_reset16_w) AM_RANGE(0x0d0000, 0x0dffff) AM_READ_PORT("IN0") @@ -334,7 +334,7 @@ static ADDRESS_MAP_START( zwackery_map, AS_PROGRAM, 16, mcr68_state ) AM_RANGE(0x108000, 0x108007) AM_DEVREADWRITE8("pia1", pia6821_device, read, write, 0x00ff) AM_RANGE(0x10c000, 0x10c007) AM_DEVREADWRITE8("pia2", pia6821_device, read, write, 0x00ff) AM_RANGE(0x800000, 0x800fff) AM_RAM_WRITE(zwackery_videoram_w) AM_SHARE("videoram") - AM_RANGE(0x802000, 0x803fff) AM_RAM_WRITE(zwackery_paletteram_w) AM_SHARE("paletteram") + AM_RANGE(0x802000, 0x803fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0xc00000, 0xc00fff) AM_RAM_WRITE(zwackery_spriteram_w) AM_SHARE("spriteram") ADDRESS_MAP_END @@ -352,7 +352,7 @@ static ADDRESS_MAP_START( pigskin_map, AS_PROGRAM, 16, mcr68_state ) AM_RANGE(0x000000, 0x03ffff) AM_ROM AM_RANGE(0x080000, 0x08ffff) AM_READ(pigskin_port_1_r) AM_RANGE(0x0a0000, 0x0affff) AM_READ(pigskin_port_2_r) - AM_RANGE(0x0c0000, 0x0c007f) AM_WRITE(mcr68_paletteram_w) AM_SHARE("paletteram") + AM_RANGE(0x0c0000, 0x0c007f) AM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0x0e0000, 0x0effff) AM_WRITE(watchdog_reset16_w) AM_RANGE(0x100000, 0x100fff) AM_RAM_WRITE(mcr68_videoram_w) AM_SHARE("videoram") AM_RANGE(0x120000, 0x120001) AM_READWRITE(pigskin_protection_r, pigskin_protection_w) @@ -378,7 +378,7 @@ static ADDRESS_MAP_START( trisport_map, AS_PROGRAM, 16, mcr68_state ) AM_RANGE(0x080000, 0x08ffff) AM_READ(trisport_port_1_r) AM_RANGE(0x0a0000, 0x0affff) AM_READ_PORT("DSW") AM_RANGE(0x100000, 0x103fff) AM_RAM AM_SHARE("nvram") - AM_RANGE(0x120000, 0x12007f) AM_WRITE(mcr68_paletteram_w) AM_SHARE("paletteram") + AM_RANGE(0x120000, 0x12007f) AM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0x140000, 0x1407ff) AM_RAM AM_SHARE("spriteram") AM_RANGE(0x160000, 0x160fff) AM_RAM_WRITE(mcr68_videoram_w) AM_SHARE("videoram") AM_RANGE(0x180000, 0x18000f) AM_READWRITE(mcr68_6840_upper_r, mcr68_6840_upper_w) @@ -1054,6 +1054,7 @@ static MACHINE_CONFIG_START( zwackery, mcr68_state ) MCFG_GFXDECODE_ADD("gfxdecode", "palette", zwackery) MCFG_PALETTE_ADD("palette", 4096) + MCFG_PALETTE_FORMAT(xRRRRRBBBBBGGGGG_inverted) MCFG_VIDEO_START_OVERRIDE(mcr68_state,zwackery) @@ -1086,6 +1087,7 @@ static MACHINE_CONFIG_START( mcr68, mcr68_state ) MCFG_GFXDECODE_ADD("gfxdecode", "palette", mcr68) MCFG_PALETTE_ADD("palette", 64) + MCFG_PALETTE_FORMAT(xxxxxxxRRRBBBGGG) MCFG_VIDEO_START_OVERRIDE(mcr68_state,mcr68) diff --git a/src/mame/drivers/mediagx.c b/src/mame/drivers/mediagx.c index 429dc44d622..57cca0c4b97 100644 --- a/src/mame/drivers/mediagx.c +++ b/src/mame/drivers/mediagx.c @@ -287,7 +287,7 @@ void mediagx_state::draw_framebuffer(bitmap_rgb32 &bitmap, const rectangle &clip m_frame_height = height; visarea.set(0, width - 1, 0, height - 1); - m_screen->configure(width, height * 262 / 240, visarea, m_screen->frame_period().attoseconds); + m_screen->configure(width, height * 262 / 240, visarea, m_screen->frame_period().attoseconds()); } if (m_disp_ctrl_reg[DC_OUTPUT_CFG] & 0x1) // 8-bit mode diff --git a/src/mame/drivers/megasys1.c b/src/mame/drivers/megasys1.c index 1ff447a3069..25586a44322 100644 --- a/src/mame/drivers/megasys1.c +++ b/src/mame/drivers/megasys1.c @@ -2358,6 +2358,46 @@ ROM_START( edf ) ROM_LOAD( "rd.20n", 0x0000, 0x0200, CRC(1d877538) SHA1(a5be0dc65dcfc36fbba10d1fddbe155e24b6122f) ) ROM_END + +ROM_START( edfa ) + ROM_REGION( 0xc0000, "maincpu", 0 ) /* Main CPU Code: 00000-3ffff & 80000-bffff */ + ROM_LOAD16_BYTE( "5.b5", 0x00000, 0x20000, CRC(6edd3c53) SHA1(53fd42f417be7ca57bd941abe343e2730a7b3ba9) ) + ROM_CONTINUE ( 0x80000, 0x20000 ) + ROM_LOAD16_BYTE( "6.b3", 0x00001, 0x20000, CRC(4d8bfa8f) SHA1(9d61f035e7c73a26b5de5380030c511eebeb7ece) ) + ROM_CONTINUE ( 0x80001, 0x20000 ) + + // rest from edf: + + ROM_REGION( 0x40000, "audiocpu", 0 ) /* Sound CPU Code */ + ROM_LOAD16_BYTE( "edf1.f5", 0x000000, 0x020000, CRC(2290ea19) SHA1(64c9394bd4d5569d68833d2e57abaf2f1af5be97) ) + ROM_LOAD16_BYTE( "edf2.f3", 0x000001, 0x020000, CRC(ce93643e) SHA1(686bf0ec104af8c97624a782e0d60afe170fd945) ) + + ROM_REGION( 0x1000, "mcu", 0 ) /* MCU Internal Code, 64 pin DIP surface scratched, m50747? */ + ROM_LOAD( "edf.mcu", 0x000000, 0x1000, NO_DUMP ) + + ROM_REGION( 0x080000, "gfx1", 0 ) /* Scroll 0 */ + ROM_LOAD( "edf_m04.rom", 0x000000, 0x080000, CRC(6744f406) SHA1(3b8f13ca968456186d9ad61f34611b7eab62ea86) ) + + ROM_REGION( 0x080000, "gfx2", 0 ) /* Scroll 1 */ + ROM_LOAD( "edf_m05.rom", 0x000000, 0x080000, CRC(6f47e456) SHA1(823baa9dc4cb2425c64e9332c6ed4678e49d0c7b) ) + + ROM_REGION( 0x020000, "gfx3", 0 ) /* Scroll 2 */ + ROM_LOAD( "edf_09.rom", 0x000000, 0x020000, CRC(96e38983) SHA1(a4fb94f15d9a9f7df1645be66fe3e179d0ebf765) ) + + ROM_REGION( 0x080000, "gfx4", 0 ) /* Sprites */ + ROM_LOAD( "edf_m03.rom", 0x000000, 0x080000, CRC(ef469449) SHA1(bc591e56c5478383eb4bd29f16133c6ba407c22f) ) + + ROM_REGION( 0x040000, "oki1", 0 ) /* Samples */ + ROM_LOAD( "edf_m02.rom", 0x000000, 0x040000, CRC(fc4281d2) SHA1(67ea324ff359a5d9e7538c08865b5eeebd16704b) ) + + ROM_REGION( 0x040000, "oki2", 0 ) /* Samples */ + ROM_LOAD( "edf_m01.rom", 0x000000, 0x040000, CRC(9149286b) SHA1(f6c66c5cd50b72c4d401a263c65a8d4ef8cf9221) ) + + ROM_REGION( 0x0200, "proms", 0 ) /* Priority PROM (N82S131N compatible type PROM) */ + ROM_LOAD( "rd.20n", 0x0000, 0x0200, CRC(1d877538) SHA1(a5be0dc65dcfc36fbba10d1fddbe155e24b6122f) ) +ROM_END + + ROM_START( edfu ) ROM_REGION( 0xc0000, "maincpu", 0 ) /* Main CPU Code: 00000-3ffff & 80000-bffff */ ROM_LOAD16_BYTE( "edf5.b5", 0x000000, 0x020000, CRC(105094d1) SHA1(e962164836756bc20c2b5dc0032042a0219e82d8) ) @@ -2365,6 +2405,8 @@ ROM_START( edfu ) ROM_LOAD16_BYTE( "edf6.b3", 0x000001, 0x020000, CRC(4797de97) SHA1(dcfcc376a49853c938d772808efe421ba4ba24da) ) ROM_CONTINUE ( 0x080001, 0x020000 ) + // rest from edf: + ROM_REGION( 0x40000, "audiocpu", 0 ) /* Sound CPU Code */ ROM_LOAD16_BYTE( "edf1.f5", 0x000000, 0x020000, CRC(2290ea19) SHA1(64c9394bd4d5569d68833d2e57abaf2f1af5be97) ) ROM_LOAD16_BYTE( "edf2.f3", 0x000001, 0x020000, CRC(ce93643e) SHA1(686bf0ec104af8c97624a782e0d60afe170fd945) ) @@ -2430,6 +2472,7 @@ ROM_START( edfbl ) ROM_LOAD( "rd.20n", 0x0000, 0x0200, CRC(1d877538) SHA1(a5be0dc65dcfc36fbba10d1fddbe155e24b6122f) ) ROM_END + /*************************************************************************** [ Hachoo! ] @@ -3544,6 +3587,77 @@ ROM_START( stdragona ) ROM_LOAD( "prom.14m", 0x0000, 0x0200, CRC(1d877538) SHA1(a5be0dc65dcfc36fbba10d1fddbe155e24b6122f) ) ROM_END +/*************************************************************************** + +Bootleg version of Saint Dragon. Two PCBs connected by two flat cables. +Sound section can host two oki chips (and roms) but only one is populated. +No ASICs just logic chips. + +- ROMs A-19 and A-20 are fitted 'piggy backed' with one pin + from A-20 bent out and wired to a nearby TTL. + +- Stage 5 has some of its background graphics corrupted. + Don't know if it is a PCB issue or designed like that. + +***************************************************************************/ + +ROM_START( stdragonb ) + ROM_REGION( 0x60000, "maincpu", 0 ) /* Main CPU Code */ + ROM_LOAD16_BYTE( "a-4.bin", 0x00000, 0x10000, CRC(c58fe5c2) SHA1(221767e995e05b076e256b1818c4b5d85f58e7e6) ) + ROM_LOAD16_BYTE( "a-2.bin", 0x00001, 0x10000, CRC(46a7cdbb) SHA1(b90a0c10a5e7584e565f61b7bb143fb5800ae039) ) + ROM_LOAD16_BYTE( "a-3.bin", 0x20000, 0x10000, CRC(f6a268c4) SHA1(106184fb18ad8018e9a4aad383c7243c254bfab1) ) + ROM_LOAD16_BYTE( "a-1.bin", 0x20001, 0x10000, CRC(0fb439bd) SHA1(ab596cee4d14f9d805c065d826f36298c6486975) ) + + ROM_REGION( 0x20000, "audiocpu", 0 ) /* Sound CPU Code */ + ROM_LOAD16_BYTE( "b-20.bin", 0x00000, 0x10000, CRC(8c04feaa) SHA1(57e86fd88dc72d123a41f0dee80a16be38ac2e81) ) // = jsd-05 + ROM_LOAD16_BYTE( "b-19.bin", 0x00001, 0x10000, CRC(0bb62f3a) SHA1(68d9f161ba2568f8e046b1a40127bbb973d7a884) ) // = jsd-06 + + ROM_REGION( 0x080000, "gfx1", 0 ) /* Scroll 0 */ + ROM_LOAD( "a-15.bin", 0x00000, 0x10000, CRC(42f7d2cd) SHA1(7518b2d1d92a1c48e6d8ae0723cfa76ac67fa2b9) ) // ~= jsd-11 [1/2] + ROM_LOAD( "a-16.bin", 0x10000, 0x10000, CRC(4f519a97) SHA1(fc7c9f6756f9b6c8fa96c2eea61066859120ad3a) ) // ~= jsd-11 [2/2] + ROM_LOAD( "a-14.bin", 0x20000, 0x10000, CRC(d8ba8d4c) SHA1(47c179e46f329c32f09ba539c742633f390fc449) ) // ~= jsd-12 [1/2] + + ROM_LOAD( "a-18.bin", 0x40000, 0x10000, CRC(5e35f269) SHA1(54b3108f819056582c3e85432faa6c31dd706cbe) ) // ~= jsd-13 [1/2] + ROM_LOAD( "a-19.bin", 0x50000, 0x10000, CRC(b818db20) SHA1(f60b041a7934fb3d1ebf8fcdf12121e33734c6ae) ) // ~= jsd-13 [2/2] + ROM_LOAD( "a-17.bin", 0x60000, 0x10000, CRC(0f6094f9) SHA1(952976c7e019536b8d718ce7c6ed5e6a643b4070) ) // ~= jsd-14 [1/2] + ROM_LOAD( "a-20.bin", 0x70000, 0x10000, CRC(e8849b15) SHA1(2c18f56da4d26ca7112d9bd720f26e9cce078eb7) ) // ~= jsd-14 [2/2] + + ROM_REGION( 0x080000, "gfx2", 0 ) /* Scroll 1 */ + ROM_LOAD( "a-9.bin", 0x00000, 0x10000, CRC(135c2e0e) SHA1(052b29c7060117c7e3e6c7c7826c129775564f87) ) // = jsd-15 [1/2] + ROM_LOAD( "a-10.bin", 0x10000, 0x10000, CRC(19cec47a) SHA1(b90600b39e4c54e1405be27740e8c55b18681632) ) // = jsd-15 [2/2] + ROM_LOAD( "a-5.bin", 0x20000, 0x10000, CRC(da4ca7bf) SHA1(f472ce7f474a56779dd3bbd729d908494e94c91c) ) // = jsd-16 [1/2] + ROM_LOAD( "a-6.bin", 0x30000, 0x10000, CRC(9d9b6470) SHA1(a6433687b1b13517e249138dac1b088ff0bcd2ff) ) // = jsd-16 [2/2] + ROM_LOAD( "a-12.bin", 0x40000, 0x10000, CRC(22382b5f) SHA1(e177368bf1e02a57d4284362804e1ba5a39cfb35) ) // = jsd-17 [1/2] + ROM_LOAD( "a-11.bin", 0x50000, 0x10000, CRC(26c2494d) SHA1(224aabd2e431f490bc9e06682ee279e7ca3a7df7) ) // = jsd-17 [2/2] + ROM_LOAD( "a-7.bin", 0x60000, 0x10000, CRC(cee3a6f7) SHA1(3829591a6724b080435e9d008ff51faf69ebcd71) ) // = jsd-18 [1/2] + ROM_LOAD( "a-8.bin", 0x70000, 0x10000, CRC(883b99bb) SHA1(820afda20ba2b66ac89a5982178aa5b5f6e2bd74) ) // = jsd-18 [2/2] + + ROM_REGION( 0x020000, "gfx3", 0 ) /* Scroll 2 */ + ROM_LOAD( "a-13.bin", 0x000000, 0x08000, CRC(9e487aa1) SHA1(6d418467bc865a7069b5a9eb0707d23ce821ad28) ) // = jsd-19 [1/2] + + ROM_REGION( 0x080000, "gfx4", 0 ) /* Sprites */ + ROM_LOAD( "a-22.bin", 0x00000, 0x10000, CRC(c7ee6d89) SHA1(45bba446dc5821222c09957380d74993310cb3a1) ) // ~= jsd-20 [1/2] + ROM_LOAD( "a-23.bin", 0x10000, 0x10000, CRC(79552709) SHA1(2e5120efcc0afc46642561b269f410498f6f5bef) ) // ~= jsd-20 [2/2] + ROM_LOAD( "a-25.bin", 0x20000, 0x10000, CRC(d8926711) SHA1(56c2f25e21eacd4fb779fa04ffd06de937c557ef) ) // ~= jsd-21 [1/2] + ROM_LOAD( "a-26.bin", 0x30000, 0x10000, CRC(41d76447) SHA1(cfced91518859b93b77c9097f0b44adef66c8683) ) // ~= jsd-21 [2/2] + ROM_LOAD( "a-21.bin", 0x40000, 0x10000, CRC(5af84bd5) SHA1(a0b4dd69c8e0e2f38f67d42dcadb1254299ab649) ) // ~= jsd-22 [1/2] + ROM_LOAD( "a-24.bin", 0x50000, 0x10000, CRC(09ae3173) SHA1(6c5c49297319decf530f3c0930d5146836d425b1) ) // ~= jsd-22 [2/2] + ROM_LOAD( "a-27.bin", 0x60000, 0x10000, CRC(c9049e98) SHA1(d24775704a4898293522ea5c2a901c6f457dce75) ) // ~= jsd-23 [1/2] + ROM_LOAD( "a-28.bin", 0x70000, 0x10000, CRC(b4d12106) SHA1(08018251d10c0f5410779fa68cf95c87ba89ea56) ) // ~= jsd-23 [2/2] + + ROM_REGION( 0x040000, "oki1", ROMREGION_ERASE00 ) /* Samples */ + // unpopulated + + ROM_REGION( 0x040000, "oki2", 0 ) /* Samples */ + ROM_LOAD( "a-29.bin", 0x00000, 0x10000, CRC(0049aa65) SHA1(29efff074e0fd23eb3cc9ccd3a0eae0acc812e39) ) // = jsd-07 [1/2] + ROM_LOAD( "a-30.bin", 0x10000, 0x10000, CRC(05bce2c7) SHA1(4aaf5156bafb3451492c5053d7d75994a72f8738) ) // = jsd-07 [2/2] + ROM_LOAD( "b-17.bin", 0x20000, 0x10000, CRC(3e4e34d3) SHA1(3cda83d8f9e9108acbace717f167cccb8adc5b90) ) // = jsd-08 [1/2] + ROM_LOAD( "b-18.bin", 0x30000, 0x10000, CRC(738a6643) SHA1(d41a0eaf076847d63a9a23db16a99627ec118f97) ) // = jsd-08 [2/2] + + ROM_REGION( 0x0200, "proms", 0 ) /* Priority PROM */ + ROM_LOAD( "prom.14m", 0x0000, 0x0200, CRC(1d877538) SHA1(a5be0dc65dcfc36fbba10d1fddbe155e24b6122f) ) // from parent +ROM_END + /*************************************************************************** @@ -4138,6 +4252,12 @@ DRIVER_INIT_MEMBER(megasys1_state,stdragona) m_maincpu->space(AS_PROGRAM).install_write_handler(0x23ff0, 0x23ff9, write16_delegate(FUNC(megasys1_state::stdragon_mcu_hs_w),this)); } +DRIVER_INIT_MEMBER(megasys1_state,stdragonb) +{ + stdragona_gfx_unmangle("gfx1"); + stdragona_gfx_unmangle("gfx4"); +} + READ16_MEMBER(megasys1_state::monkelf_input_r) { ioport_port *in_names[] = { m_io_p1, m_io_p2, m_io_dsw1, m_io_dsw2, m_io_system }; @@ -4202,6 +4322,7 @@ GAME( 1989, jitsupro, 0, system_A, jitsupro, megasys1_state, jit GAME( 1989, plusalph, 0, system_A, plusalph, megasys1_state, astyanax, ROT270, "Jaleco", "Plus Alpha", 0 ) GAME( 1989, stdragon, 0, system_A, stdragon, megasys1_state, stdragon, ROT0, "Jaleco", "Saint Dragon (set 1)", 0 ) GAME( 1989, stdragona,stdragon, system_A, stdragon, megasys1_state, stdragona,ROT0, "Jaleco", "Saint Dragon (set 2)", 0 ) +GAME( 1989, stdragonb,stdragon, system_A, stdragon, megasys1_state, stdragonb,ROT0, "bootleg","Saint Dragon (bootleg)", 0 ) GAME( 1990, rodland, 0, system_A, rodland, megasys1_state, rodland, ROT0, "Jaleco", "Rod-Land (World)", 0 ) GAME( 1990, rodlandj, rodland, system_A, rodland, megasys1_state, rodlandj, ROT0, "Jaleco", "Rod-Land (Japan)", 0 ) GAME( 1990, rittam, rodland, system_A, rodland, megasys1_state, rittam, ROT0, "Jaleco", "R&T (Rod-Land prototype?)", 0 ) @@ -4209,7 +4330,8 @@ GAME( 1990, rodlandjb,rodland, system_A, rodland, megasys1_state, ro GAME( 1991, avspirit, 0, system_B, avspirit, megasys1_state, avspirit, ROT0, "Jaleco", "Avenging Spirit", 0 ) GAME( 1990, phantasm, avspirit, system_A, phantasm, megasys1_state, phantasm, ROT0, "Jaleco", "Phantasm (Japan)", 0 ) GAME( 1990, monkelf, avspirit, system_B, avspirit, megasys1_state, monkelf, ROT0, "bootleg","Monky Elf (Korean bootleg of Avenging Spirit)", 0 ) -GAME( 1991, edf, 0, system_B, edf, megasys1_state, edf, ROT0, "Jaleco", "E.D.F. : Earth Defense Force", 0 ) +GAME( 1991, edf, 0, system_B, edf, megasys1_state, edf, ROT0, "Jaleco", "E.D.F. : Earth Defense Force (set 1)", 0 ) +GAME( 1991, edfa, edf, system_B, edf, megasys1_state, edf, ROT0, "Jaleco", "E.D.F. : Earth Defense Force (set 2)", 0 ) GAME( 1991, edfu, edf, system_B, edf, megasys1_state, edf, ROT0, "Jaleco", "E.D.F. : Earth Defense Force (North America)", 0 ) GAME( 1991, edfbl, edf, system_Bbl, edf, megasys1_state, edfbl, ROT0, "bootleg","E.D.F. : Earth Defense Force (bootleg)", MACHINE_NO_SOUND ) GAME( 1991, 64street, 0, system_C, 64street, megasys1_state, 64street, ROT0, "Jaleco", "64th. Street - A Detective Story (World)", 0 ) diff --git a/src/mame/drivers/megatech.c b/src/mame/drivers/megatech.c index 5b82e6f6373..cb0d223cff6 100644 --- a/src/mame/drivers/megatech.c +++ b/src/mame/drivers/megatech.c @@ -97,7 +97,8 @@ public: m_cart6(*this, "mt_slot6"), m_cart7(*this, "mt_slot7"), m_cart8(*this, "mt_slot8"), - m_bioscpu(*this, "mtbios") + m_bioscpu(*this, "mtbios"), + m_region_maincpu(*this, "maincpu") { } DECLARE_WRITE_LINE_MEMBER( snd_int_callback ); @@ -167,6 +168,7 @@ private: optional_device<generic_slot_device> m_cart7; optional_device<generic_slot_device> m_cart8; required_device<cpu_device> m_bioscpu; + required_memory_region m_region_maincpu; memory_region *m_cart_reg[8]; }; @@ -345,13 +347,13 @@ WRITE8_MEMBER( mtech_state::mt_sms_standard_rom_bank_w ) //printf("bank ram??\n"); break; case 1: - memcpy(sms_rom+0x0000, space.machine().root_device().memregion("maincpu")->base()+bank*0x4000, 0x4000); + memcpy(sms_rom+0x0000, m_region_maincpu->base()+bank*0x4000, 0x4000); break; case 2: - memcpy(sms_rom+0x4000, space.machine().root_device().memregion("maincpu")->base()+bank*0x4000, 0x4000); + memcpy(sms_rom+0x4000, m_region_maincpu->base()+bank*0x4000, 0x4000); break; case 3: - memcpy(sms_rom+0x8000, space.machine().root_device().memregion("maincpu")->base()+bank*0x4000, 0x4000); + memcpy(sms_rom+0x8000, m_region_maincpu->base()+bank*0x4000, 0x4000); break; } @@ -359,9 +361,8 @@ WRITE8_MEMBER( mtech_state::mt_sms_standard_rom_bank_w ) void mtech_state::set_genz80_as_sms() { - address_space &prg = machine().device("genesis_snd_z80")->memory().space(AS_PROGRAM); - address_space &io = machine().device("genesis_snd_z80")->memory().space(AS_IO); - sn76496_base_device *sn = machine().device<sn76496_base_device>("snsnd"); + address_space &prg = m_z80snd->space(AS_PROGRAM); + address_space &io = m_z80snd->space(AS_IO); // main ram area sms_mainram = (UINT8 *)prg.install_ram(0xc000, 0xdfff, 0, 0x2000); @@ -370,13 +371,13 @@ void mtech_state::set_genz80_as_sms() // fixed rom bank area sms_rom = (UINT8 *)prg.install_rom(0x0000, 0xbfff, NULL); - memcpy(sms_rom, machine().root_device().memregion("maincpu")->base(), 0xc000); + memcpy(sms_rom, m_region_maincpu->base(), 0xc000); prg.install_write_handler(0xfffc, 0xffff, write8_delegate(FUNC(mtech_state::mt_sms_standard_rom_bank_w),this)); // ports io.install_read_handler (0x40, 0x41, 0xff, 0x3e, read8_delegate(FUNC(mtech_state::sms_count_r),this)); - io.install_write_handler (0x40, 0x41, 0xff, 0x3e, write8_delegate(FUNC(sn76496_device::write),sn)); + io.install_write_handler (0x40, 0x41, 0xff, 0x3e, write8_delegate(FUNC(sn76496_device::write),(sn76496_base_device *)m_snsnd)); io.install_readwrite_handler (0x80, 0x80, 0xff, 0x3e, read8_delegate(FUNC(sega315_5124_device::vram_read),(sega315_5124_device *)m_vdp), write8_delegate(FUNC(sega315_5124_device::vram_write),(sega315_5124_device *)m_vdp)); io.install_readwrite_handler (0x81, 0x81, 0xff, 0x3e, read8_delegate(FUNC(sega315_5124_device::register_read),(sega315_5124_device *)m_vdp), write8_delegate(FUNC(sega315_5124_device::register_write),(sega315_5124_device *)m_vdp)); @@ -392,15 +393,14 @@ void mtech_state::set_genz80_as_sms() /* sets the megadrive z80 to it's normal ports / map */ void mtech_state::set_genz80_as_md() { - address_space &prg = machine().device("genesis_snd_z80")->memory().space(AS_PROGRAM); - ym2612_device *ym2612 = machine().device<ym2612_device>("ymsnd"); + address_space &prg = m_z80snd->space(AS_PROGRAM); prg.install_readwrite_bank(0x0000, 0x1fff, "bank1"); machine().root_device().membank("bank1")->set_base(m_genz80.z80_prgram); prg.install_ram(0x0000, 0x1fff, m_genz80.z80_prgram); - prg.install_readwrite_handler(0x4000, 0x4003, read8_delegate(FUNC(ym2612_device::read),ym2612), write8_delegate(FUNC(ym2612_device::write),ym2612)); + prg.install_readwrite_handler(0x4000, 0x4003, read8_delegate(FUNC(ym2612_device::read), (ym2612_device *)m_ymsnd), write8_delegate(FUNC(ym2612_device::write), (ym2612_device *)m_ymsnd)); prg.install_write_handler (0x6000, 0x6000, write8_delegate(FUNC(mtech_state::megadriv_z80_z80_bank_w),this)); prg.install_write_handler (0x6001, 0x6001, write8_delegate(FUNC(mtech_state::megadriv_z80_z80_bank_w),this)); prg.install_read_handler (0x6100, 0x7eff, read8_delegate(FUNC(mtech_state::megadriv_z80_unmapped_read),this)); @@ -417,7 +417,7 @@ void mtech_state::switch_cart(int gameno) m_z80snd->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); //m_maincpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); //m_z80snd->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); - machine().device("ymsnd")->reset(); + m_ymsnd->reset(); megadriv_stop_scanline_timer();// stop the scanline timer for the genesis vdp... it can be restarted in video eof when needed m_vdp->reset(); @@ -425,7 +425,7 @@ void mtech_state::switch_cart(int gameno) /* if the regions exist we're fine */ if (m_cart_reg[gameno]) { - memcpy(memregion("maincpu")->base(), m_cart_reg[gameno]->base(), 0x400000); + memcpy(m_region_maincpu->base(), m_cart_reg[gameno]->base(), 0x400000); if (!m_cart_is_genesis[gameno]) { @@ -447,7 +447,7 @@ void mtech_state::switch_cart(int gameno) else /* else, no cart.. */ { memset(memregion("mtbios")->base() + 0x8000, 0x00, 0x8000); - memset(memregion("maincpu")->base(), 0x00, 0x400000); + memset(m_region_maincpu->base(), 0x00, 0x400000); } } diff --git a/src/mame/drivers/meritm.c b/src/mame/drivers/meritm.c index 07070eadf40..67cf8e126ab 100644 --- a/src/mame/drivers/meritm.c +++ b/src/mame/drivers/meritm.c @@ -79,9 +79,9 @@ Power & Common Ground wires are 18 gauge, all other wires are 20 or 22 gauge. - DS1232 Reset and Watchdog - MAX232 (for MegaLink) - One of the following Dallas Nonvolatile SRAM chips: - - DS1225Y 64K Non-volitile SRAM (Mega Touch 4) - - DS1230Y 256K Non-volitile SRAM (Mega Touch 6) + One of the following Dallas Non-volatile SRAM chips: + - DS1225Y 64K Non-volatile SRAM (Mega Touch 4) + - DS1230Y 256K Non-volatile SRAM (Mega Touch 6) - DS1644 32K NVRAM + RTC (Tournament sets) Known Games: @@ -105,7 +105,7 @@ PROGRAM# Program Version Program Differences 923x-00-01 Standard Version Includes all Options, no Restrictions 923x-00-02 Minnesota Version Excludes Casino Games 923x-00-03 Louisiana Version Excludes all Poker Games -923x-00-04 Wisconsin Version Game Connot End if Player Busts; 1,000 Points are Added to End of Each Hand +923x-00-04 Wisconsin Version Game Cannot End if Player Busts; 1,000 Points are Added to End of Each Hand 923x-00-05 Montana Version Excludes Blackjack, Dice and Photo Finish 923x-00-06 California Version Excludes Poker Double-up feature 9234-00-07 New Jersey Version Excludes Sex Trivia and includes 2-Coin Limit with Lockout Coil (Only for Supertouch 30 & Megastar) @@ -130,21 +130,21 @@ Custom Program Versions (from different Megatouch manuals): PROGRAM# Program Version Program Differences --------------------------------------------------------------------------------------------- -9255-xx-01 Standard Version Includes all Options, no Restrictions -9255-xx-02 Minnesota Version Excludes Casino Games -9255-xx-03 Louisiana Version Excludes all Poker Games -9255-xx-04 Wisconsin Version Game Connot End if Player Busts; 1,000 Points are Added to End of Each Hand -9255-xx-06 California Version Excludes Poker Double-up feature & No Free Game in Solitaire -9255-xx-07 New Jersey Version Includes 2-Coin Limit with Lockout Coil -9255-xx-50 Bi-Lingual ENG/GER Same as Standard Version, Without Word/Casino Games -9255-xx-54 Bi-Lingual ENG/SPA Same as Standard Version, Without Word Games -9255-xx-56 No Free Credits Same as Standard Version, Without Word Games and No Free Credits -9255-xx-57 Internation Version Same as Standard Version, Without Word Games -9255-xx-60 Bi-Lingual ENG/FRE Same as Standard Version, Without Word/Casino Games -9255-xx-62 No Free Credit Same as Standard Version, With No Free Credit (see regional notes below) -9255-xx-62 Croatia Same as Standard Version, With No Free Credit (see regional notes below) -9255-xx-70 Australia Version Same as Standard Version with Special Question Set -9255-xx-71 South Africa Ver. Same as Standard Version with Special Question Set +9255-xx-01 Standard Version Includes all Options, no Restrictions +9255-xx-02 Minnesota Version Excludes Casino Games +9255-xx-03 Louisiana Version Excludes all Poker Games +9255-xx-04 Wisconsin Version Game Cannot End if Player Busts; 1,000 Points are Added to End of Each Hand +9255-xx-06 California Version Excludes Poker Double-up feature & No Free Game in Solitaire +9255-xx-07 New Jersey Version Includes 2-Coin Limit with Lockout Coil +9255-xx-50 Bi-Lingual ENG/GER Same as Standard Version, Without Word/Casino Games +9255-xx-54 Bi-Lingual ENG/SPA Same as Standard Version, Without Word Games +9255-xx-56 No Free Credits Same as Standard Version, Without Word Games and No Free Credits +9255-xx-57 International Version Same as Standard Version, Without Word Games +9255-xx-60 Bi-Lingual ENG/FRE Same as Standard Version, Without Word/Casino Games +9255-xx-62 No Free Credit Same as Standard Version, With No Free Credit (see regional notes below) +9255-xx-62 Croatia Same as Standard Version, With No Free Credit (see regional notes below) +9255-xx-70 Australia Version Same as Standard Version with Special Question Set +9255-xx-71 South Africa Ver. Same as Standard Version with Special Question Set xx = game/version code: @@ -163,12 +163,12 @@ Not all regional versions are available for each Megatouch series For Megatouch Super 4, set 9255-41-62 is No Free Credit Notes/ToDo: - - offset for top V9938 layer is hardcoded, probably should be taken from V9938 setup + - offset for top V9938 layer is hard coded, probably should be taken from V9938 setup - blinking on Megatouch title screen is probably incorrect - clean up V9938 interrupt implementation - finish inputs, dsw, outputs (lamps) - problem with registering touches on the bottom of the screen (currently hacked to work) - - megat5a: has jmp $0000 in the initialization code causing infinite loop - Dump verfied on 4 different sets. (watchdog issue???) + - megat5a: has jmp $0000 in the initialization code causing infinite loop - Dump verified on 4 different sets. (watchdog issue???) */ #include "emu.h" @@ -1122,10 +1122,10 @@ static MACHINE_CONFIG_START( meritm_crt250, meritm_state ) MCFG_DS1204_ADD("ds1204") - MCFG_V9938_ADD("v9938_0", "screen", 0x20000) + MCFG_V9938_ADD("v9938_0", "screen", 0x20000, SYSTEM_CLK) MCFG_V99X8_INTERRUPT_CALLBACK(WRITELINE(meritm_state,meritm_vdp0_interrupt)) - MCFG_V9938_ADD("v9938_1", "screen", 0x20000) + MCFG_V9938_ADD("v9938_1", "screen", 0x20000, SYSTEM_CLK) MCFG_V99X8_INTERRUPT_CALLBACK(WRITELINE(meritm_state,meritm_vdp1_interrupt)) MCFG_SCREEN_ADD("screen",RASTER) @@ -1213,14 +1213,41 @@ Entering the Setup menu "S": Is the "Stand" & "Hi-Score" keys the same? Without a separate Stand key, you cannot set up the "TWIN" bonus feature +REPLAYS - You start with 1 star per coin up to a maximum 15 stars. One star is deducted for each losing hand including + busting on Double-ups while stars are added for winning hands. Running out of stars forces the player to add + at least 1 more coin to continue to play EVEN if the player still has points available to use. + */ ROM_START( americna ) /* Uses a small daughter card CRT-251 & Dallas DS1225Y NV SRAM */ ROM_REGION( 0x80000, "maincpu", 0 ) - ROM_LOAD( "9131-00_u9-2.u9", 0x00000, 0x10000, CRC(8a741fb6) SHA1(2d77c67e5a0bdaf6199c31c4055df214672db3e1) ) /* 9131-00 U9-2 888020 */ + ROM_LOAD( "9131-01_u9-2.u9", 0x00000, 0x10000, CRC(0410a1bf) SHA1(1218cf4b3d1067777841673620c84406cce418fb) ) /* 9131-01 U9-2 888020 - Has REPLAYS feature */ + ROM_LOAD( "9131-00_u10-0.u10", 0x10000, 0x10000, CRC(d6f72934) SHA1(4f3d6a5227a3b0fc298533a03cc0a32f8e2f3840) ) + ROM_LOAD( "9131-00_u11-0.u11", 0x20000, 0x10000, CRC(f2db6f5d) SHA1(3f734a7e8c72c14bf4a3e6f595819311739394d3) ) +ROM_END + +ROM_START( americnaa ) /* Uses a small daughter card CRT-251 & Dallas DS1225Y NV SRAM */ + ROM_REGION( 0x80000, "maincpu", 0 ) + ROM_LOAD( "9131-00_u9-2.u9", 0x00000, 0x10000, CRC(8a741fb6) SHA1(2d77c67e5a0bdaf6199c31c4055df214672db3e1) ) /* 9131-00 U9-2 888020 - Doesn't have REPLAYS feature */ ROM_LOAD( "9131-00_u10-0.u10", 0x10000, 0x10000, CRC(d6f72934) SHA1(4f3d6a5227a3b0fc298533a03cc0a32f8e2f3840) ) ROM_LOAD( "9131-00_u11-0.u11", 0x20000, 0x10000, CRC(f2db6f5d) SHA1(3f734a7e8c72c14bf4a3e6f595819311739394d3) ) ROM_END +/* + +This set seems odd, it doesn't really have a title sequence. + +Same keys as Americana & same Stand / Hi-Score issue + +This set also has additional bonuses for certain winning hands, but requires a minimum 10 point bet to qualify for any bonus. + +*/ +ROM_START( meritjp ) /* Uses a small daughter card CRT-255 & Dallas DS1225Y NV SRAM */ + ROM_REGION( 0x80000, "maincpu", 0 ) + ROM_LOAD( "9131-01_u9-00.u9", 0x00000, 0x10000, CRC(dadaac6a) SHA1(798068f3cef6f5d41dd8ee4315e220932f31a3f7) ) /* 9131-01 U9-00 - Has REPLAYS feature */ + ROM_LOAD( "9131-01_u10-r0.u10", 0x10000, 0x10000, CRC(ebee75e2) SHA1(1ba1c92684d0f5251bb5b57a29b39467b57a1170) ) + ROM_LOAD( "9131-01_u11-r0.u11", 0x20000, 0x10000, CRC(f2db6f5d) SHA1(3f734a7e8c72c14bf4a3e6f595819311739394d3) ) +ROM_END + ROM_START( dodgecty ) /* Uses a small daughter card CRT-255 & Dallas DS1225Y NV SRAM */ ROM_REGION( 0x80000, "maincpu", 0 ) ROM_LOAD( "9131-02_u9-2t.u9", 0x00000, 0x10000, CRC(22e73039) SHA1(368f03b31f7c3cb81a95b20d1cb954e8557d2017) ) /* 9131-02 U9-2T 880111 */ @@ -1331,7 +1358,7 @@ ROM_START( megat ) /* Dallas DS1204V security key attached to CRT-254 connected ROM_LOAD( "9234-20_u1-r0_c1994_mii", 0x000000, 0x000022, BAD_DUMP CRC(6cbdbde1) SHA1(b076ee21fc792a5e85cdaed427bc41554568811e) ) ROM_REGION( 0xc0000, "extra", 0 ) // question roms - ROM_LOAD( "qs9234-20_u7-r0", 0x00000, 0x40000, CRC(c0534aaa) SHA1(4b3cbf03f29fd5b4b8fd423e73c0c8147692fa75) ) /* These 3 roms are on CRT-256 sattalite PCB */ + ROM_LOAD( "qs9234-20_u7-r0", 0x00000, 0x40000, CRC(c0534aaa) SHA1(4b3cbf03f29fd5b4b8fd423e73c0c8147692fa75) ) /* These 3 roms are on CRT-256 satellite PCB */ ROM_LOAD( "qs9234-20_u6-r0", 0x40000, 0x40000, CRC(fe2cd934) SHA1(623011dc53ed6eefefa0725dba6fd1efee2077c1) ) /* Same data as Pit Boss Supertouch 30 sets, different label - verified */ ROM_LOAD( "qs9234-20_u5-r0", 0x80000, 0x40000, CRC(293fe305) SHA1(8a551ae8fb4fa4bf329128be1bfd6f1c3ff5a366) ) ROM_END @@ -1350,7 +1377,7 @@ ROM_START( pbst30 ) /* Dallas DS1204V security key attached to CRT-254 connected ROM_LOAD( "9234-10_u1-r01_c1994_mii", 0x000000, 0x000022, BAD_DUMP CRC(1c782f78) SHA1(8255afcffbe21a43f53cfb41867552681403ea47) ) ROM_REGION( 0xc0000, "extra", 0 ) // question roms - ROM_LOAD( "qs9234-01_u7-r0", 0x00000, 0x40000, CRC(c0534aaa) SHA1(4b3cbf03f29fd5b4b8fd423e73c0c8147692fa75) ) /* These 3 roms are on CRT-256 sattalite PCB */ + ROM_LOAD( "qs9234-01_u7-r0", 0x00000, 0x40000, CRC(c0534aaa) SHA1(4b3cbf03f29fd5b4b8fd423e73c0c8147692fa75) ) /* These 3 roms are on CRT-256 satellite PCB */ ROM_LOAD( "qs9234-01_u6-r0", 0x40000, 0x40000, CRC(fe2cd934) SHA1(623011dc53ed6eefefa0725dba6fd1efee2077c1) ) ROM_LOAD( "qs9234-01_u5-r0", 0x80000, 0x40000, CRC(293fe305) SHA1(8a551ae8fb4fa4bf329128be1bfd6f1c3ff5a366) ) ROM_END @@ -1369,7 +1396,7 @@ ROM_START( pbst30a ) /* Dallas DS1204V security key attached to CRT-254 connecte ROM_LOAD( "9234-01_u1-r01_c1993_mii", 0x000000, 0x000022, BAD_DUMP CRC(74bf0546) SHA1(eb44a057cf797279ee3456a74e166fa711547ea4) ) ROM_REGION( 0xc0000, "extra", 0 ) // question roms - ROM_LOAD( "qs9234-01_u7-r0", 0x00000, 0x40000, CRC(c0534aaa) SHA1(4b3cbf03f29fd5b4b8fd423e73c0c8147692fa75) ) /* These 3 roms are on CRT-256 sattalite PCB */ + ROM_LOAD( "qs9234-01_u7-r0", 0x00000, 0x40000, CRC(c0534aaa) SHA1(4b3cbf03f29fd5b4b8fd423e73c0c8147692fa75) ) /* These 3 roms are on CRT-256 satellite PCB */ ROM_LOAD( "qs9234-01_u6-r0", 0x40000, 0x40000, CRC(fe2cd934) SHA1(623011dc53ed6eefefa0725dba6fd1efee2077c1) ) ROM_LOAD( "qs9234-01_u5-r0", 0x80000, 0x40000, CRC(293fe305) SHA1(8a551ae8fb4fa4bf329128be1bfd6f1c3ff5a366) ) ROM_END @@ -1386,7 +1413,7 @@ ROM_START( pitbossma ) /* Unprotected or patched?? The manual shows a DS1204 ke ROM_RELOAD( 0x70000, 0x10000) ROM_REGION( 0xc0000, "extra", 0 ) // question roms - ROM_LOAD( "qs9243-00-01_u7-r0", 0x00000, 0x40000, CRC(35f4ca46) SHA1(87917b3017f505fae65d6bfa2c7d6fb503c2da6a) ) /* These 3 roms are on CRT-256 sattalite PCB */ + ROM_LOAD( "qs9243-00-01_u7-r0", 0x00000, 0x40000, CRC(35f4ca46) SHA1(87917b3017f505fae65d6bfa2c7d6fb503c2da6a) ) /* These 3 roms are on CRT-256 satellite PCB */ ROM_LOAD( "qs9243-00-01_u6-r0", 0x40000, 0x40000, CRC(606f1656) SHA1(7f1e3a698a34d3c3b8f9f2cd8d5224b6c096e941) ) ROM_LOAD( "qs9243-00-01_u5-r0", 0x80000, 0x40000, CRC(590a1565) SHA1(b80ea967b6153847b2594e9c59bfe87559022b6c) ) ROM_END @@ -1443,7 +1470,7 @@ ROM_START( pitbossm ) /* Dallas DS1204V security key attached to CRT-254 connect ROM_LOAD( "9244-00_u1-ro1_c1994_mii", 0x000000, 0x000022, BAD_DUMP CRC(0455e18b) SHA1(919b48c25888af0af34b2d0cf34370476a97b79e) ) ROM_REGION( 0xc0000, "extra", 0 ) // question roms - ROM_LOAD( "qs9243-00-01_u7-r0", 0x00000, 0x40000, CRC(35f4ca46) SHA1(87917b3017f505fae65d6bfa2c7d6fb503c2da6a) ) /* These 3 roms are on CRT-256 sattalite PCB */ + ROM_LOAD( "qs9243-00-01_u7-r0", 0x00000, 0x40000, CRC(35f4ca46) SHA1(87917b3017f505fae65d6bfa2c7d6fb503c2da6a) ) /* These 3 roms are on CRT-256 satellite PCB */ ROM_LOAD( "qs9243-00-01_u6-r0", 0x40000, 0x40000, CRC(606f1656) SHA1(7f1e3a698a34d3c3b8f9f2cd8d5224b6c096e941) ) ROM_LOAD( "qs9243-00-01_u5-r0", 0x80000, 0x40000, CRC(590a1565) SHA1(b80ea967b6153847b2594e9c59bfe87559022b6c) ) ROM_END @@ -2277,7 +2304,9 @@ DRIVER_INIT_MEMBER(meritm_state,megat3te) } /* CRT-250 */ -GAME( 1987, americna, 0, meritm_crt250, americna, driver_device, 0, ROT0, "Merit", "Americana (9131-00)", MACHINE_IMPERFECT_GRAPHICS ) +GAME( 1987, americna, 0, meritm_crt250, americna, driver_device, 0, ROT0, "Merit", "Americana (9131-01)", MACHINE_IMPERFECT_GRAPHICS ) +GAME( 1987, americnaa, americna, meritm_crt250, americna, driver_device, 0, ROT0, "Merit", "Americana (9131-00)", MACHINE_IMPERFECT_GRAPHICS ) +GAME( 1988, meritjp, 0, meritm_crt250, americna, driver_device, 0, ROT0, "Merit", "Merit Joker Poker (9131-01)", MACHINE_IMPERFECT_GRAPHICS ) GAME( 1988, dodgecty, 0, meritm_crt250, dodgecty, driver_device, 0, ROT0, "Merit", "Dodge City (9131-02)", MACHINE_IMPERFECT_GRAPHICS ) GAME( 1988, pitboss2, 0, meritm_crt250, pitboss2, driver_device, 0, ROT0, "Merit", "Pit Boss II (9221-01C)", MACHINE_IMPERFECT_GRAPHICS ) GAME( 1988, spitboss, 0, meritm_crt250, spitboss, driver_device, 0, ROT0, "Merit", "Super Pit Boss (9221-02A)", MACHINE_IMPERFECT_GRAPHICS ) diff --git a/src/mame/drivers/micro3d.c b/src/mame/drivers/micro3d.c index 258dd60b6c5..988cf4cab84 100644 --- a/src/mame/drivers/micro3d.c +++ b/src/mame/drivers/micro3d.c @@ -226,7 +226,7 @@ static ADDRESS_MAP_START( vgbmem, AS_PROGRAM, 16, micro3d_state ) AM_RANGE(0x00800000, 0x00bfffff) AM_RAM AM_RANGE(0x00c00000, 0x00c0000f) AM_READ_PORT("VGB_SW") AM_RANGE(0x00e00000, 0x00e0000f) AM_WRITE(micro3d_xfer3dk_w) - AM_RANGE(0x02000000, 0x0200ffff) AM_RAM_WRITE(micro3d_clut_w) AM_SHARE("paletteram") + AM_RANGE(0x02000000, 0x0200ffff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") // clut AM_RANGE(0x02600000, 0x0260000f) AM_WRITE(micro3d_creg_w) AM_RANGE(0x02c00000, 0x02c0003f) AM_READ(micro3d_ti_uart_r) AM_RANGE(0x02e00000, 0x02e0003f) AM_WRITE(micro3d_ti_uart_w) @@ -326,6 +326,7 @@ static MACHINE_CONFIG_START( micro3d, micro3d_state ) MCFG_QUANTUM_TIME(attotime::from_hz(3000)) MCFG_PALETTE_ADD("palette", 4096) + MCFG_PALETTE_FORMAT(BBBBBRRRRRGGGGGx) MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_RAW_PARAMS(XTAL_40MHz/8*4, 192*4, 0, 144*4, 434, 0, 400) diff --git a/src/mame/drivers/midtunit.c b/src/mame/drivers/midtunit.c index 8834f0eac16..e96906f01d6 100644 --- a/src/mame/drivers/midtunit.c +++ b/src/mame/drivers/midtunit.c @@ -49,7 +49,7 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, midtunit_state ) AM_RANGE(0x01600010, 0x0160001f) AM_READ_PORT("IN1") AM_RANGE(0x01600020, 0x0160002f) AM_READ_PORT("IN2") AM_RANGE(0x01600030, 0x0160003f) AM_READ_PORT("DSW") - AM_RANGE(0x01800000, 0x0187ffff) AM_RAM_WRITE(midtunit_paletteram_w) AM_SHARE("paletteram") + AM_RANGE(0x01800000, 0x0187ffff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0x01a80000, 0x01a800ff) AM_READWRITE(midtunit_dma_r, midtunit_dma_w) AM_RANGE(0x01b00000, 0x01b0001f) AM_WRITE(midtunit_control_w) /* AM_RANGE(0x01c00060, 0x01c0007f) AM_WRITE(midtunit_cmos_enable_w) */ @@ -602,6 +602,7 @@ static MACHINE_CONFIG_START( tunit_core, midtunit_state ) /* video hardware */ MCFG_PALETTE_ADD("palette", 32768) + MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB) MCFG_SCREEN_ADD("screen", RASTER) // from TMS340 registers diff --git a/src/mame/drivers/midwunit.c b/src/mame/drivers/midwunit.c index e331ff6673d..47090af6b82 100644 --- a/src/mame/drivers/midwunit.c +++ b/src/mame/drivers/midwunit.c @@ -112,7 +112,7 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, midwunit_state ) AM_RANGE(0x01600000, 0x0160001f) AM_READWRITE(midwunit_security_r, midwunit_security_w) AM_RANGE(0x01680000, 0x0168001f) AM_READWRITE(midwunit_sound_r, midwunit_sound_w) AM_RANGE(0x01800000, 0x0187ffff) AM_READWRITE(midwunit_io_r, midwunit_io_w) - AM_RANGE(0x01880000, 0x018fffff) AM_RAM_WRITE(midtunit_paletteram_w) AM_SHARE("paletteram") + AM_RANGE(0x01880000, 0x018fffff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0x01a00000, 0x01a000ff) AM_MIRROR(0x00080000) AM_READWRITE(midtunit_dma_r, midtunit_dma_w) AM_RANGE(0x01b00000, 0x01b0001f) AM_READWRITE(midwunit_control_r, midwunit_control_w) AM_RANGE(0x02000000, 0x06ffffff) AM_READ(midwunit_gfxrom_r) @@ -631,6 +631,7 @@ static MACHINE_CONFIG_START( wunit, midwunit_state ) /* video hardware */ MCFG_PALETTE_ADD("palette", 32768) + MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB) MCFG_SCREEN_ADD("screen", RASTER) // from TMS340 registers diff --git a/src/mame/drivers/midxunit.c b/src/mame/drivers/midxunit.c index 331c380a856..a519ee1c31a 100644 --- a/src/mame/drivers/midxunit.c +++ b/src/mame/drivers/midxunit.c @@ -112,7 +112,7 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, midxunit_state ) AM_RANGE(0x80800000, 0x8080001f) AM_READWRITE(midxunit_analog_r, midxunit_analog_select_w) AM_RANGE(0x80c00000, 0x80c000ff) AM_READWRITE(midxunit_uart_r, midxunit_uart_w) AM_RANGE(0xa0440000, 0xa047ffff) AM_READWRITE(midxunit_cmos_r, midxunit_cmos_w) AM_SHARE("nvram") - AM_RANGE(0xa0800000, 0xa08fffff) AM_READWRITE(midxunit_paletteram_r, midxunit_paletteram_w) AM_SHARE("paletteram") + AM_RANGE(0xa0800000, 0xa08fffff) AM_READWRITE(midxunit_paletteram_r, midxunit_paletteram_w) AM_SHARE("palette") AM_RANGE(0xc0000000, 0xc00003ff) AM_DEVREADWRITE("maincpu", tms34020_device, io_register_r, io_register_w) AM_RANGE(0xc0c00000, 0xc0c000ff) AM_MIRROR(0x00400000) AM_READWRITE(midtunit_dma_r, midtunit_dma_w) AM_RANGE(0xf8000000, 0xfeffffff) AM_READ(midwunit_gfxrom_r) @@ -255,6 +255,7 @@ static MACHINE_CONFIG_START( midxunit, midxunit_state ) /* video hardware */ MCFG_PALETTE_ADD("palette", 32768) + MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB) MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, 506, 101, 501, 289, 20, 274) diff --git a/src/mame/drivers/mirage.c b/src/mame/drivers/mirage.c index f0d9902de1e..caaccf62c47 100644 --- a/src/mame/drivers/mirage.c +++ b/src/mame/drivers/mirage.c @@ -72,7 +72,7 @@ public: required_shared_ptr<UINT16> m_pf1_rowscroll; required_shared_ptr<UINT16> m_pf2_rowscroll; optional_device<decospr_device> m_sprgen; -// UINT16 * m_paletteram; // currently this uses generic palette handling (in decocomn.c) + DECLARE_WRITE16_MEMBER(mirage_mux_w); DECLARE_READ16_MEMBER(mirage_input_r); DECLARE_WRITE16_MEMBER(okim1_rombank_w); diff --git a/src/mame/drivers/model3.c b/src/mame/drivers/model3.c index 96d553f2224..5fd6b1012be 100644 --- a/src/mame/drivers/model3.c +++ b/src/mame/drivers/model3.c @@ -2566,7 +2566,7 @@ ROM_START( vf3 ) /* step 1.0, Sega game ID# is 833-12712, ROM board ID# 834-1 ROM_LOAD_VROM( "mpr-19226.41", 0x00000c, 0x200000, CRC(00091722) SHA1(ef86db36b4b91a66b3e401c3c91735b9d28da2e2) ) ROM_REGION( 0x100000, "audiocpu", 0 ) /* 68000 code */ - ROM_LOAD16_WORD_SWAP( "epr19231.21", 0x080000, 0x080000, CRC(b416fe96) SHA1(b508eb6802072a8d4f8fdc7ca4fba6c6a4aaadae) ) + ROM_LOAD16_WORD_SWAP( "epr-19231.21", 0x080000, 0x080000, CRC(b416fe96) SHA1(b508eb6802072a8d4f8fdc7ca4fba6c6a4aaadae) ) ROM_REGION( 0x800000, "samples", 0 ) /* SCSP samples */ ROM_LOAD( "mpr-19209.22", 0x000000, 0x400000, CRC(3715e38c) SHA1(b11dbf8a5840990e9697c53b4796cd70ad91f6a1) ) @@ -2588,10 +2588,10 @@ ROM_END ROM_START( vf3a ) /* step 1.0, Sega game ID# is 833-12712, ROM board ID# 834-12821 */ ROM_REGION64_BE( 0x8800000, "user1", 0 ) /* program + data ROMs */ // CROM - ROM_LOAD64_WORD_SWAP( "epr19227a.17", 0x600006, 0x080000, CRC(7139931a) SHA1(57eec80361726143017b1adbfaafbeef0bc4109d) ) - ROM_LOAD64_WORD_SWAP( "epr19228a.18", 0x600004, 0x080000, CRC(82f17ab5) SHA1(64714d14e64d97ebeedd1c6e1e832969df9e2324) ) - ROM_LOAD64_WORD_SWAP( "epr19229a.19", 0x600002, 0x080000, CRC(5f1404b8) SHA1(434b0900a33704190285a6db45e9391b2bda2152) ) - ROM_LOAD64_WORD_SWAP( "epr19230a.20", 0x600000, 0x080000, CRC(4dff78ed) SHA1(4d687479fc1fcce10ed7417555c003a546f64390) ) + ROM_LOAD64_WORD_SWAP( "epr-19227a.17", 0x600006, 0x080000, CRC(7139931a) SHA1(57eec80361726143017b1adbfaafbeef0bc4109d) ) + ROM_LOAD64_WORD_SWAP( "epr-19228a.18", 0x600004, 0x080000, CRC(82f17ab5) SHA1(64714d14e64d97ebeedd1c6e1e832969df9e2324) ) + ROM_LOAD64_WORD_SWAP( "epr-19229a.19", 0x600002, 0x080000, CRC(5f1404b8) SHA1(434b0900a33704190285a6db45e9391b2bda2152) ) + ROM_LOAD64_WORD_SWAP( "epr-19230a.20", 0x600000, 0x080000, CRC(4dff78ed) SHA1(4d687479fc1fcce10ed7417555c003a546f64390) ) // CROM0 ROM_LOAD64_WORD_SWAP( "mpr-19193.1", 0x800006, 0x400000, CRC(7bab33d2) SHA1(243a09959f3c4311070f1de760ee63958cd47660) ) @@ -2641,7 +2641,7 @@ ROM_START( vf3a ) /* step 1.0, Sega game ID# is 833-12712, ROM board ID# 834-1 ROM_LOAD_VROM( "mpr-19226.41", 0x00000c, 0x200000, CRC(00091722) SHA1(ef86db36b4b91a66b3e401c3c91735b9d28da2e2) ) ROM_REGION( 0x100000, "audiocpu", 0 ) /* 68000 code */ - ROM_LOAD16_WORD_SWAP( "epr19231.21", 0x080000, 0x080000, CRC(b416fe96) SHA1(b508eb6802072a8d4f8fdc7ca4fba6c6a4aaadae) ) + ROM_LOAD16_WORD_SWAP( "epr-19231.21", 0x080000, 0x080000, CRC(b416fe96) SHA1(b508eb6802072a8d4f8fdc7ca4fba6c6a4aaadae) ) ROM_REGION( 0x800000, "samples", 0 ) /* SCSP samples */ ROM_LOAD( "mpr-19209.22", 0x000000, 0x400000, CRC(3715e38c) SHA1(b11dbf8a5840990e9697c53b4796cd70ad91f6a1) ) @@ -2716,7 +2716,7 @@ ROM_START( vf3tb ) /* step 1.0? */ ROM_LOAD_VROM( "mpr-19226.41", 0x00000c, 0x200000, CRC(00091722) SHA1(ef86db36b4b91a66b3e401c3c91735b9d28da2e2) ) ROM_REGION( 0x100000, "audiocpu", 0 ) /* 68000 code */ - ROM_LOAD16_WORD_SWAP( "epr19231.21", 0x080000, 0x080000, CRC(b416fe96) SHA1(b508eb6802072a8d4f8fdc7ca4fba6c6a4aaadae) ) + ROM_LOAD16_WORD_SWAP( "epr-19231.21", 0x080000, 0x080000, CRC(b416fe96) SHA1(b508eb6802072a8d4f8fdc7ca4fba6c6a4aaadae) ) ROM_REGION( 0x800000, "samples", 0 ) /* SCSP samples */ ROM_LOAD( "mpr-19209.22", 0x000000, 0x400000, CRC(3715e38c) SHA1(b11dbf8a5840990e9697c53b4796cd70ad91f6a1) ) @@ -2967,7 +2967,7 @@ ROM_START( getbass ) /* step 1.0, Sega game ID# is 833-13416 GET BASS STD, RO ROM_FILL( 0x000000, 0x80000, 0 ) ROM_REGION( 0x10000, "iocpu", 0 ) // kl5c80a16cf code - ROM_LOAD( "epr20690.ic11", 0x00000, 0x10000, CRC(b7da201d) SHA1(7e58eb45ee6ec78250ece7b4fcc4e955b8b4f084) ) + ROM_LOAD( "epr-20690.ic11", 0x00000, 0x10000, CRC(b7da201d) SHA1(7e58eb45ee6ec78250ece7b4fcc4e955b8b4f084) ) ROM_END ROM_START( lostwsga ) /* Step 1.5, PCB cage labeled 834-13172 THE LOST WORLD U/R. Sega game ID# is 833-13171, ROM board ID# 834-13172 REV.A */ @@ -4034,7 +4034,7 @@ ROM_START( swtrilgy ) /* Step 2.1, Sega game ID# is 833-13586, ROM board ID# 8 ROM_FILL( 0x000000, 0x80000, 0 ) ROM_REGION( 0x10000, "ffcpu", 0 ) /* force feedback controller prg */ - ROM_LOAD( "epr21119.ic8", 0x00000, 0x10000, CRC(65082b14) SHA1(6c3c192dd6ef3780c6202dd63fc6086328928818) ) + ROM_LOAD( "epr-21119.ic8", 0x00000, 0x10000, CRC(65082b14) SHA1(6c3c192dd6ef3780c6202dd63fc6086328928818) ) // ???? 317-0241-COM Model 3 ROM_PARAMETER( ":315_5881:key", "31272a01" ) diff --git a/src/mame/drivers/mole.c b/src/mame/drivers/mole.c index 0ce7e6a9e69..b86dbc3b10c 100644 --- a/src/mame/drivers/mole.c +++ b/src/mame/drivers/mole.c @@ -83,7 +83,6 @@ public: virtual void machine_start(); virtual void machine_reset(); virtual void video_start(); - DECLARE_PALETTE_INIT(mole); UINT32 screen_update_mole(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); }; @@ -94,12 +93,6 @@ public: * *************************************/ -PALETTE_INIT_MEMBER(mole_state, mole) -{ - for (int i = 0; i < 8; i++) - palette.set_pen_color(i, pal1bit(i >> 0), pal1bit(i >> 2), pal1bit(i >> 1)); -} - TILE_GET_INFO_MEMBER(mole_state::get_bg_tile_info) { UINT16 code = m_tileram[tile_index]; @@ -340,8 +333,7 @@ static MACHINE_CONFIG_START( mole, mole_state ) MCFG_SCREEN_PALETTE("palette") MCFG_GFXDECODE_ADD("gfxdecode", "palette", mole) - MCFG_PALETTE_ADD("palette", 8) - MCFG_PALETTE_INIT_OWNER(mole_state, mole) + MCFG_PALETTE_ADD_3BIT_RBG("palette") /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") diff --git a/src/mame/drivers/monzagp.c b/src/mame/drivers/monzagp.c index 26d6e5a4934..f95264f2423 100644 --- a/src/mame/drivers/monzagp.c +++ b/src/mame/drivers/monzagp.c @@ -31,7 +31,9 @@ Lower board (MGP_01): #include "emu.h" #include "cpu/mcs48/mcs48.h" +#include "machine/nvram.h" +#include "monzagp.lh" class monzagp_state : public driver_device { @@ -40,82 +42,153 @@ public: : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } - - int m_coordx; - int m_coordy; - UINT8 *m_vram; - int m_screenw; - int m_bank; - - DECLARE_READ8_MEMBER(rng_r); + m_palette(*this, "palette"), + m_nvram(*this, "nvram"), + m_gfx1(*this, "gfx1"), + m_tile_attr(*this, "unk1"), + m_proms(*this, "proms"), + m_in0(*this, "IN0"), + m_in1(*this, "IN1"), + m_dsw(*this, "DSW") + { } + + DECLARE_READ8_MEMBER(port_r); DECLARE_WRITE8_MEMBER(port_w); - DECLARE_WRITE8_MEMBER(port0_w); DECLARE_WRITE8_MEMBER(port1_w); DECLARE_WRITE8_MEMBER(port2_w); + DECLARE_READ8_MEMBER(port2_r); DECLARE_WRITE8_MEMBER(port3_w); virtual void video_start(); + TIMER_DEVICE_CALLBACK_MEMBER(time_tick_timer); DECLARE_PALETTE_INIT(monzagp); UINT32 screen_update_monzagp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); required_device<cpu_device> m_maincpu; required_device<gfxdecode_device> m_gfxdecode; required_device<palette_device> m_palette; + required_device<nvram_device> m_nvram; + required_memory_region m_gfx1; + required_memory_region m_tile_attr; + required_memory_region m_proms; + required_ioport m_in0; + required_ioport m_in1; + required_ioport m_dsw; + +private: + UINT8 m_p1; + UINT8 m_p2; + UINT8 m_video_ctrl[2][8]; + bool m_time_tick; + bool m_cp_ruote; + UINT8 m_mycar_pos; + UINT8 *m_vram; + UINT8 *m_score_ram; }; +TIMER_DEVICE_CALLBACK_MEMBER(monzagp_state::time_tick_timer) +{ + m_time_tick = !m_time_tick; +} + PALETTE_INIT_MEMBER(monzagp_state, monzagp) { } void monzagp_state::video_start() { - m_screenw = 80; - m_vram = auto_alloc_array(machine(), UINT8, 0x10000); + m_vram = auto_alloc_array(machine(), UINT8, 0x800); + m_score_ram = auto_alloc_array(machine(), UINT8, 0x100); + m_time_tick = 0; + m_cp_ruote = 0; + m_mycar_pos = 7*16; + save_pointer(NAME(m_vram), 0x800); + save_pointer(NAME(m_score_ram), 0x100); + + m_nvram->set_base(m_score_ram, 0x100); } UINT32 monzagp_state::screen_update_monzagp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x,y; +/* + for(int i=0;i<8;i++) + printf("%02x ", m_video_ctrl[0][i]); + printf(" ---- "); + for(int i=0;i<8;i++) + printf("%02x ", m_video_ctrl[1][i]); + printf("\n"); +*/ - if(machine().input().code_pressed_once(KEYCODE_Z)) - m_bank--; + bitmap.fill(0, cliprect); - if(machine().input().code_pressed_once(KEYCODE_X)) - m_bank++; + // background tilemap + UINT8 *tile_table = m_proms->base() + 0x100; + UINT8 start_tile = m_video_ctrl[0][0] >> 5; - if(machine().input().code_pressed_once(KEYCODE_Q)) + for(int y=0; y<8; y++) { - m_screenw--; - printf("%x\n",m_screenw); - } + UINT16 start_x = ((m_video_ctrl[0][3] << 8) | m_video_ctrl[0][2]) ^ 0xffff; + bool inv = y > 3; - if(machine().input().code_pressed_once(KEYCODE_W)) - { - m_screenw++; - printf("%x\n",m_screenw); + for(int x=0;x<64;x++) + { + UINT8 tile_attr = m_tile_attr->base()[((start_x >> 5) & 0x07) | (((start_x >> 8) & 0x3f) << 3) | ((start_x >> 6) & 0x200)]; + + //if (tile_attr & 0x10) printf("dark on\n"); + //if (tile_attr & 0x20) printf("light on\n"); + //if (tile_attr & 0x40) printf("bridge\n"); + + int tile_idx = tile_table[((tile_attr & 0x0f) << 4) | (inv ? 0x08 : 0) | (start_tile & 0x07)]; + int tile = (tile_idx << 3) | (((start_x) >> 2) & 0x07); + + m_gfxdecode->gfx(2)->opaque(bitmap,cliprect, + tile ^ 4, + 0, + 0, inv, + x*4,y*32); + + start_x += 4; + } + + if (y < 3) + start_tile++; + else if (y > 3) + start_tile--; } - if(machine().input().code_pressed_once(KEYCODE_A)) + // my car sprite + if (m_video_ctrl[1][3] & 0x18) { - FILE * p=fopen("vram.bin","wb"); - fwrite(&m_vram[0],1,0x10000,p); - fclose(p); + int start_sprite = (((m_video_ctrl[1][3] & 0x18)) << 3) | (m_video_ctrl[1][3] & 0x06); + + if (m_cp_ruote && (m_video_ctrl[1][3] & 0x0e) == 0) + start_sprite |= 0x02; + + for(int y=0; y<2; y++) + for(int x=0; x<4*8; x+=4) + { + int sprite = start_sprite | ((x << 1) & 0x38); + + m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, + (sprite ^ 0x06) + y, + 0, + 0, 0, + m_video_ctrl[1][2] + x, m_mycar_pos + (1 - y) * 16, + 3); + } } - bitmap.fill(0, cliprect); - for(y=0;y<256;y++) + // characters + for(int y=0;y<26;y++) { - for(x=0;x<256;x++) + for(int x=0;x<40;x++) { - m_gfxdecode->gfx(m_bank&1)->transpen(bitmap,cliprect, - m_vram[y*m_screenw+x], - //(m_vram[y*m_screenw+x]&0x3f)+(m_bank>>1)*64, + m_gfxdecode->gfx(0)->transpen(bitmap,cliprect, + m_vram[y*40+x], 0, 0, 0, - x*8,y*8, - 0); - + x*7,y*10, + 1); } } @@ -126,141 +199,218 @@ static ADDRESS_MAP_START( monzagp_map, AS_PROGRAM, 8, monzagp_state ) AM_RANGE(0x0000, 0x0fff) AM_ROM ADDRESS_MAP_END -READ8_MEMBER(monzagp_state::rng_r) -{ - return machine().rand(); -} -WRITE8_MEMBER(monzagp_state::port_w) +READ8_MEMBER(monzagp_state::port_r) { - m_coordx=offset;//-0xc0; - //m_vram[m_coordy*m_screenw+m_coordx]=data; - //if(output==0xfe) + UINT8 data = 0xff; + if (!(m_p1 & 0x01)) // 8350 videoram { - // if(data>='A' && data <='Z') - // printf("%.2x %.2x %c %c\n",m_coordy, offset,data, znaki[data-'A']); - //m_vram[m_coordy*m_screenw+m_coordx]=data; - m_vram[(m_coordx*256+m_coordy)&0x7ff]=data; + //printf("ext 0 r P1:%02x P2:%02x %02x\n", m_p1, m_p2, offset); + int addr = ((m_p2 & 0x3f) << 5) | (offset & 0x1f); + data = m_vram[addr]; + } + if (!(m_p1 & 0x02)) + { + printf("ext 1 r P1:%02x P2:%02x %02x\n", m_p1, m_p2, offset); + } + if (!(m_p1 & 0x04)) // GFX + { + //printf("ext 2 r P1:%02x P2:%02x %02x\n", m_p1, m_p2, offset); + int addr = ((m_p2 & 0x7f) << 5) | (offset & 0x1f); + data = m_gfx1->base()[addr]; + } + if (!(m_p1 & 0x08)) + { + //printf("ext 3 r P1:%02x P2:%02x %02x\n", m_p1, m_p2, offset); + data = m_in1->read(); + } + if (!(m_p1 & 0x10)) + { + //printf("ext 4 r P1:%02x P2:%02x %02x\n", m_p1, m_p2, offset); + data = (m_dsw->read() & 0x1f) | (m_in0->read() & 0xe0); + } + if (!(m_p1 & 0x20)) + { + printf("ext 5 r P1:%02x P2:%02x %02x\n", m_p1, m_p2, offset); + } + if (!(m_p1 & 0x40)) // digits + { + data = m_score_ram[BITSWAP8(offset, 3,2,1,0,7,6,5,4)]; + //printf("ext 6 r P1:%02x P2:%02x %02x\n", m_p1, m_p2, offset); + } + if (!(m_p1 & 0x80)) + { + //printf("ext 7 r P1:%02x P2:%02x %02x\n", m_p1, m_p2, offset); + data = 0; + if(machine().input().code_pressed(KEYCODE_1_PAD)) data |= 0x01; + if(machine().input().code_pressed(KEYCODE_2_PAD)) data |= 0x02; + if(machine().input().code_pressed(KEYCODE_3_PAD)) data |= 0x04; + if(machine().input().code_pressed(KEYCODE_4_PAD)) data |= 0x08; + + if (m_time_tick) + data |= 0x10; } -} -/* - -10 da U T -0f f2 F F -0e ea E E -0d e2 M L -12 ca U T -11 e2 H H -0f da G G -0e f2 I I -0d ea S R -13 e6 U T -11 de I I -10 f6 D D -0f ee E E -0e e6 S R -0c de C C -14 d0 Z -10 d8 O N -0f f0 I I -0e e8 P O -0d e0 C C -14 d6 T S -13 ee U T -12 e6 I I -10 de D D -0f f6 E E -0e ee S R -0d e6 C C -14 d8 Z -11 e0 O N -0f d8 I I -0e f0 P O -0d e8 C C -*/ + return data; +} +WRITE8_MEMBER(monzagp_state::port_w) +{ + if (!(m_p1 & 0x01)) // 8350 videoram + { + //printf("ext 0 w P1:%02x P2:%02x, %02x = %02x\n", m_p1, m_p2, offset, data); + int addr = ((m_p2 & 0x3f) << 5) | (offset & 0x1f); + m_vram[addr] = data; + } + if (!(m_p1 & 0x02)) + { + printf("ext 1 w P1:%02x P2:%02x, %02x = %02x\n", m_p1, m_p2, offset, data); + } + if (!(m_p1 & 0x04)) // GFX + { + //printf("ext 2 w P1:%02x P2:%02x, %02x = %02x\n", m_p1, m_p2, offset, data); + int addr = ((m_p2 & 0x7f) << 5) | (offset & 0x1f); + if (addr < 0x400) + { + static int pt[] = { 0x0e, 0x0c, 0x0d, 0x08, 0x09, 0x0a, 0x0b, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x0f }; + m_gfx1->base()[addr] = (pt[(data >> 4) & 0x0f] << 4) | pt[data & 0x0f]; + m_gfxdecode->gfx(0)->mark_dirty(addr >> 4); + } + } + if (!(m_p1 & 0x08)) + { + //printf("ext 3 w P1:%02x P2:%02x, %02x = %02x\n", m_p1, m_p2, offset, data); + } + if (!(m_p1 & 0x10)) + { + printf("ext 4 w P1:%02x P2:%02x, %02x = %02x\n", m_p1, m_p2, offset, data); + } + if (!(m_p1 & 0x20)) + { + //printf("ext 5 w P1:%02x P2:%02x, %02x = %02x\n", m_p1, m_p2, offset, data); + } + if (!(m_p1 & 0x40)) // digits + { + //printf("ext 6 w P1:%02x P2:%02x, %02x = %02x\n", m_p1, m_p2, offset, data); + offs_t ram_offset = BITSWAP8(offset, 3,2,1,0,7,6,5,4); + m_score_ram[ram_offset] = data & 0x0f; -WRITE8_MEMBER(monzagp_state::port0_w) -{ -// printf("P0 %x = %x\n",space.device().safe_pc(),data); + if ((ram_offset & 0x07) == 0) + { + // 74LS47 BCD-to-Seven-Segment Decoder + static UINT8 bcd2hex[] = { 0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7c, 0x07, 0x7f, 0x67, 0x58, 0x4c, 0x62, 0x49, 0x78, 0x00 }; + output_set_digit_value(ram_offset >> 3, bcd2hex[data & 0x0f]); + } + } + if (!(m_p1 & 0x80)) + { + //printf("ext 7 w P1:%02x P2:%02x, %02x = %02x\n", m_p1, m_p2, offset, data); + m_video_ctrl[0][(offset>>0) & 0x07] = data; + m_video_ctrl[1][(offset>>3) & 0x07] = data; + } } WRITE8_MEMBER(monzagp_state::port1_w) { // printf("P1 %x = %x\n",space.device().safe_pc(),data); + m_p1 = data; } -WRITE8_MEMBER(monzagp_state::port2_w) +READ8_MEMBER(monzagp_state::port2_r) { -// printf("P2 %x = %x\n",space.device().safe_pc(),data); - m_coordy=data; + return m_p2; } -#if 0 -WRITE8_MEMBER(monzagp_state::port3_w) +WRITE8_MEMBER(monzagp_state::port2_w) { - output=data; +// printf("P2 %x = %x\n",space.device().safe_pc(),data); + m_p2 = data; } -#endif - -/* - -#define I8039_p0 0x100 -#define I8039_p1 0x101 -#define I8039_p2 0x102 -#define I8039_p4 0x104 -#define I8039_p5 0x105 -#define I8039_p6 0x106 -#define I8039_p7 0x107 -#define I8039_t0 0x110 -#define I8039_t1 0x111 -#define I8039_bus 0x120 -*/ static ADDRESS_MAP_START( monzagp_io, AS_IO, 8, monzagp_state ) - AM_RANGE(0x00, 0xff) AM_READWRITE(rng_r,port_w) - AM_RANGE(0x100, 0x100) AM_WRITE(port0_w) - AM_RANGE(0x101, 0x101) AM_WRITE(port1_w) - AM_RANGE(0x102, 0x102) AM_WRITE(port2_w) - AM_RANGE(0x104, 0x104) AM_READ(rng_r) + AM_RANGE(0x00, 0xff) AM_READWRITE(port_r, port_w) + AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE(port1_w) + AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READWRITE(port2_r, port2_w) ADDRESS_MAP_END static INPUT_PORTS_START( monzagp ) PORT_START("IN0") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_TILT ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 ) + + PORT_START("IN1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) + + PORT_START("DSW") + PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW:1,2") + PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) + PORT_DIPSETTING( 0x01, DEF_STR( 1C_2C ) ) + PORT_DIPSETTING( 0x02, DEF_STR( 1C_3C ) ) + PORT_DIPSETTING( 0x03, DEF_STR( 2C_1C ) ) + PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW:3,4") + PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) + PORT_DIPSETTING( 0x04, DEF_STR( 1C_2C ) ) + PORT_DIPSETTING( 0x08, DEF_STR( 1C_3C ) ) + PORT_DIPSETTING( 0x0c, DEF_STR( 2C_1C ) ) + PORT_DIPNAME( 0x30, 0x00, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW:5,6") + PORT_DIPSETTING( 0x00, DEF_STR( Easy ) ) + PORT_DIPSETTING( 0x10, DEF_STR( Medium ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Medium ) ) + PORT_DIPSETTING( 0x30, DEF_STR( Hard ) ) + PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW:7") + PORT_DIPSETTING( 0x00, DEF_STR( Unused ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Unused ) ) + PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW:8") + PORT_DIPSETTING( 0x00, DEF_STR( Unused ) ) + PORT_DIPSETTING( 0x80, DEF_STR( Unused ) ) INPUT_PORTS_END -static const gfx_layout tile_layout1 = +static const gfx_layout char_layout = { - 8,8, + 7,10, RGN_FRAC(1,1), - 1, /* 2 bit per pixel */ + 1, { 0 }, - { 0,1,2,3,4,5,6,7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + { STEP8(1,1) }, + { STEP16(0,8) }, 8*8*2 }; -static const gfx_layout tile_layout2 = +static const gfx_layout tile_layout = { - 8,8, + 4, 32, RGN_FRAC(1,1), - 1, /* 2 bit per pixel */ - { 8*8 }, - { 0,1,2,3,4,5,6,7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8*2 + 2, + { STEP2(0,4) }, + { STEP4(0,1) }, + { STEP32(0,4*2) }, + 32*4*2, +}; + +static const gfx_layout sprite_layout = +{ + 4, 16, + RGN_FRAC(1,1), + 2, + { STEP2(0,4) }, + { STEP4(0,1) }, + { STEP16(0,4*2) }, + 16*4*2, }; + static GFXDECODE_START( monzagp ) - GFXDECODE_ENTRY( "gfx1", 0x0000, tile_layout1, 0, 8 ) - GFXDECODE_ENTRY( "gfx1", 0x0000, tile_layout2, 0, 8 ) + GFXDECODE_ENTRY( "gfx1", 0x0000, char_layout, 0, 8 ) + GFXDECODE_ENTRY( "gfx2", 0x0000, sprite_layout, 0, 8 ) + GFXDECODE_ENTRY( "gfx3", 0x0000, tile_layout, 0, 8 ) GFXDECODE_END static MACHINE_CONFIG_START( monzagp, monzagp_state ) - MCFG_CPU_ADD("maincpu", I8035, 12000000/32) /* 400KHz ??? - Main board Crystal is 12MHz */ + MCFG_CPU_ADD("maincpu", I8035, 12000000/4) /* 400KHz ??? - Main board Crystal is 12MHz */ MCFG_CPU_PROGRAM_MAP(monzagp_map) MCFG_CPU_IO_MAP(monzagp_io) MCFG_CPU_VBLANK_INT_DRIVER("screen", monzagp_state, irq0_line_hold) @@ -278,6 +428,10 @@ static MACHINE_CONFIG_START( monzagp, monzagp_state ) MCFG_PALETTE_INIT_OWNER(monzagp_state, monzagp) MCFG_GFXDECODE_ADD("gfxdecode", "palette", monzagp) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("time_tick_timer", monzagp_state, time_tick_timer, attotime::from_hz(4)) + + MCFG_NVRAM_ADD_NO_FILL("nvram") MACHINE_CONFIG_END ROM_START( monzagp ) @@ -287,20 +441,24 @@ ROM_START( monzagp ) ROM_LOAD( "14.8a", 0x0800, 0x0400, CRC(16a1b36c) SHA1(6bc6bac37febb7c0fe18dc9b0a4e3a71ad1faafd) ) ROM_LOAD( "15.9a", 0x0c00, 0x0400, CRC(ee6d9cc6) SHA1(0aa9efe812c1d4865fee2bbb1764a135dd642790) ) - ROM_REGION( 0x10000, "gfx1", 0 ) - ROM_LOAD( "11.8d", 0x0000, 0x0400, CRC(47607a83) SHA1(91ce272c4af3e1994db71d2239b68879dd279347) ) + ROM_REGION( 0x1000, "gfx1", 0 ) ROM_LOAD( "10.7d", 0x0400, 0x0400, CRC(d2bedd67) SHA1(9b75731d2701f5b9ce0446141c5cd55b05671ec1) ) - ROM_LOAD( "9.10j", 0x0800, 0x0400, CRC(474ab63f) SHA1(6ba623d1768ed92b39e8f76c2f2eed7874955f1b) ) - ROM_LOAD( "6.4f", 0x0c00, 0x0400, CRC(934d2070) SHA1(e742bfcb910e8747780d32ca66efd7e343190fb4) ) - ROM_LOAD( "7.3f", 0x1000, 0x0400, CRC(08f29f60) SHA1(9ca454e848aa986ff9eccaead3fec5076df2e4d3) ) - ROM_LOAD( "8.1f", 0x1400, 0x0400, CRC(99ce2753) SHA1(f4540700ea909ba1be34ac2c33dafd8ec67a2bb7) ) + ROM_LOAD( "11.8d", 0x0800, 0x0400, CRC(47607a83) SHA1(91ce272c4af3e1994db71d2239b68879dd279347) ) + + ROM_REGION( 0x1000, "gfx2", 0 ) + ROM_LOAD( "9.10j", 0x0000, 0x0400, CRC(474ab63f) SHA1(6ba623d1768ed92b39e8f76c2f2eed7874955f1b) ) + ROM_LOAD( "6.4f", 0x0400, 0x0400, CRC(934d2070) SHA1(e742bfcb910e8747780d32ca66efd7e343190fb4) ) + ROM_LOAD( "7.3f", 0x0800, 0x0400, CRC(08f29f60) SHA1(9ca454e848aa986ff9eccaead3fec5076df2e4d3) ) + ROM_LOAD( "8.1f", 0x0c00, 0x0400, CRC(99ce2753) SHA1(f4540700ea909ba1be34ac2c33dafd8ec67a2bb7) ) + + ROM_REGION( 0x1000, "gfx3", 0 ) + ROM_LOAD( "5.9f", 0x0000, 0x0400, CRC(5abd1ef6) SHA1(1bc79225c1be2821930fdb8e821a70c7ac8683ab) ) + ROM_LOAD( "4.10f", 0x0400, 0x0400, CRC(a426a371) SHA1(d6023bebf6924d1820e631ee53896100e5b256a5) ) + ROM_LOAD( "3.12f", 0x0800, 0x0400, CRC(e5591074) SHA1(ac756ee605d932d7c1c3eddbe2b9c6f78dad6ce8) ) + ROM_LOAD( "2.13f", 0x0c00, 0x0400, BAD_DUMP CRC(1943122f) SHA1(3d343314fcb594560b4a280e795c8cea4a3200c9) ) /* missing, so use rom from below. Not confirmed to 100% same */ ROM_REGION( 0x10000, "unk1", 0 ) ROM_LOAD( "1.9c", 0x0000, 0x0400, CRC(005d5fed) SHA1(145a860751ef7d99129b7242aacac7a4e1e14a51) ) - ROM_LOAD( "2.13f", 0x0400, 0x0400, BAD_DUMP CRC(1943122f) SHA1(3d343314fcb594560b4a280e795c8cea4a3200c9) ) /* missing, so use rom from below. Not confirmed to 100% same */ - ROM_LOAD( "3.12f", 0x0800, 0x0400, CRC(e5591074) SHA1(ac756ee605d932d7c1c3eddbe2b9c6f78dad6ce8) ) - ROM_LOAD( "4.10f", 0x0c00, 0x0400, CRC(a426a371) SHA1(d6023bebf6924d1820e631ee53896100e5b256a5) ) - ROM_LOAD( "5.9f", 0x1000, 0x0400, CRC(5abd1ef6) SHA1(1bc79225c1be2821930fdb8e821a70c7ac8683ab) ) ROM_REGION( 0x0700, "proms", 0 ) ROM_LOAD( "63s140.1", 0x0000, 0x0100, CRC(5123c83e) SHA1(d8ff06af421d3dae65bc9b0a081ed56249ef61ab) ) @@ -320,20 +478,24 @@ ROM_START( monzagpb ) ROM_LOAD( "m14.8a", 0x0800, 0x0400, CRC(16a1b36c) SHA1(6bc6bac37febb7c0fe18dc9b0a4e3a71ad1faafd) ) ROM_LOAD( "m15bi.9a", 0x0c00, 0x0400, CRC(ee6d9cc6) SHA1(0aa9efe812c1d4865fee2bbb1764a135dd642790) ) - ROM_REGION( 0x10000, "gfx1", 0 ) - ROM_LOAD( "m11.8d", 0x0000, 0x0400, CRC(5b4a7ffa) SHA1(50fa073437febe516065cd83fbaf85b596c4f3c8) ) /* differs from above */ + ROM_REGION( 0x1000, "gfx1", 0 ) ROM_LOAD( "m10.7d", 0x0400, 0x0400, CRC(19db00af) SHA1(c73da9c2fdbdb1b52a7354ba169af43b26fcb4cc) ) /* differs from above */ - ROM_LOAD( "m9.10j", 0x0800, 0x0400, CRC(474ab63f) SHA1(6ba623d1768ed92b39e8f76c2f2eed7874955f1b) ) - ROM_LOAD( "m6.4f", 0x0c00, 0x0400, CRC(934d2070) SHA1(e742bfcb910e8747780d32ca66efd7e343190fb4) ) - ROM_LOAD( "m7.3f", 0x1000, 0x0400, CRC(08f29f60) SHA1(9ca454e848aa986ff9eccaead3fec5076df2e4d3) ) - ROM_LOAD( "m8.1f", 0x1400, 0x0400, CRC(99ce2753) SHA1(f4540700ea909ba1be34ac2c33dafd8ec67a2bb7) ) + ROM_LOAD( "m11.8d", 0x0800, 0x0400, CRC(5b4a7ffa) SHA1(50fa073437febe516065cd83fbaf85b596c4f3c8) ) /* differs from above */ + + ROM_REGION( 0x1000, "gfx2", 0 ) + ROM_LOAD( "m9.10j", 0x0000, 0x0400, CRC(474ab63f) SHA1(6ba623d1768ed92b39e8f76c2f2eed7874955f1b) ) + ROM_LOAD( "m6.4f", 0x0400, 0x0400, CRC(934d2070) SHA1(e742bfcb910e8747780d32ca66efd7e343190fb4) ) + ROM_LOAD( "m7.3f", 0x0800, 0x0400, CRC(08f29f60) SHA1(9ca454e848aa986ff9eccaead3fec5076df2e4d3) ) + ROM_LOAD( "m8.1f", 0x0c00, 0x0400, CRC(99ce2753) SHA1(f4540700ea909ba1be34ac2c33dafd8ec67a2bb7) ) + + ROM_REGION( 0x1000, "gfx3", 0 ) + ROM_LOAD( "m5.9f", 0x0000, 0x0400, CRC(5abd1ef6) SHA1(1bc79225c1be2821930fdb8e821a70c7ac8683ab) ) + ROM_LOAD( "m4.10f", 0x0400, 0x0400, CRC(a426a371) SHA1(d6023bebf6924d1820e631ee53896100e5b256a5) ) + ROM_LOAD( "m3.12f", 0x0800, 0x0400, CRC(e5591074) SHA1(ac756ee605d932d7c1c3eddbe2b9c6f78dad6ce8) ) + ROM_LOAD( "m2.13f", 0x0c00, 0x0400, CRC(1943122f) SHA1(3d343314fcb594560b4a280e795c8cea4a3200c9) ) ROM_REGION( 0x10000, "unk1", 0 ) ROM_LOAD( "m1.9c", 0x0000, 0x0400, CRC(005d5fed) SHA1(145a860751ef7d99129b7242aacac7a4e1e14a51) ) - ROM_LOAD( "m2.13f", 0x0400, 0x0400, CRC(1943122f) SHA1(3d343314fcb594560b4a280e795c8cea4a3200c9) ) - ROM_LOAD( "m3.12f", 0x0800, 0x0400, CRC(e5591074) SHA1(ac756ee605d932d7c1c3eddbe2b9c6f78dad6ce8) ) - ROM_LOAD( "m4.10f", 0x0c00, 0x0400, CRC(a426a371) SHA1(d6023bebf6924d1820e631ee53896100e5b256a5) ) - ROM_LOAD( "m5.9f", 0x1000, 0x0400, CRC(5abd1ef6) SHA1(1bc79225c1be2821930fdb8e821a70c7ac8683ab) ) ROM_REGION( 0x0700, "proms", 0 ) ROM_LOAD( "6300.1", 0x0000, 0x0100, CRC(5123c83e) SHA1(d8ff06af421d3dae65bc9b0a081ed56249ef61ab) ) @@ -346,5 +508,5 @@ ROM_START( monzagpb ) ROM_END -GAME( 1981, monzagp, 0, monzagp, monzagp, driver_device, 0, ROT270, "Olympia", "Monza GP", MACHINE_NOT_WORKING|MACHINE_NO_SOUND ) -GAME( 1981, monzagpb, monzagp, monzagp, monzagp, driver_device, 0, ROT270, "bootleg", "Monza GP (bootleg)", MACHINE_NOT_WORKING|MACHINE_NO_SOUND ) +GAMEL( 1981, monzagp, 0, monzagp, monzagp, driver_device, 0, ROT270, "Olympia", "Monza GP", MACHINE_NOT_WORKING|MACHINE_NO_SOUND, layout_monzagp ) +GAMEL( 1981, monzagpb, monzagp, monzagp, monzagp, driver_device, 0, ROT270, "bootleg", "Monza GP (bootleg)", MACHINE_NOT_WORKING|MACHINE_NO_SOUND, layout_monzagp ) diff --git a/src/mame/drivers/mwarr.c b/src/mame/drivers/mwarr.c index 1f7cbb836c9..aff1fae0552 100644 --- a/src/mame/drivers/mwarr.c +++ b/src/mame/drivers/mwarr.c @@ -78,7 +78,6 @@ public: required_shared_ptr<UINT16> m_mhigh_scrollram; required_shared_ptr<UINT16> m_vidattrram; required_shared_ptr<UINT16> m_spriteram; -// UINT16 *m_paletteram; // currently this uses generic palette handling required_shared_ptr<UINT16> m_mwarr_ram; /* video-related */ diff --git a/src/mame/drivers/namcos10.c b/src/mame/drivers/namcos10.c index a101c02bf40..3af6c3c0af2 100644 --- a/src/mame/drivers/namcos10.c +++ b/src/mame/drivers/namcos10.c @@ -269,6 +269,7 @@ Kono Tako 10021 Ver.A KC034A 8E, 8D #include "emu.h" #include "cpu/psx/psx.h" #include "video/psx.h" +#include "machine/ns10crypt.h" class namcos10_state : public driver_device { @@ -283,7 +284,8 @@ public: DECLARE_WRITE16_MEMBER(bank_w); // memn variant interface - DECLARE_READ16_MEMBER (nand_status_r); + DECLARE_WRITE16_MEMBER(crypto_switch_w); + DECLARE_READ16_MEMBER(nand_status_r); DECLARE_WRITE8_MEMBER(nand_address1_w); DECLARE_WRITE8_MEMBER(nand_address2_w); DECLARE_WRITE8_MEMBER(nand_address3_w); @@ -301,6 +303,7 @@ private: UINT32 bank_base; UINT32 nand_address; UINT16 block[0x1ff]; + ns10_decrypter_device* decrypter; UINT16 nand_read( UINT32 address ); UINT16 nand_read2( UINT32 address ); @@ -401,6 +404,18 @@ ADDRESS_MAP_END // Block access to the nand. Something strange is going on with the // status port. Interaction with the decryption is unclear at best. +WRITE16_MEMBER(namcos10_state::crypto_switch_w) +{ + printf("crypto_switch_w: %04x\n", data); + if (decrypter == 0) + return; + + if (BIT(data, 15) != 0) + decrypter->activate(data & 0xf); + else + decrypter->deactivate(); +} + READ16_MEMBER(namcos10_state::nand_status_r ) { return 0; @@ -447,11 +462,19 @@ READ16_MEMBER( namcos10_state::nand_data_r ) UINT16 data = nand_read2( nand_address * 2 ); // logerror("read %08x = %04x\n", nand_address*2, data); + //printf("read %08x = %04x\n", nand_address*2, data); + /* printf( "data<-%08x (%08x)\n", data, nand_address ); */ nand_address++; - return data; + if (decrypter == 0) + return data; + + if (decrypter->is_active()) + return decrypter->decrypt(data); + else + return data; } void namcos10_state::nand_copy( UINT32 *dst, UINT32 address, int len ) @@ -475,8 +498,8 @@ READ16_MEMBER(namcos10_state::nand_block_r) } static ADDRESS_MAP_START( namcos10_memn_map, AS_PROGRAM, 32, namcos10_state ) - AM_RANGE(0x1f300000, 0x1f300003) AM_WRITE16(key_w, 0x0000ffff) - + AM_RANGE(0x1f300000, 0x1f300003) AM_WRITE16(crypto_switch_w, 0x0000ffff) + AM_RANGE(0x1f380000, 0x1f380003) AM_WRITE16(crypto_switch_w, 0x0000ffff) AM_RANGE(0x1f400000, 0x1f400003) AM_READ16(nand_status_r, 0x0000ffff) AM_RANGE(0x1f410000, 0x1f410003) AM_WRITE8(nand_address1_w, 0x000000ff) AM_RANGE(0x1f420000, 0x1f420003) AM_WRITE8(nand_address2_w, 0x000000ff) @@ -492,17 +515,18 @@ void namcos10_state::memn_driver_init( ) { UINT8 *BIOS = (UINT8 *)memregion( "maincpu:rom" )->base(); nand_base = (UINT8 *)memregion( "user2" )->base(); + decrypter = static_cast<ns10_decrypter_device*>(machine().root_device().subdevice("decrypter")); nand_copy( (UINT32 *)( BIOS + 0x0000000 ), 0x08000, 0x001c000 ); nand_copy( (UINT32 *)( BIOS + 0x0020000 ), 0x24000, 0x03e0000 ); } -static void decrypt_bios( running_machine &machine, const char *regionName, int start, int b15, int b14, int b13, int b12, int b11, int b10, int b9, int b8, +static void decrypt_bios( running_machine &machine, const char *regionName, int start, int end, int b15, int b14, int b13, int b12, int b11, int b10, int b9, int b8, int b7, int b6, int b5, int b4, int b3, int b2, int b1, int b0 ) { memory_region *region = machine.root_device().memregion( regionName ); UINT16 *BIOS = (UINT16 *)( region->base() + start ); - int len = (region->bytes()-start)/2; + int len = (end - start) / 2; for( int i = 0; i < len; i++ ) { @@ -513,66 +537,89 @@ static void decrypt_bios( running_machine &machine, const char *regionName, int DRIVER_INIT_MEMBER(namcos10_state,mrdrilr2) { - decrypt_bios( machine(), "maincpu:rom", 0, 0xc, 0xd, 0xf, 0xe, 0xb, 0xa, 0x9, 0x8, 0x7, 0x6, 0x4, 0x1, 0x2, 0x5, 0x0, 0x3 ); + int regSize = machine().root_device().memregion("user2")->bytes(); + decrypt_bios(machine(), "maincpu:rom", 0, regSize, 0xc, 0xd, 0xf, 0xe, 0xb, 0xa, 0x9, 0x8, 0x7, 0x6, 0x4, 0x1, 0x2, 0x5, 0x0, 0x3); } DRIVER_INIT_MEMBER(namcos10_state,gjspace) { - decrypt_bios( machine(), "user2", 0x8400, 0x0, 0x2, 0xe, 0xd, 0xf, 0x6, 0xc, 0x7, 0x5, 0x1, 0x9, 0x8, 0xa, 0x3, 0x4, 0xb ); + int regSize = machine().root_device().memregion("user2")->bytes(); + decrypt_bios(machine(), "user2", 0x8400, regSize, 0x0, 0x2, 0xe, 0xd, 0xf, 0x6, 0xc, 0x7, 0x5, 0x1, 0x9, 0x8, 0xa, 0x3, 0x4, 0xb); memn_driver_init(); } DRIVER_INIT_MEMBER(namcos10_state,mrdrilrg) { - decrypt_bios( machine(), "user2", 0x8400, 0x6, 0x4, 0x7, 0x5, 0x2, 0x1, 0x0, 0x3, 0xc, 0xd, 0xe, 0xf, 0x8, 0x9, 0xb, 0xa ); + int regSize = machine().root_device().memregion("user2")->bytes(); + decrypt_bios(machine(), "user2", 0x8400, regSize, 0x6, 0x4, 0x7, 0x5, 0x2, 0x1, 0x0, 0x3, 0xc, 0xd, 0xe, 0xf, 0x8, 0x9, 0xb, 0xa); memn_driver_init(); } DRIVER_INIT_MEMBER(namcos10_state,knpuzzle) { - decrypt_bios( machine(), "user2", 0x8400, 0x6, 0x7, 0x4, 0x5, 0x2, 0x0, 0x3, 0x1, 0xc, 0xd, 0xe, 0xf, 0x9, 0xb, 0x8, 0xa ); + int regSize = machine().root_device().memregion("user2")->bytes(); + decrypt_bios(machine(), "user2", 0x0008400, 0x0029400, 0x6, 0x7, 0x4, 0x5, 0x2, 0x0, 0x3, 0x1, 0xc, 0xd, 0xe, 0xf, 0x9, 0xb, 0x8, 0xa); + decrypt_bios(machine(), "user2", 0x047ac00, 0x1042200, 0x6, 0x7, 0x4, 0x5, 0x2, 0x0, 0x3, 0x1, 0xc, 0xd, 0xe, 0xf, 0x9, 0xb, 0x8, 0xa); + decrypt_bios(machine(), "user2", 0x104a600, regSize , 0x6, 0x7, 0x4, 0x5, 0x2, 0x0, 0x3, 0x1, 0xc, 0xd, 0xe, 0xf, 0x9, 0xb, 0x8, 0xa); memn_driver_init(); } DRIVER_INIT_MEMBER(namcos10_state,startrgn) { - decrypt_bios( machine(), "user2", 0x8400, 0x6, 0x5, 0x4, 0x7, 0x1, 0x3, 0x0, 0x2, 0xc, 0xd, 0xe, 0xf, 0x8, 0xb, 0xa, 0x9 ); + int regSize = machine().root_device().memregion("user2")->bytes(); + decrypt_bios(machine(), "user2", 0x0008400, 0x0029400, 0x6, 0x5, 0x4, 0x7, 0x1, 0x3, 0x0, 0x2, 0xc, 0xd, 0xe, 0xf, 0x8, 0xb, 0xa, 0x9); + decrypt_bios(machine(), "user2", 0x00b9a00, 0x105ae00, 0x6, 0x5, 0x4, 0x7, 0x1, 0x3, 0x0, 0x2, 0xc, 0xd, 0xe, 0xf, 0x8, 0xb, 0xa, 0x9); + decrypt_bios(machine(), "user2", 0x1080000, regSize , 0x6, 0x7, 0x4, 0x5, 0x0, 0x1, 0x3, 0x2, 0xd, 0xc, 0xf, 0xe, 0x8, 0x9, 0xb, 0xa); memn_driver_init(); } DRIVER_INIT_MEMBER(namcos10_state,gamshara) { - decrypt_bios( machine(), "user2", 0x8400, 0x5, 0x4, 0x7, 0x6, 0x0, 0x1, 0x3, 0x2, 0xd, 0xf, 0xc, 0xe, 0x8, 0x9, 0xa, 0xb ); + int regSize = machine().root_device().memregion("user2")->bytes(); + decrypt_bios(machine(), "user2", 0x0008400, 0x0029400, 0x5, 0x4, 0x7, 0x6, 0x0, 0x1, 0x3, 0x2, 0xd, 0xf, 0xc, 0xe, 0x8, 0x9, 0xa, 0xb); + decrypt_bios(machine(), "user2", 0x014e200, 0x105ae00, 0x5, 0x4, 0x7, 0x6, 0x0, 0x1, 0x3, 0x2, 0xd, 0xf, 0xc, 0xe, 0x8, 0x9, 0xa, 0xb); + decrypt_bios(machine(), "user2", 0x1080000, regSize , 0x5, 0x4, 0x7, 0x6, 0x0, 0x1, 0x3, 0x2, 0xd, 0xf, 0xc, 0xe, 0x8, 0x9, 0xa, 0xb); memn_driver_init(); } DRIVER_INIT_MEMBER(namcos10_state,gunbalna) { - decrypt_bios( machine(), "user2", 0x8400, 0x5, 0x4, 0x7, 0x6, 0x0, 0x1, 0x3, 0x2, 0xd, 0xf, 0xc, 0xe, 0x9, 0x8, 0xa, 0xb ); + int regSize = machine().root_device().memregion("user2")->bytes(); + decrypt_bios(machine(), "user2", 0x8400, regSize, 0x5, 0x4, 0x7, 0x6, 0x0, 0x1, 0x3, 0x2, 0xd, 0xf, 0xc, 0xe, 0x9, 0x8, 0xa, 0xb); memn_driver_init(); } DRIVER_INIT_MEMBER(namcos10_state,chocovdr) { - decrypt_bios( machine(), "user2", 0x8400, 0x5, 0x4, 0x6, 0x7, 0x1, 0x0, 0x2, 0x3, 0xc, 0xf, 0xe, 0xd, 0x8, 0xb, 0xa, 0x9 ); + int regSize = machine().root_device().memregion("user2")->bytes(); + decrypt_bios(machine(), "user2", 0x0008400, 0x0029400, 0x5, 0x4, 0x6, 0x7, 0x1, 0x0, 0x2, 0x3, 0xc, 0xf, 0xe, 0xd, 0x8, 0xb, 0xa, 0x9); + decrypt_bios(machine(), "user2", 0x01eae00, 0x105ae00, 0x5, 0x4, 0x6, 0x7, 0x1, 0x0, 0x2, 0x3, 0xc, 0xf, 0xe, 0xd, 0x8, 0xb, 0xa, 0x9); + decrypt_bios(machine(), "user2", 0x1080000, regSize , 0x5, 0x4, 0x6, 0x7, 0x1, 0x0, 0x2, 0x3, 0xc, 0xf, 0xe, 0xd, 0x8, 0xb, 0xa, 0x9); memn_driver_init(); } DRIVER_INIT_MEMBER(namcos10_state,panikuru) { - decrypt_bios( machine(), "user2", 0x8400, 0x6, 0x4, 0x7, 0x5, 0x0, 0x1, 0x2, 0x3, 0xc, 0xf, 0xe, 0xd, 0x9, 0x8, 0xb, 0xa ); + int regSize = machine().root_device().memregion("user2")->bytes(); + decrypt_bios(machine(), "user2", 0x8400, regSize, 0x6, 0x4, 0x7, 0x5, 0x0, 0x1, 0x2, 0x3, 0xc, 0xf, 0xe, 0xd, 0x9, 0x8, 0xb, 0xa); memn_driver_init(); } DRIVER_INIT_MEMBER(namcos10_state,nflclsfb) { - decrypt_bios( machine(), "user2", 0x8400, 0x6, 0x5, 0x4, 0x7, 0x1, 0x3, 0x0, 0x2, 0xc, 0xd, 0xe, 0xf, 0x8, 0xb, 0xa, 0x9 ); + int regSize = machine().root_device().memregion("user2")->bytes(); + decrypt_bios(machine(), "user2", 0x0008400, 0x0029400, 0x6, 0x5, 0x4, 0x7, 0x1, 0x3, 0x0, 0x2, 0xc, 0xd, 0xe, 0xf, 0x8, 0xb, 0xa, 0x9); + decrypt_bios(machine(), "user2", 0x0214200, 0x105ae00, 0x6, 0x5, 0x4, 0x7, 0x1, 0x3, 0x0, 0x2, 0xc, 0xd, 0xe, 0xf, 0x8, 0xb, 0xa, 0x9); + decrypt_bios(machine(), "user2", 0x1080000, regSize , 0x6, 0x5, 0x4, 0x7, 0x1, 0x3, 0x0, 0x2, 0xc, 0xd, 0xe, 0xf, 0x8, 0xb, 0xa, 0x9); memn_driver_init(); } DRIVER_INIT_MEMBER(namcos10_state,konotako) { - decrypt_bios( machine(), "user2", 0x8400, 0x6, 0x7, 0x4, 0x5, 0x0, 0x1, 0x3, 0x2, 0xd, 0xc, 0xf, 0xe, 0x8, 0x9, 0xb, 0xa ); + int regSize = machine().root_device().memregion("user2")->bytes(); + decrypt_bios(machine(), "user2", 0x0008400, 0x0029400, 0x6, 0x7, 0x4, 0x5, 0x0, 0x1, 0x3, 0x2, 0xd, 0xc, 0xf, 0xe, 0x8, 0x9, 0xb, 0xa); + decrypt_bios(machine(), "user2", 0x00b9a00, 0x105ae00, 0x6, 0x7, 0x4, 0x5, 0x0, 0x1, 0x3, 0x2, 0xd, 0xc, 0xf, 0xe, 0x8, 0x9, 0xb, 0xa); + decrypt_bios(machine(), "user2", 0x1080000, regSize , 0x6, 0x7, 0x4, 0x5, 0x0, 0x1, 0x3, 0x2, 0xd, 0xc, 0xf, 0xe, 0x8, 0x9, 0xb, 0xa); memn_driver_init(); } @@ -615,6 +662,36 @@ static MACHINE_CONFIG_START( namcos10_memn, namcos10_state ) MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED(ns10_chocovdr, namcos10_memn) +/* decrypter device (CPLD in hardware?) */ +MCFG_DEVICE_ADD("decrypter", CHOCOVDR_DECRYPTER, 0) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED(ns10_gamshara, namcos10_memn) +/* decrypter device (CPLD in hardware?) */ +MCFG_DEVICE_ADD("decrypter", GAMSHARA_DECRYPTER, 0) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED(ns10_knpuzzle, namcos10_memn) +/* decrypter device (CPLD in hardware?) */ +MCFG_DEVICE_ADD("decrypter", KNPUZZLE_DECRYPTER, 0) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED(ns10_konotako, namcos10_memn) +/* decrypter device (CPLD in hardware?) */ +MCFG_DEVICE_ADD("decrypter", KONOTAKO_DECRYPTER, 0) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED(ns10_nflclsfb, namcos10_memn) +/* decrypter device (CPLD in hardware?) */ +MCFG_DEVICE_ADD("decrypter", NFLCLSFB_DECRYPTER, 0) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED(ns10_startrgn, namcos10_memn) +/* decrypter device (CPLD in hardware?) */ +MCFG_DEVICE_ADD("decrypter", STARTRGN_DECRYPTER, 0) +MACHINE_CONFIG_END + static INPUT_PORTS_START( namcos10 ) /* IN 0 */ PORT_START("SYSTEM") @@ -750,8 +827,9 @@ ROM_START( ptblank3 ) ROM_FILL( 0x0000000, 0x400000, 0x55 ) ROM_REGION16_LE( 0x2100000, "user2", 0 ) /* main prg */ - ROM_LOAD( "gnn2a.8e", 0x0000000, 0x1080000, CRC(31b39221) SHA1(7fcb14aaa26c531928a6cd704e746d0e3ae3e031) ) - ROM_LOAD( "gnn2a.8d", 0x1080000, 0x1080000, CRC(82d2cfb5) SHA1(4b5e713a55e74a7b32b1b9b5811892df2df86256) ) + // protection issues preventing the last NAND block to be dumped + ROM_LOAD("gnn2a.8e", 0x0000000, 0x1080000, BAD_DUMP CRC(31b39221) SHA1(7fcb14aaa26c531928a6cd704e746d0e3ae3e031)) + ROM_LOAD( "gnn2a.8d", 0x1080000, 0x1080000, BAD_DUMP CRC(82d2cfb5) SHA1(4b5e713a55e74a7b32b1b9b5811892df2df86256) ) ROM_END ROM_START( gunbalina ) @@ -759,8 +837,9 @@ ROM_START( gunbalina ) ROM_FILL( 0x0000000, 0x400000, 0x55 ) ROM_REGION16_LE( 0x2100000, "user2", 0 ) /* main prg */ - ROM_LOAD( "gnn1a.8e", 0x0000000, 0x1080000, CRC(981b03d4) SHA1(1c55458f1b2964afe2cf4e9d84548c0699808e9f) ) - ROM_LOAD( "gnn1a.8d", 0x1080000, 0x1080000, CRC(6cd343e0) SHA1(dcec44abae1504025895f42fe574549e5010f7d5) ) + // protection issues preventing the last NAND block to be dumped + ROM_LOAD( "gnn1a.8e", 0x0000000, 0x1080000, BAD_DUMP CRC(981b03d4) SHA1(1c55458f1b2964afe2cf4e9d84548c0699808e9f) ) + ROM_LOAD( "gnn1a.8d", 0x1080000, 0x1080000, BAD_DUMP CRC(6cd343e0) SHA1(dcec44abae1504025895f42fe574549e5010f7d5) ) ROM_END ROM_START( chocovdr ) @@ -813,10 +892,10 @@ GAME( 2000, gunbalina, ptblank3, namcos10_memn, namcos10, namcos10_state, gunbal GAME( 2001, gjspace, 0, namcos10_memn, namcos10, namcos10_state, gjspace, ROT0, "Namco / Metro", "Gekitoride-Jong Space (10011 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) GAME( 2001, mrdrilrg, 0, namcos10_memn, namcos10, namcos10_state, mrdrilrg, ROT0, "Namco", "Mr. Driller G (Japan, DRG1 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) // PORT_4WAY joysticks GAME( 2001, mrdrilrga, mrdrilrg, namcos10_memn, namcos10, namcos10_state, mrdrilrg, ROT0, "Namco", "Mr. Driller G ALT (Japan, DRG1 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) // PORT_4WAY joysticks -GAME( 2001, knpuzzle, 0, namcos10_memn, namcos10, namcos10_state, knpuzzle, ROT0, "Namco", "Kotoba no Puzzle Mojipittan (Japan, KPM1 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -GAME( 2002, chocovdr, 0, namcos10_memn, namcos10, namcos10_state, chocovdr, ROT0, "Namco", "Uchuu Daisakusen: Chocovader Contactee (Japan, CVC1 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -GAME( 2002, startrgn, 0, namcos10_memn, namcos10, namcos10_state, startrgn, ROT0, "Namco", "Star Trigon (Japan, STT1 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +GAME( 2001, knpuzzle, 0, ns10_knpuzzle, namcos10, namcos10_state, knpuzzle, ROT0, "Namco", "Kotoba no Puzzle Mojipittan (Japan, KPM1 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +GAME( 2002, chocovdr, 0, ns10_chocovdr, namcos10, namcos10_state, chocovdr, ROT0, "Namco", "Uchuu Daisakusen: Chocovader Contactee (Japan, CVC1 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +GAME( 2002, startrgn, 0, ns10_startrgn, namcos10, namcos10_state, startrgn, ROT0, "Namco", "Star Trigon (Japan, STT1 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) GAME( 2002, panikuru, 0, namcos10_memn, namcos10, namcos10_state, panikuru, ROT0, "Namco", "Panicuru Panekuru (Japan, PPA1 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -GAME( 2003, nflclsfb, 0, namcos10_memn, namcos10, namcos10_state, nflclsfb, ROT0, "Namco", "NFL Classic Football (US, NCF3 Ver.A.)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -GAME( 2003, gamshara, 0, namcos10_memn, namcos10, namcos10_state, gamshara, ROT0, "Mitchell", "Gamshara (10021 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -GAME( 2003, konotako, 0, namcos10_memn, namcos10, namcos10_state, konotako, ROT0, "Mitchell", "Kono Tako (10021 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +GAME( 2003, nflclsfb, 0, ns10_nflclsfb, namcos10, namcos10_state, nflclsfb, ROT0, "Namco", "NFL Classic Football (US, NCF3 Ver.A.)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +GAME( 2003, gamshara, 0, ns10_gamshara, namcos10, namcos10_state, gamshara, ROT0, "Mitchell", "Gamshara (10021 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +GAME( 2003, konotako, 0, ns10_konotako, namcos10, namcos10_state, konotako, ROT0, "Mitchell", "Kono Tako (10021 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/namcos12.c b/src/mame/drivers/namcos12.c index 5025e1827ae..17fa8835948 100644 --- a/src/mame/drivers/namcos12.c +++ b/src/mame/drivers/namcos12.c @@ -1042,6 +1042,7 @@ Notes: #include "emu.h" #include "cpu/psx/psx.h" #include "cpu/h8/h83002.h" +#include "cpu/h8/h83337.h" #include "video/psx.h" #include "machine/at28c16.h" #include "sound/c352.h" @@ -1082,6 +1083,14 @@ public: UINT8 m_sub_porta; UINT8 m_sub_portb; + UINT8 m_jvssense; + UINT8 m_tssio_port_4; + + DECLARE_READ16_MEMBER(s12_mcu_p6_r); + DECLARE_READ16_MEMBER(iob_p4_r); + DECLARE_READ16_MEMBER(iob_p6_r); + DECLARE_WRITE16_MEMBER(iob_p4_w); + DECLARE_WRITE16_MEMBER(sharedram_w); DECLARE_READ16_MEMBER(sharedram_r); DECLARE_WRITE16_MEMBER(bankoffset_w); @@ -1112,6 +1121,7 @@ protected: virtual void machine_reset(); }; + inline void ATTR_PRINTF(3,4) namcos12_state::verboselog( int n_level, const char *s_fmt, ... ) { if( VERBOSE_LEVEL >= n_level ) @@ -1417,6 +1427,9 @@ void namcos12_state::machine_reset() address_space &space = m_maincpu->space(AS_PROGRAM); bankoffset_w(space,0,0,0xffff); + m_jvssense = 1; + m_tssio_port_4 = 0; + m_has_tektagt_dma = 0; if( strcmp( machine().system().name, "tektagt" ) == 0 || @@ -1441,6 +1454,7 @@ void namcos12_state::machine_reset() strcmp( machine().system().name, "sws2000" ) == 0 || strcmp( machine().system().name, "sws2001" ) == 0 || strcmp( machine().system().name, "truckk" ) == 0 || + strcmp( machine().system().name, "technodr" ) == 0 || strcmp( machine().system().name, "kartduel" ) == 0 || strcmp( machine().system().name, "ohbakyuun" ) == 0 || strcmp( machine().system().name, "ghlpanic" ) == 0 ) @@ -1464,6 +1478,17 @@ static ADDRESS_MAP_START( s12h8rwmap, AS_PROGRAM, 16, namcos12_state ) AM_RANGE(0x300030, 0x300031) AM_NOP // most S12 bioses write here simply to generate a wait state. there is no deeper meaning. ADDRESS_MAP_END +// map for JVS games w/o controls connected directly +static ADDRESS_MAP_START( s12h8rwjvsmap, AS_PROGRAM, 16, namcos12_state ) + AM_RANGE(0x000000, 0x07ffff) AM_ROM + AM_RANGE(0x080000, 0x08ffff) AM_RAM AM_SHARE("sharedram") + AM_RANGE(0x280000, 0x287fff) AM_DEVREADWRITE("c352", c352_device, read, write) + AM_RANGE(0x300000, 0x300001) AM_NOP + AM_RANGE(0x300002, 0x300003) AM_NOP + AM_RANGE(0x300010, 0x300011) AM_NOP // golgo13 writes here a lot, possibly also a wait state generator? + AM_RANGE(0x300030, 0x300031) AM_NOP // most S12 bioses write here simply to generate a wait state. there is no deeper meaning. +ADDRESS_MAP_END + READ16_MEMBER(namcos12_state::s12_mcu_p8_r) { return 0x02; @@ -1498,7 +1523,14 @@ WRITE16_MEMBER(namcos12_state::s12_mcu_portB_w) m_settings->ce_w((m_sub_portb & 0x20) && !(m_sub_porta & 1)); } +READ16_MEMBER(namcos12_state::s12_mcu_p6_r) +{ + // bit 1 = JVS cable present sense (1 = I/O board plugged in) + return (m_jvssense << 1) | 0xfd; +} + static ADDRESS_MAP_START( s12h8iomap, AS_IO, 16, namcos12_state ) + AM_RANGE(h8_device::PORT_6, h8_device::PORT_6) AM_READ(s12_mcu_p6_r) AM_RANGE(h8_device::PORT_7, h8_device::PORT_7) AM_READ_PORT("DSW") AM_RANGE(h8_device::PORT_8, h8_device::PORT_8) AM_READ(s12_mcu_p8_r) AM_WRITENOP AM_RANGE(h8_device::PORT_A, h8_device::PORT_A) AM_READWRITE(s12_mcu_pa_r, s12_mcu_pa_w) @@ -1509,7 +1541,6 @@ static ADDRESS_MAP_START( s12h8iomap, AS_IO, 16, namcos12_state ) AM_RANGE(h8_device::ADC_3, h8_device::ADC_3) AM_NOP ADDRESS_MAP_END - // Golgo 13 lightgun inputs READ16_MEMBER(namcos12_state::s12_mcu_gun_h_r) @@ -1619,6 +1650,92 @@ static MACHINE_CONFIG_DERIVED( golgo13, coh700 ) MCFG_CPU_IO_MAP(golgo13_h8iomap) MACHINE_CONFIG_END +#define JVSCLOCK (XTAL_14_7456MHz) +static ADDRESS_MAP_START( jvsmap, AS_PROGRAM, 16, namcos12_state ) + AM_RANGE(0x0000, 0x1fff) AM_ROM AM_REGION("iocpu", 0) + AM_RANGE(0xc000, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( jvsiomap, AS_IO, 16, namcos12_state ) +ADDRESS_MAP_END + + +static MACHINE_CONFIG_DERIVED( truckk, coh700 ) + // Timer at 115200*16 for the jvs serial clock + MCFG_DEVICE_MODIFY(":sub:sci0") + MCFG_H8_SCI_SET_EXTERNAL_CLOCK_PERIOD(attotime::from_hz(JVSCLOCK/8)) + + MCFG_CPU_ADD("iocpu", H83334, JVSCLOCK ) + MCFG_CPU_PROGRAM_MAP( jvsmap ) + MCFG_CPU_IO_MAP( jvsiomap ) + + MCFG_DEVICE_MODIFY("iocpu:sci0") + MCFG_H8_SCI_TX_CALLBACK(DEVWRITELINE(":sub:sci0", h8_sci_device, rx_w)) + MCFG_DEVICE_MODIFY("sub:sci0") + MCFG_H8_SCI_TX_CALLBACK(DEVWRITELINE(":iocpu:sci0", h8_sci_device, rx_w)) + + MCFG_QUANTUM_TIME(attotime::from_hz(2*115200)) +MACHINE_CONFIG_END + +READ16_MEMBER(namcos12_state::iob_p4_r) +{ + return m_tssio_port_4; +} + +WRITE16_MEMBER(namcos12_state::iob_p4_w) +{ + m_tssio_port_4 = data; + + // bit 2 = SENSE line back to main (0 = asserted, 1 = dropped) + m_jvssense = (data & 0x04) ? 0 : 1; +} + +READ16_MEMBER(namcos12_state::iob_p6_r) +{ + // d4 is service button + UINT8 sb = (ioport("SERVICE")->read() & 1) << 4; + // other bits: unknown + + return sb | 0; +} + +static ADDRESS_MAP_START( tdjvsmap, AS_PROGRAM, 16, namcos12_state ) + AM_RANGE(0x0000, 0x3fff) AM_ROM AM_REGION("iocpu", 0) + AM_RANGE(0x6000, 0x6001) AM_READ_PORT("IN01") + AM_RANGE(0x6002, 0x6003) AM_READ_PORT("IN23") + AM_RANGE(0xc000, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( tdjvsiomap, AS_IO, 16, namcos12_state ) + AM_RANGE(h8_device::PORT_4, h8_device::PORT_4) AM_READWRITE(iob_p4_r, iob_p4_w) + AM_RANGE(h8_device::PORT_6, h8_device::PORT_6) AM_READ(iob_p6_r) + AM_RANGE(h8_device::ADC_0, h8_device::ADC_0) AM_READ_PORT("STEER") + AM_RANGE(h8_device::ADC_1, h8_device::ADC_1) AM_READ_PORT("BRAKE") + AM_RANGE(h8_device::ADC_2, h8_device::ADC_2) AM_READ_PORT("GAS") +ADDRESS_MAP_END + +static MACHINE_CONFIG_DERIVED( technodr, coh700 ) + // Timer at 115200*16 for the jvs serial clock + MCFG_DEVICE_MODIFY(":sub:sci0") + MCFG_H8_SCI_SET_EXTERNAL_CLOCK_PERIOD(attotime::from_hz(JVSCLOCK/8)) + + // modify H8/3002 map to omit direct-connected controls + MCFG_CPU_MODIFY("sub") + MCFG_CPU_PROGRAM_MAP(s12h8rwjvsmap) + MCFG_CPU_IO_MAP(s12h8iomap) + + MCFG_CPU_ADD("iocpu", H83334, JVSCLOCK ) + MCFG_CPU_PROGRAM_MAP( tdjvsmap ) + MCFG_CPU_IO_MAP( tdjvsiomap ) + + MCFG_DEVICE_MODIFY("iocpu:sci0") + MCFG_H8_SCI_TX_CALLBACK(DEVWRITELINE(":sub:sci0", h8_sci_device, rx_w)) + MCFG_DEVICE_MODIFY("sub:sci0") + MCFG_H8_SCI_TX_CALLBACK(DEVWRITELINE(":iocpu:sci0", h8_sci_device, rx_w)) + + MCFG_QUANTUM_TIME(attotime::from_hz(2*115200)) +MACHINE_CONFIG_END + static INPUT_PORTS_START( namcos12 ) PORT_START("DSW") @@ -1745,6 +1862,38 @@ static INPUT_PORTS_START( golgo13 ) PORT_BIT( 0xffff, 0x00fe, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, -1.0, 0.0, 0) PORT_MINMAX(0x1f,0x1de) PORT_SENSITIVITY(100) PORT_KEYDELTA(15) PORT_PLAYER(1) PORT_REVERSE INPUT_PORTS_END +static INPUT_PORTS_START( technodr ) + PORT_START("DSW") + PORT_DIPNAME( 0x0080, 0x0080, DEF_STR(Service_Mode) ) PORT_DIPLOCATION( "DIP SW2:1" ) + PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0040, 0x0040, "Freeze" ) PORT_DIPLOCATION( "DIP SW2:2" ) + PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_BIT( 0xff3f, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("IN01") + PORT_SERVICE( 0x100, IP_ACTIVE_LOW ) // service switch + PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON1 ) // select switch + PORT_BIT( 0x7eff, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("IN23") + PORT_BIT(0x0800, IP_ACTIVE_LOW, IPT_COIN1 ) // coin switch + PORT_BIT(0xf7ff, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("SERVICE") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 ) // service coin + + PORT_START("GAS") + PORT_BIT( 0x3ff, 0x0200, IPT_PEDAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_NAME("Gas Pedal") + + PORT_START("BRAKE") + PORT_BIT( 0x3ff, 0x0200, IPT_PEDAL2 ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_NAME("Brake Pedal") + + PORT_START("STEER") + PORT_BIT( 0x3ff, 0x0200, IPT_PADDLE ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_NAME("Steering Wheel") +INPUT_PORTS_END + ROM_START( aquarush ) ROM_REGION32_LE( 0x00400000, "maincpu:rom", 0 ) /* main prg */ ROM_LOAD16_BYTE( "aq1vera.2l", 0x0000000, 0x200000, CRC(91eb9258) SHA1(30e225eb551bfe1bed6b342dd6d597345d64b677) ) @@ -2798,13 +2947,37 @@ ROM_START( truckk ) ROM_REGION( 0x1000000, "c352", 0 ) /* samples */ ROM_LOAD( "tkk1wave0.ic1", 0x000000, 0x800000, CRC(037d3095) SHA1(cc343bdd45d023c133964321e2df5cb1c91525ef) ) - ROM_REGION( 0x20000, "ioboard", 0) /* Truck K. I/O board */ + ROM_REGION( 0x20000, "iocpu", 0) /* Truck K. I/O board */ ROM_LOAD( "tkk1prg0.ic7", 0x000000, 0x020000, CRC(11fd9c31) SHA1(068b8364ec0eb1e88f9f85f40b8b322876f6f3e2) ) DISK_REGION( "cdrom" ) DISK_IMAGE( "tkk2-a", 0, SHA1(6b7c3686b22a508c44f67295b188504b757dd482) ) ROM_END +ROM_START( technodr ) + ROM_REGION32_LE( 0x00400000, "maincpu:rom", 0 ) /* main prg */ + ROM_LOAD16_BYTE( "th1verb.2l", 0x000000, 0x200000, CRC(736fae08) SHA1(099e648784f617cc3b5a57a5838b8fbb54cacca1) ) + ROM_LOAD16_BYTE( "th1verb.2p", 0x000001, 0x200000, CRC(1fafb2d2) SHA1(ea0617714dcd7636e21a10fa2665a6f9c0f0a93b) ) + + ROM_REGION32_LE( 0x3400000, "user2", 0 ) /* main data */ + ROM_LOAD16_BYTE( "th1rom0l.6", 0x0000000, 0x400000, CRC(f8274106) SHA1(5c0b60c7440cfa01572b10ed564446d7f1a81a3a) ) + ROM_LOAD16_BYTE( "th1rom0u.9", 0x0000001, 0x400000, CRC(260ae0c5) SHA1(2ecb82e069fa64b9d3f63d6193befae02f3140e4) ) + ROM_LOAD16_BYTE( "th1rom1l.7", 0x0800000, 0x400000, CRC(56d9b477) SHA1(101b5acfbe5d292418f7fd8db642187f2b571d0b) ) + ROM_LOAD16_BYTE( "th1rom1u.10", 0x0800001, 0x400000, CRC(a45d337e) SHA1(10e230b61ab4c6aa386c68463badef0c4ba58f0e) ) + ROM_LOAD16_BYTE( "th1fl3l.12", 0x1000000, 0x200000, CRC(cd4422c0) SHA1(97a9788cf0c589477f77c5403cc715ce4980a7bd) ) + ROM_LOAD16_BYTE( "th1fl3u.13", 0x1000001, 0x200000, CRC(c330116f) SHA1(b12de5a82d6ebb5f893882b578e02af732231512) ) + + ROM_REGION( 0x0080000, "sub", 0 ) /* sound prg */ + ROM_LOAD16_WORD_SWAP( "th1verb.11s", 0x000000, 0x080000, CRC(85806e2e) SHA1(9e0a7e6924b72e7b5b1d0e72eeec10045984dd4b) ) + + ROM_REGION( 0x1000000, "c352", 0 ) /* samples */ + ROM_LOAD( "th1wave0.5", 0x000000, 0x400000, CRC(6cdd06fb) SHA1(31bd0b359e3b93bd40c3416a4805d0523e7f54c3) ) + ROM_LOAD( "th1wave1.4", 0x400000, 0x400000, CRC(40fd413b) SHA1(b7edf89b5fa196a0787646c73b9aa07fc062fc8b) ) + + ROM_REGION( 0x40000, "iocpu", 0) /* Truck K. I/O board */ + ROM_LOAD( "th1io-a.4f", 0x000000, 0x040000, CRC(1cbbce27) SHA1(71d61d9218543e1b0b2a6c550a8ff2b7c6267257) ) +ROM_END + GAME( 1996, tekken3, 0, coh700, namcos12, namcos12_state, namcos12, ROT0, "Namco", "Tekken 3 (Japan, TET1/VER.E1)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) /* KC006 */ GAME( 1996, tekken3ae, tekken3, coh700, namcos12, namcos12_state, namcos12, ROT0, "Namco", "Tekken 3 (Asia, TET2/VER.E1)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) /* KC006 */ GAME( 1996, tekken3ud, tekken3, coh700, namcos12, namcos12_state, namcos12, ROT0, "Namco", "Tekken 3 (US, TET3/VER.D)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) /* KC006 */ @@ -2827,6 +3000,7 @@ GAME( 1998, ehrgeizaa, ehrgeiz, coh700, namcos12, namcos12_state, namcos12, R GAME( 1998, ehrgeizja, ehrgeiz, coh700, namcos12, namcos12_state, namcos12, ROT0, "Square / Namco", "Ehrgeiz (Japan, EG1/VER.A)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) /* KC021 */ GAME( 1998, mdhorse, 0, coh700, namcos12, namcos12_state, namcos12, ROT0, "MOSS / Namco", "Derby Quiz My Dream Horse (Japan, MDH1/VER.A2)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) /* KC035 */ GAME( 1998, sws98, 0, coh700, namcos12, namcos12_state, namcos12, ROT0, "Namco", "Super World Stadium '98 (Japan, SS81/VER.A)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) /* KC0?? */ +GAME( 1998, technodr, 0, technodr, technodr, namcos12_state, namcos12, ROT0, "Namco", "Techno Drive (Japan, TD2/VER.B)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) /* KC056 */ GAME( 1998, tenkomor, 0, coh700, namcos12, namcos12_state, namcos12, ROT90,"Namco", "Tenkomori Shooting (Asia, TKM2/VER.A1)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) /* KC036 */ GAME( 1998, tenkomorja,tenkomor, coh700, namcos12, namcos12_state, namcos12, ROT90,"Namco", "Tenkomori Shooting (Japan, TKM1/VER.A1)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) /* KC036 */ GAME( 1998, fgtlayer, 0, coh700, namcos12, namcos12_state, namcos12, ROT0, "Arika / Namco", "Fighting Layer (Japan, FTL1/VER.A)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) /* KC037 */ @@ -2852,6 +3026,6 @@ GAME( 1999, aquarush, 0, coh700, namcos12, namcos12_state, namcos12, R GAME( 1999, golgo13, 0, golgo13, golgo13, namcos12_state, namcos12, ROT0, "Eighting / Raizing / Namco", "Golgo 13 (Japan, GLG1/VER.A)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) /* KC054 */ GAME( 1999, g13knd, 0, golgo13, golgo13, namcos12_state, namcos12, ROT0, "Eighting / Raizing / Namco", "Golgo 13 Kiseki no Dandou (Japan, GLS1/VER.A)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) /* KC059 */ GAME( 2000, sws2000, 0, coh700, namcos12, namcos12_state, namcos12, ROT0, "Namco", "Super World Stadium 2000 (Japan, SS01/VER.A)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) /* KC055 */ -GAME( 2000, truckk, 0, coh700, namcos12, namcos12_state, namcos12, ROT0, "Metro / Namco", "Truck Kyosokyoku (Japan, TKK2/VER.A)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) /* KC056 */ +GAME( 2000, truckk, 0, truckk, namcos12, namcos12_state, namcos12, ROT0, "Metro / Namco", "Truck Kyosokyoku (Japan, TKK2/VER.A)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) /* KC056 */ GAME( 2000, kartduel, 0, coh700, namcos12, namcos12_state, namcos12, ROT0, "Namco", "Kart Duel (Japan, KTD1/VER.A)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) /* KC057 */ GAME( 2001, sws2001, sws2000, coh700, namcos12, namcos12_state, namcos12, ROT0, "Namco", "Super World Stadium 2001 (Japan, SS11/VER.A)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) /* KC061 */ diff --git a/src/mame/drivers/naomi.c b/src/mame/drivers/naomi.c index 1fa7b27fd20..e783d9f8fe5 100644 --- a/src/mame/drivers/naomi.c +++ b/src/mame/drivers/naomi.c @@ -1000,9 +1000,9 @@ Notes: (most info taken from poor quality pics/scans, better info is needed) |LED CN4 IC4 | |--------------------| Notes: - This is the I/O board used for Dynamic Golf which is - located under the panel. It's also used for spinner - controls such as those used on Outtrigger. + This is the I/O board used in Dynamic Golf, Out Trigger, Shootout Pool, + Shootout Pool Prize, Kick'4'Cash, Crackin' DJ 1&2 + for the trackballs and other rotary type game controls. It must be daisy-chained to the normal I/O board with a USB cable. CN1 - 24 pin connector (not used on Dynamic Golf, other use unknown) @@ -1027,7 +1027,7 @@ Sega's I/O board has: - analog input - USB input (connect to NAOMI motherboard) - USB output (not used) -- shrinked D-sub 15pin connector (connect JVS video output, the signal is routed to JAMMA connector, signal is amplified to 3Vp-p and H/V sync signal is mixed (composite)) +- D-sub 15pin VGA-compatible connector (connect JVS video output, the signal is routed to JAMMA connector, signal is amplified to 3Vp-p and H/V sync signal is mixed (composite)) - external I/O connector (JST 12pin) - switch to select function of external I/O connector (extra button input or 7-seg LED(x2) output of total wins for 'Versus City' cabinet) - spare audio input (the signal goes to JAMMA speaker output) @@ -1397,8 +1397,8 @@ Notes: Development ROM board: -few unreleased and many prototype game versions known to exist on this ROM board, -currently only Rumble Fish 2 prototype dumped +There are a few unreleased and many prototype game versions known to exist on this ROM board. +Currently only Rumble Fish 2 prototype is dumped. PC BD SYSTEMX 3MODE FLASH Rev.B 1111-00001402 @@ -5091,6 +5091,9 @@ ROM_START( otrigger ) NAOMI_BIOS NAOMI_DEFAULT_EEPROM + ROM_REGION( 0x10000, "io_board", 0) + ROM_LOAD("epr-22084.ic3", 0x0000, 0x10000, CRC(18cf58bb) SHA1(1494f8215231929e41bbe2a133658d01882fbb0f) ) + ROM_REGION( 0xa000000, "rom_board", ROMREGION_ERASEFF) ROM_LOAD("epr-22163.ic22", 0x0000000, 0x0400000, CRC(3bdafb6a) SHA1(c4c5a4ba94d85c4353df22d70bb08be67e9c22c3) ) ROM_LOAD("mpr-22142.ic1", 0x0800000, 0x0800000, CRC(5b45fa35) SHA1(7d3fbecc6f0dce2b13bfb21ed68f44632b91b94b) ) @@ -7507,39 +7510,11 @@ ROM_START( monkeyba ) ROM_LOAD("317-0307-com.pic", 0x00, 0x4000, CRC(4046de19) SHA1(8adda9f223e926148b36744bbbaa89557544a229) ) ROM_END -/* -This is the I/O board used for Dynamic Golf which is -located under the panel. -It must be connected to the normal I/O board with a USB cable. - -PCB Layout ----------- - -837-13938 -|--------------------| -|CN2 CN1 | -| | -| |-----| | -| | IC2 | | -| CN3 | | | -| |-----| IC3| -|LED CN4 IC4 | -|--------------------| -Notes: - CN1 - 24 pin connector. not used - CN2 - 4 pin connector used for 5 volt power input - CN3 - USB connector type B - CN4 - 16 pin connector used for buttons and trackball - IC1 - HC240 logic IC (SOIC20) - IC2 - Sega 315-6146 custom IC (QFP176) - IC3 - 27C512 EPROM with label 'EPR-22084' (DIP28) - IC4 - HC4020 logic IC (SOIC16) -*/ - ROM_START( dygolf ) NAOMIGD_BIOS NAOMI_DEFAULT_EEPROM + // 837-13938 JVS I/O ROM_REGION( 0x10000, "io_board", 0) ROM_LOAD("epr-22084.ic3", 0x0000, 0x10000, CRC(18cf58bb) SHA1(1494f8215231929e41bbe2a133658d01882fbb0f) ) diff --git a/src/mame/drivers/nmg5.c b/src/mame/drivers/nmg5.c index a2b94f43256..20950ae9419 100644 --- a/src/mame/drivers/nmg5.c +++ b/src/mame/drivers/nmg5.c @@ -252,7 +252,6 @@ public: required_shared_ptr<UINT16> m_fg_videoram; required_shared_ptr<UINT16> m_bitmap; optional_device<decospr_device> m_sprgen; -// UINT16 * m_paletteram; // currently this uses generic palette handling /* video-related */ tilemap_t *m_bg_tilemap; diff --git a/src/mame/drivers/norautp.c b/src/mame/drivers/norautp.c index d5f7b24a519..6fd284e7cde 100644 --- a/src/mame/drivers/norautp.c +++ b/src/mame/drivers/norautp.c @@ -3436,7 +3436,6 @@ ROM_END */ -/* ROM_START( pkii_dm ) ROM_REGION( 0x10000, "maincpu", 0 ) // no stack, call's RET go to PC=0 ROM_LOAD( "12.u12", 0x0000, 0x1000, CRC(048e70d8) SHA1(f0eb16ba68455638de2ce68f51f305a13d0df287) ) @@ -3449,7 +3448,6 @@ ROM_START( pkii_dm ) ROM_REGION( 0x0200, "proms", 0 ) ROM_LOAD( "63s141n.u51", 0x0000, 0x0100, CRC(88302127) SHA1(aed1273974917673405f1234ab64e6f8b3856c34) ) ROM_END -*/ /************************** @@ -3644,5 +3642,4 @@ GAME( 1993, tpoker2, 0, dphltest, norautp, driver_device, 0, ROT0, "M GAME( 198?, fastdrwp, 0, dphl, norautp, driver_device, 0, ROT0, "Stern Electronics?", "Fast Draw (poker conversion kit)?", MACHINE_NOT_WORKING ) GAME( 198?, dphlunka, 0, dphl, norautp, driver_device, 0, ROT0, "SMS Manufacturing Corp.", "Draw Poker HI-LO (unknown, rev 1)", MACHINE_NOT_WORKING ) GAME( 198?, dphlunkb, 0, dphl, norautp, driver_device, 0, ROT0, "SMS Manufacturing Corp.", "Draw Poker HI-LO (unknown, rev 2)", MACHINE_NOT_WORKING ) - -//GAME( 198?, pkii_dm, 0, nortest1, norautp, driver_device, 0, ROT0, "<unknown>", "Unknown Poker PKII/DM", MACHINE_NOT_WORKING ) +GAME( 198?, pkii_dm, 0, nortest1, norautp, driver_device, 0, ROT0, "<unknown>", "Unknown Poker PKII/DM", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/nova2001.c b/src/mame/drivers/nova2001.c index 61c7cf8df5b..8f10665d9d0 100644 --- a/src/mame/drivers/nova2001.c +++ b/src/mame/drivers/nova2001.c @@ -647,8 +647,8 @@ static MACHINE_CONFIG_START( nova2001, nova2001_state ) MCFG_SCREEN_PALETTE("palette") MCFG_GFXDECODE_ADD("gfxdecode", "palette", nova2001) - MCFG_PALETTE_ADD("palette", 0x200) - MCFG_PALETTE_FORMAT(BBGGRRII) + MCFG_PALETTE_ADD("palette", 512) + MCFG_PALETTE_FORMAT_CLASS(1, nova2001_state, BBGGRRII) MCFG_PALETTE_INIT_OWNER(nova2001_state,nova2001) MCFG_VIDEO_START_OVERRIDE(nova2001_state,nova2001) @@ -692,8 +692,8 @@ static MACHINE_CONFIG_START( ninjakun, nova2001_state ) MCFG_SCREEN_PALETTE("palette") MCFG_GFXDECODE_ADD("gfxdecode", "palette", ninjakun) - MCFG_PALETTE_ADD("palette", 0x300) - MCFG_PALETTE_FORMAT(BBGGRRII) + MCFG_PALETTE_ADD("palette", 768) + MCFG_PALETTE_FORMAT_CLASS(1, nova2001_state, BBGGRRII) MCFG_VIDEO_START_OVERRIDE(nova2001_state,ninjakun) @@ -728,8 +728,8 @@ static MACHINE_CONFIG_START( pkunwar, nova2001_state ) MCFG_SCREEN_PALETTE("palette") MCFG_GFXDECODE_ADD("gfxdecode", "palette", pkunwar) - MCFG_PALETTE_ADD("palette", 0x200) - MCFG_PALETTE_FORMAT(BBGGRRII) + MCFG_PALETTE_ADD("palette", 512) + MCFG_PALETTE_FORMAT_CLASS(1, nova2001_state, BBGGRRII) MCFG_PALETTE_INIT_OWNER(nova2001_state,nova2001) MCFG_VIDEO_START_OVERRIDE(nova2001_state,pkunwar) @@ -771,8 +771,8 @@ static MACHINE_CONFIG_START( raiders5, nova2001_state ) MCFG_SCREEN_PALETTE("palette") MCFG_GFXDECODE_ADD("gfxdecode", "palette", raiders5) - MCFG_PALETTE_ADD("palette", 0x300) - MCFG_PALETTE_FORMAT(BBGGRRII) + MCFG_PALETTE_ADD("palette", 768) + MCFG_PALETTE_FORMAT_CLASS(1, nova2001_state, BBGGRRII) MCFG_VIDEO_START_OVERRIDE(nova2001_state,raiders5) diff --git a/src/mame/drivers/olibochu.c b/src/mame/drivers/olibochu.c index d7e6420266a..a06d9b71154 100644 --- a/src/mame/drivers/olibochu.c +++ b/src/mame/drivers/olibochu.c @@ -75,7 +75,6 @@ public: required_shared_ptr<UINT8> m_colorram; required_shared_ptr<UINT8> m_spriteram; required_shared_ptr<UINT8> m_spriteram2; -// UINT8 * m_paletteram; // currently this uses generic palette handling /* video-related */ tilemap_t *m_bg_tilemap; diff --git a/src/mame/drivers/pacman.c b/src/mame/drivers/pacman.c index d0d5823a690..48bfdb7b2e9 100644 --- a/src/mame/drivers/pacman.c +++ b/src/mame/drivers/pacman.c @@ -5079,15 +5079,23 @@ ROM_END ROM_START( crushrlf ) ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "pin1cc_6e.bin", 0x0400, 0x0400, CRC(65e469cf) SHA1(baeb5ba0ca0d78bca07f7830269f9c079f36d425) ) ROM_CONTINUE(0x0000,0x0400) - ROM_LOAD( "pin2cc_6f.bin", 0x0800, 0x0800, CRC(653f726d) SHA1(3121315cf3e8be86d29687f29fc514e29dc64a02) ) - ROM_LOAD( "pin3cc_6h.bin", 0x1000, 0x0800, CRC(55e15863) SHA1(bcbf4e5a268739c906e5c400e639e0e055799d47) ) - ROM_LOAD( "pin4cc_6j.bin", 0x1800, 0x0800, CRC(4fc4b582) SHA1(cb73b5f9171ba493afdfced0baeef9bb6bdb428d) ) - ROM_LOAD( "pin5cc_6k.bin", 0x2000, 0x0800, CRC(15f0415b) SHA1(90c663387a81ad206874a531d9fe631ac0175975) ) - ROM_LOAD( "pin6cc_6m.bin", 0x2800, 0x0800, CRC(4536ea5b) SHA1(6e0b22dd05a76644b13f1c71f771d686cd411eea) ) - ROM_LOAD( "pin7cc_6n.bin", 0x3000, 0x0800, CRC(409111ec) SHA1(ba98cfc1cce8627d11fda4954c3776d0b90cb584) ) - ROM_LOAD( "pin8cc_6p.bin", 0x3800, 0x0800, CRC(0d97a047) SHA1(d0024a87a7530246bfbef7d1603b599e2f168973) ) + ROM_LOAD( "pin5cc_6k.bin", 0x0c00, 0x0400, CRC(15f0415b) SHA1(90c663387a81ad206874a531d9fe631ac0175975) ) + ROM_CONTINUE(0x0800,0x0400) + ROM_LOAD( "pin2cc_6f.bin", 0x1400, 0x0400, CRC(653f726d) SHA1(3121315cf3e8be86d29687f29fc514e29dc64a02) ) + ROM_CONTINUE(0x1000,0x400) + ROM_LOAD( "pin6cc_6m.bin", 0x1c00, 0x0400, CRC(4536ea5b) SHA1(6e0b22dd05a76644b13f1c71f771d686cd411eea) ) + ROM_CONTINUE(0x1800,0x400) + ROM_LOAD( "pin3cc_6h.bin", 0x2400, 0x0400, CRC(55e15863) SHA1(bcbf4e5a268739c906e5c400e639e0e055799d47) ) + ROM_CONTINUE(0x2000,0x400) + ROM_LOAD( "pin7cc_6n.bin", 0x2c00, 0x0400, CRC(409111ec) SHA1(ba98cfc1cce8627d11fda4954c3776d0b90cb584) ) + ROM_CONTINUE(0x2800,0x400) + ROM_LOAD( "pin4cc_6j.bin", 0x3400, 0x0400, CRC(4fc4b582) SHA1(cb73b5f9171ba493afdfced0baeef9bb6bdb428d) ) + ROM_CONTINUE(0x3000,0x400) + ROM_LOAD( "pin8cc_6p.bin", 0x3c00, 0x0400, CRC(0d97a047) SHA1(d0024a87a7530246bfbef7d1603b599e2f168973) ) + ROM_CONTINUE(0x3800,0x400) ROM_REGION( 0x2000, "gfx1", 0 ) ROM_LOAD( "pin9cc_5e.bin", 0x0000, 0x0800, CRC(b6551507) SHA1(a544e6afda0dd1bea526cb94b9c456d923054698)) @@ -6905,7 +6913,7 @@ GAME( 1981, crush4, crush, crush4, crush4, driver_device, 0, ROT GAME( 1981, maketrax, crush, pacmanp, maketrax, pacman_state, maketrax, ROT270, "Alpha Denshi Co. / Kural (Williams license)", "Make Trax (US set 1)", MACHINE_SUPPORTS_SAVE ) GAME( 1981, maketrxb, crush, pacmanp, maketrax, pacman_state, maketrax, ROT270, "Alpha Denshi Co. / Kural (Williams license)", "Make Trax (US set 2)", MACHINE_SUPPORTS_SAVE ) GAME( 1981, korosuke, crush, pacmanp, korosuke, pacman_state, korosuke, ROT90, "Alpha Denshi Co. / Kural Electric, Ltd.", "Korosuke Roller (Japan)", MACHINE_SUPPORTS_SAVE ) -GAME( 1981, crushrlf, crush, pacman, maketrax, driver_device, 0, ROT90, "bootleg", "Crush Roller (Famaresa PCB)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING) // has some encryption or protection +GAME( 1981, crushrlf, crush, pacman, maketrax, driver_device, 0, ROT90, "bootleg", "Crush Roller (Famaresa PCB)", MACHINE_SUPPORTS_SAVE ) GAME( 1981, crushbl, crush, pacman, maketrax, driver_device, 0, ROT90, "bootleg", "Crush Roller (bootleg set 1)", MACHINE_SUPPORTS_SAVE ) GAME( 1981, crushbl2, crush, pacmanp, mbrush, pacman_state, maketrax, ROT90, "bootleg", "Crush Roller (bootleg set 2)", MACHINE_SUPPORTS_SAVE ) GAME( 1981, crushbl3, crush, pacmanp, mbrush, pacman_state, maketrax, ROT90, "bootleg", "Crush Roller (bootleg set 3)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/peplus.c b/src/mame/drivers/peplus.c index e8ff2305de0..f19b6ac1661 100644 --- a/src/mame/drivers/peplus.c +++ b/src/mame/drivers/peplus.c @@ -4580,7 +4580,31 @@ PayTable 2P 3K STR FL FH 4K SF RF 5K RF (Bonus) Programs Available: PP0550, X000550P */ ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "pp0585_a6k-a9g.u68", 0x00000, 0x10000, CRC(1de4ee32) SHA1(0e06a43e7e3988cc2fddd1a57af724f5421d2ca4) ) /* Game Version: A6K, Library Version: A9G */ + ROM_LOAD( "pp0550_a6k-a9g.u68", 0x00000, 0x10000, CRC(1de4ee32) SHA1(0e06a43e7e3988cc2fddd1a57af724f5421d2ca4) ) /* Game Version: A6K, Library Version: A9G */ + + ROM_REGION( 0x020000, "gfx1", 0 ) + ROM_LOAD( "mro-cg2004.u72", 0x00000, 0x8000, CRC(e5e40ea5) SHA1(e0d9e50b30cc0c25c932b2bf444990df1fb2c38c) ) /* 08/31/94 @ IGT L95-0146 */ + ROM_LOAD( "mgo-cg2004.u73", 0x08000, 0x8000, CRC(12607f1e) SHA1(248e1ecee4e735f5943c50f8c350ca95b81509a7) ) + ROM_LOAD( "mbo-cg2004.u74", 0x10000, 0x8000, CRC(78c3fb9f) SHA1(2b9847c511888de507a008dec981778ca4dbcd6c) ) /* Supersedes CG740 */ + ROM_LOAD( "mxo-cg2004.u75", 0x18000, 0x8000, CRC(5aaa4480) SHA1(353c4ce566c944406fce21f2c5045c856ef7a609) ) + + ROM_REGION( 0x100, "proms", 0 ) + ROM_LOAD( "cap904.u50", 0x0000, 0x0100, CRC(0eec8336) SHA1(a6585c978dbc2f4f3818e3a5b92f8c28be23c4c0) ) /* BPROM type N82S135N verified */ +ROM_END + +ROM_START( pepp0555 ) /* Normal board : Standard Draw Poker (PP0555) */ +/* +PayTable Js+ 2PR 3K STR FL FH 4K SF RF (Bonus) +--------------------------------------------------------- + CA 1 2 3 4 6 9 25 50 250 800 + % Range: 95.5-97.5% Optimum: 99.5% Hit Frequency: 45.5% + Programs Available: PP0132, PP0447, PP0555, X000447P + +Internally the program reports a 99.40% return. + +*/ + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "pp0555_966-991.u68", 0x00000, 0x10000, CRC(d3e125d3) SHA1(035141511bf19eeb4d0012f456a9f75140e6c308) ) /* Game Version: 966, Library Version: 991 */ ROM_REGION( 0x020000, "gfx1", 0 ) ROM_LOAD( "mro-cg2004.u72", 0x00000, 0x8000, CRC(e5e40ea5) SHA1(e0d9e50b30cc0c25c932b2bf444990df1fb2c38c) ) /* 08/31/94 @ IGT L95-0146 */ @@ -5546,6 +5570,20 @@ ROM_END ROM_START( peke1012 ) /* Normal board : Keno 1-10 Spot (KE1012) - Payout 90.27%, Paytable 90-P */ ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "ke1012_582-a77.u68", 0x00000, 0x10000, CRC(87f696ba) SHA1(de6cc7ff799218ae6fb75521243534484ef4b9a8) ) /* Game Version: 582, Library Version: A77 */ + + ROM_REGION( 0x020000, "gfx1", 0 ) + ROM_LOAD( "mro-cg1267.u72", 0x00000, 0x8000, CRC(16498b57) SHA1(9c22726299af7204c4be1c6d8afc4c1b512ad918) ) + ROM_LOAD( "mgo-cg1267.u73", 0x08000, 0x8000, CRC(80847c5a) SHA1(8422cd13a91c3c462af5efcfca8615e7eeaa2e52) ) + ROM_LOAD( "mbo-cg1267.u74", 0x10000, 0x8000, CRC(ce7af8a7) SHA1(38675122c764b8fa9260246ea99ac0f0750da277) ) + ROM_LOAD( "mxo-cg1267.u75", 0x18000, 0x8000, CRC(a4394303) SHA1(30a07028de35f74cc4fb776b0505ca743c8d7b5b) ) + + ROM_REGION( 0x100, "proms", 0 ) + ROM_LOAD( "cap1267.u50", 0x0000, 0x0100, CRC(7051db57) SHA1(76751a3cc47d506983205decb07e99ca0c178a42) ) +ROM_END + +ROM_START( peke1012a ) /* Normal board : Keno 1-10 Spot (KE1012) - Payout 90.27%, Paytable 90-P */ + ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "ke1012_576-a3u.u68", 0x00000, 0x10000, CRC(470e8c10) SHA1(f8a65a3a73477e9e9d2f582eeefa93b470497dfa) ) /* Game Version: 576, Library Version: A3U */ ROM_REGION( 0x020000, "gfx1", 0 ) @@ -10573,6 +10611,7 @@ GAMEL(1987, pepp0540, pepp0514, peplus, peplus_poker, peplus_state, peplus, GAMEL(1987, pepp0542, 0, peplus, peplus_poker, peplus_state, peplus, ROT0, "IGT - International Game Technology", "Player's Edge Plus (PP0542) One Eyed Jacks Wild Poker (CG2243)", 0, layout_pe_poker ) GAMEL(1987, pepp0542a, pepp0542, peplus, peplus_poker, peplus_state, peplus, ROT0, "IGT - International Game Technology", "Player's Edge Plus (PP0542) One Eyed Jacks Wild Poker (CG2020)", 0, layout_pe_poker ) GAMEL(1987, pepp0550, pepp0053, peplus, peplus_poker, peplus_state, peplus, ROT0, "IGT - International Game Technology", "Player's Edge Plus (PP0550) Joker Poker (Two Pair or Better)", 0, layout_pe_poker ) +GAMEL(1987, pepp0555, pepp0002, peplus, peplus_poker, peplus_state, peplus, ROT0, "IGT - International Game Technology", "Player's Edge Plus (PP0555) Standard Draw Poker", 0, layout_pe_poker ) GAMEL(1987, pepp0568, pepp0053, peplus, peplus_poker, peplus_state, peplus, ROT0, "IGT - International Game Technology", "Player's Edge Plus (PP0568) Joker Poker", 0, layout_pe_poker ) GAMEL(1987, pepp0585, pepp0002, peplus, peplus_poker, peplus_state, peplus, ROT0, "IGT - International Game Technology", "Player's Edge Plus (PP0585) Standard Draw Poker", 0, layout_pe_poker ) GAMEL(1987, pepp0713, pepp0434, peplus, peplus_poker, peplus_state, peplus, ROT0, "IGT - International Game Technology", "Player's Edge Plus (PP0713) Bonus Poker Deluxe", 0, layout_pe_poker ) @@ -10621,7 +10660,8 @@ GAMEL(1994, pebe0014a, pebe0014, peplus, peplus_bjack, peplus_state, peplus, /* Normal board : Keno */ GAMEL(1994, peke0017, 0, peplus, peplus_keno, peplus_state, nonplus, ROT0, "IGT - International Game Technology", "Player's Edge Plus (KE0017) Keno", MACHINE_NOT_WORKING, layout_pe_keno ) -GAMEL(1994, peke1012, 0, peplus, peplus_keno, peplus_state, peplus, ROT0, "IGT - International Game Technology", "Player's Edge Plus (KE1012) Keno", 0, layout_pe_keno ) +GAMEL(1994, peke1012, 0, peplus, peplus_keno, peplus_state, peplus, ROT0, "IGT - International Game Technology", "Player's Edge Plus (KE1012) Keno (set 1)", 0, layout_pe_keno ) +GAMEL(1994, peke1012a, peke1012, peplus, peplus_keno, peplus_state, peplus, ROT0, "IGT - International Game Technology", "Player's Edge Plus (KE1012) Keno (set 2)", 0, layout_pe_keno ) GAMEL(1994, peke1013, peke1012, peplus, peplus_keno, peplus_state, peplus, ROT0, "IGT - International Game Technology", "Player's Edge Plus (KE1013) Keno", 0, layout_pe_keno ) /* Normal board : Slots machine */ diff --git a/src/mame/drivers/pinball2k.c b/src/mame/drivers/pinball2k.c index 121fac46712..37666de9a8c 100644 --- a/src/mame/drivers/pinball2k.c +++ b/src/mame/drivers/pinball2k.c @@ -199,7 +199,7 @@ void pinball2k_state::draw_framebuffer(bitmap_rgb32 &bitmap, const rectangle &cl m_frame_height = height; visarea.set(0, width - 1, 0, height - 1); - m_screen->configure(width, height * 262 / 240, visarea, m_screen->frame_period().attoseconds); + m_screen->configure(width, height * 262 / 240, visarea, m_screen->frame_period().attoseconds()); } if (m_disp_ctrl_reg[DC_OUTPUT_CFG] & 0x1) // 8-bit mode diff --git a/src/mame/drivers/plygonet.c b/src/mame/drivers/plygonet.c index a6443c9e994..a2e66a140bc 100644 --- a/src/mame/drivers/plygonet.c +++ b/src/mame/drivers/plygonet.c @@ -290,20 +290,6 @@ READ32_MEMBER(polygonet_state::network_r) } -WRITE32_MEMBER(polygonet_state::plygonet_palette_w) -{ - int r,g,b; - - COMBINE_DATA(&m_generic_paletteram_32[offset]); - - r = (m_generic_paletteram_32[offset] >>16) & 0xff; - g = (m_generic_paletteram_32[offset] >> 8) & 0xff; - b = (m_generic_paletteram_32[offset] >> 0) & 0xff; - - m_palette->set_pen_color(offset,rgb_t(r,g,b)); -} - - /**********************************************************************************/ /******* DSP56k maps *******/ /**********************************************************************************/ @@ -479,7 +465,7 @@ WRITE16_MEMBER(polygonet_state::dsp56k_ram_bank04_write) static ADDRESS_MAP_START( main_map, AS_PROGRAM, 32, polygonet_state ) AM_RANGE(0x000000, 0x1fffff) AM_ROM - AM_RANGE(0x200000, 0x21ffff) AM_RAM_WRITE(plygonet_palette_w) AM_SHARE("paletteram") + AM_RANGE(0x200000, 0x21ffff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0x400000, 0x40001f) AM_DEVREADWRITE16("k053936", k053936_device, ctrl_r, ctrl_w, 0xffffffff) AM_RANGE(0x440000, 0x440fff) AM_READWRITE(polygonet_roz_ram_r, polygonet_roz_ram_w) AM_RANGE(0x480000, 0x480003) AM_READ8(polygonet_inputs_r, 0xffffffff) @@ -644,6 +630,7 @@ static MACHINE_CONFIG_START( plygonet, polygonet_state ) MCFG_SCREEN_PALETTE("palette") MCFG_PALETTE_ADD("palette", 32768) + MCFG_PALETTE_FORMAT(XRGB) MCFG_DEVICE_ADD("k053936", K053936, 0) diff --git a/src/mame/drivers/psikyosh.c b/src/mame/drivers/psikyosh.c index e3dd1534f18..ef28a63b065 100644 --- a/src/mame/drivers/psikyosh.c +++ b/src/mame/drivers/psikyosh.c @@ -541,7 +541,7 @@ static INPUT_PORTS_START( common ) PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_SERVICE_NO_TOGGLE( 0x00000020, IP_ACTIVE_LOW ) - PORT_DIPNAME( 0x00000040, 0x00000040, "Debug" ) /* Debug stuff. Resets EEPROM? */ + PORT_DIPNAME( 0x00000040, 0x00000040, "Tilt (Enables Debug Mode)" ) /* Debug stuff. Resets EEPROM? */ PORT_DIPSETTING( 0x00000040, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) PORT_BIT( 0x00000080, IP_ACTIVE_LOW, IPT_UNKNOWN ) @@ -654,13 +654,9 @@ static INPUT_PORTS_START( s1945iii ) /* Different Region again */ PORT_BIT( 0x10000000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_93cxx_device, do_read) INPUT_PORTS_END -static INPUT_PORTS_START( dragnblz ) /* Security requires bit high */ +static INPUT_PORTS_START( dragnblz ) PORT_INCLUDE( common ) - - PORT_MODIFY("INPUTS") - PORT_DIPNAME( 0x00000040, 0x00000000, "Debug" ) /* Must be HIGH (Or Security Error), so can perform test */ - PORT_DIPSETTING( 0x00000040, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) + /* If Debug is LOW then you can perform rom test and EEPROM security check is skipped, EEPROM doesn't reset */ PORT_START("JP4") /* jumper pads on the PCB */ PORT_DIPNAME( 0x03000000, 0x01000000, DEF_STR( Region ) ) @@ -710,7 +706,7 @@ static INPUT_PORTS_START( mjgtaste ) PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_SERVICE_NO_TOGGLE( 0x00000020, IP_ACTIVE_LOW ) - PORT_DIPNAME( 0x00000040, 0x00000040, "Debug" ) /* Debug stuff. Resets EEPROM? */ + PORT_DIPNAME( 0x00000040, 0x00000040, "Tilt (Enables Debug Mode)" ) /* Debug stuff. Resets EEPROM? */ PORT_DIPSETTING( 0x00000040, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) @@ -1022,7 +1018,7 @@ ROM_START( dragnblz ) ROM_LOAD( "snd0.u52", 0x000000, 0x200000, CRC(7fd1b225) SHA1(6aa61021ada51393bbb34fd1aea00b8feccc8197) ) ROM_REGION( 0x100, "eeprom", 0 ) - ROM_LOAD( "eeprom-dragnblz.bin", 0x0000, 0x0100, CRC(70a8a3a6) SHA1(80ded1fce090b87b8c8b56f4fb74ef4e751b51d2) ) + ROM_LOAD16_WORD_SWAP( "eeprom-dragnblz.u44", 0x0000, 0x0100, CRC(46e85da9) SHA1(673cf974fd23a20e6bfa7b2b234206d550011f54) ) ROM_END /* @@ -1098,7 +1094,7 @@ ROM_START( mjgtaste ) ROM_LOAD( "snd0.u52", 0x000000, 0x400000, CRC(0179f018) SHA1(16ae63e021230356777342ed902e02407a1a1b82) ) ROM_REGION( 0x100, "eeprom", 0 ) - ROM_LOAD( "eeprom-mjgtaste.bin", 0x0000, 0x0100, CRC(bbf7cfae) SHA1(34a36d5c4d273fc2a081a8f4062b45ee873eef09) ) + ROM_LOAD16_WORD_SWAP( "eeprom-mjgtaste.u44", 0x0000, 0x0100, CRC(d35586f2) SHA1(ce26a82d760f87dccfc15468ac3d24efc258648d) ) ROM_END ROM_START( tgm2 ) diff --git a/src/mame/drivers/pzletime.c b/src/mame/drivers/pzletime.c index 543999840f9..72d5e3ac1ed 100644 --- a/src/mame/drivers/pzletime.c +++ b/src/mame/drivers/pzletime.c @@ -46,7 +46,6 @@ public: required_shared_ptr<UINT16> m_mid_videoram; required_shared_ptr<UINT16> m_txt_videoram; required_shared_ptr<UINT16> m_spriteram; -// UINT16 * m_paletteram; // currently this uses generic palette handling /* video-related */ tilemap_t *m_mid_tilemap; diff --git a/src/mame/drivers/rockrage.c b/src/mame/drivers/rockrage.c index 0ce316b0c58..49d255e190d 100644 --- a/src/mame/drivers/rockrage.c +++ b/src/mame/drivers/rockrage.c @@ -234,8 +234,6 @@ void rockrage_state::machine_start() void rockrage_state::machine_reset() { m_vreg = 0; - m_layer_colorbase[0] = 0x00; - m_layer_colorbase[1] = 0x10; } static MACHINE_CONFIG_START( rockrage, rockrage_state ) diff --git a/src/mame/drivers/sangho.c b/src/mame/drivers/sangho.c index b4f92abb09b..863194c7dc8 100644 --- a/src/mame/drivers/sangho.c +++ b/src/mame/drivers/sangho.c @@ -456,7 +456,7 @@ static MACHINE_CONFIG_START( pzlestar, sangho_state ) MCFG_CPU_IO_MAP(pzlestar_io_map) MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", sangho_state, sangho_interrupt, "screen", 0, 1) - MCFG_V9958_ADD("v9958", "screen", 0x20000) + MCFG_V9958_ADD("v9958", "screen", 0x20000, XTAL_21_4772MHz) // typical 9958 clock, not verified MCFG_V99X8_INTERRUPT_CALLBACK(WRITELINE(sangho_state,msx_vdp_interrupt)) MCFG_SCREEN_ADD("screen", RASTER) @@ -484,7 +484,7 @@ static MACHINE_CONFIG_START( sexyboom, sangho_state ) MCFG_CPU_IO_MAP(sexyboom_io_map) MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", sangho_state, sangho_interrupt, "screen", 0, 1) - MCFG_V9958_ADD("v9958", "screen", 0x20000) + MCFG_V9958_ADD("v9958", "screen", 0x20000, XTAL_21_4772MHz) // typical 9958 clock, not verified MCFG_V99X8_INTERRUPT_CALLBACK(WRITELINE(sangho_state,msx_vdp_interrupt)) MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/drivers/seattle.c b/src/mame/drivers/seattle.c index 424dd217a47..da357413e5f 100644 --- a/src/mame/drivers/seattle.c +++ b/src/mame/drivers/seattle.c @@ -1802,6 +1802,7 @@ static ADDRESS_MAP_START( seattle_map, AS_PROGRAM, 32, seattle_state ) AM_RANGE(0x17900000, 0x17900003) AM_READWRITE(status_leds_r, status_leds_w) AM_RANGE(0x17f00000, 0x17f00003) AM_RAM_WRITE(asic_reset_w) AM_SHARE("asic_reset") AM_RANGE(0x1fc00000, 0x1fc7ffff) AM_ROM AM_REGION("user1", 0) AM_SHARE("rombase") + AM_RANGE(0x1fd00000, 0x1fdfffff) AM_ROM AM_REGION("update", 0) ADDRESS_MAP_END @@ -2755,6 +2756,8 @@ ROM_START( wg3dh ) ROM_REGION32_LE( 0x80000, "user1", 0 ) /* Boot Code Version L1.2 (10/8/96) */ ROM_LOAD( "wg3dh_12.u32", 0x000000, 0x80000, CRC(15e4cea2) SHA1(72c0db7dc53ce645ba27a5311b5ce803ad39f131) ) + ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) + DISK_REGION( "ide:0:hdd:image" ) /* Hard Drive Version 1.3 (Guts 10/15/96, Main 10/15/96) */ DISK_IMAGE( "wg3dh", 0, SHA1(4fc6f25d7f043d9bcf8743aa8df1d9be3cbc375b) ) @@ -2767,6 +2770,8 @@ ROM_START( mace ) ROM_REGION32_LE( 0x80000, "user1", 0 ) /* Boot Code Version 1.0ce 7/2/97 */ ROM_LOAD( "mace10ce.u32", 0x000000, 0x80000, CRC(7a50b37e) SHA1(33788835f84a9443566c80bee9f20a1691490c6d) ) + ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) + DISK_REGION( "ide:0:hdd:image" ) /* Hard Drive Version 1.0B 6/10/97 (Guts 7/2/97, Main 7/2/97) */ DISK_IMAGE( "mace", 0, SHA1(96ec8d3ff5dd894e21aa81403bcdbeba44bb97ea) ) @@ -2779,6 +2784,8 @@ ROM_START( macea ) ROM_REGION32_LE( 0x80000, "user1", 0 ) /* Boot Code Version ??? 5/7/97 */ ROM_LOAD( "maceboot.u32", 0x000000, 0x80000, CRC(effe3ebc) SHA1(7af3ca3580d6276ffa7ab8b4c57274e15ee6bcbb) ) + ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) + DISK_REGION( "ide:0:hdd:image" ) /* Hard Drive Version 1.0a (Guts 6/9/97, Main 5/12/97) */ DISK_IMAGE( "macea", 0, BAD_DUMP SHA1(9bd4a60627915d71932cab24f89c48ea21f4c1cb) ) @@ -2791,6 +2798,8 @@ ROM_START( sfrush ) ROM_REGION32_LE( 0x80000, "user1", 0 ) /* Boot Code Version L1.0 */ ROM_LOAD( "hdboot.u32", 0x000000, 0x80000, CRC(39a35f1b) SHA1(c46d83448399205d38e6e41dd56abbc362254254) ) + ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) + ROM_REGION32_LE( 0x200000, "cageboot", 0 ) /* TMS320C31 boot ROM Version L1.0 */ ROM_LOAD32_BYTE( "sndboot.u69", 0x000000, 0x080000, CRC(7e52cdc7) SHA1(f735063e19d2ca672cef6d761a2a47df272e8c59) ) @@ -2809,6 +2818,8 @@ ROM_START( sfrushrk ) ROM_REGION32_LE( 0x80000, "user1", 0 ) /* Boot Code */ ROM_LOAD( "boot.bin", 0x000000, 0x080000, CRC(0555b3cf) SHA1(a48abd6d06a26f4f9b6c52d8c0af6095b6be57fd) ) + ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) + ROM_REGION32_LE( 0x200000, "cageboot", 0 ) /* TMS320C31 boot ROM */ ROM_LOAD32_BYTE( "audboot.bin", 0x000000, 0x080000, CRC(c70c060d) SHA1(dd014bd13efdf5adc5450836bd4650351abefc46) ) @@ -2827,6 +2838,8 @@ ROM_START( calspeed ) ROM_REGION32_LE( 0x80000, "user1", 0 ) /* Boot Code Version 1.2 (2/18/98) */ ROM_LOAD( "caspd1_2.u32", 0x000000, 0x80000, CRC(0a235e4e) SHA1(b352f10fad786260b58bd344b5002b6ea7aaf76d) ) + ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) + DISK_REGION( "ide:0:hdd:image" ) /* Release version 2.1a (4/17/98) (Guts 1.25 4/17/98, Main 4/17/98) */ DISK_IMAGE( "calspeed", 0, SHA1(08d411c591d4b8bbdd6437ea80d01c4cec8516f8) ) @@ -2838,6 +2851,8 @@ ROM_START( calspeeda ) ROM_REGION32_LE( 0x80000, "user1", 0 ) /* Boot Code Version 1.2 (2/18/98) */ ROM_LOAD( "caspd1_2.u32", 0x000000, 0x80000, CRC(0a235e4e) SHA1(b352f10fad786260b58bd344b5002b6ea7aaf76d) ) + ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) + DISK_REGION( "ide:0:hdd:image" ) /* Release version 1.0r8a (4/10/98) (Guts 4/10/98, Main 4/10/98) */ DISK_IMAGE( "cs_10r8a", 0, SHA1(ba4e7589740e0647938c81c5082bb71d8826bad4) ) @@ -2849,6 +2864,8 @@ ROM_START( calspeedb ) ROM_REGION32_LE( 0x80000, "user1", 0 ) /* Boot Code Version 1.2 (2/18/98) */ ROM_LOAD( "caspd1_2.u32", 0x000000, 0x80000, CRC(0a235e4e) SHA1(b352f10fad786260b58bd344b5002b6ea7aaf76d) ) + ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) + DISK_REGION( "ide:0:hdd:image" ) /* Release version 1.0r7a (3/4/98) (Guts 3/3/98, Main 1/19/98) */ DISK_IMAGE( "calspeda", 0, SHA1(6b1c3a7530195ef7309b06a651b01c8b3ece92c6) ) @@ -2864,6 +2881,8 @@ ROM_START( vaportrx ) ROM_REGION32_LE( 0x80000, "user1", 0 ) ROM_LOAD( "vtrxboot.bin", 0x000000, 0x80000, CRC(ee487a6c) SHA1(fb9efda85047cf615f24f7276a9af9fd542f3354) ) + ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) + DISK_REGION( "ide:0:hdd:image" ) DISK_IMAGE( "vaportrx", 0, SHA1(fe53ca7643d2ed2745086abb7f2243c69678cab1) ) @@ -2876,6 +2895,8 @@ ROM_START( vaportrxp ) ROM_REGION32_LE( 0x80000, "user1", 0 ) ROM_LOAD( "vtrxboot.bin", 0x000000, 0x80000, CRC(ee487a6c) SHA1(fb9efda85047cf615f24f7276a9af9fd542f3354) ) + ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) + DISK_REGION( "ide:0:hdd:image" ) /* Guts: Apr 10 1998 11:03:14 Main: Apr 10 1998 11:27:44 */ DISK_IMAGE( "vaportrp", 0, SHA1(6c86637c442ebd6994eee8c0ae0dce343c35dbe9) ) @@ -2888,6 +2909,8 @@ ROM_START( biofreak ) ROM_REGION16_LE( 0x10000, "dcs", 0 ) /* ADSP-2115 data Version 1.02 */ ROM_LOAD16_BYTE( "sound102.u95", 0x000000, 0x8000, CRC(bec7d3ae) SHA1(db80aa4a645804a4574b07b9f34dec6b6b64190d) ) + ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) + ROM_REGION32_LE( 0x80000, "user1", 0 ) /* Seattle System Boot ROM Version 0.1i Apr 14 1997 14:52:53 */ ROM_LOAD( "biofreak.u32", 0x000000, 0x80000, CRC(cefa00bb) SHA1(7e171610ede1e8a448fb8d175f9cb9e7d549de28) ) @@ -2900,6 +2923,8 @@ ROM_START( blitz ) ROM_REGION16_LE( 0x10000, "dcs", 0 ) /* ADSP-2115 data Version 1.02 */ ROM_LOAD16_BYTE( "sound102.u95", 0x000000, 0x8000, CRC(bec7d3ae) SHA1(db80aa4a645804a4574b07b9f34dec6b6b64190d) ) + ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) + ROM_REGION32_LE( 0x80000, "user1", 0 ) /* Boot Code Version 1.2 */ ROM_LOAD( "blitz1_2.u32", 0x000000, 0x80000, CRC(38dbecf5) SHA1(7dd5a5b3baf83a7f8f877ff4cd3f5e8b5201b36f) ) @@ -2912,6 +2937,8 @@ ROM_START( blitz11 ) ROM_REGION16_LE( 0x10000, "dcs", 0 ) /* ADSP-2115 data Version 1.02 */ ROM_LOAD16_BYTE( "sound102.u95", 0x000000, 0x8000, CRC(bec7d3ae) SHA1(db80aa4a645804a4574b07b9f34dec6b6b64190d) ) + ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) + ROM_REGION32_LE( 0x80000, "user1", 0 ) /* Boot Code Version 1.1 */ ROM_LOAD( "blitz1_1.u32", 0x000000, 0x80000, CRC(8163ce02) SHA1(89b432d8879052f6c5534ee49599f667f50a010f) ) @@ -2924,6 +2951,8 @@ ROM_START( blitz99 ) ROM_REGION16_LE( 0x10000, "dcs", 0 ) /* ADSP-2115 data Version 1.02 */ ROM_LOAD16_BYTE( "sound102.u95", 0x000000, 0x8000, CRC(bec7d3ae) SHA1(db80aa4a645804a4574b07b9f34dec6b6b64190d) ) + ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) + ROM_REGION32_LE( 0x80000, "user1", 0 ) /* Boot Code Version 1.0 */ ROM_LOAD( "bltz9910.u32", 0x000000, 0x80000, CRC(777119b2) SHA1(40d255181c2f3a787919c339e83593fd506779a5) ) @@ -2938,6 +2967,11 @@ ROM_START( blitz99a ) ROM_REGION32_LE( 0x80000, "user1", 0 ) /* Boot Code Version 1.0 */ ROM_LOAD( "bltz9910.u32", 0x000000, 0x80000, CRC(777119b2) SHA1(40d255181c2f3a787919c339e83593fd506779a5) ) + ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) // to use this rom run with -bios up130 and go into TEST mode to update. + ROM_SYSTEM_BIOS( 0, "noupdate", "No Update Rom" ) + ROM_SYSTEM_BIOS( 1, "up130", "Update to 1.30" ) + ROMX_LOAD( "rev.-1.3.u33", 0x000000, 0x100000, CRC(0a0fde5a) SHA1(1edb671c66819f634a9f1daa35331a99b2bda01a), ROM_BIOS(2) ) + DISK_REGION( "ide:0:hdd:image" ) /* Hard Drive Version 1.30 */ DISK_IMAGE( "blitz99a", 0, SHA1(43f834727ce01d7a63b482fc28cbf292477fc6f2) ) ROM_END @@ -2947,6 +2981,8 @@ ROM_START( blitz2k ) ROM_REGION16_LE( 0x10000, "dcs", 0 ) /* ADSP-2115 data Version 1.02 */ ROM_LOAD16_BYTE( "sound102.u95", 0x000000, 0x8000, CRC(bec7d3ae) SHA1(db80aa4a645804a4574b07b9f34dec6b6b64190d) ) + ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) + ROM_REGION32_LE( 0x80000, "user1", 0 ) /* Boot Code Version 1.4 */ ROM_LOAD( "bltz2k14.u32", 0x000000, 0x80000, CRC(ac4f0051) SHA1(b8125c17370db7bfd9b783230b4ef3d5b22a2025) ) @@ -2959,6 +2995,8 @@ ROM_START( carnevil ) ROM_REGION16_LE( 0x10000, "dcs", 0 ) /* ADSP-2115 data Version 1.02 */ ROM_LOAD16_BYTE( "sound102.u95", 0x000000, 0x8000, CRC(bec7d3ae) SHA1(db80aa4a645804a4574b07b9f34dec6b6b64190d) ) + ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) + ROM_REGION32_LE( 0x80000, "user1", 0 ) /* Boot Rom Version 1.9 */ ROM_LOAD( "carnevil1_9.u32", 0x000000, 0x80000, CRC(82c07f2e) SHA1(fa51c58022ce251c53bad12fc6ffadb35adb8162) ) @@ -2971,6 +3009,8 @@ ROM_START( carnevil1 ) ROM_REGION16_LE( 0x10000, "dcs", 0 ) /* ADSP-2115 data Version 1.02 */ ROM_LOAD16_BYTE( "sound102.u95", 0x000000, 0x8000, CRC(bec7d3ae) SHA1(db80aa4a645804a4574b07b9f34dec6b6b64190d) ) + ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) + ROM_REGION32_LE( 0x80000, "user1", 0 ) /* Boot Rom Version 1.9 */ ROM_LOAD( "carnevil1_9.u32", 0x000000, 0x80000, CRC(82c07f2e) SHA1(fa51c58022ce251c53bad12fc6ffadb35adb8162) ) @@ -2983,6 +3023,8 @@ ROM_START( hyprdriv ) ROM_REGION16_LE( 0x10000, "dcs", 0 ) /* ADSP-2115 data Version 1.02 */ ROM_LOAD16_BYTE( "seattle.snd", 0x000000, 0x8000, BAD_DUMP CRC(bec7d3ae) SHA1(db80aa4a645804a4574b07b9f34dec6b6b64190d) ) + ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) + ROM_REGION32_LE( 0x80000, "user1", 0 ) /* Boot Rom Version 9. */ ROM_LOAD( "hyprdrve.u32", 0x000000, 0x80000, CRC(3e18cb80) SHA1(b18cc4253090ee1d65d72a7ec0c426ed08c4f238) ) diff --git a/src/mame/drivers/segaorun.c b/src/mame/drivers/segaorun.c index fee77e3544c..b0e521589ca 100644 --- a/src/mame/drivers/segaorun.c +++ b/src/mame/drivers/segaorun.c @@ -1937,10 +1937,10 @@ ROM_END // ROM_START( shangon1 ) ROM_REGION( 0x60000, "maincpu", 0 ) // 68000 code - protected - ROM_LOAD16_BYTE( "ic133", 0x000000, 0x10000, CRC(e52721fe) SHA1(21f0aa14d0cbda3d762bca86efe089646031aef5) ) // All EPR numbers for this main CPU version are unknown - ROM_LOAD16_BYTE( "ic118", 0x000001, 0x10000, BAD_DUMP CRC(5fee09f6) SHA1(b97a08ba75d8c617aceff2b03c1f2bfcb16181ef) ) - ROM_LOAD16_BYTE( "ic132", 0x020000, 0x10000, CRC(5d55d65f) SHA1(d02d76b98d74746b078b0f49f0320b8be48e4c47) ) - ROM_LOAD16_BYTE( "ic117", 0x020001, 0x10000, CRC(b967e8c3) SHA1(00224b337b162daff03bbfabdcf8541025220d46) ) + ROM_LOAD16_BYTE( "epr-10636.133", 0x000000, 0x10000, CRC(e52721fe) SHA1(21f0aa14d0cbda3d762bca86efe089646031aef5) ) + ROM_LOAD16_BYTE( "epr-10634.118", 0x000001, 0x10000, CRC(08feca97) SHA1(011aa59155d77150ed3a5c3a3b031c699736d262) ) + ROM_LOAD16_BYTE( "epr-10637.132", 0x020000, 0x10000, CRC(5d55d65f) SHA1(d02d76b98d74746b078b0f49f0320b8be48e4c47) ) + ROM_LOAD16_BYTE( "epr-10635.117", 0x020001, 0x10000, CRC(b967e8c3) SHA1(00224b337b162daff03bbfabdcf8541025220d46) ) ROM_REGION( 0x60000, "subcpu", 0 ) // second 68000 CPU ROM_LOAD16_BYTE( "epr-10640.76", 0x00000, 0x10000, CRC(02be68db) SHA1(8c9f98ee49db54ee53b721ecf53f91737ae6cd73) ) @@ -2532,7 +2532,7 @@ GAMEL(1986, outrunb, outrun, outrun, outrun, segaorun_state,outrun GAME( 1987, shangon, 0, shangon, shangon, segaorun_state,shangon, ROT0, "Sega", "Super Hang-On (sitdown/upright, unprotected)", 0 ) GAME( 1987, shangon3, shangon, shangon_fd1089b, shangon, segaorun_state,shangon, ROT0, "Sega", "Super Hang-On (sitdown/upright, FD1089B 317-0034)", 0 ) GAME( 1987, shangon2, shangon, shangon_fd1089b, shangon, segaorun_state,shangon, ROT0, "Sega", "Super Hang-On (mini ride-on, Rev A, FD1089B 317-0034)", 0 ) -GAME( 1987, shangon1, shangon, shangon_fd1089b, shangon, segaorun_state,shangon, ROT0, "Sega", "Super Hang-On (mini ride-on?, FD1089B 317-0034)", MACHINE_NOT_WORKING ) // bad program rom +GAME( 1987, shangon1, shangon, shangon_fd1089b, shangon, segaorun_state,shangon, ROT0, "Sega", "Super Hang-On (mini ride-on, FD1089B 317-0034)", 0 ) GAME( 1991, shangonle, shangon, shangon, shangon, segaorun_state,shangon, ROT0, "Sega", "Limited Edition Hang-On", 0 ) GAMEL(1989, toutrun, 0, outrun_fd1094, toutrun, segaorun_state,outrun, ROT0, "Sega", "Turbo Out Run (Out Run upgrade, FD1094 317-0118)", 0, layout_outrun ) // Cabinet determined by dipswitch settings GAMEL(1989, toutrunj, toutrun, outrun_fd1094, toutrun, segaorun_state,outrun, ROT0, "Sega", "Turbo Out Run (Japan, Out Run upgrade, FD1094 317-0117)", 0, layout_outrun ) // Cabinet determined by dipswitch settings diff --git a/src/mame/drivers/senjyo.c b/src/mame/drivers/senjyo.c index 47c8eece399..4ccb8036ab1 100644 --- a/src/mame/drivers/senjyo.c +++ b/src/mame/drivers/senjyo.c @@ -118,28 +118,13 @@ WRITE8_MEMBER(senjyo_state::sound_cmd_w) m_pio->strobe_a(1); } -WRITE8_MEMBER(senjyo_state::paletteram_w) -{ - int r = (data << 2) & 0xC; - int g = (data ) & 0xC; - int b = (data >> 2) & 0xC; - int i = (data >> 6) & 0x3; - - int rr = r|((r!=0)?i:0); - int gg = g|((g!=0)?i:0); - int bb = b|((b!=0)?i:0); - - m_generic_paletteram_8[offset] = data; - m_palette->set_pen_color(offset, pal4bit(rr), pal4bit(gg), pal4bit(bb) ); -} - static ADDRESS_MAP_START( senjyo_map, AS_PROGRAM, 8, senjyo_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0x8fff) AM_RAM AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(fgvideoram_w) AM_SHARE("fgvideoram") AM_RANGE(0x9400, 0x97ff) AM_RAM_WRITE(fgcolorram_w) AM_SHARE("fgcolorram") AM_RANGE(0x9800, 0x987f) AM_RAM AM_SHARE("spriteram") - AM_RANGE(0x9c00, 0x9dff) AM_RAM_WRITE(paletteram_w) AM_SHARE("paletteram") + AM_RANGE(0x9c00, 0x9dff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0x9e00, 0x9e1f) AM_RAM AM_SHARE("fgscroll") AM_RANGE(0x9e20, 0x9e21) AM_RAM AM_SHARE("scrolly3") /* AM_RANGE(0x9e22, 0x9e23) height of the layer (Senjyo only, fixed at 0x380) */ @@ -210,7 +195,7 @@ static ADDRESS_MAP_START( starforb_map, AS_PROGRAM, 8, senjyo_state ) AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(fgvideoram_w) AM_SHARE("fgvideoram") AM_RANGE(0x9400, 0x97ff) AM_RAM_WRITE(fgcolorram_w) AM_SHARE("fgcolorram") AM_RANGE(0x9800, 0x987f) AM_RAM AM_SHARE("spriteram") - AM_RANGE(0x9c00, 0x9dff) AM_RAM_WRITE(paletteram_w) AM_SHARE("paletteram") + AM_RANGE(0x9c00, 0x9dff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") /* The format / use of the ram here is different on the bootleg */ AM_RANGE(0x9e20, 0x9e21) AM_RAM AM_SHARE("scrolly3") AM_RANGE(0x9e25, 0x9e25) AM_RAM AM_SHARE("scrollx3") @@ -588,11 +573,14 @@ static MACHINE_CONFIG_START( senjyo, senjyo_state ) MCFG_SCREEN_SIZE(32*8, 32*8) MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) MCFG_SCREEN_UPDATE_DRIVER(senjyo_state, screen_update) - MCFG_SCREEN_PALETTE("palette") MCFG_GFXDECODE_ADD("gfxdecode", "palette", senjyo) - MCFG_PALETTE_ADD_INIT_BLACK("palette", 512+2) /* 512 real palette + 2 for the radar */ + MCFG_PALETTE_ADD_INIT_BLACK("palette", 512) + MCFG_PALETTE_FORMAT_CLASS(1, senjyo_state, IIBBGGRR) + + MCFG_PALETTE_ADD("radar_palette", 2) + MCFG_PALETTE_INIT_OWNER(senjyo_state, radar) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") diff --git a/src/mame/drivers/sfkick.c b/src/mame/drivers/sfkick.c index cd6e4bbed66..bb6b52d866e 100644 --- a/src/mame/drivers/sfkick.c +++ b/src/mame/drivers/sfkick.c @@ -470,7 +470,7 @@ static MACHINE_CONFIG_START( sfkick, sfkick_state ) MCFG_CPU_PROGRAM_MAP(sfkick_sound_map) MCFG_CPU_IO_MAP(sfkick_sound_io_map) - MCFG_V9938_ADD("v9938", "screen", 0x80000) + MCFG_V9938_ADD("v9938", "screen", 0x80000, MASTER_CLOCK) MCFG_V99X8_INTERRUPT_CALLBACK(WRITELINE(sfkick_state,sfkick_vdp_interrupt)) MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/drivers/simpsons.c b/src/mame/drivers/simpsons.c index bb510fa74b7..9d0cece5f09 100644 --- a/src/mame/drivers/simpsons.c +++ b/src/mame/drivers/simpsons.c @@ -344,11 +344,10 @@ static MACHINE_CONFIG_START( simpsons, simpsons_state ) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_RAW_PARAMS(XTAL_24MHz/3, 528, 112, 400, 256, 16, 240) +// 6MHz dotclock is more realistic, however needs drawing updates. replace when ready +// MCFG_SCREEN_RAW_PARAMS(XTAL_24MHz/4, 396, hbend, hbstart, 256, 16, 240) MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK) - MCFG_SCREEN_REFRESH_RATE(59.1856) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) - MCFG_SCREEN_SIZE(64*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(14*8, (64-14)*8-1, 2*8, 30*8-1 ) MCFG_SCREEN_UPDATE_DRIVER(simpsons_state, screen_update_simpsons) MCFG_SCREEN_PALETTE("palette") diff --git a/src/mame/drivers/sothello.c b/src/mame/drivers/sothello.c index 17d0684ed44..5305fc60ced 100644 --- a/src/mame/drivers/sothello.c +++ b/src/mame/drivers/sothello.c @@ -92,6 +92,7 @@ public: #define VDP_MEM 0x40000 +#define MAIN_CLOCK (XTAL_21_4772MHz) #define MAINCPU_CLOCK (XTAL_21_4772MHz/6) #define SOUNDCPU_CLOCK (XTAL_21_4772MHz/6) #define YM_CLOCK (XTAL_21_4772MHz/12) @@ -369,7 +370,7 @@ static MACHINE_CONFIG_START( sothello, sothello_state ) MCFG_QUANTUM_TIME(attotime::from_hz(600)) /* video hardware */ - MCFG_V9938_ADD("v9938", "screen", VDP_MEM) + MCFG_V9938_ADD("v9938", "screen", VDP_MEM, MAIN_CLOCK) MCFG_V99X8_INTERRUPT_CALLBACK(WRITELINE(sothello_state,sothello_vdp_interrupt)) MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/drivers/spcforce.c b/src/mame/drivers/spcforce.c index b313ad7c999..303d4c61a87 100644 --- a/src/mame/drivers/spcforce.c +++ b/src/mame/drivers/spcforce.c @@ -119,6 +119,13 @@ static ADDRESS_MAP_START( spcforce_map, AS_PROGRAM, 8, spcforce_state ) AM_RANGE(0xa000, 0xa3ff) AM_RAM AM_SHARE("scrollram") ADDRESS_MAP_END +static ADDRESS_MAP_START( meteors_map, AS_PROGRAM, 8, spcforce_state ) + AM_RANGE(0x700b, 0x700b) AM_WRITENOP + AM_RANGE(0x700d, 0x700d) AM_WRITE(irq_mask_w) // ?? + AM_RANGE(0x700e, 0x700e) AM_WRITE(flip_screen_w) // irq mask isn't here, gets written too early causing the game to not boot, see startup code between sets + AM_IMPORT_FROM(spcforce_map) +ADDRESS_MAP_END + static ADDRESS_MAP_START( spcforce_sound_map, AS_PROGRAM, 8, spcforce_state ) AM_RANGE(0x0000, 0x07ff) AM_ROM ADDRESS_MAP_END @@ -265,6 +272,7 @@ PALETTE_INIT_MEMBER(spcforce_state, spcforce) INTERRUPT_GEN_MEMBER(spcforce_state::vblank_irq) { + if(m_irq_mask) device.execute().set_input_line(3, HOLD_LINE); } @@ -310,6 +318,11 @@ static MACHINE_CONFIG_START( spcforce, spcforce_state ) MCFG_SN76496_READY_HANDLER(WRITELINE(spcforce_state, write_sn3_ready)) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( meteors, spcforce ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(meteors_map) +MACHINE_CONFIG_END + /*************************************************************************** @@ -385,7 +398,31 @@ ROM_START( meteor ) ROM_LOAD( "bm2v", 0x2800, 0x0800, CRC(2858cf5c) SHA1(1313b4e4adda074499153e4a42bc2c6b41b0ec7e) ) ROM_END +ROM_START( meteors ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "1hz1_2.1ab", 0x0000, 0x0800, CRC(86de2a63) SHA1(083a0d31f29bd9d68d240b23234645eeea57556d) ) + ROM_LOAD( "2hz1_2.1cd", 0x0800, 0x0800, CRC(7ef2c421) SHA1(f01327748e5a2144744557cd3cef16c93076466c) ) + ROM_LOAD( "3hz1_2.2ab", 0x1000, 0x0800, CRC(6d631f33) SHA1(4c69e3761d7db5ed6c8c23cc5e255cacfac6137f) ) + ROM_LOAD( "4hz1_2.2cd", 0x1800, 0x0800, CRC(48cb5acc) SHA1(791f9ca0225465d7af8a2a61f617112570f529e6)) + /*0x2000 empty */ + ROM_LOAD( "6hz1_2.3cd", 0x2800, 0x0800, CRC(39541265) SHA1(e55eb6c826fb553123991577be4daa3c2aa236f6) ) + ROM_LOAD( "7hz1_2.4ab", 0x3000, 0x0800, CRC(e718e807) SHA1(d8f3f66aea409c296785d66937b067f4b2c76ed4) ) + ROM_LOAD( "mbv21_2.4cd", 0x3800, 0x0800, CRC(f805c3cd) SHA1(78eb13b99aae895742b34ed56bee9313d3643de1) ) + + ROM_REGION( 0x1000, "audiocpu", 0 ) /* sound MCU */ + ROM_LOAD( "vms.10l", 0x0000, 0x0800, CRC(b14ccd57) SHA1(0349ec5d0ca7f98ffdd96d7bf01cf096fe547f7a)) + + ROM_REGION( 0x3000, "gfx1", 0 ) + ROM_LOAD( "rm1h1_2.6st", 0x0000, 0x0800, CRC(409fef31) SHA1(7260e06fa654d54f3660712a63f8db8c28b872c9) ) + ROM_LOAD( "rm2h1_2.7st", 0x0800, 0x0800, CRC(b3981251) SHA1(b6743d121a6b3ad8e8beebe1faff2678b89e7d16) ) + ROM_LOAD( "gm1h1_2.6pr", 0x1000, 0x0800, CRC(0b85c282) SHA1(b264c92d4b2533c18ac7831491133170a2fd400b) ) + ROM_LOAD( "gm2h1_2.7pr", 0x1800, 0x0800, CRC(0997d945) SHA1(16eba77b14c62b2a0ebea47a28d4d5d21d7a2234) ) + ROM_LOAD( "bm1h1_2.6nm", 0x2000, 0x0800, CRC(f9501c8e) SHA1(483d3d4c3f9601d7fcbf263bba5bdc5529b13f70) ) + ROM_LOAD( "bm2h1_2.7nm", 0x2800, 0x0800, CRC(2858cf5c) SHA1(1313b4e4adda074499153e4a42bc2c6b41b0ec7e) ) +ROM_END + GAME( 1980, spcforce, 0, spcforce, spcforce, driver_device, 0, ROT270, "Venture Line", "Space Force (set 1)", MACHINE_IMPERFECT_COLORS | MACHINE_SUPPORTS_SAVE ) GAME( 19??, spcforc2, spcforce, spcforce, spcforc2, driver_device, 0, ROT270, "bootleg? (Elcon)", "Space Force (set 2)", MACHINE_IMPERFECT_COLORS | MACHINE_SUPPORTS_SAVE ) GAME( 1981, meteor, spcforce, spcforce, spcforc2, driver_device, 0, ROT270, "Venture Line", "Meteoroids", MACHINE_IMPERFECT_COLORS | MACHINE_SUPPORTS_SAVE ) +GAME( 19??, meteors, spcforce, meteors, spcforc2, driver_device, 0, ROT0, "Amusement World", "Meteors", MACHINE_IMPERFECT_COLORS | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/spy.c b/src/mame/drivers/spy.c index 0d1254c7aca..a37a42d0bce 100644 --- a/src/mame/drivers/spy.c +++ b/src/mame/drivers/spy.c @@ -519,6 +519,7 @@ static MACHINE_CONFIG_START( spy, spy_state ) MCFG_DEVICE_ADD("k051960", K051960, 0) MCFG_GFX_PALETTE("palette") + MCFG_K051960_SCREEN_TAG("screen") MCFG_K051960_CB(spy_state, sprite_callback) /* sound hardware */ diff --git a/src/mame/drivers/sstrangr.c b/src/mame/drivers/sstrangr.c index 19e7d304f40..e1db1d7b53e 100644 --- a/src/mame/drivers/sstrangr.c +++ b/src/mame/drivers/sstrangr.c @@ -13,18 +13,17 @@ #include "sstrangr.lh" -#define NUM_PENS (8) - class sstrangr_state : public driver_device { public: sstrangr_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), + m_palette(*this, "palette"), m_ram(*this, "ram") { } required_device<cpu_device> m_maincpu; - + optional_device<palette_device> m_palette; required_shared_ptr<UINT8> m_ram; UINT8 m_flip_screen; @@ -86,32 +85,12 @@ UINT32 sstrangr_state::screen_update_sstrangr(screen_device &screen, bitmap_rgb3 return 0; } - -static void get_pens(pen_t *pens) -{ - offs_t i; - - for (i = 0; i < NUM_PENS; i++) - { - pens[i] = rgb_t(pal1bit(i >> 0), pal1bit(i >> 2), pal1bit(i >> 1)); - } -} - - UINT32 sstrangr_state::screen_update_sstrngr2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - pen_t pens[NUM_PENS]; - offs_t offs; - UINT8 *color_map_base; - - get_pens(pens); - - color_map_base = &memregion("proms")->base()[m_flip_screen ? 0x0000 : 0x0200]; + UINT8 *color_map_base = &memregion("proms")->base()[m_flip_screen ? 0x0000 : 0x0200]; - for (offs = 0; offs < 0x2000; offs++) + for (offs_t offs = 0; offs < 0x2000; offs++) { - int i; - UINT8 y = offs >> 5; UINT8 x = offs << 3; @@ -120,7 +99,7 @@ UINT32 sstrangr_state::screen_update_sstrngr2(screen_device &screen, bitmap_rgb3 UINT8 data = m_ram[offs]; UINT8 fore_color = color_map_base[color_address] & 0x07; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { UINT8 color; @@ -135,7 +114,7 @@ UINT32 sstrangr_state::screen_update_sstrngr2(screen_device &screen, bitmap_rgb3 data = data >> 1; } - bitmap.pix32(y, x) = pens[color]; + bitmap.pix32(y, x) = m_palette->pen_color(color); x = x + 1; } @@ -282,6 +261,7 @@ static MACHINE_CONFIG_DERIVED( sstrngr2, sstrangr ) MCFG_SCREEN_MODIFY("screen") MCFG_SCREEN_UPDATE_DRIVER(sstrangr_state, screen_update_sstrngr2) + MCFG_PALETTE_ADD_3BIT_RBG("palette") MACHINE_CONFIG_END diff --git a/src/mame/drivers/suna16.c b/src/mame/drivers/suna16.c index ba2ae6ee936..fd90aebce16 100644 --- a/src/mame/drivers/suna16.c +++ b/src/mame/drivers/suna16.c @@ -296,8 +296,8 @@ ADDRESS_MAP_END MACHINE_START_MEMBER(suna16_state, bssoccer) { - membank("bank1")->configure_entries(0, 8, memregion("pcm1")->base() + 0x1000, 0x10000); - membank("bank2")->configure_entries(0, 8, memregion("pcm2")->base() + 0x1000, 0x10000); + m_bank1->configure_entries(0, 8, memregion("pcm1")->base() + 0x1000, 0x10000); + m_bank2->configure_entries(0, 8, memregion("pcm2")->base() + 0x1000, 0x10000); } /* Bank Switching */ @@ -306,16 +306,14 @@ WRITE8_MEMBER(suna16_state::bssoccer_pcm_1_bankswitch_w) { const int bank = data & 7; if (bank & ~7) logerror("CPU#2 PC %06X - ROM bank unknown bits: %02X\n", space.device().safe_pc(), data); - printf("%d %d\n", 1, bank); - membank("bank1")->set_entry(bank); + m_bank1->set_entry(bank); } WRITE8_MEMBER(suna16_state::bssoccer_pcm_2_bankswitch_w) { const int bank = data & 7; if (bank & ~7) logerror("CPU#3 PC %06X - ROM bank unknown bits: %02X\n", space.device().safe_pc(), data); - printf("%d %d\n", 2, bank); - membank("bank2")->set_entry(bank); + m_bank2->set_entry(bank); } @@ -380,7 +378,7 @@ WRITE8_MEMBER(suna16_state::uballoon_pcm_1_bankswitch_w) { const int bank = data & 1; if (bank & ~1) logerror("CPU#2 PC %06X - ROM bank unknown bits: %02X\n", space.device().safe_pc(), data); - membank("bank1")->set_entry(bank); + m_bank1->set_entry(bank); } /* Memory maps: Yes, *no* RAM */ @@ -400,7 +398,7 @@ ADDRESS_MAP_END MACHINE_START_MEMBER(suna16_state,uballoon) { - membank("bank1")->configure_entries(0, 2, memregion("pcm1")->base() + 0x400, 0x10000); + m_bank1->configure_entries(0, 2, memregion("pcm1")->base() + 0x400, 0x10000); save_item(NAME(m_prot)); } diff --git a/src/mame/drivers/superqix.c b/src/mame/drivers/superqix.c index cd86dd4d4ab..8db24ee5ed0 100644 --- a/src/mame/drivers/superqix.c +++ b/src/mame/drivers/superqix.c @@ -941,7 +941,7 @@ static MACHINE_CONFIG_START( pbillian, superqix_state ) MCFG_GFXDECODE_ADD("gfxdecode", "palette", pbillian) MCFG_PALETTE_ADD("palette", 512) - MCFG_PALETTE_FORMAT(BBGGRRII) + MCFG_PALETTE_FORMAT_CLASS(1, superqix_state, BBGGRRII) MCFG_VIDEO_START_OVERRIDE(superqix_state,pbillian) @@ -980,7 +980,7 @@ static MACHINE_CONFIG_START( hotsmash, superqix_state ) MCFG_GFXDECODE_ADD("gfxdecode", "palette", pbillian) MCFG_PALETTE_ADD("palette", 512) - MCFG_PALETTE_FORMAT(BBGGRRII) + MCFG_PALETTE_FORMAT_CLASS(1, superqix_state, BBGGRRII) MCFG_VIDEO_START_OVERRIDE(superqix_state,pbillian) @@ -1023,7 +1023,7 @@ static MACHINE_CONFIG_START( sqix, superqix_state ) MCFG_GFXDECODE_ADD("gfxdecode", "palette", sqix) MCFG_PALETTE_ADD("palette", 256) - MCFG_PALETTE_FORMAT(BBGGRRII) + MCFG_PALETTE_FORMAT_CLASS(1, superqix_state, BBGGRRII) MCFG_VIDEO_START_OVERRIDE(superqix_state,superqix) @@ -1071,7 +1071,7 @@ static MACHINE_CONFIG_START( sqixbl, superqix_state ) MCFG_GFXDECODE_ADD("gfxdecode", "palette", sqix) MCFG_PALETTE_ADD("palette", 256) - MCFG_PALETTE_FORMAT(BBGGRRII) + MCFG_PALETTE_FORMAT_CLASS(1, superqix_state, BBGGRRII) MCFG_VIDEO_START_OVERRIDE(superqix_state,superqix) diff --git a/src/mame/drivers/system1.c b/src/mame/drivers/system1.c index d8037bf4cc7..e110517de1f 100644 --- a/src/mame/drivers/system1.c +++ b/src/mame/drivers/system1.c @@ -747,7 +747,7 @@ static ADDRESS_MAP_START( system1_map, AS_PROGRAM, 8, system1_state ) AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") AM_RANGE(0xc000, 0xcfff) AM_RAM AM_SHARE("ram") AM_RANGE(0xd000, 0xd7ff) AM_RAM AM_SHARE("spriteram") - AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(system1_paletteram_w) AM_SHARE("paletteram") + AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(system1_paletteram_w) AM_SHARE("palette") AM_RANGE(0xe000, 0xefff) AM_READWRITE(system1_videoram_r, system1_videoram_w) AM_RANGE(0xf000, 0xf3ff) AM_READWRITE(system1_mixer_collision_r, system1_mixer_collision_w) AM_RANGE(0xf400, 0xf7ff) AM_WRITE(system1_mixer_collision_reset_w) @@ -760,7 +760,7 @@ static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, system AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") AM_RANGE(0xc000, 0xcfff) AM_RAM AM_SHARE("ram") AM_RANGE(0xd000, 0xd7ff) AM_RAM AM_SHARE("spriteram") - AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(system1_paletteram_w) AM_SHARE("paletteram") + AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(system1_paletteram_w) AM_SHARE("palette") ADDRESS_MAP_END static ADDRESS_MAP_START( banked_decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, system1_state ) @@ -768,7 +768,7 @@ static ADDRESS_MAP_START( banked_decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1d") AM_RANGE(0xc000, 0xcfff) AM_RAM AM_SHARE("ram") AM_RANGE(0xd000, 0xd7ff) AM_RAM AM_SHARE("spriteram") - AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(system1_paletteram_w) AM_SHARE("paletteram") + AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(system1_paletteram_w) AM_SHARE("palette") ADDRESS_MAP_END /* same as normal System 1 except address map is shuffled (RAM/collision are swapped) */ @@ -780,7 +780,7 @@ static ADDRESS_MAP_START( nobo_map, AS_PROGRAM, 8, system1_state ) AM_RANGE(0xc800, 0xcbff) AM_READWRITE(system1_sprite_collision_r, system1_sprite_collision_w) AM_RANGE(0xcc00, 0xcfff) AM_WRITE(system1_sprite_collision_reset_w) AM_RANGE(0xd000, 0xd7ff) AM_RAM AM_SHARE("spriteram") - AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(system1_paletteram_w) AM_SHARE("paletteram") + AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(system1_paletteram_w) AM_SHARE("palette") AM_RANGE(0xe000, 0xefff) AM_READWRITE(system1_videoram_r, system1_videoram_w) AM_RANGE(0xf000, 0xffff) AM_RAM AM_SHARE("ram") ADDRESS_MAP_END @@ -2173,6 +2173,7 @@ static MACHINE_CONFIG_START( sys1ppi, system1_state ) MCFG_GFXDECODE_ADD("gfxdecode", "palette", system1) MCFG_PALETTE_ADD("palette", 2048) + MCFG_PALETTE_FORMAT(BBGGGRRR) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") diff --git a/src/mame/drivers/taito_x.c b/src/mame/drivers/taito_x.c index 46bf1bb2e65..78a1a582a2a 100644 --- a/src/mame/drivers/taito_x.c +++ b/src/mame/drivers/taito_x.c @@ -965,7 +965,7 @@ static MACHINE_CONFIG_START( ballbros, taitox_state ) MCFG_PALETTE_ADD("palette", 2048) MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB) - MCFG_VIDEO_START_OVERRIDE(taitox_state,seta_no_layers) + MCFG_VIDEO_START_OVERRIDE(taitox_state, kyustrkr_no_layers) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") diff --git a/src/mame/drivers/tasman.c b/src/mame/drivers/tasman.c index 8bf2c876674..bf46c41665e 100644 --- a/src/mame/drivers/tasman.c +++ b/src/mame/drivers/tasman.c @@ -183,7 +183,7 @@ static ADDRESS_MAP_START( kongambl_map, AS_PROGRAM, 32, kongambl_state ) AM_RANGE(0x440000, 0x443fff) AM_RAM // OBJ RAM - AM_RANGE(0x460000, 0x47ffff) AM_RAM_WRITE(konamigx_palette_w) AM_SHARE("paletteram") + AM_RANGE(0x460000, 0x47ffff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0x4b001c, 0x4b001f) AM_WRITENOP @@ -590,7 +590,8 @@ static MACHINE_CONFIG_START( kongambl, kongambl_state ) MCFG_SCREEN_UPDATE_DRIVER(kongambl_state, screen_update_kongambl) MCFG_SCREEN_PALETTE("palette") - MCFG_PALETTE_ADD("palette", 0x8000) + MCFG_PALETTE_ADD("palette", 32768) + MCFG_PALETTE_FORMAT(XRGB) MCFG_VIDEO_START_OVERRIDE(kongambl_state,kongambl) diff --git a/src/mame/drivers/thunderx.c b/src/mame/drivers/thunderx.c index 6dced26d356..0149e610533 100644 --- a/src/mame/drivers/thunderx.c +++ b/src/mame/drivers/thunderx.c @@ -663,6 +663,7 @@ static MACHINE_CONFIG_START( scontra, thunderx_state ) MCFG_DEVICE_ADD("k051960", K051960, 0) MCFG_GFX_PALETTE("palette") + MCFG_K051960_SCREEN_TAG("screen") MCFG_K051960_CB(thunderx_state, sprite_callback) /* sound hardware */ diff --git a/src/mame/drivers/tmnt.c b/src/mame/drivers/tmnt.c index 4fd26f6d5ca..0d7c1c1ede7 100644 --- a/src/mame/drivers/tmnt.c +++ b/src/mame/drivers/tmnt.c @@ -1992,6 +1992,7 @@ static MACHINE_CONFIG_START( cuebrick, tmnt_state ) MCFG_DEVICE_ADD("k051960", K051960, 0) MCFG_GFX_PALETTE("palette") + MCFG_K051960_SCREEN_TAG("screen") MCFG_K051960_CB(tmnt_state, mia_sprite_callback) MCFG_K051960_PLANEORDER(K051960_PLANEORDER_MIA) @@ -2041,6 +2042,7 @@ static MACHINE_CONFIG_START( mia, tmnt_state ) MCFG_DEVICE_ADD("k051960", K051960, 0) MCFG_GFX_PALETTE("palette") + MCFG_K051960_SCREEN_TAG("screen") MCFG_K051960_CB(tmnt_state, mia_sprite_callback) MCFG_K051960_PLANEORDER(K051960_PLANEORDER_MIA) @@ -2103,6 +2105,7 @@ static MACHINE_CONFIG_START( tmnt, tmnt_state ) MCFG_DEVICE_ADD("k051960", K051960, 0) MCFG_GFX_PALETTE("palette") + MCFG_K051960_SCREEN_TAG("screen") MCFG_K051960_CB(tmnt_state, tmnt_sprite_callback) MCFG_K051960_PLANEORDER(K051960_PLANEORDER_MIA) @@ -2163,6 +2166,7 @@ static MACHINE_CONFIG_START( punkshot, tmnt_state ) MCFG_DEVICE_ADD("k051960", K051960, 0) MCFG_GFX_PALETTE("palette") + MCFG_K051960_SCREEN_TAG("screen") MCFG_K051960_CB(tmnt_state, punkshot_sprite_callback) MCFG_K053251_ADD("k053251") @@ -2632,6 +2636,7 @@ static MACHINE_CONFIG_START( thndrx2, tmnt_state ) MCFG_DEVICE_ADD("k051960", K051960, 0) MCFG_GFX_PALETTE("palette") + MCFG_K051960_SCREEN_TAG("screen") MCFG_K051960_CB(tmnt_state, thndrx2_sprite_callback) MCFG_K053251_ADD("k053251") diff --git a/src/mame/drivers/tnzs.c b/src/mame/drivers/tnzs.c index 7a9ab7b0baf..7448c36aff2 100644 --- a/src/mame/drivers/tnzs.c +++ b/src/mame/drivers/tnzs.c @@ -675,8 +675,8 @@ READ8_MEMBER(tnzs_state::kageki_csport_r) { int dsw, dsw1, dsw2; - dsw1 = ioport("DSWA")->read(); - dsw2 = ioport("DSWB")->read(); + dsw1 = m_dswa->read(); + dsw2 = m_dswb->read(); switch (m_kageki_csport_sel) { @@ -731,7 +731,7 @@ WRITE8_MEMBER(tnzs_state::kabukiz_sound_bank_w) { // to avoid the write when the sound chip is initialized if (data != 0xff) - membank("audiobank")->set_entry(data & 0x07); + m_audiobank->set_entry(data & 0x07); } WRITE8_MEMBER(tnzs_state::kabukiz_sample_w) @@ -877,7 +877,7 @@ ADDRESS_MAP_END WRITE8_MEMBER(tnzs_state::jpopnics_subbankswitch_w) { /* bits 0-1 select ROM bank */ - membank("subbank")->set_entry(data & 0x03); + m_subbank->set_entry(data & 0x03); } static ADDRESS_MAP_START( jpopnics_sub_map, AS_PROGRAM, 8, tnzs_state ) diff --git a/src/mame/drivers/tonton.c b/src/mame/drivers/tonton.c index 204d1bec059..9747e06c20d 100644 --- a/src/mame/drivers/tonton.c +++ b/src/mame/drivers/tonton.c @@ -245,7 +245,7 @@ static MACHINE_CONFIG_START( tonton, tonton_state ) /* video hardware */ - MCFG_V9938_ADD("v9938", "screen", VDP_MEM) + MCFG_V9938_ADD("v9938", "screen", VDP_MEM, MAIN_CLOCK) MCFG_V99X8_INTERRUPT_CALLBACK(WRITELINE(tonton_state,tonton_vdp0_interrupt)) MCFG_SCREEN_ADD("screen",RASTER) diff --git a/src/mame/drivers/tutankhm.c b/src/mame/drivers/tutankhm.c index c84439ad5c0..8a4d65e4753 100644 --- a/src/mame/drivers/tutankhm.c +++ b/src/mame/drivers/tutankhm.c @@ -118,7 +118,7 @@ WRITE8_MEMBER(tutankhm_state::tutankhm_coin_counter_w) static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, tutankhm_state ) AM_RANGE(0x0000, 0x7fff) AM_RAM AM_SHARE("videoram") - AM_RANGE(0x8000, 0x800f) AM_MIRROR(0x00f0) AM_RAM AM_SHARE("paletteram") + AM_RANGE(0x8000, 0x800f) AM_MIRROR(0x00f0) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0x8100, 0x8100) AM_MIRROR(0x000f) AM_RAM AM_SHARE("scroll") AM_RANGE(0x8120, 0x8120) AM_MIRROR(0x000f) AM_READ(watchdog_reset_r) AM_RANGE(0x8160, 0x8160) AM_MIRROR(0x000f) AM_READ_PORT("DSW2") /* DSW2 (inverted bits) */ @@ -237,6 +237,9 @@ static MACHINE_CONFIG_START( tutankhm, tutankhm_state ) MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) /* not sure about the visible area */ MCFG_SCREEN_UPDATE_DRIVER(tutankhm_state, screen_update_tutankhm) + MCFG_PALETTE_ADD("palette", 16) + MCFG_PALETTE_FORMAT(BBGGGRRR) + /* sound hardware */ MCFG_FRAGMENT_ADD(timeplt_sound) MACHINE_CONFIG_END diff --git a/src/mame/drivers/ultraman.c b/src/mame/drivers/ultraman.c index e06606002b4..93c6c67f7c6 100644 --- a/src/mame/drivers/ultraman.c +++ b/src/mame/drivers/ultraman.c @@ -200,6 +200,7 @@ static MACHINE_CONFIG_START( ultraman, ultraman_state ) MCFG_DEVICE_ADD("k051960", K051960, 0) MCFG_GFX_PALETTE("palette") + MCFG_K051960_SCREEN_TAG("screen") MCFG_K051960_CB(ultraman_state, sprite_callback) MCFG_DEVICE_ADD("k051316_1", K051316, 0) diff --git a/src/mame/drivers/vegas.c b/src/mame/drivers/vegas.c index 81bfaff86a8..de12d7253d3 100644 --- a/src/mame/drivers/vegas.c +++ b/src/mame/drivers/vegas.c @@ -1172,7 +1172,7 @@ WRITE32_MEMBER( vegas_state::nile_w ) logerror("Unexpected value: timer %d is prescaled\n", which); if (scale != 0) m_timer[which]->adjust(TIMER_PERIOD * scale, which); - if (LOG_TIMERS) logerror("Starting timer %d at a rate of %d Hz\n", which, (int)ATTOSECONDS_TO_HZ((TIMER_PERIOD * (m_nile_regs[offset + 1] + 1)).attoseconds)); + if (LOG_TIMERS) logerror("Starting timer %d at a rate of %d Hz\n", which, (int)ATTOSECONDS_TO_HZ((TIMER_PERIOD * (m_nile_regs[offset + 1] + 1)).attoseconds())); } /* timer disabled? */ @@ -1708,6 +1708,9 @@ static ADDRESS_MAP_START( vegas_map_8mb, AS_PROGRAM, 32, vegas_state ) ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x00000000, 0x007fffff) AM_RAM AM_SHARE("rambase") AM_RANGE(0x1fa00000, 0x1fa00fff) AM_READWRITE(nile_r, nile_w) AM_SHARE("nile_regs") + + AM_RANGE(0x01700000, 0x017fffff) AM_ROM AM_REGION("update", 0) + AM_RANGE(0x1fc00000, 0x1fc7ffff) AM_ROM AM_REGION("user1", 0) AM_SHARE("rombase") ADDRESS_MAP_END @@ -1716,6 +1719,10 @@ static ADDRESS_MAP_START( vegas_map_32mb, AS_PROGRAM, 32, vegas_state ) ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x00000000, 0x01ffffff) AM_RAM AM_SHARE("rambase") AM_RANGE(0x1fa00000, 0x1fa00fff) AM_READWRITE(nile_r, nile_w) AM_SHARE("nile_regs") + + + AM_RANGE(0x01700000, 0x017fffff) AM_ROM AM_REGION("update", 0) + AM_RANGE(0x1fc00000, 0x1fc7ffff) AM_ROM AM_REGION("user1", 0) AM_SHARE("rombase") ADDRESS_MAP_END @@ -2446,13 +2453,15 @@ MACHINE_CONFIG_END * *************************************/ - + // there is a socket next to the main bios roms for updates, this is what the update region is. ROM_START( gauntleg ) ROM_REGION32_LE( 0x80000, "user1", 0 ) ROM_LOAD( "legend15.bin", 0x000000, 0x80000, CRC(a8372d70) SHA1(d8cd4fd4d7007ee38bb58b5a818d0f83043d5a48) ) // EPROM Boot code. Version: Nov 17 1998 19:18:28 / 1.5 Nov 17 1998 19:21:49 + ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) + DISK_REGION( "ide:0:hdd:image" ) /* Guts 1.5 1/14/1999 Game 1/14/1999 */ DISK_IMAGE( "gauntleg", 0, SHA1(66eb70e2fba574a7abe54be8bd45310654b24b08) ) @@ -2465,9 +2474,21 @@ ROM_START( gauntleg12 ) ROM_REGION32_LE( 0x80000, "user1", 0 ) ROM_LOAD( "legend13.bin", 0x000000, 0x80000, CRC(34674c5f) SHA1(92ec1779f3ab32944cbd953b6e1889503a57794b) ) // EPROM Boot code. Version: Sep 25 1998 18:34:43 / 1.3 Sep 25 1998 18:33:45 ROM_LOAD( "legend14.bin", 0x000000, 0x80000, CRC(66869402) SHA1(bf470e0b9198b80f8baf8b9432a7e1df8c7d18ca) ) // EPROM Boot code. Version: Oct 30 1998 17:48:21 / 1.4 Oct 30 1998 17:44:29 + + ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) + ROM_SYSTEM_BIOS( 0, "noupdate", "No Update Rom" ) + + ROM_SYSTEM_BIOS( 1, "up16_1", "Disk Update 1.2 to 1.6 Step 1 of 3" ) + ROMX_LOAD("12to16.1.bin", 0x000000, 0x100000, CRC(253c6bf2) SHA1(5e129576afe2bc4c638242e010735655d269a747), ROM_BIOS(2)) + ROM_SYSTEM_BIOS( 2, "up16_2", "Disk Update 1.2 to 1.6 Step 2 of 3" ) + ROMX_LOAD("12to16.2.bin", 0x000000, 0x100000, CRC(15b1fe78) SHA1(532c4937b55befcc3a8cb25b0282d63e206fba47), ROM_BIOS(3)) + ROM_SYSTEM_BIOS( 3, "up16_3", "Disk Update 1.2 to 1.6 Step 3 of 3" ) + ROMX_LOAD("12to16.3.bin", 0x000000, 0x100000, CRC(1027e54f) SHA1(a841f5cc5b022ddfaf70c97a64d1582f0a2ca70e), ROM_BIOS(4)) + + DISK_REGION( "ide:0:hdd:image" ) /* Guts 1.4 10/22/1998 Main 10/23/1998 */ - DISK_IMAGE( "gauntl12", 0, SHA1(c8208e3ce3b02a271dc6b089efa98dd996b66ce0) ) + DISK_IMAGE( "gauntl12", 0, SHA1(62917fbd692d004bc391287349041ebe669385cf) ) // compressed with -chs 4969,16,63 (which is apparently correct for a Quantum FIREBALL 2.5 GB and allows the update program to work) ROM_REGION16_LE( 0x10000, "dcs", 0 ) /* Vegas SIO boot ROM */ ROM_LOAD16_BYTE( "vegassio.bin", 0x000000, 0x8000, CRC(d1470e23) SHA1(f6e8405cfa604528c0224401bc374a6df9caccef) ) @@ -2478,6 +2499,9 @@ ROM_START( gauntdl ) ROM_REGION32_LE( 0x80000, "user1", 0 ) /* EPROM 1.7 12/14/1999 */ ROM_LOAD( "gauntdl.bin", 0x000000, 0x80000, CRC(3d631518) SHA1(d7f5a3bc109a19c9c7a711d607ff87e11868b536) ) + ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) + + DISK_REGION( "ide:0:hdd:image" ) /* Guts: 1.9 3/17/2000 Game 5/9/2000 */ DISK_IMAGE( "gauntdl", 0, SHA1(ba3af48171e727c2f7232c06dcf8411cbcf14de8) ) @@ -2490,6 +2514,9 @@ ROM_START( gauntdl24 ) ROM_REGION32_LE( 0x80000, "user1", 0 ) /* EPROM 1.7 12/14/1999 */ ROM_LOAD( "gauntdl.bin", 0x000000, 0x80000, CRC(3d631518) SHA1(d7f5a3bc109a19c9c7a711d607ff87e11868b536) ) + ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) + + DISK_REGION( "ide:0:hdd:image" ) /* Guts: 1.9 3/17/2000 Game 3/19/2000 */ DISK_IMAGE( "gauntd24", 0, SHA1(3e055794d23d62680732e906cfaf9154765de698) ) @@ -2502,6 +2529,9 @@ ROM_START( warfa ) ROM_REGION32_LE( 0x80000, "user1", 0 ) /* EPROM 1.9 3/25/1999 */ ROM_LOAD( "warboot.v19", 0x000000, 0x80000, CRC(b0c095cd) SHA1(d3b8cccdca83f0ecb49aa7993864cfdaa4e5c6f0) ) + ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) + + DISK_REGION( "ide:0:hdd:image" ) /* Guts 1.3 4/20/1999 Game 4/20/1999 */ DISK_IMAGE( "warfa", 0, SHA1(87f8a8878cd6be716dbd6c68fb1bc7f564ede484) ) @@ -2509,11 +2539,28 @@ ROM_START( warfa ) ROM_LOAD16_BYTE( "warsnd.106", 0x000000, 0x8000, CRC(d1470e23) SHA1(f6e8405cfa604528c0224401bc374a6df9caccef) ) ROM_END +ROM_START( warfaa ) + ROM_REGION32_LE( 0x80000, "user1", 0 ) /* EPROM 1.6 Jan 14 1999 */ + ROM_LOAD( "warboot.v16", 0x000000, 0x80000, CRC(1c44b3a3) SHA1(e81c15d7c9bc19078787d39c7f5e48eab003c5f4) ) + + ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) + + + DISK_REGION( "ide:0:hdd:image" ) /* GUTS 1.1 Mar 16 1999, GAME Mar 16 1999 */ + DISK_IMAGE( "warfaa", 0, SHA1(b443ba68003f8492e5c20156e0d3091fe51e9224) ) + + ROM_REGION16_LE( 0x10000, "dcs", 0 ) /* Vegas SIO boot ROM */ + ROM_LOAD16_BYTE( "warsnd.106", 0x000000, 0x8000, CRC(d1470e23) SHA1(f6e8405cfa604528c0224401bc374a6df9caccef) ) +ROM_END + ROM_START( tenthdeg ) ROM_REGION32_LE( 0x80000, "user1", 0 ) ROM_LOAD( "tenthdeg.bio", 0x000000, 0x80000, CRC(1cd2191b) SHA1(a40c48f3d6a9e2760cec809a79a35abe762da9ce) ) + ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) + + DISK_REGION( "ide:0:hdd:image" ) /* Guts 5/26/1998 Main 8/25/1998 */ DISK_IMAGE( "tenthdeg", 0, SHA1(41a1a045a2d118cf6235be2cc40bf16dbb8be5d1) ) @@ -2526,6 +2573,9 @@ ROM_START( roadburn ) ROM_REGION32_LE( 0x80000, "user1", 0 ) /* EPROM 2.6 4/22/1999 */ ROM_LOAD( "rbmain.bin", 0x000000, 0x80000, CRC(060e1aa8) SHA1(2a1027d209f87249fe143500e721dfde7fb5f3bc) ) + ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) + + DISK_REGION( "ide:0:hdd:image" ) /* Guts 4/22/1999 Game 4/22/1999 */ DISK_IMAGE( "roadburn", 0, SHA1(a62870cceafa6357d7d3505aca250c3f16087566) ) ROM_END @@ -2535,6 +2585,9 @@ ROM_START( nbashowt ) ROM_REGION32_LE( 0x80000, "user1", 0 ) ROM_LOAD( "showtime_mar15_1999.u27", 0x000000, 0x80000, CRC(ff5d620d) SHA1(8f07567929f40a2269a42495dfa9dd5edef688fe) ) // 16:09:14 Mar 15 1999 BIOS FOR SHOWTIME USING BANSHEE / 16:09:01 Mar 15 1999. POST FOR SHOWTIME USING BANSHEE + ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) + + DISK_REGION( "ide:0:hdd:image" ) // various strings from this image // SHOWTIME REV 2.0 @@ -2553,6 +2606,9 @@ ROM_START( nbanfl ) // ROM_LOAD( "bootnflnba.bin", 0x000000, 0x80000, CRC(3def7053) SHA1(8f07567929f40a2269a42495dfa9dd5edef688fe) ) // 1 byte different to above (0x51b95 is 0x1b instead of 0x18) ROM_LOAD( "blitz00_nov30_1999.u27", 0x000000, 0x80000, CRC(4242bf14) SHA1(c1fcec67d7463df5f41afc89f22c3b4484279534) ) // 15:10:49 Nov 30 1999 BIOS FOR BLITZ00 USING BANSHEE / 15:10:43 Nov 30 1999 POST FOR BLITZ00 USING BANSHEE + ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) + + DISK_REGION( "ide:0:hdd:image" ) // various strings from this image //NBA SHOWTIME 2.1 @@ -2570,6 +2626,9 @@ ROM_START( nbagold ) ROM_REGION32_LE( 0x80000, "user1", 0 ) ROM_LOAD( "nbagold_jan10_2000.u27", 0x000000, 0x80000, CRC(6768e802) SHA1(d994e3efe14f57e261841134ddd1489fa67d418b) ) // 11:29:11 Jan 10 2000. BIOS FOR NBAGOLD USING BANSHEE / 11:23:58 Jan 10 2000. POST FOR NBAGOLD USING BANSHEE + ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) + + DISK_REGION( "ide:0:hdd:image" ) // various strings from this image //NBA SHOWTIME GOLD 3.00 @@ -2593,6 +2652,9 @@ ROM_START( cartfury ) ROM_REGION32_LE( 0x80000, "user1", 0 ) ROM_LOAD( "cart_mar8_2000.u27", 0x000000, 0x80000, CRC(c44550a2) SHA1(ad30f1c3382ff2f5902a4cbacbb1f0c4e37f42f9) ) // 10:40:17 Mar 8 2000 BIOS FOR CART USING VOODOO3 / 10:39:55 Mar 8 2000 POST FOR CART USING VOODOO3 + ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) + + DISK_REGION( "ide:0:hdd:image" ) DISK_IMAGE( "cartfury", 0, SHA1(4c5bc2803297ea9a191bbd8b002d0e46b4ae1563) ) @@ -2605,6 +2667,9 @@ ROM_START( sf2049 ) ROM_REGION32_LE( 0x80000, "user1", 0 ) /* EPROM 1.02 7/9/1999 */ ROM_LOAD( "sf2049.u27", 0x000000, 0x80000, CRC(174ba8fe) SHA1(baba83b811eca659f00514a008a86ef0ac9680ee) ) + ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) + + DISK_REGION( "ide:0:hdd:image" ) /* Guts 1.03 9/3/1999 Game 9/8/1999 */ DISK_IMAGE( "sf2049", 0, SHA1(9e0661b8566a6c78d18c59c11cd3a6628d025405) ) ROM_END @@ -2614,6 +2679,9 @@ ROM_START( sf2049se ) ROM_REGION32_LE( 0x80000, "user1", 0 ) ROM_LOAD( "sf2049se.u27", 0x000000, 0x80000, CRC(da4ecd9c) SHA1(2574ff3d608ebcc59a63cf6dea13ee7650ae8921) ) + ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) + + DISK_REGION( "ide:0:hdd:image" ) DISK_IMAGE( "sf2049se", 0, SHA1(7b27a8ce2a953050ce267548bb7160b41f3e8054) ) ROM_END @@ -2623,6 +2691,9 @@ ROM_START( sf2049te ) ROM_REGION32_LE( 0x80000, "user1", 0 ) ROM_LOAD( "sf2049te.u27", 0x000000, 0x80000, CRC(cc7c8601) SHA1(3f37dbd1b32b3ac5caa300725468e8e426f0fb83) ) + ROM_REGION32_LE( 0x100000, "update", ROMREGION_ERASEFF ) + + DISK_REGION( "ide:0:hdd:image" ) DISK_IMAGE( "sf2049te", 0, SHA1(625aa36436587b7bec3e7db1d19793b760e2ea51) ) ROM_END @@ -2722,7 +2793,9 @@ GAME( 1998, tenthdeg, 0, tenthdeg, tenthdeg, vegas_state, tenthdeg, RO /* Durango + Vegas SIO + Voodoo 2 */ GAME( 1999, gauntdl, 0, gauntdl, gauntdl, vegas_state, gauntdl, ROT0, "Midway Games", "Gauntlet Dark Legacy (version DL 2.52)", MACHINE_SUPPORTS_SAVE ) GAME( 1999, gauntdl24,gauntdl, gauntdl, gauntdl, vegas_state, gauntdl, ROT0, "Midway Games", "Gauntlet Dark Legacy (version DL 2.4)", MACHINE_SUPPORTS_SAVE ) -GAME( 1999, warfa, 0, warfa, warfa, vegas_state, warfa, ROT0, "Atari Games", "War: The Final Assault", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) +GAME( 1999, warfa, 0, warfa, warfa, vegas_state, warfa, ROT0, "Atari Games", "War: The Final Assault (EPROM 1.9 Mar 25 1999, GUTS 1.3 Apr 20 1999, GAME Apr 20 1999)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) +GAME( 1999, warfaa, warfa, warfa, warfa, vegas_state, warfa, ROT0, "Atari Games", "War: The Final Assault (EPROM 1.6 Jan 14 1999, GUTS 1.1 Mar 16 1999, GAME Mar 16 1999)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) + /* Durango + DSIO + Voodoo 2 */ GAME( 1999, roadburn, 0, roadburn, roadburn, vegas_state, roadburn, ROT0, "Atari Games", "Road Burners", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/xmen.c b/src/mame/drivers/xmen.c index 000a4fba7e4..f0cac836222 100644 --- a/src/mame/drivers/xmen.c +++ b/src/mame/drivers/xmen.c @@ -83,15 +83,9 @@ WRITE16_MEMBER(xmen_state::xmen_18fa00_w) } } -void xmen_state::sound_reset_bank() -{ - membank("bank4")->set_entry(m_sound_curbank & 0x07); -} - WRITE8_MEMBER(xmen_state::sound_bankswitch_w) { - m_sound_curbank = data; - sound_reset_bank(); + m_z80bank->set_entry(data & 0x07); } @@ -118,7 +112,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, xmen_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank4") + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("z80bank") AM_RANGE(0xc000, 0xdfff) AM_RAM AM_RANGE(0xe000, 0xe22f) AM_DEVREADWRITE("k054539", k054539_device, read, write) AM_RANGE(0xe800, 0xe801) AM_MIRROR(0x0400) AM_DEVREADWRITE("ymsnd", ym2151_device, read, write) @@ -282,17 +276,13 @@ INPUT_PORTS_END void xmen_state::machine_start() { - UINT8 *ROM = memregion("audiocpu")->base(); - - membank("bank4")->configure_entries(0, 8, &ROM[0x10000], 0x4000); - membank("bank4")->set_entry(0); + m_z80bank->configure_entries(0, 8, memregion("audiocpu")->base(), 0x4000); + m_z80bank->set_entry(0); - save_item(NAME(m_sound_curbank)); save_item(NAME(m_sprite_colorbase)); save_item(NAME(m_layer_colorbase)); save_item(NAME(m_layerpri)); save_item(NAME(m_vblank_irq_mask)); - machine().save().register_postload(save_prepost_delegate(FUNC(xmen_state::sound_reset_bank), this)); } void xmen_state::machine_reset() @@ -306,7 +296,6 @@ void xmen_state::machine_reset() } m_sprite_colorbase = 0; - m_sound_curbank = 0; m_vblank_irq_mask = 0; } @@ -501,9 +490,8 @@ ROM_START( xmen ) ROM_LOAD16_BYTE( "065-a02.9d", 0x80000, 0x40000, CRC(b31dc44c) SHA1(4bdac05826b4d6d4fe46686ede5190e2f73eefc5) ) ROM_LOAD16_BYTE( "065-a03.9f", 0x80001, 0x40000, CRC(13842fe6) SHA1(b61f094eb94336edb8708d3437ead9b853b2d6e6) ) - ROM_REGION( 0x30000, "audiocpu", 0 ) /* 64k+128k for sound cpu */ + ROM_REGION( 0x20000, "audiocpu", 0 ) ROM_LOAD( "065-a01.6f", 0x00000, 0x20000, CRC(147d3a4d) SHA1(a14409fe991e803b9e7812303e3a9ebd857d8b01) ) - ROM_RELOAD( 0x10000, 0x20000 ) ROM_REGION( 0x200000, "k052109", 0 ) /* tiles */ ROM_LOAD32_WORD( "065-a08.15l", 0x000000, 0x100000, CRC(6b649aca) SHA1(2595f314517738e8614facf578cc951a6c36a180) ) @@ -529,9 +517,8 @@ ROM_START( xmenj ) ROM_LOAD16_BYTE( "065-a02.9d", 0x80000, 0x40000, CRC(b31dc44c) SHA1(4bdac05826b4d6d4fe46686ede5190e2f73eefc5) ) ROM_LOAD16_BYTE( "065-a03.9f", 0x80001, 0x40000, CRC(13842fe6) SHA1(b61f094eb94336edb8708d3437ead9b853b2d6e6) ) - ROM_REGION( 0x30000, "audiocpu", 0 ) /* 64k+128k for sound cpu */ + ROM_REGION( 0x20000, "audiocpu", 0 ) ROM_LOAD( "065-a01.6f", 0x00000, 0x20000, CRC(147d3a4d) SHA1(a14409fe991e803b9e7812303e3a9ebd857d8b01) ) - ROM_RELOAD( 0x10000, 0x20000 ) ROM_REGION( 0x200000, "k052109", 0 ) /* tiles */ ROM_LOAD32_WORD( "065-a08.15l", 0x000000, 0x100000, CRC(6b649aca) SHA1(2595f314517738e8614facf578cc951a6c36a180) ) @@ -557,9 +544,8 @@ ROM_START( xmene ) ROM_LOAD16_BYTE( "065-a02.9d", 0x80000, 0x40000, CRC(b31dc44c) SHA1(4bdac05826b4d6d4fe46686ede5190e2f73eefc5) ) ROM_LOAD16_BYTE( "065-a03.9f", 0x80001, 0x40000, CRC(13842fe6) SHA1(b61f094eb94336edb8708d3437ead9b853b2d6e6) ) - ROM_REGION( 0x30000, "audiocpu", 0 ) /* 64k+128k for sound cpu */ + ROM_REGION( 0x20000, "audiocpu", 0 ) ROM_LOAD( "065-a01.6f", 0x00000, 0x20000, CRC(147d3a4d) SHA1(a14409fe991e803b9e7812303e3a9ebd857d8b01) ) - ROM_RELOAD( 0x10000, 0x20000 ) ROM_REGION( 0x200000, "k052109", 0 ) /* tiles */ ROM_LOAD32_WORD( "065-a08.15l", 0x000000, 0x100000, CRC(6b649aca) SHA1(2595f314517738e8614facf578cc951a6c36a180) ) @@ -585,9 +571,8 @@ ROM_START( xmena ) ROM_LOAD16_BYTE( "065-a02.9d", 0x80000, 0x40000, CRC(b31dc44c) SHA1(4bdac05826b4d6d4fe46686ede5190e2f73eefc5) ) ROM_LOAD16_BYTE( "065-a03.9f", 0x80001, 0x40000, CRC(13842fe6) SHA1(b61f094eb94336edb8708d3437ead9b853b2d6e6) ) - ROM_REGION( 0x30000, "audiocpu", 0 ) /* 64k+128k for sound cpu */ + ROM_REGION( 0x20000, "audiocpu", 0 ) ROM_LOAD( "065-a01.6f", 0x00000, 0x20000, CRC(147d3a4d) SHA1(a14409fe991e803b9e7812303e3a9ebd857d8b01) ) - ROM_RELOAD( 0x10000, 0x20000 ) ROM_REGION( 0x200000, "k052109", 0 ) /* tiles */ ROM_LOAD32_WORD( "065-a08.15l", 0x000000, 0x100000, CRC(6b649aca) SHA1(2595f314517738e8614facf578cc951a6c36a180) ) @@ -613,9 +598,8 @@ ROM_START( xmenaa ) ROM_LOAD16_BYTE( "065-a02.9d", 0x80000, 0x40000, CRC(b31dc44c) SHA1(4bdac05826b4d6d4fe46686ede5190e2f73eefc5) ) ROM_LOAD16_BYTE( "065-a03.9f", 0x80001, 0x40000, CRC(13842fe6) SHA1(b61f094eb94336edb8708d3437ead9b853b2d6e6) ) - ROM_REGION( 0x30000, "audiocpu", 0 ) /* 64k+128k for sound cpu */ + ROM_REGION( 0x20000, "audiocpu", 0 ) ROM_LOAD( "065-a01.6f", 0x00000, 0x20000, CRC(147d3a4d) SHA1(a14409fe991e803b9e7812303e3a9ebd857d8b01) ) - ROM_RELOAD( 0x10000, 0x20000 ) ROM_REGION( 0x200000, "k052109", 0 ) /* tiles */ ROM_LOAD32_WORD( "065-a08.15l", 0x000000, 0x100000, CRC(6b649aca) SHA1(2595f314517738e8614facf578cc951a6c36a180) ) @@ -641,9 +625,8 @@ ROM_START( xmen2pe ) ROM_LOAD16_BYTE( "065-a02.9d", 0x80000, 0x40000, CRC(b31dc44c) SHA1(4bdac05826b4d6d4fe46686ede5190e2f73eefc5) ) ROM_LOAD16_BYTE( "065-a03.9f", 0x80001, 0x40000, CRC(13842fe6) SHA1(b61f094eb94336edb8708d3437ead9b853b2d6e6) ) - ROM_REGION( 0x30000, "audiocpu", 0 ) /* 64k+128k for sound cpu */ + ROM_REGION( 0x20000, "audiocpu", 0 ) ROM_LOAD( "065-a01.6f", 0x00000, 0x20000, CRC(147d3a4d) SHA1(a14409fe991e803b9e7812303e3a9ebd857d8b01) ) - ROM_RELOAD( 0x10000, 0x20000 ) ROM_REGION( 0x200000, "k052109", 0 ) /* tiles */ ROM_LOAD32_WORD( "065-a08.15l", 0x000000, 0x100000, CRC(6b649aca) SHA1(2595f314517738e8614facf578cc951a6c36a180) ) @@ -669,9 +652,8 @@ ROM_START( xmen2pu ) ROM_LOAD16_BYTE( "065-a02.9d", 0x80000, 0x40000, CRC(b31dc44c) SHA1(4bdac05826b4d6d4fe46686ede5190e2f73eefc5) ) ROM_LOAD16_BYTE( "065-a03.9f", 0x80001, 0x40000, CRC(13842fe6) SHA1(b61f094eb94336edb8708d3437ead9b853b2d6e6) ) - ROM_REGION( 0x30000, "audiocpu", 0 ) /* 64k+128k for sound cpu */ + ROM_REGION( 0x20000, "audiocpu", 0 ) ROM_LOAD( "065-a01.6f", 0x00000, 0x20000, CRC(147d3a4d) SHA1(a14409fe991e803b9e7812303e3a9ebd857d8b01) ) - ROM_RELOAD( 0x10000, 0x20000 ) ROM_REGION( 0x200000, "k052109", 0 ) /* tiles */ ROM_LOAD32_WORD( "065-a08.15l", 0x000000, 0x100000, CRC(6b649aca) SHA1(2595f314517738e8614facf578cc951a6c36a180) ) @@ -697,9 +679,8 @@ ROM_START( xmen2pa ) ROM_LOAD16_BYTE( "065-a02.9d", 0x80000, 0x40000, CRC(b31dc44c) SHA1(4bdac05826b4d6d4fe46686ede5190e2f73eefc5) ) ROM_LOAD16_BYTE( "065-a03.9f", 0x80001, 0x40000, CRC(13842fe6) SHA1(b61f094eb94336edb8708d3437ead9b853b2d6e6) ) - ROM_REGION( 0x30000, "audiocpu", 0 ) /* 64k+128k for sound cpu */ + ROM_REGION( 0x20000, "audiocpu", 0 ) ROM_LOAD( "065-a01.6f", 0x00000, 0x20000, CRC(147d3a4d) SHA1(a14409fe991e803b9e7812303e3a9ebd857d8b01) ) - ROM_RELOAD( 0x10000, 0x20000 ) ROM_REGION( 0x200000, "k052109", 0 ) /* tiles */ ROM_LOAD32_WORD( "065-a08.15l", 0x000000, 0x100000, CRC(6b649aca) SHA1(2595f314517738e8614facf578cc951a6c36a180) ) @@ -725,9 +706,8 @@ ROM_START( xmen2pj ) ROM_LOAD16_BYTE( "065-a02.9d", 0x80000, 0x40000, CRC(b31dc44c) SHA1(4bdac05826b4d6d4fe46686ede5190e2f73eefc5) ) ROM_LOAD16_BYTE( "065-a03.9f", 0x80001, 0x40000, CRC(13842fe6) SHA1(b61f094eb94336edb8708d3437ead9b853b2d6e6) ) - ROM_REGION( 0x30000, "audiocpu", 0 ) /* 64k+128k for sound cpu */ + ROM_REGION( 0x20000, "audiocpu", 0 ) ROM_LOAD( "065-a01.6f", 0x00000, 0x20000, CRC(147d3a4d) SHA1(a14409fe991e803b9e7812303e3a9ebd857d8b01) ) - ROM_RELOAD( 0x10000, 0x20000 ) ROM_REGION( 0x200000, "k052109", 0 ) /* tiles */ ROM_LOAD32_WORD( "065-a08.15l", 0x000000, 0x100000, CRC(6b649aca) SHA1(2595f314517738e8614facf578cc951a6c36a180) ) @@ -807,9 +787,8 @@ ROM_START( xmen6p ) ROM_LOAD16_BYTE( "065-a02.17g", 0x80000, 0x40000, CRC(b31dc44c) SHA1(4bdac05826b4d6d4fe46686ede5190e2f73eefc5) ) ROM_LOAD16_BYTE( "065-a03.17j", 0x80001, 0x40000, CRC(13842fe6) SHA1(b61f094eb94336edb8708d3437ead9b853b2d6e6) ) - ROM_REGION( 0x30000, "audiocpu", 0 ) /* 64k+128k for sound cpu */ + ROM_REGION( 0x20000, "audiocpu", 0 ) ROM_LOAD( "065-a01.7b", 0x00000, 0x20000, CRC(147d3a4d) SHA1(a14409fe991e803b9e7812303e3a9ebd857d8b01) ) - ROM_RELOAD( 0x10000, 0x20000 ) ROM_REGION( 0x200000, "k052109", 0 ) /* tiles */ ROM_LOAD32_WORD( "065-a08.1l", 0x000000, 0x100000, CRC(6b649aca) SHA1(2595f314517738e8614facf578cc951a6c36a180) ) @@ -835,9 +814,8 @@ ROM_START( xmen6pu ) ROM_LOAD16_BYTE( "065-a02.17g", 0x80000, 0x40000, CRC(b31dc44c) SHA1(4bdac05826b4d6d4fe46686ede5190e2f73eefc5) ) ROM_LOAD16_BYTE( "065-a03.17j", 0x80001, 0x40000, CRC(13842fe6) SHA1(b61f094eb94336edb8708d3437ead9b853b2d6e6) ) - ROM_REGION( 0x30000, "audiocpu", 0 ) /* 64k+128k for sound cpu */ + ROM_REGION( 0x20000, "audiocpu", 0 ) ROM_LOAD( "065-a01.7b", 0x00000, 0x20000, CRC(147d3a4d) SHA1(a14409fe991e803b9e7812303e3a9ebd857d8b01) ) - ROM_RELOAD( 0x10000, 0x20000 ) ROM_REGION( 0x200000, "k052109", 0 ) /* tiles */ ROM_LOAD32_WORD( "065-a08.1l", 0x000000, 0x100000, CRC(6b649aca) SHA1(2595f314517738e8614facf578cc951a6c36a180) ) diff --git a/src/mame/drivers/xxmissio.c b/src/mame/drivers/xxmissio.c index 2e3c02ee7f8..b826848f1d5 100644 --- a/src/mame/drivers/xxmissio.c +++ b/src/mame/drivers/xxmissio.c @@ -270,7 +270,6 @@ static MACHINE_CONFIG_START( xxmissio, xxmissio_state ) MCFG_QUANTUM_TIME(attotime::from_hz(6000)) - /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -282,8 +281,7 @@ static MACHINE_CONFIG_START( xxmissio, xxmissio_state ) MCFG_GFXDECODE_ADD("gfxdecode", "palette", xxmissio) MCFG_PALETTE_ADD("palette", 768) - MCFG_PALETTE_FORMAT(BBGGRRII) - + MCFG_PALETTE_FORMAT_CLASS(1, xxmissio_state, BBGGRRII) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") diff --git a/src/mame/etc/template_driver.c b/src/mame/etc/template_driver.c index 40d40704c9e..168bfc6c837 100644 --- a/src/mame/etc/template_driver.c +++ b/src/mame/etc/template_driver.c @@ -190,4 +190,4 @@ ROM_END // For a generic system: // SYST(YEAR,NAME,PARENT,COMPAT,MACHINE,INPUT,CLASS,INIT,COMPANY,FULLNAME,FLAGS) -GAME( 198?, xxx, 0, xxx, xxx, driver_device, 0, ROT0, "<template_manufacturer>", "<template_machinename>", GAME_IS_SKELETON ) +GAME( 198?, xxx, 0, xxx, xxx, driver_device, 0, ROT0, "<template_manufacturer>", "<template_machinename>", MACHINE_IS_SKELETON ) diff --git a/src/mame/includes/8080bw.h b/src/mame/includes/8080bw.h index 2c8da3f42ea..8dcbdef4fb4 100644 --- a/src/mame/includes/8080bw.h +++ b/src/mame/includes/8080bw.h @@ -127,6 +127,7 @@ public: DECLARE_MACHINE_START(claybust); DECLARE_PALETTE_INIT(rollingc); + DECLARE_PALETTE_INIT(sflush); UINT32 screen_update_invadpt2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); UINT32 screen_update_cosmo(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); @@ -150,12 +151,9 @@ public: DECLARE_WRITE8_MEMBER(polaris_sh_port_3_w); void schaser_reinit_555_time_remain(); - void invadpt2_get_pens( pen_t *pens ); - void sflush_get_pens( pen_t *pens ); - void cosmo_get_pens( pen_t *pens ); - inline void set_pixel( bitmap_rgb32 &bitmap, UINT8 y, UINT8 x, const pen_t *pens, UINT8 color ); - inline void set_8_pixels( bitmap_rgb32 &bitmap, UINT8 y, UINT8 x, UINT8 data, const pen_t *pens, UINT8 fore_color, UINT8 back_color ); - void clear_extra_columns( bitmap_rgb32 &bitmap, const pen_t *pens, UINT8 color ); + inline void set_pixel( bitmap_rgb32 &bitmap, UINT8 y, UINT8 x, int color ); + inline void set_8_pixels( bitmap_rgb32 &bitmap, UINT8 y, UINT8 x, UINT8 data, int fore_color, int back_color ); + void clear_extra_columns( bitmap_rgb32 &bitmap, int color ); void invmulti_bankswitch_restore(); }; diff --git a/src/mame/includes/88games.h b/src/mame/includes/88games.h index f2ebec8ac88..bdf62a239ed 100644 --- a/src/mame/includes/88games.h +++ b/src/mame/includes/88games.h @@ -29,9 +29,6 @@ public: /* video-related */ int m_k88games_priority; - int m_layer_colorbase[3]; - int m_sprite_colorbase; - int m_zoom_colorbase; int m_videobank; int m_zoomreadroms; int m_speech_chip; diff --git a/src/mame/includes/aerofgt.h b/src/mame/includes/aerofgt.h index 47a77b6d8bf..194640f805c 100644 --- a/src/mame/includes/aerofgt.h +++ b/src/mame/includes/aerofgt.h @@ -35,7 +35,6 @@ public: optional_shared_ptr<UINT16> m_spriteram2; required_shared_ptr<UINT16> m_spriteram3; optional_shared_ptr<UINT16> m_tx_tilemap_ram; -// UINT16 * m_paletteram; // currently this uses generic palette handling /* devices referenced above */ optional_device<vsystem_spr_device> m_spr; // only the aerofgt parent uses this chip diff --git a/src/mame/includes/ajax.h b/src/mame/includes/ajax.h index f576bbefba2..e8197eea633 100644 --- a/src/mame/includes/ajax.h +++ b/src/mame/includes/ajax.h @@ -21,13 +21,7 @@ public: m_k051316(*this, "k051316"), m_palette(*this, "palette") { } - /* memory pointers */ -// UINT8 * m_paletteram; // currently this uses generic palette handling - /* video-related */ - int m_layer_colorbase[3]; - int m_sprite_colorbase; - int m_zoom_colorbase; UINT8 m_priority; /* misc */ @@ -52,9 +46,7 @@ public: DECLARE_WRITE8_MEMBER(k007232_extvol_w); virtual void machine_start(); virtual void machine_reset(); - virtual void video_start(); UINT32 screen_update_ajax(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(ajax_interrupt); DECLARE_WRITE8_MEMBER(volume_callback0); DECLARE_WRITE8_MEMBER(volume_callback1); K051316_CB_MEMBER(zoom_callback); diff --git a/src/mame/includes/aliens.h b/src/mame/includes/aliens.h index f4b32aa50ea..6e21270c068 100644 --- a/src/mame/includes/aliens.h +++ b/src/mame/includes/aliens.h @@ -10,7 +10,6 @@ #include "sound/k007232.h" #include "video/k052109.h" #include "video/k051960.h" -#include "video/konami_helper.h" class aliens_state : public driver_device { @@ -22,11 +21,8 @@ public: m_bank0000(*this, "bank0000"), m_k007232(*this, "k007232"), m_k052109(*this, "k052109"), - m_k051960(*this, "k051960") { } - - /* video-related */ - int m_layer_colorbase[3]; - int m_sprite_colorbase; + m_k051960(*this, "k051960"), + m_rombank(*this, "rombank") { } /* devices */ required_device<cpu_device> m_maincpu; @@ -35,6 +31,8 @@ public: required_device<k007232_device> m_k007232; required_device<k052109_device> m_k052109; required_device<k051960_device> m_k051960; + required_memory_bank m_rombank; + DECLARE_WRITE8_MEMBER(aliens_coin_counter_w); DECLARE_WRITE8_MEMBER(aliens_sh_irqtrigger_w); DECLARE_READ8_MEMBER(k052109_051960_r); @@ -42,9 +40,7 @@ public: DECLARE_WRITE8_MEMBER(aliens_snd_bankswitch_w); virtual void machine_start(); virtual void machine_reset(); - virtual void video_start(); UINT32 screen_update_aliens(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(aliens_interrupt); DECLARE_WRITE8_MEMBER(volume_callback); K052109_CB_MEMBER(tile_callback); K051960_CB_MEMBER(sprite_callback); diff --git a/src/mame/includes/amiga.h b/src/mame/includes/amiga.h index 2858f47ce27..efefd00c58d 100644 --- a/src/mame/includes/amiga.h +++ b/src/mame/includes/amiga.h @@ -352,6 +352,7 @@ public: m_p1_mouse_y(*this, "p1_mouse_y"), m_p2_mouse_x(*this, "p2_mouse_x"), m_p2_mouse_y(*this, "p2_mouse_y"), + m_hvpos(*this, "HVPOS"), m_chip_ram_mask(0), m_cia_0_irq(0), m_cia_1_irq(0), @@ -580,6 +581,7 @@ protected: optional_ioport m_p1_mouse_y; optional_ioport m_p2_mouse_x; optional_ioport m_p2_mouse_y; + optional_ioport m_hvpos; memory_array m_chip_ram; UINT32 m_chip_ram_mask; @@ -660,6 +662,8 @@ private: void serial_adjust(); void serial_shift(); void rx_write(amiga_state *state, int level); + + UINT32 amiga_gethvpos(); }; @@ -675,7 +679,6 @@ extern const UINT16 amiga_expand_byte[256]; void amiga_copper_setpc(running_machine &machine, UINT32 pc); int amiga_copper_execute_next(running_machine &machine, int xpos); -UINT32 amiga_gethvpos(screen_device &screen); void amiga_set_genlock_color(running_machine &machine, UINT16 color); void amiga_sprite_dma_reset(running_machine &machine, int which); void amiga_sprite_enable_comparitor(running_machine &machine, int which, int enable); diff --git a/src/mame/includes/amspdwy.h b/src/mame/includes/amspdwy.h index 4cc765c7876..e851882d26e 100644 --- a/src/mame/includes/amspdwy.h +++ b/src/mame/includes/amspdwy.h @@ -48,7 +48,6 @@ public: DECLARE_READ8_MEMBER(amspdwy_wheel_0_r); DECLARE_READ8_MEMBER(amspdwy_wheel_1_r); DECLARE_WRITE8_MEMBER(amspdwy_sound_w); - DECLARE_WRITE8_MEMBER(amspdwy_paletteram_w); DECLARE_WRITE8_MEMBER(amspdwy_flipscreen_w); DECLARE_WRITE8_MEMBER(amspdwy_videoram_w); DECLARE_WRITE8_MEMBER(amspdwy_colorram_w); diff --git a/src/mame/includes/aquarium.h b/src/mame/includes/aquarium.h index 19218015471..8b3bb94e32f 100644 --- a/src/mame/includes/aquarium.h +++ b/src/mame/includes/aquarium.h @@ -24,7 +24,6 @@ public: required_shared_ptr<UINT16> m_bak_videoram; required_shared_ptr<UINT16> m_txt_videoram; required_shared_ptr<UINT16> m_scroll; -// UINT16 * m_paletteram; // currently this uses generic palette handling /* video-related */ tilemap_t *m_txt_tilemap; diff --git a/src/mame/includes/armedf.h b/src/mame/includes/armedf.h index b534441aa39..4934f2d6d00 100644 --- a/src/mame/includes/armedf.h +++ b/src/mame/includes/armedf.h @@ -33,7 +33,6 @@ public: required_shared_ptr<UINT16> m_fg_videoram; required_shared_ptr<UINT16> m_bg_videoram; UINT16 m_legion_cmd[4]; // legionjb only! -// UINT16 * m_paletteram; // currently this uses generic palette handling /* video-related */ tilemap_t *m_bg_tilemap; diff --git a/src/mame/includes/ashnojoe.h b/src/mame/includes/ashnojoe.h index 6cf2dc1748a..eb166ff953d 100644 --- a/src/mame/includes/ashnojoe.h +++ b/src/mame/includes/ashnojoe.h @@ -35,7 +35,6 @@ public: required_shared_ptr<UINT16> m_tileram_7; required_shared_ptr<UINT16> m_tileram; required_shared_ptr<UINT16> m_tilemap_reg; -// UINT16 * m_paletteram; // currently this uses generic palette handling /* video-related */ tilemap_t *m_joetilemap; diff --git a/src/mame/includes/asterix.h b/src/mame/includes/asterix.h index 6bc29450828..62755366d58 100644 --- a/src/mame/includes/asterix.h +++ b/src/mame/includes/asterix.h @@ -26,9 +26,6 @@ public: m_k053244(*this, "k053244"), m_k053251(*this, "k053251") { } - /* memory pointers */ -// UINT16 * m_paletteram; // currently this uses generic palette handling - /* video-related */ int m_sprite_colorbase; int m_layer_colorbase[4]; diff --git a/src/mame/includes/astrocde.h b/src/mame/includes/astrocde.h index fe2c249de99..9469edd8b4c 100644 --- a/src/mame/includes/astrocde.h +++ b/src/mame/includes/astrocde.h @@ -5,6 +5,7 @@ Bally Astrocade-based hardware ***************************************************************************/ +#include "machine/bankdev.h" #include "sound/astrocde.h" #include "sound/samples.h" #include "sound/votrax.h" @@ -37,7 +38,24 @@ public: m_astrocade_sound1(*this, "astrocade1"), m_videoram(*this, "videoram"), m_protected_ram(*this, "protected_ram"), - m_screen(*this, "screen") { } + m_screen(*this, "screen"), + m_bank4000(*this, "bank4000"), + m_bank8000(*this, "bank8000"), + m_p1handle(*this, "P1HANDLE"), + m_p2handle(*this, "P2HANDLE"), + m_p3handle(*this, "P3HANDLE"), + m_p4handle(*this, "P4HANDLE"), + m_keypad0(*this, "KEYPAD0"), + m_keypad1(*this, "KEYPAD1"), + m_keypad2(*this, "KEYPAD2"), + m_keypad3(*this, "KEYPAD3"), + m_p1_knob(*this, "P1_KNOB"), + m_p2_knob(*this, "P2_KNOB"), + m_p3_knob(*this, "P3_KNOB"), + m_p4_knob(*this, "P4_KNOB"), + m_trackball(*this, trackball_inputs), + m_joystick(*this, joystick_inputs) + { } required_device<cpu_device> m_maincpu; optional_device<cpu_device> m_subcpu; @@ -47,6 +65,24 @@ public: optional_shared_ptr<UINT8> m_videoram; optional_shared_ptr<UINT8> m_protected_ram; required_device<screen_device> m_screen; + optional_device<address_map_bank_device> m_bank4000; + optional_memory_bank m_bank8000; + optional_ioport m_p1handle; + optional_ioport m_p2handle; + optional_ioport m_p3handle; + optional_ioport m_p4handle; + optional_ioport m_keypad0; + optional_ioport m_keypad1; + optional_ioport m_keypad2; + optional_ioport m_keypad3; + optional_ioport m_p1_knob; + optional_ioport m_p2_knob; + optional_ioport m_p3_knob; + optional_ioport m_p4_knob; + DECLARE_IOPORT_ARRAY(trackball_inputs); + optional_ioport_array<4> m_trackball; + DECLARE_IOPORT_ARRAY(joystick_inputs); + optional_ioport_array<2> m_joystick; UINT8 m_video_config; UINT8 m_sparkle[4]; @@ -58,7 +94,6 @@ public: UINT8 m_port_2_last; UINT8 m_ram_write_enable; UINT8 m_input_select; - UINT8 m_profpac_bank; UINT8 *m_sparklestar; UINT8 m_interrupt_enabl; UINT8 m_interrupt_vector; @@ -112,6 +147,7 @@ public: DECLARE_READ8_MEMBER(profpac_io_1_r); DECLARE_READ8_MEMBER(profpac_io_2_r); DECLARE_WRITE8_MEMBER(profpac_banksw_w); + DECLARE_WRITE8_MEMBER(demndrgn_banksw_w); DECLARE_READ8_MEMBER(demndrgn_io_r); DECLARE_WRITE8_MEMBER(demndrgn_sound_w); DECLARE_WRITE8_MEMBER(tenpindx_sound_w); @@ -147,7 +183,6 @@ public: UINT32 screen_update_astrocde(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_profpac(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_CALLBACK_MEMBER(scanline_callback); - void profbank_banksw_restore(); inline int mame_vpos_to_astrocade_vpos(int scanline); void init_savestate(); void astrocade_trigger_lightpen(UINT8 vfeedback, UINT8 hfeedback); diff --git a/src/mame/includes/asuka.h b/src/mame/includes/asuka.h index 9c0f1fdb8b7..f98fe0c9627 100644 --- a/src/mame/includes/asuka.h +++ b/src/mame/includes/asuka.h @@ -31,9 +31,6 @@ public: m_tc0110pcr(*this, "tc0110pcr"), m_tc0220ioc(*this, "tc0220ioc") { } - /* memory pointers */ -// UINT16 * paletteram; // this currently uses generic palette handlers - /* video-related */ UINT16 m_video_ctrl; UINT16 m_video_mask; diff --git a/src/mame/includes/atarisy2.h b/src/mame/includes/atarisy2.h index 17ed588662a..39b4e8348ce 100644 --- a/src/mame/includes/atarisy2.h +++ b/src/mame/includes/atarisy2.h @@ -25,7 +25,6 @@ public: m_alpha_tilemap(*this, "alpha"), m_rombank1(*this, "rombank1"), m_rombank2(*this, "rombank2"), - m_generic_paletteram_16(*this, "paletteram"), m_slapstic(*this, "slapstic") { } @@ -50,7 +49,6 @@ public: required_memory_bank m_rombank1; required_memory_bank m_rombank2; - required_shared_ptr<UINT16> m_generic_paletteram_16; required_device<atari_slapstic_device> m_slapstic; UINT8 m_sound_reset_state; @@ -112,7 +110,7 @@ public: DECLARE_WRITE16_MEMBER(yscroll_w); DECLARE_WRITE16_MEMBER(xscroll_w); DECLARE_WRITE16_MEMBER(videoram_w); - DECLARE_WRITE16_MEMBER(paletteram_w); + DECLARE_PALETTE_DECODER(RRRRGGGGBBBBIIII); static const atari_motion_objects_config s_mob_config; }; diff --git a/src/mame/includes/battlnts.h b/src/mame/includes/battlnts.h index 7caaedbcb47..8b65ea88388 100644 --- a/src/mame/includes/battlnts.h +++ b/src/mame/includes/battlnts.h @@ -23,7 +23,6 @@ public: /* video-related */ int m_spritebank; - int m_layer_colorbase[2]; /* devices */ required_device<cpu_device> m_maincpu; diff --git a/src/mame/includes/bionicc.h b/src/mame/includes/bionicc.h index 1fd57dd5e7c..67912af61ab 100644 --- a/src/mame/includes/bionicc.h +++ b/src/mame/includes/bionicc.h @@ -18,7 +18,6 @@ public: m_txvideoram(*this, "txvideoram"), m_fgvideoram(*this, "fgvideoram"), m_bgvideoram(*this, "bgvideoram"), - m_paletteram(*this, "paletteram"), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), @@ -30,7 +29,6 @@ public: required_shared_ptr<UINT16> m_txvideoram; required_shared_ptr<UINT16> m_fgvideoram; required_shared_ptr<UINT16> m_bgvideoram; - required_shared_ptr<UINT16> m_paletteram; /* video-related */ tilemap_t *m_tx_tilemap; @@ -49,7 +47,6 @@ public: DECLARE_WRITE16_MEMBER(bionicc_bgvideoram_w); DECLARE_WRITE16_MEMBER(bionicc_fgvideoram_w); DECLARE_WRITE16_MEMBER(bionicc_txvideoram_w); - DECLARE_WRITE16_MEMBER(bionicc_paletteram_w); DECLARE_WRITE16_MEMBER(bionicc_scroll_w); DECLARE_WRITE16_MEMBER(bionicc_gfxctrl_w); TILE_GET_INFO_MEMBER(get_bg_tile_info); @@ -58,6 +55,7 @@ public: virtual void machine_start(); virtual void machine_reset(); virtual void video_start(); + DECLARE_PALETTE_DECODER(RRRRGGGGBBBBIIII); UINT32 screen_update_bionicc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_DEVICE_CALLBACK_MEMBER(bionicc_scanline); required_device<cpu_device> m_maincpu; diff --git a/src/mame/includes/bishi.h b/src/mame/includes/bishi.h index 215d61962de..d07c2881928 100644 --- a/src/mame/includes/bishi.h +++ b/src/mame/includes/bishi.h @@ -30,7 +30,6 @@ public: /* memory pointers */ UINT8 * m_ram; -// UINT8 * m_paletteram; // currently this uses generic palette handling /* video-related */ int m_layer_colorbase[4]; diff --git a/src/mame/includes/bladestl.h b/src/mame/includes/bladestl.h index 6988eb2b797..5eac667b587 100644 --- a/src/mame/includes/bladestl.h +++ b/src/mame/includes/bladestl.h @@ -45,7 +45,6 @@ public: /* video-related */ int m_spritebank; - int m_layer_colorbase[2]; /* misc */ int m_last_track[4]; diff --git a/src/mame/includes/blktiger.h b/src/mame/includes/blktiger.h index 46429897ed0..73f83ce0190 100644 --- a/src/mame/includes/blktiger.h +++ b/src/mame/includes/blktiger.h @@ -24,8 +24,6 @@ public: /* memory pointers */ required_device<buffered_spriteram8_device> m_spriteram; required_shared_ptr<UINT8> m_txvideoram; -// UINT8 * m_paletteram; // currently this uses generic palette handling -// UINT8 * m_paletteram2; // currently this uses generic palette handling /* video-related */ tilemap_t *m_tx_tilemap; diff --git a/src/mame/includes/blockhl.h b/src/mame/includes/blockhl.h deleted file mode 100644 index a6b01c412d5..00000000000 --- a/src/mame/includes/blockhl.h +++ /dev/null @@ -1,56 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nicola Salmoria -/************************************************************************* - - Block Hole - -*************************************************************************/ - -#include "video/k052109.h" -#include "video/k051960.h" -#include "video/konami_helper.h" - -class blockhl_state : public driver_device -{ -public: - blockhl_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_ram(*this, "ram"), - m_maincpu(*this, "maincpu"), - m_audiocpu(*this, "audiocpu"), - m_k052109(*this, "k052109"), - m_k051960(*this, "k051960"), - m_palette(*this, "palette") { } - - /* memory pointers */ - required_shared_ptr<UINT8> m_ram; - std::vector<UINT8> m_paletteram; - - /* video-related */ - int m_layer_colorbase[3]; - int m_sprite_colorbase; - - /* misc */ - int m_palette_selected; - int m_rombank; - - /* devices */ - required_device<cpu_device> m_maincpu; - required_device<cpu_device> m_audiocpu; - required_device<k052109_device> m_k052109; - required_device<k051960_device> m_k051960; - required_device<palette_device> m_palette; - DECLARE_READ8_MEMBER(bankedram_r); - DECLARE_WRITE8_MEMBER(bankedram_w); - DECLARE_WRITE8_MEMBER(blockhl_sh_irqtrigger_w); - DECLARE_READ8_MEMBER(k052109_051960_r); - DECLARE_WRITE8_MEMBER(k052109_051960_w); - virtual void machine_start(); - virtual void machine_reset(); - virtual void video_start(); - UINT32 screen_update_blockhl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(blockhl_interrupt); - K052109_CB_MEMBER(tile_callback); - K051960_CB_MEMBER(sprite_callback); - DECLARE_WRITE8_MEMBER(banking_callback); -}; diff --git a/src/mame/includes/bogeyman.h b/src/mame/includes/bogeyman.h index 2b21fc3b918..0be085af765 100644 --- a/src/mame/includes/bogeyman.h +++ b/src/mame/includes/bogeyman.h @@ -37,7 +37,6 @@ public: required_shared_ptr<UINT8> m_colorram; required_shared_ptr<UINT8> m_colorram2; required_shared_ptr<UINT8> m_spriteram; -// UINT8 * m_paletteram; // currently this uses generic palette handling /* video-related */ tilemap_t *m_bg_tilemap; @@ -54,7 +53,6 @@ public: DECLARE_WRITE8_MEMBER(colorram_w); DECLARE_WRITE8_MEMBER(videoram2_w); DECLARE_WRITE8_MEMBER(colorram2_w); - DECLARE_WRITE8_MEMBER(paletteram_w); DECLARE_WRITE8_MEMBER(colbank_w); TILE_GET_INFO_MEMBER(get_bg_tile_info); diff --git a/src/mame/includes/bottom9.h b/src/mame/includes/bottom9.h index d038e07b4d6..66ace28ab83 100644 --- a/src/mame/includes/bottom9.h +++ b/src/mame/includes/bottom9.h @@ -25,11 +25,6 @@ public: m_k051316(*this, "k051316"), m_palette(*this, "palette") { } - /* video-related */ - int m_layer_colorbase[3]; - int m_sprite_colorbase; - int m_zoom_colorbase; - /* misc */ int m_video_enable; int m_zoomreadroms; @@ -58,7 +53,6 @@ public: DECLARE_WRITE8_MEMBER(sound_bank_w); virtual void machine_start(); virtual void machine_reset(); - virtual void video_start(); UINT32 screen_update_bottom9(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(bottom9_interrupt); INTERRUPT_GEN_MEMBER(bottom9_sound_interrupt); diff --git a/src/mame/includes/btime.h b/src/mame/includes/btime.h index 592a18f058d..fbda90ffd2d 100644 --- a/src/mame/includes/btime.h +++ b/src/mame/includes/btime.h @@ -14,7 +14,6 @@ public: m_rambase(*this, "rambase"), m_videoram(*this, "videoram"), m_colorram(*this, "colorram"), - m_paletteram(*this, "palette"), m_bnj_backgroundram(*this, "bnj_bgram"), m_zoar_scrollram(*this, "zoar_scrollram"), m_lnc_charbank(*this, "lnc_charbank"), @@ -31,7 +30,6 @@ public: optional_shared_ptr<UINT8> m_rambase; required_shared_ptr<UINT8> m_videoram; required_shared_ptr<UINT8> m_colorram; - optional_shared_ptr<UINT8> m_paletteram; optional_shared_ptr<UINT8> m_bnj_backgroundram; optional_shared_ptr<UINT8> m_zoar_scrollram; optional_shared_ptr<UINT8> m_lnc_charbank; @@ -78,7 +76,6 @@ public: DECLARE_READ8_MEMBER(wtennis_reset_hack_r); DECLARE_READ8_MEMBER(mmonkey_protection_r); DECLARE_WRITE8_MEMBER(mmonkey_protection_w); - DECLARE_WRITE8_MEMBER(btime_paletteram_w); DECLARE_WRITE8_MEMBER(lnc_videoram_w); DECLARE_READ8_MEMBER(btime_mirrorvideoram_r); DECLARE_READ8_MEMBER(btime_mirrorcolorram_r); diff --git a/src/mame/includes/bublbobl.h b/src/mame/includes/bublbobl.h index 61a18a94ca8..e1899c08086 100644 --- a/src/mame/includes/bublbobl.h +++ b/src/mame/includes/bublbobl.h @@ -26,7 +26,6 @@ public: required_shared_ptr<UINT8> m_videoram; required_shared_ptr<UINT8> m_objectram; optional_shared_ptr<UINT8> m_mcu_sharedram; -// UINT8 * paletteram; // currently this uses generic palette handling /* video-related */ int m_video_enable; diff --git a/src/mame/includes/cbasebal.h b/src/mame/includes/cbasebal.h index 5c9428de199..c21728a45dc 100644 --- a/src/mame/includes/cbasebal.h +++ b/src/mame/includes/cbasebal.h @@ -18,7 +18,6 @@ public: /* memory pointers */ required_shared_ptr<UINT8> m_spriteram; -// UINT8 * m_paletteram; // currently this uses generic palette handling /* video-related */ tilemap_t *m_fg_tilemap; diff --git a/src/mame/includes/chqflag.h b/src/mame/includes/chqflag.h index 22127cce04b..79b9aca8f9d 100644 --- a/src/mame/includes/chqflag.h +++ b/src/mame/includes/chqflag.h @@ -28,10 +28,6 @@ public: m_palette(*this, "palette"), m_rombank(*this, "rombank") { } - /* video-related */ - int m_zoom_colorbase[2]; - int m_sprite_colorbase; - /* misc */ int m_k051316_readroms; int m_last_vreg; @@ -64,9 +60,7 @@ public: DECLARE_WRITE8_MEMBER(k007232_extvolume_w); virtual void machine_start(); virtual void machine_reset(); - virtual void video_start(); UINT32 screen_update_chqflag(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_DEVICE_CALLBACK_MEMBER(chqflag_scanline); DECLARE_WRITE8_MEMBER(volume_callback0); DECLARE_WRITE8_MEMBER(volume_callback1); K051316_CB_MEMBER(zoom_callback_1); diff --git a/src/mame/includes/citycon.h b/src/mame/includes/citycon.h index 4204710e97a..aaf9a33e836 100644 --- a/src/mame/includes/citycon.h +++ b/src/mame/includes/citycon.h @@ -24,7 +24,6 @@ public: required_shared_ptr<UINT8> m_linecolor; required_shared_ptr<UINT8> m_spriteram; required_shared_ptr<UINT8> m_scroll; -// UINT8 * m_paletteram; // currently this uses generic palette handling /* video-related */ tilemap_t *m_bg_tilemap; diff --git a/src/mame/includes/crimfght.h b/src/mame/includes/crimfght.h index 2e3acc50625..70b96323d40 100644 --- a/src/mame/includes/crimfght.h +++ b/src/mame/includes/crimfght.h @@ -5,11 +5,10 @@ Crime Fighters *************************************************************************/ -#include "cpu/m6809/konami.h" +#include "machine/bankdev.h" #include "sound/k007232.h" #include "video/k052109.h" #include "video/k051960.h" -#include "video/konami_helper.h" class crimfght_state : public driver_device { @@ -18,37 +17,39 @@ public: : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), + m_bank0000(*this, "bank0000"), m_k007232(*this, "k007232"), m_k052109(*this, "k052109"), m_k051960(*this, "k051960"), - m_palette(*this, "palette") { } - - /* memory pointers */ - std::vector<UINT8> m_paletteram; - - /* video-related */ - int m_layer_colorbase[3]; - int m_sprite_colorbase; + m_palette(*this, "palette"), + m_rombank(*this, "rombank") { } /* devices */ required_device<cpu_device> m_maincpu; required_device<cpu_device> m_audiocpu; + required_device<address_map_bank_device> m_bank0000; required_device<k007232_device> m_k007232; required_device<k052109_device> m_k052109; required_device<k051960_device> m_k051960; required_device<palette_device> m_palette; + required_memory_bank m_rombank; DECLARE_WRITE8_MEMBER(crimfght_coin_w); - DECLARE_WRITE8_MEMBER(crimfght_sh_irqtrigger_w); + DECLARE_WRITE8_MEMBER(sound_w); DECLARE_READ8_MEMBER(k052109_051960_r); DECLARE_WRITE8_MEMBER(k052109_051960_w); - DECLARE_WRITE8_MEMBER(crimfght_snd_bankswitch_w); + IRQ_CALLBACK_MEMBER(audiocpu_irq_ack); + DECLARE_WRITE8_MEMBER(ym2151_ct_w); virtual void machine_start(); - virtual void video_start(); UINT32 screen_update_crimfght(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(crimfght_interrupt); DECLARE_WRITE8_MEMBER(volume_callback); K052109_CB_MEMBER(tile_callback); K051960_CB_MEMBER(sprite_callback); DECLARE_WRITE8_MEMBER(banking_callback); + DECLARE_CUSTOM_INPUT_MEMBER(system_r); + +private: + int m_woco; + int m_rmrd; + int m_init; }; diff --git a/src/mame/includes/crospang.h b/src/mame/includes/crospang.h index ab60e145d4f..a314a1347eb 100644 --- a/src/mame/includes/crospang.h +++ b/src/mame/includes/crospang.h @@ -25,7 +25,6 @@ public: required_shared_ptr<UINT16> m_bg_videoram; required_shared_ptr<UINT16> m_spriteram; optional_device<decospr_device> m_sprgen; -// UINT16 * m_paletteram; // currently this uses generic palette handling /* video-related */ tilemap_t *m_bg_layer; diff --git a/src/mame/includes/crshrace.h b/src/mame/includes/crshrace.h index 4569196d4e6..f377019864d 100644 --- a/src/mame/includes/crshrace.h +++ b/src/mame/includes/crshrace.h @@ -34,8 +34,6 @@ public: required_device<buffered_spriteram16_device> m_spriteram2; required_device<vsystem_spr_device> m_spr; - // UINT16 * m_paletteram; // currently this uses generic palette handling - /* video-related */ tilemap_t *m_tilemap1; tilemap_t *m_tilemap2; diff --git a/src/mame/includes/dbz.h b/src/mame/includes/dbz.h index 7063cf4ac07..358b3a65e99 100644 --- a/src/mame/includes/dbz.h +++ b/src/mame/includes/dbz.h @@ -33,7 +33,6 @@ public: /* memory pointers */ required_shared_ptr<UINT16> m_bg1_videoram; required_shared_ptr<UINT16> m_bg2_videoram; -// UINT16 * m_paletteram; // currently this uses generic palette handling /* video-related */ tilemap_t *m_bg1_tilemap; diff --git a/src/mame/includes/dec8.h b/src/mame/includes/dec8.h index d59022f0224..2c7d4a05315 100644 --- a/src/mame/includes/dec8.h +++ b/src/mame/includes/dec8.h @@ -52,8 +52,6 @@ public: UINT8 * m_pf1_data; UINT8 * m_row; -// UINT8 * m_paletteram; // currently this uses generic palette handling -// UINT8 * m_paletteram_2; // currently this uses generic palette handling UINT16 m_buffered_spriteram16[0x800/2]; // for the mxc06 sprite chip emulation (oscar, cobra) /* video-related */ diff --git a/src/mame/includes/dietgo.h b/src/mame/includes/dietgo.h index 12c47ebf49e..3b3871b8ead 100644 --- a/src/mame/includes/dietgo.h +++ b/src/mame/includes/dietgo.h @@ -34,7 +34,6 @@ public: required_shared_ptr<UINT16> m_pf2_rowscroll; required_shared_ptr<UINT16> m_spriteram; optional_device<decospr_device> m_sprgen; -// UINT16 * m_paletteram; // currently this uses generic palette handling (in decocomn.c) /* devices */ required_device<cpu_device> m_maincpu; diff --git a/src/mame/includes/djmain.h b/src/mame/includes/djmain.h index 975b2f34dae..9b1bb3a0b97 100644 --- a/src/mame/includes/djmain.h +++ b/src/mame/includes/djmain.h @@ -16,8 +16,7 @@ public: m_k055555(*this, "k055555"), m_ata(*this, "ata"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"), - m_generic_paletteram_32(*this, "paletteram") + m_palette(*this, "palette") { } @@ -32,7 +31,6 @@ public: const UINT8 *m_ata_user_password; const UINT8 *m_ata_master_password; required_shared_ptr<UINT32> m_obj_ram; - DECLARE_WRITE32_MEMBER(paletteram32_w); DECLARE_WRITE32_MEMBER(sndram_bank_w); DECLARE_READ32_MEMBER(sndram_r); DECLARE_WRITE32_MEMBER(sndram_w); @@ -76,6 +74,5 @@ public: required_device<ata_interface_device> m_ata; required_device<gfxdecode_device> m_gfxdecode; required_device<palette_device> m_palette; - required_shared_ptr<UINT32> m_generic_paletteram_32; K056832_CB_MEMBER(tile_callback); }; diff --git a/src/mame/includes/dogfgt.h b/src/mame/includes/dogfgt.h index aa614bf9b29..ba6f48a99f8 100644 --- a/src/mame/includes/dogfgt.h +++ b/src/mame/includes/dogfgt.h @@ -23,7 +23,6 @@ public: required_shared_ptr<UINT8> m_bgvideoram; required_shared_ptr<UINT8> m_spriteram; required_shared_ptr<UINT8> m_sharedram; -// UINT8 * m_paletteram; // currently this uses generic palette handling /* video-related */ bitmap_ind16 m_pixbitmap; diff --git a/src/mame/includes/drgnmst.h b/src/mame/includes/drgnmst.h index 65e67b5ed1b..00ccb915410 100644 --- a/src/mame/includes/drgnmst.h +++ b/src/mame/includes/drgnmst.h @@ -31,7 +31,6 @@ public: required_shared_ptr<UINT16> m_rowscrollram; required_shared_ptr<UINT16> m_vidregs2; required_shared_ptr<UINT16> m_spriteram; -// UINT16 * m_paletteram; // currently this uses generic palette handling /* video-related */ tilemap_t *m_bg_tilemap; diff --git a/src/mame/includes/dynduke.h b/src/mame/includes/dynduke.h index 4a8e84bcdff..43f75f66567 100644 --- a/src/mame/includes/dynduke.h +++ b/src/mame/includes/dynduke.h @@ -16,8 +16,7 @@ public: m_scroll_ram(*this, "scroll_ram"), m_videoram(*this, "videoram"), m_back_data(*this, "back_data"), - m_fore_data(*this, "fore_data"), - m_generic_paletteram_16(*this, "paletteram") { } + m_fore_data(*this, "fore_data") { } required_device<cpu_device> m_maincpu; required_device<seibu_sound_device> m_seibu_sound; @@ -29,7 +28,6 @@ public: required_shared_ptr<UINT16> m_videoram; required_shared_ptr<UINT16> m_back_data; required_shared_ptr<UINT16> m_fore_data; - required_shared_ptr<UINT16> m_generic_paletteram_16; tilemap_t *m_bg_layer; tilemap_t *m_fg_layer; @@ -43,7 +41,6 @@ public: int m_old_back; int m_old_fore; - DECLARE_WRITE16_MEMBER(paletteram_w); DECLARE_WRITE16_MEMBER(background_w); DECLARE_WRITE16_MEMBER(foreground_w); DECLARE_WRITE16_MEMBER(text_w); diff --git a/src/mame/includes/esd16.h b/src/mame/includes/esd16.h index bf8ab730fa2..47cf740c227 100644 --- a/src/mame/includes/esd16.h +++ b/src/mame/includes/esd16.h @@ -38,7 +38,6 @@ public: required_shared_ptr<UINT16> m_head_layersize; required_shared_ptr<UINT16> m_headpanic_platform_x; required_shared_ptr<UINT16> m_headpanic_platform_y; -// UINT16 * m_paletteram; // currently this uses generic palette handling /* video-related */ tilemap_t *m_tilemap_0_16x16; diff --git a/src/mame/includes/f1gp.h b/src/mame/includes/f1gp.h index 52e61091c95..ac790335d6f 100644 --- a/src/mame/includes/f1gp.h +++ b/src/mame/includes/f1gp.h @@ -54,7 +54,6 @@ public: UINT16 * m_zoomdata; -// UINT16 * m_paletteram; // currently this uses generic palette handling /* video-related */ tilemap_t *m_fg_tilemap; diff --git a/src/mame/includes/fantland.h b/src/mame/includes/fantland.h index f998ff48644..bce1ffa5140 100644 --- a/src/mame/includes/fantland.h +++ b/src/mame/includes/fantland.h @@ -22,7 +22,6 @@ public: /* memory pointers */ // UINT8 * m_spriteram; // currently directly used in a 16bit map... // UINT8 * m_spriteram_2; // currently directly used in a 16bit map... -// UINT8 * m_paletteram; // currently this uses generic palette handling /* misc */ UINT8 m_nmi_enable; diff --git a/src/mame/includes/fitfight.h b/src/mame/includes/fitfight.h index 3eab210bf59..6a19912d763 100644 --- a/src/mame/includes/fitfight.h +++ b/src/mame/includes/fitfight.h @@ -31,7 +31,6 @@ public: required_shared_ptr<UINT16> m_fof_mid_tileram; required_shared_ptr<UINT16> m_fof_txt_tileram; required_shared_ptr<UINT16> m_spriteram; -// UINT16 * m_paletteram; // currently this uses generic palette handling /* video-related */ tilemap_t *m_fof_bak_tilemap; diff --git a/src/mame/includes/flkatck.h b/src/mame/includes/flkatck.h index e85534ab84b..1aaac47e1cf 100644 --- a/src/mame/includes/flkatck.h +++ b/src/mame/includes/flkatck.h @@ -22,7 +22,6 @@ public: /* memory pointers */ required_shared_ptr<UINT8> m_k007121_ram; -// UINT8 * paletteram; // this currently uses generic palette handling /* video-related */ tilemap_t *m_k007121_tilemap[2]; diff --git a/src/mame/includes/flstory.h b/src/mame/includes/flstory.h index 932efe566cf..31afbdde494 100644 --- a/src/mame/includes/flstory.h +++ b/src/mame/includes/flstory.h @@ -23,8 +23,6 @@ public: required_shared_ptr<UINT8> m_spriteram; required_shared_ptr<UINT8> m_scrlram; optional_shared_ptr<UINT8> m_workram; -// UINT8 * m_paletteram; // currently this uses generic palette handling -// UINT8 * m_paletteram_2; // currently this uses generic palette handling /* video-related */ tilemap_t *m_bg_tilemap; diff --git a/src/mame/includes/fromance.h b/src/mame/includes/fromance.h index e71682ca514..30e7b0ec204 100644 --- a/src/mame/includes/fromance.h +++ b/src/mame/includes/fromance.h @@ -29,7 +29,6 @@ public: /* memory pointers (used by pipedrm) */ optional_shared_ptr<UINT8> m_videoram; optional_shared_ptr<UINT8> m_spriteram; -// UINT8 * m_paletteram; // currently this uses generic palette handling optional_device<vsystem_spr2_device> m_spr_old; // only used by pipe dream, split this state up and clean things... diff --git a/src/mame/includes/funkyjet.h b/src/mame/includes/funkyjet.h index 08e8413ec54..c26956d5886 100644 --- a/src/mame/includes/funkyjet.h +++ b/src/mame/includes/funkyjet.h @@ -32,7 +32,6 @@ public: required_shared_ptr<UINT16> m_pf1_rowscroll; required_shared_ptr<UINT16> m_pf2_rowscroll; optional_device<decospr_device> m_sprgen; -// UINT16 * paletteram; // currently this uses generic palette handling (in decocomn.c) /* devices */ required_device<cpu_device> m_maincpu; diff --git a/src/mame/includes/gaelco.h b/src/mame/includes/gaelco.h index bb59e7c009b..cf73224941d 100644 --- a/src/mame/includes/gaelco.h +++ b/src/mame/includes/gaelco.h @@ -25,7 +25,6 @@ public: required_shared_ptr<UINT16> m_vregs; required_shared_ptr<UINT16> m_spriteram; optional_shared_ptr<UINT16> m_screenram; -// UINT16 * paletteram; // currently this uses generic palette handling /* video-related */ tilemap_t *m_tilemap[2]; diff --git a/src/mame/includes/gaelco2.h b/src/mame/includes/gaelco2.h index 32d71355cc8..ca0e5affccc 100644 --- a/src/mame/includes/gaelco2.h +++ b/src/mame/includes/gaelco2.h @@ -27,33 +27,21 @@ public: required_device<palette_device> m_palette; required_shared_ptr<UINT16> m_generic_paletteram_16; - int m_clr_gun_int; - UINT8 m_analog_ports[2]; UINT16 *m_videoram; tilemap_t *m_pant[2]; int m_dual_monitor; - DECLARE_READ16_MEMBER(p1_gun_x); - DECLARE_READ16_MEMBER(p1_gun_y); - DECLARE_READ16_MEMBER(p2_gun_x); - DECLARE_READ16_MEMBER(p2_gun_y); DECLARE_READ16_MEMBER(dallas_kludge_r); DECLARE_WRITE16_MEMBER(gaelco2_coin_w); DECLARE_WRITE16_MEMBER(gaelco2_coin2_w); - DECLARE_WRITE16_MEMBER(wrally2_coin_w); DECLARE_WRITE16_MEMBER(touchgo_coin_w); - DECLARE_WRITE16_MEMBER(bang_clr_gun_int_w); - DECLARE_WRITE16_MEMBER(wrally2_adc_clk); - DECLARE_WRITE16_MEMBER(wrally2_adc_cs); DECLARE_READ16_MEMBER(snowboar_protection_r); DECLARE_WRITE16_MEMBER(snowboar_protection_w); DECLARE_WRITE16_MEMBER(gaelco2_vram_w); DECLARE_WRITE16_MEMBER(gaelco2_palette_w); - DECLARE_CUSTOM_INPUT_MEMBER(wrally2_analog_bit_r); DECLARE_DRIVER_INIT(touchgo); DECLARE_DRIVER_INIT(snowboar); DECLARE_DRIVER_INIT(alighunt); - DECLARE_DRIVER_INIT(bang); TILE_GET_INFO_MEMBER(get_tile_info_gaelco2_screen0); TILE_GET_INFO_MEMBER(get_tile_info_gaelco2_screen1); TILE_GET_INFO_MEMBER(get_tile_info_gaelco2_screen0_dual); @@ -63,7 +51,6 @@ public: UINT32 screen_update_gaelco2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_gaelco2_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_gaelco2_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_DEVICE_CALLBACK_MEMBER(bang_irq); DECLARE_WRITE16_MEMBER(gaelco2_eeprom_cs_w); DECLARE_WRITE16_MEMBER(gaelco2_eeprom_sk_w); DECLARE_WRITE16_MEMBER(gaelco2_eeprom_data_w); @@ -71,3 +58,53 @@ public: UINT32 dual_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int index); void gaelco2_ROM16_split_gfx(const char *src_reg, const char *dst_reg, int start, int length, int dest1, int dest2); }; + + +class bang_state : public gaelco2_state +{ +public: + bang_state(const machine_config &mconfig, device_type type, const char *tag) + : gaelco2_state(mconfig, type, tag) + , m_light0_x(*this, "LIGHT0_X") + , m_light0_y(*this, "LIGHT0_Y") + , m_light1_x(*this, "LIGHT1_X") + , m_light1_y(*this, "LIGHT1_Y") + {} + + required_ioport m_light0_x; + required_ioport m_light0_y; + required_ioport m_light1_x; + required_ioport m_light1_y; + + int m_clr_gun_int; + + DECLARE_READ16_MEMBER(p1_gun_x); + DECLARE_READ16_MEMBER(p1_gun_y); + DECLARE_READ16_MEMBER(p2_gun_x); + DECLARE_READ16_MEMBER(p2_gun_y); + DECLARE_WRITE16_MEMBER(bang_clr_gun_int_w); + TIMER_DEVICE_CALLBACK_MEMBER(bang_irq); + DECLARE_DRIVER_INIT(bang); +}; + + +class wrally2_state : public gaelco2_state +{ +public: + wrally2_state(const machine_config &mconfig, device_type type, const char *tag) + : gaelco2_state(mconfig, type, tag) + , m_analog0(*this, "ANALOG0") + , m_analog1(*this, "ANALOG1") + {} + + required_ioport m_analog0; + required_ioport m_analog1; + + UINT8 m_analog_ports[2]; + + DECLARE_WRITE16_MEMBER(wrally2_coin_w); + DECLARE_WRITE16_MEMBER(wrally2_adc_clk); + DECLARE_WRITE16_MEMBER(wrally2_adc_cs); + DECLARE_CUSTOM_INPUT_MEMBER(wrally2_analog_bit_r); +}; + diff --git a/src/mame/includes/galpanic.h b/src/mame/includes/galpanic.h index 19ebd232858..788ca087540 100644 --- a/src/mame/includes/galpanic.h +++ b/src/mame/includes/galpanic.h @@ -14,7 +14,6 @@ public: m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), m_palette(*this, "palette"), - m_generic_paletteram_16(*this, "paletteram"), m_pandora(*this, "pandora") { } @@ -27,7 +26,6 @@ public: required_device<gfxdecode_device> m_gfxdecode; required_device<screen_device> m_screen; required_device<palette_device> m_palette; - required_shared_ptr<UINT16> m_generic_paletteram_16; required_device<kaneko_pandora_device> m_pandora; DECLARE_WRITE16_MEMBER(galpanic_6295_bankswitch_w); @@ -38,9 +36,7 @@ public: UINT32 screen_update_galpanic(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void screen_eof_galpanic(screen_device &screen, bool state); TIMER_DEVICE_CALLBACK_MEMBER(galpanic_scanline); - void comad_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); void draw_fgbitmap(bitmap_ind16 &bitmap, const rectangle &cliprect); /*----------- defined in video/galpanic.c -----------*/ DECLARE_WRITE16_MEMBER( galpanic_bgvideoram_w ); - DECLARE_WRITE16_MEMBER( galpanic_paletteram_w ); }; diff --git a/src/mame/includes/gcpinbal.h b/src/mame/includes/gcpinbal.h index 57d0abf0eec..255b93ca4ec 100644 --- a/src/mame/includes/gcpinbal.h +++ b/src/mame/includes/gcpinbal.h @@ -37,7 +37,6 @@ public: required_device<gfxdecode_device> m_gfxdecode; required_device<palette_device> m_palette; -// UINT16 * m_paletteram; // currently this uses generic palette handling /* video-related */ tilemap_t *m_tilemap[3]; diff --git a/src/mame/includes/gijoe.h b/src/mame/includes/gijoe.h index 92ab66a86e2..8dd7b41dc8f 100644 --- a/src/mame/includes/gijoe.h +++ b/src/mame/includes/gijoe.h @@ -29,7 +29,6 @@ public: /* memory pointers */ required_shared_ptr<UINT16> m_spriteram; required_shared_ptr<UINT16> m_workram; -// UINT16 * m_paletteram; // currently this uses generic palette handling /* video-related */ int m_avac_bits[4]; diff --git a/src/mame/includes/ginganin.h b/src/mame/includes/ginganin.h index 0a0b0631489..44ae01b5503 100644 --- a/src/mame/includes/ginganin.h +++ b/src/mame/includes/ginganin.h @@ -25,7 +25,6 @@ public: required_shared_ptr<UINT16> m_spriteram; required_shared_ptr<UINT16> m_vregs; required_shared_ptr<UINT16> m_fgram; -// UINT16 * m_paletteram; // currently this uses generic palette handling /* video-related */ tilemap_t *m_bg_tilemap; diff --git a/src/mame/includes/glass.h b/src/mame/includes/glass.h index 8f2a5c5ebe9..0f77604513f 100644 --- a/src/mame/includes/glass.h +++ b/src/mame/includes/glass.h @@ -24,7 +24,6 @@ public: required_shared_ptr<UINT16> m_vregs; required_shared_ptr<UINT16> m_spriteram; required_shared_ptr<UINT16> m_mainram; -// UINT16 * m_paletteram; // currently this uses generic palette handling /* video-related */ tilemap_t *m_pant[2]; diff --git a/src/mame/includes/gng.h b/src/mame/includes/gng.h index a40e7c95188..e3f2585e3cd 100644 --- a/src/mame/includes/gng.h +++ b/src/mame/includes/gng.h @@ -24,8 +24,6 @@ public: required_device<buffered_spriteram8_device> m_spriteram; required_shared_ptr<UINT8> m_fgvideoram; required_shared_ptr<UINT8> m_bgvideoram; -// UINT8 * m_paletteram; // currently this uses generic palette handling -// UINT8 * m_paletteram2; // currently this uses generic palette handling /* video-related */ tilemap_t *m_bg_tilemap; diff --git a/src/mame/includes/goal92.h b/src/mame/includes/goal92.h index 8b816c303e7..cbe95e7346e 100644 --- a/src/mame/includes/goal92.h +++ b/src/mame/includes/goal92.h @@ -28,7 +28,6 @@ public: required_shared_ptr<UINT16> m_tx_data; required_shared_ptr<UINT16> m_spriteram; required_shared_ptr<UINT16> m_scrollram; -// UINT16 * m_paletteram; // this currently use generic palette handling UINT16 * m_buffered_spriteram; /* video-related */ diff --git a/src/mame/includes/gotcha.h b/src/mame/includes/gotcha.h index 3eaf61b4049..755759df85e 100644 --- a/src/mame/includes/gotcha.h +++ b/src/mame/includes/gotcha.h @@ -27,7 +27,6 @@ public: required_shared_ptr<UINT16> m_bgvideoram; required_shared_ptr<UINT16> m_spriteram; optional_device<decospr_device> m_sprgen; -// UINT16 * m_paletteram; // currently this uses generic palette handling /* video-related */ tilemap_t *m_bg_tilemap; diff --git a/src/mame/includes/gradius3.h b/src/mame/includes/gradius3.h index a0e8bacc159..0aa94e18fed 100644 --- a/src/mame/includes/gradius3.h +++ b/src/mame/includes/gradius3.h @@ -16,6 +16,7 @@ public: gradius3_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_gfxram(*this, "k052109"), + m_gfxrom(*this, "k051960"), m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), m_subcpu(*this, "sub"), @@ -25,10 +26,7 @@ public: /* memory pointers */ required_shared_ptr<UINT16> m_gfxram; - - /* video-related */ - int m_layer_colorbase[3]; - int m_sprite_colorbase; + required_region_ptr<UINT8> m_gfxrom; /* misc */ int m_priority; diff --git a/src/mame/includes/gumbo.h b/src/mame/includes/gumbo.h index e69653ed63c..3ee479e711d 100644 --- a/src/mame/includes/gumbo.h +++ b/src/mame/includes/gumbo.h @@ -19,7 +19,6 @@ public: /* memory pointers */ required_shared_ptr<UINT16> m_bg_videoram; required_shared_ptr<UINT16> m_fg_videoram; -// UINT16 * paletteram; // currently this uses generic palette handling /* video-related */ tilemap_t *m_bg_tilemap; diff --git a/src/mame/includes/harddriv.h b/src/mame/includes/harddriv.h index 5a1925474a4..7602b616330 100644 --- a/src/mame/includes/harddriv.h +++ b/src/mame/includes/harddriv.h @@ -59,6 +59,8 @@ public: optional_device<dac_device> m_ds3dac2; optional_device<harddriv_sound_board_device> m_harddriv_sound; optional_device<atari_jsa_base_device> m_jsa; + optional_device<screen_device> m_screen; + optional_device<mc68681_device> m_duartn68681; UINT8 m_hd34010_host_access; UINT8 m_dsk_pio_access; @@ -106,6 +108,12 @@ public: optional_shared_ptr<UINT16> m_gsp_paletteram_lo; optional_shared_ptr<UINT16> m_gsp_paletteram_hi; + required_ioport m_in0; + optional_ioport m_sw1; + required_ioport m_a80000; + optional_ioport_array<8> m_8badc; + optional_ioport_array<4> m_12badc; + /* machine state */ UINT8 m_irq_state; UINT8 m_gsp_irq_state; @@ -525,7 +533,6 @@ class racedriv_board_device_state : public harddriv_state { public: racedriv_board_device_state(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - DECLARE_WRITE_LINE_MEMBER(tx_a); protected: virtual machine_config_constructor device_mconfig_additions() const; diff --git a/src/mame/includes/himesiki.h b/src/mame/includes/himesiki.h index 5fbfcf6ecd5..7ac93031082 100644 --- a/src/mame/includes/himesiki.h +++ b/src/mame/includes/himesiki.h @@ -21,7 +21,6 @@ public: /* memory pointers */ required_shared_ptr<UINT8> m_bg_ram; required_shared_ptr<UINT8> m_spriteram; -// UINT8 * paletteram; // currently this uses generic palette handling /* video-related */ tilemap_t *m_bg_tilemap; diff --git a/src/mame/includes/hng64.h b/src/mame/includes/hng64.h index 7d8d92f1459..ed243864fe0 100644 --- a/src/mame/includes/hng64.h +++ b/src/mame/includes/hng64.h @@ -125,10 +125,7 @@ public: m_com_ram(*this, "com_ram"), m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), - m_palette(*this, "palette"), - m_generic_paletteram_32(*this, "paletteram") - - { } + m_palette(*this, "palette") { } required_device<mips3_device> m_maincpu; required_device<v53a_device> m_audiocpu; @@ -159,8 +156,6 @@ public: required_device<gfxdecode_device> m_gfxdecode; required_device<screen_device> m_screen; required_device<palette_device> m_palette; - required_shared_ptr<UINT32> m_generic_paletteram_32; - int m_mcu_type; @@ -224,7 +219,6 @@ public: DECLARE_READ8_MEMBER(hng64_com_share_r); DECLARE_WRITE8_MEMBER(hng64_com_share_mips_w); DECLARE_READ8_MEMBER(hng64_com_share_mips_r); - DECLARE_WRITE32_MEMBER(hng64_pal_w); DECLARE_READ32_MEMBER(hng64_sysregs_r); DECLARE_WRITE32_MEMBER(hng64_sysregs_w); DECLARE_READ32_MEMBER(fight_io_r); diff --git a/src/mame/includes/inufuku.h b/src/mame/includes/inufuku.h index c751434fa2b..ef0a7e407fc 100644 --- a/src/mame/includes/inufuku.h +++ b/src/mame/includes/inufuku.h @@ -24,7 +24,6 @@ public: required_shared_ptr<UINT16> m_spriteram1; required_shared_ptr<UINT16> m_spriteram2; required_device<vsystem_spr_device> m_spr; -// UINT16 * m_paletteram; // currently this uses generic palette handling /* video-related */ tilemap_t *m_bg_tilemap; diff --git a/src/mame/includes/itech8.h b/src/mame/includes/itech8.h index ee957d9c621..a35d6ffbbf8 100644 --- a/src/mame/includes/itech8.h +++ b/src/mame/includes/itech8.h @@ -7,6 +7,7 @@ **************************************************************************/ +#include "machine/ticket.h" #include "video/tlc34076.h" #include "video/tms34061.h" @@ -23,6 +24,10 @@ public: m_tms34061(*this, "tms34061"), m_tlc34076(*this, "tlc34076"), m_screen(*this, "screen"), + m_ticket(*this, "ticket"), + m_an(*this, analog_inputs), + m_fakex(*this, "FAKEX"), + m_fakey(*this, "FAKEY"), m_visarea(0, 0, 0, 0) { } enum @@ -40,6 +45,11 @@ public: required_device<tms34061_device> m_tms34061; required_device<tlc34076_device> m_tlc34076; required_device<screen_device> m_screen; + required_device<ticket_dispenser_device> m_ticket; + DECLARE_IOPORT_ARRAY(analog_inputs); + optional_ioport_array<4> m_an; + optional_ioport m_fakex; + optional_ioport m_fakey; rectangle m_visarea; diff --git a/src/mame/includes/jack.h b/src/mame/includes/jack.h index c108a89eaef..8c713856539 100644 --- a/src/mame/includes/jack.h +++ b/src/mame/includes/jack.h @@ -50,7 +50,6 @@ public: DECLARE_READ8_MEMBER(striv_question_r); DECLARE_WRITE8_MEMBER(jack_videoram_w); DECLARE_WRITE8_MEMBER(jack_colorram_w); - DECLARE_WRITE8_MEMBER(jack_paletteram_w); DECLARE_READ8_MEMBER(jack_flipscreen_r); DECLARE_WRITE8_MEMBER(jack_flipscreen_w); DECLARE_READ8_MEMBER(timer_r); diff --git a/src/mame/includes/kickgoal.h b/src/mame/includes/kickgoal.h index 24ad168b4b2..dfbe3299d22 100644 --- a/src/mame/includes/kickgoal.h +++ b/src/mame/includes/kickgoal.h @@ -32,7 +32,6 @@ public: required_shared_ptr<UINT16> m_bg2ram; required_shared_ptr<UINT16> m_scrram; required_shared_ptr<UINT16> m_spriteram; -// UINT16 * m_paletteram; // currently this uses generic palette handling /* video-related */ tilemap_t *m_fgtm; diff --git a/src/mame/includes/konamigx.h b/src/mame/includes/konamigx.h index 705d809b497..61bf5a11037 100644 --- a/src/mame/includes/konamigx.h +++ b/src/mame/includes/konamigx.h @@ -96,8 +96,6 @@ public: DECLARE_WRITE16_MEMBER(K053990_martchmp_word_w); DECLARE_WRITE32_MEMBER(fantjour_dma_w); DECLARE_WRITE32_MEMBER(konamigx_type3_psac2_bank_w); - DECLARE_WRITE32_MEMBER(konamigx_palette_w); - DECLARE_WRITE32_MEMBER(konamigx_palette2_w); DECLARE_WRITE32_MEMBER(konamigx_555_palette_w); DECLARE_WRITE32_MEMBER(konamigx_555_palette2_w); DECLARE_WRITE32_MEMBER(konamigx_tilebank_w); diff --git a/src/mame/includes/lethalj.h b/src/mame/includes/lethalj.h index ed70bdf3453..390f889ef3c 100644 --- a/src/mame/includes/lethalj.h +++ b/src/mame/includes/lethalj.h @@ -6,6 +6,9 @@ **************************************************************************/ +#include "machine/ticket.h" + + class lethalj_state : public driver_device { public: @@ -17,10 +20,24 @@ public: lethalj_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_screen(*this, "screen"), + m_ticket(*this, "ticket"), + m_paddle(*this, "PADDLE"), + m_light0_x(*this, "LIGHT0_X"), + m_light0_y(*this, "LIGHT0_Y"), + m_light1_x(*this, "LIGHT1_X"), + m_light1_y(*this, "LIGHT1_Y") + { } required_device<cpu_device> m_maincpu; required_device<screen_device> m_screen; + required_device<ticket_dispenser_device> m_ticket; + optional_ioport m_paddle; + optional_ioport m_light0_x; + optional_ioport m_light0_y; + optional_ioport m_light1_x; + optional_ioport m_light1_y; + UINT16 m_blitter_data[8]; UINT16 *m_screenram; UINT8 m_vispage; diff --git a/src/mame/includes/liberate.h b/src/mame/includes/liberate.h index 442c5ca5b70..c86a926b090 100644 --- a/src/mame/includes/liberate.h +++ b/src/mame/includes/liberate.h @@ -5,7 +5,6 @@ class liberate_state : public driver_device public: liberate_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_paletteram(*this, "paletteram"), m_bg_vram(*this, "bg_vram"), m_colorram(*this, "colorram"), m_videoram(*this, "videoram"), @@ -17,7 +16,6 @@ public: m_palette(*this, "palette"), m_decrypted_opcodes(*this, "decrypted_opcodes") { } - optional_shared_ptr<UINT8> m_paletteram; optional_shared_ptr<UINT8> m_bg_vram; /* prosport */ required_shared_ptr<UINT8> m_colorram; required_shared_ptr<UINT8> m_videoram; @@ -59,7 +57,6 @@ public: DECLARE_WRITE8_MEMBER(liberate_videoram_w); DECLARE_WRITE8_MEMBER(liberate_colorram_w); DECLARE_WRITE8_MEMBER(prosport_bg_vram_w); - DECLARE_WRITE8_MEMBER(prosport_paletteram_w); DECLARE_DRIVER_INIT(yellowcb); DECLARE_DRIVER_INIT(liberate); DECLARE_DRIVER_INIT(prosport); diff --git a/src/mame/includes/lkage.h b/src/mame/includes/lkage.h index 27bacd92fde..0df611aac37 100644 --- a/src/mame/includes/lkage.h +++ b/src/mame/includes/lkage.h @@ -20,7 +20,6 @@ public: required_shared_ptr<UINT8> m_scroll; required_shared_ptr<UINT8> m_spriteram; required_shared_ptr<UINT8> m_videoram; -// UINT8 * m_paletteram; // currently this uses generic palette handling /* video-related */ tilemap_t *m_bg_tilemap; diff --git a/src/mame/includes/lwings.h b/src/mame/includes/lwings.h index ef88429411b..51abcb98b5e 100644 --- a/src/mame/includes/lwings.h +++ b/src/mame/includes/lwings.h @@ -22,8 +22,6 @@ public: required_shared_ptr<UINT8> m_fgvideoram; required_shared_ptr<UINT8> m_bg1videoram; required_shared_ptr<UINT8> m_soundlatch2; -// UINT8 * m_paletteram; // currently this uses generic palette handling -// UINT8 * m_paletteram2; // currently this uses generic palette handling /* video-related */ tilemap_t *m_fg_tilemap; @@ -31,6 +29,7 @@ public: tilemap_t *m_bg2_tilemap; UINT8 m_bg2_image; int m_bg2_avenger_hw; + int m_spr_avenger_hw; UINT8 m_scroll_x[2]; UINT8 m_scroll_y[2]; @@ -63,8 +62,10 @@ public: virtual void machine_start(); virtual void machine_reset(); virtual void video_start(); + DECLARE_DRIVER_INIT(avengersb); DECLARE_VIDEO_START(trojan); DECLARE_VIDEO_START(avengers); + DECLARE_VIDEO_START(avengersb); UINT32 screen_update_lwings(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_trojan(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(lwings_interrupt); diff --git a/src/mame/includes/macrossp.h b/src/mame/includes/macrossp.h index aa5ab298cc0..703a327b7e0 100644 --- a/src/mame/includes/macrossp.h +++ b/src/mame/includes/macrossp.h @@ -28,10 +28,10 @@ public: m_text_linezoom(*this, "text_linezoom"), m_text_videoregs(*this, "text_videoregs"), - m_paletteram(*this, "paletteram"), m_mainram(*this, "mainram"), m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), + m_screen(*this, "screen"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette") { @@ -51,7 +51,6 @@ public: required_shared_ptr<UINT32> m_text_videoram; required_shared_ptr<UINT32> m_text_linezoom; required_shared_ptr<UINT32> m_text_videoregs; - required_shared_ptr<UINT32> m_paletteram; required_shared_ptr<UINT32> m_mainram; UINT32 * m_spriteram_old; UINT32 * m_spriteram_old2; @@ -65,20 +64,18 @@ public: /* misc */ int m_sndpending; int m_snd_toggle; - INT32 m_fade_effect; - INT32 m_old_fade; /* devices */ required_device<cpu_device> m_maincpu; required_device<cpu_device> m_audiocpu; + required_device<screen_device> m_screen; required_device<gfxdecode_device> m_gfxdecode; required_device<palette_device> m_palette; - DECLARE_WRITE32_MEMBER(paletteram32_macrossp_w); DECLARE_READ32_MEMBER(macrossp_soundstatus_r); DECLARE_WRITE32_MEMBER(macrossp_soundcmd_w); DECLARE_READ16_MEMBER(macrossp_soundcmd_r); - DECLARE_WRITE32_MEMBER(macrossp_palette_fade_w); + DECLARE_WRITE16_MEMBER(palette_fade_w); DECLARE_WRITE32_MEMBER(macrossp_speedup_w); DECLARE_WRITE32_MEMBER(quizmoon_speedup_w); DECLARE_WRITE32_MEMBER(macrossp_scra_videoram_w); @@ -96,9 +93,7 @@ public: virtual void video_start(); UINT32 screen_update_macrossp(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); void screen_eof_macrossp(screen_device &screen, bool state); - void draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, int priority ); - void draw_layer( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int layer, int line ); - void sortlayers(int *layer,int *pri); - void update_colors( ); + void draw_sprites(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + void draw_layer(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int layer, int linem, int pri); DECLARE_WRITE_LINE_MEMBER(irqhandler); }; diff --git a/src/mame/includes/madmotor.h b/src/mame/includes/madmotor.h index 67f1a821fae..ec815c94bb8 100644 --- a/src/mame/includes/madmotor.h +++ b/src/mame/includes/madmotor.h @@ -24,7 +24,6 @@ public: /* memory pointers */ required_shared_ptr<UINT16> m_spriteram; -// UINT16 * m_paletteram; // this currently uses generic palette handlers /* video-related */ int m_flipscreen; diff --git a/src/mame/includes/mainevt.h b/src/mame/includes/mainevt.h index c8b92ff3eed..f68af5e78b8 100644 --- a/src/mame/includes/mainevt.h +++ b/src/mame/includes/mainevt.h @@ -22,14 +22,8 @@ public: m_upd7759(*this, "upd"), m_k007232(*this, "k007232"), m_k052109(*this, "k052109"), - m_k051960(*this, "k051960") { } - - /* memory pointers */ -// UINT8 * m_paletteram; // currently this uses generic palette handling - - /* video-related */ - int m_layer_colorbase[3]; - int m_sprite_colorbase; + m_k051960(*this, "k051960"), + m_rombank(*this, "rombank") { } /* misc */ int m_nmi_enable; @@ -42,6 +36,9 @@ public: required_device<k007232_device> m_k007232; required_device<k052109_device> m_k052109; required_device<k051960_device> m_k051960; + + required_memory_bank m_rombank; + DECLARE_WRITE8_MEMBER(dv_nmienable_w); DECLARE_WRITE8_MEMBER(mainevt_bankswitch_w); DECLARE_WRITE8_MEMBER(mainevt_coin_w); @@ -55,8 +52,6 @@ public: DECLARE_WRITE8_MEMBER(dv_sh_bankswitch_w); virtual void machine_start(); virtual void machine_reset(); - DECLARE_VIDEO_START(mainevt); - DECLARE_VIDEO_START(dv); UINT32 screen_update_mainevt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_dv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(mainevt_interrupt); diff --git a/src/mame/includes/mcatadv.h b/src/mame/includes/mcatadv.h index 5c7f5bf1cb0..81ddb102175 100644 --- a/src/mame/includes/mcatadv.h +++ b/src/mame/includes/mcatadv.h @@ -26,7 +26,6 @@ public: UINT16 * m_spriteram_old; required_shared_ptr<UINT16> m_vidregs; UINT16 * m_vidregs_old; -// UINT16 * m_paletteram; // this currently uses generic palette handlers /* video-related */ tilemap_t *m_tilemap1; diff --git a/src/mame/includes/mcr68.h b/src/mame/includes/mcr68.h index 2115cbd2df1..86485c7ed81 100644 --- a/src/mame/includes/mcr68.h +++ b/src/mame/includes/mcr68.h @@ -28,8 +28,7 @@ public: m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), - m_palette(*this, "palette"), - m_generic_paletteram_16(*this, "paletteram") { } + m_palette(*this, "palette") { } optional_device<midway_chip_squeak_deluxe_device> m_chip_squeak_deluxe; optional_device<midway_sounds_good_device> m_sounds_good; @@ -79,8 +78,6 @@ public: DECLARE_READ16_MEMBER(mcr68_6840_r_common); void reload_count(int counter); UINT16 compute_counter(int counter); - DECLARE_WRITE16_MEMBER(mcr68_paletteram_w); - DECLARE_WRITE16_MEMBER(zwackery_paletteram_w); DECLARE_WRITE16_MEMBER(mcr68_videoram_w); DECLARE_WRITE16_MEMBER(zwackery_videoram_w); DECLARE_WRITE16_MEMBER(zwackery_spriteram_w); @@ -129,5 +126,4 @@ public: required_device<gfxdecode_device> m_gfxdecode; required_device<screen_device> m_screen; required_device<palette_device> m_palette; - required_shared_ptr<UINT16> m_generic_paletteram_16; }; diff --git a/src/mame/includes/megadriv.h b/src/mame/includes/megadriv.h index 96cf8fa3f1c..b30205cb890 100644 --- a/src/mame/includes/megadriv.h +++ b/src/mame/includes/megadriv.h @@ -46,12 +46,14 @@ public: m_z80snd(*this,"genesis_snd_z80"), m_ymsnd(*this,"ymsnd"), m_vdp(*this,"gen_vdp"), + m_snsnd(*this, "snsnd"), m_megadrive_ram(*this,"megadrive_ram") { } required_device<m68000_base_device> m_maincpu; optional_device<cpu_device> m_z80snd; optional_device<ym2612_device> m_ymsnd; required_device<sega315_5313_device> m_vdp; + required_device<sn76496_base_device> m_snsnd; optional_shared_ptr<UINT16> m_megadrive_ram; ioport_port *m_io_reset; diff --git a/src/mame/includes/megasys1.h b/src/mame/includes/megasys1.h index 869ff11f182..073541652c7 100644 --- a/src/mame/includes/megasys1.h +++ b/src/mame/includes/megasys1.h @@ -135,6 +135,7 @@ public: DECLARE_DRIVER_INIT(rodland); DECLARE_DRIVER_INIT(edfbl); DECLARE_DRIVER_INIT(stdragona); + DECLARE_DRIVER_INIT(stdragonb); TILEMAP_MAPPER_MEMBER(megasys1_scan_8x8); TILEMAP_MAPPER_MEMBER(megasys1_scan_16x16); TILE_GET_INFO_MEMBER(megasys1_get_scroll_tile_info_8x8); diff --git a/src/mame/includes/metlclsh.h b/src/mame/includes/metlclsh.h index 0f68a1e300a..8885ff1019d 100644 --- a/src/mame/includes/metlclsh.h +++ b/src/mame/includes/metlclsh.h @@ -26,8 +26,6 @@ public: required_shared_ptr<UINT8> m_bgram; required_shared_ptr<UINT8> m_scrollx; UINT8 * m_otherram; -// UINT8 * m_paletteram; // currently this uses generic palette handling -// UINT8 * m_paletteram2; // currently this uses generic palette handling /* video-related */ tilemap_t *m_bg_tilemap; diff --git a/src/mame/includes/micro3d.h b/src/mame/includes/micro3d.h index cefff99545b..ed0f05ee67e 100644 --- a/src/mame/includes/micro3d.h +++ b/src/mame/includes/micro3d.h @@ -39,6 +39,7 @@ enum dac_registers { PAN }; +class micro3d_sound_device; class micro3d_state : public driver_device { @@ -58,7 +59,14 @@ public: m_vgb(*this, "vgb"), m_palette(*this, "palette"), m_duart68681(*this, "duart68681"), - m_generic_paletteram_16(*this, "paletteram"), + m_noise_1(*this, "noise_1"), + m_noise_2(*this, "noise_2"), + m_vertex(*this, "vertex"), + m_sound_sw(*this, "SOUND_SW"), + m_volume(*this, "VOLUME"), + m_joystick_x(*this, "JOYSTICK_X"), + m_joystick_y(*this, "JOYSTICK_Y"), + m_throttle(*this, "THROTTLE"), m_shared_ram(*this, "shared_ram"), m_mac_sram(*this, "mac_sram"), m_sprite_vram(*this, "sprite_vram") { } @@ -70,7 +78,15 @@ public: required_device<tms34010_device> m_vgb; required_device<palette_device> m_palette; required_device<mc68681_device> m_duart68681; - required_shared_ptr<UINT16> m_generic_paletteram_16; + required_device<micro3d_sound_device> m_noise_1; + required_device<micro3d_sound_device> m_noise_2; + required_memory_region m_vertex; + + required_ioport m_sound_sw; + required_ioport m_volume; + optional_ioport m_joystick_x; + optional_ioport m_joystick_y; + optional_ioport m_throttle; required_shared_ptr<UINT16> m_shared_ram; UINT8 m_m68681_tx0; @@ -145,7 +161,6 @@ public: DECLARE_READ32_MEMBER(micro3d_shared_r); DECLARE_WRITE32_MEMBER(drmath_int_w); DECLARE_WRITE32_MEMBER(drmath_intr2_ack); - DECLARE_WRITE16_MEMBER(micro3d_clut_w); DECLARE_WRITE16_MEMBER(micro3d_creg_w); DECLARE_WRITE16_MEMBER(micro3d_xfer3dk_w); DECLARE_WRITE32_MEMBER(micro3d_fifo_w); diff --git a/src/mame/includes/midtunit.h b/src/mame/includes/midtunit.h index 48973fb6134..98cd404aa32 100644 --- a/src/mame/includes/midtunit.h +++ b/src/mame/includes/midtunit.h @@ -24,7 +24,6 @@ public: m_dcs(*this, "dcs"), m_cvsd_sound(*this, "cvsd"), m_adpcm_sound(*this, "adpcm") , - m_generic_paletteram_16(*this, "paletteram"), m_nvram(*this, "nvram"), m_gfxrom(*this, "gfxrom") { } @@ -34,7 +33,6 @@ public: optional_device<williams_cvsd_sound_device> m_cvsd_sound; optional_device<williams_adpcm_sound_device> m_adpcm_sound; - required_shared_ptr<UINT16> m_generic_paletteram_16; required_shared_ptr<UINT16> m_nvram; required_memory_region m_gfxrom; @@ -69,7 +67,6 @@ public: DECLARE_WRITE16_MEMBER(midtunit_control_w); DECLARE_WRITE16_MEMBER(midwunit_control_w); DECLARE_READ16_MEMBER(midwunit_control_r); - DECLARE_WRITE16_MEMBER(midtunit_paletteram_w); DECLARE_WRITE16_MEMBER(midxunit_paletteram_w); DECLARE_READ16_MEMBER(midxunit_paletteram_r); DECLARE_READ16_MEMBER(midtunit_dma_r); diff --git a/src/mame/includes/momoko.h b/src/mame/includes/momoko.h index 93542aa3d7a..1278dcf07fa 100644 --- a/src/mame/includes/momoko.h +++ b/src/mame/includes/momoko.h @@ -24,7 +24,6 @@ public: required_shared_ptr<UINT8> m_videoram; required_shared_ptr<UINT8> m_bg_scrolly; required_shared_ptr<UINT8> m_bg_scrollx; -// UINT8 * paletteram; // currently this uses generic palette handling /* video-related */ UINT8 m_fg_scrollx; diff --git a/src/mame/includes/moo.h b/src/mame/includes/moo.h index 0cf8b34c042..4ffd6548528 100644 --- a/src/mame/includes/moo.h +++ b/src/mame/includes/moo.h @@ -37,7 +37,6 @@ public: /* memory pointers */ optional_shared_ptr<UINT16> m_workram; required_shared_ptr<UINT16> m_spriteram; -// UINT16 * m_paletteram; // currently this uses generic palette handling /* video-related */ int m_sprite_colorbase; diff --git a/src/mame/includes/mrflea.h b/src/mame/includes/mrflea.h index 527d52b01e1..5c8b7020b12 100644 --- a/src/mame/includes/mrflea.h +++ b/src/mame/includes/mrflea.h @@ -22,7 +22,6 @@ public: /* memory pointers */ required_shared_ptr<UINT8> m_videoram; required_shared_ptr<UINT8> m_spriteram; -// UINT8 * paletteram; // currently this uses generic palette handling /* video-related */ int m_gfx_bank; diff --git a/src/mame/includes/news.h b/src/mame/includes/news.h index 455fd17bf70..e79b794a135 100644 --- a/src/mame/includes/news.h +++ b/src/mame/includes/news.h @@ -14,7 +14,6 @@ public: /* memory pointers */ required_shared_ptr<UINT8> m_bgram; required_shared_ptr<UINT8> m_fgram; -// UINT8 * m_paletteram; // currently this uses generic palette handling /* video-related */ tilemap_t *m_fg_tilemap; diff --git a/src/mame/includes/nova2001.h b/src/mame/includes/nova2001.h index 7dcaa7817e1..497a337c4e5 100644 --- a/src/mame/includes/nova2001.h +++ b/src/mame/includes/nova2001.h @@ -42,6 +42,7 @@ public: DECLARE_DRIVER_INIT(pkunwar); DECLARE_VIDEO_START(nova2001); DECLARE_PALETTE_INIT(nova2001); + DECLARE_PALETTE_DECODER(BBGGRRII); DECLARE_MACHINE_START(ninjakun); DECLARE_VIDEO_START(ninjakun); DECLARE_VIDEO_START(pkunwar); diff --git a/src/mame/includes/overdriv.h b/src/mame/includes/overdriv.h index 07274e54117..8296a6ec493 100644 --- a/src/mame/includes/overdriv.h +++ b/src/mame/includes/overdriv.h @@ -28,9 +28,6 @@ public: m_screen(*this, "screen") { } - /* memory pointers */ -// UINT16 * m_paletteram; // currently this uses generic palette handling - /* video-related */ int m_zoom_colorbase[2]; int m_road_colorbase[2]; diff --git a/src/mame/includes/pbaction.h b/src/mame/includes/pbaction.h index 13fc38633c6..1e4537a74fd 100644 --- a/src/mame/includes/pbaction.h +++ b/src/mame/includes/pbaction.h @@ -30,7 +30,6 @@ public: required_shared_ptr<UINT8> m_colorram2; required_shared_ptr<UINT8> m_work_ram; required_shared_ptr<UINT8> m_spriteram; -// UINT8 * m_paletteram; // currently this uses generic palette handling /* video-related */ tilemap_t *m_bg_tilemap; diff --git a/src/mame/includes/pgm.h b/src/mame/includes/pgm.h index 920a9a8a194..6b03cadc8f8 100644 --- a/src/mame/includes/pgm.h +++ b/src/mame/includes/pgm.h @@ -44,7 +44,6 @@ public: UINT8 * m_sprite_a_region; size_t m_sprite_a_region_size; UINT16 * m_spritebufferram; // buffered spriteram -// UINT16 * m_paletteram; // currently this uses generic palette handling /* video-related */ tilemap_t *m_bg_tilemap; diff --git a/src/mame/includes/pktgaldx.h b/src/mame/includes/pktgaldx.h index 02b1143ff21..bb9fe73ba68 100644 --- a/src/mame/includes/pktgaldx.h +++ b/src/mame/includes/pktgaldx.h @@ -37,8 +37,6 @@ public: optional_shared_ptr<UINT16> m_pf1_rowscroll; optional_shared_ptr<UINT16> m_pf2_rowscroll; optional_shared_ptr<UINT16> m_spriteram; -// UINT16 * paletteram; // currently this uses generic palette handling (in decocomn.c) - optional_shared_ptr<UINT16> m_pktgaldb_fgram; optional_shared_ptr<UINT16> m_pktgaldb_sprites; optional_device<decospr_device> m_sprgen; diff --git a/src/mame/includes/plygonet.h b/src/mame/includes/plygonet.h index 033cce2a1b3..f849a54556f 100644 --- a/src/mame/includes/plygonet.h +++ b/src/mame/includes/plygonet.h @@ -25,8 +25,7 @@ public: m_dsp56k_p_mirror(*this, "dsp56k_p_mirror"), m_dsp56k_p_8000(*this, "dsp56k_p_8000"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"), - m_generic_paletteram_32(*this, "paletteram") + m_palette(*this, "palette") { } required_device<cpu_device> m_maincpu; @@ -42,7 +41,6 @@ public: required_shared_ptr<UINT16> m_dsp56k_p_8000; required_device<gfxdecode_device> m_gfxdecode; required_device<palette_device> m_palette; - required_shared_ptr<UINT32> m_generic_paletteram_32; ioport_port *m_inputs[4]; UINT8 m_sys0; @@ -76,7 +74,6 @@ public: DECLARE_WRITE32_MEMBER(dsp_w_lines); DECLARE_WRITE32_MEMBER(dsp_host_interface_w); DECLARE_READ32_MEMBER(network_r); - DECLARE_WRITE32_MEMBER(plygonet_palette_w); DECLARE_READ16_MEMBER(dsp56k_bootload_r); DECLARE_READ16_MEMBER(dsp56k_ram_bank00_read); DECLARE_WRITE16_MEMBER(dsp56k_ram_bank00_write); diff --git a/src/mame/includes/psikyo.h b/src/mame/includes/psikyo.h index 11b7d50507e..73c40d24440 100644 --- a/src/mame/includes/psikyo.h +++ b/src/mame/includes/psikyo.h @@ -32,7 +32,6 @@ public: optional_shared_ptr<UINT32> m_bootleg_spritebuffer; UINT32 * m_spritebuf1; UINT32 * m_spritebuf2; -// UINT32 * m_paletteram; // currently this uses generic palette handling /* video-related */ tilemap_t *m_tilemap_0_size0; diff --git a/src/mame/includes/rainbow.h b/src/mame/includes/rainbow.h index ee221bdacd6..41794a7fdcc 100644 --- a/src/mame/includes/rainbow.h +++ b/src/mame/includes/rainbow.h @@ -24,7 +24,6 @@ public: /* memory pointers */ optional_shared_ptr<UINT16> m_spriteram; -// UINT16 * paletteram; // currently this uses generic palette handling /* video-related */ UINT16 m_sprite_ctrl; diff --git a/src/mame/includes/rastan.h b/src/mame/includes/rastan.h index 09e2b4c4118..cf59b370e36 100644 --- a/src/mame/includes/rastan.h +++ b/src/mame/includes/rastan.h @@ -20,9 +20,6 @@ public: m_pc080sn(*this, "pc080sn"), m_pc090oj(*this, "pc090oj") { } - /* memory pointers */ -// UINT16 * paletteram; // this currently uses generic palette handlers - /* video-related */ UINT16 m_sprite_ctrl; UINT16 m_sprites_flipscreen; diff --git a/src/mame/includes/rockrage.h b/src/mame/includes/rockrage.h index 3d16d50d50d..c2ed6095460 100644 --- a/src/mame/includes/rockrage.h +++ b/src/mame/includes/rockrage.h @@ -37,7 +37,6 @@ public: required_memory_bank m_rombank; /* video-related */ - int m_layer_colorbase[2]; int m_vreg; DECLARE_WRITE8_MEMBER(rockrage_bankswitch_w); diff --git a/src/mame/includes/rollerg.h b/src/mame/includes/rollerg.h index eb982a3c5a5..88ddca6cc45 100644 --- a/src/mame/includes/rollerg.h +++ b/src/mame/includes/rollerg.h @@ -27,10 +27,6 @@ public: m_k053252(*this, "k053252") { } - /* video-related */ - int m_sprite_colorbase; - int m_zoom_colorbase; - /* misc */ int m_readzoomroms; @@ -48,7 +44,6 @@ public: DECLARE_WRITE_LINE_MEMBER(rollerg_irq_ack_w); virtual void machine_start(); virtual void machine_reset(); - virtual void video_start(); UINT32 screen_update_rollerg(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); K05324X_CB_MEMBER(sprite_callback); K051316_CB_MEMBER(zoom_callback); diff --git a/src/mame/includes/senjyo.h b/src/mame/includes/senjyo.h index 7ed3af920b9..36c6bbebdb1 100644 --- a/src/mame/includes/senjyo.h +++ b/src/mame/includes/senjyo.h @@ -15,6 +15,7 @@ public: m_dac(*this, "dac"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), + m_radar_palette(*this, "radar_palette"), m_spriteram(*this, "spriteram"), m_fgscroll(*this, "fgscroll"), m_scrollx1(*this, "scrollx1"), @@ -30,7 +31,6 @@ public: m_bg3videoram(*this, "bg3videoram"), m_radarram(*this, "radarram"), m_bgstripesram(*this, "bgstripesram"), - m_generic_paletteram_8(*this, "paletteram"), m_decrypted_opcodes(*this, "decrypted_opcodes") { } /* devices */ @@ -39,6 +39,7 @@ public: required_device<dac_device> m_dac; required_device<gfxdecode_device> m_gfxdecode; required_device<palette_device> m_palette; + required_device<palette_device> m_radar_palette; /* memory pointers */ required_shared_ptr<UINT8> m_spriteram; @@ -56,7 +57,6 @@ public: required_shared_ptr<UINT8> m_bg3videoram; required_shared_ptr<UINT8> m_radarram; required_shared_ptr<UINT8> m_bgstripesram; - required_shared_ptr<UINT8> m_generic_paletteram_8; optional_shared_ptr<UINT8> m_decrypted_opcodes; // game specific initialization @@ -73,7 +73,6 @@ public: tilemap_t *m_bg3_tilemap; DECLARE_WRITE8_MEMBER(flip_screen_w); - DECLARE_WRITE8_MEMBER(paletteram_w); DECLARE_WRITE8_MEMBER(starforb_scrolly2); DECLARE_WRITE8_MEMBER(starforb_scrollx2); DECLARE_WRITE8_MEMBER(fgvideoram_w); @@ -87,6 +86,9 @@ public: DECLARE_WRITE8_MEMBER(irq_ctrl_w); DECLARE_READ8_MEMBER(pio_pa_r); + DECLARE_PALETTE_DECODER(IIBBGGRR); + DECLARE_PALETTE_INIT(radar); + DECLARE_DRIVER_INIT(starfora); DECLARE_DRIVER_INIT(senjyo); DECLARE_DRIVER_INIT(starfore); @@ -101,10 +103,10 @@ public: virtual void machine_start(); virtual void machine_reset(); virtual void video_start(); - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void draw_bgbitmap(bitmap_ind16 &bitmap,const rectangle &cliprect); - void draw_radar(bitmap_ind16 &bitmap,const rectangle &cliprect); - void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,int priority); + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + void draw_bgbitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect); + void draw_radar(bitmap_rgb32 &bitmap, const rectangle &cliprect); + void draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect,int priority); }; /*----------- defined in audio/senjyo.c -----------*/ diff --git a/src/mame/includes/seta.h b/src/mame/includes/seta.h index 68b45917831..1f1c5d0a920 100644 --- a/src/mame/includes/seta.h +++ b/src/mame/includes/seta.h @@ -193,6 +193,7 @@ public: TILE_GET_INFO_MEMBER(get_tile_info_2); TILE_GET_INFO_MEMBER(get_tile_info_3); DECLARE_VIDEO_START(seta_no_layers); + DECLARE_VIDEO_START(kyustrkr_no_layers); DECLARE_VIDEO_START(twineagl_1_layer); DECLARE_VIDEO_START(setaroul_1_layer); DECLARE_VIDEO_START(seta_1_layer); diff --git a/src/mame/includes/spy.h b/src/mame/includes/spy.h index 71ad18d5ad5..1bdcf2aaf1c 100644 --- a/src/mame/includes/spy.h +++ b/src/mame/includes/spy.h @@ -29,10 +29,6 @@ public: UINT8 m_pmcram[0x800]; std::vector<UINT8> m_paletteram; - /* video-related */ - int m_layer_colorbase[3]; - int m_sprite_colorbase; - /* misc */ int m_rambank; int m_pmcbank; @@ -57,7 +53,6 @@ public: DECLARE_WRITE8_MEMBER(k052109_051960_w); virtual void machine_start(); virtual void machine_reset(); - virtual void video_start(); UINT32 screen_update_spy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(spy_interrupt); void spy_collision( ); diff --git a/src/mame/includes/suna16.h b/src/mame/includes/suna16.h index 3683bf6cc1d..572fe87365a 100644 --- a/src/mame/includes/suna16.h +++ b/src/mame/includes/suna16.h @@ -16,7 +16,11 @@ public: m_screen(*this, "screen"), m_palette(*this, "palette"), m_spriteram(*this, "spriteram"), - m_spriteram2(*this, "spriteram2") + m_spriteram2(*this, "spriteram2"), + m_bank1(*this, "bank1"), + m_bank2(*this, "bank2") + + { } required_device<cpu_device> m_maincpu; @@ -31,6 +35,10 @@ public: required_shared_ptr<UINT16> m_spriteram; optional_shared_ptr<UINT16> m_spriteram2; + optional_memory_bank m_bank1; + optional_memory_bank m_bank2; + + UINT16 *m_paletteram; int m_color_bank; UINT8 m_prot; diff --git a/src/mame/includes/supbtime.h b/src/mame/includes/supbtime.h index d38f7a66d46..dc1130efad1 100644 --- a/src/mame/includes/supbtime.h +++ b/src/mame/includes/supbtime.h @@ -28,7 +28,6 @@ public: required_shared_ptr<UINT16> m_pf1_rowscroll; required_shared_ptr<UINT16> m_pf2_rowscroll; optional_device<decospr_device> m_sprgen; - // UINT16 * m_paletteram; // currently this uses generic palette handling (in decocomn.c) /* video-related */ diff --git a/src/mame/includes/superqix.h b/src/mame/includes/superqix.h index f605e8372f6..ede28fa498e 100644 --- a/src/mame/includes/superqix.h +++ b/src/mame/includes/superqix.h @@ -89,6 +89,7 @@ public: DECLARE_VIDEO_START(pbillian); DECLARE_MACHINE_START(superqix); DECLARE_VIDEO_START(superqix); + DECLARE_PALETTE_DECODER(BBGGRRII); UINT32 screen_update_pbillian(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_superqix(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(vblank_irq); diff --git a/src/mame/includes/suprslam.h b/src/mame/includes/suprslam.h index c691bfb902b..8c52558a251 100644 --- a/src/mame/includes/suprslam.h +++ b/src/mame/includes/suprslam.h @@ -34,7 +34,6 @@ public: required_shared_ptr<UINT16> m_spr_ctrl; required_shared_ptr<UINT16> m_screen_vregs; required_device<vsystem_spr_device> m_spr; -// UINT16 * m_paletteram; // this currently uses generic palette handling /* video-related */ tilemap_t *m_screen_tilemap; diff --git a/src/mame/includes/system1.h b/src/mame/includes/system1.h index 1cdc17ee42a..fb02caa00ca 100644 --- a/src/mame/includes/system1.h +++ b/src/mame/includes/system1.h @@ -19,9 +19,9 @@ public: m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), m_palette(*this, "palette"), - m_generic_paletteram_8(*this, "paletteram"), m_decrypted_opcodes(*this, "decrypted_opcodes"), m_maincpu_region(*this, "maincpu"), + m_color_prom(*this, "palette"), m_bank1(*this, "bank1"), m_bank0d(*this, "bank0d"), m_bank1d(*this, "bank1d") { } @@ -142,9 +142,9 @@ public: required_device<gfxdecode_device> m_gfxdecode; required_device<screen_device> m_screen; required_device<palette_device> m_palette; - required_shared_ptr<UINT8> m_generic_paletteram_8; optional_shared_ptr<UINT8> m_decrypted_opcodes; required_memory_region m_maincpu_region; + optional_region_ptr<UINT8> m_color_prom; required_memory_bank m_bank1; optional_memory_bank m_bank0d; optional_memory_bank m_bank1d; diff --git a/src/mame/includes/taito_b.h b/src/mame/includes/taito_b.h index 4f6d2eef264..c97e53a8c6f 100644 --- a/src/mame/includes/taito_b.h +++ b/src/mame/includes/taito_b.h @@ -42,7 +42,6 @@ public: /* memory pointers */ required_shared_ptr<UINT16> m_spriteram; optional_shared_ptr<UINT16> m_pixelram; -// UINT16 * m_paletteram; // this currently uses generic palette handlers /* video-related */ /* framebuffer is a raw bitmap, remapped as a last step */ diff --git a/src/mame/includes/taito_f2.h b/src/mame/includes/taito_f2.h index 98c9f772fbb..6497d09306c 100644 --- a/src/mame/includes/taito_f2.h +++ b/src/mame/includes/taito_f2.h @@ -53,8 +53,6 @@ public: UINT16 * m_spriteram_buffered; UINT16 * m_spriteram_delayed; optional_shared_ptr<UINT16> m_cchip2_ram; // for megablst only -// UINT16 * m_paletteram; // currently this uses generic palette handling - /* video-related */ struct f2_tempsprite *m_spritelist; diff --git a/src/mame/includes/taito_o.h b/src/mame/includes/taito_o.h index 2b132d95efe..08225c21741 100644 --- a/src/mame/includes/taito_o.h +++ b/src/mame/includes/taito_o.h @@ -18,9 +18,6 @@ public: m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette") { } - /* memory pointers */ -// UINT16 * paletteram; // currently this uses generic palette handling - /* devices */ required_device<cpu_device> m_maincpu; required_device<tc0080vco_device> m_tc0080vco; diff --git a/src/mame/includes/tnzs.h b/src/mame/includes/tnzs.h index ee747b914a2..8cfde271a57 100644 --- a/src/mame/includes/tnzs.h +++ b/src/mame/includes/tnzs.h @@ -35,7 +35,18 @@ public: m_dac(*this, "dac"), m_samples(*this, "samples"), m_palette(*this, "palette"), - m_mainbank(*this, "mainbank") + m_mainbank(*this, "mainbank"), + m_subbank(*this, "subbank"), + m_audiobank(*this, "audiobank"), + m_dswa(*this, "DSWA"), + m_dswb(*this, "DSWB"), + m_in0(*this, "IN0"), + m_in1(*this, "IN1"), + m_in2(*this, "IN2"), + m_coin1(*this, "COIN1"), + m_coin2(*this, "COIN2"), + m_an1(*this, "AN1"), + m_an2(*this, "AN2") { } /* devices */ @@ -48,6 +59,17 @@ public: optional_device<samples_device> m_samples; required_device<palette_device> m_palette; optional_device<address_map_bank_device> m_mainbank; + optional_memory_bank m_subbank; /* optional because of reuse from cchance.c */ + optional_memory_bank m_audiobank; + required_ioport m_dswa; + required_ioport m_dswb; + required_ioport m_in0; + required_ioport m_in1; + required_ioport m_in2; + optional_ioport m_coin1; + optional_ioport m_coin2; + optional_ioport m_an1; + optional_ioport m_an2; /* sound-related */ INT16 *m_sampledata[MAX_SAMPLES]; diff --git a/src/mame/includes/tumbleb.h b/src/mame/includes/tumbleb.h index d87e5efad48..3abcc4ed79a 100644 --- a/src/mame/includes/tumbleb.h +++ b/src/mame/includes/tumbleb.h @@ -29,7 +29,6 @@ public: required_shared_ptr<UINT16> m_pf2_data; optional_shared_ptr<UINT16> m_control; optional_device<decospr_device> m_sprgen; -// UINT16 * m_paletteram; // currently this uses generic palette handling /* misc */ int m_music_command; diff --git a/src/mame/includes/tumblep.h b/src/mame/includes/tumblep.h index 67d64baf668..f09ac964918 100644 --- a/src/mame/includes/tumblep.h +++ b/src/mame/includes/tumblep.h @@ -28,7 +28,6 @@ public: required_shared_ptr<UINT16> m_pf1_rowscroll; required_shared_ptr<UINT16> m_pf2_rowscroll; optional_device<decospr_device> m_sprgen; -// UINT16 * m_paletteram; // currently this uses generic palette handling (in decocomn.c) /* devices */ required_device<cpu_device> m_maincpu; diff --git a/src/mame/includes/tutankhm.h b/src/mame/includes/tutankhm.h index f183b0688eb..b5748db47b0 100644 --- a/src/mame/includes/tutankhm.h +++ b/src/mame/includes/tutankhm.h @@ -6,13 +6,12 @@ public: tutankhm_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_videoram(*this, "videoram"), - m_paletteram(*this, "paletteram"), m_scroll(*this, "scroll"), - m_maincpu(*this, "maincpu"){ } + m_maincpu(*this, "maincpu"), + m_palette(*this, "palette") { } /* memory pointers */ required_shared_ptr<UINT8> m_videoram; - required_shared_ptr<UINT8> m_paletteram; required_shared_ptr<UINT8> m_scroll; /* video-related */ @@ -26,6 +25,7 @@ public: /* devices */ required_device<cpu_device> m_maincpu; + required_device<palette_device> m_palette; DECLARE_WRITE8_MEMBER(irq_enable_w); DECLARE_WRITE8_MEMBER(tutankhm_bankselect_w); DECLARE_WRITE8_MEMBER(sound_mute_w); @@ -36,5 +36,4 @@ public: DECLARE_MACHINE_RESET(tutankhm); UINT32 screen_update_tutankhm(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(tutankhm_interrupt); - void get_pens( pen_t *pens ); }; diff --git a/src/mame/includes/ultraman.h b/src/mame/includes/ultraman.h index 3b1cd3c9462..854f30d606e 100644 --- a/src/mame/includes/ultraman.h +++ b/src/mame/includes/ultraman.h @@ -22,12 +22,6 @@ public: m_k051316_3(*this, "k051316_3"), m_k051960(*this, "k051960") { } - /* memory pointers */ -// UINT16 * m_paletteram; // currently this uses generic palette handling - - /* video-related */ - int m_sprite_colorbase; - int m_zoom_colorbase[3]; int m_bank0; int m_bank1; int m_bank2; @@ -44,7 +38,6 @@ public: DECLARE_WRITE16_MEMBER(ultraman_gfxctrl_w); virtual void machine_start(); virtual void machine_reset(); - virtual void video_start(); UINT32 screen_update_ultraman(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); K051316_CB_MEMBER(zoom_callback_1); K051316_CB_MEMBER(zoom_callback_2); diff --git a/src/mame/includes/volfied.h b/src/mame/includes/volfied.h index 8633ab5ae70..a978e36f048 100644 --- a/src/mame/includes/volfied.h +++ b/src/mame/includes/volfied.h @@ -26,7 +26,6 @@ public: /* memory pointers */ UINT16 * m_video_ram; UINT8 * m_cchip_ram; -// UINT16 * paletteram; // this currently uses generic palette handlers /* video-related */ UINT16 m_video_ctrl; diff --git a/src/mame/includes/xbox.h b/src/mame/includes/xbox.h new file mode 100644 index 00000000000..e51067a37ef --- /dev/null +++ b/src/mame/includes/xbox.h @@ -0,0 +1,321 @@ +// license:BSD-3-Clause +// copyright-holders:Samuele Zannoli + +struct OHCIEndpointDescriptor { + int mps; // MaximumPacketSize + int f; // Format + int k; // sKip + int s; // Speed + int d; // Direction + int en; // EndpointNumber + int fa; // FunctionAddress + UINT32 tailp; // TDQueueTailPointer + UINT32 headp; // TDQueueHeadPointer + UINT32 nexted; // NextED + int c; // toggleCarry + int h; // Halted + UINT32 word0; +}; + +struct OHCITransferDescriptor { + int cc; // ConditionCode + int ec; // ErrorCount + int t; // DataToggle + int di; // DelayInterrupt + int dp; // Direction/PID + int r; // bufferRounding + UINT32 cbp; // CurrentBufferPointer + UINT32 nexttd; // NextTD + UINT32 be; // BufferEnd + UINT32 word0; +}; + +struct OHCIIsochronousTransferDescriptor { + int cc; // ConditionCode + int fc; // FrameCount + int di; // DelayInterrupt + int sf; // StartingFrame + UINT32 bp0; // BufferPage0 + UINT32 nexttd; // NextTD + UINT32 be; // BufferEnd + UINT32 offset[8]; // Offset/PacketStatusWord +}; + +enum OHCIRegisters { + HcRevision=0, + HcControl, + HcCommandStatus, + HcInterruptStatus, + HcInterruptEnable, + HcInterruptDisable, + HcHCCA, + HcPeriodCurrentED, + HcControlHeadED, + HcControlCurrentED, + HcBulkHeadED, + HcBulkCurrentED, + HcDoneHead, + HcFmInterval, + HcFmRemaining, + HcFmNumber, + HcPeriodicStart, + HcLSThreshold, + HcRhDescriptorA, + HcRhDescriptorB, + HcRhStatus, + HcRhPortStatus1 +}; + +enum OHCIHostControllerFunctionalState { + UsbReset=0, + UsbResume, + UsbOperational, + UsbSuspend +}; + +enum OHCIInterrupt { + SchedulingOverrun=1, + WritebackDoneHead=2, + StartofFrame=4, + ResumeDetected=8, + UnrecoverableError=16, + FrameNumberOverflow=32, + RootHubStatusChange=64, + OwnershipChange=0x40000000, + MasterInterruptEnable=0x80000000 +}; + +enum OHCICompletionCode { + NoError=0, + CRC, + BitStuffing, + DataToggleMismatch, + Stall, + DeviceNotResponding, + PIDCheckFailure, + UnexpectedPID, + DataOverrun, + DataUnderrun, + BufferOverrun=12, + BufferUnderrun, + NotAccessed=14 +}; + +struct USBSetupPacket { + UINT8 bmRequestType; + UINT8 bRequest; + UINT16 wValue; + UINT16 wIndex; + UINT16 wLength; +}; + +struct USBStandardDeviceDscriptor { + UINT8 bLength; + UINT8 bDescriptorType; + UINT16 bcdUSB; + UINT8 bDeviceClass; + UINT8 bDeviceSubClass; + UINT8 bDeviceProtocol; + UINT8 bMaxPacketSize0; + UINT16 idVendor; + UINT16 idProduct; + UINT16 bcdDevice; + UINT8 iManufacturer; + UINT8 iProduct; + UINT8 iSerialNumber; + UINT8 bNumConfigurations; +}; + +struct USBStandardConfigurationDescriptor { + UINT8 bLength; + UINT8 bDescriptorType; + UINT16 wTotalLength; + UINT8 bNumInterfaces; + UINT8 bConfigurationValue; + UINT8 iConfiguration; + UINT8 bmAttributes; + UINT8 MaxPower; +}; + +struct USBStandardInterfaceDescriptor { + UINT8 bLength; + UINT8 bDescriptorType; + UINT8 bInterfaceNumber; + UINT8 bAlternateSetting; + UINT8 bNumEndpoints; + UINT8 bInterfaceClass; + UINT8 bInterfaceSubClass; + UINT8 bInterfaceProtocol; + UINT8 iInterface; +}; + +struct USBStandardEndpointDescriptor { + UINT8 bLength; + UINT8 bDescriptorType; + UINT8 bEndpointAddress; + UINT8 bmAttributes; + UINT16 wMaxPacketSize; + UINT8 bInterval; +}; + +enum USBPid { + SetupPid=0, + OutPid, + InPid +}; + +enum USBRequestCode { + GET_STATUS=0, + CLEAR_FEATURE=1, + SET_FEATURE=3, + SET_ADDRESS=5, + GET_DESCRIPTOR=6, + SET_DESCRIPTOR=7, + GET_CONFIGURATION=8, + SET_CONFIGURATION=9, + GET_INTERFACE=10, + SET_INTERFACE=11, + SYNCH_FRAME=12 +}; + +enum USBDescriptorType { + DEVICE=1, + CONFIGURATION=2, + STRING=3, + INTERFACE=4, + ENDPOINT=5 +}; + +class ohci_function_device { +public: + ohci_function_device(); + void execute_reset(); + int execute_transfer(int address, int endpoint, int pid, UINT8 *buffer, int size); +private: + int address; + int controldir; + int remain; + UINT8 *position; +}; + +class xbox_base_state : public driver_device +{ +public: + xbox_base_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + nvidia_nv2a(NULL), + debug_irq_active(false), + debug_irq_number(0), + m_maincpu(*this, "maincpu") { } + + DECLARE_READ32_MEMBER(geforce_r); + DECLARE_WRITE32_MEMBER(geforce_w); + DECLARE_READ32_MEMBER(usbctrl_r); + DECLARE_WRITE32_MEMBER(usbctrl_w); + DECLARE_READ32_MEMBER(smbus_r); + DECLARE_WRITE32_MEMBER(smbus_w); + DECLARE_READ32_MEMBER(audio_apu_r); + DECLARE_WRITE32_MEMBER(audio_apu_w); + DECLARE_READ32_MEMBER(audio_ac93_r); + DECLARE_WRITE32_MEMBER(audio_ac93_w); + DECLARE_READ32_MEMBER(dummy_r); + DECLARE_WRITE32_MEMBER(dummy_w); + + void smbus_register_device(int address, int(*handler)(xbox_base_state &chs, int command, int rw, int data)); + int smbus_pic16lc(int command, int rw, int data); + int smbus_cx25871(int command, int rw, int data); + int smbus_eeprom(int command, int rw, int data); + void usb_ohci_plug(int port, ohci_function_device *function); + void usb_ohci_interrupts(); + void usb_ohci_read_endpoint_descriptor(UINT32 address); + void usb_ohci_writeback_endpoint_descriptor(UINT32 address); + void usb_ohci_read_transfer_descriptor(UINT32 address); + void usb_ohci_writeback_transfer_descriptor(UINT32 address); + void usb_ohci_read_isochronous_transfer_descriptor(UINT32 address); + void dword_write_le(UINT8 *addr, UINT32 d); + void word_write_le(UINT8 *addr, UINT16 d); + void debug_generate_irq(int irq, bool active); + virtual void hack_eeprom() {}; + virtual void hack_usb() {}; + + void vblank_callback(screen_device &screen, bool state); + UINT32 screen_update_callback(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + virtual void machine_start(); + DECLARE_WRITE_LINE_MEMBER(xbox_pic8259_1_set_int_line); + DECLARE_READ8_MEMBER(get_slave_ack); + DECLARE_WRITE_LINE_MEMBER(xbox_pit8254_out0_changed); + DECLARE_WRITE_LINE_MEMBER(xbox_pit8254_out2_changed); + IRQ_CALLBACK_MEMBER(irq_callback); + TIMER_CALLBACK_MEMBER(audio_apu_timer); + TIMER_CALLBACK_MEMBER(usb_ohci_timer); + + struct xbox_devices { + pic8259_device *pic8259_1; + pic8259_device *pic8259_2; + bus_master_ide_controller_device *ide; + } xbox_base_devs; + struct smbus_state { + int status; + int control; + int address; + int data; + int command; + int rw; + int(*devices[128])(xbox_base_state &chs, int command, int rw, int data); + UINT32 words[256 / 4]; + } smbusst; + struct apu_state { + UINT32 memory[0x60000 / 4]; + UINT32 gpdsp_sgaddress; // global processor scatter-gather + UINT32 gpdsp_sgblocks; + UINT32 gpdsp_address; + UINT32 epdsp_sgaddress; // encoder processor scatter-gather + UINT32 epdsp_sgblocks; + UINT32 unknown_sgaddress; + UINT32 unknown_sgblocks; + int voice_number; + UINT32 voices_heap_blockaddr[1024]; + UINT64 voices_active[4]; //one bit for each voice: 1 playing 0 not + UINT32 voicedata_address; + int voices_frequency[256]; // sample rate + int voices_position[256]; // position in samples * 1000 + int voices_position_start[256]; // position in samples * 1000 + int voices_position_end[256]; // position in samples * 1000 + int voices_position_increment[256]; // position increment every 1ms * 1000 + emu_timer *timer; + address_space *space; + } apust; + struct ac97_state { + UINT32 mixer_regs[0x80 / 4]; + UINT32 controller_regs[0x38 / 4]; + } ac97st; + struct ohci_state { + UINT32 hc_regs[255]; + struct { + ohci_function_device *function; + int delay; + } ports[4 + 1]; + emu_timer *timer; + int state; + UINT32 framenumber; + UINT32 nextinterupted; + UINT32 nextbulked; + int interruptbulkratio; + int writebackdonehadcounter; + address_space *space; + UINT8 buffer[1024]; + OHCIEndpointDescriptor endpoint_descriptor; + OHCITransferDescriptor transfer_descriptor; + OHCIIsochronousTransferDescriptor isochronous_transfer_descriptor; + } ohcist; + UINT8 pic16lc_buffer[0xff]; + nv2a_renderer *nvidia_nv2a; + bool debug_irq_active; + int debug_irq_number; + required_device<cpu_device> m_maincpu; +}; + +ADDRESS_MAP_EXTERN(xbox_base_map, 32); +ADDRESS_MAP_EXTERN(xbox_base_map_io, 32); +MACHINE_CONFIG_EXTERN(xbox_base);
\ No newline at end of file diff --git a/src/mame/includes/xexex.h b/src/mame/includes/xexex.h index 2b03361443e..d0be3200057 100644 --- a/src/mame/includes/xexex.h +++ b/src/mame/includes/xexex.h @@ -42,7 +42,6 @@ public: /* memory pointers */ required_shared_ptr<UINT16> m_workram; required_shared_ptr<UINT16> m_spriteram; -// UINT16 * m_paletteram; // currently this uses generic palette handling /* video-related */ int m_layer_colorbase[4]; diff --git a/src/mame/includes/xmen.h b/src/mame/includes/xmen.h index 692c653db45..2f87182fbea 100644 --- a/src/mame/includes/xmen.h +++ b/src/mame/includes/xmen.h @@ -21,10 +21,8 @@ public: m_k052109(*this, "k052109"), m_k053246(*this, "k053246"), m_k053251(*this, "k053251"), - m_screen(*this, "screen") { } - - /* memory pointers */ -// UINT16 * m_paletteram; // currently this uses generic palette handling + m_screen(*this, "screen"), + m_z80bank(*this, "z80bank") { } /* video-related */ int m_layer_colorbase[3]; @@ -41,7 +39,6 @@ public: UINT16 * m_k053247_ram; /* misc */ - UINT8 m_sound_curbank; UINT8 m_vblank_irq_mask; /* devices */ @@ -52,6 +49,8 @@ public: required_device<k053247_device> m_k053246; required_device<k053251_device> m_k053251; required_device<screen_device> m_screen; + + required_memory_bank m_z80bank; DECLARE_WRITE16_MEMBER(eeprom_w); DECLARE_READ16_MEMBER(sound_status_r); DECLARE_WRITE16_MEMBER(sound_cmd_w); @@ -67,7 +66,6 @@ public: UINT32 screen_update_xmen6p_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void screen_eof_xmen6p(screen_device &screen, bool state); TIMER_DEVICE_CALLBACK_MEMBER(xmen_scanline); - void sound_reset_bank(); K052109_CB_MEMBER(tile_callback); K053246_CB_MEMBER(sprite_callback); }; diff --git a/src/mame/includes/xxmissio.h b/src/mame/includes/xxmissio.h index 1082e830cd3..48564dba069 100644 --- a/src/mame/includes/xxmissio.h +++ b/src/mame/includes/xxmissio.h @@ -49,6 +49,8 @@ public: virtual void machine_start(); virtual void video_start(); + DECLARE_PALETTE_DECODER(BBGGRRII); + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx); }; diff --git a/src/mame/layout/aquastge.lay b/src/mame/layout/aquastge.lay new file mode 100644 index 00000000000..97aa3e4a68f --- /dev/null +++ b/src/mame/layout/aquastge.lay @@ -0,0 +1,15 @@ +<?xml version="1.0"?> +<mamelayout version="2"> + + <!-- exact ratio unknown, could be wider --> + <view name="Dual Wide Screens"> + <screen index="0"> + <bounds left="0" top="0" right="900" bottom="450" /> + </screen> + <screen index="1"> + <bounds left="900" top="0" right="1800" bottom="450" /> + </screen> + + </view> + +</mamelayout> diff --git a/src/mame/layout/monzagp.lay b/src/mame/layout/monzagp.lay new file mode 100644 index 00000000000..12d9614ce47 --- /dev/null +++ b/src/mame/layout/monzagp.lay @@ -0,0 +1,106 @@ +<?xml version="1.0"?> +<mamelayout version="2"> + <element name="digit" defstate="0"> + <led7seg> + <color red="1.0" green="0.0" blue="0.0" /> + </led7seg> + </element> + + <view name="Default Layout"> + <screen index="0"> + <bounds x="0" y="160" width="300" height="400" /> + </screen> + + <!-- best scores 1 --> + <bezel name="digit27" element="digit"> + <bounds x="10" y="10" width="15" height="22" /> + </bezel> + <bezel name="digit11" element="digit"> + <bounds x="30" y="10" width="15" height="22" /> + </bezel> + <bezel name="digit19" element="digit"> + <bounds x="50" y="10" width="15" height="22" /> + </bezel> + <bezel name="digit3" element="digit"> + <bounds x="70" y="10" width="15" height="22" /> + </bezel> + + <!-- best scores 2 --> + <bezel name="digit24" element="digit"> + <bounds x="10" y="40" width="15" height="22" /> + </bezel> + <bezel name="digit8" element="digit"> + <bounds x="30" y="40" width="15" height="22" /> + </bezel> + <bezel name="digit16" element="digit"> + <bounds x="50" y="40" width="15" height="22" /> + </bezel> + <bezel name="digit0" element="digit"> + <bounds x="70" y="40" width="15" height="22" /> + </bezel> + + <!-- best scores 3 --> + <bezel name="digit28" element="digit"> + <bounds x="10" y="70" width="15" height="22" /> + </bezel> + <bezel name="digit12" element="digit"> + <bounds x="30" y="70" width="15" height="22" /> + </bezel> + <bezel name="digit20" element="digit"> + <bounds x="50" y="70" width="15" height="22" /> + </bezel> + <bezel name="digit4" element="digit"> + <bounds x="70" y="70" width="15" height="22" /> + </bezel> + + <!-- best scores 4 --> + <bezel name="digit26" element="digit"> + <bounds x="10" y="100" width="15" height="22" /> + </bezel> + <bezel name="digit10" element="digit"> + <bounds x="30" y="100" width="15" height="22" /> + </bezel> + <bezel name="digit18" element="digit"> + <bounds x="50" y="100" width="15" height="22" /> + </bezel> + <bezel name="digit2" element="digit"> + <bounds x="70" y="100" width="15" height="22" /> + </bezel> + + <!-- best scores 5 --> + <bezel name="digit30" element="digit"> + <bounds x="10" y="130" width="15" height="22" /> + </bezel> + <bezel name="digit14" element="digit"> + <bounds x="30" y="130" width="15" height="22" /> + </bezel> + <bezel name="digit22" element="digit"> + <bounds x="50" y="130" width="15" height="22" /> + </bezel> + <bezel name="digit6" element="digit"> + <bounds x="70" y="130" width="15" height="22" /> + </bezel> + + <!-- time racing --> + <bezel name="digit21" element="digit"> + <bounds x="140" y="130" width="15" height="22" /> + </bezel> + <bezel name="digit5" element="digit"> + <bounds x="160" y="130" width="15" height="22" /> + </bezel> + + <!-- your score --> + <bezel name="digit25" element="digit"> + <bounds x="220" y="10" width="15" height="22" /> + </bezel> + <bezel name="digit9" element="digit"> + <bounds x="240" y="10" width="15" height="22" /> + </bezel> + <bezel name="digit17" element="digit"> + <bounds x="260" y="10" width="15" height="22" /> + </bezel> + <bezel name="digit1" element="digit"> + <bounds x="280" y="10" width="15" height="22" /> + </bezel> + </view> +</mamelayout> diff --git a/src/mame/machine/ajax.c b/src/mame/machine/ajax.c index f684fd5ca28..15d4ca3415b 100644 --- a/src/mame/machine/ajax.c +++ b/src/mame/machine/ajax.c @@ -214,9 +214,3 @@ void ajax_state::machine_reset() m_priority = 0; m_firq_enable = 0; } - -INTERRUPT_GEN_MEMBER(ajax_state::ajax_interrupt) -{ - if (m_k051960->k051960_is_irq_enabled()) - device.execute().set_input_line(KONAMI_IRQ_LINE, HOLD_LINE); -} diff --git a/src/mame/machine/amiga.c b/src/mame/machine/amiga.c index 6679a2925c4..b69d4a96746 100644 --- a/src/mame/machine/amiga.c +++ b/src/mame/machine/amiga.c @@ -381,23 +381,23 @@ TIMER_CALLBACK_MEMBER( amiga_state::amiga_irq_proc ) UINT16 amiga_state::joy0dat_r() { if (m_input_device == NULL) - return m_joy0dat_port->read_safe(0xffff); + return m_joy0dat_port ? m_joy0dat_port->read() : 0xffff; - if (m_input_device->read_safe(0xff) & 0x10) - return m_joy0dat_port->read_safe(0xffff); + if (m_input_device->read() & 0x10) + return m_joy0dat_port ? m_joy0dat_port->read() : 0xffff; else - return (m_p1_mouse_y->read_safe(0xff) << 8) | m_p1_mouse_x->read_safe(0xff); + return ((m_p1_mouse_y ? m_p1_mouse_y->read() : 0xff) << 8) | (m_p1_mouse_x? m_p1_mouse_x->read() : 0xff); } UINT16 amiga_state::joy1dat_r() { if (m_input_device == NULL) - return m_joy1dat_port->read_safe(0xffff); + return m_joy1dat_port ? m_joy1dat_port->read() : 0xffff; - if (m_input_device->read_safe(0xff) & 0x20) - return m_joy1dat_port->read_safe(0xffff); + if (m_input_device->read() & 0x20) + return m_joy1dat_port ? m_joy1dat_port->read() : 0xffff; else - return (m_p2_mouse_y->read_safe(0xff) << 8) | m_p2_mouse_x->read_safe(0xff); + return ((m_p2_mouse_y ? m_p2_mouse_y->read() : 0xff) << 8) | (m_p2_mouse_x ? m_p2_mouse_x->read() : 0xff); } CUSTOM_INPUT_MEMBER( amiga_state::amiga_joystick_convert ) @@ -1172,12 +1172,12 @@ READ16_MEMBER( amiga_state::custom_chip_r ) case REG_VPOSR: CUSTOM_REG(REG_VPOSR) &= 0xff00; - CUSTOM_REG(REG_VPOSR) |= amiga_gethvpos(*m_screen) >> 16; + CUSTOM_REG(REG_VPOSR) |= amiga_gethvpos() >> 16; return CUSTOM_REG(REG_VPOSR); case REG_VHPOSR: - return amiga_gethvpos(*m_screen) & 0xffff; + return amiga_gethvpos() & 0xffff; case REG_SERDATR: if (LOG_SERIAL) @@ -1186,23 +1186,23 @@ READ16_MEMBER( amiga_state::custom_chip_r ) return CUSTOM_REG(REG_SERDATR); case REG_JOY0DAT: - if (state->m_joy0dat_port) + if (m_joy0dat_port) return joy0dat_r(); case REG_JOY1DAT: - if (state->m_joy1dat_port) + if (m_joy1dat_port) return joy1dat_r(); case REG_POTGOR: - if (state->m_potgo_port) - return state->m_potgo_port->read(); + if (m_potgo_port) + return m_potgo_port->read(); else return 0x5500; case REG_POT0DAT: - if (state->m_pot0dat_port) + if (m_pot0dat_port) { - return state->m_pot0dat_port->read(); + return m_pot0dat_port->read(); } else { @@ -1215,9 +1215,9 @@ READ16_MEMBER( amiga_state::custom_chip_r ) } case REG_POT1DAT: - if (state->m_pot1dat_port) + if (m_pot1dat_port) { - return state->m_pot1dat_port->read(); + return m_pot1dat_port->read(); } else { @@ -1230,7 +1230,7 @@ READ16_MEMBER( amiga_state::custom_chip_r ) } case REG_DSKBYTR: - return state->m_fdc->dskbytr_r(); + return m_fdc->dskbytr_r(); case REG_INTENAR: return CUSTOM_REG(REG_INTENA); @@ -1255,13 +1255,13 @@ READ16_MEMBER( amiga_state::custom_chip_r ) return CUSTOM_REG(REG_DENISEID); case REG_DSKPTH: - return state->m_fdc->dskpth_r(); + return m_fdc->dskpth_r(); case REG_DSKPTL: - return state->m_fdc->dskptl_r(); + return m_fdc->dskptl_r(); case REG_ADKCONR: - return state->m_fdc->adkcon_r(); + return m_fdc->adkcon_r(); case REG_DSKDATR: popmessage("DSKDAT R, contact MESSdev"); @@ -1294,19 +1294,19 @@ WRITE16_MEMBER( amiga_state::custom_chip_w ) break; case REG_DSKSYNC: - state->m_fdc->dsksync_w(data); + m_fdc->dsksync_w(data); break; case REG_DSKPTH: - state->m_fdc->dskpth_w(data); + m_fdc->dskpth_w(data); break; case REG_DSKPTL: - state->m_fdc->dskptl_w(data); + m_fdc->dskptl_w(data); break; case REG_DSKLEN: - state->m_fdc->dsklen_w(data); + m_fdc->dsklen_w(data); break; case REG_POTGO: @@ -1392,7 +1392,7 @@ WRITE16_MEMBER( amiga_state::custom_chip_w ) case REG_SPR0PTH: case REG_SPR1PTH: case REG_SPR2PTH: case REG_SPR3PTH: case REG_SPR4PTH: case REG_SPR5PTH: case REG_SPR6PTH: case REG_SPR7PTH: - data &= ( state->m_chip_ram_mask >> 16 ); + data &= ( m_chip_ram_mask >> 16 ); break; case REG_SPR0PTL: case REG_SPR1PTL: case REG_SPR2PTL: case REG_SPR3PTL: @@ -1414,7 +1414,7 @@ WRITE16_MEMBER( amiga_state::custom_chip_w ) case REG_COP1LCH: case REG_COP2LCH: - data &= ( state->m_chip_ram_mask >> 16 ); + data &= ( m_chip_ram_mask >> 16 ); break; case REG_COPJMP1: @@ -1445,7 +1445,7 @@ WRITE16_MEMBER( amiga_state::custom_chip_w ) /* bits BBUSY (14) and BZERO (13) are read-only */ data &= 0x9fff; data = (data & 0x8000) ? (CUSTOM_REG(offset) | (data & 0x7fff)) : (CUSTOM_REG(offset) & ~(data & 0x7fff)); - state->m_fdc->dmacon_set(data); + m_fdc->dmacon_set(data); /* if 'blitter-nasty' has been turned on and we have a blit pending, reschedule it */ if ( ( data & 0x400 ) && ( CUSTOM_REG(REG_DMACON) & 0x4000 ) ) @@ -1495,7 +1495,7 @@ WRITE16_MEMBER( amiga_state::custom_chip_w ) case REG_ADKCON: m_sound->update(); data = (data & 0x8000) ? (CUSTOM_REG(offset) | (data & 0x7fff)) : (CUSTOM_REG(offset) & ~(data & 0x7fff)); - state->m_fdc->adkcon_set(data); + m_fdc->adkcon_set(data); break; case REG_AUD0LCL: case REG_AUD0LCH: case REG_AUD0LEN: case REG_AUD0PER: case REG_AUD0VOL: @@ -1511,7 +1511,7 @@ WRITE16_MEMBER( amiga_state::custom_chip_w ) case REG_BPL1PTH: case REG_BPL2PTH: case REG_BPL3PTH: case REG_BPL4PTH: case REG_BPL5PTH: case REG_BPL6PTH: - data &= ( state->m_chip_ram_mask >> 16 ); + data &= ( m_chip_ram_mask >> 16 ); break; case REG_BPLCON0: diff --git a/src/mame/machine/atari.c b/src/mame/machine/atari.c index 34b2cdbbb4c..d576305cad2 100644 --- a/src/mame/machine/atari.c +++ b/src/mame/machine/atari.c @@ -98,15 +98,15 @@ POKEY_KEYBOARD_CB_MEMBER(atari_common_state::a800_keyboard) { case pokey_device::POK_KEY_BREAK: /* special case ... */ - ret |= ((m_keyboard[0]->read_safe(0) & 0x08) ? 0x02 : 0x00); + ret |= ((m_keyboard[0] && m_keyboard[0]->read() & 0x08) ? 0x02 : 0x00); break; case pokey_device::POK_KEY_CTRL: /* CTRL */ - ret |= ((m_fake->read_safe(0) & 0x02) ? 0x02 : 0x00); + ret |= ((m_fake && m_fake->read() & 0x02) ? 0x02 : 0x00); break; case pokey_device::POK_KEY_SHIFT: /* SHIFT */ - ret |= ((m_fake->read_safe(0) & 0x01) ? 0x02 : 0x00); + ret |= ((m_fake && m_fake->read() & 0x01) ? 0x02 : 0x00); break; } @@ -115,7 +115,7 @@ POKEY_KEYBOARD_CB_MEMBER(atari_common_state::a800_keyboard) return ret; /* decode regular key */ - ipt = m_keyboard[k543210 >> 3]->read_safe(0); + ipt = m_keyboard[k543210 >> 3] ? m_keyboard[k543210 >> 3]->read() : 0; if (ipt & (1 << (k543210 & 0x07))) ret |= 0x01; @@ -162,7 +162,7 @@ POKEY_KEYBOARD_CB_MEMBER(atari_common_state::a5200_keypads) { case pokey_device::POK_KEY_BREAK: /* special case ... */ - ret |= ((m_keypad[0]->read_safe(0) & 0x01) ? 0x02 : 0x00); + ret |= ((m_keypad[0] && m_keypad[0]->read() & 0x01) ? 0x02 : 0x00); break; case pokey_device::POK_KEY_CTRL: break; @@ -184,7 +184,7 @@ POKEY_KEYBOARD_CB_MEMBER(atari_common_state::a5200_keypads) if (k543210 == 0) return ret; - ipt = m_keypad[k543210 >> 2]->read_safe(0); + ipt = m_keypad[k543210 >> 2] ? m_keypad[k543210 >> 2]->read() : 0; if (ipt & (1 << (k543210 & 0x03))) ret |= 0x01; diff --git a/src/mame/machine/dc-ctrl.c b/src/mame/machine/dc-ctrl.c index c5c1d77c8d4..0191b75849f 100644 --- a/src/mame/machine/dc-ctrl.c +++ b/src/mame/machine/dc-ctrl.c @@ -74,14 +74,14 @@ void dc_controller_device::fixed_status(UINT32 *dest) { dest[0] = 0x20000000; // Controller dest[1] = - ((ioport(port_tag[2]) != NULL) ? 0x010000 : 0) | - ((ioport(port_tag[3]) != NULL) ? 0x020000 : 0) | - ((ioport(port_tag[4]) != NULL) ? 0x040000 : 0) | - ((ioport(port_tag[5]) != NULL) ? 0x080000 : 0) | - ((ioport(port_tag[6]) != NULL) ? 0x100000 : 0) | - ((ioport(port_tag[7]) != NULL) ? 0x200000 : 0) | - (ioport(port_tag[0])->active_safe(0) << 8) | - ioport(port_tag[1])->active_safe(0); // 1st function - controller + ((port[2] != NULL) ? 0x010000 : 0) | + ((port[3] != NULL) ? 0x020000 : 0) | + ((port[4] != NULL) ? 0x040000 : 0) | + ((port[5] != NULL) ? 0x080000 : 0) | + ((port[6] != NULL) ? 0x100000 : 0) | + ((port[7] != NULL) ? 0x200000 : 0) | + ((port[0] ? port[0]->active() : 0) << 8) | + (port[1] ? port[1]->active() : 0); // 1st function - controller dest[2] = 0; // No 2nd function dest[3] = 0; // No 3rd function dest[4] = 0x00ff; // Every region, no expansion @@ -99,13 +99,24 @@ void dc_controller_device::read(UINT32 *dest) { dest[0] = 0x21000000; // Controller dest[1] = - ioport(port_tag[0])->read_safe(0xff) | - (ioport(port_tag[1])->read_safe(0xff) << 8) | - (ioport(port_tag[2])->read_safe(0x00) << 16) | - (ioport(port_tag[3])->read_safe(0x00) << 24); + (port[0] ? port[0]->read() : 0xff) | + ((port[1] ? port[1]->read() : 0xff) << 8) | + ((port[2] ? port[2]->read() : 0) << 16) | + ((port[3] ? port[3]->read() : 0) << 24); dest[2] = - ioport(port_tag[4])->read_safe(0x80) | - (ioport(port_tag[5])->read_safe(0x80) << 8) | - (ioport(port_tag[6])->read_safe(0x80) << 16) | - (ioport(port_tag[7])->read_safe(0x80) << 24); + (port[4] ? port[4]->read() : 0x80) | + ((port[5] ? port[5]->read() : 0x80) << 8) | + ((port[6] ? port[6]->read() : 0x80) << 16) | + ((port[7] ? port[7]->read() : 0x80) << 24); } + +void dc_controller_device::device_start() +{ + maple_device::device_start(); + + for (int i = 0; i < 8; i++) + { + port[i] = ioport(port_tag[i]); + } +} + diff --git a/src/mame/machine/dc-ctrl.h b/src/mame/machine/dc-ctrl.h index 99309e8318c..38e0f32f487 100644 --- a/src/mame/machine/dc-ctrl.h +++ b/src/mame/machine/dc-ctrl.h @@ -38,6 +38,10 @@ public: void maple_w(const UINT32 *data, UINT32 in_size); +protected: + // device-level overrides + virtual void device_start(); + private: void fixed_status(UINT32 *dest); void free_status(UINT32 *dest); @@ -45,6 +49,8 @@ private: const char *port_tag[8]; const char *id, *license, *versions; + + ioport_port *port[8]; }; extern const device_type DC_CONTROLLER; diff --git a/src/mame/machine/gaelco2.c b/src/mame/machine/gaelco2.c index 306c3e1ed07..19dfd833223 100644 --- a/src/mame/machine/gaelco2.c +++ b/src/mame/machine/gaelco2.c @@ -155,7 +155,7 @@ WRITE16_MEMBER(gaelco2_state::gaelco2_coin2_w) coin_counter_w(machine(), offset & 0x01, data & 0x01); } -WRITE16_MEMBER(gaelco2_state::wrally2_coin_w) +WRITE16_MEMBER(wrally2_state::wrally2_coin_w) { /* coin counters */ coin_counter_w(machine(), (offset >> 3) & 0x01, data & 0x01); @@ -178,17 +178,17 @@ WRITE16_MEMBER(gaelco2_state::touchgo_coin_w) ***************************************************************************/ -DRIVER_INIT_MEMBER(gaelco2_state,bang) +DRIVER_INIT_MEMBER(bang_state,bang) { m_clr_gun_int = 0; } -WRITE16_MEMBER(gaelco2_state::bang_clr_gun_int_w) +WRITE16_MEMBER(bang_state::bang_clr_gun_int_w) { m_clr_gun_int = 1; } -TIMER_DEVICE_CALLBACK_MEMBER(gaelco2_state::bang_irq) +TIMER_DEVICE_CALLBACK_MEMBER(bang_state::bang_irq) { int scanline = param; @@ -218,14 +218,14 @@ TIMER_DEVICE_CALLBACK_MEMBER(gaelco2_state::bang_irq) ***************************************************************************/ -CUSTOM_INPUT_MEMBER(gaelco2_state::wrally2_analog_bit_r) +CUSTOM_INPUT_MEMBER(wrally2_state::wrally2_analog_bit_r) { int which = (FPTR)param; return (m_analog_ports[which] >> 7) & 0x01; } -WRITE16_MEMBER(gaelco2_state::wrally2_adc_clk) +WRITE16_MEMBER(wrally2_state::wrally2_adc_clk) { /* a zero/one combo is written here to clock the next analog port bit */ if (ACCESSING_BITS_0_7) @@ -241,15 +241,15 @@ WRITE16_MEMBER(gaelco2_state::wrally2_adc_clk) } -WRITE16_MEMBER(gaelco2_state::wrally2_adc_cs) +WRITE16_MEMBER(wrally2_state::wrally2_adc_cs) { /* a zero is written here to read the analog ports, and a one is written when finished */ if (ACCESSING_BITS_0_7) { if (!(data & 0xff)) { - m_analog_ports[0] = ioport("ANALOG0")->read_safe(0); - m_analog_ports[1] = ioport("ANALOG1")->read_safe(0); + m_analog_ports[0] = m_analog0->read(); + m_analog_ports[1] = m_analog1->read(); } } else diff --git a/src/mame/machine/harddriv.c b/src/mame/machine/harddriv.c index 24a6ff0da7c..e802f2bfe09 100644 --- a/src/mame/machine/harddriv.c +++ b/src/mame/machine/harddriv.c @@ -200,7 +200,7 @@ WRITE16_MEMBER( harddriv_state::hd68k_msp_io_w ) READ16_MEMBER( harddriv_state::hd68k_a80000_r ) { - return ioport("a80000")->read_safe(0xffff); + return m_a80000->read(); } READ16_MEMBER( harddriv_state::hd68k_port0_r ) @@ -222,7 +222,7 @@ READ16_MEMBER( harddriv_state::hd68k_port0_r ) */ screen_device &scr = m_gsp->screen(); - int temp = (ioport("SW1")->read_safe(0xff) << 8) | ioport("IN0")->read_safe(0xff); + int temp = ((m_sw1 ? m_sw1->read() : 0xff) << 8) | m_in0->read(); if (get_hblank(scr)) temp ^= 0x0002; temp ^= 0x0018; /* both EOCs always high for now */ return temp; @@ -231,7 +231,7 @@ READ16_MEMBER( harddriv_state::hd68k_port0_r ) READ16_MEMBER( harddriv_state::hdc68k_port1_r ) { - UINT16 result = ioport("a80000")->read_safe(0xffff); + UINT16 result = m_a80000->read(); UINT16 diff = result ^ m_hdc68k_last_port1; /* if a new shifter position is selected, use it */ @@ -259,7 +259,7 @@ READ16_MEMBER( harddriv_state::hdc68k_port1_r ) READ16_MEMBER( harddriv_state::hda68k_port1_r ) { - UINT16 result = ioport("a80000")->read_safe(0xffff); + UINT16 result = m_a80000->read(); /* merge in the wheel edge latch bit */ if (m_hdc68k_wheel_edge) @@ -272,7 +272,7 @@ READ16_MEMBER( harddriv_state::hda68k_port1_r ) READ16_MEMBER( harddriv_state::hdc68k_wheel_r ) { /* grab the new wheel value and upconvert to 12 bits */ - UINT16 new_wheel = ioport("12BADC0")->read_safe(0xffff) << 4; + UINT16 new_wheel = (m_12badc[0] ? m_12badc[0]->read() : 0xffff) << 4; /* hack to display the wheel position */ if (space.machine().input().code_pressed(KEYCODE_LSHIFT)) @@ -317,23 +317,20 @@ READ16_MEMBER( harddriv_state::hd68k_sound_reset_r ) WRITE16_MEMBER( harddriv_state::hd68k_adc_control_w ) { - static const char *const adc8names[] = { "8BADC0", "8BADC1", "8BADC2", "8BADC3", "8BADC4", "8BADC5", "8BADC6", "8BADC7" }; - static const char *const adc12names[] = { "12BADC0", "12BADC1", "12BADC2", "12BADC3" }; - COMBINE_DATA(&m_adc_control); /* handle a write to the 8-bit ADC address select */ if (m_adc_control & 0x08) { m_adc8_select = m_adc_control & 0x07; - m_adc8_data = ioport(adc8names[m_adc8_select])->read_safe(0xffff); + m_adc8_data = m_8badc[m_adc8_select] ? m_8badc[m_adc8_select]->read() : 0xffff; } /* handle a write to the 12-bit ADC address select */ if (m_adc_control & 0x40) { m_adc12_select = (m_adc_control >> 4) & 0x03; - m_adc12_data = ioport(adc12names[m_adc12_select])->read_safe(0xffff) << 4; + m_adc12_data = (m_12badc[m_adc12_select] ? m_12badc[m_adc12_select]->read() : 0xffff) << 4; } /* bit 7 selects which byte of the 12 bit data to read */ diff --git a/src/mame/machine/iteagle_fpga.c b/src/mame/machine/iteagle_fpga.c index 9a70dedc446..5d419385b59 100644 --- a/src/mame/machine/iteagle_fpga.c +++ b/src/mame/machine/iteagle_fpga.c @@ -120,6 +120,36 @@ void iteagle_fpga_device::update_sequence(UINT32 data) } } +// Eagle 1 sequence generator +void iteagle_fpga_device::update_sequence_eg1(UINT32 data) +{ + UINT32 offset = 0x04/4; + UINT32 val1, feed; + feed = ((m_seq<<4) ^ m_seq)>>7; + if (data & 0x1) { + val1 = ((m_seq & 0x2)<<6) | ((m_seq & 0x4)<<4) | ((m_seq & 0x8)<<2) | ((m_seq & 0x10)<<0) + | ((m_seq & 0x20)>>2) | ((m_seq & 0x40)>>4) | ((m_seq & 0x80)>>6) | ((m_seq & 0x100)>>8); + m_seq = (m_seq>>8) | ((feed&0xff)<<16); + //m_fpga_regs[offset] = (m_fpga_regs[offset]&0xFFFFFF00) | ((val1 + m_seq_rem1)&0xFF); + m_fpga_regs[offset] = (m_fpga_regs[offset]&0xFFFFFF00) | ((val1 + m_seq_rem1 + m_seq_rem2)&0xFF); + } else if (data & 0x2) { + val1 = ((m_seq & 0x2)<<1) | ((m_seq & 0x4)>>1) | ((m_seq & 0x8)>>3); + m_seq_rem1 = ((m_seq & 0x10)) | ((m_seq & 0x20)>>2) | ((m_seq & 0x40)>>4); + //m_seq_rem2 = ((m_seq & 0x80)>>1) | ((m_seq & 0x100)>>3) | ((m_seq & 0x200)>>5); + m_seq = (m_seq>>6) | ((feed&0x3f)<<18); + m_fpga_regs[offset] = (m_fpga_regs[offset]&0xFFFFFF00) | ((val1 + m_seq_rem1 + m_seq_rem2)&0xFF); + } else { + val1 = ((m_seq & 0x2)<<1) | ((m_seq & 0x4)>>1) | ((m_seq & 0x8)>>3); + m_seq_rem1 = ((m_seq & 0x10)) | ((m_seq & 0x20)>>2) | ((m_seq & 0x40)>>4); + m_seq_rem2 = ((m_seq & 0x80)>>1) | ((m_seq & 0x100)>>3) | ((m_seq & 0x200)>>5); + m_seq = (m_seq>>9) | ((feed&0x1ff)<<15); + m_fpga_regs[offset] = (m_fpga_regs[offset]&0xFFFFFF00) | ((val1 + m_seq_rem1 + m_seq_rem2) & 0xff); + } + if (0 && LOG_FPGA) + logerror("%s:fpga update_sequence In: %02X Seq: %06X Out: %02X other %02X%02X%02X\n", machine().describe_context(), + data, m_seq, m_fpga_regs[offset]&0xff, m_seq_rem2, m_seq_rem1, val1); +} + //------------------------------------------------- // device_timer - called when our device timer expires //------------------------------------------------- @@ -200,6 +230,9 @@ WRITE32_MEMBER( iteagle_fpga_device::fpga_w ) switch (offset) { case 0x04/4: if (ACCESSING_BITS_0_7) { + if ((m_version & 0xff00) == 0x0200) + update_sequence_eg1(data & 0xff); + else // ATMEL Chip access. Returns version id's when bit 7 is set. update_sequence(data & 0xff); if (0 && LOG_FPGA) @@ -596,6 +629,7 @@ void iteagle_ide_device::set_irq_info(const char *tag, const int irq_num) void iteagle_ide_device::device_start() { m_cpu = machine().device<cpu_device>(m_cpu_tag); + m_irq_status = 0; pci_device::device_start(); add_map(sizeof(m_ctrl_regs), M_IO, FUNC(iteagle_ide_device::ctrl_map)); // ctrl defaults to base address 0x00000000 @@ -617,6 +651,9 @@ void iteagle_ide_device::device_reset() memset(m_ctrl_regs, 0, sizeof(m_ctrl_regs)); m_ctrl_regs[0x10/4] = 0x00000000; // 0x6=No SIMM, 0x2, 0x1, 0x0 = SIMM . Top 16 bits are compared to 0x3. memset(m_rtc_regs, 0, sizeof(m_rtc_regs)); + m_rtc_regs[0xa] = 0x20; // 32.768 MHz + m_rtc_regs[0xb] = 0x02; // 24-hour format + m_irq_status = 0; } READ32_MEMBER( iteagle_ide_device::ctrl_r ) @@ -643,7 +680,8 @@ READ32_MEMBER( iteagle_ide_device::ctrl_r ) m_rtc_regs[7] = dec_2_bcd(systime.local_time.mday); m_rtc_regs[8] = dec_2_bcd(systime.local_time.month + 1); m_rtc_regs[9] = dec_2_bcd(systime.local_time.year - 1900); // Epoch is 1900 - m_rtc_regs[0xa] &= ~0x10; // Reg A Status + //m_rtc_regs[9] = 0x99; // Use 1998 + //m_rtc_regs[0xa] &= ~0x10; // Reg A Status //m_ctrl_regs[0xb] &= 0x10; // Reg B Status //m_ctrl_regs[0xc] &= 0x10; // Reg C Interupt Status m_rtc_regs[0xd] = 0x80; // Reg D Valid time/ram Status @@ -693,19 +731,28 @@ READ32_MEMBER( iteagle_ide_device::ide_r ) { UINT32 result = m_ide->read_cs0(space, offset, mem_mask); if (offset==0x4/4 && ACCESSING_BITS_24_31) { - if (m_irq_num!=-1) { + if (m_irq_num!=-1 && m_irq_status==1) { + m_irq_status = 0; m_cpu->set_input_line(m_irq_num, CLEAR_LINE); if (LOG_IDE) - logerror("%s:ide_interrupt Clearing interrupt\n", machine().describe_context()); + logerror("%s:ide_r Clearing interrupt\n", machine().describe_context()); } } - if (LOG_IDE) + if (LOG_IDE && mem_mask!=0xffffffff) logerror("%s:ide_r read from offset %04X = %08X & %08X\n", machine().describe_context(), offset*4, result, mem_mask); return result; } WRITE32_MEMBER( iteagle_ide_device::ide_w ) { m_ide->write_cs0(space, offset, data, mem_mask); + if (offset==0x4/4 && ACCESSING_BITS_24_31) { + if (m_irq_num!=-1 && m_irq_status==1) { + m_irq_status = 0; + m_cpu->set_input_line(m_irq_num, CLEAR_LINE); + if (LOG_IDE) + logerror("%s:ide_w Clearing interrupt\n", machine().describe_context()); + } + } if (LOG_IDE) logerror("%s:ide_w write to offset %04X = %08X & %08X\n", machine().describe_context(), offset*4, data, mem_mask); } @@ -724,7 +771,8 @@ WRITE32_MEMBER( iteagle_ide_device::ide_ctrl_w ) } WRITE_LINE_MEMBER(iteagle_ide_device::ide_interrupt) { - if (m_irq_num!=-1) { + if (m_irq_num!=-1 && m_irq_status==0) { + m_irq_status = 1; m_cpu->set_input_line(m_irq_num, ASSERT_LINE); if (LOG_IDE_CTRL) logerror("%s:ide_interrupt Setting interrupt\n", machine().describe_context()); @@ -735,10 +783,11 @@ READ32_MEMBER( iteagle_ide_device::ide2_r ) { UINT32 result = m_ide2->read_cs0(space, offset, mem_mask); if (offset==0x4/4 && ACCESSING_BITS_24_31) { - if (m_irq_num!=-1) { + if (m_irq_num!=-1 && m_irq_status==1) { + m_irq_status = 0; m_cpu->set_input_line(m_irq_num, CLEAR_LINE); if (LOG_IDE_CTRL) - logerror("%s:ide2_interrupt Clearing interrupt\n", machine().describe_context()); + logerror("%s:ide2_r Clearing interrupt\n", machine().describe_context()); } } if (LOG_IDE) @@ -748,6 +797,14 @@ READ32_MEMBER( iteagle_ide_device::ide2_r ) WRITE32_MEMBER( iteagle_ide_device::ide2_w ) { m_ide2->write_cs0(space, offset, data, mem_mask); + if (offset==0x4/4 && ACCESSING_BITS_24_31) { + if (m_irq_num!=-1 && m_irq_status==1) { + m_irq_status = 0; + m_cpu->set_input_line(m_irq_num, CLEAR_LINE); + if (LOG_IDE_CTRL) + logerror("%s:ide2_w Clearing interrupt\n", machine().describe_context()); + } + } if (LOG_IDE) logerror("%s:ide2_w write to offset %04X = %08X & %08X\n", machine().describe_context(), offset*4, data, mem_mask); } @@ -766,7 +823,8 @@ WRITE32_MEMBER( iteagle_ide_device::ide2_ctrl_w ) } WRITE_LINE_MEMBER(iteagle_ide_device::ide2_interrupt) { - if (m_irq_num!=-1) { + if (m_irq_num!=-1 && m_irq_status==0) { + m_irq_status = 1; m_cpu->set_input_line(m_irq_num, ASSERT_LINE); if (LOG_IDE_CTRL) logerror("%s:ide2_interrupt Setting interrupt\n", machine().describe_context()); diff --git a/src/mame/machine/iteagle_fpga.h b/src/mame/machine/iteagle_fpga.h index 594ada0d360..bb8b4331182 100644 --- a/src/mame/machine/iteagle_fpga.h +++ b/src/mame/machine/iteagle_fpga.h @@ -73,6 +73,7 @@ private: UINT32 m_seq; UINT32 m_seq_rem1, m_seq_rem2; void update_sequence(UINT32 data); + void update_sequence_eg1(UINT32 data); DECLARE_ADDRESS_MAP(rtc_map, 32); DECLARE_ADDRESS_MAP(fpga_map, 32); @@ -132,6 +133,7 @@ private: const char *m_cpu_tag; cpu_device *m_cpu; int m_irq_num; + int m_irq_status; UINT32 m_ctrl_regs[0xd0/4]; UINT8 m_rtc_regs[0x100]; diff --git a/src/mame/machine/jvs13551.c b/src/mame/machine/jvs13551.c index 40b669e235e..fa0350e60a0 100644 --- a/src/mame/machine/jvs13551.c +++ b/src/mame/machine/jvs13551.c @@ -79,6 +79,10 @@ UINT8 sega_837_13551::comm_method_version() void sega_837_13551::device_start() { jvs_device::device_start(); + for (int i = 0; i < ARRAY_LENGTH(port_tag); i++) + { + port[i] = ioport(port_tag[i]); + } save_item(NAME(coin_counter)); } @@ -140,9 +144,9 @@ bool sega_837_13551::switches(UINT8 *&buf, UINT8 count_players, UINT8 bytes_per_ if(count_players > 2 || bytes_per_switch > 2) return false; - *buf++ = ioport(port_tag[0])->read_safe(0); + *buf++ = port[0] ? port[0]->read() : 0; for(int i=0; i<count_players; i++) { - UINT32 val = ioport(port_tag[1+i])->read_safe(0); + UINT32 val = port[1+i] ? port[1+i]->read() : 0; for(int j=0; j<bytes_per_switch; j++) *buf++ = val >> ((1-j) << 3); } @@ -155,7 +159,7 @@ bool sega_837_13551::analogs(UINT8 *&buf, UINT8 count) if(count > 8) return false; for(int i=0; i<count; i++) { - UINT16 val = ioport(port_tag[3+i])->read_safe(0x8000); + UINT16 val = port[3+i] ? port[3+i]->read() : 0x8000; *buf++ = val >> 8; *buf++ = val; } @@ -170,7 +174,10 @@ bool sega_837_13551::swoutputs(UINT8 count, const UINT8 *vals) return false; jvs_outputs = vals[0] & 0xfc; logerror("837-13551: output %02x\n", jvs_outputs); - ioport(port_tag[11])->write_safe(jvs_outputs, 0xfc); + if (port[11]) + { + port[11]->write(jvs_outputs, 0xfc); + } return true; } @@ -178,7 +185,7 @@ bool sega_837_13551::swoutputs(UINT8 id, UINT8 val) { if(id > 6) return false; - handle_output(port_tag[11], id, val); + handle_output(port[11], id, val); logerror("837-13551: output %d, %d\n", id, val); return true; } diff --git a/src/mame/machine/jvs13551.h b/src/mame/machine/jvs13551.h index 98f095e3c1c..6385178b318 100644 --- a/src/mame/machine/jvs13551.h +++ b/src/mame/machine/jvs13551.h @@ -56,6 +56,7 @@ protected: private: const char *port_tag[12]; + ioport_port *port[12]; UINT16 coin_counter[2]; }; diff --git a/src/mame/machine/megadriv.c b/src/mame/machine/megadriv.c index 03417e178e9..3b20ff80a78 100644 --- a/src/mame/machine/megadriv.c +++ b/src/mame/machine/megadriv.c @@ -214,14 +214,14 @@ READ8_MEMBER(md_base_state::megadrive_io_read_data_port_6button) { /* here we read B, C & the additional buttons */ retdata = (m_megadrive_io_data_regs[portnum] & helper) | - (((m_io_pad_3b[portnum]->read_safe(0) & 0x30) | - (m_io_pad_6b[portnum]->read_safe(0) & 0x0f)) & ~helper); + ((((m_io_pad_3b[portnum] ? m_io_pad_3b[portnum]->read() : 0) & 0x30) | + ((m_io_pad_6b[portnum] ? m_io_pad_6b[portnum]->read() : 0) & 0x0f)) & ~helper); } else { /* here we read B, C & the directional buttons */ retdata = (m_megadrive_io_data_regs[portnum] & helper) | - ((m_io_pad_3b[portnum]->read_safe(0) & 0x3f) & ~helper); + (((m_io_pad_3b[portnum] ? m_io_pad_3b[portnum]->read() : 0) & 0x3f) & ~helper); } } else @@ -230,20 +230,20 @@ READ8_MEMBER(md_base_state::megadrive_io_read_data_port_6button) { /* here we read ((Start & A) >> 2) | 0x00 */ retdata = (m_megadrive_io_data_regs[portnum] & helper) | - (((m_io_pad_3b[portnum]->read_safe(0) & 0xc0) >> 2) & ~helper); + ((((m_io_pad_3b[portnum] ? m_io_pad_3b[portnum]->read() : 0) & 0xc0) >> 2) & ~helper); } else if (m_io_stage[portnum]==2) { /* here we read ((Start & A) >> 2) | 0x0f */ retdata = (m_megadrive_io_data_regs[portnum] & helper) | - ((((m_io_pad_3b[portnum]->read_safe(0) & 0xc0) >> 2) | 0x0f) & ~helper); + (((((m_io_pad_3b[portnum] ? m_io_pad_3b[portnum]->read() : 0) & 0xc0) >> 2) | 0x0f) & ~helper); } else { /* here we read ((Start & A) >> 2) | Up and Down */ retdata = (m_megadrive_io_data_regs[portnum] & helper) | - ((((m_io_pad_3b[portnum]->read_safe(0) & 0xc0) >> 2) | - (m_io_pad_3b[portnum]->read_safe(0) & 0x03)) & ~helper); + (((((m_io_pad_3b[portnum] ? m_io_pad_3b[portnum]->read() : 0) & 0xc0) >> 2) | + ((m_io_pad_3b[portnum] ? m_io_pad_3b[portnum]->read() : 0) & 0x03)) & ~helper); } } @@ -263,14 +263,14 @@ READ8_MEMBER(md_base_state::megadrive_io_read_data_port_3button) { /* here we read B, C & the directional buttons */ retdata = (m_megadrive_io_data_regs[portnum] & helper) | - (((m_io_pad_3b[portnum]->read_safe(0) & 0x3f) | 0x40) & ~helper); + ((((m_io_pad_3b[portnum] ? m_io_pad_3b[portnum]->read() : 0) & 0x3f) | 0x40) & ~helper); } else { /* here we read ((Start & A) >> 2) | Up and Down */ retdata = (m_megadrive_io_data_regs[portnum] & helper) | - ((((m_io_pad_3b[portnum]->read_safe(0) & 0xc0) >> 2) | - (m_io_pad_3b[portnum]->read_safe(0) & 0x03) | 0x40) & ~helper); + (((((m_io_pad_3b[portnum] ? m_io_pad_3b[portnum]->read() : 0) & 0xc0) >> 2) | + ((m_io_pad_3b[portnum] ? m_io_pad_3b[portnum]->read() : 0) & 0x03) | 0x40) & ~helper); } return retdata; @@ -718,7 +718,7 @@ WRITE8_MEMBER(md_base_state::megadriv_z80_vdp_write ) case 0x15: case 0x17: // accessed by either segapsg_device or sn76496_device - space.machine().device<sn76496_base_device>("snsnd")->write(space, 0, data); + m_snsnd->write(space, 0, data); break; default: @@ -1103,7 +1103,7 @@ DRIVER_INIT_MEMBER(md_base_state, megadrie) void md_base_state::screen_eof_megadriv(screen_device &screen, bool state) { - if (m_io_reset->read_safe(0x00) & 0x01) + if (m_io_reset && m_io_reset->read() & 0x01) m_maincpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE); // rising edge diff --git a/src/mame/machine/micro3d.c b/src/mame/machine/micro3d.c index 9d9eb6c7f99..4c207dfe28f 100644 --- a/src/mame/machine/micro3d.c +++ b/src/mame/machine/micro3d.c @@ -299,7 +299,7 @@ WRITE32_MEMBER(micro3d_state::micro3d_mac2_w) case 0x08: { int i; - const UINT16 *rom = (UINT16*)memregion("vertex")->base(); + const UINT16 *rom = (UINT16*)m_vertex->base(); for (i = 0; i <= cnt; ++i) { @@ -338,7 +338,7 @@ WRITE32_MEMBER(micro3d_state::micro3d_mac2_w) case 0x0c: { int i; - const UINT16 *rom = (UINT16*)memregion("vertex")->base(); + const UINT16 *rom = (UINT16*)m_vertex->base(); for (i = 0; i <= cnt; ++i) { @@ -371,7 +371,7 @@ WRITE32_MEMBER(micro3d_state::micro3d_mac2_w) case 0x0f: { int i; - const UINT16 *rom = (UINT16*)memregion("vertex")->base(); + const UINT16 *rom = (UINT16*)m_vertex->base(); for (i = 0; i <= cnt; ++i, vtx_addr += 4) { @@ -467,16 +467,16 @@ WRITE32_MEMBER(micro3d_state::micro3d_mac2_w) READ16_MEMBER(micro3d_state::micro3d_encoder_h_r) { - UINT16 x_encoder = ioport("JOYSTICK_X")->read_safe(0); - UINT16 y_encoder = ioport("JOYSTICK_Y")->read_safe(0); + UINT16 x_encoder = m_joystick_x ? m_joystick_x->read() : 0; + UINT16 y_encoder = m_joystick_y ? m_joystick_y->read() : 0; return (y_encoder & 0xf00) | ((x_encoder & 0xf00) >> 8); } READ16_MEMBER(micro3d_state::micro3d_encoder_l_r) { - UINT16 x_encoder = ioport("JOYSTICK_X")->read_safe(0); - UINT16 y_encoder = ioport("JOYSTICK_Y")->read_safe(0); + UINT16 x_encoder = m_joystick_x ? m_joystick_x->read() : 0; + UINT16 y_encoder = m_joystick_y ? m_joystick_y->read() : 0; return ((y_encoder & 0xff) << 8) | (x_encoder & 0xff); } @@ -485,9 +485,9 @@ TIMER_CALLBACK_MEMBER(micro3d_state::adc_done_callback) { switch (param) { - case 0: m_adc_val = ioport("THROTTLE")->read_safe(0); + case 0: m_adc_val = m_throttle ? m_throttle->read() : 0; break; - case 1: m_adc_val = (UINT8)((255.0/100.0) * ioport("VOLUME")->read() + 0.5); + case 1: m_adc_val = (UINT8)((255.0/100.0) * m_volume->read() + 0.5); break; case 2: break; case 3: break; diff --git a/src/mame/machine/mie.c b/src/mame/machine/mie.c index b82c3fe8f8f..108192fd021 100644 --- a/src/mame/machine/mie.c +++ b/src/mame/machine/mie.c @@ -108,6 +108,11 @@ void mie_device::device_start() timer = timer_alloc(0); jvs = machine().device<mie_jvs_device>(jvs_name); + for (int i = 0; i < ARRAY_LENGTH(gpio_name); i++) + { + gpio_port[i] = gpio_name[i] ? ioport(gpio_name[i]) : NULL; + } + save_item(NAME(gpiodir)); save_item(NAME(gpio_val)); save_item(NAME(irq_enable)); @@ -215,7 +220,7 @@ READ8_MEMBER(mie_device::read_78xx) READ8_MEMBER(mie_device::gpio_r) { if(gpiodir & (1 << offset)) - return gpio_name[offset] ? ioport(gpio_name[offset])->read() : 0xff; + return gpio_port[offset] ? gpio_port[offset]->read() : 0xff; else return gpio_val[offset]; } @@ -223,8 +228,8 @@ READ8_MEMBER(mie_device::gpio_r) WRITE8_MEMBER(mie_device::gpio_w) { gpio_val[offset] = data; - if(!(gpiodir & (1 << offset)) && gpio_name[offset]) - ioport(gpio_name[offset])->write(data, 0xff); + if(!(gpiodir & (1 << offset)) && gpio_port[offset]) + gpio_port[offset]->write(data, 0xff); } READ8_MEMBER(mie_device::gpiodir_r) diff --git a/src/mame/machine/mie.h b/src/mame/machine/mie.h index a011d463592..d76f17ee4f9 100644 --- a/src/mame/machine/mie.h +++ b/src/mame/machine/mie.h @@ -103,6 +103,7 @@ private: z80_device *cpu; emu_timer *timer; mie_jvs_device *jvs; + ioport_port *gpio_port[8]; UINT32 tbuf[TBUF_SIZE]; UINT32 control, lreg, jvs_rpos; diff --git a/src/mame/machine/n64.c b/src/mame/machine/n64.c index 3d93b68d9c6..a93065780f5 100644 --- a/src/mame/machine/n64.c +++ b/src/mame/machine/n64.c @@ -1003,7 +1003,7 @@ void n64_periphs::vi_recalculate_resolution() int height = ((vi_yscale & 0x00000fff) * (y_end - y_start)) / 0x400; rectangle visarea = m_screen->visible_area(); - attoseconds_t period = m_screen->frame_period().attoseconds; + attoseconds_t period = m_screen->frame_period().attoseconds(); if (width == 0 || height == 0) { diff --git a/src/mame/machine/ns10crypt.c b/src/mame/machine/ns10crypt.c new file mode 100644 index 00000000000..8804898cc2d --- /dev/null +++ b/src/mame/machine/ns10crypt.c @@ -0,0 +1,375 @@ +// license:BSD-3 +// copyright-holders:Andreas Naive +/**************************************************************************** +Namco System 10 decryption emulation + +(As of 2015-08, this file is still pretty much a WIP; changes are expected as +out knowledge progress.) + +The decryption used by type-2 System10 PCBs (MEM-N) acts on 16-bit words and is +designed to operate in a serial way: once the decryption is triggered, every +word is XORed with a mask calculated over data taken from the previous words +(both encrypted and decrypted). Type-1 PCBs seem to use a similar +scheme, probably involving the word address too and a bitswap, but his relation +to what is described here needs further investigation. + +In type-2 PCBs, the encrypted data is always contained in the first ROM of the +game (8E), and it's always stored spanning an integer number of NAND blocks +(the K9F2808U0B is organized in blocks of 16 KiB, each containing 32 pages of +0x200 bytes). The first part of the encrypted data is stored at about the end +of the ROM, and apparently all the blocks in that area are processed in +reverse order (first the one nearest the end, then the second nearest, etc); +the second part goes immediately after it from a logic perspective, but it's +physically located at the area starting at 0x28000 in the ROM. Games, after +some bootup code has been executed, will copy the encrypted content from +the NANDs to RAM, moment at which the decryption is triggered. Physical locations +of the encrypted programs in the first NAND, together with the RAM region where +they are loaded, are summarized in the following table: + +game head region tail region RAM address +-------- ---------------- -------------- ----------- +chocovdr [fdc000,1000000) [28000,1dc000) 80010000 +gamshara [fdc000,1000000) [28000,144000) 80010000 +knpuzzle [fc8000,fcc000) [28000,40c000) 80030000 +konotako [fdc000,1000000) [28000,b4000) 80010000 +mrdrilrg [fd4000,fd8000) [28000,3dc000) 80030000 +nflclsfb [fdc000,1000000) [28000,204000) 80010000 +startrgn [fdc000,1000000) [28000,b4000) 80010000 + +knpuzzle constitutes an interesting case, as it seem to be playing some tricks +in order to obfuscate the location of the main program; first, both regions +are padded by encrypted blank regions (at [fc4000,fc8000) & [40c000,458000)), +maybe in an attempt to hinder the recognition of the extremes of the +encrypted data; second, some kind of protection trap seem to simulate a loading +of the encrypted region as if it were using the same head region and RAM address +than most sets ([fdc000,1000000) & 80010000), while those aren't the correct +values for it. + +Most games do a single decryption run, so the process is only initialized once; +however, at least one game (gamshara) does write to the triggering register +more than once, effectively resetting the internal state of the decrypter +several times. (gamshara do it every 5 NAND blocks; the lowest nibble written to +the register seem to control the initial value of the state; see details in the +implementation). + +The calculation of the XOR masks seem to operate this way: most bits are +calculated by using linear equations over GF(2) taking as input data the bits from +previously processed words; however, one nonlinear calculation is performed +per word processed, and that calculation can affect several bits from the +mask (but, apparently, the same nonlinear terms affect all of them), +though in most cases only one bit is involved. Till now, most of the linear +relations seem to depend only on the previous 3 words, but there are some +bits from those showing nonlinear behaviour which seem to use farther words; +this is still being investigated, and the implementation is probable to +change to reflect new findings. + +The bits affected by the nonlinear calculations are given below: +chocovdr -> #10 +gamshara -> #2 +gjspace -> a subset of {#3, #4, #5, #10, #11}, maybe all of them +gunbalina -> #11 +knpuzzle -> #1 +konotako -> #15 +mrdrilrg -> #0 & #4 +nflclsfb -> #2 +panikuru -> #2 +ptblank3 -> #11 +startrgn -> #4 + +Overall, the values used as linear masks, those from the initSbox and +the values and bit order used at initialization time are not expected to +be exactly the ones used by the hardware; given the many degrees of freedom +caused by the nature of the scheme, the whole set of values should +be considered as a representative of a class of equivalence of functionally +equivalent datasets, nothing else. + + +TO-DO: +* Research the nonlinear calculations in most of the games. +* Determine how many previous words the hardware is really using, and change +the implementation accordingly. + +Observing the linear equations, there is a keen difference between bits using +just a bunch of previous bits, and others using much more bits from more words; +simplifying the latter ones could be handy, and probably closer to what the +hardware is doing. Two possible simplifications could be: +A) The linear relations are creating lots of identities involving the bits +from the sequence; they could be exploited to simplify the equations (but +only when the implementation be stable, to avoid duplicating work). +B) It's possible that some of those calculations are being stored and then +used as another input bits for subsequent masks. Determining that (supposed) +bits and factoring out them would simplify the expressions, in case they +really exist. +*****************************************************************************/ + +#include "emu.h" +#include "ns10crypt.h" + +const device_type CHOCOVDR_DECRYPTER = &device_creator<chocovdr_decrypter_device>; +const device_type GAMSHARA_DECRYPTER = &device_creator<gamshara_decrypter_device>; +const device_type KNPUZZLE_DECRYPTER = &device_creator<knpuzzle_decrypter_device>; +const device_type KONOTAKO_DECRYPTER = &device_creator<konotako_decrypter_device>; +const device_type NFLCLSFB_DECRYPTER = &device_creator<nflclsfb_decrypter_device>; +const device_type STARTRGN_DECRYPTER = &device_creator<startrgn_decrypter_device>; + +// this could perfectly be part of the per-game logic; by now, only gamshara seems to use it, so we keep it global +const int ns10_decrypter_device::initSbox[16] = {0,12,13,6,2,4,9,8,11,1,7,15,10,5,14,3}; + +ns10_decrypter_device::ns10_decrypter_device(device_type type, const ns10_crypto_logic &logic, const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, type, "Namco System 10 Decrypter", tag, owner, clock, "ns10_crypto", __FILE__) + , _active(false) + , _logic(logic) +{ +} + +void ns10_decrypter_device::activate(int iv) +{ + init(iv); + _active = true; +} + +void ns10_decrypter_device::deactivate() +{ + _active = false; +} + +bool ns10_decrypter_device::is_active()const +{ + return _active; +} + +UINT16 ns10_decrypter_device::decrypt(UINT16 cipherword) +{ + UINT16 plainword = cipherword ^ _mask; + + _previous_cipherwords <<= 16; + _previous_cipherwords ^= cipherword; + _previous_plainwords <<= 16; + _previous_plainwords ^= plainword; + + _mask = 0; + for (int j = 15; j >= 0; --j) + { + _mask <<= 1; + _mask ^= _reducer->gf2_reduce(_logic.eMask[j] & _previous_cipherwords); + _mask ^= _reducer->gf2_reduce(_logic.dMask[j] & _previous_plainwords); + } + _mask ^= _logic.xMask; + _mask ^= _logic.nonlinear_calculation(_previous_cipherwords, _previous_plainwords, *_reducer); + + return plainword; +} + +void ns10_decrypter_device::device_start() +{ + _active = false; + _reducer = auto_alloc(machine(), gf2_reducer()); +} + +void ns10_decrypter_device::init(int iv) +{ + // by now, only gamshara requires non-trivial initialization code; data + // should be moved to the per-game logic in case any other game do it differently + _previous_cipherwords = BITSWAP16(initSbox[iv],3,16,16,2,1,16,16,0,16,16,16,16,16,16,16,16); + _previous_plainwords = 0; + _mask = 0; +} + +gf2_reducer::gf2_reducer() +{ + int reduction; + + // create a look-up table of GF2 reductions of 16-bits words + for (int i = 0; i < 0x10000; ++i) + { + reduction = 0; + for (int j = 0; j < 16; ++j) + reduction ^= BIT(i, j); + + _gf2Reduction[i] = reduction; + } +} + +int gf2_reducer::gf2_reduce(UINT64 num)const +{ + return + _gf2Reduction[num & 0xffff] ^ + _gf2Reduction[(num >> 16) & 0xffff] ^ + _gf2Reduction[(num >> 32) & 0xffff] ^ + _gf2Reduction[num >> 48]; +} + + +// game-specific logic + +// static UINT16 mrdrilrg_nonlinear_calc(UINT64 previous_cipherwords, UINT64 previous_plainwords, const gf2_reducer& reducer) +// { + // UINT64 previous_masks = previous_cipherwords ^ previous_plainwords; + // return (reducer.gf2_reduce(0x00000a00a305c826ull & previousMasks) & reducer.gf2_reduce(0x0000011800020000ull & previousMasks)) * 0x0011; +// } + + +static UINT16 chocovdr_nonlinear_calc(UINT64 previous_cipherwords, UINT64 previous_plainwords, const gf2_reducer& reducer) +{ + UINT64 previous_masks = previous_cipherwords ^ previous_plainwords; + return ((previous_masks >> 9) & (reducer.gf2_reduce(0x0000000010065810ull & previous_cipherwords) ^ reducer.gf2_reduce(0x0000000021005810ull & previous_plainwords)) & 1) << 10; +} + +static const ns10_decrypter_device::ns10_crypto_logic chocovdr_crypto_logic = { + { + 0x00005239351ec1daull, 0x0000000000008090ull, 0x0000000048264808ull, 0x0000000000004820ull, + 0x0000000000000500ull, 0x0000000058ff5a54ull, 0x00000000d8220208ull, 0x00005239351e91d3ull, + 0x000000009a1dfaffull, 0x0000000090040001ull, 0x0000000000000100ull, 0x0000000000001408ull, + 0x0000000032efd3f1ull, 0x00000000000000d0ull, 0x0000000032efd2d7ull, 0x0000000000000840ull, + }, { + 0x00002000410485daull, 0x0000000000008081ull, 0x0000000008044088ull, 0x0000000000004802ull, + 0x0000000000000500ull, 0x00000000430cda54ull, 0x0000000010000028ull, 0x00002000410491dbull, + 0x000000001100fafeull, 0x0000000018040001ull, 0x0000000000000010ull, 0x0000000000000508ull, + 0x000000006800d3f5ull, 0x0000000000000058ull, 0x000000006800d2d5ull, 0x0000000000001840ull, + }, + 0x5b22, + chocovdr_nonlinear_calc +}; + +static UINT16 gamshara_nonlinear_calc(UINT64 previous_cipherwords, UINT64 previous_plainwords, const gf2_reducer&) +{ + UINT64 previous_masks = previous_cipherwords ^ previous_plainwords; + return ((previous_masks >> 7) & (previous_masks >> 13) & 1) << 2; +} + +static const ns10_decrypter_device::ns10_crypto_logic gamshara_crypto_logic = { + { + 0x0000000000000028ull, 0x0000cae83f389fd9ull, 0x0000000000001000ull, 0x0000000042823402ull, + 0x0000cae8736a0592ull, 0x0000cae8736a8596ull, 0x000000008b4095b9ull, 0x0000000000002100ull, + 0x0000000004018228ull, 0x0000000000000042ull, 0x0000000000000818ull, 0x0000000000004010ull, + 0x000000008b4099f1ull, 0x00000000044bce08ull, 0x00000000000000c1ull, 0x0000000042823002ull, + }, { + 0x0000000000000028ull, 0x00000904c2048dd9ull, 0x0000000000008000ull, 0x0000000054021002ull, + 0x00000904e0078592ull, 0x00000904e00785b2ull, 0x00000000440097f9ull, 0x0000000000002104ull, + 0x0000000029018308ull, 0x0000000000000042ull, 0x0000000000000850ull, 0x0000000000004012ull, + 0x000000004400d1f1ull, 0x000000006001ce08ull, 0x00000000000000c8ull, 0x0000000054023002ull, + }, + 0x25ab, + gamshara_nonlinear_calc +}; + +static UINT16 knpuzzle_nonlinear_calc(UINT64 previous_cipherwords, UINT64 previous_plainwords, const gf2_reducer& reducer) +{ + UINT64 previous_masks = previous_cipherwords ^ previous_plainwords; + return ((previous_masks >> 0x13) & (reducer.gf2_reduce(0x0000000014001290ull & previous_cipherwords) ^ reducer.gf2_reduce(0x0000000000021290ull & previous_plainwords)) & 1) << 1; +} + +static const ns10_decrypter_device::ns10_crypto_logic knpuzzle_crypto_logic = { + { + 0x00000000c0a4208cull, 0x00000000204100a8ull, 0x000000000c0306a0ull, 0x000000000819e944ull, + 0x0000000000001400ull, 0x0000000000000061ull, 0x000000000141401cull, 0x0000000000000020ull, + 0x0000000001418010ull, 0x00008d6a1eb690cfull, 0x00008d6a4d3b90ceull, 0x0000000000004201ull, + 0x00000000012c00a2ull, 0x000000000c0304a4ull, 0x0000000000000500ull, 0x0000000000000980ull, + }, { + 0x000000002a22608cull, 0x00000000002300a8ull, 0x0000000000390ea0ull, 0x000000000100a9c4ull, + 0x0000000000001400ull, 0x0000000000000041ull, 0x0000000003014014ull, 0x0000000000000022ull, + 0x0000000003010110ull, 0x00000800031a80cfull, 0x00000800003398deull, 0x0000000000004200ull, + 0x00000000012a04a2ull, 0x00000000003984a4ull, 0x0000000000000700ull, 0x0000000000000882ull, + }, + 0x01e2, + knpuzzle_nonlinear_calc +}; + +static UINT16 konotako_nonlinear_calc(UINT64 previous_cipherwords, UINT64 previous_plainwords, const gf2_reducer&) +{ + UINT64 previous_masks = previous_cipherwords ^ previous_plainwords; + return ((previous_masks >> 7) & (previous_masks >> 15) & 1) << 15; +} + +static const ns10_decrypter_device::ns10_crypto_logic konotako_crypto_logic = { + { + 0x000000000000004cull, 0x00000000d39e3d3dull, 0x0000000000001110ull, 0x0000000000002200ull, + 0x000000003680c008ull, 0x0000000000000281ull, 0x0000000000005002ull, 0x00002a7371895a47ull, + 0x0000000000000003ull, 0x00002a7371897a4eull, 0x00002a73aea17a41ull, 0x00002a73fd895a4full, + 0x000000005328200aull, 0x0000000000000010ull, 0x0000000000000040ull, 0x0000000000000200ull, + }, { + 0x000000000000008cull, 0x0000000053003d25ull, 0x0000000000001120ull, 0x0000000000002200ull, + 0x0000000037004008ull, 0x0000000000000282ull, 0x0000000000006002ull, 0x0000060035005a47ull, + 0x0000000000000003ull, 0x0000060035001a4eull, 0x0000060025007a41ull, 0x00000600b5005a2full, + 0x000000009000200bull, 0x0000000000000310ull, 0x0000000000001840ull, 0x0000000000000400ull, + }, + 0x0748, + konotako_nonlinear_calc +}; + +static UINT16 nflclsfb_nonlinear_calc(UINT64 previous_cipherwords, UINT64 previous_plainwords, const gf2_reducer& reducer) +{ + UINT64 previous_masks = previous_cipherwords ^ previous_plainwords; + return ((previous_masks >> 1) & (reducer.gf2_reduce(0x0000000040de8fb3ull & previous_cipherwords) ^ reducer.gf2_reduce(0x0000000088008fb3ull & previous_plainwords)) & 1) << 2; +} + +static const ns10_decrypter_device::ns10_crypto_logic nflclsfb_crypto_logic = { + { + 0x000034886e281880ull, 0x0000000012c5e7baull, 0x0000000000000200ull, 0x000000002900002aull, + 0x00000000000004c0ull, 0x0000000012c5e6baull, 0x00000000e0df8bbbull, 0x000000002011532aull, + 0x0000000000009040ull, 0x0000000000006004ull, 0x000000000000a001ull, 0x000034886e2818e1ull, + 0x0000000000004404ull, 0x0000000000004200ull, 0x0000000000009100ull, 0x0000000020115712ull, + }, { + 0x00000e00060819c0ull, 0x000000000e08e7baull, 0x0000000000000800ull, 0x000000000100002aull, + 0x00000000000010c0ull, 0x000000000e08cebaull, 0x0000000088018bbbull, 0x000000008c005302ull, + 0x000000000000c040ull, 0x0000000000006010ull, 0x0000000000000001ull, 0x00000e00060818e3ull, + 0x0000000000000404ull, 0x0000000000004201ull, 0x0000000000001100ull, 0x000000008c0057b2ull, + }, + 0xbe32, + nflclsfb_nonlinear_calc +}; + +static UINT16 startrgn_nonlinear_calc(UINT64 previous_cipherwords, UINT64 previous_plainwords, const gf2_reducer&) +{ + UINT64 previous_masks = previous_cipherwords ^ previous_plainwords; + return ((previous_masks >> 12) & (previous_masks >> 14) & 1) << 4; +} + +static const ns10_decrypter_device::ns10_crypto_logic startrgn_crypto_logic = { + { + 0x00003e4bfe92c6a9ull, 0x000000000000010cull, 0x00003e4b7bd6c4aaull, 0x0000b1a904b8fab8ull, + 0x0000000000000080ull, 0x0000000000008c00ull, 0x0000b1a9b2f0b4cdull, 0x000000006c100828ull, + 0x000000006c100838ull, 0x0000b1a9d3913fcdull, 0x000000006161aa00ull, 0x0000000000006040ull, + 0x0000000000000420ull, 0x0000000000001801ull, 0x00003e4b7bd6deabull, 0x0000000000000105ull, + }, { + 0x000012021f00c6a8ull, 0x0000000000000008ull, 0x000012020b1046aaull, 0x000012001502fea8ull, + 0x0000000000002000ull, 0x0000000000008800ull, 0x000012001e02b4cdull, 0x000000002c0008aaull, + 0x000000002c00083aull, 0x000012003f027ecdull, 0x0000000021008a00ull, 0x0000000000002040ull, + 0x0000000000000428ull, 0x0000000000001001ull, 0x000012020b10ceabull, 0x0000000000000144ull, + }, + 0x8c46, + startrgn_nonlinear_calc +}; + + +// game-specific devices + +chocovdr_decrypter_device::chocovdr_decrypter_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : ns10_decrypter_device(CHOCOVDR_DECRYPTER, chocovdr_crypto_logic, mconfig, tag, owner, clock) +{ +} + +gamshara_decrypter_device::gamshara_decrypter_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : ns10_decrypter_device(GAMSHARA_DECRYPTER, gamshara_crypto_logic, mconfig, tag, owner, clock) +{ +} + +knpuzzle_decrypter_device::knpuzzle_decrypter_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : ns10_decrypter_device(KNPUZZLE_DECRYPTER, knpuzzle_crypto_logic, mconfig, tag, owner, clock) +{ +} + +konotako_decrypter_device::konotako_decrypter_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : ns10_decrypter_device(KONOTAKO_DECRYPTER, konotako_crypto_logic, mconfig, tag, owner, clock) +{ +} + +nflclsfb_decrypter_device::nflclsfb_decrypter_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : ns10_decrypter_device(NFLCLSFB_DECRYPTER, nflclsfb_crypto_logic, mconfig, tag, owner, clock) +{ +} + +startrgn_decrypter_device::startrgn_decrypter_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : ns10_decrypter_device(STARTRGN_DECRYPTER, startrgn_crypto_logic, mconfig, tag, owner, clock) +{ +} diff --git a/src/mame/machine/ns10crypt.h b/src/mame/machine/ns10crypt.h new file mode 100644 index 00000000000..4aa7ad47266 --- /dev/null +++ b/src/mame/machine/ns10crypt.h @@ -0,0 +1,101 @@ +// license:BSD-3 +// copyright-holders:Andreas Naive + +#ifndef _NS10CRYPT_H_ +#define _NS10CRYPT_H_ + +class gf2_reducer // helper class +{ +public: + gf2_reducer(); + int gf2_reduce(UINT64 num)const; +private: + int _gf2Reduction[0x10000]; +}; + +class ns10_decrypter_device : public device_t +{ +public: + // this encodes the decryption logic, which varies per game + // and is probably hard-coded into the CPLD + struct ns10_crypto_logic + { + UINT64 eMask[16]; + UINT64 dMask[16]; + UINT16 xMask; + UINT16(*nonlinear_calculation)(UINT64, UINT64, const gf2_reducer&); // preliminary encoding; need research + }; + + void activate(int iv); + void deactivate(); + bool is_active()const; + + UINT16 decrypt(UINT16 cipherword); + +protected: + ns10_decrypter_device( + device_type type, const ns10_decrypter_device::ns10_crypto_logic &logic, + const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + +private: + UINT16 _mask; + UINT64 _previous_cipherwords; + UINT64 _previous_plainwords; + bool _active; + const ns10_crypto_logic& _logic; + static const int initSbox[16]; + const gf2_reducer *_reducer; + + void device_start(); + void init(int iv); +}; + + + +// game-specific devices + +class chocovdr_decrypter_device : public ns10_decrypter_device +{ +public: + chocovdr_decrypter_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +class gamshara_decrypter_device : public ns10_decrypter_device +{ +public: + gamshara_decrypter_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +class knpuzzle_decrypter_device : public ns10_decrypter_device +{ +public: + knpuzzle_decrypter_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +class konotako_decrypter_device : public ns10_decrypter_device +{ +public: + konotako_decrypter_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +class nflclsfb_decrypter_device : public ns10_decrypter_device +{ +public: + nflclsfb_decrypter_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +class startrgn_decrypter_device : public ns10_decrypter_device +{ +public: + startrgn_decrypter_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + + +extern const device_type CHOCOVDR_DECRYPTER; +extern const device_type GAMSHARA_DECRYPTER; +extern const device_type KNPUZZLE_DECRYPTER; +extern const device_type KONOTAKO_DECRYPTER; +extern const device_type NFLCLSFB_DECRYPTER; +extern const device_type STARTRGN_DECRYPTER; + +#endif diff --git a/src/mame/machine/pgmcrypt.c b/src/mame/machine/pgmcrypt.c index 956edaaa66f..3d7ad018f9f 100644 --- a/src/mame/machine/pgmcrypt.c +++ b/src/mame/machine/pgmcrypt.c @@ -1525,3 +1525,8 @@ void slqz3_decrypt(running_machine &machine) src[i] = x; } } + +void fruitpar_decrypt(running_machine &machine) +{ +// TODO +} diff --git a/src/mame/machine/pgmcrypt.h b/src/mame/machine/pgmcrypt.h index 2eb78e99d20..a2351b5309c 100644 --- a/src/mame/machine/pgmcrypt.h +++ b/src/mame/machine/pgmcrypt.h @@ -35,3 +35,4 @@ void lhzb4_decrypt(running_machine &machine); void fearless_decrypt(running_machine &machine); void pgm_decrypt_pgm3in1(running_machine &machine); void slqz3_decrypt(running_machine &machine); +void fruitpar_decrypt(running_machine &machine); diff --git a/src/mame/machine/raiden2cop.c b/src/mame/machine/raiden2cop.c index 7194ca3ee5a..0190e691043 100644 --- a/src/mame/machine/raiden2cop.c +++ b/src/mame/machine/raiden2cop.c @@ -997,7 +997,7 @@ void raiden2cop_device::LEGACY_execute_130e(address_space &space, int offset, UI cop_angle = 0; } else { - cop_angle = atan(double(dy) / double(dx)) * 128.0 / M_PI; + cop_angle = (int)(atan(double(dy) / double(dx)) * 128.0 / M_PI); if (dx < 0) cop_angle += 0x80; } @@ -1020,7 +1020,7 @@ void raiden2cop_device::LEGACY_execute_130e_cupsoc(address_space &space, int off cop_angle = 0; } else { - cop_angle = atan(double(dy) / double(dx)) * 128.0 / M_PI; + cop_angle = (int)(atan(double(dy) / double(dx)) * 128.0 / M_PI); if (dx < 0) cop_angle += 0x80; } @@ -1057,7 +1057,7 @@ void raiden2cop_device::execute_2288(address_space &space, int offset, UINT16 da cop_angle = 0; } else { - cop_angle = atan(double(dx) / double(dy)) * 128 / M_PI; + cop_angle = (int)(atan(double(dx) / double(dy)) * 128 / M_PI); if (dy < 0) cop_angle += 0x80; } @@ -1095,7 +1095,7 @@ void raiden2cop_device::execute_338e(address_space &space, int offset, UINT16 da cop_angle = 0; } else { - cop_angle = atan(double(dx) / double(dy)) * 128 / M_PI; + cop_angle = (int)(atan(double(dx) / double(dy)) * 128 / M_PI); if (dy < 0) cop_angle += 0x80; } @@ -1553,7 +1553,7 @@ void raiden2cop_device::LEGACY_execute_e30e(address_space &space, int offset, UI cop_angle = 0; } else { - cop_angle = atan(double(dy) / double(dx)) * 128.0 / M_PI; + cop_angle = (int)(atan(double(dy) / double(dx)) * 128.0 / M_PI); if (dx < 0) cop_angle += 0x80; } diff --git a/src/mame/machine/slikshot.c b/src/mame/machine/slikshot.c index 5edf4f56311..1c2ad7ac8cd 100644 --- a/src/mame/machine/slikshot.c +++ b/src/mame/machine/slikshot.c @@ -546,8 +546,8 @@ UINT32 itech8_state::screen_update_slikshot(screen_device &screen, bitmap_rgb32 screen_update_2page(screen, bitmap, cliprect); /* add the current X,Y positions to the list */ - m_xbuffer[m_ybuffer_next % YBUFFER_COUNT] = ioport("FAKEX")->read_safe(0); - m_ybuffer[m_ybuffer_next % YBUFFER_COUNT] = ioport("FAKEY")->read_safe(0); + m_xbuffer[m_ybuffer_next % YBUFFER_COUNT] = m_fakex->read(); + m_ybuffer[m_ybuffer_next % YBUFFER_COUNT] = m_fakey->read(); m_ybuffer_next++; /* determine where to draw the starting point */ diff --git a/src/mame/machine/snes.c b/src/mame/machine/snes.c index 90914f1ac4e..80ed9e1909b 100644 --- a/src/mame/machine/snes.c +++ b/src/mame/machine/snes.c @@ -1064,7 +1064,7 @@ void snes_state::snes_init_ram() SNES_CPU_REG(WRIO) = 0xff; // init frame counter so first line is 0 - if (ATTOSECONDS_TO_HZ(m_screen->frame_period().attoseconds) >= 59) + if (ATTOSECONDS_TO_HZ(m_screen->frame_period().attoseconds()) >= 59) m_ppu->m_beam.current_vert = SNES_VTOTAL_NTSC; else m_ppu->m_beam.current_vert = SNES_VTOTAL_PAL; @@ -1137,7 +1137,7 @@ void snes_state::machine_reset() } /* Set STAT78 to NTSC or PAL */ - if (ATTOSECONDS_TO_HZ(m_screen->frame_period().attoseconds) >= 59.0) + if (ATTOSECONDS_TO_HZ(m_screen->frame_period().attoseconds()) >= 59.0) m_ppu->m_stat78 = SNES_NTSC; else /* if (ATTOSECONDS_TO_HZ(m_screen->frame_period().attoseconds) == 50.0f) */ m_ppu->m_stat78 = SNES_PAL; diff --git a/src/mame/machine/tnzs.c b/src/mame/machine/tnzs.c index 6da269b0a0e..a855f81b9b8 100644 --- a/src/mame/machine/tnzs.c +++ b/src/mame/machine/tnzs.c @@ -46,9 +46,9 @@ READ8_MEMBER(tnzs_state::tnzs_port1_r) switch (m_input_select & 0x0f) { - case 0x0a: data = ioport("IN2")->read(); break; - case 0x0c: data = ioport("IN0")->read(); break; - case 0x0d: data = ioport("IN1")->read(); break; + case 0x0a: data = m_in2->read(); break; + case 0x0c: data = m_in0->read(); break; + case 0x0d: data = m_in1->read(); break; default: data = 0xff; break; } @@ -59,7 +59,7 @@ READ8_MEMBER(tnzs_state::tnzs_port1_r) READ8_MEMBER(tnzs_state::tnzs_port2_r) { - int data = ioport("IN2")->read(); + int data = m_in2->read(); // logerror("I8742:%04x Read %02x from port 2\n", space.device().safe_pcbase(), data); @@ -82,11 +82,11 @@ WRITE8_MEMBER(tnzs_state::tnzs_port2_w) READ8_MEMBER(tnzs_state::arknoid2_sh_f000_r) { - int val; - // logerror("PC %04x: read input %04x\n", space.device().safe_pc(), 0xf000 + offset); - val = ioport((offset / 2) ? "AN2" : "AN1")->read_safe(0); + ioport_port *port = (offset / 2) ? m_an2 : m_an1; + int val = port ? port->read() : 0; + if (offset & 1) return ((val >> 8) & 0xff); else @@ -213,7 +213,7 @@ READ8_MEMBER(tnzs_state::mcu_arknoid2_r) } else return m_mcu_credits; } - else return ioport("IN0")->read(); /* buttons */ + else return m_in0->read(); /* buttons */ default: logerror("error, unknown mcu command\n"); @@ -305,16 +305,16 @@ READ8_MEMBER(tnzs_state::mcu_extrmatn_r) switch (m_mcu_command) { case 0x01: - return ioport("IN0")->read() ^ 0xff; /* player 1 joystick + buttons */ + return m_in0->read() ^ 0xff; /* player 1 joystick + buttons */ case 0x02: - return ioport("IN1")->read() ^ 0xff; /* player 2 joystick + buttons */ + return m_in1->read() ^ 0xff; /* player 2 joystick + buttons */ case 0x1a: - return (ioport("COIN1")->read() | (ioport("COIN2")->read() << 1)); + return (m_coin1->read() | (m_coin2->read() << 1)); case 0x21: - return ioport("IN2")->read() & 0x0f; + return m_in2->read() & 0x0f; case 0x41: return m_mcu_credits; @@ -342,7 +342,7 @@ READ8_MEMBER(tnzs_state::mcu_extrmatn_r) else return m_mcu_credits; } /* buttons */ - else return ((ioport("IN0")->read() & 0xf0) | (ioport("IN1")->read() >> 4)) ^ 0xff; + else return ((m_in0->read() & 0xf0) | (m_in1->read() >> 4)) ^ 0xff; default: logerror("error, unknown mcu command\n"); @@ -529,7 +529,7 @@ DRIVER_INIT_MEMBER(tnzs_state,kabukiz) UINT8 *SOUND = memregion("audiocpu")->base(); m_mcu_type = MCU_NONE_KABUKIZ; - membank("audiobank")->configure_entries(0, 8, &SOUND[0x00000], 0x4000); + m_audiobank->configure_entries(0, 8, &SOUND[0x00000], 0x4000); } DRIVER_INIT_MEMBER(tnzs_state,insectx) @@ -598,9 +598,9 @@ INTERRUPT_GEN_MEMBER(tnzs_state::arknoid2_interrupt) case MCU_DRTOPPEL: case MCU_PLUMPOP: coin = 0; - coin |= ((ioport("COIN1")->read() & 1) << 0); - coin |= ((ioport("COIN2")->read() & 1) << 1); - coin |= ((ioport("IN2")->read() & 3) << 2); + coin |= ((m_coin1->read() & 1) << 0); + coin |= ((m_coin2->read() & 1) << 1); + coin |= ((m_in2->read() & 3) << 2); coin ^= 0x0c; mcu_handle_coins(coin); break; @@ -642,8 +642,8 @@ MACHINE_START_MEMBER(tnzs_state,tnzs_common) { UINT8 *SUB = memregion("sub")->base(); - membank("subbank")->configure_entries(0, 4, &SUB[0x08000], 0x2000); - membank("subbank")->set_entry(m_bank2); + m_subbank->configure_entries(0, 4, &SUB[0x08000], 0x2000); + m_subbank->set_entry(m_bank2); m_bank2 = 0; m_mainbank->set_bank(2); @@ -733,5 +733,5 @@ WRITE8_MEMBER(tnzs_state::tnzs_bankswitch1_w) /* bits 0-1 select ROM bank */ m_bank2 = data & 0x03; - membank("subbank")->set_entry(m_bank2); + m_subbank->set_entry(m_bank2); } diff --git a/src/mame/machine/xbox.c b/src/mame/machine/xbox.c new file mode 100644 index 00000000000..fd1eaf854e6 --- /dev/null +++ b/src/mame/machine/xbox.c @@ -0,0 +1,1539 @@ +// license:BSD-3-Clause +// copyright-holders:Samuele Zannoli + +#include "emu.h" +#include "cpu/i386/i386.h" +#include "machine/lpci.h" +#include "machine/pic8259.h" +#include "machine/pit8253.h" +#include "machine/idectrl.h" +#include "machine/idehd.h" +#include "video/poly.h" +#include "bitmap.h" +#include "debug/debugcon.h" +#include "debug/debugcmd.h" +#include "debug/debugcpu.h" +#include "includes/chihiro.h" +#include "includes/xbox.h" + +// for now, make buggy GCC/Mingw STFU about I64FMT +#if (defined(__MINGW32__) && (__GNUC__ >= 5)) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat" +#pragma GCC diagnostic ignored "-Wformat-extra-args" +#endif + +#define LOG_PCI +//#define LOG_OHCI +//#define USB_ENABLED + +static void dump_string_command(running_machine &machine, int ref, int params, const char **param) +{ + xbox_base_state *state = machine.driver_data<xbox_base_state>(); + address_space &space = state->m_maincpu->space(); + UINT64 addr; + offs_t address; + UINT32 length, maximumlength; + offs_t buffer; + + if (params < 1) + return; + if (!debug_command_parameter_number(machine, param[0], &addr)) + return; + address = (offs_t)addr; + if (!debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &address)) + { + debug_console_printf(machine, "Address is unmapped.\n"); + return; + } + length = space.read_word_unaligned(address); + maximumlength = space.read_word_unaligned(address + 2); + buffer = space.read_dword_unaligned(address + 4); + debug_console_printf(machine, "Length %d word\n", length); + debug_console_printf(machine, "MaximumLength %d word\n", maximumlength); + debug_console_printf(machine, "Buffer %08X byte* ", buffer); + if (!debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &buffer)) + { + debug_console_printf(machine, "\nBuffer is unmapped.\n"); + return; + } + if (length > 256) + length = 256; + for (int a = 0; a < length; a++) + { + UINT8 c = space.read_byte(buffer + a); + debug_console_printf(machine, "%c", c); + } + debug_console_printf(machine, "\n"); +} + +static void dump_process_command(running_machine &machine, int ref, int params, const char **param) +{ + xbox_base_state *state = machine.driver_data<xbox_base_state>(); + address_space &space = state->m_maincpu->space(); + UINT64 addr; + offs_t address; + + if (params < 1) + return; + if (!debug_command_parameter_number(machine, param[0], &addr)) + return; + address = (offs_t)addr; + if (!debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &address)) + { + debug_console_printf(machine, "Address is unmapped.\n"); + return; + } + debug_console_printf(machine, "ReadyListHead {%08X,%08X} _LIST_ENTRY\n", space.read_dword_unaligned(address), space.read_dword_unaligned(address + 4)); + debug_console_printf(machine, "ThreadListHead {%08X,%08X} _LIST_ENTRY\n", space.read_dword_unaligned(address + 8), space.read_dword_unaligned(address + 12)); + debug_console_printf(machine, "StackCount %d dword\n", space.read_dword_unaligned(address + 16)); + debug_console_printf(machine, "ThreadQuantum %d dword\n", space.read_dword_unaligned(address + 20)); + debug_console_printf(machine, "BasePriority %d byte\n", space.read_byte(address + 24)); + debug_console_printf(machine, "DisableBoost %d byte\n", space.read_byte(address + 25)); + debug_console_printf(machine, "DisableQuantum %d byte\n", space.read_byte(address + 26)); + debug_console_printf(machine, "_padding %d byte\n", space.read_byte(address + 27)); +} + +static void dump_list_command(running_machine &machine, int ref, int params, const char **param) +{ + xbox_base_state *state = machine.driver_data<xbox_base_state>(); + address_space &space = state->m_maincpu->space(); + UINT64 addr, offs, start, old; + offs_t address, offset; + + if (params < 1) + return; + if (!debug_command_parameter_number(machine, param[0], &addr)) + return; + offs = 0; + offset = 0; + if (params >= 2) + { + if (!debug_command_parameter_number(machine, param[1], &offs)) + return; + offset = (offs_t)offs; + } + start = addr; + address = (offs_t)addr; + if (!debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &address)) + { + debug_console_printf(machine, "Address is unmapped.\n"); + return; + } + if (params >= 2) + debug_console_printf(machine, "Entry Object\n"); + else + debug_console_printf(machine, "Entry\n"); + for (int num = 0; num < 32; num++) + { + if (params >= 2) + debug_console_printf(machine, "%08X %08X\n", (UINT32)addr, (offs_t)addr - offset); + else + debug_console_printf(machine, "%08X\n", (UINT32)addr); + old = addr; + addr = space.read_dword_unaligned(address); + if (addr == start) + break; + if (addr == old) + break; + address = (offs_t)addr; + if (!debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &address)) + break; + } +} + +static void dump_dpc_command(running_machine &machine, int ref, int params, const char **param) +{ + xbox_base_state *state = machine.driver_data<xbox_base_state>(); + address_space &space = state->m_maincpu->space(); + UINT64 addr; + offs_t address; + + if (params < 1) + return; + if (!debug_command_parameter_number(machine, param[0], &addr)) + return; + address = (offs_t)addr; + if (!debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &address)) + { + debug_console_printf(machine, "Address is unmapped.\n"); + return; + } + debug_console_printf(machine, "Type %d word\n", space.read_word_unaligned(address)); + debug_console_printf(machine, "Inserted %d byte\n", space.read_byte(address + 2)); + debug_console_printf(machine, "Padding %d byte\n", space.read_byte(address + 3)); + debug_console_printf(machine, "DpcListEntry {%08X,%08X} _LIST_ENTRY\n", space.read_dword_unaligned(address + 4), space.read_dword_unaligned(address + 8)); + debug_console_printf(machine, "DeferredRoutine %08X dword\n", space.read_dword_unaligned(address + 12)); + debug_console_printf(machine, "DeferredContext %08X dword\n", space.read_dword_unaligned(address + 16)); + debug_console_printf(machine, "SystemArgument1 %08X dword\n", space.read_dword_unaligned(address + 20)); + debug_console_printf(machine, "SystemArgument2 %08X dword\n", space.read_dword_unaligned(address + 24)); +} + +static void dump_timer_command(running_machine &machine, int ref, int params, const char **param) +{ + xbox_base_state *state = machine.driver_data<xbox_base_state>(); + address_space &space = state->m_maincpu->space(); + UINT64 addr; + offs_t address; + + if (params < 1) + return; + if (!debug_command_parameter_number(machine, param[0], &addr)) + return; + address = (offs_t)addr; + if (!debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &address)) + { + debug_console_printf(machine, "Address is unmapped.\n"); + return; + } + debug_console_printf(machine, "Header.Type %d byte\n", space.read_byte(address)); + debug_console_printf(machine, "Header.Absolute %d byte\n", space.read_byte(address + 1)); + debug_console_printf(machine, "Header.Size %d byte\n", space.read_byte(address + 2)); + debug_console_printf(machine, "Header.Inserted %d byte\n", space.read_byte(address + 3)); + debug_console_printf(machine, "Header.SignalState %08X dword\n", space.read_dword_unaligned(address + 4)); + debug_console_printf(machine, "Header.WaitListEntry {%08X,%08X} _LIST_ENTRY\n", space.read_dword_unaligned(address + 8), space.read_dword_unaligned(address + 12)); + debug_console_printf(machine, "DueTime %" I64FMT "x qword\n", (INT64)space.read_qword_unaligned(address + 16)); + debug_console_printf(machine, "TimerListEntry {%08X,%08X} _LIST_ENTRY\n", space.read_dword_unaligned(address + 24), space.read_dword_unaligned(address + 28)); + debug_console_printf(machine, "Dpc %08X dword\n", space.read_dword_unaligned(address + 32)); + debug_console_printf(machine, "Period %d dword\n", space.read_dword_unaligned(address + 36)); +} + +static void curthread_command(running_machine &machine, int ref, int params, const char **param) +{ + xbox_base_state *state = machine.driver_data<xbox_base_state>(); + address_space &space = state->m_maincpu->space(); + UINT64 fsbase; + UINT32 kthrd, topstack, tlsdata; + offs_t address; + + fsbase = state->m_maincpu->state_int(44); + address = (offs_t)fsbase + 0x28; + if (!debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &address)) + { + debug_console_printf(machine, "Address is unmapped.\n"); + return; + } + kthrd = space.read_dword_unaligned(address); + debug_console_printf(machine, "Current thread is %08X\n", kthrd); + address = (offs_t)kthrd + 0x1c; + if (!debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &address)) + return; + topstack = space.read_dword_unaligned(address); + debug_console_printf(machine, "Current thread stack top is %08X\n", topstack); + address = (offs_t)kthrd + 0x28; + if (!debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &address)) + return; + tlsdata = space.read_dword_unaligned(address); + if (tlsdata == 0) + address = (offs_t)topstack - 0x210 - 8; + else + address = (offs_t)tlsdata - 8; + if (!debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &address)) + return; + debug_console_printf(machine, "Current thread function is %08X\n", space.read_dword_unaligned(address)); +} + +static void generate_irq_command(running_machine &machine, int ref, int params, const char **param) +{ + UINT64 irq; + xbox_base_state *chst = machine.driver_data<xbox_base_state>(); + + if (params < 1) + return; + if (!debug_command_parameter_number(machine, param[0], &irq)) + return; + if (irq > 15) + return; + if (irq == 2) + return; + chst->debug_generate_irq((int)irq, true); +} + +static void nv2a_combiners_command(running_machine &machine, int ref, int params, const char **param) +{ + int en; + + xbox_base_state *chst = machine.driver_data<xbox_base_state>(); + en = chst->nvidia_nv2a->toggle_register_combiners_usage(); + if (en != 0) + debug_console_printf(machine, "Register combiners enabled\n"); + else + debug_console_printf(machine, "Register combiners disabled\n"); +} + +static void waitvblank_command(running_machine &machine, int ref, int params, const char **param) +{ + int en; + + xbox_base_state *chst = machine.driver_data<xbox_base_state>(); + en = chst->nvidia_nv2a->toggle_wait_vblank_support(); + if (en != 0) + debug_console_printf(machine, "Vblank method enabled\n"); + else + debug_console_printf(machine, "Vblank method disabled\n"); +} + +static void grab_texture_command(running_machine &machine, int ref, int params, const char **param) +{ + UINT64 type; + xbox_base_state *chst = machine.driver_data<xbox_base_state>(); + + if (params < 2) + return; + if (!debug_command_parameter_number(machine, param[0], &type)) + return; + if ((param[1][0] == 0) || (strlen(param[1]) > 127)) + return; + chst->nvidia_nv2a->debug_grab_texture((int)type, param[1]); +} + +static void grab_vprog_command(running_machine &machine, int ref, int params, const char **param) +{ + xbox_base_state *chst = machine.driver_data<xbox_base_state>(); + UINT32 instruction[4]; + FILE *fil; + + if (params < 1) + return; + if ((param[0][0] == 0) || (strlen(param[0]) > 127)) + return; + if ((fil = fopen(param[0], "wb")) == NULL) + return; + for (int n = 0; n < 136; n++) { + chst->nvidia_nv2a->debug_grab_vertex_program_slot(n, instruction); + fwrite(instruction, sizeof(UINT32), 4, fil); + } + fclose(fil); +} + +static void vprogdis_command(running_machine &machine, int ref, int params, const char **param) +{ + UINT64 address, length, type; + UINT32 instruction[4]; + offs_t addr; + vertex_program_disassembler vd; + char line[64]; + xbox_base_state *chst = machine.driver_data<xbox_base_state>(); + address_space &space = chst->m_maincpu->space(); + + if (params < 2) + return; + if (!debug_command_parameter_number(machine, param[0], &address)) + return; + if (!debug_command_parameter_number(machine, param[1], &length)) + return; + type = 0; + if (params > 2) + if (!debug_command_parameter_number(machine, param[2], &type)) + return; + while (length > 0) { + if (type == 1) { + addr = (offs_t)address; + if (!debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &addr)) + return; + instruction[0] = space.read_dword_unaligned(address); + instruction[1] = space.read_dword_unaligned(address + 4); + instruction[2] = space.read_dword_unaligned(address + 8); + instruction[3] = space.read_dword_unaligned(address + 12); + } + else + chst->nvidia_nv2a->debug_grab_vertex_program_slot((int)address, instruction); + while (vd.disassemble(instruction, line) != 0) + debug_console_printf(machine, "%s\n", line); + if (type == 1) + address = address + 4 * 4; + else + address++; + length--; + } +} + +static void help_command(running_machine &machine, int ref, int params, const char **param) +{ + debug_console_printf(machine, "Available Xbox commands:\n"); + debug_console_printf(machine, " xbox dump_string,<address> -- Dump _STRING object at <address>\n"); + debug_console_printf(machine, " xbox dump_process,<address> -- Dump _PROCESS object at <address>\n"); + debug_console_printf(machine, " xbox dump_list,<address>[,<offset>] -- Dump _LIST_ENTRY chain starting at <address>\n"); + debug_console_printf(machine, " xbox dump_dpc,<address> -- Dump _KDPC object at <address>\n"); + debug_console_printf(machine, " xbox dump_timer,<address> -- Dump _KTIMER object at <address>\n"); + debug_console_printf(machine, " xbox curthread -- Print information about current thread\n"); + debug_console_printf(machine, " xbox irq,<number> -- Generate interrupt with irq number 0-15\n"); + debug_console_printf(machine, " xbox nv2a_combiners -- Toggle use of register combiners\n"); + debug_console_printf(machine, " xbox waitvblank -- Toggle support for wait vblank method\n"); + debug_console_printf(machine, " xbox grab_texture,<type>,<filename> -- Save to <filename> the next used texture of type <type>\n"); + debug_console_printf(machine, " xbox grab_vprog,<filename> -- save current vertex program instruction slots to <filename>\n"); + debug_console_printf(machine, " xbox vprogdis,<address>,<length>[,<type>] -- disassemble <lenght> vertex program instructions at <address> of <type>\n"); + debug_console_printf(machine, " xbox help -- this list\n"); +} + +static void xbox_debug_commands(running_machine &machine, int ref, int params, const char **param) +{ + if (params < 1) + return; + if (strcmp("dump_string", param[0]) == 0) + dump_string_command(machine, ref, params - 1, param + 1); + else if (strcmp("dump_process", param[0]) == 0) + dump_process_command(machine, ref, params - 1, param + 1); + else if (strcmp("dump_list", param[0]) == 0) + dump_list_command(machine, ref, params - 1, param + 1); + else if (strcmp("dump_dpc", param[0]) == 0) + dump_dpc_command(machine, ref, params - 1, param + 1); + else if (strcmp("dump_timer", param[0]) == 0) + dump_timer_command(machine, ref, params - 1, param + 1); + else if (strcmp("curthread", param[0]) == 0) + curthread_command(machine, ref, params - 1, param + 1); + else if (strcmp("irq", param[0]) == 0) + generate_irq_command(machine, ref, params - 1, param + 1); + else if (strcmp("nv2a_combiners", param[0]) == 0) + nv2a_combiners_command(machine, ref, params - 1, param + 1); + else if (strcmp("waitvblank", param[0]) == 0) + waitvblank_command(machine, ref, params - 1, param + 1); + else if (strcmp("grab_texture", param[0]) == 0) + grab_texture_command(machine, ref, params - 1, param + 1); + else if (strcmp("grab_vprog", param[0]) == 0) + grab_vprog_command(machine, ref, params - 1, param + 1); + else if (strcmp("vprogdis", param[0]) == 0) + vprogdis_command(machine, ref, params - 1, param + 1); + else + help_command(machine, ref, params - 1, param + 1); +} + +void xbox_base_state::debug_generate_irq(int irq, bool active) +{ + int state; + + if (active) + { + debug_irq_active = true; + debug_irq_number = irq; + state = 1; + } + else + { + debug_irq_active = false; + state = 0; + } + switch (irq) + { + case 0: + xbox_base_devs.pic8259_1->ir0_w(state); + break; + case 1: + xbox_base_devs.pic8259_1->ir1_w(state); + break; + case 3: + xbox_base_devs.pic8259_1->ir3_w(state); + break; + case 4: + xbox_base_devs.pic8259_1->ir4_w(state); + break; + case 5: + xbox_base_devs.pic8259_1->ir5_w(state); + break; + case 6: + xbox_base_devs.pic8259_1->ir6_w(state); + break; + case 7: + xbox_base_devs.pic8259_1->ir7_w(state); + break; + case 8: + xbox_base_devs.pic8259_2->ir0_w(state); + break; + case 9: + xbox_base_devs.pic8259_2->ir1_w(state); + break; + case 10: + xbox_base_devs.pic8259_2->ir2_w(state); + break; + case 11: + xbox_base_devs.pic8259_2->ir3_w(state); + break; + case 12: + xbox_base_devs.pic8259_2->ir4_w(state); + break; + case 13: + xbox_base_devs.pic8259_2->ir5_w(state); + break; + case 14: + xbox_base_devs.pic8259_2->ir6_w(state); + break; + case 15: + xbox_base_devs.pic8259_2->ir7_w(state); + break; + } +} + +void xbox_base_state::vblank_callback(screen_device &screen, bool state) +{ + if (nvidia_nv2a->vblank_callback(screen, state)) + xbox_base_devs.pic8259_1->ir3_w(1); // IRQ 3 + else + xbox_base_devs.pic8259_1->ir3_w(0); // IRQ 3 +} + +UINT32 xbox_base_state::screen_update_callback(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + return nvidia_nv2a->screen_update_callback(screen, bitmap, cliprect); +} + +READ32_MEMBER(xbox_base_state::geforce_r) +{ + return nvidia_nv2a->geforce_r(space, offset, mem_mask); +} + +WRITE32_MEMBER(xbox_base_state::geforce_w) +{ + nvidia_nv2a->geforce_w(space, offset, data, mem_mask); +} + +static UINT32 geforce_pci_r(device_t *busdevice, device_t *device, int function, int reg, UINT32 mem_mask) +{ +#ifdef LOG_PCI + // logerror(" bus:1 device:NV_2A function:%d register:%d mask:%08X\n",function,reg,mem_mask); +#endif + return 0; +} + +static void geforce_pci_w(device_t *busdevice, device_t *device, int function, int reg, UINT32 data, UINT32 mem_mask) +{ +#ifdef LOG_PCI + // logerror(" bus:1 device:NV_2A function:%d register:%d data:%08X mask:%08X\n",function,reg,data,mem_mask); +#endif +} + +/* + * ohci usb controller (placeholder for now) + */ + +#ifdef LOG_OHCI +static const char *const usbregnames[] = { + "HcRevision", + "HcControl", + "HcCommandStatus", + "HcInterruptStatus", + "HcInterruptEnable", + "HcInterruptDisable", + "HcHCCA", + "HcPeriodCurrentED", + "HcControlHeadED", + "HcControlCurrentED", + "HcBulkHeadED", + "HcBulkCurrentED", + "HcDoneHead", + "HcFmInterval", + "HcFmRemaining", + "HcFmNumber", + "HcPeriodicStart", + "HcLSThreshold", + "HcRhDescriptorA", + "HcRhDescriptorB", + "HcRhStatus", + "HcRhPortStatus[1]" +}; +#endif + +READ32_MEMBER(xbox_base_state::usbctrl_r) +{ + UINT32 ret; + +#ifdef LOG_OHCI + if (offset >= 0x54 / 4) + logerror("usb controller 0 register HcRhPortStatus[%d] read\n", (offset - 0x54 / 4) + 1); + else + logerror("usb controller 0 register %s read\n", usbregnames[offset]); +#endif + ret=ohcist.hc_regs[offset]; + if (offset == 0) { /* hacks needed until usb (and jvs) is implemented */ +#ifndef USB_ENABLED + hack_usb(); +#endif + } + return ret; +} + +WRITE32_MEMBER(xbox_base_state::usbctrl_w) +{ +#ifdef USB_ENABLED + UINT32 old = ohcist.hc_regs[offset]; +#endif + +#ifdef LOG_OHCI + if (offset >= 0x54 / 4) + logerror("usb controller 0 register HcRhPortStatus[%d] write %08X\n", (offset - 0x54 / 4) + 1, data); + else + logerror("usb controller 0 register %s write %08X\n", usbregnames[offset], data); +#endif +#ifdef USB_ENABLED + if (offset == HcRhStatus) { + if (data & 0x80000000) + ohcist.hc_regs[HcRhStatus] &= ~0x8000; + if (data & 0x00020000) + ohcist.hc_regs[HcRhStatus] &= ~0x0002; + if (data & 0x00010000) + ohcist.hc_regs[HcRhStatus] &= ~0x0001; + return; + } + if (offset == HcControl) { + int hcfs; + + hcfs = (data >> 6) & 3; + if (hcfs == UsbOperational) { + ohcist.timer->enable(); + ohcist.timer->adjust(attotime::from_msec(1), 0, attotime::from_msec(1)); + ohcist.writebackdonehadcounter = 7; + } + else + ohcist.timer->enable(false); + ohcist.state = hcfs; + ohcist.interruptbulkratio = (data & 3) + 1; + } + if (offset == HcCommandStatus) { + if (data & 1) + ohcist.hc_regs[HcControl] |= 3 << 6; + ohcist.hc_regs[HcCommandStatus] |= data; + return; + } + if (offset == HcInterruptStatus) { + ohcist.hc_regs[HcInterruptStatus] &= ~data; + usb_ohci_interrupts(); + return; + } + if (offset == HcInterruptEnable) { + ohcist.hc_regs[HcInterruptEnable] |= data; + usb_ohci_interrupts(); + return; + } + if (offset == HcInterruptDisable) { + ohcist.hc_regs[HcInterruptEnable] &= ~data; + usb_ohci_interrupts(); + return; + } + if (offset >= HcRhPortStatus1) { + int port = offset - HcRhPortStatus1 + 1; // port 0 not used + // bit 0 ClearPortEnable: 1 clears PortEnableStatus + // bit 1 SetPortEnable: 1 sets PortEnableStatus + // bit 2 SetPortSuspend: 1 sets PortSuspendStatus + // bit 3 ClearSuspendStatus: 1 clears PortSuspendStatus + // bit 4 SetPortReset: 1 sets PortResetStatus + if (data & 0x10) { + ohcist.hc_regs[offset] |= 0x10; + ohcist.ports[port].function->execute_reset(); + // after 10ms set PortResetStatusChange and clear PortResetStatus and set PortEnableStatus + ohcist.ports[port].delay = 10; + } + // bit 8 SetPortPower: 1 sets PortPowerStatus + // bit 9 ClearPortPower: 1 clears PortPowerStatus + // bit 16 1 clears ConnectStatusChange + // bit 17 1 clears PortEnableStatusChange + // bit 18 1 clears PortSuspendStatusChange + // bit 19 1 clears PortOverCurrentIndicatorChange + // bit 20 1 clears PortResetStatusChange + if (ohcist.hc_regs[offset] != old) + ohcist.hc_regs[HcInterruptStatus] |= RootHubStatusChange; + usb_ohci_interrupts(); + return; + } +#endif + ohcist.hc_regs[offset] = data; +} + +TIMER_CALLBACK_MEMBER(xbox_base_state::usb_ohci_timer) +{ + UINT32 hcca; + int changed = 0; + int list = 1; + bool cont = false; + int pid, remain, mps; + + hcca = ohcist.hc_regs[HcHCCA]; + if (ohcist.state == UsbOperational) { + // increment frame number + ohcist.framenumber = (ohcist.framenumber + 1) & 0xffff; + ohcist.space->write_dword(hcca + 0x80, ohcist.framenumber); + ohcist.hc_regs[HcFmNumber] = ohcist.framenumber; + } + // port reset delay + for (int p = 1; p <= 4; p++) { + if (ohcist.ports[p].delay > 0) { + ohcist.ports[p].delay--; + if (ohcist.ports[p].delay == 0) { + ohcist.hc_regs[HcRhPortStatus1 + p - 1] = (ohcist.hc_regs[HcRhPortStatus1 + p - 1] & ~(1 << 4)) | (1 << 20) | (1 << 1); // bit 1 PortEnableStatus + changed = 1; + } + } + } + if (ohcist.state == UsbOperational) { + while (list >= 0) + { + // select list, do transfer + if (list == 0) { + if (ohcist.hc_regs[HcControl] & (1 << 2)) { + // periodic + if (ohcist.hc_regs[HcControl] & (1 << 3)) { + // isochronous + } + } + list = -1; + } + if (list == 1) { + // control + if (ohcist.hc_regs[HcControl] & (1 << 4)) { + cont = true; + while (cont == true) { + // if current endpoint descriptor is not 0 use it, otherwise ... + if (ohcist.hc_regs[HcControlCurrentED] == 0) { + // ... check the filled bit ... + if (ohcist.hc_regs[HcCommandStatus] & (1 << 1)) { + // ... if 1 start processing from the head of the list + ohcist.hc_regs[HcControlCurrentED] = ohcist.hc_regs[HcControlHeadED]; + ohcist.hc_regs[HcCommandStatus] &= ~(1 << 1); + // but if the list is empty, go to the next list + if (ohcist.hc_regs[HcControlCurrentED] == 0) + cont = false; + } + else + cont = false; + } + if (cont == true) { + // service endpoint descriptor + usb_ohci_read_endpoint_descriptor(ohcist.hc_regs[HcControlCurrentED]); + // only if it is not halted and not to be skipped + if (!(ohcist.endpoint_descriptor.h | ohcist.endpoint_descriptor.k)) { + // compare the Endpoint Descriptor?s TailPointer and NextTransferDescriptor fields. + if (ohcist.endpoint_descriptor.headp != ohcist.endpoint_descriptor.tailp) { + UINT32 a, b; + // service transfer descriptor + usb_ohci_read_transfer_descriptor(ohcist.endpoint_descriptor.headp); + // get pid + if (ohcist.endpoint_descriptor.d == 1) + pid=OutPid; // out + else if (ohcist.endpoint_descriptor.d == 2) + pid=InPid; // in + else { + pid = ohcist.transfer_descriptor.dp; // 0 setup 1 out 2 in + } + // determine how much data to transfer + // setup pid must be 8 bytes + a = ohcist.transfer_descriptor.be & 0xfff; + b = ohcist.transfer_descriptor.cbp & 0xfff; + if ((ohcist.transfer_descriptor.be ^ ohcist.transfer_descriptor.cbp) & 0xfffff000) + a |= 0x1000; + remain = a - b + 1; + if (pid == InPid) { + mps = ohcist.endpoint_descriptor.mps; + if (remain < mps) + mps = remain; + } + else { + mps = ohcist.endpoint_descriptor.mps; + } + if (ohcist.transfer_descriptor.cbp == 0) + mps = 0; + b = ohcist.transfer_descriptor.cbp; + // if sending ... + if (pid != InPid) { + // ... get mps bytes + for (int c = 0; c < mps; c++) { + ohcist.buffer[c] = ohcist.space->read_byte(b); + b++; + if ((b & 0xfff) == 0) + b = ohcist.transfer_descriptor.be & 0xfffff000; + } + } + // should check for time available + // execute transaction + mps=ohcist.ports[1].function->execute_transfer(ohcist.endpoint_descriptor.fa, ohcist.endpoint_descriptor.en, pid, ohcist.buffer, mps); + // if receiving ... + if (pid == InPid) { + // ... store mps bytes + for (int c = 0; c < mps; c++) { + ohcist.space->write_byte(b,ohcist.buffer[c]); + b++; + if ((b & 0xfff) == 0) + b = ohcist.transfer_descriptor.be & 0xfffff000; + } + } + // status writeback (CompletionCode field, DataToggleControl field, CurrentBufferPointer field, ErrorCount field) + ohcist.transfer_descriptor.cc = NoError; + ohcist.transfer_descriptor.t = (ohcist.transfer_descriptor.t ^ 1) | 2; + ohcist.transfer_descriptor.cbp = b; + ohcist.transfer_descriptor.ec = 0; + if ((remain == mps) || (mps == 0)) { + // retire transfer descriptor + a = ohcist.endpoint_descriptor.headp; + ohcist.endpoint_descriptor.headp = ohcist.transfer_descriptor.nexttd; + ohcist.transfer_descriptor.nexttd = ohcist.hc_regs[HcDoneHead]; + ohcist.hc_regs[HcDoneHead] = a; + ohcist.endpoint_descriptor.c = ohcist.transfer_descriptor.t & 1; + if (ohcist.transfer_descriptor.di != 7) { + if (ohcist.transfer_descriptor.di < ohcist.writebackdonehadcounter) + ohcist.writebackdonehadcounter = ohcist.transfer_descriptor.di; + } + usb_ohci_writeback_transfer_descriptor(a); + usb_ohci_writeback_endpoint_descriptor(ohcist.hc_regs[HcControlCurrentED]); + } else { + usb_ohci_writeback_transfer_descriptor(ohcist.endpoint_descriptor.headp); + } + } else + ohcist.hc_regs[HcControlCurrentED] = ohcist.endpoint_descriptor.nexted; + } else + ohcist.hc_regs[HcControlCurrentED] = ohcist.endpoint_descriptor.nexted; + // one bulk every n control transfers + ohcist.interruptbulkratio--; + if (ohcist.interruptbulkratio <= 0) { + ohcist.interruptbulkratio = (ohcist.hc_regs[HcControl] & 3) + 1; + cont = false; + } + } + } + } + list = 2; + } + if (list == 2) { + // bulk + if (ohcist.hc_regs[HcControl] & (1 << 5)) { + ohcist.hc_regs[HcCommandStatus] &= ~(1 << 2); + if (ohcist.hc_regs[HcControlCurrentED] == 0) + list = 0; + else if (ohcist.hc_regs[HcControl] & (1 << 4)) + list = 1; + else + list = 0; + } + } + } + if (ohcist.framenumber == 0) + ohcist.hc_regs[HcInterruptStatus] |= FrameNumberOverflow; + ohcist.hc_regs[HcInterruptStatus] |= StartofFrame; + if ((ohcist.writebackdonehadcounter != 0) && (ohcist.writebackdonehadcounter != 7)) + ohcist.writebackdonehadcounter--; + if ((ohcist.writebackdonehadcounter == 0) && ((ohcist.hc_regs[HcInterruptStatus] & WritebackDoneHead) == 0)) { + UINT32 b = 0; + + if ((ohcist.hc_regs[HcInterruptStatus] & ohcist.hc_regs[HcInterruptEnable]) != WritebackDoneHead) + b = 1; + ohcist.hc_regs[HcInterruptStatus] |= WritebackDoneHead; + ohcist.space->write_dword(hcca + 0x84, ohcist.hc_regs[HcDoneHead] | b); + ohcist.hc_regs[HcDoneHead] = 0; + ohcist.writebackdonehadcounter = 7; + } + } + if (changed != 0) { + ohcist.hc_regs[HcInterruptStatus] |= RootHubStatusChange; + } + usb_ohci_interrupts(); +} + +void xbox_base_state::usb_ohci_plug(int port, ohci_function_device *function) +{ + if ((port > 0) && (port <= 4)) { + ohcist.ports[port].function = function; + ohcist.hc_regs[HcRhPortStatus1+port-1] = 1; + } +} + +static USBStandardDeviceDscriptor devdesc = {18,1,0x201,0xff,0x34,0x56,64,0x100,0x101,0x301,0,0,0,1}; + +ohci_function_device::ohci_function_device() +{ + address = 0; + controldir = 0; + remain = 0; + position = NULL; +} + +void ohci_function_device::execute_reset() +{ + address = 0; +} + +int ohci_function_device::execute_transfer(int address, int endpoint, int pid, UINT8 *buffer, int size) +{ + if (endpoint == 0) { + if (pid == SetupPid) { + struct USBSetupPacket *p=(struct USBSetupPacket *)buffer; + // define direction + controldir = p->bmRequestType & 128; + // case !=0, in data stage and out status stage + // case ==0, out data stage and in status stage + position = NULL; + remain = p->wLength; + if ((p->bmRequestType & 0x60) == 0) { + switch (p->bRequest) { + case GET_DESCRIPTOR: + if ((p->wValue >> 8) == 1) { // device descriptor + //p->wValue & 255; + position = (UINT8 *)&devdesc; + remain = sizeof(devdesc); + } + break; + case SET_ADDRESS: + //p->wValue; + break; + default: + break; + } + } + } + else if (pid == InPid) { + // case !=0, give data + // case ==0, nothing + if (size > remain) + size = remain; + if (controldir != 0) { + if (position != NULL) + memcpy(buffer, position, size); + position = position + size; + remain = remain - size; + } + } + else if (pid == OutPid) { + // case !=0, nothing + // case ==0, give data + if (size > remain) + size = remain; + if (controldir == 0) { + if (position != NULL) + memcpy(position, buffer, size); + position = position + size; + remain = remain - size; + } + } + } + return size; +} + +void xbox_base_state::usb_ohci_interrupts() +{ + if (((ohcist.hc_regs[HcInterruptStatus] & ohcist.hc_regs[HcInterruptEnable]) != 0) && ((ohcist.hc_regs[HcInterruptEnable] & MasterInterruptEnable) != 0)) + xbox_base_devs.pic8259_1->ir1_w(1); + else + xbox_base_devs.pic8259_1->ir1_w(0); +} + +void xbox_base_state::usb_ohci_read_endpoint_descriptor(UINT32 address) +{ + UINT32 w; + + w = ohcist.space->read_dword(address); + ohcist.endpoint_descriptor.word0 = w; + ohcist.endpoint_descriptor.fa = w & 0x7f; + ohcist.endpoint_descriptor.en = (w >> 7) & 15; + ohcist.endpoint_descriptor.d = (w >> 11) & 3; + ohcist.endpoint_descriptor.s = (w >> 13) & 1; + ohcist.endpoint_descriptor.k = (w >> 14) & 1; + ohcist.endpoint_descriptor.f = (w >> 15) & 1; + ohcist.endpoint_descriptor.mps = (w >> 16) & 0x7ff; + ohcist.endpoint_descriptor.tailp = ohcist.space->read_dword(address + 4); + w = ohcist.space->read_dword(address + 8); + ohcist.endpoint_descriptor.headp = w & 0xfffffffc; + ohcist.endpoint_descriptor.h = w & 1; + ohcist.endpoint_descriptor.c = (w >> 1) & 1; + ohcist.endpoint_descriptor.nexted = ohcist.space->read_dword(address + 12); +} + +void xbox_base_state::usb_ohci_writeback_endpoint_descriptor(UINT32 address) +{ + UINT32 w; + + w = ohcist.endpoint_descriptor.word0 & 0xf8000000; + w = w | (ohcist.endpoint_descriptor.mps << 16) | (ohcist.endpoint_descriptor.f << 15) | (ohcist.endpoint_descriptor.k << 14) | (ohcist.endpoint_descriptor.s << 13) | (ohcist.endpoint_descriptor.d << 11) | (ohcist.endpoint_descriptor.en << 7) | ohcist.endpoint_descriptor.fa; + ohcist.space->write_dword(address, w); + w = ohcist.endpoint_descriptor.headp | (ohcist.endpoint_descriptor.c << 1) | ohcist.endpoint_descriptor.h; + ohcist.space->write_dword(address + 8, w); +} + +void xbox_base_state::usb_ohci_read_transfer_descriptor(UINT32 address) +{ + UINT32 w; + + w = ohcist.space->read_dword(address); + ohcist.transfer_descriptor.word0 = w; + ohcist.transfer_descriptor.cc = (w >> 28) & 15; + ohcist.transfer_descriptor.ec= (w >> 26) & 3; + ohcist.transfer_descriptor.t= (w >> 24) & 3; + ohcist.transfer_descriptor.di= (w >> 21) & 7; + ohcist.transfer_descriptor.dp= (w >> 19) & 3; + ohcist.transfer_descriptor.r = (w >> 18) & 1; + ohcist.transfer_descriptor.cbp = ohcist.space->read_dword(address + 4); + ohcist.transfer_descriptor.nexttd = ohcist.space->read_dword(address + 8); + ohcist.transfer_descriptor.be = ohcist.space->read_dword(address + 12); +} + +void xbox_base_state::usb_ohci_writeback_transfer_descriptor(UINT32 address) +{ + UINT32 w; + + w = ohcist.transfer_descriptor.word0 & 0x0003ffff; + w = w | (ohcist.transfer_descriptor.cc << 28) | (ohcist.transfer_descriptor.ec << 26) | (ohcist.transfer_descriptor.t << 24) | (ohcist.transfer_descriptor.di << 21) | (ohcist.transfer_descriptor.dp << 19) | (ohcist.transfer_descriptor.r << 18); + ohcist.space->write_dword(address, w); + ohcist.space->write_dword(address + 4, ohcist.transfer_descriptor.cbp); + ohcist.space->write_dword(address + 8, ohcist.transfer_descriptor.nexttd); +} + +void xbox_base_state::usb_ohci_read_isochronous_transfer_descriptor(UINT32 address) +{ + UINT32 w; + + w = ohcist.space->read_dword(address); + ohcist.isochronous_transfer_descriptor.cc = (w >> 28) & 15; + ohcist.isochronous_transfer_descriptor.fc = (w >> 24) & 7; + ohcist.isochronous_transfer_descriptor.di = (w >> 21) & 7; + ohcist.isochronous_transfer_descriptor.sf = w & 0xffff; + ohcist.isochronous_transfer_descriptor.bp0 = ohcist.space->read_dword(address + 4) & 0xfffff000; + ohcist.isochronous_transfer_descriptor.nexttd = ohcist.space->read_dword(address + 8); + ohcist.isochronous_transfer_descriptor.be = ohcist.space->read_dword(address + 12); + w = ohcist.space->read_dword(address + 16); + ohcist.isochronous_transfer_descriptor.offset[0] = w & 0xffff; + ohcist.isochronous_transfer_descriptor.offset[1] = (w >> 16) & 0xffff; + w = ohcist.space->read_dword(address + 20); + ohcist.isochronous_transfer_descriptor.offset[2] = w & 0xffff; + ohcist.isochronous_transfer_descriptor.offset[3] = (w >> 16) & 0xffff; + w = ohcist.space->read_dword(address + 24); + ohcist.isochronous_transfer_descriptor.offset[4] = w & 0xffff; + ohcist.isochronous_transfer_descriptor.offset[5] = (w >> 16) & 0xffff; + w = ohcist.space->read_dword(address + 28); + ohcist.isochronous_transfer_descriptor.offset[6] = w & 0xffff; + ohcist.isochronous_transfer_descriptor.offset[7] = (w >> 16) & 0xffff; +} + +/* + * Audio + */ + +READ32_MEMBER(xbox_base_state::audio_apu_r) +{ + logerror("Audio_APU: read from %08X mask %08X\n", 0xfe800000 + offset * 4, mem_mask); + if (offset == 0x20010 / 4) // some kind of internal counter or state value + return 0x20 + 4 + 8 + 0x48 + 0x80; + return apust.memory[offset]; +} + +WRITE32_MEMBER(xbox_base_state::audio_apu_w) +{ + //UINT32 old; + UINT32 v; + + logerror("Audio_APU: write at %08X mask %08X value %08X\n", 0xfe800000 + offset * 4, mem_mask, data); + //old = apust.memory[offset]; + apust.memory[offset] = data; + if (offset == 0x02040 / 4) // address of memory area with scatter-gather info (gpdsp scratch dma) + apust.gpdsp_sgaddress = data; + if (offset == 0x020d4 / 4) { // block count (gpdsp) + apust.gpdsp_sgblocks = data; + apust.gpdsp_address = apust.space->read_dword(apust.gpdsp_sgaddress); // memory address of first block + apust.timer->enable(); + apust.timer->adjust(attotime::from_msec(1), 0, attotime::from_msec(1)); + } + if (offset == 0x02048 / 4) // (epdsp scratch dma) + apust.epdsp_sgaddress = data; + if (offset == 0x020dc / 4) // (epdsp) + apust.epdsp_sgblocks = data; + if (offset == 0x0204c / 4) // address of memory area with information about blocks + apust.unknown_sgaddress = data; + if (offset == 0x020e0 / 4) // block count - 1 + apust.unknown_sgblocks = data; + if (offset == 0x0202c / 4) { // address of memory area with 0x80 bytes for each voice + apust.voicedata_address = data; + return; + } + if (offset == 0x04024 / 4) // offset in memory area indicated by 0x204c (analog output ?) + return; + if (offset == 0x04034 / 4) // size + return; + if (offset == 0x04028 / 4) // offset in memory area indicated by 0x204c (digital output ?) + return; + if (offset == 0x04038 / 4) // size + return; + if (offset == 0x20804 / 4) { // block number for scatter-gather heap that stores sampled audio to be played + if (data >= 1024) { + logerror("Audio_APU: sg block number too high, increase size of voices_heap_blockaddr\n"); + apust.memory[offset] = 1023; + } + return; + } + if (offset == 0x20808 / 4) { // block address for scatter-gather heap that stores sampled audio to be played + apust.voices_heap_blockaddr[apust.memory[0x20804 / 4]] = data; + return; + } + if (offset == 0x202f8 / 4) { // voice number for parameters ? + apust.voice_number = data; + return; + } + if (offset == 0x202fc / 4) // 1 when accessing voice parameters 0 otherwise + return; + if (offset == 0x20304 / 4) { // format + /* + bits 28-31 sample format: + 0 8-bit pcm + 5 16-bit pcm + 10 adpcm ? + 14 24-bit pcm + 15 32-bit pcm + bits 16-20 number of channels - 1: + 0 mono + 1 stereo + */ + return; + } + if (offset == 0x2037c / 4) { // value related to sample rate + INT16 v = (INT16)(data >> 16); // upper 16 bits as a signed 16 bit value + float vv = ((float)v) / 4096.0f; // divide by 4096 + float vvv = powf(2, vv); // two to the vv + int f = vvv*48000.0f; // sample rate + apust.voices_frequency[apust.voice_number] = f; + return; + } + if (offset == 0x203a0 / 4) // start offset of data in scatter-gather heap + return; + if (offset == 0x203a4 / 4) { // first sample to play + apust.voices_position_start[apust.voice_number] = data * 1000; + return; + } + if (offset == 0x203dc / 4) { // last sample to play + apust.voices_position_end[apust.voice_number] = data * 1000; + return; + } + if (offset == 0x2010c / 4) // voice processor 0 idle 1 not idle ? + return; + if (offset == 0x20124 / 4) { // voice number to activate ? + v = apust.voice_number; + apust.voices_active[v >> 6] |= ((UINT64)1 << (v & 63)); + apust.voices_position[v] = apust.voices_position_start[apust.voice_number]; + apust.voices_position_increment[apust.voice_number] = apust.voices_frequency[apust.voice_number]; + return; + } + if (offset == 0x20128 / 4) { // voice number to deactivate ? + v = apust.voice_number; + apust.voices_active[v >> 6] &= ~(1 << (v & 63)); + return; + } + if (offset == 0x20140 / 4) // voice number to ? + return; + if ((offset >= 0x20200 / 4) && (offset < 0x20280 / 4)) // headroom for each of the 32 mixbins + return; + if (offset == 0x20280 / 4) // hrtf headroom ? + return; +} + +READ32_MEMBER(xbox_base_state::audio_ac93_r) +{ + UINT32 ret = 0; + + logerror("Audio_AC3: read from %08X mask %08X\n", 0xfec00000 + offset * 4, mem_mask); + if (offset < 0x80 / 4) + { + ret = ac97st.mixer_regs[offset]; + } + if ((offset >= 0x100 / 4) && (offset <= 0x138 / 4)) + { + offset = offset - 0x100 / 4; + if (offset == 0x18 / 4) + { + ac97st.controller_regs[offset] &= ~0x02000000; // REGRST: register reset + } + if (offset == 0x30 / 4) + { + ac97st.controller_regs[offset] |= 0x100; // PCRDY: primary codec ready + } + if (offset == 0x34 / 4) + { + ac97st.controller_regs[offset] &= ~1; // CAS: codec access semaphore + } + ret = ac97st.controller_regs[offset]; + } + return ret; +} + +WRITE32_MEMBER(xbox_base_state::audio_ac93_w) +{ + logerror("Audio_AC3: write at %08X mask %08X value %08X\n", 0xfec00000 + offset * 4, mem_mask, data); + if (offset < 0x80 / 4) + { + COMBINE_DATA(ac97st.mixer_regs + offset); + } + if ((offset >= 0x100 / 4) && (offset <= 0x138 / 4)) + { + offset = offset - 0x100 / 4; + COMBINE_DATA(ac97st.controller_regs + offset); + } +} + +TIMER_CALLBACK_MEMBER(xbox_base_state::audio_apu_timer) +{ + int cmd; + int bb, b, v; + UINT64 bv; + UINT32 phys; + + cmd = apust.space->read_dword(apust.gpdsp_address + 0x800 + 0x10); + if (cmd == 3) + apust.space->write_dword(apust.gpdsp_address + 0x800 + 0x10, 0); + /*else + logerror("Audio_APU: unexpected value at address %d\n",apust.gpdsp_address+0x800+0x10);*/ + for (b = 0; b < 4; b++) { + bv = 1; + for (bb = 0; bb < 64; bb++) { + if (apust.voices_active[b] & bv) { + v = bb + (b << 6); + apust.voices_position[v] += apust.voices_position_increment[v]; + while (apust.voices_position[v] >= apust.voices_position_end[v]) + apust.voices_position[v] = apust.voices_position_start[v] + apust.voices_position[v] - apust.voices_position_end[v] - 1000; + phys = apust.voicedata_address + 0x80 * v; + apust.space->write_dword(phys + 0x58, apust.voices_position[v] / 1000); + } + bv = bv << 1; + } + } +} + +static UINT32 hubintiasbridg_pci_r(device_t *busdevice, device_t *device, int function, int reg, UINT32 mem_mask) +{ +#ifdef LOG_PCI + // logerror(" bus:0 function:%d register:%d mask:%08X\n",function,reg,mem_mask); +#endif + if ((function == 0) && (reg == 8)) + return 0xb4; // 0:1:0 revision id must be at least 0xb4, otherwise usb will require a hub + return 0; +} + +static void hubintiasbridg_pci_w(device_t *busdevice, device_t *device, int function, int reg, UINT32 data, UINT32 mem_mask) +{ +#ifdef LOG_PCI + if (reg >= 16) logerror(" bus:0 function:%d register:%d data:%08X mask:%08X\n", function, reg, data, mem_mask); +#endif +} + +/* + * dummy for non connected devices + */ + +static UINT32 dummy_pci_r(device_t *busdevice, device_t *device, int function, int reg, UINT32 mem_mask) +{ +#ifdef LOG_PCI + // logerror(" bus:0 function:%d register:%d mask:%08X\n",function,reg,mem_mask); +#endif + return 0; +} + +static void dummy_pci_w(device_t *busdevice, device_t *device, int function, int reg, UINT32 data, UINT32 mem_mask) +{ +#ifdef LOG_PCI + if (reg >= 16) logerror(" bus:0 function:%d register:%d data:%08X mask:%08X\n", function, reg, data, mem_mask); +#endif +} + +READ32_MEMBER(xbox_base_state::dummy_r) +{ + return 0; +} + +WRITE32_MEMBER(xbox_base_state::dummy_w) +{ +} + +/* + * PIC & PIT + */ + +WRITE_LINE_MEMBER(xbox_base_state::xbox_pic8259_1_set_int_line) +{ + m_maincpu->set_input_line(0, state ? HOLD_LINE : CLEAR_LINE); +} + +READ8_MEMBER(xbox_base_state::get_slave_ack) +{ + if (offset == 2) { // IRQ = 2 + return xbox_base_devs.pic8259_2->acknowledge(); + } + return 0x00; +} + +IRQ_CALLBACK_MEMBER(xbox_base_state::irq_callback) +{ + int r = 0; + r = xbox_base_devs.pic8259_2->acknowledge(); + if (r == 0) + { + r = xbox_base_devs.pic8259_1->acknowledge(); + } + if (debug_irq_active) + debug_generate_irq(debug_irq_number, false); + return r; +} + +WRITE_LINE_MEMBER(xbox_base_state::xbox_pit8254_out0_changed) +{ + if (xbox_base_devs.pic8259_1) + { + xbox_base_devs.pic8259_1->ir0_w(state); + } +} + +WRITE_LINE_MEMBER(xbox_base_state::xbox_pit8254_out2_changed) +{ + //xbox_speaker_set_input( state ? 1 : 0 ); +} + +/* + * SMbus devices + */ + +int smbus_callback_pic16lc(xbox_base_state &chs, int command, int rw, int data) +{ + return chs.smbus_pic16lc(command, rw, data); +} + +int xbox_base_state::smbus_pic16lc(int command, int rw, int data) +{ + if (rw == 1) { // read + if (command == 0) { + if (pic16lc_buffer[0] == 'D') + pic16lc_buffer[0] = 'X'; + else if (pic16lc_buffer[0] == 'X') + pic16lc_buffer[0] = 'B'; + else if (pic16lc_buffer[0] == 'B') + pic16lc_buffer[0] = 'D'; + } + logerror("pic16lc: %d %d %d\n", command, rw, pic16lc_buffer[command]); + return pic16lc_buffer[command]; + } + else + if (command == 0) + pic16lc_buffer[0] = 'B'; + else + pic16lc_buffer[command] = (UINT8)data; + logerror("pic16lc: %d %d %d\n", command, rw, data); + return 0; +} + +int smbus_callback_cx25871(xbox_base_state &chs, int command, int rw, int data) +{ + return chs.smbus_cx25871(command, rw, data); +} + +int xbox_base_state::smbus_cx25871(int command, int rw, int data) +{ + logerror("cx25871: %d %d %d\n", command, rw, data); + return 0; +} + +// let's try to fake the missing eeprom +static int dummyeeprom[256] = { 0x94,0x18,0x10,0x59,0x83,0x58,0x15,0xDA,0xDF,0xCC,0x1D,0x78,0x20,0x8A,0x61,0xB8,0x08,0xB4,0xD6,0xA8, +0x9E,0x77,0x9C,0xEB,0xEA,0xF8,0x93,0x6E,0x3E,0xD6,0x9C,0x49,0x6B,0xB5,0x6E,0xAB,0x6D,0xBC,0xB8,0x80,0x68,0x9D,0xAA,0xCD,0x0B,0x83, +0x17,0xEC,0x2E,0xCE,0x35,0xA8,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x61,0x62,0x63,0xAA,0xBB,0xCC,0xDD,0xEE,0xFF,0x00,0x00, +0x4F,0x6E,0x6C,0x69,0x6E,0x65,0x6B,0x65,0x79,0x69,0x6E,0x76,0x61,0x6C,0x69,0x64,0x00,0x03,0x80,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF, +0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }; + +int smbus_callback_eeprom(xbox_base_state &chs, int command, int rw, int data) +{ + return chs.smbus_eeprom(command, rw, data); +} + +int xbox_base_state::smbus_eeprom(int command, int rw, int data) +{ + if (command >= 112) + return 0; + if (rw == 1) { // if reading + // hack to avoid hanging if eeprom contents are not correct + // this would need dumping the serial eeprom on the xbox board + if (command == 0) { + hack_eeprom(); + } + data = dummyeeprom[command] + dummyeeprom[command + 1] * 256; + logerror("eeprom: %d %d %d\n", command, rw, data); + return data; + } + logerror("eeprom: %d %d %d\n", command, rw, data); + dummyeeprom[command] = data; + return 0; +} + +/* + * SMbus controller + */ + +void xbox_base_state::smbus_register_device(int address, int(*handler)(xbox_base_state &chs, int command, int rw, int data)) +{ + if (address < 128) + smbusst.devices[address] = handler; +} + +READ32_MEMBER(xbox_base_state::smbus_r) +{ + if ((offset == 0) && (mem_mask == 0xff)) // 0 smbus status + smbusst.words[offset] = (smbusst.words[offset] & ~mem_mask) | ((smbusst.status << 0) & mem_mask); + if ((offset == 1) && ((mem_mask == 0x00ff0000) || (mem_mask == 0xffff0000))) // 6 smbus data + smbusst.words[offset] = (smbusst.words[offset] & ~mem_mask) | ((smbusst.data << 16) & mem_mask); + return smbusst.words[offset]; +} + +WRITE32_MEMBER(xbox_base_state::smbus_w) +{ + COMBINE_DATA(smbusst.words); + if ((offset == 0) && (mem_mask == 0xff)) // 0 smbus status + { + if (!((smbusst.status ^ data) & 0x10)) // clearing interrupt + xbox_base_devs.pic8259_2->ir3_w(0); // IRQ 11 + smbusst.status &= ~data; + } + if ((offset == 0) && (mem_mask == 0xff0000)) // 2 smbus control + { + data = data >> 16; + smbusst.control = data; + int cycletype = smbusst.control & 7; + if (smbusst.control & 8) { // start + if ((cycletype & 6) == 2) + { + if (smbusst.devices[smbusst.address]) + if (smbusst.rw == 0) + smbusst.devices[smbusst.address](*this, smbusst.command, smbusst.rw, smbusst.data); + else + smbusst.data = smbusst.devices[smbusst.address](*this, smbusst.command, smbusst.rw, smbusst.data); + else + logerror("SMBUS: access to missing device at address %d\n", smbusst.address); + smbusst.status |= 0x10; + if (smbusst.control & 0x10) + { + xbox_base_devs.pic8259_2->ir3_w(1); // IRQ 11 + } + } + } + } + if ((offset == 1) && (mem_mask == 0xff)) // 4 smbus address + { + smbusst.address = data >> 1; + smbusst.rw = data & 1; + } + if ((offset == 1) && ((mem_mask == 0x00ff0000) || (mem_mask == 0xffff0000))) // 6 smbus data + { + data = data >> 16; + smbusst.data = data; + } + if ((offset == 2) && (mem_mask == 0xff)) // 8 smbus command + smbusst.command = data; +} + +ADDRESS_MAP_START(xbox_base_map, AS_PROGRAM, 32, xbox_base_state) + AM_RANGE(0x00000000, 0x07ffffff) AM_RAM // 128 megabytes + AM_RANGE(0xf0000000, 0xf0ffffff) AM_RAM + AM_RANGE(0xfd000000, 0xfdffffff) AM_RAM AM_READWRITE(geforce_r, geforce_w) + AM_RANGE(0xfed00000, 0xfed003ff) AM_READWRITE(usbctrl_r, usbctrl_w) + AM_RANGE(0xfe800000, 0xfe85ffff) AM_READWRITE(audio_apu_r, audio_apu_w) + AM_RANGE(0xfec00000, 0xfec001ff) AM_READWRITE(audio_ac93_r, audio_ac93_w) + AM_RANGE(0xff000000, 0xff07ffff) AM_ROM AM_REGION("bios", 0) AM_MIRROR(0x00f80000) +ADDRESS_MAP_END + +ADDRESS_MAP_START(xbox_base_map_io, AS_IO, 32, xbox_base_state) + AM_RANGE(0x0020, 0x0023) AM_DEVREADWRITE8("pic8259_1", pic8259_device, read, write, 0xffffffff) + AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE8("pit8254", pit8254_device, read, write, 0xffffffff) + AM_RANGE(0x00a0, 0x00a3) AM_DEVREADWRITE8("pic8259_2", pic8259_device, read, write, 0xffffffff) + AM_RANGE(0x01f0, 0x01f7) AM_DEVREADWRITE("ide", bus_master_ide_controller_device, read_cs0, write_cs0) + AM_RANGE(0x0cf8, 0x0cff) AM_DEVREADWRITE("pcibus", pci_bus_legacy_device, read, write) + AM_RANGE(0x8000, 0x80ff) AM_READWRITE(dummy_r, dummy_w) + AM_RANGE(0xc000, 0xc0ff) AM_READWRITE(smbus_r, smbus_w) + AM_RANGE(0xff60, 0xff67) AM_DEVREADWRITE("ide", bus_master_ide_controller_device, bmdma_r, bmdma_w) +ADDRESS_MAP_END + +void xbox_base_state::machine_start() +{ + nvidia_nv2a = auto_alloc(machine(), nv2a_renderer(machine())); + memset(pic16lc_buffer, 0, sizeof(pic16lc_buffer)); + pic16lc_buffer[0] = 'B'; + pic16lc_buffer[4] = 0; // A/V connector, 2=vga + smbus_register_device(0x10, smbus_callback_pic16lc); + smbus_register_device(0x45, smbus_callback_cx25871); + smbus_register_device(0x54, smbus_callback_eeprom); + xbox_base_devs.pic8259_1 = machine().device<pic8259_device>("pic8259_1"); + xbox_base_devs.pic8259_2 = machine().device<pic8259_device>("pic8259_2"); + xbox_base_devs.ide = machine().device<bus_master_ide_controller_device>("ide"); + memset(apust.memory, 0, sizeof(apust.memory)); + memset(apust.voices_heap_blockaddr, 0, sizeof(apust.voices_heap_blockaddr)); + memset(apust.voices_active, 0, sizeof(apust.voices_active)); + memset(apust.voices_position, 0, sizeof(apust.voices_position)); + memset(apust.voices_position_start, 0, sizeof(apust.voices_position_start)); + memset(apust.voices_position_end, 0, sizeof(apust.voices_position_end)); + memset(apust.voices_position_increment, 0, sizeof(apust.voices_position_increment)); + apust.space = &m_maincpu->space(); + apust.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(xbox_base_state::audio_apu_timer), this), (void *)"APU Timer"); + apust.timer->enable(false); + if (machine().debug_flags & DEBUG_FLAG_ENABLED) + debug_console_register_command(machine(), "xbox", CMDFLAG_NONE, 0, 1, 4, xbox_debug_commands); + memset(&ohcist, 0, sizeof(ohcist)); +#ifdef USB_ENABLED + ohcist.hc_regs[HcRevision] = 0x10; + ohcist.hc_regs[HcFmInterval] = 0x2edf; + ohcist.hc_regs[HcLSThreshold] = 0x628; + ohcist.hc_regs[HcRhDescriptorA] = 4; + ohcist.interruptbulkratio = 1; + ohcist.writebackdonehadcounter = 7; + ohcist.space = &m_maincpu->space(); + ohcist.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(xbox_base_state::usb_ohci_timer), this), (void *)"USB OHCI Timer"); + ohcist.timer->enable(false); + usb_ohci_plug(1, new ohci_function_device()); // test connect +#endif + // savestates + save_item(NAME(debug_irq_active)); + save_item(NAME(debug_irq_number)); + save_item(NAME(smbusst.status)); + save_item(NAME(smbusst.control)); + save_item(NAME(smbusst.address)); + save_item(NAME(smbusst.data)); + save_item(NAME(smbusst.command)); + save_item(NAME(smbusst.rw)); + save_item(NAME(smbusst.words)); + save_item(NAME(pic16lc_buffer)); + nvidia_nv2a->start(&m_maincpu->space()); + nvidia_nv2a->savestate_items(); +} + +MACHINE_CONFIG_START(xbox_base, xbox_base_state) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", PENTIUM3, 733333333) /* Wrong! family 6 model 8 stepping 10 */ + MCFG_CPU_PROGRAM_MAP(xbox_base_map) + MCFG_CPU_IO_MAP(xbox_base_map_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(xbox_base_state, irq_callback) + + MCFG_QUANTUM_TIME(attotime::from_hz(6000)) + + MCFG_PCI_BUS_LEGACY_ADD("pcibus", 0) + MCFG_PCI_BUS_LEGACY_DEVICE(0, "PCI Bridge Device - Host Bridge", dummy_pci_r, dummy_pci_w) + MCFG_PCI_BUS_LEGACY_DEVICE(1, "HUB Interface - ISA Bridge", hubintiasbridg_pci_r, hubintiasbridg_pci_w) + MCFG_PCI_BUS_LEGACY_DEVICE(2, "OHCI USB Controller 1", dummy_pci_r, dummy_pci_w) + MCFG_PCI_BUS_LEGACY_DEVICE(3, "OHCI USB Controller 2", dummy_pci_r, dummy_pci_w) + MCFG_PCI_BUS_LEGACY_DEVICE(4, "MCP Networking Adapter", dummy_pci_r, dummy_pci_w) + MCFG_PCI_BUS_LEGACY_DEVICE(5, "MCP APU", dummy_pci_r, dummy_pci_w) + MCFG_PCI_BUS_LEGACY_DEVICE(6, "AC`97 Audio Codec Interface", dummy_pci_r, dummy_pci_w) + MCFG_PCI_BUS_LEGACY_DEVICE(9, "IDE Controller", dummy_pci_r, dummy_pci_w) + MCFG_PCI_BUS_LEGACY_DEVICE(30, "AGP Host to PCI Bridge", dummy_pci_r, dummy_pci_w) + MCFG_PCI_BUS_LEGACY_ADD("agpbus", 1) + MCFG_PCI_BUS_LEGACY_SIBLING("pcibus") + MCFG_PCI_BUS_LEGACY_DEVICE(0, "NV2A GeForce 3MX Integrated GPU/Northbridge", geforce_pci_r, geforce_pci_w) + MCFG_PIC8259_ADD("pic8259_1", WRITELINE(xbox_base_state, xbox_pic8259_1_set_int_line), VCC, READ8(xbox_base_state, get_slave_ack)) + MCFG_PIC8259_ADD("pic8259_2", DEVWRITELINE("pic8259_1", pic8259_device, ir2_w), GND, NULL) + + MCFG_DEVICE_ADD("pit8254", PIT8254, 0) + MCFG_PIT8253_CLK0(1125000) /* heartbeat IRQ */ + MCFG_PIT8253_OUT0_HANDLER(WRITELINE(xbox_base_state, xbox_pit8254_out0_changed)) + MCFG_PIT8253_CLK1(1125000) /* (unused) dram refresh */ + MCFG_PIT8253_CLK2(1125000) /* (unused) pio port c pin 4, and speaker polling enough */ + MCFG_PIT8253_OUT2_HANDLER(WRITELINE(xbox_base_state, xbox_pit8254_out2_changed)) + + MCFG_DEVICE_ADD("ide", BUS_MASTER_IDE_CONTROLLER, 0) + MCFG_ATA_INTERFACE_IRQ_HANDLER(DEVWRITELINE("pic8259_2", pic8259_device, ir6_w)) + MCFG_BUS_MASTER_IDE_CONTROLLER_SPACE("maincpu", AS_PROGRAM) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 479) + MCFG_SCREEN_UPDATE_DRIVER(xbox_base_state, screen_update_callback) + MCFG_SCREEN_VBLANK_DRIVER(xbox_base_state, vblank_callback) +MACHINE_CONFIG_END + +#if (defined(__MINGW32__) && (__GNUC__ >= 5)) +#pragma GCC diagnostic pop +#endif diff --git a/src/mame/mess.lst b/src/mame/mess.lst index d43d941981e..fe4cba98e44 100644 --- a/src/mame/mess.lst +++ b/src/mame/mess.lst @@ -99,6 +99,7 @@ multmega // 1994 Sega Multi-Mega (Europe) 32xe 32xj 32x_scd // 1994 Sega Sega CD (USA w/32X addon) +segapm // 1996 Sega Picture Magic (32x type hardware) saturnjp // 1994 Sega Saturn (Japan) saturn // 1995 Sega Saturn (USA) @@ -2237,11 +2238,17 @@ snspellb snspelluk snspelluka snspelljp -ladictee +snspellfr +snspellit snmath snmathp snread lantutor +tntell +tntelluk +tntellfr +tntellp +vocaid // hh_tms1k ticalc1x.c tisr16 @@ -2262,6 +2269,7 @@ bmsoccer // Bambino bmsafari // Bambino splasfgt // Bambino bcclimbr // Bandai +tactix // Castle Toy invspace // Epoch efball // Epoch galaxy2 // Epoch @@ -2642,6 +2650,7 @@ vax785 ms0515 ie15 dvk_ksm +dvk_ksm01 asmapro asma2k altos5 @@ -2716,3 +2725,5 @@ excali64 bitgrpha bitgrphb tvgame +aussieby + diff --git a/src/mame/osd/windows/mame/mame.man b/src/mame/osd/windows/mame/mame.man index 2ea6a6b2e5a..e08eba181cb 100644 --- a/src/mame/osd/windows/mame/mame.man +++ b/src/mame/osd/windows/mame/mame.man @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> - <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> + <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3"> <assemblyIdentity version="1.0.0.0" processorArchitecture="*" name="MAME" type="win32" /> <description>Multiple Arcade Machine Emulator</description> <dependency> @@ -7,4 +7,9 @@ <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" publicKeyToken="6595b64144ccf1df" language="*" processorArchitecture="*"/> </dependentAssembly> </dependency> + <asmv3:application> + <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings"> + <dpiAware>true</dpiAware> + </asmv3:windowsSettings> + </asmv3:application> </assembly> diff --git a/src/mame/osd/windows/mess/mess.man b/src/mame/osd/windows/mess/mess.man index 926637826c3..67ba3aced37 100644 --- a/src/mame/osd/windows/mess/mess.man +++ b/src/mame/osd/windows/mess/mess.man @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> - <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> + <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3"> <assemblyIdentity version="1.0.0.0" processorArchitecture="*" name="MESS" type="win32" /> <description>Multi Emulator Super System</description> <dependency> @@ -7,4 +7,9 @@ <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" publicKeyToken="6595b64144ccf1df" language="*" processorArchitecture="*"/> </dependentAssembly> </dependency> + <asmv3:application> + <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings"> + <dpiAware>true</dpiAware> + </asmv3:windowsSettings> + </asmv3:application> </assembly> diff --git a/src/mame/video/8080bw.c b/src/mame/video/8080bw.c index d5779ed8828..2e51570d156 100644 --- a/src/mame/video/8080bw.c +++ b/src/mame/video/8080bw.c @@ -12,9 +12,6 @@ #include "includes/8080bw.h" -#define NUM_PENS (8) - - MACHINE_START_MEMBER(_8080bw_state,extra_8080bw_vh) { save_item(NAME(m_flip_screen)); @@ -44,60 +41,35 @@ PALETTE_INIT_MEMBER(_8080bw_state,rollingc) } -void _8080bw_state::invadpt2_get_pens( pen_t *pens ) +PALETTE_INIT_MEMBER( _8080bw_state, sflush ) { - offs_t i; + // standard 3-bit rbg palette + palette.palette_init_3bit_rbg(palette); - for (i = 0; i < NUM_PENS; i++) - { - pens[i] = rgb_t(pal1bit(i >> 0), pal1bit(i >> 2), pal1bit(i >> 1)); - } + // but background color is bright blue + palette.set_pen_color(0, 0x80, 0x80, 0xff); } -void _8080bw_state::sflush_get_pens( pen_t *pens ) -{ - offs_t i; - - pens[0] = rgb_t(0x80, 0x80, 0xff); - - for (i = 1; i < NUM_PENS; i++) - { - pens[i] = rgb_t(pal1bit(i >> 0), pal1bit(i >> 2), pal1bit(i >> 1)); - } -} - - -void _8080bw_state::cosmo_get_pens( pen_t *pens ) -{ - offs_t i; - - for (i = 0; i < NUM_PENS; i++) - { - pens[i] = rgb_t(pal1bit(i >> 0), pal1bit(i >> 1), pal1bit(i >> 2)); - } -} - - -inline void _8080bw_state::set_pixel( bitmap_rgb32 &bitmap, UINT8 y, UINT8 x, const pen_t *pens, UINT8 color ) +inline void _8080bw_state::set_pixel( bitmap_rgb32 &bitmap, UINT8 y, UINT8 x, int color ) { if (y >= MW8080BW_VCOUNTER_START_NO_VBLANK) { if (m_flip_screen) - bitmap.pix32(MW8080BW_VBSTART - 1 - (y - MW8080BW_VCOUNTER_START_NO_VBLANK), MW8080BW_HPIXCOUNT - 1 - x) = pens[color]; + bitmap.pix32(MW8080BW_VBSTART - 1 - (y - MW8080BW_VCOUNTER_START_NO_VBLANK), MW8080BW_HPIXCOUNT - 1 - x) = color; else - bitmap.pix32(y - MW8080BW_VCOUNTER_START_NO_VBLANK, x) = pens[color]; + bitmap.pix32(y - MW8080BW_VCOUNTER_START_NO_VBLANK, x) = m_palette->pen_color(color); } } -inline void _8080bw_state::set_8_pixels( bitmap_rgb32 &bitmap, UINT8 y, UINT8 x, UINT8 data, const pen_t *pens, UINT8 fore_color, UINT8 back_color ) +inline void _8080bw_state::set_8_pixels( bitmap_rgb32 &bitmap, UINT8 y, UINT8 x, UINT8 data, int fore_color, int back_color ) { int i; for (i = 0; i < 8; i++) { - set_pixel(bitmap, y, x, pens, (data & 0x01) ? fore_color : back_color); + set_pixel(bitmap, y, x, (data & 0x01) ? fore_color : back_color); x = x + 1; data = data >> 1; @@ -106,7 +78,7 @@ inline void _8080bw_state::set_8_pixels( bitmap_rgb32 &bitmap, UINT8 y, UINT8 x, /* this is needed as this driver doesn't emulate the shift register like mw8080bw does */ -void _8080bw_state::clear_extra_columns( bitmap_rgb32 &bitmap, const pen_t *pens, UINT8 color ) +void _8080bw_state::clear_extra_columns( bitmap_rgb32 &bitmap, int color ) { UINT8 x; @@ -117,9 +89,9 @@ void _8080bw_state::clear_extra_columns( bitmap_rgb32 &bitmap, const pen_t *pens for (y = MW8080BW_VCOUNTER_START_NO_VBLANK; y != 0; y++) { if (m_flip_screen) - bitmap.pix32(MW8080BW_VBSTART - 1 - (y - MW8080BW_VCOUNTER_START_NO_VBLANK), MW8080BW_HPIXCOUNT - 1 - (256 + x)) = pens[color]; + bitmap.pix32(MW8080BW_VBSTART - 1 - (y - MW8080BW_VCOUNTER_START_NO_VBLANK), MW8080BW_HPIXCOUNT - 1 - (256 + x)) = m_palette->pen_color(color); else - bitmap.pix32(y - MW8080BW_VCOUNTER_START_NO_VBLANK, 256 + x) = pens[color]; + bitmap.pix32(y - MW8080BW_VCOUNTER_START_NO_VBLANK, 256 + x) = m_palette->pen_color(color); } } } @@ -127,17 +99,10 @@ void _8080bw_state::clear_extra_columns( bitmap_rgb32 &bitmap, const pen_t *pens UINT32 _8080bw_state::screen_update_invadpt2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - pen_t pens[NUM_PENS]; - offs_t offs; - UINT8 *prom; - UINT8 *color_map_base; - - invadpt2_get_pens(pens); - - prom = memregion("proms")->base(); - color_map_base = m_color_map ? &prom[0x0400] : &prom[0x0000]; + UINT8 *prom = memregion("proms")->base(); + UINT8 *color_map_base = m_color_map ? &prom[0x0400] : &prom[0x0000]; - for (offs = 0; offs < m_main_ram.bytes(); offs++) + for (offs_t offs = 0; offs < m_main_ram.bytes(); offs++) { UINT8 y = offs >> 5; UINT8 x = offs << 3; @@ -147,10 +112,10 @@ UINT32 _8080bw_state::screen_update_invadpt2(screen_device &screen, bitmap_rgb32 UINT8 data = m_main_ram[offs]; UINT8 fore_color = m_screen_red ? 1 : color_map_base[color_address] & 0x07; - set_8_pixels(bitmap, y, x, data, pens, fore_color, 0); + set_8_pixels(bitmap, y, x, data, fore_color, 0); } - clear_extra_columns(bitmap, pens, 0); + clear_extra_columns(bitmap, 0); return 0; } @@ -158,17 +123,10 @@ UINT32 _8080bw_state::screen_update_invadpt2(screen_device &screen, bitmap_rgb32 UINT32 _8080bw_state::screen_update_ballbomb(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - pen_t pens[NUM_PENS]; - offs_t offs; - UINT8 *color_map_base; - UINT8 *prom; + UINT8 *prom = memregion("proms")->base(); + UINT8 *color_map_base = m_color_map ? &prom[0x0400] : &prom[0x0000]; - invadpt2_get_pens(pens); - - prom = memregion("proms")->base(); - color_map_base = m_color_map ? &prom[0x0400] : &prom[0x0000]; - - for (offs = 0; offs < m_main_ram.bytes(); offs++) + for (offs_t offs = 0; offs < m_main_ram.bytes(); offs++) { UINT8 y = offs >> 5; UINT8 x = offs << 3; @@ -179,10 +137,10 @@ UINT32 _8080bw_state::screen_update_ballbomb(screen_device &screen, bitmap_rgb32 UINT8 fore_color = m_screen_red ? 1 : color_map_base[color_address] & 0x07; /* blue background */ - set_8_pixels(bitmap, y, x, data, pens, fore_color, 2); + set_8_pixels(bitmap, y, x, data, fore_color, 2); } - clear_extra_columns(bitmap, pens, 2); + clear_extra_columns(bitmap, 2); return 0; } @@ -190,15 +148,9 @@ UINT32 _8080bw_state::screen_update_ballbomb(screen_device &screen, bitmap_rgb32 UINT32 _8080bw_state::screen_update_schaser(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - pen_t pens[NUM_PENS]; - offs_t offs; - UINT8 *background_map_base; - - invadpt2_get_pens(pens); + UINT8 *background_map_base = memregion("proms")->base(); - background_map_base = memregion("proms")->base(); - - for (offs = 0; offs < m_main_ram.bytes(); offs++) + for (offs_t offs = 0; offs < m_main_ram.bytes(); offs++) { UINT8 back_color = 0; @@ -219,10 +171,10 @@ UINT32 _8080bw_state::screen_update_schaser(screen_device &screen, bitmap_rgb32 back_color = (((back_data & 0x0c) == 0x0c) && m_schaser_background_select) ? 4 : 2; } - set_8_pixels(bitmap, y, x, data, pens, fore_color, back_color); + set_8_pixels(bitmap, y, x, data, fore_color, back_color); } - clear_extra_columns(bitmap, pens, m_schaser_background_disable ? 0 : 2); + clear_extra_columns(bitmap, m_schaser_background_disable ? 0 : 2); return 0; } @@ -230,12 +182,7 @@ UINT32 _8080bw_state::screen_update_schaser(screen_device &screen, bitmap_rgb32 UINT32 _8080bw_state::screen_update_schasercv(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - pen_t pens[NUM_PENS]; - offs_t offs; - - invadpt2_get_pens(pens); - - for (offs = 0; offs < m_main_ram.bytes(); offs++) + for (offs_t offs = 0; offs < m_main_ram.bytes(); offs++) { UINT8 y = offs >> 5; UINT8 x = offs << 3; @@ -244,10 +191,10 @@ UINT32 _8080bw_state::screen_update_schasercv(screen_device &screen, bitmap_rgb3 UINT8 fore_color = m_colorram[offs & 0x1f9f] & 0x07; /* blue background */ - set_8_pixels(bitmap, y, x, data, pens, fore_color, 2); + set_8_pixels(bitmap, y, x, data, fore_color, 2); } - clear_extra_columns(bitmap, pens, 2); + clear_extra_columns(bitmap, 2); return 0; } @@ -255,9 +202,7 @@ UINT32 _8080bw_state::screen_update_schasercv(screen_device &screen, bitmap_rgb3 UINT32 _8080bw_state::screen_update_rollingc(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - offs_t offs; - - for (offs = 0; offs < m_main_ram.bytes(); offs++) + for (offs_t offs = 0; offs < m_main_ram.bytes(); offs++) { UINT8 y = offs >> 5; UINT8 x = offs << 3; @@ -266,10 +211,10 @@ UINT32 _8080bw_state::screen_update_rollingc(screen_device &screen, bitmap_rgb32 UINT8 fore_color = m_colorram[offs & 0x1f1f] & 0x0f; UINT8 back_color = m_colorram2[offs & 0x1f1f] & 0x0f; - set_8_pixels(bitmap, y, x, data, m_palette->pens(), fore_color, back_color); + set_8_pixels(bitmap, y, x, data, fore_color, back_color); } - clear_extra_columns(bitmap, m_palette->pens(), 0); + clear_extra_columns(bitmap, 0); return 0; } @@ -277,17 +222,10 @@ UINT32 _8080bw_state::screen_update_rollingc(screen_device &screen, bitmap_rgb32 UINT32 _8080bw_state::screen_update_polaris(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - pen_t pens[NUM_PENS]; - offs_t offs; - UINT8 *color_map_base; - UINT8 *cloud_gfx; - - invadpt2_get_pens(pens); - - color_map_base = memregion("proms")->base(); - cloud_gfx = memregion("user1")->base(); + UINT8 *color_map_base = memregion("proms")->base(); + UINT8 *cloud_gfx = memregion("user1")->base(); - for (offs = 0; offs < m_main_ram.bytes(); offs++) + for (offs_t offs = 0; offs < m_main_ram.bytes(); offs++) { UINT8 y = offs >> 5; UINT8 x = offs << 3; @@ -309,7 +247,7 @@ UINT32 _8080bw_state::screen_update_polaris(screen_device &screen, bitmap_rgb32 if ((color_map_base[color_address] & 0x08) || (cloud_y >= 64)) { - set_8_pixels(bitmap, y, x, data, pens, fore_color, back_color); + set_8_pixels(bitmap, y, x, data, fore_color, back_color); } else { @@ -332,7 +270,7 @@ UINT32 _8080bw_state::screen_update_polaris(screen_device &screen, bitmap_rgb32 color = (cloud_gfx[cloud_gfx_offs] & bit) ? 7 : back_color; } - set_pixel(bitmap, y, x, pens, color); + set_pixel(bitmap, y, x, color); x = x + 1; data = data >> 1; @@ -340,7 +278,7 @@ UINT32 _8080bw_state::screen_update_polaris(screen_device &screen, bitmap_rgb32 } } - clear_extra_columns(bitmap, pens, 6); + clear_extra_columns(bitmap, 6); return 0; } @@ -348,12 +286,7 @@ UINT32 _8080bw_state::screen_update_polaris(screen_device &screen, bitmap_rgb32 UINT32 _8080bw_state::screen_update_lupin3(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - pen_t pens[NUM_PENS]; - offs_t offs; - - invadpt2_get_pens(pens); - - for (offs = 0; offs < m_main_ram.bytes(); offs++) + for (offs_t offs = 0; offs < m_main_ram.bytes(); offs++) { UINT8 y = offs >> 5; UINT8 x = offs << 3; @@ -361,10 +294,10 @@ UINT32 _8080bw_state::screen_update_lupin3(screen_device &screen, bitmap_rgb32 & UINT8 data = m_main_ram[offs]; UINT8 fore_color = ~m_colorram[offs & 0x1f9f] & 0x07; - set_8_pixels(bitmap, y, x, data, pens, fore_color, 0); + set_8_pixels(bitmap, y, x, data, fore_color, 0); } - clear_extra_columns(bitmap, pens, 0); + clear_extra_columns(bitmap, 0); return 0; } @@ -372,12 +305,7 @@ UINT32 _8080bw_state::screen_update_lupin3(screen_device &screen, bitmap_rgb32 & UINT32 _8080bw_state::screen_update_cosmo(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - pen_t pens[NUM_PENS]; - offs_t offs; - - cosmo_get_pens(pens); - - for (offs = 0; offs < m_main_ram.bytes(); offs++) + for (offs_t offs = 0; offs < m_main_ram.bytes(); offs++) { UINT8 y = offs >> 5; UINT8 x = offs << 3; @@ -387,10 +315,10 @@ UINT32 _8080bw_state::screen_update_cosmo(screen_device &screen, bitmap_rgb32 &b UINT8 data = m_main_ram[offs]; UINT8 fore_color = m_colorram[color_address] & 0x07; - set_8_pixels(bitmap, y, x, data, pens, fore_color, 0); + set_8_pixels(bitmap, y, x, data, fore_color, 0); } - clear_extra_columns(bitmap, pens, 0); + clear_extra_columns(bitmap, 0); return 0; } @@ -398,17 +326,10 @@ UINT32 _8080bw_state::screen_update_cosmo(screen_device &screen, bitmap_rgb32 &b UINT32 _8080bw_state::screen_update_indianbt(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - pen_t pens[NUM_PENS]; - offs_t offs; - UINT8 *color_map_base; - UINT8 *prom; - - cosmo_get_pens(pens); + UINT8 *prom = memregion("proms")->base(); + UINT8 *color_map_base = m_color_map ? &prom[0x0400] : &prom[0x0000]; - prom = memregion("proms")->base(); - color_map_base = m_color_map ? &prom[0x0400] : &prom[0x0000]; - - for (offs = 0; offs < m_main_ram.bytes(); offs++) + for (offs_t offs = 0; offs < m_main_ram.bytes(); offs++) { UINT8 y = offs >> 5; UINT8 x = offs << 3; @@ -418,10 +339,10 @@ UINT32 _8080bw_state::screen_update_indianbt(screen_device &screen, bitmap_rgb32 UINT8 data = m_main_ram[offs]; UINT8 fore_color = color_map_base[color_address] & 0x07; - set_8_pixels(bitmap, y, x, data, pens, fore_color, 0); + set_8_pixels(bitmap, y, x, data, fore_color, 0); } - clear_extra_columns(bitmap, pens, 0); + clear_extra_columns(bitmap, 0); return 0; } @@ -429,12 +350,7 @@ UINT32 _8080bw_state::screen_update_indianbt(screen_device &screen, bitmap_rgb32 UINT32 _8080bw_state::screen_update_sflush(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - pen_t pens[NUM_PENS]; - offs_t offs; - - sflush_get_pens(pens); - - for (offs = 0; offs < m_main_ram.bytes(); offs++) + for (offs_t offs = 0; offs < m_main_ram.bytes(); offs++) { UINT8 y = offs >> 5; UINT8 x = offs << 3; @@ -442,10 +358,10 @@ UINT32 _8080bw_state::screen_update_sflush(screen_device &screen, bitmap_rgb32 & UINT8 data = m_main_ram[offs]; UINT8 fore_color = m_colorram[offs & 0x1f9f] & 0x07; - set_8_pixels(bitmap, y, x, data, pens, fore_color, 0); + set_8_pixels(bitmap, y, x, data, fore_color, 0); } - clear_extra_columns(bitmap, pens, 0); + clear_extra_columns(bitmap, 0); return 0; } @@ -453,24 +369,19 @@ UINT32 _8080bw_state::screen_update_sflush(screen_device &screen, bitmap_rgb32 & UINT32 _8080bw_state::screen_update_shuttlei(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - pen_t pens[2] = { rgb_t::black, rgb_t::white }; - offs_t offs; - - for (offs = 0; offs < m_main_ram.bytes(); offs++) + for (offs_t offs = 0; offs < m_main_ram.bytes(); offs++) { - int i; - UINT8 y = offs >> 5; UINT8 x = offs << 3; UINT8 data = m_main_ram[offs]; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { if (m_flip_screen) - bitmap.pix32(191-y, 255-(x|i)) = pens[BIT(data, 7)]; + bitmap.pix32(191-y, 255-(x|i)) = m_palette->pen_color(BIT(data, 7)); else - bitmap.pix32(y, x|i) = pens[BIT(data, 7)]; + bitmap.pix32(y, x|i) = m_palette->pen_color(BIT(data, 7)); data <<= 1; } } @@ -481,22 +392,17 @@ UINT32 _8080bw_state::screen_update_shuttlei(screen_device &screen, bitmap_rgb32 UINT32 _8080bw_state::screen_update_spacecom(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - pen_t pens[2] = { rgb_t::black, rgb_t::white }; - offs_t offs; - - for (offs = 0; offs < 0x1c00; offs++) + for (offs_t offs = 0; offs < 0x1c00; offs++) { - int i; - UINT8 y = offs >> 5; UINT8 x = offs << 3; UINT8 flipx = m_flip_screen ? 7 : 0; UINT8 data = m_main_ram[offs+0x400]; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { - bitmap.pix32(y, x | (i^flipx)) = pens[data & 1]; + bitmap.pix32(y, x | (i^flipx)) = m_palette->pen_color(BIT(data, 0)); data >>= 1; } } diff --git a/src/mame/video/88games.c b/src/mame/video/88games.c index b7b34342c01..70c1206b44c 100644 --- a/src/mame/video/88games.c +++ b/src/mame/video/88games.c @@ -12,8 +12,10 @@ K052109_CB_MEMBER(_88games_state::tile_callback) { + static const int layer_colorbase[] = { 1024 / 16, 0 / 16, 256 / 16 }; + *code |= ((*color & 0x0f) << 8) | (bank << 12); - *color = m_layer_colorbase[layer] + ((*color & 0xf0) >> 4); + *color = layer_colorbase[layer] + ((*color & 0xf0) >> 4); } @@ -25,8 +27,10 @@ K052109_CB_MEMBER(_88games_state::tile_callback) K051960_CB_MEMBER(_88games_state::sprite_callback) { + enum { sprite_colorbase = 512 / 16 }; + *priority = (*color & 0x20) >> 5; /* ??? */ - *color = m_sprite_colorbase + (*color & 0x0f); + *color = sprite_colorbase + (*color & 0x0f); } @@ -38,9 +42,11 @@ K051960_CB_MEMBER(_88games_state::sprite_callback) K051316_CB_MEMBER(_88games_state::zoom_callback) { + enum { zoom_colorbase = 768 / 16 }; + *flags = (*color & 0x40) ? TILE_FLIPX : 0; *code |= ((*color & 0x07) << 8); - *color = m_zoom_colorbase + ((*color & 0x38) >> 3) + ((*color & 0x80) >> 4); + *color = zoom_colorbase + ((*color & 0x38) >> 3) + ((*color & 0x80) >> 4); } /*************************************************************************** diff --git a/src/mame/video/aerofgt.c b/src/mame/video/aerofgt.c index 2c455b6bf29..f66649889e6 100644 --- a/src/mame/video/aerofgt.c +++ b/src/mame/video/aerofgt.c @@ -836,7 +836,7 @@ UINT32 aerofgt_state::screen_update_wbbc97(screen_device &screen, bitmap_rgb32 & m_bg1_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0); } - m_spr_old->turbofrc_draw_sprites(m_spriteram3,m_spriteram3.bytes(),m_spritepalettebank, bitmap, cliprect, screen.priority(), 0); m_spr_old->turbofrc_draw_sprites(m_spriteram3,m_spriteram3.bytes(),m_spritepalettebank, bitmap, cliprect, screen.priority(), 1); + m_spr_old->turbofrc_draw_sprites(m_spriteram3,m_spriteram3.bytes(),m_spritepalettebank, bitmap, cliprect, screen.priority(), 0); return 0; } diff --git a/src/mame/video/ajax.c b/src/mame/video/ajax.c index d9bc8ec7feb..35e68312860 100644 --- a/src/mame/video/ajax.c +++ b/src/mame/video/ajax.c @@ -20,8 +20,10 @@ K052109_CB_MEMBER(ajax_state::tile_callback) { + static const int layer_colorbase[] = { 1024 / 16, 0 / 16, 512 / 16 }; + *code |= ((*color & 0x0f) << 8) | (bank << 12); - *color = m_layer_colorbase[layer] + ((*color & 0xf0) >> 4); + *color = layer_colorbase[layer] + ((*color & 0xf0) >> 4); } @@ -33,17 +35,19 @@ K052109_CB_MEMBER(ajax_state::tile_callback) K051960_CB_MEMBER(ajax_state::sprite_callback) { + enum { sprite_colorbase = 256 / 16 }; + /* priority bits: 4 over zoom (0 = have priority) 5 over B (0 = have priority) 6 over A (1 = have priority) never over F */ - *priority = 0xff00; /* F = 8 */ - if ( *color & 0x10) *priority |= 0xf0f0; /* Z = 4 */ - if (~*color & 0x40) *priority |= 0xcccc; /* A = 2 */ - if ( *color & 0x20) *priority |= 0xaaaa; /* B = 1 */ - *color = m_sprite_colorbase + (*color & 0x0f); + *priority = 0; + if ( *color & 0x10) *priority |= GFX_PMASK_4; /* Z = 4 */ + if (~*color & 0x40) *priority |= GFX_PMASK_2; /* A = 2 */ + if ( *color & 0x20) *priority |= GFX_PMASK_1; /* B = 1 */ + *color = sprite_colorbase + (*color & 0x0f); } @@ -55,28 +59,13 @@ K051960_CB_MEMBER(ajax_state::sprite_callback) K051316_CB_MEMBER(ajax_state::zoom_callback) { - *code |= ((*color & 0x07) << 8); - *color = m_zoom_colorbase + ((*color & 0x08) >> 3); -} - - -/*************************************************************************** + enum { zoom_colorbase = 768 / 128 }; - Start the video hardware emulation. - -***************************************************************************/ - -void ajax_state::video_start() -{ - m_layer_colorbase[0] = 64; - m_layer_colorbase[1] = 0; - m_layer_colorbase[2] = 32; - m_sprite_colorbase = 16; - m_zoom_colorbase = 6; /* == 48 since it's 7-bit graphics */ + *code |= ((*color & 0x07) << 8); + *color = zoom_colorbase + ((*color & 0x08) >> 3); } - /*************************************************************************** Display Refresh @@ -103,8 +92,7 @@ UINT32 ajax_state::screen_update_ajax(screen_device &screen, bitmap_ind16 &bitma m_k052109->tilemap_draw(screen, bitmap, cliprect, 1, 0, 2); m_k051316->zoom_draw(screen, bitmap, cliprect, 0, 4); } - m_k052109->tilemap_draw(screen, bitmap, cliprect, 0, 0, 8); - m_k051960->k051960_sprites_draw(bitmap, cliprect, screen.priority(), -1, -1); + m_k052109->tilemap_draw(screen, bitmap, cliprect, 0, 0, 0); return 0; } diff --git a/src/mame/video/aliens.c b/src/mame/video/aliens.c index e169a422406..39489d27faa 100644 --- a/src/mame/video/aliens.c +++ b/src/mame/video/aliens.c @@ -12,7 +12,7 @@ K052109_CB_MEMBER(aliens_state::tile_callback) { *code |= ((*color & 0x3f) << 8) | (bank << 14); - *color = m_layer_colorbase[layer] + ((*color & 0xc0) >> 6); + *color = layer * 4 + ((*color & 0xc0) >> 6); } @@ -24,43 +24,29 @@ K052109_CB_MEMBER(aliens_state::tile_callback) K051960_CB_MEMBER(aliens_state::sprite_callback) { + enum { sprite_colorbase = 256 / 16 }; + /* The PROM allows for mixed priorities, where sprites would have */ /* priority over text but not on one or both of the other two planes. */ switch (*color & 0x70) { case 0x10: *priority = 0x00; break; /* over ABF */ - case 0x00: *priority = 0xf0 ; break; /* over AB, not F */ - case 0x40: *priority = 0xf0|0xcc ; break; /* over A, not BF */ + case 0x00: *priority = GFX_PMASK_4 ; break; /* over AB, not F */ + case 0x40: *priority = GFX_PMASK_4|GFX_PMASK_2 ; break; /* over A, not BF */ case 0x20: - case 0x60: *priority = 0xf0|0xcc|0xaa; break; /* over -, not ABF */ - case 0x50: *priority = 0xcc ; break; /* over AF, not B */ + case 0x60: *priority = GFX_PMASK_4|GFX_PMASK_2|GFX_PMASK_1; break; /* over -, not ABF */ + case 0x50: *priority = GFX_PMASK_2 ; break; /* over AF, not B */ case 0x30: - case 0x70: *priority = 0xcc|0xaa; break; /* over F, not AB */ + case 0x70: *priority = GFX_PMASK_2|GFX_PMASK_1; break; /* over F, not AB */ } *code |= (*color & 0x80) << 6; - *color = m_sprite_colorbase + (*color & 0x0f); + *color = sprite_colorbase + (*color & 0x0f); *shadow = 0; /* shadows are not used by this game */ } /*************************************************************************** - Start the video hardware emulation. - -***************************************************************************/ - -void aliens_state::video_start() -{ - m_layer_colorbase[0] = 0; - m_layer_colorbase[1] = 4; - m_layer_colorbase[2] = 8; - m_sprite_colorbase = 16; -} - - - -/*************************************************************************** - Display refresh ***************************************************************************/ @@ -70,7 +56,8 @@ UINT32 aliens_state::screen_update_aliens(screen_device &screen, bitmap_ind16 &b m_k052109->tilemap_update(); screen.priority().fill(0, cliprect); - bitmap.fill(m_layer_colorbase[1] * 16, cliprect); + /* The background color is always from layer 1 */ + m_k052109->tilemap_draw(screen, bitmap, cliprect, 1, TILEMAP_DRAW_OPAQUE, 0); m_k052109->tilemap_draw(screen, bitmap, cliprect, 1, 0, 1); m_k052109->tilemap_draw(screen, bitmap, cliprect, 2, 0, 2); diff --git a/src/mame/video/amiga.c b/src/mame/video/amiga.c index f9891c67cda..95bbe40c078 100644 --- a/src/mame/video/amiga.c +++ b/src/mame/video/amiga.c @@ -146,15 +146,15 @@ VIDEO_START_MEMBER( amiga_state, amiga ) * *************************************/ -UINT32 amiga_gethvpos(screen_device &screen) +UINT32 amiga_state::amiga_gethvpos() { - amiga_state *state = screen.machine().driver_data<amiga_state>(); - UINT32 hvpos = (state->m_last_scanline << 8) | (screen.hpos() >> 2); - UINT32 latchedpos = state->ioport("HVPOS")->read_safe(0); + amiga_state *state = this; + UINT32 hvpos = (m_last_scanline << 8) | (m_screen->hpos() >> 2); + UINT32 latchedpos = m_hvpos ? m_hvpos->read() : 0; /* if there's no latched position, or if we are in the active display area */ /* but before the latching point, return the live HV position */ - if ((CUSTOM_REG(REG_BPLCON0) & 0x0008) == 0 || latchedpos == 0 || (state->m_last_scanline >= 20 && hvpos < latchedpos)) + if ((CUSTOM_REG(REG_BPLCON0) & 0x0008) == 0 || latchedpos == 0 || (m_last_scanline >= 20 && hvpos < latchedpos)) return hvpos; /* otherwise, return the latched position */ diff --git a/src/mame/video/amspdwy.c b/src/mame/video/amspdwy.c index b9a3ed2bf54..ad1f6ec050d 100644 --- a/src/mame/video/amspdwy.c +++ b/src/mame/video/amspdwy.c @@ -18,11 +18,6 @@ #include "includes/amspdwy.h" -WRITE8_MEMBER(amspdwy_state::amspdwy_paletteram_w) -{ - m_palette->write(space, offset, UINT8(~data)); -} - WRITE8_MEMBER(amspdwy_state::amspdwy_flipscreen_w) { m_flipscreen ^= 1; diff --git a/src/mame/video/astrocde.c b/src/mame/video/astrocde.c index 962de8e7e2c..2df2fb11706 100644 --- a/src/mame/video/astrocde.c +++ b/src/mame/video/astrocde.c @@ -24,7 +24,6 @@ void astrocde_state::machine_start() save_item(NAME(m_port_2_last)); save_item(NAME(m_ram_write_enable)); save_item(NAME(m_input_select)); - save_item(NAME(m_profpac_bank)); m_port_1_last = m_port_2_last = 0xff; } @@ -491,51 +490,51 @@ READ8_MEMBER(astrocde_state::astrocade_data_chip_register_r) break; case 0x10: /* player 1 handle */ - result = ioport("P1HANDLE")->read_safe(0xff); + result = m_p1handle? m_p1handle->read() : 0xff; break; case 0x11: /* player 2 handle */ - result = ioport("P2HANDLE")->read_safe(0xff); + result = m_p2handle? m_p2handle->read() : 0xff; break; case 0x12: /* player 3 handle */ - result = ioport("P3HANDLE")->read_safe(0xff); + result = m_p3handle? m_p3handle->read() : 0xff; break; case 0x13: /* player 4 handle */ - result = ioport("P4HANDLE")->read_safe(0xff); + result = m_p4handle? m_p4handle->read() : 0xff; break; case 0x14: /* keypad column 0 */ - result = ioport("KEYPAD0")->read_safe(0xff); + result = m_keypad0 ? m_keypad0->read() : 0xff; break; case 0x15: /* keypad column 1 */ - result = ioport("KEYPAD1")->read_safe(0xff); + result = m_keypad1 ? m_keypad1->read() : 0xff; break; case 0x16: /* keypad column 2 */ - result = ioport("KEYPAD2")->read_safe(0xff); + result = m_keypad2 ? m_keypad2->read() : 0xff; break; case 0x17: /* keypad column 3 */ - result = ioport("KEYPAD3")->read_safe(0xff); + result = m_keypad3 ? m_keypad3->read() : 0xff; break; case 0x1c: /* player 1 knob */ - result = ioport("P1_KNOB")->read_safe(0xff); + result = m_p1_knob ? m_p1_knob->read() : 0xff; break; case 0x1d: /* player 2 knob */ - result = ioport("P2_KNOB")->read_safe(0xff); + result = m_p2_knob ? m_p2_knob->read() : 0xff; break; case 0x1e: /* player 3 knob */ - result = ioport("P3_KNOB")->read_safe(0xff); + result = m_p3_knob ? m_p3_knob->read() : 0xff; break; case 0x1f: /* player 4 knob */ - result = ioport("P4_KNOB")->read_safe(0xff); + result = m_p4_knob ? m_p4_knob->read() : 0xff; break; } @@ -605,7 +604,7 @@ WRITE8_MEMBER(astrocde_state::astrocade_data_chip_register_w) case 0x17: /* noise volume register */ case 0x18: /* sound block transfer */ if (m_video_config & AC_SOUND_PRESENT) - machine().device<astrocade_device>("astrocade1")->astrocade_sound_w(space, offset, data); + m_astrocade_sound1->astrocade_sound_w(space, offset, data); break; case 0x19: /* expand register */ diff --git a/src/mame/video/atarimo.c b/src/mame/video/atarimo.c index aeb0e3d6912..df1df174e9e 100644 --- a/src/mame/video/atarimo.c +++ b/src/mame/video/atarimo.c @@ -259,12 +259,12 @@ void atari_motion_objects_device::apply_stain(bitmap_ind16 &bitmap, UINT16 *pf, { const UINT16 START_MARKER = ((4 << PRIORITY_SHIFT) | 2); const UINT16 END_MARKER = ((4 << PRIORITY_SHIFT) | 4); - int offnext = 0; + bool offnext = false; for ( ; x < bitmap.width(); x++) { pf[x] |= 0x400; - if (offnext != 0 && (mo[x] & START_MARKER) != START_MARKER) + if (mo[x] == 0xffff || (offnext && (mo[x] & START_MARKER) != START_MARKER)) break; offnext = ((mo[x] & END_MARKER) == END_MARKER); } @@ -541,7 +541,7 @@ void atari_motion_objects_device::render_object(bitmap_ind16 &bitmap, const rect continue; // draw the sprite - gfx->transpen_raw(bitmap,cliprect, code, color, hflip, vflip, sx, sy, m_transpen); + gfx->transpen_raw(bitmap,cliprect, code, color, hflip, vflip, sx, sy, m_transpen); mark_dirty(sx, sx + m_tilewidth - 1, sy, sy + m_tileheight - 1); } } @@ -570,7 +570,7 @@ void atari_motion_objects_device::render_object(bitmap_ind16 &bitmap, const rect continue; // draw the sprite - gfx->transpen_raw(bitmap,cliprect, code, color, hflip, vflip, sx, sy, m_transpen); + gfx->transpen_raw(bitmap,cliprect, code, color, hflip, vflip, sx, sy, m_transpen); mark_dirty(sx, sx + m_tilewidth - 1, sy, sy + m_tileheight - 1); } } @@ -595,8 +595,8 @@ void atari_motion_objects_device::render_object(bitmap_ind16 &bitmap, const rect atari_motion_objects_device::sprite_parameter::sprite_parameter() : m_word(0), - m_shift(0), - m_mask(0) + m_shift(0), + m_mask(0) { } diff --git a/src/mame/video/atarisy2.c b/src/mame/video/atarisy2.c index 1e6b1238ec5..65030f97f57 100644 --- a/src/mame/video/atarisy2.c +++ b/src/mame/video/atarisy2.c @@ -166,35 +166,31 @@ WRITE16_MEMBER( atarisy2_state::yscroll_w ) /************************************* * - * Palette RAM write handler + * Palette RAM to RGB converter * *************************************/ -WRITE16_MEMBER( atarisy2_state::paletteram_w ) +PALETTE_DECODER_MEMBER( atarisy2_state, RRRRGGGGBBBBIIII ) { + static const int ZB = 115, Z3 = 78, Z2 = 37, Z1 = 17, Z0 = 9; + static const int intensity_table[16] = { - #define ZB 115 - #define Z3 78 - #define Z2 37 - #define Z1 17 - #define Z0 9 0, ZB+Z0, ZB+Z1, ZB+Z1+Z0, ZB+Z2, ZB+Z2+Z0, ZB+Z2+Z1, ZB+Z2+Z1+Z0, ZB+Z3, ZB+Z3+Z0, ZB+Z3+Z1, ZB+Z3+Z1+Z0,ZB+ Z3+Z2, ZB+Z3+Z2+Z0, ZB+Z3+Z2+Z1, ZB+Z3+Z2+Z1+Z0 }; - static const int color_table[16] = - { 0x0, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xe, 0xf, 0xf }; - int newword, inten, red, green, blue; + static const int color_table[16] = + { + 0x0, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xe, 0xf, 0xf + }; - COMBINE_DATA(&m_generic_paletteram_16[offset]); - newword = m_generic_paletteram_16[offset]; + int i = intensity_table[raw & 15]; + UINT8 r = (color_table[(raw >> 12) & 15] * i) >> 4; + UINT8 g = (color_table[(raw >> 8) & 15] * i) >> 4; + UINT8 b = (color_table[(raw >> 4) & 15] * i) >> 4; - inten = intensity_table[newword & 15]; - red = (color_table[(newword >> 12) & 15] * inten) >> 4; - green = (color_table[(newword >> 8) & 15] * inten) >> 4; - blue = (color_table[(newword >> 4) & 15] * inten) >> 4; - m_palette->set_pen_color(offset, rgb_t(red, green, blue)); + return rgb_t(r, g, b); } diff --git a/src/mame/video/avgdvg.c b/src/mame/video/avgdvg.c index 1b5d6b3b37b..4363db0e66c 100644 --- a/src/mame/video/avgdvg.c +++ b/src/mame/video/avgdvg.c @@ -670,6 +670,7 @@ int avg_tempest_device::handler_7() // tempest_strobe3 return cycles; } +#if 0 void avg_tempest_device::vggo() // tempest_vggo { m_pc = 0; @@ -682,7 +683,7 @@ void avg_tempest_device::vggo() // tempest_vggo */ nvect = 0; } - +#endif /************************************* * @@ -912,7 +913,6 @@ void avg_quantum_device::vggo() // tempest_vggo nvect = 0; } - int avg_quantum_device::handler_0() // quantum_st2st3 { /* Quantum doesn't decode latch0 or latch2 but ST2 and ST3 are fed diff --git a/src/mame/video/avgdvg.h b/src/mame/video/avgdvg.h index 79f923e7f46..269e7ebc49f 100644 --- a/src/mame/video/avgdvg.h +++ b/src/mame/video/avgdvg.h @@ -189,7 +189,7 @@ public: virtual int handler_6(); virtual int handler_7(); - virtual void vggo(); + //virtual void vggo(); }; // device type definition diff --git a/src/mame/video/battlnts.c b/src/mame/video/battlnts.c index f50f77339d2..d88f16a9251 100644 --- a/src/mame/video/battlnts.c +++ b/src/mame/video/battlnts.c @@ -12,7 +12,7 @@ K007342_CALLBACK_MEMBER(battlnts_state::battlnts_tile_callback) { *code |= ((*color & 0x0f) << 9) | ((*color & 0x40) << 2); - *color = m_layer_colorbase[layer]; + *color = 0; } /*************************************************************************** diff --git a/src/mame/video/bionicc.c b/src/mame/video/bionicc.c index 6f61d0ff32b..9c6b38a053c 100644 --- a/src/mame/video/bionicc.c +++ b/src/mame/video/bionicc.c @@ -97,6 +97,24 @@ void bionicc_state::video_start() m_bg_tilemap->set_transparent_pen(15); } +PALETTE_DECODER_MEMBER( bionicc_state, RRRRGGGGBBBBIIII ) +{ + UINT8 bright = (raw & 0x0f); + + UINT8 r = ((raw >> 12) & 0x0f) * 0x11; + UINT8 g = ((raw >> 8) & 0x0f) * 0x11; + UINT8 b = ((raw >> 4) & 0x0f) * 0x11; + + if ((bright & 0x08) == 0) + { + r = r * (0x07 + bright) / 0x0e; + g = g * (0x07 + bright) / 0x0e; + b = b * (0x07 + bright) / 0x0e; + } + + return rgb_t(r, g, b); +} + /*************************************************************************** @@ -123,27 +141,6 @@ WRITE16_MEMBER(bionicc_state::bionicc_txvideoram_w) m_tx_tilemap->mark_tile_dirty(offset & 0x3ff); } -WRITE16_MEMBER(bionicc_state::bionicc_paletteram_w) -{ - int r, g, b, bright; - data = COMBINE_DATA(&m_paletteram[offset]); - - bright = (data & 0x0f); - - r = ((data >> 12) & 0x0f) * 0x11; - g = ((data >> 8 ) & 0x0f) * 0x11; - b = ((data >> 4 ) & 0x0f) * 0x11; - - if ((bright & 0x08) == 0) - { - r = r * (0x07 + bright) / 0x0e; - g = g * (0x07 + bright) / 0x0e; - b = b * (0x07 + bright) / 0x0e; - } - - m_palette->set_pen_color (offset, rgb_t(r, g, b)); -} - WRITE16_MEMBER(bionicc_state::bionicc_scroll_w) { data = COMBINE_DATA(&m_scroll[offset]); diff --git a/src/mame/video/bladestl.c b/src/mame/video/bladestl.c index 7e62058945a..58db646223a 100644 --- a/src/mame/video/bladestl.c +++ b/src/mame/video/bladestl.c @@ -32,7 +32,7 @@ PALETTE_INIT_MEMBER(bladestl_state, bladestl) K007342_CALLBACK_MEMBER(bladestl_state::bladestl_tile_callback) { *code |= ((*color & 0x0f) << 8) | ((*color & 0x40) << 6); - *color = m_layer_colorbase[layer]; + *color = layer; } /*************************************************************************** diff --git a/src/mame/video/blockhl.c b/src/mame/video/blockhl.c deleted file mode 100644 index c64215f6b51..00000000000 --- a/src/mame/video/blockhl.c +++ /dev/null @@ -1,62 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nicola Salmoria -#include "emu.h" -#include "includes/blockhl.h" - - -/*************************************************************************** - - Callbacks for the K052109 - -***************************************************************************/ - -K052109_CB_MEMBER(blockhl_state::tile_callback) -{ - *code |= ((*color & 0x0f) << 8); - *color = m_layer_colorbase[layer] + ((*color & 0xe0) >> 5); -} - -/*************************************************************************** - - Callbacks for the K051960 - -***************************************************************************/ - -K051960_CB_MEMBER(blockhl_state::sprite_callback) -{ - if(*color & 0x10) - *priority = 0xfe; // under K052109_tilemap[0] - else - *priority = 0xfc; // under K052109_tilemap[1] - - *color = m_sprite_colorbase + (*color & 0x0f); -} - - -/*************************************************************************** - - Start the video hardware emulation. - -***************************************************************************/ - -void blockhl_state::video_start() -{ - m_layer_colorbase[0] = 0; - m_layer_colorbase[1] = 16; - m_layer_colorbase[2] = 32; - m_sprite_colorbase = 48; -} - -UINT32 blockhl_state::screen_update_blockhl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - screen.priority().fill(0, cliprect); - - m_k052109->tilemap_update(); - - m_k052109->tilemap_draw(screen, bitmap, cliprect, 2, TILEMAP_DRAW_OPAQUE, 0); // tile 2 - m_k052109->tilemap_draw(screen, bitmap, cliprect, 1, 0, 1); // tile 1 - m_k052109->tilemap_draw(screen, bitmap, cliprect, 0, 0, 2); // tile 0 - - m_k051960->k051960_sprites_draw(bitmap, cliprect, screen.priority(), 0, -1); - return 0; -} diff --git a/src/mame/video/bogeyman.c b/src/mame/video/bogeyman.c index 9b4e0ee2814..26df51ab078 100644 --- a/src/mame/video/bogeyman.c +++ b/src/mame/video/bogeyman.c @@ -62,12 +62,6 @@ WRITE8_MEMBER(bogeyman_state::colorram2_w) m_fg_tilemap->mark_tile_dirty(offset); } -WRITE8_MEMBER(bogeyman_state::paletteram_w) -{ - /* RGB output is inverted */ - m_palette->write(space, offset, UINT8(~data)); -} - TILE_GET_INFO_MEMBER(bogeyman_state::get_bg_tile_info) { int attr = m_colorram[tile_index]; diff --git a/src/mame/video/bottom9.c b/src/mame/video/bottom9.c index 45df8f6bd10..912e5e0c2bb 100644 --- a/src/mame/video/bottom9.c +++ b/src/mame/video/bottom9.c @@ -10,10 +10,12 @@ ***************************************************************************/ +static const int layer_colorbase[] = { 0 / 16, 0 / 16, 256 / 16 }; + K052109_CB_MEMBER(bottom9_state::tile_callback) { *code |= (*color & 0x3f) << 8; - *color = m_layer_colorbase[layer] + ((*color & 0xc0) >> 6); + *color = layer_colorbase[layer] + ((*color & 0xc0) >> 6); } @@ -25,10 +27,15 @@ K052109_CB_MEMBER(bottom9_state::tile_callback) K051960_CB_MEMBER(bottom9_state::sprite_callback) { + enum { sprite_colorbase = 512 / 16 }; + /* bit 4 = priority over zoom (0 = have priority) */ /* bit 5 = priority over B (1 = have priority) */ - *priority = (*color & 0x30) >> 4; - *color = m_sprite_colorbase + (*color & 0x0f); + *priority = 0; + if ( *color & 0x10) *priority |= GFX_PMASK_1; + if (~*color & 0x20) *priority |= GFX_PMASK_2; + + *color = sprite_colorbase + (*color & 0x0f); } @@ -40,29 +47,14 @@ K051960_CB_MEMBER(bottom9_state::sprite_callback) K051316_CB_MEMBER(bottom9_state::zoom_callback) { + enum { zoom_colorbase = 768 / 16 }; + *flags = (*color & 0x40) ? TILE_FLIPX : 0; *code |= ((*color & 0x03) << 8); - *color = m_zoom_colorbase + ((*color & 0x3c) >> 2); -} - - -/*************************************************************************** - - Start the video hardware emulation. - -***************************************************************************/ - -void bottom9_state::video_start() -{ - m_layer_colorbase[0] = 0; /* not used */ - m_layer_colorbase[1] = 0; - m_layer_colorbase[2] = 16; - m_sprite_colorbase = 32; - m_zoom_colorbase = 48; + *color = zoom_colorbase + ((*color & 0x3c) >> 2); } - /*************************************************************************** Display refresh @@ -74,16 +66,14 @@ UINT32 bottom9_state::screen_update_bottom9(screen_device &screen, bitmap_ind16 m_k052109->tilemap_update(); /* note: FIX layer is not used */ - bitmap.fill(m_layer_colorbase[1], cliprect); + bitmap.fill(layer_colorbase[1], cliprect); + screen.priority().fill(0, cliprect); + // if (m_video_enable) { - m_k051960->k051960_sprites_draw(bitmap, cliprect, screen.priority(), 1, 1); - m_k051316->zoom_draw(screen, bitmap, cliprect, 0, 0); - m_k051960->k051960_sprites_draw(bitmap, cliprect, screen.priority(), 0, 0); - m_k052109->tilemap_draw(screen, bitmap, cliprect, 2, 0, 0); - /* note that priority 3 is opposite to the basic layer priority! */ - /* (it IS used, but hopefully has no effect) */ - m_k051960->k051960_sprites_draw(bitmap, cliprect, screen.priority(), 2, 3); + m_k051316->zoom_draw(screen, bitmap, cliprect, 0, 1); + m_k052109->tilemap_draw(screen, bitmap, cliprect, 2, 0, 2); + m_k051960->k051960_sprites_draw(bitmap, cliprect, screen.priority(), -1, -1); m_k052109->tilemap_draw(screen, bitmap, cliprect, 1, 0, 0); } return 0; diff --git a/src/mame/video/btime.c b/src/mame/video/btime.c index 34abcb6046f..56c68dcd5d0 100644 --- a/src/mame/video/btime.c +++ b/src/mame/video/btime.c @@ -123,7 +123,6 @@ VIDEO_START_MEMBER(btime_state,disco) m_gfxdecode->gfx(1)->set_source(m_deco_charram); } - VIDEO_START_MEMBER(btime_state,bnj) { /* the background area is twice as wide as the screen */ @@ -134,14 +133,6 @@ VIDEO_START_MEMBER(btime_state,bnj) save_item(NAME(*m_background_bitmap)); } - -WRITE8_MEMBER(btime_state::btime_paletteram_w) -{ - m_paletteram[offset] = data; - /* RGB output is inverted */ - m_palette->write(space, offset, UINT8(~data)); -} - WRITE8_MEMBER(btime_state::lnc_videoram_w) { m_videoram[offset] = data; diff --git a/src/mame/video/chqflag.c b/src/mame/video/chqflag.c index 74c8e12f8f0..21b74bf5712 100644 --- a/src/mame/video/chqflag.c +++ b/src/mame/video/chqflag.c @@ -20,8 +20,10 @@ K051960_CB_MEMBER(chqflag_state::sprite_callback) { - *priority = (*color & 0x10) >> 4; - *color = m_sprite_colorbase + (*color & 0x0f); + enum { sprite_colorbase = 0 }; + + *priority = (*color & 0x10) ? 0 : GFX_PMASK_1; + *color = sprite_colorbase + (*color & 0x0f); } /*************************************************************************** @@ -32,28 +34,19 @@ K051960_CB_MEMBER(chqflag_state::sprite_callback) K051316_CB_MEMBER(chqflag_state::zoom_callback_1) { + enum { zoom_colorbase_1 = 256 / 16 }; + *code |= ((*color & 0x03) << 8); - *color = m_zoom_colorbase[0] + ((*color & 0x3c) >> 2); + *color = zoom_colorbase_1 + ((*color & 0x3c) >> 2); } K051316_CB_MEMBER(chqflag_state::zoom_callback_2) { + enum { zoom_colorbase_2 = 512 / 256 }; + *flags = TILE_FLIPYX((*color & 0xc0) >> 6); *code |= ((*color & 0x0f) << 8); - *color = m_zoom_colorbase[1] + ((*color & 0x10) >> 4); -} - -/*************************************************************************** - - Start the video hardware emulation. - -***************************************************************************/ - -void chqflag_state::video_start() -{ - m_sprite_colorbase = 0; - m_zoom_colorbase[0] = 0x10; - m_zoom_colorbase[1] = 0x02; + *color = zoom_colorbase_2 + ((*color & 0x10) >> 4); } /*************************************************************************** @@ -64,12 +57,11 @@ void chqflag_state::video_start() UINT32 chqflag_state::screen_update_chqflag(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - bitmap.fill(0, cliprect); + screen.priority().fill(0, cliprect); m_k051316_2->zoom_draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0); - m_k051960->k051960_sprites_draw(bitmap, cliprect, screen.priority(), 0, 0); - m_k051316_2->zoom_draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0); - m_k051960->k051960_sprites_draw(bitmap, cliprect, screen.priority(), 1, 1); + m_k051316_2->zoom_draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER0, 1); + m_k051960->k051960_sprites_draw(bitmap, cliprect, screen.priority(), -1, -1); m_k051316_1->zoom_draw(screen, bitmap, cliprect, 0, 0); return 0; } diff --git a/src/mame/video/crimfght.c b/src/mame/video/crimfght.c index 46806d7e076..8b37bb03313 100644 --- a/src/mame/video/crimfght.c +++ b/src/mame/video/crimfght.c @@ -13,7 +13,7 @@ K052109_CB_MEMBER(crimfght_state::tile_callback) { *flags = (*color & 0x20) ? TILE_FLIPX : 0; *code |= ((*color & 0x1f) << 8) | (bank << 13); - *color = m_layer_colorbase[layer] + ((*color & 0xc0) >> 6); + *color = layer * 4 + ((*color & 0xc0) >> 6); } /*************************************************************************** @@ -24,50 +24,29 @@ K052109_CB_MEMBER(crimfght_state::tile_callback) K051960_CB_MEMBER(crimfght_state::sprite_callback) { - /* Weird priority scheme. Why use three bits when two would suffice? */ + enum { sprite_colorbase = 256 / 16 }; + /* The PROM allows for mixed priorities, where sprites would have */ /* priority over text but not on one or both of the other two planes. */ - /* Luckily, this isn't used by the game. */ switch (*color & 0x70) { - case 0x10: *priority = 0; break; - case 0x00: *priority = 1; break; - case 0x40: *priority = 2; break; - case 0x20: *priority = 3; break; - /* 0x60 == 0x20 */ - /* 0x50 priority over F and A, but not over B */ - /* 0x30 priority over F, but not over A and B */ - /* 0x70 == 0x30 */ + case 0x10: *priority = 0x00; break; /* over ABF */ + case 0x00: *priority = GFX_PMASK_4 ; break; /* over AB, not F */ + case 0x40: *priority = GFX_PMASK_4|GFX_PMASK_2 ; break; /* over A, not BF */ + case 0x20: + case 0x60: *priority = GFX_PMASK_4|GFX_PMASK_2|GFX_PMASK_1; break; /* over -, not ABF */ + case 0x50: *priority = GFX_PMASK_2 ; break; /* over AF, not B */ + case 0x30: + case 0x70: *priority = GFX_PMASK_2|GFX_PMASK_1; break; /* over F, not AB */ } /* bit 7 is on in the "Game Over" sprites, meaning unknown */ /* in Aliens it is the top bit of the code, but that's not needed here */ - *color = m_sprite_colorbase + (*color & 0x0f); + *color = sprite_colorbase + (*color & 0x0f); } /*************************************************************************** - Start the video hardware emulation. - -***************************************************************************/ - -void crimfght_state::video_start() -{ - m_paletteram.resize(0x400); - m_palette->basemem().set(m_paletteram, ENDIANNESS_BIG, 2); - - m_layer_colorbase[0] = 0; - m_layer_colorbase[1] = 4; - m_layer_colorbase[2] = 8; - m_sprite_colorbase = 16; - - save_item(NAME(m_paletteram)); -} - - - -/*************************************************************************** - Display refresh ***************************************************************************/ @@ -76,11 +55,14 @@ UINT32 crimfght_state::screen_update_crimfght(screen_device &screen, bitmap_ind1 { m_k052109->tilemap_update(); + screen.priority().fill(0, cliprect); + /* The background color is always from layer 1 */ m_k052109->tilemap_draw(screen, bitmap, cliprect, 1, TILEMAP_DRAW_OPAQUE, 0); - m_k051960->k051960_sprites_draw(bitmap, cliprect, screen.priority(), 2, 2); - m_k052109->tilemap_draw(screen, bitmap, cliprect, 2, 0, 0); - m_k051960->k051960_sprites_draw(bitmap, cliprect, screen.priority(), 1, 1); - m_k052109->tilemap_draw(screen, bitmap, cliprect, 0, 0, 0); - m_k051960->k051960_sprites_draw(bitmap, cliprect, screen.priority(), 0, 0); + + m_k052109->tilemap_draw(screen, bitmap, cliprect, 1, 0, 1); + m_k052109->tilemap_draw(screen, bitmap, cliprect, 2, 0, 2); + m_k052109->tilemap_draw(screen, bitmap, cliprect, 0, 0, 4); + + m_k051960->k051960_sprites_draw(bitmap, cliprect, screen.priority(), -1, -1); return 0; } diff --git a/src/mame/video/deco16ic.c b/src/mame/video/deco16ic.c index 545e1a353f3..73aad4794fd 100644 --- a/src/mame/video/deco16ic.c +++ b/src/mame/video/deco16ic.c @@ -36,14 +36,15 @@ Pocket Gal DX MAZ 102 52,71 56 104 153 Boogie Wings MBD 102 52,52,71,71 141, 141 104 113,99,200 1 Double Wings MBE 102 52 141 104 - Fighter's History MBF 101 52,153 56,74 [Scratched] 200, 153, 170 - Heavy Smash MBG 156 52 141 153*3 - Night Slashers MBH 156 52,52,52,153,153,153 74, 141 104 99,200 - Locked N Loaded MBM 101 ? 74,74 146 113,186,187 +3 Fighter's History DE-0380-0 MBF 101 52,153,153 56, 74 [Scratched] 200,170 +3 Fighter's History DE-0396-0 MBF 101 52,153,153 74, 141 75 200 + Heavy Smash MBG 156 52,153*3 141 + Night Slashers MBH 156 52(*3),153(*3) 74, 141 104 99,200 + Locked N Loaded MBM 101 ? 74, 74 146 113,186,187 Joe & Mac Return MBN 156 52 141 223,223 2 Charlie Ninja MBR 156 52 141 223,223 World Cup Volleyball 95 MBX 156 52 141 ? - Backfire! MBZ 156 52,52,153,153 141,141 ? 223 + Backfire! MBZ 156 52,52,153,153 141, 141 ? 223 2* Ganbare Gonta MCB 156 52 141 223,223 Chain Reaction/Magical Drop MCC 156 52 141 223,223 Dunk Dream 95 MCE 156 [MLC] [MLC] @@ -57,6 +58,7 @@ Note 1: Mitchell game on DECO PCB board number DEC-22V0 (S-NK-3220) Note 2: Mitchell games on DECO PCB board number MT5601-0 +Note 3: Fighter's History was released on 3 different PCBs, DE-0396-0, DE-0395-1 & DE-0380-2 Note *: Ganbare! Gonta!! 2 / Lady Killer Part 2 - Party Time Custom chip 59 = 68000 cpu diff --git a/src/mame/video/dynduke.c b/src/mame/video/dynduke.c index fd727a55788..464903b9db4 100644 --- a/src/mame/video/dynduke.c +++ b/src/mame/video/dynduke.c @@ -7,13 +7,6 @@ /******************************************************************************/ -WRITE16_MEMBER(dynduke_state::paletteram_w) -{ - COMBINE_DATA(&m_generic_paletteram_16[offset]); - int color=m_generic_paletteram_16[offset]; - m_palette->set_pen_color(offset,pal4bit(color >> 0),pal4bit(color >> 4),pal4bit(color >> 8)); -} - WRITE16_MEMBER(dynduke_state::background_w) { COMBINE_DATA(&m_back_data[offset]); diff --git a/src/mame/video/galpanic.c b/src/mame/video/galpanic.c index 43cef8a51ee..487a22aeefb 100644 --- a/src/mame/video/galpanic.c +++ b/src/mame/video/galpanic.c @@ -21,8 +21,6 @@ PALETTE_INIT_MEMBER(galpanic_state,galpanic) palette.set_pen_color(i+1024,pal5bit(i >> 5),pal5bit(i >> 10),pal5bit(i >> 0)); } - - WRITE16_MEMBER(galpanic_state::galpanic_bgvideoram_w) { int sx,sy; @@ -36,15 +34,6 @@ WRITE16_MEMBER(galpanic_state::galpanic_bgvideoram_w) m_bitmap.pix16(sy, sx) = 1024 + (data >> 1); } -WRITE16_MEMBER(galpanic_state::galpanic_paletteram_w) -{ - data = COMBINE_DATA(&m_generic_paletteram_16[offset]); - /* bit 0 seems to be a transparency flag for the front bitmap */ - m_palette->set_pen_color(offset,pal5bit(data >> 6),pal5bit(data >> 11),pal5bit(data >> 1)); -} - - - void galpanic_state::draw_fgbitmap(bitmap_ind16 &bitmap, const rectangle &cliprect) { int offs; diff --git a/src/mame/video/gradius3.c b/src/mame/video/gradius3.c index 36f3e334bc5..2002afb39bc 100644 --- a/src/mame/video/gradius3.c +++ b/src/mame/video/gradius3.c @@ -4,9 +4,6 @@ #include "includes/gradius3.h" -#define TOTAL_CHARS 0x1000 -#define TOTAL_SPRITES 0x4000 - /*************************************************************************** Callbacks for the K052109 @@ -15,9 +12,11 @@ K052109_CB_MEMBER(gradius3_state::tile_callback) { + static const int layer_colorbase[] = { 0 / 16, 512 / 16, 768 / 16 }; + /* (color & 0x02) is flip y handled internally by the 052109 */ *code |= ((*color & 0x01) << 8) | ((*color & 0x1c) << 7); - *color = m_layer_colorbase[layer] + ((*color & 0xe0) >> 5); + *color = layer_colorbase[layer] + ((*color & 0xe0) >> 5); } /*************************************************************************** @@ -28,14 +27,19 @@ K052109_CB_MEMBER(gradius3_state::tile_callback) K051960_CB_MEMBER(gradius3_state::sprite_callback) { - #define L0 0xaa - #define L1 0xcc - #define L2 0xf0 + enum { sprite_colorbase = 256 / 16 }; + + #define L0 GFX_PMASK_1 + #define L1 GFX_PMASK_2 + #define L2 GFX_PMASK_4 static const int primask[2][4] = { { L0|L2, L0, L0|L2, L0|L1|L2 }, { L1|L2, L2, 0, L0|L1|L2 } }; + #undef L0 + #undef L1 + #undef L2 int pri = ((*color & 0x60) >> 5); @@ -45,7 +49,7 @@ K051960_CB_MEMBER(gradius3_state::sprite_callback) *priority = primask[1][pri]; *code |= (*color & 0x01) << 13; - *color = m_sprite_colorbase + ((*color & 0x1e) >> 1); + *color = sprite_colorbase + ((*color & 0x1e) >> 1); } /*************************************************************************** @@ -61,11 +65,6 @@ void gradius3_state::gradius3_postload() void gradius3_state::video_start() { - m_layer_colorbase[0] = 0; - m_layer_colorbase[1] = 32; - m_layer_colorbase[2] = 48; - m_sprite_colorbase = 16; - machine().save().register_postload(save_prepost_delegate(FUNC(gradius3_state::gradius3_postload), this)); } @@ -77,9 +76,7 @@ void gradius3_state::video_start() READ16_MEMBER(gradius3_state::gradius3_gfxrom_r) { - UINT8 *gfxdata = memregion("k051960")->base(); - - return (gfxdata[2 * offset + 1] << 8) | gfxdata[2 * offset]; + return (m_gfxrom[2 * offset + 1] << 8) | m_gfxrom[2 * offset]; } WRITE16_MEMBER(gradius3_state::gradius3_gfxram_w) diff --git a/src/mame/video/gtia.c b/src/mame/video/gtia.c index 59027e594af..2d9e0b08378 100644 --- a/src/mame/video/gtia.c +++ b/src/mame/video/gtia.c @@ -283,7 +283,7 @@ void gtia_device::device_reset() int gtia_device::is_ntsc() { - return ATTOSECONDS_TO_HZ(machine().first_screen()->frame_period().attoseconds) > 55; + return ATTOSECONDS_TO_HZ(machine().first_screen()->frame_period().attoseconds()) > 55; } void gtia_device::button_interrupt(int button_count, UINT8 button_port) diff --git a/src/mame/video/itech8.c b/src/mame/video/itech8.c index a96770f90c5..42a80eb9291 100644 --- a/src/mame/video/itech8.c +++ b/src/mame/video/itech8.c @@ -417,7 +417,6 @@ TIMER_CALLBACK_MEMBER(itech8_state::blitter_done) READ8_MEMBER(itech8_state::blitter_r) { int result = m_blitter_data[offset / 2]; - static const char *const portnames[] = { "AN_C", "AN_D", "AN_E", "AN_F" }; /* debugging */ if (FULL_LOGGING) logerror("%04x:blitter_r(%02x)\n", space.device().safe_pcbase(), offset / 2); @@ -437,7 +436,7 @@ READ8_MEMBER(itech8_state::blitter_r) /* a read from offsets 12-15 return input port values */ if (offset >= 12 && offset <= 15) - result = ioport(portnames[offset - 12])->read_safe(0x00); + result = m_an[offset - 12] ? m_an[offset - 12]->read() : 0; return result; } diff --git a/src/mame/video/jack.c b/src/mame/video/jack.c index dbc6aa8725d..2ea38483d75 100644 --- a/src/mame/video/jack.c +++ b/src/mame/video/jack.c @@ -25,12 +25,6 @@ WRITE8_MEMBER(jack_state::jack_colorram_w) m_bg_tilemap->mark_tile_dirty(offset); } -WRITE8_MEMBER(jack_state::jack_paletteram_w) -{ - /* RGB output is inverted */ - m_palette->write(space, offset, UINT8(~data)); -} - READ8_MEMBER(jack_state::jack_flipscreen_r) { flip_screen_set(offset); diff --git a/src/mame/video/k051960.c b/src/mame/video/k051960.c index a72ed132d86..96c1acb2faf 100644 --- a/src/mame/video/k051960.c +++ b/src/mame/video/k051960.c @@ -24,11 +24,12 @@ The 051960 can also genenrate IRQ, FIRQ and NMI signals. memory map: 000-007 is for the 051937, but also seen by the 051960 400-7ff is 051960 only -000 R bit 0 = unknown, looks like a status flag or something +000 R bit 0 = vblank? aliens waits for it to be 0 before starting to copy sprite data thndrx2 needs it to pulse for the startup checks to succeed -000 W bit 0 = irq enable/acknowledge? - bit 2 = nmi enable? +000 W bit 0 = irq acknowledge + bit 1 = firq acknowledge? + bit 2 = nmi enable/acknowledge bit 3 = flip screen (applies to sprites only, not tilemaps) bit 4 = unknown, used by Devastators, TMNT, Aliens, Chequered Flag, maybe others aliens sets it just after checking bit 0, and before copying @@ -128,12 +129,18 @@ k051960_device::k051960_device(const machine_config &mconfig, const char *tag, d : device_t(mconfig, K051960, "K051960 Sprite Generator", tag, owner, clock, "k051960", __FILE__), device_gfx_interface(mconfig, *this, gfxinfo), m_ram(NULL), + m_sprite_rom(NULL), + m_sprite_size(0), + m_screen_tag(NULL), + m_screen(NULL), + m_scanline_timer(NULL), + m_irq_handler(*this), + m_firq_handler(*this), + m_nmi_handler(*this), m_romoffset(0), m_spriteflip(0), m_readroms(0), - m_irq_enabled(0), - m_nmi_enabled(0), - m_k051937_counter(0) + m_nmi_enabled(0) { } @@ -161,11 +168,30 @@ void k051960_device::set_plane_order(device_t &device, int order) } //------------------------------------------------- +// set_screen_tag - set screen we are attached to +//------------------------------------------------- + +void k051960_device::set_screen_tag(device_t &device, device_t *owner, const char *tag) +{ + k051960_device &dev = dynamic_cast<k051960_device &>(device); + dev.m_screen_tag = tag; +} + +//------------------------------------------------- // device_start - device-specific startup //------------------------------------------------- void k051960_device::device_start() { + // make sure our screen is started + m_screen = m_owner->subdevice<screen_device>(m_screen_tag); + if (!m_screen->started()) + throw device_missing_dependencies(); + + // allocate scanline timer and start at first scanline + m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(k051960_device::scanline_callback), this)); + m_scanline_timer->adjust(m_screen->time_until_pos(0)); + m_sprite_rom = region()->base(); m_sprite_size = region()->bytes(); @@ -180,15 +206,18 @@ void k051960_device::device_start() // bind callbacks m_k051960_cb.bind_relative_to(*owner()); + // resolve callbacks + m_irq_handler.resolve_safe(); + m_firq_handler.resolve_safe(); + m_nmi_handler.resolve_safe(); + + // register for save states save_item(NAME(m_romoffset)); save_item(NAME(m_spriteflip)); save_item(NAME(m_readroms)); + save_item(NAME(m_nmi_enabled)); save_item(NAME(m_spriterombank)); save_pointer(NAME(m_ram), 0x400); - save_item(NAME(m_irq_enabled)); - save_item(NAME(m_nmi_enabled)); - - save_item(NAME(m_k051937_counter)); } //------------------------------------------------- @@ -197,12 +226,9 @@ void k051960_device::device_start() void k051960_device::device_reset() { - m_k051937_counter = 0; - m_romoffset = 0; m_spriteflip = 0; m_readroms = 0; - m_irq_enabled = 0; m_nmi_enabled = 0; m_spriterombank[0] = 0; @@ -215,6 +241,23 @@ void k051960_device::device_reset() DEVICE HANDLERS *****************************************************************************/ +TIMER_CALLBACK_MEMBER( k051960_device::scanline_callback ) +{ + // range 0..255 + UINT8 y = m_screen->vpos(); + + // 32v + if ((y % 32 == 0) && m_nmi_enabled) + m_nmi_handler(ASSERT_LINE); + + // vblank + if (y == 240) + m_irq_handler(ASSERT_LINE); + + // wait for next line + m_scanline_timer->adjust(m_screen->time_until_pos(y + 1)); +} + int k051960_device::k051960_fetchromdata( int byte ) { int code, color, pri, shadow, off1, addr; @@ -259,10 +302,9 @@ READ8_MEMBER( k051960_device::k051937_r ) if (m_readroms && offset >= 4 && offset < 8) return k051960_fetchromdata(offset & 3); else if (offset == 0) - /* some games need bit 0 to pulse */ - return (m_k051937_counter++) & 1; + return m_screen->vblank() ? 1 : 0; // vblank? - //logerror("%04x: read unknown 051937 address %x\n", device->cpu->safe_pc(), offset); + //logerror("%04x: read unknown 051937 address %x\n", space.device().safe_pc(), offset); return 0; } @@ -272,13 +314,13 @@ WRITE8_MEMBER( k051960_device::k051937_w ) { //if (data & 0xc2) popmessage("051937 reg 00 = %02x",data); - /* bit 0 is IRQ enable */ - m_irq_enabled = data & 0x01; - - /* bit 1: probably FIRQ enable */ + if (BIT(data, 0)) m_irq_handler(CLEAR_LINE); // bit 0, irq ack + if (BIT(data, 1)) m_firq_handler(CLEAR_LINE); // bit 1, firq ack? - /* bit 2 is NMI enable */ - m_nmi_enabled = data & 0x04; + // bit 2, nmi enable/ack + m_nmi_enabled = BIT(data, 2); + if (m_nmi_enabled) + m_nmi_handler(CLEAR_LINE); /* bit 3 = flip screen */ m_spriteflip = data & 0x08; @@ -287,12 +329,13 @@ WRITE8_MEMBER( k051960_device::k051937_w ) /* bit 5 = enable gfx ROM reading */ m_readroms = data & 0x20; - //logerror("%04x: write %02x to 051937 address %x\n", machine().cpu->safe_pc(), data, offset); + //logerror("%04x: write %02x to 051937 address %x\n", space.device().safe_pc(), data, offset); } else if (offset == 1) { -// popmessage("%04x: write %02x to 051937 address %x", machine().cpu->safe_pc(), data, offset); -//logerror("%04x: write %02x to unknown 051937 address %x\n", machine().cpu->safe_pc(), data, offset); + // unknown, Devastators writes 02 here in game + if (0) + logerror("%s: %02x to 051937 address %x\n", machine().describe_context(), data, offset); } else if (offset >= 2 && offset < 5) { @@ -300,21 +343,11 @@ WRITE8_MEMBER( k051960_device::k051937_w ) } else { - // popmessage("%04x: write %02x to 051937 address %x", machine().cpu->safe_pc(), data, offset); - //logerror("%04x: write %02x to unknown 051937 address %x\n", machine().cpu->safe_pc(), data, offset); + // popmessage("%04x: write %02x to 051937 address %x", space.device().safe_pc(), data, offset); + //logerror("%04x: write %02x to unknown 051937 address %x\n", space.device().safe_pc(), data, offset); } } -int k051960_device::k051960_is_irq_enabled( ) -{ - return m_irq_enabled; -} - -int k051960_device::k051960_is_nmi_enabled( ) -{ - return m_nmi_enabled; -} - /* * Sprite Format diff --git a/src/mame/video/k051960.h b/src/mame/video/k051960.h index 353974ed734..43c9a171856 100644 --- a/src/mame/video/k051960.h +++ b/src/mame/video/k051960.h @@ -21,6 +21,15 @@ typedef device_delegate<void (int *code, int *color, int *priority, int *shadow) #define MCFG_K051960_PLANEORDER(_order) \ k051960_device::set_plane_order(*device, _order); +#define MCFG_K051960_SCREEN_TAG(_tag) \ + k051960_device::set_screen_tag(*device, owner, _tag); + +#define MCFG_K051960_IRQ_HANDLER(_devcb) \ + devcb = &k051960_device::set_irq_handler(*device, DEVCB_##_devcb); + +#define MCFG_K051960_NMI_HANDLER(_devcb) \ + devcb = &k051960_device::set_nmi_handler(*device, DEVCB_##_devcb); + class k051960_device : public device_t, public device_gfx_interface @@ -36,9 +45,16 @@ public: k051960_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); ~k051960_device() {} + template<class _Object> static devcb_base &set_irq_handler(device_t &device, _Object object) + { return downcast<k051960_device &>(device).m_irq_handler.set_callback(object); } + + template<class _Object> static devcb_base &set_nmi_handler(device_t &device, _Object object) + { return downcast<k051960_device &>(device).m_nmi_handler.set_callback(object); } + // static configuration static void set_k051960_callback(device_t &device, k051960_cb_delegate callback) { downcast<k051960_device &>(device).m_k051960_cb = callback; } static void set_plane_order(device_t &device, int order); + static void set_screen_tag(device_t &device, device_t *owner, const char *tag); /* The callback is passed: @@ -61,13 +77,14 @@ public: DECLARE_WRITE8_MEMBER( k051937_w ); void k051960_sprites_draw(bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, int min_priority, int max_priority); - int k051960_is_irq_enabled(); - int k051960_is_nmi_enabled(); + + TIMER_CALLBACK_MEMBER(scanline_callback); protected: // device-level overrides virtual void device_start(); virtual void device_reset(); + private: // internal state UINT8 *m_ram; @@ -75,14 +92,20 @@ private: UINT8 *m_sprite_rom; UINT32 m_sprite_size; + const char *m_screen_tag; + screen_device *m_screen; + emu_timer *m_scanline_timer; + k051960_cb_delegate m_k051960_cb; + devcb_write_line m_irq_handler; + devcb_write_line m_firq_handler; + devcb_write_line m_nmi_handler; + UINT8 m_spriterombank[3]; int m_romoffset; int m_spriteflip, m_readroms; - int m_irq_enabled, m_nmi_enabled; - - int m_k051937_counter; + int m_nmi_enabled; int k051960_fetchromdata( int byte ); }; diff --git a/src/mame/video/k052109.c b/src/mame/video/k052109.c index 52ef33ecb65..ccffe5f2e89 100644 --- a/src/mame/video/k052109.c +++ b/src/mame/video/k052109.c @@ -179,7 +179,11 @@ k052109_device::k052109_device(const machine_config &mconfig, const char *tag, d m_romsubbank(0), m_scrollctrl(0), m_char_rom(NULL), - m_char_size(0) + m_char_size(0), + m_screen_tag(NULL), + m_irq_handler(*this), + m_firq_handler(*this), + m_nmi_handler(*this) { } @@ -201,11 +205,21 @@ void k052109_device::set_ram(device_t &device, bool ram) void k052109_device::device_start() { - memory_region *ROM = region(); - if (ROM != NULL) + if (m_screen_tag != NULL) { - m_char_rom = ROM->base(); - m_char_size = ROM->bytes(); + // make sure our screen is started + screen_device *screen = m_owner->subdevice<screen_device>(m_screen_tag); + if (!screen->started()) + throw device_missing_dependencies(); + + // and register a callback for vblank state + screen->register_vblank_callback(vblank_state_delegate(FUNC(k052109_device::vblank_callback), this)); + } + + if (region() != NULL) + { + m_char_rom = region()->base(); + m_char_size = region()->bytes(); } decode_gfx(); @@ -234,6 +248,11 @@ void k052109_device::device_start() // bind callbacks m_k052109_cb.bind_relative_to(*owner()); + // resolve callbacks + m_irq_handler.resolve_safe(); + m_firq_handler.resolve_safe(); + m_nmi_handler.resolve_safe(); + save_pointer(NAME(m_ram), 0x6000); save_item(NAME(m_rmrd_line)); save_item(NAME(m_romsubbank)); @@ -265,10 +284,27 @@ void k052109_device::device_reset() } } +//------------------------------------------------- +// set_screen_tag - set screen we are attached to +//------------------------------------------------- + +void k052109_device::set_screen_tag(device_t &device, device_t *owner, const char *tag) +{ + k052109_device &dev = dynamic_cast<k052109_device &>(device); + dev.m_screen_tag = tag; +} + + /***************************************************************************** DEVICE HANDLERS *****************************************************************************/ +void k052109_device::vblank_callback(screen_device &screen, bool state) +{ + if (state) + m_irq_handler(ASSERT_LINE); +} + READ8_MEMBER( k052109_device::read ) { if (m_rmrd_line == CLEAR_LINE) @@ -351,6 +387,8 @@ WRITE8_MEMBER( k052109_device::write ) /* bit 2 = irq enable */ /* the custom chip can also generate NMI and FIRQ, for use with a 6809 */ m_irq_enabled = data & 0x04; + if (m_irq_enabled) + m_irq_handler(CLEAR_LINE); } else if (offset == 0x1d80) { diff --git a/src/mame/video/k052109.h b/src/mame/video/k052109.h index 13f63b61359..5c62bdf1638 100644 --- a/src/mame/video/k052109.h +++ b/src/mame/video/k052109.h @@ -13,8 +13,14 @@ typedef device_delegate<void (int layer, int bank, int *code, int *color, int *f #define MCFG_K052109_CHARRAM(_ram) \ k052109_device::set_ram(*device, _ram); -class k052109_device : public device_t, - public device_gfx_interface +#define MCFG_K052109_SCREEN_TAG(_tag) \ + k052109_device::set_screen_tag(*device, owner, _tag); + +#define MCFG_K052109_IRQ_HANDLER(_devcb) \ + devcb = &k052109_device::set_irq_handler(*device, DEVCB_##_devcb); + + +class k052109_device : public device_t, public device_gfx_interface { static const gfx_layout charlayout; static const gfx_layout charlayout_ram; @@ -25,8 +31,12 @@ public: k052109_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); ~k052109_device() {} + template<class _Object> static devcb_base &set_irq_handler(device_t &device, _Object object) + { return downcast<k052109_device &>(device).m_irq_handler.set_callback(object); } + static void set_k052109_callback(device_t &device, k052109_cb_delegate callback) { downcast<k052109_device &>(device).m_k052109_cb = callback; } static void set_ram(device_t &device, bool ram); + static void set_screen_tag(device_t &device, device_t *owner, const char *tag); /* The callback is passed: @@ -57,10 +67,13 @@ public: void tilemap_mark_dirty(int tmap_num); void tilemap_draw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int tmap_num, UINT32 flags, UINT8 priority); + void vblank_callback(screen_device &screen, bool state); + protected: // device-level overrides virtual void device_start(); virtual void device_reset(); + private: // internal state UINT8 *m_ram; @@ -86,8 +99,14 @@ private: UINT8 *m_char_rom; UINT32 m_char_size; + const char *m_screen_tag; + k052109_cb_delegate m_k052109_cb; + devcb_write_line m_irq_handler; + devcb_write_line m_firq_handler; + devcb_write_line m_nmi_handler; + TILE_GET_INFO_MEMBER(get_tile_info0); TILE_GET_INFO_MEMBER(get_tile_info1); TILE_GET_INFO_MEMBER(get_tile_info2); diff --git a/src/mame/video/k057714.c b/src/mame/video/k057714.c new file mode 100644 index 00000000000..9473607aa30 --- /dev/null +++ b/src/mame/video/k057714.c @@ -0,0 +1,672 @@ +// license:BSD-3-Clause +// copyright-holders:Ville Linde + +// Konami 0000057714 "GCU" 2D Graphics Chip + +#include "emu.h" +#include "k057714.h" + + +#define DUMP_VRAM 0 +#define PRINT_GCU 0 + + +const device_type K057714 = &device_creator<k057714_device>; + +k057714_device::k057714_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, K057714, "K057714 GCU", tag, owner, clock, "k057714", __FILE__) +{ +} + +void k057714_device::device_start() +{ + m_cpu = machine().device(m_cputag); + + m_vram = auto_alloc_array(machine(), UINT32, 0x2000000/4); + memset(m_vram, 0, 0x2000000); +} + +void k057714_device::device_reset() +{ + m_vram_read_addr = 0; + m_command_fifo0_ptr = 0; + m_command_fifo1_ptr = 0; + m_vram_fifo0_addr = 0; + m_vram_fifo1_addr = 0; + + for (int i=0; i < 4; i++) + { + m_frame[i].base = 0; + m_frame[i].width = 0; + m_frame[i].height = 0; + } +} + +void k057714_device::device_stop() +{ +#if DUMP_VRAM + char filename[200]; + sprintf(filename, "%s_vram.bin", basetag()); + printf("dumping %s\n", filename); + FILE *file = fopen(filename, "wb"); + int i; + + for (i=0; i < 0x2000000/4; i++) + { + fputc((m_vram[i] >> 24) & 0xff, file); + fputc((m_vram[i] >> 16) & 0xff, file); + fputc((m_vram[i] >> 8) & 0xff, file); + fputc((m_vram[i] >> 0) & 0xff, file); + } + + fclose(file); +#endif +} + + +READ32_MEMBER(k057714_device::read) +{ + int reg = offset * 4; + + // VRAM Read + if (reg >= 0x80 && reg < 0x100) + { + return m_vram[m_vram_read_addr + offset - 0x20]; + } + + switch (reg) + { + case 0x78: // GCU Status + /* ppd checks bits 0x0041 of the upper halfword on interrupt */ + return 0xffff0005; + + default: + break; + } + + return 0xffffffff; +} + +WRITE32_MEMBER(k057714_device::write) +{ + int reg = offset * 4; + + switch (reg) + { + case 0x10: + /* IRQ clear/enable; ppd writes bit off then on in response to interrupt */ + /* it enables bits 0x41, but 0x01 seems to be the one it cares about */ + if (ACCESSING_BITS_16_31 && (data & 0x00010000) == 0) + m_cpu->execute().set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE); + if (ACCESSING_BITS_0_15) +#if PRINT_GCU + printf("%s_w: %02X, %08X, %08X\n", basetag(), reg, data, mem_mask); +#endif + break; + + case 0x14: // ? + break; + + case 0x18: // ? + break; + + case 0x20: // Framebuffer 0 Origin(?) + break; + + case 0x24: // Framebuffer 1 Origin(?) + break; + + case 0x28: // Framebuffer 2 Origin(?) + break; + + case 0x2c: // Framebuffer 3 Origin(?) + break; + + case 0x30: // Framebuffer 0 Dimensions + if (ACCESSING_BITS_16_31) + m_frame[0].height = (data >> 16) & 0xffff; + if (ACCESSING_BITS_0_15) + m_frame[0].width = data & 0xffff; + break; + + case 0x34: // Framebuffer 1 Dimensions + if (ACCESSING_BITS_16_31) + m_frame[1].height = (data >> 16) & 0xffff; + if (ACCESSING_BITS_0_15) + m_frame[1].width = data & 0xffff; + break; + + case 0x38: // Framebuffer 2 Dimensions + if (ACCESSING_BITS_16_31) + m_frame[2].height = (data >> 16) & 0xffff; + if (ACCESSING_BITS_0_15) + m_frame[2].width = data & 0xffff; + break; + + case 0x3c: // Framebuffer 3 Dimensions + if (ACCESSING_BITS_16_31) + m_frame[3].height = (data >> 16) & 0xffff; + if (ACCESSING_BITS_0_15) + m_frame[3].width = data & 0xffff; + break; + + case 0x40: // Framebuffer 0 Base + m_frame[0].base = data; +#if PRINT_GCU + printf("%s FB0 Base: %08X\n", basetag(), data); +#endif + break; + + case 0x44: // Framebuffer 1 Base + m_frame[1].base = data; +#if PRINT_GCU + printf("%s FB1 Base: %08X\n", basetag(), data); +#endif + break; + + case 0x48: // Framebuffer 2 Base + m_frame[2].base = data; +#if PRINT_GCU + printf("%s FB2 Base: %08X\n", basetag(), data); +#endif + break; + + case 0x4c: // Framebuffer 3 Base + m_frame[3].base = data; +#if PRINT_GCU + printf("%s FB3 Base: %08X\n", basetag(), data); +#endif + break; + + case 0x5c: // VRAM Read Address + m_vram_read_addr = (data & 0xffffff) / 2; + break; + + case 0x60: // VRAM Port 0 Write Address + m_vram_fifo0_addr = (data & 0xffffff) / 2; + break; + + case 0x68: // VRAM Port 0/1 Mode + if (ACCESSING_BITS_16_31) + m_vram_fifo0_mode = data >> 16; + if (ACCESSING_BITS_0_15) + m_vram_fifo1_mode = data & 0xffff; + break; + + case 0x70: // VRAM Port 0 Write FIFO + if (m_vram_fifo0_mode & 0x100) + { + // write to command fifo + m_command_fifo0[m_command_fifo0_ptr] = data; + m_command_fifo0_ptr++; + + // execute when filled + if (m_command_fifo0_ptr >= 4) + { + //printf("GCU FIFO0 exec: %08X %08X %08X %08X\n", m_command_fifo0[0], m_command_fifo0[1], m_command_fifo0[2], m_command_fifo0[3]); + execute_command(m_command_fifo0); + m_command_fifo0_ptr = 0; + } + } + else + { + // write to VRAM fifo + m_vram[m_vram_fifo0_addr] = data; + m_vram_fifo0_addr++; + } + break; + + case 0x64: // VRAM Port 1 Write Address + m_vram_fifo1_addr = (data & 0xffffff) / 2; + break; + + case 0x74: // VRAM Port 1 Write FIFO + if (m_vram_fifo1_mode & 0x100) + { + // write to command fifo + m_command_fifo1[m_command_fifo1_ptr] = data; + m_command_fifo1_ptr++; + + // execute when filled + if (m_command_fifo1_ptr >= 4) + { + //printf("GCU FIFO1 exec: %08X %08X %08X %08X\n", m_command_fifo1[0], m_command_fifo1[1], m_command_fifo1[2], m_command_fifo1[3]); + execute_command(m_command_fifo1); + m_command_fifo1_ptr = 0; + } + } + else + { + // write to VRAM fifo + m_vram[m_vram_fifo1_addr] = data; + m_vram_fifo1_addr++; + } + break; + + default: + //printf("%s_w: %02X, %08X, %08X\n", basetag(), reg, data, mem_mask); + break; + } +} + +int k057714_device::draw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + UINT16 *vram16 = (UINT16*)m_vram; + + int x = 0; + int y = 0; + int width = m_frame[0].width; + int height = m_frame[0].height; + + if (width != 0 && height != 0) + { + rectangle visarea = screen.visible_area(); + if ((visarea.max_x+1) != width || (visarea.max_y+1) != height) + { + visarea.max_x = width-1; + visarea.max_y = height-1; + screen.configure(width, height, visarea, screen.frame_period().attoseconds()); + } + } + + int fb_pitch = 1024; + + for (int j=0; j < height; j++) + { + UINT16 *d = &bitmap.pix16(j, x); + int li = ((j+y) * fb_pitch) + x; + UINT32 fbaddr0 = m_frame[0].base + li; + UINT32 fbaddr1 = m_frame[1].base + li; +// UINT32 fbaddr2 = m_frame[2].base + li; +// UINT32 fbaddr3 = m_frame[3].base + li; + + for (int i=0; i < width; i++) + { + UINT16 pix0 = vram16[fbaddr0 ^ NATIVE_ENDIAN_VALUE_LE_BE(1,0)]; + UINT16 pix1 = vram16[fbaddr1 ^ NATIVE_ENDIAN_VALUE_LE_BE(1,0)]; +// UINT16 pix2 = vram16[fbaddr2 ^ NATIVE_ENDIAN_VALUE_LE_BE(1,0)]; +// UINT16 pix3 = vram16[fbaddr3 ^ NATIVE_ENDIAN_VALUE_LE_BE(1,0)]; + + if (pix0 & 0x8000) + { + d[i] = pix0 & 0x7fff; + } + else + { + d[i] = pix1 & 0x7fff; + } + + fbaddr0++; + fbaddr1++; +// fbaddr2++; +// fbaddr3++; + } + } + + return 0; +} + +void k057714_device::draw_object(UINT32 *cmd) +{ + // 0x00: xxx----- -------- -------- -------- command (5) + // 0x00: ---x---- -------- -------- -------- 0: absolute coordinates + // 1: relative coordinates from framebuffer origin + // 0x00: ----xx-- -------- -------- -------- ? + // 0x00: -------- xxxxxxxx xxxxxxxx xxxxxxxx object data address in vram + + // 0x01: -------- -------- ------xx xxxxxxxx object x + // 0x01: -------- xxxxxxxx xxxxxx-- -------- object y + // 0x01: -----x-- -------- -------- -------- object x flip + // 0x01: ----x--- -------- -------- -------- object y flip + // 0x01: --xx---- -------- -------- -------- object alpha enable (different blend modes?) + // 0x01: -x------ -------- -------- -------- object transparency enable (?) + + // 0x02: -------- -------- ------xx xxxxxxxx object width + // 0x02: -------- -----xxx xxxxxx-- -------- object x scale + + // 0x03: -------- -------- ------xx xxxxxxxx object height + // 0x03: -------- -----xxx xxxxxx-- -------- object y scale + + int x = cmd[1] & 0x3ff; + int y = (cmd[1] >> 10) & 0x3fff; + int width = (cmd[2] & 0x3ff) + 1; + int height = (cmd[3] & 0x3ff) + 1; + int xscale = (cmd[2] >> 10) & 0x1ff; + int yscale = (cmd[3] >> 10) & 0x1ff; + bool xflip = (cmd[1] & 0x04000000) ? true : false; + bool yflip = (cmd[1] & 0x08000000) ? true : false; + bool alpha_enable = (cmd[1] & 0x30000000) ? true : false; + bool trans_enable = (cmd[1] & 0x40000000) ? true : false; + UINT32 address = cmd[0] & 0xffffff; + int alpha_level = (cmd[2] >> 27) & 0x1f; + bool relative_coords = (cmd[0] & 0x10000000) ? true : false; + + if (relative_coords) + { + x += m_fb_origin_x; + y += m_fb_origin_y; + } + + UINT16 *vram16 = (UINT16*)m_vram; + + if (xscale == 0 || yscale == 0) + { + return; + } + +#if PRINT_GCU + printf("%s Draw Object %08X, x %d, y %d, w %d, h %d [%08X %08X %08X %08X]\n", basetag(), address, x, y, width, height, cmd[0], cmd[1], cmd[2], cmd[3]); +#endif + + width = (((width * 65536) / xscale) * 64) / 65536; + height = (((height * 65536) / yscale) * 64) / 65536; + + int fb_pitch = 1024; + + int v = 0; + for (int j=0; j < height; j++) + { + int index; + int xinc; + UINT32 fbaddr = ((j+y) * fb_pitch) + x; + + if (yflip) + { + index = address + ((height - 1 - (v >> 6)) * 1024); + } + else + { + index = address + ((v >> 6) * 1024); + } + + if (xflip) + { + fbaddr += width; + xinc = -1; + } + else + { + xinc = 1; + } + + int u = 0; + for (int i=0; i < width; i++) + { + UINT16 pix = vram16[((index + (u >> 6)) ^ NATIVE_ENDIAN_VALUE_LE_BE(1,0)) & 0xffffff]; + bool draw = !trans_enable || (trans_enable && (pix & 0x8000)); + if (alpha_enable) + { + if (draw) + { + if ((pix & 0x7fff) != 0) + { + UINT16 srcpix = vram16[fbaddr ^ NATIVE_ENDIAN_VALUE_LE_BE(1,0)]; + + UINT32 sr = (srcpix >> 10) & 0x1f; + UINT32 sg = (srcpix >> 5) & 0x1f; + UINT32 sb = (srcpix >> 0) & 0x1f; + UINT32 r = (pix >> 10) & 0x1f; + UINT32 g = (pix >> 5) & 0x1f; + UINT32 b = (pix >> 0) & 0x1f; + + sr += (r * alpha_level) >> 4; + sg += (g * alpha_level) >> 4; + sb += (b * alpha_level) >> 4; + + if (sr > 0x1f) sr = 0x1f; + if (sg > 0x1f) sg = 0x1f; + if (sb > 0x1f) sb = 0x1f; + + vram16[fbaddr ^ NATIVE_ENDIAN_VALUE_LE_BE(1,0)] = (sr << 10) | (sg << 5) | sb | 0x8000; + } + } + } + else + { + if (draw) + { + vram16[fbaddr ^ NATIVE_ENDIAN_VALUE_LE_BE(1,0)] = pix | 0x8000; + } + } + + fbaddr += xinc; + u += xscale; + } + + v += yscale; + } +} + +void k057714_device::fill_rect(UINT32 *cmd) +{ + // 0x00: xxx----- -------- -------- -------- command (4) + // 0x00: ---x---- -------- -------- -------- 0: absolute coordinates + // 1: relative coordinates from framebuffer origin + // 0x00: ----xx-- -------- -------- -------- ? + // 0x00: -------- -------- ------xx xxxxxxxx width + // 0x00: -------- ----xxxx xxxxxx-- -------- height + + // 0x01: -------- -------- ------xx xxxxxxxx x + // 0x01: -------- xxxxxxxx xxxxxx-- -------- y + + // 0x02: xxxxxxxx xxxxxxxx -------- -------- fill pattern pixel 0 + // 0x02: -------- -------- xxxxxxxx xxxxxxxx fill pattern pixel 1 + + // 0x03: xxxxxxxx xxxxxxxx -------- -------- fill pattern pixel 2 + // 0x03: -------- -------- xxxxxxxx xxxxxxxx fill pattern pixel 3 + + int x = cmd[1] & 0x3ff; + int y = (cmd[1] >> 10) & 0x3fff; + int width = (cmd[0] & 0x3ff) + 1; + int height = ((cmd[0] >> 10) & 0x3ff) + 1; + bool relative_coords = (cmd[0] & 0x10000000) ? true : false; + + if (relative_coords) + { + x += m_fb_origin_x; + y += m_fb_origin_y; + } + + UINT16 color[4]; + color[0] = (cmd[2] >> 16); + color[1] = (cmd[2] & 0xffff); + color[2] = (cmd[3] >> 16); + color[3] = (cmd[3] & 0xffff); + +#if PRINT_GCU + printf("%s Fill Rect x %d, y %d, w %d, h %d, %08X %08X [%08X %08X %08X %08X]\n", basetag(), x, y, width, height, cmd[2], cmd[3], cmd[0], cmd[1], cmd[2], cmd[3]); +#endif + + int x1 = x; + int x2 = x + width; + int y1 = y; + int y2 = y + height; + + UINT16 *vram16 = (UINT16*)m_vram; + + int fb_pitch = 1024; + + for (int j=y1; j < y2; j++) + { + UINT32 fbaddr = j * fb_pitch; + for (int i=x1; i < x2; i++) + { + vram16[(fbaddr+i) ^ NATIVE_ENDIAN_VALUE_LE_BE(1,0)] = color[i&3]; + } + } +} + +void k057714_device::draw_character(UINT32 *cmd) +{ + // 0x00: xxx----- -------- -------- -------- command (7) + // 0x00: ---x---- -------- -------- -------- 0: absolute coordinates + // 1: relative coordinates from framebuffer base (unverified, should be same as other operations) + // 0x00: -------- xxxxxxxx xxxxxxxx xxxxxxxx character data address in vram + + // 0x01: -------- -------- ------xx xxxxxxxx character x + // 0x01: -------- ----xxxx xxxxxx-- -------- character y + // 0x01: -------x -------- -------- -------- double height + + // 0x02: xxxxxxxx xxxxxxxx -------- -------- color 0 + // 0x02: -------- -------- xxxxxxxx xxxxxxxx color 1 + + // 0x03: xxxxxxxx xxxxxxxx -------- -------- color 2 + // 0x03: -------- -------- xxxxxxxx xxxxxxxx color 3 + + int x = cmd[1] & 0x3ff; + int y = (cmd[1] >> 10) & 0x3ff; + UINT32 address = cmd[0] & 0xffffff; + UINT16 color[4]; + bool relative_coords = (cmd[0] & 0x10000000) ? true : false; + bool double_height = (cmd[1] & 0x01000000) ? true : false; + + if (relative_coords) + { + x += m_fb_origin_x; + y += m_fb_origin_y; + } + + color[0] = cmd[2] >> 16; + color[1] = cmd[2] & 0xffff; + color[2] = cmd[3] >> 16; + color[3] = cmd[3] & 0xffff; + +#if PRINT_GCU + printf("%s Draw Char %08X, x %d, y %d\n", basetag(), address, x, y); +#endif + + UINT16 *vram16 = (UINT16*)m_vram; + int fb_pitch = 1024; + int height = double_height ? 16 : 8; + + for (int j=0; j < height; j++) + { + UINT32 fbaddr = (y+j) * fb_pitch; + UINT16 line = vram16[address ^ NATIVE_ENDIAN_VALUE_LE_BE(1,0)]; + + address += 4; + + for (int i=0; i < 8; i++) + { + int p = (line >> ((7-i) * 2)) & 3; + vram16[(fbaddr+x+i) ^ NATIVE_ENDIAN_VALUE_LE_BE(1,0)] = color[p] | 0x8000; + } + } +} + +void k057714_device::fb_config(UINT32 *cmd) +{ + // 0x00: xxx----- -------- -------- -------- command (3) + + // 0x01: -------- -------- -------- -------- unused? + + // 0x02: -------- -------- ------xx xxxxxxxx Framebuffer Origin X + + // 0x03: -------- -------- --xxxxxx xxxxxxxx Framebuffer Origin Y + +#if PRINT_GCU + printf("%s FB Config %08X %08X %08X %08X\n", basetag(), cmd[0], cmd[1], cmd[2], cmd[3]); +#endif + + m_fb_origin_x = cmd[2] & 0x3ff; + m_fb_origin_y = cmd[3] & 0x3fff; +} + +void k057714_device::execute_display_list(UINT32 addr) +{ + bool end = false; + + int counter = 0; + +#if PRINT_GCU + printf("%s Exec Display List %08X\n", basetag(), addr); +#endif + + addr /= 2; + while (!end && counter < 0x1000 && addr < (0x2000000/4)) + { + UINT32 *cmd = &m_vram[addr]; + addr += 4; + + int command = (cmd[0] >> 29) & 0x7; + + switch (command) + { + case 0: // NOP? + break; + + case 1: // Execute display list + execute_display_list(cmd[0] & 0xffffff); + break; + + case 2: // End of display list + end = true; + break; + + case 3: // Framebuffer config + fb_config(cmd); + break; + + case 4: // Fill rectangle + fill_rect(cmd); + break; + + case 5: // Draw object + draw_object(cmd); + break; + + case 6: + case 7: // Draw 8x8 character (2 bits per pixel) + draw_character(cmd); + break; + + default: + printf("GCU Unknown command %08X %08X %08X %08X\n", cmd[0], cmd[1], cmd[2], cmd[3]); + break; + } + counter++; + }; +} + +void k057714_device::execute_command(UINT32* cmd) +{ + int command = (cmd[0] >> 29) & 0x7; + +#if PRINT_GCU + printf("%s Exec Command %08X, %08X, %08X, %08X\n", basetag(), cmd[0], cmd[1], cmd[2], cmd[3]); +#endif + + switch (command) + { + case 0: // NOP? + break; + + case 1: // Execute display list + execute_display_list(cmd[0] & 0xffffff); + break; + + case 2: // End of display list + break; + + case 3: // Framebuffer config + fb_config(cmd); + break; + + case 4: // Fill rectangle + fill_rect(cmd); + break; + + case 5: // Draw object + draw_object(cmd); + break; + + case 6: + case 7: // Draw 8x8 character (2 bits per pixel) + draw_character(cmd); + break; + + default: + printf("GCU Unknown command %08X %08X %08X %08X\n", cmd[0], cmd[1], cmd[2], cmd[3]); + break; + } +} diff --git a/src/mame/video/k057714.h b/src/mame/video/k057714.h new file mode 100644 index 00000000000..85671ffd5d8 --- /dev/null +++ b/src/mame/video/k057714.h @@ -0,0 +1,63 @@ +// license:BSD-3-Clause +// copyright-holders:Ville Linde + +#pragma once +#ifndef __K057714_H__ +#define __K057714_H__ + +class k057714_device : public device_t +{ +public: + k057714_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + static void static_set_cpu_tag(device_t &device, const char *tag) { downcast<k057714_device &>(device).m_cputag = tag; } + + int draw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + DECLARE_READ32_MEMBER(read); + DECLARE_WRITE32_MEMBER(write); + + struct framebuffer + { + UINT32 base; + int width; + int height; + }; + +protected: + virtual void device_start(); + virtual void device_stop(); + virtual void device_reset(); + +private: + void execute_command(UINT32 *cmd); + void execute_display_list(UINT32 addr); + void draw_object(UINT32 *cmd); + void fill_rect(UINT32 *cmd); + void draw_character(UINT32 *cmd); + void fb_config(UINT32 *cmd); + + UINT32 *m_vram; + UINT32 m_vram_read_addr; + UINT32 m_vram_fifo0_addr; + UINT32 m_vram_fifo1_addr; + UINT32 m_vram_fifo0_mode; + UINT32 m_vram_fifo1_mode; + UINT32 m_command_fifo0[4]; + UINT32 m_command_fifo0_ptr; + UINT32 m_command_fifo1[4]; + UINT32 m_command_fifo1_ptr; + + const char* m_cputag; + device_t* m_cpu; + + framebuffer m_frame[4]; + UINT32 m_fb_origin_x; + UINT32 m_fb_origin_y; +}; + +extern const device_type K057714; + +#define MCFG_K057714_CPU_TAG(_tag) \ + k057714_device::static_set_cpu_tag(*device, _tag); + +#endif diff --git a/src/mame/video/konamigx.c b/src/mame/video/konamigx.c index 2897a11a62a..f87156e3b01 100644 --- a/src/mame/video/konamigx.c +++ b/src/mame/video/konamigx.c @@ -1557,37 +1557,6 @@ UINT32 konamigx_state::screen_update_konamigx_right(screen_device &screen, bitma return 0; } - -WRITE32_MEMBER(konamigx_state::konamigx_palette_w) -{ - int r,g,b; - - COMBINE_DATA(&m_generic_paletteram_32[offset]); - - r = (m_generic_paletteram_32[offset] >>16) & 0xff; - g = (m_generic_paletteram_32[offset] >> 8) & 0xff; - b = (m_generic_paletteram_32[offset] >> 0) & 0xff; - - m_palette->set_pen_color(offset,rgb_t(r,g,b)); -} - -#ifdef UNUSED_FUNCTION -WRITE32_MEMBER(konamigx_state::konamigx_palette2_w) -{ - int r,g,b; - - COMBINE_DATA(&m_subpaletteram32[offset]); - - r = (m_subpaletteram32[offset] >>16) & 0xff; - g = (m_subpaletteram32[offset] >> 8) & 0xff; - b = (m_subpaletteram32[offset] >> 0) & 0xff; - - offset += (0x8000/4); - - m_palette->set_pen_color(offset,rgb_t(r,g,b)); -} -#endif - INLINE void set_color_555(palette_device &palette, pen_t color, int rshift, int gshift, int bshift, UINT16 data) { palette.set_pen_color(color, pal5bit(data >> rshift), pal5bit(data >> gshift), pal5bit(data >> bshift)); @@ -1620,7 +1589,6 @@ WRITE32_MEMBER(konamigx_state::konamigx_555_palette2_w) } #endif - WRITE32_MEMBER(konamigx_state::konamigx_tilebank_w) { if (ACCESSING_BITS_24_31) diff --git a/src/mame/video/lethalj.c b/src/mame/video/lethalj.c index d34a017623b..3fdc4027ede 100644 --- a/src/mame/video/lethalj.c +++ b/src/mame/video/lethalj.c @@ -24,13 +24,20 @@ inline void lethalj_state::get_crosshair_xy(int player, int *x, int *y) { - static const char *const gunnames[] = { "LIGHT0_X", "LIGHT0_Y", "LIGHT1_X", "LIGHT1_Y" }; const rectangle &visarea = m_screen->visible_area(); int width = visarea.width(); int height = visarea.height(); - *x = ((ioport(gunnames[player * 2])->read_safe(0x00) & 0xff) * width) / 255; - *y = ((ioport(gunnames[1 + player * 2])->read_safe(0x00) & 0xff) * height) / 255; + if (player) + { + *x = (((m_light1_x ? m_light1_x->read() : 0) & 0xff) * width) / 255; + *y = (((m_light1_y ? m_light1_y->read() : 0) & 0xff) * height) / 255; + } + else + { + *x = (((m_light0_x ? m_light0_x->read() : 0) & 0xff) * width) / 255; + *y = (((m_light0_y ? m_light0_y->read() : 0) & 0xff) * height) / 255; + } } diff --git a/src/mame/video/liberate.c b/src/mame/video/liberate.c index 0b49699cf2b..55011e47c58 100644 --- a/src/mame/video/liberate.c +++ b/src/mame/video/liberate.c @@ -243,14 +243,6 @@ VIDEO_START_MEMBER(liberate_state,prosport) /***************************************************************************/ -WRITE8_MEMBER(liberate_state::prosport_paletteram_w) -{ - m_paletteram[offset] = data; - - /* RGB output is inverted */ - m_palette->set_pen_color(offset, pal3bit(~data >> 0), pal3bit(~data >> 3), pal2bit(~data >> 6)); -} - PALETTE_INIT_MEMBER(liberate_state,liberate) { const UINT8 *color_prom = memregion("proms")->base(); diff --git a/src/mame/video/lwings.c b/src/mame/video/lwings.c index f29ccf4032e..8ecd4464152 100644 --- a/src/mame/video/lwings.c +++ b/src/mame/video/lwings.c @@ -95,14 +95,24 @@ VIDEO_START_MEMBER(lwings_state,trojan) m_bg1_tilemap->set_transmask(1, 0xf07f, 0x0f81); /* split type 1 has pens 7-11 opaque in front half */ m_bg2_avenger_hw = 0; + m_spr_avenger_hw = 0; } VIDEO_START_MEMBER(lwings_state,avengers) { VIDEO_START_CALL_MEMBER(trojan); m_bg2_avenger_hw = 1; + m_spr_avenger_hw = 1; } +VIDEO_START_MEMBER(lwings_state,avengersb) +{ + VIDEO_START_CALL_MEMBER(trojan); + m_bg2_avenger_hw = 0; + m_spr_avenger_hw = 1; +} + + /*************************************************************************** Memory handlers @@ -222,7 +232,7 @@ void lwings_state::trojan_draw_sprites( bitmap_ind16 &bitmap, const rectangle &c ((buffered_spriteram[offs + 1] & 0x80) << 3); color = (buffered_spriteram[offs + 1] & 0x0e) >> 1; - if (m_bg2_avenger_hw) + if (m_spr_avenger_hw) { flipx = 0; /* Avengers */ flipy = ~buffered_spriteram[offs + 1] & 0x10; diff --git a/src/mame/video/macrossp.c b/src/mame/video/macrossp.c index 39019fa6634..70ae597904c 100644 --- a/src/mame/video/macrossp.c +++ b/src/mame/video/macrossp.c @@ -1,10 +1,38 @@ // license:BSD-3-Clause -// copyright-holders:David Haywood +// copyright-holders:David Haywood,Paul Priest /* video/macrossp.c */ #include "emu.h" #include "includes/macrossp.h" +//#define DEBUG_KEYS 1 + +/* +Sprite list is drawn backwards, and priorities with backgrounds are not transitive + +=== Vid Registers === +[0] - tiles +0x000003ff - global scrollx +0x00000c00 - color mode +0x0000c000 - priority +0x03ff0000 - global scrolly +0x90000000 - enable? Always 0x9 + +[1] - ??? +0xffff0000 - another scrolly register, mainly used when zooming. unused by emulation +0x0000ffff - another scrollx register, mainly used when zooming. unused by emulation + +[2] - zoom params +0xf0000000 - zoom enable (== 0xe, not == 0x2). Presumably one bit for x and y enable +0x01ff0000 - incy (0x40 is 1:1, incx is in lineram. might be more bits) + +Interesting test cases (macrossp, quizmoon doesn't use tilemap zoom): +1) Title screen logo zoom +2) Second level, as zoom into end of canyon +3) Second level, as doors open to revels tracks/blue background for boss +4) Boss should go under bridge on level 4 when he first appears + +*/ /*** SCR A LAYER ***/ @@ -161,14 +189,15 @@ void macrossp_state::video_start() -void macrossp_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, int priority ) +void macrossp_state::draw_sprites(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect ) { gfx_element *gfx = m_gfxdecode->gfx(0); // UINT32 *source = m_spriteram; - UINT32 *source = m_spriteram_old2; /* buffers by two frames */ - UINT32 *finish = source + m_spriteram.bytes() / 4; + UINT32 *source = (m_spriteram_old2 + m_spriteram.bytes() / 4) - 3; /* buffers by two frames */ + UINT32 *finish = m_spriteram_old2; - while (source < finish) + /* reverse order */ + while (source >= finish) { /* @@ -204,109 +233,83 @@ void macrossp_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprec int xoffset, yoffset; int pri = (source[2] & 0x0c000000) >> 26; - - if (pri == priority) + int primask = 0; + if(pri <= 0) primask |= GFX_PMASK_1; + if(pri <= 1) primask |= GFX_PMASK_2; + if(pri <= 2) primask |= GFX_PMASK_4; + if(pri <= 3) primask |= GFX_PMASK_8; + + switch (source[0] & 0x0000c000) { - switch (source[0] & 0x0000c000) - { - case 0x00008000: - col = (source[2] & 0x00380000) >> 17; - break; - - case 0x00004000: - col = (source[2] & 0x00f80000) >> 19; - break; + case 0x00008000: + col = (source[2] & 0x00380000) >> 17; + break; - default: - col = machine().rand(); - break; - } + case 0x00004000: + col = (source[2] & 0x00f80000) >> 19; + break; + default: + col = machine().rand(); + break; + } - if (xpos > 0x1ff) xpos -=0x400; - if (ypos > 0x1ff) ypos -=0x400; + if (xpos > 0x1ff) xpos -=0x400; + if (ypos > 0x1ff) ypos -=0x400; + + /* loop params */ + int ymin = 0; + int ymax = high+1; + int yinc = 1; + int yoffst = 0; + if(flipy) { + yoffst = (high * yzoom * 16); + ymin = high; + ymax = -1; + yinc = -1; + } + + int xmin = 0; + int xmax = wide+1; + int xinc = 1; + int xoffst = 0; + if(flipx) { + xoffst = (wide * xzoom * 16); + xmin = wide; + xmax = -1; + xinc = -1; + } - if (!flipx) - { - if (!flipy) - { - /* noxflip, noyflip */ - yoffset = 0; /* I'm doing this so rounding errors are cumulative, still looks a touch crappy when multiple sprites used together */ - for (ycnt = 0; ycnt <= high; ycnt++) - { - xoffset = 0; - for (xcnt = 0; xcnt <= wide; xcnt++) - { - gfx->zoom_alpha(bitmap,cliprect,tileno+loopno,col,flipx,flipy,xpos+xoffset,ypos+yoffset,xzoom*0x100,yzoom*0x100,0,alpha); - - xoffset += ((xzoom*16 + (1<<7)) >> 8); - loopno++; - } - yoffset += ((yzoom*16 + (1<<7)) >> 8); - } - } - else - { - /* noxflip, flipy */ - yoffset = ((high * yzoom * 16) >> 8); - for (ycnt = high; ycnt >= 0; ycnt--) - { - xoffset = 0; - for (xcnt = 0; xcnt <= wide; xcnt++) - { - gfx->zoom_alpha(bitmap,cliprect,tileno+loopno,col,flipx,flipy,xpos+xoffset,ypos+yoffset,xzoom*0x100,yzoom*0x100,0,alpha); - - xoffset += ((xzoom * 16 + (1 << 7)) >> 8); - loopno++; - } - yoffset -= ((yzoom * 16 + (1 << 7)) >> 8); - } - } - } - else + yoffset = yoffst; + for (ycnt = ymin; ycnt != ymax; ycnt += yinc) + { + xoffset = xoffst; + for (xcnt = xmin; xcnt != xmax; xcnt += xinc) { - if (!flipy) - { - /* xflip, noyflip */ - yoffset = 0; - for (ycnt = 0; ycnt <= high; ycnt++) - { - xoffset = ((wide*xzoom*16) >> 8); - for (xcnt = wide; xcnt >= 0; xcnt--) - { - gfx->zoom_alpha(bitmap,cliprect,tileno+loopno,col,flipx,flipy,xpos+xoffset,ypos+yoffset,xzoom*0x100,yzoom*0x100,0,alpha); - - xoffset -= ((xzoom * 16 + (1 << 7)) >> 8); - loopno++; - } - yoffset += ((yzoom * 16 + (1 << 7)) >> 8); - } - } - else - { - /* xflip, yflip */ - yoffset = ((high * yzoom * 16) >> 8); - for (ycnt = high; ycnt >= 0; ycnt--) - { - xoffset = ((wide * xzoom * 16) >> 8); - for (xcnt = wide; xcnt >=0 ; xcnt--) - { - gfx->zoom_alpha(bitmap,cliprect,tileno+loopno,col,flipx,flipy,xpos+xoffset,ypos+yoffset,xzoom*0x100,yzoom*0x100,0,alpha); - - xoffset -= ((xzoom * 16 + (1 << 7)) >> 8); - loopno++; - } - yoffset -= ((yzoom * 16 + (1 << 7)) >> 8); - } - } + int fudged_xzoom = xzoom<<8; + int fudged_yzoom = yzoom<<8; + + /* cover seams as don't know exactly how many pixels on target will cover, and can't specify fractional offsets to start */ + if(xzoom < 0x100) fudged_xzoom += 0x600; + if(yzoom < 0x100) fudged_yzoom += 0x600; + + gfx->prio_zoom_alpha(bitmap,cliprect,tileno+loopno,col, + flipx,flipy,xpos+(xoffset>>8),ypos+(yoffset>>8), + fudged_xzoom,fudged_yzoom, + screen.priority(),primask,0,alpha); + + xoffset += ((xzoom*16) * xinc); + loopno++; } + yoffset += ((yzoom*16) * yinc); } - source += 3; + + source -= 3; } } -void macrossp_state::draw_layer( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int layer, int line ) +void macrossp_state::draw_layer( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int layer, int line, int pri ) { tilemap_t *tm; UINT32 *vr; @@ -336,112 +339,118 @@ void macrossp_state::draw_layer( screen_device &screen, bitmap_rgb32 &bitmap, co if ((vr[2] & 0xf0000000) == 0xe0000000) /* zoom enable (guess, surely wrong) */ { - int startx, starty, inc, linc; + int startx=0, starty=0, incy, incx; - startx = (vr[1] & 0x0000ffff) << 16; - starty = (vr[1] & 0xffff0000) >> 0; - inc = (vr[2] & 0x00ff0000) >> 6; + startx = ((vr[0] & 0x000003ff) << 16 ); + starty = ((vr[0] & 0x03ff0000) >> 0); + incy = (vr[2] & 0x01ff0000) >> 6; if (line&1) - linc = (lr[line/2] & 0x0000ffff)>>0; + incx = (lr[line/2] & 0x0000ffff)>>0; else - linc = (lr[line/2] & 0xffff0000)>>16; - + incx = (lr[line/2] & 0xffff0000)>>16; - linc <<= 10; + incx <<= 10; - /* WRONG! */ /* scroll register contain position relative to the center of the screen, so adjust */ - startx -= (368/2) * linc; - starty -= (240/2) * inc; + startx -= (368/2) * (incx - 0x10000); + starty -= (240/2) * (incy - 0x10000); + +// previous logic, which gives mostly comparable results, vr[1] is now unused +// startx = (vr[1] & 0x0000ffff) << 16; +// starty = (vr[1] & 0xffff0000) >> 0; +// startx -= (368/2) * incx; +// starty -= (240/2) * incy; tm->draw_roz(screen, bitmap, cliprect, - startx,starty,linc,0,0,inc, + startx,starty,incx,0,0,incy, 1, /* wraparound */ - 0,0); + 0, 1<<pri); } else { tm->set_scrollx(0, ((vr[0] & 0x000003ff) >> 0 ) ); tm->set_scrolly(0, ((vr[0] & 0x03ff0000) >> 16) ); - tm->draw(screen, bitmap, cliprect, 0, 0); - } -} - -/* useful function to sort the three tile layers by priority order */ -void macrossp_state::sortlayers(int *layer,int *pri) -{ -#define SWAP(a,b) \ - if (pri[a] >= pri[b]) \ - { \ - int t; \ - t = pri[a]; pri[a] = pri[b]; pri[b] = t; \ - t = layer[a]; layer[a] = layer[b]; layer[b] = t; \ + tm->draw(screen, bitmap, cliprect, 0, 1<<pri); } - - SWAP(0,1) - SWAP(0,2) - SWAP(1,2) } UINT32 macrossp_state::screen_update_macrossp(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int layers[3],layerpri[3]; + int layerpri[3]; + int sprites = true; + int backgrounds = true; - bitmap.fill(m_palette->black_pen(), cliprect); + rectangle clip; + const rectangle &visarea = screen.visible_area(); + clip = visarea; - layers[0] = 0; + /* 0 <= layerpri <= 2 */ layerpri[0] = (m_scra_videoregs[0] & 0x0000c000) >> 14; - layers[1] = 1; layerpri[1] = (m_scrb_videoregs[0] & 0x0000c000) >> 14; - layers[2] = 2; layerpri[2] = (m_scrc_videoregs[0] & 0x0000c000) >> 14; - sortlayers(layers, layerpri); - - rectangle clip; - const rectangle &visarea = screen.visible_area(); - clip = visarea; + screen.priority().fill(0, cliprect); + bitmap.fill(m_palette->black_pen(), cliprect); - for (int y=0;y<240;y++) +#ifdef DEBUG_KEYS + const input_code lay_keys[8] = {KEYCODE_Q, KEYCODE_W, KEYCODE_E, KEYCODE_R, KEYCODE_T}; + bool lay_debug = false; + for (int pri = 0; pri <= 4; pri++) { - clip.min_y = clip.max_y = y; - draw_layer(screen, bitmap, clip, layers[0], y); + if(machine().input().code_pressed(lay_keys[pri])) { + lay_debug = true; + } } - - draw_sprites(bitmap, cliprect, 0); - - for (int y=0;y<240;y++) - { - clip.min_y = clip.max_y = y; - draw_layer(screen, bitmap, clip, layers[1], y); + if(machine().input().code_pressed(KEYCODE_G)) { + sprites = false; } + if(machine().input().code_pressed(KEYCODE_H)) { + backgrounds = false; + } +#endif + for(int pri = 0; pri <= 3; pri++) { +#ifdef DEBUG_KEYS + if(lay_debug && !machine().input().code_pressed(lay_keys[pri])) + continue; +#endif + + if(!backgrounds) + continue; + + for (int y=0; y<240; y++) { + clip.min_y = clip.max_y = y; + + /* quizmoon map requires that layer 2 be drawn over layer 3 when same pri */ + for(int layer = 2; layer >= 0; layer--) { + if(layerpri[layer] == pri) { + draw_layer(screen, bitmap, clip, layer, y, pri); + } + } + } - draw_sprites(bitmap, cliprect, 1); - - for (int y=0;y<240;y++) - { - clip.min_y = clip.max_y = y; - draw_layer(screen, bitmap, clip, layers[2], y); } +#ifdef DEBUG_KEYS + if(!lay_debug && !machine().input().code_pressed(lay_keys[4])) +#endif + m_text_tilemap->draw(screen, bitmap, cliprect, 0, 8); - draw_sprites(bitmap, cliprect, 2); - draw_sprites(bitmap, cliprect, 3); - m_text_tilemap->draw(screen, bitmap, cliprect, 0, 0); + if(sprites) draw_sprites(screen, bitmap, cliprect); + #if 0 popmessage ("scra - %08x %08x %08x\nscrb - %08x %08x %08x\nscrc - %08x %08x %08x", -m_scra_videoregs[0]&0xffff33ff, // yyyyxxxx +m_scra_videoregs[0]&0xffffffff, // yyyyxxxx m_scra_videoregs[1], // ??? more scrolling? m_scra_videoregs[2], // 08 - 0b -m_scrb_videoregs[0]&0xffff33ff, // 00 - 03 +m_scrb_videoregs[0]&0xffffffff, // 00 - 03 m_scrb_videoregs[1], // 04 - 07 m_scrb_videoregs[2], // 08 - 0b -m_scrc_videoregs[0]&0xffff33ff, // 00 - 03 +m_scrc_videoregs[0]&0xffffffff, // 00 - 03 m_scrc_videoregs[1], // 04 - 07 m_scrc_videoregs[2]);// 08 - 0b #endif diff --git a/src/mame/video/mainevt.c b/src/mame/video/mainevt.c index b8fc5bb2287..8f177009ca2 100644 --- a/src/mame/video/mainevt.c +++ b/src/mame/video/mainevt.c @@ -19,19 +19,23 @@ K052109_CB_MEMBER(mainevt_state::mainevt_tile_callback) { + static const int layer_colorbase[] = { 0 / 16, 128 / 16, 64 / 16 }; + *flags = (*color & 0x02) ? TILE_FLIPX : 0; /* priority relative to HALF priority sprites */ *priority = (layer == 2) ? (*color & 0x20) >> 5 : 0; *code |= ((*color & 0x01) << 8) | ((*color & 0x1c) << 7); - *color = m_layer_colorbase[layer] + ((*color & 0xc0) >> 6); + *color = layer_colorbase[layer] + ((*color & 0xc0) >> 6); } K052109_CB_MEMBER(mainevt_state::dv_tile_callback) { + static const int layer_colorbase[] = { 0 / 16, 0 / 16, 64 / 16 }; + /* (color & 0x02) is flip y handled internally by the 052109 */ *code |= ((*color & 0x01) << 8) | ((*color & 0x3c) << 7); - *color = m_layer_colorbase[layer] + ((*color & 0xc0) >> 6); + *color = layer_colorbase[layer] + ((*color & 0xc0) >> 6); } @@ -43,6 +47,8 @@ K052109_CB_MEMBER(mainevt_state::dv_tile_callback) K051960_CB_MEMBER(mainevt_state::mainevt_sprite_callback) { + enum { sprite_colorbase = 192 / 16 }; + /* bit 5 = priority over layer B (has precedence) */ /* bit 6 = HALF priority over layer B (used for crowd when you get out of the ring) */ if (*color & 0x20) @@ -53,33 +59,17 @@ K051960_CB_MEMBER(mainevt_state::mainevt_sprite_callback) *priority = 0xff00 | 0xf0f0 | 0xcccc; /* bit 7 is shadow, not used */ - *color = m_sprite_colorbase + (*color & 0x03); + *color = sprite_colorbase + (*color & 0x03); } K051960_CB_MEMBER(mainevt_state::dv_sprite_callback) { - /* TODO: the priority/shadow handling (bits 5-7) seems to be quite complex (see PROM) */ - *color = m_sprite_colorbase + (*color & 0x07); -} - + enum { sprite_colorbase = 128 / 16 }; -/*****************************************************************************/ - -VIDEO_START_MEMBER(mainevt_state,mainevt) -{ - m_layer_colorbase[0] = 0; - m_layer_colorbase[1] = 8; - m_layer_colorbase[2] = 4; - m_sprite_colorbase = 12; + /* TODO: the priority/shadow handling (bits 5-7) seems to be quite complex (see PROM) */ + *color = sprite_colorbase + (*color & 0x07); } -VIDEO_START_MEMBER(mainevt_state,dv) -{ - m_layer_colorbase[0] = 0; - m_layer_colorbase[1] = 0; - m_layer_colorbase[2] = 4; - m_sprite_colorbase = 8; -} /*****************************************************************************/ diff --git a/src/mame/video/mcd212.c b/src/mame/video/mcd212.c index 7ae7051916e..d67930c08f1 100644 --- a/src/mame/video/mcd212.c +++ b/src/mame/video/mcd212.c @@ -518,7 +518,7 @@ void mcd212_device::update_visible_area() { const rectangle &visarea = m_screen->visible_area(); rectangle visarea1; - attoseconds_t period = m_screen->frame_period().attoseconds; + attoseconds_t period = m_screen->frame_period().attoseconds(); int width = 0; if((m_channel[0].dcr & (MCD212_DCR_CF | MCD212_DCR_FD)) && (m_channel[0].csrw & MCD212_CSR1W_ST)) diff --git a/src/mame/video/mcr68.c b/src/mame/video/mcr68.c index a84ea4dd29b..983f01205f1 100644 --- a/src/mame/video/mcr68.c +++ b/src/mame/video/mcr68.c @@ -133,33 +133,6 @@ VIDEO_START_MEMBER(mcr68_state,zwackery) /************************************* * - * Palette RAM writes - * - *************************************/ - -WRITE16_MEMBER(mcr68_state::mcr68_paletteram_w) -{ - int newword; - - COMBINE_DATA(&m_generic_paletteram_16[offset]); - newword = m_generic_paletteram_16[offset]; - m_palette->set_pen_color(offset, pal3bit(newword >> 6), pal3bit(newword >> 0), pal3bit(newword >> 3)); -} - - -WRITE16_MEMBER(mcr68_state::zwackery_paletteram_w) -{ - int newword; - - COMBINE_DATA(&m_generic_paletteram_16[offset]); - newword = m_generic_paletteram_16[offset]; - m_palette->set_pen_color(offset, pal5bit(~newword >> 10), pal5bit(~newword >> 0), pal5bit(~newword >> 5)); -} - - - -/************************************* - * * Video RAM writes * *************************************/ diff --git a/src/mame/video/micro3d.c b/src/mame/video/micro3d.c index 256624092b9..e34a29897a7 100644 --- a/src/mame/video/micro3d.c +++ b/src/mame/video/micro3d.c @@ -103,15 +103,6 @@ TMS340X0_SCANLINE_IND16_CB_MEMBER(micro3d_state::scanline_update) } } -WRITE16_MEMBER(micro3d_state::micro3d_clut_w) -{ - UINT16 word; - - COMBINE_DATA(&m_generic_paletteram_16[offset]); - word = m_generic_paletteram_16[offset]; - m_palette->set_pen_color(offset, pal5bit(word >> 6), pal5bit(word >> 1), pal5bit(word >> 11)); -} - WRITE16_MEMBER(micro3d_state::micro3d_creg_w) { if (~data & 0x80) diff --git a/src/mame/video/midtunit.c b/src/mame/video/midtunit.c index bc8f35d6f91..8495d9fd5b3 100644 --- a/src/mame/video/midtunit.c +++ b/src/mame/video/midtunit.c @@ -296,26 +296,16 @@ READ16_MEMBER(midtunit_state::midwunit_control_r) * *************************************/ -WRITE16_MEMBER(midtunit_state::midtunit_paletteram_w) -{ - //int newword; - - COMBINE_DATA(&m_generic_paletteram_16[offset]); - //newword = m_generic_paletteram_16[offset]; - m_palette->set_pen_color(offset, pal5bit(data >> 10), pal5bit(data >> 5), pal5bit(data >> 0)); -} - - WRITE16_MEMBER(midtunit_state::midxunit_paletteram_w) { if (!(offset & 1)) - midtunit_paletteram_w(space, offset / 2, data, mem_mask); + m_palette->write(space, offset / 2, data, mem_mask); } READ16_MEMBER(midtunit_state::midxunit_paletteram_r) { - return m_generic_paletteram_16[offset / 2]; + return m_palette->read(space, offset / 2, mem_mask); } diff --git a/src/mame/video/midzeus.c b/src/mame/video/midzeus.c index f3694d1e23e..8afd287ec7a 100644 --- a/src/mame/video/midzeus.c +++ b/src/mame/video/midzeus.c @@ -27,6 +27,10 @@ #define WAVERAM1_WIDTH 512 #define WAVERAM1_HEIGHT 512 +#define BLEND_OPAQUE 0x00000000 +#define BLEND_OPAQUE2 0x4b23cb00 +#define BLEND_ADD 0x40b68800 +#define BLEND_SUB 0x4093c800 /************************************* @@ -46,6 +50,8 @@ struct mz_poly_extra_data UINT16 texwidth; UINT16 color; UINT32 alpha; + bool blend_enable; + UINT32 blend; UINT8 (*get_texel)(const void *, int, int, int); }; @@ -77,7 +83,6 @@ static int texel_width; static int is_mk4b; - /************************************* * * Function prototypes @@ -1253,6 +1258,8 @@ void midzeus_state::zeus_draw_quad(int long_fmt, const UINT32 *databuffer, UINT3 extra->solidcolor = m_zeusbase[0x00] & 0x7fff; extra->zoffset = m_zeusbase[0x7e] >> 16; extra->alpha = m_zeusbase[0x4e]; + extra->blend = m_zeusbase[0x5c]; + extra->blend_enable = m_zeusbase[0x5c] == BLEND_ADD || m_zeusbase[0x5c] == BLEND_SUB; extra->transcolor = ((ctrl_word >> 16) & 1) ? 0 : 0x100; extra->palbase = waveram0_ptr_from_block_addr(zeus_palbase); @@ -1310,7 +1317,42 @@ static void render_poly_texture(void *dest, INT32 scanline, const poly_extent *e color2 = ((color2 & 0x7fe0) << 6) | (color2 & 0x1f); color3 = ((color3 & 0x7fe0) << 6) | (color3 & 0x1f); rgb_t filtered = rgbaint_t::bilinear_filter(color0, color1, color2, color3, curu, curv); - WAVERAM_WRITEPIX(zeus_renderbase, scanline, x, ((filtered >> 6) & 0x7fe0) | (filtered & 0x1f)); + + if (extra->blend_enable) + { + UINT16 dst = WAVERAM_READPIX(zeus_renderbase, scanline, x); + INT32 dst_r = (dst >> 10) & 0x1f; + INT32 dst_g = (dst >> 5) & 0x1f; + INT32 dst_b = dst & 0x1f; + + INT32 src_r = filtered.r(); + INT32 src_g = filtered.g() >> 3; + INT32 src_b = filtered.b(); + + if (extra->blend == BLEND_ADD) + { + dst_r += src_r; + dst_g += src_g; + dst_b += src_b; + dst_r = ((dst_r > 0x1f) ? 0x1f : dst_r); + dst_g = ((dst_g > 0x1f) ? 0x1f : dst_g); + dst_b = ((dst_b > 0x1f) ? 0x1f : dst_b); + } + else if (extra->blend == BLEND_SUB) + { + dst_r -= src_r; + dst_g -= src_g; + dst_b -= src_b; + dst_r = ((dst_r < 0) ? 0 : dst_r); + dst_g = ((dst_g < 0) ? 0 : dst_g); + dst_b = ((dst_b < 0) ? 0 : dst_b); + } + WAVERAM_WRITEPIX(zeus_renderbase, scanline, x, (dst_r << 10) | (dst_g << 5) | dst_b); + } + else + { + WAVERAM_WRITEPIX(zeus_renderbase, scanline, x, ((filtered >> 6) & 0x7fe0) | (filtered & 0x1f)); + } *depthptr = depth; } } diff --git a/src/mame/video/midzeus2.c b/src/mame/video/midzeus2.c index db96c9bf8e4..c7f8300c3af 100644 --- a/src/mame/video/midzeus2.c +++ b/src/mame/video/midzeus2.c @@ -749,6 +749,18 @@ if (subregdata_count[which] < 256) zeus_unknown_40 = value & 0xffffff; zeus_quad_size = (zeus_unknown_40 == 0) ? 10 : 14; break; + +#if 0 + case 0x0c: + case 0x0d: + // These seem to have something to do with blending. + // There are fairly unique 0x0C,0x0D pairs for various things: + // Car reflection on initial screen: 0x40, 0x00 + // Additively-blended "flares": 0xFA, 0xFF + // Car windshields (and drivers, apparently): 0x82, 0x7D + // Other minor things: 0xA4, 0x100 + break; +#endif } } diff --git a/src/mame/video/nova2001.c b/src/mame/video/nova2001.c index 740b0127294..e5366891b2f 100644 --- a/src/mame/video/nova2001.c +++ b/src/mame/video/nova2001.c @@ -50,6 +50,16 @@ PALETTE_INIT_MEMBER(nova2001_state,nova2001) } } +PALETTE_DECODER_MEMBER( nova2001_state, BBGGRRII ) +{ + UINT8 i = raw & 3; + UINT8 r = (raw >> 0) & 0x0c; + UINT8 g = (raw >> 2) & 0x0c; + UINT8 b = (raw >> 4) & 0x0c; + + return rgb_t(pal4bit(r | i), pal4bit(g | i), pal4bit(b | i)); +} + WRITE8_MEMBER(nova2001_state::ninjakun_paletteram_w) { int i; diff --git a/src/mame/video/powervr2.c b/src/mame/video/powervr2.c index 95638a3681d..328f5fdc3c7 100644 --- a/src/mame/video/powervr2.c +++ b/src/mame/video/powervr2.c @@ -3467,7 +3467,7 @@ UINT32 powervr2_device::screen_update(screen_device &screen, bitmap_rgb32 &bitma pvr_drawframebuffer(bitmap, cliprect); // update this here so we only do string lookup once per frame - debug_dip_status = ioport(":MAMEDEBUG")->read(); + debug_dip_status = m_mamedebug->read(); return 0; } @@ -3603,7 +3603,8 @@ void powervr2_device::pvr_dma_execute(address_space &space) powervr2_device::powervr2_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, POWERVR2, "PowerVR 2", tag, owner, clock, "powervr2", __FILE__), device_video_interface(mconfig, *this), - irq_cb(*this) + irq_cb(*this), + m_mamedebug(*this, ":MAMEDEBUG") { } diff --git a/src/mame/video/powervr2.h b/src/mame/video/powervr2.h index deea328c858..65d68f7864e 100644 --- a/src/mame/video/powervr2.h +++ b/src/mame/video/powervr2.h @@ -285,6 +285,7 @@ protected: private: devcb_write8 irq_cb; + required_ioport m_mamedebug; // Core registers UINT32 softreset; diff --git a/src/mame/video/rockrage.c b/src/mame/video/rockrage.c index 394cb79da6b..8e32ecfa0b4 100644 --- a/src/mame/video/rockrage.c +++ b/src/mame/video/rockrage.c @@ -30,7 +30,7 @@ K007342_CALLBACK_MEMBER(rockrage_state::rockrage_tile_callback) *code |= ((*color & 0x40) << 2) | ((bank & 0x01) << 9); else *code |= ((*color & 0x40) << 2) | ((bank & 0x03) << 10) | ((m_vreg & 0x04) << 7) | ((m_vreg & 0x08) << 9); - *color = m_layer_colorbase[layer] + (*color & 0x0f); + *color = layer * 16 + (*color & 0x0f); } /*************************************************************************** diff --git a/src/mame/video/rollerg.c b/src/mame/video/rollerg.c index 473ff87b3f3..016cf298c96 100644 --- a/src/mame/video/rollerg.c +++ b/src/mame/video/rollerg.c @@ -11,6 +11,7 @@ K05324X_CB_MEMBER(rollerg_state::sprite_callback) { + enum { sprite_colorbase = 256 / 16 }; #if 0 if (machine().input().code_pressed(KEYCODE_Q) && (*color & 0x80)) *color = rand(); if (machine().input().code_pressed(KEYCODE_W) && (*color & 0x40)) *color = rand(); @@ -18,7 +19,7 @@ K05324X_CB_MEMBER(rollerg_state::sprite_callback) if (machine().input().code_pressed(KEYCODE_R) && (*color & 0x10)) *color = rand(); #endif *priority = (*color & 0x10) ? 0 : 0x02; - *color = m_sprite_colorbase + (*color & 0x0f); + *color = sprite_colorbase + (*color & 0x0f); } @@ -32,20 +33,7 @@ K051316_CB_MEMBER(rollerg_state::zoom_callback) { *flags = TILE_FLIPYX((*color & 0xc0) >> 6); *code |= ((*color & 0x0f) << 8); - *color = m_zoom_colorbase + ((*color & 0x30) >> 4); -} - - -/*************************************************************************** - - Start the video hardware emulation. - -***************************************************************************/ - -void rollerg_state::video_start() -{ - m_sprite_colorbase = 16; - m_zoom_colorbase = 0; + *color = ((*color & 0x30) >> 4); } diff --git a/src/mame/video/senjyo.c b/src/mame/video/senjyo.c index 3356d7efe01..dfccfbdd7b1 100644 --- a/src/mame/video/senjyo.c +++ b/src/mame/video/senjyo.c @@ -108,6 +108,22 @@ void senjyo_state::video_start() m_fg_tilemap->set_scroll_cols(32); } +PALETTE_DECODER_MEMBER( senjyo_state, IIBBGGRR ) +{ + UINT8 i = (raw >> 6) & 3; + UINT8 r = (raw << 2) & 0x0c; + UINT8 g = (raw ) & 0x0c; + UINT8 b = (raw >> 2) & 0x0c; + + return rgb_t(pal4bit(r ? (r | i) : 0), pal4bit(g ? (g | i) : 0), pal4bit(b ? (b | i) : 0)); +} + +PALETTE_INIT_MEMBER( senjyo_state, radar ) +{ + // two colors for the radar dots (verified on the real board) + m_radar_palette->set_pen_color(0, rgb_t(0xff, 0x00, 0x00)); // red for enemies + m_radar_palette->set_pen_color(1, rgb_t(0xff, 0xff, 0x00)); // yellow for player +} /*************************************************************************** @@ -148,10 +164,10 @@ WRITE8_MEMBER(senjyo_state::bg3videoram_w) ***************************************************************************/ -void senjyo_state::draw_bgbitmap(bitmap_ind16 &bitmap,const rectangle &cliprect) +void senjyo_state::draw_bgbitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect) { if (m_bgstripes == 0xff) /* off */ - bitmap.fill(0, cliprect); + bitmap.fill(m_palette->pen_color(0), cliprect); else { int flip = flip_screen(); @@ -166,10 +182,10 @@ void senjyo_state::draw_bgbitmap(bitmap_ind16 &bitmap,const rectangle &cliprect) { if (flip) for (int y = 0;y < 256;y++) - bitmap.pix16(y, 255 - x) = 384 + pen; + bitmap.pix32(y, 255 - x) = m_palette->pen_color(384 + pen); else for (int y = 0;y < 256;y++) - bitmap.pix16(y, x) = 384 + pen; + bitmap.pix32(y, x) = m_palette->pen_color(384 + pen); count += 0x10; if (count >= strwid) @@ -181,7 +197,7 @@ void senjyo_state::draw_bgbitmap(bitmap_ind16 &bitmap,const rectangle &cliprect) } } -void senjyo_state::draw_radar(bitmap_ind16 &bitmap,const rectangle &cliprect) +void senjyo_state::draw_radar(bitmap_rgb32 &bitmap, const rectangle &cliprect) { for (int offs = 0;offs < 0x400;offs++) for (int x = 0;x < 8;x++) @@ -199,11 +215,11 @@ void senjyo_state::draw_radar(bitmap_ind16 &bitmap,const rectangle &cliprect) } if (cliprect.contains(sx, sy)) - bitmap.pix16(sy, sx) = offs < 0x200 ? 512 : 513; + bitmap.pix32(sy, sx) = m_radar_palette->pen_color(offs < 0x200 ? 0 : 1); } } -void senjyo_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,int priority) +void senjyo_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, int priority) { for (int offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4) { @@ -250,44 +266,38 @@ void senjyo_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,i } } -UINT32 senjyo_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +UINT32 senjyo_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - /* two colors for the radar dots (verified on the real board) */ - m_palette->set_pen_color(512,rgb_t(0xff,0x00,0x00)); /* red for enemies */ - m_palette->set_pen_color(513,rgb_t(0xff,0xff,0x00)); /* yellow for player */ + int flip = flip_screen(); - { - int flip = flip_screen(); - - for (int i = 0;i < 32;i++) - m_fg_tilemap->set_scrolly(i, m_fgscroll[i]); + for (int i = 0;i < 32;i++) + m_fg_tilemap->set_scrolly(i, m_fgscroll[i]); - int scrollx = m_scrollx1[0]; - int scrolly = m_scrolly1[0] + 256 * m_scrolly1[1]; - if (flip) - scrollx = -scrollx; - m_bg1_tilemap->set_scrollx(0, scrollx); - m_bg1_tilemap->set_scrolly(0, scrolly); + int scrollx = m_scrollx1[0]; + int scrolly = m_scrolly1[0] + 256 * m_scrolly1[1]; + if (flip) + scrollx = -scrollx; + m_bg1_tilemap->set_scrollx(0, scrollx); + m_bg1_tilemap->set_scrolly(0, scrolly); - scrollx = m_scrollx2[0]; - scrolly = m_scrolly2[0] + 256 * m_scrolly2[1]; - if (m_scrollhack) /* Star Force, but NOT the encrypted version */ - { - scrollx = m_scrollx1[0]; - scrolly = m_scrolly1[0] + 256 * m_scrolly1[1]; - } - if (flip) - scrollx = -scrollx; - m_bg2_tilemap->set_scrollx(0, scrollx); - m_bg2_tilemap->set_scrolly(0, scrolly); - - scrollx = m_scrollx3[0]; - scrolly = m_scrolly3[0] + 256 * m_scrolly3[1]; - if (flip) - scrollx = -scrollx; - m_bg3_tilemap->set_scrollx(0, scrollx); - m_bg3_tilemap->set_scrolly(0, scrolly); + scrollx = m_scrollx2[0]; + scrolly = m_scrolly2[0] + 256 * m_scrolly2[1]; + if (m_scrollhack) /* Star Force, but NOT the encrypted version */ + { + scrollx = m_scrollx1[0]; + scrolly = m_scrolly1[0] + 256 * m_scrolly1[1]; } + if (flip) + scrollx = -scrollx; + m_bg2_tilemap->set_scrollx(0, scrollx); + m_bg2_tilemap->set_scrolly(0, scrolly); + + scrollx = m_scrollx3[0]; + scrolly = m_scrolly3[0] + 256 * m_scrolly3[1]; + if (flip) + scrollx = -scrollx; + m_bg3_tilemap->set_scrollx(0, scrollx); + m_bg3_tilemap->set_scrolly(0, scrolly); draw_bgbitmap(bitmap, cliprect); draw_sprites(bitmap, cliprect, 0); diff --git a/src/mame/video/seta.c b/src/mame/video/seta.c index fa82df8d97b..816d7e98745 100644 --- a/src/mame/video/seta.c +++ b/src/mame/video/seta.c @@ -556,6 +556,15 @@ VIDEO_START_MEMBER(seta_state,seta_no_layers) m_seta001->set_bg_yoffsets( 0x1, -0x1 ); } +VIDEO_START_MEMBER(seta_state,kyustrkr_no_layers) +{ + VIDEO_START_CALL_MEMBER(seta_no_layers); + + // position kludges + m_seta001->set_fg_yoffsets( -0x0a, 0x0e ); + m_seta001->set_bg_yoffsets( 0x1, -0x1 ); +} + /*************************************************************************** diff --git a/src/mame/video/spy.c b/src/mame/video/spy.c index 4b0fa6f6a31..c12a886c079 100644 --- a/src/mame/video/spy.c +++ b/src/mame/video/spy.c @@ -12,9 +12,11 @@ K052109_CB_MEMBER(spy_state::tile_callback) { + static const int layer_colorbase[] = { 768 / 16, 0 / 16, 256 / 16 }; + *flags = (*color & 0x20) ? TILE_FLIPX : 0; *code |= ((*color & 0x03) << 8) | ((*color & 0x10) << 6) | ((*color & 0x0c) << 9) | (bank << 13); - *color = m_layer_colorbase[layer] + ((*color & 0xc0) >> 6); + *color = layer_colorbase[layer] + ((*color & 0xc0) >> 6); } @@ -26,32 +28,18 @@ K052109_CB_MEMBER(spy_state::tile_callback) K051960_CB_MEMBER(spy_state::sprite_callback) { + enum { sprite_colorbase = 512 / 16 }; + /* bit 4 = priority over layer A (0 = have priority) */ /* bit 5 = priority over layer B (1 = have priority) */ *priority = 0x00; - if ( *color & 0x10) *priority |= 0xa; - if (~*color & 0x20) *priority |= 0xc; - - *color = m_sprite_colorbase + (*color & 0x0f); -} - - -/*************************************************************************** - - Start the video hardware emulation. - -***************************************************************************/ + if ( *color & 0x10) *priority |= GFX_PMASK_1; + if (~*color & 0x20) *priority |= GFX_PMASK_2; -void spy_state::video_start() -{ - m_layer_colorbase[0] = 48; - m_layer_colorbase[1] = 0; - m_layer_colorbase[2] = 16; - m_sprite_colorbase = 32; + *color = sprite_colorbase + (*color & 0x0f); } - /*************************************************************************** Display refresh @@ -65,7 +53,7 @@ UINT32 spy_state::screen_update_spy(screen_device &screen, bitmap_ind16 &bitmap, screen.priority().fill(0, cliprect); if (!m_video_enable) - bitmap.fill(16 * m_layer_colorbase[0], cliprect); + bitmap.fill(768, cliprect); // ? else { m_k052109->tilemap_draw(screen, bitmap, cliprect, 1, TILEMAP_DRAW_OPAQUE, 1); diff --git a/src/mame/video/superqix.c b/src/mame/video/superqix.c index ba6b1acd4aa..d2c08c13d96 100644 --- a/src/mame/video/superqix.c +++ b/src/mame/video/superqix.c @@ -69,6 +69,15 @@ VIDEO_START_MEMBER(superqix_state,superqix) save_item(NAME(*m_fg_bitmap[1])); } +PALETTE_DECODER_MEMBER( superqix_state, BBGGRRII ) +{ + UINT8 i = raw & 3; + UINT8 r = (raw >> 0) & 0x0c; + UINT8 g = (raw >> 2) & 0x0c; + UINT8 b = (raw >> 4) & 0x0c; + + return rgb_t(pal4bit(r | i), pal4bit(g | i), pal4bit(b | i)); +} /*************************************************************************** diff --git a/src/mame/video/system1.c b/src/mame/video/system1.c index 07e040dc8d4..b43c8020664 100644 --- a/src/mame/video/system1.c +++ b/src/mame/video/system1.c @@ -292,9 +292,6 @@ WRITE8_MEMBER(system1_state::system1_videoram_bank_w) WRITE8_MEMBER(system1_state::system1_paletteram_w) { - const UINT8 *color_prom = memregion("palette")->base(); - int val,r,g,b; - /* There are two kind of color handling: in the System 1 games, values in the palette RAM are directly mapped to colors with the usual BBGGGRRR format; @@ -316,41 +313,25 @@ WRITE8_MEMBER(system1_state::system1_paletteram_w) accurate to +/- .003K ohms. */ - m_generic_paletteram_8[offset] = data; - - if (color_prom != NULL) + if (m_color_prom != NULL) { - int bit0,bit1,bit2,bit3; - - val = color_prom[data+0*256]; - bit0 = (val >> 0) & 0x01; - bit1 = (val >> 1) & 0x01; - bit2 = (val >> 2) & 0x01; - bit3 = (val >> 3) & 0x01; - r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - val = color_prom[data+1*256]; - bit0 = (val >> 0) & 0x01; - bit1 = (val >> 1) & 0x01; - bit2 = (val >> 2) & 0x01; - bit3 = (val >> 3) & 0x01; - g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - val = color_prom[data+2*256]; - bit0 = (val >> 0) & 0x01; - bit1 = (val >> 1) & 0x01; - bit2 = (val >> 2) & 0x01; - bit3 = (val >> 3) & 0x01; - b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + UINT8 val; + + val = m_color_prom[data + 0 * 256]; + UINT8 r = 0x0e * BIT(val, 0) + 0x1f * BIT(val, 1) + 0x43 * BIT(val, 2) + 0x8f * BIT(val, 3); + + val = m_color_prom[data + 1 * 256]; + UINT8 g = 0x0e * BIT(val, 0) + 0x1f * BIT(val, 1) + 0x43 * BIT(val, 2) + 0x8f * BIT(val, 3); + + val = m_color_prom[data + 2 * 256]; + UINT8 b = 0x0e * BIT(val, 0) + 0x1f * BIT(val, 1) + 0x43 * BIT(val, 2) + 0x8f * BIT(val, 3); + + m_palette->set_pen_color(offset, rgb_t(r, g, b)); } else { - r = pal3bit(data >> 0); - g = pal3bit(data >> 3); - b = pal2bit(data >> 6); + m_palette->write(space, offset, data); } - - m_palette->set_pen_color(offset,rgb_t(r,g,b)); } diff --git a/src/mame/video/thunderx.c b/src/mame/video/thunderx.c index 65d33a5316f..0c2d85a1d01 100644 --- a/src/mame/video/thunderx.c +++ b/src/mame/video/thunderx.c @@ -30,10 +30,10 @@ K052109_CB_MEMBER(thunderx_state::gbusters_tile_callback) ***************************************************************************/ -static const int sprite_colorbase = 512 / 16; - K051960_CB_MEMBER(thunderx_state::sprite_callback) { + enum { sprite_colorbase = 512 / 16 }; + /* Sprite priority 1 means appear behind background, used only to mask sprites */ /* in the foreground */ /* Sprite priority 3 means don't draw (not used) */ diff --git a/src/mame/video/tutankhm.c b/src/mame/video/tutankhm.c index fe152c43762..473ab27824a 100644 --- a/src/mame/video/tutankhm.c +++ b/src/mame/video/tutankhm.c @@ -12,9 +12,6 @@ #include "includes/tutankhm.h" -#define NUM_PENS (0x10) - - /************************************* * * Write handlers @@ -35,25 +32,6 @@ WRITE8_MEMBER(tutankhm_state::tutankhm_flip_screen_y_w) /************************************* * - * Palette management - * - *************************************/ - -void tutankhm_state::get_pens( pen_t *pens ) -{ - offs_t i; - - for (i = 0; i < NUM_PENS; i++) - { - UINT8 data = m_paletteram[i]; - - pens[i] = rgb_t(pal3bit(data >> 0), pal3bit(data >> 3), pal2bit(data >> 6)); - } -} - - -/************************************* - * * Video update * *************************************/ @@ -62,23 +40,19 @@ UINT32 tutankhm_state::screen_update_tutankhm(screen_device &screen, bitmap_rgb3 { int xorx = m_flip_x ? 255 : 0; int xory = m_flip_y ? 255 : 0; - pen_t pens[NUM_PENS]; - int x, y; - - get_pens( pens); - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { UINT32 *dst = &bitmap.pix32(y); - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { UINT8 effx = x ^ xorx; UINT8 yscroll = (effx < 192) ? *m_scroll : 0; UINT8 effy = (y ^ xory) + yscroll; UINT8 vrambyte = m_videoram[effy * 128 + effx / 2]; UINT8 shifted = vrambyte >> (4 * (effx % 2)); - dst[x] = pens[shifted & 0x0f]; + dst[x] = m_palette->pen_color(shifted & 0x0f); } } diff --git a/src/mame/video/ultraman.c b/src/mame/video/ultraman.c index 9e003fe8fe1..ed969c5e21a 100644 --- a/src/mame/video/ultraman.c +++ b/src/mame/video/ultraman.c @@ -11,8 +11,10 @@ K051960_CB_MEMBER(ultraman_state::sprite_callback) { - *priority = (*color & 0x80) >> 7; - *color = m_sprite_colorbase + ((*color & 0x7e) >> 1); + enum { sprite_colorbase = 3072 / 16 }; + + *priority = (*color & 0x80) ? 0 : GFX_PMASK_1; + *color = sprite_colorbase + ((*color & 0x7e) >> 1); *shadow = 0; } @@ -25,36 +27,25 @@ K051960_CB_MEMBER(ultraman_state::sprite_callback) K051316_CB_MEMBER(ultraman_state::zoom_callback_1) { + enum { zoom_colorbase_1 = 0 / 16 }; + *code |= ((*color & 0x07) << 8) | (m_bank0 << 11); - *color = m_zoom_colorbase[0] + ((*color & 0xf8) >> 3); + *color = zoom_colorbase_1 + ((*color & 0xf8) >> 3); } K051316_CB_MEMBER(ultraman_state::zoom_callback_2) { + enum { zoom_colorbase_2 = 1024 / 16 }; + *code |= ((*color & 0x07) << 8) | (m_bank1 << 11); - *color = m_zoom_colorbase[1] + ((*color & 0xf8) >> 3); + *color = zoom_colorbase_2 + ((*color & 0xf8) >> 3); } K051316_CB_MEMBER(ultraman_state::zoom_callback_3) { + enum { zoom_colorbase_3 = 2048 / 16 }; *code |= ((*color & 0x07) << 8) | (m_bank2 << 11); - *color = m_zoom_colorbase[2] + ((*color & 0xf8) >> 3); -} - - - -/*************************************************************************** - - Start the video hardware emulation. - -***************************************************************************/ - -void ultraman_state::video_start() -{ - m_sprite_colorbase = 192; - m_zoom_colorbase[0] = 0; - m_zoom_colorbase[1] = 64; - m_zoom_colorbase[2] = 128; + *color = zoom_colorbase_3 + ((*color & 0xf8) >> 3); } @@ -117,10 +108,11 @@ WRITE16_MEMBER(ultraman_state::ultraman_gfxctrl_w) UINT32 ultraman_state::screen_update_ultraman(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { + screen.priority().fill(0, cliprect); + m_k051316_3->zoom_draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0); m_k051316_2->zoom_draw(screen, bitmap, cliprect, 0, 0); - m_k051960->k051960_sprites_draw(bitmap, cliprect, screen.priority(), 0, 0); - m_k051316_1->zoom_draw(screen, bitmap, cliprect, 0, 0); - m_k051960->k051960_sprites_draw(bitmap, cliprect, screen.priority(), 1, 1); + m_k051316_1->zoom_draw(screen, bitmap, cliprect, 0, 1); + m_k051960->k051960_sprites_draw(bitmap, cliprect, screen.priority(), -1, -1); return 0; } diff --git a/src/mame/video/xxmissio.c b/src/mame/video/xxmissio.c index 5633c7dc40f..eda9e682e4f 100644 --- a/src/mame/video/xxmissio.c +++ b/src/mame/video/xxmissio.c @@ -77,6 +77,15 @@ void xxmissio_state::video_start() save_item(NAME(m_flipscreen)); } +PALETTE_DECODER_MEMBER( xxmissio_state, BBGGRRII ) +{ + UINT8 i = raw & 3; + UINT8 r = (raw >> 0) & 0x0c; + UINT8 g = (raw >> 2) & 0x0c; + UINT8 b = (raw >> 4) & 0x0c; + + return rgb_t(pal4bit(r | i), pal4bit(g | i), pal4bit(b | i)); +} void xxmissio_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx) { diff --git a/src/mess/audio/gamate.c b/src/mess/audio/gamate.c index 15ed48d22b6..19555dd7c44 100644 --- a/src/mess/audio/gamate.c +++ b/src/mess/audio/gamate.c @@ -193,7 +193,7 @@ WRITE8_MEMBER( gamate_sound_device::device_w ) size = reg[chan*2] | ((reg[chan*2+1] & 0xf) << 8); if (size) { - m_channels[chan].size= (int) (machine().sample_rate() * size*ClockDelay / machine().device("maincpu")->unscaled_clock()); + m_channels[chan].size= (int) (machine().sample_rate() * size*ClockDelay / m_clock); } else { @@ -205,7 +205,7 @@ WRITE8_MEMBER( gamate_sound_device::device_w ) size=data&0x1f; if (size==0) size=1; - noise.step= machine().device("maincpu")->unscaled_clock() / (1.0*ClockDelay*machine().sample_rate()*size); + noise.step= m_clock / (1.0*ClockDelay*machine().sample_rate()*size); break; case 7: m_channels[Right].full_cycle=data&1; @@ -229,7 +229,7 @@ WRITE8_MEMBER( gamate_sound_device::device_w ) size = reg[0xb] | ((reg[0xc]) << 8); if (size==0) size=1; - envelope.step= machine().device("maincpu")->unscaled_clock() / (1.0*ClockDelay*machine().sample_rate()*size); + envelope.step= m_clock / (1.0*ClockDelay*machine().sample_rate()*size); break; case 0xd: envelope.control=data&0xf; diff --git a/src/mess/drivers/4004clk.c b/src/mess/drivers/4004clk.c index 7f3cb36a90b..631690d582d 100644 --- a/src/mess/drivers/4004clk.c +++ b/src/mess/drivers/4004clk.c @@ -19,11 +19,13 @@ public: nixieclock_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), - m_dac(*this, "dac") + m_dac(*this, "dac"), + m_input(*this, "INPUT") { } required_device<i4004_cpu_device> m_maincpu; required_device<dac_device> m_dac; + required_ioport m_input; DECLARE_READ8_MEMBER( data_r ); DECLARE_WRITE8_MEMBER( nixie_w ); DECLARE_WRITE8_MEMBER( neon_w ); @@ -39,7 +41,7 @@ public: READ8_MEMBER(nixieclock_state::data_r) { - return ioport("INPUT")->read() & 0x0f; + return m_input->read() & 0x0f; } UINT8 nixieclock_state::nixie_to_num(UINT16 val) diff --git a/src/mess/drivers/a2600.c b/src/mess/drivers/a2600.c index 1b80eb4c5ad..4868d07bd39 100644 --- a/src/mess/drivers/a2600.c +++ b/src/mess/drivers/a2600.c @@ -37,7 +37,9 @@ public: m_cart(*this, "cartslot"), m_tia(*this, "tia_video"), m_maincpu(*this, "maincpu"), - m_screen(*this, "screen") { } + m_screen(*this, "screen"), + m_swb(*this, "SWB") + { } required_shared_ptr<UINT8> m_riot_ram; UINT16 m_current_screen_height; @@ -66,6 +68,7 @@ protected: unsigned long detect_2600controllers(); required_device<m6502_device> m_maincpu; required_device<screen_device> m_screen; + required_ioport m_swb; }; @@ -124,7 +127,7 @@ WRITE_LINE_MEMBER(a2600_state::irq_callback) READ8_MEMBER(a2600_state::riot_input_port_8_r) { - return ioport("SWB")->read(); + return m_swb->read(); } diff --git a/src/mess/drivers/ac1.c b/src/mess/drivers/ac1.c index 46683958e08..bf67bbfff9e 100644 --- a/src/mess/drivers/ac1.c +++ b/src/mess/drivers/ac1.c @@ -53,7 +53,7 @@ ADDRESS_MAP_END /* Input ports */ static INPUT_PORTS_START( ac1 ) - PORT_START("LINE0") + PORT_START("LINE.0") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') @@ -63,7 +63,7 @@ static INPUT_PORTS_START( ac1 ) PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_START("LINE1") + PORT_START("LINE.1") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('*') @@ -73,7 +73,7 @@ static INPUT_PORTS_START( ac1 ) PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('>') PORT_CHAR('.') PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('?') PORT_CHAR('/') - PORT_START("LINE2") + PORT_START("LINE.2") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('@') PORT_CHAR('`') PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') @@ -83,7 +83,7 @@ static INPUT_PORTS_START( ac1 ) PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') - PORT_START("LINE3") + PORT_START("LINE.3") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') @@ -93,7 +93,7 @@ static INPUT_PORTS_START( ac1 ) PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') - PORT_START("LINE4") + PORT_START("LINE.4") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') @@ -103,7 +103,7 @@ static INPUT_PORTS_START( ac1 ) PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') - PORT_START("LINE5") + PORT_START("LINE.5") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') @@ -113,7 +113,7 @@ static INPUT_PORTS_START( ac1 ) PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_START("LINE6") + PORT_START("LINE.6") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') diff --git a/src/mess/drivers/ace.c b/src/mess/drivers/ace.c index 06cbec86d42..9a3856bcc1c 100644 --- a/src/mess/drivers/ace.c +++ b/src/mess/drivers/ace.c @@ -55,7 +55,95 @@ Ports: #include "sound/sp0256.h" #include "sound/speaker.h" #include "sound/wave.h" -#include "includes/ace.h" + + +#define Z80_TAG "z0" +#define AY8910_TAG "ay8910" +#define I8255_TAG "i8255" +#define SP0256AL2_TAG "ic1" +#define Z80PIO_TAG "z80pio" +#define CENTRONICS_TAG "centronics" +#define SCREEN_TAG "screen" + +class ace_state : public driver_device +{ +public: + ace_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, Z80_TAG), + m_ppi(*this, I8255_TAG), + m_z80pio(*this, Z80PIO_TAG), + m_speaker(*this, "speaker"), + m_cassette(*this, "cassette"), + m_centronics(*this, CENTRONICS_TAG), + m_ram(*this, RAM_TAG), + m_sp0256(*this, SP0256AL2_TAG), + m_video_ram(*this, "video_ram"), + m_char_ram(*this, "char_ram"), + m_a8(*this, "A8"), + m_a9(*this, "A9"), + m_a10(*this, "A10"), + m_a11(*this, "A11"), + m_a12(*this, "A12"), + m_a13(*this, "A13"), + m_a14(*this, "A14"), + m_a15(*this, "A15"), + m_joy(*this, "JOY") + { } + + virtual void machine_start(); + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + DECLARE_READ8_MEMBER( io_r ); + DECLARE_WRITE8_MEMBER( io_w ); + DECLARE_READ8_MEMBER( ppi_pa_r ); + DECLARE_WRITE8_MEMBER( ppi_pa_w ); + DECLARE_READ8_MEMBER( ppi_pb_r ); + DECLARE_WRITE8_MEMBER( ppi_pb_w ); + DECLARE_READ8_MEMBER( ppi_pc_r ); + DECLARE_WRITE8_MEMBER( ppi_pc_w ); + DECLARE_READ8_MEMBER( ppi_control_r ); + DECLARE_WRITE8_MEMBER( ppi_control_w ); + DECLARE_READ8_MEMBER( pio_pa_r ); + DECLARE_WRITE8_MEMBER( pio_pa_w ); + + UINT32 screen_update_ace(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_DEVICE_CALLBACK_MEMBER(set_irq); + TIMER_DEVICE_CALLBACK_MEMBER(clear_irq); + DECLARE_READ8_MEMBER(pio_ad_r); + DECLARE_READ8_MEMBER(pio_bd_r); + DECLARE_READ8_MEMBER(pio_ac_r); + DECLARE_READ8_MEMBER(pio_bc_r); + DECLARE_WRITE8_MEMBER(pio_ad_w); + DECLARE_WRITE8_MEMBER(pio_bd_w); + DECLARE_WRITE8_MEMBER(pio_ac_w); + DECLARE_WRITE8_MEMBER(pio_bc_w); + DECLARE_READ8_MEMBER(sby_r); + DECLARE_WRITE8_MEMBER(ald_w); + DECLARE_SNAPSHOT_LOAD_MEMBER( ace ); + +private: + required_device<cpu_device> m_maincpu; + required_device<i8255_device> m_ppi; + required_device<z80pio_device> m_z80pio; + required_device<speaker_sound_device> m_speaker; + required_device<cassette_image_device> m_cassette; + required_device<centronics_device> m_centronics; + required_device<ram_device> m_ram; + required_device<sp0256_device> m_sp0256; + required_shared_ptr<UINT8> m_video_ram; + required_shared_ptr<UINT8> m_char_ram; + required_ioport m_a8; + required_ioport m_a9; + required_ioport m_a10; + required_ioport m_a11; + required_ioport m_a12; + required_ioport m_a13; + required_ioport m_a14; + required_ioport m_a15; + required_ioport m_joy; +}; /* Load in .ace files. These are memory images of 0x2000 to 0x7fff @@ -172,17 +260,17 @@ READ8_MEMBER( ace_state::io_r ) { UINT8 data = 0xff; - if (!BIT(offset, 8)) data &= ioport("A8")->read(); - if (!BIT(offset, 9)) data &= ioport("A9")->read(); - if (!BIT(offset, 10)) data &= ioport("A10")->read(); - if (!BIT(offset, 11)) data &= ioport("A11")->read(); - if (!BIT(offset, 12)) data &= ioport("A12")->read(); - if (!BIT(offset, 13)) data &= ioport("A13")->read(); - if (!BIT(offset, 14)) data &= ioport("A14")->read(); + if (!BIT(offset, 8)) data &= m_a8->read(); + if (!BIT(offset, 9)) data &= m_a9->read(); + if (!BIT(offset, 10)) data &= m_a10->read(); + if (!BIT(offset, 11)) data &= m_a11->read(); + if (!BIT(offset, 12)) data &= m_a12->read(); + if (!BIT(offset, 13)) data &= m_a13->read(); + if (!BIT(offset, 14)) data &= m_a14->read(); if (!BIT(offset, 15)) { - data &= ioport("A15")->read(); + data &= m_a15->read(); m_cassette->output(-1); m_speaker->level_w(0); @@ -264,26 +352,22 @@ WRITE8_MEMBER( ace_state::ppi_control_w ) READ8_MEMBER(ace_state::pio_ad_r) { - device_t *device = machine().device(Z80PIO_TAG); - return dynamic_cast<z80pio_device*>(device)->data_read(0); + return m_z80pio->data_read(0); } READ8_MEMBER(ace_state::pio_bd_r) { - device_t *device = machine().device(Z80PIO_TAG); - return dynamic_cast<z80pio_device*>(device)->data_read(1); + return m_z80pio->data_read(1); } READ8_MEMBER(ace_state::pio_ac_r) { - device_t *device = machine().device(Z80PIO_TAG); - return dynamic_cast<z80pio_device*>(device)->control_read(); + return m_z80pio->control_read(); } READ8_MEMBER(ace_state::pio_bc_r) { - device_t *device = machine().device(Z80PIO_TAG); - return dynamic_cast<z80pio_device*>(device)->control_read(); + return m_z80pio->control_read(); } @@ -293,26 +377,22 @@ READ8_MEMBER(ace_state::pio_bc_r) WRITE8_MEMBER(ace_state::pio_ad_w) { - device_t *device = machine().device(Z80PIO_TAG); - dynamic_cast<z80pio_device*>(device)->data_write(0, data); + m_z80pio->data_write(0, data); } WRITE8_MEMBER(ace_state::pio_bd_w) { - device_t *device = machine().device(Z80PIO_TAG); - dynamic_cast<z80pio_device*>(device)->data_write(1, data); + m_z80pio->data_write(1, data); } WRITE8_MEMBER(ace_state::pio_ac_w) { - device_t *device = machine().device(Z80PIO_TAG); - dynamic_cast<z80pio_device*>(device)->control_write(0, data); + m_z80pio->control_write(0, data); } WRITE8_MEMBER(ace_state::pio_bc_w) { - device_t *device = machine().device(Z80PIO_TAG); - dynamic_cast<z80pio_device*>(device)->control_write(1, data); + m_z80pio->control_write(1, data); } diff --git a/src/mess/drivers/alesis.c b/src/mess/drivers/alesis.c index 0e2dbbed2cf..605305b6b64 100644 --- a/src/mess/drivers/alesis.c +++ b/src/mess/drivers/alesis.c @@ -27,17 +27,17 @@ READ8_MEMBER( alesis_state::kb_r ) UINT8 data = 0xff; if (!(m_kb_matrix & 0x01)) - data &= ioport("COL1")->read(); + data &= m_col1->read(); if (!(m_kb_matrix & 0x02)) - data &= ioport("COL2")->read(); + data &= m_col2->read(); if (!(m_kb_matrix & 0x04)) - data &= ioport("COL3")->read(); + data &= m_col3->read(); if (!(m_kb_matrix & 0x08)) - data &= ioport("COL4")->read(); + data &= m_col4->read(); if (!(m_kb_matrix & 0x10)) - data &= ioport("COL5")->read(); + data &= m_col5->read(); if (!(m_kb_matrix & 0x20)) - data &= ioport("COL6")->read(); + data &= m_col6->read(); return data; } diff --git a/src/mess/drivers/apple2.c b/src/mess/drivers/apple2.c index 602a5f3f3f0..bbe05013928 100644 --- a/src/mess/drivers/apple2.c +++ b/src/mess/drivers/apple2.c @@ -368,7 +368,7 @@ PALETTE_INIT_MEMBER(napple2_state, apple2) UINT32 napple2_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { // always update the flash timer here so it's smooth regardless of mode switches - m_video->m_flash = ((machine().time() * 4).seconds & 1) ? true : false; + m_video->m_flash = ((machine().time() * 4).seconds() & 1) ? true : false; if (m_video->m_graphics) { diff --git a/src/mess/drivers/apple2e.c b/src/mess/drivers/apple2e.c index 2db5b7d9939..55b74c579b8 100644 --- a/src/mess/drivers/apple2e.c +++ b/src/mess/drivers/apple2e.c @@ -822,7 +822,7 @@ UINT32 apple2e_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, } // always update the flash timer here so it's smooth regardless of mode switches - m_video->m_flash = ((machine().time() * 4).seconds & 1) ? true : false; + m_video->m_flash = ((machine().time() * 4).seconds() & 1) ? true : false; if (m_video->m_graphics) { diff --git a/src/mess/drivers/aussiebyte.c b/src/mess/drivers/aussiebyte.c new file mode 100644 index 00000000000..1e597d64406 --- /dev/null +++ b/src/mess/drivers/aussiebyte.c @@ -0,0 +1,572 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/************************************************************************************************* + + The Aussie Byte II Single-Board Computer, created by SME Systems, Melbourne, Australia. + Also known as the Knight 2000 Microcomputer. + + Status: + Boots up from floppy. + Output to serial terminal and to 6545 are working. Serial keyboard works. + + Developed in conjunction with members of the MSPP. Written in July, 2015. + + ToDo: + - CRT8002 attributes controller + - Graphics + - Hard drive controllers and drives + - Test Centronics printer + - PIO connections + - RTC not working + + Note of MAME restrictions: + - Votrax doesn't sound anything like the real thing + - WD1001/WD1002 device is not emulated + - CRT8002 device is not emulated + +**************************************************************************************************/ + +/*********************************************************** + + Includes + +************************************************************/ +#include "includes/aussiebyte.h" + + +/*********************************************************** + + Address Maps + +************************************************************/ + +static ADDRESS_MAP_START( aussiebyte_map, AS_PROGRAM, 8, aussiebyte_state ) + AM_RANGE(0x0000, 0x3fff) AM_READ_BANK("bankr0") AM_WRITE_BANK("bankw0") + AM_RANGE(0x4000, 0x7fff) AM_RAMBANK("bank1") + AM_RANGE(0x8000, 0xbfff) AM_RAMBANK("bank2") + AM_RANGE(0xc000, 0xffff) AM_RAM AM_REGION("mram", 0x0000) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( aussiebyte_io, AS_IO, 8, aussiebyte_state ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("sio1", z80sio0_device, ba_cd_r, ba_cd_w) + AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("pio1", z80pio_device, read, write) + AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("ctc", z80ctc_device, read, write) + AM_RANGE(0x0c, 0x0f) AM_NOP // winchester interface + AM_RANGE(0x10, 0x13) AM_DEVREADWRITE("fdc", wd2797_t, read, write) + AM_RANGE(0x14, 0x14) AM_DEVREADWRITE("dma", z80dma_device, read, write) + AM_RANGE(0x15, 0x15) AM_WRITE(port15_w) // boot rom disable + AM_RANGE(0x16, 0x16) AM_WRITE(port16_w) // fdd select + AM_RANGE(0x17, 0x17) AM_WRITE(port17_w) // DMA mux + AM_RANGE(0x18, 0x18) AM_WRITE(port18_w) // fdc select + AM_RANGE(0x19, 0x19) AM_READ(port19_r) // info port + AM_RANGE(0x1a, 0x1a) AM_WRITE(port1a_w) // membank + AM_RANGE(0x1b, 0x1b) AM_WRITE(port1b_w) // winchester control + AM_RANGE(0x1c, 0x1f) AM_WRITE(port1c_w) // gpebh select + AM_RANGE(0x20, 0x23) AM_DEVREADWRITE("pio2", z80pio_device, read, write) + AM_RANGE(0x24, 0x27) AM_DEVREADWRITE("sio2", z80sio0_device, ba_cd_r, ba_cd_w) + AM_RANGE(0x28, 0x28) AM_READ(port28_r) AM_DEVWRITE("votrax", votrax_sc01_device, write) + AM_RANGE(0x2c, 0x2c) AM_DEVWRITE("votrax", votrax_sc01_device, inflection_w) + AM_RANGE(0x30, 0x30) AM_WRITE(address_w) + AM_RANGE(0x31, 0x31) AM_DEVREAD("crtc", mc6845_device, status_r) + AM_RANGE(0x32, 0x32) AM_WRITE(register_w) + AM_RANGE(0x33, 0x33) AM_READ(port33_r) + AM_RANGE(0x34, 0x34) AM_WRITE(port34_w) // video control + AM_RANGE(0x35, 0x35) AM_WRITE(port35_w) // data to vram and aram + AM_RANGE(0x36, 0x36) AM_READ(port36_r) // data from vram and aram + AM_RANGE(0x37, 0x37) AM_READ(port37_r) // read dispen flag + AM_RANGE(0x40, 0x4f) AM_DEVREADWRITE("rtc", msm5832_device, data_r, data_w) +ADDRESS_MAP_END + +/*********************************************************** + + Keyboard + +************************************************************/ +static INPUT_PORTS_START( aussiebyte ) +INPUT_PORTS_END + +/*********************************************************** + + I/O Ports + +************************************************************/ +WRITE8_MEMBER( aussiebyte_state::port15_w ) +{ + membank("bankr0")->set_entry(m_port15); // point at ram + m_port15 = true; +} + +/* FDD select +0 Drive Select bit O +1 Drive Select bit 1 +2 Drive Select bit 2 +3 Drive Select bit 3 + - These bits connect to a 74LS145 binary to BCD converter. + - Drives 0 to 3 are 5.25 inch, 4 to 7 are 8 inch, 9 and 0 are not used. + - Currently we only support drive 0. +4 Side Select to Disk Drives. +5 Disable 5.25 inch floppy spindle motors. +6 Unused. +7 Enable write precompensation on WD2797 controller. */ +WRITE8_MEMBER( aussiebyte_state::port16_w ) +{ + floppy_image_device *m_floppy = NULL; + if ((data & 15) == 0) + m_floppy = m_floppy0->get_device(); + else + if ((data & 15) == 1) + m_floppy = m_floppy1->get_device(); + + m_fdc->set_floppy(m_floppy); + + if (m_floppy) + { + m_floppy->mon_w(BIT(data, 5)); + m_floppy->ss_w(BIT(data, 4)); + } +} + +/* DMA select +0 - FDC +1 - SIO Ch A +2 - SIO Ch B +3 - Winchester bus +4 - SIO Ch C +5 - SIO Ch D +6 - Ext ready 1 +7 - Ext ready 2 */ +WRITE8_MEMBER( aussiebyte_state::port17_w ) +{ + m_port17 = data & 7; + m_dma->rdy_w(BIT(m_port17_rdy, data)); +} + +/* FDC params +2 EXC: WD2797 clock frequency. H = 5.25"; L = 8" +3 WIEN: WD2797 Double density select. */ +WRITE8_MEMBER( aussiebyte_state::port18_w ) +{ + m_fdc->set_unscaled_clock(BIT(data, 2) ? 1e6 : 2e6); + m_fdc->dden_w(BIT(data, 3)); +} + +READ8_MEMBER( aussiebyte_state::port19_r ) +{ + return m_port19; +} + +// Memory banking +WRITE8_MEMBER( aussiebyte_state::port1a_w ) +{ + data &= 7; + switch (data) + { + case 0: + case 1: + case 2: + case 3: + case 4: + m_port1a = data*3+1; + if (m_port15) + membank("bankr0")->set_entry(data*3+1); + membank("bankw0")->set_entry(data*3+1); + membank("bank1")->set_entry(data*3+2); + membank("bank2")->set_entry(data*3+3); + break; + case 5: + m_port1a = 1; + if (m_port15) + membank("bankr0")->set_entry(1); + membank("bankw0")->set_entry(1); + membank("bank1")->set_entry(2); + membank("bank2")->set_entry(13); + break; + case 6: + m_port1a = 14; + if (m_port15) + membank("bankr0")->set_entry(14); + membank("bankw0")->set_entry(14); + membank("bank1")->set_entry(15); + //membank("bank2")->set_entry(0); // open bus + break; + case 7: + m_port1a = 1; + if (m_port15) + membank("bankr0")->set_entry(1); + membank("bankw0")->set_entry(1); + membank("bank1")->set_entry(4); + membank("bank2")->set_entry(13); + break; + } +} + +// Winchester control +WRITE8_MEMBER( aussiebyte_state::port1b_w ) +{ +} + +// GPEHB control +WRITE8_MEMBER( aussiebyte_state::port1c_w ) +{ +} + +WRITE8_MEMBER( aussiebyte_state::port20_w ) +{ + m_speaker->level_w(BIT(data, 7)); +} + +READ8_MEMBER( aussiebyte_state::port28_r ) +{ + return m_port28; +} + +/*********************************************************** + + DMA + +************************************************************/ +READ8_MEMBER( aussiebyte_state::memory_read_byte ) +{ + address_space& prog_space = m_maincpu->space(AS_PROGRAM); + return prog_space.read_byte(offset); +} + +WRITE8_MEMBER( aussiebyte_state::memory_write_byte ) +{ + address_space& prog_space = m_maincpu->space(AS_PROGRAM); + prog_space.write_byte(offset, data); +} + +READ8_MEMBER( aussiebyte_state::io_read_byte ) +{ + address_space& prog_space = m_maincpu->space(AS_IO); + return prog_space.read_byte(offset); +} + +WRITE8_MEMBER( aussiebyte_state::io_write_byte ) +{ + address_space& prog_space = m_maincpu->space(AS_IO); + prog_space.write_byte(offset, data); +} + +WRITE_LINE_MEMBER( aussiebyte_state::busreq_w ) +{ +// since our Z80 has no support for BUSACK, we assume it is granted immediately + m_maincpu->set_input_line(Z80_INPUT_LINE_BUSRQ, state); + m_dma->bai_w(state); // tell dma that bus has been granted +} + +/*********************************************************** + + DMA selector + +************************************************************/ +WRITE_LINE_MEMBER( aussiebyte_state::sio1_rdya_w ) +{ + m_port17_rdy = (m_port17_rdy & 0xfd) | (UINT8)(state << 1); + if (m_port17 == 1) + m_dma->rdy_w(state); +} + +WRITE_LINE_MEMBER( aussiebyte_state::sio1_rdyb_w ) +{ + m_port17_rdy = (m_port17_rdy & 0xfb) | (UINT8)(state << 2); + if (m_port17 == 2) + m_dma->rdy_w(state); +} + +WRITE_LINE_MEMBER( aussiebyte_state::sio2_rdya_w ) +{ + m_port17_rdy = (m_port17_rdy & 0xef) | (UINT8)(state << 4); + if (m_port17 == 4) + m_dma->rdy_w(state); +} + +WRITE_LINE_MEMBER( aussiebyte_state::sio2_rdyb_w ) +{ + m_port17_rdy = (m_port17_rdy & 0xdf) | (UINT8)(state << 5); + if (m_port17 == 5) + m_dma->rdy_w(state); +} + + +/*********************************************************** + + Video + +************************************************************/ + +/* F4 Character Displayer */ +static const gfx_layout crt8002_charlayout = +{ + 8, 12, /* 7 x 11 characters */ + 128, /* 128 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5, 6, 7 }, + /* y offsets */ + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8 }, + 8*16 /* every char takes 16 bytes */ +}; + +static GFXDECODE_START( crt8002 ) + GFXDECODE_ENTRY( "chargen", 0x0000, crt8002_charlayout, 0, 1 ) +GFXDECODE_END + +/*************************************************************** + + Daisy Chain + +****************************************************************/ + +static const z80_daisy_config daisy_chain_intf[] = +{ + { "dma" }, + { "pio2" }, + { "sio1" }, + { "sio2" }, + { "pio1" }, + { "ctc" }, + { NULL } +}; + + +/*********************************************************** + + CTC + +************************************************************/ + +// baud rate generator. All inputs are 1.2288MHz. +TIMER_DEVICE_CALLBACK_MEMBER( aussiebyte_state::ctc_tick ) +{ + m_ctc->trg0(1); + m_ctc->trg0(0); + m_ctc->trg1(1); + m_ctc->trg1(0); + m_ctc->trg2(1); + m_ctc->trg2(0); +} + +WRITE_LINE_MEMBER( aussiebyte_state::ctc_z0_w ) +{ + m_sio1->rxca_w(state); + m_sio1->txca_w(state); +} + +WRITE_LINE_MEMBER( aussiebyte_state::ctc_z1_w ) +{ + m_sio1->rxtxcb_w(state); + m_sio2->rxca_w(state); + m_sio2->txca_w(state); +} + +WRITE_LINE_MEMBER( aussiebyte_state::ctc_z2_w ) +{ + m_sio2->rxtxcb_w(state); + m_ctc->trg3(1); + m_ctc->trg3(0); +} + +/*********************************************************** + + Centronics ack + +************************************************************/ +WRITE_LINE_MEMBER( aussiebyte_state::write_centronics_busy ) +{ + m_centronics_busy = state; +} + +/*********************************************************** + + Speech ack + +************************************************************/ +WRITE_LINE_MEMBER( aussiebyte_state::votrax_w ) +{ + m_port28 = state; +} + + +/*********************************************************** + + Floppy Disk + +************************************************************/ + +WRITE_LINE_MEMBER( aussiebyte_state::fdc_intrq_w ) +{ + UINT8 data = (m_port19 & 0xbf) | (state ? 0x40 : 0); + m_port19 = data; +} + +WRITE_LINE_MEMBER( aussiebyte_state::fdc_drq_w ) +{ + UINT8 data = (m_port19 & 0x7f) | (state ? 0x80 : 0); + m_port19 = data; + state ^= 1; // inverter on pin38 of fdc + m_port17_rdy = (m_port17_rdy & 0xfe) | (UINT8)state; + if (m_port17 == 0) + m_dma->rdy_w(state); +} + +static SLOT_INTERFACE_START( aussiebyte_floppies ) + SLOT_INTERFACE( "drive0", FLOPPY_525_QD ) + SLOT_INTERFACE( "drive1", FLOPPY_525_QD ) +SLOT_INTERFACE_END + +/*********************************************************** + + Machine Driver + +************************************************************/ +MACHINE_RESET_MEMBER( aussiebyte_state, aussiebyte ) +{ + m_port15 = false; + m_port17 = 0; + m_port17_rdy = 0; + m_port1a = 1; + m_alpha_address = 0; + m_graph_address = 0; + m_p_chargen = memregion("chargen")->base(); + m_p_videoram = memregion("vram")->base(); + m_p_attribram = memregion("aram")->base(); + membank("bankr0")->set_entry(16); // point at rom + membank("bankw0")->set_entry(1); // always write to ram + membank("bank1")->set_entry(2); + membank("bank2")->set_entry(3); + m_maincpu->reset(); +} + +static MACHINE_CONFIG_START( aussiebyte, aussiebyte_state ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", Z80, XTAL_16MHz / 4) + MCFG_CPU_PROGRAM_MAP(aussiebyte_map) + MCFG_CPU_IO_MAP(aussiebyte_io) + MCFG_CPU_CONFIG(daisy_chain_intf) + + MCFG_MACHINE_RESET_OVERRIDE(aussiebyte_state, aussiebyte ) + + /* video hardware */ + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(50) + MCFG_SCREEN_SIZE(640, 480) + MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + MCFG_SCREEN_UPDATE_DEVICE("crtc", sy6545_1_device, screen_update) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", crt8002) + MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + MCFG_DEVICE_ADD("votrax", VOTRAX_SC01, 720000) /* 720kHz? needs verify */ + MCFG_VOTRAX_SC01_REQUEST_CB(WRITELINE(aussiebyte_state, votrax_w)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + /* devices */ + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_DATA_INPUT_BUFFER("cent_data_in") + MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(aussiebyte_state, write_centronics_busy)) + MCFG_DEVICE_ADD("cent_data_in", INPUT_BUFFER, 0) + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + + MCFG_DEVICE_ADD("ctc", Z80CTC, XTAL_16MHz / 4) + MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80CTC_ZC0_CB(WRITELINE(aussiebyte_state, ctc_z0_w)) // SIO1 Ch A + MCFG_Z80CTC_ZC1_CB(WRITELINE(aussiebyte_state, ctc_z1_w)) // SIO1 Ch B, SIO2 Ch A + MCFG_Z80CTC_ZC2_CB(WRITELINE(aussiebyte_state, ctc_z2_w)) // SIO2 Ch B, CTC Ch 3 + + MCFG_DEVICE_ADD("dma", Z80DMA, XTAL_16MHz / 4) + MCFG_Z80DMA_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80DMA_OUT_BUSREQ_CB(WRITELINE(aussiebyte_state, busreq_w)) + // BAO, not used + MCFG_Z80DMA_IN_MREQ_CB(READ8(aussiebyte_state, memory_read_byte)) + MCFG_Z80DMA_OUT_MREQ_CB(WRITE8(aussiebyte_state, memory_write_byte)) + MCFG_Z80DMA_IN_IORQ_CB(READ8(aussiebyte_state, io_read_byte)) + MCFG_Z80DMA_OUT_IORQ_CB(WRITE8(aussiebyte_state, io_write_byte)) + + MCFG_DEVICE_ADD("pio1", Z80PIO, XTAL_16MHz / 4) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80PIO_OUT_PA_CB(DEVWRITE8("cent_data_out", output_latch_device, write)) + MCFG_Z80PIO_IN_PB_CB(DEVREAD8("cent_data_in", input_buffer_device, read)) + MCFG_Z80PIO_OUT_ARDY_CB(DEVWRITELINE("centronics", centronics_device, write_strobe)) MCFG_DEVCB_INVERT + + MCFG_DEVICE_ADD("pio2", Z80PIO, XTAL_16MHz / 4) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80PIO_OUT_PA_CB(WRITE8(aussiebyte_state, port20_w)) + + MCFG_Z80SIO0_ADD("sio1", XTAL_16MHz / 4, 0, 0, 0, 0) + MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80DART_OUT_WRDYA_CB(WRITELINE(aussiebyte_state, sio1_rdya_w)) + MCFG_Z80DART_OUT_WRDYB_CB(WRITELINE(aussiebyte_state, sio1_rdyb_w)) + + MCFG_Z80SIO0_ADD("sio2", XTAL_16MHz / 4, 0, 0, 0, 0) + MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + MCFG_Z80DART_OUT_WRDYA_CB(WRITELINE(aussiebyte_state, sio2_rdya_w)) + MCFG_Z80DART_OUT_WRDYB_CB(WRITELINE(aussiebyte_state, sio2_rdyb_w)) + MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE("rs232", rs232_port_device, write_txd)) + MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE("rs232", rs232_port_device, write_dtr)) + MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE("rs232", rs232_port_device, write_rts)) + + MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "keyboard") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("sio2", z80sio0_device, rxa_w)) + + MCFG_WD2797_ADD("fdc", XTAL_16MHz / 16) + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(aussiebyte_state, fdc_intrq_w)) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(aussiebyte_state, fdc_drq_w)) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", aussiebyte_floppies, "drive0", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", aussiebyte_floppies, "drive1", floppy_image_device::default_floppy_formats) + + /* devices */ + MCFG_MC6845_ADD("crtc", SY6545_1, "screen", XTAL_16MHz / 8) + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_UPDATE_ROW_CB(aussiebyte_state, crtc_update_row) + MCFG_MC6845_ADDR_CHANGED_CB(aussiebyte_state, crtc_update_addr) + + MCFG_MSM5832_ADD("rtc", XTAL_32_768kHz) + MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc_tick", aussiebyte_state, ctc_tick, attotime::from_hz(XTAL_4_9152MHz / 4)) +MACHINE_CONFIG_END + + +DRIVER_INIT_MEMBER( aussiebyte_state, aussiebyte ) +{ + // Main ram is divided into 16k blocks (0-15). The boot rom is block number 16. + // For convenience, bank 0 is permanently assigned to C000-FFFF + UINT8 *main = memregion("roms")->base(); + UINT8 *ram = memregion("mram")->base(); + + membank("bankr0")->configure_entries(0, 16, &ram[0x0000], 0x4000); + membank("bankw0")->configure_entries(0, 16, &ram[0x0000], 0x4000); + membank("bank1")->configure_entries(0, 16, &ram[0x0000], 0x4000); + membank("bank2")->configure_entries(0, 16, &ram[0x0000], 0x4000); + membank("bankr0")->configure_entry(16, &main[0x0000]); +} + + +/*********************************************************** + + Game driver + +************************************************************/ + + +ROM_START(aussieby) + ROM_REGION(0x4000, "roms", 0) // Size of bank 16 + ROM_LOAD( "knight_boot_0000.u27", 0x0000, 0x1000, CRC(1f200437) SHA1(80d1d208088b325c16a6824e2da605fb2b00c2ce) ) + + ROM_REGION(0x800, "chargen", 0) + ROM_LOAD( "8002.bin", 0x0000, 0x0800, CRC(fdd6eb13) SHA1(a094d416e66bdab916e72238112a6265a75ca690) ) + + ROM_REGION(0x40000, "mram", ROMREGION_ERASE00) // main ram, 256k dynamic + ROM_REGION(0x10000, "vram", ROMREGION_ERASEFF) // video ram, 64k dynamic + ROM_REGION(0x00800, "aram", ROMREGION_ERASEFF) // attribute ram, 2k static +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1984, aussieby, 0, 0, aussiebyte, aussiebyte, aussiebyte_state, aussiebyte, "SME Systems", "Aussie Byte II" , MACHINE_IMPERFECT_GRAPHICS ) diff --git a/src/mess/drivers/bebox.c b/src/mess/drivers/bebox.c index 899e1f783c8..cd3aec4c163 100644 --- a/src/mess/drivers/bebox.c +++ b/src/mess/drivers/bebox.c @@ -17,23 +17,15 @@ #include "bus/lpci/cirrus.h" #include "cpu/powerpc/ppc.h" #include "sound/3812intf.h" -#include "machine/ins8250.h" -#include "machine/pic8259.h" #include "machine/mc146818.h" -#include "bus/lpci/pci.h" -#include "machine/am9517a.h" #include "machine/pckeybrd.h" -#include "machine/idectrl.h" #include "bus/lpci/mpc105.h" -#include "machine/intelfsh.h" #include "bus/scsi/scsi.h" -#include "machine/53c810.h" /* Devices */ #include "bus/scsi/scsicd.h" #include "bus/scsi/scsihd.h" #include "formats/pc_dsk.h" -#include "machine/ram.h" #include "machine/8042kbdc.h" READ8_MEMBER(bebox_state::at_dma8237_1_r) { return m_dma8237_2->read(space, offset / 2); } @@ -80,15 +72,13 @@ ADDRESS_MAP_END READ64_MEMBER(bebox_state::bb_slave_64be_r) { - pci_bus_device *device = machine().device<pci_bus_device>("pcibus"); - // 2e94 is the real address, 2e84 is where the PC appears to be under full DRC if ((space.device().safe_pc() == 0xfff02e94) || (space.device().safe_pc() == 0xfff02e84)) { return 0x108000ff; // indicate slave CPU } - return device->read_64be(space, offset, mem_mask); + return m_pcibus->read_64be(space, offset, mem_mask); } static ADDRESS_MAP_START( bebox_slave_mem, AS_PROGRAM, 64, bebox_state ) diff --git a/src/mess/drivers/c128.c b/src/mess/drivers/c128.c index 9ae7e3372ab..abe3f7bde8b 100644 --- a/src/mess/drivers/c128.c +++ b/src/mess/drivers/c128.c @@ -963,11 +963,11 @@ READ8_MEMBER( c128_state::cia1_pa_r ) bit description - PA0 COL0, JOY B0 - PA1 COL1, JOY B1 - PA2 COL2, JOY B2 - PA3 COL3, JOY B3 - PA4 COL4, BTNB + PA0 COL0, JOYB0 + PA1 COL1, JOYB1 + PA2 COL2, JOYB2 + PA3 COL3, JOYB3 + PA4 COL4, FBTNB PA5 COL5 PA6 COL6 PA7 COL7 @@ -1005,20 +1005,40 @@ READ8_MEMBER( c128_state::cia1_pa_r ) return data; } +WRITE8_MEMBER( c128_state::cia1_pa_w ) +{ + /* + + bit description + + PA0 COL0, JOYB0 + PA1 COL1, JOYB1 + PA2 COL2, JOYB2 + PA3 COL3, JOYB3 + PA4 COL4, FBTNB + PA5 COL5 + PA6 COL6 + PA7 COL7 + + */ + + m_joy2->joy_w(data & 0x1f); +} + READ8_MEMBER( c128_state::cia1_pb_r ) { /* bit description - PB0 JOY A0 - PB1 JOY A1 - PB2 JOY A2 - PB3 JOY A3 - PB4 BTNA/_LP - PB5 - PB6 - PB7 + PB0 ROW0, JOYA0 + PB1 ROW1, JOYA1 + PB2 ROW2, JOYA2 + PB3 ROW3, JOYA3 + PB4 ROW4, FBTNA, _LP + PB5 ROW5 + PB6 ROW6 + PB7 ROW7 */ @@ -1055,17 +1075,19 @@ WRITE8_MEMBER( c128_state::cia1_pb_w ) bit description - PB0 ROW0 - PB1 ROW1 - PB2 ROW2 - PB3 ROW3 - PB4 ROW4 + PB0 ROW0, JOYA0 + PB1 ROW1, JOYA1 + PB2 ROW2, JOYA2 + PB3 ROW3, JOYA3 + PB4 ROW4, FBTNA, _LP PB5 ROW5 PB6 ROW6 PB7 ROW7 */ + m_joy1->joy_w(data & 0x1f); + m_vic->lp_w(BIT(data, 4)); } @@ -1487,6 +1509,7 @@ static MACHINE_CONFIG_START( ntsc, c128_state ) MCFG_MOS6526_CNT_CALLBACK(WRITELINE(c128_state, cia1_cnt_w)) MCFG_MOS6526_SP_CALLBACK(WRITELINE(c128_state, cia1_sp_w)) MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(c128_state, cia1_pa_r)) + MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(c128_state, cia1_pa_w)) MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(c128_state, cia1_pb_r)) MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(c128_state, cia1_pb_w)) MCFG_DEVICE_ADD(MOS6526_2_TAG, MOS6526, XTAL_14_31818MHz*2/3.5/8) @@ -1659,6 +1682,7 @@ static MACHINE_CONFIG_START( pal, c128_state ) MCFG_MOS6526_CNT_CALLBACK(WRITELINE(c128_state, cia1_cnt_w)) MCFG_MOS6526_SP_CALLBACK(WRITELINE(c128_state, cia1_sp_w)) MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(c128_state, cia1_pa_r)) + MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(c128_state, cia1_pa_w)) MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(c128_state, cia1_pb_r)) MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(c128_state, cia1_pb_w)) MCFG_DEVICE_ADD(MOS6526_2_TAG, MOS6526, XTAL_17_734472MHz*2/4.5/8) diff --git a/src/mess/drivers/c64.c b/src/mess/drivers/c64.c index b65ae1a072a..56aaf5966da 100644 --- a/src/mess/drivers/c64.c +++ b/src/mess/drivers/c64.c @@ -625,20 +625,40 @@ READ8_MEMBER( c64_state::cia1_pa_r ) return data; } +WRITE8_MEMBER( c64_state::cia1_pa_w ) +{ + /* + + bit description + + PA0 COL0, JOY B0 + PA1 COL1, JOY B1 + PA2 COL2, JOY B2 + PA3 COL3, JOY B3 + PA4 COL4, BTNB + PA5 COL5 + PA6 COL6 + PA7 COL7 + + */ + + m_joy2->joy_w(data & 0x1f); +} + READ8_MEMBER( c64_state::cia1_pb_r ) { /* bit description - PB0 JOY A0 - PB1 JOY A1 - PB2 JOY A2 - PB3 JOY A3 - PB4 BTNA/_LP - PB5 - PB6 - PB7 + PB0 ROW0, JOY A0 + PB1 ROW1, JOY A1 + PB2 ROW2, JOY A2 + PB3 ROW3, JOY A3 + PB4 ROW4, BTNA, _LP + PB5 ROW5 + PB6 ROW6 + PB7 ROW7 */ @@ -671,17 +691,19 @@ WRITE8_MEMBER( c64_state::cia1_pb_w ) bit description - PB0 ROW0 - PB1 ROW1 - PB2 ROW2 - PB3 ROW3 - PB4 ROW4 + PB0 ROW0, JOY A0 + PB1 ROW1, JOY A1 + PB2 ROW2, JOY A2 + PB3 ROW3, JOY A3 + PB4 ROW4, BTNA, _LP PB5 ROW5 PB6 ROW6 PB7 ROW7 */ + m_joy1->joy_w(data & 0x1f); + m_vic->lp_w(BIT(data, 4)); } @@ -1289,6 +1311,7 @@ static MACHINE_CONFIG_START( pal, c64_state ) MCFG_MOS6526_CNT_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_4)) MCFG_MOS6526_SP_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_5)) MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(c64_state, cia1_pa_r)) + MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(c64_state, cia1_pa_w)) MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(c64_state, cia1_pb_r)) MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(c64_state, cia1_pb_w)) MCFG_DEVICE_ADD(MOS6526_2_TAG, MOS6526, XTAL_17_734472MHz/18) @@ -1423,6 +1446,7 @@ static MACHINE_CONFIG_START( pal_gs, c64gs_state ) MCFG_MOS6526_CNT_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_4)) MCFG_MOS6526_SP_CALLBACK(DEVWRITELINE(PET_USER_PORT_TAG, pet_user_port_device, write_5)) MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(c64gs_state, cia1_pa_r)) + MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(c64_state, cia1_pa_w)) MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(c64gs_state, cia1_pb_r)) MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(c64_state, cia1_pb_w)) MCFG_DEVICE_ADD(MOS6526_2_TAG, MOS6526, XTAL_17_734472MHz/18) diff --git a/src/mess/drivers/coleco.c b/src/mess/drivers/coleco.c index 7f8d4be28d8..5f6c020e33c 100644 --- a/src/mess/drivers/coleco.c +++ b/src/mess/drivers/coleco.c @@ -70,12 +70,12 @@ READ8_MEMBER( coleco_state::paddle_1_r ) { - return m_joy_d7_state[0] | coleco_paddle_read(machine(), 0, m_joy_mode, m_joy_analog_state[0]); + return m_joy_d7_state[0] | coleco_paddle_read(0, m_joy_mode, m_joy_analog_state[0]); } READ8_MEMBER( coleco_state::paddle_2_r ) { - return m_joy_d7_state[1] | coleco_paddle_read(machine(), 1, m_joy_mode, m_joy_analog_state[1]); + return m_joy_d7_state[1] | coleco_paddle_read(1, m_joy_mode, m_joy_analog_state[1]); } WRITE8_MEMBER( coleco_state::paddle_off_w ) @@ -206,7 +206,7 @@ TIMER_CALLBACK_MEMBER(coleco_state::paddle_pulse_callback) TIMER_DEVICE_CALLBACK_MEMBER(coleco_state::paddle_update_callback) { // arbitrary timer for reading analog controls - coleco_scan_paddles(machine(), &m_joy_analog_reload[0], &m_joy_analog_reload[1]); + coleco_scan_paddles(&m_joy_analog_reload[0], &m_joy_analog_reload[1]); for (int port = 0; port < 2; port++) { @@ -229,6 +229,97 @@ READ8_MEMBER( coleco_state::cart_r ) return m_cart->bd_r(space, offset & 0x7fff, 0, 0, 0, 0, 0); } +UINT8 coleco_state::coleco_scan_paddles(UINT8 *joy_status0, UINT8 *joy_status1) +{ + UINT8 ctrl_sel = (m_ctrlsel != NULL) ? m_ctrlsel->read() : 0; + + /* which controller shall we read? */ + if ((ctrl_sel & 0x07) == 0x02) // Super Action Controller P1 + *joy_status0 = (m_sac_slide1 != NULL) ? m_sac_slide1->read() : 0; + else if ((ctrl_sel & 0x07) == 0x03) // Driving Controller P1 + *joy_status0 = (m_driv_wheel1 != NULL) ? m_driv_wheel1->read() : 0; + + if ((ctrl_sel & 0x70) == 0x20) // Super Action Controller P2 + *joy_status1 = (m_sac_slide2 != NULL) ? m_sac_slide2->read() : 0; + else if ((ctrl_sel & 0x70) == 0x30) // Driving Controller P2 + *joy_status1 = (m_driv_wheel2 != NULL) ? m_driv_wheel2->read() : 0; + + /* In principle, even if not supported by any game, I guess we could have two Super + Action Controllers plugged into the Roller controller ports. Since I found no info + about the behavior of sliders in such a configuration, we overwrite SAC sliders with + the Roller trackball inputs and actually use the latter ones, when both are selected. */ + if (ctrl_sel & 0x80) // Roller controller + { + *joy_status0 = (m_roller_x != NULL) ? m_roller_x->read() : 0; + *joy_status1 = (m_roller_y != NULL) ? m_roller_y->read() : 0; + } + + return *joy_status0 | *joy_status1; +} + + +UINT8 coleco_state::coleco_paddle_read(int port, int joy_mode, UINT8 joy_status) +{ + UINT8 ctrl_sel = (m_ctrlsel != NULL ) ? m_ctrlsel->read() : 0; + UINT8 ctrl_extra = ctrl_sel & 0x80; + ctrl_sel = ctrl_sel >> (port*4) & 7; + + /* Keypad and fire 1 (SAC Yellow Button) */ + if (joy_mode == 0) + { + /* No key pressed by default */ + UINT8 data = 0x0f; + UINT16 ipt = 0xffff; + + if (ctrl_sel == 0) // ColecoVision Controller + ipt = port ? m_std_keypad2->read() : m_std_keypad1->read(); + else if (ctrl_sel == 2) // Super Action Controller + ipt = port ? m_sac_keypad2->read() : m_sac_keypad1->read(); + + /* Numeric pad buttons are not independent on a real ColecoVision, if you push more + than one, a real ColecoVision think that it is a third button, so we are going to emulate + the right behaviour */ + /* Super Action Controller additional buttons are read in the same way */ + if (!(ipt & 0x0001)) data &= 0x0a; /* 0 */ + if (!(ipt & 0x0002)) data &= 0x0d; /* 1 */ + if (!(ipt & 0x0004)) data &= 0x07; /* 2 */ + if (!(ipt & 0x0008)) data &= 0x0c; /* 3 */ + if (!(ipt & 0x0010)) data &= 0x02; /* 4 */ + if (!(ipt & 0x0020)) data &= 0x03; /* 5 */ + if (!(ipt & 0x0040)) data &= 0x0e; /* 6 */ + if (!(ipt & 0x0080)) data &= 0x05; /* 7 */ + if (!(ipt & 0x0100)) data &= 0x01; /* 8 */ + if (!(ipt & 0x0200)) data &= 0x0b; /* 9 */ + if (!(ipt & 0x0400)) data &= 0x06; /* # */ + if (!(ipt & 0x0800)) data &= 0x09; /* * */ + if (!(ipt & 0x1000)) data &= 0x04; /* Blue Action Button */ + if (!(ipt & 0x2000)) data &= 0x08; /* Purple Action Button */ + + return ((ipt & 0x4000) >> 8) | 0x30 | data; + } + /* Joystick and fire 2 (SAC Red Button) */ + else + { + UINT8 data = 0x7f; + + if (ctrl_sel == 0) // ColecoVision Controller + data = port ? m_std_joy2->read() : m_std_joy1->read(); + else if (ctrl_sel == 2) // Super Action Controller + data = port ? m_sac_joy2->read() : m_sac_joy1->read(); + else if (ctrl_sel == 3) // Driving Controller + data = port ? m_driv_pedal2->read() : m_driv_pedal1->read(); + + /* If any extra analog contoller enabled */ + if (ctrl_extra || ctrl_sel == 2 || ctrl_sel == 3) + { + if (joy_status & 0x80) data ^= 0x30; + else if (joy_status) data ^= 0x10; + } + + return data & 0x7f; + } +} + void coleco_state::machine_start() { memset(m_ram, 0xff, m_ram.bytes()); // initialize RAM diff --git a/src/mess/drivers/cybiko.c b/src/mess/drivers/cybiko.c index 48db13a52ee..a3a4bd2864e 100644 --- a/src/mess/drivers/cybiko.c +++ b/src/mess/drivers/cybiko.c @@ -164,7 +164,7 @@ ADDRESS_MAP_END static INPUT_PORTS_START( cybiko ) - PORT_START("A1") + PORT_START("A.0") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Del") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) @@ -174,7 +174,7 @@ static INPUT_PORTS_START( cybiko ) PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CHAR('`') PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_START("A2") + PORT_START("A.1") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("As") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) @@ -184,7 +184,7 @@ static INPUT_PORTS_START( cybiko ) PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Fn") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_START("A3") + PORT_START("A.2") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') @@ -194,7 +194,7 @@ static INPUT_PORTS_START( cybiko ) PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Help") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) - PORT_START("A4") + PORT_START("A.3") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') @@ -204,7 +204,7 @@ static INPUT_PORTS_START( cybiko ) PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_START("A5") + PORT_START("A.4") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Select") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) @@ -214,7 +214,7 @@ static INPUT_PORTS_START( cybiko ) PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') - PORT_START("A6") + PORT_START("A.5") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR( 13 ) @@ -224,7 +224,7 @@ static INPUT_PORTS_START( cybiko ) PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - PORT_START("A7") + PORT_START("A.6") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("BkSp") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) @@ -233,7 +233,7 @@ static INPUT_PORTS_START( cybiko ) PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_START("A8") + PORT_START("A.7") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CHAR('.') PORT_CHAR('>') PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') @@ -242,7 +242,7 @@ static INPUT_PORTS_START( cybiko ) PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_START("A9") + PORT_START("A.8") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') @@ -254,7 +254,7 @@ static INPUT_PORTS_START( cybiko ) INPUT_PORTS_END static INPUT_PORTS_START( cybikoxt ) - PORT_START("A1") + PORT_START("A.0") PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') @@ -262,7 +262,7 @@ static INPUT_PORTS_START( cybikoxt ) PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_START("A2") + PORT_START("A.1") PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') @@ -272,7 +272,7 @@ static INPUT_PORTS_START( cybikoxt ) PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_START("A3") + PORT_START("A.2") PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') @@ -281,7 +281,7 @@ static INPUT_PORTS_START( cybikoxt ) PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_START("A4") + PORT_START("A.3") PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') @@ -291,38 +291,38 @@ static INPUT_PORTS_START( cybikoxt ) PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_START("A5") + PORT_START("A.4") PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR( 13 ) PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Select") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_START("A6") + PORT_START("A.5") PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Del") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("As") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_START("A7") + PORT_START("A.6") PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_START("A8") + PORT_START("A.7") PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Fn") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_START("A9") + PORT_START("A.8") PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_START("A10") + PORT_START("A.13") PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Help") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CHAR('.') PORT_CHAR('>') PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_START("A15") + PORT_START("A.14") PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("On/Off") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) INPUT_PORTS_END diff --git a/src/mess/drivers/dvk_ksm.c b/src/mess/drivers/dvk_ksm.c index 118fdef57e7..36eaaa241fc 100644 --- a/src/mess/drivers/dvk_ksm.c +++ b/src/mess/drivers/dvk_ksm.c @@ -408,11 +408,11 @@ ROM_START( dvk_ksm01 ) ROM_LOAD( "ksm_05_rom1_d33.bin", 0x0800, 0x0800, CRC(5b29bcd2) SHA1(1f4f82c2f88f1e8615ec02076559dc606497e654)) ROM_REGION(0x0800, "chargen", ROMREGION_ERASE00) - ROM_LOAD("ksm_03_cg_d31.bin", 0x0000, 0x0800, CRC(98853aa7) SHA1(c7871a96f135db05c3c8d718fbdf1728e22e72b7)) + ROM_LOAD("ksm_03_cg_d31.bin", 0x0000, 0x0800, CRC(98853aa7) SHA1(09b8e1b5b10a00c0b0ae7e36ad1328113d31230a)) ROM_END /* Driver */ /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ COMP( 1986, dvk_ksm, 0, 0, ksm, ksm, driver_device, 0, "USSR", "DVK KSM", 0) -COMP( 198?, dvk_ksm01,0 , 0, ksm, ksm, driver_device, 0, "USSR", "DVK KSM-01", 0) +COMP( 198?, dvk_ksm01,dvk_ksm,0, ksm, ksm, driver_device, 0, "USSR", "DVK KSM-01", 0) diff --git a/src/mess/drivers/gamate.c b/src/mess/drivers/gamate.c index 2d54d0b4776..ad1e129e60c 100644 --- a/src/mess/drivers/gamate.c +++ b/src/mess/drivers/gamate.c @@ -25,6 +25,8 @@ public: , m_io_joy(*this, "JOY") , m_palette(*this, "palette") , m_bios(*this, "bios") + , m_bank(*this, "bank") + , m_bankmulti(*this, "bankmulti") { } DECLARE_PALETTE_INIT(gamate); @@ -77,6 +79,8 @@ private: required_ioport m_io_joy; required_device<palette_device> m_palette; required_shared_ptr<UINT8> m_bios; + required_memory_bank m_bank; + required_memory_bank m_bankmulti; emu_timer *timer1; emu_timer *timer2; UINT8 bank_multi; @@ -186,12 +190,12 @@ WRITE8_MEMBER( gamate_state::gamate_video_w ) WRITE8_MEMBER( gamate_state::cart_bankswitchmulti_w ) { bank_multi=data; - membank("bankmulti")->set_base(m_cart_ptr+0x4000*data+1); + m_bankmulti->set_base(m_cart_ptr+0x4000*data+1); } WRITE8_MEMBER( gamate_state::cart_bankswitch_w ) { - membank("bank")->set_base(m_cart_ptr+0x4000*data); + m_bank->set_base(m_cart_ptr+0x4000*data); } READ8_MEMBER( gamate_state::gamate_video_r ) @@ -322,8 +326,8 @@ void gamate_state::machine_start() { // m_maincpu->space(AS_PROGRAM).install_read_handler(0x6000, 0x6000, READ8_DELEGATE(gamate_state, gamate_cart_protection_r)); m_cart_ptr = m_cart->get_rom_base(); - membank("bankmulti")->set_base(m_cart->get_rom_base()+1); - membank("bank")->set_base(m_cart->get_rom_base()+0x4000); // bankswitched games in reality no offset + m_bankmulti->set_base(m_cart->get_rom_base()+1); + m_bank->set_base(m_cart->get_rom_base()+0x4000); // bankswitched games in reality no offset } // m_bios[0xdf1]=0xea; m_bios[0xdf2]=0xea; // default bios: $47 protection readback card_protection.set=false; @@ -382,7 +386,7 @@ static MACHINE_CONFIG_START( gamate, gamate_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD("custom", GAMATE_SND, 0) + MCFG_SOUND_ADD("custom", GAMATE_SND, 4433000/2) MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) diff --git a/src/mess/drivers/gba.c b/src/mess/drivers/gba.c index 60ffed0d525..08fc5a6e04f 100644 --- a/src/mess/drivers/gba.c +++ b/src/mess/drivers/gba.c @@ -34,7 +34,7 @@ INLINE void ATTR_PRINTF(3,4) verboselog(running_machine &machine, int n_level, c } } -#define GBA_ATTOTIME_NORMALIZE(a) do { while ((a).attoseconds >= ATTOSECONDS_PER_SECOND) { (a).seconds++; (a).attoseconds -= ATTOSECONDS_PER_SECOND; } } while (0) +#define GBA_ATTOTIME_NORMALIZE(a) a.normalize() static const UINT32 timer_clks[4] = { 16777216, 16777216/64, 16777216/256, 16777216/1024 }; diff --git a/src/mess/drivers/geneve.c b/src/mess/drivers/geneve.c index cf738540f11..8ec248d5fae 100644 --- a/src/mess/drivers/geneve.c +++ b/src/mess/drivers/geneve.c @@ -209,11 +209,12 @@ #include "machine/mm58274c.h" #include "sound/sn76496.h" -#include "machine/ti99/genboard.h" +#include "bus/ti99x/genboard.h" +#include "bus/ti99x/videowrp.h" +#include "bus/ti99x/joyport.h" + #include "bus/ti99_peb/peribox.h" -#include "machine/ti99/videowrp.h" -#include "machine/ti99/joyport.h" #define VERBOSE 1 #define LOG logerror diff --git a/src/mess/drivers/glasgow.c b/src/mess/drivers/glasgow.c index 733f64a9352..803fd591005 100644 --- a/src/mess/drivers/glasgow.c +++ b/src/mess/drivers/glasgow.c @@ -61,7 +61,9 @@ public: glasgow_state(const machine_config &mconfig, device_type type, const char *tag) : mboard_state(mconfig, type, tag), m_maincpu(*this, "maincpu"), - m_beep(*this, "beeper") + m_beep(*this, "beeper"), + m_line0(*this, "LINE0"), + m_line1(*this, "LINE1") { } required_device<cpu_device> m_maincpu; @@ -89,6 +91,8 @@ public: DECLARE_MACHINE_START(dallas32); TIMER_DEVICE_CALLBACK_MEMBER(update_nmi); TIMER_DEVICE_CALLBACK_MEMBER(update_nmi32); + required_ioport m_line0; + required_ioport m_line1; }; @@ -126,10 +130,10 @@ READ16_MEMBER( glasgow_state::glasgow_keys_r ) /* See if any keys pressed */ data = 3; - if (mboard_key_select == ioport("LINE0")->read()) + if (mboard_key_select == m_line0->read()) data &= 1; - if (mboard_key_select == ioport("LINE1")->read()) + if (mboard_key_select == m_line1->read()) data &= 2; return data << 8; @@ -188,9 +192,9 @@ READ16_MEMBER( glasgow_state::read_newkeys16 ) //Amsterdam, Roma UINT16 data; if (mboard_key_selector == 0) - data = ioport("LINE0")->read(); + data = m_line0->read(); else - data = ioport("LINE1")->read(); + data = m_line1->read(); logerror("read Keyboard Offset = %x Data = %x Select = %x \n", offset, data, mboard_key_selector); data <<= 8; @@ -251,10 +255,10 @@ READ32_MEMBER( glasgow_state::read_newkeys32 ) // Dallas 32, Roma 32 UINT32 data; if (mboard_key_selector == 0) - data = ioport("LINE0")->read(); + data = m_line0->read(); else - data = ioport("LINE1")->read(); - //if (mboard_key_selector == 1) data = machine.root_device().ioport("LINE0")->read(); else data = 0; + data = m_line1->read(); + //if (mboard_key_selector == 1) data = m_line0->read(); else data = 0; if(data) logerror("read Keyboard Offset = %x Data = %x\n", offset, data); data <<= 24; @@ -399,113 +403,16 @@ static INPUT_PORTS_START( old_keyboard ) //Glasgow,Dallas INPUT_PORTS_END -static INPUT_PORTS_START( board ) - PORT_START("LINE2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_START("LINE3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_START("LINE4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_START("LINE5") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_START("LINE6") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_START("LINE7") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_START("LINE8") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_START("LINE9") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) - - PORT_START("LINE10") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) - - PORT_START("B_WHITE") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) - - PORT_START("B_BLACK") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) - - PORT_START("B_BUTTONS") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) - -INPUT_PORTS_END +INPUT_PORTS_EXTERN( chessboard); static INPUT_PORTS_START( oldkeys ) PORT_INCLUDE( old_keyboard ) - PORT_INCLUDE( board ) + PORT_INCLUDE( chessboard ) INPUT_PORTS_END static INPUT_PORTS_START( newkeys ) PORT_INCLUDE( new_keyboard ) - PORT_INCLUDE( board ) + PORT_INCLUDE( chessboard ) INPUT_PORTS_END static MACHINE_CONFIG_START( glasgow, glasgow_state ) diff --git a/src/mess/drivers/hh_tms1k.c b/src/mess/drivers/hh_tms1k.c index 1f972ba67dc..adbc2595c0e 100644 --- a/src/mess/drivers/hh_tms1k.c +++ b/src/mess/drivers/hh_tms1k.c @@ -144,6 +144,7 @@ void hh_tms1k_state::machine_start() m_o = 0; m_r = 0; m_inp_mux = 0; + m_power_led = false; m_power_on = false; // register for savestates @@ -153,6 +154,7 @@ void hh_tms1k_state::machine_start() save_item(NAME(m_display_state)); /* save_item(NAME(m_display_cache)); */ // don't save! + /* save_item(NAME(m_power_led)); */ // don't save! save_item(NAME(m_display_decay)); save_item(NAME(m_display_segmask)); @@ -229,6 +231,13 @@ void hh_tms1k_state::display_update() } memcpy(m_display_cache, active_state, sizeof(m_display_cache)); + + // output optional power led + if (m_power_led != m_power_on) + { + m_power_led = m_power_on; + output_set_value("power_led", m_power_led ? 1 : 0); + } } TIMER_DEVICE_CALLBACK_MEMBER(hh_tms1k_state::display_decay_tick) diff --git a/src/mess/drivers/hh_ucom4.c b/src/mess/drivers/hh_ucom4.c index b1f016fa194..f0df7f66792 100644 --- a/src/mess/drivers/hh_ucom4.c +++ b/src/mess/drivers/hh_ucom4.c @@ -44,6 +44,8 @@ @209 uPD553C 1982, Tomy Caveman (TN-12) @258 uPD553C 1984, Tomy Alien Chase (TN-16) + @512 uPD557LC 1980, Castle Toy Tactix + *060 uPD650C 1979, Mattel Computer Gin *085 uPD650C 1980, Roland TR-808 *127 uPD650C 198?, Sony OA-S1100 Typecorder (subcpu, have dump) @@ -52,6 +54,11 @@ (* denotes not yet emulated by MAME, @ denotes it's in this driver) + +TODO: + - games that rely on the fact that faster/longer strobed elements appear brighter: + tactix(player 2) + ***************************************************************************/ #include "includes/hh_ucom4.h" @@ -59,6 +66,7 @@ // internal artwork #include "efball.lh" #include "mvbfree.lh" +#include "tactix.lh" // clickable #include "hh_ucom4_test.lh" // common test-layout - use external artwork @@ -958,6 +966,125 @@ MACHINE_CONFIG_END /*************************************************************************** + Castle Toy Tactix + * NEC uCOM-43 MCU, labeled D557LC 512 + * 16 LEDs behind buttons + + Tactix is similar to Merlin, for 1 or 2 players. In 2-player mode, simply + don't press the Comp Turn button. The four included minigames are: + 1: Capture (reversi) + 2: Jump-Off (peg solitaire) + 3: Triple Play (3 in a row) + 4: Concentration (memory) + + note: MAME external artwork is not needed for this game + +***************************************************************************/ + +class tactix_state : public hh_ucom4_state +{ +public: + tactix_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_ucom4_state(mconfig, type, tag) + { } + + DECLARE_WRITE8_MEMBER(leds_w); + DECLARE_WRITE8_MEMBER(speaker_w); + DECLARE_WRITE8_MEMBER(input_w); + DECLARE_READ8_MEMBER(input_r); +}; + +// handlers + +WRITE8_MEMBER(tactix_state::leds_w) +{ + // D,F: 4*4 led matrix + m_port[offset] = data; + display_matrix(4, 4, m_port[NEC_UCOM4_PORTD], m_port[NEC_UCOM4_PORTF]); +} + +WRITE8_MEMBER(tactix_state::speaker_w) +{ + // G0: speaker out + m_speaker->level_w(data & 1); +} + +WRITE8_MEMBER(tactix_state::input_w) +{ + // C,E0: input mux + m_port[offset] = data; + m_inp_mux = (m_port[NEC_UCOM4_PORTE] << 4 & 0x10) | m_port[NEC_UCOM4_PORTC]; +} + +READ8_MEMBER(tactix_state::input_r) +{ + // A: multiplexed inputs + return read_inputs(5); +} + + +// config + +static INPUT_PORTS_START( tactix ) + PORT_START("IN.0") // C0 port A + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_1) PORT_NAME("Button 1") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_Q) PORT_NAME("Button 5") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_A) PORT_NAME("Button 9") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_Z) PORT_NAME("Button 13") + + PORT_START("IN.1") // C1 port A + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_2) PORT_NAME("Button 2") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_W) PORT_NAME("Button 6") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_S) PORT_NAME("Button 10") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_X) PORT_NAME("Button 14") + + PORT_START("IN.2") // C2 port A + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_3) PORT_NAME("Button 3") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_E) PORT_NAME("Button 7") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_D) PORT_NAME("Button 11") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_C) PORT_NAME("Button 15") + + PORT_START("IN.3") // C3 port A + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_4) PORT_NAME("Button 4") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_R) PORT_NAME("Button 8") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_F) PORT_NAME("Button 12") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_V) PORT_NAME("Button 16") + + PORT_START("IN.4") // E0 port A + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_ENTER) PORT_NAME("New Game") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_T) PORT_NAME("Comp Turn") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) +INPUT_PORTS_END + +static MACHINE_CONFIG_START( tactix, tactix_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", NEC_D557L, 400000) // approximation + MCFG_UCOM4_READ_A_CB(READ8(tactix_state, input_r)) + MCFG_UCOM4_WRITE_C_CB(WRITE8(tactix_state, input_w)) + MCFG_UCOM4_WRITE_D_CB(WRITE8(tactix_state, leds_w)) + MCFG_UCOM4_WRITE_E_CB(WRITE8(tactix_state, input_w)) + MCFG_UCOM4_WRITE_F_CB(WRITE8(tactix_state, leds_w)) + MCFG_UCOM4_WRITE_G_CB(WRITE8(tactix_state, speaker_w)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_tactix) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + +/*************************************************************************** + Epoch Invader From Space (manufactured in Japan) * PCB labels 36010(A/B) * NEC uCOM-44 MCU, labeled D552C 054 @@ -2319,6 +2446,12 @@ ROM_START( bcclimbr ) ROM_END +ROM_START( tactix ) + ROM_REGION( 0x0800, "maincpu", 0 ) + ROM_LOAD( "d557lc-512", 0x0000, 0x0800, CRC(1df738cb) SHA1(15a5de28a3c03e6894d29c56b5b424983569ccf2) ) +ROM_END + + ROM_START( invspace ) ROM_REGION( 0x0400, "maincpu", 0 ) ROM_LOAD( "d552c-054", 0x0000, 0x0400, CRC(913d9c13) SHA1(f20edb5458e54d2f6d4e45e5d59efd87e05a6f3f) ) @@ -2401,6 +2534,8 @@ CONS( 1980, splasfgt, 0, 0, splasfgt, splasfgt, driver_device, 0, "Bambin CONS( 1982, bcclimbr, 0, 0, bcclimbr, bcclimbr, driver_device, 0, "Bandai", "Crazy Climber (Bandai)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) +CONS( 1980, tactix, 0, 0, tactix, tactix, driver_device, 0, "Castle Toy", "Tactix", MACHINE_SUPPORTS_SAVE ) + CONS( 1980, invspace, 0, 0, invspace, invspace, driver_device, 0, "Epoch", "Invader From Space", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) CONS( 1980, efball, 0, 0, efball, efball, driver_device, 0, "Epoch", "Electronic Football (Epoch)", MACHINE_SUPPORTS_SAVE ) CONS( 1981, galaxy2, 0, 0, galaxy2, galaxy2, driver_device, 0, "Epoch", "Galaxy II", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) diff --git a/src/mess/drivers/laser3k.c b/src/mess/drivers/laser3k.c index b157da73fd5..a7a3fa3bfa3 100644 --- a/src/mess/drivers/laser3k.c +++ b/src/mess/drivers/laser3k.c @@ -529,7 +529,7 @@ void laser3k_state::text_update(screen_device &screen, bitmap_ind16 &bitmap, con start_address = (m_disp_page == 0) ? 0x400 : 0x800; } - m_flash = ((machine().time() * 4).seconds & 1) ? 1 : 0; + m_flash = ((machine().time() * 4).seconds() & 1) ? 1 : 0; beginrow = MAX(beginrow, cliprect.min_y - (cliprect.min_y % 8)); endrow = MIN(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7); diff --git a/src/mess/drivers/mac.c b/src/mess/drivers/mac.c index 56a4c7f95a8..5ba63ada537 100644 --- a/src/mess/drivers/mac.c +++ b/src/mess/drivers/mac.c @@ -202,7 +202,7 @@ READ8_MEMBER( mac_state::mac_sonora_vctl_r ) if (offset == 2) { // printf("Sonora: read monitor ID at PC=%x\n", m_maincpu->pc()); - return (m_montype->read_safe(6)<<4); + return ((m_montype ? m_montype->read() : 6)<<4); } return m_sonora_vctl[offset]; diff --git a/src/mess/drivers/megadriv.c b/src/mess/drivers/megadriv.c index 34e17a29190..63164a11d0f 100644 --- a/src/mess/drivers/megadriv.c +++ b/src/mess/drivers/megadriv.c @@ -54,14 +54,14 @@ READ8_MEMBER(md_cons_state::mess_md_io_read_data_port) { /* here we read B, C & the additional buttons */ retdata = (m_megadrive_io_data_regs[portnum] & helper_6b) | - (((m_io_pad6b[0][portnum]->read_safe(0) & 0x30) | - (m_io_pad6b[1][portnum]->read_safe(0) & 0x0f)) & ~helper_6b); + ((((m_io_pad6b[0][portnum] ? m_io_pad6b[0][portnum]->read() : 0) & 0x30) | + ((m_io_pad6b[1][portnum] ? m_io_pad6b[1][portnum]->read() : 0) & 0x0f)) & ~helper_6b); } else { /* here we read B, C & the directional buttons */ retdata = (m_megadrive_io_data_regs[portnum] & helper_6b) | - ((m_io_pad6b[0][portnum]->read_safe(0) & 0x3f) & ~helper_6b); + (((m_io_pad6b[0][portnum] ? m_io_pad6b[0][portnum]->read() : 0) & 0x3f) & ~helper_6b); } } else @@ -70,20 +70,20 @@ READ8_MEMBER(md_cons_state::mess_md_io_read_data_port) { /* here we read ((Start & A) >> 2) | 0x00 */ retdata = (m_megadrive_io_data_regs[portnum] & helper_6b) | - (((m_io_pad6b[0][portnum]->read_safe(0) & 0xc0) >> 2) & ~helper_6b); + ((((m_io_pad6b[0][portnum] ? m_io_pad6b[0][portnum]->read() : 0) & 0xc0) >> 2) & ~helper_6b); } else if (m_io_stage[portnum]==2) { /* here we read ((Start & A) >> 2) | 0x0f */ retdata = (m_megadrive_io_data_regs[portnum] & helper_6b) | - ((((m_io_pad6b[0][portnum]->read_safe(0) & 0xc0) >> 2) | 0x0f) & ~helper_6b); + (((((m_io_pad6b[0][portnum] ? m_io_pad6b[0][portnum]->read() : 0) & 0xc0) >> 2) | 0x0f) & ~helper_6b); } else { /* here we read ((Start & A) >> 2) | Up and Down */ retdata = (m_megadrive_io_data_regs[portnum] & helper_6b) | - ((((m_io_pad6b[0][portnum]->read_safe(0) & 0xc0) >> 2) | - (m_io_pad6b[0][portnum]->read_safe(0) & 0x03)) & ~helper_6b); + (((((m_io_pad6b[0][portnum] ? m_io_pad6b[0][portnum]->read() : 0) & 0xc0) >> 2) | + ((m_io_pad6b[0][portnum] ? m_io_pad6b[0][portnum]->read() : 0) & 0x03)) & ~helper_6b); } } @@ -107,14 +107,14 @@ READ8_MEMBER(md_cons_state::mess_md_io_read_data_port) { /* here we read B, C & the directional buttons */ retdata = (m_megadrive_io_data_regs[portnum] & helper_3b) | - (((m_io_pad3b[portnum]->read_safe(0) & 0x3f) | 0x40) & ~helper_3b); + ((((m_io_pad3b[portnum] ? m_io_pad3b[portnum]->read() : 0) & 0x3f) | 0x40) & ~helper_3b); } else { /* here we read ((Start & A) >> 2) | Up and Down */ retdata = (m_megadrive_io_data_regs[portnum] & helper_3b) | - ((((m_io_pad3b[portnum]->read_safe(0) & 0xc0) >> 2) | - (m_io_pad3b[portnum]->read_safe(0) & 0x03) | 0x40) & ~helper_3b); + (((((m_io_pad3b[portnum] ? m_io_pad3b[portnum]->read() : 0) & 0xc0) >> 2) | + ((m_io_pad3b[portnum] ? m_io_pad3b[portnum]->read() : 0) & 0x03) | 0x40) & ~helper_3b); } } @@ -311,7 +311,7 @@ MACHINE_RESET_MEMBER(md_cons_state, ms_megadriv) // same as screen_eof_megadriv but with addition of 32x and SegaCD/MegaCD pieces void md_cons_state::screen_eof_console(screen_device &screen, bool state) { - if (m_io_reset->read_safe(0x00) & 0x01) + if (m_io_reset && (m_io_reset->read() & 0x01)) m_maincpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE); // rising edge diff --git a/src/mess/drivers/mephisto.c b/src/mess/drivers/mephisto.c index c352fade921..faf3cd69797 100644 --- a/src/mess/drivers/mephisto.c +++ b/src/mess/drivers/mephisto.c @@ -251,103 +251,7 @@ static ADDRESS_MAP_START( mm2_mem, AS_PROGRAM, 8, mephisto_state ) AM_RANGE( 0x8000, 0xffff) AM_ROM ADDRESS_MAP_END -static INPUT_PORTS_START( board ) - PORT_START("LINE2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_START("LINE3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_START("LINE4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_START("LINE5") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_START("LINE6") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_START("LINE7") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_START("LINE8") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_START("LINE9") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) - - PORT_START("LINE10") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) - - PORT_START("B_WHITE") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) - - PORT_START("B_BLACK") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) - - PORT_START("B_BUTTONS") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) -INPUT_PORTS_END +INPUT_PORTS_EXTERN( chessboard ); static INPUT_PORTS_START( mephisto ) PORT_START("KEY1_0") //Port $2c00 @@ -384,7 +288,7 @@ static INPUT_PORTS_START( mephisto ) PORT_START("KEY2_7") //Port $2c0f PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D 4") PORT_CODE(KEYCODE_D) PORT_CODE(KEYCODE_4) - PORT_INCLUDE( board ) + PORT_INCLUDE( chessboard ) INPUT_PORTS_END diff --git a/src/mess/drivers/msx.c b/src/mess/drivers/msx.c index 5827edb4e6c..d6d03b292d3 100644 --- a/src/mess/drivers/msx.c +++ b/src/mess/drivers/msx.c @@ -22,8 +22,8 @@ ** ** ** Todo/known issues: -** - piopx7/piopx7uk/piopxv60: Laserdisc integration doesn't exist -** - piopx7: Is this a pal or an ntsc machine? +** - piopx7/piopx7uk/piopxv60: Pioneer System Remote (home entertainment/Laserdisc control) not implemented +** - piopx7: Dump is from a PAL (EU/AU) machine, we have no known good dumps from JP or US NTSC machines ** - spc800: Haven't been able to test operation of the han rom yet ** - svi728: Expansion slot not emulated ** - svi738: v9938 not emulated @@ -1500,7 +1500,7 @@ static MACHINE_CONFIG_START( msx2, msx_state ) MCFG_I8255_OUT_PORTC_CB(WRITE8(msx_state, msx_ppi_port_c_w)) /* video hardware */ - MCFG_V9938_ADD("v9938", "screen", 0x20000) + MCFG_V9938_ADD("v9938", "screen", 0x20000, XTAL_21_4772MHz) MCFG_V99X8_INTERRUPT_CALLBACK(WRITELINE(msx_state,msx_irq_source0)) MCFG_SCREEN_ADD("screen", RASTER) @@ -1565,7 +1565,7 @@ static MACHINE_CONFIG_START( msx2p, msx_state ) MCFG_I8255_OUT_PORTC_CB(WRITE8(msx_state, msx_ppi_port_c_w)) /* video hardware */ - MCFG_V9958_ADD("v9958", "screen", 0x20000) + MCFG_V9958_ADD("v9958", "screen", 0x20000, XTAL_21_4772MHz) MCFG_V99X8_INTERRUPT_CALLBACK(WRITELINE(msx_state,msx_irq_source0)) MCFG_SCREEN_ADD("screen", RASTER) @@ -2942,10 +2942,29 @@ ROM_START (piopx7) ROM_END static MACHINE_CONFIG_DERIVED( piopx7, msx_pal ) - // AY8910/YM2149? + // TMS9129NL VDP with sync/overlay interface + // AY-3-8910 PSG + // Pioneer System Remote (SR) system control interface // FDC: None, 0 drives // 2 Cartridge slots - // TMS9928 is this were an ntsc machine + + // Line-level stereo audio input can be mixed with sound output, balance controlled with slider on front panel + // Front-panel switch allows audio input to be passed through bypassing the mixing circuit + // Line input can be muted under software control, e.g. when loading data from Laserdisc + // Right channel of line input is additionally routed via some signal processing to the cassette input for loading data from Laserdisc + + // PSG port B bits 0-5 can be used to drive controller pins 1-6, 1-7, 2-6, 2-7, 1-8 and 2-8 low if 0 is written + + // Slot #2 7FFE is the SR control register LCON + // Bit 7 R = /ACK (significant with acknowledge 1->0 with respect to remote control signal transmission) + // Bit 0 R = RMCLK (clock produced by dividing CLK1/CLK2 frequency by 128) + // Bit 0 W = /REM (high output with bit serial data output generated in synchronisation with RMCLK) + + // Slot #2 7FFF is the video overlay control register VCON + // Bit 7 R = /EXTV (low when external video input available; high when not available) + // Bit 7 W = Mute (line input signal muting) + // Bit 0 R = INTEXV (interrupt available when external video signal OFF, reset on read) + // Bit 0 W = /OVERLAY (0 = superimpose, 1 = non-superimpose) MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000) MCFG_MSX_LAYOUT_RAM("ram", 0, 0, 2, 2) /* 32KB RAM */ diff --git a/src/mess/drivers/mz2000.c b/src/mess/drivers/mz2000.c index 5d90b145a31..1fa43c6fcd6 100644 --- a/src/mess/drivers/mz2000.c +++ b/src/mess/drivers/mz2000.c @@ -586,20 +586,6 @@ void mz2000_state::machine_reset() m_color_mode = m_io_config->read() & 1; m_has_fdc = (m_io_config->read() & 2) >> 1; m_hi_mode = (m_io_config->read() & 4) >> 2; - - { - int i; - int r,g,b; - - for(i=0;i<8;i++) - { - r = (m_color_mode) ? (i & 2)>>1 : 0; - g = (m_color_mode) ? (i & 4)>>2 : ((i) ? 1 : 0); - b = (m_color_mode) ? (i & 1)>>0 : 0; - - m_palette->set_pen_color(i,pal1bit(r),pal1bit(g),pal1bit(b)); - } - } } @@ -859,7 +845,7 @@ static MACHINE_CONFIG_START( mz2000, mz2000_state ) MCFG_SCREEN_PALETTE("palette") MCFG_GFXDECODE_ADD("gfxdecode", "palette", mz2000) - MCFG_PALETTE_ADD("palette", 8) + MCFG_PALETTE_ADD_3BIT_BRG("palette") MCFG_SPEAKER_STANDARD_MONO("mono") diff --git a/src/mess/drivers/mz2500.c b/src/mess/drivers/mz2500.c index 837a6f833db..9e30a8c2ac5 100644 --- a/src/mess/drivers/mz2500.c +++ b/src/mess/drivers/mz2500.c @@ -729,7 +729,7 @@ void mz2500_state::mz2500_reconfigure_screen() //popmessage("%d %d %d %d %02x",vs,ve,hs,he,m_cg_reg[0x0e]); - machine().first_screen()->configure(720, 480, visarea, machine().first_screen()->frame_period().attoseconds); + machine().first_screen()->configure(720, 480, visarea, machine().first_screen()->frame_period().attoseconds()); /* calculate CG window parameters here */ m_cg_vs = (m_cg_reg[0x08]) | ((m_cg_reg[0x09]<<8) & 1); diff --git a/src/mess/drivers/ngen.c b/src/mess/drivers/ngen.c index 6bcdf0a767a..83af9bec0df 100644 --- a/src/mess/drivers/ngen.c +++ b/src/mess/drivers/ngen.c @@ -91,8 +91,6 @@ public: m_pic(*this,"pic"), m_pit(*this,"pit"), m_disk_rom(*this,"disk"), - m_vram(*this,"vram"), - m_fontram(*this,"fontram"), m_fdc(*this,"fdc"), m_fd0(*this,"fdc:0"), m_fdc_timer(*this,"fdc_timer"), @@ -141,6 +139,10 @@ public: DECLARE_READ8_MEMBER(hd_buffer_r); DECLARE_WRITE8_MEMBER(hd_buffer_w); + DECLARE_READ16_MEMBER(b38_keyboard_r); + DECLARE_WRITE16_MEMBER(b38_keyboard_w); + DECLARE_READ16_MEMBER(b38_crtc_r); + DECLARE_WRITE16_MEMBER(b38_crtc_w); protected: virtual void machine_reset(); virtual void machine_start(); @@ -155,8 +157,8 @@ private: required_device<pic8259_device> m_pic; required_device<pit8254_device> m_pit; optional_memory_region m_disk_rom; - optional_shared_ptr<UINT16> m_vram; - optional_shared_ptr<UINT16> m_fontram; + memory_array m_vram; + memory_array m_fontram; optional_device<wd2797_t> m_fdc; optional_device<floppy_connector> m_fd0; optional_device<pit8253_device> m_fdc_timer; @@ -742,13 +744,13 @@ WRITE8_MEMBER(ngen_state::dma_write_word) MC6845_UPDATE_ROW( ngen_state::crtc_update_row ) { UINT16 addr = ma; - + for(int x=0;x<bitmap.width();x+=9) { - UINT8 ch = m_vram[addr++]; + UINT8 ch = m_vram.read16(addr++) & 0xff; for(int z=0;z<9;z++) { - if(BIT(m_fontram[ch*16+ra],8-z)) + if(BIT(m_fontram.read16(ch*16+ra),8-z)) bitmap.pix32(y,x+z) = rgb_t(0,0xff,0); else bitmap.pix32(y,x+z) = rgb_t(0,0,0); @@ -761,9 +763,80 @@ READ8_MEMBER( ngen_state::irq_cb ) return m_pic->acknowledge(); } +READ16_MEMBER( ngen_state::b38_keyboard_r ) +{ + UINT8 ret = 0; + switch(offset) + { + case 0: + if(mem_mask & 0x00ff) + ret = m_viduart->data_r(space,0); + break; + case 1: // keyboard UART + // expects bit 0 to be set (UART transmit ready) + if(mem_mask & 0x00ff) + ret = m_viduart->status_r(space,0); + break; + } + return ret; +} + +WRITE16_MEMBER( ngen_state::b38_keyboard_w ) +{ + switch(offset) + { + case 0: + if(mem_mask & 0x00ff) + m_viduart->data_w(space,0,data & 0xff); + break; + case 1: + if(mem_mask & 0x00ff) + m_viduart->control_w(space,0,data & 0xff); + break; + } +} + +READ16_MEMBER( ngen_state::b38_crtc_r ) +{ + UINT8 ret = 0; + switch(offset) + { + case 0: + if(mem_mask & 0x00ff) + ret = m_crtc->register_r(space,0); + break; + case 1: + if(mem_mask & 0x00ff) + ret = m_viduart->data_r(space,0); + break; + } + return ret; +} + +WRITE16_MEMBER( ngen_state::b38_crtc_w ) +{ + switch(offset) + { + case 0: + if(mem_mask & 0x00ff) + m_crtc->address_w(space,0,data & 0xff); + break; + case 1: + if(mem_mask & 0x00ff) + m_crtc->register_w(space,0,data & 0xff); + break; + } +} + void ngen_state::machine_start() { + memory_share* vidshare = memshare("vram"); + memory_share* fontshare = memshare("fontram"); m_hd_buffer.allocate(1024*8); // 8kB buffer RAM for HD controller + if(vidshare == NULL || fontshare == NULL) + fatalerror("Error: VRAM not found"); + m_vram.set(*vidshare,2); + m_fontram.set(*fontshare,2); } void ngen_state::machine_reset() @@ -800,25 +873,29 @@ static ADDRESS_MAP_START( ngen_io, AS_IO, 16, ngen_state ) ADDRESS_MAP_END static ADDRESS_MAP_START( ngen386_mem, AS_PROGRAM, 32, ngen_state ) - AM_RANGE(0x00000000, 0x000fdfff) AM_RAM + AM_RANGE(0x00000000, 0x000f7fff) AM_RAM AM_RANGE(0x000f8000, 0x000f9fff) AM_RAM AM_SHARE("vram") AM_RANGE(0x000fa000, 0x000fbfff) AM_RAM AM_SHARE("fontram") AM_RANGE(0x000fc000, 0x000fcfff) AM_RAM AM_RANGE(0x000fe000, 0x000fffff) AM_ROM AM_REGION("bios",0) + AM_RANGE(0x00100000, 0x00ffffff) AM_RAM // some extra RAM AM_RANGE(0xffffe000, 0xffffffff) AM_ROM AM_REGION("bios",0) ADDRESS_MAP_END static ADDRESS_MAP_START( ngen386i_mem, AS_PROGRAM, 32, ngen_state ) - AM_RANGE(0x00000000, 0x000fbfff) AM_RAM + AM_RANGE(0x00000000, 0x000f7fff) AM_RAM AM_RANGE(0x000f8000, 0x000f9fff) AM_RAM AM_SHARE("vram") AM_RANGE(0x000fa000, 0x000fbfff) AM_RAM AM_SHARE("fontram") AM_RANGE(0x000fc000, 0x000fffff) AM_ROM AM_REGION("bios",0) + AM_RANGE(0x00100000, 0x00ffffff) AM_RAM // some extra RAM AM_RANGE(0xffffc000, 0xffffffff) AM_ROM AM_REGION("bios",0) ADDRESS_MAP_END static ADDRESS_MAP_START( ngen386_io, AS_IO, 32, ngen_state ) AM_RANGE(0x0000, 0x0003) AM_READWRITE16(xbus_r, xbus_w, 0x0000ffff) - AM_RANGE(0xf800, 0xfeff) AM_READWRITE16(peripheral_r, peripheral_w,0xffffffff) +// AM_RANGE(0xf800, 0xfeff) AM_READWRITE16(peripheral_r, peripheral_w,0xffffffff) + AM_RANGE(0xfd08, 0xfd0b) AM_READWRITE16(b38_crtc_r, b38_crtc_w,0xffffffff) + AM_RANGE(0xfd0c, 0xfd0f) AM_READWRITE16(b38_keyboard_r, b38_keyboard_w,0xffffffff) ADDRESS_MAP_END static INPUT_PORTS_START( ngen ) @@ -1064,6 +1141,9 @@ ROM_START( ngen ) ROM_LOAD16_BYTE( "72-00414_80186_cpu.bin", 0x000000, 0x001000, CRC(e1387a03) SHA1(ddca4eba67fbf8b731a8009c14f6b40edcbc3279) ) // bootstrap ROM v8.4 ROM_LOAD16_BYTE( "72-00415_80186_cpu.bin", 0x000001, 0x001000, CRC(a6dde7d9) SHA1(b4d15c1bce31460ab5b92ff43a68c15ac5485816) ) + ROM_REGION16_LE( 0x2000, "vram", ROMREGION_ERASE00 ) + ROM_REGION16_LE( 0x2000, "fontram", ROMREGION_ERASE00 ) + ROM_REGION( 0x1000, "disk", 0) ROM_LOAD( "72-00422_10mb_disk.bin", 0x000000, 0x001000, CRC(f5b046b6) SHA1(b303c6f6aa40504016de9826879bc316e44389aa) ) @@ -1076,6 +1156,9 @@ ROM_START( ngenb38 ) ROM_REGION( 0x2000, "bios", 0) ROM_LOAD16_BYTE( "72-168_fpc_386_cpu.bin", 0x000000, 0x001000, CRC(250a3b68) SHA1(49c070514bac264fa4892f284f7d2c852ae6605d) ) ROM_LOAD16_BYTE( "72-167_fpc_386_cpu.bin", 0x000001, 0x001000, CRC(4010cc4e) SHA1(74a3024d605569056484d08b63f19fbf8eaf31c6) ) + + ROM_REGION16_LE( 0x2000, "vram", ROMREGION_ERASE00 ) + ROM_REGION16_LE( 0x2000, "fontram", ROMREGION_ERASE00 ) ROM_END ROM_START( 386i ) @@ -1083,6 +1166,9 @@ ROM_START( 386i ) ROM_LOAD16_BYTE( "72-1561o_386i_cpu.bin", 0x000000, 0x002000, CRC(b5efd768) SHA1(8b250d47d9c6eb82e1afaeb2244d8c4134ecbc47) ) ROM_LOAD16_BYTE( "72-1562e_386i_cpu.bin", 0x000001, 0x002000, CRC(002d0d3a) SHA1(31de8592999377db9251acbeff348390a2d2602a) ) + ROM_REGION16_LE( 0x2000, "vram", ROMREGION_ERASE00 ) + ROM_REGION16_LE( 0x2000, "fontram", ROMREGION_ERASE00 ) + ROM_REGION( 0x2000, "video", 0) ROM_LOAD( "72-1630_gc-104_vga.bin", 0x000000, 0x002000, CRC(4e4d8ebe) SHA1(50c96ccb4d0bd1beb2d1aee0d18b2c462d25fc8f) ) ROM_END diff --git a/src/mess/drivers/orao.c b/src/mess/drivers/orao.c index 83fa8642b6a..6c275196333 100644 --- a/src/mess/drivers/orao.c +++ b/src/mess/drivers/orao.c @@ -34,129 +34,129 @@ ADDRESS_MAP_END /* Input ports */ static INPUT_PORTS_START( orao ) - PORT_START("LINE0") + PORT_START("LINE.0") PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_START("LINE1") + PORT_START("LINE.1") PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_BIT(0xC0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE2") + PORT_START("LINE.2") PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_START("LINE3") + PORT_START("LINE.3") PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_BIT(0xC0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE4") + PORT_START("LINE.4") PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_START("LINE5") + PORT_START("LINE.5") PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') PORT_BIT(0xC0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE6") + PORT_START("LINE.6") PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_START("LINE7") + PORT_START("LINE.7") PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') PORT_BIT(0xC0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE8") + PORT_START("LINE.8") PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_START("LINE9") + PORT_START("LINE.9") PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') PORT_BIT(0xC0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE10") + PORT_START("LINE.10") PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_START("LINE11") + PORT_START("LINE.11") PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') PORT_BIT(0xC0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE12") + PORT_START("LINE.12") PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_START("LINE13") + PORT_START("LINE.13") PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_BIT(0xC0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE14") + PORT_START("LINE.14") PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_START("LINE15") + PORT_START("LINE.15") PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_BIT(0xC0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE16") + PORT_START("LINE.16") PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ch") PORT_CODE(KEYCODE_COLON) PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Cj") PORT_CODE(KEYCODE_QUOTE) PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Zh") PORT_CODE(KEYCODE_SLASH) PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(':') PORT_CHAR('*') - PORT_START("LINE17") + PORT_START("LINE.17") PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('^') PORT_CHAR('@') PORT_BIT(0xC0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_START("LINE18") + PORT_START("LINE.18") PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Dj") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Sh") PORT_CODE(KEYCODE_OPENBRACE) PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(';') PORT_CHAR('+') - PORT_START("LINE19") + PORT_START("LINE.19") PORT_BIT(0x0F, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') diff --git a/src/mess/drivers/pc100.c b/src/mess/drivers/pc100.c index 424b8d67dbc..5c23a8f1934 100644 --- a/src/mess/drivers/pc100.c +++ b/src/mess/drivers/pc100.c @@ -72,7 +72,6 @@ public: m_beeper(*this, "beeper"), m_rtc(*this, "rtc"), m_palette(*this, "palette"), - m_palram(*this, "palram"), m_kanji_rom(*this, "kanji"), m_vram(*this, "vram"), m_rtc_portc(0) @@ -83,7 +82,6 @@ public: required_device<beep_device> m_beeper; required_device<msm58321_device> m_rtc; required_device<palette_device> m_palette; - required_shared_ptr<UINT16> m_palram; required_region_ptr<UINT16> m_kanji_rom; required_region_ptr<UINT16> m_vram; @@ -94,7 +92,6 @@ public: DECLARE_READ8_MEMBER(pc100_key_r); DECLARE_WRITE8_MEMBER(pc100_output_w); DECLARE_WRITE8_MEMBER(pc100_tc_w); - DECLARE_WRITE16_MEMBER(pc100_paletteram_w); DECLARE_READ8_MEMBER(pc100_shift_r); DECLARE_WRITE8_MEMBER(pc100_shift_w); DECLARE_READ8_MEMBER(pc100_vs_vreg_r); @@ -246,27 +243,11 @@ WRITE8_MEMBER( pc100_state::pc100_tc_w ) machine().device<upd765a_device>("upd765")->tc_w(data & 0x40); } -WRITE16_MEMBER( pc100_state::pc100_paletteram_w ) -{ - COMBINE_DATA(&m_palram[offset]); - - { - int r,g,b; - - r = (m_palram[offset] >> 0) & 7; - g = (m_palram[offset] >> 3) & 7; - b = (m_palram[offset] >> 6) & 7; - - m_palette->set_pen_color(offset, pal3bit(r),pal3bit(g),pal3bit(b)); - } -} - READ8_MEMBER( pc100_state::pc100_shift_r ) { return m_crtc.shift; } - WRITE8_MEMBER( pc100_state::pc100_shift_w ) { m_crtc.shift = data & 0xf; @@ -316,7 +297,7 @@ static ADDRESS_MAP_START(pc100_io, AS_IO, 16, pc100_state) AM_RANGE(0x38, 0x39) AM_WRITE8(pc100_crtc_addr_w,0x00ff) //crtc address reg AM_RANGE(0x3a, 0x3b) AM_WRITE8(pc100_crtc_data_w,0x00ff) //crtc data reg AM_RANGE(0x3c, 0x3f) AM_READWRITE8(pc100_vs_vreg_r,pc100_vs_vreg_w,0x00ff) //crtc vertical start position - AM_RANGE(0x40, 0x5f) AM_RAM_WRITE(pc100_paletteram_w) AM_SHARE("palram") + AM_RANGE(0x40, 0x5f) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") // AM_RANGE(0x60, 0x61) crtc command (16-bit wide) AM_RANGE(0x80, 0x81) AM_READWRITE(pc100_kanji_r,pc100_kanji_w) AM_RANGE(0x82, 0x83) AM_WRITENOP //kanji-related? @@ -514,7 +495,7 @@ static MACHINE_CONFIG_START( pc100, pc100_state ) MCFG_GFXDECODE_ADD("gfxdecode", "palette", pc100) MCFG_PALETTE_ADD("palette", 16) -// MCFG_PALETTE_INIT(black_and_white) + MCFG_PALETTE_FORMAT(xxxxxxxBBBGGGRRR) MCFG_SPEAKER_STANDARD_MONO("mono") diff --git a/src/mess/drivers/pc6001.c b/src/mess/drivers/pc6001.c index 8c85fb6998f..aadd261c5b0 100644 --- a/src/mess/drivers/pc6001.c +++ b/src/mess/drivers/pc6001.c @@ -1343,7 +1343,7 @@ WRITE8_MEMBER(pc6001_state::pc6001m2_vram_bank_w) visarea.set(0, (320) - 1, 0, (y_height) - 1); - machine().first_screen()->configure(320, 240, visarea, machine().first_screen()->frame_period().attoseconds); + machine().first_screen()->configure(320, 240, visarea, machine().first_screen()->frame_period().attoseconds()); } } diff --git a/src/mess/drivers/pcd.c b/src/mess/drivers/pcd.c index 8cd85eacf01..a17e509b3ee 100644 --- a/src/mess/drivers/pcd.c +++ b/src/mess/drivers/pcd.c @@ -43,6 +43,7 @@ public: m_scsi(*this, "scsi"), m_scsi_data_out(*this, "scsi_data_out"), m_scsi_data_in(*this, "scsi_data_in"), + m_ram(*this, "ram"), m_vram(*this, "vram"), m_charram(8*1024) { } @@ -71,6 +72,8 @@ public: DECLARE_WRITE16_MEMBER( vram_w ); DECLARE_READ16_MEMBER( mmu_r ); DECLARE_WRITE16_MEMBER( mmu_w ); + DECLARE_READ16_MEMBER( mem_r ); + DECLARE_WRITE16_MEMBER( mem_w ); SCN2674_DRAW_CHARACTER_MEMBER(display_pixels); DECLARE_FLOPPY_FORMATS( floppy_formats ); DECLARE_WRITE_LINE_MEMBER(write_scsi_bsy); @@ -98,12 +101,19 @@ private: required_device<SCSI_PORT_DEVICE> m_scsi; required_device<output_latch_device> m_scsi_data_out; required_device<input_buffer_device> m_scsi_data_in; + required_device<ram_device> m_ram; required_shared_ptr<UINT16> m_vram; dynamic_buffer m_charram; UINT8 m_stat, m_led, m_vram_sw; int m_msg, m_bsy, m_io, m_cd, m_req, m_rst; emu_timer *m_req_hack; UINT16 m_dskctl; + struct { + UINT16 ctl; + UINT16 regs[1024]; + int type; + bool sc; + } m_mmu; }; @@ -135,6 +145,8 @@ void pcd_state::machine_start() { m_gfxdecode->set_gfx(0, global_alloc(gfx_element(machine().device<palette_device>("palette"), pcd_charlayout, &m_charram[0], 0, 1, 0))); m_req_hack = timer_alloc(); + save_item(NAME(m_mmu.ctl)); + save_item(NAME(m_mmu.regs)); } void pcd_state::machine_reset() @@ -144,6 +156,9 @@ void pcd_state::machine_reset() m_dskctl = 0; m_vram_sw = 1; m_rst = 0; + m_mmu.ctl = 0; + m_mmu.sc = false; + m_mmu.type = ioport("mmu")->read(); } READ8_MEMBER( pcd_state::irq_callback ) @@ -286,13 +301,32 @@ WRITE8_MEMBER( pcd_state::led_w ) READ16_MEMBER( pcd_state::mmu_r ) { - logerror("%s: mmu read %04x\n", machine().describe_context(), offset + 0x8000); + UINT16 data = m_mmu.regs[((m_mmu.ctl & 0x1f) << 5) | ((offset >> 2) & 0x1f)]; + logerror("%s: mmu read %04x %04x\n", machine().describe_context(), (offset << 1) + 0x8000, data); + if(!offset) + return m_mmu.ctl; + else if((offset >= 0x200) && (offset < 0x300) && !(offset & 3)) + return (data << 4) | (data >> 12) | (m_mmu.sc && (offset == 0x200) ? 0xc0 : 0); + else if(offset == 0x400) + { + m_mmu.sc = false; + m_pic1->ir0_w(CLEAR_LINE); + } return 0; } WRITE16_MEMBER( pcd_state::mmu_w ) { - logerror("%s: mmu write %04x %04x\n", machine().describe_context(), offset + 0x8000, data); + logerror("%s: mmu write %04x %04x\n", machine().describe_context(), (offset << 1) + 0x8000, data); + if(!offset) + m_mmu.ctl = data; + else if((offset >= 0x200) && (offset < 0x300) && !(offset & 3)) + m_mmu.regs[((m_mmu.ctl & 0x1f) << 5) | ((offset >> 2) & 0x1f)] = (data >> 4) | (data << 12); + else if(offset == 0x400) + { + m_mmu.sc = true; + m_pic1->ir0_w(ASSERT_LINE); + } } SCN2674_DRAW_CHARACTER_MEMBER(pcd_state::display_pixels) @@ -409,12 +443,55 @@ WRITE_LINE_MEMBER(pcd_state::write_scsi_req) else m_scsi->write_ack(0); } + +WRITE16_MEMBER(pcd_state::mem_w) +{ + UINT16 *ram = (UINT16 *)m_ram->pointer(); + if((m_mmu.ctl & 0x20) && m_mmu.type) + { + UINT16 reg; + if(m_mmu.type == 2) + reg = m_mmu.regs[((offset >> 10) & 0xff) | ((m_mmu.ctl & 0x18) << 5)]; + else + reg = m_mmu.regs[((offset >> 10) & 0x7f) | ((m_mmu.ctl & 0x1c) << 5)]; + if(!reg && !space.debugger_access()) + { + offset <<= 1; + logerror("%s: Null mmu entry %06x\n", machine().describe_context(), offset); + nmi_io_w(space, offset, data, mem_mask); + return; + } + offset = ((reg << 3) & 0x7fc00) | (offset & 0x3ff); + } + COMBINE_DATA(&ram[offset]); +} + +READ16_MEMBER(pcd_state::mem_r) +{ + UINT16 *ram = (UINT16 *)m_ram->pointer(); + if((m_mmu.ctl & 0x20) && m_mmu.type) + { + UINT16 reg; + if(m_mmu.type == 2) + reg = m_mmu.regs[((offset >> 10) & 0xff) | ((m_mmu.ctl & 0x18) << 5)]; + else + reg = m_mmu.regs[((offset >> 10) & 0x7f) | ((m_mmu.ctl & 0x1c) << 5)]; + if(!reg && !space.debugger_access()) + { + offset <<= 1; + logerror("%s: Null mmu entry %06x\n", machine().describe_context(), offset); + return nmi_io_r(space, offset, mem_mask); + } + offset = ((reg << 3) & 0x7fc00) | (offset & 0x3ff); + } + return ram[offset]; +} //************************************************************************** // ADDRESS MAPS //************************************************************************** static ADDRESS_MAP_START( pcd_map, AS_PROGRAM, 16, pcd_state ) - AM_RANGE(0x00000, 0x7ffff) AM_RAM // fixed 512k for now + AM_RANGE(0x00000, 0x7ffff) AM_READWRITE(mem_r, mem_w) AM_RANGE(0xf0000, 0xf7fff) AM_READONLY AM_WRITE(vram_w) AM_SHARE("vram") AM_RANGE(0xfc000, 0xfffff) AM_ROM AM_REGION("bios", 0) AM_RANGE(0x00000, 0xfffff) AM_READWRITE8(nmi_io_r, nmi_io_w, 0xffff) @@ -459,6 +536,14 @@ FLOPPY_FORMATS_MEMBER( pcd_state::floppy_formats ) FLOPPY_PC_FORMAT FLOPPY_FORMATS_END +static INPUT_PORTS_START(pcd) + PORT_START("mmu") + PORT_CONFNAME(0x03, 0x00, "MMU Type") + PORT_CONFSETTING(0x00, "None") + PORT_CONFSETTING(0x01, "SINIX 1.0") + PORT_CONFSETTING(0x02, "SINIX 1.2") +INPUT_PORTS_END + static MACHINE_CONFIG_START( pcd, pcd_state ) MCFG_CPU_ADD("maincpu", I80186, XTAL_16MHz) MCFG_CPU_PROGRAM_MAP(pcd_map) @@ -474,11 +559,8 @@ static MACHINE_CONFIG_START( pcd, pcd_state ) MCFG_PIC8259_ADD("pic1", DEVWRITELINE("maincpu", i80186_cpu_device, int0_w), VCC, NULL) MCFG_PIC8259_ADD("pic2", DEVWRITELINE("maincpu", i80186_cpu_device, int1_w), VCC, NULL) -#if 0 MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("256K") - MCFG_RAM_EXTRA_OPTIONS("512K,1M") -#endif + MCFG_RAM_DEFAULT_SIZE("1M") // nvram MCFG_NVRAM_ADD_1FILL("nvram") @@ -569,4 +651,4 @@ ROM_END // GAME DRIVERS //************************************************************************** -COMP( 1984, pcd, 0, 0, pcd, 0, driver_device, 0, "Siemens", "PC-D", MACHINE_NOT_WORKING ) +COMP( 1984, pcd, 0, 0, pcd, pcd, driver_device, 0, "Siemens", "PC-D", MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/pce.c b/src/mess/drivers/pce.c index 62094975dff..9153ec14c0b 100644 --- a/src/mess/drivers/pce.c +++ b/src/mess/drivers/pce.c @@ -69,7 +69,7 @@ Super System Card: /* todo: alternate forms of input (multitap, mouse, etc.) */ static INPUT_PORTS_START( pce ) - PORT_START("JOY_P1") + PORT_START("JOY_P.0") /* II is left of I on the original pad so we map them in reverse order */ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 Button I") PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0000) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P1 Button II") PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0000) @@ -80,7 +80,7 @@ static INPUT_PORTS_START( pce ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0000) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0000) - PORT_START("JOY_P2") + PORT_START("JOY_P.1") /* II is left of I on the original pad so we map them in reverse order */ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P2 Button I") PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0000) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P2 Button II") PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0000) @@ -91,7 +91,7 @@ static INPUT_PORTS_START( pce ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0000) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0000) - PORT_START("JOY_P3") + PORT_START("JOY_P.2") /* II is left of I on the original pad so we map them in reverse order */ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P3 Button I") PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0000) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P3 Button II") PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0000) @@ -102,7 +102,7 @@ static INPUT_PORTS_START( pce ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0000) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0000) - PORT_START("JOY_P4") + PORT_START("JOY_P.3") /* II is left of I on the original pad so we map them in reverse order */ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P4 Button I") PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0000) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P4 Button II") PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0000) @@ -113,7 +113,7 @@ static INPUT_PORTS_START( pce ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0000) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0000) - PORT_START("JOY_P5") + PORT_START("JOY_P.4") /* II is left of I on the original pad so we map them in reverse order */ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P5 Button I") PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0000) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P5 Button II") PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0000) @@ -124,7 +124,7 @@ static INPUT_PORTS_START( pce ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0000) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0000) - PORT_START("JOY6B_P1") + PORT_START("JOY6B_P.0") /* II is left of I on the original pad so we map them in reverse order */ PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 Button I") PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0002) PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P1 Button II") PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0002) @@ -140,7 +140,7 @@ static INPUT_PORTS_START( pce ) PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P1 Button VI") PORT_PLAYER(1) PORT_CONDITION("JOY_TYPE", 0x0003, EQUALS, 0x0002) PORT_BIT( 0xf000, IP_ACTIVE_HIGH,IPT_UNUSED ) //6-button pad header - PORT_START("JOY6B_P2") /* Player 2 controls */ + PORT_START("JOY6B_P.1") /* Player 2 controls */ /* II is left of I on the original pad so we map them in reverse order */ PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P2 Button I") PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0008) PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P2 Button II") PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0008) @@ -156,7 +156,7 @@ static INPUT_PORTS_START( pce ) PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P2 Button VI") PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0008) PORT_BIT( 0xf000, IP_ACTIVE_HIGH,IPT_UNUSED ) //6-button pad header - PORT_START("JOY6B_P3") /* Player 3 controls */ + PORT_START("JOY6B_P.2") /* Player 3 controls */ /* II is left of I on the original pad so we map them in reverse order */ PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P3 Button I") PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0020) PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P3 Button II") PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0020) @@ -172,7 +172,7 @@ static INPUT_PORTS_START( pce ) PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P3 Button VI") PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0020) PORT_BIT( 0xf000, IP_ACTIVE_HIGH,IPT_UNUSED ) //6-button pad header - PORT_START("JOY6B_P4") /* Player 4 controls */ + PORT_START("JOY6B_P.3") /* Player 4 controls */ /* II is left of I on the original pad so we map them in reverse order */ PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P4 Button I") PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0080) PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P4 Button II") PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0080) @@ -188,7 +188,7 @@ static INPUT_PORTS_START( pce ) PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P3 Button VI") PORT_PLAYER(4) PORT_CONDITION("JOY_TYPE", 0x00c0, EQUALS, 0x0080) PORT_BIT( 0xf000, IP_ACTIVE_HIGH,IPT_UNUSED ) //6-button pad header - PORT_START("JOY6B_P5") /* Player 5 controls */ + PORT_START("JOY6B_P.4") /* Player 5 controls */ /* II is left of I on the original pad so we map them in reverse order */ PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P5 Button I") PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0200) PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P5 Button II") PORT_PLAYER(5) PORT_CONDITION("JOY_TYPE", 0x0300, EQUALS, 0x0200) diff --git a/src/mess/drivers/pdp1.c b/src/mess/drivers/pdp1.c index 2d71bde9203..f3827cf61b1 100644 --- a/src/mess/drivers/pdp1.c +++ b/src/mess/drivers/pdp1.c @@ -166,7 +166,7 @@ static INPUT_PORTS_START( pdp1 ) rightmost one: maybe they were used to set the margin (I don't have the manual for the typewriter). */ - PORT_START("TWR0") /* 6: typewriter codes 00-17 */ + PORT_START("TWR.0") /* 6: typewriter codes 00-17 */ PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(Space)") PORT_CODE(KEYCODE_SPACE) PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1 \"") PORT_CODE(KEYCODE_1) PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2 '") PORT_CODE(KEYCODE_2) @@ -178,7 +178,7 @@ static INPUT_PORTS_START( pdp1 ) PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8 >") PORT_CODE(KEYCODE_8) PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9 (up arrow)") PORT_CODE(KEYCODE_9) - PORT_START("TWR1") /* 7: typewriter codes 20-37 */ + PORT_START("TWR.1") /* 7: typewriter codes 20-37 */ PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0 (right arrow)") PORT_CODE(KEYCODE_0) PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) @@ -192,7 +192,7 @@ static INPUT_PORTS_START( pdp1 ) PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(", =") PORT_CODE(KEYCODE_COMMA) PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tab Key") PORT_CODE(KEYCODE_TAB) - PORT_START("TWR2") /* 8: typewriter codes 40-57 */ + PORT_START("TWR.2") /* 8: typewriter codes 40-57 */ PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(non-spacing middle dot) _") PORT_CODE(KEYCODE_QUOTE) PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) @@ -208,7 +208,7 @@ static INPUT_PORTS_START( pdp1 ) PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(non-spacing overstrike) |") PORT_CODE(KEYCODE_OPENBRACE) PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("( [") PORT_CODE(KEYCODE_MINUS) - PORT_START("TWR3") /* 9: typewriter codes 60-77 */ + PORT_START("TWR.3") /* 9: typewriter codes 60-77 */ PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) @@ -485,9 +485,8 @@ static pdp1_reset_param_t pdp1_reset_param = void pdp1_state::machine_reset() { - int cfg; + int cfg = m_cfg->read(); - cfg = ioport("CFG")->read(); pdp1_reset_param.extend_support = (cfg >> pdp1_config_extend_bit) & pdp1_config_extend_mask; pdp1_reset_param.hw_mul_div = (cfg >> pdp1_config_hw_mul_div_bit) & pdp1_config_hw_mul_div_mask; pdp1_reset_param.type_20_sbs = (cfg >> pdp1_config_type_20_sbs_bit) & pdp1_config_type_20_sbs_mask; @@ -1598,7 +1597,7 @@ static void iot_dra(device_t *device, int op2, int nac, int mb, int *io, int ac) { pdp1_state *state = device->machine().driver_data<pdp1_state>(); (*io) = (state->m_parallel_drum.rotation_timer->elapsed() * - (ATTOSECONDS_PER_SECOND / (PARALLEL_DRUM_WORD_TIME.as_attoseconds()))).seconds & 0007777; + (ATTOSECONDS_PER_SECOND / (PARALLEL_DRUM_WORD_TIME.as_attoseconds()))).seconds() & 0007777; /* set parity error and timing error... */ } @@ -1618,7 +1617,7 @@ static void iot_dra(device_t *device, int op2, int nac, int mb, int *io, int ac) */ static void iot_011(device_t *device, int op2, int nac, int mb, int *io, int ac) { - int key_state = device->machine().root_device().ioport("SPACEWAR")->read(); + int key_state = device->machine().driver_data<pdp1_state>()->read_spacewar(); int reply; @@ -1701,12 +1700,11 @@ void pdp1_state::pdp1_keyboard() int typewriter_keys[4]; int typewriter_transitions; - static const char *const twrnames[] = { "TWR0", "TWR1", "TWR2", "TWR3" }; for (i=0; i<4; i++) { - typewriter_keys[i] = ioport(twrnames[i])->read(); + typewriter_keys[i] = m_twr[i]->read(); } for (i=0; i<4; i++) @@ -1734,11 +1732,9 @@ void pdp1_state::pdp1_keyboard() void pdp1_state::pdp1_lightpen() { int x_delta, y_delta; - int current_state; + int current_state = m_io_lightpen->read(); - m_lightpen.active = (ioport("CFG")->read() >> pdp1_config_lightpen_bit) & pdp1_config_lightpen_mask; - - current_state = ioport("LIGHTPEN")->read(); + m_lightpen.active = (m_cfg->read() >> pdp1_config_lightpen_bit) & pdp1_config_lightpen_mask; /* update pen down state */ m_lightpen.down = m_lightpen.active && (current_state & pdp1_lightpen_down); @@ -1760,8 +1756,8 @@ void pdp1_state::pdp1_lightpen() m_old_lightpen = current_state; /* update pen position */ - x_delta = ioport("LIGHTX")->read(); - y_delta = ioport("LIGHTY")->read(); + x_delta = m_lightx->read(); + y_delta = m_lighty->read(); if (x_delta >= 0x80) x_delta -= 0x100; @@ -1797,10 +1793,10 @@ INTERRUPT_GEN_MEMBER(pdp1_state::pdp1_interrupt) int ta_transitions; - m_maincpu->set_state_int(PDP1_SS, ioport("SENSE")->read()); + m_maincpu->set_state_int(PDP1_SS, m_sense->read()); /* read new state of control keys */ - control_keys = ioport("CSW")->read(); + control_keys = m_csw->read(); if (control_keys & pdp1_control) { @@ -1892,7 +1888,7 @@ INTERRUPT_GEN_MEMBER(pdp1_state::pdp1_interrupt) /* handle test word keys */ - tw_keys = (ioport("TWDMSB")->read() << 16) | ioport("TWDLSB")->read(); + tw_keys = (m_twdmsb->read() << 16) | m_twdlsb->read(); /* compute transitions */ tw_transitions = tw_keys & (~ m_old_tw_keys); @@ -1905,7 +1901,7 @@ INTERRUPT_GEN_MEMBER(pdp1_state::pdp1_interrupt) /* handle address keys */ - ta_keys = ioport("TSTADD")->read(); + ta_keys = m_tstadd->read(); /* compute transitions */ ta_transitions = ta_keys & (~ m_old_ta_keys); diff --git a/src/mess/drivers/pmd85.c b/src/mess/drivers/pmd85.c index 737c7e63a4f..ce1189c9592 100644 --- a/src/mess/drivers/pmd85.c +++ b/src/mess/drivers/pmd85.c @@ -182,6 +182,36 @@ I/O ports #include "formats/pmd_cas.h" #include "machine/ram.h" + +//************************************************************************** +// VIDEO EMULATION +//************************************************************************** + +UINT32 pmd85_state::screen_update_pmd85(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + for (int y = 0; y < 256; y++) + { + // address of current line in PMD-85 video memory + UINT8 *line = m_ram->pointer() + 0xc000 + 0x40 * y; + + for (int x = 0; x < 288/6; x++) + { + int pen = BIT(line[x], 7) ? 1 : 2; + + bitmap.pix16(y, x * 6 + 0) = BIT(line[x], 0) ? pen : 0; + bitmap.pix16(y, x * 6 + 1) = BIT(line[x], 1) ? pen : 0; + bitmap.pix16(y, x * 6 + 2) = BIT(line[x], 2) ? pen : 0; + bitmap.pix16(y, x * 6 + 3) = BIT(line[x], 3) ? pen : 0; + bitmap.pix16(y, x * 6 + 4) = BIT(line[x], 4) ? pen : 0; + bitmap.pix16(y, x * 6 + 5) = BIT(line[x], 5) ? pen : 0; + } + + } + + return 0; +} + + /* I/O ports */ static ADDRESS_MAP_START( pmd85_io_map, AS_IO, 8, pmd85_state ) @@ -578,8 +608,7 @@ static MACHINE_CONFIG_START( pmd85, pmd85_state ) MCFG_SCREEN_UPDATE_DRIVER(pmd85_state, screen_update_pmd85) MCFG_SCREEN_PALETTE("palette") - MCFG_PALETTE_ADD("palette", sizeof (pmd85_palette) / 3) - MCFG_PALETTE_INIT_OWNER(pmd85_state, pmd85) + MCFG_PALETTE_ADD_MONOCHROME_GREEN_HIGHLIGHT("palette") /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") diff --git a/src/mess/drivers/riscpc.c b/src/mess/drivers/riscpc.c index 9bfcf221020..4bddb03c55f 100644 --- a/src/mess/drivers/riscpc.c +++ b/src/mess/drivers/riscpc.c @@ -186,7 +186,7 @@ void riscpc_state::vidc20_dynamic_screen_change() visarea.min_y = (m_vidc20_vert_reg[VBSR] & 0x1fff); visarea.max_y = (m_vidc20_vert_reg[VBER] & 0x1fff)-1; - machine().first_screen()->configure(hblank_period, vblank_period, visarea, machine().first_screen()->frame_period().attoseconds ); + machine().first_screen()->configure(hblank_period, vblank_period, visarea, machine().first_screen()->frame_period().attoseconds() ); logerror("VIDC20: successfully changed the screen to:\n Display Size = %d x %d\n Border Size %d x %d\n Cycle Period %d x %d\n", (m_vidc20_horz_reg[HDER]-m_vidc20_horz_reg[HDSR]),(m_vidc20_vert_reg[VDER]-m_vidc20_vert_reg[VDSR]), (m_vidc20_horz_reg[HBER]-m_vidc20_horz_reg[HBSR]),(m_vidc20_vert_reg[VBER]-m_vidc20_vert_reg[VBSR]), diff --git a/src/mess/drivers/samcoupe.c b/src/mess/drivers/samcoupe.c index 7c96130e3a7..e6262e1d0ff 100644 --- a/src/mess/drivers/samcoupe.c +++ b/src/mess/drivers/samcoupe.c @@ -31,16 +31,11 @@ # /* components */ #include "cpu/z80/z80.h" -#include "machine/wd_fdc.h" -#include "machine/msm6242.h" #include "sound/saa1099.h" -#include "sound/speaker.h" /* devices */ -#include "imagedev/cassette.h" #include "formats/tzx_cas.h" #include "formats/coupedsk.h" -#include "machine/ram.h" /*************************************************************************** CONSTANTS @@ -78,23 +73,21 @@ void samcoupe_state::device_timer(emu_timer &timer, device_timer_id id, int para READ8_MEMBER(samcoupe_state::samcoupe_disk_r) { - wd1772_t *fdc = machine().device<wd1772_t>("wd1772"); - /* drive and side is encoded into bit 5 and 3 */ - floppy_connector *con = machine().device<floppy_connector>(BIT(offset, 4) ? "wd1772:1" : "wd1772:0"); + floppy_connector *con = (BIT(offset, 4) ? m_wd1772_1 : m_wd1772_0); floppy_image_device *floppy = con ? con->get_device() : 0; if(floppy) floppy->ss_w(BIT(offset, 2)); - fdc->set_floppy(floppy); + m_fdc->set_floppy(floppy); /* bit 1 and 2 select the controller register */ switch (offset & 0x03) { - case 0: return fdc->status_r(); - case 1: return fdc->track_r(); - case 2: return fdc->sector_r(); - case 3: return fdc->data_r(); + case 0: return m_fdc->status_r(); + case 1: return m_fdc->track_r(); + case 2: return m_fdc->sector_r(); + case 3: return m_fdc->data_r(); } return 0xff; @@ -102,23 +95,21 @@ READ8_MEMBER(samcoupe_state::samcoupe_disk_r) WRITE8_MEMBER(samcoupe_state::samcoupe_disk_w) { - wd1772_t *fdc = machine().device<wd1772_t>("wd1772"); - /* drive and side is encoded into bit 5 and 3 */ - floppy_connector *con = machine().device<floppy_connector>(BIT(offset, 4) ? "wd1772:1" : "wd1772:0"); + floppy_connector *con = (BIT(offset, 4) ? m_wd1772_1 : m_wd1772_0); floppy_image_device *floppy = con ? con->get_device() : 0; if(floppy) floppy->ss_w(BIT(offset, 2)); - fdc->set_floppy(floppy); + m_fdc->set_floppy(floppy); /* bit 1 and 2 select the controller register */ switch (offset & 0x03) { - case 0: fdc->cmd_w(data); break; - case 1: fdc->track_w(data); break; - case 2: fdc->sector_w(data); break; - case 3: fdc->data_w(data); break; + case 0: m_fdc->cmd_w(data); break; + case 1: m_fdc->track_w(data); break; + case 2: m_fdc->sector_w(data); break; + case 3: m_fdc->data_w(data); break; } } @@ -156,14 +147,14 @@ READ8_MEMBER(samcoupe_state::samcoupe_status_r) UINT8 data = 0xe0; /* bit 5-7, keyboard input */ - if (!BIT(offset, 8)) data &= ioport("keyboard_row_fe")->read() & 0xe0; - if (!BIT(offset, 9)) data &= ioport("keyboard_row_fd")->read() & 0xe0; - if (!BIT(offset, 10)) data &= ioport("keyboard_row_fb")->read() & 0xe0; - if (!BIT(offset, 11)) data &= ioport("keyboard_row_f7")->read() & 0xe0; - if (!BIT(offset, 12)) data &= ioport("keyboard_row_ef")->read() & 0xe0; - if (!BIT(offset, 13)) data &= ioport("keyboard_row_df")->read() & 0xe0; - if (!BIT(offset, 14)) data &= ioport("keyboard_row_bf")->read() & 0xe0; - if (!BIT(offset, 15)) data &= ioport("keyboard_row_7f")->read() & 0xe0; + if (!BIT(offset, 8)) data &= m_keyboard_row_fe->read() & 0xe0; + if (!BIT(offset, 9)) data &= m_keyboard_row_fd->read() & 0xe0; + if (!BIT(offset, 10)) data &= m_keyboard_row_fb->read() & 0xe0; + if (!BIT(offset, 11)) data &= m_keyboard_row_f7->read() & 0xe0; + if (!BIT(offset, 12)) data &= m_keyboard_row_ef->read() & 0xe0; + if (!BIT(offset, 13)) data &= m_keyboard_row_df->read() & 0xe0; + if (!BIT(offset, 14)) data &= m_keyboard_row_bf->read() & 0xe0; + if (!BIT(offset, 15)) data &= m_keyboard_row_7f->read() & 0xe0; /* bit 0-4, interrupt source */ data |= m_status; @@ -231,18 +222,18 @@ READ8_MEMBER(samcoupe_state::samcoupe_keyboard_r) UINT8 data = 0x1f; /* bit 0-4, keyboard input */ - if (!BIT(offset, 8)) data &= ioport("keyboard_row_fe")->read() & 0x1f; - if (!BIT(offset, 9)) data &= ioport("keyboard_row_fd")->read() & 0x1f; - if (!BIT(offset, 10)) data &= ioport("keyboard_row_fb")->read() & 0x1f; - if (!BIT(offset, 11)) data &= ioport("keyboard_row_f7")->read() & 0x1f; - if (!BIT(offset, 12)) data &= ioport("keyboard_row_ef")->read() & 0x1f; - if (!BIT(offset, 13)) data &= ioport("keyboard_row_df")->read() & 0x1f; - if (!BIT(offset, 14)) data &= ioport("keyboard_row_bf")->read() & 0x1f; - if (!BIT(offset, 15)) data &= ioport("keyboard_row_7f")->read() & 0x1f; + if (!BIT(offset, 8)) data &= m_keyboard_row_fe->read() & 0x1f; + if (!BIT(offset, 9)) data &= m_keyboard_row_fd->read() & 0x1f; + if (!BIT(offset, 10)) data &= m_keyboard_row_fb->read() & 0x1f; + if (!BIT(offset, 11)) data &= m_keyboard_row_f7->read() & 0x1f; + if (!BIT(offset, 12)) data &= m_keyboard_row_ef->read() & 0x1f; + if (!BIT(offset, 13)) data &= m_keyboard_row_df->read() & 0x1f; + if (!BIT(offset, 14)) data &= m_keyboard_row_bf->read() & 0x1f; + if (!BIT(offset, 15)) data &= m_keyboard_row_7f->read() & 0x1f; if (offset == 0xff00) { - data &= ioport("keyboard_row_ff")->read() & 0x1f; + data &= m_keyboard_row_ff->read() & 0x1f; /* if no key has been pressed, return the mouse state */ if (data == 0x1f) diff --git a/src/mess/drivers/segapico.c b/src/mess/drivers/segapico.c index 805aa14db7c..df93af5705b 100644 --- a/src/mess/drivers/segapico.c +++ b/src/mess/drivers/segapico.c @@ -130,14 +130,19 @@ class pico_base_state : public md_cons_state public: pico_base_state(const machine_config &mconfig, device_type type, const char *tag) : md_cons_state(mconfig, type, tag), - m_upd7759(*this, "7759") { } + m_upd7759(*this, "7759"), + m_io_page(*this, "PAGE"), + m_io_pad(*this, "PAD"), + m_io_penx(*this, "PENX"), + m_io_peny(*this, "PENY") + { } optional_device<upd7759_device> m_upd7759; - ioport_port *m_io_page; - ioport_port *m_io_pad; - ioport_port *m_io_penx; - ioport_port *m_io_peny; + required_ioport m_io_page; + required_ioport m_io_pad; + required_ioport m_io_penx; + required_ioport m_io_peny; UINT8 m_page_register; @@ -171,13 +176,13 @@ UINT16 pico_base_state::pico_read_penpos(int pen) switch (pen) { case PICO_PENX: - penpos = m_io_penx->read_safe(0); + penpos = m_io_penx->read(); penpos |= 0x6; penpos = penpos * 320 / 255; penpos += 0x3d; break; case PICO_PENY: - penpos = m_io_peny->read_safe(0); + penpos = m_io_peny->read(); penpos |= 0x6; penpos = penpos * 251 / 255; penpos += 0x1fc; @@ -197,7 +202,7 @@ READ16_MEMBER(pico_base_state::pico_68k_io_read ) retdata = m_version_hi_nibble; break; case 1: - retdata = m_io_pad->read_safe(0); + retdata = m_io_pad->read(); break; /* @@ -230,7 +235,7 @@ READ16_MEMBER(pico_base_state::pico_68k_io_read ) either page 5 or page 6 is often unused. */ { - UINT8 tmp = m_io_page->read_safe(0); + UINT8 tmp = m_io_page->read(); if (tmp == 2 && m_page_register != 0x3f) { m_page_register <<= 1; @@ -336,11 +341,6 @@ SLOT_INTERFACE_END MACHINE_START_MEMBER(pico_state,pico) { - m_io_page = ioport("PAGE"); - m_io_pad = ioport("PAD"); - m_io_penx = ioport("PENX"); - m_io_peny = ioport("PENY"); - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7fffff, read16_delegate(FUNC(base_md_cart_slot_device::read),(base_md_cart_slot_device*)m_picocart), write16_delegate(FUNC(base_md_cart_slot_device::write),(base_md_cart_slot_device*)m_picocart)); m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xa13000, 0xa130ff, read16_delegate(FUNC(base_md_cart_slot_device::read_a13),(base_md_cart_slot_device*)m_picocart), write16_delegate(FUNC(base_md_cart_slot_device::write_a13),(base_md_cart_slot_device*)m_picocart)); m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xa15000, 0xa150ff, read16_delegate(FUNC(base_md_cart_slot_device::read_a15),(base_md_cart_slot_device*)m_picocart), write16_delegate(FUNC(base_md_cart_slot_device::write_a15),(base_md_cart_slot_device*)m_picocart)); @@ -547,11 +547,6 @@ SLOT_INTERFACE_END MACHINE_START_MEMBER(copera_state,copera) { - m_io_page = ioport("PAGE"); - m_io_pad = ioport("PAD"); - m_io_penx = ioport("PENX"); - m_io_peny = ioport("PENY"); - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7fffff, read16_delegate(FUNC(base_md_cart_slot_device::read),(base_md_cart_slot_device*)m_picocart), write16_delegate(FUNC(base_md_cart_slot_device::write),(base_md_cart_slot_device*)m_picocart)); m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xa13000, 0xa130ff, read16_delegate(FUNC(base_md_cart_slot_device::read_a13),(base_md_cart_slot_device*)m_picocart), write16_delegate(FUNC(base_md_cart_slot_device::write_a13),(base_md_cart_slot_device*)m_picocart)); m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xa15000, 0xa150ff, read16_delegate(FUNC(base_md_cart_slot_device::read_a15),(base_md_cart_slot_device*)m_picocart), write16_delegate(FUNC(base_md_cart_slot_device::write_a15),(base_md_cart_slot_device*)m_picocart)); diff --git a/src/mess/drivers/segapm.c b/src/mess/drivers/segapm.c new file mode 100644 index 00000000000..34d7488e8b3 --- /dev/null +++ b/src/mess/drivers/segapm.c @@ -0,0 +1,80 @@ +/* Sega Picture Magic (codename JANUS) */ +// http://segaretro.org/Sega_Picture_Magic + +// this uses a Sega 32X PCB (not in a 32X case) attached to a stripped down 68k based board rather than a full Genesis / Megadrive +// it is likely the internal SH2 bios roms differ + + +#include "emu.h" +#include "cpu/m68000/m68000.h" + + +class segapm_state : public driver_device +{ +public: + segapm_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu") + { } + + virtual void video_start(); + UINT32 screen_update_segapm(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + required_device<cpu_device> m_maincpu; +}; + + +void segapm_state::video_start() +{ +} + +UINT32 segapm_state::screen_update_segapm(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + return 0; +} + + + +static ADDRESS_MAP_START( segapm_map, AS_PROGRAM, 16, segapm_state ) + AM_RANGE(0x000000, 0x07ffff) AM_ROM + + // A15100 + + AM_RANGE(0xe00000, 0xe7ffff) AM_RAM + +ADDRESS_MAP_END + +static INPUT_PORTS_START( segapm ) +INPUT_PORTS_END + + + + +static MACHINE_CONFIG_START( segapm, segapm_state ) + + MCFG_CPU_ADD("maincpu", M68000, 8000000) // ?? + MCFG_CPU_PROGRAM_MAP(segapm_map) + + // + 2 sh2s on 32x board + + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) + MCFG_SCREEN_SIZE(32*8, 32*8) + MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) + MCFG_SCREEN_UPDATE_DRIVER(segapm_state, screen_update_segapm) + MCFG_SCREEN_PALETTE("palette") + + MCFG_PALETTE_ADD("palette", 0x200) + MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB) +MACHINE_CONFIG_END + + + +ROM_START( segapm ) // was more than one cartridge available? if so softlist them? + ROM_REGION( 0x80000, "maincpu", 0 ) /* 68000 Code */ + ROM_LOAD( "picture magic boot cart (j) [!].bin", 0x00000, 0x80000, CRC(c9ab4e60) SHA1(9c4d4ab3e59c8acde86049a1ba3787aa03b549a3) ) // internal header is GOUSEI HENSYUU + + // todo, sh2 bios roms etc. +ROM_END + +GAME( 1996, segapm, 0, segapm, segapm, driver_device, 0, ROT0, "Sega", "Picture Magic", MACHINE_NO_SOUND | MACHINE_NOT_WORKING ) diff --git a/src/mess/drivers/socrates.c b/src/mess/drivers/socrates.c index fe354a2b955..ddf88ddc002 100644 --- a/src/mess/drivers/socrates.c +++ b/src/mess/drivers/socrates.c @@ -867,7 +867,7 @@ WRITE8_MEMBER( iqunlim_state::video_regs_w ) { rectangle visarea = m_screen->visible_area(); visarea.set(0, (data & 0x02 ? 496 : 256) - 1, 0, 224 - 1); - m_screen->configure(data & 0x02 ? 496 : 256 , 224, visarea, m_screen->frame_period().attoseconds); + m_screen->configure(data & 0x02 ? 496 : 256 , 224, visarea, m_screen->frame_period().attoseconds()); } m_video_regs[offset] = data; diff --git a/src/mess/drivers/sorcerer.c b/src/mess/drivers/sorcerer.c index c2e810de539..bff2e0820a2 100644 --- a/src/mess/drivers/sorcerer.c +++ b/src/mess/drivers/sorcerer.c @@ -199,112 +199,112 @@ static INPUT_PORTS_START(sorcerer) PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_CUSTOM) PORT_VBLANK("screen") /* line 0 */ - PORT_START("X0") + PORT_START("X.0") PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Graphic") PORT_CODE(KEYCODE_F1) PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Stop") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) /* line 1 */ - PORT_START("X1") + PORT_START("X.1") PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(Sel)") PORT_CODE(KEYCODE_F2) PORT_CHAR(27) PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Skip") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Repeat") PORT_CODE(KEYCODE_F4) PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Clear") PORT_CODE(KEYCODE_F5) PORT_CHAR(12) /* line 2 */ - PORT_START("X2") + PORT_START("X.2") PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') PORT_CHAR(0x11) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') PORT_CHAR(0x01) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') PORT_CHAR(0x1a) PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') PORT_CHAR(0x18) /* line 3 */ - PORT_START("X3") + PORT_START("X.3") PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') PORT_CHAR(0x17) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') PORT_CHAR(0x13) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') PORT_CHAR(0x04) PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') PORT_CHAR(0x03) /* line 4 */ - PORT_START("X4") + PORT_START("X.4") PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') PORT_CHAR(0x05) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') PORT_CHAR(0x12) PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') PORT_CHAR(0x06) /* line 5 */ - PORT_START("X5") + PORT_START("X.5") PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') PORT_CHAR(0x14) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') PORT_CHAR(0x07) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') PORT_CHAR(0x16) PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') PORT_CHAR(0x02) /* line 6 */ - PORT_START("X6") + PORT_START("X.6") PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') PORT_CHAR(0x19) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') PORT_CHAR(0x08) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') PORT_CHAR(0x0e) PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') PORT_CHAR(0x0d) /* line 7 */ - PORT_START("X7") + PORT_START("X.7") PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') PORT_CHAR(0x15) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') PORT_CHAR(0x0a) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') PORT_CHAR(0x09) PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') PORT_CHAR(0x0b) /* line 8 */ - PORT_START("X8") + PORT_START("X.8") PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') PORT_CHAR(0x0f) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') PORT_CHAR(0x0c) PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') /* line 9 */ - PORT_START("X9") + PORT_START("X.9") PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') PORT_CHAR(0x10) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("; +") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') /* line 10 */ - PORT_START("XA") + PORT_START("X.10") PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(": *") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@ `") PORT_CODE(KEYCODE_F7) PORT_CHAR('@') PORT_CHAR('`') PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\ |") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') /* line 11 */ - PORT_START("XB") + PORT_START("X.11") PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- =") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^ ~") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LINE FEED") PORT_CODE(KEYCODE_F6) PORT_CHAR(10) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(13) PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("_ Rub") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR('_') PORT_CHAR(8) /* line 12 */ - PORT_START("XC") + PORT_START("X.12") PORT_BIT(0x10, 0x10, IPT_UNUSED) PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- (PAD)") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/ (PAD)") PORT_CODE(KEYCODE_SLASH_PAD) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("* (PAD)") PORT_CODE(KEYCODE_ASTERISK) PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("+ (PAD)") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) /* line 13 */ - PORT_START("XD") + PORT_START("X.13") PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 (PAD)") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 (PAD)") PORT_CODE(KEYCODE_8_PAD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 (PAD)") PORT_CODE(KEYCODE_4_PAD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 (PAD)") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 (PAD)") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) /* line 14 */ - PORT_START("XE") + PORT_START("X.14") PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 (PAD)") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 (PAD)") PORT_CODE(KEYCODE_6_PAD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 (PAD)") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 (PAD)") PORT_CODE(KEYCODE_2_PAD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". (PAD)") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) /* line 15 */ - PORT_START("XF") + PORT_START("X.15") PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 (PAD)") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("= (PAD)") PORT_CODE(KEYCODE_NUMLOCK) PORT_BIT(0x04, 0x04, IPT_UNUSED) diff --git a/src/mess/drivers/ssystem3.c b/src/mess/drivers/ssystem3.c index b95fb8d4b0e..03240af22b5 100644 --- a/src/mess/drivers/ssystem3.c +++ b/src/mess/drivers/ssystem3.c @@ -38,7 +38,6 @@ backup of playfield rom and picture/description of its board #include "emu.h" #include "includes/ssystem3.h" -#include "machine/6522via.h" #include "cpu/m6502/m6502.h" #include "sound/dac.h" @@ -60,7 +59,7 @@ void ssystem3_state::ssystem3_playfield_reset() { memset(&m_playfield, 0, sizeof(m_playfield)); m_playfield.signal=FALSE; - // m_playfield.on=TRUE; //ioport("Configuration")->read()&1; + // m_playfield.on=TRUE; //m_configuration->read()&1; } void ssystem3_state::ssystem3_playfield_write(int reset, int signal) @@ -91,7 +90,7 @@ void ssystem3_state::ssystem3_playfield_write(int reset, int signal) if (d) m_playfield.data|=1<<(m_playfield.bit^7); m_playfield.bit++; if (m_playfield.bit==8) { - logerror("%.4x playfield wrote %d %02x\n", (int)machine().device("maincpu")->safe_pc(), m_playfield.count, m_playfield.data); + logerror("%.4x playfield wrote %d %02x\n", (int)m_maincpu->pc(), m_playfield.count, m_playfield.data); m_playfield.u.data[m_playfield.count]=m_playfield.data; m_playfield.bit=0; m_playfield.count=(m_playfield.count+1)%ARRAY_LENGTH(m_playfield.u.data); @@ -110,7 +109,7 @@ void ssystem3_state::ssystem3_playfield_write(int reset, int signal) void ssystem3_state::ssystem3_playfield_read(int *on, int *ready) { - *on=!(ioport("Configuration")->read()&1); + *on = !(m_configuration->read() & 1); // *on=!m_playfield.on; *ready=FALSE; } @@ -125,39 +124,39 @@ READ8_MEMBER(ssystem3_state::ssystem3_via_read_a) { UINT8 data=0xff; #if 1 // time switch - if (!(m_porta&0x10)) data&=ioport("matrix1")->read()|0xf1; - if (!(m_porta&0x20)) data&=ioport("matrix2")->read()|0xf1; - if (!(m_porta&0x40)) data&=ioport("matrix3")->read()|0xf1; - if (!(m_porta&0x80)) data&=ioport("matrix4")->read()|0xf1; + if (!(m_porta&0x10)) data&=m_matrix[0]->read()|0xf1; + if (!(m_porta&0x20)) data&=m_matrix[1]->read()|0xf1; + if (!(m_porta&0x40)) data&=m_matrix[2]->read()|0xf1; + if (!(m_porta&0x80)) data&=m_matrix[3]->read()|0xf1; #else - if (!(m_porta&0x10)) data&=ioport("matrix1")->read()|0xf0; - if (!(m_porta&0x20)) data&=ioport("matrix2")->read()|0xf0; - if (!(m_porta&0x40)) data&=ioport("matrix3")->read()|0xf0; - if (!(m_porta&0x80)) data&=ioport("matrix4")->read()|0xf0; + if (!(m_porta&0x10)) data&=m_matrix[0]->read()|0xf0; + if (!(m_porta&0x20)) data&=m_matrix[1]->read()|0xf0; + if (!(m_porta&0x40)) data&=m_matrix[2]->read()|0xf0; + if (!(m_porta&0x80)) data&=m_matrix[3]->read()|0xf0; #endif if (!(m_porta&1)) { - if (!(ioport("matrix1")->read()&1)) data&=~0x10; - if (!(ioport("matrix2")->read()&1)) data&=~0x20; - if (!(ioport("matrix3")->read()&1)) data&=~0x40; - if (!(ioport("matrix4")->read()&1)) data&=~0x80; + if (!(m_matrix[0]->read()&1)) data&=~0x10; + if (!(m_matrix[1]->read()&1)) data&=~0x20; + if (!(m_matrix[2]->read()&1)) data&=~0x40; + if (!(m_matrix[3]->read()&1)) data&=~0x80; } if (!(m_porta&2)) { - if (!(ioport("matrix1")->read()&2)) data&=~0x10; - if (!(ioport("matrix2")->read()&2)) data&=~0x20; - if (!(ioport("matrix3")->read()&2)) data&=~0x40; - if (!(ioport("matrix4")->read()&2)) data&=~0x80; + if (!(m_matrix[0]->read()&2)) data&=~0x10; + if (!(m_matrix[1]->read()&2)) data&=~0x20; + if (!(m_matrix[2]->read()&2)) data&=~0x40; + if (!(m_matrix[3]->read()&2)) data&=~0x80; } if (!(m_porta&4)) { - if (!(ioport("matrix1")->read()&4)) data&=~0x10; - if (!(ioport("matrix2")->read()&4)) data&=~0x20; - if (!(ioport("matrix3")->read()&4)) data&=~0x40; - if (!(ioport("matrix4")->read()&4)) data&=~0x80; + if (!(m_matrix[0]->read()&4)) data&=~0x10; + if (!(m_matrix[1]->read()&4)) data&=~0x20; + if (!(m_matrix[2]->read()&4)) data&=~0x40; + if (!(m_matrix[3]->read()&4)) data&=~0x80; } if (!(m_porta&8)) { - if (!(ioport("matrix1")->read()&8)) data&=~0x10; - if (!(ioport("matrix2")->read()&8)) data&=~0x20; - if (!(ioport("matrix3")->read()&8)) data&=~0x40; - if (!(ioport("matrix4")->read()&8)) data&=~0x80; + if (!(m_matrix[0]->read()&8)) data&=~0x10; + if (!(m_matrix[1]->read()&8)) data&=~0x20; + if (!(m_matrix[2]->read()&8)) data&=~0x40; + if (!(m_matrix[3]->read()&8)) data&=~0x80; } // logerror("%.4x via port a read %02x\n",(int)activecpu_get_pc(), data); return data; @@ -197,22 +196,21 @@ READ8_MEMBER(ssystem3_state::ssystem3_via_read_b) WRITE8_MEMBER(ssystem3_state::ssystem3_via_write_b) { - ssystem3_playfield_write(data&1, data&8); - ssystem3_lcd_write(data&4, data&2); + ssystem3_playfield_write(data & 1, data & 8); + ssystem3_lcd_write(data & 4, data & 2); // TODO: figure out what this is trying to achieve - via6522_device *via_0 = machine().device<via6522_device>("via6522_0"); - UINT8 d=ssystem3_via_read_b(space, 0, mem_mask)&~0x40; - if (data&0x80) d|=0x40; + UINT8 d = ssystem3_via_read_b(space, 0, mem_mask) & ~0x40; + if (data & 0x80) d |= 0x40; // d&=~0x8f; - via_0->write_pb0((d>>0)&1); - via_0->write_pb1((d>>1)&1); - via_0->write_pb2((d>>2)&1); - via_0->write_pb3((d>>3)&1); - via_0->write_pb4((d>>4)&1); - via_0->write_pb5((d>>5)&1); - via_0->write_pb6((d>>6)&1); - via_0->write_pb7((d>>7)&1); + m_via6522_0->write_pb0((d >> 0) & 1); + m_via6522_0->write_pb1((d >> 1) & 1); + m_via6522_0->write_pb2((d >> 2) & 1); + m_via6522_0->write_pb3((d >> 3) & 1); + m_via6522_0->write_pb4((d >> 4) & 1); + m_via6522_0->write_pb5((d >> 5) & 1); + m_via6522_0->write_pb6((d >> 6) & 1); + m_via6522_0->write_pb7((d >> 7) & 1); } DRIVER_INIT_MEMBER(ssystem3_state,ssystem3) @@ -252,22 +250,22 @@ static INPUT_PORTS_START( ssystem3 ) //PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("NEW GAME") PORT_CODE(KEYCODE_F3) // seems to be direct wired to reset // PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?CLEAR") PORT_CODE(KEYCODE_F1) // PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?ENTER") PORT_CODE(KEYCODE_ENTER) - PORT_START( "matrix1" ) + PORT_START( "matrix.0" ) PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("?1") PORT_CODE(KEYCODE_1_PAD) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 C SQ EP") PORT_CODE(KEYCODE_9) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER?") PORT_CODE(KEYCODE_ENTER) PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 C BOARD MD") PORT_CODE(KEYCODE_0) - PORT_START( "matrix2" ) + PORT_START( "matrix.1" ) PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("?2") PORT_CODE(KEYCODE_2_PAD) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 F springer zeitvorgabe") PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_F) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 E laeufer ruecknahme") PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_E) PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CE interrupt") PORT_CODE(KEYCODE_BACKSPACE) - PORT_START( "matrix3" ) + PORT_START( "matrix.2" ) PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("?3") PORT_CODE(KEYCODE_3_PAD) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 G bauer zugvorschlaege") PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_G) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 D turm #") PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_D) PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 A white") PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_A) - PORT_START( "matrix4" ) + PORT_START( "matrix.3" ) PORT_DIPNAME( 0x01, 0, "Time") PORT_CODE(KEYCODE_T) PORT_TOGGLE PORT_DIPSETTING( 0, DEF_STR(Off) ) PORT_DIPSETTING( 0x01, DEF_STR( On ) ) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 H black") PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_H) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 C dame #50") PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_C) diff --git a/src/mess/drivers/supracan.c b/src/mess/drivers/supracan.c index 9b2a370c8ec..baf2a4668f1 100644 --- a/src/mess/drivers/supracan.c +++ b/src/mess/drivers/supracan.c @@ -149,7 +149,6 @@ public: DECLARE_READ16_MEMBER(video_r); DECLARE_WRITE16_MEMBER(video_w); DECLARE_WRITE16_MEMBER(vram_w); - DECLARE_WRITE16_MEMBER(paletteram_w); acan_dma_regs_t m_acan_dma_regs; acan_sprdma_regs_t m_acan_sprdma_regs; @@ -1644,7 +1643,7 @@ WRITE16_MEMBER( supracan_state::video_w ) rectangle visarea = machine().first_screen()->visible_area(); visarea.set(0, ((m_video_flags & 0x100) ? 320 : 256) - 1, 8, 232 - 1); - machine().first_screen()->configure(348, 256, visarea, machine().first_screen()->frame_period().attoseconds); + machine().first_screen()->configure(348, 256, visarea, machine().first_screen()->frame_period().attoseconds()); } break; case 0x0a/2: diff --git a/src/mess/drivers/thomson.c b/src/mess/drivers/thomson.c index 6c26574b790..33112623a19 100644 --- a/src/mess/drivers/thomson.c +++ b/src/mess/drivers/thomson.c @@ -304,8 +304,7 @@ static ADDRESS_MAP_START ( to7, AS_PROGRAM, 8, thomson_state ) AM_RANGE ( 0x0000, 0x3fff ) AM_READ_BANK ( THOM_CART_BANK ) AM_WRITE(to7_cartridge_w ) /* 4 * 16 KB */ AM_RANGE ( 0x4000, 0x5fff ) AM_READ_BANK ( THOM_VRAM_BANK ) AM_WRITE(to7_vram_w ) AM_RANGE ( 0x6000, 0x7fff ) AM_RAMBANK ( THOM_BASE_BANK ) /* 1 * 8 KB */ - AM_RANGE ( 0x8000, 0xbfff ) AM_NOP /* 16 KB (for extension) */ - AM_RANGE ( 0xc000, 0xdfff ) AM_NOP /* 8 KB (for extension) */ + AM_RANGE ( 0x8000, 0xdfff ) AM_RAMBANK ( THOM_RAM_BANK ) /* 16 or 24 KB (for extension) */ AM_RANGE ( 0xe000, 0xe7bf ) AM_ROMBANK ( THOM_FLOP_BANK ) AM_RANGE ( 0xe7c0, 0xe7c7 ) AM_DEVREADWRITE("mc6846", mc6846_device, read, write) AM_RANGE ( 0xe7c8, 0xe7cb ) AM_DEVREADWRITE( "pia_0", pia6821_device, read_alt, write_alt ) @@ -480,10 +479,10 @@ INPUT_PORTS_END static INPUT_PORTS_START ( to7_keyboard ) - PORT_START ( "keyboard_0" ) + PORT_START ( "keyboard.0" ) KEY ( 0, "Shift", LSHIFT ) PORT_CODE ( KEYCODE_RSHIFT ) PORT_CHAR(UCHAR_SHIFT_1) PORT_BIT ( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START ( "keyboard_1" ) + PORT_START ( "keyboard.1" ) KEY ( 0, "W", W ) PORT_CHAR('W') KEY ( 1, UTF8_UP, UP ) PORT_CHAR(UCHAR_MAMEKEY(UP)) KEY ( 2, "C \303\247", C ) PORT_CHAR('C') @@ -492,7 +491,7 @@ static INPUT_PORTS_START ( to7_keyboard ) KEY ( 5, "Control", LCONTROL ) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) KEY ( 6, "Accent", END ) PORT_CHAR(UCHAR_MAMEKEY(END)) KEY ( 7, "Stop", TAB ) PORT_CHAR(27) - PORT_START ( "keyboard_2" ) + PORT_START ( "keyboard.2" ) KEY ( 0, "X", X ) PORT_CHAR('X') KEY ( 1, UTF8_LEFT, LEFT ) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) KEY ( 2, "V", V ) PORT_CHAR('V') @@ -501,7 +500,7 @@ static INPUT_PORTS_START ( to7_keyboard ) KEY ( 5, "A", A ) PORT_CHAR('A') KEY ( 6, "+ ;", EQUALS ) PORT_CHAR('+') PORT_CHAR(';') KEY ( 7, "1 !", 1 ) PORT_CHAR('1') PORT_CHAR('!') - PORT_START ( "keyboard_3" ) + PORT_START ( "keyboard.3" ) KEY ( 0, "Space Caps-Lock", SPACE ) PORT_CHAR(' ') PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) KEY ( 1, UTF8_DOWN, DOWN ) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) KEY ( 2, "B", B ) PORT_CHAR('B') @@ -510,7 +509,7 @@ static INPUT_PORTS_START ( to7_keyboard ) KEY ( 5, "Z \305\223", Z) PORT_CHAR('Z') KEY ( 6, "- =", MINUS ) PORT_CHAR('-') PORT_CHAR('=') KEY ( 7, "2 \" \302\250", 2 ) PORT_CHAR('2') PORT_CHAR('"') - PORT_START ( "keyboard_4" ) + PORT_START ( "keyboard.4" ) KEY ( 0, "@ \342\206\221", TILDE ) PORT_CHAR('@') KEY ( 1, UTF8_RIGHT, RIGHT ) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) KEY ( 2, "M", M ) PORT_CHAR('M') @@ -519,7 +518,7 @@ static INPUT_PORTS_START ( to7_keyboard ) KEY ( 5, "E", E ) PORT_CHAR('E') KEY ( 6, "0 \140", 0 ) PORT_CHAR('0') PORT_CHAR( 0140 ) KEY ( 7, "3 #", 3 ) PORT_CHAR('3') PORT_CHAR('#') - PORT_START ( "keyboard_5" ) + PORT_START ( "keyboard.5" ) KEY ( 0, ". >", STOP ) PORT_CHAR('.') PORT_CHAR('>') KEY ( 1, "Home", HOME ) PORT_CHAR(UCHAR_MAMEKEY(HOME)) KEY ( 2, "L", L ) PORT_CHAR('L') @@ -528,7 +527,7 @@ static INPUT_PORTS_START ( to7_keyboard ) KEY ( 5, "R", R ) PORT_CHAR('R') KEY ( 6, "9 )", 9 ) PORT_CHAR('9') PORT_CHAR(')') KEY ( 7, "4 $", 4 ) PORT_CHAR('4') PORT_CHAR('$') - PORT_START ( "keyboard_6" ) + PORT_START ( "keyboard.6" ) KEY ( 0, ", <", COMMA ) PORT_CHAR(',') PORT_CHAR('<') KEY ( 1, "Insert", INSERT ) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) KEY ( 2, "K", K ) PORT_CHAR('K') @@ -537,7 +536,7 @@ static INPUT_PORTS_START ( to7_keyboard ) KEY ( 5, "T", T ) PORT_CHAR('T') KEY ( 6, "8 (", 8 ) PORT_CHAR('8') PORT_CHAR('(') KEY ( 7, "5 %", 5 ) PORT_CHAR('5') PORT_CHAR('%') - PORT_START ( "keyboard_7" ) + PORT_START ( "keyboard.7" ) KEY ( 0, "N", N ) PORT_CHAR('N') KEY ( 1, "Delete", DEL ) PORT_CHAR(8) KEY ( 2, "J \305\222", J ) PORT_CHAR('J') @@ -548,8 +547,8 @@ static INPUT_PORTS_START ( to7_keyboard ) KEY ( 7, "6 &", 6 ) PORT_CHAR('6') PORT_CHAR('&') /* unused */ - PORT_START ( "keyboard_8" ) - PORT_START ( "keyboard_9" ) + PORT_START ( "keyboard.8" ) + PORT_START ( "keyboard.9" ) INPUT_PORTS_END @@ -859,15 +858,15 @@ ROM_END static INPUT_PORTS_START ( to770 ) PORT_INCLUDE ( to7 ) - PORT_MODIFY ( "keyboard_1" ) + PORT_MODIFY ( "keyboard.1" ) KEY ( 2, "C \302\250 \303\247", C ) PORT_CHAR('C') - PORT_MODIFY ( "keyboard_4" ) + PORT_MODIFY ( "keyboard.4" ) KEY ( 6, "0 \140 \303\240", 0 ) PORT_CHAR('0') PORT_CHAR( 0140 ) - PORT_MODIFY ( "keyboard_5" ) + PORT_MODIFY ( "keyboard.5" ) KEY ( 6, "9 ) \303\247", 9 ) PORT_CHAR('9') PORT_CHAR(')') - PORT_MODIFY ( "keyboard_6" ) + PORT_MODIFY ( "keyboard.6" ) KEY ( 6, "8 ( \303\271", 8 ) PORT_CHAR('8') PORT_CHAR('(') - PORT_MODIFY ( "keyboard_7" ) + PORT_MODIFY ( "keyboard.7" ) KEY ( 6, "7 ' \303\250 \302\264", 7 ) PORT_CHAR('7') PORT_CHAR('\'') KEY ( 7, "6 & \303\251", 6 ) PORT_CHAR('6') PORT_CHAR('&') @@ -877,26 +876,26 @@ INPUT_PORTS_END static INPUT_PORTS_START ( to770a ) PORT_INCLUDE ( to770 ) - PORT_MODIFY ( "keyboard_1" ) + PORT_MODIFY ( "keyboard.1" ) KEY ( 0, "Z", Z ) PORT_CHAR('Z') - PORT_MODIFY ( "keyboard_2" ) + PORT_MODIFY ( "keyboard.2" ) KEY ( 3, "A", A ) PORT_CHAR('A') KEY ( 4, "/ ?", QUOTE ) PORT_CHAR('/') PORT_CHAR('?') KEY ( 5, "Q", Q ) PORT_CHAR('Q') - PORT_MODIFY ( "keyboard_3" ) + PORT_MODIFY ( "keyboard.3" ) KEY ( 4, "* :", SLASH ) PORT_CHAR('*') PORT_CHAR(':') KEY ( 5, "W", W) PORT_CHAR('W') - PORT_MODIFY ( "keyboard_4" ) + PORT_MODIFY ( "keyboard.4" ) KEY ( 0, ". >", STOP ) PORT_CHAR('.') PORT_CHAR('>') KEY ( 2, "@ \342\206\221", TILDE ) PORT_CHAR('@') PORT_CHAR('^') KEY ( 6, "0 \302\243 \302\260 \140", 0 ) PORT_CHAR('0') PORT_CHAR( 0140 ) - PORT_MODIFY ( "keyboard_5" ) + PORT_MODIFY ( "keyboard.5" ) KEY ( 0, ", <", COMMA ) PORT_CHAR(',') PORT_CHAR('<') KEY ( 6, "9 ) \303\261", 9 ) PORT_CHAR('9') PORT_CHAR(')') - PORT_MODIFY ( "keyboard_6" ) + PORT_MODIFY ( "keyboard.6" ) KEY ( 0, "M", M ) PORT_CHAR('M') KEY ( 6, "8 ( \303\274", 8 ) PORT_CHAR('8') PORT_CHAR('(') - PORT_MODIFY ( "keyboard_7" ) + PORT_MODIFY ( "keyboard.7" ) KEY ( 6, "7 ' \303\266 \302\264", 7 ) PORT_CHAR('7') PORT_CHAR('\'') KEY ( 7, "6 & \303\244", 6 ) PORT_CHAR('6') PORT_CHAR('&') @@ -1062,7 +1061,7 @@ ROM_END static INPUT_PORTS_START ( mo5 ) PORT_INCLUDE ( to770 ) - PORT_MODIFY ( "keyboard_0" ) + PORT_MODIFY ( "keyboard.0" ) KEY ( 1, "BASIC", RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) PORT_BIT ( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED ) @@ -1072,24 +1071,24 @@ INPUT_PORTS_END static INPUT_PORTS_START ( mo5e ) PORT_INCLUDE ( mo5 ) - PORT_MODIFY ( "keyboard_1" ) + PORT_MODIFY ( "keyboard.1" ) KEY ( 0, "Z", Z ) PORT_CHAR('Z') - PORT_MODIFY ( "keyboard_2" ) + PORT_MODIFY ( "keyboard.2" ) KEY ( 3, "A", A ) PORT_CHAR('A') KEY ( 5, "Q", Q ) PORT_CHAR('Q') - PORT_MODIFY ( "keyboard_3" ) + PORT_MODIFY ( "keyboard.3" ) KEY ( 5, "W", W) PORT_CHAR('W') - PORT_MODIFY ( "keyboard_4" ) + PORT_MODIFY ( "keyboard.4" ) KEY ( 0, ". >", STOP ) PORT_CHAR('.') PORT_CHAR('>') KEY ( 2, "@ \342\206\221", TILDE ) PORT_CHAR('@') PORT_CHAR('^') KEY ( 6, "0 \302\243 \302\260 \140", 0 ) PORT_CHAR('0') PORT_CHAR( 0140 ) - PORT_MODIFY ( "keyboard_5" ) + PORT_MODIFY ( "keyboard.5" ) KEY ( 0, ", <", COMMA ) PORT_CHAR(',') PORT_CHAR('<') KEY ( 6, "9 ) \303\261", 9 ) PORT_CHAR('9') PORT_CHAR(')') - PORT_MODIFY ( "keyboard_6" ) + PORT_MODIFY ( "keyboard.6" ) KEY ( 0, "M", M ) PORT_CHAR('M') KEY ( 6, "8 ( \303\274", 8 ) PORT_CHAR('8') PORT_CHAR('(') - PORT_MODIFY ( "keyboard_7" ) + PORT_MODIFY ( "keyboard.7" ) KEY ( 6, "7 ' \303\266 \302\264", 7 ) PORT_CHAR('7') PORT_CHAR('\'') KEY ( 7, "6 & \303\244", 6 ) PORT_CHAR('6') PORT_CHAR('&') @@ -1298,7 +1297,7 @@ ROM_END /* ------------ inputs ------------ */ static INPUT_PORTS_START ( to9_keyboard ) - PORT_START ( "keyboard_0" ) + PORT_START ( "keyboard.0" ) KEY ( 0, "F2 F7", F2 ) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_CHAR(UCHAR_MAMEKEY(F7)) KEY ( 1, "_ 6", 6 ) PORT_CHAR('_') PORT_CHAR('6') KEY ( 2, "Y", Y ) PORT_CHAR('Y') @@ -1307,7 +1306,7 @@ static INPUT_PORTS_START ( to9_keyboard ) KEY ( 5, UTF8_RIGHT, RIGHT ) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) KEY ( 6, "Home Clear", HOME ) PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_CHAR(UCHAR_MAMEKEY(ESC)) KEY ( 7, "N", N ) PORT_CHAR('N') - PORT_START ( "keyboard_1" ) + PORT_START ( "keyboard.1" ) KEY ( 0, "F3 F8", F3 ) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_CHAR(UCHAR_MAMEKEY(F8)) KEY ( 1, "( 5", 5 ) PORT_CHAR('(') PORT_CHAR('5') KEY ( 2, "T", T ) PORT_CHAR('T') @@ -1316,7 +1315,7 @@ static INPUT_PORTS_START ( to9_keyboard ) KEY ( 5, UTF8_LEFT, LEFT ) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) KEY ( 6, "Insert", INSERT ) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) KEY ( 7, "B \302\264", B ) PORT_CHAR('B') - PORT_START ( "keyboard_2" ) + PORT_START ( "keyboard.2" ) KEY ( 0, "F4 F9", F4 ) PORT_CHAR(UCHAR_MAMEKEY(F4)) PORT_CHAR(UCHAR_MAMEKEY(F9)) KEY ( 1, "' 4", 4 ) PORT_CHAR('\'') PORT_CHAR('4') KEY ( 2, "R", R ) PORT_CHAR('R') @@ -1325,7 +1324,7 @@ static INPUT_PORTS_START ( to9_keyboard ) KEY ( 5, "Keypad 1", 1_PAD ) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) KEY ( 6, "Delete Backspace", DEL ) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE)) KEY ( 7, "V", V ) PORT_CHAR('V') - PORT_START ( "keyboard_3" ) + PORT_START ( "keyboard.3" ) KEY ( 0, "F5 F10", F5 ) PORT_CHAR(UCHAR_MAMEKEY(F5)) PORT_CHAR(UCHAR_MAMEKEY(F10)) KEY ( 1, "\" 3", 3 ) PORT_CHAR('"') PORT_CHAR('3') KEY ( 2, "E", E ) PORT_CHAR('E') @@ -1334,7 +1333,7 @@ static INPUT_PORTS_START ( to9_keyboard ) KEY ( 5, "Keypad 4", 4_PAD ) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) KEY ( 6, "Keypad 0", 0_PAD ) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) KEY ( 7, "C \136", C ) PORT_CHAR('C') - PORT_START ( "keyboard_4" ) + PORT_START ( "keyboard.4" ) KEY ( 0, "F1 F6", F1 ) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_CHAR(UCHAR_MAMEKEY(F6)) KEY ( 1, "\303\251 2", 2 ) PORT_CHAR( 0xe9 ) PORT_CHAR('2') KEY ( 2, "Z", Z ) PORT_CHAR('Z') @@ -1343,7 +1342,7 @@ static INPUT_PORTS_START ( to9_keyboard ) KEY ( 5, "Keypad 2", 2_PAD ) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) KEY ( 6, "Keypad .", DEL_PAD ) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) KEY ( 7, "X", X ) PORT_CHAR('X') - PORT_START ( "keyboard_5" ) + PORT_START ( "keyboard.5" ) KEY ( 0, "# @", TILDE ) PORT_CHAR('#') PORT_CHAR('@') KEY ( 1, "* 1", 1 ) PORT_CHAR('*') PORT_CHAR('1') KEY ( 2, "A \140", A ) PORT_CHAR('A') @@ -1352,7 +1351,7 @@ static INPUT_PORTS_START ( to9_keyboard ) KEY ( 5, "Keypad 5", 5_PAD ) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) KEY ( 6, "Keypad 6", 6_PAD ) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) KEY ( 7, "W", W ) PORT_CHAR('W') - PORT_START ( "keyboard_6" ) + PORT_START ( "keyboard.6" ) KEY ( 0, "Stop", TAB ) PORT_CHAR(27) KEY ( 1, "\303\250 7", 7 ) PORT_CHAR( 0xe8 ) PORT_CHAR('7') KEY ( 2, "U", U ) PORT_CHAR('U') @@ -1361,7 +1360,7 @@ static INPUT_PORTS_START ( to9_keyboard ) KEY ( 5, "Keypad 9", 9_PAD ) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) KEY ( 6, "Keypad Enter", ENTER_PAD ) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) KEY ( 7, ", ?", COMMA ) PORT_CHAR(',') PORT_CHAR('?') - PORT_START ( "keyboard_7" ) + PORT_START ( "keyboard.7" ) KEY ( 0, "Control", LCONTROL ) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) KEY ( 1, "! 8", 8 ) PORT_CHAR('!') PORT_CHAR('8') KEY ( 2, "I", I ) PORT_CHAR('I') @@ -1370,7 +1369,7 @@ static INPUT_PORTS_START ( to9_keyboard ) KEY ( 5, UTF8_DOWN, DOWN ) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) KEY ( 6, "] }", BACKSLASH ) PORT_CHAR(']') PORT_CHAR('}') KEY ( 7, "; .", STOP ) PORT_CHAR(';') PORT_CHAR('.') - PORT_START ( "keyboard_8" ) + PORT_START ( "keyboard.8" ) KEY ( 0, "Caps-Lock", CAPSLOCK ) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) KEY ( 1, "\303\247 9", 9 ) PORT_CHAR( 0xe7 ) PORT_CHAR('9') KEY ( 2, "O", O ) PORT_CHAR('O') @@ -1379,7 +1378,7 @@ static INPUT_PORTS_START ( to9_keyboard ) KEY ( 5, "\303\271 %", COLON ) PORT_CHAR( 0xf9 ) PORT_CHAR('%') KEY ( 6, "Enter", ENTER ) PORT_CHAR(13) KEY ( 7, ": /", SLASH ) PORT_CHAR(':') PORT_CHAR('/') - PORT_START ( "keyboard_9" ) + PORT_START ( "keyboard.9" ) KEY ( 0, "Shift", LSHIFT ) PORT_CODE ( KEYCODE_RSHIFT ) PORT_CHAR(UCHAR_SHIFT_1) KEY ( 1, "\303\240 0", 0 ) PORT_CHAR( 0xe0 ) PORT_CHAR('0') KEY ( 2, "P", P ) PORT_CHAR('P') @@ -2015,7 +2014,7 @@ ROM_END static INPUT_PORTS_START ( mo6_keyboard ) - PORT_START ( "keyboard_0" ) + PORT_START ( "keyboard.0" ) KEY ( 0, "N", N ) PORT_CHAR('N') KEY ( 1, ", ?", COMMA ) PORT_CHAR(',') PORT_CHAR('?') KEY ( 2, "; .", STOP ) PORT_CHAR(';') PORT_CHAR('.') @@ -2024,7 +2023,7 @@ static INPUT_PORTS_START ( mo6_keyboard ) KEY ( 5, "X", X ) PORT_CHAR('X') KEY ( 6, "W", W ) PORT_CHAR('W') KEY ( 7, "Shift", LSHIFT ) PORT_CODE ( KEYCODE_RSHIFT ) PORT_CHAR(UCHAR_SHIFT_1) - PORT_START ( "keyboard_1" ) + PORT_START ( "keyboard.1" ) KEY ( 0, "Delete Backspace", DEL ) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE)) KEY ( 1, "Insert", INSERT ) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) KEY ( 2, "> <", BACKSLASH2 ) PORT_CHAR('>') PORT_CHAR('<') @@ -2033,7 +2032,7 @@ static INPUT_PORTS_START ( mo6_keyboard ) KEY ( 5, UTF8_LEFT, LEFT ) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) KEY ( 6, UTF8_UP, UP ) PORT_CHAR(UCHAR_MAMEKEY(UP)) KEY ( 7, "BASIC", RCONTROL ) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) - PORT_START ( "keyboard_2" ) + PORT_START ( "keyboard.2" ) KEY ( 0, "J", J ) PORT_CHAR('J') KEY ( 1, "K", K ) PORT_CHAR('K') KEY ( 2, "L", L ) PORT_CHAR('L') @@ -2042,7 +2041,7 @@ static INPUT_PORTS_START ( mo6_keyboard ) KEY ( 5, "V", V ) PORT_CHAR('V') KEY ( 6, "C \136", C ) PORT_CHAR('C') KEY ( 7, "Caps-Lock", CAPSLOCK ) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_START ( "keyboard_3" ) + PORT_START ( "keyboard.3" ) KEY ( 0, "H \302\250", H ) PORT_CHAR('H') KEY ( 1, "G", G ) PORT_CHAR('G') KEY ( 2, "F", F ) PORT_CHAR('F') @@ -2051,7 +2050,7 @@ static INPUT_PORTS_START ( mo6_keyboard ) KEY ( 5, "Q", Q ) PORT_CHAR('Q') KEY ( 6, "Home Clear", HOME ) PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_CHAR(UCHAR_MAMEKEY(ESC)) KEY ( 7, "F1 F6", F1 ) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_START ( "keyboard_4" ) + PORT_START ( "keyboard.4" ) KEY ( 0, "U", U ) PORT_CHAR('U') KEY ( 1, "I", I ) PORT_CHAR('I') KEY ( 2, "O", O ) PORT_CHAR('O') @@ -2060,7 +2059,7 @@ static INPUT_PORTS_START ( mo6_keyboard ) KEY ( 5, "$ &", CLOSEBRACE ) PORT_CHAR('$') PORT_CHAR('&') KEY ( 6, "Enter", ENTER ) PORT_CHAR(13) KEY ( 7, "F2 F7", F2 ) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_START ( "keyboard_5" ) + PORT_START ( "keyboard.5" ) KEY ( 0, "Y", Y ) PORT_CHAR('Y') KEY ( 1, "T", T ) PORT_CHAR('T') KEY ( 2, "R", R ) PORT_CHAR('R') @@ -2069,7 +2068,7 @@ static INPUT_PORTS_START ( mo6_keyboard ) KEY ( 5, "A \140", A ) PORT_CHAR('A') KEY ( 6, "Control", LCONTROL ) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) KEY ( 7, "F3 F8", F3 ) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_CHAR(UCHAR_MAMEKEY(F8)) - PORT_START ( "keyboard_6" ) + PORT_START ( "keyboard.6" ) KEY ( 0, "7 \303\250", 7 ) PORT_CHAR('7') PORT_CHAR( 0xe8 ) KEY ( 1, "8 !", 8 ) PORT_CHAR('8') PORT_CHAR('!') KEY ( 2, "9 \303\247", 9 ) PORT_CHAR('9') PORT_CHAR( 0xe7 ) @@ -2078,7 +2077,7 @@ static INPUT_PORTS_START ( mo6_keyboard ) KEY ( 5, "= +", EQUALS ) PORT_CHAR('=') PORT_CHAR('+') KEY ( 6, "Accent", END ) PORT_CHAR(UCHAR_MAMEKEY(END)) KEY ( 7, "F4 F9", F4 ) PORT_CHAR(UCHAR_MAMEKEY(F4)) PORT_CHAR(UCHAR_MAMEKEY(F9)) - PORT_START ( "keyboard_7" ) + PORT_START ( "keyboard.7" ) KEY ( 0, "6 _", 6 ) PORT_CHAR('6') PORT_CHAR('_') KEY ( 1, "5 (", 5 ) PORT_CHAR('5') PORT_CHAR('(') KEY ( 2, "4 '", 4 ) PORT_CHAR('4') PORT_CHAR('\'') @@ -2087,7 +2086,7 @@ static INPUT_PORTS_START ( mo6_keyboard ) KEY ( 5, "1 *", 1 ) PORT_CHAR('1') PORT_CHAR('*') KEY ( 6, "Stop", TAB ) PORT_CHAR(27) KEY ( 7, "F5 F10", F5 ) PORT_CHAR(UCHAR_MAMEKEY(F5)) PORT_CHAR(UCHAR_MAMEKEY(F10)) - PORT_START ( "keyboard_8" ) + PORT_START ( "keyboard.8" ) KEY ( 0, "[ {", QUOTE ) PORT_CHAR('[') PORT_CHAR('{') KEY ( 1, "] }", BACKSLASH ) PORT_CHAR(']') PORT_CHAR('}') KEY ( 2, ") \302\260", MINUS ) PORT_CHAR(')') PORT_CHAR( 0xb0 ) @@ -2096,7 +2095,7 @@ static INPUT_PORTS_START ( mo6_keyboard ) PORT_BIT ( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) /* unused */ - PORT_START ( "keyboard_9" ) + PORT_START ( "keyboard.9" ) INPUT_PORTS_END @@ -2104,39 +2103,39 @@ INPUT_PORTS_END static INPUT_PORTS_START ( pro128_keyboard ) PORT_INCLUDE ( mo6_keyboard ) - PORT_MODIFY ( "keyboard_0" ) + PORT_MODIFY ( "keyboard.0" ) KEY ( 1, "M", M ) PORT_CHAR('M') KEY ( 2, ", ;", COMMA ) PORT_CHAR(',') PORT_CHAR(';') KEY ( 3, "[ {", QUOTE ) PORT_CHAR('[') PORT_CHAR('{') KEY ( 6, "Z", Z ) PORT_CHAR('Z') KEY ( 7, "Shift", LSHIFT ) PORT_CODE ( KEYCODE_RSHIFT ) PORT_CHAR(UCHAR_SHIFT_1) - PORT_MODIFY ( "keyboard_1" ) + PORT_MODIFY ( "keyboard.1" ) KEY ( 2, "- _", MINUS ) PORT_CHAR('-') PORT_CHAR('_') - PORT_MODIFY ( "keyboard_2" ) + PORT_MODIFY ( "keyboard.2" ) KEY ( 3, "\303\221", TILDE ) PORT_CHAR( 0xd1 ) - PORT_MODIFY ( "keyboard_3" ) + PORT_MODIFY ( "keyboard.3" ) KEY ( 5, "A \140", A ) PORT_CHAR('A') - PORT_MODIFY ( "keyboard_4" ) + PORT_MODIFY ( "keyboard.4" ) KEY ( 4, ". :", STOP ) PORT_CHAR('.') PORT_CHAR(':') KEY ( 5, "+ *", BACKSPACE ) PORT_CHAR('+') PORT_CHAR('*') - PORT_MODIFY ( "keyboard_5" ) + PORT_MODIFY ( "keyboard.5" ) KEY ( 4, "W", W ) PORT_CHAR('W') KEY ( 5, "Q", Q ) PORT_CHAR('Q') - PORT_MODIFY ( "keyboard_6" ) + PORT_MODIFY ( "keyboard.6" ) KEY ( 0, "7 /", 7 ) PORT_CHAR('7') PORT_CHAR('/') KEY ( 1, "8 (", 8 ) PORT_CHAR('8') PORT_CHAR('(') KEY ( 2, "9 )", 9 ) PORT_CHAR('9') PORT_CHAR(')') KEY ( 3, "0 =", 0 ) PORT_CHAR('0') PORT_CHAR('=') KEY ( 4, "' \302\243", CLOSEBRACE ) PORT_CHAR('\'') PORT_CHAR( 0xa3 ) KEY ( 5, "] }", BACKSLASH ) PORT_CHAR(']') PORT_CHAR('}') - PORT_MODIFY ( "keyboard_7" ) + PORT_MODIFY ( "keyboard.7" ) KEY ( 0, "6 &", 6 ) PORT_CHAR('6') PORT_CHAR('&') KEY ( 1, "5 %", 5 ) PORT_CHAR('5') PORT_CHAR('%') KEY ( 2, "4 $", 4 ) PORT_CHAR('4') PORT_CHAR('$') KEY ( 3, "3 \302\247", 3 ) PORT_CHAR('3') PORT_CHAR( 0xa7 ) KEY ( 4, "2 \"", 2 ) PORT_CHAR('2') PORT_CHAR('"') KEY ( 5, "1 !", 1 ) PORT_CHAR('1') PORT_CHAR('!') - PORT_MODIFY ( "keyboard_8" ) + PORT_MODIFY ( "keyboard.8" ) KEY ( 0, "> <", BACKSLASH2 ) PORT_CHAR('>') PORT_CHAR('<') KEY ( 1, "# \342\206\221", EQUALS ) PORT_CHAR('#') PORT_CHAR('^') KEY ( 2, "\303\247 ?", COLON ) PORT_CHAR( 0xe7 ) PORT_CHAR('?') @@ -2320,7 +2319,7 @@ ROM_END static INPUT_PORTS_START ( mo5nr_keyboard ) - PORT_START ( "keyboard_0" ) + PORT_START ( "keyboard.0" ) KEY ( 0, "N", N ) PORT_CHAR('N') KEY ( 1, ", <", COMMA ) PORT_CHAR(',') PORT_CHAR('<') KEY ( 2, ". >", STOP ) PORT_CHAR('.') PORT_CHAR('>') @@ -2329,7 +2328,7 @@ static INPUT_PORTS_START ( mo5nr_keyboard ) KEY ( 5, "X", X ) PORT_CHAR('X') KEY ( 6, "W", W ) PORT_CHAR('W') KEY ( 7, "Shift", LSHIFT ) PORT_CODE ( KEYCODE_RSHIFT ) PORT_CHAR(UCHAR_SHIFT_1) - PORT_START ( "keyboard_1" ) + PORT_START ( "keyboard.1" ) KEY ( 0, "Delete Backspace", DEL ) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE)) KEY ( 1, "Insert", INSERT ) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) KEY ( 2, "Home", HOME ) PORT_CHAR(UCHAR_MAMEKEY(HOME)) @@ -2338,7 +2337,7 @@ static INPUT_PORTS_START ( mo5nr_keyboard ) KEY ( 5, UTF8_LEFT, LEFT ) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) KEY ( 6, UTF8_UP, UP ) PORT_CHAR(UCHAR_MAMEKEY(UP)) KEY ( 7, "BASIC", RCONTROL ) - PORT_START ( "keyboard_2" ) + PORT_START ( "keyboard.2" ) KEY ( 0, "J", J ) PORT_CHAR('J') KEY ( 1, "K", K ) PORT_CHAR('K') KEY ( 2, "L", L ) PORT_CHAR('L') @@ -2347,7 +2346,7 @@ static INPUT_PORTS_START ( mo5nr_keyboard ) KEY ( 5, "V", V ) PORT_CHAR('V') KEY ( 6, "C \136", C ) PORT_CHAR('C') PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START ( "keyboard_3" ) + PORT_START ( "keyboard.3" ) KEY ( 0, "H \302\250", H ) PORT_CHAR('H') KEY ( 1, "G", G ) PORT_CHAR('G') KEY ( 2, "F", F ) PORT_CHAR('F') @@ -2356,7 +2355,7 @@ static INPUT_PORTS_START ( mo5nr_keyboard ) KEY ( 5, "Q", Q ) PORT_CHAR('Q') KEY ( 6, "Clear", ESC ) PORT_CHAR(UCHAR_MAMEKEY(ESC)) PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START ( "keyboard_4" ) + PORT_START ( "keyboard.4" ) KEY ( 0, "U", U ) PORT_CHAR('U') KEY ( 1, "I", I ) PORT_CHAR('I') KEY ( 2, "O", O ) PORT_CHAR('O') @@ -2365,7 +2364,7 @@ static INPUT_PORTS_START ( mo5nr_keyboard ) KEY ( 5, "* :", QUOTE ) PORT_CHAR('*') PORT_CHAR(':') KEY ( 6, "Enter", ENTER ) PORT_CHAR(13) PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START ( "keyboard_5" ) + PORT_START ( "keyboard.5" ) KEY ( 0, "Y", Y ) PORT_CHAR('Y') KEY ( 1, "T", T ) PORT_CHAR('T') KEY ( 2, "R", R ) PORT_CHAR('R') @@ -2374,7 +2373,7 @@ static INPUT_PORTS_START ( mo5nr_keyboard ) KEY ( 5, "A \140", A ) PORT_CHAR('A') KEY ( 6, "Control", LCONTROL ) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START ( "keyboard_6" ) + PORT_START ( "keyboard.6" ) KEY ( 0, "7 ' \303\250", 7 ) PORT_CHAR('7') PORT_CHAR('\'' ) KEY ( 1, "8 ( \303\271", 8 ) PORT_CHAR('8') PORT_CHAR('(') KEY ( 2, "9 ) \303\247", 9 ) PORT_CHAR('9') PORT_CHAR(')') @@ -2383,7 +2382,7 @@ static INPUT_PORTS_START ( mo5nr_keyboard ) KEY ( 5, "+ ;", EQUALS ) PORT_CHAR('+') PORT_CHAR(';') KEY ( 6, "Accent", END ) PORT_CHAR(UCHAR_MAMEKEY(END)) PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START ( "keyboard_7" ) + PORT_START ( "keyboard.7" ) KEY ( 0, "6 & \303\251", 6 ) PORT_CHAR('6') PORT_CHAR('&') KEY ( 1, "5 %", 5 ) PORT_CHAR('5') PORT_CHAR('%') KEY ( 2, "4 $", 4 ) PORT_CHAR('4') PORT_CHAR('$') @@ -2394,8 +2393,8 @@ static INPUT_PORTS_START ( mo5nr_keyboard ) PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) /* unused */ - PORT_START ( "keyboard_8" ) - PORT_START ( "keyboard_9" ) + PORT_START ( "keyboard.8" ) + PORT_START ( "keyboard.9" ) INPUT_PORTS_END diff --git a/src/mess/drivers/ti990_10.c b/src/mess/drivers/ti990_10.c index 75ab566afb5..21c0fe33010 100644 --- a/src/mess/drivers/ti990_10.c +++ b/src/mess/drivers/ti990_10.c @@ -73,8 +73,8 @@ TODO : #include "cpu/tms9900/ti990_10.h" #include "sound/beep.h" -#include "machine/ti99/990_hd.h" -#include "machine/ti99/990_tap.h" +#include "bus/ti99x/990_hd.h" +#include "bus/ti99x/990_tap.h" #include "video/911_vdt.h" diff --git a/src/mess/drivers/ti990_4.c b/src/mess/drivers/ti990_4.c index df7d7f9e38d..b18fe23ff34 100644 --- a/src/mess/drivers/ti990_4.c +++ b/src/mess/drivers/ti990_4.c @@ -44,7 +44,7 @@ TODO: #include "sound/beep.h" #include "video/733_asr.h" -#include "machine/ti99/990_dk.h" +#include "bus/ti99x/990_dk.h" class ti990_4_state : public driver_device diff --git a/src/mess/drivers/ti99_4p.c b/src/mess/drivers/ti99_4p.c index 637f7120900..0f1e1e9e4c7 100644 --- a/src/mess/drivers/ti99_4p.c +++ b/src/mess/drivers/ti99_4p.c @@ -44,9 +44,11 @@ #include "machine/tms9901.h" #include "imagedev/cassette.h" -#include "machine/ti99/videowrp.h" + +#include "bus/ti99x/videowrp.h" +#include "bus/ti99x/joyport.h" + #include "bus/ti99_peb/peribox.h" -#include "machine/ti99/joyport.h" #define TMS9901_TAG "tms9901" #define SGCPU_TAG "sgcpu" diff --git a/src/mess/drivers/ti99_4x.c b/src/mess/drivers/ti99_4x.c index c6ebe5ccf39..8980453a0fd 100644 --- a/src/mess/drivers/ti99_4x.c +++ b/src/mess/drivers/ti99_4x.c @@ -46,11 +46,12 @@ #include "machine/tms9901.h" #include "imagedev/cassette.h" -#include "machine/ti99/videowrp.h" -#include "machine/ti99/datamux.h" -#include "machine/ti99/grom.h" -#include "machine/ti99/gromport.h" -#include "machine/ti99/joyport.h" +#include "bus/ti99x/videowrp.h" +#include "bus/ti99x/datamux.h" +#include "bus/ti99x/grom.h" +#include "bus/ti99x/gromport.h" +#include "bus/ti99x/joyport.h" + #include "bus/ti99_peb/peribox.h" // Debugging diff --git a/src/mess/drivers/ti99_8.c b/src/mess/drivers/ti99_8.c index 1e046c9ff1a..eeaacff3591 100644 --- a/src/mess/drivers/ti99_8.c +++ b/src/mess/drivers/ti99_8.c @@ -205,14 +205,13 @@ Known Issues (MZ, 2010-11-07) #include "machine/tms9901.h" #include "imagedev/cassette.h" -#include "machine/ti99/videowrp.h" -#include "machine/ti99/speech8.h" +#include "bus/ti99x/998board.h" +#include "bus/ti99x/videowrp.h" +#include "bus/ti99x/grom.h" +#include "bus/ti99x/gromport.h" +#include "bus/ti99x/joyport.h" #include "bus/ti99_peb/peribox.h" -#include "machine/ti99/mapper8.h" -#include "machine/ti99/grom.h" -#include "machine/ti99/gromport.h" -#include "machine/ti99/joyport.h" // Debugging #define TRACE_READY 0 @@ -1027,7 +1026,7 @@ static MACHINE_CONFIG_START( ti99_8, ti99_8_state ) MCFG_GROM_LIBRARY_ADD3(pascal3_grom, pascal3) /* Devices */ - MCFG_DEVICE_ADD(SPEECH_TAG, TI99_SPEECH8, 0) + MCFG_DEVICE_ADD(SPEECH_TAG, SPEECH8, 0) MCFG_SPEECH8_READY_CALLBACK(WRITELINE(ti99_8_state, console_ready_speech)) // Joystick port diff --git a/src/mess/drivers/ticalc1x.c b/src/mess/drivers/ticalc1x.c index e72f822ecdb..59c20ab391e 100644 --- a/src/mess/drivers/ticalc1x.c +++ b/src/mess/drivers/ticalc1x.c @@ -11,7 +11,6 @@ TODO: - MCU clocks are unknown where noted - - lilprof78 equals-sign is always on ***************************************************************************/ @@ -686,7 +685,7 @@ WRITE16_MEMBER(lilprof78_state::write_r) m_display_state[y] = (r >> y & 1) ? o : 0; // 3rd digit A/G(equals sign) is from O7 - m_display_state[3] = (m_o & 0x80) ? 0x41 : 0; + m_display_state[3] = (r && m_o & 0x80) ? 0x41 : 0; // 6th digit is a custom 7seg for math symbols (see wizatron_state write_r) m_display_state[6] = BITSWAP8(m_display_state[6],7,6,1,4,2,3,5,0); @@ -774,6 +773,11 @@ MACHINE_CONFIG_END * TI Business Analyst-I: TMS0980 MCU labeled TMC0982NL. die labeled 0980B-82F * 9-digit 7seg LED display + Of note is a peripheral by Schoenherr, called the Braillotron. It acts as + a docking station to the TI-30, with an additional display made of magnetic + refreshable Braille cells. The TI-30 itself is slightly modified to wire + the original LED display to a 25-pin D-Sub connector. + ***************************************************************************/ class majestic_state : public ticalc1x_state diff --git a/src/mess/drivers/tispeak.c b/src/mess/drivers/tispeak.c index c75306c5b67..084bf37f50b 100644 --- a/src/mess/drivers/tispeak.c +++ b/src/mess/drivers/tispeak.c @@ -1,10 +1,10 @@ // license:BSD-3-Clause -// copyright-holders:hap, Jonathan Gevaryahu +// copyright-holders:hap, Jonathan Gevaryahu, Sean Riddle /*************************************************************************** ** subclass of hh_tms1k_state (includes/hh_tms1k.h, drivers/hh_tms1k.c) ** - Texas Instruments 1st-gen. handheld speech devices, + Texas Instruments 1st-gen. handheld speech devices. These devices, mostly edu-toys, are based around an MCU(TMS0270/TMS1100), TMS51xx speech, and VSM ROM(s). Newer devices, such as Speak & Music, @@ -21,7 +21,7 @@ Some of these may have pre-release bugs. Speak & Spell: US4189779 Speak & Math: US4946391 - Touch & Tell: US4403965** (patent calls it "Speak & Seek") + Touch & Tell: US4403965, EP0048835A2 (patent calls it "Speak & Seek") Language Translator: US4631748 @@ -33,32 +33,38 @@ above expectations. TI continued to manufacture many products for this line. Speak & Spell (US), 1978 - MCU: TMC0271* - - TMS51xx(1/2): 16KB TMC0351NL - - TMS51xx(2/2): 16KB TMC0352NL + - TMS51xx: TMC0281 + - VSM(1/2): 16KB TMC0351NL + - VSM(2/2): 16KB TMC0352NL + - VFD: NEC FIP8A5AR no. 3A - notes: keyboard has buttons instead of cheap membrane Speak & Spell (US), 1979 - MCU: TMC0271* (different from 1978 version) - - TMS51xx(1/2): 16KB TMC0351N2L - - TMS51xx(2/2): 16KB TMC0352N2L + - TMS51xx: TMC0281 + - VSM(1/2): 16KB TMC0351N2L + - VSM(2/2): 16KB TMC0352N2L - notes: fixed a funny bug with gibberish-talk when Module button is pressed with no module inserted Speak & Spell (US), 1980 - MCU: TMC0271* (same as 1979 version) - - TMS51xx: 16KB CD2350 (rev.A) + - TMS51xx: TMC0281D + - VSM: 16KB CD2350(rev.A) - notes: only 1 VSM, meaning much smaller internal vocabulary Speak & Spell (Japan), 1980 - MCU: TMC0271* (assume same as US 1978 or 1979 version) - - TMS51xx(1/2): 16KB CD2321 - - TMS51xx(2/2): 16KB CD2322 + - TMS51xx: TMC0281 + - VSM(1/2): 16KB CD2321 + - VSM(2/2): 16KB CD2322 - notes: no local name for the product, words are in English but very low difficulty Speak & Spell (UK), 1978 - MCU: TMC0271* (assume same as US 1978 version) - - TMS51xx(1/2): 16KB CD2303 - - TMS51xx(2/2): 16KB CD2304 + - TMS51xx: TMC0281 + - VSM(1/2): 16KB CD2303 + - VSM(2/2): 16KB CD2304 - notes: voice data was manually altered to give it a UK accent, here's a small anecdote from developer: "(...) I cannot bear to listen the product even now. I remember the @@ -66,31 +72,33 @@ above expectations. TI continued to manufacture many products for this line. Speak & Spell (UK), 1981 - MCU: TMC0271* (assume same as US 1979 version) - - TMS51xx: 16KB CD62175 + - TMS51xx: CD2801 + - VSM: 16KB CD62175 - notes: this one has a dedicated voice actor Speak & Spell (France) "La Dictee Magique", 1980 - MCU: CD2702** - - TMS51xx: 16KB CD2352 + - TMS51xx: CD2801 + - VSM: 16KB CD2352 Speak & Spell (Germany) "Buddy", 1980 - - MCU: CD2702** (same as French 1980 version) - - TMS51xx(1/2): 16KB CD2345* - - TMS51xx(2/2): 16KB CD2346* + - MCU & TMS51xx: same as French 1980 version + - VSM(1/2): 16KB CD2345* + - VSM(2/2): 16KB CD2346* Speak & Spell (Italy) "Grillo Parlante", 1982 - - MCU: CD2702** (same as French 1980 version) - - TMS51xx: 16KB? CD62190** + - MCU & TMS51xx: same as French 1980 version + - VSM: 16KB CD62190 Speak & Spell Compact (US), 1981 - MCU: CD8011** - - TMS51xx: 16KB CD2354 - - TMS51xx: 16KB CD2354A (rev.A) + - TMS51xx: TMC0281D + - VSM: 16KB CD2354, CD2354(rev.A) - notes: no display, MCU is TMS1100 instead of TMS0270 Speak & Spell Compact (UK) "Speak & Write", 1981 - - MCU: CD8011** (same as US 1981 version) - - TMS51xx: 16KB CD62174 (rev.A) + - MCU & TMS51xx: same as US 1981 version + - VSM: 16KB CD62174(rev.A) - notes: anecdotes from the developer, the same person working on the original UK version: "We included a pencil and writing pad - it was now about 'writing'.", and one about the welcome message: @@ -103,34 +111,35 @@ Speak & Spell modules: Note that they are interchangeable, eg. you can use a French module on a US Speak & Spell. English: - - Vowel Power: TMS51xx: 16KB CD2302 - - Number Stumpers 4-6: TMS51xx: 16KB CD2305 - - Number Stumpers 7-8: TMS51xx: 16KB CD2307 (rev.A) - - Basic Builders: TMS51xx: 16KB CD2308 - - Mighty Verbs: TMS51xx: 16KB CD2309 (rev.B) - - Homonym Heroes: TMS51xx: 16KB CD2310 - - Vowel Ventures: TMS51xx: 16KB CD2347 (rev.C) - - Noun Endings: TMS51xx: 16KB CD2348 - - Magnificent Modifiers: TMS51xx: 16KB CD2349 - - E.T. Fantasy: TMS51xx: 16KB CD2360 + - Vowel Power: VSM: 16KB CD2302 + - Number Stumpers 4-6: VSM: 16KB CD2305 + - Number Stumpers 7-8: VSM: 16KB CD2307(rev.A) + - Basic Builders: VSM: 16KB CD2308 + - Mighty Verbs: VSM: 16KB CD2309(rev.B) + - Homonym Heroes: VSM: 16KB CD2310 + - Vowel Ventures: VSM: 16KB CD2347(rev.C) + - Noun Endings: VSM: 16KB CD2348 + - Magnificent Modifiers: VSM: 16KB CD2349 + - E.T. Fantasy: VSM: 16KB CD2360 French: - - No.1: Les Mots de Base: TMS51xx: 16KB CD2353 (1st release was called "Module No. 1 de Jacques Capelovici") - - No.2: Les Mots Difficilies: TMS51xx: 16KB? CD62177* - - No.3: Les Animaux Familiers: TMS51xx: 16KB? CD62047 - - No.4: Les Magasins De La Rue: TMS51xx: 16KB CD62048 - - No.5: Les Extra-Terrestres: TMS51xx: 16KB? CD62178* + - No.1: Les Mots de Base: VSM: 16KB CD2353 (1st release was called "Module No. 1 de Jacques Capelovici") + - No.2: Les Mots Difficilies: VSM: 16KB? CD62177* + - No.3: Les Animaux Familiers: VSM: 16KB? CD62047* + - No.4: Les Magasins De La Rue: VSM: 16KB CD62048 + - No.5: Les Extra-Terrestres: VSM: 16KB? CD62178* Italian: - - Super Modulo: TMS51xx: 16KB? CD62313* + - Super Modulo: VSM: 16KB? CD62313* Speak & Math: Speak & Math (US), 1980 (renamed to "Speak & Maths" in UK, but is the same product) - MCU: CD2704* - - TMS51xx(1/2): 16KB CD2392 - - TMS51xx(2/2): 16KB CD2393 + - TMS51xx: CD2801 + - VSM(1/2): 16KB CD2392 + - VSM(2/2): 16KB CD2393 - notes: As with the Speak & Spell, the voice actor was a radio announcer. However, the phrase "is greater than or less than" had to be added in a hurry by one of the TI employees in a hurry, the day before a demo. @@ -138,12 +147,14 @@ Speak & Math: Speak & Math (US), 1986 - MCU: CD2708, labeled CD2708N2L (die labeled TMC0270F 2708A) - - TMS51xx(1/2): 16KB CD2381 - - TMS51xx(2/2): 4KB CD2614 + - TMS51xx: CD2801 + - VSM(1/2): 16KB CD2381 + - VSM(2/2): 4KB CD2614 Speak & Math 'Compact' (France) "Les Maths Magiques", 1986? - MCU: CP3447-NL* (TMS1100?) - - CD2801: 16KB? CD62173* + - TMS51xx: CD2801 + - VSM: 16KB? CD62173* - notes: this is not the same as "Le Calcul Magique", that's from a series centered around a TMS50C40 instead of MCU+TMS51xx @@ -152,57 +163,131 @@ Speak & Read: Speak & Read (US), 1980 - MCU: CD2705, labeled CD2705B-N2L (die labeled TMC0270E 2705B) - 2nd revision? - - TMS51xx(1/2): 16KB CD2394 (rev.A) - - TMS51xx(2/2): 16KB CD2395 (rev.A) + - TMS51xx: CD2801 + - VSM(1/2): 16KB CD2394(rev.A) + - VSM(2/2): 16KB CD2395(rev.A) Speak & Read modules: English: - - Sea Sights: TMS51xx: 16KB CD2396 (rev.A) - - Who's Who at the Zoo: TMS51xx: 16KB CD2397 - - A Dog on a Log: TMS51xx: 16KB CD3534 (rev.A) - - The Seal That Could Fly: TMS51xx: 16KB CD3535 - - A Ghost in the House: TMS51xx: 16KB CD3536* - - On the Track: TMS51xx: 16KB CD3538 - - The Third Circle: TMS51xx: 16KB CD3539* - - The Millionth Knight: TMS51xx: 16KB CD3540 + - Sea Sights: VSM: 16KB CD2396(rev.A) + - Who's Who at the Zoo: VSM: 16KB CD2397 + - A Dog on a Log: VSM: 16KB CD3534(rev.A) + - The Seal That Could Fly: VSM: 16KB CD3535 + - A Ghost in the House: VSM: 16KB CD3536* + - On the Track: VSM: 16KB CD3538 + - The Third Circle: VSM: 16KB CD3539* + - The Millionth Knight: VSM: 16KB CD3540 Touch & Tell: Touch & Tell (US), 1981 - - MCU: CD8012** - - TMS51xx: 4KB CD2610 + - MCU: CD8012 + - TMS51xx: CD2802 + - VSM: 4KB CD2610 - notes: MCU is TMS1100 instead of TMS0270. CD8010 is seen in some devices too, maybe an earlier version? Touch & Tell (UK), 1981 - - MCU: ?* (assume same as US version) - - TMS51xx: ?KB CD62170* + - MCU & TMS51xx: same as US version + - VSM: 16KB CD62170 Touch & Tell (France) "Le Livre Magique", 1981 - - MCU: ?* (assume same as US version) - - TMS51xx: ?KB CD62171* + - MCU & TMS51xx: same as US version + - VSM: 16KB CD62171 Touch & Tell (Germany) "Tipp & Sprich", 1981 - - MCU: ?* (assume same as US version) - - TMS51xx: ?KB CD62172* + - MCU & TMS51xx: same as US version + - VSM: ?KB CD62172* Touch & Tell (Italy) "Libro Parlante", 1982 - - MCU: ?* (assume same as US version) - - TMS51xx: ?KB CD62176* + - MCU & TMS51xx: same as US version + - VSM: ?KB CD62176* + Vocaid (US), 1982 + - MCU & TMS51xx: same as Touch & Tell (US) + - VSM: 16KB CD2357 + - notes: MCU is the same as in Touch & Tell, but instead of a toddler's toy, + you get a serious medical aid device for the voice-impaired. The PCB is + identical, it includes the edge connector for modules but no external slot. Touch & Tell modules: English: - - Animal Friends: CD2802: 16KB CD2355 - - World of Transportation: CD2802: 16KB CD2361 - - Little Creatures: CD2802: 16KB CD2362 - - E.T.: CD2802: 16KB CD2363** - - Alphabet Fun: TMS51xx: 4KB CD2611 - - Number Fun: TMS51xx: 4KB CD2612 - - All About Me: TMS51xx: 4KB CD2613 + - Alphabet Fun: VSM: 4KB CD2611 + - Animal Friends: VSM: 16KB CD2355 + - Number Fun: VSM: 4KB CD2612*, CD2612(rev.A) + - All About Me: VSM: 4KB CD2613 + - World of Transportation: VSM: 16KB CD2361 + - Little Creatures: VSM: 16KB CD2362 + - E.T.: VSM: 16KB CD2363 + +Touch & Tell/Vocaid overlay reference: + + tntell CD2610: + - 04: a - Colors + - 01: b - Objects + - 05: c - Shapes + - 09: d - Home Scene + tntelluk CD62170, tntellfr CD62171: + - see tntell + - see numfun(not A) + - see animalfr + - 08: ? - Clown Face + - 0B: ? - Body Parts + vocaid CD2357: + - 1C: 1 - Leisure + - 1E: 2 - Telephone + - 1B: 3 - Bedside + - 1D: 4 - Alphabet + alphabet CD2611: + - 0E: 1a - Alphabet A-M + - 0D: 1b - Alphabet N-Z + - 0C: 1c - Letter Jumble A-M + - 0B: 1d - Letter Jumble N-Z + animalfr CD2355: + - 0A: 2a - Farm Animals + - 0F: 2b - At The Farm + - 0E: 2c - Animal Babies + - 0D: 2d - In The Jungle + numfun CD2612: + - 02/0A(rev.A): 3a - Numbers 1-10 + - 03/0F(rev.A): 3b - Numbers 11-30 + - 07/0D(rev.A): 3c - How Many? + - 06/0E(rev.A): 3d - Hidden Numbers + aboutme CD2613: + - 0E: 4a - Clown Face + - 0B: 4b - Body Parts + - 0D: 4c - Things to Wear + - 0C: 4d - Just For Me + wot CD2361: + - 0A: 5a - On Land + - 0B: 5b - In The Air + - 0C: 5c - On The Water + - 0D: 5d - In Space + - 10: 5e - What Belongs Here? + - 11: 5f - How It Used To Be + - 12: 5g - Word Fun + - 13: 5h - In the Surprise Garage + lilcreat CD2362: + - 14: 6a - In The Park + - 15: 6b - In The Sea + - 16: 6c - In The Woods + - 17: 6d - Whose House? + - 18: 6e - Hide & Seek + - 1A: 6f - Who Is It? + - 19: 6g - But It's Not + - 1B: 6h - Word Fun + et CD2363: + - 0F: 7a - The Adventure On Earth I + - 10: 7b - The Adventure On Earth II + - 11: 7c - Fun And Friendship I + - 12: 7d - Fun And Friendship II + - 13: 7e - E.T. The Star I + - 14: 7f - E.T. The Star II + - 15: 7g - Do You Remember? I + - 16: 7h - Do You Remember? II Language Tutor/Translator: @@ -211,61 +296,35 @@ A later device, called Language Teacher, was released without speech hardware. Language Tutor (US), 1978 - MCU: TMC0275* + - TMS51xx: CD2801 - notes: external module is required (see below) Language Tutor modules: - - Ingles(1/4): TMS51xx: 16KB CD2311* - - Ingles(2/4): TMS51xx: 16KB CD2312* - - Ingles(3/4): TMS51xx: 16KB CD2313* - - Ingles(4/4): TMS51xx: 16KB CD2314* - - - Spanish(1/4): TMS51xx: 16KB CD2315* - - Spanish(2/4): TMS51xx: 16KB CD2316* - - Spanish(3/4): TMS51xx: 16KB CD2317 - - Spanish(4/4): TMS51xx: 16KB CD2318 - - - French(1/4): TMS51xx: 16KB CD2327 - - French(2/4): TMS51xx: 16KB CD2328 - - French(3/4): TMS51xx: 16KB CD2329 - - French(4/4): TMS51xx: 16KB CD2330 - - - German(1/4): TMS51xx: 16KB CD2331 - - German(2/4): TMS51xx: 16KB CD2332 - - German(3/4): TMS51xx: 16KB CD2333 - - German(4/4): TMS51xx: 16KB CD2334 + - Ingles(1/4): VSM: 16KB CD2311 + - Ingles(2/4): VSM: 16KB CD2312 + - Ingles(3/4): VSM: 16KB CD2313 + - Ingles(4/4): VSM: 16KB CD2314 - - English(1/4): TMC0280: 16KB CD3526** - - English(2/4): TMC0280: 16KB CD3527** - - English(3/4): TMC0280: 16KB CD3528** - - English(4/4): TMC0280: 16KB CD3529** - - -Other devices: - - Vocaid (US), 1982 - - MCU: CD8012** - - CD2802: 16KB CD2357 - - notes: MCU is the same as in Touch & Tell, but instead of a toddler's toy, - you get a serious medical aid device for the voice-impaired. + - Spanish(1/4): VSM: 16KB CD2315 + - Spanish(2/4): VSM: 16KB CD2316 + - Spanish(3/4): VSM: 16KB CD2317 + - Spanish(4/4): VSM: 16KB CD2318 - Spelling B (US), 1978 - - MCU: TMC0272* - - ?: TMC1984* (what is this?) - - notes: this line of toys (Spelling B, Mr. Challenger, Math Marvel) is calculator-sized, - might have been aimed for older kids. Note that Math Marvel is a TMC1986, no speech. + - French(1/4): VSM: 16KB CD2327 + - French(2/4): VSM: 16KB CD2328 + - French(3/4): VSM: 16KB CD2329 + - French(4/4): VSM: 16KB CD2330 - Spelling B (US), newer - - MCU: TMC0274* - - TMS51xx: ?KB TMC0355 CD2602* + - German(1/4): VSM: 16KB CD2331 + - German(2/4): VSM: 16KB CD2332 + - German(3/4): VSM: 16KB CD2333 + - German(4/4): VSM: 16KB CD2334 - Spelling B (Germany) "Spelling ABC", 198? - - MCU: TMC0274* (assume same as US version) - - TMS51xx: ?KB TMC0355 CD2607* - - Mr. Challenger (US), 1980 - - MCU: TMC0273* - - TMS51xx: ?KB TMC0355 CD2601* + - English(1/4): VSM: 16KB CD3526 + - English(2/4): VSM: 16KB CD3527 + - English(3/4): VSM: 16KB CD3528 + - English(4/4): VSM: 16KB CD3529 ---------------------------------------------------------------------------- @@ -286,6 +345,7 @@ Other devices: // internal artwork #include "lantutor.lh" #include "snspell.lh" +#include "tntell.lh" // keyboard overlay // The master clock is a single stage RC oscillator into TMS5100 RCOSC: // In an early 1979 Speak & Spell, C is 68pf, R is a 50kohm trimpot which is set to around 33.6kohm @@ -307,27 +367,35 @@ public: { } // devices - required_device<tms5100_device> m_tms5100; + required_device<tms5110_device> m_tms5100; required_device<tms6100_device> m_tms6100; optional_device<generic_slot_device> m_cart; + DECLARE_INPUT_CHANGED_MEMBER(snspell_power_button); + void snspell_power_off(); + void prepare_display(); + + DECLARE_READ8_MEMBER(snspell_read_k); + DECLARE_WRITE16_MEMBER(snmath_write_o); + DECLARE_WRITE16_MEMBER(snspell_write_o); + DECLARE_WRITE16_MEMBER(snspell_write_r); + DECLARE_WRITE16_MEMBER(lantutor_write_r); + + DECLARE_READ8_MEMBER(tntell_read_k); + DECLARE_WRITE16_MEMBER(tntell_write_o); + DECLARE_WRITE16_MEMBER(tntell_write_r); + // cartridge UINT32 m_cart_max_size; UINT8* m_cart_base; void init_cartridge(); DECLARE_DEVICE_IMAGE_LOAD_MEMBER(tispeak_cartridge); DECLARE_DRIVER_INIT(snspell); + DECLARE_DRIVER_INIT(tntell); DECLARE_DRIVER_INIT(lantutor); - DECLARE_READ8_MEMBER(snspell_read_k); - DECLARE_WRITE16_MEMBER(snmath_write_o); - DECLARE_WRITE16_MEMBER(snspell_write_o); - DECLARE_WRITE16_MEMBER(snspell_write_r); - DECLARE_WRITE16_MEMBER(lantutor_write_r); - - DECLARE_INPUT_CHANGED_MEMBER(snspell_power_button); - void snspell_power_off(); - void prepare_display(); + UINT8 m_overlay; + TIMER_DEVICE_CALLBACK_MEMBER(tntell_get_overlay); protected: virtual void machine_start(); @@ -352,6 +420,8 @@ void tispeak_state::machine_start() void tispeak_state::init_cartridge() { + m_overlay = 0; + if (m_cart != NULL && m_cart->exists()) { std::string region_tag; @@ -384,6 +454,12 @@ DRIVER_INIT_MEMBER(tispeak_state, snspell) m_cart_base = memregion("tms6100")->base() + 0x8000; } +DRIVER_INIT_MEMBER(tispeak_state, tntell) +{ + m_cart_max_size = 0x4000; + m_cart_base = memregion("tms6100")->base() + 0x4000; +} + DRIVER_INIT_MEMBER(tispeak_state, lantutor) { m_cart_max_size = 0x10000; @@ -464,6 +540,62 @@ WRITE16_MEMBER(tispeak_state::lantutor_write_r) } +// tntell specific + +WRITE16_MEMBER(tispeak_state::tntell_write_r) +{ + // R10: CD2802 PDC pin + m_tms5100->pdc_w(data >> 10); + + // R9: power-off request, on falling edge + if ((m_r >> 9 & 1) && !(data >> 9 & 1)) + snspell_power_off(); + + // R0-R8: input mux + m_r = m_inp_mux = data; +} + +WRITE16_MEMBER(tispeak_state::tntell_write_o) +{ + // O3210: CD2802 CTL8124 + m_o = BITSWAP8(data,7,6,5,4,3,0,1,2); + m_tms5100->ctl_w(space, 0, m_o & 0xf); +} + +READ8_MEMBER(tispeak_state::tntell_read_k) +{ + // multiplexed inputs (and K2 from on-button) + UINT8 k = m_inp_matrix[9]->read() | read_inputs(9); + + // K4: CD2802 CTL1 + if (m_tms5100->ctl_r(space, 0) & 1) + k |= 4; + + // K8: overlay code from R5,O4-O7 + if (((m_r >> 1 & 0x10) | (m_o >> 4 & 0xf)) & m_overlay) + k |= 8; + + return k; +} + +TIMER_DEVICE_CALLBACK_MEMBER(tispeak_state::tntell_get_overlay) +{ + // Each keyboard overlay insert has 5 holes, used by the game to determine + // which one is active(if any). If it matches with the internal ROM or + // external module, the game continues. + // 00 for none, 1F for diagnostics, see comment section above for a list + + // try to get overlay code from artwork file(in decimal), otherwise pick the + // one that was selected in machine configuration + m_overlay = output_get_value("overlay_code") & 0x1f; + if (m_overlay == 0) + m_overlay = m_inp_matrix[10]->read(); + + for (int i = 0; i < 5; i++) + output_set_indexed_value("ol", i+1, m_overlay >> i & 1); +} + + /*************************************************************************** @@ -548,53 +680,53 @@ INPUT_PORTS_END static INPUT_PORTS_START( snmath ) PORT_START("IN.0") // R0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL_PAD) PORT_NAME(".") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_DEL_PAD) PORT_NAME(".") PORT_START("IN.1") // R1 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_START("IN.2") // R2 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_START("IN.3") // R3 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("Enter") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_NAME("Go") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off") // -> auto_power_off + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("Enter") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Q) PORT_NAME("Go") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off") // -> auto_power_off PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_START("IN.4") // R4 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("Clear") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_NAME("<") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_NAME(">") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_NAME("Repeat") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_DEL) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("Clear") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_COMMA) PORT_NAME("<") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_STOP) PORT_NAME(">") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_W) PORT_NAME("Repeat") PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_START("IN.5") // R5 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("+") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("-") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME(UTF8_MULTIPLY) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME(UTF8_DIVIDE) // / - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_NAME("Mix It") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("+") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("-") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME(UTF8_MULTIPLY) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME(UTF8_DIVIDE) // / + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_NAME("Mix It") PORT_START("IN.6") // R6 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_NAME("Number Stumper") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_NAME("Write It") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_NAME("Greater/Less") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_NAME("Word Problems") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CODE(KEYCODE_PGUP) PORT_NAME("Solve It/On") PORT_CHANGED_MEMBER(DEVICE_SELF, tispeak_state, snspell_power_button, (void *)true) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_I) PORT_NAME("Number Stumper") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_U) PORT_NAME("Write It") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Y) PORT_NAME("Greater/Less") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_T) PORT_NAME("Word Problems") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_R) PORT_CODE(KEYCODE_PGUP) PORT_NAME("Solve It/On") PORT_CHANGED_MEMBER(DEVICE_SELF, tispeak_state, snspell_power_button, (void *)true) PORT_START("IN.7") PORT_BIT( 0x1f, IP_ACTIVE_HIGH, IPT_UNUSED ) @@ -650,6 +782,102 @@ static INPUT_PORTS_START( lantutor ) INPUT_PORTS_END +static INPUT_PORTS_START( tntell ) + PORT_START("IN.0") // R0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_NAME("Grid 1-1") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_NAME("Grid 1-2") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_NAME("Grid 1-4") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_NAME("Grid 1-3") + + PORT_START("IN.1") // R1 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Q) PORT_NAME("Grid 2-1") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_W) PORT_NAME("Grid 2-2") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_R) PORT_NAME("Grid 2-4") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_E) PORT_NAME("Grid 2-3") + + PORT_START("IN.2") // R2 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_A) PORT_NAME("Grid 3-1") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_S) PORT_NAME("Grid 3-2") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_F) PORT_NAME("Grid 3-4") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_D) PORT_NAME("Grid 3-3") + + PORT_START("IN.3") // R3 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Z) PORT_NAME("Grid 4-1") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_X) PORT_NAME("Grid 4-2") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_V) PORT_NAME("Grid 4-4") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_C) PORT_NAME("Grid 4-3") + + PORT_START("IN.4") // R4 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_NAME("Grid 5-1") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_NAME("Grid 5-2") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_U) PORT_NAME("Grid 5-4") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_NAME("Grid 5-3") + + PORT_START("IN.5") // R5 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_O) PORT_NAME("Grid 5-6") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_COMMA) PORT_NAME("Grid 6-5") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_I) PORT_NAME("Grid 5-5") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) // overlay code + + PORT_START("IN.6") // R6 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_G) PORT_NAME("Grid 3-5") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_T) PORT_NAME("Grid 2-5") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_B) PORT_NAME("Grid 4-5") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_NAME("Grid 1-5") + + PORT_START("IN.7") // R7 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_H) PORT_NAME("Grid 3-6") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Y) PORT_NAME("Grid 2-6") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_N) PORT_NAME("Grid 4-6") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_NAME("Grid 1-6") + + PORT_START("IN.8") // R8 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_J) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Grid 6-1 (Off)") // -> auto_power_off + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_K) PORT_NAME("Grid 6-2") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_M) PORT_NAME("Grid 6-4") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_L) PORT_NAME("Grid 6-3") + + PORT_START("IN.9") // Vss! + PORT_BIT( 0x0d, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_STOP) PORT_CODE(KEYCODE_PGUP) PORT_NAME("Grid 6-6 (On)") PORT_CHANGED_MEMBER(DEVICE_SELF, tispeak_state, snspell_power_button, (void *)true) + + PORT_START("IN.10") + PORT_CONFNAME( 0x1f, 0x04, "Overlay Code" ) // only if not provided by external artwork + PORT_CONFSETTING( 0x00, "00 (None)" ) + PORT_CONFSETTING( 0x01, "01" ) + PORT_CONFSETTING( 0x02, "02" ) + PORT_CONFSETTING( 0x03, "03" ) + PORT_CONFSETTING( 0x04, "04" ) + PORT_CONFSETTING( 0x05, "05" ) + PORT_CONFSETTING( 0x06, "06" ) + PORT_CONFSETTING( 0x07, "07" ) + PORT_CONFSETTING( 0x08, "08" ) + PORT_CONFSETTING( 0x09, "09" ) + PORT_CONFSETTING( 0x0a, "0A" ) + PORT_CONFSETTING( 0x0b, "0B" ) + PORT_CONFSETTING( 0x0c, "0C" ) + PORT_CONFSETTING( 0x0d, "0D" ) + PORT_CONFSETTING( 0x0e, "0E" ) + PORT_CONFSETTING( 0x0f, "0F" ) + PORT_CONFSETTING( 0x10, "10" ) + PORT_CONFSETTING( 0x11, "11" ) + PORT_CONFSETTING( 0x12, "12" ) + PORT_CONFSETTING( 0x13, "13" ) + PORT_CONFSETTING( 0x14, "14" ) + PORT_CONFSETTING( 0x15, "15" ) + PORT_CONFSETTING( 0x16, "16" ) + PORT_CONFSETTING( 0x17, "17" ) + PORT_CONFSETTING( 0x18, "18" ) + PORT_CONFSETTING( 0x19, "19" ) + PORT_CONFSETTING( 0x1a, "1A" ) + PORT_CONFSETTING( 0x1b, "1B" ) + PORT_CONFSETTING( 0x1c, "1C" ) + PORT_CONFSETTING( 0x1d, "1D" ) + PORT_CONFSETTING( 0x1e, "1E" ) + PORT_CONFSETTING( 0x1f, "1F (Diagnostic)" ) +INPUT_PORTS_END + + /*************************************************************************** @@ -657,6 +885,17 @@ INPUT_PORTS_END ***************************************************************************/ +static MACHINE_CONFIG_FRAGMENT( tms5110_route ) + + /* sound hardware */ + MCFG_TMS5110_M0_CB(DEVWRITELINE("tms6100", tms6100_device, tms6100_m0_w)) + MCFG_TMS5110_M1_CB(DEVWRITELINE("tms6100", tms6100_device, tms6100_m1_w)) + MCFG_TMS5110_ADDR_CB(DEVWRITE8("tms6100", tms6100_device, tms6100_addr_w)) + MCFG_TMS5110_DATA_CB(DEVREADLINE("tms6100", tms6100_device, tms6100_data_r)) + MCFG_TMS5110_ROMCLK_CB(DEVWRITELINE("tms6100", tms6100_device, tms6100_romclock_w)) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5) +MACHINE_CONFIG_END + static MACHINE_CONFIG_START( snmath, tispeak_state ) /* basic machine hardware */ @@ -665,9 +904,9 @@ static MACHINE_CONFIG_START( snmath, tispeak_state ) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(tispeak_state, snmath_write_o)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(tispeak_state, snspell_write_r)) - MCFG_TMS0270_READ_CTL_CB(DEVREAD8("tms5100", tms5100_device, ctl_r)) - MCFG_TMS0270_WRITE_CTL_CB(DEVWRITE8("tms5100", tms5100_device, ctl_w)) - MCFG_TMS0270_WRITE_PDC_CB(DEVWRITELINE("tms5100", tms5100_device, pdc_w)) + MCFG_TMS0270_READ_CTL_CB(DEVREAD8("tms5100", tms5110_device, ctl_r)) + MCFG_TMS0270_WRITE_CTL_CB(DEVWRITE8("tms5100", tms5110_device, ctl_w)) + MCFG_TMS0270_WRITE_PDC_CB(DEVWRITELINE("tms5100", tms5110_device, pdc_w)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_snspell) // max 9 digits @@ -678,16 +917,12 @@ static MACHINE_CONFIG_START( snmath, tispeak_state ) MCFG_DEVICE_ADD("tms6100", TMS6100, MASTER_CLOCK/4) MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("tms5100", TMS5100, MASTER_CLOCK) - MCFG_TMS5110_M0_CB(DEVWRITELINE("tms6100", tms6100_device, tms6100_m0_w)) - MCFG_TMS5110_M1_CB(DEVWRITELINE("tms6100", tms6100_device, tms6100_m1_w)) - MCFG_TMS5110_ADDR_CB(DEVWRITE8("tms6100", tms6100_device, tms6100_addr_w)) - MCFG_TMS5110_DATA_CB(DEVREADLINE("tms6100", tms6100_device, tms6100_data_r)) - MCFG_TMS5110_ROMCLK_CB(DEVWRITELINE("tms6100", tms6100_device, tms6100_romclock_w)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5) + MCFG_SOUND_ADD("tms5100", CD2801, MASTER_CLOCK) + MCFG_FRAGMENT_ADD(tms5110_route) MACHINE_CONFIG_END -static MACHINE_CONFIG_DERIVED( snspell, snmath ) + +static MACHINE_CONFIG_DERIVED( sns_cd2801, snmath ) /* basic machine hardware */ MCFG_CPU_MODIFY("maincpu") @@ -701,6 +936,21 @@ static MACHINE_CONFIG_DERIVED( snspell, snmath ) MCFG_SOFTWARE_LIST_ADD("cart_list", "snspell") MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( sns_tmc0281, sns_cd2801 ) + + /* sound hardware */ + MCFG_SOUND_REPLACE("tms5100", TMC0281, MASTER_CLOCK) + MCFG_FRAGMENT_ADD(tms5110_route) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( sns_tmc0281d, sns_cd2801 ) + + /* sound hardware */ + MCFG_SOUND_REPLACE("tms5100", TMC0281D, MASTER_CLOCK) + MCFG_FRAGMENT_ADD(tms5110_route) +MACHINE_CONFIG_END + + static MACHINE_CONFIG_DERIVED( snread, snmath ) /* basic machine hardware */ @@ -715,6 +965,7 @@ static MACHINE_CONFIG_DERIVED( snread, snmath ) MCFG_SOFTWARE_LIST_ADD("cart_list", "snread") MACHINE_CONFIG_END + static MACHINE_CONFIG_DERIVED( lantutor, snmath ) /* basic machine hardware */ @@ -734,6 +985,39 @@ static MACHINE_CONFIG_DERIVED( lantutor, snmath ) MACHINE_CONFIG_END +static MACHINE_CONFIG_START( vocaid, tispeak_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS1100, MASTER_CLOCK/2) + MCFG_TMS1XXX_READ_K_CB(READ8(tispeak_state, tntell_read_k)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(tispeak_state, tntell_write_o)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(tispeak_state, tntell_write_r)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("ol_timer", tispeak_state, tntell_get_overlay, attotime::from_msec(50)) + MCFG_DEFAULT_LAYOUT(layout_tntell) + + /* no video! */ + + /* sound hardware */ + MCFG_DEVICE_ADD("tms6100", TMS6100, MASTER_CLOCK/4) + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("tms5100", CD2802, MASTER_CLOCK) + MCFG_FRAGMENT_ADD(tms5110_route) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( tntell, vocaid ) + + /* cartridge */ + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "tntell") + MCFG_GENERIC_EXTENSIONS("vsm") + MCFG_GENERIC_LOAD(tispeak_state, tispeak_cartridge) + + MCFG_SOFTWARE_LIST_ADD("cart_list", "tntell") +MACHINE_CONFIG_END + + /*************************************************************************** @@ -743,7 +1027,7 @@ MACHINE_CONFIG_END ROM_START( snspell ) ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD( "us4189779_tmc0271", 0x0000, 0x1000, CRC(d3f5a37d) SHA1(f75ab617a6067d4d3a954a9f86126d2089554df8) ) // typed in from patent 4189779, verified by 2 sources + ROM_LOAD( "us4189779_tmc0271", 0x0000, 0x1000, CRC(d3f5a37d) SHA1(f75ab617a6067d4d3a954a9f86126d2089554df8) ) // typed in from patent US4189779, verified by 2 sources ROM_REGION( 1246, "maincpu:ipla", 0 ) ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) @@ -835,7 +1119,7 @@ ROM_START( snspelljp ) ROM_LOAD( "cd2322.vsm", 0x4000, 0x4000, CRC(b6f4bba4) SHA1(65d686a9385b5ef3f080a5f47c6b2418bb9455b0) ) ROM_END -ROM_START( ladictee ) +ROM_START( snspellfr ) ROM_REGION( 0x1000, "maincpu", 0 ) ROM_LOAD( "us4189779_tmc0271", 0x0000, 0x1000, BAD_DUMP CRC(d3f5a37d) SHA1(f75ab617a6067d4d3a954a9f86126d2089554df8) ) // placeholder, use the one we have @@ -850,6 +1134,21 @@ ROM_START( ladictee ) ROM_LOAD( "cd2352.vsm", 0x0000, 0x4000, CRC(181a239e) SHA1(e16043766c385e152b7005c1c010be4c5fccdd9b) ) ROM_END +ROM_START( snspellit ) + ROM_REGION( 0x1000, "maincpu", 0 ) + ROM_LOAD( "us4189779_tmc0271", 0x0000, 0x1000, BAD_DUMP CRC(d3f5a37d) SHA1(f75ab617a6067d4d3a954a9f86126d2089554df8) ) // placeholder, use the one we have + + ROM_REGION( 1246, "maincpu:ipla", 0 ) + ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) + ROM_REGION( 2127, "maincpu:mpla", 0 ) + ROM_LOAD( "tms0270_common1_micro.pla", 0, 2127, BAD_DUMP CRC(504b96bb) SHA1(67b691e7c0b97239410587e50e5182bf46475b43) ) // not verified + ROM_REGION( 1246, "maincpu:opla", 0 ) + ROM_LOAD( "tms0270_tmc0271_output.pla", 0, 1246, BAD_DUMP CRC(9ebe12ab) SHA1(acb4e07ba26f2daca5f1c234885ac0371c7ce87f) ) // placeholder, use the one we have + + ROM_REGION( 0xc000, "tms6100", ROMREGION_ERASEFF ) // uses only 1 rom, 8000-bfff = space reserved for cartridge + ROM_LOAD( "cd62190.vsm", 0x0000, 0x4000, CRC(63832002) SHA1(ea8124b2bf0f5908c5f1a56d60063f2468a10143) ) +ROM_END + ROM_START( snmath ) ROM_REGION( 0x1000, "maincpu", 0 ) @@ -862,7 +1161,7 @@ ROM_START( snmath ) ROM_REGION( 1246, "maincpu:opla", 0 ) ROM_LOAD( "tms0270_cd2708_output.pla", 0, 1246, CRC(1abad753) SHA1(53d20b519ed73ce248368047a056836afbe3cd46) ) - ROM_REGION( 0x8000, "tms6100", 0 ) + ROM_REGION( 0x8000, "tms6100", ROMREGION_ERASEFF ) ROM_LOAD( "cd2381.vsm", 0x0000, 0x4000, CRC(f048dc81) SHA1(e97667d1002de40ab3d702c63b82311480032e0f) ) ROM_LOAD( "cd2614.vsm", 0x4000, 0x1000, CRC(11989074) SHA1(0e9cf906de9bcdf4acb425535dc442846fc48fa2) ) ROM_RELOAD( 0x5000, 0x1000 ) @@ -883,7 +1182,7 @@ ROM_START( snmathp ) ROM_REGION( 1246, "maincpu:opla", 0 ) ROM_LOAD( "tms0270_cd2708_output.pla", 0, 1246, BAD_DUMP CRC(1abad753) SHA1(53d20b519ed73ce248368047a056836afbe3cd46) ) // taken from cd2708, need to verify if it's same as cd2704 - ROM_REGION( 0x8000, "tms6100", 0 ) + ROM_REGION( 0x8000, "tms6100", ROMREGION_ERASEFF ) ROM_LOAD( "cd2392.vsm", 0x0000, 0x4000, CRC(4ed2e920) SHA1(8896f29e25126c1e4d9a47c9a325b35dddecc61f) ) ROM_LOAD( "cd2393.vsm", 0x4000, 0x4000, CRC(571d5b5a) SHA1(83284755d9b77267d320b5b87fdc39f352433715) ) ROM_END @@ -908,7 +1207,7 @@ ROM_END ROM_START( lantutor ) ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD( "us4631748_tmc0275", 0x0000, 0x1000, CRC(22818845) SHA1(1a84f15fb18ca66b1f2bf7491d76fbc56068984d) ) // extracted visually from patent 4631748, verified with source code + ROM_LOAD( "us4631748_tmc0275", 0x0000, 0x1000, CRC(22818845) SHA1(1a84f15fb18ca66b1f2bf7491d76fbc56068984d) ) // extracted visually from patent US4631748, verified with source code ROM_REGION( 1246, "maincpu:ipla", 0 ) ROM_LOAD( "tms0980_common1_instr.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) @@ -921,19 +1220,94 @@ ROM_START( lantutor ) ROM_END +ROM_START( tntell ) + ROM_REGION( 0x0800, "maincpu", 0 ) + ROM_LOAD( "cd8012", 0x0000, 0x0800, CRC(3d0fee24) SHA1(8b1b1df03d50ffe8adea59ece212dece5245fe86) ) + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1100_cd8012_micro.pla", 0, 867, CRC(46d936c8) SHA1(b0aad486a90a5dec7fd2fb07caa503be771f91c8) ) + ROM_REGION( 365, "maincpu:opla", 0 ) + ROM_LOAD( "tms1100_cd8012_output.pla", 0, 365, CRC(5ada9306) SHA1(a4140118dd535af45a691832530d55cd86a23510) ) + + ROM_REGION( 0x8000, "tms6100", ROMREGION_ERASEFF ) // 4000-7fff = space reserved for cartridge + ROM_LOAD( "cd2610.vsm", 0x0000, 0x1000, CRC(6db34e5a) SHA1(10fa5db20fdcba68034058e7194f35c90b9844e6) ) +ROM_END + +ROM_START( tntelluk ) + ROM_REGION( 0x0800, "maincpu", 0 ) + ROM_LOAD( "cd8012", 0x0000, 0x0800, CRC(3d0fee24) SHA1(8b1b1df03d50ffe8adea59ece212dece5245fe86) ) + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1100_cd8012_micro.pla", 0, 867, CRC(46d936c8) SHA1(b0aad486a90a5dec7fd2fb07caa503be771f91c8) ) + ROM_REGION( 365, "maincpu:opla", 0 ) + ROM_LOAD( "tms1100_cd8012_output.pla", 0, 365, CRC(5ada9306) SHA1(a4140118dd535af45a691832530d55cd86a23510) ) + + ROM_REGION( 0x8000, "tms6100", ROMREGION_ERASEFF ) // 4000-7fff = space reserved for cartridge + ROM_LOAD( "cd62170.vsm", 0x0000, 0x4000, CRC(6dc9d072) SHA1(9d2c9ff57c4f8fe69768666ffa41fcac649279ef) ) +ROM_END + +ROM_START( tntellfr ) + ROM_REGION( 0x0800, "maincpu", 0 ) + ROM_LOAD( "cd8012", 0x0000, 0x0800, CRC(3d0fee24) SHA1(8b1b1df03d50ffe8adea59ece212dece5245fe86) ) + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1100_cd8012_micro.pla", 0, 867, CRC(46d936c8) SHA1(b0aad486a90a5dec7fd2fb07caa503be771f91c8) ) + ROM_REGION( 365, "maincpu:opla", 0 ) + ROM_LOAD( "tms1100_cd8012_output.pla", 0, 365, CRC(5ada9306) SHA1(a4140118dd535af45a691832530d55cd86a23510) ) + + ROM_REGION( 0x8000, "tms6100", ROMREGION_ERASEFF ) // 4000-7fff = space reserved for cartridge + ROM_LOAD( "cd62171.vsm", 0x0000, 0x4000, CRC(cc26f7d1) SHA1(2b03e37b3bf3cbeca36980acfc45246dac706b83) ) +ROM_END + +ROM_START( tntellp ) + ROM_REGION( 0x0800, "maincpu", 0 ) + ROM_LOAD( "us4403965_cd1100", 0x0000, 0x0800, BAD_DUMP CRC(863a1c9e) SHA1(f2f9eb0ae17eedd4ef2b887b34601e75b4f6c720) ) // typed in from patent US4403965/EP0048835A2, may have errors + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1100_cd8012_micro.pla", 0, 867, CRC(46d936c8) SHA1(b0aad486a90a5dec7fd2fb07caa503be771f91c8) ) // from cd8012, matches patent source code + ROM_REGION( 365, "maincpu:opla", 0 ) + ROM_LOAD( "tms1100_us4403965_output.pla", 0, 365, CRC(66cfb3c3) SHA1(80a05e5d729518e1f35d8f26438f56e80ffbd003) ) + + ROM_REGION( 0x8000, "tms6100", ROMREGION_ERASEFF ) // 4000-7fff = space reserved for cartridge + ROM_LOAD( "cd2610.vsm", 0x0000, 0x1000, CRC(6db34e5a) SHA1(10fa5db20fdcba68034058e7194f35c90b9844e6) ) +ROM_END + + +ROM_START( vocaid ) + ROM_REGION( 0x0800, "maincpu", 0 ) + ROM_LOAD( "cd8012", 0x0000, 0x0800, CRC(3d0fee24) SHA1(8b1b1df03d50ffe8adea59ece212dece5245fe86) ) + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1100_cd8012_micro.pla", 0, 867, CRC(46d936c8) SHA1(b0aad486a90a5dec7fd2fb07caa503be771f91c8) ) + ROM_REGION( 365, "maincpu:opla", 0 ) + ROM_LOAD( "tms1100_cd8012_output.pla", 0, 365, CRC(5ada9306) SHA1(a4140118dd535af45a691832530d55cd86a23510) ) + + ROM_REGION( 0x8000, "tms6100", ROMREGION_ERASEFF ) // same hw as tntell, but no external slot + ROM_LOAD( "cd2357.vsm", 0x0000, 0x4000, CRC(19c251fa) SHA1(8f8163069f32413379e7e1681ce6a4d0819d4ebc) ) +ROM_END + + + +/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ +COMP( 1978, snspell, 0, 0, sns_tmc0281, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (US, 1978 version/patent)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) +COMP( 1979, snspella, snspell, 0, sns_tmc0281, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (US, 1979 version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) // incomplete dump, uses patent MCU ROM +COMP( 1980, snspellb, snspell, 0, sns_tmc0281d,snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (US, 1980 version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) // " +COMP( 1978, snspelluk, snspell, 0, sns_tmc0281, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (UK, 1978 version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) // " +COMP( 1981, snspelluka, snspell, 0, sns_cd2801, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (UK, 1981 version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) // " +COMP( 1979, snspelljp, snspell, 0, sns_tmc0281, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (Japan)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) // " +COMP( 1980, snspellfr, snspell, 0, sns_cd2801, snspell, tispeak_state, snspell, "Texas Instruments", "La Dictee Magique (France)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) // doesn't work due to missing CD2702 MCU dump, German/Italian version has CD2702 too +COMP( 1982, snspellit, snspell, 0, sns_cd2801, snspell, tispeak_state, snspell, "Texas Instruments", "Grillo Parlante (Italy)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) // " + +COMP( 1986, snmath, 0, 0, snmath, snmath, driver_device, 0, "Texas Instruments", "Speak & Math (US, 1986 version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) +COMP( 1980, snmathp, snmath, 0, snmath, snmath, driver_device, 0, "Texas Instruments", "Speak & Math (US, 1980 version/patent)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ -COMP( 1978, snspell, 0, 0, snspell, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (US, 1978 version/patent)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) -COMP( 1979, snspella, snspell, 0, snspell, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (US, 1979 version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) // incomplete dump, uses patent MCU ROM -COMP( 1980, snspellb, snspell, 0, snspell, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (US, 1980 version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) // incomplete dump, uses patent MCU ROM -COMP( 1978, snspelluk, snspell, 0, snspell, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (UK, 1978 version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) // incomplete dump, uses patent MCU ROM -COMP( 1981, snspelluka, snspell, 0, snspell, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (UK, 1981 version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) // incomplete dump, uses patent MCU ROM -COMP( 1979, snspelljp, snspell, 0, snspell, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (Japan)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) // incomplete dump, uses patent MCU ROM -COMP( 1980, ladictee, snspell, 0, snspell, snspell, tispeak_state, snspell, "Texas Instruments", "La Dictee Magique (France)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) // doesn't work due to missing CD2702 MCU dump, German/Italian version has CD2702 too +COMP( 1980, snread, 0, 0, snread, snread, tispeak_state, snspell, "Texas Instruments", "Speak & Read (US)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) -COMP( 1986, snmath, 0, 0, snmath, snmath, driver_device, 0, "Texas Instruments", "Speak & Math (US, 1986 version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) -COMP( 1980, snmathp, snmath, 0, snmath, snmath, driver_device, 0, "Texas Instruments", "Speak & Math (US, 1980 version/patent)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) +COMP( 1979, lantutor, 0, 0, lantutor, lantutor, tispeak_state, lantutor, "Texas Instruments", "Language Tutor (patent)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) -COMP( 1980, snread, 0, 0, snread, snread, tispeak_state, snspell, "Texas Instruments", "Speak & Read (US)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) +COMP( 1981, tntell, 0, 0, tntell, tntell, tispeak_state, tntell, "Texas Instruments", "Touch & Tell (US, 1981 version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_REQUIRES_ARTWORK ) // assume there is an older version too, with CD8010 MCU +COMP( 1981, tntelluk, tntell, 0, tntell, tntell, tispeak_state, tntell, "Texas Instruments", "Touch & Tell (UK)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_REQUIRES_ARTWORK ) +COMP( 1981, tntellfr, tntell, 0, tntell, tntell, tispeak_state, tntell, "Texas Instruments", "Le Livre Magique (France)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_REQUIRES_ARTWORK ) +COMP( 1980, tntellp, tntell, 0, tntell, tntell, tispeak_state, tntell, "Texas Instruments", "Touch & Tell (patent)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_REQUIRES_ARTWORK | MACHINE_NOT_WORKING ) -COMP( 1979, lantutor, 0, 0, lantutor, lantutor, tispeak_state, lantutor, "Texas Instruments", "Language Tutor (patent)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) +COMP( 1982, vocaid, 0, 0, vocaid, tntell, driver_device, 0, "Texas Instruments", "Vocaid", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_REQUIRES_ARTWORK ) diff --git a/src/mess/drivers/tx0.c b/src/mess/drivers/tx0.c index 4d6d76d9e70..d2a2865572e 100644 --- a/src/mess/drivers/tx0.c +++ b/src/mess/drivers/tx0.c @@ -125,7 +125,7 @@ static INPUT_PORTS_START( tx0 ) PORT_BIT( 0000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Toggle Switch Register Switch 16") PORT_CODE(KEYCODE_COMMA) PORT_BIT( 0000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Toggle Switch Register Switch 17") PORT_CODE(KEYCODE_STOP) - PORT_START("TWR0") /* 3: typewriter codes 00-17 */ + PORT_START("TWR.0") /* 3: typewriter codes 00-17 */ PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("| _") PORT_CODE(KEYCODE_SLASH) @@ -140,7 +140,7 @@ static INPUT_PORTS_START( tx0 ) PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) - PORT_START("TWR1") /* 4: typewriter codes 20-37 */ + PORT_START("TWR.1") /* 4: typewriter codes 20-37 */ PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(". )") PORT_CODE(KEYCODE_STOP) PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) @@ -156,7 +156,7 @@ static INPUT_PORTS_START( tx0 ) PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("- +") PORT_CODE(KEYCODE_MINUS) PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) - PORT_START("TWR2") /* 5: typewriter codes 40-57 */ + PORT_START("TWR.2") /* 5: typewriter codes 40-57 */ PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) @@ -169,7 +169,7 @@ static INPUT_PORTS_START( tx0 ) PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) - PORT_START("TWR3") /* 6: typewriter codes 60-77 */ + PORT_START("TWR.3") /* 6: typewriter codes 60-77 */ PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) @@ -1408,11 +1408,10 @@ void tx0_state::tx0_keyboard() int typewriter_transitions; int charcode, lr; - static const char *const twrnames[] = { "TWR0", "TWR1", "TWR2", "TWR3" }; for (i=0; i<4; i++) { - typewriter_keys[i] = ioport(twrnames[i])->read(); + typewriter_keys[i] = m_twr[i]->read(); } for (i=0; i<4; i++) @@ -1428,7 +1427,7 @@ void tx0_state::tx0_keyboard() previous LR */ lr = (1 << 17) | ((charcode & 040) << 10) | ((charcode & 020) << 8) | ((charcode & 010) << 6) | ((charcode & 004) << 4) | ((charcode & 002) << 2) | ((charcode & 001) << 1); /* write modified LR */ - machine().device("maincpu")->state().set_state_int(TX0_LR, lr); + m_maincpu->set_state_int(TX0_LR, lr); tx0_typewriter_drawchar(charcode); /* we want to echo input */ break; } @@ -1451,7 +1450,7 @@ INTERRUPT_GEN_MEMBER(tx0_state::tx0_interrupt) /* read new state of control keys */ - control_keys = ioport("CSW")->read(); + control_keys = m_csw->read(); if (control_keys & tx0_control) { diff --git a/src/mess/drivers/vector06.c b/src/mess/drivers/vector06.c index 02cf3423bfc..8546573f221 100644 --- a/src/mess/drivers/vector06.c +++ b/src/mess/drivers/vector06.c @@ -33,7 +33,7 @@ ADDRESS_MAP_END /* Input ports */ static INPUT_PORTS_START( vector06 ) - PORT_START("LINE0") + PORT_START("LINE.0") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_DEL) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) @@ -42,7 +42,7 @@ static INPUT_PORTS_START( vector06 ) PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) - PORT_START("LINE1") + PORT_START("LINE.1") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Home") PORT_CODE(KEYCODE_HOME) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PgUp") PORT_CODE(KEYCODE_PGUP) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) @@ -51,7 +51,7 @@ static INPUT_PORTS_START( vector06 ) PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) - PORT_START("LINE2") + PORT_START("LINE.2") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) @@ -60,7 +60,7 @@ static INPUT_PORTS_START( vector06 ) PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) - PORT_START("LINE3") + PORT_START("LINE.3") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("'") PORT_CODE(KEYCODE_INSERT) @@ -69,7 +69,7 @@ static INPUT_PORTS_START( vector06 ) PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS) PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) - PORT_START("LINE4") + PORT_START("LINE.4") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_QUOTE) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) @@ -78,7 +78,7 @@ static INPUT_PORTS_START( vector06 ) PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) - PORT_START("LINE5") + PORT_START("LINE.5") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) @@ -87,7 +87,7 @@ static INPUT_PORTS_START( vector06 ) PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) - PORT_START("LINE6") + PORT_START("LINE.6") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) @@ -96,7 +96,7 @@ static INPUT_PORTS_START( vector06 ) PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) - PORT_START("LINE7") + PORT_START("LINE.7") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) @@ -105,7 +105,7 @@ static INPUT_PORTS_START( vector06 ) PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("~") PORT_CODE(KEYCODE_TILDE) PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) - PORT_START("LINE8") + PORT_START("LINE.8") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) diff --git a/src/mess/drivers/vk100.c b/src/mess/drivers/vk100.c index fd0fd8db86f..c40e48a5c39 100644 --- a/src/mess/drivers/vk100.c +++ b/src/mess/drivers/vk100.c @@ -1188,7 +1188,8 @@ ROM_START( vk100 ) X'2 inputs lend credence to this. * */ - ROM_LOAD( "wb8151_573a2.mmi6301.pr3.ic41", 0x0000, 0x0100, CRC(75885a9f) SHA1(c721dad6a69c291dd86dad102ed3a8ddd620ecc4)) // label verified from nigwil's and andy's board + ROM_LOAD( "wb8151_573a2.mmi6301.pr3.ic41", 0x0000, 0x0100, CRC(75885a9f) SHA1(c721dad6a69c291dd86dad102ed3a8ddd620ecc4)) // Stamp/silkscreen: "WB8151 // 573A2" (23-573A2), 82S129 equivalent @ E41 + // label verified from nigwil's and andy's board ROM_REGION( 0x100, "vector", ROMREGION_ERASEFF ) // WARNING: it is possible that the first two bytes of this prom are bad! diff --git a/src/mess/drivers/x1.c b/src/mess/drivers/x1.c index 98e21f5a4b9..9bad6b21493 100644 --- a/src/mess/drivers/x1.c +++ b/src/mess/drivers/x1.c @@ -2552,7 +2552,7 @@ MACHINE_CONFIG_END * *************************************/ - ROM_START( x1 ) +ROM_START( x1 ) ROM_REGION( 0x8000, "ipl", ROMREGION_ERASEFF ) ROM_LOAD( "ipl.x1", 0x0000, 0x1000, CRC(7b28d9de) SHA1(c4db9a6e99873808c8022afd1c50fef556a8b44d) ) diff --git a/src/mess/drivers/xbox.c b/src/mess/drivers/xbox.c index 500b019b239..7c919b54ad7 100644 --- a/src/mess/drivers/xbox.c +++ b/src/mess/drivers/xbox.c @@ -11,76 +11,56 @@ #include "emu.h" #include "cpu/i386/i386.h" -//#include "machine/lpci.h" -//#include "machine/pic8259.h" -//#include "machine/pit8253.h" -//#include "machine/idectrl.h" -//#include "machine/idehd.h" -//#include "machine/naomigd.h" -//#include "video/poly.h" -//#include "bitmap.h" -//#include "debug/debugcon.h" -//#include "debug/debugcmd.h" -//#include "debug/debugcpu.h" -//#include "includes/chihiro.h" - +#include "machine/lpci.h" +#include "machine/pic8259.h" +#include "machine/pit8253.h" +#include "machine/idectrl.h" +#include "machine/idehd.h" +#include "video/poly.h" +#include "bitmap.h" +#include "debug/debugcon.h" +#include "debug/debugcmd.h" +#include "debug/debugcpu.h" +#include "includes/chihiro.h" +#include "includes/xbox.h" #define CPU_DIV 64 -/*! - @todo - Inheritance with chihiro_state - */ -class xbox_state : public driver_device +class xbox_state : public xbox_base_state { public: - xbox_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu") + xbox_state(const machine_config &mconfig, device_type type, const char *tag) : + xbox_base_state(mconfig, type, tag), + usbhack_index(-1), + usbhack_counter(0) { } - // devices - required_device<cpu_device> m_maincpu; - - // screen updates - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_PALETTE_INIT(xbox); protected: // driver_device overrides virtual void machine_start(); virtual void machine_reset(); - virtual void video_start(); + + virtual void hack_eeprom(); + virtual void hack_usb(); + + struct chihiro_devices { + bus_master_ide_controller_device *ide; + } xbox_devs; + int usbhack_index; + int usbhack_counter; }; void xbox_state::video_start() { } -UINT32 xbox_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ) -{ - return 0; -} - static ADDRESS_MAP_START(xbox_map, AS_PROGRAM, 32, xbox_state) - AM_RANGE(0x00000000, 0x07ffffff) AM_RAM // 128 megabytes - AM_RANGE(0xf0000000, 0xf0ffffff) AM_RAM -// AM_RANGE(0xfd000000, 0xfdffffff) AM_RAM AM_READWRITE(geforce_r, geforce_w) -// AM_RANGE(0xfed00000, 0xfed003ff) AM_READWRITE(usbctrl_r, usbctrl_w) -// AM_RANGE(0xfe800000, 0xfe85ffff) AM_READWRITE(audio_apu_r, audio_apu_w) -// AM_RANGE(0xfec00000, 0xfec001ff) AM_READWRITE(audio_ac93_r, audio_ac93_w) - AM_RANGE(0xff000000, 0xff07ffff) AM_ROM AM_REGION("bios", 0) AM_MIRROR(0x00f80000) + AM_IMPORT_FROM(xbox_base_map) ADDRESS_MAP_END static ADDRESS_MAP_START(xbox_map_io, AS_IO, 32, xbox_state) -// AM_RANGE(0x0020, 0x0023) AM_DEVREADWRITE8("pic8259_1", pic8259_device, read, write, 0xffffffff) -// AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE8("pit8254", pit8254_device, read, write, 0xffffffff) -// AM_RANGE(0x00a0, 0x00a3) AM_DEVREADWRITE8("pic8259_2", pic8259_device, read, write, 0xffffffff) -// AM_RANGE(0x01f0, 0x01f7) AM_DEVREADWRITE("ide", bus_master_ide_controller_device, read_cs0, write_cs0) -// AM_RANGE(0x0cf8, 0x0cff) AM_DEVREADWRITE("pcibus", pci_bus_legacy_device, read, write) -// AM_RANGE(0x4000, 0x40ff) AM_READWRITE(mediaboard_r, mediaboard_w) -// AM_RANGE(0x8000, 0x80ff) AM_READWRITE(dummy_r, dummy_w) -// AM_RANGE(0xc000, 0xc0ff) AM_READWRITE(smbus_r, smbus_w) -// AM_RANGE(0xff60, 0xff67) AM_DEVREADWRITE("ide", bus_master_ide_controller_device, bmdma_r, bmdma_w) + AM_IMPORT_FROM(xbox_base_map_io) ADDRESS_MAP_END static INPUT_PORTS_START( xbox ) @@ -140,41 +120,67 @@ static INPUT_PORTS_START( xbox ) INPUT_PORTS_END +void xbox_state::hack_eeprom() +{ + // 8003b744,3b744=0x90 0x90 + /*m_maincpu->space(0).write_byte(0x3b744, 0x90); + m_maincpu->space(0).write_byte(0x3b745, 0x90); + m_maincpu->space(0).write_byte(0x3b766, 0xc9); + m_maincpu->space(0).write_byte(0x3b767, 0xc3);*/ +} +/*static const struct { + const char *game_name; + struct { + UINT32 address; + UINT8 write_byte; + } modify[16]; +} hacks[] = { { "chihiro",{ { 0x6a79f, 0x01 },{ 0x6a7a0, 0x00 },{ 0x6b575, 0x00 },{ 0x6b576, 0x00 },{ 0x6b5af, 0x75 },{ 0x6b78a, 0x75 },{ 0x6b7ca, 0x00 },{ 0x6b7b8, 0x00 },{ 0x8f5b2, 0x75 },{ 0x79a9e, 0x74 },{ 0x79b80, 0x74 },{ 0x79b97, 0x74 },{ 0, 0 } } }, +{ "outr2",{ { 0x12e4cf, 0x01 },{ 0x12e4d0, 0x00 },{ 0x4793e, 0x01 },{ 0x4793f, 0x00 },{ 0x47aa3, 0x01 },{ 0x47aa4, 0x00 },{ 0x14f2b6, 0x84 },{ 0x14f2d1, 0x75 },{ 0x8732f, 0x7d },{ 0x87384, 0x7d },{ 0x87388, 0xeb },{ 0, 0 } } } };*/ -void xbox_state::machine_start() +void xbox_state::hack_usb() { + int p; + + if (usbhack_counter == 0) + p = 0; + else if (usbhack_counter == 1) // after game loaded + p = usbhack_index; + else + p = -1; + if (p >= 0) { + /*for (int a = 0; a < 16; a++) { + if (hacks[p].modify[a].address == 0) + break; + m_maincpu->space(0).write_byte(hacks[p].modify[a].address, hacks[p].modify[a].write_byte); + }*/ + } + usbhack_counter++; } -void xbox_state::machine_reset() +void xbox_state::machine_start() { + xbox_base_state::machine_start(); + xbox_devs.ide = machine().device<bus_master_ide_controller_device>("ide"); + usbhack_index = -1; + /*for (int a = 1; a < 2; a++) + if (strcmp(machine().basename(), hacks[a].game_name) == 0) { + usbhack_index = a; + break; + }*/ + usbhack_counter = 0; + // savestates + save_item(NAME(usbhack_counter)); } - -PALETTE_INIT_MEMBER(xbox_state, xbox) +void xbox_state::machine_reset() { } -static MACHINE_CONFIG_START( xbox, xbox_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", PENTIUM3, 733333333/CPU_DIV) /* Wrong! family 6 model 8 stepping 10 */ +static MACHINE_CONFIG_DERIVED_CLASS(xbox, xbox_base, xbox_state) + MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(xbox_map) MCFG_CPU_IO_MAP(xbox_map_io) -// MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(chihiro_state, irq_callback) - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) -// MCFG_SCREEN_REFRESH_RATE(60) -// MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) - MCFG_SCREEN_UPDATE_DRIVER(xbox_state, screen_update) -// MCFG_SCREEN_SIZE(32*8, 32*8) -// MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1) - MCFG_SCREEN_RAW_PARAMS(8000000/2, 442, 0, 320, 264, 0, 240) /* generic NTSC video timing, change accordingly */ - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 8) - MCFG_PALETTE_INIT_OWNER(xbox_state, xbox) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") diff --git a/src/mess/includes/ac1.h b/src/mess/includes/ac1.h index dff44d07d6b..b18cad87b24 100644 --- a/src/mess/includes/ac1.h +++ b/src/mess/includes/ac1.h @@ -20,9 +20,10 @@ public: m_cassette(*this, "cassette"), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_io_line(*this, "LINE") + { } - required_device<cassette_image_device> m_cassette; DECLARE_DRIVER_INIT(ac1); virtual void machine_reset(); virtual void video_start(); @@ -32,9 +33,13 @@ public: DECLARE_READ8_MEMBER(ac1_port_a_r); DECLARE_WRITE8_MEMBER(ac1_port_a_w); DECLARE_WRITE8_MEMBER(ac1_port_b_w); + +private: + required_device<cassette_image_device> m_cassette; required_device<cpu_device> m_maincpu; required_device<gfxdecode_device> m_gfxdecode; required_device<palette_device> m_palette; + required_ioport_array<7> m_io_line; }; /*----------- defined in video/ac1.c -----------*/ diff --git a/src/mess/includes/ace.h b/src/mess/includes/ace.h deleted file mode 100644 index 8e8d77cf683..00000000000 --- a/src/mess/includes/ace.h +++ /dev/null @@ -1,80 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder, Robbbert -/***************************************************************************** - * - * includes/ace.h - * - ****************************************************************************/ - -#pragma once - -#ifndef ACE_H_ -#define ACE_H_ - -#define Z80_TAG "z0" -#define AY8910_TAG "ay8910" -#define I8255_TAG "i8255" -#define SP0256AL2_TAG "ic1" -#define Z80PIO_TAG "z80pio" -#define CENTRONICS_TAG "centronics" -#define SCREEN_TAG "screen" - -class ace_state : public driver_device -{ -public: - ace_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, Z80_TAG), - m_ppi(*this, I8255_TAG), - m_speaker(*this, "speaker"), - m_cassette(*this, "cassette"), - m_centronics(*this, CENTRONICS_TAG), - m_ram(*this, RAM_TAG), - m_sp0256(*this, SP0256AL2_TAG), - m_video_ram(*this, "video_ram"), - m_char_ram(*this, "char_ram"){ } - - required_device<cpu_device> m_maincpu; - required_device<i8255_device> m_ppi; - required_device<speaker_sound_device> m_speaker; - required_device<cassette_image_device> m_cassette; - required_device<centronics_device> m_centronics; - required_device<ram_device> m_ram; - required_device<sp0256_device> m_sp0256; - - virtual void machine_start(); - - UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - DECLARE_READ8_MEMBER( io_r ); - DECLARE_WRITE8_MEMBER( io_w ); - DECLARE_READ8_MEMBER( ppi_pa_r ); - DECLARE_WRITE8_MEMBER( ppi_pa_w ); - DECLARE_READ8_MEMBER( ppi_pb_r ); - DECLARE_WRITE8_MEMBER( ppi_pb_w ); - DECLARE_READ8_MEMBER( ppi_pc_r ); - DECLARE_WRITE8_MEMBER( ppi_pc_w ); - DECLARE_READ8_MEMBER( ppi_control_r ); - DECLARE_WRITE8_MEMBER( ppi_control_w ); - DECLARE_READ8_MEMBER( pio_pa_r ); - DECLARE_WRITE8_MEMBER( pio_pa_w ); - - required_shared_ptr<UINT8> m_video_ram; - required_shared_ptr<UINT8> m_char_ram; - UINT32 screen_update_ace(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_DEVICE_CALLBACK_MEMBER(set_irq); - TIMER_DEVICE_CALLBACK_MEMBER(clear_irq); - DECLARE_READ8_MEMBER(pio_ad_r); - DECLARE_READ8_MEMBER(pio_bd_r); - DECLARE_READ8_MEMBER(pio_ac_r); - DECLARE_READ8_MEMBER(pio_bc_r); - DECLARE_WRITE8_MEMBER(pio_ad_w); - DECLARE_WRITE8_MEMBER(pio_bd_w); - DECLARE_WRITE8_MEMBER(pio_ac_w); - DECLARE_WRITE8_MEMBER(pio_bc_w); - DECLARE_READ8_MEMBER(sby_r); - DECLARE_WRITE8_MEMBER(ald_w); - DECLARE_SNAPSHOT_LOAD_MEMBER( ace ); -}; - -#endif /* ACE_H_ */ diff --git a/src/mess/includes/alesis.h b/src/mess/includes/alesis.h index 4d0cafc95ac..a0acc3db8f4 100644 --- a/src/mess/includes/alesis.h +++ b/src/mess/includes/alesis.h @@ -65,7 +65,15 @@ public: : driver_device(mconfig, type, tag), m_lcdc(*this, "hd44780"), m_cassette(*this, "cassette"), - m_maincpu(*this, "maincpu") { } + m_maincpu(*this, "maincpu"), + m_col1(*this, "COL1"), + m_col2(*this, "COL2"), + m_col3(*this, "COL3"), + m_col4(*this, "COL4"), + m_col5(*this, "COL5"), + m_col6(*this, "COL6"), + m_select(*this, "SELECT") + { } required_device<hd44780_device> m_lcdc; optional_device<cassette_image_device> m_cassette; @@ -92,6 +100,13 @@ private: UINT8 m_leds; UINT8 m_lcd_digits[5]; required_device<cpu_device> m_maincpu; + required_ioport m_col1; + required_ioport m_col2; + required_ioport m_col3; + required_ioport m_col4; + required_ioport m_col5; + required_ioport m_col6; + optional_ioport m_select; }; // device type definition diff --git a/src/mess/includes/aussiebyte.h b/src/mess/includes/aussiebyte.h new file mode 100644 index 00000000000..80dc6567ae5 --- /dev/null +++ b/src/mess/includes/aussiebyte.h @@ -0,0 +1,127 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert + +/*********************************************************** + + Includes + +************************************************************/ +#include "emu.h" +#include "cpu/z80/z80.h" +#include "cpu/z80/z80daisy.h" +#include "machine/z80ctc.h" +#include "machine/z80pio.h" +#include "machine/z80dart.h" +#include "machine/z80dma.h" +#include "bus/centronics/ctronics.h" +#include "sound/speaker.h" +#include "sound/votrax.h" +#include "video/mc6845.h" +#include "bus/rs232/rs232.h" +#include "machine/wd_fdc.h" +#include "machine/msm5832.h" + + +/*********************************************************** + + Class + +************************************************************/ +class aussiebyte_state : public driver_device +{ +public: + aussiebyte_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_palette(*this, "palette") + , m_maincpu(*this, "maincpu") + , m_ctc(*this, "ctc") + , m_dma(*this, "dma") + , m_pio1(*this, "pio1") + , m_pio2(*this, "pio2") + , m_sio1(*this, "sio1") + , m_sio2(*this, "sio2") + , m_centronics(*this, "centronics") + , m_rs232(*this, "rs232") + , m_fdc(*this, "fdc") + , m_floppy0(*this, "fdc:0") + , m_floppy1(*this, "fdc:1") + , m_crtc(*this, "crtc") + , m_speaker(*this, "speaker") + , m_votrax(*this, "votrax") + {} + + DECLARE_READ8_MEMBER(memory_read_byte); + DECLARE_WRITE8_MEMBER(memory_write_byte); + DECLARE_READ8_MEMBER(io_read_byte); + DECLARE_WRITE8_MEMBER(io_write_byte); + DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); + DECLARE_WRITE8_MEMBER(port15_w); + DECLARE_WRITE8_MEMBER(port16_w); + DECLARE_WRITE8_MEMBER(port17_w); + DECLARE_WRITE8_MEMBER(port18_w); + DECLARE_READ8_MEMBER(port19_r); + DECLARE_WRITE8_MEMBER(port1a_w); + DECLARE_WRITE8_MEMBER(port1b_w); + DECLARE_WRITE8_MEMBER(port1c_w); + DECLARE_WRITE8_MEMBER(port20_w); + DECLARE_READ8_MEMBER(port28_r); + DECLARE_READ8_MEMBER(port33_r); + DECLARE_WRITE8_MEMBER(port34_w); + DECLARE_WRITE8_MEMBER(port35_w); + DECLARE_READ8_MEMBER(port36_r); + DECLARE_READ8_MEMBER(port37_r); + DECLARE_WRITE_LINE_MEMBER(fdc_intrq_w); + DECLARE_WRITE_LINE_MEMBER(fdc_drq_w); + DECLARE_WRITE_LINE_MEMBER(busreq_w); + DECLARE_WRITE_LINE_MEMBER(votrax_w); + DECLARE_WRITE_LINE_MEMBER(sio1_rdya_w); + DECLARE_WRITE_LINE_MEMBER(sio1_rdyb_w); + DECLARE_WRITE_LINE_MEMBER(sio2_rdya_w); + DECLARE_WRITE_LINE_MEMBER(sio2_rdyb_w); + DECLARE_MACHINE_RESET(aussiebyte); + DECLARE_DRIVER_INIT(aussiebyte); + TIMER_DEVICE_CALLBACK_MEMBER(ctc_tick); + DECLARE_WRITE_LINE_MEMBER(ctc_z0_w); + DECLARE_WRITE_LINE_MEMBER(ctc_z1_w); + DECLARE_WRITE_LINE_MEMBER(ctc_z2_w); + DECLARE_WRITE8_MEMBER(address_w); + DECLARE_WRITE8_MEMBER(register_w); + MC6845_UPDATE_ROW(crtc_update_row); + MC6845_ON_UPDATE_ADDR_CHANGED(crtc_update_addr); + int m_centronics_busy; + required_device<palette_device> m_palette; + +private: + UINT8 crt8002(UINT8 ac_ra, UINT8 ac_chr, UINT8 ac_attr, UINT16 ac_cnt, bool ac_curs); + bool m_port15; // rom switched in (0), out (1) + UINT8 m_port17; + UINT8 m_port17_rdy; + UINT8 m_port19; + UINT8 m_port1a; // bank to switch to when write to port 15 happens + UINT8 m_port28; + UINT8 m_port34; + UINT8 m_port35; // byte to be written to vram or aram + UINT8 m_video_index; + UINT16 m_cnt; + UINT8 *m_p_videoram; + UINT8 *m_p_attribram; + const UINT8 *m_p_chargen; + UINT16 m_alpha_address; + UINT16 m_graph_address; + required_device<cpu_device> m_maincpu; + required_device<z80ctc_device> m_ctc; + required_device<z80dma_device> m_dma; + required_device<z80pio_device> m_pio1; + required_device<z80pio_device> m_pio2; + required_device<z80sio0_device> m_sio1; + required_device<z80sio0_device> m_sio2; + required_device<centronics_device> m_centronics; + required_device<rs232_port_device> m_rs232; + required_device<wd2797_t> m_fdc; + required_device<floppy_connector> m_floppy0; + optional_device<floppy_connector> m_floppy1; + required_device<mc6845_device> m_crtc; + required_device<speaker_sound_device> m_speaker; + required_device<votrax_sc01_device> m_votrax; +}; + diff --git a/src/mess/includes/bebox.h b/src/mess/includes/bebox.h index 23f252911d0..d9909a67b44 100644 --- a/src/mess/includes/bebox.h +++ b/src/mess/includes/bebox.h @@ -20,6 +20,9 @@ #include "machine/pit8253.h" #include "machine/ram.h" #include "machine/upd765.h" +#include "machine/intelfsh.h" +#include "bus/lpci/pci.h" + class bebox_state : public driver_device { @@ -39,7 +42,10 @@ public: m_pic8259_1(*this, "pic8259_1"), m_pic8259_2(*this, "pic8259_2"), m_pit8254(*this, "pit8254"), - m_ram(*this, RAM_TAG) + m_ram(*this, RAM_TAG), + m_smc37c78(*this, "smc37c78"), + m_flash(*this, "flash"), + m_pcibus(*this, "pcibus") { } @@ -52,6 +58,9 @@ public: required_device<pic8259_device> m_pic8259_2; required_device<pit8254_device> m_pit8254; required_device<ram_device> m_ram; + required_device<smc37c78_device> m_smc37c78; + required_device<fujitsu_29f016a_device> m_flash; + required_device<pci_bus_device> m_pcibus; UINT32 m_cpu_imask[2]; UINT32 m_interrupts; UINT32 m_crossproc_interrupts; diff --git a/src/mess/includes/c128.h b/src/mess/includes/c128.h index 0a1ca6c9cb8..c32b2afd726 100644 --- a/src/mess/includes/c128.h +++ b/src/mess/includes/c128.h @@ -171,6 +171,7 @@ public: DECLARE_WRITE_LINE_MEMBER( cia1_cnt_w ); DECLARE_WRITE_LINE_MEMBER( cia1_sp_w ); DECLARE_READ8_MEMBER( cia1_pa_r ); + DECLARE_WRITE8_MEMBER( cia1_pa_w ); DECLARE_READ8_MEMBER( cia1_pb_r ); DECLARE_WRITE8_MEMBER( cia1_pb_w ); diff --git a/src/mess/includes/c64.h b/src/mess/includes/c64.h index a9adca1291f..787fe5a6f60 100644 --- a/src/mess/includes/c64.h +++ b/src/mess/includes/c64.h @@ -34,42 +34,42 @@ class c64_state : public driver_device { public: - c64_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, M6510_TAG), - m_pla(*this, PLA_TAG), - m_vic(*this, MOS6569_TAG), - m_sid(*this, MOS6581_TAG), - m_cia1(*this, MOS6526_1_TAG), - m_cia2(*this, MOS6526_2_TAG), - m_iec(*this, CBM_IEC_TAG), - m_joy1(*this, CONTROL1_TAG), - m_joy2(*this, CONTROL2_TAG), - m_exp(*this, C64_EXPANSION_SLOT_TAG), - m_user(*this, PET_USER_PORT_TAG), - m_ram(*this, RAM_TAG), - m_cassette(*this, PET_DATASSETTE_PORT_TAG), - m_color_ram(*this, "color_ram"), - m_row0(*this, "ROW0"), - m_row1(*this, "ROW1"), - m_row2(*this, "ROW2"), - m_row3(*this, "ROW3"), - m_row4(*this, "ROW4"), - m_row5(*this, "ROW5"), - m_row6(*this, "ROW6"), - m_row7(*this, "ROW7"), - m_lock(*this, "LOCK"), - m_loram(1), - m_hiram(1), - m_charen(1), - m_va14(1), - m_va15(1), - m_restore(1), - m_cia1_irq(CLEAR_LINE), - m_cia2_irq(CLEAR_LINE), - m_vic_irq(CLEAR_LINE), - m_exp_irq(CLEAR_LINE), - m_exp_nmi(CLEAR_LINE) + c64_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, M6510_TAG), + m_pla(*this, PLA_TAG), + m_vic(*this, MOS6569_TAG), + m_sid(*this, MOS6581_TAG), + m_cia1(*this, MOS6526_1_TAG), + m_cia2(*this, MOS6526_2_TAG), + m_iec(*this, CBM_IEC_TAG), + m_joy1(*this, CONTROL1_TAG), + m_joy2(*this, CONTROL2_TAG), + m_exp(*this, C64_EXPANSION_SLOT_TAG), + m_user(*this, PET_USER_PORT_TAG), + m_ram(*this, RAM_TAG), + m_cassette(*this, PET_DATASSETTE_PORT_TAG), + m_color_ram(*this, "color_ram"), + m_row0(*this, "ROW0"), + m_row1(*this, "ROW1"), + m_row2(*this, "ROW2"), + m_row3(*this, "ROW3"), + m_row4(*this, "ROW4"), + m_row5(*this, "ROW5"), + m_row6(*this, "ROW6"), + m_row7(*this, "ROW7"), + m_lock(*this, "LOCK"), + m_loram(1), + m_hiram(1), + m_charen(1), + m_va14(1), + m_va15(1), + m_restore(1), + m_cia1_irq(CLEAR_LINE), + m_cia2_irq(CLEAR_LINE), + m_vic_irq(CLEAR_LINE), + m_exp_irq(CLEAR_LINE), + m_exp_nmi(CLEAR_LINE) { } // ROM @@ -121,6 +121,7 @@ public: DECLARE_WRITE_LINE_MEMBER( cia1_irq_w ); DECLARE_READ8_MEMBER( cia1_pa_r ); + DECLARE_WRITE8_MEMBER( cia1_pa_w ); DECLARE_READ8_MEMBER( cia1_pb_r ); DECLARE_WRITE8_MEMBER( cia1_pb_w ); diff --git a/src/mess/includes/coleco.h b/src/mess/includes/coleco.h index 7b91445e8e1..ab6e1379663 100644 --- a/src/mess/includes/coleco.h +++ b/src/mess/includes/coleco.h @@ -20,13 +20,26 @@ public: : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_cart(*this, COLECOVISION_CARTRIDGE_SLOT_TAG), - m_ram(*this, "ram") + m_ram(*this, "ram"), + m_ctrlsel(*this, "CTRLSEL"), + m_std_keypad1(*this, "STD_KEYPAD1"), + m_std_joy1(*this, "STD_JOY1"), + m_std_keypad2(*this, "STD_KEYPAD2"), + m_std_joy2(*this, "STD_JOY2"), + m_sac_keypad1(*this, "SAC_KEYPAD1"), + m_sac_joy1(*this, "SAC_JOY1"), + m_sac_slide1(*this, "SAC_SLIDE1"), + m_sac_keypad2(*this, "SAC_KEYPAD2"), + m_sac_joy2(*this, "SAC_JOY2"), + m_sac_slide2(*this, "SAC_SLIDE2"), + m_driv_wheel1(*this, "DRIV_WHEEL1"), + m_driv_pedal1(*this, "DRIV_PEDAL1"), + m_driv_wheel2(*this, "DRIV_WHEEL2"), + m_driv_pedal2(*this, "DRIV_PEDAL2"), + m_roller_x(*this, "ROLLER_X"), + m_roller_y(*this, "ROLLER_Y") { } - required_device<cpu_device> m_maincpu; - required_device<colecovision_cartridge_slot_device> m_cart; - required_shared_ptr<UINT8> m_ram; - virtual void machine_start(); virtual void machine_reset(); @@ -36,6 +49,21 @@ public: DECLARE_WRITE8_MEMBER( paddle_off_w ); DECLARE_WRITE8_MEMBER( paddle_on_w ); + TIMER_CALLBACK_MEMBER(paddle_d7reset_callback); + TIMER_CALLBACK_MEMBER(paddle_irqreset_callback); + TIMER_CALLBACK_MEMBER(paddle_pulse_callback); + TIMER_DEVICE_CALLBACK_MEMBER(paddle_update_callback); + DECLARE_WRITE_LINE_MEMBER(coleco_vdp_interrupt); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(czz50_cart); + + UINT8 coleco_paddle_read(int port, int joy_mode, UINT8 joy_status); + UINT8 coleco_scan_paddles(UINT8 *joy_status0, UINT8 *joy_status1); + +private: + required_device<cpu_device> m_maincpu; + required_device<colecovision_cartridge_slot_device> m_cart; + required_shared_ptr<UINT8> m_ram; + int m_joy_mode; int m_last_nmi_state; @@ -48,12 +76,24 @@ public: int m_joy_d7_state[2]; UINT8 m_joy_analog_state[2]; UINT8 m_joy_analog_reload[2]; - TIMER_CALLBACK_MEMBER(paddle_d7reset_callback); - TIMER_CALLBACK_MEMBER(paddle_irqreset_callback); - TIMER_CALLBACK_MEMBER(paddle_pulse_callback); - TIMER_DEVICE_CALLBACK_MEMBER(paddle_update_callback); - DECLARE_WRITE_LINE_MEMBER(coleco_vdp_interrupt); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(czz50_cart); + + optional_ioport m_ctrlsel; + required_ioport m_std_keypad1; + required_ioport m_std_joy1; + required_ioport m_std_keypad2; + required_ioport m_std_joy2; + optional_ioport m_sac_keypad1; + optional_ioport m_sac_joy1; + optional_ioport m_sac_slide1; + optional_ioport m_sac_keypad2; + optional_ioport m_sac_joy2; + optional_ioport m_sac_slide2; + optional_ioport m_driv_wheel1; + optional_ioport m_driv_pedal1; + optional_ioport m_driv_wheel2; + optional_ioport m_driv_pedal2; + optional_ioport m_roller_x; + optional_ioport m_roller_y; }; #endif diff --git a/src/mess/includes/cybiko.h b/src/mess/includes/cybiko.h index f7ac742808f..7bf4e0834de 100644 --- a/src/mess/includes/cybiko.h +++ b/src/mess/includes/cybiko.h @@ -51,13 +51,14 @@ class cybiko_state : public driver_device public: cybiko_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_crtc(*this, "hd66421"), - m_speaker(*this, "speaker"), - m_rtc(*this, "rtc"), - m_ram(*this, RAM_TAG), - m_flash1(*this, "flash1"), - m_nvram(*this, "nvram") + m_maincpu(*this, "maincpu"), + m_crtc(*this, "hd66421"), + m_speaker(*this, "speaker"), + m_rtc(*this, "rtc"), + m_ram(*this, RAM_TAG), + m_flash1(*this, "flash1"), + m_nvram(*this, "nvram"), + m_input(*this, "A") { } DECLARE_READ16_MEMBER(serflash_r); @@ -92,6 +93,7 @@ public: required_device<ram_device> m_ram; optional_device<at45db041_device> m_flash1; required_device<nvram_device> m_nvram; + optional_ioport_array<15> m_input; DECLARE_DRIVER_INIT(cybikoxt); DECLARE_DRIVER_INIT(cybiko); virtual void machine_start(); diff --git a/src/mess/includes/hh_tms1k.h b/src/mess/includes/hh_tms1k.h index 27cf20279d2..2d4149fcee4 100644 --- a/src/mess/includes/hh_tms1k.h +++ b/src/mess/includes/hh_tms1k.h @@ -38,6 +38,7 @@ public: UINT16 m_o; // MCU O-pins data UINT16 m_inp_mux; // multiplexed inputs mask bool m_power_on; + bool m_power_led; UINT8 read_inputs(int columns); DECLARE_INPUT_CHANGED_MEMBER(power_button); diff --git a/src/mess/includes/mboard.h b/src/mess/includes/mboard.h index 9cf94c502f3..b6e8c5028f4 100644 --- a/src/mess/includes/mboard.h +++ b/src/mess/includes/mboard.h @@ -43,7 +43,17 @@ class mboard_state : public driver_device public: mboard_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu") { } + m_maincpu(*this, "maincpu"), + m_line(*this, "LINE"), + m_line10(*this, "LINE10"), + m_b_white(*this, "B_WHITE"), + m_b_black(*this, "B_BLACK"), + m_b_buttons(*this, "B_BUTTONS"), + m_mouse_x(*this, "MOUSE_X"), + m_mouse_y(*this, "MOUSE_Y"), + m_button_l(*this, "BUTTON_L"), + m_button_r(*this, "BUTTON_R") + { } DECLARE_READ8_MEMBER(mboard_read_board_8); DECLARE_WRITE8_MEMBER(mboard_write_board_8); @@ -96,6 +106,15 @@ private: void check_board_buttons(); public: required_device<cpu_device> m_maincpu; + required_ioport_array<8> m_line; + required_ioport m_line10; + required_ioport m_b_white; + required_ioport m_b_black; + required_ioport m_b_buttons; + required_ioport m_mouse_x; + required_ioport m_mouse_y; + required_ioport m_button_l; + required_ioport m_button_r; }; diff --git a/src/mess/includes/orao.h b/src/mess/includes/orao.h index 2ccdff38966..6d63dc86049 100644 --- a/src/mess/includes/orao.h +++ b/src/mess/includes/orao.h @@ -20,10 +20,10 @@ public: m_video_ram(*this, "video_ram"), m_maincpu(*this, "maincpu"), m_dac(*this, "dac"), - m_cassette(*this, "cassette") { } + m_cassette(*this, "cassette"), + m_line(*this, "LINE") + { } - required_shared_ptr<UINT8> m_memory; - required_shared_ptr<UINT8> m_video_ram; DECLARE_READ8_MEMBER(orao_io_r); DECLARE_WRITE8_MEMBER(orao_io_w); DECLARE_DRIVER_INIT(orao); @@ -31,9 +31,14 @@ public: virtual void machine_reset(); virtual void video_start(); UINT32 screen_update_orao(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + +private: + required_shared_ptr<UINT8> m_memory; + required_shared_ptr<UINT8> m_video_ram; required_device<cpu_device> m_maincpu; required_device<dac_device> m_dac; required_device<cassette_image_device> m_cassette; + required_ioport_array<20> m_line; }; #endif /* ORAO_H_ */ diff --git a/src/mess/includes/pce.h b/src/mess/includes/pce.h index eccd9b4a123..9d9a7d34b56 100644 --- a/src/mess/includes/pce.h +++ b/src/mess/includes/pce.h @@ -40,7 +40,11 @@ public: m_user_ram(*this, "user_ram"), m_huc6260(*this, "huc6260"), m_cartslot(*this, "cartslot"), - m_cd(*this, "pce_cd") + m_cd(*this, "pce_cd"), + m_joy(*this, "JOY_P"), + m_joy6b(*this, "JOY6B_P"), + m_joy_type(*this, "JOY_TYPE"), + m_a_card(*this, "A_CARD") { } required_device<h6280_device> m_maincpu; @@ -49,6 +53,10 @@ public: optional_device<huc6260_device> m_huc6260; required_device<pce_cart_slot_device> m_cartslot; optional_device<pce_cd_device> m_cd; + required_ioport_array<5> m_joy; + required_ioport_array<5> m_joy6b; + required_ioport m_joy_type; + required_ioport m_a_card; UINT8 m_io_port_options; UINT8 m_sys3_card; diff --git a/src/mess/includes/pdp1.h b/src/mess/includes/pdp1.h index ee2c5f7f703..074c907a489 100644 --- a/src/mess/includes/pdp1.h +++ b/src/mess/includes/pdp1.h @@ -239,9 +239,21 @@ public: : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_crt(*this, "crt"), + m_spacewar(*this, "SPACEWAR"), + m_csw(*this, "CSW"), + m_sense(*this, "SENSE"), + m_tstadd(*this, "TSTADD"), + m_twdmsb(*this, "TWDMSB"), + m_twdlsb(*this, "TWDLSB"), + m_twr(*this, "TWR"), + m_cfg(*this, "CFG"), + m_io_lightpen(*this, "LIGHTPEN"), + m_lightx(*this, "LIGHTX"), + m_lighty(*this, "LIGHTY") + { } - pdp1_reset_param_t m_reset_param; int m_io_status; tape_reader_t m_tape_reader; tape_puncher_t m_tape_puncher; @@ -249,19 +261,8 @@ public: emu_timer *m_dpy_timer; lightpen_t m_lightpen; parallel_drum_t m_parallel_drum; - int m_old_typewriter_keys[4]; - int m_old_lightpen; - int m_old_control_keys; - int m_old_tw_keys; - int m_old_ta_keys; - int m_typewriter_color; - bitmap_ind16 m_panel_bitmap; - bitmap_ind16 m_typewriter_bitmap; - lightpen_t m_lightpen_state; - lightpen_t m_previous_lightpen_state; - int m_pos; - int m_case_shift; - crt_device *m_crt; + required_device<pdp1_device> m_maincpu; + virtual void machine_start(); virtual void machine_reset(); virtual void video_start(); @@ -275,7 +276,6 @@ public: TIMER_CALLBACK_MEMBER(dpy_callback); TIMER_CALLBACK_MEMBER(il_timer_callback); void pdp1_machine_stop(); - required_device<pdp1_device> m_maincpu; inline void pdp1_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color); void pdp1_plot(int x, int y); void pdp1_draw_led(bitmap_ind16 &bitmap, int x, int y, int state); @@ -302,7 +302,35 @@ public: void drum_write(int field, int position, UINT32 data); void pdp1_keyboard(); void pdp1_lightpen(); + int read_spacewar() { return m_spacewar->read(); } + +private: + pdp1_reset_param_t m_reset_param; + int m_old_typewriter_keys[4]; + int m_old_lightpen; + int m_old_control_keys; + int m_old_tw_keys; + int m_old_ta_keys; + int m_typewriter_color; + bitmap_ind16 m_panel_bitmap; + bitmap_ind16 m_typewriter_bitmap; + lightpen_t m_lightpen_state; + lightpen_t m_previous_lightpen_state; + int m_pos; + int m_case_shift; required_device<gfxdecode_device> m_gfxdecode; required_device<palette_device> m_palette; + required_device<crt_device> m_crt; + required_ioport m_spacewar; + required_ioport m_csw; + required_ioport m_sense; + required_ioport m_tstadd; + required_ioport m_twdmsb; + required_ioport m_twdlsb; + required_ioport_array<4> m_twr; + required_ioport m_cfg; + required_ioport m_io_lightpen; + required_ioport m_lightx; + required_ioport m_lighty; }; #endif /* PDP1_H_ */ diff --git a/src/mess/includes/pmd85.h b/src/mess/includes/pmd85.h index 46ec61a52d9..07d9986994b 100644 --- a/src/mess/includes/pmd85.h +++ b/src/mess/includes/pmd85.h @@ -76,8 +76,6 @@ public: DECLARE_DRIVER_INIT(alfa); DECLARE_DRIVER_INIT(c2717); virtual void machine_reset(); - virtual void video_start(); - DECLARE_PALETTE_INIT(pmd85); UINT32 screen_update_pmd85(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_CALLBACK_MEMBER(pmd85_cassette_timer_callback); DECLARE_WRITE_LINE_MEMBER(write_cas_tx); @@ -148,15 +146,10 @@ protected: void mato_update_memory(); void c2717_update_memory(); void pmd85_common_driver_init(); - void pmd85_draw_scanline(bitmap_ind16 &bitmap, int pmd85_scanline); virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); int m_cas_tx; }; -/*----------- defined in video/pmd85.c -----------*/ - -extern const unsigned char pmd85_palette[3*3]; - #endif /* PMD85_H_ */ diff --git a/src/mess/includes/rmnimbus.h b/src/mess/includes/rmnimbus.h index c857b808842..3d0cba8e05c 100644 --- a/src/mess/includes/rmnimbus.h +++ b/src/mess/includes/rmnimbus.h @@ -66,7 +66,12 @@ public: m_scsi_ctrl_out(*this, "scsi_ctrl_out"), m_fdc(*this, FDC_TAG), m_z80sio(*this, Z80SIO_TAG), - m_screen(*this, "screen") + m_screen(*this, "screen"), + m_io_config(*this, "config"), + m_io_joystick0(*this, JOYSTICK0_TAG), + m_io_mouse_button(*this, MOUSE_BUTTON_TAG), + m_io_mousex(*this, MOUSEX_TAG), + m_io_mousey(*this, MOUSEY_TAG) { } @@ -84,6 +89,11 @@ public: required_device<wd2793_t> m_fdc; required_device<z80sio2_device> m_z80sio; required_device<screen_device> m_screen; + required_ioport m_io_config; + required_ioport m_io_joystick0; + required_ioport m_io_mouse_button; + required_ioport m_io_mousex; + required_ioport m_io_mousey; bitmap_ind16 m_video_mem; diff --git a/src/mess/includes/samcoupe.h b/src/mess/includes/samcoupe.h index 26519391978..e576e32f782 100644 --- a/src/mess/includes/samcoupe.h +++ b/src/mess/includes/samcoupe.h @@ -18,6 +18,7 @@ #include "imagedev/cassette.h" #include "bus/centronics/ctronics.h" #include "machine/ram.h" +#include "machine/msm6242.h" /* screen dimensions */ #define SAM_BLOCK 8 @@ -56,16 +57,35 @@ public: m_cassette(*this, "cassette"), m_lpt1(*this, "lpt1"), m_lpt2(*this, "lpt2"), - m_ram(*this, RAM_TAG) { - sam_bank_read_ptr[0] = NULL; - sam_bank_write_ptr[0] = NULL; - sam_bank_read_ptr[1] = NULL; - sam_bank_write_ptr[1] = NULL; - sam_bank_read_ptr[2] = NULL; - sam_bank_write_ptr[2] = NULL; - sam_bank_read_ptr[3] = NULL; - sam_bank_write_ptr[3] = NULL; - } + m_ram(*this, RAM_TAG), + m_rtc(*this, "sambus_clock"), + m_fdc(*this, "wd1772"), + m_wd1772_0(*this, "wd1772:0"), + m_wd1772_1(*this, "wd1772:1"), + m_region_maincpu(*this, "maincpu"), + m_keyboard_row_fe(*this, "keyboard_row_fe"), + m_keyboard_row_fd(*this, "keyboard_row_fd"), + m_keyboard_row_fb(*this, "keyboard_row_fb"), + m_keyboard_row_f7(*this, "keyboard_row_f7"), + m_keyboard_row_ef(*this, "keyboard_row_ef"), + m_keyboard_row_df(*this, "keyboard_row_df"), + m_keyboard_row_bf(*this, "keyboard_row_bf"), + m_keyboard_row_7f(*this, "keyboard_row_7f"), + m_keyboard_row_ff(*this, "keyboard_row_ff"), + m_mouse_buttons(*this, "mouse_buttons"), + m_io_mouse_x(*this, "mouse_x"), + m_io_mouse_y(*this, "mouse_y"), + m_config(*this, "config") + { + sam_bank_read_ptr[0] = NULL; + sam_bank_write_ptr[0] = NULL; + sam_bank_read_ptr[1] = NULL; + sam_bank_write_ptr[1] = NULL; + sam_bank_read_ptr[2] = NULL; + sam_bank_write_ptr[2] = NULL; + sam_bank_read_ptr[3] = NULL; + sam_bank_write_ptr[3] = NULL; + } virtual void video_start(); @@ -141,6 +161,25 @@ public: required_device<centronics_device> m_lpt1; required_device<centronics_device> m_lpt2; required_device<ram_device> m_ram; + required_device<msm6242_device> m_rtc; + required_device<wd1772_t> m_fdc; + required_device<floppy_connector> m_wd1772_0; + required_device<floppy_connector> m_wd1772_1; + required_memory_region m_region_maincpu; + required_ioport m_keyboard_row_fe; + required_ioport m_keyboard_row_fd; + required_ioport m_keyboard_row_fb; + required_ioport m_keyboard_row_f7; + required_ioport m_keyboard_row_ef; + required_ioport m_keyboard_row_df; + required_ioport m_keyboard_row_bf; + required_ioport m_keyboard_row_7f; + required_ioport m_keyboard_row_ff; + required_ioport m_mouse_buttons; + required_ioport m_io_mouse_x; + required_ioport m_io_mouse_y; + required_ioport m_config; + void draw_mode4_line(int y, int hpos); void draw_mode3_line(int y, int hpos); void draw_mode12_block(bitmap_ind16 &bitmap, int vpos, int hpos, UINT8 mask); diff --git a/src/mess/includes/sorcerer.h b/src/mess/includes/sorcerer.h index 1a66cdd2afb..3cff01cdc38 100644 --- a/src/mess/includes/sorcerer.h +++ b/src/mess/includes/sorcerer.h @@ -64,6 +64,7 @@ public: , m_ram(*this, RAM_TAG) , m_iop_config(*this, "CONFIG") , m_iop_vs(*this, "VS") + , m_iop_x(*this, "X") { } DECLARE_READ8_MEMBER(sorcerer_fc_r); @@ -103,6 +104,7 @@ private: required_device<ram_device> m_ram; required_ioport m_iop_config; required_ioport m_iop_vs; + required_ioport_array<16> m_iop_x; }; #endif /* SORCERER_H_ */ diff --git a/src/mess/includes/spectrum.h b/src/mess/includes/spectrum.h index 5795c1e3cc0..2706e8223c7 100644 --- a/src/mess/includes/spectrum.h +++ b/src/mess/includes/spectrum.h @@ -203,9 +203,9 @@ public: DECLARE_SNAPSHOT_LOAD_MEMBER( spectrum ); DECLARE_QUICKLOAD_LOAD_MEMBER( spectrum ); + required_device<cpu_device> m_maincpu; protected: - required_device<cpu_device> m_maincpu; required_device<cassette_image_device> m_cassette; required_device<ram_device> m_ram; required_device<speaker_sound_device> m_speaker; diff --git a/src/mess/includes/ssystem3.h b/src/mess/includes/ssystem3.h index 64ed29b7427..0367a8acb67 100644 --- a/src/mess/includes/ssystem3.h +++ b/src/mess/includes/ssystem3.h @@ -9,6 +9,8 @@ #ifndef SSYSTEM3_H_ #define SSYSTEM3_H_ +#include "machine/6522via.h" + struct playfield_t { @@ -40,14 +42,14 @@ class ssystem3_state : public driver_device { public: ssystem3_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_palette(*this, "palette") { } + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_palette(*this, "palette") + , m_via6522_0(*this, "via6522_0") + , m_configuration(*this, "Configuration") + , m_matrix(*this, "matrix") + { } - UINT8 m_porta; - UINT8 *m_videoram; - playfield_t m_playfield; - lcd_t m_lcd; DECLARE_DRIVER_INIT(ssystem3); virtual void video_start(); DECLARE_PALETTE_INIT(ssystem3); @@ -56,8 +58,6 @@ public: DECLARE_READ8_MEMBER(ssystem3_via_read_a); DECLARE_READ8_MEMBER(ssystem3_via_read_b); DECLARE_WRITE8_MEMBER(ssystem3_via_write_b); - required_device<cpu_device> m_maincpu; - required_device<palette_device> m_palette; void ssystem3_lcd_reset(); void ssystem3_lcd_write(int clock, int data); void ssystem3_draw_7segment(bitmap_ind16 &bitmap,int value, int x, int y); @@ -66,6 +66,18 @@ public: void ssystem3_playfield_reset(); void ssystem3_playfield_write(int reset, int signal); void ssystem3_playfield_read(int *on, int *ready); + +private: + UINT8 m_porta; + UINT8 *m_videoram; + playfield_t m_playfield; + lcd_t m_lcd; + + required_device<cpu_device> m_maincpu; + required_device<palette_device> m_palette; + required_device<via6522_device> m_via6522_0; + required_ioport m_configuration; + required_ioport_array<4> m_matrix; }; diff --git a/src/mess/includes/thomson.h b/src/mess/includes/thomson.h index 7aac073fa2a..440ca355e45 100644 --- a/src/mess/includes/thomson.h +++ b/src/mess/includes/thomson.h @@ -113,7 +113,32 @@ public: m_mc6846(*this, "mc6846"), m_mc6843(*this, "mc6843"), m_acia6850(*this, "acia6850"), - m_screen(*this, "screen") + m_screen(*this, "screen"), + m_io_game_port_directions(*this, "game_port_directions"), + m_io_game_port_buttons(*this, "game_port_buttons"), + m_io_mouse_x(*this, "mouse_x"), + m_io_mouse_y(*this, "mouse_y"), + m_io_mouse_button(*this, "mouse_button"), + m_io_lightpen_x(*this, "lightpen_x"), + m_io_lightpen_y(*this, "lightpen_y"), + m_io_lightpen_button(*this, "lightpen_button"), + m_io_config(*this, "config"), + m_io_vconfig(*this, "vconfig"), + m_io_mconfig(*this, "mconfig"), + m_io_fconfig(*this, "fconfig"), + m_io_keyboard(*this, "keyboard"), + m_vrambank(*this, THOM_VRAM_BANK), + m_cartbank(*this, THOM_CART_BANK), + m_rambank(*this, THOM_RAM_BANK), + m_flopbank(*this, THOM_FLOP_BANK), + m_basebank(*this, THOM_BASE_BANK), + m_syslobank(*this, TO8_SYS_LO), + m_syshibank(*this, TO8_SYS_HI), + m_datalobank(*this, TO8_DATA_LO), + m_datahibank(*this, TO8_DATA_HI), + m_biosbank(*this, TO8_BIOS_BANK), + m_cartlobank(*this, MO6_CART_LO), + m_carthibank(*this, MO6_CART_HI) { } @@ -347,6 +372,31 @@ protected: optional_device<mc6843_device> m_mc6843; optional_device<acia6850_device> m_acia6850; required_device<screen_device> m_screen; + required_ioport m_io_game_port_directions; + required_ioport m_io_game_port_buttons; + required_ioport m_io_mouse_x; + required_ioport m_io_mouse_y; + required_ioport m_io_mouse_button; + required_ioport m_io_lightpen_x; + required_ioport m_io_lightpen_y; + required_ioport m_io_lightpen_button; + required_ioport m_io_config; + required_ioport m_io_vconfig; + optional_ioport m_io_mconfig; + required_ioport m_io_fconfig; + required_ioport_array<10> m_io_keyboard; + required_memory_bank m_vrambank; + optional_memory_bank m_cartbank; + optional_memory_bank m_rambank; + required_memory_bank m_flopbank; + required_memory_bank m_basebank; + required_memory_bank m_syslobank; + optional_memory_bank m_syshibank; + optional_memory_bank m_datalobank; + optional_memory_bank m_datahibank; + optional_memory_bank m_biosbank; + optional_memory_bank m_cartlobank; + optional_memory_bank m_carthibank; /* bank logging and optimisations */ int m_old_cart_bank; diff --git a/src/mess/includes/tx0.h b/src/mess/includes/tx0.h index b961a415224..98d111d72ec 100644 --- a/src/mess/includes/tx0.h +++ b/src/mess/includes/tx0.h @@ -136,7 +136,11 @@ public: : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_crt(*this, "crt"), + m_csw(*this, "CSW"), + m_twr(*this, "TWR") + { } tx0_tape_reader_t m_tape_reader; tape_puncher_t m_tape_puncher; @@ -152,7 +156,6 @@ public: bitmap_ind16 m_typewriter_bitmap; int m_pos; int m_case_shift; - crt_device *m_crt; DECLARE_DRIVER_INIT(tx0); virtual void machine_start(); virtual void machine_reset(); @@ -198,8 +201,13 @@ public: DECLARE_WRITE_LINE_MEMBER(tx0_sel); DECLARE_WRITE_LINE_MEMBER(tx0_io_reset_callback); void magtape_callback(); + +private: required_device<gfxdecode_device> m_gfxdecode; required_device<palette_device> m_palette; + required_device<crt_device> m_crt; + required_ioport m_csw; + required_ioport_array<4> m_twr; }; /* defines for each bit and mask in input port "CSW" */ diff --git a/src/mess/includes/vc4000.h b/src/mess/includes/vc4000.h index 529e1828404..f0d0c95cab8 100644 --- a/src/mess/includes/vc4000.h +++ b/src/mess/includes/vc4000.h @@ -82,6 +82,7 @@ public: m_screen(*this, "screen"), m_cassette(*this, "cassette"), m_cart(*this, "cartslot"), + m_custom(*this, "custom"), m_keypad1_1(*this, "KEYPAD1_1"), m_keypad1_2(*this, "KEYPAD1_2"), m_keypad1_3(*this, "KEYPAD1_3"), @@ -93,11 +94,12 @@ public: m_io_joy1_x(*this, "JOY1_X"), m_io_joy1_y(*this, "JOY1_Y"), m_io_joy2_x(*this, "JOY2_X"), - m_io_joy2_y(*this, "JOY2_Y") { } + m_io_joy2_y(*this, "JOY2_Y") #else m_joys(*this, "JOYS"), - m_config(*this, "CONFIG") { } + m_config(*this, "CONFIG") #endif + { } DECLARE_WRITE8_MEMBER(vc4000_sound_ctl); DECLARE_READ8_MEMBER(vc4000_key_r); @@ -128,6 +130,7 @@ protected: required_device<screen_device> m_screen; optional_device<cassette_image_device> m_cassette; required_device<vc4000_cart_slot_device> m_cart; + required_device<vc4000_sound_device> m_custom; required_ioport m_keypad1_1; required_ioport m_keypad1_2; required_ioport m_keypad1_3; diff --git a/src/mess/includes/vector06.h b/src/mess/includes/vector06.h index 970965465ef..959842aa3b6 100644 --- a/src/mess/includes/vector06.h +++ b/src/mess/includes/vector06.h @@ -27,30 +27,27 @@ class vector06_state : public driver_device public: vector06_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_cassette(*this, "cassette"), - m_cart(*this, "cartslot"), - m_fdc(*this, "wd1793"), - m_floppy0(*this, "wd1793:0"), - m_floppy1(*this, "wd1793:1"), - m_ppi(*this, "ppi8255"), - m_ppi2(*this, "ppi8255_2"), - m_ram(*this, RAM_TAG), - m_palette(*this, "palette") + m_maincpu(*this, "maincpu"), + m_cassette(*this, "cassette"), + m_cart(*this, "cartslot"), + m_fdc(*this, "wd1793"), + m_floppy0(*this, "wd1793:0"), + m_floppy1(*this, "wd1793:1"), + m_ppi(*this, "ppi8255"), + m_ppi2(*this, "ppi8255_2"), + m_ram(*this, RAM_TAG), + m_palette(*this, "palette"), + m_bank1(*this, "bank1"), + m_bank2(*this, "bank2"), + m_bank3(*this, "bank3"), + m_bank4(*this, "bank4"), + m_region_maincpu(*this, "maincpu"), + m_line(*this, "LINE"), + m_reset(*this, "RESET") { } DECLARE_FLOPPY_FORMATS(floppy_formats); - required_device<cpu_device> m_maincpu; - required_device<cassette_image_device> m_cassette; - required_device<generic_slot_device> m_cart; - required_device<fd1793_t> m_fdc; - required_device<floppy_connector> m_floppy0; - required_device<floppy_connector> m_floppy1; - required_device<i8255_device> m_ppi; - required_device<i8255_device> m_ppi2; - required_device<ram_device> m_ram; - required_device<palette_device> m_palette; DECLARE_READ8_MEMBER(vector06_8255_portb_r); DECLARE_READ8_MEMBER(vector06_8255_portc_r); DECLARE_WRITE8_MEMBER(vector06_8255_porta_w); @@ -64,12 +61,6 @@ public: DECLARE_READ8_MEMBER(vector06_8255_2_r); DECLARE_WRITE8_MEMBER(vector06_8255_2_w); DECLARE_WRITE8_MEMBER(vector06_disc_w); - UINT8 m_keyboard_mask; - UINT8 m_color_index; - UINT8 m_video_mode; - UINT8 m_romdisk_msb; - UINT8 m_romdisk_lsb; - UINT8 m_vblank_state; void vector06_set_video_mode(int width); virtual void machine_start(); virtual void machine_reset(); @@ -79,6 +70,33 @@ public: INTERRUPT_GEN_MEMBER(vector06_interrupt); TIMER_CALLBACK_MEMBER(reset_check_callback); IRQ_CALLBACK_MEMBER(vector06_irq_callback); + +private: + required_device<cpu_device> m_maincpu; + required_device<cassette_image_device> m_cassette; + required_device<generic_slot_device> m_cart; + required_device<fd1793_t> m_fdc; + required_device<floppy_connector> m_floppy0; + required_device<floppy_connector> m_floppy1; + required_device<i8255_device> m_ppi; + required_device<i8255_device> m_ppi2; + required_device<ram_device> m_ram; + required_device<palette_device> m_palette; + required_memory_bank m_bank1; + required_memory_bank m_bank2; + required_memory_bank m_bank3; + required_memory_bank m_bank4; + required_memory_region m_region_maincpu; + required_ioport_array<9> m_line; + required_ioport m_reset; + + UINT8 m_keyboard_mask; + UINT8 m_color_index; + UINT8 m_video_mode; + UINT8 m_romdisk_msb; + UINT8 m_romdisk_lsb; + UINT8 m_vblank_state; + }; #endif /* VECTOR06_H_ */ diff --git a/src/mess/layout/aim65.lay b/src/mess/layout/aim65.lay index 1ab154fe1b5..b250dc48b35 100644 --- a/src/mess/layout/aim65.lay +++ b/src/mess/layout/aim65.lay @@ -1,98 +1,133 @@ -<!-- aim65.lay --> +<?xml version="1.0"?> +<mamelayout version="2"> <!-- 2007-07-30: Initial version. [Dirk Best] --> +<!-- 2015-08-14: Eric Roberts version. [Best of the Best 2] --> -<mamelayout version="2"> + +<!-- define elements --> <element name="digit" defstate="0"> <led16seg> <!-- Note: Peak wavelength of the DL1416 chips = 660 nm --> - <color red="1.0" green="0.0" blue="0.0" /> + <color red="1.0" green="0.15" blue="0.2" /> </led16seg> </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="static_black"><rect><color red="0.0" green="0.0" blue="0.0" /></rect></element> + <element name="static_white"><rect><color red="0.85" green="0.84" blue="0.84" /></rect></element> - <view name="Default Layout"> - <!-- Black background --> - <bezel element="background"> - <bounds left="55" top="60" right="758" bottom="130" /> +<!-- build screen --> + + <view name="Internal Layout"> + <bounds left="50" top="20" right="770" bottom="141" /> + <bezel element="static_black"> + <bounds left="50" top="20" right="770" bottom="141" /> </bezel> + <!-- bezel --> + + <bezel element="static_white"><bounds left="50" top="20" right="770" bottom="141" /></bezel> + <bezel element="static_black"><bounds left="53" top="23" right="767" bottom="138" /></bezel> + + <bezel element="static_white"><bounds x="63" y="129" width="2" height="10" /></bezel> + <bezel element="static_white"><bounds x="97" y="135" width="2" height="4" /></bezel> + <bezel element="static_white"><bounds x="131" y="135" width="2" height="4" /></bezel> + <bezel element="static_white"><bounds x="165" y="135" width="2" height="4" /></bezel> + <bezel element="static_white"><bounds x="202" y="135" width="2" height="4" /></bezel> + + <bezel element="static_white"><bounds x="236" y="129" width="2" height="10" /></bezel> + <bezel element="static_white"><bounds x="270" y="135" width="2" height="4" /></bezel> + <bezel element="static_white"><bounds x="304" y="135" width="2" height="4" /></bezel> + <bezel element="static_white"><bounds x="341" y="135" width="2" height="4" /></bezel> + <bezel element="static_white"><bounds x="375" y="135" width="2" height="4" /></bezel> + + <bezel element="static_white"><bounds x="409" y="129" width="2" height="10" /></bezel> + <bezel element="static_white"><bounds x="443" y="135" width="2" height="4" /></bezel> + <bezel element="static_white"><bounds x="480" y="135" width="2" height="4" /></bezel> + <bezel element="static_white"><bounds x="514" y="135" width="2" height="4" /></bezel> + <bezel element="static_white"><bounds x="548" y="135" width="2" height="4" /></bezel> + + <bezel element="static_white"><bounds x="582" y="129" width="2" height="10" /></bezel> + <bezel element="static_white"><bounds x="619" y="135" width="2" height="4" /></bezel> + <bezel element="static_white"><bounds x="653" y="135" width="2" height="4" /></bezel> + <bezel element="static_white"><bounds x="687" y="135" width="2" height="4" /></bezel> + <bezel element="static_white"><bounds x="721" y="135" width="2" height="4" /></bezel> + + <bezel element="static_white"><bounds x="755" y="129" width="2" height="10" /></bezel> + + + <!-- digits --> + <!-- DL1416A DS1 --> <bezel name="digit0" element="digit"> - <bounds left="65" top="70" right="90" bottom="120" /> + <bounds left="65" top="80" right="90" bottom="120" /> </bezel> <bezel name="digit1" element="digit"> - <bounds left="99" top="70" right="124" bottom="120" /> + <bounds left="99" top="80" right="124" bottom="120" /> </bezel> <bezel name="digit2" element="digit"> - <bounds left="133" top="70" right="158" bottom="120" /> + <bounds left="133" top="80" right="158" bottom="120" /> </bezel> <bezel name="digit3" element="digit"> - <bounds left="167" top="70" right="192" bottom="120" /> + <bounds left="167" top="80" right="192" bottom="120" /> </bezel> <!-- DL1416A DS2 --> <bezel name="digit4" element="digit"> - <bounds left="204" top="70" right="229" bottom="120" /> + <bounds left="204" top="80" right="229" bottom="120" /> </bezel> <bezel name="digit5" element="digit"> - <bounds left="238" top="70" right="263" bottom="120" /> + <bounds left="238" top="80" right="263" bottom="120" /> </bezel> <bezel name="digit6" element="digit"> - <bounds left="272" top="70" right="297" bottom="120" /> + <bounds left="272" top="80" right="297" bottom="120" /> </bezel> <bezel name="digit7" element="digit"> - <bounds left="306" top="70" right="331" bottom="120" /> + <bounds left="306" top="80" right="331" bottom="120" /> </bezel> <!-- DL1416A DS3 --> <bezel name="digit8" element="digit"> - <bounds left="343" top="70" right="368" bottom="120" /> + <bounds left="343" top="80" right="368" bottom="120" /> </bezel> <bezel name="digit9" element="digit"> - <bounds left="377" top="70" right="402" bottom="120" /> + <bounds left="377" top="80" right="402" bottom="120" /> </bezel> <bezel name="digit10" element="digit"> - <bounds left="411" top="70" right="436" bottom="120" /> + <bounds left="411" top="80" right="436" bottom="120" /> </bezel> <bezel name="digit11" element="digit"> - <bounds left="445" top="70" right="470" bottom="120" /> + <bounds left="445" top="80" right="470" bottom="120" /> </bezel> <!-- DL1416A DS4 --> <bezel name="digit12" element="digit"> - <bounds left="482" top="70" right="507" bottom="120" /> + <bounds left="482" top="80" right="507" bottom="120" /> </bezel> <bezel name="digit13" element="digit"> - <bounds left="516" top="70" right="541" bottom="120" /> + <bounds left="516" top="80" right="541" bottom="120" /> </bezel> <bezel name="digit14" element="digit"> - <bounds left="550" top="70" right="575" bottom="120" /> + <bounds left="550" top="80" right="575" bottom="120" /> </bezel> <bezel name="digit15" element="digit"> - <bounds left="584" top="70" right="609" bottom="120" /> + <bounds left="584" top="80" right="609" bottom="120" /> </bezel> <!-- DL1416A DS5 --> <bezel name="digit16" element="digit"> - <bounds left="621" top="70" right="646" bottom="120" /> + <bounds left="621" top="80" right="646" bottom="120" /> </bezel> <bezel name="digit17" element="digit"> - <bounds left="655" top="70" right="680" bottom="120" /> + <bounds left="655" top="80" right="680" bottom="120" /> </bezel> <bezel name="digit18" element="digit"> - <bounds left="689" top="70" right="714" bottom="120" /> + <bounds left="689" top="80" right="714" bottom="120" /> </bezel> <bezel name="digit19" element="digit"> - <bounds left="723" top="70" right="748" bottom="120" /> + <bounds left="723" top="80" right="748" bottom="120" /> </bezel> </view> diff --git a/src/mess/layout/tactix.lay b/src/mess/layout/tactix.lay new file mode 100644 index 00000000000..63afeac12a4 --- /dev/null +++ b/src/mess/layout/tactix.lay @@ -0,0 +1,150 @@ +<?xml version="1.0"?> +<mamelayout version="2"> + +<!-- define elements --> + + <element name="static_white"><rect><color red="0.95" green="0.95" blue="0.97" /></rect></element> + <element name="disk_grey"><disk><color red="0.65" green="0.65" blue="0.67" /></disk></element> + <element name="disk_blue"><disk><color red="0.06" green="0.4" blue="0.85" /></disk></element> + <element name="disk_yellow"><disk><color red="0.80" green="0.85" blue="0.3" /></disk></element> + + <element name="button" defstate="0"> + <text state="0" string=" "><color red="0.0" green="0.0" blue="0.0" /></text> + <text state="1" string=" "><color red="0.0" green="0.0" blue="0.0" /></text> + <disk state="1"> + <bounds x="0.04" y="0.04" width="0.92" height="0.92"/> + <color red="0.30" green="0.31" blue="0.32" /> + </disk> + </element> + + <element name="led" defstate="0"> + <disk> + <bounds x="0" y="0" width="1" height="1" /> + <color red="0.0" green="0.0" blue="0.0" /> + </disk> + <disk state="0"> + <bounds x="0.1" y="0.1" width="0.8" height="0.8" /> + <color red="0.2" green="0.03" blue="0.05" /> + </disk> + <disk state="1"> + <bounds x="0.1" y="0.1" width="0.8" height="0.8" /> + <color red="1.0" green="0.15" blue="0.25" /> + </disk> + </element> + + <element name="t1"><rect><color red="0.06" green="0.4" blue="0.85" /></rect><text string="1"><color red="0.9" green="0.9" blue="0.9" /></text></element> + <element name="t2"><rect><color red="0.06" green="0.4" blue="0.85" /></rect><text string="2"><color red="0.9" green="0.9" blue="0.9" /></text></element> + <element name="t3"><rect><color red="0.06" green="0.4" blue="0.85" /></rect><text string="3"><color red="0.9" green="0.9" blue="0.9" /></text></element> + <element name="t4"><rect><color red="0.06" green="0.4" blue="0.85" /></rect><text string="4"><color red="0.9" green="0.9" blue="0.9" /></text></element> + <element name="t5"><rect><color red="0.06" green="0.4" blue="0.85" /></rect><text string="5"><color red="0.9" green="0.9" blue="0.9" /></text></element> + <element name="t6"><rect><color red="0.06" green="0.4" blue="0.85" /></rect><text string="6"><color red="0.9" green="0.9" blue="0.9" /></text></element> + <element name="t7"><rect><color red="0.06" green="0.4" blue="0.85" /></rect><text string="7"><color red="0.9" green="0.9" blue="0.9" /></text></element> + <element name="t8"><rect><color red="0.06" green="0.4" blue="0.85" /></rect><text string="8"><color red="0.9" green="0.9" blue="0.9" /></text></element> + <element name="t9"><rect><color red="0.06" green="0.4" blue="0.85" /></rect><text string="9"><color red="0.9" green="0.9" blue="0.9" /></text></element> + <element name="t10"><rect><color red="0.06" green="0.4" blue="0.85" /></rect><text string="10"><color red="0.9" green="0.9" blue="0.9" /></text></element> + <element name="t11"><rect><color red="0.06" green="0.4" blue="0.85" /></rect><text string="11"><color red="0.9" green="0.9" blue="0.9" /></text></element> + <element name="t12"><rect><color red="0.06" green="0.4" blue="0.85" /></rect><text string="12"><color red="0.9" green="0.9" blue="0.9" /></text></element> + <element name="t13"><rect><color red="0.06" green="0.4" blue="0.85" /></rect><text string="13"><color red="0.9" green="0.9" blue="0.9" /></text></element> + <element name="t14"><rect><color red="0.06" green="0.4" blue="0.85" /></rect><text string="14"><color red="0.9" green="0.9" blue="0.9" /></text></element> + <element name="t15"><rect><color red="0.06" green="0.4" blue="0.85" /></rect><text string="15"><color red="0.9" green="0.9" blue="0.9" /></text></element> + <element name="t16"><rect><color red="0.06" green="0.4" blue="0.85" /></rect><text string="16"><color red="0.9" green="0.9" blue="0.9" /></text></element> + + <element name="t_comp"><rect><color red="0.06" green="0.4" blue="0.85" /></rect><text string="COMP"><color red="0.9" green="0.9" blue="0.9" /></text></element> + <element name="t_turn"><rect><color red="0.06" green="0.4" blue="0.85" /></rect><text string="TURN"><color red="0.9" green="0.9" blue="0.9" /></text></element> + <element name="t_new"><rect><color red="0.06" green="0.4" blue="0.85" /></rect><text string="NEW"><color red="0.9" green="0.9" blue="0.9" /></text></element> + <element name="t_game"><rect><color red="0.06" green="0.4" blue="0.85" /></rect><text string="GAME"><color red="0.9" green="0.9" blue="0.9" /></text></element> + + +<!-- build screen --> + + <view name="Internal Layout"> + <bounds left="7.15" right="20" top="7.15" bottom="20" /> + <bezel element="static_white"> + <bounds left="0" right="30" top="0" bottom="30" /> + </bezel> + + <!-- bezel --> + + <bezel element="disk_grey"><bounds x="7.55" y="7.55" width="12.05" height="12.05" /></bezel> + <bezel element="disk_blue"><bounds x="7.8" y="7.8" width="11.55" height="11.55" /></bezel> + + <bezel element="t1"><bounds x="10" y="11.25" width="1.15" height="0.5" /></bezel> + <bezel element="t2"><bounds x="12" y="11.25" width="1.15" height="0.5" /></bezel> + <bezel element="t3"><bounds x="14" y="11.25" width="1.15" height="0.5" /></bezel> + <bezel element="t4"><bounds x="16" y="11.25" width="1.15" height="0.5" /></bezel> + + <bezel element="t5"><bounds x="10" y="13.25" width="1.15" height="0.5" /></bezel> + <bezel element="t6"><bounds x="12" y="13.25" width="1.15" height="0.5" /></bezel> + <bezel element="t7"><bounds x="14" y="13.25" width="1.15" height="0.5" /></bezel> + <bezel element="t8"><bounds x="16" y="13.25" width="1.15" height="0.5" /></bezel> + + <bezel element="t9"><bounds x="10" y="15.25" width="1.15" height="0.5" /></bezel> + <bezel element="t10"><bounds x="12" y="15.25" width="1.15" height="0.5" /></bezel> + <bezel element="t11"><bounds x="14" y="15.25" width="1.15" height="0.5" /></bezel> + <bezel element="t12"><bounds x="16" y="15.25" width="1.15" height="0.5" /></bezel> + + <bezel element="t13"><bounds x="10" y="17.25" width="1.15" height="0.5" /></bezel> + <bezel element="t14"><bounds x="12" y="17.25" width="1.15" height="0.5" /></bezel> + <bezel element="t15"><bounds x="14" y="17.25" width="1.15" height="0.5" /></bezel> + <bezel element="t16"><bounds x="16" y="17.25" width="1.15" height="0.5" /></bezel> + + <bezel element="t_comp"><bounds x="7.95" y="12.32" width="1.55" height="0.5" /></bezel> + <bezel element="t_turn"><bounds x="7.95" y="14.175" width="1.55" height="0.5" /></bezel> + <bezel element="disk_yellow"><bounds x="8.15" y="12.925" width="1.15" height="1.15" /></bezel> + + <bezel element="t_new"><bounds x="17.65" y="12.32" width="1.55" height="0.5" /></bezel> + <bezel element="t_game"><bounds x="17.65" y="14.175" width="1.55" height="0.5" /></bezel> + <bezel element="disk_yellow"><bounds x="17.85" y="12.925" width="1.15" height="1.15" /></bezel> + + + <!-- leds --> + + <bezel name="3.0" element="led"><bounds x="10" y="10" width="1.15" height="1.15" /></bezel> + <bezel name="3.1" element="led"><bounds x="12" y="10" width="1.15" height="1.15" /></bezel> + <bezel name="3.2" element="led"><bounds x="14" y="10" width="1.15" height="1.15" /></bezel> + <bezel name="3.3" element="led"><bounds x="16" y="10" width="1.15" height="1.15" /></bezel> + + <bezel name="2.0" element="led"><bounds x="10" y="12" width="1.15" height="1.15" /></bezel> + <bezel name="2.1" element="led"><bounds x="12" y="12" width="1.15" height="1.15" /></bezel> + <bezel name="2.2" element="led"><bounds x="14" y="12" width="1.15" height="1.15" /></bezel> + <bezel name="2.3" element="led"><bounds x="16" y="12" width="1.15" height="1.15" /></bezel> + + <bezel name="1.0" element="led"><bounds x="10" y="14" width="1.15" height="1.15" /></bezel> + <bezel name="1.1" element="led"><bounds x="12" y="14" width="1.15" height="1.15" /></bezel> + <bezel name="1.2" element="led"><bounds x="14" y="14" width="1.15" height="1.15" /></bezel> + <bezel name="1.3" element="led"><bounds x="16" y="14" width="1.15" height="1.15" /></bezel> + + <bezel name="0.0" element="led"><bounds x="10" y="16" width="1.15" height="1.15" /></bezel> + <bezel name="0.1" element="led"><bounds x="12" y="16" width="1.15" height="1.15" /></bezel> + <bezel name="0.2" element="led"><bounds x="14" y="16" width="1.15" height="1.15" /></bezel> + <bezel name="0.3" element="led"><bounds x="16" y="16" width="1.15" height="1.15" /></bezel> + + + <!-- button highlights --> + + <bezel element="button" inputtag="IN.0" inputmask="0x01"><bounds x="10" y="10" width="1.15" height="1.15" /><color alpha="0.6" /></bezel> + <bezel element="button" inputtag="IN.0" inputmask="0x02"><bounds x="10" y="12" width="1.15" height="1.15" /><color alpha="0.6" /></bezel> + <bezel element="button" inputtag="IN.0" inputmask="0x04"><bounds x="10" y="14" width="1.15" height="1.15" /><color alpha="0.6" /></bezel> + <bezel element="button" inputtag="IN.0" inputmask="0x08"><bounds x="10" y="16" width="1.15" height="1.15" /><color alpha="0.6" /></bezel> + + <bezel element="button" inputtag="IN.1" inputmask="0x01"><bounds x="12" y="10" width="1.15" height="1.15" /><color alpha="0.6" /></bezel> + <bezel element="button" inputtag="IN.1" inputmask="0x02"><bounds x="12" y="12" width="1.15" height="1.15" /><color alpha="0.6" /></bezel> + <bezel element="button" inputtag="IN.1" inputmask="0x04"><bounds x="12" y="14" width="1.15" height="1.15" /><color alpha="0.6" /></bezel> + <bezel element="button" inputtag="IN.1" inputmask="0x08"><bounds x="12" y="16" width="1.15" height="1.15" /><color alpha="0.6" /></bezel> + + <bezel element="button" inputtag="IN.2" inputmask="0x01"><bounds x="14" y="10" width="1.15" height="1.15" /><color alpha="0.6" /></bezel> + <bezel element="button" inputtag="IN.2" inputmask="0x02"><bounds x="14" y="12" width="1.15" height="1.15" /><color alpha="0.6" /></bezel> + <bezel element="button" inputtag="IN.2" inputmask="0x04"><bounds x="14" y="14" width="1.15" height="1.15" /><color alpha="0.6" /></bezel> + <bezel element="button" inputtag="IN.2" inputmask="0x08"><bounds x="14" y="16" width="1.15" height="1.15" /><color alpha="0.6" /></bezel> + + <bezel element="button" inputtag="IN.3" inputmask="0x01"><bounds x="16" y="10" width="1.15" height="1.15" /><color alpha="0.6" /></bezel> + <bezel element="button" inputtag="IN.3" inputmask="0x02"><bounds x="16" y="12" width="1.15" height="1.15" /><color alpha="0.6" /></bezel> + <bezel element="button" inputtag="IN.3" inputmask="0x04"><bounds x="16" y="14" width="1.15" height="1.15" /><color alpha="0.6" /></bezel> + <bezel element="button" inputtag="IN.3" inputmask="0x08"><bounds x="16" y="16" width="1.15" height="1.15" /><color alpha="0.6" /></bezel> + + <bezel element="button" inputtag="IN.4" inputmask="0x04"><bounds x="8.15" y="12.925" width="1.15" height="1.15" /><color alpha="0.33" /></bezel> + <bezel element="button" inputtag="IN.4" inputmask="0x01"><bounds x="17.85" y="12.925" width="1.15" height="1.15" /><color alpha="0.33" /></bezel> + + + </view> +</mamelayout> diff --git a/src/mess/layout/tntell.lay b/src/mess/layout/tntell.lay new file mode 100644 index 00000000000..629a79643c2 --- /dev/null +++ b/src/mess/layout/tntell.lay @@ -0,0 +1,101 @@ +<?xml version="1.0"?> +<mamelayout version="2"> + +<!-- define elements --> + + <element name="static_black"><rect><color red="0.1" green="0.1" blue="0.1" /></rect></element> + <element name="static_white"><rect><color red="0.98" green="0.98" blue="1.0" /></rect></element> + + <element name="text_on"> + <rect><color red="0.98" green="0.98" blue="1.0" /></rect> + <text string="ON"><color red="0.9" green="0.7" blue="0.6" /></text> + </element> + <element name="text_off"> + <rect><color red="0.98" green="0.98" blue="1.0" /></rect> + <text string="OFF"><color red="0.44" green="0.55" blue="0.9" /></text> + </element> + + <element name="led" defstate="0"> + <disk state="0"><color red="0.4" green="0.1" blue="0.11" /></disk> + <disk state="1"><color red="1.0" green="0.2" blue="0.22" /></disk> + </element> + + <element name="hole" defstate="1"> + <text state="0" string=" "><color red="0.0" green="0.0" blue="0.0" /></text> + <text state="1" string=" "><color red="0.0" green="0.0" blue="0.0" /></text> + <disk state="0"><color red="0.0" green="0.0" blue="0.0" /></disk> + </element> + + <element name="button" defstate="0"> + <rect state="0"><color red="0.98" green="0.98" blue="1.0" /></rect> + <rect state="1"><color red="0.98" green="0.98" blue="1.0" /></rect> + <disk state="1"> + <bounds x="0.16" y="0.16" width="0.68" height="0.68"/> + <color red="0.88" green="0.88" blue="0.86" /> + </disk> + </element> + + +<!-- build screen --> + + <view name="Internal Layout"> + <bounds left="3" right="71.8" top="9.7" bottom="71.8" /> + <bezel element="static_black"> + <bounds left="3" right="71.8" top="9.7" bottom="71.8" /> + </bezel> + + <bezel element="static_white"><bounds x="3.3" y="10.0" width="6.3" height="61.5" /></bezel> + <bezel name="ol1" element="hole"><bounds x="5.6" y="56.0" width="1.7" height="1.7" /></bezel> + <bezel name="ol2" element="hole"><bounds x="5.6" y="53.5" width="1.7" height="1.7" /></bezel> + <bezel name="ol3" element="hole"><bounds x="5.6" y="51.0" width="1.7" height="1.7" /></bezel> + <bezel name="ol4" element="hole"><bounds x="5.6" y="48.5" width="1.7" height="1.7" /></bezel> + <bezel name="ol5" element="hole"><bounds x="5.6" y="46.0" width="1.7" height="1.7" /></bezel> + + <bezel element="button" inputtag="IN.0" inputmask="0x01"><bounds x="10.0" y="10.0" width="10" height="10" /></bezel> + <bezel element="button" inputtag="IN.0" inputmask="0x02"><bounds x="20.3" y="10.0" width="10" height="10" /></bezel> + <bezel element="button" inputtag="IN.0" inputmask="0x08"><bounds x="30.6" y="10.0" width="10" height="10" /></bezel> + <bezel element="button" inputtag="IN.0" inputmask="0x04"><bounds x="40.9" y="10.0" width="10" height="10" /></bezel> + <bezel element="button" inputtag="IN.6" inputmask="0x08"><bounds x="51.2" y="10.0" width="10" height="10" /></bezel> + <bezel element="button" inputtag="IN.7" inputmask="0x08"><bounds x="61.5" y="10.0" width="10" height="10" /></bezel> + + <bezel element="button" inputtag="IN.1" inputmask="0x01"><bounds x="10.0" y="20.3" width="10" height="10" /></bezel> + <bezel element="button" inputtag="IN.1" inputmask="0x02"><bounds x="20.3" y="20.3" width="10" height="10" /></bezel> + <bezel element="button" inputtag="IN.1" inputmask="0x08"><bounds x="30.6" y="20.3" width="10" height="10" /></bezel> + <bezel element="button" inputtag="IN.1" inputmask="0x04"><bounds x="40.9" y="20.3" width="10" height="10" /></bezel> + <bezel element="button" inputtag="IN.6" inputmask="0x02"><bounds x="51.2" y="20.3" width="10" height="10" /></bezel> + <bezel element="button" inputtag="IN.7" inputmask="0x02"><bounds x="61.5" y="20.3" width="10" height="10" /></bezel> + + <bezel element="button" inputtag="IN.2" inputmask="0x01"><bounds x="10.0" y="30.6" width="10" height="10" /></bezel> + <bezel element="button" inputtag="IN.2" inputmask="0x02"><bounds x="20.3" y="30.6" width="10" height="10" /></bezel> + <bezel element="button" inputtag="IN.2" inputmask="0x08"><bounds x="30.6" y="30.6" width="10" height="10" /></bezel> + <bezel element="button" inputtag="IN.2" inputmask="0x04"><bounds x="40.9" y="30.6" width="10" height="10" /></bezel> + <bezel element="button" inputtag="IN.6" inputmask="0x01"><bounds x="51.2" y="30.6" width="10" height="10" /></bezel> + <bezel element="button" inputtag="IN.7" inputmask="0x01"><bounds x="61.5" y="30.6" width="10" height="10" /></bezel> + + <bezel element="button" inputtag="IN.3" inputmask="0x01"><bounds x="10.0" y="40.9" width="10" height="10" /></bezel> + <bezel element="button" inputtag="IN.3" inputmask="0x02"><bounds x="20.3" y="40.9" width="10" height="10" /></bezel> + <bezel element="button" inputtag="IN.3" inputmask="0x08"><bounds x="30.6" y="40.9" width="10" height="10" /></bezel> + <bezel element="button" inputtag="IN.3" inputmask="0x04"><bounds x="40.9" y="40.9" width="10" height="10" /></bezel> + <bezel element="button" inputtag="IN.6" inputmask="0x04"><bounds x="51.2" y="40.9" width="10" height="10" /></bezel> + <bezel element="button" inputtag="IN.7" inputmask="0x04"><bounds x="61.5" y="40.9" width="10" height="10" /></bezel> + + <bezel element="button" inputtag="IN.4" inputmask="0x01"><bounds x="10.0" y="51.2" width="10" height="10" /></bezel> + <bezel element="button" inputtag="IN.4" inputmask="0x02"><bounds x="20.3" y="51.2" width="10" height="10" /></bezel> + <bezel element="button" inputtag="IN.4" inputmask="0x08"><bounds x="30.6" y="51.2" width="10" height="10" /></bezel> + <bezel element="button" inputtag="IN.4" inputmask="0x04"><bounds x="40.9" y="51.2" width="10" height="10" /></bezel> + <bezel element="button" inputtag="IN.5" inputmask="0x04"><bounds x="51.2" y="51.2" width="10" height="10" /></bezel> + <bezel element="button" inputtag="IN.5" inputmask="0x01"><bounds x="61.5" y="51.2" width="10" height="10" /></bezel> + + <bezel element="button" inputtag="IN.8" inputmask="0x01"><bounds x="10.0" y="61.5" width="10" height="10" /></bezel> + <bezel element="button" inputtag="IN.8" inputmask="0x02"><bounds x="20.3" y="61.5" width="10" height="10" /></bezel> + <bezel element="button" inputtag="IN.8" inputmask="0x08"><bounds x="30.6" y="61.5" width="10" height="10" /></bezel> + <bezel element="button" inputtag="IN.8" inputmask="0x04"><bounds x="40.9" y="61.5" width="10" height="10" /></bezel> + <bezel element="button" inputtag="IN.5" inputmask="0x02"><bounds x="51.2" y="61.5" width="10" height="10" /></bezel> + <bezel element="button" inputtag="IN.9" inputmask="0x02"><bounds x="61.5" y="61.5" width="10" height="10" /></bezel> + + <bezel element="text_off"><bounds x="10.6" y="69.8" width="3" height="1.6" /></bezel> + <bezel element="text_on"><bounds x="67.9" y="69.8" width="2.3" height="1.6" /></bezel> + <bezel name="power_led" element="led"><bounds x="70.1" y="70.1" width="1" height="1" /></bezel> <!-- fake --> + + </view> +</mamelayout> diff --git a/src/mess/machine/ac1.c b/src/mess/machine/ac1.c index faa1411b57f..e504807ef96 100644 --- a/src/mess/machine/ac1.c +++ b/src/mess/machine/ac1.c @@ -27,13 +27,13 @@ READ8_MEMBER(ac1_state::ac1_port_b_r) READ8_MEMBER(ac1_state::ac1_port_a_r) { - UINT8 line0 = ioport("LINE0")->read(); - UINT8 line1 = ioport("LINE1")->read(); - UINT8 line2 = ioport("LINE2")->read(); - UINT8 line3 = ioport("LINE3")->read(); - UINT8 line4 = ioport("LINE4")->read(); - UINT8 line5 = ioport("LINE5")->read(); - UINT8 line6 = ioport("LINE6")->read(); + UINT8 line0 = m_io_line[0]->read(); + UINT8 line1 = m_io_line[1]->read(); + UINT8 line2 = m_io_line[2]->read(); + UINT8 line3 = m_io_line[3]->read(); + UINT8 line4 = m_io_line[4]->read(); + UINT8 line5 = m_io_line[5]->read(); + UINT8 line6 = m_io_line[6]->read(); UINT8 SH = BNOT(BIT(line6,0)); UINT8 CTRL = BNOT(BIT(line6,1)); diff --git a/src/mess/machine/amstrad.c b/src/mess/machine/amstrad.c index 508ed6f2e82..2e7d5796894 100644 --- a/src/mess/machine/amstrad.c +++ b/src/mess/machine/amstrad.c @@ -2660,17 +2660,17 @@ READ8_MEMBER(amstrad_state::amstrad_psg_porta_read) { if(m_system_type != SYSTEM_GX4000) { - if((m_io_ctrltype->read_safe(0) == 1) && (m_ppi_port_outputs[amstrad_ppi_PortC] & 0x0F) == 9) + if(m_io_ctrltype && (m_io_ctrltype->read() == 1) && (m_ppi_port_outputs[amstrad_ppi_PortC] & 0x0F) == 9) { return m_amx_mouse_data; } - if((m_io_ctrltype->read_safe(0) == 2) && (m_ppi_port_outputs[amstrad_ppi_PortC] & 0x0F) == 9) + if(m_io_ctrltype && (m_io_ctrltype->read() == 2) && (m_ppi_port_outputs[amstrad_ppi_PortC] & 0x0F) == 9) { - return (m_io_kbrow[m_ppi_port_outputs[amstrad_ppi_PortC] & 0x0F]->read_safe(0) & 0x80) | 0x7f; + return (m_io_kbrow[m_ppi_port_outputs[amstrad_ppi_PortC] & 0x0F] ? m_io_kbrow[m_ppi_port_outputs[amstrad_ppi_PortC] & 0x0F]->read() & 0x80 : 0) | 0x7f; } } - return m_io_kbrow[m_ppi_port_outputs[amstrad_ppi_PortC] & 0x0F]->read_safe(0) & 0xFF; + return m_io_kbrow[m_ppi_port_outputs[amstrad_ppi_PortC] & 0x0F] ? m_io_kbrow[m_ppi_port_outputs[amstrad_ppi_PortC] & 0x0F]->read() : 0; } return 0xFF; } @@ -2705,14 +2705,14 @@ IRQ_CALLBACK_MEMBER(amstrad_state::amstrad_cpu_acknowledge_int) if(m_system_type != SYSTEM_GX4000) { // update AMX mouse inputs (normally done every 1/300th of a second) - if(m_io_ctrltype->read_safe(0) == 1) + if(m_io_ctrltype && m_io_ctrltype->read() == 1) { static UINT8 prev_x,prev_y; UINT8 data_x, data_y; m_amx_mouse_data = 0x0f; - data_x = m_io_mouse1->read_safe(0) & 0xff; - data_y = m_io_mouse2->read_safe(0) & 0xff; + data_x = m_io_mouse1 ? m_io_mouse1->read() : 0; + data_y = m_io_mouse2 ? m_io_mouse2->read() : 0; if(data_x > prev_x) m_amx_mouse_data &= ~0x08; @@ -2722,11 +2722,11 @@ IRQ_CALLBACK_MEMBER(amstrad_state::amstrad_cpu_acknowledge_int) m_amx_mouse_data &= ~0x02; if(data_y < prev_y) m_amx_mouse_data &= ~0x01; - m_amx_mouse_data |= (m_io_mouse3->read_safe(0) << 4); + m_amx_mouse_data |= ((m_io_mouse3 ? m_io_mouse3->read() : 0) << 4); prev_x = data_x; prev_y = data_y; - m_amx_mouse_data |= (m_io_kbrow[9]->read_safe(0) & 0x80); // DEL key + m_amx_mouse_data |= ((m_io_kbrow[9] ? m_io_kbrow[9]->read() : 0) & 0x80); // DEL key } } return 0xFF; diff --git a/src/mess/machine/apple2gs.c b/src/mess/machine/apple2gs.c index 537375b17cc..4f7f64f0f7c 100644 --- a/src/mess/machine/apple2gs.c +++ b/src/mess/machine/apple2gs.c @@ -143,7 +143,7 @@ void apple2gs_state::process_clock() seconds_t current_interval; /* update clock_curtime */ - current_interval = machine().time().seconds; + current_interval = machine().time().seconds(); m_clock_curtime += current_interval - m_clock_curtime_interval; m_clock_curtime_interval = current_interval; diff --git a/src/mess/machine/bebox.c b/src/mess/machine/bebox.c index 0523bcbcf51..d5bceceb0aa 100644 --- a/src/mess/machine/bebox.c +++ b/src/mess/machine/bebox.c @@ -97,16 +97,9 @@ #include "video/pc_vga.h" #include "bus/lpci/cirrus.h" #include "cpu/powerpc/ppc.h" -#include "machine/ins8250.h" -#include "machine/upd765.h" #include "machine/mc146818.h" -#include "machine/pic8259.h" -#include "machine/am9517a.h" #include "machine/ataintf.h" #include "bus/lpci/pci.h" -#include "machine/intelfsh.h" -#include "machine/53c810.h" -#include "machine/ram.h" #define LOG_CPUIMASK 1 #define LOG_UART 1 @@ -215,7 +208,7 @@ WRITE64_MEMBER(bebox_state::bebox_crossproc_interrupts_w ) }; int i, line; UINT32 old_crossproc_interrupts = m_crossproc_interrupts; - static const char *const cputags[] = { "ppc1", "ppc2" }; + cpu_device *cpus[] = { m_ppc1, m_ppc2 }; bebox_mbreg32_w(&m_crossproc_interrupts, data, mem_mask); @@ -237,7 +230,7 @@ WRITE64_MEMBER(bebox_state::bebox_crossproc_interrupts_w ) */ } - space.machine().device(cputags[crossproc_map[i].cpunum])->execute().set_input_line(crossproc_map[i].inputline, line); + cpus[crossproc_map[i].cpunum]->set_input_line(crossproc_map[i].inputline, line); } } } @@ -256,7 +249,7 @@ WRITE64_MEMBER(bebox_state::bebox_processor_resets_w ) void bebox_state::bebox_update_interrupts() { UINT32 interrupt; - static const char *const cputags[] = { "ppc1", "ppc2" }; + cpu_device *cpus[] = { m_ppc1, m_ppc2 }; for (int cpunum = 0; cpunum < 2; cpunum++) { @@ -268,7 +261,7 @@ void bebox_state::bebox_update_interrupts() m_interrupts, m_cpu_imask[cpunum], interrupt ? "on" : "off"); } - machine().device(cputags[cpunum])->execute().set_input_line(INPUT_LINE_IRQ0, interrupt ? ASSERT_LINE : CLEAR_LINE); + cpus[cpunum]->set_input_line(INPUT_LINE_IRQ0, interrupt ? ASSERT_LINE : CLEAR_LINE); } } @@ -318,8 +311,8 @@ void bebox_state::bebox_set_irq_bit(unsigned int interrupt_bit, int val) assert_always((interrupt_bit < ARRAY_LENGTH(interrupt_names)) && (interrupt_names[interrupt_bit] != NULL), "Raising invalid interrupt"); logerror("bebox_set_irq_bit(): pc[0]=0x%08x pc[1]=0x%08x %s interrupt #%u (%s)\n", - (unsigned) machine().device("ppc1")->safe_pc(), - (unsigned) machine().device("ppc2")->safe_pc(), + (unsigned) m_ppc1->pc(), + (unsigned) m_ppc2->pc(), val ? "Asserting" : "Clearing", interrupt_bit, interrupt_names[interrupt_bit]); } @@ -546,7 +539,7 @@ WRITE_LINE_MEMBER(bebox_state::bebox_dma_hrq_changed) READ8_MEMBER(bebox_state::bebox_dma_read_byte ) { - address_space& prog_space = machine().device<cpu_device>("ppc1")->space(AS_PROGRAM); // get the right address space + address_space& prog_space = m_ppc1->space(AS_PROGRAM); // get the right address space offs_t page_offset = (((offs_t) m_dma_offset[0][m_dma_channel]) << 16) & 0x7FFF0000; return prog_space.read_byte(page_offset + offset); @@ -555,7 +548,7 @@ READ8_MEMBER(bebox_state::bebox_dma_read_byte ) WRITE8_MEMBER(bebox_state::bebox_dma_write_byte ) { - address_space& prog_space = machine().device<cpu_device>("ppc1")->space(AS_PROGRAM); // get the right address space + address_space& prog_space = m_ppc1->space(AS_PROGRAM); // get the right address space offs_t page_offset = (((offs_t) m_dma_offset[0][m_dma_channel]) << 16) & 0x7FFF0000; prog_space.write_byte(page_offset + offset, data); @@ -563,17 +556,17 @@ WRITE8_MEMBER(bebox_state::bebox_dma_write_byte ) READ8_MEMBER(bebox_state::bebox_dma8237_fdc_dack_r){ - return machine().device<smc37c78_device>("smc37c78")->dma_r(); + return m_smc37c78->dma_r(); } WRITE8_MEMBER(bebox_state::bebox_dma8237_fdc_dack_w){ - machine().device<smc37c78_device>("smc37c78")->dma_w(data); + m_smc37c78->dma_w(data); } WRITE_LINE_MEMBER(bebox_state::bebox_dma8237_out_eop){ - machine().device<smc37c78_device>("smc37c78")->tc_w(state); + m_smc37c78->tc_w(state); } static void set_dma_channel(running_machine &machine, int channel, int state) @@ -607,17 +600,15 @@ WRITE_LINE_MEMBER(bebox_state::bebox_timer0_w) READ8_MEMBER(bebox_state::bebox_flash_r ) { - fujitsu_29f016a_device *flash = space.machine().device<fujitsu_29f016a_device>("flash"); offset = (offset & ~7) | (7 - (offset & 7)); - return flash->read(offset); + return m_flash->read(offset); } WRITE8_MEMBER(bebox_state::bebox_flash_w ) { - fujitsu_29f016a_device *flash = space.machine().device<fujitsu_29f016a_device>("flash"); offset = (offset & ~7) | (7 - (offset & 7)); - flash->write(offset, data); + m_flash->write(offset, data); } /************************************* @@ -779,7 +770,7 @@ void bebox_state::machine_reset() m_ppc1->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); m_ppc2->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); - memcpy(machine().device<fujitsu_29f016a_device>("flash")->space().get_read_ptr(0),memregion("user1")->base(),0x200000); + memcpy(m_flash->space().get_read_ptr(0),memregion("user1")->base(),0x200000); } void bebox_state::machine_start() diff --git a/src/mess/machine/coco.c b/src/mess/machine/coco.c index e281197b37c..d28fa1b3412 100644 --- a/src/mess/machine/coco.c +++ b/src/mess/machine/coco.c @@ -1179,7 +1179,7 @@ WRITE8_MEMBER( coco_state::ff60_write ) READ8_MEMBER( coco_state::ff40_read ) { - if (offset >= 1 && offset <= 2 && m_beckerportconfig->read_safe(0) == 1) + if (offset >= 1 && offset <= 2 && m_beckerportconfig && m_beckerportconfig->read() == 1) { return m_beckerport->read(space, offset-1, mem_mask); } @@ -1195,7 +1195,7 @@ READ8_MEMBER( coco_state::ff40_read ) WRITE8_MEMBER( coco_state::ff40_write ) { - if (offset >= 1 && offset <= 2 && m_beckerportconfig->read_safe(0) == 1) + if (offset >= 1 && offset <= 2 && m_beckerportconfig && m_beckerportconfig->read() == 1) { return m_beckerport->write(space, offset-1, data, mem_mask); } diff --git a/src/mess/machine/coleco.c b/src/mess/machine/coleco.c index 82deef9aa8e..e95e6786903 100644 --- a/src/mess/machine/coleco.c +++ b/src/mess/machine/coleco.c @@ -3,98 +3,6 @@ #include "emu.h" #include "machine/coleco.h" -UINT8 coleco_scan_paddles(running_machine &machine, UINT8 *joy_status0, UINT8 *joy_status1) -{ - UINT8 ctrl_sel = machine.root_device().ioport("CTRLSEL")->read_safe(0); - - /* which controller shall we read? */ - if ((ctrl_sel & 0x07) == 0x02) // Super Action Controller P1 - *joy_status0 = machine.root_device().ioport("SAC_SLIDE1")->read_safe(0); - else if ((ctrl_sel & 0x07) == 0x03) // Driving Controller P1 - *joy_status0 = machine.root_device().ioport("DRIV_WHEEL1")->read_safe(0); - - if ((ctrl_sel & 0x70) == 0x20) // Super Action Controller P2 - *joy_status1 = machine.root_device().ioport("SAC_SLIDE2")->read_safe(0); - else if ((ctrl_sel & 0x70) == 0x30) // Driving Controller P2 - *joy_status1 = machine.root_device().ioport("DRIV_WHEEL2")->read_safe(0); - - /* In principle, even if not supported by any game, I guess we could have two Super - Action Controllers plugged into the Roller controller ports. Since I found no info - about the behavior of sliders in such a configuration, we overwrite SAC sliders with - the Roller trackball inputs and actually use the latter ones, when both are selected. */ - if (ctrl_sel & 0x80) // Roller controller - { - *joy_status0 = machine.root_device().ioport("ROLLER_X")->read_safe(0); - *joy_status1 = machine.root_device().ioport("ROLLER_Y")->read_safe(0); - } - - return *joy_status0 | *joy_status1; -} - - -UINT8 coleco_paddle_read(running_machine &machine, int port, int joy_mode, UINT8 joy_status) -{ - UINT8 ctrl_sel = machine.root_device().ioport("CTRLSEL")->read_safe(0); - UINT8 ctrl_extra = ctrl_sel & 0x80; - ctrl_sel = ctrl_sel >> (port*4) & 7; - - /* Keypad and fire 1 (SAC Yellow Button) */ - if (joy_mode == 0) - { - /* No key pressed by default */ - UINT8 data = 0x0f; - UINT16 ipt = 0xffff; - - if (ctrl_sel == 0) // ColecoVision Controller - ipt = machine.root_device().ioport(port ? "STD_KEYPAD2" : "STD_KEYPAD1")->read(); - else if (ctrl_sel == 2) // Super Action Controller - ipt = machine.root_device().ioport(port ? "SAC_KEYPAD2" : "SAC_KEYPAD1")->read(); - - /* Numeric pad buttons are not independent on a real ColecoVision, if you push more - than one, a real ColecoVision think that it is a third button, so we are going to emulate - the right behaviour */ - /* Super Action Controller additional buttons are read in the same way */ - if (!(ipt & 0x0001)) data &= 0x0a; /* 0 */ - if (!(ipt & 0x0002)) data &= 0x0d; /* 1 */ - if (!(ipt & 0x0004)) data &= 0x07; /* 2 */ - if (!(ipt & 0x0008)) data &= 0x0c; /* 3 */ - if (!(ipt & 0x0010)) data &= 0x02; /* 4 */ - if (!(ipt & 0x0020)) data &= 0x03; /* 5 */ - if (!(ipt & 0x0040)) data &= 0x0e; /* 6 */ - if (!(ipt & 0x0080)) data &= 0x05; /* 7 */ - if (!(ipt & 0x0100)) data &= 0x01; /* 8 */ - if (!(ipt & 0x0200)) data &= 0x0b; /* 9 */ - if (!(ipt & 0x0400)) data &= 0x06; /* # */ - if (!(ipt & 0x0800)) data &= 0x09; /* * */ - if (!(ipt & 0x1000)) data &= 0x04; /* Blue Action Button */ - if (!(ipt & 0x2000)) data &= 0x08; /* Purple Action Button */ - - return ((ipt & 0x4000) >> 8) | 0x30 | data; - } - /* Joystick and fire 2 (SAC Red Button) */ - else - { - UINT8 data = 0x7f; - - if (ctrl_sel == 0) // ColecoVision Controller - data = machine.root_device().ioport(port ? "STD_JOY2" : "STD_JOY1")->read(); - else if (ctrl_sel == 2) // Super Action Controller - data = machine.root_device().ioport(port ? "SAC_JOY2" : "SAC_JOY1")->read(); - else if (ctrl_sel == 3) // Driving Controller - data = machine.root_device().ioport(port ? "DRIV_PEDAL2" : "DRIV_PEDAL1")->read(); - - /* If any extra analog contoller enabled */ - if (ctrl_extra || ctrl_sel == 2 || ctrl_sel == 3) - { - if (joy_status & 0x80) data ^= 0x30; - else if (joy_status) data ^= 0x10; - } - - return data & 0x7f; - } -} - - // ColecoVision Controller static INPUT_PORTS_START( ctrl1 ) PORT_START("STD_KEYPAD1") diff --git a/src/mess/machine/coleco.h b/src/mess/machine/coleco.h index b7874b9c576..b6022b164c9 100644 --- a/src/mess/machine/coleco.h +++ b/src/mess/machine/coleco.h @@ -5,9 +5,6 @@ #ifndef __COLECO_CONTROLLERS__ #define __COLECO_CONTROLLERS__ -UINT8 coleco_scan_paddles(running_machine &machine, UINT8 *joy_status0, UINT8 *joy_status1); -UINT8 coleco_paddle_read(running_machine &machine, int port, int joy_mode, UINT8 joy_status); - INPUT_PORTS_EXTERN( coleco ); #endif diff --git a/src/mess/machine/cybiko.c b/src/mess/machine/cybiko.c index be0991bf4fe..6da702b34c3 100644 --- a/src/mess/machine/cybiko.c +++ b/src/mess/machine/cybiko.c @@ -191,12 +191,11 @@ WRITE16_MEMBER( cybiko_state::cybiko_lcd_w ) int cybiko_state::cybiko_key_r( offs_t offset, int mem_mask) { - static const char *const keynames[] = { "A1", "A2", "A3", "A4", "A5", "A6", "A7", "A8", "A9", "A10", "A11", "A12", "A13", "A14", "A15" }; UINT16 data = 0xFFFF; for (UINT8 i = 0; i < 15; i++) { - if (!BIT(offset, i)) - data &= ~ioport(keynames[i])->read_safe(0); + if (m_input[i] && !BIT(offset, i)) + data &= ~m_input[i]->read(); } if (data != 0xFFFF) { diff --git a/src/mess/machine/mbee.c b/src/mess/machine/mbee.c index 904849a1c78..e2f6b08a94a 100644 --- a/src/mess/machine/mbee.c +++ b/src/mess/machine/mbee.c @@ -716,18 +716,17 @@ QUICKLOAD_LOAD_MEMBER( mbee_state, mbee_z80bin ) { UINT16 execute_address, start_addr, end_addr; int autorun; + address_space &space = m_maincpu->space(AS_PROGRAM); /* load the binary into memory */ - if (z80bin_load_file(&image, file_type, &execute_address, &start_addr, &end_addr) == IMAGE_INIT_FAIL) + if (z80bin_load_file(&image, space, file_type, &execute_address, &start_addr, &end_addr) == IMAGE_INIT_FAIL) return IMAGE_INIT_FAIL; /* is this file executable? */ if (execute_address != 0xffff) { /* check to see if autorun is on */ - autorun = m_io_config->read_safe(0xFF) & 1; - - address_space &space = m_maincpu->space(AS_PROGRAM); + autorun = m_io_config->read() & 1; space.write_word(0xa6, execute_address); /* fix the EXEC command */ diff --git a/src/mess/machine/mboard.c b/src/mess/machine/mboard.c index 01aa1a988d5..1ea5963a3ab 100644 --- a/src/mess/machine/mboard.c +++ b/src/mess/machine/mboard.c @@ -318,7 +318,6 @@ void mboard_state::check_board_buttons() int i; UINT8 port_input=0; UINT8 data = 0xff; - static const char *const keynames[] = { "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7", "LINE8", "LINE9" }; static UINT8 board_row = 0; static UINT16 mouse_down = 0; UINT8 pos2num_res = 0; @@ -329,14 +328,14 @@ void mboard_state::check_board_buttons() /* check click on border pieces */ i=0; - port_input=ioport("B_BLACK")->read(); + port_input = m_b_black->read(); if (port_input) { i=get_first_bit(port_input)+6; click_on_border_piece=TRUE; } - port_input=ioport("B_WHITE")->read(); + port_input = m_b_white->read(); if (port_input) { i=get_first_bit(port_input); @@ -373,7 +372,7 @@ void mboard_state::check_board_buttons() /* check click on board */ - data = ioport(keynames[board_row])->read_safe(0xff); + data = m_line[board_row]->read(); if ((data != 0xff) && (!mouse_down) ) { @@ -419,7 +418,7 @@ void mboard_state::check_board_buttons() mouse_down = 0; /* check click on border - remove selected piece*/ - if (ioport("LINE10")->read_safe(0x01)) + if (m_line10->read()) { if (mouse_hold_piece) { @@ -439,7 +438,7 @@ void mboard_state::check_board_buttons() /* check additional buttons */ if (data == 0xff) { - port_input=ioport("B_BUTTONS")->read(); + port_input = m_b_buttons->read(); if (port_input==0x01) { clear_board(); @@ -457,7 +456,7 @@ void mboard_state::check_board_buttons() extern INPUT_PORTS_START( chessboard ) - PORT_START("LINE2") + PORT_START("LINE.0") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) @@ -466,7 +465,7 @@ extern INPUT_PORTS_START( chessboard ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_START("LINE3") + PORT_START("LINE.1") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) @@ -475,7 +474,7 @@ extern INPUT_PORTS_START( chessboard ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_START("LINE4") + PORT_START("LINE.2") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) @@ -484,7 +483,7 @@ extern INPUT_PORTS_START( chessboard ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_START("LINE5") + PORT_START("LINE.3") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) @@ -493,7 +492,7 @@ extern INPUT_PORTS_START( chessboard ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_START("LINE6") + PORT_START("LINE.4") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) @@ -502,7 +501,7 @@ extern INPUT_PORTS_START( chessboard ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_START("LINE7") + PORT_START("LINE.5") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) @@ -511,7 +510,7 @@ extern INPUT_PORTS_START( chessboard ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_START("LINE8") + PORT_START("LINE.6") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) @@ -520,7 +519,7 @@ extern INPUT_PORTS_START( chessboard ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) - PORT_START("LINE9") + PORT_START("LINE.7") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) diff --git a/src/mess/machine/mega32x.c b/src/mess/machine/mega32x.c index be3c572b53d..8c60160097d 100644 --- a/src/mess/machine/mega32x.c +++ b/src/mess/machine/mega32x.c @@ -958,9 +958,9 @@ UINT16 sega_32x_device::get_hposition(void) time_elapsed_since_megadriv_scanline_timer = machine().device<timer_device>(":md_scan_timer")->time_elapsed(); - if (time_elapsed_since_megadriv_scanline_timer.attoseconds<(ATTOSECONDS_PER_SECOND/m_framerate /m_total_scanlines)) + if (time_elapsed_since_megadriv_scanline_timer.attoseconds() < (ATTOSECONDS_PER_SECOND/m_framerate /m_total_scanlines)) { - value4 = (UINT16)(MAX_HPOSITION*((double)(time_elapsed_since_megadriv_scanline_timer.attoseconds) / (double)(ATTOSECONDS_PER_SECOND/m_framerate /m_total_scanlines))); + value4 = (UINT16)(MAX_HPOSITION*((double)(time_elapsed_since_megadriv_scanline_timer.attoseconds()) / (double)(ATTOSECONDS_PER_SECOND/m_framerate /m_total_scanlines))); } else /* in some cases (probably due to rounding errors) we get some stupid results (the odd huge value where the time elapsed is much higher than the scanline time??!).. hopefully by clamping the result to the maximum we limit errors */ { diff --git a/src/mess/machine/orao.c b/src/mess/machine/orao.c index 79365fb0f09..681b9a415eb 100644 --- a/src/mess/machine/orao.c +++ b/src/mess/machine/orao.c @@ -36,26 +36,26 @@ READ8_MEMBER(orao_state::orao_io_r) switch(offset) { /* Keyboard*/ - case 0x07FC : return ioport("LINE0")->read(); - case 0x07FD : return ioport("LINE1")->read(); - case 0x07FA : return ioport("LINE2")->read(); - case 0x07FB : return ioport("LINE3")->read(); - case 0x07F6 : return ioport("LINE4")->read(); - case 0x07F7 : return ioport("LINE5")->read(); - case 0x07EE : return ioport("LINE6")->read(); - case 0x07EF : return ioport("LINE7")->read(); - case 0x07DE : return ioport("LINE8")->read(); - case 0x07DF : return ioport("LINE9")->read(); - case 0x07BE : return ioport("LINE10")->read(); - case 0x07BF : return ioport("LINE11")->read(); - case 0x077E : return ioport("LINE12")->read(); - case 0x077F : return ioport("LINE13")->read(); - case 0x06FE : return ioport("LINE14")->read(); - case 0x06FF : return ioport("LINE15")->read(); - case 0x05FE : return ioport("LINE16")->read(); - case 0x05FF : return ioport("LINE17")->read(); - case 0x03FE : return ioport("LINE18")->read(); - case 0x03FF : return ioport("LINE19")->read(); + case 0x07FC : return m_line[0]->read(); + case 0x07FD : return m_line[1]->read(); + case 0x07FA : return m_line[2]->read(); + case 0x07FB : return m_line[3]->read(); + case 0x07F6 : return m_line[4]->read(); + case 0x07F7 : return m_line[5]->read(); + case 0x07EE : return m_line[6]->read(); + case 0x07EF : return m_line[7]->read(); + case 0x07DE : return m_line[8]->read(); + case 0x07DF : return m_line[9]->read(); + case 0x07BE : return m_line[10]->read(); + case 0x07BF : return m_line[11]->read(); + case 0x077E : return m_line[12]->read(); + case 0x077F : return m_line[13]->read(); + case 0x06FE : return m_line[14]->read(); + case 0x06FF : return m_line[15]->read(); + case 0x05FE : return m_line[16]->read(); + case 0x05FF : return m_line[17]->read(); + case 0x03FE : return m_line[18]->read(); + case 0x03FF : return m_line[19]->read(); /* Tape */ case 0x07FF : level = m_cassette->input(); diff --git a/src/mess/machine/orion.c b/src/mess/machine/orion.c index f52a33ccf73..4556778597b 100644 --- a/src/mess/machine/orion.c +++ b/src/mess/machine/orion.c @@ -69,7 +69,7 @@ WRITE8_MEMBER(orion_state::orion128_romdisk_w) void orion_state::orion_set_video_mode(int width) { rectangle visarea(0, width-1, 0, 255); - machine().first_screen()->configure(width, 256, visarea, machine().first_screen()->frame_period().attoseconds); + machine().first_screen()->configure(width, 256, visarea, machine().first_screen()->frame_period().attoseconds()); } WRITE8_MEMBER(orion_state::orion128_video_mode_w) diff --git a/src/mess/machine/pce.c b/src/mess/machine/pce.c index ede842ad8a8..6aeba853933 100644 --- a/src/mess/machine/pce.c +++ b/src/mess/machine/pce.c @@ -115,7 +115,7 @@ MACHINE_RESET_MEMBER(pce_state,mess_pce) /* Note: Arcade Card BIOS contents are the same as System 3, only internal HW differs. We use a category to select between modes (some games can be run in either S-CD or A-CD modes) */ - m_acard = ioport("A_CARD")->read() & 1; + m_acard = m_a_card->read() & 1; if (m_cartslot->get_type() == PCE_CDSYS3J) { @@ -134,7 +134,7 @@ MACHINE_RESET_MEMBER(pce_state,mess_pce) WRITE8_MEMBER(pce_state::mess_pce_joystick_w) { int joy_i; - UINT8 joy_type = ioport("JOY_TYPE")->read(); + UINT8 joy_type = m_joy_type->read(); m_maincpu->io_set_buffer(data); @@ -162,13 +162,7 @@ WRITE8_MEMBER(pce_state::mess_pce_joystick_w) READ8_MEMBER(pce_state::mess_pce_joystick_r) { - static const char *const joyname[4][5] = { - { "JOY_P1", "JOY_P2", "JOY_P3", "JOY_P4", "JOY_P5" }, - { }, - { "JOY6B_P1", "JOY6B_P2", "JOY6B_P3", "JOY6B_P4", "JOY6B_P5" }, - { } - }; - UINT8 joy_type = ioport("JOY_TYPE")->read(); + UINT8 joy_type = m_joy_type->read(); UINT8 ret, data; if (m_joystick_port_select <= 4) @@ -176,7 +170,7 @@ READ8_MEMBER(pce_state::mess_pce_joystick_r) switch ((joy_type >> (m_joystick_port_select*2)) & 3) { case 0: //2-buttons pad - data = ioport(joyname[0][m_joystick_port_select])->read(); + data = m_joy[m_joystick_port_select]->read(); break; case 2: //6-buttons pad /* @@ -186,7 +180,7 @@ READ8_MEMBER(pce_state::mess_pce_joystick_r) Note that six buttons pad just doesn't work with (almost?) every single 2-button-only games, it's really just an after-thought and it is like this on real HW. */ - data = ioport(joyname[2][m_joystick_port_select])->read() >> (m_joy_6b_packet[m_joystick_port_select]*8); + data = m_joy6b[m_joystick_port_select]->read() >> (m_joy_6b_packet[m_joystick_port_select]*8); break; default: data = 0xff; diff --git a/src/mess/machine/pce_cd.c b/src/mess/machine/pce_cd.c index 7434046fc04..d9b9e5441ea 100644 --- a/src/mess/machine/pce_cd.c +++ b/src/mess/machine/pce_cd.c @@ -80,6 +80,7 @@ const device_type PCE_CD = &device_creator<pce_cd_device>; pce_cd_device::pce_cd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, PCE_CD, "PCE CD Add-on", tag, owner, clock, "pcecd", __FILE__), + m_maincpu(*this, ":maincpu"), m_msm(*this, "msm5205"), m_cdda(*this, "cdda"), m_nvram(*this, "bram"), @@ -930,11 +931,11 @@ void pce_cd_device::set_irq_line(int num, int state) if (m_regs[0x02] & m_regs[0x03] & 0x7c) { //printf("IRQ PEND = %02x MASK = %02x IRQ ENABLE %02X\n",m_regs[0x02] & m_regs[0x03] & 0x7c,m_regs[0x02] & 0x7c,m_regs[0x03] & 0x7c); - machine().device<cpu_device>("maincpu")->set_input_line(1, ASSERT_LINE); + m_maincpu->set_input_line(1, ASSERT_LINE); } else { - machine().device<cpu_device>("maincpu")->set_input_line(1, CLEAR_LINE); + m_maincpu->set_input_line(1, CLEAR_LINE); } } @@ -1267,7 +1268,7 @@ UINT8 pce_cd_device::get_cd_data_byte() if (m_scsi_IO) { m_scsi_ACK = 1; - machine().scheduler().timer_set(machine().device<cpu_device>("maincpu")->cycles_to_attotime(15), timer_expired_delegate(FUNC(pce_cd_device::clear_ack),this)); + machine().scheduler().timer_set(m_maincpu->cycles_to_attotime(15), timer_expired_delegate(FUNC(pce_cd_device::clear_ack),this)); } } return data; diff --git a/src/mess/machine/pce_cd.h b/src/mess/machine/pce_cd.h index d5c2d9e924e..d50bbe27153 100644 --- a/src/mess/machine/pce_cd.h +++ b/src/mess/machine/pce_cd.h @@ -93,6 +93,8 @@ private: TIMER_CALLBACK_MEMBER(clear_ack); TIMER_CALLBACK_MEMBER(adpcm_dma_timer_callback); + required_device<cpu_device> m_maincpu; + UINT8 m_regs[16]; UINT8 *m_bram; UINT8 *m_adpcm_ram; diff --git a/src/mess/machine/rmnimbus.c b/src/mess/machine/rmnimbus.c index 2670e1968c9..b8b2d79218b 100644 --- a/src/mess/machine/rmnimbus.c +++ b/src/mess/machine/rmnimbus.c @@ -1546,9 +1546,9 @@ void rmnimbus_state::device_timer(emu_timer &timer, device_timer_id id, int para int xint; int yint; - m_nimbus_mouse.m_reg0a4 = ioport(MOUSE_BUTTON_TAG)->read() | 0xC0; - x = ioport(MOUSEX_TAG)->read(); - y = ioport(MOUSEY_TAG)->read(); + m_nimbus_mouse.m_reg0a4 = m_io_mouse_button->read() | 0xC0; + x = m_io_mousex->read(); + y = m_io_mousey->read(); UINT8 mxa; UINT8 mxb; @@ -1683,14 +1683,14 @@ READ8_MEMBER(rmnimbus_state::nimbus_mouse_js_r) UINT8 result; //int pc=m_maincpu->_pc(); - if (ioport("config")->read() & 0x01) + if (m_io_config->read() & 0x01) { result=m_nimbus_mouse.m_reg0a4; //logerror("mouse_js_r: pc=%05X, result=%02X\n",pc,result); } else { - result=ioport(JOYSTICK0_TAG)->read_safe(0xff); + result = m_io_joystick0->read(); } return result; diff --git a/src/mess/machine/samcoupe.c b/src/mess/machine/samcoupe.c index f8d943f34ff..682d81d906c 100644 --- a/src/mess/machine/samcoupe.c +++ b/src/mess/machine/samcoupe.c @@ -8,8 +8,6 @@ #include "emu.h" #include "includes/samcoupe.h" -#include "machine/msm6242.h" -#include "machine/ram.h" /*************************************************************************** CONSTANTS @@ -136,7 +134,7 @@ void samcoupe_state::samcoupe_install_ext_mem(address_space &space) void samcoupe_state::samcoupe_update_memory(address_space &space) { const int PAGE_MASK = ((m_ram->size() & 0xfffff) / 0x4000) - 1; - UINT8 *rom = memregion("maincpu")->base(); + UINT8 *rom = m_region_maincpu->base(); UINT8 *memory; int is_readonly; @@ -228,16 +226,14 @@ WRITE8_MEMBER(samcoupe_state::samcoupe_ext_mem_w) READ8_MEMBER(samcoupe_state::samcoupe_rtc_r) { address_space &spaceio = m_maincpu->space(AS_IO); - msm6242_device *rtc = dynamic_cast<msm6242_device*>(machine().device("sambus_clock")); - return rtc->read(spaceio,offset >> 12); + return m_rtc->read(spaceio, offset >> 12); } WRITE8_MEMBER(samcoupe_state::samcoupe_rtc_w) { address_space &spaceio = m_maincpu->space(AS_IO); - msm6242_device *rtc = dynamic_cast<msm6242_device*>(machine().device("sambus_clock")); - rtc->write(spaceio,offset >> 12, data); + m_rtc->write(spaceio, offset >> 12, data); } @@ -261,8 +257,8 @@ UINT8 samcoupe_state::samcoupe_mouse_r() if (m_mouse_index == 2) { /* update values */ - int mouse_x = ioport("mouse_x")->read(); - int mouse_y = ioport("mouse_y")->read(); + int mouse_x = m_io_mouse_x->read(); + int mouse_y = m_io_mouse_y->read(); int mouse_dx = m_mouse_x - mouse_x; int mouse_dy = m_mouse_y - mouse_y; @@ -271,7 +267,7 @@ UINT8 samcoupe_state::samcoupe_mouse_r() m_mouse_y = mouse_y; /* button state */ - m_mouse_data[2] = ioport("mouse_buttons")->read(); + m_mouse_data[2] = m_mouse_buttons->read(); /* y-axis */ m_mouse_data[3] = (mouse_dy & 0xf00) >> 8; @@ -324,7 +320,7 @@ void samcoupe_state::machine_reset() m_mouse_data[0] = 0xff; m_mouse_data[1] = 0xff; - if (ioport("config")->read() & 0x01) + if (m_config->read() & 0x01) { /* install RTC */ spaceio.install_readwrite_handler(0xef, 0xef, 0xffff, 0xff00, read8_delegate(FUNC(samcoupe_state::samcoupe_rtc_r),this), write8_delegate(FUNC(samcoupe_state::samcoupe_rtc_w),this)); diff --git a/src/mess/machine/sorcerer.c b/src/mess/machine/sorcerer.c index ea3d70dfbc5..25fb66015e3 100644 --- a/src/mess/machine/sorcerer.c +++ b/src/mess/machine/sorcerer.c @@ -284,15 +284,12 @@ READ8_MEMBER(sorcerer_state::sorcerer_fe_r) - tied high, allowing PARIN and PAROUT bios routines to run */ UINT8 data = 0xc0; - char kbdrow[6]; - - sprintf(kbdrow,"X%X",m_keyboard_line); /* bit 5 - vsync */ data |= m_iop_vs->read(); /* bits 4..0 - keyboard data */ - data |= ioport(kbdrow)->read(); + data |= m_iop_x[m_keyboard_line]->read(); return data; } @@ -435,17 +432,17 @@ QUICKLOAD_LOAD_MEMBER( sorcerer_state, sorcerer ) { UINT16 execute_address, start_address, end_address; int autorun; + address_space &space = m_maincpu->space(AS_PROGRAM); + /* load the binary into memory */ - if (z80bin_load_file(&image, file_type, &execute_address, &start_address, &end_address) == IMAGE_INIT_FAIL) + if (z80bin_load_file(&image, space, file_type, &execute_address, &start_address, &end_address) == IMAGE_INIT_FAIL) return IMAGE_INIT_FAIL; /* is this file executable? */ if (execute_address != 0xffff) { /* check to see if autorun is on (I hate how this works) */ - autorun = ioport("CONFIG")->read_safe(0xFF) & 1; - - address_space &space = m_maincpu->space(AS_PROGRAM); + autorun = m_iop_config->read() & 1; if ((execute_address >= 0xc000) && (execute_address <= 0xdfff) && (space.read_byte(0xdffa) != 0xc3)) return IMAGE_INIT_FAIL; /* can't run a program if the cartridge isn't in */ diff --git a/src/mess/machine/spec_snqk.c b/src/mess/machine/spec_snqk.c index 5a2bbcc8917..2bdbd725683 100644 --- a/src/mess/machine/spec_snqk.c +++ b/src/mess/machine/spec_snqk.c @@ -36,7 +36,7 @@ #define LOAD_REG(_cpu, _reg, _data) \ do { \ - _cpu->state().set_state_int(_reg, (_data)); \ + _cpu->set_state_int(_reg, (_data)); \ } while (0) #define EXEC_NA "N/A" @@ -315,8 +315,8 @@ void spectrum_setup_sp(running_machine &machine, UINT8 *snapdata, UINT32 snapsiz UINT8 intr; UINT16 start, size, data, status; spectrum_state *state = machine.driver_data<spectrum_state>(); - device_t *cpu = machine.device("maincpu"); - address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); + cpu_device *cpu = state->m_maincpu; + address_space &space = cpu->space(AS_PROGRAM); if (snapsize == SP_NEW_SIZE_16K || snapsize == SP_NEW_SIZE_48K) { @@ -401,8 +401,8 @@ void spectrum_setup_sp(running_machine &machine, UINT8 *snapdata, UINT32 snapsiz LOAD_REG(cpu, Z80_IFF2, data); intr = BIT(status, 4) ? ASSERT_LINE : CLEAR_LINE; - machine.device("maincpu")->execute().set_input_line(INPUT_LINE_IRQ0, intr); - machine.device("maincpu")->execute().set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + cpu->set_input_line(INPUT_LINE_IRQ0, intr); + cpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); data = BIT(status, 5); state->m_flash_invert = data; @@ -515,8 +515,8 @@ void spectrum_setup_sna(running_machine &machine, UINT8 *snapdata, UINT32 snapsi UINT8 intr; UINT16 data, addr; spectrum_state *state = machine.driver_data<spectrum_state>(); - device_t *cpu = machine.device("maincpu"); - address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); + cpu_device *cpu = state->m_maincpu; + address_space &space = cpu->space(AS_PROGRAM); if ((snapsize != SNA48_SIZE) && (state->m_port_7ffd_data == -1)) { @@ -579,8 +579,8 @@ void spectrum_setup_sna(running_machine &machine, UINT8 *snapdata, UINT32 snapsi LOAD_REG(cpu, Z80_IFF2, BIT(data, 2)); intr = BIT(data, 0) ? CLEAR_LINE : ASSERT_LINE; - machine.device("maincpu")->execute().set_input_line(INPUT_LINE_IRQ0, intr); - machine.device("maincpu")->execute().set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + cpu->set_input_line(INPUT_LINE_IRQ0, intr); + cpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); if (snapsize == SNA48_SIZE) /* 48K Snapshot */ @@ -605,7 +605,7 @@ void spectrum_setup_sna(running_machine &machine, UINT8 *snapdata, UINT32 snapsi space.write_byte(BASE_RAM + i, snapdata[SNA48_HDR + i]); /* Get PC from stack */ - addr = cpu->state().state_int(Z80_SP); + addr = cpu->state_int(Z80_SP); if (addr < BASE_RAM || addr > 4*SPECTRUM_BANK - 2) logerror("Corrupted SP out of range:%04X", addr); @@ -622,7 +622,7 @@ void spectrum_setup_sna(running_machine &machine, UINT8 *snapdata, UINT32 snapsi addr += 2; logerror("Fixing SP:%04X\n", addr); - cpu->state().set_state_int(Z80_SP, addr); + cpu->set_state_int(Z80_SP, addr); /* Set border color */ data = snapdata[SNA48_OFFSET + 26] & 0x07; @@ -734,8 +734,8 @@ void spectrum_setup_ach(running_machine &machine, UINT8 *snapdata, UINT32 snapsi UINT8 intr; UINT16 data; spectrum_state *state = machine.driver_data<spectrum_state>(); - device_t *cpu = machine.device("maincpu"); - address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); + cpu_device *cpu = state->m_maincpu; + address_space &space = cpu->space(AS_PROGRAM); data = (snapdata[ACH_OFFSET + 0] << 8) | snapdata[ACH_OFFSET + 4]; LOAD_REG(cpu, Z80_AF, data); @@ -792,8 +792,8 @@ void spectrum_setup_ach(running_machine &machine, UINT8 *snapdata, UINT32 snapsi LOAD_REG(cpu, Z80_IFF2, data); intr = snapdata[ACH_OFFSET + 191] ? CLEAR_LINE : ASSERT_LINE; - machine.device("maincpu")->execute().set_input_line(INPUT_LINE_IRQ0, intr); - machine.device("maincpu")->execute().set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + cpu->set_input_line(INPUT_LINE_IRQ0, intr); + cpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); logerror("Skipping the 16K ROM dump at offset:%04X\n", ACH_OFFSET + 256); @@ -867,8 +867,8 @@ void spectrum_setup_prg(running_machine &machine, UINT8 *snapdata, UINT32 snapsi UINT8 intr; UINT16 addr, data; spectrum_state *state = machine.driver_data<spectrum_state>(); - device_t *cpu = machine.device("maincpu"); - address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); + cpu_device *cpu = state->m_maincpu; + address_space &space = cpu->space(AS_PROGRAM); data = snapdata[PRG_OFFSET + 0]; if (data != 0x05) @@ -924,8 +924,8 @@ void spectrum_setup_prg(running_machine &machine, UINT8 *snapdata, UINT32 snapsi LOAD_REG(cpu, Z80_IFF2, BIT(data, 2)); intr = BIT(data, 2) ? CLEAR_LINE : ASSERT_LINE; - machine.device("maincpu")->execute().set_input_line(INPUT_LINE_IRQ0, intr); - machine.device("maincpu")->execute().set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + cpu->set_input_line(INPUT_LINE_IRQ0, intr); + cpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); data = space.read_byte(addr + 1); LOAD_REG(cpu, Z80_R, data); @@ -947,7 +947,7 @@ void spectrum_setup_prg(running_machine &machine, UINT8 *snapdata, UINT32 snapsi addr += 6; logerror("Fixing SP:%04X\n", addr); - cpu->state().set_state_int(Z80_SP, addr); + cpu->set_state_int(Z80_SP, addr); /* Set border color */ data = (space.read_byte(0x5c48) >> 3) & 0x07; // Get the current border color from BORDCR system variable. @@ -1037,8 +1037,8 @@ void spectrum_setup_plusd(running_machine &machine, UINT8 *snapdata, UINT32 snap UINT8 intr; UINT16 addr = 0, data; spectrum_state *state = machine.driver_data<spectrum_state>(); - device_t *cpu = machine.device("maincpu"); - address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); + cpu_device *cpu = state->m_maincpu; + address_space &space = cpu->space(AS_PROGRAM); data = (snapdata[PLUSD_OFFSET + 15] << 8) | snapdata[PLUSD_OFFSET + 14]; LOAD_REG(cpu, Z80_BC, data); @@ -1126,8 +1126,8 @@ void spectrum_setup_plusd(running_machine &machine, UINT8 *snapdata, UINT32 snap LOAD_REG(cpu, Z80_IFF2, BIT(data, 2)); intr = BIT(data, 2) ? CLEAR_LINE : ASSERT_LINE; - machine.device("maincpu")->execute().set_input_line(INPUT_LINE_IRQ0, intr); - machine.device("maincpu")->execute().set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + cpu->set_input_line(INPUT_LINE_IRQ0, intr); + cpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); data = space.read_byte(addr + 1); LOAD_REG(cpu, Z80_R, data); @@ -1149,7 +1149,7 @@ void spectrum_setup_plusd(running_machine &machine, UINT8 *snapdata, UINT32 snap addr += 6; logerror("Fixing SP:%04X\n", addr); - cpu->state().set_state_int(Z80_SP, addr); + cpu->set_state_int(Z80_SP, addr); /* Set border color */ data = (space.read_byte(0x5c48) >> 3) & 0x07; // Get the current border color from BORDCR system variable. @@ -1205,8 +1205,8 @@ void spectrum_setup_sem(running_machine &machine, UINT8 *snapdata, UINT32 snapsi UINT8 intr; UINT16 data; spectrum_state *state = machine.driver_data<spectrum_state>(); - device_t *cpu = machine.device("maincpu"); - address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); + cpu_device *cpu = state->m_maincpu; + address_space &space = cpu->space(AS_PROGRAM); data = (snapdata[SEM_OFFSET + 1] << 8) | snapdata[SEM_OFFSET + 0]; LOAD_REG(cpu, Z80_AF, data); @@ -1263,8 +1263,8 @@ void spectrum_setup_sem(running_machine &machine, UINT8 *snapdata, UINT32 snapsi LOAD_REG(cpu, Z80_IFF2, BIT(data, 0)); intr = BIT(snapdata[SEM_OFFSET + 30], 0) ? CLEAR_LINE : ASSERT_LINE; - machine.device("maincpu")->execute().set_input_line(INPUT_LINE_IRQ0, intr); - machine.device("maincpu")->execute().set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + cpu->set_input_line(INPUT_LINE_IRQ0, intr); + cpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); /* Memory dump */ logerror("Loading %04X bytes of RAM at %04X\n", 3*SPECTRUM_BANK, BASE_RAM); @@ -1324,8 +1324,8 @@ void spectrum_setup_sit(running_machine &machine, UINT8 *snapdata, UINT32 snapsi UINT8 intr; UINT16 data; spectrum_state *state = machine.driver_data<spectrum_state>(); - device_t *cpu = machine.device("maincpu"); - address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); + cpu_device *cpu = state->m_maincpu; + address_space &space = cpu->space(AS_PROGRAM); data = (snapdata[SIT_OFFSET + 7] << 8) | snapdata[SIT_OFFSET + 6]; LOAD_REG(cpu, Z80_AF, data); @@ -1381,8 +1381,8 @@ void spectrum_setup_sit(running_machine &machine, UINT8 *snapdata, UINT32 snapsi LOAD_REG(cpu, Z80_IFF2, data); intr = data ? CLEAR_LINE : ASSERT_LINE; - machine.device("maincpu")->execute().set_input_line(INPUT_LINE_IRQ0, intr); - machine.device("maincpu")->execute().set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + cpu->set_input_line(INPUT_LINE_IRQ0, intr); + cpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); /* Memory dump */ logerror("Skipping the 16K ROM dump at offset:%04X\n", SIT_OFFSET + 28); @@ -1454,8 +1454,8 @@ void spectrum_setup_zx(running_machine &machine, UINT8 *snapdata, UINT32 snapsiz UINT8 intr; UINT16 data, mode; spectrum_state *state = machine.driver_data<spectrum_state>(); - device_t *cpu = machine.device("maincpu"); - address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); + cpu_device *cpu = state->m_maincpu; + address_space &space = cpu->space(AS_PROGRAM); logerror("Skipping last 132 bytes of the 16K ROM dump at offset:0000\n"); @@ -1526,8 +1526,8 @@ void spectrum_setup_zx(running_machine &machine, UINT8 *snapdata, UINT32 snapsiz LOAD_REG(cpu, Z80_IFF2, data); intr = BIT(snapdata[ZX_OFFSET + 142], 0) ? CLEAR_LINE : ASSERT_LINE; - machine.device("maincpu")->execute().set_input_line(INPUT_LINE_IRQ0, intr); - machine.device("maincpu")->execute().set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + cpu->set_input_line(INPUT_LINE_IRQ0, intr); + cpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); /* Memory dump */ logerror("Loading %04X bytes of RAM at %04X\n", 3*SPECTRUM_BANK, BASE_RAM); @@ -1586,8 +1586,8 @@ void spectrum_setup_snp(running_machine &machine, UINT8 *snapdata, UINT32 snapsi UINT8 intr; UINT16 data; spectrum_state *state = machine.driver_data<spectrum_state>(); - device_t *cpu = machine.device("maincpu"); - address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); + cpu_device *cpu = state->m_maincpu; + address_space &space = cpu->space(AS_PROGRAM); data = (snapdata[SNP_OFFSET + 1] << 8) | snapdata[SNP_OFFSET + 0]; LOAD_REG(cpu, Z80_AF, data); @@ -1644,8 +1644,8 @@ void spectrum_setup_snp(running_machine &machine, UINT8 *snapdata, UINT32 snapsi LOAD_REG(cpu, Z80_IFF2, data); intr = BIT(snapdata[SNP_OFFSET + 19], 0) ? CLEAR_LINE : ASSERT_LINE; - machine.device("maincpu")->execute().set_input_line(INPUT_LINE_IRQ0, intr); - machine.device("maincpu")->execute().set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + cpu->set_input_line(INPUT_LINE_IRQ0, intr); + cpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); /* Memory dump */ logerror("Loading %04X bytes of RAM at %04X\n", 3*SPECTRUM_BANK, BASE_RAM); @@ -1760,11 +1760,10 @@ void spectrum_setup_snp(running_machine &machine, UINT8 *snapdata, UINT32 snapsi * length of the block. * *******************************************************************/ -static void spectrum_snx_decompress_block(running_machine &machine, UINT8 *source, UINT16 dest, UINT16 size) +static void spectrum_snx_decompress_block(address_space &space, UINT8 *source, UINT16 dest, UINT16 size) { UINT8 counthi, countlo, compress, fill; UINT16 block = 0, count, i, j, numbytes; - address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); i = SNX_HDR - 1; numbytes = 0; @@ -1813,8 +1812,8 @@ void spectrum_setup_snx(running_machine &machine, UINT8 *snapdata, UINT32 snapsi UINT8 intr; UINT16 data, addr; spectrum_state *state = machine.driver_data<spectrum_state>(); - device_t *cpu = machine.device("maincpu"); - address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); + cpu_device *cpu = state->m_maincpu; + address_space &space = cpu->space(AS_PROGRAM); data = (snapdata[SNX_OFFSET + 4] << 8) | snapdata[SNX_OFFSET + 5]; if (data != 0x25) @@ -1874,15 +1873,15 @@ void spectrum_setup_snx(running_machine &machine, UINT8 *snapdata, UINT32 snapsi LOAD_REG(cpu, Z80_IFF2, BIT(data, 2)); intr = BIT(data, 0) ? CLEAR_LINE : ASSERT_LINE; - machine.device("maincpu")->execute().set_input_line(INPUT_LINE_IRQ0, intr); - machine.device("maincpu")->execute().set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + cpu->set_input_line(INPUT_LINE_IRQ0, intr); + cpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); /* Memory dump */ logerror("Uncompressing %04X bytes of RAM at %04X\n", 3*SPECTRUM_BANK, BASE_RAM); - spectrum_snx_decompress_block(machine, snapdata, BASE_RAM, 3*SPECTRUM_BANK); + spectrum_snx_decompress_block(space, snapdata, BASE_RAM, 3*SPECTRUM_BANK); /* get pc from stack */ - addr = cpu->state().state_int(Z80_SP); + addr = cpu->state_int(Z80_SP); if (addr < BASE_RAM || addr > 4*SPECTRUM_BANK - 2) logerror("Corrupted SP out of range:%04X", addr); @@ -1898,7 +1897,7 @@ void spectrum_setup_snx(running_machine &machine, UINT8 *snapdata, UINT32 snapsi addr += 2; logerror("Fixed the stack at SP:%04X\n", addr); - cpu->state().set_state_int(Z80_SP, addr); + cpu->set_state_int(Z80_SP, addr); /* Set border color */ data = snapdata[SNX_OFFSET + 32] & 0x07; @@ -1967,8 +1966,8 @@ void spectrum_setup_frz(running_machine &machine, UINT8 *snapdata, UINT32 snapsi UINT8 intr; UINT16 addr, data; spectrum_state *state = machine.driver_data<spectrum_state>(); - device_t *cpu = machine.device("maincpu"); - address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); + cpu_device *cpu = state->m_maincpu; + address_space &space = cpu->space(AS_PROGRAM); if (state->m_port_7ffd_data == -1) { @@ -2031,8 +2030,8 @@ void spectrum_setup_frz(running_machine &machine, UINT8 *snapdata, UINT32 snapsi LOAD_REG(cpu, Z80_IFF2, BIT(data, 2)); intr = BIT(data, 2) ? CLEAR_LINE : ASSERT_LINE; - machine.device("maincpu")->execute().set_input_line(INPUT_LINE_IRQ0, intr); - machine.device("maincpu")->execute().set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + cpu->set_input_line(INPUT_LINE_IRQ0, intr); + cpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); /* Memory dump */ addr = 0; @@ -2075,11 +2074,10 @@ void spectrum_setup_frz(running_machine &machine, UINT8 *snapdata, UINT32 snapsi //logerror("Snapshot loaded.\nExecution resuming at bank:%d %s\n", state->m_port_7ffd_data & 0x07, cpu_get_reg_string(cpu, Z80_PC)); } -static void spectrum_z80_decompress_block(running_machine &machine,UINT8 *source, UINT16 dest, UINT16 size) +static void spectrum_z80_decompress_block(address_space &space, UINT8 *source, UINT16 dest, UINT16 size) { UINT8 ch; int i; - address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); do { @@ -2190,7 +2188,8 @@ void spectrum_setup_z80(running_machine &machine, UINT8 *snapdata, UINT32 snapsi int i; UINT8 lo, hi, data; SPECTRUM_Z80_SNAPSHOT_TYPE z80_type; - address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); + cpu_device *cpu = state->m_maincpu; + address_space &space = cpu->space(AS_PROGRAM); z80_type = spectrum_identify_z80(snapdata, snapsize); @@ -2231,27 +2230,27 @@ void spectrum_setup_z80(running_machine &machine, UINT8 *snapdata, UINT32 snapsi /* AF */ hi = snapdata[0] & 0x0ff; lo = snapdata[1] & 0x0ff; - machine.device("maincpu")->state().set_state_int(Z80_AF, (hi << 8) | lo); + cpu->set_state_int(Z80_AF, (hi << 8) | lo); /* BC */ lo = snapdata[2] & 0x0ff; hi = snapdata[3] & 0x0ff; - machine.device("maincpu")->state().set_state_int(Z80_BC, (hi << 8) | lo); + cpu->set_state_int(Z80_BC, (hi << 8) | lo); /* HL */ lo = snapdata[4] & 0x0ff; hi = snapdata[5] & 0x0ff; - machine.device("maincpu")->state().set_state_int(Z80_HL, (hi << 8) | lo); + cpu->set_state_int(Z80_HL, (hi << 8) | lo); /* SP */ lo = snapdata[8] & 0x0ff; hi = snapdata[9] & 0x0ff; - machine.device("maincpu")->state().set_state_int(Z80_SP, (hi << 8) | lo); + cpu->set_state_int(Z80_SP, (hi << 8) | lo); /* I */ - machine.device("maincpu")->state().set_state_int(Z80_I, (snapdata[10] & 0x0ff)); + cpu->set_state_int(Z80_I, (snapdata[10] & 0x0ff)); /* R */ data = (snapdata[11] & 0x07f) | ((snapdata[12] & 0x01) << 7); - machine.device("maincpu")->state().set_state_int(Z80_R, data); + cpu->set_state_int(Z80_R, data); /* Set border color */ state->m_port_fe_data = (state->m_port_fe_data & 0xf8) | ((snapdata[12] & 0x0e) >> 1); @@ -2259,47 +2258,47 @@ void spectrum_setup_z80(running_machine &machine, UINT8 *snapdata, UINT32 snapsi lo = snapdata[13] & 0x0ff; hi = snapdata[14] & 0x0ff; - machine.device("maincpu")->state().set_state_int(Z80_DE, (hi << 8) | lo); + cpu->set_state_int(Z80_DE, (hi << 8) | lo); lo = snapdata[15] & 0x0ff; hi = snapdata[16] & 0x0ff; - machine.device("maincpu")->state().set_state_int(Z80_BC2, (hi << 8) | lo); + cpu->set_state_int(Z80_BC2, (hi << 8) | lo); lo = snapdata[17] & 0x0ff; hi = snapdata[18] & 0x0ff; - machine.device("maincpu")->state().set_state_int(Z80_DE2, (hi << 8) | lo); + cpu->set_state_int(Z80_DE2, (hi << 8) | lo); lo = snapdata[19] & 0x0ff; hi = snapdata[20] & 0x0ff; - machine.device("maincpu")->state().set_state_int(Z80_HL2, (hi << 8) | lo); + cpu->set_state_int(Z80_HL2, (hi << 8) | lo); hi = snapdata[21] & 0x0ff; lo = snapdata[22] & 0x0ff; - machine.device("maincpu")->state().set_state_int(Z80_AF2, (hi << 8) | lo); + cpu->set_state_int(Z80_AF2, (hi << 8) | lo); lo = snapdata[23] & 0x0ff; hi = snapdata[24] & 0x0ff; - machine.device("maincpu")->state().set_state_int(Z80_IY, (hi << 8) | lo); + cpu->set_state_int(Z80_IY, (hi << 8) | lo); lo = snapdata[25] & 0x0ff; hi = snapdata[26] & 0x0ff; - machine.device("maincpu")->state().set_state_int(Z80_IX, (hi << 8) | lo); + cpu->set_state_int(Z80_IX, (hi << 8) | lo); /* Interrupt Flip/Flop */ if (snapdata[27] == 0) { - machine.device("maincpu")->state().set_state_int(Z80_IFF1, (UINT64)0); - /* machine.device("maincpu")->state().set_state_int(Z80_IRQ_STATE, 0); */ + cpu->set_state_int(Z80_IFF1, (UINT64)0); + /* cpu->set_state_int(Z80_IRQ_STATE, 0); */ } else { - machine.device("maincpu")->state().set_state_int(Z80_IFF1, 1); - /* machine.device("maincpu")->state().set_state_int(Z80_IRQ_STATE, 1); */ + cpu->set_state_int(Z80_IFF1, 1); + /* cpu->set_state_int(Z80_IRQ_STATE, 1); */ } - machine.device("maincpu")->execute().set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE); -// machine.device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, data); - machine.device("maincpu")->execute().set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + cpu->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE); +// cpu->set_input_line(INPUT_LINE_NMI, data); + cpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); /* IFF2 */ if (snapdata[28] != 0) @@ -2310,16 +2309,16 @@ void spectrum_setup_z80(running_machine &machine, UINT8 *snapdata, UINT32 snapsi { data = 0; } - machine.device("maincpu")->state().set_state_int(Z80_IFF2, data); + cpu->set_state_int(Z80_IFF2, data); /* Interrupt Mode */ - machine.device("maincpu")->state().set_state_int(Z80_IM, (snapdata[29] & 0x03)); + cpu->set_state_int(Z80_IM, (snapdata[29] & 0x03)); if (z80_type == SPECTRUM_Z80_SNAPSHOT_48K_OLD) { lo = snapdata[6] & 0x0ff; hi = snapdata[7] & 0x0ff; - machine.device("maincpu")->state().set_state_int(Z80_PC, (hi << 8) | lo); + cpu->set_state_int(Z80_PC, (hi << 8) | lo); spectrum_page_basicrom(machine); @@ -2332,7 +2331,7 @@ void spectrum_setup_z80(running_machine &machine, UINT8 *snapdata, UINT32 snapsi else { logerror("Compressed\n"); /* compressed */ - spectrum_z80_decompress_block(machine, snapdata + 30, 16384, 49152); + spectrum_z80_decompress_block(space, snapdata + 30, 16384, 49152); } } else @@ -2344,7 +2343,7 @@ void spectrum_setup_z80(running_machine &machine, UINT8 *snapdata, UINT32 snapsi lo = snapdata[32] & 0x0ff; hi = snapdata[33] & 0x0ff; - machine.device("maincpu")->state().set_state_int(Z80_PC, (hi << 8) | lo); + cpu->set_state_int(Z80_PC, (hi << 8) | lo); if ((z80_type == SPECTRUM_Z80_SNAPSHOT_128K) || ((z80_type == SPECTRUM_Z80_SNAPSHOT_TS2068) && !strcmp(machine.system().name,"ts2068"))) { @@ -2415,7 +2414,7 @@ void spectrum_setup_z80(running_machine &machine, UINT8 *snapdata, UINT32 snapsi logerror("Compressed\n"); /* block is compressed */ - spectrum_z80_decompress_block(machine,&pSource[3], Dest, 16384); + spectrum_z80_decompress_block(space, &pSource[3], Dest, 16384); } } @@ -2508,7 +2507,7 @@ error: void spectrum_setup_scr(running_machine &machine, UINT8 *quickdata, UINT32 quicksize) { int i; - address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine.driver_data<spectrum_state>()->m_maincpu->space(AS_PROGRAM); for (i = 0; i < quicksize; i++) space.write_byte(i + BASE_RAM, quickdata[i]); @@ -2548,7 +2547,7 @@ void spectrum_setup_raw(running_machine &machine, UINT8 *quickdata, UINT32 quick UINT8 data; UINT16 start, len; spectrum_state *state = machine.driver_data<spectrum_state>(); - address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = state->m_maincpu->space(AS_PROGRAM); start = (quickdata[RAW_OFFSET + 4] << 8) | quickdata[RAW_OFFSET + 3]; len = (quickdata[RAW_OFFSET + 2] << 8) | quickdata[RAW_OFFSET + 1]; diff --git a/src/mess/machine/super80.c b/src/mess/machine/super80.c index 8b1944f132f..b77c04b68fd 100644 --- a/src/mess/machine/super80.c +++ b/src/mess/machine/super80.c @@ -227,13 +227,13 @@ QUICKLOAD_LOAD_MEMBER( super80_state, super80 ) UINT16 exec_addr, start_addr, end_addr; /* load the binary into memory */ - if (z80bin_load_file(&image, file_type, &exec_addr, &start_addr, &end_addr) == IMAGE_INIT_FAIL) + if (z80bin_load_file(&image, m_maincpu->space(AS_PROGRAM), file_type, &exec_addr, &start_addr, &end_addr) == IMAGE_INIT_FAIL) return IMAGE_INIT_FAIL; /* is this file executable? */ if (exec_addr != 0xffff) /* check to see if autorun is on */ - if BIT(m_io_config->read_safe(0xFF), 0) + if BIT(m_io_config->read(), 0) m_maincpu->set_pc(exec_addr); return IMAGE_INIT_PASS; diff --git a/src/mess/machine/thomflop.c b/src/mess/machine/thomflop.c index bc84715d253..3927f7219af 100644 --- a/src/mess/machine/thomflop.c +++ b/src/mess/machine/thomflop.c @@ -1683,7 +1683,7 @@ READ8_MEMBER( thomson_state::to7_network_r ) if ( offset == 8 ) { /* network ID of the computer */ - UINT8 id = ioport("fconfig")->read() >> 3; + UINT8 id = m_io_fconfig->read() >> 3; VLOG(( "%f $%04x to7_network_r: read id $%02X\n", machine().time().as_double(), m_maincpu->pc(), id )); return id; } @@ -1727,7 +1727,7 @@ UINT8 to7_floppy_bank; void thomson_state::to7_floppy_init( void* base ) { - membank( THOM_FLOP_BANK )->configure_entries( 0, TO7_NB_FLOP_BANK, base, 0x800 ); + m_flopbank->configure_entries( 0, TO7_NB_FLOP_BANK, base, 0x800 ); save_item(NAME(to7_controller_type)); save_item(NAME(to7_floppy_bank)); to7_5p14sd_init(); @@ -1741,7 +1741,7 @@ void thomson_state::to7_floppy_init( void* base ) void thomson_state::to7_floppy_reset() { - to7_controller_type = (ioport("fconfig")->read() ) & 7; + to7_controller_type = (m_io_fconfig->read() ) & 7; switch ( to7_controller_type ) { @@ -1775,7 +1775,7 @@ void thomson_state::to7_floppy_reset() break; } - membank( THOM_FLOP_BANK )->set_entry( to7_floppy_bank ); + m_flopbank->set_entry( to7_floppy_bank ); } @@ -1821,7 +1821,7 @@ WRITE8_MEMBER( thomson_state::to7_floppy_w ) if ( offset == 8 ) { to7_floppy_bank = 3 + (data & 3); - membank( THOM_FLOP_BANK )->set_entry( to7_floppy_bank ); + m_flopbank->set_entry( to7_floppy_bank ); VLOG (( "to7_floppy_w: set CD 90-351 ROM bank to %i\n", data & 3 )); } else @@ -1851,7 +1851,7 @@ WRITE8_MEMBER( thomson_state::to7_floppy_w ) void thomson_state::to9_floppy_init( void* int_base, void* ext_base ) { to7_floppy_init( ext_base ); - membank( THOM_FLOP_BANK )->configure_entry( TO7_NB_FLOP_BANK, int_base); + m_flopbank->configure_entry( TO7_NB_FLOP_BANK, int_base); } @@ -1867,7 +1867,7 @@ void thomson_state::to9_floppy_reset() { LOG(( "to9_floppy_reset: internal controller\n" )); to7_5p14_reset(); - membank( THOM_FLOP_BANK )->set_entry( TO7_NB_FLOP_BANK ); + m_flopbank->set_entry( TO7_NB_FLOP_BANK ); } } diff --git a/src/mess/machine/thomson.c b/src/mess/machine/thomson.c index 471a29c2139..240b004141a 100644 --- a/src/mess/machine/thomson.c +++ b/src/mess/machine/thomson.c @@ -430,7 +430,7 @@ void thomson_state::to7_update_cart_bank() } if ( bank != m_old_cart_bank ) { - membank( THOM_CART_BANK )->set_entry( bank ); + m_cartbank->set_entry( bank ); m_old_cart_bank = bank; LOG_BANK(( "to7_update_cart_bank: CART is cartridge bank %i\n", bank )); } @@ -496,7 +496,7 @@ WRITE8_MEMBER( thomson_state::to7_timer_cp2_out ) READ8_MEMBER( thomson_state::to7_timer_port_in ) { - int lightpen = (ioport("lightpen_button")->read() & 1) ? 2 : 0; + int lightpen = (m_io_lightpen_button->read() & 1) ? 2 : 0; int cass = to7_get_cassette() ? 0x80 : 0; return lightpen | cass; } @@ -575,15 +575,11 @@ READ8_MEMBER( thomson_state::to7_sys_porta_in ) int keyline = m_pia_sys->b_output(); UINT8 val = 0xff; int i; - static const char *const keynames[] = { - "keyboard_0", "keyboard_1", "keyboard_2", "keyboard_3", - "keyboard_4", "keyboard_5", "keyboard_6", "keyboard_7" - }; for ( i = 0; i < 8; i++ ) { if ( ! (keyline & (1 << i)) ) - val &= ioport(keynames[i])->read(); + val &= m_io_keyboard[i]->read(); } return val; } @@ -782,7 +778,7 @@ READ8_MEMBER( thomson_state::to7_modem_mea8000_r ) return 0; } - if ( ioport("mconfig")->read() & 1 ) + if ( m_io_mconfig->read() & 1 ) { return m_mea8000->read(space, offset); } @@ -806,7 +802,7 @@ READ8_MEMBER( thomson_state::to7_modem_mea8000_r ) WRITE8_MEMBER( thomson_state::to7_modem_mea8000_w ) { - if ( ioport("mconfig")->read() & 1 ) + if ( m_io_mconfig->read() & 1 ) { m_mea8000->write(space, offset, data); } @@ -854,8 +850,8 @@ WRITE8_MEMBER( thomson_state::to7_modem_mea8000_w ) UINT8 thomson_state::to7_get_mouse_signal() { UINT8 xa, xb, ya, yb; - UINT16 dx = ioport("mouse_x")->read(); /* x axis */ - UINT16 dy = ioport("mouse_y")->read(); /* y axis */ + UINT16 dx = m_io_mouse_x->read(); /* x axis */ + UINT16 dy = m_io_mouse_y->read(); /* y axis */ xa = ((dx + 1) & 3) <= 1; xb = (dx & 3) <= 1; ya = ((dy + 1) & 3) <= 1; @@ -875,16 +871,16 @@ void thomson_state::to7_game_sound_update() READ8_MEMBER( thomson_state::to7_game_porta_in ) { UINT8 data; - if ( ioport("config")->read() & 1 ) + if ( m_io_config->read() & 1 ) { /* mouse */ data = to7_get_mouse_signal() & 0x0c; /* XB, YB */ - data |= ioport("mouse_button")->read() & 3; /* buttons */ + data |= m_io_mouse_button->read() & 3; /* buttons */ } else { /* joystick */ - data = ioport("game_port_directions")->read(); + data = m_io_game_port_directions->read(); /* bit 0=0 => P1 up bit 4=0 => P2 up bit 1=0 => P1 down bit 5=0 => P2 down bit 2=0 => P1 left bit 6=0 => P2 left @@ -916,7 +912,7 @@ READ8_MEMBER( thomson_state::to7_game_porta_in ) READ8_MEMBER( thomson_state::to7_game_portb_in ) { UINT8 data; - if ( ioport("config")->read() & 1 ) + if ( m_io_config->read() & 1 ) { /* mouse */ UINT8 mouse = to7_get_mouse_signal(); @@ -933,7 +929,7 @@ READ8_MEMBER( thomson_state::to7_game_portb_in ) /* bits 2-3: action buttons B (0=pressed) */ /* bits 4-5: unused (ouput) */ /* bits 0-1: unknown! */ - data = ioport("game_port_buttons")->read(); + data = m_io_game_port_buttons->read(); } return data; } @@ -960,7 +956,7 @@ WRITE_LINE_MEMBER( thomson_state::to7_game_cb2_out ) /* this should be called periodically */ TIMER_CALLBACK_MEMBER(thomson_state::to7_game_update_cb) { - if ( ioport("config")->read() & 1 ) + if ( m_io_config->read() & 1 ) { /* mouse */ UINT8 mouse = to7_get_mouse_signal(); @@ -970,7 +966,7 @@ TIMER_CALLBACK_MEMBER(thomson_state::to7_game_update_cb) else { /* joystick */ - UINT8 in = ioport("game_port_buttons")->read(); + UINT8 in = m_io_game_port_buttons->read(); m_pia_game->cb2_w( (in & 0x80) ? 1 : 0 ); /* P2 action A */ m_pia_game->ca2_w( (in & 0x40) ? 1 : 0 ); /* P1 action A */ m_pia_game->cb1_w( (in & 0x08) ? 1 : 0 ); /* P2 action B */ @@ -1118,22 +1114,24 @@ MACHINE_START_MEMBER( thomson_state, to7 ) /* memory */ m_thom_cart_bank = 0; m_thom_vram = ram; - membank( THOM_BASE_BANK )->configure_entry( 0, ram + 0x4000); - membank( THOM_VRAM_BANK )->configure_entries( 0, 2, m_thom_vram, 0x2000 ); - membank( THOM_CART_BANK )->configure_entries( 0, 4, mem + 0x10000, 0x4000 ); - membank( THOM_BASE_BANK )->set_entry( 0 ); - membank( THOM_VRAM_BANK )->set_entry( 0 ); - membank( THOM_CART_BANK )->set_entry( 0 ); + m_basebank->configure_entry( 0, ram + 0x4000); + m_vrambank->configure_entries( 0, 2, m_thom_vram, 0x2000 ); + m_cartbank->configure_entries( 0, 4, mem + 0x10000, 0x4000 ); + m_basebank->set_entry( 0 ); + m_vrambank->set_entry( 0 ); + m_cartbank->set_entry( 0 ); + + space.unmap_readwrite(0x8000, 0xdfff); if ( m_ram->size() > 24*1024 ) { /* install 16 KB or 16 KB + 8 KB memory extensions */ /* BASIC instruction to see free memory: ?FRE(0) */ int extram = m_ram->size() - 24*1024; - space.install_write_bank(0x8000, 0x8000 + extram - 1, THOM_RAM_BANK); - space.install_read_bank(0x8000, 0x8000 + extram - 1, THOM_RAM_BANK ); - membank( THOM_RAM_BANK )->configure_entry( 0, ram + 0x6000); - membank( THOM_RAM_BANK )->set_entry( 0 ); + space.install_write_bank(0x8000, 0x8000 + extram - 1, m_rambank); + space.install_read_bank(0x8000, 0x8000 + extram - 1, m_rambank); + m_rambank->configure_entry( 0, ram + 0x6000); + m_rambank->set_entry( 0 ); } /* force 2 topmost color bits to 1 */ @@ -1169,13 +1167,9 @@ WRITE_LINE_MEMBER( thomson_state::to770_sys_cb2_out ) READ8_MEMBER( thomson_state::to770_sys_porta_in ) { /* keyboard */ - static const char *const keynames[] = { - "keyboard_0", "keyboard_1", "keyboard_2", "keyboard_3", - "keyboard_4", "keyboard_5", "keyboard_6", "keyboard_7" - }; int keyline = m_pia_sys->b_output() & 7; - return ioport(keynames[7 - keyline])->read(); + return m_io_keyboard[7 - keyline]->read(); } @@ -1210,7 +1204,7 @@ void thomson_state::to770_update_ram_bank() { if ( m_ram->size() == 128*1024 || bank < 2 ) { - membank( THOM_RAM_BANK )->set_entry( bank ); + m_rambank->set_entry( bank ); } else { @@ -1344,14 +1338,14 @@ MACHINE_START_MEMBER( thomson_state, to770 ) /* memory */ m_thom_cart_bank = 0; m_thom_vram = ram; - membank( THOM_BASE_BANK )->configure_entry( 0, ram + 0x4000); - membank( THOM_RAM_BANK )->configure_entries( 0, 6, ram + 0x8000, 0x4000 ); - membank( THOM_VRAM_BANK )->configure_entries( 0, 2, m_thom_vram, 0x2000 ); - membank( THOM_CART_BANK )->configure_entries( 0, 4, mem + 0x10000, 0x4000 ); - membank( THOM_BASE_BANK )->set_entry( 0 ); - membank( THOM_RAM_BANK )->set_entry( 0 ); - membank( THOM_VRAM_BANK )->set_entry( 0 ); - membank( THOM_CART_BANK )->set_entry( 0 ); + m_basebank->configure_entry( 0, ram + 0x4000); + m_rambank->configure_entries( 0, 6, ram + 0x8000, 0x4000 ); + m_vrambank->configure_entries( 0, 2, m_thom_vram, 0x2000 ); + m_cartbank->configure_entries( 0, 4, mem + 0x10000, 0x4000 ); + m_basebank->set_entry( 0 ); + m_rambank->set_entry( 0 ); + m_vrambank->set_entry( 0 ); + m_cartbank->set_entry( 0 ); /* save-state */ save_item(NAME(m_thom_cart_nb_banks)); @@ -1426,7 +1420,7 @@ READ8_MEMBER( thomson_state::mo5_sys_porta_in ) { return (mo5_get_cassette() ? 0x80 : 0) | /* bit 7: cassette input */ - ((ioport("lightpen_button")->read() & 1) ? 0x20 : 0) + ((m_io_lightpen_button->read() & 1) ? 0x20 : 0) /* bit 5: lightpen button */; } @@ -1444,12 +1438,8 @@ READ8_MEMBER( thomson_state::mo5_sys_portb_in ) UINT8 portb = m_pia_sys->b_output(); int col = (portb >> 1) & 7; /* key column */ int lin = 7 - ((portb >> 4) & 7); /* key line */ - static const char *const keynames[] = { - "keyboard_0", "keyboard_1", "keyboard_2", "keyboard_3", - "keyboard_4", "keyboard_5", "keyboard_6", "keyboard_7" - }; - return ( ioport(keynames[lin])->read() & (1 << col) ) ? 0x80 : 0; + return ( m_io_keyboard[lin]->read() & (1 << col) ) ? 0x80 : 0; } @@ -1573,7 +1563,7 @@ void thomson_state::mo5_update_cart_bank() { if ( m_old_cart_bank < 0 || m_old_cart_bank > 3 ) { - space.install_read_bank( 0xb000, 0xefff, THOM_CART_BANK); + space.install_read_bank( 0xb000, 0xefff, m_cartbank); space.nop_write( 0xb000, 0xefff); } LOG_BANK(( "mo5_update_cart_bank: CART is cartridge bank %i (A7CB style)\n", bank )); @@ -1589,12 +1579,12 @@ void thomson_state::mo5_update_cart_bank() { if ( bank_is_read_only ) { - space.install_read_bank( 0xb000, 0xefff, THOM_CART_BANK); + space.install_read_bank( 0xb000, 0xefff, m_cartbank); space.nop_write( 0xb000, 0xefff ); } else { - space.install_readwrite_bank( 0xb000, 0xefff, THOM_CART_BANK); + space.install_readwrite_bank( 0xb000, 0xefff, m_cartbank); } LOG_BANK(( "mo5_update_cart_bank: CART is nanonetwork RAM bank %i (%s)\n", m_mo5_reg_cart & 3, @@ -1612,7 +1602,7 @@ void thomson_state::mo5_update_cart_bank() { if ( m_old_cart_bank < 0 ) { - space.install_read_bank( 0xb000, 0xefff, THOM_CART_BANK); + space.install_read_bank( 0xb000, 0xefff, m_cartbank); space.install_write_handler( 0xb000, 0xefff, write8_delegate(FUNC(thomson_state::mo5_cartridge_w),this) ); space.install_read_handler( 0xbffc, 0xbfff, read8_delegate(FUNC(thomson_state::mo5_cartridge_r),this) ); } @@ -1624,7 +1614,7 @@ void thomson_state::mo5_update_cart_bank() /* internal ROM */ if ( m_old_cart_bank != 0 ) { - space.install_read_bank( 0xb000, 0xefff, THOM_CART_BANK); + space.install_read_bank( 0xb000, 0xefff, m_cartbank); space.install_write_handler( 0xb000, 0xefff, write8_delegate(FUNC(thomson_state::mo5_cartridge_w),this) ); LOG_BANK(( "mo5_update_cart_bank: CART is internal\n")); } @@ -1632,7 +1622,7 @@ void thomson_state::mo5_update_cart_bank() } if ( bank != m_old_cart_bank ) { - membank( THOM_CART_BANK )->set_entry( bank ); + m_cartbank->set_entry( bank ); m_old_cart_bank = bank; } } @@ -1738,13 +1728,13 @@ MACHINE_START_MEMBER( thomson_state, mo5 ) m_thom_cart_bank = 0; m_mo5_reg_cart = 0; m_thom_vram = ram; - membank( THOM_BASE_BANK )->configure_entry( 0, ram + 0x4000); - membank( THOM_CART_BANK )->configure_entries( 0, 4, mem + 0x10000, 0x4000 ); - membank( THOM_CART_BANK )->configure_entries( 4, 4, ram + 0xc000, 0x4000 ); - membank( THOM_VRAM_BANK )->configure_entries( 0, 2, m_thom_vram, 0x2000 ); - membank( THOM_BASE_BANK )->set_entry( 0 ); - membank( THOM_CART_BANK )->set_entry( 0 ); - membank( THOM_VRAM_BANK )->set_entry( 0 ); + m_basebank->configure_entry( 0, ram + 0x4000); + m_cartbank->configure_entries( 0, 4, mem + 0x10000, 0x4000 ); + m_cartbank->configure_entries( 4, 4, ram + 0xc000, 0x4000 ); + m_vrambank->configure_entries( 0, 2, m_thom_vram, 0x2000 ); + m_basebank->set_entry( 0 ); + m_cartbank->set_entry( 0 ); + m_vrambank->set_entry( 0 ); /* save-state */ save_item(NAME(m_thom_cart_nb_banks)); @@ -1974,7 +1964,7 @@ void thomson_state::to9_update_cart_bank() { if ( m_old_cart_bank < 4) { - space.install_read_bank( 0x0000, 0x3fff, THOM_CART_BANK ); + space.install_read_bank( 0x0000, 0x3fff, m_cartbank ); } LOG_BANK(( "to9_update_cart_bank: CART is BASIC bank %i\n", m_to9_soft_bank )); } @@ -1986,7 +1976,7 @@ void thomson_state::to9_update_cart_bank() { if ( m_old_cart_bank < 4) { - space.install_read_bank( 0x0000, 0x3fff, THOM_CART_BANK ); + space.install_read_bank( 0x0000, 0x3fff, m_cartbank ); } LOG_BANK(( "to9_update_cart_bank: CART is software 1 bank %i\n", m_to9_soft_bank )); } @@ -1998,7 +1988,7 @@ void thomson_state::to9_update_cart_bank() { if ( m_old_cart_bank < 4) { - space.install_read_bank( 0x0000, 0x3fff, THOM_CART_BANK ); + space.install_read_bank( 0x0000, 0x3fff, m_cartbank ); } LOG_BANK(( "to9_update_cart_bank: CART is software 2 bank %i\n", m_to9_soft_bank )); } @@ -2012,7 +2002,7 @@ void thomson_state::to9_update_cart_bank() { if ( m_old_cart_bank < 0 || m_old_cart_bank > 3 ) { - space.install_read_bank( 0x0000, 0x3fff, THOM_CART_BANK ); + space.install_read_bank( 0x0000, 0x3fff, m_cartbank ); space.install_write_handler( 0x0000, 0x3fff, write8_delegate(FUNC(thomson_state::to9_cartridge_w),this) ); space.install_read_handler( 0x0000, 0x0003, read8_delegate(FUNC(thomson_state::to9_cartridge_r),this) ); } @@ -2031,7 +2021,7 @@ void thomson_state::to9_update_cart_bank() } if ( bank != m_old_cart_bank ) { - membank( THOM_CART_BANK )->set_entry( bank ); + m_cartbank->set_entry( bank ); m_old_cart_bank = bank; } } @@ -2110,7 +2100,7 @@ void thomson_state::to9_update_ram_bank() { if ( m_ram->size() == 192*1024 || bank < 6 ) { - membank( THOM_RAM_BANK )->set_entry( bank ); + m_rambank->set_entry( bank ); } else { @@ -2160,14 +2150,10 @@ int thomson_state::to9_kbd_ktest() { int line, bit; UINT8 port; - static const char *const keynames[] = { - "keyboard_0", "keyboard_1", "keyboard_2", "keyboard_3", "keyboard_4", - "keyboard_5", "keyboard_6", "keyboard_7", "keyboard_8", "keyboard_9" - }; for ( line = 0; line < 10; line++ ) { - port = ioport(keynames[line])->read(); + port = m_io_keyboard[line]->read(); if ( line == 7 || line == 9 ) port |= 1; /* shift & control */ @@ -2393,18 +2379,14 @@ static const int to9_kbd_code[80][2] = /* returns the ASCII code for the key, or 0 for no key */ int thomson_state::to9_kbd_get_key() { - int control = ! (ioport("keyboard_7")->read() & 1); - int shift = ! (ioport("keyboard_9")->read() & 1); + int control = ! (m_io_keyboard[7]->read() & 1); + int shift = ! (m_io_keyboard[9]->read() & 1); int key = -1, line, bit; UINT8 port; - static const char *const keynames[] = { - "keyboard_0", "keyboard_1", "keyboard_2", "keyboard_3", "keyboard_4", - "keyboard_5", "keyboard_6", "keyboard_7", "keyboard_8", "keyboard_9" - }; for ( line = 0; line < 10; line++ ) { - port = ioport(keynames[line])->read(); + port = m_io_keyboard[line]->read(); if ( line == 7 || line == 9 ) port |= 1; /* shift & control */ @@ -2495,7 +2477,7 @@ TIMER_CALLBACK_MEMBER(thomson_state::to9_kbd_timer_cb) case 1: /* x axis */ { - int newx = ioport("mouse_x")->read(); + int newx = m_io_mouse_x->read(); UINT8 data = ( (newx - m_to9_mouse_x) & 0xf ) - 8; to9_kbd_send( data, 1 ); m_to9_mouse_x = newx; @@ -2504,7 +2486,7 @@ TIMER_CALLBACK_MEMBER(thomson_state::to9_kbd_timer_cb) case 2: /* y axis */ { - int newy = ioport("mouse_y")->read(); + int newy = m_io_mouse_y->read(); UINT8 data = ( (newy - m_to9_mouse_y) & 0xf ) - 8; to9_kbd_send( data, 1 ); m_to9_mouse_y = newy; @@ -2513,7 +2495,7 @@ TIMER_CALLBACK_MEMBER(thomson_state::to9_kbd_timer_cb) case 3: /* axis overflow & buttons */ { - int b = ioport("mouse_button")->read(); + int b = m_io_mouse_button->read(); UINT8 data = 0; if ( b & 1 ) data |= 1; if ( b & 2 ) data |= 4; @@ -2689,14 +2671,14 @@ MACHINE_START_MEMBER( thomson_state, to9 ) /* memory */ m_thom_vram = ram; m_thom_cart_bank = 0; - membank( THOM_VRAM_BANK )->configure_entries( 0, 2, m_thom_vram, 0x2000 ); - membank( THOM_CART_BANK )->configure_entries( 0, 12, mem + 0x10000, 0x4000 ); - membank( THOM_BASE_BANK )->configure_entry( 0, ram + 0x4000); - membank( THOM_RAM_BANK )->configure_entries( 0, 10, ram + 0x8000, 0x4000 ); - membank( THOM_VRAM_BANK )->set_entry( 0 ); - membank( THOM_CART_BANK )->set_entry( 0 ); - membank( THOM_BASE_BANK )->set_entry( 0 ); - membank( THOM_RAM_BANK )->set_entry( 0 ); + m_vrambank->configure_entries( 0, 2, m_thom_vram, 0x2000 ); + m_cartbank->configure_entries( 0, 12, mem + 0x10000, 0x4000 ); + m_basebank->configure_entry( 0, ram + 0x4000); + m_rambank->configure_entries( 0, 10, ram + 0x8000, 0x4000 ); + m_vrambank->set_entry( 0 ); + m_cartbank->set_entry( 0 ); + m_basebank->set_entry( 0 ); + m_rambank->set_entry( 0 ); /* save-state */ save_item(NAME(m_thom_cart_nb_banks)); @@ -2752,17 +2734,13 @@ int thomson_state::to8_kbd_ktest() { int line, bit; UINT8 port; - static const char *const keynames[] = { - "keyboard_0", "keyboard_1", "keyboard_2", "keyboard_3", "keyboard_4", - "keyboard_5", "keyboard_6", "keyboard_7", "keyboard_8", "keyboard_9" - }; - if ( ioport("config")->read() & 2 ) + if ( m_io_config->read() & 2 ) return 0; /* disabled */ for ( line = 0; line < 10; line++ ) { - port = ioport(keynames[line])->read(); + port = m_io_keyboard[line]->read(); if ( line == 7 || line == 9 ) port |= 1; /* shift & control */ @@ -2782,21 +2760,17 @@ int thomson_state::to8_kbd_ktest() /* keyboard scan & return keycode (or -1) */ int thomson_state::to8_kbd_get_key() { - int control = (ioport("keyboard_7")->read() & 1) ? 0 : 0x100; - int shift = (ioport("keyboard_9")->read() & 1) ? 0 : 0x080; + int control = (m_io_keyboard[7]->read() & 1) ? 0 : 0x100; + int shift = (m_io_keyboard[9]->read() & 1) ? 0 : 0x080; int key = -1, line, bit; UINT8 port; - static const char *const keynames[] = { - "keyboard_0", "keyboard_1", "keyboard_2", "keyboard_3", "keyboard_4", - "keyboard_5", "keyboard_6", "keyboard_7", "keyboard_8", "keyboard_9" - }; - if ( ioport("config")->read() & 2 ) + if ( m_io_config->read() & 2 ) return -1; /* disabled */ for ( line = 0; line < 10; line++ ) { - port = ioport(keynames[line])->read(); + port = m_io_keyboard[line]->read(); if ( line == 7 || line == 9 ) port |= 1; /* shift & control */ @@ -3045,7 +3019,7 @@ void thomson_state::to8_update_floppy_bank() LOG_BANK(( "to8_update_floppy_bank: floppy ROM is %s bank %i\n", (m_to8_reg_sys1 & 0x80) ? "external" : "internal", bank % TO7_NB_FLOP_BANK )); - membank( THOM_FLOP_BANK )->set_entry( bank ); + m_flopbank->set_entry( bank ); m_old_floppy_bank = bank; } } @@ -3099,8 +3073,8 @@ void thomson_state::to8_update_ram_bank() { if (m_ram->size() == 512*1024 || m_to8_data_vpage < 16) { - membank( TO8_DATA_LO )->set_entry( bank ); - membank( TO8_DATA_HI )->set_entry( bank ); + m_datalobank->set_entry( bank ); + m_datahibank->set_entry( bank ); } else { @@ -3145,7 +3119,7 @@ void thomson_state::to8_update_cart_bank() { if (m_old_cart_bank < 8 || m_old_cart_bank > 11) { - space.install_read_bank( 0x0000, 0x3fff, THOM_CART_BANK ); + space.install_read_bank( 0x0000, 0x3fff, m_cartbank ); if ( bank_is_read_only ) { space.nop_write( 0x0000, 0x3fff); @@ -3162,12 +3136,12 @@ void thomson_state::to8_update_cart_bank() { if ( bank_is_read_only ) { - space.install_read_bank( 0x0000, 0x3fff, THOM_CART_BANK ); + space.install_read_bank( 0x0000, 0x3fff, m_cartbank ); space.nop_write( 0x0000, 0x3fff); } else { - space.install_readwrite_bank( 0x0000, 0x3fff,THOM_CART_BANK); + space.install_readwrite_bank(0x0000, 0x3fff, m_cartbank); } } } @@ -3198,7 +3172,7 @@ void thomson_state::to8_update_cart_bank() } else { - space.install_readwrite_bank( 0x0000, 0x3fff, THOM_CART_BANK ); + space.install_readwrite_bank( 0x0000, 0x3fff, m_cartbank ); } } LOG_BANK(( "to8_update_cart_bank: update CART bank %i write status to %s\n", @@ -3218,7 +3192,7 @@ void thomson_state::to8_update_cart_bank() { if ( m_old_cart_bank < 4 || m_old_cart_bank > 7 ) { - space.install_read_bank( 0x0000, 0x3fff, THOM_CART_BANK ); + space.install_read_bank( 0x0000, 0x3fff, m_cartbank ); space.install_write_handler( 0x0000, 0x3fff, write8_delegate(FUNC(thomson_state::to8_cartridge_w),this) ); } LOG_BANK(( "to8_update_cart_bank: CART is internal bank %i\n", m_to8_soft_bank )); @@ -3234,7 +3208,7 @@ void thomson_state::to8_update_cart_bank() { if ( m_old_cart_bank < 0 || m_old_cart_bank > 3 ) { - space.install_read_bank( 0x0000, 0x3fff, THOM_CART_BANK ); + space.install_read_bank( 0x0000, 0x3fff, m_cartbank ); space.install_write_handler( 0x0000, 0x3fff, write8_delegate(FUNC(thomson_state::to8_cartridge_w),this) ); space.install_read_handler( 0x0000, 0x0003, read8_delegate(FUNC(thomson_state::to8_cartridge_r),this) ); } @@ -3253,7 +3227,7 @@ void thomson_state::to8_update_cart_bank() } if ( bank != m_old_cart_bank ) { - membank( THOM_CART_BANK )->set_entry( bank ); + m_cartbank->set_entry( bank ); m_old_cart_bank = bank; } } @@ -3315,7 +3289,7 @@ void thomson_state::to8_floppy_reset() to7_floppy_reset(); if ( THOM_FLOPPY_INT ) thmfc_floppy_reset(); - membank( THOM_FLOP_BANK )->configure_entries( TO7_NB_FLOP_BANK, 2, mem + 0x30000, 0x2000 ); + m_flopbank->configure_entries( TO7_NB_FLOP_BANK, 2, mem + 0x30000, 0x2000 ); } @@ -3590,7 +3564,7 @@ WRITE_LINE_MEMBER(thomson_state::write_centronics_busy ) READ8_MEMBER( thomson_state::to8_timer_port_in ) { - int lightpen = (ioport("lightpen_button")->read() & 1) ? 2 : 0; + int lightpen = (m_io_lightpen_button->read() & 1) ? 2 : 0; int cass = to7_get_cassette() ? 0x80 : 0; int dtr = m_centronics_busy << 6; int lock = m_to8_kbd_caps ? 0 : 8; /* undocumented! */ @@ -3604,7 +3578,7 @@ WRITE8_MEMBER( thomson_state::to8_timer_port_out ) int ack = (data & 0x20) ? 1 : 0; /* bit 5: keyboard ACK */ m_to8_bios_bank = (data & 0x10) ? 1 : 0; /* bit 4: BIOS bank*/ thom_set_mode_point( data & 1 ); /* bit 0: video bank switch */ - membank( TO8_BIOS_BANK )->set_entry( m_to8_bios_bank ); + m_biosbank->set_entry( m_to8_bios_bank ); m_to8_soft_select = (data & 0x04) ? 1 : 0; /* bit 2: internal ROM select */ to8_update_floppy_bank(); to8_update_cart_bank(); @@ -3683,7 +3657,7 @@ MACHINE_RESET_MEMBER( thomson_state, to8 ) to8_update_ram_bank(); to8_update_cart_bank(); to8_update_floppy_bank(); - membank( TO8_BIOS_BANK )->set_entry( 0 ); + m_biosbank->set_entry( 0 ); /* thom_cart_bank not reset */ } @@ -3708,33 +3682,33 @@ MACHINE_START_MEMBER( thomson_state, to8 ) /* memory */ m_thom_cart_bank = 0; m_thom_vram = ram; - membank( THOM_CART_BANK )->configure_entries( 0, 8, mem + 0x10000, 0x4000 ); + m_cartbank->configure_entries( 0, 8, mem + 0x10000, 0x4000 ); if ( m_ram->size() == 256*1024 ) { - membank( THOM_CART_BANK )->configure_entries( 8, 16, ram, 0x4000 ); - membank( THOM_CART_BANK )->configure_entries( 8+16, 16, ram, 0x4000 ); - membank( TO8_DATA_LO )->configure_entries( 0, 16, ram + 0x2000, 0x4000 ); - membank( TO8_DATA_LO )->configure_entries( 16, 16, ram + 0x2000, 0x4000 ); - membank( TO8_DATA_HI )->configure_entries( 0, 16, ram + 0x0000, 0x4000 ); - membank( TO8_DATA_HI )->configure_entries( 16, 16, ram + 0x0000, 0x4000 ); + m_cartbank->configure_entries( 8, 16, ram, 0x4000 ); + m_cartbank->configure_entries( 8+16, 16, ram, 0x4000 ); + m_datalobank->configure_entries( 0, 16, ram + 0x2000, 0x4000 ); + m_datalobank->configure_entries( 16, 16, ram + 0x2000, 0x4000 ); + m_datahibank->configure_entries( 0, 16, ram + 0x0000, 0x4000 ); + m_datahibank->configure_entries( 16, 16, ram + 0x0000, 0x4000 ); } else { - membank( THOM_CART_BANK )->configure_entries( 8, 32, ram, 0x4000 ); - membank( TO8_DATA_LO )->configure_entries( 0, 32, ram + 0x2000, 0x4000 ); - membank( TO8_DATA_HI )->configure_entries( 0, 32, ram + 0x0000, 0x4000 ); + m_cartbank->configure_entries( 8, 32, ram, 0x4000 ); + m_datalobank->configure_entries( 0, 32, ram + 0x2000, 0x4000 ); + m_datahibank->configure_entries( 0, 32, ram + 0x0000, 0x4000 ); } - membank( THOM_VRAM_BANK )->configure_entries( 0, 2, ram, 0x2000 ); - membank( TO8_SYS_LO )->configure_entry( 0, ram + 0x6000); - membank( TO8_SYS_HI )->configure_entry( 0, ram + 0x4000); - membank( TO8_BIOS_BANK )->configure_entries( 0, 2, mem + 0x30800, 0x2000 ); - membank( THOM_CART_BANK )->set_entry( 0 ); - membank( THOM_VRAM_BANK )->set_entry( 0 ); - membank( TO8_SYS_LO )->set_entry( 0 ); - membank( TO8_SYS_HI )->set_entry( 0 ); - membank( TO8_DATA_LO )->set_entry( 0 ); - membank( TO8_DATA_HI )->set_entry( 0 ); - membank( TO8_BIOS_BANK )->set_entry( 0 ); + m_vrambank->configure_entries( 0, 2, ram, 0x2000 ); + m_syslobank->configure_entry( 0, ram + 0x6000); + m_syshibank->configure_entry( 0, ram + 0x4000); + m_biosbank->configure_entries( 0, 2, mem + 0x30800, 0x2000 ); + m_cartbank->set_entry( 0 ); + m_vrambank->set_entry( 0 ); + m_syslobank->set_entry( 0 ); + m_syshibank->set_entry( 0 ); + m_datalobank->set_entry( 0 ); + m_datahibank->set_entry( 0 ); + m_biosbank->set_entry( 0 ); /* save-state */ save_item(NAME(m_thom_cart_nb_banks)); @@ -3773,7 +3747,7 @@ MACHINE_START_MEMBER( thomson_state, to8 ) READ8_MEMBER( thomson_state::to9p_timer_port_in ) { - int lightpen = (ioport("lightpen_button")->read() & 1) ? 2 : 0; + int lightpen = (m_io_lightpen_button->read() & 1) ? 2 : 0; int cass = to7_get_cassette() ? 0x80 : 0; int dtr = m_centronics_busy << 6; return lightpen | cass | dtr; @@ -3785,7 +3759,7 @@ WRITE8_MEMBER( thomson_state::to9p_timer_port_out ) { int bios_bank = (data & 0x10) ? 1 : 0; /* bit 4: BIOS bank */ thom_set_mode_point( data & 1 ); /* bit 0: video bank switch */ - membank( TO8_BIOS_BANK )->set_entry( bios_bank ); + m_biosbank->set_entry( bios_bank ); m_to8_soft_select = (data & 0x04) ? 1 : 0; /* bit 2: internal ROM select */ to8_update_floppy_bank(); to8_update_cart_bank(); @@ -3834,7 +3808,7 @@ MACHINE_RESET_MEMBER( thomson_state, to9p ) to8_update_ram_bank(); to8_update_cart_bank(); to8_update_floppy_bank(); - membank( TO8_BIOS_BANK )->set_entry( 0 ); + m_biosbank->set_entry( 0 ); /* thom_cart_bank not reset */ } @@ -3859,21 +3833,21 @@ MACHINE_START_MEMBER( thomson_state, to9p ) /* memory */ m_thom_cart_bank = 0; m_thom_vram = ram; - membank( THOM_CART_BANK )->configure_entries( 0, 8, mem + 0x10000, 0x4000 ); - membank( THOM_CART_BANK )->configure_entries( 8, 32, ram, 0x4000 ); - membank( THOM_VRAM_BANK )->configure_entries( 0, 2, ram, 0x2000 ); - membank( TO8_SYS_LO )->configure_entry( 0, ram + 0x6000 ); - membank( TO8_SYS_HI )->configure_entry( 0, ram + 0x4000 ); - membank( TO8_DATA_LO )->configure_entries( 0, 32, ram + 0x2000, 0x4000 ); - membank( TO8_DATA_HI )->configure_entries( 0, 32, ram + 0x0000, 0x4000 ); - membank( TO8_BIOS_BANK )->configure_entries( 0, 2, mem + 0x30800, 0x2000 ); - membank( THOM_CART_BANK )->set_entry( 0 ); - membank( THOM_VRAM_BANK )->set_entry( 0 ); - membank( TO8_SYS_LO )->set_entry( 0 ); - membank( TO8_SYS_HI )->set_entry( 0 ); - membank( TO8_DATA_LO )->set_entry( 0 ); - membank( TO8_DATA_HI )->set_entry( 0 ); - membank( TO8_BIOS_BANK )->set_entry( 0 ); + m_cartbank->configure_entries( 0, 8, mem + 0x10000, 0x4000 ); + m_cartbank->configure_entries( 8, 32, ram, 0x4000 ); + m_vrambank->configure_entries( 0, 2, ram, 0x2000 ); + m_syslobank->configure_entry( 0, ram + 0x6000 ); + m_syshibank->configure_entry( 0, ram + 0x4000 ); + m_datalobank->configure_entries( 0, 32, ram + 0x2000, 0x4000 ); + m_datahibank->configure_entries( 0, 32, ram + 0x0000, 0x4000 ); + m_biosbank->configure_entries( 0, 2, mem + 0x30800, 0x2000 ); + m_cartbank->set_entry( 0 ); + m_vrambank->set_entry( 0 ); + m_syslobank->set_entry( 0 ); + m_syshibank->set_entry( 0 ); + m_datalobank->set_entry( 0 ); + m_datahibank->set_entry( 0 ); + m_biosbank->set_entry( 0 ); /* save-state */ save_item(NAME(m_thom_cart_nb_banks)); @@ -3915,8 +3889,8 @@ void thomson_state::mo6_update_ram_bank() bank = m_to8_reg_ram & 7; /* 128 KB RAM only = 8 pages */ } if ( bank != m_to8_data_vpage ) { - membank( TO8_DATA_LO )->set_entry( bank ); - membank( TO8_DATA_HI )->set_entry( bank ); + m_datalobank->set_entry( bank ); + m_datahibank->set_entry( bank ); m_to8_data_vpage = bank; m_old_ram_bank = bank; LOG_BANK(( "mo6_update_ram_bank: select bank %i (new style)\n", bank )); @@ -3954,8 +3928,8 @@ void thomson_state::mo6_update_cart_bank() { if (m_old_cart_bank < 8 || m_old_cart_bank > 11) { - space.install_read_bank( 0xb000, 0xbfff, MO6_CART_LO ); - space.install_read_bank( 0xc000, 0xefff, MO6_CART_HI ); + space.install_read_bank( 0xb000, 0xbfff, m_cartlobank ); + space.install_read_bank( 0xc000, 0xefff, m_carthibank ); if ( bank_is_read_only ) { space.nop_write( 0xb000, 0xefff); @@ -3973,14 +3947,14 @@ void thomson_state::mo6_update_cart_bank() { if ( bank_is_read_only ) { - space.install_read_bank( 0xb000, 0xbfff, MO6_CART_LO ); - space.install_read_bank( 0xc000, 0xefff, MO6_CART_HI ); - space.nop_write( 0xb000, 0xefff); + space.install_read_bank( 0xb000, 0xbfff, m_cartlobank ); + space.install_read_bank( 0xc000, 0xefff, m_carthibank ); + space.nop_write( 0xb000, 0xefff); } else { - space.install_readwrite_bank( 0xb000, 0xbfff, MO6_CART_LO ); - space.install_readwrite_bank( 0xc000, 0xefff, MO6_CART_HI ); + space.install_readwrite_bank( 0xb000, 0xbfff, m_cartlobank ); + space.install_readwrite_bank( 0xc000, 0xefff, m_carthibank ); } } } @@ -3998,14 +3972,13 @@ void thomson_state::mo6_update_cart_bank() { if (m_to8_cart_vpage < 4) { - space.install_write_handler( 0xb000, 0xbfff, write8_delegate(FUNC(thomson_state::mo6_vcart_lo_w),this)); - space.install_write_handler( 0xc000, 0xefff, write8_delegate(FUNC(thomson_state::mo6_vcart_hi_w),this)); - + space.install_write_handler( 0xb000, 0xbfff, write8_delegate(FUNC(thomson_state::mo6_vcart_lo_w),this)); + space.install_write_handler( 0xc000, 0xefff, write8_delegate(FUNC(thomson_state::mo6_vcart_hi_w),this)); } else { - space.install_readwrite_bank( 0xb000, 0xbfff, MO6_CART_LO ); - space.install_readwrite_bank( 0xc000, 0xefff, MO6_CART_HI ); + space.install_readwrite_bank( 0xb000, 0xbfff, m_cartlobank ); + space.install_readwrite_bank( 0xc000, 0xefff, m_carthibank ); } } LOG_BANK(( "mo6_update_cart_bank: update CART bank %i write status to %s\n", @@ -4022,8 +3995,8 @@ void thomson_state::mo6_update_cart_bank() { if ( m_old_cart_bank < 0 || m_old_cart_bank > 3 ) { - space.install_read_bank( 0xb000, 0xbfff, MO6_CART_LO ); - space.install_read_bank( 0xc000, 0xefff, MO6_CART_HI ); + space.install_read_bank( 0xb000, 0xbfff, m_cartlobank ); + space.install_read_bank( 0xc000, 0xefff, m_carthibank ); space.nop_write( 0xb000, 0xefff); } LOG_BANK(( "mo6_update_cart_bank: CART is external cartridge bank %i (A7CB style)\n", bank )); @@ -4041,14 +4014,14 @@ void thomson_state::mo6_update_cart_bank() { if ( bank_is_read_only ) { - space.install_read_bank( 0xb000, 0xbfff, MO6_CART_LO ); - space.install_read_bank( 0xc000, 0xefff, MO6_CART_HI ); + space.install_read_bank( 0xb000, 0xbfff, m_cartlobank ); + space.install_read_bank( 0xc000, 0xefff, m_carthibank ); space.nop_write( 0xb000, 0xefff); } else { - space.install_readwrite_bank( 0xb000, 0xbfff, MO6_CART_LO ); - space.install_readwrite_bank( 0xc000, 0xefff, MO6_CART_HI ); + space.install_readwrite_bank( 0xb000, 0xbfff, m_cartlobank ); + space.install_readwrite_bank( 0xc000, 0xefff, m_carthibank ); } } LOG_BANK(( "mo6_update_cart_bank: CART is RAM bank %i (MO5 compat.) (%s)\n", @@ -4059,14 +4032,14 @@ void thomson_state::mo6_update_cart_bank() { if ( bank_is_read_only ) { - space.install_read_bank( 0xb000, 0xbfff, MO6_CART_LO ); - space.install_read_bank( 0xc000, 0xefff, MO6_CART_HI ); + space.install_read_bank( 0xb000, 0xbfff, m_cartlobank ); + space.install_read_bank( 0xc000, 0xefff, m_carthibank ); space.nop_write( 0xb000, 0xefff); } else { - space.install_readwrite_bank( 0xb000, 0xbfff, MO6_CART_LO ); - space.install_readwrite_bank( 0xc000, 0xefff, MO6_CART_HI ); + space.install_readwrite_bank( 0xb000, 0xbfff, m_cartlobank ); + space.install_readwrite_bank( 0xc000, 0xefff, m_carthibank ); } LOG_BANK(( "mo5_update_cart_bank: update CART bank %i write status to %s\n", m_to8_cart_vpage, @@ -4093,8 +4066,8 @@ void thomson_state::mo6_update_cart_bank() { if ( m_old_cart_bank < 4 || m_old_cart_bank > 7 ) { - space.install_read_bank( 0xb000, 0xbfff, MO6_CART_LO ); - space.install_read_bank( 0xc000, 0xefff, MO6_CART_HI ); + space.install_read_bank( 0xb000, 0xbfff, m_cartlobank ); + space.install_read_bank( 0xc000, 0xefff, m_carthibank ); space.install_write_handler( 0xb000, 0xefff, write8_delegate(FUNC(thomson_state::mo6_cartridge_w),this) ); } LOG_BANK(( "mo6_update_cart_bank: CART is internal ROM bank %i\n", b )); @@ -4108,10 +4081,10 @@ void thomson_state::mo6_update_cart_bank() bank = m_thom_cart_bank % m_thom_cart_nb_banks; if ( bank != m_old_cart_bank ) { - if ( m_old_cart_bank < 0 || m_old_cart_bank > 3 ) + if ( m_old_cart_bank < 0 || m_old_cart_bank > 3 ) { - space.install_read_bank( 0xb000, 0xbfff, MO6_CART_LO ); - space.install_read_bank( 0xc000, 0xefff, MO6_CART_HI ); + space.install_read_bank( 0xb000, 0xbfff, m_cartlobank ); + space.install_read_bank( 0xc000, 0xefff, m_carthibank ); space.install_write_handler( 0xb000, 0xefff, write8_delegate(FUNC(thomson_state::mo6_cartridge_w),this) ); space.install_read_handler( 0xbffc, 0xbfff, read8_delegate(FUNC(thomson_state::mo6_cartridge_r),this) ); } @@ -4129,10 +4102,10 @@ void thomson_state::mo6_update_cart_bank() } } if ( bank != m_old_cart_bank ) - { - membank( MO6_CART_LO )->set_entry( bank ); - membank( MO6_CART_HI )->set_entry( bank ); - membank( TO8_BIOS_BANK )->set_entry( b ); + { + m_cartlobank->set_entry( bank ); + m_carthibank->set_entry( bank ); + m_biosbank->set_entry( b ); m_old_cart_bank = bank; } } @@ -4216,7 +4189,7 @@ WRITE_LINE_MEMBER( thomson_state::mo6_game_cb2_out ) TIMER_CALLBACK_MEMBER(thomson_state::mo6_game_update_cb) { /* unlike the TO8, CB1 & CB2 are not connected to buttons */ - if ( ioport("config")->read() & 1 ) + if ( m_io_config->read() & 1 ) { UINT8 mouse = to7_get_mouse_signal(); m_pia_game->ca1_w( BIT(mouse, 0) ); /* XA */ @@ -4225,7 +4198,7 @@ TIMER_CALLBACK_MEMBER(thomson_state::mo6_game_update_cb) else { /* joystick */ - UINT8 in = ioport("game_port_buttons")->read(); + UINT8 in = m_io_game_port_buttons->read(); m_pia_game->ca1_w( BIT(in, 2) ); /* P1 action B */ m_pia_game->ca2_w( BIT(in, 6) ); /* P1 action A */ } @@ -4264,7 +4237,7 @@ READ8_MEMBER( thomson_state::mo6_sys_porta_in ) return (mo5_get_cassette() ? 0x80 : 0) | /* bit 7: cassette input */ 8 | /* bit 3: kbd-line float up to 1 */ - ((ioport("lightpen_button")->read() & 1) ? 2 : 0); + ((m_io_lightpen_button->read() & 1) ? 2 : 0); /* bit 1: lightpen button */; } @@ -4277,16 +4250,12 @@ READ8_MEMBER( thomson_state::mo6_sys_portb_in ) UINT8 portb = m_pia_sys->b_output(); int col = (portb >> 4) & 7; /* B bits 4-6: kbd column */ int lin = (portb >> 1) & 7; /* B bits 1-3: kbd line */ - static const char *const keynames[] = { - "keyboard_0", "keyboard_1", "keyboard_2", "keyboard_3", "keyboard_4", - "keyboard_5", "keyboard_6", "keyboard_7", "keyboard_8", "keyboard_9" - }; if ( ! (porta & 8) ) lin = 8; /* A bit 3: 9-th kbd line select */ return - ( ioport(keynames[lin])->read() & (1 << col) ) ? 0x80 : 0; + ( m_io_keyboard[lin]->read() & (1 << col) ) ? 0x80 : 0; /* bit 7: key up */ } @@ -4558,28 +4527,28 @@ MACHINE_START_MEMBER( thomson_state, mo6 ) m_thom_cart_bank = 0; m_mo5_reg_cart = 0; m_thom_vram = ram; - membank( MO6_CART_LO )->configure_entries( 0, 4, mem + 0x10000, 0x4000 ); - membank( MO6_CART_LO )->configure_entries( 4, 2, mem + 0x1f000, 0x4000 ); - membank( MO6_CART_LO )->configure_entries( 6, 2, mem + 0x28000, 0x4000 ); - membank( MO6_CART_LO )->configure_entries( 8, 8, ram + 0x3000, 0x4000 ); - membank( MO6_CART_HI )->configure_entries( 0, 4, mem + 0x10000 + 0x1000, 0x4000 ); - membank( MO6_CART_HI )->configure_entries( 4, 2, mem + 0x1f000 + 0x1000, 0x4000 ); - membank( MO6_CART_HI )->configure_entries( 6, 2, mem + 0x28000 + 0x1000, 0x4000 ); - membank( MO6_CART_HI )->configure_entries( 8, 8, ram, 0x4000 ); - membank( THOM_VRAM_BANK )->configure_entries( 0, 2, ram, 0x2000 ); - membank( TO8_SYS_LO )->configure_entry( 0, ram + 0x6000); - membank( TO8_SYS_HI )->configure_entry( 0, ram + 0x4000); - membank( TO8_DATA_LO )->configure_entries( 0, 8, ram + 0x2000, 0x4000 ); - membank( TO8_DATA_HI )->configure_entries( 0, 8, ram + 0x0000, 0x4000 ); - membank( TO8_BIOS_BANK )->configure_entries( 0, 2, mem + 0x23000, 0x4000 ); - membank( MO6_CART_LO )->set_entry( 0 ); - membank( MO6_CART_HI )->set_entry( 0 ); - membank( THOM_VRAM_BANK )->set_entry( 0 ); - membank( TO8_SYS_LO )->set_entry( 0 ); - membank( TO8_SYS_HI )->set_entry( 0 ); - membank( TO8_DATA_LO )->set_entry( 0 ); - membank( TO8_DATA_HI )->set_entry( 0 ); - membank( TO8_BIOS_BANK )->set_entry( 0 ); + m_cartlobank->configure_entries( 0, 4, mem + 0x10000, 0x4000 ); + m_cartlobank->configure_entries( 4, 2, mem + 0x1f000, 0x4000 ); + m_cartlobank->configure_entries( 6, 2, mem + 0x28000, 0x4000 ); + m_cartlobank->configure_entries( 8, 8, ram + 0x3000, 0x4000 ); + m_carthibank->configure_entries( 0, 4, mem + 0x10000 + 0x1000, 0x4000 ); + m_carthibank->configure_entries( 4, 2, mem + 0x1f000 + 0x1000, 0x4000 ); + m_carthibank->configure_entries( 6, 2, mem + 0x28000 + 0x1000, 0x4000 ); + m_carthibank->configure_entries( 8, 8, ram, 0x4000 ); + m_vrambank->configure_entries( 0, 2, ram, 0x2000 ); + m_syslobank->configure_entry( 0, ram + 0x6000); + m_syshibank->configure_entry( 0, ram + 0x4000); + m_datalobank->configure_entries( 0, 8, ram + 0x2000, 0x4000 ); + m_datahibank->configure_entries( 0, 8, ram + 0x0000, 0x4000 ); + m_biosbank->configure_entries( 0, 2, mem + 0x23000, 0x4000 ); + m_cartlobank->set_entry( 0 ); + m_carthibank->set_entry( 0 ); + m_vrambank->set_entry( 0 ); + m_syslobank->set_entry( 0 ); + m_syshibank->set_entry( 0 ); + m_datalobank->set_entry( 0 ); + m_datahibank->set_entry( 0 ); + m_biosbank->set_entry( 0 ); /* save-state */ save_item(NAME(m_thom_cart_nb_banks)); @@ -4669,12 +4638,8 @@ READ8_MEMBER( thomson_state::mo5nr_sys_portb_in ) UINT8 portb = m_pia_sys->b_output(); int col = (portb >> 4) & 7; /* B bits 4-6: kbd column */ int lin = (portb >> 1) & 7; /* B bits 1-3: kbd line */ - static const char *const keynames[] = { - "keyboard_0", "keyboard_1", "keyboard_2", "keyboard_3", - "keyboard_4", "keyboard_5", "keyboard_6", "keyboard_7" - }; - return ( ioport(keynames[lin])->read() & (1 << col) ) ? 0x80 : 0; + return ( m_io_keyboard[lin]->read() & (1 << col) ) ? 0x80 : 0; /* bit 7: key up */ } @@ -4787,28 +4752,28 @@ MACHINE_START_MEMBER( thomson_state, mo5nr ) m_mo5_reg_cart = 0; m_thom_vram = ram; - membank( MO6_CART_LO )->configure_entries( 0, 4, mem + 0x10000, 0x4000 ); - membank( MO6_CART_LO )->configure_entries( 4, 2, mem + 0x1f000, 0x4000 ); - membank( MO6_CART_LO )->configure_entries( 6, 2, mem + 0x28000, 0x4000 ); - membank( MO6_CART_LO )->configure_entries( 8, 8, ram + 0x3000, 0x4000 ); - membank( MO6_CART_HI )->configure_entries( 0, 4, mem + 0x10000 + 0x1000, 0x4000 ); - membank( MO6_CART_HI )->configure_entries( 4, 2, mem + 0x1f000 + 0x1000, 0x4000 ); - membank( MO6_CART_HI )->configure_entries( 6, 2, mem + 0x28000 + 0x1000, 0x4000 ); - membank( MO6_CART_HI )->configure_entries( 8, 8, ram, 0x4000 ); - membank( THOM_VRAM_BANK )->configure_entries( 0, 2, ram, 0x2000 ); - membank( TO8_SYS_LO )->configure_entry( 0, ram + 0x6000); - membank( TO8_SYS_HI )->configure_entry( 0, ram + 0x4000); - membank( TO8_DATA_LO )->configure_entries( 0, 8, ram + 0x2000, 0x4000 ); - membank( TO8_DATA_HI )->configure_entries( 0, 8, ram + 0x0000, 0x4000 ); - membank( TO8_BIOS_BANK )->configure_entries( 0, 2, mem + 0x23000, 0x4000 ); - membank( MO6_CART_LO )->set_entry( 0 ); - membank( MO6_CART_HI )->set_entry( 0 ); - membank( THOM_VRAM_BANK )->set_entry( 0 ); - membank( TO8_SYS_LO )->set_entry( 0 ); - membank( TO8_SYS_HI )->set_entry( 0 ); - membank( TO8_DATA_LO )->set_entry( 0 ); - membank( TO8_DATA_HI )->set_entry( 0 ); - membank( TO8_BIOS_BANK )->set_entry( 0 ); + m_cartlobank->configure_entries( 0, 4, mem + 0x10000, 0x4000 ); + m_cartlobank->configure_entries( 4, 2, mem + 0x1f000, 0x4000 ); + m_cartlobank->configure_entries( 6, 2, mem + 0x28000, 0x4000 ); + m_cartlobank->configure_entries( 8, 8, ram + 0x3000, 0x4000 ); + m_carthibank->configure_entries( 0, 4, mem + 0x10000 + 0x1000, 0x4000 ); + m_carthibank->configure_entries( 4, 2, mem + 0x1f000 + 0x1000, 0x4000 ); + m_carthibank->configure_entries( 6, 2, mem + 0x28000 + 0x1000, 0x4000 ); + m_carthibank->configure_entries( 8, 8, ram, 0x4000 ); + m_vrambank->configure_entries( 0, 2, ram, 0x2000 ); + m_syslobank->configure_entry( 0, ram + 0x6000); + m_syshibank->configure_entry( 0, ram + 0x4000); + m_datalobank->configure_entries( 0, 8, ram + 0x2000, 0x4000 ); + m_datahibank->configure_entries( 0, 8, ram + 0x0000, 0x4000 ); + m_biosbank->configure_entries( 0, 2, mem + 0x23000, 0x4000 ); + m_cartlobank->set_entry( 0 ); + m_carthibank->set_entry( 0 ); + m_vrambank->set_entry( 0 ); + m_syslobank->set_entry( 0 ); + m_syshibank->set_entry( 0 ); + m_datalobank->set_entry( 0 ); + m_datahibank->set_entry( 0 ); + m_biosbank->set_entry( 0 ); /* save-state */ save_item(NAME(m_thom_cart_nb_banks)); diff --git a/src/mess/machine/ti99/speech8.c b/src/mess/machine/ti99/speech8.c deleted file mode 100644 index 0cf94706e8e..00000000000 --- a/src/mess/machine/ti99/speech8.c +++ /dev/null @@ -1,163 +0,0 @@ -// license:LGPL-2.1+ -// copyright-holders:Michael Zapf -/**************************************************************************** - - TI-99/8 Speech synthesizer subsystem - - The TI-99/8 contains a speech synthesizer inside the console, so we cannot - reuse the spchsyn implementation of the P-Box speech synthesizer. - Accordingly, this is not a ti_expansion_card_device. - - Michael Zapf - February 2012: Rewritten as class - -*****************************************************************************/ - -#include "speech8.h" -#include "sound/wave.h" -#include "machine/spchrom.h" - -#define TMS5220_ADDRESS_MASK 0x3FFFFUL /* 18-bit mask for tms5220 address */ - -#define VERBOSE 1 -#define LOG logerror - -#define SPEECHSYN_TAG "speechsyn" - -#define REAL_TIMING 0 - -/* - For comments on real timing see ti99/spchsyn.c - - Note that before the REAL_TIMING can be used we must first establish - the set_address logic in mapper8. -*/ -/****************************************************************************/ - -ti998_spsyn_device::ti998_spsyn_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) -: bus8z_device(mconfig, TI99_SPEECH8, "TI-99/8 Speech synthesizer (onboard)", tag, owner, clock, "ti99_speech8", __FILE__), - m_ready(*this) -{ -} - -/* - Memory read -*/ -#if REAL_TIMING -// ====== This is the version with real timing ======= -READ8Z_MEMBER( ti998_spsyn_device::readz ) -{ - m_vsp->wsq_w(TRUE); - m_vsp->rsq_w(FALSE); - *value = m_vsp->read(offset) & 0xff; - if (VERBOSE>4) LOG("speech8: read value = %02x\n", *value); -} - -/* - Memory write -*/ -WRITE8_MEMBER( ti998_spsyn_device::write ) -{ - m_vsp->rsq_w(m_vsp, TRUE); - m_vsp->wsq_w(m_vsp, FALSE); - if (VERBOSE>4) LOG("speech8: write value = %02x\n", data); - m_vsp->write(offset, data); -} - -#else -// ====== This is the version without real timing ======= - -READ8Z_MEMBER( ti998_spsyn_device::readz ) -{ - machine().device("maincpu")->execute().adjust_icount(-(18+3)); /* this is just a minimum, it can be more */ - *value = m_vsp->status_r(space, offset, 0xff) & 0xff; - if (VERBOSE>4) LOG("speech8: read value = %02x\n", *value); -} - -/* - Memory write -*/ -WRITE8_MEMBER( ti998_spsyn_device::write ) -{ - machine().device("maincpu")->execute().adjust_icount(-(54+3)); /* this is just an approx. minimum, it can be much more */ - - /* RN: the stupid design of the tms5220 core means that ready is cleared */ - /* when there are 15 bytes in FIFO. It should be 16. Of course, if */ - /* it were the case, we would need to store the value on the bus, */ - /* which would be more complex. */ - if (!m_vsp->readyq_r()) - { - attotime time_to_ready = attotime::from_double(m_vsp->time_to_ready()); - int cycles_to_ready = machine().device<cpu_device>("maincpu")->attotime_to_cycles(time_to_ready); - if (VERBOSE>8) LOG("speech8: time to ready: %f -> %d\n", time_to_ready.as_double(), (int) cycles_to_ready); - - machine().device("maincpu")->execute().adjust_icount(-cycles_to_ready); - machine().scheduler().timer_set(attotime::zero, FUNC_NULL); - } - if (VERBOSE>4) LOG("speech8: write value = %02x\n", data); - m_vsp->data_w(space, offset, data); -} -#endif - -/**************************************************************************/ - -WRITE_LINE_MEMBER( ti998_spsyn_device::speech8_ready ) -{ - // The TMS5200 implementation uses TRUE/FALSE, not ASSERT/CLEAR semantics - m_ready((state==0)? ASSERT_LINE : CLEAR_LINE); - if (VERBOSE>5) LOG("spchsyn: READY = %d\n", (state==0)); - -#if REAL_TIMING - // Need to do that here (see explanations in spchsyn.c) - if (state==0) - { - m_vsp->rsq_w(TRUE); - m_vsp->wsq_w(TRUE); - } -#endif -} - -void ti998_spsyn_device::device_start() -{ - m_ready.resolve_safe(); - m_vsp = subdevice<tms5220_device>(SPEECHSYN_TAG); - speechrom_device* mem = subdevice<speechrom_device>("vsm"); - mem->set_reverse_bit_order(true); -} - -void ti998_spsyn_device::device_reset() -{ - if (VERBOSE>4) LOG("speech8: reset\n"); -} - -// Unlike the TI-99/4A, the 99/8 uses the CD2501ECD -// The CD2501ECD is a tms5200/cd2501e with the rate control from the tms5220c added in. -// (it's probably actually a tms5220c die with the cd2501e/tms5200 lpc rom masked onto it) -MACHINE_CONFIG_FRAGMENT( ti998_speech ) - MCFG_DEVICE_ADD("vsm", SPEECHROM, 0) - - MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(SPEECHSYN_TAG, CD2501ECD, 640000L) - MCFG_TMS52XX_READYQ_HANDLER(WRITELINE(ti998_spsyn_device, speech8_ready)) - MCFG_TMS52XX_SPEECHROM("vsm") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) -MACHINE_CONFIG_END - -/* Verified on a real machine: TI-99/8 uses the same speech rom contents - as the TI speech synthesizer. */ -ROM_START( ti998_speech ) - ROM_REGION(0x8000, "vsm", 0) - ROM_LOAD("cd2325a.vsm", 0x0000, 0x4000, CRC(1f58b571) SHA1(0ef4f178716b575a1c0c970c56af8a8d97561ffe)) - ROM_LOAD("cd2326a.vsm", 0x4000, 0x4000, CRC(65d00401) SHA1(a367242c2c96cebf0e2bf21862f3f6734b2b3020)) -ROM_END - -machine_config_constructor ti998_spsyn_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( ti998_speech ); -} - -const rom_entry *ti998_spsyn_device::device_rom_region() const -{ - return ROM_NAME( ti998_speech ); -} -const device_type TI99_SPEECH8 = &device_creator<ti998_spsyn_device>; diff --git a/src/mess/machine/ti99/speech8.h b/src/mess/machine/ti99/speech8.h deleted file mode 100644 index 950274826d4..00000000000 --- a/src/mess/machine/ti99/speech8.h +++ /dev/null @@ -1,67 +0,0 @@ -// license:LGPL-2.1+ -// copyright-holders:Michael Zapf -/**************************************************************************** - - TI-99/8 Speech Synthesizer - See speech8.c for documentation - - Michael Zapf - October 2010 - February 2012: Rewritten as class - -*****************************************************************************/ - -#ifndef __TISPEECH8__ -#define __TISPEECH8__ - -#include "emu.h" -#include "ti99defs.h" -#include "sound/tms5220.h" - -extern const device_type TI99_SPEECH8; - -#define MCFG_SPEECH8_READY_CALLBACK(_write) \ - devcb = &ti998_spsyn_device::set_ready_wr_callback(*device, DEVCB_##_write); - -class ti998_spsyn_device : public bus8z_device -{ -public: - ti998_spsyn_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - template<class _Object> static devcb_base &set_ready_wr_callback(device_t &device, _Object object) { return downcast<ti998_spsyn_device &>(device).m_ready.set_callback(object); } - - DECLARE_READ8Z_MEMBER(readz); - DECLARE_WRITE8_MEMBER(write); - - DECLARE_READ8Z_MEMBER(crureadz) { }; - DECLARE_WRITE8_MEMBER(cruwrite) { }; - - DECLARE_WRITE_LINE_MEMBER( speech8_ready ); - - DECLARE_READ8_MEMBER( spchrom_read ); - DECLARE_WRITE8_MEMBER( spchrom_load_address ); - DECLARE_WRITE8_MEMBER( spchrom_read_and_branch ); - -protected: - virtual void device_start(); - virtual void device_reset(void); - virtual const rom_entry *device_rom_region() const; - virtual machine_config_constructor device_mconfig_additions() const; - -private: - tms5220_device *m_vsp; -// UINT8 *m_speechrom; // pointer to speech ROM data -// int m_load_pointer; // which 4-bit nibble will be affected by load address -// int m_rombits_count; // current bit position in ROM -// UINT32 m_sprom_address; // 18 bit pointer in ROM -// UINT32 m_sprom_length; // length of data pointed by speechrom_data, from 0 to 2^18 - - // Ready line to the CPU - devcb_write_line m_ready; -}; - -#define MCFG_TISPEECH8_ADD(_tag, _conf) \ - MCFG_DEVICE_ADD(_tag, TI99_SPEECH8, 0) \ - MCFG_DEVICE_CONFIG(_conf) - -#endif diff --git a/src/mess/machine/vector06.c b/src/mess/machine/vector06.c index b6f4e353fed..ba944cef8fd 100644 --- a/src/mess/machine/vector06.c +++ b/src/mess/machine/vector06.c @@ -15,20 +15,20 @@ READ8_MEMBER( vector06_state::vector06_8255_portb_r ) { UINT8 key = 0xff; - if (BIT(m_keyboard_mask, 0)) key &= ioport("LINE0")->read(); - if (BIT(m_keyboard_mask, 1)) key &= ioport("LINE1")->read(); - if (BIT(m_keyboard_mask, 2)) key &= ioport("LINE2")->read(); - if (BIT(m_keyboard_mask, 3)) key &= ioport("LINE3")->read(); - if (BIT(m_keyboard_mask, 4)) key &= ioport("LINE4")->read(); - if (BIT(m_keyboard_mask, 5)) key &= ioport("LINE5")->read(); - if (BIT(m_keyboard_mask, 6)) key &= ioport("LINE6")->read(); - if (BIT(m_keyboard_mask, 7)) key &= ioport("LINE7")->read(); + if (BIT(m_keyboard_mask, 0)) key &= m_line[0]->read(); + if (BIT(m_keyboard_mask, 1)) key &= m_line[1]->read(); + if (BIT(m_keyboard_mask, 2)) key &= m_line[2]->read(); + if (BIT(m_keyboard_mask, 3)) key &= m_line[3]->read(); + if (BIT(m_keyboard_mask, 4)) key &= m_line[4]->read(); + if (BIT(m_keyboard_mask, 5)) key &= m_line[5]->read(); + if (BIT(m_keyboard_mask, 6)) key &= m_line[6]->read(); + if (BIT(m_keyboard_mask, 7)) key &= m_line[7]->read(); return key; } READ8_MEMBER( vector06_state::vector06_8255_portc_r ) { - UINT8 ret = ioport("LINE8")->read(); + UINT8 ret = m_line[8]->read(); if (m_cassette->input() > 0) ret |= 0x10; @@ -44,7 +44,7 @@ WRITE8_MEMBER( vector06_state::vector06_8255_porta_w ) void vector06_state::vector06_set_video_mode(int width) { rectangle visarea(0, width+64-1, 0, 256+64-1); - machine().first_screen()->configure(width+64, 256+64, visarea, machine().first_screen()->frame_period().attoseconds); + machine().first_screen()->configure(width+64, 256+64, visarea, machine().first_screen()->frame_period().attoseconds()); } WRITE8_MEMBER( vector06_state::vector06_8255_portb_w ) @@ -121,17 +121,17 @@ IRQ_CALLBACK_MEMBER(vector06_state::vector06_irq_callback) TIMER_CALLBACK_MEMBER(vector06_state::reset_check_callback) { - UINT8 val = ioport("RESET")->read(); + UINT8 val = m_reset->read(); if (BIT(val, 0)) { - membank("bank1")->set_base(memregion("maincpu")->base() + 0x10000); + m_bank1->set_base(m_region_maincpu->base() + 0x10000); m_maincpu->reset(); } if (BIT(val, 1)) { - membank("bank1")->set_base(m_ram->pointer() + 0x0000); + m_bank1->set_base(m_ram->pointer() + 0x0000); m_maincpu->reset(); } } @@ -165,15 +165,15 @@ void vector06_state::machine_reset() { address_space &space = m_maincpu->space(AS_PROGRAM); - space.install_read_bank (0x0000, 0x7fff, "bank1"); - space.install_write_bank(0x0000, 0x7fff, "bank2"); - space.install_read_bank (0x8000, 0xffff, "bank3"); - space.install_write_bank(0x8000, 0xffff, "bank4"); + space.install_read_bank (0x0000, 0x7fff, m_bank1); + space.install_write_bank(0x0000, 0x7fff, m_bank2); + space.install_read_bank (0x8000, 0xffff, m_bank3); + space.install_write_bank(0x8000, 0xffff, m_bank4); - membank("bank1")->set_base(memregion("maincpu")->base() + 0x10000); - membank("bank2")->set_base(m_ram->pointer() + 0x0000); - membank("bank3")->set_base(m_ram->pointer() + 0x8000); - membank("bank4")->set_base(m_ram->pointer() + 0x8000); + m_bank1->set_base(m_region_maincpu->base() + 0x10000); + m_bank2->set_base(m_ram->pointer() + 0x0000); + m_bank3->set_base(m_ram->pointer() + 0x8000); + m_bank4->set_base(m_ram->pointer() + 0x8000); m_keyboard_mask = 0; m_color_index = 0; diff --git a/src/mess/machine/z80bin.c b/src/mess/machine/z80bin.c index 05fcbbf1721..ac18c8e7e11 100644 --- a/src/mess/machine/z80bin.c +++ b/src/mess/machine/z80bin.c @@ -8,7 +8,7 @@ memory -------------------------------------------------*/ -int z80bin_load_file(device_image_interface *image, const char *file_type, UINT16 *exec_addr, UINT16 *start_addr, UINT16 *end_addr ) +int z80bin_load_file(device_image_interface *image, address_space &space, const char *file_type, UINT16 *exec_addr, UINT16 *start_addr, UINT16 *end_addr ) { int ch; UINT16 args[3]; @@ -70,7 +70,7 @@ int z80bin_load_file(device_image_interface *image, const char *file_type, UINT1 image->message("%s: Unexpected EOF while writing byte to %04X", pgmname, (unsigned) j); return IMAGE_INIT_FAIL; } - image->device().machine().device("maincpu")->memory().space(AS_PROGRAM).write_byte(j, data); + space.write_byte(j, data); } return IMAGE_INIT_PASS; diff --git a/src/mess/machine/z80bin.h b/src/mess/machine/z80bin.h index 45ea2309682..1690ebffcda 100644 --- a/src/mess/machine/z80bin.h +++ b/src/mess/machine/z80bin.h @@ -13,6 +13,6 @@ #ifndef __Z80_BIN__ #define __Z80_BIN__ -int z80bin_load_file(device_image_interface *image, const char *file_type, UINT16 *exec_addr, UINT16 *start_addr, UINT16 *end_addr ); +int z80bin_load_file(device_image_interface *image, address_space &space, const char *file_type, UINT16 *exec_addr, UINT16 *start_addr, UINT16 *end_addr ); #endif diff --git a/src/mess/video/apple2.c b/src/mess/video/apple2.c index 6f5b31793d3..28fed7e36dc 100644 --- a/src/mess/video/apple2.c +++ b/src/mess/video/apple2.c @@ -615,7 +615,7 @@ UINT32 apple2_state::screen_update_apple2(screen_device &screen, bitmap_ind16 &b UINT32 new_a2; /* calculate the m_flash value */ - m_flash = ((machine().time() * 4).seconds & 1) ? 1 : 0; + m_flash = ((machine().time() * 4).seconds() & 1) ? 1 : 0; /* read out relevant softswitch variables; to see what has changed */ new_a2 = effective_a2(); diff --git a/src/mess/video/aussiebyte.c b/src/mess/video/aussiebyte.c new file mode 100644 index 00000000000..b4e84863db8 --- /dev/null +++ b/src/mess/video/aussiebyte.c @@ -0,0 +1,197 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*********************************************************** + + Video + Graphics not working properly. + Mode 0 - lores (wide, chunky) + Mode 1 - external, *should* be ok + Mode 2 - thin graphics, not explained well enough to code + Mode 3 - alphanumeric, works + + + +************************************************************/ +#include "includes/aussiebyte.h" +/*********************************************************** + + I/O Ports + +************************************************************/ + +// dummy read port, forces requested action to happen +READ8_MEMBER( aussiebyte_state::port33_r ) +{ + return 0xff; +} + +/* +Video control - needs to be fully understood +d0, d1, d2, d3 - can replace RA0-3 in graphics mode +d4 - GS - unknown +d5 - /SRRD - controls write of data to either vram or aram (1=vram, 0=aram) +d6 - /VWR - 0 = enable write vdata to vram, read from aram to vdata ; 1 = enable write to aram from vdata +d7 - OE on port 35 +*/ +WRITE8_MEMBER( aussiebyte_state::port34_w ) +{ + m_port34 = data; +} + +WRITE8_MEMBER( aussiebyte_state::port35_w ) +{ + m_port35 = data; +} + +READ8_MEMBER( aussiebyte_state::port36_r ) +{ + if BIT(m_port34, 5) + { + if BIT(m_p_attribram[m_alpha_address & 0x7ff], 7) + return m_p_videoram[m_alpha_address]; + else + return m_p_videoram[m_graph_address]; + } + else + return m_p_attribram[m_alpha_address & 0x7ff]; +} + +READ8_MEMBER( aussiebyte_state::port37_r ) +{ + return m_crtc->de_r() ? 0xff : 0xfe; +} + + +/*********************************************************** + + Video + +************************************************************/ +MC6845_ON_UPDATE_ADDR_CHANGED( aussiebyte_state::crtc_update_addr ) +{ +/* not sure what goes in here - parameters passed are device, address, strobe */ +// m_video_address = address;// & 0x7ff; +} + +WRITE8_MEMBER( aussiebyte_state::address_w ) +{ + m_crtc->address_w( space, 0, data ); + + m_video_index = data & 0x1f; + + if (m_video_index == 31) + { + m_alpha_address++; + m_alpha_address &= 0x3fff; + m_graph_address = (m_alpha_address << 4) | (m_port34 & 15); + + if BIT(m_port34, 5) + { + if BIT(m_p_attribram[m_alpha_address & 0x7ff], 7) + m_p_videoram[m_alpha_address] = m_port35; + else + m_p_videoram[m_graph_address] = m_port35; + } + else + m_p_attribram[m_alpha_address & 0x7ff] = m_port35; + } +} + +WRITE8_MEMBER( aussiebyte_state::register_w ) +{ + m_crtc->register_w( space, 0, data ); + UINT16 temp = m_alpha_address; + + // Get transparent address + if (m_video_index == 18) + m_alpha_address = (data << 8 ) | (temp & 0xff); + else + if (m_video_index == 19) + m_alpha_address = data | (temp & 0xff00); +} + +UINT8 aussiebyte_state::crt8002(UINT8 ac_ra, UINT8 ac_chr, UINT8 ac_attr, UINT16 ac_cnt, bool ac_curs) +{ + UINT8 gfx = 0; + switch (ac_attr & 3) + { + case 0: // lores gfx + switch (ac_ra) + { + case 0: + case 1: + case 2: + gfx = (BIT(ac_chr, 7) ? 0xf8 : 0) | (BIT(ac_chr, 3) ? 7 : 0); + break; + case 3: + case 4: + case 5: + gfx = (BIT(ac_chr, 6) ? 0xf8 : 0) | (BIT(ac_chr, 2) ? 7 : 0); + break; + case 6: + case 7: + case 8: + gfx = (BIT(ac_chr, 5) ? 0xf8 : 0) | (BIT(ac_chr, 1) ? 7 : 0); + break; + default: + gfx = (BIT(ac_chr, 4) ? 0xf8 : 0) | (BIT(ac_chr, 0) ? 7 : 0); + break; + } + break; + case 1: // external mode + gfx = BITSWAP8(ac_chr, 0,1,2,3,4,5,6,7); + break; + case 2: // thin gfx + break; + case 3: // alpha + gfx = m_p_chargen[((ac_chr & 0x7f)<<4) | ac_ra]; + break; + } + + if (BIT(ac_attr, 3) & (ac_ra == 11)) // underline + gfx = 0xff; + if (BIT(ac_attr, 2) & ((ac_ra == 5) | (ac_ra == 6))) // strike-through + gfx = 0xff; + if (BIT(ac_attr, 6) & BIT(ac_cnt, 13)) // flash + gfx = 0; + if BIT(ac_attr, 5) // blank + gfx = 0; + if (ac_curs & BIT(ac_cnt, 14)) // cursor + gfx ^= 0xff; + if BIT(ac_attr, 4) // reverse video + gfx ^= 0xff; + return gfx; +} + +MC6845_UPDATE_ROW( aussiebyte_state::crtc_update_row ) +{ + const rgb_t *palette = m_palette->palette()->entry_list_raw(); + UINT8 chr,gfx,attr; + UINT16 mem,x; + UINT32 *p = &bitmap.pix32(y); + ra &= 15; + m_cnt++; + + for (x = 0; x < x_count; x++) + { + mem = ma + x; + attr = m_p_attribram[mem & 0x7ff]; + if BIT(attr, 7) + chr = m_p_videoram[mem & 0x3fff]; // alpha + else + chr = m_p_videoram[(mem << 4) | ra]; // gfx + + gfx = crt8002(ra, chr, attr, m_cnt, (x==cursor_x)); + + /* 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)]; + } +} + diff --git a/src/mess/video/mac.c b/src/mess/video/mac.c index baffedf186d..289c62feb57 100644 --- a/src/mess/video/mac.c +++ b/src/mess/video/mac.c @@ -246,7 +246,7 @@ VIDEO_RESET_MEMBER(mac_state,macrbv) view = 0; if (m_montype) { - m_rbv_montype = m_montype->read_safe(2); + m_rbv_montype = m_montype->read(); } else { @@ -308,7 +308,7 @@ VIDEO_RESET_MEMBER(mac_state,macsonora) visarea.min_x = 0; visarea.min_y = 0; - m_rbv_montype = m_montype->read_safe(2); + m_rbv_montype = m_montype ? m_montype->read() : 2; switch (m_rbv_montype) { case 1: // 15" portrait display diff --git a/src/mess/video/nes.c b/src/mess/video/nes.c index 3c898d58b1b..077f4efe3a2 100644 --- a/src/mess/video/nes.c +++ b/src/mess/video/nes.c @@ -42,18 +42,21 @@ UINT32 nes_state::screen_update_nes(screen_device &screen, bitmap_ind16 &bitmap, if ((m_cartslot && m_cartslot->exists() && (m_cartslot->get_pcb_id() == STD_DISKSYS)) // first scenario = disksys in m_cartslot (= famicom) || m_disk) // second scenario = disk via fixed internal disk option (fds & famitwin) { - // latch this input so it doesn't go at warp speed - if ((m_io_disksel->read_safe(0) & 0x01) && (!m_last_frame_flip)) + if (m_io_disksel) { - if (m_disk) - m_disk->disk_flip_side(); - else - m_cartslot->disk_flip_side(); - m_last_frame_flip = 1; + // latch this input so it doesn't go at warp speed + if ((m_io_disksel->read() & 0x01) && (!m_last_frame_flip)) + { + if (m_disk) + m_disk->disk_flip_side(); + else + m_cartslot->disk_flip_side(); + m_last_frame_flip = 1; + } + + if (!(m_io_disksel->read() & 0x01)) + m_last_frame_flip = 0; } - - if (!(m_io_disksel->read_safe(1) & 0x01)) - m_last_frame_flip = 0; } return 0; } diff --git a/src/mess/video/pdp1.c b/src/mess/video/pdp1.c index eea7b521679..2e91b2cadeb 100644 --- a/src/mess/video/pdp1.c +++ b/src/mess/video/pdp1.c @@ -22,7 +22,6 @@ #include "emu.h" #include "cpu/pdp1/pdp1.h" #include "includes/pdp1.h" -#include "video/crt.h" @@ -48,8 +47,6 @@ void pdp1_state::video_start() const rectangle typewriter_bitmap_bounds(0, typewriter_window_width-1, 0, typewriter_window_height-1); m_typewriter_bitmap.fill(pen_typewriter_bg, typewriter_bitmap_bounds); - - m_crt = machine().device<crt_device>("crt"); } diff --git a/src/mess/video/pmd85.c b/src/mess/video/pmd85.c deleted file mode 100644 index 146e7a03e6f..00000000000 --- a/src/mess/video/pmd85.c +++ /dev/null @@ -1,69 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Krzysztof Strzecha -/*************************************************************************** - - pmd85.c - - Functions to emulate the video hardware of PMD-85. - - Krzysztof Strzecha - -***************************************************************************/ - -#include "emu.h" -#include "includes/pmd85.h" - -const unsigned char pmd85_palette[3*3] = -{ - 0x00, 0x00, 0x00, - 0x7f, 0x7f, 0x7f, - 0xff, 0xff, 0xff -}; - -PALETTE_INIT_MEMBER(pmd85_state, pmd85) -{ - int i; - - for ( i = 0; i < sizeof(pmd85_palette) / 3; i++ ) { - m_palette->set_pen_color(i, pmd85_palette[i*3], pmd85_palette[i*3+1], pmd85_palette[i*3+2]); - } -} - -void pmd85_state::video_start() -{ -} - -void pmd85_state::pmd85_draw_scanline(bitmap_ind16 &bitmap, int pmd85_scanline) -{ - int x, i; - int pen0, pen1; - UINT8 data; - - /* set up scanline */ - UINT16 *scanline = &bitmap.pix16(pmd85_scanline); - - /* address of current line in PMD-85 video memory */ - UINT8* pmd85_video_ram_line = m_ram->pointer() + 0xc000 + 0x40*pmd85_scanline; - - for (x=0; x<288; x+=6) - { - data = pmd85_video_ram_line[x/6]; - pen0 = 0; - pen1 = data & 0x80 ? 1 : 2; - - for (i=0; i<6; i++) - scanline[x+i] = (data & (0x01<<i)) ? pen1 : pen0; - - } -} - -UINT32 pmd85_state::screen_update_pmd85(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int pmd85_scanline; - - for (pmd85_scanline=0; pmd85_scanline<256; pmd85_scanline++) - { - pmd85_draw_scanline(bitmap, pmd85_scanline); - } - return 0; -} diff --git a/src/mess/video/ssystem3.c b/src/mess/video/ssystem3.c index b173ae76911..a755dff5a4b 100644 --- a/src/mess/video/ssystem3.c +++ b/src/mess/video/ssystem3.c @@ -18,7 +18,7 @@ void ssystem3_state::ssystem3_lcd_write(int clock, int data) m_lcd.data[m_lcd.count/8]&=~(1<<(m_lcd.count&7)); if (data) m_lcd.data[m_lcd.count/8]|=1<<(m_lcd.count&7); if (m_lcd.count+1==40) { - logerror("%.4x lcd %02x%02x%02x%02x%02x\n",(int)machine().device("maincpu")->safe_pc(), + logerror("%.4x lcd %02x%02x%02x%02x%02x\n",(int)m_maincpu->pc(), m_lcd.data[0], m_lcd.data[1], m_lcd.data[2], m_lcd.data[3], m_lcd.data[4]); } m_lcd.count=(m_lcd.count+1)%40; @@ -204,7 +204,7 @@ UINT32 ssystem3_state::screen_update_ssystem3(screen_device &screen, bitmap_ind1 ssystem3_draw_led(bitmap, m_lcd.data[3]&1?1:0, ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, '3'); ssystem3_draw_led(bitmap, m_lcd.data[4]&1?1:0, ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, '4'); - if (ioport("Configuration")->read()&1) { // playfield(optional device) + if (m_configuration->read() & 1) { // playfield(optional device) static const int lcd_signs_on[]={ 0, // empty 1, // bauer diff --git a/src/mess/video/thomson.c b/src/mess/video/thomson.c index 38e06296b8d..a258bb529da 100644 --- a/src/mess/video/thomson.c +++ b/src/mess/video/thomson.c @@ -32,7 +32,7 @@ int thomson_state::thom_update_screen_size() { const rectangle &visarea = m_screen->visible_area(); - UINT8 p = ioport("vconfig")->read(); + UINT8 p = m_io_vconfig->read(); int new_w, new_h, changed = 0; switch ( p & 3 ) @@ -70,7 +70,7 @@ unsigned thomson_state::thom_video_elapsed() { unsigned u; attotime elapsed = m_thom_video_timer->elapsed(); - u = (elapsed * 1000000 ).seconds; + u = (elapsed * 1000000 ).seconds(); if ( u >= 19968 ) u = 19968; return u; @@ -106,8 +106,8 @@ struct thom_vsignal thomson_state::thom_get_vsignal() void thomson_state::thom_get_lightpen_pos( int*x, int* y ) { - *x = ioport("lightpen_x")->read(); - *y = ioport("lightpen_y")->read(); + *x = m_io_lightpen_x->read(); + *y = m_io_lightpen_y->read(); if ( *x < 0 ) *x = 0; @@ -871,7 +871,7 @@ void thomson_state::thom_set_mode_point( int point ) { assert( point >= 0 && point <= 1 ); m_thom_mode_point = ( ! point ) * 0x2000; - membank( THOM_VRAM_BANK )->set_entry( ! point ); + m_vrambank->set_entry( ! point ); } @@ -1153,7 +1153,7 @@ VIDEO_START_MEMBER( thomson_state, thom ) m_thom_mode_point = 0; save_item(NAME(m_thom_mode_point)); - membank( THOM_VRAM_BANK )->set_entry( 0 ); + m_vrambank->set_entry( 0 ); m_thom_floppy_rcount = 0; m_thom_floppy_wcount = 0; diff --git a/src/mess/video/tx0.c b/src/mess/video/tx0.c index 4da8462a4af..35e105107e7 100644 --- a/src/mess/video/tx0.c +++ b/src/mess/video/tx0.c @@ -36,8 +36,6 @@ void tx0_state::video_start() const rectangle typewriter_bitmap_bounds(0, typewriter_window_width-1, 0, typewriter_window_height-1); m_typewriter_bitmap.fill(pen_typewriter_bg, typewriter_bitmap_bounds); - - m_crt = machine().device<crt_device>("crt"); } diff --git a/src/mess/video/vc4000.c b/src/mess/video/vc4000.c index 315ac46934f..d8ba1ca6f30 100644 --- a/src/mess/video/vc4000.c +++ b/src/mess/video/vc4000.c @@ -321,7 +321,7 @@ WRITE8_MEMBER( vc4000_state::vc4000_video_w ) case 0xc7: // Soundregister m_video.reg.data[offset] = data; - machine().device<vc4000_sound_device>("custom")->soundport_w(0, data); + m_custom->soundport_w(0, data); break; case 0xc8: // Digits 1 and 2 diff --git a/src/osd/modules/debugger/debugqt.c b/src/osd/modules/debugger/debugqt.c index 1819eaa24dd..692e58d6551 100644 --- a/src/osd/modules/debugger/debugqt.c +++ b/src/osd/modules/debugger/debugqt.c @@ -8,7 +8,9 @@ // //============================================================ +#if (!defined(NO_MEM_TRACKING)) #define NO_MEM_TRACKING +#endif #include "debug_module.h" #include "modules/osdmodule.h" @@ -17,7 +19,8 @@ #include <vector> -#include <QtWidgets/QApplication> +#include <QtGui/QtGui> +#include <QtGui/QApplication> #include "emu.h" #include "config.h" diff --git a/src/osd/modules/debugger/osx/debugview.m b/src/osd/modules/debugger/osx/debugview.m index 27f1fd35f22..13a9fbc7e04 100644 --- a/src/osd/modules/debugger/osx/debugview.m +++ b/src/osd/modules/debugger/osx/debugview.m @@ -260,6 +260,7 @@ static void debugwin_view_update(debug_view &view, void *osdprivate) - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; + if (view != NULL) machine->debug_view().free_view(*view); if (font != nil) [font release]; if (text != nil) [text release]; [super dealloc]; diff --git a/src/osd/modules/debugger/osx/debugwindowhandler.m b/src/osd/modules/debugger/osx/debugwindowhandler.m index 5eb5060d462..a8e92bd6f5f 100644 --- a/src/osd/modules/debugger/osx/debugwindowhandler.m +++ b/src/osd/modules/debugger/osx/debugwindowhandler.m @@ -166,7 +166,10 @@ NSString *const MAMEAuxiliaryDebugWindowWillCloseNotification = @"MAMEAuxiliaryD [[NSNotificationCenter defaultCenter] removeObserver:self]; if (window != nil) + { + [window orderOut:self]; [window release]; + } [super dealloc]; } diff --git a/src/osd/modules/debugger/qt/breakpointswindow.c b/src/osd/modules/debugger/qt/breakpointswindow.c index e1d90146b18..d1aea9fbd46 100644 --- a/src/osd/modules/debugger/qt/breakpointswindow.c +++ b/src/osd/modules/debugger/qt/breakpointswindow.c @@ -2,12 +2,6 @@ // copyright-holders:Andrew Gardner #define NO_MEM_TRACKING -#include <QtWidgets/QActionGroup> -#include <QtWidgets/QHBoxLayout> -#include <QtWidgets/QMenu> -#include <QtWidgets/QMenuBar> -#include <QtWidgets/QVBoxLayout> - #include "breakpointswindow.h" #include "debug/debugcon.h" @@ -60,7 +54,7 @@ BreakpointsWindow::BreakpointsWindow(running_machine* machine, QWidget* parent) typeBreak->setShortcut(QKeySequence("Ctrl+1")); typeWatch->setShortcut(QKeySequence("Ctrl+2")); typeBreak->setChecked(true); - connect(typeGroup, &QActionGroup::triggered, this, &BreakpointsWindow::typeChanged); + connect(typeGroup, SIGNAL(triggered(QAction*)), this, SLOT(typeChanged(QAction*))); // Assemble the options menu QMenu* optionsMenu = menuBar()->addMenu("&Options"); diff --git a/src/osd/modules/debugger/qt/breakpointswindow.h b/src/osd/modules/debugger/qt/breakpointswindow.h index 6c4335e334c..9a041f8de07 100644 --- a/src/osd/modules/debugger/qt/breakpointswindow.h +++ b/src/osd/modules/debugger/qt/breakpointswindow.h @@ -3,6 +3,8 @@ #ifndef __DEBUG_QT_BREAK_POINTS_WINDOW_H__ #define __DEBUG_QT_BREAK_POINTS_WINDOW_H__ +#include <QtGui/QtGui> + #include "debuggerview.h" #include "windowqt.h" diff --git a/src/osd/modules/debugger/qt/dasmwindow.c b/src/osd/modules/debugger/qt/dasmwindow.c index 71b92c59ce4..14de9080876 100644 --- a/src/osd/modules/debugger/qt/dasmwindow.c +++ b/src/osd/modules/debugger/qt/dasmwindow.c @@ -2,12 +2,6 @@ // copyright-holders:Andrew Gardner #define NO_MEM_TRACKING -#include <QtWidgets/QHBoxLayout> -#include <QtWidgets/QVBoxLayout> -#include <QtWidgets/QAction> -#include <QtWidgets/QMenu> -#include <QtWidgets/QMenuBar> - #include "dasmwindow.h" #include "debug/debugcon.h" @@ -36,17 +30,17 @@ DasmWindow::DasmWindow(running_machine* machine, QWidget* parent) : // The input edit m_inputEdit = new QLineEdit(topSubFrame); - connect(m_inputEdit, &QLineEdit::returnPressed, this, &DasmWindow::expressionSubmitted); + connect(m_inputEdit, SIGNAL(returnPressed()), this, SLOT(expressionSubmitted())); // The cpu combo box m_cpuComboBox = new QComboBox(topSubFrame); m_cpuComboBox->setObjectName("cpu"); m_cpuComboBox->setMinimumWidth(300); - connect(m_cpuComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &DasmWindow::cpuChanged); + connect(m_cpuComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(cpuChanged(int))); // The main disasm window m_dasmView = new DebuggerView(DVT_DISASSEMBLY, m_machine, this); - connect(m_dasmView, &DebuggerView::updated, this, &DasmWindow::dasmViewUpdated); + connect(m_dasmView, SIGNAL(updated()), this, SLOT(dasmViewUpdated())); // Force a recompute of the disassembly region downcast<debug_view_disasm*>(m_dasmView->view())->set_expression("curpc"); @@ -83,9 +77,9 @@ DasmWindow::DasmWindow(running_machine* machine, QWidget* parent) : m_breakpointToggleAct->setShortcut(Qt::Key_F9); m_breakpointEnableAct->setShortcut(Qt::SHIFT + Qt::Key_F9); m_runToCursorAct->setShortcut(Qt::Key_F4); - connect(m_breakpointToggleAct, &QAction::triggered, this, &DasmWindow::toggleBreakpointAtCursor); - connect(m_breakpointEnableAct, &QAction::triggered, this, &DasmWindow::enableBreakpointAtCursor); - connect(m_runToCursorAct, &QAction::triggered, this, &DasmWindow::runToCursor); + connect(m_breakpointToggleAct, SIGNAL(triggered(bool)), this, SLOT(toggleBreakpointAtCursor(bool))); + connect(m_breakpointEnableAct, SIGNAL(triggered(bool)), this, SLOT(enableBreakpointAtCursor(bool))); + connect(m_runToCursorAct, SIGNAL(triggered(bool)), this, SLOT(runToCursor(bool))); // Right bar options QActionGroup* rightBarGroup = new QActionGroup(this); @@ -103,7 +97,7 @@ DasmWindow::DasmWindow(running_machine* machine, QWidget* parent) : rightActEncrypted->setShortcut(QKeySequence("Ctrl+E")); rightActComments->setShortcut(QKeySequence("Ctrl+C")); rightActRaw->setChecked(true); - connect(rightBarGroup, &QActionGroup::triggered, this, &DasmWindow::rightBarChanged); + connect(rightBarGroup, SIGNAL(triggered(QAction*)), this, SLOT(rightBarChanged(QAction*))); // Assemble the options menu QMenu* optionsMenu = menuBar()->addMenu("&Options"); diff --git a/src/osd/modules/debugger/qt/dasmwindow.h b/src/osd/modules/debugger/qt/dasmwindow.h index 44368c4e11f..9912841603a 100644 --- a/src/osd/modules/debugger/qt/dasmwindow.h +++ b/src/osd/modules/debugger/qt/dasmwindow.h @@ -3,8 +3,7 @@ #ifndef __DEBUG_QT_DASM_WINDOW_H__ #define __DEBUG_QT_DASM_WINDOW_H__ -#include <QtWidgets/QLineEdit> -#include <QtWidgets/QComboBox> +#include <QtGui/QtGui> #include "debuggerview.h" #include "windowqt.h" diff --git a/src/osd/modules/debugger/qt/debuggerview.c b/src/osd/modules/debugger/qt/debuggerview.c index c0cefdda759..d1be4815288 100644 --- a/src/osd/modules/debugger/qt/debuggerview.c +++ b/src/osd/modules/debugger/qt/debuggerview.c @@ -2,11 +2,6 @@ // copyright-holders:Andrew Gardner #define NO_MEM_TRACKING -#include <QtWidgets/QScrollBar> -#include <QtWidgets/QApplication> -#include <QtGui/QPainter> -#include <QtGui/QKeyEvent> - #include "debuggerview.h" #include "modules/lib/osdobj_common.h" @@ -33,10 +28,10 @@ DebuggerView::DebuggerView(const debug_view_type& type, DebuggerView::debuggerViewUpdate, this); - connect(verticalScrollBar(), &QScrollBar::valueChanged, - this, &DebuggerView::verticalScrollSlot); - connect(horizontalScrollBar(), &QScrollBar::valueChanged, - this, &DebuggerView::horizontalScrollSlot); + connect(verticalScrollBar(), SIGNAL(valueChanged(int)), + this, SLOT(verticalScrollSlot(int))); + connect(horizontalScrollBar(), SIGNAL(valueChanged(int)), + this, SLOT(horizontalScrollSlot(int))); } @@ -46,12 +41,127 @@ DebuggerView::~DebuggerView() m_machine->debug_view().free_view(*m_view); } +// TODO: remove this version no later than January 1, 2015 +#if QT_VERSION < QT_VERSION_CHECK(4, 7, 0) +void DebuggerView::paintEvent(QPaintEvent* event) +{ + // Tell the MAME debug view how much real estate is available + QFontMetrics actualFont = fontMetrics(); + const int fontWidth = MAX(1, actualFont.width('_')); + const int fontHeight = MAX(1, actualFont.height()); + m_view->set_visible_size(debug_view_xy(width()/fontWidth, height()/fontHeight)); + + + // Handle the scroll bars + const int horizontalScrollCharDiff = m_view->total_size().x - m_view->visible_size().x; + const int horizontalScrollSize = horizontalScrollCharDiff < 0 ? 0 : horizontalScrollCharDiff; + horizontalScrollBar()->setRange(0, horizontalScrollSize); + + // If the horizontal scroll bar appears, make sure to adjust the vertical scrollbar accordingly + const int verticalScrollAdjust = horizontalScrollSize > 0 ? 1 : 0; + + const int verticalScrollCharDiff = m_view->total_size().y - m_view->visible_size().y; + const int verticalScrollSize = verticalScrollCharDiff < 0 ? 0 : verticalScrollCharDiff+verticalScrollAdjust; + bool atEnd = false; + if (verticalScrollBar()->value() == verticalScrollBar()->maximum()) + { + atEnd = true; + } + verticalScrollBar()->setRange(0, verticalScrollSize); + if (m_preferBottom && atEnd) + { + verticalScrollBar()->setValue(verticalScrollSize); + } + + + // Draw the viewport widget + QPainter painter(viewport()); + painter.fillRect(0, 0, width(), height(), QBrush(Qt::white)); + painter.setBackgroundMode(Qt::OpaqueMode); + painter.setBackground(QColor(255,255,255)); + + // Background control + QBrush bgBrush; + bgBrush.setStyle(Qt::SolidPattern); + painter.setPen(QPen(QColor(0,0,0))); + + size_t viewDataOffset = 0; + const debug_view_xy& visibleCharDims = m_view->visible_size(); + for (int y = 0; y < visibleCharDims.y; y++) + { + for (int x = 0; x < visibleCharDims.x; x++) + { + const unsigned char textAttr = m_view->viewdata()[viewDataOffset].attrib; + + if (x == 0 || textAttr != m_view->viewdata()[viewDataOffset-1].attrib) + { + // Text color handling + QColor fgColor(0,0,0); + QColor bgColor(255,255,255); + + if(textAttr & DCA_VISITED) + { + bgColor.setRgb(0xc6, 0xe2, 0xff); + } + if(textAttr & DCA_ANCILLARY) + { + bgColor.setRgb(0xe0, 0xe0, 0xe0); + } + if(textAttr & DCA_SELECTED) + { + bgColor.setRgb(0xff, 0x80, 0x80); + } + if(textAttr & DCA_CURRENT) + { + bgColor.setRgb(0xff, 0xff, 0x00); + } + if ((textAttr & DCA_SELECTED) && (textAttr & DCA_CURRENT)) + { + bgColor.setRgb(0xff,0xc0,0x80); + } + if(textAttr & DCA_CHANGED) + { + fgColor.setRgb(0xff, 0x00, 0x00); + } + if(textAttr & DCA_INVALID) + { + fgColor.setRgb(0x00, 0x00, 0xff); + } + if(textAttr & DCA_DISABLED) + { + fgColor.setRgb((fgColor.red() + bgColor.red()) >> 1, + (fgColor.green() + bgColor.green()) >> 1, + (fgColor.blue() + bgColor.blue()) >> 1); + } + if(textAttr & DCA_COMMENT) + { + fgColor.setRgb(0x00, 0x80, 0x00); + } + + bgBrush.setColor(bgColor); + painter.setBackground(bgBrush); + painter.setPen(QPen(fgColor)); + } + + // Your character is not guaranteed to take up the entire fontWidth x fontHeight, so fill before. + painter.fillRect(x*fontWidth, y*fontHeight, fontWidth, fontHeight, bgBrush); + + // There is a touchy interplay between font height, drawing difference, visible position, etc + // Fonts don't get drawn "down and to the left" like boxes, so some wiggling is needed. + painter.drawText(x*fontWidth, + (y*fontHeight + (fontHeight*0.80)), + QString(m_view->viewdata()[viewDataOffset].byte)); + viewDataOffset++; + } + } +} +#else void DebuggerView::paintEvent(QPaintEvent* event) { // Tell the MAME debug view how much real estate is available QFontMetrics actualFont = fontMetrics(); const double fontWidth = actualFont.width(QString(100, '_')) / 100.; - const int fontHeight = MAX(1, actualFont.lineSpacing()); + const int fontHeight = MAX(1, actualFont.height()); m_view->set_visible_size(debug_view_xy(width()/fontWidth, height()/fontHeight)); @@ -162,6 +272,7 @@ void DebuggerView::paintEvent(QPaintEvent* event) } } } +#endif void DebuggerView::keyPressEvent(QKeyEvent* event) { diff --git a/src/osd/modules/debugger/qt/debuggerview.h b/src/osd/modules/debugger/qt/debuggerview.h index 7b1aed6fd2c..e064b86e9c1 100644 --- a/src/osd/modules/debugger/qt/debuggerview.h +++ b/src/osd/modules/debugger/qt/debuggerview.h @@ -3,7 +3,7 @@ #ifndef __DEBUG_QT_DEBUGGER_VIEW_H__ #define __DEBUG_QT_DEBUGGER_VIEW_H__ -#include <QtWidgets/QAbstractScrollArea> +#include <QtGui/QtGui> #include "debug/debugvw.h" diff --git a/src/osd/modules/debugger/qt/deviceinformationwindow.c b/src/osd/modules/debugger/qt/deviceinformationwindow.c index ca6913f0b06..303dc650b70 100644 --- a/src/osd/modules/debugger/qt/deviceinformationwindow.c +++ b/src/osd/modules/debugger/qt/deviceinformationwindow.c @@ -2,10 +2,6 @@ // copyright-holders:Andrew Gardner #define NO_MEM_TRACKING -#include <QtWidgets/QFrame> -#include <QtWidgets/QLabel> -#include <QtWidgets/QVBoxLayout> - #include "deviceinformationwindow.h" diff --git a/src/osd/modules/debugger/qt/deviceinformationwindow.h b/src/osd/modules/debugger/qt/deviceinformationwindow.h index b0d9898488a..6ea38de60c3 100644 --- a/src/osd/modules/debugger/qt/deviceinformationwindow.h +++ b/src/osd/modules/debugger/qt/deviceinformationwindow.h @@ -3,6 +3,8 @@ #ifndef __DEBUG_QT_DEVICE_INFORMATION_WINDOW_H__ #define __DEBUG_QT_DEVICE_INFORMATION_WINDOW_H__ +#include <QtGui/QtGui> + #include "windowqt.h" //============================================================ diff --git a/src/osd/modules/debugger/qt/deviceswindow.c b/src/osd/modules/debugger/qt/deviceswindow.c index 75d84f4bc7e..0a71fd8fbdf 100644 --- a/src/osd/modules/debugger/qt/deviceswindow.c +++ b/src/osd/modules/debugger/qt/deviceswindow.c @@ -128,8 +128,8 @@ DevicesWindow::DevicesWindow(running_machine* machine, QWidget* parent) : m_devices_view->setModel(&m_devices_model); m_devices_view->expandAll(); m_devices_view->resizeColumnToContents(0); - connect(m_devices_view->selectionModel(), &QItemSelectionModel::currentRowChanged, this, &DevicesWindow::currentRowChanged); - connect(m_devices_view, &QTreeView::activated, this, &DevicesWindow::activated); + connect(m_devices_view->selectionModel(), SIGNAL(currentRowChanged(const QModelIndex &,const QModelIndex &)), this, SLOT(currentRowChanged(const QModelIndex &,const QModelIndex &))); + connect(m_devices_view, SIGNAL(activated(const QModelIndex &)), this, SLOT(activated(const QModelIndex &))); setCentralWidget(m_devices_view); } diff --git a/src/osd/modules/debugger/qt/deviceswindow.h b/src/osd/modules/debugger/qt/deviceswindow.h index 13965b9dce5..614dd11edde 100644 --- a/src/osd/modules/debugger/qt/deviceswindow.h +++ b/src/osd/modules/debugger/qt/deviceswindow.h @@ -3,7 +3,7 @@ #ifndef __DEBUG_QT_DEVICES_WINDOW_H__ #define __DEBUG_QT_DEVICES_WINDOW_H__ -#include <QtWidgets/QTreeView> +#include <QtGui/QtGui> #include "windowqt.h" diff --git a/src/osd/modules/debugger/qt/logwindow.c b/src/osd/modules/debugger/qt/logwindow.c index 38cb33d0f0b..95b379f9c28 100644 --- a/src/osd/modules/debugger/qt/logwindow.c +++ b/src/osd/modules/debugger/qt/logwindow.c @@ -2,8 +2,6 @@ // copyright-holders:Andrew Gardner #define NO_MEM_TRACKING -#include <QtWidgets/QVBoxLayout> - #include "logwindow.h" #include "debug/debugcon.h" diff --git a/src/osd/modules/debugger/qt/logwindow.h b/src/osd/modules/debugger/qt/logwindow.h index a406cfb8eb3..97aa81c41a1 100644 --- a/src/osd/modules/debugger/qt/logwindow.h +++ b/src/osd/modules/debugger/qt/logwindow.h @@ -3,6 +3,8 @@ #ifndef __DEBUG_QT_LOG_WINDOW_H__ #define __DEBUG_QT_LOG_WINDOW_H__ +#include <QtGui/QtGui> + #include "debuggerview.h" #include "windowqt.h" diff --git a/src/osd/modules/debugger/qt/mainwindow.c b/src/osd/modules/debugger/qt/mainwindow.c index 12b6a09dd77..bb4db219912 100644 --- a/src/osd/modules/debugger/qt/mainwindow.c +++ b/src/osd/modules/debugger/qt/mainwindow.c @@ -2,14 +2,6 @@ // copyright-holders:Andrew Gardner #define NO_MEM_TRACKING -#include <QtWidgets/QAction> -#include <QtWidgets/QMenu> -#include <QtWidgets/QMenuBar> -#include <QtWidgets/QDockWidget> -#include <QtWidgets/QScrollBar> -#include <QtWidgets/QFileDialog> -#include <QtGui/QCloseEvent> - #include "mainwindow.h" #include "debug/debugcon.h" @@ -31,7 +23,7 @@ MainWindow::MainWindow(running_machine* machine, QWidget* parent) : // The input line m_inputEdit = new QLineEdit(mainWindowFrame); - connect(m_inputEdit, &QLineEdit::returnPressed, this, &MainWindow::executeCommandSlot); + connect(m_inputEdit, SIGNAL(returnPressed()), this, SLOT(executeCommand())); m_inputEdit->installEventFilter(this); @@ -60,9 +52,9 @@ MainWindow::MainWindow(running_machine* machine, QWidget* parent) : m_breakpointToggleAct->setShortcut(Qt::Key_F9); m_breakpointEnableAct->setShortcut(Qt::SHIFT + Qt::Key_F9); m_runToCursorAct->setShortcut(Qt::Key_F4); - connect(m_breakpointToggleAct, &QAction::triggered, this, &MainWindow::toggleBreakpointAtCursor); - connect(m_breakpointEnableAct, &QAction::triggered, this, &MainWindow::enableBreakpointAtCursor); - connect(m_runToCursorAct, &QAction::triggered, this, &MainWindow::runToCursor); + connect(m_breakpointToggleAct, SIGNAL(triggered(bool)), this, SLOT(toggleBreakpointAtCursor(bool))); + connect(m_breakpointEnableAct, SIGNAL(triggered(bool)), this, SLOT(enableBreakpointAtCursor(bool))); + connect(m_runToCursorAct, SIGNAL(triggered(bool)), this, SLOT(runToCursor(bool))); // Right bar options QActionGroup* rightBarGroup = new QActionGroup(this); @@ -80,7 +72,7 @@ MainWindow::MainWindow(running_machine* machine, QWidget* parent) : rightActEncrypted->setShortcut(QKeySequence("Ctrl+E")); rightActComments->setShortcut(QKeySequence("Ctrl+C")); rightActRaw->setChecked(true); - connect(rightBarGroup, &QActionGroup::triggered, this, &MainWindow::rightBarChanged); + connect(rightBarGroup, SIGNAL(triggered(QAction*)), this, SLOT(rightBarChanged(QAction*))); // Assemble the options menu QMenu* optionsMenu = menuBar()->addMenu("&Options"); @@ -123,7 +115,7 @@ MainWindow::MainWindow(running_machine* machine, QWidget* parent) : dasmDock->setAllowedAreas(Qt::TopDockWidgetArea); m_dasmFrame = new DasmDockWidget(m_machine, dasmDock); dasmDock->setWidget(m_dasmFrame); - connect(m_dasmFrame->view(), &DebuggerView::updated, this, &MainWindow::dasmViewUpdated); + connect(m_dasmFrame->view(), SIGNAL(updated()), this, SLOT(dasmViewUpdated())); addDockWidget(Qt::TopDockWidgetArea, dasmDock); dockMenu->addAction(dasmDock->toggleViewAction()); @@ -308,10 +300,6 @@ void MainWindow::rightBarChanged(QAction* changedTo) m_dasmFrame->view()->viewport()->update(); } -void MainWindow::executeCommandSlot() -{ - executeCommand(true); -} void MainWindow::executeCommand(bool withClear) { @@ -489,8 +477,8 @@ void MainWindow::createImagesMenu() mountAct->setData(QVariant(interfaceIndex)); unmountAct->setObjectName("unmount"); unmountAct->setData(QVariant(interfaceIndex)); - connect(mountAct, &QAction::triggered, this, &MainWindow::mountImage); - connect(unmountAct, &QAction::triggered, this, &MainWindow::unmountImage); + connect(mountAct, SIGNAL(triggered(bool)), this, SLOT(mountImage(bool))); + connect(unmountAct, SIGNAL(triggered(bool)), this, SLOT(unmountImage(bool))); if (!img->exists()) unmountAct->setEnabled(false); diff --git a/src/osd/modules/debugger/qt/mainwindow.h b/src/osd/modules/debugger/qt/mainwindow.h index 4a93608772f..53a9969baa2 100644 --- a/src/osd/modules/debugger/qt/mainwindow.h +++ b/src/osd/modules/debugger/qt/mainwindow.h @@ -3,12 +3,9 @@ #ifndef __DEBUG_QT_MAIN_WINDOW_H__ #define __DEBUG_QT_MAIN_WINDOW_H__ +#include <QtGui/QtGui> #include <vector> -#include <QtWidgets/QLineEdit> -#include <QtWidgets/QVBoxLayout> -#include <QtWidgets/QComboBox> - #include "debug/dvdisasm.h" #include "debuggerview.h" @@ -46,7 +43,7 @@ private slots: void runToCursor(bool changedTo); void rightBarChanged(QAction* changedTo); - void executeCommandSlot(); + void executeCommand(bool withClear=true); void mountImage(bool changedTo); void unmountImage(bool changedTo); @@ -75,7 +72,6 @@ private: int m_historyIndex; std::vector<QString> m_inputHistory; void addToHistory(const QString& command); - void executeCommand(bool withClear); }; diff --git a/src/osd/modules/debugger/qt/memorywindow.c b/src/osd/modules/debugger/qt/memorywindow.c index 90b7f703472..3aee20a0cd0 100644 --- a/src/osd/modules/debugger/qt/memorywindow.c +++ b/src/osd/modules/debugger/qt/memorywindow.c @@ -2,17 +2,6 @@ // copyright-holders:Andrew Gardner #define NO_MEM_TRACKING -#include <QtGui/QClipboard> -#include <QtGui/QMouseEvent> -#include <QtWidgets/QActionGroup> -#include <QtWidgets/QApplication> -#include <QtWidgets/QHBoxLayout> -#include <QtWidgets/QMenu> -#include <QtWidgets/QMenuBar> -#include <QtWidgets/QScrollBar> -#include <QtWidgets/QToolTip> -#include <QtWidgets/QVBoxLayout> - #include "memorywindow.h" #include "debug/dvmemory.h" @@ -41,13 +30,13 @@ MemoryWindow::MemoryWindow(running_machine* machine, QWidget* parent) : // The input edit m_inputEdit = new QLineEdit(topSubFrame); - connect(m_inputEdit, &QLineEdit::returnPressed, this, &MemoryWindow::expressionSubmitted); + connect(m_inputEdit, SIGNAL(returnPressed()), this, SLOT(expressionSubmitted())); // The memory space combo box m_memoryComboBox = new QComboBox(topSubFrame); m_memoryComboBox->setObjectName("memoryregion"); m_memoryComboBox->setMinimumWidth(300); - connect(m_memoryComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &MemoryWindow::memoryRegionChanged); + connect(m_memoryComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(memoryRegionChanged(int))); // The main memory window m_memTable = new DebuggerMemView(DVT_MEMORY, m_machine, this); @@ -89,7 +78,7 @@ MemoryWindow::MemoryWindow(running_machine* machine, QWidget* parent) : chunkActTwo->setShortcut(QKeySequence("Ctrl+2")); chunkActFour->setShortcut(QKeySequence("Ctrl+4")); chunkActOne->setChecked(true); - connect(chunkGroup, &QActionGroup::triggered, this, &MemoryWindow::chunkChanged); + connect(chunkGroup, SIGNAL(triggered(QAction*)), this, SLOT(chunkChanged(QAction*))); // Create a address display group QActionGroup* addressGroup = new QActionGroup(this); @@ -103,22 +92,22 @@ MemoryWindow::MemoryWindow(running_machine* machine, QWidget* parent) : addressActLogical->setShortcut(QKeySequence("Ctrl+G")); addressActPhysical->setShortcut(QKeySequence("Ctrl+Y")); addressActLogical->setChecked(true); - connect(addressGroup, &QActionGroup::triggered, this, &MemoryWindow::addressChanged); + connect(addressGroup, SIGNAL(triggered(QAction*)), this, SLOT(addressChanged(QAction*))); // Create a reverse view radio QAction* reverseAct = new QAction("Reverse View", this); reverseAct->setObjectName("reverse"); reverseAct->setCheckable(true); reverseAct->setShortcut(QKeySequence("Ctrl+R")); - connect(reverseAct, &QAction::toggled, this, &MemoryWindow::reverseChanged); + connect(reverseAct, SIGNAL(toggled(bool)), this, SLOT(reverseChanged(bool))); // Create increase and decrease bytes-per-line actions QAction* increaseBplAct = new QAction("Increase Bytes Per Line", this); QAction* decreaseBplAct = new QAction("Decrease Bytes Per Line", this); increaseBplAct->setShortcut(QKeySequence("Ctrl+P")); decreaseBplAct->setShortcut(QKeySequence("Ctrl+O")); - connect(increaseBplAct, &QAction::triggered, this, &MemoryWindow::increaseBytesPerLine); - connect(decreaseBplAct, &QAction::triggered, this, &MemoryWindow::decreaseBytesPerLine); + connect(increaseBplAct, SIGNAL(triggered(bool)), this, SLOT(increaseBytesPerLine(bool))); + connect(decreaseBplAct, SIGNAL(triggered(bool)), this, SLOT(decreaseBytesPerLine(bool))); // Assemble the options menu QMenu* optionsMenu = menuBar()->addMenu("&Options"); diff --git a/src/osd/modules/debugger/qt/memorywindow.h b/src/osd/modules/debugger/qt/memorywindow.h index f8c18d0fb32..5233c619d19 100644 --- a/src/osd/modules/debugger/qt/memorywindow.h +++ b/src/osd/modules/debugger/qt/memorywindow.h @@ -3,8 +3,7 @@ #ifndef __DEBUG_QT_MEMORY_WINDOW_H__ #define __DEBUG_QT_MEMORY_WINDOW_H__ -#include <QtWidgets/QLineEdit> -#include <QtWidgets/QComboBox> +#include <QtGui/QtGui> #include "debuggerview.h" #include "windowqt.h" diff --git a/src/osd/modules/debugger/qt/windowqt.c b/src/osd/modules/debugger/qt/windowqt.c index 01b4983ec06..e455e586b00 100644 --- a/src/osd/modules/debugger/qt/windowqt.c +++ b/src/osd/modules/debugger/qt/windowqt.c @@ -2,9 +2,6 @@ // copyright-holders:Andrew Gardner #define NO_MEM_TRACKING -#include <QtWidgets/QMenu> -#include <QtWidgets/QMenuBar> - #include "windowqt.h" #include "logwindow.h" #include "dasmwindow.h" @@ -30,71 +27,71 @@ WindowQt::WindowQt(running_machine* machine, QWidget* parent) : // The Debug menu bar QAction* debugActOpenMemory = new QAction("New &Memory Window", this); debugActOpenMemory->setShortcut(QKeySequence("Ctrl+M")); - connect(debugActOpenMemory, &QAction::triggered, this, &WindowQt::debugActOpenMemory); + connect(debugActOpenMemory, SIGNAL(triggered()), this, SLOT(debugActOpenMemory())); QAction* debugActOpenDasm = new QAction("New &Dasm Window", this); debugActOpenDasm->setShortcut(QKeySequence("Ctrl+D")); - connect(debugActOpenDasm, &QAction::triggered, this, &WindowQt::debugActOpenDasm); + connect(debugActOpenDasm, SIGNAL(triggered()), this, SLOT(debugActOpenDasm())); QAction* debugActOpenLog = new QAction("New &Log Window", this); debugActOpenLog->setShortcut(QKeySequence("Ctrl+L")); - connect(debugActOpenLog, &QAction::triggered, this, &WindowQt::debugActOpenLog); + connect(debugActOpenLog, SIGNAL(triggered()), this, SLOT(debugActOpenLog())); QAction* debugActOpenPoints = new QAction("New &Break|Watchpoints Window", this); debugActOpenPoints->setShortcut(QKeySequence("Ctrl+B")); - connect(debugActOpenPoints, &QAction::triggered, this, &WindowQt::debugActOpenPoints); + connect(debugActOpenPoints, SIGNAL(triggered()), this, SLOT(debugActOpenPoints())); QAction* debugActOpenDevices = new QAction("New D&evices Window", this); debugActOpenDevices->setShortcut(QKeySequence("Shift+Ctrl+D")); - connect(debugActOpenDevices, &QAction::triggered, this, &WindowQt::debugActOpenDevices); + connect(debugActOpenDevices, SIGNAL(triggered()), this, SLOT(debugActOpenDevices())); QAction* dbgActRun = new QAction("Run", this); dbgActRun->setShortcut(Qt::Key_F5); - connect(dbgActRun, &QAction::triggered, this, &WindowQt::debugActRun); + connect(dbgActRun, SIGNAL(triggered()), this, SLOT(debugActRun())); QAction* dbgActRunAndHide = new QAction("Run And Hide Debugger", this); dbgActRunAndHide->setShortcut(Qt::Key_F12); - connect(dbgActRunAndHide, &QAction::triggered, this, &WindowQt::debugActRunAndHide); + connect(dbgActRunAndHide, SIGNAL(triggered()), this, SLOT(debugActRunAndHide())); QAction* dbgActRunToNextCpu = new QAction("Run to Next CPU", this); dbgActRunToNextCpu->setShortcut(Qt::Key_F6); - connect(dbgActRunToNextCpu, &QAction::triggered, this, &WindowQt::debugActRunToNextCpu); + connect(dbgActRunToNextCpu, SIGNAL(triggered()), this, SLOT(debugActRunToNextCpu())); QAction* dbgActRunNextInt = new QAction("Run to Next Interrupt on This CPU", this); dbgActRunNextInt->setShortcut(Qt::Key_F7); - connect(dbgActRunNextInt, &QAction::triggered, this, &WindowQt::debugActRunNextInt); + connect(dbgActRunNextInt, SIGNAL(triggered()), this, SLOT(debugActRunNextInt())); QAction* dbgActRunNextVBlank = new QAction("Run to Next VBlank", this); dbgActRunNextVBlank->setShortcut(Qt::Key_F8); - connect(dbgActRunNextVBlank, &QAction::triggered, this, &WindowQt::debugActRunNextVBlank); + connect(dbgActRunNextVBlank, SIGNAL(triggered()), this, SLOT(debugActRunNextVBlank())); QAction* dbgActStepInto = new QAction("Step Into", this); dbgActStepInto->setShortcut(Qt::Key_F11); - connect(dbgActStepInto, &QAction::triggered, this, &WindowQt::debugActStepInto); + connect(dbgActStepInto, SIGNAL(triggered()), this, SLOT(debugActStepInto())); QAction* dbgActStepOver = new QAction("Step Over", this); dbgActStepOver->setShortcut(Qt::Key_F10); - connect(dbgActStepOver, &QAction::triggered, this, &WindowQt::debugActStepOver); + connect(dbgActStepOver, SIGNAL(triggered()), this, SLOT(debugActStepOver())); QAction* dbgActStepOut = new QAction("Step Out", this); dbgActStepOut->setShortcut(QKeySequence("Shift+F11")); - connect(dbgActStepOut, &QAction::triggered, this, &WindowQt::debugActStepOut); + connect(dbgActStepOut, SIGNAL(triggered()), this, SLOT(debugActStepOut())); QAction* dbgActSoftReset = new QAction("Soft Reset", this); dbgActSoftReset->setShortcut(Qt::Key_F3); - connect(dbgActSoftReset, &QAction::triggered, this, &WindowQt::debugActSoftReset); + connect(dbgActSoftReset, SIGNAL(triggered()), this, SLOT(debugActSoftReset())); QAction* dbgActHardReset = new QAction("Hard Reset", this); dbgActHardReset->setShortcut(QKeySequence("Shift+F3")); - connect(dbgActHardReset, &QAction::triggered, this, &WindowQt::debugActHardReset); + connect(dbgActHardReset, SIGNAL(triggered()), this, SLOT(debugActHardReset())); QAction* dbgActClose = new QAction("Close &Window", this); dbgActClose->setShortcut(QKeySequence::Close); - connect(dbgActClose, &QAction::triggered, this, &WindowQt::debugActClose); + connect(dbgActClose, SIGNAL(triggered()), this, SLOT(debugActClose())); QAction* dbgActQuit = new QAction("&Quit", this); dbgActQuit->setShortcut(QKeySequence::Quit); - connect(dbgActQuit, &QAction::triggered, this, &WindowQt::debugActQuit); + connect(dbgActQuit, SIGNAL(triggered()), this, SLOT(debugActQuit())); // Construct the menu QMenu* debugMenu = menuBar()->addMenu("&Debug"); diff --git a/src/osd/modules/debugger/qt/windowqt.h b/src/osd/modules/debugger/qt/windowqt.h index e2e334792b2..5b16b47463f 100644 --- a/src/osd/modules/debugger/qt/windowqt.h +++ b/src/osd/modules/debugger/qt/windowqt.h @@ -3,7 +3,7 @@ #ifndef __DEBUG_QT_WINDOW_QT_H__ #define __DEBUG_QT_WINDOW_QT_H__ -#include <QtWidgets/QMainWindow> +#include <QtGui/QtGui> #include "emu.h" #include "config.h" diff --git a/src/osd/modules/debugger/win/debugviewinfo.c b/src/osd/modules/debugger/win/debugviewinfo.c index f3c12a09f2e..b4868800692 100644 --- a/src/osd/modules/debugger/win/debugviewinfo.c +++ b/src/osd/modules/debugger/win/debugviewinfo.c @@ -68,9 +68,6 @@ debugview_info::debugview_info(debugger_windows_interface &debugger, debugwin_in return; cleanup: - if (m_view != NULL) - machine().debug_view().free_view(*m_view); - m_view = NULL; if (m_hscroll != NULL) DestroyWindow(m_hscroll); m_hscroll = NULL; @@ -80,15 +77,18 @@ cleanup: if (m_wnd != NULL) DestroyWindow(m_wnd); m_wnd = NULL; + if (m_view != NULL) + machine().debug_view().free_view(*m_view); + m_view = NULL; } debugview_info::~debugview_info() { - if (m_view) - machine().debug_view().free_view(*m_view); if (m_wnd != NULL) DestroyWindow(m_wnd); + if (m_view) + machine().debug_view().free_view(*m_view); } diff --git a/src/osd/modules/render/d3d/d3dhlsl.c b/src/osd/modules/render/d3d/d3dhlsl.c index 1f244bf2184..ec52cd4abc4 100644 --- a/src/osd/modules/render/d3d/d3dhlsl.c +++ b/src/osd/modules/render/d3d/d3dhlsl.c @@ -523,7 +523,7 @@ void shaders::begin_avi_recording(const char *name) // build up information about this new movie avi_movie_info info; info.video_format = 0; - info.video_timescale = 1000 * ((machine->first_screen() != NULL) ? ATTOSECONDS_TO_HZ(machine->first_screen()->frame_period().attoseconds) : screen_device::DEFAULT_FRAME_RATE); + info.video_timescale = 1000 * ((machine->first_screen() != NULL) ? ATTOSECONDS_TO_HZ(machine->first_screen()->frame_period().m_attoseconds) : screen_device::DEFAULT_FRAME_RATE); info.video_sampletime = 1000; info.video_numsamples = 0; info.video_width = snap_width; diff --git a/src/osd/osdmini/minifile.c b/src/osd/osdmini/minifile.c index 86b816d3ce2..52ddc3a2503 100644 --- a/src/osd/osdmini/minifile.c +++ b/src/osd/osdmini/minifile.c @@ -8,6 +8,7 @@ #include "osdcore.h" #include <stdlib.h> +#include <unistd.h> //============================================================ diff --git a/src/tools/nltool.c b/src/tools/nltool.c index 5b6ff343b94..ed9473efc02 100644 --- a/src/tools/nltool.c +++ b/src/tools/nltool.c @@ -155,7 +155,7 @@ pstring filetobuf(pstring fname) else { FILE *f; - f = fopen(fname, "rb"); + f = fopen(fname.cstr(), "rb"); fseek(f, 0, SEEK_END); long fsize = ftell(f); fseek(f, 0, SEEK_SET); @@ -192,11 +192,11 @@ public: m_setup->init(); } - void read_netlist(const char *buffer, pstring name) + void read_netlist(const pstring &filename, const pstring &name) { // read the netlist ... - m_setup->register_source(palloc(netlist::netlist_source_mem_t(buffer))); + m_setup->register_source(palloc(netlist::source_file_t(filename))); m_setup->include(name); log_setup(); @@ -267,11 +267,8 @@ void usage(tool_options_t &opts) struct input_t { - netlist::netlist_time m_time; - netlist::param_t *m_param; - double m_value; - input_t() + : m_param(NULL), m_value(0.0) { } input_t(netlist::netlist_t *netlist, const pstring &line) @@ -280,7 +277,7 @@ struct input_t double t; int e = sscanf(line.cstr(), "%lf,%[^,],%lf", &t, buf, &m_value); if ( e!= 3) - throw netlist::fatalerror_e("error %d scanning line %s\n", e, line.cstr()); + throw netlist::fatalerror_e(pformat("error %1 scanning line %2\n")(e)(line)); m_time = netlist::netlist_time::from_double(t); m_param = netlist->setup().find_param(buf, true); } @@ -291,7 +288,7 @@ struct input_t { case netlist::param_t::MODEL: case netlist::param_t::STRING: - throw netlist::fatalerror_e("param %s is not numeric\n", m_param->name().cstr()); + throw netlist::fatalerror_e(pformat("param %1 is not numeric\n")(m_param->name())); case netlist::param_t::DOUBLE: static_cast<netlist::param_double_t*>(m_param)->setTo(m_value); break; @@ -303,6 +300,11 @@ struct input_t break; } } + + netlist::netlist_time m_time; + netlist::param_t *m_param; + double m_value; + }; plist_t<input_t> *read_input(netlist::netlist_t *netlist, pstring fname) @@ -310,10 +312,10 @@ plist_t<input_t> *read_input(netlist::netlist_t *netlist, pstring fname) plist_t<input_t> *ret = palloc(plist_t<input_t>()); if (fname != "") { - pstring_list_t lines(filetobuf(fname) , "\n"); - for (unsigned i=0; i<lines.size(); i++) + pifilestream f(fname); + pstring l; + while (f.readline(l)) { - pstring l = lines[i].trim(); if (l != "") { input_t inp(netlist, l); @@ -331,7 +333,7 @@ static void run(tool_options_t &opts) nt.m_opts = &opts; nt.init(); - nt.read_netlist(filetobuf(opts.opt_file()), opts.opt_name()); + nt.read_netlist(opts.opt_file(), opts.opt_name()); plist_t<input_t> *inps = read_input(&nt, opts.opt_inp()); @@ -378,12 +380,11 @@ static void listdevices() for (int i=0; i < list.size(); i++) { netlist::base_factory_t *f = list.value_at(i); - pstring out = pstring::sprintf("%-20s %s(<id>", f->classname().cstr(), - f->name().cstr() ); + pstring out = pformat("%1 %2(<id>")(f->classname(),"-20")(f->name()); pstring terms(""); netlist::device_t *d = f->Create(); - d->init(nt, pstring::sprintf("dummy%d", i)); + d->init(nt, pformat("dummy%1")(i)); d->start_dev(); // get the list of terminals ... diff --git a/src/tools/nlwav.c b/src/tools/nlwav.c index cc6a5988e3e..8f9c57c7ac5 100644 --- a/src/tools/nlwav.c +++ b/src/tools/nlwav.c @@ -3,6 +3,7 @@ #include "plib/poptions.h" #include "plib/pstring.h" #include "plib/plists.h" +#include "plib/pstream.h" #include "nl_setup.h" class nlwav_options_t : public poptions @@ -46,15 +47,13 @@ public: class wav_t { public: - wav_t(const pstring &fn, unsigned sr) + wav_t(postream &strm, unsigned sr) : m_f(strm) { - m_f = std::fopen(fn.cstr(),"w"); - if (m_f==NULL) - throw netlist::fatalerror_e("Error opening output file: %s", fn.cstr()); +// m_f = strm; initialize(sr); - std::fwrite(&m_fh, sizeof(m_fh), 1, m_f); - std::fwrite(&m_fmt, sizeof(m_fmt), 1, m_f); - std::fwrite(&m_data, sizeof(m_data), 1, m_f); + m_f.write(&m_fh, sizeof(m_fh)); + m_f.write(&m_fmt, sizeof(m_fmt)); + m_f.write(&m_data, sizeof(m_data)); } ~wav_t() { @@ -68,24 +67,17 @@ public: { m_data.len += m_fmt.block_align; short ps = sample; /* 16 bit sample, FIXME: powerpc? */ - std::fwrite(&ps, sizeof(ps), 1, m_f); + m_f.write(&ps, sizeof(ps)); } void close() { - if (m_f != NULL) - { - std::fseek(m_f, 0, SEEK_SET); - std::fwrite(&m_fh, sizeof(m_fh), 1, m_f); - std::fwrite(&m_fmt, sizeof(m_fmt), 1, m_f); - - //data.len = fmt.block_align * n; - std::fwrite(&m_data, sizeof(m_data), 1, m_f); + m_f.seek(0); + m_f.write(&m_fh, sizeof(m_fh)); + m_f.write(&m_fmt, sizeof(m_fmt)); - - std::fclose(m_f); - m_f = NULL; - } + //data.len = fmt.block_align * n; + m_f.write(&m_data, sizeof(m_data)); } private: struct riff_chunk_t @@ -138,17 +130,22 @@ private: riff_format_t m_fmt; riff_data_t m_data; - FILE *m_f; + postream &m_f; }; void convert(nlwav_options_t &opts) { - wav_t wo(opts.opt_out(), 48000); + pofilestream fo(opts.opt_out()); + if (fo.bad()) + { + throw netlist::fatalerror_e("Error opening output file: " + opts.opt_out()); + } + wav_t wo(fo, 48000); - FILE *FIN = std::fopen(opts.opt_inp(),"r"); - if (FIN==NULL) - throw netlist::fatalerror_e("Error opening input file: %s", opts.opt_inp().cstr()); + pifilestream fin(opts.opt_inp()); + if (fin.bad()) + throw netlist::fatalerror_e("Error opening input file: " + opts.opt_inp()); double dt = 1.0 / (double) wo.sample_rate(); double ct = dt; @@ -163,13 +160,13 @@ void convert(nlwav_options_t &opts) double minsam = 1e9; int n = 0; //short sample = 0; + pstring line; - - while(!std::feof(FIN)) + while(fin.readline(line)) { #if 1 float t = 0.0; float v = 0.0; - fscanf(FIN, "%f %f", &t, &v); + sscanf(line.cstr(), "%f %f", &t, &v); while (t >= ct) { outsam += (ct - lt) * cursam; @@ -220,7 +217,8 @@ void convert(nlwav_options_t &opts) printf("Amp + %f\n", 32000.0 / (maxsam- mean)); printf("Amp - %f\n", -32000.0 / (minsam- mean)); wo.close(); - fclose(FIN); + fo.close(); + fin.close(); } |