What42

JASM Light v2.2

Mar 26th, 2020 (edited)
617
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.66 KB | None | 0 0
  1. Go to the github page: https://github.com/What42Pizza/JASM-Light-2
  2.  
  3. JASM Light 2.2.0
  4.  
  5. Started: 05/15/19
  6. Last worked on: 02/20/20
  7.  
  8.  
  9.  
  10. 00 NOP --- No operation.
  11. 01 STA num Sets register A to "num".
  12. 02 STB num Sets register B to "num".
  13. 03 RDA add Reads from memory "add" to register A.
  14. 04 RDB add Reads from memory "add" to register B.
  15. 05 WTA add Writes register A to memory "add".
  16. 06 WTB add Writes register B to memory "add".
  17. 07 WTC add Writes register C to memory "add".
  18. 08 MCA --- Moves register C to register A.
  19. 09 MCB --- Moves register C to register B.
  20. 0A ADD --- Sets register C to register A + register B.
  21. 0B SUB --- Sets register C to register A - register B.
  22. 0C INA --- Sets register C to register A incremented by 1.
  23. 0D DCA --- Sets register C to register A decremented by 1.
  24. 0E SLA --- Sets register C to register A shifted left by 1.
  25. 0F AND --- Sets register C to register A bitwise and register B.
  26. 10 OUT add Sets the IO register to memory "add".
  27. 11 OTC --- Sets the IO register to register C.
  28. 12 INP add Sets momory "add" to the IO register.
  29. 13 JMP add Jumps to "add".
  30. 14 JPE add Jumps to "add" if register A = register B.
  31. 15 JPG add Jumps to "add" if register A < register B.
  32. 16 JPL add Jumps to "add" if register A > register B.
  33. 17 STP --- Stops execution.
  34.  
  35.  
  36.  
  37. Every instruction takes two memory addresses. The first address is used for the
  38. instruction, and the second address is used for the instruction's data. For example, this
  39. is what you would use for STA 0A:
  40. 01
  41. 0A
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49. Sub-routine simulator:
  50.  
  51. 00 JMP
  52. 01 ADDRESS --------- Program start
  53. 02 WTA ------------- Start sub-routine
  54. 03 0F
  55. 04 RDA
  56. 05 0D
  57. 06 INA
  58. 07 00
  59. 08 WTC
  60. 09 0D
  61. 0A WTC
  62. 0B 11
  63. 0C WTB
  64. 0D 1D
  65. 0E JMP
  66. 0F 00
  67. 10 RDA ------------- End sub-routine
  68. 11 1D
  69. 12 WTA
  70. 13 1D
  71. 14 RDA
  72. 15 0D
  73. 16 DCA
  74. 17 00
  75. 18 WTC
  76. 19 0D
  77. 1A WTC
  78. 1B 11
  79. 1C JMP
  80. 1D 00
  81. 1E 00 ------------- Sub-routine return addresses (emulated stack)
  82. ...
  83. 2D 00
  84.  
  85.  
  86. 19
  87. 46
  88. 05
  89. 15
  90. 03
  91. 13
  92. 12
  93. 00
  94. 07
  95. 13
  96. 07
  97. 17
  98. 06
  99. 29
  100. 19
  101. 00
  102. 03
  103. 29
  104. 05
  105. 29
  106. 03
  107. 13
  108. 13
  109. 00
  110. 07
  111. 13
  112. 07
  113. 17
  114. 19
  115. 00
  116.  
  117.  
  118.  
  119. Fibonacci (stored in RAM):
  120.  
  121. 00: STA
  122. 01: 01
  123. 02: STB
  124. 03: 01
  125. 04: ADD
  126. 05: 00
  127. 06: WRB
  128. 07: 16
  129. 08: MCB
  130. 09: 00
  131. 10: RDA
  132. 11: 07
  133. 12: INA
  134. 13: 00
  135. 14: WRC
  136. 15: 07
  137. 16: RDA
  138. 17: 16
  139. 18: WRC
  140. 19: 11
  141. 20: JMP
  142. 21: 04
  143.  
  144.  
  145. 01
  146. 01
  147. 02
  148. 01
  149. 10
  150. 00
  151. 06
  152. 22
  153. 09
  154. 00
  155. 03
  156. 07
  157. 14
  158. 00
  159. 07
  160. 07
  161. 03
  162. 22
  163. 07
  164. 17
  165. 16
  166. 04
  167.  
  168.  
  169.  
  170. Fibonacci: (Outputted)
  171.  
  172. 00: STA
  173. 01: 01
  174. 02: STB
  175. 03: 00
  176. 04: ADD
  177. 05: 00
  178. 06: OTC
  179. 07: 00
  180. 08: MCB
  181. 09: 00
  182. 10: ADD
  183. 11: 00
  184. 12: OTC
  185. 13: 00
  186. 14: MCA
  187. 15: 00
  188. 16: JMP
  189. 17: 04
  190.  
  191.  
  192. 01
  193. 01
  194. 02
  195. 00
  196. 10
  197. 00
  198. 17
  199. 00
  200. 09
  201. 00
  202. 10
  203. 00
  204. 17
  205. 00
  206. 08
  207. 00
  208. 19
  209. 04
Add Comment
Please, Sign In to add comment