Lunar Lunatic
Lunar Lunatic

Reputation: 397

I get a macro error in NASM: 'error: parser: instruction expected'

I keep getting the same error: error: parser: instruction expected
I get this error with the following line:

WSTRING 'MESSAGE'

My code is:

Bits 16  
call clear_screen  
WSTRING 'MESSAGE'  
jmp $   

%MACRO WSTRING 1  
     mov si, %1  
     call print  
%ENDMACRO   

I've tried this and doesn't work either:

Bits 16
MSG DB 'MESSAGE',0
call clear_screen
WSTRING MSG
jmp $

%MACRO WSTRING 1
    mov si, %1
    call print
%ENDMACRO

Upvotes: 0

Views: 2579

Answers (1)

Grigory Rechistov
Grigory Rechistov

Reputation: 2214

You cannot use a literal string as an instruction's operand. You can only use string 's address. This means, you need to instruct the assembler to place that string somewhere, and then use its symbolical address.

Upvotes: 2

Related Questions