lately i downloaded nasm for compiling .asm files but when im trying to compile something(by using in cmd "d:\nasm\nasm.exe -f bin d:\nasm\myfile.asm -o d:\nasm\myfile.com") i get the following error: "d:\nasm\hw.asm:4: error: parser: instruction expected"... does anyone know why and wanna help me? thanx in advance

the attached file...


i have no ideea how this code works but i decided that ill learn 'computer's arhitecture' while learning assembly because honestly doesnt make any sense to me just learning 'how computer works' if i dont even know what im learning about, will help me with the asm language... my point is, i just wanna get used with the compiling and stuff like this. thanx alot for helping me :!:


ps. the code is taken from emu8086(a kinda editor+compiler)'s exercises...

Attachments
; The easiest way to print out "Hello, World!"

name "hi"

org 100h

jmp start       ; jump over data declaration

msg:    db      "Hello, World!", 0Dh,0Ah, 24h

start:  mov     dx, msg  ; load offset of msg into dx.
        mov     ah, 09h  ; print function is 9.
        int     21h      ; do it!
        
        mov     ah, 0 
        int     16h      ; wait for any key....
        
ret ; return to operating system.

Hi uu666,
It's not a big problem since you should comment out the line:

name "hi"

and that's all.
And your code would look like this:

; The easiest way to print out "Hello, World!"

;name "hi"

org 100h

jmp start ; jump over data declaration

msg: db "Hello, World!", 0Dh,0Ah, 24h

start: mov dx, msg ; load offset of msg into dx.
mov ah, 09h ; print function is 9.
int 21h ; do it!

mov ah, 0
int 16h ; wait for any key....

ret ; return to operating system.

and assemble your code using this:

nasm.exe -o hw.com hw.txt

Good luck.

This article has been dead for over six months. Start a new discussion instead.