home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 3 / CD ACTUAL 3.iso / linux / system / bsvc-1.000 / bsvc-1 / bsvc-1.0.4 / src / Framework / BasicDevice.cxx < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-26  |  2.3 KB  |  69 lines

  1. ///////////////////////////////////////////////////////////////////////////////
  2. // $Id: BasicDevice.cxx,v 1.1 1994/02/18 19:48:06 bmott Exp $
  3. ///////////////////////////////////////////////////////////////////////////////
  4. // BasicDevice.cxx - Device base class
  5. //
  6. // This is the abstract base class for all derived devices
  7. //
  8. //
  9. // BSVC "A Microprocessor Simulation Framework"
  10. // Copyright (c) 1993
  11. // By: Bradford W. Mott
  12. // November 26,1993
  13. //
  14. ///////////////////////////////////////////////////////////////////////////////
  15. // $Log: BasicDevice.cxx,v $
  16. // Revision 1.1  1994/02/18  19:48:06  bmott
  17. // Initial revision
  18. //
  19. ///////////////////////////////////////////////////////////////////////////////
  20.  
  21. #include "BasicCPU.hxx"
  22. #include "BasicDevice.hxx"
  23.  
  24. ///////////////////////////////////////////////////////////////////////////////
  25. // Reset device - At the very least the interrupt pending flag has to be reset
  26. ///////////////////////////////////////////////////////////////////////////////
  27. void BasicDevice::Reset()
  28. {
  29.   interrupt_pending=0;
  30. }
  31.  
  32. ///////////////////////////////////////////////////////////////////////////////
  33. // Interrupt Request - This routine should set the interrupt_pending flag and
  34. //                     send a request to the CPU for an interrupt.
  35. ///////////////////////////////////////////////////////////////////////////////
  36. void BasicDevice::InterruptRequest(int level)
  37. {
  38.   // If no interrupt is pending then request one
  39.   if(!interrupt_pending)
  40.   {
  41.     interrupt_pending=1;
  42.     cpu->InterruptRequest(this, level);
  43.   }
  44. }
  45.        
  46. ///////////////////////////////////////////////////////////////////////////////
  47. // Interrupt Acknowledge - This routine is called by the CPU when it processes
  48. //                         the requested interrupt.  It should return the
  49. //                         vector number associated with the interrupt or
  50. //                         AUTOVECTOR if the device doesn't generate vectors.
  51. //
  52. //                         NOTE: This default routine only does AUTOVECTOR
  53. //                               interrupts.
  54. //
  55. ///////////////////////////////////////////////////////////////////////////////
  56. long BasicDevice::InterruptAcknowledge(int)
  57. {
  58.   if(interrupt_pending)
  59.   {
  60.     interrupt_pending=0;
  61.     return(AUTOVECTOR_INTERRUPT);
  62.   }
  63.   else
  64.   {
  65.     return(SPURIOUS_INTERRUPT);
  66.   }
  67. }
  68.  
  69.