0

I wrote a simple Hello World program and when I run that, I have this error: "error A2022:instruction operands must be the same size".

.DATA
msg DB "Hello World", 10
len EQU $ - msg
.CODE
Main PROC
    Print PROC
        MOV RAX, 4
        MOV RBX, 1
        MOV RCX, msg
        MOV RDX, len
        INT 80
    Print ENDP
Main ENDP
END
Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
  • 1
    Even if you did port this bad NASM code to MASM syntax correctly (`OFFSET msg` to get the address as an immediate), you know it won't work in a Windows executable, right? `int 80h` is the Linux 32-bit system call interface, which Windows doesn't support. (`int 80` (decimal) isn't anything, and will fail under any OS.) With bugfixes, this code could work with JWASM to make a working Linux executable, but [What happens if you use the 32-bit int 0x80 Linux ABI in 64-bit code?](https://stackoverflow.com/q/46087730) - don't. – Peter Cordes Jan 13 '21 at 16:20
  • See also [NASM tutorial uses int 80h, but this isn't working on Windows](https://stackoverflow.com/q/38269269) and [What does "int 0x80" mean in assembly code?](https://stackoverflow.com/q/1817577) – Peter Cordes Jan 13 '21 at 16:31
  • @PeterCordes Thanks for responding, now I have this error: LINK : error LNK2001: prog1.exe : fatal error LNK1120: – top skins Jan 13 '21 at 19:15
  • Did you google those error codes? That would be the obvious first step. – Peter Cordes Jan 13 '21 at 19:17

0 Answers0