简体   繁体   English

在 NASM 中组装 JMPI 指令会出现错误“解析器:预期指令”

[英]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. jmpi 0,0xc200不正确,我不明白出了什么问题。 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).看来您可能一直在查看使用JMPI (段间跳转)的AS86汇编代码。 This is usually referred to as a FAR JMP and is encoded in NASM this way:这通常被称为 FAR JMP,在 NASM 中以这种方式编码:

jmp 0:0xc200

In NASM JMPI is simply JMP and there is a colon ( : ) between the segment and the offset rather than a comma ( , ).在NASM JMPI是简单地JMP并有一个冒号( :所述段和所述偏移,而不是一个逗号(之间) , )。


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 来组装引导加载程序而不是 NASM,您必须安装 AS86 包,然后以这种方式将您的代码组装成二进制文件:

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:目前尚不清楚您打算如何在 FAR JMP 之后到达 HLT 循环,但您可能打算这样做:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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