Tuesday, 15 June 2010

c - How to concatenate two strings in assembly? -


Hello I'm trying to insert two stars.

I have string 1, 2, and so on; 3. I need to store the last string in R2.

I load strings using memory by using ldr and I can store them using str .

Code

Do anyone know the effective way to get involved? Do not like to add them up? Registers are limited to a byte of data, so I am doing something wrong ..

I am a Nob.

Something like this. I agree that your strings have not been terminated because they do not appear in your code example.

In addition to STRING1 and STRING2 the .text section (read only permanent memory), while STRING3 must be done in the .data section, because it buffers in a RAM.

 ; Ding is not finished \ 0 (like in C) so let us move to our own size R4, # STRING1_SIZE loop1: ldrb r3, [r0], # 1; Copy STRING1 to SRTRING3 strb r3, [r2], # 1 subs r4, # 1 bne loop1 mov r4, # STRING2_SIZE loop 2: ldrb r3, [r1], # 1; Copy from STRING2 to STRING3 strobe R3, [R2], # 1 subs r4, # 1, Ben Loop 2; Done  

No comments:

Post a Comment