Andrei Moiseev
Andrei Moiseev

Reputation: 4084

Strange JWASM (MASM-compatible) behaviour

cmp word ptr ds:[0], 0AA55h

assembled and objdumped, it looks like this:

67 81 3d 00 00 00 00    addr32 cmpw $0xaa55,0x0
55 aa

Why addr32 is here? I mean to do the same thing I did in AT&T (GAS) syntax:

cmpw    $0xAA55, %ds:0

which, in its turn, objumped:

81 3e 00 00 55 aa       cmpw   $0xaa55,0x0

There is use16 in the beginning of the file, and almost everything seems ok, except of this.

Upvotes: 1

Views: 172

Answers (1)

Max Malysh
Max Malysh

Reputation: 31585

I guess the reason is that actually you have specified .i386 (or higher) directive in JWASM, what results in 32-bit code generation as Intel 80386 was a 32-bit CPU.

Try compiling this code with .i286 directive in order to archive real 16-bit code.

Upvotes: 1

Related Questions