x86汇编(MASM32) - 如何分割多位数数据成单个字符 [英] x86 assembly (masm32) - how to split multi-digit data into individual characters

查看:269
本文介绍了x86汇编(MASM32) - 如何分割多位数数据成单个字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我仍然得到我的身边x86汇编头,所以我做了这个小程序,乘以6和7,将数据移动到EAX,然后打印出结果。它编译罚款,并运行良好,但不是打印42,它打印四十秒的ASCII字符。我对这个论坛如何打印单字符数,但现在我需要弄清楚如何打印多位数。这里是我的code:

I am still getting my head around x86 assembly, and so I have made this little program that multiplies 6 and 7, moves the data to EAX and then prints the result. It compiles fine, and runs fine, but instead of printing 42, it prints the fourty-second ASCII character. I have on this forum how to print a single-character number, but now I need to figure out how to print multi-digit numbers. Here is my code:

.386
.model flat, stdcall
option casemap :none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\masm32.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\masm32.lib
.data
    adrs dd 0
.code
start:
    mov eax, 6
    mov ebx, 7
    imul eax, ebx
    add eax, 48
    mov adrs, eax
    invoke StdOut, addr adrs
    invoke ExitProcess, 0
end start

因此​​,在总结,我需要了解如何将数据分割成单个字符,这样我就可以打印出来。任何帮助将是巨大的。

So in summary, I need to understand how to split data into individual characters, so that I can print them. Any help would be great.

问候,

Progrmr

推荐答案

10除以你的电话号码反复。收集剩余物。添加到他们的0,打印的ASCII code。

Divide your number by 10 repeatedly. Collect remainders. Add to them ASCII code of '0', print.

这篇关于x86汇编(MASM32) - 如何分割多位数数据成单个字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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