trunk/src/emu/cpu/z80/z80.c
r17601 | r17602 | |
366 | 366 | |
367 | 367 | static void take_interrupt(z80_state *z80); |
368 | 368 | static void take_interrupt_nsc800(z80_state *z80); |
369 | | static CPU_BURN( z80 ); |
370 | 369 | |
371 | 370 | typedef void (*funcptr)(z80_state *z80); |
372 | 371 | |
r17601 | r17602 | |
477 | 476 | PROTOTYPES(Z80fd,fd); |
478 | 477 | PROTOTYPES(Z80xycb,xycb); |
479 | 478 | |
480 | | /****************************************************************************/ |
481 | | /* Burn an odd amount of cycles, that is instructions taking something */ |
482 | | /* different from 4 T-states per opcode (and r increment) */ |
483 | | /****************************************************************************/ |
484 | | INLINE void BURNODD(z80_state *z80, int cycles, int opcodes, int cyclesum) |
485 | | { |
486 | | if( cycles > 0 ) |
487 | | { |
488 | | z80->r += (cycles / cyclesum) * opcodes; |
489 | | z80->icount -= (cycles / cyclesum) * cyclesum; |
490 | | } |
491 | | } |
492 | | |
493 | 479 | /*************************************************************** |
494 | 480 | * define an opcode function |
495 | 481 | ***************************************************************/ |
r17601 | r17602 | |
594 | 580 | #define ENTER_HALT(Z) do { \ |
595 | 581 | (Z)->PC--; \ |
596 | 582 | (Z)->halt = 1; \ |
597 | | if( (Z)->irq_state == CLEAR_LINE ) \ |
598 | | CPU_BURN_NAME(z80)( (Z)->device, (Z)->icount); \ |
599 | 583 | } while (0) |
600 | 584 | |
601 | 585 | /*************************************************************** |
r17601 | r17602 | |
3687 | 3671 | } |
3688 | 3672 | |
3689 | 3673 | /**************************************************************************** |
3690 | | * Burn 'cycles' T-states. Adjust z80->r register for the lost time |
3691 | | ****************************************************************************/ |
3692 | | static CPU_BURN( z80 ) |
3693 | | { |
3694 | | z80_state *z80 = get_safe_token(device); |
3695 | | |
3696 | | if( cycles > 0 ) |
3697 | | { |
3698 | | /* NOP takes 4 cycles per instruction */ |
3699 | | int n = (cycles + 3) / 4; |
3700 | | z80->r += n; |
3701 | | z80->icount -= 4 * n; |
3702 | | } |
3703 | | } |
3704 | | |
3705 | | /**************************************************************************** |
3706 | 3674 | * Set IRQ line state |
3707 | 3675 | ****************************************************************************/ |
3708 | 3676 | static void set_irq_line(z80_state *z80, int irqline, int state) |