aidencuneo

Mini Interpreter written in MInelang

Apr 15th, 2021 (edited)
365
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Author: Aiden Blishen Cuneo
  2. // This code is intended for interpretation using Aiden Blishen Cuneo's Minelang Interpreter for Minecraft.
  3. // Contact aidencuneo@gmail.com for more information.
  4.  
  5. // Program to interpret
  6. '''0123456789
  7. str 0 652
  8.  
  9. // Index in program
  10. mov 1 0
  11.  
  12. // Interpreter variables
  13. // ptr1
  14. mov 10 0
  15. // ptr2
  16. mov 11 0
  17. // ptr3
  18. mov 12 0
  19.  
  20. // Begin interpretation
  21. label 0
  22.  
  23. // Character to interpret can be retrieved with register 68
  24. mov 68 1 4
  25.  
  26. // cmp '0'
  27. cmp 68 48
  28. je 1
  29.  
  30. // cmp '1'
  31. cmp 68 49
  32. je 2
  33.  
  34. // cmp '2'
  35. cmp 68 50
  36. je 3
  37.  
  38. // cmp '3'
  39. cmp 68 51
  40. je 4
  41.  
  42. // cmp '4'
  43. cmp 68 52
  44. je 5
  45.  
  46. // cmp '5'
  47. cmp 68 53
  48. je 6
  49.  
  50. // cmp '6'
  51. cmp 68 54
  52. je 7
  53.  
  54. // cmp '7'
  55. cmp 68 55
  56. je 8
  57.  
  58. // cmp '8'
  59. cmp 68 56
  60. je 9
  61.  
  62. // cmp '9'
  63. cmp 68 57
  64. je 10
  65.  
  66. // If character doesn't match anything above, skip it
  67. jmp 999
  68.  
  69. // '0'
  70. label 1
  71. // Set ptr1 to 0
  72. mov 10 0
  73. jmp 999
  74.  
  75. // '1'
  76. label 2
  77. // Add 1 to ptr1
  78. add 10 1
  79. jmp 999
  80.  
  81. // '2'
  82. label 3
  83. // Add 2 to ptr1
  84. add 10 2
  85. jmp 999
  86.  
  87. // '3'
  88. label 4
  89. // Add 3 to ptr1
  90. add 10 3
  91. jmp 999
  92.  
  93. // '4'
  94. label 5
  95. // Add 4 to ptr1
  96. add 10 4
  97. jmp 999
  98.  
  99. // '5'
  100. label 6
  101. // Add 5 to ptr1
  102. add 10 5
  103. jmp 999
  104.  
  105. // '6'
  106. label 7
  107. // Add 6 to ptr1
  108. add 10 6
  109. jmp 999
  110.  
  111. // '7'
  112. label 8
  113. // Add 7 to ptr1
  114. add 10 7
  115. jmp 999
  116.  
  117. // '8'
  118. label 9
  119. // Add 8 to ptr1
  120. add 10 8
  121. jmp 999
  122.  
  123. // '9'
  124. label 10
  125. // Add 9 to ptr1
  126. add 10 9
  127. jmp 999
  128.  
  129. // End of character, move to the next character
  130. label 999
  131. add 1 1
  132.  
  133. // Is this character a null byte?
  134. cmp 0 1 4
  135. // If so, jump to the exit label
  136. je 998
  137.  
  138. // Interpret the next character
  139. jmp 0
  140.  
  141. // Post-interpretation stuff
  142. label 998
  143.  
  144. syscall 1 10 1
  145. syscall 2 10
  146.  
  147. syscall 1 11 1
  148. syscall 2 10
  149.  
  150. syscall 1 12 1
  151. syscall 2 10
  152.  
  153. // (Currently nothing needs to happen here)
  154.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×