diff options
author | 2015-08-15 17:55:59 +0200 | |
---|---|---|
committer | 2015-08-15 17:56:10 +0200 | |
commit | fe8e6aca657f202daf91ad83cc1427296b50615e (patch) | |
tree | a516d55f859b90bc1ebef65be61ff10cf7040dfa /src | |
parent | 55592b6c785b36a9684800e0ccc7111603f958ed (diff) |
Added seconds() and attoseconds() to attotime and prefixed members with
m_. Rewrote code accessing members to use seconds() and attoseconds().
The changes were triggered by a test how gcc __int128_t would perform as
the internal representation. This test revealed that the current
implementation is still faster. (nw)
Diffstat (limited to 'src')
61 files changed, 206 insertions, 193 deletions
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/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/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/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/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/imagedev/mfmhd.c b/src/emu/imagedev/mfmhd.c index 2a76b0d70e4..cfcdbed0353 100644 --- a/src/emu/imagedev/mfmhd.c +++ b/src/emu/imagedev/mfmhd.c @@ -303,8 +303,8 @@ enum 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; } diff --git a/src/emu/ioport.c b/src/emu/ioport.c index 9777d123cfc..1514462e579 100644 --- a/src/emu/ioport.c +++ b/src/emu/ioport.c @@ -3442,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"); @@ -3581,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/machine.c b/src/emu/machine.c index e36f3c41fe9..06e112e758d 100644 --- a/src/emu/machine.c +++ b/src/emu/machine.c @@ -850,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/hdc92x4.c b/src/emu/machine/hdc92x4.c index f9b77b63fb0..b9be2b36f6c 100644 --- a/src/emu/machine/hdc92x4.c +++ b/src/emu/machine/hdc92x4.c @@ -1892,8 +1892,8 @@ void hdc92x4_device::write_sectors() 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; } @@ -3558,7 +3558,7 @@ bool hdc92x4_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 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/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/netlist/plib/pconfig.h b/src/emu/netlist/plib/pconfig.h index 3be33d01503..021bb7ff72d 100644 --- a/src/emu/netlist/plib/pconfig.h +++ b/src/emu/netlist/plib/pconfig.h @@ -19,7 +19,7 @@ #define PSTANDALONE (0) #endif -#define PHAS_INT128 (0) +//#define PHAS_INT128 (0) #ifndef PHAS_INT128 #define PHAS_INT128 (0) 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..28973616272 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); } @@ -945,6 +945,7 @@ void device_scheduler::add_scheduling_quantum(const attotime &quantum, const att 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/sound.c b/src/emu/sound.c index d2543154bf6..fe5638be358 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,18 +264,18 @@ 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); 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); 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,7 +1083,7 @@ 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); 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/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..a3b614f6a34 100644 --- a/src/emu/video.c +++ b/src/emu/video.c @@ -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/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/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/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/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/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/hng64.c b/src/mame/drivers/hng64.c index 29c3248d2e0..c0c8cc70c10 100644 --- a/src/mame/drivers/hng64.c +++ b/src/mame/drivers/hng64.c @@ -813,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() ); } } 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/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/vegas.c b/src/mame/drivers/vegas.c index b516b736d30..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? */ 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/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/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/k057714.c b/src/mame/video/k057714.c index 5f7b6b7b595..9473607aa30 100644 --- a/src/mame/video/k057714.c +++ b/src/mame/video/k057714.c @@ -265,7 +265,7 @@ int k057714_device::draw(screen_device &screen, bitmap_ind16 &bitmap, const rect { visarea.max_x = width-1; visarea.max_y = height-1; - screen.configure(width, height, visarea, screen.frame_period().attoseconds); + screen.configure(width, height, visarea, screen.frame_period().attoseconds()); } } 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/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/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/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/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/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/pdp1.c b/src/mess/drivers/pdp1.c index cddee893f94..f3827cf61b1 100644 --- a/src/mess/drivers/pdp1.c +++ b/src/mess/drivers/pdp1.c @@ -1597,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... */ } 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/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/supracan.c b/src/mess/drivers/supracan.c index 8fb7668b5f9..baf2a4668f1 100644 --- a/src/mess/drivers/supracan.c +++ b/src/mess/drivers/supracan.c @@ -1643,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/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/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/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/vector06.c b/src/mess/machine/vector06.c index a2d7d770db4..ba944cef8fd 100644 --- a/src/mess/machine/vector06.c +++ b/src/mess/machine/vector06.c @@ -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 ) 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/thomson.c b/src/mess/video/thomson.c index 7c6a9ea7a97..a258bb529da 100644 --- a/src/mess/video/thomson.c +++ b/src/mess/video/thomson.c @@ -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; 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; |