简体   繁体   English

nasm等同于设置指令

[英]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. 有谁知道nasm是否等效于我习惯使用的“ set”指令,因此根据cmp的结果在eax中设置位,但是nasm似乎不认识它,只是想知道是否有替代方法进行异或运算,然后求出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: 从2012年3月12日起,这与NASM 2.10配合得很好:

; file: set.asm
bits 16

cmp ecx, eax
setl al
movzx eax, al

I assemble it as nasm -f bin set.asm . 我将其组装为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. 编辑 :我已经在所有地方都颠倒了操作数的顺序,因为好像您在编写代码时要牢记AT&T语法(不适用于NASM),其中操作数的顺序相反。

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

相关问题 如何在nasm上设置execve调用正确? - How to set up execve call on nasm right? 32 位模式下的 NASM x86_64 汇编:为什么这条指令会产生 RIP-Relative Addressing 代码? - NASM x86_64 assembly in 32-bit mode: Why does this instruction produce RIP-Relative Addressing code? 在Linux下确定我的处理器的指令集 - Determine instruction set of my processor under Linux 运行 GNU/Linux 的最小 RISC-V 指令集是多少? - What is the minimum RISC-V instruction set that runs GNU/Linux? emmintrin.h:31:3: error: #error "SSE2 指令集未启用" #error "SSE2 指令集未启用", "scaling solution" - emmintrin.h:31:3: error: #error "SSE2 instruction set not enabled" # error "SSE2 instruction set not enabled", "scaling solution" 什么等于SET在Shell脚本中验证 - what is equivalent to SET verify off in shell script 如何设置回车位置或等效位置? - How to set carriage return location or equivalent? 是否有相当于set wildignore用于忽略具有不可打印字符的文件? - Is there an equivalent of set wildignore for ignoring files with nonprintable characters? 使用gcc为x86编译C程序不使用AVX指令集 - Compile c program for x86 with gcc doesn't use AVX instruction set 测试和设置(或其他原子RMW操作)是否是任何架构上的特权指令? - Is test-and-set (or other atomic RMW operation) a privileged instruction on any architecture?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM