SHARE
TWEET

Untitled

a guest Nov 17th, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. BEGIN:  INP R7,2 //Read M
  2.         INP R6,2 //Read Q
  3. TEST1:  MOV R2,R6
  4.     MOD R2,#2//Q[0]
  5.     CMP R2,#0//Q[0]==0
  6.     BEQ RSHIFT
  7.     ADD R4,R4,R7//A=A+M
  8.     LSR R1,R7,#7//M[7]
  9.     MUL R2,R2,R1//Q0*M7
  10.     ADD R3,R3,R2//F=F+
  11. RSHIFT: //shiftare
  12.     LSL R2,R3,#7
  13.     LSR R1,R4,#1
  14.     ADD R4,R1,R2
  15.     LSR R2,R4,#7
  16.     AND R1,R6,#254
  17.     ADD R6,R1,R2
  18.     CMP R5,#1//COUNT==1
  19.     BEQ TEST2
  20.     ADD R5,#1//COUNT++
  21.     BRA TEST1
  22. TEST2:  MOV R2, R6
  23.     MOD R2,#2//Q[0]
  24.     CMP R2,#0//Q[0]==0
  25.     BEQ OUTPUT
  26.     SUB R4,R4,R7//A=A-M
  27.     AND R6,#254
  28. OUTPUT: OUT R4,4
  29.     OUT R7,4
  30.  
  31. THEEND    HLT
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top