-- @BEGIN: LAB_Q1 -- 1. Write an assembly language program to add the two numbers X and Y where X=1234H and Y=5678H. Verify the experimental output with theoretical values. Keywords: 16-bit addition, MASM, 8086 ASSUME CS:CODE, DS:DATA DATA SEGMENT var1 DW 1234H var2 DW 5678H res DW ? carry DB 00H DATA ENDS CODE SEGMENT START: MOV AX, DATA MOV DS, AX MOV AX, var1 ADD AX, var2 MOV res, AX JNC NO_CARRY MOV carry, 01H NO_CARRY: INT 03H CODE ENDS END START -- @END: LAB_Q1 -- @BEGIN: LAB_Q2 -- 2. Write an assembly language program to subtract Y from X where X=9999H and Y=1111H. Verify the experimental output with theoretical values. Keywords: 16-bit subtraction, MASM, 8086 ASSUME CS:CODE, DS:DATA DATA SEGMENT var1 DW 9999H var2 DW 1111H res DW ? DATA ENDS CODE SEGMENT START: MOV AX, DATA MOV DS, AX MOV AX, var1 SUB AX, var2 MOV res, AX INT 03H CODE ENDS END START -- @END: LAB_Q2 -- @BEGIN: LAB_Q3 -- 3. Write an assembly language program to perform X*Y where X=3000H and Y=1000H. Verify the experimental output with theoretical values. Keywords: 16-bit multiplication, MASM, 8086 ASSUME CS:CODE, DS:DATA DATA SEGMENT var1 DW 3000H var2 DW 1000H res DD ? DATA ENDS CODE SEGMENT START: MOV AX, DATA MOV DS, AX MOV AX, var1 MUL var2 MOV WORD PTR res, AX MOV WORD PTR res+2, DX INT 03H CODE ENDS END START -- @END: LAB_Q3 -- @BEGIN: LAB_Q4 -- 4. Write an assembly language program to perform X divided by Y where X=3000H and Y=1000H. Verify the experimental output with theoretical values. Keywords: 16-bit division, MASM, 8086 ASSUME CS:CODE, DS:DATA DATA SEGMENT var1 DW 3000H var2 DW 1000H quot DW ? rem DW ? DATA ENDS CODE SEGMENT START: MOV AX, DATA MOV DS, AX MOV AX, var1 MOV DX, 0000H DIV var2 MOV quot, AX MOV rem, DX INT 03H CODE ENDS END START -- @END: LAB_Q4 -- @BEGIN: LAB_Q5 -- 5. Write an assembly language program to add two numbers X and Y where X=12341000H and Y=56783000H. Verify the experimental output with theoretical values. Keywords: 32-bit addition, MASM, 8086 ASSUME CS:CODE, DS:DATA DATA SEGMENT var1 DD 12341000H var2 DD 56783000H res DD ? DATA ENDS CODE SEGMENT START: MOV AX, DATA MOV DS, AX MOV AX, WORD PTR var1 ADD AX, WORD PTR var2 MOV WORD PTR res, AX MOV AX, WORD PTR var1+2 ADC AX, WORD PTR var2+2 MOV WORD PTR res+2, AX INT 03H CODE ENDS END START -- @END: LAB_Q5 -- @BEGIN: LAB_Q6 -- 6. Write an assembly language program to subtract Y from X where X=56783000H and Y=12341000H. Verify the experimental output with theoretical values. Keywords: 32-bit subtraction, MASM, 8086 ASSUME CS:CODE, DS:DATA DATA SEGMENT var1 DD 56783000H var2 DD 12341000H res DD ? DATA ENDS CODE SEGMENT START: MOV AX, DATA MOV DS, AX MOV AX, WORD PTR var1 SUB AX, WORD PTR var2 MOV WORD PTR res, AX MOV AX, WORD PTR var1+2 SBB AX, WORD PTR var2+2 MOV WORD PTR res+2, AX INT 03H CODE ENDS END START -- @END: LAB_Q6 -- @BEGIN: LAB_Q7 -- 7. Write an assembly language program to find the sum of given series of numbers 33H, 43H, 13H, 06H, 03H and 01H. Verify the experimental output with theoretical values. Keywords: sum of series, array addition, MASM, 8086 ASSUME CS:CODE, DS:DATA DATA SEGMENT arr DB 33H, 43H, 13H, 06H, 03H, 01H cnt DB 06H res DW ? DATA ENDS CODE SEGMENT START: MOV AX, DATA MOV DS, AX LEA SI, arr MOV CL, cnt MOV AX, 0000H ADD_LOOP: MOV BL, [SI] MOV BH, 00H ADD AX, BX INC SI DEC CL JNZ ADD_LOOP MOV res, AX INT 03H CODE ENDS END START -- @END: LAB_Q7 -- @BEGIN: LAB_Q8 -- 8. Write an assembly language program to find the average of given series of numbers 33H, 43H, 13H, 06H, 03H and 01H. Verify the experimental output with theoretical values. Keywords: average of series, array mean, MASM, 8086 ASSUME CS:CODE, DS:DATA DATA SEGMENT arr DB 33H, 43H, 13H, 06H, 03H, 01H cnt DB 06H res DB ? DATA ENDS CODE SEGMENT START: MOV AX, DATA MOV DS, AX LEA SI, arr MOV CL, cnt MOV AX, 0000H ADD_LOOP: MOV BL, [SI] MOV BH, 00H ADD AX, BX INC SI DEC CL JNZ ADD_LOOP DIV cnt MOV res, AL INT 03H END START -- @END: LAB_Q8 -- @BEGIN: LAB_Q9 -- 9. Write an assembly language program to add the cubes of given series of numbers 03H, 02H, 05H. Verify the experimental output with theoretical values. Keywords: sum of cubes, loop, MASM, 8086 ASSUME CS:CODE, DS:DATA DATA SEGMENT arr DB 03H, 02H, 05H cnt DB 03H res DW ? DATA ENDS CODE SEGMENT START: MOV AX, DATA MOV DS, AX LEA SI, arr MOV CL, cnt MOV BX, 0000H CUBE_LOOP: MOV AL, [SI] MUL AL MOV DL, [SI] MUL DL ADD BX, AX INC SI DEC CL JNZ CUBE_LOOP MOV res, BX INT 03H CODE ENDS END START -- @END: LAB_Q9 -- @BEGIN: LAB_Q10 -- 10. Write an assembly language program to add the squares of given series of numbers 03H, 02H, 05H. Verify the experimental output with theoretical values. Keywords: sum of squares, loop, MASM, 8086 ASSUME CS:CODE, DS:DATA DATA SEGMENT arr DB 03H, 02H, 05H cnt DB 03H res DW ? DATA ENDS CODE SEGMENT START: MOV AX, DATA MOV DS, AX LEA SI, arr MOV CL, cnt MOV BX, 0000H SUM_LOOP: MOV AL, [SI] MUL AL ADD BX, AX INC SI DEC CL JNZ SUM_LOOP MOV res, BX INT 03H CODE ENDS END START -- @END: LAB_Q10 -- @BEGIN: LAB_Q11 -- 11. Write an assembly language program to find the largest from the given series of numbers 08H, 0DH, 0FH, 03H, 09H and 0AH. Keywords: largest number, array max, MASM, 8086 ASSUME CS:CODE, DS:DATA DATA SEGMENT arr DB 08H, 0DH, 0FH, 03H, 09H, 0AH cnt DB 06H res DB ? DATA ENDS CODE SEGMENT START: MOV AX, DATA MOV DS, AX LEA SI, arr MOV CL, cnt MOV AL, [SI] INC SI DEC CL FIND_MAX: CMP AL, [SI] JAE SKIP MOV AL, [SI] SKIP: INC SI DEC CL JNZ FIND_MAX MOV res, AL INT 03H CODE ENDS END START -- @END: LAB_Q11 -- @BEGIN: LAB_Q12 -- 12. Write an assembly language program to find the sort the given series of numbers 0AH, 0DH, 0FH, 03H, 09H and 13H in descending order. Keywords: bubble sort, descending order, array sort, MASM, 8086 ASSUME CS:CODE, DS:DATA DATA SEGMENT arr DB 0AH, 0DH, 0FH, 03H, 09H, 13H cnt DB 06H DATA ENDS CODE SEGMENT START: MOV AX, DATA MOV DS, AX MOV CL, cnt DEC CL OUTER_LOOP: LEA SI, arr MOV CH, CL INNER_LOOP: MOV AL, [SI] CMP AL, [SI+1] JAE NO_SWAP MOV BL, [SI+1] MOV [SI], BL MOV [SI+1], AL NO_SWAP: INC SI DEC CH JNZ INNER_LOOP DEC CL JNZ OUTER_LOOP INT 03H CODE ENDS END START -- @END: LAB_Q12 -- @BEGIN: LAB_Q13 -- 13. Write an assembly language program to find the smallest from the given series of numbers 03H, 0DH, 0FH, 0BH, 99H and 12H. Keywords: smallest number, array min, MASM, 8086 ASSUME CS:CODE, DS:DATA DATA SEGMENT arr DB 03H, 0DH, 0FH, 0BH, 99H, 12H cnt DB 06H res DB ? DATA ENDS CODE SEGMENT START: MOV AX, DATA MOV DS, AX LEA SI, arr MOV CL, cnt MOV AL, [SI] INC SI DEC CL FIND_MIN: CMP AL, [SI] JBE SKIP MOV AL, [SI] SKIP: INC SI DEC CL JNZ FIND_MIN MOV res, AL INT 03H CODE ENDS END START -- @END: LAB_Q13 -- @BEGIN: LAB_Q14 -- 14. Write an assembly language program to sort the given series of numbers A3H, CDH, BFH, B3H, 99H and AFH in ascending order. Keywords: bubble sort, ascending order, array sort, MASM, 8086 ASSUME CS:CODE, DS:DATA DATA SEGMENT arr DB 0A3H, 0CDH, 0BFH, 0B3H, 99H, 0AFH cnt DB 06H DATA ENDS CODE SEGMENT START: MOV AX, DATA MOV DS, AX MOV CL, cnt DEC CL OUTER_LOOP: LEA SI, arr MOV CH, CL INNER_LOOP: MOV AL, [SI] CMP AL, [SI+1] JBE NO_SWAP MOV BL, [SI+1] MOV [SI], BL MOV [SI+1], AL NO_SWAP: INC SI DEC CH JNZ INNER_LOOP DEC CL JNZ OUTER_LOOP INT 03H CODE ENDS END START -- @END: LAB_Q14 -- @BEGIN: LAB_Q15 -- 15. Write and assembly language program to find the length of the string "EXCELLENT". Keywords: string length, MASM, 8086 ASSUME CS:CODE, DS:DATA DATA SEGMENT str1 DB 'EXCELLENT$' res DB ? DATA ENDS CODE SEGMENT START: MOV AX, DATA MOV DS, AX LEA SI, str1 MOV CL, 00H COUNT_LOOP: MOV AL, [SI] CMP AL, '$' JE DONE INC CL INC SI JMP COUNT_LOOP DONE: MOV res, CL INT 03H CODE ENDS END START -- @END: LAB_Q15 -- @BEGIN: LAB_Q16 -- 16. Write and assembly language program if the character "E" is there in the string "MOVIE". Keywords: search character, string traversal, MASM, 8086 ASSUME CS:CODE, DS:DATA DATA SEGMENT str1 DB 'MOVIE$' char1 DB 'E' res DB 00H DATA ENDS CODE SEGMENT START: MOV AX, DATA MOV DS, AX LEA SI, str1 MOV AL, char1 SEARCH_LOOP: MOV BL, [SI] CMP BL, '$' JE NOT_FOUND CMP BL, AL JE IS_FOUND INC SI JMP SEARCH_LOOP IS_FOUND: MOV res, 01H NOT_FOUND: INT 03H CODE ENDS END START -- @END: LAB_Q16 -- @BEGIN: LAB_Q17 -- 17. Write and assembly language program to reverse the string "MANGO". Keywords: reverse string, string operations, MASM, 8086 ASSUME CS:CODE, DS:DATA DATA SEGMENT str1 DB 'MANGO$' str2 DB 6 DUP ('$') DATA ENDS CODE SEGMENT START: MOV AX, DATA MOV DS, AX MOV ES, AX LEA SI, str1 MOV CX, 05H ADD SI, CX DEC SI LEA DI, str2 REVERSE_LOOP: MOV AL, [SI] MOV [DI], AL DEC SI INC DI LOOP REVERSE_LOOP INT 03H CODE ENDS END START -- @END: LAB_Q17 -- @BEGIN: LAB_Q18 -- 18. Write and assembly language program to concatenate the two strings "RE" and "ADMIT". Keywords: concatenate string, join strings, MASM, 8086 ASSUME CS:CODE, DS:DATA DATA SEGMENT str1 DB 'RE$' str2 DB 'ADMIT$' str3 DB 10 DUP ('$') DATA ENDS CODE SEGMENT START: MOV AX, DATA MOV DS, AX MOV ES, AX LEA SI, str1 LEA DI, str3 COPY_STR1: MOV AL, [SI] CMP AL, '$' JE COPY_STR2 MOV [DI], AL INC SI INC DI JMP COPY_STR1 COPY_STR2: LEA SI, str2 COPY_LOOP2: MOV AL, [SI] CMP AL, '$' JE DONE MOV [DI], AL INC SI INC DI JMP COPY_LOOP2 DONE: INT 03H CODE ENDS END START -- @END: LAB_Q18 -- @BEGIN: LAB_Q19 -- 19. Write an assembly language program to move the string "ADASTRA" from data segment to extra segment. Keywords: move string, MOVSB, memory copy, MASM, 8086 ASSUME CS:CODE, DS:DATA DATA SEGMENT str1 DB 'ADASTRA$' DATA ENDS EXTRA SEGMENT str2 DB 8 DUP ('$') EXTRA ENDS CODE SEGMENT START: MOV AX, DATA MOV DS, AX MOV AX, EXTRA MOV ES, AX LEA SI, str1 LEA DI, str2 MOV CX, 07H REP MOVSB INT 03H CODE ENDS END START -- @END: LAB_Q19 -- @BEGIN: LAB_Q20 -- 20. Write an assembly language program to find the factorial of the number X=05H. Keywords: factorial, MASM, 8086 ASSUME CS:CODE, DS:DATA DATA SEGMENT var1 DB 05H res DW ? DATA ENDS CODE SEGMENT START: MOV AX, DATA MOV DS, AX MOV AL, var1 MOV AH, 00H MOV CX, AX DEC CX FACT_LOOP: MUL CX DEC CX JNZ FACT_LOOP MOV res, AX INT 03H CODE ENDS END START -- @END: LAB_Q20 -- @BEGIN: LAB_Q21 -- 21. Write an assembly language program to print first 10 Fibonacci numbers. Keywords: Fibonacci sequence, MASM, 8086 ASSUME CS:CODE, DS:DATA DATA SEGMENT arr DB 10 DUP(?) cnt DB 0AH DATA ENDS CODE SEGMENT START: MOV AX, DATA MOV DS, AX LEA SI, arr MOV AL, 00H MOV [SI], AL INC SI MOV BL, 01H MOV [SI], BL INC SI MOV CL, cnt SUB CL, 02H FIB_LOOP: ADD AL, BL MOV [SI], AL MOV AL, BL MOV BL, [SI] INC SI DEC CL JNZ FIB_LOOP INT 03H CODE ENDS END START -- @END: LAB_Q21 -- @BEGIN: LAB_Q22 -- 22. Write an assembly language program to compare two strings "HEEL" and "HEAL". Keywords: compare strings, string match, CMPSB, MASM, 8086 ASSUME CS:CODE, DS:DATA DATA SEGMENT str1 DB 'HEEL$' str2 DB 'HEAL$' msg1 DB 'EQUAL$' msg2 DB 'NOT EQUAL$' DATA ENDS CODE SEGMENT START: MOV AX, DATA MOV DS, AX MOV ES, AX LEA SI, str1 LEA DI, str2 MOV CX, 04H REPE CMPSB JE EQUAL LEA DX, msg2 JMP DISPLAY EQUAL: LEA DX, msg1 DISPLAY: MOV AH, 09H INT 21H INT 03H CODE ENDS END START -- @END: LAB_Q22