简体   繁体   中英

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM