Вопрос

I want to disassemble a very simple row binary code (.com file) with nasm but the output is not what i expected.the main code is:

mov ax,4
push ax
mov ax,7
push 9

but the output in nasm is: (and i also tried to use IDA Pro and it was the same)

00000000 B80400    mov ax,0x4
00000003 B80750    mov ax,5007
00000006 006809    add [bx+si+0x9],ch
00000009 0000      add [bx+si],al

as you can see the binary code is right, just the interpretation is wrong (i think because of last 3 extra zero bytes that is caused by another program i am using.or maybe something else!)

how can i omit last zeros in the binary code? or any way for nasm to interpret the code as i want?

thank you

Это было полезно?

Решение

B80750 is indeed mov ax, 0x5007. Nothing wrong there.

Anyway the given code fragment should assemble into something like this:

00000000  B80400            mov ax,0x4
00000003  50                push ax
00000004  B80700            mov ax,0x7
00000007  6A09              push byte +0x9

If you assembled the .com file yourself you are doing it wrong.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top