Intel x86 assembly code behavior question?

Up vote 1 down vote favorite share g+ share fb share tw.

I have a Intel assembly x86(16 bit version) assembly code as below which prints the message fine. Using flat assembler to assemble on Win-7 32 bit. ORG 100h USE16 mov ah, 09 mov dx, message jmp Displayit ;unconditional jump mov ah,01 int 21h mov ah,4ch int 21h Displayit: int 21h message db 'Testing assembly jump instruction', 0Ah, '$' If I move the string definition of message(in code below), at the beginning, it does not print that string?

What is the reason? Also, although I have the instruction mov ah, 01, int 21h to keep the output command prompt/console from closing, it does not work. The console just closes before I can see the message is printed or not?

. ORG 100h USE16 message db 'Testing assembly jump instruction', 0Ah, '$' mov ah, 09 mov dx, message jmp Displayit ;unconditional jump mov ah,01 int 21h mov ah,4ch int 21h Displayit: int 21h assembly intel link|improve this question edited Jun 20 '11 at 17:22karlphillip19.2k52149 asked Jun 20 '11 at 10:40goldenmean3,28912659 60% accept rate.

– goldenmean Jun 20 '11 at 11:00 Also even if I put the mov ah,01 code in the Displayit: label, the console closes without waiting on it. And the string gets printed only if message is not at the beginning, but somewhere down. Strange!

– goldenmean Jun 20 '11 at 11:03 The string is pritned only if it is defined anywhere after the jmp instruction call. – goldenmean Jun 20 '11 at 11:05.

If you define the string at the beginning, it will be executed as code. This leads to a crash or all kinds of undefined behaviour. The instruction sequence beginning with mov ah,1 is never executed, you jump over it.

Even if I put the mov ah,1 code in the jump label DisplayIT:, still the console window just closes without waiting there. – goldenmean Jun 20 '11 at 12:10 Yeah, you are correct. My bad.

Now it does wait on the console, when code mov ah,1 is in jump label. – goldenmean Jun 20 '11 at 12:12.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions