Hello guys !

I've just started to learn Assembler and I needed an assembler. My choice was nasm, because of the same syntax as masm and tasm (at least that's what i heard ^^)

I used apt-get to install nasm, everything ok until here.

I wrote my first script (copied it from a book)

Then i wanted to use nasm to assemble (?) it, but it didn't work that well.

This is what the terminal told me

# nasm asm1.asm
asm1.asm:1: error: parser: instruction expected
asm1.asm:6: error: symbol `DATEN' redefined
asm1.asm:6: error: parser: instruction expected
asm1.asm:8: error: parser: instruction expected
asm1.asm:10: error: parser: instruction expected
asm1.asm:15: error: comma or end of line expected
asm1.asm:25: error: symbol `CODE' redefined
asm1.asm:25: error: parser: instruction expected
asm1.asm:27: error: parser: instruction expected

alright, doesn't look too good

this is my script:

DATEN SEGMENT

Meldung db "Assemler blablabla"
db "$"

DATEN ENDS

CODE SEGMENT

ASSUME CS:CODE,DS:DATEN

Anfang: mov ax,DATEN
mov ds,ax

mov dx,offset Meldung

mov ah,9

int 21h

mov ah,4Ch

int 21h

CODE ENDS

END Anfang

Can anybody tell me, what was wrong ?

Your assumption that NASM has the same syntax as ML (Masm) or TASM. Yes, for the most part opcodes are similar. An example would be.

ML: mov eax, Data
mov eax, offset Data

NASM: mov eax, [Data] the contents of location Data
mov eax, Data the address of data

If your going to use NASM you'll have to read the manual.

Biggest difference is NASM does not have segmented memory models and therefore ASSUMES nothing

Alright, thank you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.