NASM - The Netwide Assembler
NASM Forum => Programming with NASM => Topic started by: ben321 on March 27, 2015, 07:14:42 AM
-
I'm trying to conditionally set a certain variable called MemSeg, based on what key a user presses, for my experimental graphics program.
cmp byte al,0x30
cmove word [MemSeg],0xA000
cmp byte al,0x31
cmove word [MemSeg],0xB000
cmp byte al,0x32
cmove word [MemSeg],0xB800
But upon compiling, I get these errors. Why? Isn't the CMOVxx set of commands just like MOV, except for the fact that they are conditional based on the previous CMP statement?
a.asm:106: error: invalid combination of opcode and operands
a.asm:108: error: invalid combination of opcode and operands
a.asm:110: error: invalid combination of opcode and operands
-
Looks like the first operand to CMOVcc has to be a register.
(0xB000 ? Are you working in a museum? :) )
Best,
Frank
-
Looks like the first operand to CMOVcc has to be a register.
(0xB000 ? Are you working in a museum? :) )
Best,
Frank
cmp byte al,0x30
cmove word dx,0xA000
cmp byte al,0x31
cmove word dx,0xB000
cmp byte al,0x32
cmove word dx,0xB800
Still gives the same error. Do BOTH operands have to be registers? Does CMOVcc mnemonics exist only for register-to-register transfers? If so, this could get a bit tricky.
-
Register or memory, for the second operand - no immediates.
http://home.myfairpoint.net/fbkotler/nasmdocc.html#section-A.4.23
That's the old instruction set reference from the old Nasm Manual. Better to go straight to the manufacturers, but I'm used to this one. :)
Best,
Frank