X86 MASM build
I created the following code that will print a multiplication table that multiplies 1 * 1, 1 * 2, 1 * 3, ..., 1 * 10. I want to create a continuous table 1 * 1, 1 * 2, 1 * 3, ..., 1 * 10 and another table 2 * 1, 2 * 2, 2 * 3, ..., 2 * 10 and 3 * 1, 3 * 2, 3 * 3, ..., 3 * 10 and etc. Up to 10 * 10, using loops, and recording each procedure separately. However, it is difficult for me to create loops. Please let someone show me. Thank you so much.
INCLUDE Irvine32.inc
.data
a dword 1
b dword 1
z dword ?
times byte " * ",0
equals byte " = ",0
.code
main PROC
call clrscr
mov ecx,10
outloop :
push ecx
call printtimes
call crlf
inc a
pop ecx
loop outloop
call crlf
mov ecx,10
mov a, 1
outloop1 :
push ecx
call printtimes1
call crlf
inc a
pop ecx
loop outloop1
call crlf
mov ecx,10
mov a, 1
outloop2 :
push ecx
call printtimes2
call crlf
inc a
pop ecx
loop outloop2
exit
main ENDP
mymul proc
mov ecx,a
mov eax,0
myloop:
add eax,b
loop myloop
mov z,eax
ret
mymul endp
mymul1 proc
mov ecx,a
mov eax,0
mov b, 1
inc b
myloop:
add eax,b
loop myloop
mov z,eax
ret
mymul1 endp
mymul2 proc
mov ecx,a
mov eax,0
mov b, 2
inc b
myloop:
add eax,b
loop myloop
mov z,eax
ret
mymul2 endp
printtimes proc
call mymul
mov eax,a
call writedec
mov edx, offset times
call writestring
mov eax,b
call writedec
mov edx,offset equals
call writestring
mov eax,z
call writedec
call crlf
ret
printtimes endp
printtimes1 proc
call mymul1
mov eax,a
call writedec
mov edx, offset times
call writestring
mov eax,b
call writedec
mov edx,offset equals
call writestring
mov eax,z
call writedec
call crlf
ret
printtimes1 endp
printtimes2 proc
call mymul2
mov eax,a
call writedec
mov edx, offset times
call writestring
mov eax,b
call writedec
mov edx,offset equals
call writestring
mov eax,z
call writedec
call crlf
ret
printtimes2 endp
end main
Results (I want to get this result using nested loops, but it's hard for me to create it):
1*1=1
2*1=2
3*1=3
4*1=4
5*1=5
6*1=6
7*1=7
8*1=8
9*1=9
10*1=10
1*2=2
2*2=4
3*2=6
4*2=8
5*2=10
6*2=12
7*2=14
8*2=16
9*2=18
10*2=20
1*3=3
2*3=6
3*3=9
4*3=12
5*3=15
6*3=18
7*3=21
8*3=24
9*3=27
10*3=30