Advertisement
Guest User

prog1

a guest
Mar 8th, 2017
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ARM 0.48 KB | None | 0 0
  1.         AREA upc, CODE, READONLY   
  2.         ENTRY
  3. Start   ADR r0, UPC-48 ;register r0 points to the upc string
  4.         MOV r1, #6 ;Initializing the loop counter to 12
  5.         MOV r2, #0 ;clearing the sum in r2
  6.         MOV r3, #0  ;clearing r3 for the sum
  7. Loop    LDRB r4,[r0]
  8.         ADD r0,r0, #4 ; point to the next element
  9.         ADD r2, r2, r4 ;add the evens
  10.        
  11.         ADD r0,r0, #4
  12.         ADD r3,r3, r4 ; add the odds
  13.        
  14.         BNE Loop
  15.        
  16.         ;MUL r2,r2,#3
  17.         ADD r5,r2,r3
  18.         SUB r5, r5, #1
  19.        
  20. UPC     DCB "013800150738" ; upc string
  21.         END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement