June-Solstice
June-Solstice

Reputation: 43

Assembling a JMPI instruction in NASM gives the error "parser: instruction expected"

I have this assembly code:

fin:   
jmpi 0,0xc200
hlt            ;halt cpu run and wait instructions
jmp fin

jmpi 0,0xc200 is incorrect and I cannot understand what is wrong. I assemble this code with:

nasm -f bin bootsect.asm -o bootsect.bin

Upvotes: 0

Views: 328

Answers (1)

Michael Petch
Michael Petch

Reputation: 47573

It appears you may have been looking at AS86 assembly code that use JMPI (Inter-segment jump). This is usually referred to as a FAR JMP and is encoded in NASM this way:

jmp 0:0xc200

In NASM JMPI is simply JMP and there is a colon (:) between the segment and the offset rather than a comma (,).


If you wish to use AS86 to assemble a bootloader instead of NASM you would have to install the AS86 package and then assemble your code into a binary file this way:

as86 -b bootsect.bin bootsect.asm

It is unclear how you intended to reach the HLT loop after the FAR JMP but you probably meant to do this:

fin:
    hlt            ;halt cpu and wait for interrupt
    jmp fin

Upvotes: 3

Related Questions