Professional Documents
Culture Documents
Lab2 (Solution)
Lab2 (Solution)
SP22-BCS-065-B
LAB No 2
Program Exercise 1 (solution):
Using only MOV, ADD, SUB, INC and DEC:
AX = BX – AX
MOV AX, 0050: Moves the value 0050 into AX
MOV BX, 0020: Moves the value 0020 into BX
SUB BX, AX: Subtracting the value of AX from BX and
stores in BX
MOV AX, BX: moves the value of BX to AX
AX = AX + 1
Incrementing the value of AX by 1.
CX = AX + BX
ADD AX, BX: Adds the value of BX into AX.
MOV CX, AX: Moves the value of AX into CX.
BX = BX-1d + 10d
DEC BX: Decrementing the value of BX by 1.
ADD BX, A: Add A to the value of BX.
AX = 5h – AX
MOV AX, 5: Move the value 5 into AX
SUB DX, AX: Subtracting the value of AX from DX.
MOV AX, DX: moves the value of DX to AX.
AX = 01001100b + 00011011b
FARYAL AWAIS
SP22-BCS-065-B
Post-Lab Assignment:
Question 1: Write code to achieve the following:
Initialize two registers AX, BX with 20h and 30h. Swap the contents of AX with BX
registers.
Display the contents of the registers.
FARYAL AWAIS
SP22-BCS-065-B