Dephott
Dephott

Reputation: 45

how to make 3 nested loops in asm

I want to make 3 nested loops in asm, but i have not found any description. I want to solve this:

enter image description here

This project is "finding the Pythagoras-triplets".

Upvotes: 0

Views: 621

Answers (1)

Sep Roland
Sep Roland

Reputation: 39166

This is how a typical loop could look like:

 mov ax,1
AgainA:
 ...
 inc ax
 cmp ax,1000
 jbe AgainA

Now imagine that you replace the ellipses with similar code but using the BX register. Later replace the new ellipses again with similar code using the CX register. Now you'll have 3 nested loops.
The last remaining ellipses will be replaced by the body of your program, the IF part.

Upvotes: 2

Related Questions