0

I was exploring the 8086 instruction set and was writing simple assembly codes in emu8086. I understood all the MOV,ADD, and other instructions until I encountered the LOOP instruction. The LOOP is converted to E2, that's fine. But for the label to branch, how does the assembler converts it? If the code is simple, many a times 'label' is converted to FC. Sometimes to FA, F8, and others. It would be very appreciable if you discuss the mechanism of converting the label name to its corresponding machine code.

Thanks.

4

1 回答 1

2

本页所述,标签只是我们(程序员)的助记符。汇编器将该标签翻译成一个数字,例如要添加到要跳转到的指令指针的偏移量,而CX不是零。在您展示的示例中,这些偏移量是负数(符号位设置为 1)。所以它会跳回几条指令,就像你在循环中所期望的那样。

于 2016-04-24T01:02:46.427 回答