如何在汇编中将二进制转换为 ascii [英] How to convert binary to ascii in assembly

查看:123
本文介绍了如何在汇编中将二进制转换为 ascii的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是汇编语言的新手,我可以知道如何将二进制转换为另一种语言的 ascii,但我在汇编方面遇到了困难(汇编 IA32,Linux 中的英特尔).

Im new to assembly language, i can have an idea in how to convert binary to ascii in another language but im having a hard time with assembly (assembly IA32, intel in linux).

用户必须输入一串二进制,长度为:01100001011101000110000101110001011101010110010101101110 56

The user must put a string of binary and the lenght like: 01100001011101000110000101110001011101010110010101101110 56

并且输出必须是:ataquen

and the ouput must be: ataquen

我不是要给我完整的功能,但我想知道汇编中是否有一些提示可以帮助我构建我的程序.谢谢.

Im not asking to give me the complete function but i would like to know if there are some tips in assembly than can help me to build my program. Thanks.

推荐答案

假设 ESI 指向用户输入且 ECX = 8,这将转换为 8 个 ASCII0"的字符串 &1".

Assuming ESI points to users input and ECX = 8, this will convert a string of eight ASCII "0" & "1".

 NextCh:
        lodsb           
        ror     al, 1
        rcl     ah, 1
        loop    NextCh

所以如果输入是 01110011 那么 AH 就是 0b1110011 = 73H = 115 = 's'

So if input was 01110011 then AH is 0b1110011 = 73H = 115 = 's'

这篇关于如何在汇编中将二进制转换为 ascii的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