Advertisement
Guest User

Untitled

a guest
Mar 2nd, 2015
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. r EQU 2 ;number of rows
  2. c EQU 2 ;number of columns
  3. ORG $1000
  4. START: MOVEA.L #A,A0
  5. MOVEA.L #B,A1
  6. MOVEA.L #D,A2
  7.  
  8. MOVE.W #r,D3 ;used for rows
  9. CLR.W D0 ;offset for A
  10. CLR.W D1 ;offset for B
  11. CLR.W D2 ;offset for D
  12. CLR.W D5 ;calculating the sum
  13. CLR.W D6 ;calculaing the multiplication
  14. CLR.W D7 ;used for number of repeats
  15. L2 MOVE.W #c,D4 ;used for columns mainly for first matrix
  16. L1 CLR.W D5
  17. MOVE.W (A0,D0.W),D5
  18. MULU (A1,D1.W),D5
  19. ADD.W D5,D6
  20. ADD.W #1,D0
  21. ADD.W #c,D1 ;we are moving down a column and thus are adding column to the offset in B
  22. SUB.W #1,D4
  23. BNE L1
  24. MOVE.W D6,(A2,D2.W)
  25. ADD.W #1,D2 ;increment counter for C
  26. ADD.W #1,D7 ;increment repeat
  27. CMP.W #c,D7 ;number of repeats should be equal to column number
  28. BNE RE
  29. CLR.W D7 ;clear repeats because we are moving on to a new row
  30. CLR.W D1 ;set offset for B to 0
  31. SUB.W #1,D3 ;find out through how many rows we went through
  32. BNE L2
  33. STOP #$2700
  34.  
  35. RE SUB.W #c,D0 ;got at the beginning of a row in A
  36. MOVE.W D7,D1
  37. CLR.W D6
  38. BSR L2
  39.  
  40. * Put program code here
  41.  
  42. SIMHALT ; halt simulator
  43.  
  44. * Put variables and constants here
  45. A DC.W 1,2,0,1
  46. B DC.W 1,0,2,1
  47. D DS.W 4
  48.  
  49. END START ; last line of source
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement