Showing posts with label loop. Show all posts
Showing posts with label loop. Show all posts

Loop in Assembly Language


TITLE LOOP IN ASSEMBLY LANGUAGE
.model small
.stack
.data
.code
MOV CX,10
L1:
MOV DL,'A'
MOV AH,2H
INT 21H
LOOP L1

MOV AH,4CH
INT 21H
end

See another way:

Loop in Assembly Language

Loop in Assembly Language


TITLE LOOP IN ASSEMBLY LANGUAGE
.model small
.stack

.code
mov bl,10
L1:
MOV AH,2H;PRINT 'A'
MOV DL,'A'
INT 21H
DEC bL
JNZ L1

MOV AH,4CH
INT 21H
end

See another way for

Loop in Assembly Language

Loop in Assembly Language


Loop in Assembly Language

TITLE for (int i = 10; i!=0; i++)
; print 'A'

.model small
.stack

.code
;initializing
mov al,10;
mov bl,al;

;condition
wapis:
cmp bl,0;
;if (bl == 0)
je false
; else
; if (bl != 0)
; print 'A'
mov dl,'A'
mov ah,02h
;decrement
sub bl,1
int 21h
jmp wapis

false:
;Give control back to OS
mov ah,4ch
int 21h

end