Nothing Special   »   [go: up one dir, main page]

Chapter-1 (Week 1 & 2)

Download as pdf or txt
Download as pdf or txt
You are on page 1of 21

CoSc3025- Microprocessor and Assembly Language Programming

Chapter 1: Introduction to the Microprocessor and Computer


1.0 INTRODUCTION
 A microprocessor (sometimes abbreviated μp) is a digital electronic component with
transistors on a single semiconductor integrated circuit (IC). Integrated circuit (IC) that
contains the entire central processing unit of a computer on a single chip.
 A Central processing unit (CPU) in a computer system or handheld device consists of
one or more microprocessors.
 A microprocessor is essentially a set of switches. Using photographic technology a
massive set of electronic switches is superimposed onto a very small piece of silicon.
 A bit refers to one binary digit; a zero or one. In computer memory and processing, this
refers to the state of one switch. The transistors are arranged into groups in order to
represent complex numbers and instructions
 A microprocessor is a computer processor where the data processing logic and control is
included on a single integrated circuit, or a small number of integrated circuits. The
microprocessor contains the arithmetic, logic, and control circuitry required to perform the
functions of a computer's central processing unit.
 A microprocessor is a controlling unit of a micro-computer, fabricated on a small chip capable
of performing Arithmetic Logical Unit (ALU) operations and communicating with the other
devices connected to it

Figure 1.1: Microprocessor

How does a Microprocessor Work?


The microprocessor follows a sequence: Fetch, Decode, and then Execute.
Initially, the instructions are stored in the memory in a sequential order. The microprocessor fetches those
instructions from the memory, then decodes it and executes those instructions till STOP instruction is
reached. Later, it sends the result in binary to the output port. Between these processes, the register stores
the temporarily data and ALU performs the computing functions.
Page 1- 1
CoSc3025- Microprocessor and Assembly Language Programming

1.1 THE MICROPROCESSOR AGE

List of Terms Used in a Microprocessor


Here is a list of some of the frequently used terms in a microprocessor −
Instruction Set − It is the set of instructions that the microprocessor can understand.
Bandwidth − It is the number of bits processed in a single instruction.
Clock Speed − It determines the number of operations per second the processor can perform. It is
expressed in megahertz (MHz) or gigahertz (GHz).It is also known as Clock Rate.
Word Length − It depends upon the width of internal data bus, registers, ALU, etc. An 8-bit
microprocessor can process 8-bit data at a time. The word length ranges from 4 bits to 64 bits
depending upon the type of the microcomputer.
Intel 4004 & 4040
 Intel 4004 was the world’s first microprocessor developed by Intel Corporation in 1971.
It is a 4-bit microprocessor–programmable controller on a chip. 4004 weighed less than
an ounce (approx. 28 gms).
 It addressed a mere 4096, 4-bit-wide memory locations. A 4-bit-wide memory location
is often called a nibble.
 The 4004 instruction set contained only 45 instructions. It executed instructions at the
slow rate of 50 KIPs (kilo-instructions per second) compared to 100,000 instructions
per second by 30-ton ENIAC computer in 1946.
 Later, Intel released the 4040, an updated version of the earlier 4004. The 4040 operated
at a higher speed compared to 4004. The 4-bit microprocessor still survives in low-end
applications such as calculators, microwave ovens and small control systems.
 Main problems with early microprocessor were speed, word width, and memory size.

Intel 8008
 Intel released 8008 in 1971 which is an extended 8-bit version of 4004 microprocessor.
 It executed instructions at the rate of 20 μs (50,000 instructions per second).
 Addressed expanded memory of 16K bytes. Memory size often specified in K bytes. A
byte is generally an 8-bit-wide binary number and a K is 1024 bytes.
 Contained additional instructions, 48 totals. Provided opportunity for application in
more advanced systems.

 Considering the demanding uses for 8008 (Somewhat small memory size, slow speed,
and instruction set limited 8008 usefulness), Intel introduced 8080 microprocessor in
1973 - the first of the modem 8-bit microprocessors.
Page 1- 2
CoSc3025- Microprocessor and Assembly Language Programming

 Six months after Motorola Corporation introduced its MC6800 microprocessor. Soon,
