如何将div
指令的剩余部分收集到寄存器中,以便将其转换为字符串并显示到控制台。例如:
.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
adrs1 dd 0
adrs2 dd 0
.code
start:
mov eax, 6 ; add 6 to eax
mov ebx, 7 ; add 7 to ebx
imul eax, ebx ; multiply both numbers, result is in eax
mov ecx, 10 ; add 10 to ecx
idiv eax:ecx, edx ; divide eax (result of mul) by 10 so that I can separate the digits into single characters so I can display them.
; Numbers will be 4 and 2. Is the result of the division stored in EDX?
mov adrs1, eax ; mov the '4' from the '42' result of the multiplication into 'adrs'
mov adrs2, edx ; mov the remainder of the division to adrs2
add adrs1, 50 ; make the result the correct ASCII character for the result
add adrs2, 50 ; " "
invoke StdOut, addr adrs1 ; display adrs1
invoke StdOut, addr adrs2 ; display adrs2
invoke ExitProcess, 0 ; exit
end start
我需要显示该部门的剩余部分。任何帮助将不胜感激。
提前致谢,
Progrmr