Click here to Skip to main content
15,879,535 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Include Irvine32.inc
.data
count dword ?
string byte 0ah , "it is internal loop",0ah,0
string1 byte 0ah , "it is middle loop",0ah,0
string2 byte 0ah , "it is external loop",0ah,0

.code
main PROC
mov ebx,0
mov ecx,3 ;external loop value
L1:
mov edx,offsetstring2
call writestring
mov eax , ecx
call writedec
mov count, ecx
mov ecx, 2 ;middle loop value
add ebx , 1

L2:
mov edx, offsetstring1
call writestring
mov eax, ecx
call writedec
mov count, ecx
mov ecx, 1 ;internal loop value
add ebx , 2

L3:
mov edx, offsetstring
call writestring
mov eax , ecx
call writedec
;call dumpregs

loop L3
mov ecx , count
loop L1
call dumpregs
main endp
end main


please run this program

What I have tried:

Assembly
Include Irvine32.inc
.data
count dword ?
string byte 0ah , "it is internal loop",0ah,0
string1 byte 0ah , "it is middle loop",0ah,0
string2 byte 0ah , "it is external loop",0ah,0

.code
main PROC
mov ebx,0
mov ecx,3 ;external loop value
L1:
mov edx,offsetstring2
call writestring
mov eax , ecx
call writedec
mov count, ecx
mov ecx, 2 ;middle loop value
add ebx , 1

L2:
mov edx, offsetstring1
call writestring
mov eax, ecx
call writedec
mov count, ecx
mov ecx, 1 ;internal loop value
add ebx , 2

L3:
mov edx, offsetstring
call writestring
mov eax , ecx
call writedec
;call dumpregs

loop L3
mov ecx , count 
loop L1
call dumpregs
main endp
end main
Posted
Updated 26-Mar-20 22:15pm
v3
Comments
phil.o 27-Mar-20 2:31am    
This is not c++. What is your question?
OriginalGriff 27-Mar-20 2:54am    
And?
What does it do that you didn't expect, or not do that you did?
What have you tried to do to find out why?
Are there any error messages, and if so, where and when? What did you do to make them happen?

This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with.
Use the "Improve question" widget to edit your question and provide better information.

That's assembly code, not C++.
And you may run it yourself: there are tutorials available on using the Irvine32 library.
 
Share this answer
 
loop L3
mov ecx , count
loop L1
call dumpregs
main endp
end main

You are missing loop L2
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900