You are on page 1of 22

Computer Organization and

Assembly Language
(CS2411 & CSC2201)

Class: BSCS 4
Lecture: 1
Lecturer Name: Kashif
Email: kashifdayo@Hotmail.com

SZABIST LARKANA CAMPUS 1


Lecture outline

 Resources
 Grading Theory
 Goals and Required Background
 Organization VS Architecture
 Function and Structure of Computer System
 Data Representation
 Number System Conversion
 Computer Arithmetic
 Two’s Compliment of Binary and Hexadecimal
 Boolean Algebra

SZABIST LARKANA CAMPUS 2


Resources
1. Assembly Language for x86 Processors, 7th edition/4th edition, Kip Irvine
2. Art of Assembly Language, 2e, Randall Hyde
3.IDE for assembly language programming (Visual Studio 2012)
4. Irvine (32-bit/16bit) Library

SZABIST LARKANA CAMPUS 3


Goals and Required Background

 Goals: broaden student’s interest and knowledge in …


 Basic organization of a computer system
 Intel IA-32 processor architecture
 How to write assembly language programs
 How high-level languages translate into assembly language
 Interaction between the assembly language programs, libraries, the operating
system, and the hardware
 How interrupts, system calls, and handlers work
 How to debug a program at the machine level
 Required Background
 The student should already be able to program confidently in at least one high-
level programming language, such as Java or C.

SZABIST LARKANA CAMPUS 4


Early computers and Programming Tools

SZABIST LARKANA CAMPUS 5


Language

 Human Language  Programming Language

 Naturally created, e.g.,  Artificially developed, e.g.,


English, Urdu, Sindhi,
C, Basic, C#, Fortran,…
Punjabi,…

 Interpreted mostly by  Interpreted by human and


human computer

 Ambiguities and exceptions  Clear and precise syntax


in syntax and grammar

SZABIST LARKANA CAMPUS 6


Hierarchy of Programming Language

SZABIST LARKANA CAMPUS 7


Organization VS Architecture

 Organization refers to….


 Operational Units and their interconnection.
 Realize the architectural specification.
 Physical arrangement of components of computer.
 Placement of main memory, CPU, cache memory etc.
 Examples of Organizational Attributes:
 Hardware details transparent (not visible) to the programmer
Interface between computer and peripherals.
Memory technology used.

SZABIST LARKANA CAMPUS 8


Organization VS Architecture Cont…

 Architecture refers to…


 Attributes of computer system visible to programmer.
 Direct impact on logical execution of program.
 Examples of Architectural Attributes:
Instruction set
Number of bits used to represent data types.
I/O mechanism
Memory addressing techniques

SZABIST LARKANA CAMPUS 9


Organization VS Architecture Cont…
 Example of architectural design issue:
 A computer will have a multiply instruction.
 Example of Organizational issue:
 An Instruction will be implemented by a special multiply unit or by
repeated use of the add unit of the system.
 Particular architecture may span many years.
 Encompass a number of different computer models
 But its organization changing with changing technology.
 Organization must be designed to implement a particular architectural.
 Thorough treatment of organization requires a detailed examination of
architecture.
 Changes in technology influence organization and architectures.

SZABIST LARKANA CAMPUS 10


Function of Computer System

 Function
 The operation of each individual component
as part of the structure.
Data processing
Data storage
Data movement
Control

SZABIST LARKANA CAMPUS 11


Structure of Computer System

 Structure
 The way in which the components are
interrelated.
 Computer interacts in some fashion with its
external environment.
 Its linkages to the external environment
 Classified as peripheral devices or
communication lines.

SZABIST LARKANA CAMPUS 12


Structure of Computer System

 Four main structural components:


 CPU, Main Memory, I/O, System interconnection/System Bus
 CPU’s structural components:
 CU, ALU, Registers, CPU interconnection.
 Control unit: Controls the operation of the CPU and the computer
 Arithmetic and logic unit (ALU): Performs the computer’s data
processing functions
 Registers: Provides storage internal to the CPU
 CPU interconnection: Some mechanism that provides for communication
among the control unit, ALU, and registers.

SZABIST LARKANA CAMPUS 13


Data representation

 Computer is a construction of digital circuits with two states:


on and off
 You need to have the ability to translate between different
representations to examine the content of the machine
 Common number systems:
 Binary, octal, decimal and hexadecimal

SZABIST LARKANA CAMPUS 14


Data Representation

 Often, binary numbers are used to describe the contents of computer memory.
 At other times, decimal and hexadecimal numbers are used.
 Quickly translate numbers from one format to another.
 Each numbering system has a base or maximum number of symbols.

SZABIST LARKANA CAMPUS 15


Binary Integers

 Computer stores instructions and data in memory as collections of electronic


charges.
 Representing these entities with numbers requires a system geared to the concepts
of on and off or true and false.
 Binary numbers are base 2 numbers, in which each binary digit (called a bit) is
either 0 or 1

SZABIST LARKANA CAMPUS 16


Extra Digit/Bit is needed in Addition
 Sometimes a carry is generated out of the highest bit position.
 When that happens, the size of the storage area set aside
becomes important.
 If we add 11111111 to 00000001, for example, a 1 carries out of
the highest bit position, and the lowest 8 bits of the sum equal
all zeros.
 If the storage location for the sum is at least 9 bits long, we can
represent the sum as 100000000.
 But if the sum can only store 8 bits, it will equal to 00000000,
the lowest 8 bits of the calculated value.
 It is like adding 99 with 1 ( 1+99 =100). An extra digit is needed
for the result.

SZABIST LARKANA CAMPUS 17


Integer Storage Sizes

 The basic storage unit for all data in an x86 computer is a byte (8 bits).
 Other storage sizes are:
 Word (2 bytes)
 Doubleword (4 bytes)
 Quadword (8 bytes)

SZABIST LARKANA CAMPUS 18


Signed Binary Integers

 Signed binary integers are positive or negative.


 MSB indicates the sign.
 0 is positive and 1 is negative.

SZABIST LARKANA CAMPUS 19


Two’s-Complement Representation

 Negative integers use two’s-complement representation.


 Two’s complement of an integer is its additive inverse.
 add a number to its additive inverse, the sum is zero
 Useful to processor designers as it removes the need for
separate digital circuits to handle both addition and
subtraction.
 A-B can be expressed as A+(-B).

SZABIST LARKANA CAMPUS 20


Two’s-Complement

 The two’s complement of a binary integer is formed by inverting (complementing)


its bits and adding 1.
 as can be seen as follows:

 11111111 is the two’s-complement representation of -1.


 The two’s-complement operation is reversible, so the two’s complement of
11111111 is 00000001.

SZABIST LARKANA CAMPUS 21


THANKS

SZABIST LARKANA CAMPUS 22

You might also like