other companies began to introduce their own versions of the 8-bit microprocessor.
Table 1.1 lists several of these early microprocessors and their manufacturers.

Table 1.1: Early 8-bit microprocessors.

Intel 8080
 8080 address more memory and execute additional instructions. It executed them 10
times faster than the 8008.
 An addition that took 20 μs (50,000 instructions per second) on an 8008-based system
required only 2.0 μs (500,000 instructions per second) on an 8080-based system.
 Also, the 8080 was compatible with TTL (transistor-transistor logic), whereas the 8008
was not directly compatible.
 The 8080 also addressed four times more memory (64K bytes) than the 8008 (l6K
bytes).
The 8085 Microprocessor
 In 1977, Intel Corporation introduced an updated version of the 8080—the 8085. The
8085 was the last 8-bit, general-purpose microprocessor developed by Intel.
o Intel has managed to sell well over 100 million copies of the 8085
microprocessor, its most successful 8-bit, general-purpose microprocessor.
 Although only slightly more advanced than an 8080 microprocessor, the 8085 executed
software at an even higher speed.
 An addition that took 2.0 μs (500,000 instructions per second on the 8080) required
only 1.3 μs (769,230 instructions per second) on the 8085.
 The main advantages of the 8085 were its internal clock generator, internal system
controller, and higher clock frequency.

Page 1- 3
CoSc3025- Microprocessor and Assembly Language Programming

1.2 The MODERN MICROPROCESSOR


Intel 8086/8088
 In 1978, Intel released the 8086 microprocessor; a year or so later, it released the 8088.
 Both devices are 16-bit microprocessors, which executed instructions in as little as 400
ns (2.5 MIPs, or 2.5 millions of instructions per second). This represented a major
improvement over the execution speed of the 8085.
 In addition, the 8086 and 8088 addressed 1M byte of memory, which was 16 times
more memory than the 8085.

 One other feature found in the 8086/8088 was a small 4- or 6-byte instruction cache or
queue that prefetched a few instructions before they were executed. The queue sped the
operation of many sequences of instructions and proved to be the basis for the much
larger instruction caches found in modem microprocessors.
 The increased memory size and additional instructions in the 8086 and 8088 have led
to many sophisticated applications for microprocessors. Improvements to the
instruction set included multiply and divide instructions, which were missing on earlier
microprocessors.
 In addition, the number of instructions increased from 45 on the 4004, to 246 on the
8085, to well over 20,000 variations on the 8086 and 8088 microprocessors. These
microprocessors are called CISC (complex instruction set computers) because of the
number and complexity of instructions.
 The 16-bit microprocessor also provided more internal register storage space than the
8-bit microprocessor.

The 80286 Microprocessor


 Even 1M byte memory system proved limiting for large databases and other
applications. This led Intel to introduce the 80286 microprocessor, an updated 8086, in
1983.
 The 80286 microprocessor (also a 16-bit microprocessor) was almost identical to the
8086 and 8088, except it addressed a 16M byte memory system.
 The instruction set of the 80286 was almost identical to the 8086 and 8088, except for
a few additional instructions that managed the extra 15M bytes of memory.
 The clock speed of the 80286 was increased, so it executed some instructions in as little

Page 1- 4
CoSc3025- Microprocessor and Assembly Language Programming

as 250 ns (4.0 MIPs).


The 32-Bit Microprocessor
 Applications began to demand faster microprocessor speeds, more memory, and wider
data paths. This led to the arrival of the 80386 in 1986 by Intel Corporation.
 The 80386 represented a major overhaul of the 16-bit 8086–80286 architecture. The
80386 was Intel’s first practical 32-bit microprocessor that contained
o A 32-bit data bus and a 32-bit memory address.
o Through these 32-bit buses, the 80386 addressed up to 4G bytes of memory. (1G
of memory contains 1024M, or 1,073,741,824 locations.)
o A 4G-byte memory can store an astounding 1,000,000 typewritten, double-
spaced pages of ASCII text data.
o The 80386 was available in a few modified versions such as the 80386SX, which
addressed 16M bytes of memory through a 16-bit data and 24-bit address bus, and
the 80386SL/80386SLC, which addressed 32M bytes of memory through a 16-
bit data and 25-bit address bus. An 80386SLC version contained an internal
cache memory that allowed it to process data at even higher rates.
 In 1995, Intel released the 80386EX microprocessor. The 80386EX microprocessor is
called an embedded PC because it contains all the components of the personal computer
on a single integrated circuit.
 The 80386EX also contains 24 lines for input/output data, a 26-bit address bus, a 16-
bit data bus, a DRAM refresh controller, and programmable chip selection logic.
 The 32-bit microprocessor is needed because of the size of its data bus, which transfers
real (single-precision floating-point) numbers that require 32-bit-wide memory. In
order to efficiently process 32-bit real numbers, the microprocessor must efficiently
pass them between itself and memory. If the numbers pass through an 8-bit data bus, it takes
four read or write cycles; when passed through a 32-bit data bus, however, only one read or
write cycle is required. This significantly increases the speed of any program that manipulates
real numbers.
 Besides providing higher clocking speeds, the 80386 included a hardware circuitry for
memory management unit that allowed memory resources to be allocated and managed
by the operating system. Earlier microprocessors left memory management completely
to the software.
 The instruction set of the 80386 microprocessor was upward-compatible with the earlier
8086, 8088, and 80286 microprocessors. Additional instructions referenced the 32-bit
Page 1- 5
CoSc3025- Microprocessor and Assembly Language Programming

registers and managed the memory system.


The 80486 Microprocessor
 In 1989, Intel released the 80486 microprocessor, which incorporated an 80386-like
microprocessor, an 80387-like numeric coprocessor, and an 8K-byte cache memory
into one integrated package.
 Because the 80486 was available in a 50 MHz version, about half of the instructions
executed in 25ns (50 MIPs). The average speed improvement for a typical mix of
instructions was about 50% over the 80386 that operated at the same clock speed.
 Later versions of the 80486 executed instructions at even higher speeds with a 66 MHz
double-clocked version (80486DX2) with memory transfers executing at the rate of 33
MHz. This is why it was called a double-clocked microprocessor.
 A triple-clocked version from Intel, the 80486DX4, improved the internal execution
speed to 100 MHz with memory transfers at 33 MHz. It also contained an expanded
16K-byte cache in place of the standard 8K-byte cache found on earlier 80486
microprocessors.
The Pentium Microprocessor
 The Pentium, introduced in 1993, was similar to the 80386 and 80486 microprocessors.
This microprocessor was originally labeled the P5 or 80586.
 The two introductory versions of the Pentium operated with a clocking frequency of 60
MHz and 66 MHz, and a speed of 110 MIPs, with a higher-frequency 100 MHz one
and one-half clocked version that operated at 150 MIPs.
 The double-clocked Pentium, operating at 120 MHz and 133 MHz, was also available,
as were higher-speed versions. The fastest version produced by Intel is the 233 MHz
Pentium, which is a three and one-half clocked version. Another difference was that the
cache size was increased to 16K bytes from the 8K cache found in the basic version of
the 80486.
 The Pentium contained an 8K-byte instruction cache and an 8K-byte data cache, which
allowed a program that transfers a large amount of memory data to still benefit from a
cache. The memory system contained up to 4G bytes, with the data bus width increased
from the 32 bits found in the 80386 and 80486 to a full 64 bits.
 Probably the most ingenious feature of the Pentium is its dual integer processors. The
Pentium executes two instructions, which are not dependent on each other,
simultaneously because it contains two independent internal integer processors called
superscaler technology.
Page 1- 6
CoSc3025- Microprocessor and Assembly Language Programming

 Intel also may allow the Pentium to replace some of the RISC (reduced instruction set
computer) machines that currently execute one instruction per clock.

Pentium Pro Processor


 A recent entry from Intel, formerly named the P6 microprocessor.
 Contains 21 million transistors, integer units, as well as a floating-point unit to increase
the performance.
 The basic clock frequency was 150 MHz and 166 MHz.
 Addition to the internal 16K level-one (L1) cache (8K for data and 8K for instructions)
it also contains a 256K level-two (L2) cache.
 Uses three execution engines, so it can execute up to three instructions at a time.
 Optimized to efficiently execute 32-bit code.
 Can address either a 4G-byte memory system or a 64G-byte memory system. The
Pentium Pro has a 36-bit address bus if configured for a 64G memory system.
Pentium II Microprocessors
 Released in 1997. Instead of being an integrated circuit as with prior versions of the
microprocessor, Intel has placed the Pentium II on a small circuit board.
 Use a 100 MHz bus speed.

Pentium III Microprocessor


 Uses a faster core than the Pentium II, but it is still a P6 or Pentium Pro processor.
 Available with clock frequencies of up to 1 GHz. The slot 1 version contains a 512K
cache and the flip-chip version contains a 256K cache.
 Both versions use a memory bus speed of 100 MHz.

Pentium 4 and Core2 Microprocessors


 Pentium 4 microprocessor was first made available in late 2000.
 The most recent version of the Pentium is called the Core2 by Intel.
 Pentium 4 is available in speeds to 3.2 GHz and faster
 The Core2 is available at speeds of up to 3 GHz.
 Cache size from 32K to 8K bytes and most recently to 64K.
Pentium 4 and Core2, 64-bit and Multiple Core Microprocessors
 Recently Intel has included new modifications to the Pentium 4 and Core2 that include
a 64-bit core and multiple cores.
Page 1- 7
CoSc3025- Microprocessor and Assembly Language Programming

 The 64-bit modification allows the microprocessor to address more than 4G bytes of
memory through a wider 64-bit address.
 The biggest advancement in the technology is not the 64-bit operation, but the inclusion
of multiple cores.
 Each core executes a separate task in a program, which increases the speed of execution
Programs that do this are called multithreaded applications.
 Currently, Intel manufactures dual and quad core versions, but in the future the number
of cores will likely increase to eight or even sixteen.
 The problem faced by Intel is that the clock speed cannot be increased to a much higher
rate, so multiple cores are the current solution to providing faster microprocessors.

Page 1- 8
CoSc3025- Microprocessor and Assembly Language Programming

Table 1.2: List of microprocessors with their data size, memory size, number of transistors
and instructions.
YEAR NAME DATA MEMORY # OF # OF
SIZE SIZE TRANSISTO INSTRUCTIO
RS NS
1971 4004 4 4096 4-bit 2,300 45
1973 8008 8 16Kbytes 3,500 48
1973 8080 8 64Kbytes 6,000 48
1973 MC6800 8 64Kbytes
1977 8085 8 64Kbytes 6,500 246
1977 Z80 8 64Kbytes 8,500
1978 8086 16 1Mbytes 29,000 >20,000
1979 8088 16 1Mbytes 29,000
1983 80286 16 16Mbytes 134,000
1986 80386 32 4Gbytes 275,000
1989 80486(i486) 32 4Gbytes 1.2 Million
1993 80586(pentium) 32 4Gbytes 3.3 Million
1995 Pentium Pro 32 4Gbytes 5.5 Million
1997 Pentium II 32 4Gbytes 7.5 Million
1999 Pentium III 32 4Gbytes 9.5 Million
2000 Pentium IV 32 4Gbytes 21 Million
2000 Itanium Processor 64 64Gbytes 15,000,000

Table 1.2 presents list of microprocessors with their data size, memory size, number of
transistors and instructions.

The Future of Microprocessors


 No one can make accurate predictions.
 The process speed will get more faster
 The memory will get more large
 The width of data bus will increase
 Architecture will get more efficient

Page 1- 9
CoSc3025- Microprocessor and Assembly Language Programming

Based on the instruction set microprocessors are classified into:


 RISC: Reduced Instruction Set Computing.
o These types of processors are commonly used in ovens, air conditioners, etc.
o Executes one instruction per clock
 CISC: Complex Instruction Set Computing.
o The types of processors are used in desktops, laptops and servers.
o Refers to number and complexity of instructions
o Improvements was: Multiply and Divide
o The number of instruction increased from
 45 on 4004 to:
 246 on 8085
 20,000 on 8086 and 8088

Page 1- 10
CoSc3025- Microprocessor and Assembly Language Programming

1.3 THE MICROPROCESSOR-BASED PERSONAL COMPUTER SYSTEM


 Computer systems have undergone many changes recently. Machines that once filled
large areas have been reduced to small desktop computer systems because of the
microprocessor.
 Mainframe computer systems, developed in the early 1980s, are not as powerful as the
Pentium Core2-based computers of today.
 Microprocessor-based personal computer system structure includes information about
the memory and operating system.
 Figure 1.2 is the block diagram of the personal computer, also applies to any computer
system, from the early mainframe computers to the latest microprocessor-based
systems.
 The block diagram is composed of three blocks that are interconnected by buses. A bus
is the set of common connections that carry the same type of information.
 For example, the address bus, which contains 20 or more connections, conveys the
memory address to the memory.

Figure 1.2: The block diagram of a microprocessor-based computer system.

The Memory and I/O System


 The memory structure of all Intel-based personal computers is similar.
 The memory system is divided into three main parts:
Page 1- 11
CoSc3025- Microprocessor and Assembly Language Programming

o TPA (transient program area), system area, and XMS (extended memory
system).
 The type of microprocessor in your computer determines whether an extended memory
system exists.
o Computer based on old 8086 or 8088 (a PC or XT), the TPA (640K bytes) and
systems area (384K bytes) exist, but there is no extended memory area.
o First 1M byte of memory is often called the real or conventional memory system.
o Systems based on the 80286 through the Core2 not only contain the TPA (640K
bytes) and system area (384K bytes), they also contain extended memory. These

Page 1- 12
CoSc3025- Microprocessor and Assembly Language Programming

machines are called AT class machines, e.g. PS/l and PS/2, produced by IBM.
Sometimes, these machines are also referred to as ISA (industry standard
architecture) or EISA (extended ISA) machines.

Figure 1.3: The memory map of a personal computer.

 A change beginning with the introduction of the Pentium microprocessor and the ATX
class machine is the addition of a bus called the PCI (peripheral component
interconnect) bus.
 ISA machine contains an 8-bit peripheral bus that is used to interface 8-bit devices to
the computer in the 8086/8088-based PC.
 AT class machine, also called an ISA machine, uses a l6-bit peripheral bus for interface
and may contain the 80286 or above microprocessor.
 The EISA bus is a 32-bit peripheral interface bus found in a few older 80386DX- and
80486-based systems.
o Three newer buses have appeared in ATX class systems. The first to appear was
the USB (universal serial bus).
o The second newer bus is the AGP (advanced graphics port) for video cards. The
advanced graphics port transfers data between the video card and the
microprocessor at higher speeds (66 MHz, with a 64-bit data path, or 533M bytes
per second)
o The latest new buses to appear are the serial ATA interface (SATA) for hard disk
Page 1- 13
CoSc3025- Microprocessor and Assembly Language Programming

drives and the PCI Express bus for the video card. The SATA bus transfers data
from the PC to the hard disk drive at rates of 150M bytes per second or 300M
bytes for SATA-2.
The TPA
 The transient program area (TPA) holds the DOS, any currently active or inactive DOS
application programs and other programs that control the computer system.
o The TPA is a DOS concept and not really applicable in Windows.
o The length of the TPA is 640K bytes.

Figure 1.4 shows the organization of the TPA in a computer system running DOS.

