Hi I have a problem with compiling my x86 assembler code, im using nasm to compile but the compiler tells me that the syntax is wrong. I don’t understand it since im using a simple label and jumping to it? Can somebody please explain it to me..
; reads character and prints ascii code in console
[BITS 16]
SEGMENT code
..start:
mov ax, pile
mov ss, ax
mov ax, topofstack
mov sp, ax
loop: ; gives syntax error
mov ah, 00h
int 16h
cmp ax, 1c0dh ; user pressed enter, jump to end
je end
mov ah, 09h ; write character and attribute at cursor position
mov bh, 0h ; flags...
mov bl, 08h
mov cx, 01h
int 10h
jmp loop ; gives syntax error
end:
mov ax, 04c00h
int 21h
SEGMENT pile stack
resb 64
topofstack:
loopis an instruction, I would suggest changing the label to something likeloop1.Interestingly enough, this doesn’t cause an error in my version of
nasm(2.10.03) , at least with the commandnasm -fobj xx.asm, but the fact that your two errors on on the lines containingloopmake it a pretty safe bet that this is the problem.You may have an earlier (or later) version, or you may be using different options. Certainly worth investigating, anyway.