将十六进制转换为二进制 - ASM
在AX中给定一个数字,将相应的位字符串存储在Str1中。 如果AX = 0x1234,则结果应为: str1 = 0001001000111
我如何将AX中的所有内容转换为二进制 我必须使用循环吗? 如何实施此方法?
given a number in AX, store the corresponding bit string in str1.
if AX = 0x1234, the result should be:
str1 = 0001001000111
How can I convert everything in AX to binary
Do I have to use loop?
How to implement this method?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在
ax
中输入编号,然后输出二进制字符串在[rdi]
中。如果ax = 0x1234
,[rdi] =“ 0001001000110100”
带有终止空字符。使用NASM靶向X86_64。
SSE2优化版本
基于彼得·科德斯(Peter Cordes)的职位,带有手动调度。
旧版本使用展开的环路
每次迭代都不依赖于先前的迭代,并且循环完全展开。
如果您不熟悉NASM宏。阅读文档( https://wwwww.nasm.us/xdoc/2.10 rc8/html/nasmdoc4.html )。
Input number in
ax
, and output binary string in[rdi]
. Ifax = 0x1234
,[rdi] = "0001001000110100"
with a terminating null character.Using NASM targeting x86_64.
SSE2 optimized version
Based on Peter Cordes' post, with hand-tuned scheduling.
Old version using an unrolled loop
Each iteration has no dependency on the previous iteration, and the loop is fully unrolled.
If you are not familiar with NASM macros. Read the docs (https://www.nasm.us/xdoc/2.10rc8/html/nasmdoc4.html).