Assignment 1
Assignment 1
Assignment# 1
Submitted to: Sir. Muhammad Zubair
Submitted by: Hanzla
Subject: Computer Organization and Assembly Language
Class: BSCS 3rd (B)
Registration No.: 13304
Date: 25-November-2020
Q1-Make a simple program in assembly language and performs any
mathematical operation on your accumulator register and also uses
your base register in your program.
: A = (A + B) - (C + D)
INCLUDE Irvine32.inc
.code
main PROC
mov eax,2000h
mov ebx,3000h
mov ecx,4000h
mov edx,1000h
add eax,ebx
add ecx,edx
sub eax,ecx
call DumpRegs
exit
main ENDP
END main
Qno-2 Briefly explain the flag register and its uses
FLAG REGISTERS
Zero Bit
RESULT of an arithmetic or logic operation is zero. If Z = 1, the result is zero.
If Z = 0, the result is not zero.
Sign Bit
Indicates the arithmetic sign of the result after an addition or subtraction. If S = 1,
the result is negative. If S = 0, the result is positive.
Carry Bit
Indicates carry after addition or borrow after subtraction. If carry is after addition or
borrow after subtraction occur than C = 1, otherwise C = 0;
Overflow Bit
A condition that can occur when signed numbers are added or subtracted.
An overflow condition indicates that a result has exceeded the capacity of the
machine. For example, if 7Fh (+127) is added to 01h (+1), the result is 80h (-128).
This result represents an overflow condition indicated by the overflow flag
for signed addition. For unsigned operations, ignore the overflow flag.