本文整理汇总了C++中running_machine::time方法的典型用法代码示例。如果您正苦于以下问题:C++ running_machine::time方法的具体用法?C++ running_machine::time怎么用?C++ running_machine::time使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类running_machine
的用法示例。
在下文中一共展示了running_machine::time方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handle_eoi
static void handle_eoi(running_machine &machine,int data)
{
compis_state *state = machine.driver_data<compis_state>();
int i, j;
/* specific case */
if (!(data & 0x8000))
{
/* turn off the appropriate in-service bit */
switch (data & 0x1f)
{
case 0x08: state->m_i186.intr.in_service &= ~0x01; break;
case 0x12: state->m_i186.intr.in_service &= ~0x01; break;
case 0x13: state->m_i186.intr.in_service &= ~0x01; break;
case 0x0a: state->m_i186.intr.in_service &= ~0x04; break;
case 0x0b: state->m_i186.intr.in_service &= ~0x08; break;
case 0x0c: state->m_i186.intr.in_service &= ~0x10; break;
case 0x0d: state->m_i186.intr.in_service &= ~0x20; break;
case 0x0e: state->m_i186.intr.in_service &= ~0x40; break;
case 0x0f: state->m_i186.intr.in_service &= ~0x80; break;
default: logerror("%05X:ERROR - 80186 EOI with unknown vector %02X\n", cpu_get_pc(machine.device("maincpu")), data & 0x1f);
}
if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for vector %02X\n", machine.time().as_double(), data & 0x1f);
}
/* non-specific case */
else
{
/* loop over priorities */
for (i = 0; i <= 7; i++)
{
/* check for in-service timers */
if ((state->m_i186.intr.timer & 7) == i && (state->m_i186.intr.in_service & 0x01))
{
state->m_i186.intr.in_service &= ~0x01;
if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for timer\n", machine.time().as_double());
return;
}
/* check for in-service DMA interrupts */
for (j = 0; j < 2; j++)
if ((state->m_i186.intr.dma[j] & 7) == i && (state->m_i186.intr.in_service & (0x04 << j)))
{
state->m_i186.intr.in_service &= ~(0x04 << j);
if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for DMA%d\n", machine.time().as_double(), j);
return;
}
/* check external interrupts */
for (j = 0; j < 4; j++)
if ((state->m_i186.intr.ext[j] & 7) == i && (state->m_i186.intr.in_service & (0x10 << j)))
{
state->m_i186.intr.in_service &= ~(0x10 << j);
if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for INT%d\n", machine.time().as_double(), j);
return;
}
}
}
}
示例2: command_end
static void command_end(running_machine &machine)
{
/* at the end of our test */
state = STATE_DONE;
final_time = machine.time();
machine.schedule_exit();
}
示例3: if
static void ssystem3_playfield_write(running_machine &machine, int reset, int signal)
{
ssystem3_state *state = machine.driver_data<ssystem3_state>();
int d=FALSE;
if (!reset) {
state->m_playfield.count=0;
state->m_playfield.bit=0;
state->m_playfield.started=FALSE;
state->m_playfield.signal=signal;
state->m_playfield.time=machine.time();
}
if (!signal && state->m_playfield.signal) {
attotime t=machine.time();
state->m_playfield.high_time=t - state->m_playfield.time;
state->m_playfield.time=t;
// logerror("%.4x playfield %d lowtime %s hightime %s\n",(int)activecpu_get_pc(), state->m_playfield.count,
// state->m_playfield.low_time.as_string(7), state->m_playfield.high_time.as_string(7) );
if (state->m_playfield.started) {
// 0 twice as long low
// 1 twice as long high
if (state->m_playfield.low_time > state->m_playfield.high_time) d=TRUE;
state->m_playfield.data&=~(1<<(state->m_playfield.bit^7));
if (d) state->m_playfield.data|=1<<(state->m_playfield.bit^7);
state->m_playfield.bit++;
if (state->m_playfield.bit==8) {
logerror("%.4x playfield wrote %d %02x\n", (int)cpu_get_pc(machine.device("maincpu")), state->m_playfield.count, state->m_playfield.data);
state->m_playfield.u.data[state->m_playfield.count]=state->m_playfield.data;
state->m_playfield.bit=0;
state->m_playfield.count=(state->m_playfield.count+1)%ARRAY_LENGTH(state->m_playfield.u.data);
if (state->m_playfield.count==0) state->m_playfield.started=FALSE;
}
}
} else if (signal && !state->m_playfield.signal) {
attotime t=machine.time();
state->m_playfield.low_time= t - state->m_playfield.time;
state->m_playfield.time=t;
state->m_playfield.started=TRUE;
}
state->m_playfield.signal=signal;
}
示例4:
static UINT8 read_port_and_t0( running_machine &machine, int port )
{
hitme_state *state = machine.driver_data<hitme_state>();
static const char *const portnames[] = { "IN0", "IN1", "IN2", "IN3" };
UINT8 val = machine.root_device().ioport(portnames[port])->read();
if (machine.time() > state->m_timeout_time)
val ^= 0x80;
return val;
}
示例5: update_plunger
static void update_plunger( running_machine &machine )
{
mgolf_state *state = machine.driver_data<mgolf_state>();
UINT8 val = state->ioport("BUTTON")->read();
if (state->m_prev != val)
{
if (val == 0)
{
state->m_time_released = machine.time();
if (!state->m_mask)
state->m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
}
else
state->m_time_pushed = machine.time();
state->m_prev = val;
}
}
示例6: update_plunger
static void update_plunger(running_machine &machine)
{
videopin_state *state = machine.driver_data<videopin_state>();
UINT8 val = input_port_read(machine, "IN2");
if (state->m_prev != val)
{
if (val == 0)
{
state->m_time_released = machine.time();
if (!state->m_mask)
cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, ASSERT_LINE);
}
else
state->m_time_pushed = machine.time();
state->m_prev = val;
}
}
示例7: command_rawinput
static void command_rawinput(running_machine &machine)
{
//int parts;
attotime current_time = machine.time();
static const char *position;
#if 0
int i;
double rate = attotime::from_seconds(1);
const char *s;
char buf[256];
#endif
if (state == STATE_READY)
{
/* beginning of a raw input command */
//parts = 1;
position = current_command->u.input_args.input_chars;
wait_target = current_time;
state = STATE_INCOMMAND;
}
else if (current_time > wait_target)
{
#if 0
do
{
/* process the next command */
while(!isspace(*position))
position++;
/* look up the input to trigger */
for (i = 0; input_keywords[i].name; i++)
{
if (!strncmp(position, input_keywords[i].name, strlen(input_keywords[i].name)))
break;
}
/* go to next command */
position = strchr(position, ',');
if (position)
position++;
}
while(position && !input_keywords[i].name);
current_fake_input = input_keywords[i].name ? &input_keywords[i] : NULL;
if (position)
wait_target = current_time + rate;
else
state = STATE_READY;
#endif
}
}
示例8: command_wait
static void command_wait(running_machine &machine)
{
attotime current_time = machine.time();
if (state == STATE_READY)
{
/* beginning a wait command */
wait_target = current_time + attotime::from_msec(current_command->u.wait_time);
state = STATE_INCOMMAND;
}
else
{
/* during a wait command */
state = (current_time >= wait_target) ? STATE_READY : STATE_INCOMMAND;
}
}
示例9: calc_plunger_pos
static double calc_plunger_pos(running_machine &machine)
{
mgolf_state *state = machine.driver_data<mgolf_state>();
return (machine.time().as_double() - state->m_time_released.as_double()) * (state->m_time_released.as_double() - state->m_time_pushed.as_double() + 0.2);
}
示例10: osd_update
void osd_update(running_machine &machine, int skip_redraw)
{
int i;
attotime time_limit;
attotime current_time;
target->get_primitives();
/* don't do anything if we are initializing! */
switch(machine.phase())
{
case MACHINE_PHASE_PREINIT:
case MACHINE_PHASE_INIT:
case MACHINE_PHASE_RESET:
return;
default: break;
}
/* if we have already aborted or completed, our work is done */
if ((state == STATE_ABORTED) || (state == STATE_DONE))
{
machine.schedule_exit();
return;
}
/* have we hit the time limit? */
current_time = machine.time();
time_limit = (current_testcase.time_limit != attotime::zero) ? current_testcase.time_limit
: attotime::from_seconds(600);
if (current_time > time_limit)
{
state = STATE_ABORTED;
report_message(MSG_FAILURE, "Time limit of %s attoseconds exceeded", time_limit.as_string(9));
return;
}
for (i = 0; i < ARRAY_LENGTH(commands); i++)
{
if (current_command->command_type == commands[i].command_type)
{
commands[i].proc(machine);
break;
}
}
/* if we are ready for the next command, advance to it */
if (state == STATE_READY)
{
/* if we are at the end, and we are dumping screenshots, and we didn't
* just dump a screenshot, dump one now
*/
if ((test_flags & MESSTEST_ALWAYS_DUMP_SCREENSHOT) &&
(current_command[0].command_type != MESSTEST_COMMAND_SCREENSHOT) &&
(current_command[1].command_type == MESSTEST_COMMAND_END))
{
dump_screenshot(machine, TRUE);
}
current_command++;
}
}
示例11: update_interrupt_state
static void update_interrupt_state(running_machine &machine)
{
compis_state *state = machine.driver_data<compis_state>();
int i, j, new_vector = 0;
if (LOG_INTERRUPTS) logerror("update_interrupt_status: req=%02X stat=%02X serv=%02X\n", state->m_i186.intr.request, state->m_i186.intr.status, state->m_i186.intr.in_service);
/* loop over priorities */
for (i = 0; i <= state->m_i186.intr.priority_mask; i++)
{
/* note: by checking 4 bits, we also verify that the mask is off */
if ((state->m_i186.intr.timer & 15) == i)
{
/* if we're already servicing something at this level, don't generate anything new */
if (state->m_i186.intr.in_service & 0x01)
return;
/* if there's something pending, generate an interrupt */
if (state->m_i186.intr.status & 0x07)
{
if (state->m_i186.intr.status & 1)
new_vector = 0x08;
else if (state->m_i186.intr.status & 2)
new_vector = 0x12;
else if (state->m_i186.intr.status & 4)
new_vector = 0x13;
else
popmessage("Invalid timer interrupt!");
/* set the clear mask and generate the int */
state->m_i186.intr.ack_mask = 0x0001;
goto generate_int;
}
}
/* check DMA interrupts */
for (j = 0; j < 2; j++)
if ((state->m_i186.intr.dma[j] & 15) == i)
{
/* if we're already servicing something at this level, don't generate anything new */
if (state->m_i186.intr.in_service & (0x04 << j))
return;
/* if there's something pending, generate an interrupt */
if (state->m_i186.intr.request & (0x04 << j))
{
new_vector = 0x0a + j;
/* set the clear mask and generate the int */
state->m_i186.intr.ack_mask = 0x0004 << j;
goto generate_int;
}
}
/* check external interrupts */
for (j = 0; j < 4; j++)
if ((state->m_i186.intr.ext[j] & 15) == i)
{
/* if we're already servicing something at this level, don't generate anything new */
if (state->m_i186.intr.in_service & (0x10 << j))
return;
/* if there's something pending, generate an interrupt */
if (state->m_i186.intr.request & (0x10 << j))
{
/* otherwise, generate an interrupt for this request */
new_vector = 0x0c + j;
/* set the clear mask and generate the int */
state->m_i186.intr.ack_mask = 0x0010 << j;
goto generate_int;
}
}
}
return;
generate_int:
/* generate the appropriate interrupt */
state->m_i186.intr.poll_status = 0x8000 | new_vector;
if (!state->m_i186.intr.pending)
cputag_set_input_line(machine, "maincpu", 0, ASSERT_LINE);
state->m_i186.intr.pending = 1;
machine.scheduler().trigger(CPU_RESUME_TRIGGER);
if (LOG_OPTIMIZATION) logerror(" - trigger due to interrupt pending\n");
if (LOG_INTERRUPTS) logerror("(%f) **** Requesting interrupt vector %02X\n", machine.time().as_double(), new_vector);
}