Adam’s Engineering College, Paloncha ECE Department –MPI LAB Experiment No.: 18 Page 1 of 2
Year : III/IV B.Tech II Semester
COUNTING NUMBER OF EVEN AND ODD NUMBERS FROM A GIVEN SERIES
Aim: - To write an assembly language program to count the number of even and odd numbers from a given series. Registers: - AL, BL, CL, and DL. Description: - The number of even and odd numbers from a given series are found, and EVEN is stored in DL, and ODD is stored in BL. Ports:- None. DATA SEGMENT SERIES DB 05 DUP(00) EVEN DB ? ODD DB ? DATA ENDS CODE SEGMENT ASSUME CS: CODE, DS: DATA START:
NEXT2:
MOV CL, 05 XOR BL, BL XOR DL, DL LEA SI, SERIES MOV AL, [SI] SHR AL, O1
Lab in-charge
HOD, ECE
Adam’s Engineering College, Paloncha ECE Department –MPI LAB Experiment No.: 18 Page 2 of 2
Year : III/IV B.Tech II Semester
JNC NEXT1
NEXT1: NEXT3:
INC BL JMP NEXT3 INC DL INC SI DEC CL JNZ NEXT2 MOV EVEN, DL MOV ODD, BL
CODE ENDS END START Result: The numbers of even and odd numbers are counted from the given series.
Lab in-charge
HOD, ECE