computer_enhance icon indicating copy to clipboard operation
computer_enhance copied to clipboard

`[0]` mistakenly decodes to `[]`

Open jceipek opened this issue 1 year ago • 1 comments

Given the file:

; listing A
bits 16
mov ax, [0]

nasm produces A1 00 00

sim86 decodes that to:

; listing A disassembly
bits 16
mov ax, []

which nasm cannot assemble (error: expression syntax error).

I would expect it to produce listing A.

This happens because PrintEffectiveAddressExpression of an effective_address_expression with no terms and a 0 Displacement doesn't print anything due to this conditional:

    if(Address.Displacement != 0)
    {
        fprintf(Dest, "%+d", Address.Displacement);
    }

jceipek avatar Mar 30 '23 03:03 jceipek