0% found this document useful (0 votes)
6 views1 page

Looping in Assembly Language

This document contains a program with nested loops. The outer loop (k1) iterates 5 times, incrementing a counter (bx) each time and printing the character '1'. Within this loop is another loop (k2) that also iterates 5 times, incrementing the counter and printing '2' each iteration. Nested within k2 is a third loop (k3) that iterates 5 times as well, incrementing the counter and printing '3' before looping back. This creates a nested loop structure that prints the numbers 1, 2, and 3 in the specified patterns.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views1 page

Looping in Assembly Language

This document contains a program with nested loops. The outer loop (k1) iterates 5 times, incrementing a counter (bx) each time and printing the character '1'. Within this loop is another loop (k2) that also iterates 5 times, incrementing the counter and printing '2' each iteration. Nested within k2 is a third loop (k3) that iterates 5 times as well, incrementing the counter and printing '3' before looping back. This creates a nested loop structure that prints the numbers 1, 2, and 3 in the specified patterns.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Loop Example

============================================
name "loops"

org 100h

mov bx, 0 ; total step counter

mov cx, 5
k1: add bx, 1
mov al, '1'
mov ah, 0eh
int 10h
push cx
mov cx, 5
k2: add bx, 1
mov al, '2'
mov ah, 0eh
int 10h
push cx
mov cx, 5
k3: add bx, 1
mov al, '3'
mov ah, 0eh
int 10h
loop k3 ; internal in internal loop.
pop cx
loop k2 ; internal loop.
pop cx
loop k1 ; external loop.

; wait any key...


mov ah, 1
int 21h

ret

[Link]
FARHAN: 03008855006

You might also like