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
除算の余りを表示する必要があります。どんな助けでも大歓迎です。
前もって感謝します、
プログラム