summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/cpu/mcs96
diff options
context:
space:
mode:
author Olivier Galibert <galibert@pobox.com>2014-09-17 20:50:32 +0000
committer Olivier Galibert <galibert@pobox.com>2014-09-17 20:50:32 +0000
commitf5570dc9c61adc03e008c6e23f911ea9bd1f0366 (patch)
tree40d7a0c39fc600776bcf1402400054979ea2ff7f /src/emu/cpu/mcs96
parentc61142c217aaf03f7c319a2a56a987516d63d066 (diff)
If we were documented, we'd be dangerous (nw)
Diffstat (limited to 'src/emu/cpu/mcs96')
-rw-r--r--src/emu/cpu/mcs96/i8x9x.c18
-rw-r--r--src/emu/cpu/mcs96/mcs96.c23
-rw-r--r--src/emu/cpu/mcs96/mcs96.h3
3 files changed, 17 insertions, 27 deletions
diff --git a/src/emu/cpu/mcs96/i8x9x.c b/src/emu/cpu/mcs96/i8x9x.c
index 1342b394aa0..e86fa598248 100644
--- a/src/emu/cpu/mcs96/i8x9x.c
+++ b/src/emu/cpu/mcs96/i8x9x.c
@@ -87,7 +87,7 @@ void i8x9x_device::commit_hso_cam()
hso_info[i].active = true;
hso_info[i].command = hso_command;
hso_info[i].time = hso_time;
- internal_update(get_cycle());
+ internal_update(total_cycles());
return;
}
hso_cam_hold.active = true;
@@ -105,7 +105,7 @@ void i8x9x_device::ad_start(UINT64 current_time)
void i8x9x_device::serial_send(UINT8 data)
{
serial_send_buf = data;
- serial_send_timer = get_cycle() + 9600;
+ serial_send_timer = total_cycles() + 9600;
}
void i8x9x_device::serial_send_done()
@@ -123,7 +123,7 @@ void i8x9x_device::io_w8(UINT8 adr, UINT8 data)
case 0x02:
ad_command = data;
if(ad_command & 8)
- ad_start(get_cycle());
+ ad_start(total_cycles());
break;
case 0x03:
logerror("%s: hsi_mode %02x (%04x)\n", tag(), data, PPC);
@@ -229,16 +229,16 @@ UINT8 i8x9x_device::io_r8(UINT8 adr)
return pending_irq;
case 0x0a:
logerror("%s: read timer1 l (%04x)\n", tag(), PPC);
- return timer_value(1, get_cycle());
+ return timer_value(1, total_cycles());
case 0x0b:
logerror("%s: read timer1 h (%04x)\n", tag(), PPC);
- return timer_value(1, get_cycle()) >> 8;
+ return timer_value(1, total_cycles()) >> 8;
case 0x0c:
logerror("%s: read timer2 l (%04x)\n", tag(), PPC);
- return timer_value(2, get_cycle());
+ return timer_value(2, total_cycles());
case 0x0d:
logerror("%s: read timer2 h (%04x)\n", tag(), PPC);
- return timer_value(2, get_cycle()) >> 8;
+ return timer_value(2, total_cycles()) >> 8;
case 0x0e: {
static int last = -1;
if(io->read_word(P0*2) != last) {
@@ -282,10 +282,10 @@ UINT16 i8x9x_device::io_r16(UINT8 adr)
logerror("%s: read hsi time (%04x)\n", tag(), PPC);
return 0x0000;
case 0x0a:
- return timer_value(1, get_cycle());
+ return timer_value(1, total_cycles());
case 0x0c:
logerror("%s: read timer2 (%04x)\n", tag(), PPC);
- return timer_value(2, get_cycle());
+ return timer_value(2, total_cycles());
default:
return io_r8(adr) | (io_r8(adr+1) << 8);
}
diff --git a/src/emu/cpu/mcs96/mcs96.c b/src/emu/cpu/mcs96/mcs96.c
index d487af3e855..51f661e0f94 100644
--- a/src/emu/cpu/mcs96/mcs96.c
+++ b/src/emu/cpu/mcs96/mcs96.c
@@ -94,18 +94,13 @@ UINT32 mcs96_device::execute_input_lines() const
return 1;
}
-UINT64 mcs96_device::get_cycle()
-{
- return end_cycles == 0 || icount <= 0 ? machine().time().as_ticks(clock()) : end_cycles - icount;
-}
-
void mcs96_device::recompute_bcount(UINT64 event_time)
{
- if(!event_time || event_time >= end_cycles) {
+ if(!event_time || event_time >= total_cycles()+icount) {
bcount = 0;
return;
}
- bcount = end_cycles - event_time;
+ bcount = total_cycles() - event_time;
}
void mcs96_device::check_irq()
@@ -115,13 +110,10 @@ void mcs96_device::check_irq()
void mcs96_device::execute_run()
{
- UINT64 start_cycles = machine().time().as_ticks(clock());
- end_cycles = start_cycles + icount;
-
- internal_update(start_cycles);
+ internal_update(total_cycles());
- if(/*inst_substate*/ 0)
- do_exec_partial();
+ // if(inst_substate)
+ // do_exec_partial();
while(icount > 0) {
while(icount > bcount) {
@@ -132,9 +124,10 @@ void mcs96_device::execute_run()
}
}
while(bcount && icount <= bcount)
- internal_update(end_cycles - bcount);
+ internal_update(total_cycles() + icount - bcount);
+ // if(inst_substate)
+ // do_exec_partial();
}
- end_cycles = 0;
}
void mcs96_device::execute_set_input(int inputnum, int state)
diff --git a/src/emu/cpu/mcs96/mcs96.h b/src/emu/cpu/mcs96/mcs96.h
index f7b11dca14b..22503dff0e0 100644
--- a/src/emu/cpu/mcs96/mcs96.h
+++ b/src/emu/cpu/mcs96/mcs96.h
@@ -48,8 +48,6 @@ public:
mcs96_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, int data_width, const char *shortname, const char *source);
- UINT64 get_cycle();
-
protected:
enum {
STATE_FETCH = 0x200,
@@ -127,7 +125,6 @@ protected:
address_space *program;
direct_read_data *direct;
- UINT64 end_cycles;
int icount, bcount, inst_state, cycles_scaling;
UINT8 pending_irq;
UINT16 PC, PPC, PSW;