NASM - The Netwide Assembler

NASM Forum => Using NASM => Topic started by: ktx59 on May 23, 2021, 04:09:20 PM

Title: Opcodes 0x83/1, 0x83/4 and 0x83/6 with CPU 286?
Post by: ktx59 on May 23, 2021, 04:09:20 PM
Dear all,
When I try to assemble code with NASM that contains an instruction like "and cx, 0x01", NASM consistently generates the following code, even when I use "CPU 286" or "CPU 8086":
Code: [Select]
83E101            and cx,byte +0x1 However, to my knowledge, opcodes 0x83/1 ("or r/m16, imm8") 0x83/4 ("and r/m16, imm8") and 0x83/6 ("xor r/m16, imm8") are documented only for 80386 and later processors. (I have checked scanned versions of the original Intel developers' manuals.) I have also checked other online references, according to http://ref.x86asm.net/coder32.html#x83, this instruction is only available on 80386+ (or at least, it does not mention that these are present but undocumented). Could somebody provide me some reliable reference on this? Or is this a bug in NASM?

Title: Re: Opcodes 0x83/1, 0x83/4 and 0x83/6 with CPU 286?
Post by: debs3759 on May 24, 2021, 02:31:48 AM
That looks like a bug to me. Until it gets fixed, you could use

AND CX,WORD 0x01.
Title: Re: Opcodes 0x83/1, 0x83/4 and 0x83/6 with CPU 286?
Post by: ktx59 on May 24, 2021, 08:21:15 AM
Thanks for the suggestion, but I have already tried this, makes no difference (it still generates 83E101). The only workaround I have found is db 0x81,0xE1,0x01,0x00.