开发者

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, '$'
  1. If I move the string definition of message(in code below), at the beginning, it does not print that string? What is the reason?

  2. 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


  1. 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.

  2. The instruction sequence beginning with mov ah,1 is never executed, you jump over it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