Using INT for Displaying

Why is that instruction 109 appears to be executed even if it doesn't actually reach by the instruction pointer when run. As far as I know(C++ background), the processor process instructions 1 at a time and in an orderly fashion. Address 100,102,105, and 107 are executed first, and so how come INT 21 can display the contents of memory location 109 prior to being the next line (not yet declared)?

(suppose we enter these instructions on debug)

100 MOV AH,09
102 Dx,109
105 INT 21
107 JMP 100
109 DB 'Hello World', '$' <Enter> <Enter> 

DB is not an instruction, it is a pseudo instruction aka assembler directive. It tells the assembler to store the following data bytes at the current address.


When the program is assembled, the assembler will put your string at the right address. The processor can read from addresses it is not executing. The instruction pointer is only one pointer, you can read from addresses larger than the instruction pointer without issues. The memory is "random-accessible" after all.

There is no "declaration". There is only addresses. Some assembly programs have labels, but those labels are translated by the assembler to addresses upon assembly.

链接地址: http://www.djcxy.com/p/80352.html

上一篇: 8086中的中断,指令指针和指令队列

下一篇: 使用INT显示