c - How to concatenate two strings in assembly? -


hello trying concatenate 2 strings.

i load strings 1, 2, & 3. need store final string in r2.

i load strings memory using ldr , can store them using str.

code

anyone know effective way concatenate them? adding them above not right? registers limited 1 byte of data maybe doing else wrong..

i noob.

sonething that. assume strings aren't null terminated because doesn't appear in code example.

also you'd want store string1 , string2 in .text section (read permanent memory), while string3 .data section, since buffer in ram.

;stings aren't \0 terminated (like in c) should deal size ourselves      mov  r4, #string1_size loop1:     ldrb r3, [r0], #1   ;copy string1 srtring3     strb r3, [r2], #1     subs r4, #1     bne  loop1      mov  r4, #string2_size loop2:     ldrb r3, [r1], #1   ;copy string2 string3     strb r3, [r2], #1     subs r4, #1     bne  loop2      ;done 

Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -