0% found this document useful (0 votes)
124 views30 pages

Assembly Language For x86 Processors CH2

This document provides an overview of two chapters on assembly language for x86 processors. Chapter 1 discusses basic concepts like data representation and Boolean expressions. Chapter 2 covers the architecture of 32-bit and 64-bit x86 processors, including general concepts like instruction execution cycles and components like the CPU, memory, and buses. It also outlines topics like loading and executing programs and reading from memory.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
124 views30 pages

Assembly Language For x86 Processors CH2

This document provides an overview of two chapters on assembly language for x86 processors. Chapter 1 discusses basic concepts like data representation and Boolean expressions. Chapter 2 covers the architecture of 32-bit and 64-bit x86 processors, including general concepts like instruction execution cycles and components like the CPU, memory, and buses. It also outlines topics like loading and executing programs and reading from memory.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

Assembly Language for x86 Processors

CH1. Basic Concepts + CH2. x86 Processor Architecture

Internal
Outlines

Remains of Ch1:
➢ Review
➢ Continue with Data Representation.
➢ Boolean Expressions.

Topics in Ch2:
➢ General Concepts.
➢ 32-Bit x86 Processors.

Internal
Review

Internal
How represent 1000 signed binary

# Sign and magnitude 1st comp. 1ed comp.


000 +0 +0 +0
001 +1 +1 +1
010 +2 +2 +2
011 +3 +3 +3
100 -0 -3 -4
101 -1 -2 -3
110 -2 -1 -2
111 -3 -0 -1

Internal
Data Representation

Maximum and Minimum Values

➢ A signed integer of n bits uses only n - 1 bits to represent the number’s magnitude,

Internal
Data Representation

Internal
Data Representation

Integer Storage Sizes


➢ The basic storage unit for all data in an x86 computer is a byte, containing 8 bits.

➢ Large Measurements
• kilobyte is equal to 210
• yottabyte is equal to 280

Internal
Data Representation

Character Storage
➢ To represent characters, computers use a character set which is a mapping of characters to
integers.
• For example, IBM-compatible microcomputers use the ASCII (pronounced “askey”) character
set. In ASCII, a unique 7-bit integer is assigned to each character, the extra bit is used on various
computers to create a proprietary character set.
• ANSI Character Set uses 256 characters. Early version of Microsoft Windows used the ANSI
character set.
• Unicode Standard was created as a universal way of defining characters and symbols, like
UTF-8, UTF-16, and UTF-32. It defines numeric codes (called code points)

➢ ASCII String is a sequence of one or more characters.

Internal
Data Representation

Character Storage
➢ Using the ASCII Table.

Internal
Data Representation

Character Storage
➢ ASCII Control Characters are in the range 0 through

Internal
Data Representation

Character Storage
➢ Terminology for Numeric Data Representation
Decimal 65 is stored in memory as a single binary byte as 01000001would be probably displayed
as “41,” which is the number’s hexadecimal representation. If the byte were copied to video
memory, the letter “A” would appear on the screen because 01000001 is the ASCII code for the
letter A.
• A binary integer is an integer stored in memory in its raw format, ready to be used in a
calculation. Binary integers are stored in multiples of 8 bits (such as 8, 16, 32, or 64).
• A digit string is a string of ASCII characters, such as “123” or “65.” This is simply a
representation of the number and can be in any of the formats shown for the decimal number 65

Internal
Boolean Expressions

Internal
Boolean Expressions

➢ Boolean algebra defines a set of operations on the values true and false.

➢ A boolean expression involves a boolean operator and one or more operands.


• NOT: notated as  or ~ or ’
• AND: notated as  or •
• OR: notated as  or +

Internal
Boolean Expressions

➢ NOT operation reverses a boolean value.

➢ AND operation requires two operands

➢ OR operation requires two operands,

Internal
Boolean Expressions

➢ Operator precedence rules are used to indicate which operators execute first in expressions
involving multiple operators

➢ Truth Tables for Boolean Functions


• A boolean function receives boolean inputs and produces a boolean output
• A truth table can be constructed for any boolean function, showing all possible inputs and
outputs.

Internal
Boolean Expressions

Internal
The end of CH1

Internal
CH2 : x86 Processor Architecture

Internal
Outlines

➢ General Concepts

➢ 32-Bit x86 Processors

➢ 64-Bit x86-64 Processors

➢ Components of a Typical x86 Computer

➢ Input–Output System

Internal
General Concepts

➢ Basic Microcomputer Design

➢ Instruction Execution Cycle

➢ Reading from Memory

➢ Loading and Executing a Program

Internal
Basic Microcomputer Design

➢ The clock synchronizes the internal operations of the CPU with other system
components.
➢ The control unit (CU) coordinates the sequencing of steps involved in executing
machine instructions.
➢ The arithmetic logic unit (ALU) performs arithmetic operations such as addition and
subtraction and logical operations such as AND, OR, and NOT.

Internal
Basic Microcomputer Design

➢ The memory storage unit is where instructions and data are held while a computer
program is Running
➢ programs residing in memory must be copied into the CPU before they can execute.

Internal
Basic Microcomputer Design

➢ A bus is a group of parallel wires that transfer data from one part of the computer to
another.
➢ A computer system usually contains four bus types: data, I/O, control, and address.

Internal
Basic Microcomputer Design

➢ The data bus transfers instructions and data between the CPU and memory.

➢ The I/O bus transfers data between the CPU and the system input/output devices.

➢ The control bus uses binary signals to synchronize actions of all devices attached to
the system bus.

➢ The address bus holds the addresses of instructions and data when the currently
executing instruction transfers data between the CPU and memory.

Internal
Basic Microcomputer Design

Clock
➢ Each operation involving the CPU and the system bus is synchronized by an internal
clock pulsing at a constant rate.

➢ The basic unit of time for machine instructions is a machine cycle (or clock cycle).

➢ The length of a clock cycle is the time required for one complete clock pulse.

➢ The duration of a clock cycle is calculated as the reciprocal of the clock’s speed, which
in turn is measured in oscillations per second.
End
Internal
Instruction Execution Cycle

➢ The CPU has to go through a predefined sequence of steps to execute a machine


instruction, called the instruction execution cycle :

1. First, the CPU has to fetch the instruction from an area of memory called the instruction
queue. Right after doing this, it increments the instruction pointer.
2. Next, the CPU decodes the instruction by looking at its binary bit pattern. This bit pattern
might reveal that the instruction has operands (input values).
3. If operands are involved, the CPU fetches the operands from registers and memory.
Sometimes, this involves address calculations.
4. Next, the CPU executes the instruction, using any operand values it fetched during the earlier
step. It also updates a few status flags, such as Zero, Carry, and Overflow.
5. Finally, if an output operand was part of the instruction, the CPU stores the result of its
execution in the operand.
Internal
Instruction Execution Cycle

➢ Simplified CPU block diagram.

End
Internal
Reading from Memory

➢ As a rule, computers read memory much more slowly than they access internal
registers. This is because reading a single value from memory involves four separate
steps:
1. Place the address of the value you want to read on the address bus.
2. Assert (change the value of) the processor’s RD (read) pin.
3. Wait one clock cycle for the memory chips to respond.
4. Copy the data from the data bus into the destination operand.

➢ Each of these steps generally requires a single clock cycle, that’s much slower than the
CPU registers, which are usually accessed in only one clock cycle.

Internal
Reading from Memory

➢ Program is more likely want to access the same memory and instructions repeatedly,
so cache keeps these values where they can be accessed.

➢ Also, when the CPU begins to execute a program, it can look ahead and load the next
thousand instructions (for example) into cache, on the assumption that these
instructions will be needed fairly soon.

➢ When the processor is able to find its data in cache memory, we call that a cache hit.

➢ On the other hand, if the CPU tries to find something in cache and it’s not there, we call
that a cache miss.

➢ There’s a reason why cache memory is faster than conventional RAM --> static RAM

Internal
Loading and Executing a Program

➢ Before a program can run, it must be loaded into memory by a utility known as a program
loader.

➢ After loading, the operating system must point the CPU to the program’s entry point, which
is the address at which the program is to begin execution.

➢ The following steps break this process down in more detail:


1. The operating system (OS) searches for the program’s filename in the current disk directory.
2. If it is found, the OS retrieves the file size and its physical location on the disk drive.
3. The OS determines the next available location in memory and loads the program file into memory.
4. The OS begins execution of the program’s first machine instruction (its entry point). As soon as the
program begins running, it is called a process.
5. The process runs by itself. It is the OS’s job to track the execution of the process, when the process
ends, it is removed from memory.
End
Internal

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy