简体   繁体   中英

nasm equivalent to set instruction

Does anyone know if nasm has an equivalent to the "set" instruction I am accustomed to using it so set bits in eax based on the result of a cmp but nasm doesn't seem to recognize it just wondering if there is an alternative to using xor and shifts to figuring out the results of a cmp. I am trying to do something like the following

cmp eax,ecx
setl al
movzbl al,eax

Thanks in advance

This assembles just fine with NASM 2.10 from Mar 12 2012:

; file: set.asm
bits 16

cmp ecx, eax
setl al
movzx eax, al

I assemble it as nasm -f bin set.asm .

EDIT : I have reversed the order of operands everywhere as it seems like you were writing your code with the AT&T syntax in mind (not applicable to NASM), where the operands are in the reverse order.

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