0

I am total beginner to ASM and I am following this tutorial. Code in this example is not working. I am using Linux Mint and both on my 64bit computer and 32bit laptop nasm is displaying same errors:

rad.asm:1: error: attempt to define a local label before any non-local labels
rad.asm:1: error: parser: instruction expected
rad.asm:2: error: attempt to define a local label before any non-local labels
rad.asm:2: error: parser: instruction expected
rad.asm:4: error: attempt to define a local label before any non-local labels
rad.asm:13: error: comma, colon or end of line expected
rad.asm:19: error: parser: instruction expected

This is the code:

.model small
.stack 100h

.data
dexter db "Hello$"

.code
start:
    mov ax, @data
    mov ds, ax
    mov ah, 09h
    mov dx, offset dexter
    int 21h
    mov ah, 4ch
    int 21h
end start

I have successfully installed nasm because other "Hello World" examples I can compile successfully using:

nasm -f elf name.asm
ld name.o -o test
./test

Does NASM for Windows compile code different that NASM for Linux?

user3486470
  • 296
  • 1
  • 11
  • 2
    That is 16 bit DOS code, that won't work on linux. It will work in a dos emulator such as dosbox. Also it is not `nasm` syntax, the tutorial uses `tasm`. – Jester Nov 13 '14 at 17:55
  • No, but Nasm needs to assemble different code for Windows/Linux. What you've got there is DOS code in Masm/Tasm syntax. – Frank Kotler Nov 13 '14 at 17:59

0 Answers0