engine.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /* ScummVM Tools
  2. *
  3. * ScummVM Tools is the legal property of its developers, whose
  4. * names are too numerous to list here. Please refer to the
  5. * COPYRIGHT file distributed with this source distribution.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version 2
  10. * of the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  20. */
  21. #ifndef SCUMM_V6_ENGINE_H
  22. #define SCUMM_V6_ENGINE_H
  23. #include "../decompiler_engine.h"
  24. #include "../instruction.h"
  25. #include "../value.h"
  26. namespace Scumm {
  27. namespace v6 {
  28. const int kArrayOpInst = kFirstCustomInst;
  29. const int kIncDecInst = kFirstCustomInst + 1;
  30. /**
  31. * SCUMMv6 engine.
  32. */
  33. class Scummv6Engine : public Engine {
  34. public:
  35. virtual std::unique_ptr<Disassembler> getDisassembler(InstVec &insts) override;
  36. virtual std::unique_ptr<CodeGenerator> getCodeGenerator(const InstVec& insts, std::ostream &output) override;
  37. };
  38. /**
  39. * SCUMM v6 string value.
  40. */
  41. class Scummv6StringValue : public StringValue {
  42. public:
  43. /**
  44. * Constructor for Scummv6StringValue.
  45. *
  46. * @param str The string value.
  47. */
  48. Scummv6StringValue(std::string str) : StringValue(str) { }
  49. virtual std::ostream &print(std::ostream &output) const;
  50. };
  51. /**
  52. * SCUMM v6 load instruction.
  53. */
  54. class Scummv6LoadInstruction : public LoadInstruction {
  55. public:
  56. virtual void processInst(Function& func, ValueStack &stack, Engine *engine, CodeGenerator *codeGen) override;
  57. };
  58. /**
  59. * SCUMM v6 store instruction.
  60. */
  61. class Scummv6StoreInstruction : public StoreInstruction {
  62. public:
  63. virtual void processInst(Function& func, ValueStack &stack, Engine *engine, CodeGenerator *codeGen) override;
  64. };
  65. /**
  66. * SCUMM v6 stack operation.
  67. */
  68. class Scummv6StackInstruction : public StackInstruction {
  69. public:
  70. virtual void processInst(Function& func, ValueStack &stack, Engine *engine, CodeGenerator *codeGen) override;
  71. };
  72. /**
  73. * SCUMM v6 conditional jump.
  74. */
  75. class Scummv6CondJumpInstruction : public CondJumpInstruction {
  76. public:
  77. virtual void processInst(Function& func, ValueStack &stack, Engine *engine, CodeGenerator *codeGen) override;
  78. virtual uint32 getDestAddress() const;
  79. };
  80. /**
  81. * SCUMM v6 unconditional jump.
  82. */
  83. class Scummv6JumpInstruction : public UncondJumpInstruction {
  84. public:
  85. virtual uint32 getDestAddress() const;
  86. };
  87. /**
  88. * SCUMM v6 variable increment/decrement.
  89. */
  90. class Scummv6IncDecInstruction : public UnaryOpPostfixStackInstruction {
  91. public:
  92. virtual void processInst(Function& func, ValueStack &stack, Engine *engine, CodeGenerator *codeGen) override;
  93. };
  94. /**
  95. * SCUMM v6 array operation.
  96. */
  97. class Scummv6ArrayOpInstruction : public StoreInstruction {
  98. public:
  99. virtual void processInst(Function& func, ValueStack &stack, Engine *engine, CodeGenerator *codeGen) override;
  100. };
  101. } // End of namespace v6
  102. } // End of namespace Scumm
  103. #endif