lslByteCode.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. namespace libLSL
  5. {
  6. class lslByteCode
  7. {
  8. byte[] bytecode;
  9. public void executeStep()
  10. {
  11. byte ins = nextInstruction();
  12. lslOpcodes code = (lslOpcodes)ins;
  13. Object arg1 = (Object)32;
  14. Object arg2 = (Object)32;
  15. switch (code)
  16. {
  17. case lslOpcodes.OP_NOOP:
  18. break;
  19. case lslOpcodes.OP_POP:
  20. popBytes(4);
  21. break;
  22. case lslOpcodes.OP_POPS:
  23. case lslOpcodes.OP_POPL:
  24. // Do Stuff
  25. break;
  26. case lslOpcodes.OP_POPV:
  27. popBytes(12);
  28. break;
  29. case lslOpcodes.OP_POPQ:
  30. popBytes(16);
  31. break;
  32. case lslOpcodes.OP_POPARG:
  33. popBytes((Int32)arg1);
  34. break;
  35. case lslOpcodes.OP_POPIP:
  36. // Do Stuff
  37. break;
  38. case lslOpcodes.OP_POPBP:
  39. // Do Stuff
  40. break;
  41. case lslOpcodes.OP_POPSP:
  42. // Do Stuff
  43. break;
  44. case lslOpcodes.OP_POPSLR:
  45. // Do Stuff
  46. break;
  47. case lslOpcodes.OP_DUP:
  48. pushBytes(getBytes(4));
  49. break;
  50. case lslOpcodes.OP_DUPS:
  51. case lslOpcodes.OP_DUPL:
  52. // Do Stuff
  53. break;
  54. case lslOpcodes.OP_DUPV:
  55. pushBytes(getBytes(12));
  56. break;
  57. case lslOpcodes.OP_DUPQ:
  58. pushBytes(getBytes(16));
  59. break;
  60. case lslOpcodes.OP_STORE:
  61. // Somefin.
  62. break;
  63. default:
  64. break;
  65. }
  66. }
  67. /// <summary>
  68. /// Advance the instruction pointer, pull the current instruction
  69. /// </summary>
  70. /// <returns></returns>
  71. byte nextInstruction()
  72. {
  73. return 0;
  74. }
  75. /// <summary>
  76. /// Removes bytes from the stack
  77. /// </summary>
  78. /// <param name="num">Number of bytes</param>
  79. void popBytes(int num)
  80. {
  81. }
  82. /// <summary>
  83. /// Pushes Bytes to the stack
  84. /// </summary>
  85. /// <param name="bytes">Ze bytes!</param>
  86. void pushBytes(byte[] bytes)
  87. {
  88. }
  89. /// <summary>
  90. /// Get Bytes from the stack
  91. /// </summary>
  92. /// <param name="num">Number of bytes</param>
  93. /// <returns>Ze bytes!</returns>
  94. byte[] getBytes(int num)
  95. {
  96. return new byte[1];
  97. }
  98. /// <summary>
  99. /// Saves bytes to the local frame
  100. /// </summary>
  101. /// <param name="bytes">Ze bytes!</param>
  102. /// <param name="index">Index in local frame</param>
  103. void storeBytes(byte[] bytes, int index)
  104. {
  105. }
  106. }
  107. }