12 views

Uploaded by AzkahViqar

Computer Organization and Assembly Language

save

- Autodesk Inventor Programming In C++
- i Ching Paper
- Strings
- The CL Corner More on ILE CEE Time APIs
- 56248153_Application_PCS_7_Multilingual_V801_en.pdf
- ps1hacker
- Midterm.wi14
- DLD_LAB_MANUAL_08.doc
- 452L03F10
- PQR2.7 Printing Letter
- Number representation
- acsl 16-17 contest 1 notes - recursive functions cns wdtpd 1
- Cambridge International as and a Level Computer Science Coursebook
- 8.1.2.7 Lab - Using the Windows Calculator With Network Addresses
- 7.1.2.8 Lab - Using the Windows Calculator with Network Addresses.pdf
- Audi CAN Data Bus.pdf
- chandasutram
- The Best of the Transact Or Volume 2
- command.xlsx
- Untitled
- 1008181282110935 Multiple Choice Questions
- 24AA515,_24LC515,_24FC515
- By Said Mchaalia = New Structured Fuzzy Dynamics = Symbolic Synchronized Big X
- 1_level.pdf
- computer science- question and answer in computer science
- Satti Tarar Timir by Jibanananda Das
- Computer Application
- p247 Penney
- Syn
- C++ Constants
- Lecture 10
- lecture 8
- Lecture 11
- lecture 9
- Day of Judgement
- Lecture 13
- Lecture 14
- Lecture 12
- Early Economic Problems.pptx
- lecture 5
- lecture 6
- Lecture 1 VM
- lecture 7
- lecture 4
- lecture 3

You are on page 1of 34

COMSATS Institute of

Information Technology

CSC221– COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE

Lecture # 2

Asif Muhammad Malik

asif.malik@comsats.edu.pk

**Quote of the day
**

The greatest mistake we humans

make in our relationships

"We listen half, understand quarter,

think zero and react double"

4/17/16

**CSC221– COMPUTER ORGANIZATION AND
**

ASSEMBLY LANGUAGE

3

Data Representation • Binary numbers are used to describe the contents of computer memory • Each numbering format has a base. or maximum number of symbols that can be assigned to a single digit 4/17/16 CSC221– COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE 4 .

Binary Integers • Binary numbers are base 2 numbers. and the bit on the right is the least significant bit (LSB) • Binary integers can be signed or unsigned 4/17/16 CSC221– COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE 5 . in which each binary digit (called a bit) is either 0 or 1 • Bits are numbered sequentially starting at zero on the right side and increasing toward the left • The bit on the left is called the most significant bit (MSB).

each bit in an unsigned binary integer represents an increasing power of 2 4/17/16 CSC221– COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE 6 .Unsigned Binary Integers • Starting with the LSB.

Translating Unsigned Binary Integers to Decimal • Weighted positional notation represents a convenient way to calculate the decimal value of an unsigned binary integer having n digits: • D indicates a binary digit • Calculate Decimal of Binary 10101001 ? 4/17/16 CSC221– COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE 7 .

repeatedly divide the integer by 2.) to produce binary 100101 4/17/16 CSC221– COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE 8 . saving each remainder as a binary digit • We can concatenate the binary bits from the remainder column of the table in reverse order (D5. .Translating Unsigned Decimal Integers to Binary • To translate an unsigned decimal integer into binary. . D4. .

Binary Addition • When adding two binary integers. starting with the low-order pair of bits (on the right) and add each subsequent pair of bits • Add binary 00000100 to 00000111: • What If we add 11111111 to 00000001 and save in 8 bits ? CSC221– COMPUTER ORGANIZATION AND 4/17/16 ASSEMBLY LANGUAGE 9 . proceed bit by bit.

Integer Storage Sizes • The basic storage unit for all data in an x86 computer is a byte. containing 8 bits • Other storage sizes are : 4/17/16 CSC221– COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE 10 .

Integer Storage Sizes 4/17/16 CSC221– COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE 11 .

Hexadecimal Integers 4/17/16 CSC221– COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE 12 .

Hexadecimal Integers • Each hexadecimal digit corresponds to 4 binary bits. • Example: Translate the binary integer 000101101010011110010100 to hexadecimal: 4/17/16 CSC221– COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE 13 .

each digit position represents a power of 16 • The formula can be generalized for any n-digit hexadecimal integer: • For example.Converting Unsigned Hexadecimal to Decimal • In hexadecimal. Convert Hexadecimal ABCD to Decimal ? 4/17/16 CSC221– COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE 14 .

Powers of 16 4/17/16 CSC221– COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE 15 .

Converting Unsigned Decimal to Hexadecimal 4/17/16 CSC221– COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE 16 .

Hexadecimal Addition 4/17/16 CSC221– COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE 17 .

the MSB indicates the sign: 0 is positive and 1 is negative 4/17/16 CSC221– COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE 18 .Signed Binary Integers • For x86 processors.

if presented with the expression A .Two’s-Complement Representation • Negative integers use two’s-complement representation. using the mathematical principle that the two’s complement of an integer is its additive inverse • Two’s-complement representation is useful to processor designers because it removes the need for separate digital circuits to handle both addition and subtraction • For example.B. the processor can simply convert it to an addition expression: A + (-B) 4/17/16 CSC221– COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE 19 .

for example.Two’s-Complement Representation • The two’s complement of a binary integer is formed by inverting (complementing) its bits and adding 1 • Using the 8-bit binary value 00000001. its two’s complement turns out to be 11111111. as can be seen as follows: 4/17/16 CSC221– COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE 20 .

convert B to its two's complement • Add A to (–B) 00001100 00001100 – 00000011 11111101 00001001 4/17/16 CSC221– COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE 21 .Binary Subtraction • When subtracting A – B.

Hexadecimal Two’s Complement • To create the two’s complement of a hexadecimal integer. • An easy way to reverse the bits of a hexadecimal digit is to subtract the digit from 15. reverse all bits and add 1. • Example : 4/17/16 CSC221– COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE 22 .

For Self Learning • Converting • Converting • Converting • Converting 4/17/16 Signed Signed Signed Signed Binary to Decimal Decimal to Binary Decimal to Hexadecimal Hexadecimal to Decimal CSC221– COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE 23 .

Create its two’s complement a second time to get its positive equivalent.Converting Signed Binary to Decimal • If the highest bit is a 1. the number is stored in two’s-complement notation. Then convert this new number to decimal as if it were an unsigned binary integer • If the highest bit is a 0. you can convert it to decimal as if it were an unsigned binary integer • Same steps for “Converting Signed Hexadecimal to Decimal” 4/17/16 CSC221– COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE 24 .

Example 4/17/16 CSC221– COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE 25 .

we create the two’s complement of 00101011. which is 11010101 • Same steps for “Converting Signed Decimal to Hexadecimal” 4/17/16 CSC221– COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE 26 . create the two’s complement of the binary number from the previous step For example. −43 decimal is translated to binary as follows: • The binary representation of unsigned 43 is 00101011 • Because the original value was negative.Converting Signed Decimal to Binary • Convert the absolute value of the decimal integer to binary • If the original decimal integer was negative.

This limits the range: Practice: What is the largest positive value that may be stored in 20 bits? 4/17/16 CSC221– COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE 27 .Ranges of Signed Integers • The highest bit is reserved for the sign.

which is a mapping of characters to integers • ANSI Character Set The American National Standards Institute (ANSI) defines an 8-bit character set that represents up to 256 characters 4/17/16 CSC221– COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE 28 .Character Storage • If computers only store binary data. how do they represent characters? They use a character set.

Character Storage • Unicode Standard Today. computers must be able to represent a wide variety of international languages in computer software • As a result. and punctuation used in all major languages 4/17/16 CSC221– COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE 29 . the Unicode standard was created as a universal way of defining characters and symbols • It defines numeric codes (called code points) for characters. symbols.

32h. 43h. 42h. and 33h 4/17/16 CSC221– COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE 30 . A sequence of one or more characters is called a string • An ASCII string is stored in memory as a succession of bytes containing ASCII codes • For example. the numeric codes for the string “ABC123” are 41h. 31h.Character Storage • ASCII Strings.

Summary 4/17/16 CSC221– COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE 31 .

Reading Material • Chapter # 1 Assembly Language for x86 Processors. IRVINE 4/17/16 CSC221– COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE 32 . Seventh Edition By KIP R.

- Autodesk Inventor Programming In C++Uploaded byDuy Nguyen Duc
- i Ching PaperUploaded byPersia Santiago
- StringsUploaded byRakhi Manglani
- The CL Corner More on ILE CEE Time APIsUploaded byrachmat99
- 56248153_Application_PCS_7_Multilingual_V801_en.pdfUploaded byHiggor Olipe
- ps1hackerUploaded byUdrea Mihai Madalin
- Midterm.wi14Uploaded bychrislake12
- DLD_LAB_MANUAL_08.docUploaded bySana gull
- 452L03F10Uploaded bygmsinclair
- PQR2.7 Printing LetterUploaded bygcarrera32972
- Number representationUploaded byAdam Tri Ramdani
- acsl 16-17 contest 1 notes - recursive functions cns wdtpd 1Uploaded byapi-328824013
- Cambridge International as and a Level Computer Science CoursebookUploaded byPrasanth
- 8.1.2.7 Lab - Using the Windows Calculator With Network AddressesUploaded byRayhan Daffa R
- 7.1.2.8 Lab - Using the Windows Calculator with Network Addresses.pdfUploaded byChee Wei Au
- Audi CAN Data Bus.pdfUploaded byJOHNNY5377
- chandasutramUploaded bypadma2910
- The Best of the Transact Or Volume 2Uploaded byCubemanPDX
- command.xlsxUploaded byjaynos
- UntitledUploaded byeurolex
- 1008181282110935 Multiple Choice QuestionsUploaded bySravanthi Gelley
- 24AA515,_24LC515,_24FC515Uploaded bydorud
- By Said Mchaalia = New Structured Fuzzy Dynamics = Symbolic Synchronized Big XUploaded bysfofoby
- 1_level.pdfUploaded byPARVATHY ANIL
- computer science- question and answer in computer scienceUploaded byAlok Nikhil
- Satti Tarar Timir by Jibanananda DasUploaded byallbdbooks
- Computer ApplicationUploaded byKrista Jackson
- p247 PenneyUploaded byDebajyoti Datta
- SynUploaded byAbhishek Sharma
- C++ ConstantsUploaded byRaman Goyal

- Lecture 10Uploaded byAzkahViqar
- lecture 8Uploaded byAzkahViqar
- Lecture 11Uploaded byAzkahViqar
- lecture 9Uploaded byAzkahViqar
- Day of JudgementUploaded byAzkahViqar
- Lecture 13Uploaded byAzkahViqar
- Lecture 14Uploaded byAzkahViqar
- Lecture 12Uploaded byAzkahViqar
- Early Economic Problems.pptxUploaded byAzkahViqar
- lecture 5Uploaded byAzkahViqar
- lecture 6Uploaded byAzkahViqar
- Lecture 1 VMUploaded byAzkahViqar
- lecture 7Uploaded byAzkahViqar
- lecture 4Uploaded byAzkahViqar
- lecture 3Uploaded byAzkahViqar