Intel x86 assembly code behavior question
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 bi开发者_如何学JAVAt.
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
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.
精彩评论