MSXResetStatusRegister.cc 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #include "MSXResetStatusRegister.hh"
  2. #include "serialize.hh"
  3. namespace openmsx {
  4. MSXResetStatusRegister::MSXResetStatusRegister(const DeviceConfig& config)
  5. : MSXDevice(config)
  6. , inverted(config.getChildDataAsBool("inverted", false))
  7. {
  8. reset(EmuTime::dummy());
  9. }
  10. void MSXResetStatusRegister::reset(EmuTime::param /*time*/)
  11. {
  12. status = inverted ? 0xFF : 0x00;
  13. }
  14. byte MSXResetStatusRegister::readIO(word port, EmuTime::param time)
  15. {
  16. return peekIO(port, time);
  17. }
  18. byte MSXResetStatusRegister::peekIO(word /*port*/, EmuTime::param /*time*/) const
  19. {
  20. return status;
  21. }
  22. void MSXResetStatusRegister::writeIO(word /*port*/, byte value, EmuTime::param /*time*/)
  23. {
  24. if (inverted) {
  25. status = value | 0x7F;
  26. } else {
  27. status = (status & 0x20) | (value & 0xA0);
  28. }
  29. }
  30. template<typename Archive>
  31. void MSXResetStatusRegister::serialize(Archive& ar, unsigned /*version*/)
  32. {
  33. ar.template serializeBase<MSXDevice>(*this);
  34. ar.serialize("status", status);
  35. }
  36. INSTANTIATE_SERIALIZE_METHODS(MSXResetStatusRegister);
  37. REGISTER_MSXDEVICE(MSXResetStatusRegister, "F4Device"); // TODO: find a way to handle renames of classes and keep bwcompat with savestates....
  38. } // namespace openmsx