Advertisement
Guest User

strcmp by Xhendos

a guest
Aug 30th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. init:
  2.     LDR R0, =STRING1    ; &STRING1
  3.     LDR R1, =STRING2    ; &STRING2
  4.        
  5. loop:
  6.     LDRB R2, [R0, #0x04]!        
  7.     LDRB R3, [R1, #0x04]!      
  8.  
  9.     CMP R2, 0              
  10.     BEQ are_equal       ; Reached null terminator, let's do the final check
  11.  
  12.     CMP R2, R3
  13.     BEQ loop            ; The current character is the same, let's check the next
  14.     B   not_equal       ; The current character is not the same, we are done.
  15.  
  16.  
  17. are_equal:
  18.     CMP R2, R3
  19.     BEQ equal                                                                                                                        
  20.     B not_equal
  21.        
  22. equal:
  23.     ;code continues here    
  24.  
  25. not_equal:
  26.     ;code continues here
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement