Aim:
To write an assembly language program to perform various arithmetic and logical
operations using 8086 Emulator.
Arithmetic Operations:
Algorithm:
Step1. Assume general purpose registers and starting address of the program
Step 2. Initialize AX with an immediate data
Step 3. Initialize BX with a register-based addressing mode data
Step 4. Perform Arithmetic operations using the 8086-Instruction Set Architecture’s
instructions
Program
ORG 1000H
MOV AX,0005H ;Initialize AX with immediate data
MOV BX,[4500H] ;Initialize BX with register-based addressing mode
ADD AX,BX ;Add the register contents
MOV [2000H],AX ;Move the result to memory
SUB AX,BX ;Sub the register contents
MOV [2002H],AX ;Move the result to memory
MOV AX,BX ;Move BX to AX
MUL BX ;Performing AX*BX
MOV [2004H],AX ;Move the result to memory
DIV BX ;Performing AX/BX
MOV [2006H],AX ;Move the result to memory
Logical Operations:
Algorithm:
Step1. Assume general purpose registers and starting address of the program
Step 2. Initialize AX and BX with register-based addressing mode data
Step 3. Use CX register as a backup register of AX initial value, which we will be using for
several logical operations
Step 4. Perform Arithmetic operations using the 8086-Instruction Set Architecture’s
instructions
Step 5. Move the resultant value to the memory location using appropriate move instruction
Program:
ORG 1000h
MOV AX,[1500H] ; Initializing AX with register-based addressing mode
MOV BX,[1502H] ; Initializing BX with register-based addressing mode
MOV CX,AX ; Backing-up AX content to CX
AND AX,BX ; ADD operation
MOV [1504H],AX
MOV AX,CX
OR AX,BX ; OR operation
MOV [1506H],AX
MOV AX,CX
XOR AX,BX ; XOR operation
MOV [1508H],AX
NOT AX ; NOT operation
MOV [150AH],AX
END
HLT