You are on page 1of 2

Practice Tasks for Lab 6

TASK1
Write an assembly language program that swaps the values stored in the AX and BX
registers. The program should first initialize the value of the AX register to 5, and the
value of the BX register to 10. You should use the XCHG instruction to swap the values
in AX and BX and then terminate the program. Your program should be able to
execute the code correctly and produce the expected output. Additionally, you
should be able to provide a clear explanation of the purpose of each line of code.

TASK2
Write an assembly language program that initializes the AX register to 5 and the BX
register to 10. The program should then compare the values stored in the AX and BX
registers. If the value in AX is less than the value in BX, the program should increment
the value of AX by 1 and jump back to the comparison step. Once the value in AX is
greater than or equal to the value in BX, the program should terminate. You should
use the CMP, JB, INC, and JMP instructions to accomplish this. Your program should
be able to execute the code correctly and produce the expected output. Additionally,
you should be able to provide a clear explanation of the purpose of each line of code.

TASK3
Write an assembly language program that initializes the AX register to -5 and the BX
register to 0. The program should then compare the values stored in the AX and BX
registers. If the value in AX is less than the value in BX, the program should increment
the value of AX by 1 and jump back to the comparison step. Once the value in AX is
greater than or equal to the value in BX, the program should terminate. You should
use the CMP, JL, INC, and JMP instructions to accomplish this. Your program should
be able to execute the code correctly and produce the expected output. Additionally,
you should be able to provide a clear explanation of the purpose of each line of code.
Practice Tasks for Lab 7
TASK4
Write an assembly language program that defines a procedure named "Addition"
which adds the values stored in the AX and BX registers and returns the result. The
main procedure initializes the AX register to 5 and the BX register to 10, calls the
"Addition" procedure, and then terminates. The program should be able to execute
the code correctly and produce the expected output. Additionally, you should be
able to provide a clear explanation of the purpose of each line of code.

TASK5
Write an assembly language program that adds the values stored in the AX and BX
registers using stack. The program should first initialize the value of the AX register
to 5, and the value of the BX register to 10. The program should then push the values
of AX and BX to the stack, call the addition procedure, and pop the values from the
stack. The addition procedure should add the values of AX and BX using the stack
and return the result to the main program. Your program should be able to execute
the code correctly and produce the expected output. Additionally, you should be
able to provide a clear explanation of the purpose of each line of code.

You might also like