1

there is an error when i run following MASM command in NASM environment:

MOV BYTE PTR [DI-02H],0FH

it gives one error and one warning message:

warning: 'PTR' is not a NASM keyword [-w+ptr]
error: symbol 'PTR' not defined

here i want to know that what is NASM option for 'PTR' of MASM.

  • 2
    just remove PTR: `mov BYTE [DI-02h],0FH` – Paweł Łukasik Aug 12 '20 at 10:52
  • 2
    assembly language is defined by the assembler, the tool, not the target (x86), so you need to write code for the programming (assembly) language that matches the tool. (or ask the tool if supported to use a different programming language) – old_timer Aug 12 '20 at 13:49
  • Do you have a bunch of pre-existing MASM code? If you only fix syntax errors like this, it will assemble but then not work if you ever have code like `mov eax, symbol`. In NASM, that's a mov-immediate of the address; in MASM it's a load. If you were careful to always use `mov eax, [symbol]` in your MASM code, that will mean the same thing in NASM so you might be ok. If you don't have a bunch of existing code, write it in NASM syntax in the first place. – Peter Cordes Aug 12 '20 at 19:10
  • See [also](https://stackoverflow.com/a/13791007/774575). – mins Aug 12 '20 at 19:35

1 Answers1

5

A limited amount of MASM compatibility can be enabled using the

%use masm

directive. Among other features, this enables a MASM-like PTR keyword.

Refer to the manual for details.

fuz
  • 88,405
  • 25
  • 200
  • 352