Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

ARM Assembly language program

Status
Not open for further replies.

fistpunch

Newbie level 4
Joined
Oct 18, 2010
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,323
I need to write an ARM assembly language routine that will replace a character in a string with another specified character and print the resulting string. You should return the pointer to the new string to the C program

The C driver code is below.
#include <stdlib.h>
#include <stdio.h>

extern char * subit( char *string, char this_c, char that_c ) ;

int main( int argc, char *argv[] )
{
char this_c= ‘e’ ;
char that_c = ‘x’ ;
char orgstr[] = "The quick brown fox jumped over the lazy dog" ;
char * result ;

result = subit( orgstr, this_c, that_c ) ;
printf( “old: %s\n”, orgstr ) ;
printf( “new: %s\n”, result ) ;

exit( 0 ) ;
}

I have part of the code done to check the length of the string which is:

stmfd sp!, {v1-v6, lr} ; standard entry
mov v1, #0 ; set index to zero
mov v2, #0 ; set count equal to zero
loop
ldrb v3, [a1, v1] ; get element
add v2, v2, #1 ; increment count
add v1, v1, #1 ; increment index
cmp v3, #0 ; end of string
bne loop ; end loop
sub v2, v2, #1 ; one less element
mov a1, v2 ; return value to C

I dont know how to finish the rest. Can anyone help?
 

Which compiler do u use if u are using gcc there is an option to get .asm or .s file using the switch -as.
Try that option instead of writing manually
 

I am using ARM IDE, would gcc work to get the .s file?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top