Figure 1.4 The memory map of the TPA in a personal computer.

 Many areas of the TPA are used for system programs, data, and drivers.
 It also shows a large area of memory available for application programs.
 To the left of each area is a hexadecimal number that represents the memory addresses
Page 1- 14
CoSc3025- Microprocessor and Assembly Language Programming

that begin and end each data area. Hexadecimal memory addresses or memory locations
are used to number each byte of the memory system.

The System Area


 Smaller than the TPA.
 Contains programs on either a read-only memory (ROM) or flash memory, and areas
of read/write (RAM) memory for data storage.
 System area map also includes the hexadecimal memory addresses of the various areas.

Windows Systems
 Modern computers use a different memory map with Windows than the DOS memory
maps.
 The Windows memory map appears in Figure 1.5 has two main areas, a TPA and a
system area.

Figure 1.5: The memory map used by Windows.

I/O Space
 The I/O space in a computer system extends from I/O port 0000H to port FFFFH. (An
I/O port address is similar to a memory address, except that instead of addressing
memory, it addresses an I/O device.)
 The I/O devices allow the microprocessor to communicate with the outside world.

Page 1- 15
CoSc3025- Microprocessor and Assembly Language Programming

 To view the memory map on your computer in Windows, go to the Control Panel,
Performance and Maintenance, System, Hardware tab, Device Manager, View tab, then
select resources by type and click on the plus next to Input/Output (I/O).

The Microprocessor (CPU)


 At the heart of the microprocessor-based computer system is the microprocessor
integrated circuit, is the controlling element in a computer system.
 Microprocessor controls memory and I/O through a series of connections called buses.
o The buses select an I/O or memory device, transfer data between an I/O device
or memory and the microprocessor, and control the I/O and memory system.
o Memory and I/O are controlled through instructions that are stored in the
memory and executed by the microprocessor.
 Microprocessor performs three main tasks for the computer system:
1. data transfer between itself and the memory or I/O systems,
2. simple arithmetic and logic operations
3. program flow via simple decisions
 The power of the microprocessor is in its capability to execute billions of millions of
instructions per second from a program stored in the memory system.

Table 1.2 shows the arithmetic and logic operations executed by the Intel family of
microprocessors.

 These operations are very basic, but through them, very complex problems are solved.
Data are operated upon from the memory system or internal registers. Data widths are
variable and include a byte (8 bits), word (16 bits), and double word (32 bits).

 Beginning with the 80486, the microprocessor contained a numeric coprocessor that
allowed it to perform complex arithmetic using floating-point arithmetic.
 The numeric coprocessor is also capable of performing integer operations on
quadwords (64 bits).
 Microprocessor is also able to make simple decisions based upon numerical facts.

Table 1.2: Simple arithmetic and logic operations.

Page 1- 16
CoSc3025- Microprocessor and Assembly Language Programming

Table 1.3 Decision-making capabilities found in the Intel family of microprocessors

Buses (System Bus)


 A bus is a common group of wires that interconnect components in a computer system.
 The buses that interconnect the sections of a computer system transfer address, data,
and control information between the microprocessor and its memory and I/O systems.
 In the microprocessor based computer system, three buses exist for this transfer of
information. These buses are called System Bus:
o Address bus
o Data bus
o Control bus
 Figure 1.6 shows how these buses interconnect various system components such as the
microprocessor, read/write memory (RAM), read-only memory (ROM or flash), and a
few I/O devices. Table 1.4 shows complete listing of bus and memory sizes of the Intel
family of microprocessors.

Page 1- 17
CoSc-2043: Microprocessor and Assembly Language

Figure 1.6: The block diagram of a computer system showing the address, data, and control
bus structure.

Table 1.4 The Intel family of microprocessor bus and memory sizes.

Address Bus:
 The address bus is ‘unidirectional’, over which the microprocessor sends an address
code to the memory or input/output.
 The address bus requests a memory location from the memory or an I/O location from
the I/O devices.
 If I/O is addressed, the address bus contains a 16-bit I/O address from 0000H through
