如何在屏幕上显示小数 [英] how to show a decimal number on the screen

查看:287
本文介绍了如何在屏幕上显示小数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 我正在编写一个程序(以16位汇编),该程序计算两个8字节数字并将它们保存在另一个8字节变量中,但是我不知道如何在屏幕上显示结果,却找不到互联网上有关它的任何内容.
请帮助我

 number1 dq 12345678
编号2 dq 87654321
sum dq?

解决方案

您需要编写一些代码来提取每个数字并将其转换为可显示的值并将其添加到字符串或数组中.自编写任何汇编程序以来已经很长时间了,但是用伪代码,它就像是这样:

 字符串 = " 
做
    数字=数字1% 10 ; %是"  运算符
    Digit = Digit + '  0';零字符
    字符串 =数字+字符串;将数字添加到字符串前
    数字1 =数字1/ 10 ;
当number1!=  0  


hi i am writing a program(in 16 bit assembly) that calculates two 8 byte number and save them in a another 8 byte variable,but i don''t know how can i show the result on the screen and i didn''t find anything on the internet about it.
please help me

number1 dq 12345678
number2 dq 87654321
sum dq ?

解决方案

You need to write some code that extracts each digit and converts it to a displayable value and adds it to a string or array. It''s a long time since I wrote any assembler, but in pseudo-code it would be something like:

String = ""
DO
    Digit = number1 % 10 ; % is the "get remainder" operator
    Digit = Digit + '0' ; the zero character
    String = digit + string ; prepend this digit to the string
    number1 = number1 / 10 ;
WHILE number1 != 0 


这篇关于如何在屏幕上显示小数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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