title: What is the difference between MASM and NASM codes?
body: <p>I have macOS and I'm trying to figure out difference between MASM and NASM.</p>
  <p>As I understand MASM works only for Windows systems, and NASM is is available for other platforms as well. NASM I can compile on my mac:</p>
  <p><code>nasm -f macho64 hello1.asm</code></p>
  <p><code>ld -macosx_version_min 10.7.0 -o hello1 hello1.o</code></p>
  <p><code>./hello1</code></p>
  <pre><code>    global    start
      section   .text
  start:
      mov       rax, 0x02000004
      mov       rdi, 1
      mov       rsi, message
      mov       rdx, 13
      syscall
  
      mov       rax, 0x02000001
      xor       rdi, rdi
      syscall 
  
      section   .data
  message:  
      db        &quot;Hello, World&quot;, 10
  </code></pre>
  <p>But to compile MASM I need to use <code>DOSBox</code></p>
  <p><code>MASM.EXE HELLO2.ASM</code></p>
  <p><code>LINK.EXE HELLO2.OJB</code></p>
  <p><code>HELLO2.EXE</code></p>
  <pre><code>DATA SEGMENT 
      MSG DB  &quot;Hello, World!&quot;, &quot;$&quot;
  DATA ENDS
  
  CODE SEGMENT
      ASSUME CS:CODE, DS:DATA 
      ; INIT SEGMENT REGS 
      START:
          MOV AX, DATA 
          MOV DS, AX 
  
          MOV AH, 09H
          LEA DX, MSG     ; PRINT THE STRING
          INT 21H
  
      STOP:
          MOV AX, 4C00H
          INT 21H 
  CODE ENDS 
      END START
  </code></pre>
  <p>My question may seem silly, but I want to figure it out. Do I understand correctly that <code>hello1</code> is <code>NASM</code>, and <code>hello2</code> is <code>MASM</code>? And if it is right, why can't I execute on <code>DOSBox</code> this:</p>
  <pre><code>.model SMALL
  .386
  
  .data
      tekst db &quot;Hello World!\n&quot;
  .stack 100h
  .code
      .startup
          mov eax, 4
          mov ebx, 1
      mov ecx, offset tekst
      mov edx, 13
      int 80h
          .exit
  end
  </code></pre>