1. /Evan O'Keeffe
  2. /10324289
  3. /5x5 matrix adder
  4.  
  5. /initialize routine
  6. ORG 100
  7. load stmp
  8. add sm1 / adding the address of matrix one
  9. store strcmd
  10. CLEAR
  11. /input for the first matrix
  12. loop1, input
  13. store datatemp
  14. jns stri
  15. load count1
  16. subt one
  17. store count1
  18. clear
  19. load count1
  20. skipcond 400
  21. jump loop1
  22.  
  23. /this is the second matrix
  24. clear
  25. load stmp
  26. add sm2 /adding the address of the second matrix
  27. store strcmd
  28. CLEAR
  29.  
  30. loop2, input
  31. store datatemp
  32. jns stri
  33. load count2
  34. subt one
  35. store count2
  36. clear
  37. load count2
  38. skipcond 400
  39. jump loop2
  40. /this is the routine to add the two matrices
  41. load stmp
  42. add sm3 /adding the address of the third matrix
  43. store strcmd
  44. load sm1
  45. store tmp1
  46. load sm2
  47. store tmp2
  48.  
  49. loop3, clear
  50. addi tmp1
  51. addi tmp2
  52. skipcond 000
  53. jump I
  54. jump error
  55. I, store datatemp
  56. jns stri
  57. load tmp1
  58. add one
  59. store tmp1
  60. load tmp2
  61. add one
  62. store tmp2
  63. clear
  64. load count3
  65. subt one
  66. store count3
  67. clear
  68. load count3
  69. skipcond 400
  70. jump loop3
  71.  
  72. /routine to print out results
  73. load sm3
  74. store addr
  75.  
  76. loop4, clear
  77. addi addr
  78. output
  79. load addr
  80. add one
  81. store addr
  82. clear
  83. load count4
  84. subt one
  85. store count4
  86. skipcond 400
  87. jump loop4
  88. jump end
  89.  
  90. /routine to print out the over flow error message
  91. error, load em
  92. store addr
  93. error1, clear
  94. addi addr
  95. output
  96. load addr
  97. add one
  98. store addr
  99. clear
  100. load count5
  101. subt one
  102. store count5
  103. skipcond 400
  104. jump error1
  105. jump end
  106.  
  107. end, halt
  108.  
  109. /store indirect routine for the first 3 loops
  110. stri, hex 0 /this contains the address from the jns
  111. load datatemp
  112. strcmd, hex 0
  113. load strcmd
  114. add one
  115. store strcmd
  116. jumpi stri
  117. /end of sub routine
  118.  
  119. /VARIABLES
  120. addr, hex 0
  121. count1, DEC 4
  122. count2, DEC 4
  123. count3, DEC 4
  124. count4, DEC 4
  125. count5, dec 16
  126. one, DEC 1
  127. tmp, hex 0
  128. tmp1, hex 140
  129. tmp2, hex 200
  130. stmp, hex 2000
  131. sm1, hex 170
  132. sm2, hex 189
  133. sm3, hex 1A2
  134. em, hex 1BC
  135. datatemp, hex 0
  136. matrix1, hex 0
  137. hex 0
  138. hex 0
  139. hex 0
  140. hex 0
  141. hex 0
  142. hex 0
  143. hex 0
  144. hex 0
  145. hex 0
  146. hex 0
  147. hex 0
  148. hex 0
  149. hex 0
  150. hex 0
  151. hex 0
  152. hex 0
  153. hex 0
  154. hex 0
  155. hex 0
  156. hex 0
  157. hex 0
  158. hex 0
  159. hex 0
  160. hex 0
  161. matrix2, hex 0
  162. hex 0
  163. hex 0
  164. hex 0
  165. hex 0
  166. hex 0
  167. hex 0
  168. hex 0
  169. hex 0
  170. hex 0
  171. hex 0
  172. hex 0
  173. hex 0
  174. hex 0
  175. hex 0
  176. hex 0
  177. hex 0
  178. hex 0
  179. hex 0
  180. hex 0
  181. hex 0
  182. hex 0
  183. hex 0
  184. hex 0
  185. hex 0
  186. matrix3, hex 0
  187. hex 0
  188. hex 0
  189. hex 0
  190. hex 0
  191. hex 0
  192. hex 0
  193. hex 0
  194. hex 0
  195. hex 0
  196. hex 0
  197. hex 0
  198. hex 0
  199. hex 0
  200. hex 0
  201. hex 0
  202. hex 0
  203. hex 0
  204. hex 0
  205. hex 0
  206. hex 0
  207. hex 0
  208. hex 0
  209. hex 0
  210. hex 0
  211. message, hex 0
  212. emessage, dec 79/o
  213. dec 86/v
  214. dec 69/e
  215. dec 82/r
  216. dec 13/carriage return
  217. dec 70/f
  218. dec 76/l
  219. dec 79/o
  220. dec 87/w
  221. dec 13/carraige return
  222. dec 69/e
  223. dec 82/r
  224. dec 82/r
  225. dec 79/o
  226. dec 82/r
  227. dec 0