I8255.hh 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. // This class implements the Intel 8255 chip
  2. //
  3. // * Only the 8255 is emulated, no surrounding hardware.
  4. // Use the class I8255Interface to do that.
  5. // * Only mode 0 (basic input/output) is implemented
  6. #ifndef I8255_HH
  7. #define I8255_HH
  8. #include "EmuTime.hh"
  9. #include "openmsx.hh"
  10. namespace openmsx {
  11. class I8255Interface;
  12. class CliComm;
  13. class I8255
  14. {
  15. public:
  16. I8255(I8255Interface& interf, EmuTime::param time,
  17. CliComm& cliComm);
  18. void reset(EmuTime::param time);
  19. byte read(byte port, EmuTime::param time);
  20. byte peek(byte port, EmuTime::param time) const;
  21. void write(byte port, byte value, EmuTime::param time);
  22. template<typename Archive>
  23. void serialize(Archive& ar, unsigned version);
  24. private:
  25. byte readPortA(EmuTime::param time);
  26. byte readPortB(EmuTime::param time);
  27. byte readPortC(EmuTime::param time);
  28. byte readControlPort(EmuTime::param time) const;
  29. byte peekPortA(EmuTime::param time) const;
  30. byte peekPortB(EmuTime::param time) const;
  31. byte peekPortC(EmuTime::param time) const;
  32. void writePortA(byte value, EmuTime::param time);
  33. void writePortB(byte value, EmuTime::param time);
  34. void writePortC(byte value, EmuTime::param time);
  35. void writeControlPort(byte value, EmuTime::param time);
  36. byte readC0(EmuTime::param time);
  37. byte readC1(EmuTime::param time);
  38. byte peekC0(EmuTime::param time) const;
  39. byte peekC1(EmuTime::param time) const;
  40. void outputPortA(byte value, EmuTime::param time);
  41. void outputPortB(byte value, EmuTime::param time);
  42. void outputPortC(byte value, EmuTime::param time);
  43. I8255Interface& interface;
  44. CliComm& cliComm;
  45. byte control;
  46. byte latchPortA;
  47. byte latchPortB;
  48. byte latchPortC;
  49. bool warningPrinted;
  50. };
  51. } // namespace openmsx
  52. #endif