I am doing an assembly programming practice, on the Windows debug tool for 32 bits.
The proposed exercise is as follows:
Starting at memory location 012F design an algorithm that displays the following stream of characters "This is my first program in DEBUG"
We have been given an example of how to print the typical "Hello World" in assembler.
Following this example, I then proceeded to write my version depending on the proposed exercise:
-a
jmp 120
-e 0102 "Este es mi primer programa en debug" 0a 0d "$"
-a 120
mov ah,09
mov dx,0102
int 21
int 20
All this code, I wrote it, based on the working example. The only thing I have changed is the text.
But when executing the program (that is, executing the -g instruction).
I get the following result:
I do not understand where the problem is, I have reviewed the notes, regarding the instructions, but I do not understand what has failed.
My question is:
What is the error that I have made, which leads me to obtain said erroneous result?
Change your code to the following:
I'm not very good with assembler, but what I can notice is that you
string
are located at position0102
and your application starts at0120
.Now, being
longer than
needs more available positions to be copied. Therefore, when the application starts writing at position
0120
, it is overwriting thestring
and when it tries to print it does not find the end of the string"$"
.So what we're doing with the location
0130
is starting the app a little further away so that the string has enough space to be copied.