8086 Programming Basics

how can i concantenate a string with a string variable by using PROMPT ?

for example , in VB

string1 ="Hello" & var_NAME

how to do that in assembly programming ?

pls give me an example . Thanks
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Try Assembly TA.

As I recall, one good approach is to have a label for two or three areas of data. Either add str1 to str3, then add str2 to str3, or, just add the one to the other (note, this is destructive of original string, so it shlould not have further use.

Define string as a row of text (bytes) beginning at a label. Each has a length, or runtime means to assess its termination.
ANGmohAuthor Commented:
can u please elaborate ? i cant get you ..
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

I haven't done much assembly lately. For label of "String1" you append the colon (":") and follow on same line or next with a reserved storage for data bytes. For simple sample or test, you can predefine the strings. That's there "where" it is in RAM. Perhaps make it 256 characters (bytes) long. Make comment on intentions.

To access each string, you place the address in an index register of choice, and find each character of string by an appropriate offset for character number, or position. An initial code attempt could be wise to use the very first reserved byte for indicating length of string, so that you know when you reach the end.  So address String1 +0 is length, and if value is zero, then it is empty string. Drawback is that when you create new string, you have to revisit the front to update length. String1 + 1 is then character in first position.

Alternative is to have a special character, such as <nul> or <cr> to indicate end of string. Thus the code continues until it finds that character.  (Later on you can get more sophisticated and make variable strings to save storage, and make heavier use of stack and indexing, don't think about that now).
Actually, we should say that there is no gurantee that any two Assembly Languages use same syntax, they only need to generate code acceptable to machine, so even operand order can be different. Here's a sample of possible string definition:

String1      DB       "Hello",0,"World",0      ;2 null-terminated strings
String2      DB       256 DUP (?)              ; Reserved storage for future use for strings
String3      BYTE     "Hello World",0Dh         ; <cr><lf>
             BYTE     0Ah
In assembly, strings are like C-strings : an array of character (byte) which ends with value 0 ( '\0' ).

Here is an example of how you may want to fill a char array, 1st statement is in C then in ASM.

x[0] = 'H';
mov     BYTE PTR _x$[ebp], 72    ;value 72 stands for H

x[1] = 'e';
mov     BYTE PTR _x$[ebp+1], 101     ;value 101 stands for e

x[2] = 'l';
mov     BYTE PTR _x$[ebp+2], 108

x[3] = 'l';
mov     BYTE PTR _x$[ebp+3], 108

x[4] = 'o';
mov     BYTE PTR _x$[ebp+4], 111

x[5] = ' ';
mov     BYTE PTR _x$[ebp+5], 32

x[6] = 'W';
mov     BYTE PTR _x$[ebp+6], 87    

x[7] = 'o';
mov     BYTE PTR _x$[ebp+7], 111

x[8] = 'r';
mov     BYTE PTR _x$[ebp+8], 114

x[9] = 'l';
mov     BYTE PTR _x$[ebp+9], 108

x[10] = '\0';     ;this tells the string ends here
mov     BYTE PTR _x$[ebp+10], 0

Then to concatenate, ecrase the ending '\0' with the ascii value you want, continue filling the array, don't forget to end it with another 0 value.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.