Subversion Repositories pentevo

Rev

Blame | Last modification | View Log | Download | RSS feed | ?url?

  1. #pragma once
  2.  
  3. Z80INLINE void handle_int(Z80 *cpu, unsigned char vector)
  4. {
  5.    unsigned intad;
  6.    if (cpu->im < 2) {
  7.       intad = 0x38;
  8.    } else { // im2
  9.       unsigned vec = vector + cpu->i*0x100;
  10.       intad = cpu->MemIf->rm(vec) + 0x100*cpu->MemIf->rm(vec+1);
  11.    }
  12.  
  13.    cpu->last_branch = u16(cpu->pc);
  14.    if(cpu->MemIf->rm(cpu->pc) == 0x76) // int on halt command
  15.        cpu->pc++;
  16.  
  17.    cpu->t += (cpu->im < 2) ? 13 : 19;
  18.    cpu->MemIf->wm(--cpu->sp, cpu->pch);
  19.    cpu->MemIf->wm(--cpu->sp, cpu->pcl);
  20.    cpu->pc = intad;
  21.    cpu->memptr = intad;
  22.    cpu->halted = 0;
  23.    cpu->iff1 = cpu->iff2 = 0;
  24.    cpu->int_pend = false;
  25. }
  26.