neir45
neir45

Reputation: 31

Simple Assembly procedure (Hello world)

I'm trying to write my first assembly procedure, but NASM gives me errors when assembling. My code is:

Hello PROC
segment .data
tekst db "Hello World!",0Dh,0Ah,"$"
segment stosik stack
resb 64
segment .text
mov ax, .data
mov ds, ax
mov ax, stosik
mov ss, ax
mov dx, tekst
mov ah, 9
int 21h
mov ax, 4C00h
int 21h
ENDP

This code will give me this error on the first line with the PROC directive:

error: parser: instruction expected

Why am I getting this error and how can I fix it so that my code will assemble properly?

Upvotes: 2

Views: 459

Answers (1)

Liam_LightChild
Liam_LightChild

Reputation: 81

Hello PROC
...
ENDP

is correct in masm/tasm, however will not work using nasm. The correct syntax would be:

Hello:
...

Using masm/tasm syntax with nasm will make it complain about the first and last lines for error: parser: instruction expected and warning: label alone on a line without a colon might be in error.

Upvotes: 1

Related Questions