FFFFH. The 16-bit I/O address, or port number, selects one of 64K different I/O
devices. If memory is addressed, the address bus contains a memory address, which
Page 1- 14
CoSc-2043: Microprocessor and Assembly Language

varies in width with the different versions of the microprocessor.


 The more bits there are in the address bus, the more memory locations a microprocessor
can access.

Data bus
 The data bus is 'bi-directional'

 The data bus transfers information between the microprocessor and its memory and I/O
address space.
 Data transfers vary in size, from 8 bits wide to 64 bits wide in various members of the
Intel microprocessor family.
 The advantage of a wider data bus is speed in applications that use wide data. For
example, if a 32-bit number is stored in memory, it takes the 8088 microprocessor four
transfer operations to complete because its data bus is only 8 bits wide. The 80486
accomplishes the same task with one transfer because its data bus is 32 bits wide.

Control Bus:
 The control bus contains lines that select the memory or I/O and cause them to perform
a read or write operation.
 The control bus is used by the microprocessor to send out or receive timing and control
signals in order to coordinate and regulate its operation and to communicate with other
devices, i.e. memory or input/output.
 In most computer systems, there are four control bus connections: MRDC (memory
read control), MWTC (memory write control), IORC (I/O read control), and IOWC
(I/O write control).
 Overbar indicates that the control signal is active-low; that is, it is active when a logic
zero appears on the control line. For example, if IODC=0, the microprocessor is writing
data from the data bus to an I/O device whose address appears on the address bus.
 Microprocessor reads the contents of a memory location by sending the memory an
address through the address bus. Next, it sends the memory read control signal (MRDC)
to cause the memory to read data. Finally, the data read from the memory are passed to
the microprocessor through the data bus.
 Whenever a memory write, I/O write, or I/O read occurs, the same sequence ensues,
except that different control signals are issued and the data flow out of the
microprocessor through its data bus for a write operation.

Page 1- 15
CoSc-2043: Microprocessor and Assembly Language

Word-Sized Data
 Byte ordering, or endianness, is a major architectural consideration.
 If we have a two-byte integer, the integer may be stored so that the least significant byte
is followed by the most significant byte or vice versa.
 In little endian machines, the least significant byte is followed by the most significant
byte.
 Big endian machines store the most significant byte first (at the lower address).
 As an example, suppose we have the hexadecimal number 12345678.
 The big endian and small endian arrangements of the bytes are shown below.

 The least significant byte always stored in the lowest-numbered memory location.
 Most significant byte is stored in the highest.
 This method of storing a number is called the little endian format.
 Alternate method is called the big endian format.

 Numbers are stored with the lowest location containing the most significant data.
 Not used with Intel microprocessors.
 The big endian format is used with the Motorola family of microprocessors.
Hexadecimal number system
The hexadecimal number system uses sixteen characters to represent umbers: 0 through 9 and
A through F; A is worth ten, B is worth eleven, …, and F is fifteen. In assembly program, the
hexadecimal will be indicated by the letter h.
Example:
7Fh is the number 127(7*16+15*1) and its equivalent binary number is 01111111b.

The conversion between binary and hexadecimal is simple. To covert from hexadecimal to
binary: just represent each hexadecimal digit by four binary digits: Example: 74Dh =
011101001101b

To convert from binary to hexadecimal: break the binary number into groups of four digits, and
Page 1- 16
CoSc-2043: Microprocessor and Assembly Language

convert each group into one hexadecimal digit:


Example: 101001001110b = A4Fh

Character representation
Each character is represented by a byte or two hexadecimal digits according to ASCII code.
For example:

ASCII code 41h 42h 5Ah 61h 62h 7Ah 30h 39h
Letter A B Z a b z 0 9

In assembly the ASCII representation of character can be defined by enclosing the characters
in paired single (‘) or double (“) quotes. Example: ‘A’ ‘e’ “9”
Note ‘A’ = 41h, ‘a’ = 61h and “9” = 39h

Page 1- 17

You might also like