Advertisement
Guest User

Untitled

a guest
Aug 16th, 2015
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
D 0.48 KB | None | 0 0
  1. module common.rp6502.interrupts;
  2.  
  3.  
  4. enum
  5. {
  6.     VECTOR_NMI = 0xfffa,
  7.     VECTOR_RES = 0xfffc,
  8.     VECTOR_IRQ = 0xfffe
  9. }
  10.  
  11. class Interrupts
  12. {
  13.     private bool irq;
  14.     private bool nmi;
  15.     private bool res;
  16.  
  17.     public bool available(bool i)
  18.     {
  19.         return nmi | (irq & !i) | res;
  20.     }
  21.  
  22.     public ushort vector()
  23.     {
  24.         if (res) return VECTOR_RES;
  25.         if (nmi) return VECTOR_NMI;
  26.         if (irq) return VECTOR_IRQ;
  27.  
  28.         return 0;
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement