0% found this document useful (0 votes)
69 views

Assignment 1

This document contains an assignment submission for a computer organization and assembly language class. It includes three questions and responses. Question 1 asks to write a simple assembly language program performing a mathematical operation on the accumulator and base registers. Question 2 explains the purpose and uses of flag registers. Question 3 discusses the importance of assembly language, including its closeness to hardware and ability to better understand architecture.

Uploaded by

Moon Mughal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
69 views

Assignment 1

This document contains an assignment submission for a computer organization and assembly language class. It includes three questions and responses. Question 1 asks to write a simple assembly language program performing a mathematical operation on the accumulator and base registers. Question 2 explains the purpose and uses of flag registers. Question 3 discusses the importance of assembly language, including its closeness to hardware and ability to better understand architecture.

Uploaded by

Moon Mughal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Riphah International University

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.

Qno-3 Importance of assembly language


IMPORTANCE OF ASSEMBLY LANGUAGE
Assembly language is machine specific and considered a "low level" language. This
means that the code and syntax is much closer to the computer's processor, memory, and
I/O system. A high level language is designed with keywords, libraries, and a syntax that
introduces a high level of abstraction between the language and the hardware.
Often, assembly language can be mixed into higher level languages, such as C, where
assembly can be added inline to the C code. Assembly language is a low level language
that uses mnemonics to represent each operation. Instead of using pure binary.
 Better understanding of the underlying architecture;
 Interfacing with uncommon ABI rules.
 interfacing with hardware, BIOS, SoCs (System-on-Chips);

You might also like