NstHomebrew.hpp 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. ////////////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Nestopia - NES/Famicom emulator written in C++
  4. //
  5. // Copyright (C) 2018-2018 Phil Smith
  6. //
  7. // This file is part of Nestopia.
  8. //
  9. // Nestopia is free software; you can redistribute it and/or modify
  10. // it under the terms of the GNU General Public License as published by
  11. // the Free Software Foundation; either version 2 of the License, or
  12. // (at your option) any later version.
  13. //
  14. // Nestopia is distributed in the hope that it will be useful,
  15. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. // GNU General Public License for more details.
  18. //
  19. // You should have received a copy of the GNU General Public License
  20. // along with Nestopia; if not, write to the Free Software
  21. // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  22. //
  23. ////////////////////////////////////////////////////////////////////////////////////////
  24. #ifndef NST_HOMEBREW_H
  25. #define NST_HOMEBREW_H
  26. #ifndef NST_VECTOR_H
  27. #include "NstVector.hpp"
  28. #endif
  29. #ifdef NST_PRAGMA_ONCE
  30. #pragma once
  31. #endif
  32. namespace Nes
  33. {
  34. namespace Core
  35. {
  36. class Homebrew
  37. {
  38. public:
  39. explicit Homebrew(Cpu&);
  40. ~Homebrew();
  41. void Reset();
  42. void ClearPorts();
  43. Result SetExitPort (word,bool);
  44. Result ClearExitPort ();
  45. Result SetStdOutPort (word,bool);
  46. Result ClearStdOutPort ();
  47. Result SetStdErrPort (word,bool);
  48. Result ClearStdErrPort ();
  49. dword NumPorts () const;
  50. private:
  51. NES_DECL_PEEK( Exit );
  52. NES_DECL_POKE( Exit );
  53. NES_DECL_PEEK( StdOut );
  54. NES_DECL_POKE( StdOut );
  55. NES_DECL_PEEK( StdErr );
  56. NES_DECL_POKE( StdErr );
  57. Result ActivateExitPort ();
  58. Result ActivateStdOutPort ();
  59. Result ActivateStdErrPort ();
  60. Cpu& cpu;
  61. word exitAddress;
  62. ibool exitSet;
  63. const Io::Port* exitPort;
  64. word stdOutAddress;
  65. ibool stdOutSet;
  66. const Io::Port* stdOutPort;
  67. word stdErrAddress;
  68. ibool stdErrSet;
  69. const Io::Port* stdErrPort;
  70. };
  71. }
  72. }
  73. #endif