Progam.-(6)* Write a program to Display series of Leaner, Even and odd using by LOOP command and Direct Offset address. Design by : sir Masood
1.Store 9 into CX 2.Store 1 into BL 3.Store BL into DL 4.Add 48 in to DL 5. Display to DL 6. Increment in BL 7.Check CX IF CX=0 Then go to step No.8 else go to step 3 8. Store 5 into CX 9. Store 1 into BL 10 Store BL into DL 11 Add 48 in to DL 12 Display to DL 13 BL=BL+2 14 Check CX IF CX=0 Then go to step No.15 else go to step Store 5 into CX 16. Store 0 into BL 17 Store BL into DL 18. Add 48 in to DL 19 Display to DL 20 BL=BL+2 21Check CX IF CX=0 Then go to step No.22 else go to step 17 22END Algorithm steps Algorithm steps Design by : sir Masood
Start CX=9 BL=1 DISPLAY DL DL=BL CX≠0 DL=DL+48 Yes No C c BL=BL+1 CX=5 BL=1 DISPLAY DL DL=BL CX≠0 DL=DL+48 BL=BL+2 D CX=5 BL=1 DISPLAY DL DL=BL CX≠0 DL=DL+48 BL=BL+2 D End Yes No Yes No Sir. Masood Design by : Sir. Masood
Program Example MOV CX,9 ; for loop 9 Times MOV BL,1 MOV AH,2 ; This is service For display Offset address: ; This is label name MOV DL,BL ADD DL,30H ; Add Simple No. to ASCII Code No. INT 21H INC BL LOOP Offset address MOV CX,5 ; for loop 5 Times MOV BL,1 MOV AH,2 ; This is service For display Offset address : ; This is label name MOV DL,BL ADD DL,30H ; Add Simple No. to ASCII Code No. INT 21H ADD BL,2 ; This is service For display LOOP Offset address Design by :Sir Masood
Program Example MOV CX,5 ; for loop 5 Times MOV BL,0 MOV AH,2 Offset address : ; This is label name MOV DL,BL ADD DL,30H ; Add Simple No. to ASCII Code No. INT 21H ADD BL,2 ; Increment 2 in DL regester LOOP Offset address INT 20H ; Here end Program Masood Design by : Sir Masood