Advertisement
Guest User

Untitled

a guest
Mar 8th, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ARM 0.38 KB | None | 0 0
  1. Start   ADR r0, UPC ;register r0 points to the upc string
  2.         MOV r1, #6 ;Initializing the loop counter to 12
  3.         MOV r2, #0 ;clearing the sum in r2
  4.         MOV r3, #0  ;clearing r3 for the sum
  5. Loop    LDRB r4,[r0]
  6.         SUBS r4,r4,#48
  7.         ADD r2, r2, r4 ;add the odds
  8.         ADD r0,r0, #1 ; point to the next element
  9.         LDRB r4,[r0]
  10.         SUBS r4,r4,#48
  11.         ADD r3,r3, r4 ; add the evens
  12.         SUBS r1,r1,#1
  13.         BNE Loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement