Appending two string in x86 assembly -


i'm working on assignment in at&t assembly , have append 2 strings:

message: .asciz "string 1" before: .asciz "string 2" 

i have no idea how or how begin. i've searched on internet couldn't find helpful information. think have manually copy characters of second string end of first string i'm not sure that.

could please explain me how this? :)

this not trivial matter. strings variable in length , occupy different spaces in memory, , there has way know how long or end. c or c++, nul bytes (bytes of 0 value) indicates end of string. other program languages, have pointer start of string , length of string stored separately, has advantage of letting store binary (including bytes of 0 value) in string. c , rest, have have pointer string starts.

what has happen have use asm contact operating system , request block of memory free big enough contain contents of 2 strings once attached. memory separate either of 2 strings start with, , comes referred memory heap, once given beginning point of memory block, copy contents of first string it, continue on while copying contents of second string in there right behind first. release memory had been assigned first string , reassign block string changing pointer, , possibly length. released memory returned memory heap operating system reuse elsewhere.

actually, operating system not source of freed memory. compilers, assemblers, either handle memory management on own, or provide suitable tools programmer need arises.

in other words, can ambitious undertaking, , have know quite bit going on right. wrong, can expect consequences crashing system , needing reboot.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -