简体   繁体   English

读取intel组件8086清单文件

[英]Reading intel assembly 8086 listing file

Here is my listing file for a program. 这是我的程序清单文件。 However, the question I'm asked is the significance of F0 on line 20. I know the first column represents the address offset and the third column represents the instruction, but how do we figure out what the data means here? 但是,我问的问题是第20行上F0的重要性。我知道第一列代表地址偏移量,第三列代表指令,但是我们如何弄清楚数据在这里的含义?

 1 ; 
 2 ; 
 3 ;
 4                                 section .data
 5
 6 00000000 0102030405             number: db 1,2,3,4,5
 7 00000005 00                     sum: db 0
 8
 9
 10                                section .text
 11                                        global _start
 12
 13                                 _start:
 14 00000000 B905000000            keith: mov ecx, 5
 15 00000005 B800000000            ron:   mov eax, 0
 16 0000000A BB[00000000]                 mov ebx, number
 17 0000000F 0203                  again: add al, [ebx]
 18 00000011 81C301000000                 add ebx,1
 19 00000017 81E901000000                 sub ecx,1
 20 0000001D 75F0                         jnz again
 21 0000001F A2[05000000]                 mov [sum], al
 22
 23 00000024 B801000000                   mov eax,1
 24 00000029 BB00000000                   mov ebx,0
 25 0000002E CD80                         int 80h

Opcode 75 is a short jump . 操作码75是一个短距离跳转 A short jump is a relative jump that is less than 128 bytes away forward or backward from the instruction pointer (IP) of the instruction that follows the jump instruction. 短跳转是相对跳转,相对跳转距离跟随跳转指令的指令的指令指针 (IP)少于128个字节。 (NOTE: in the standard CPU fetch-execute cycle, an instruction is fetched, and then the IP is incremented to the next instruction before the fetched instruction is executed.) (注意:在标准CPU提取执行周期中,将提取一条指令,然后在执行该提取的指令之前 ,将IP递增到下一条指令。)

 16 0000000A BB[00000000]                 mov ebx, number
 17 0000000F 0203                  again: add al, [ebx]
 18 00000011 81C301000000                 add ebx,1
 19 00000017 81E901000000                 sub ecx,1
 20 0000001D 75F0                         jnz again
 21 0000001F A2[05000000]                 mov [sum], al

In this case, your full opcode is: 75F0 . 在这种情况下,您的完整操作码为: 75F0 That's a short jump (if Z flag is 0) a distance from the next IP represented by the signed byte value, F0 . 这是一个短距离的跳跃(如果Z标志为0)与由有符号字节值F0表示的下一个IP的距离。 The signed value of F0h , taken as a 2's complement signed byte, is minus 10h and is computed as: F0h的有符号值(作为2的补码有符号字节)为负10h ,其计算公式为:

  0000000F ; address of "again:" label
- 0000001F ; address of instruction after "jnz"
----------
        F0 ; difference in addresses

This tells the CPU to jump back -10h byte locations from the following IP in order to get to the again: label. 这告诉CPU 跳回 -10h从下面的IP字节位置,以获得对again:标签。

The fact that the distance to jump was so short, the assembler was able to use the short jump . 跳跃距离很短的事实,使组装人员能够使用短距离跳跃 Otherwise, if it were greater than 128 bytes away, a different jump opcode would be needed ( eg , near jump if it's within the 64kB segment - otherwise a far jump is needed). 否则,如果距离大于128个字节,则需要一个不同的跳转操作码( 例如 ,如果它在64kB段内,则为近跳转 -否则需要远跳转 )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM