Assembly Language For x86 Processors CH2
Assembly Language For x86 Processors CH2
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
Internal
Data Representation
➢ A signed integer of n bits uses only n - 1 bits to represent the number’s magnitude,
Internal
Data Representation
Internal
Data Representation
➢ 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)
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.
Internal
Boolean Expressions
Internal
Boolean Expressions
➢ Operator precedence rules are used to indicate which operators execute first in expressions
involving multiple operators
Internal
Boolean Expressions
Internal
The end of CH1
Internal
CH2 : x86 Processor Architecture
Internal
Outlines
➢ General Concepts
➢ Input–Output System
Internal
General Concepts
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
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
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.