x86 - The binary of opcode in assembly -
x86 - The binary of opcode in assembly -
i have next code (after producing listing file, written intel 80x86):
1 global _start 2 3 section .data 4 00000000 03000000 x: dd 3 5 6 ;section .text 7 8 _start: 9 00000004 8b0d[00000000] mov ecx, [x] 10 0000000a 000d[16000000] r: add together byte [l+6], cl 11 00000010 c605[00000000]30 l: mov byte [x], 48 12 00000017 51 force ecx 13 00000018 b804000000 mov eax, 4 ; "write" scheme phone call 14 0000001d bb01000000 mov ebx, 1 ; standard output 15 00000022 b9[00000000] mov ecx, x ; "buffer" 16 00000027 ba01000000 mov edx, 1 ; byte counter 17 0000002c cd80 int 0x80 18 0000002e 59 pop ecx 19 0000002f e2d9 loop r, ecx 20 21 00000031 bb00000000 mov ebx, 0 22 00000036 b801000000 mov eax, 1 ; "exit" scheme phone call 23 0000003b cd80 int 0x80
i'm concentrating on row 19, , don't understand it. understand binary of opcode 'loop' e2.
but d9 byte? how calculated?
19 0000002f e2d9 loop r, ecx
where sec opcode (d9) come from?
the sec opcode (0xd9
in case) relative destination address in two's complement - since jumping backwards, negative in case:
0x00000031 (the address next loop instruction) + 0xffffffd9 (signed-extended representation of 0xd9 - negative number, -39 decimal) ============ 0x0000000a (the address of r label)
note destination address calculated based on address after loop instruction.
see http://www.mathemainzel.info/files/x86asmref.html#loop
assembly x86 opcode
Comments
Post a Comment