如何使用汇编语言创建基本转换器。 [英] How do I create a base converter in assembly language.

查看:116
本文介绍了如何使用汇编语言创建基本转换器。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是计算机科学的新手,遇到这个问题,需要将十进制数转换为任何基数,如二进制,十六进制,ASCII,汇编语言微处理器8086



我尝试了什么:



i试图将小数转换为二进制但我不知道如何将它们放在一起所以我可以询问系统,输入一个数字,然后给出将其转换为什么基数的选项。

请帮帮我。

i am new to computer science and came across this question that one needs to convert a decimal number to any base like binary, hexadecimal,ASCII in assembly language microprocessor 8086

What I have tried:

i have tried to convert a decimal to binary but i don't know how to put them together so that i can be able to ask the system, input a number then give options on what base to convert it to.
Please help me out here.

推荐答案

将二进制整数值转换为字符表示遵循基本路径:

Converting a binary integer value to a character representation follows the basic path:
Allocate a string array long enough to hold any number of digits
While the number is greater than zero
Get the remainder of the number divided by the base
Convert the resulting value to a character (add '0' for decimals)
Add the resulting character to the next position of the string array
Divide the number by the base ignoring any remainder
Repeat the While loop
When the number has been reduced to zero, display the string, in reverse order.



你可以看到如何使用纸和笔手动模拟这个算法。


You can see how this works by emulating this algorithm manually using paper and pencil.


这篇关于如何使用汇编语言创建基本转换器。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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