ARM Code: Length of carriage return terminated String

ARM Assembly Code to find the length of Carriage return terminated string

This code is tested in Keil uVision 4. 

Basically The Carriage Return (CR) character (0x0D, \r) moves the cursor to the beginning of the line without advancing to the next line. This character is used as a new line character in Commodore and Early Macintosh operating systems (OS-9 and earlier). 

ARM Code :
area string,code
LDR R0,=data
MOV R1,#00
loop LDRB R2,[R0],#1
     CMP R2,0x0D
     BEQ stop
     ADD R1,#1
     B loop
stop b stop
data dcb "codesexplorer\r"

Output Pic :

Download Code:
 To Download the Code click on the link below:
 LCD Program Download

No comments:

Powered by Blogger.