This is introduction to micro processor and assembly language course. In this chapter you are going to be introduced to basic idea of microprocessor. Language hierarchy and virtual machine concept.
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
Assembly chapter One.pptx
1. WELCOME TO COSC3025
What to expect:
Microprocessor Architecture, interrupt,
interfacing …
Assembly language Concept
Fundamentals
Data Transfer in Memory and Registers
How conditional and Loop Works
Assembly for MP programming
Assembly for OS programming (inline Assembly)
C compiler
Procedure, Macro, Array, String (???)
5. DESIGN OBJECTIVES OF MP
Maximize Performance
Speed of operation: How quickly an operation can be completed
Throughput: No of operations completed in unit time, not necessarily
the same as speed, consider Servers.
Maximize Productivity
Interface provided must be easy
Be one step ahead of market needs and two steps
ahead of competition
7. DESIGN CONSTRAINT
Power consumed
Today’s processors consume a peak power of 100 W, which means a
peak current of nearly 80A.
Area
Cost
Backward compatibility
Windows running on Intel P3 Processor should run on Intel P4 too.
Time taken to design the processor should not be
very large or else the competitor may get ahead
Other factors like security, scalability, reliability also
need to be considered in processor design
8. MARKET
Desktop
Processor for desktop computers. Cost, backward compatibility are very
important. Eg: Intel Pentium, AMD Athlon
Servers
Processor for applications requiring huge amount of computation, data
handling like web servers, database servers, scientific computation
servers. In general, multiple processors are used. Throughput is a very
important metric for servers in general. Eg: Google servers, vsnlproxy
Embedded
For applications in electronic appliances, robots, cars, mobiles etc. Power
consumption, cost are very important metrics. Eg: Microcontrollers like
8051, PIC, specifically designed processors for cars, mobiles etc.
9. STRUCTURE
The processor is a computing unit which needs to
interact with memory for getting instructions as
well as data
Processor
Instruction
Memory
Data
Memory
Address
(PC)
Instruction
Address
(reg)
Data
(loads)
Data
(stores)
10. INTERNAL STRUCTURE OF THE PROCESSOR
Control Unit
Fetches instructions from memory, Interprets them, Controls ALU
ALU
Does all computations
Register File
Stores variables
Data
Address
ALU
(Calculator)
Register File
Data
Control Unit
Instr
Control
Flags
PC
Data
Out
Data
In
Instr
In
Inst
Address
r1
r2
r3
r4
11. EVOLUTION OF MP
Intel Microprocessor History
Intel 8086, 80286
IA-32 processor family
P6 processor family
CISC and RISC
12. EARLY
•Intel 8080
–64K addressable RAM
–8-bit registers
–CP/M operating system
–S-100 BUS architecture
–8-inch floppy disks!
•Intel 8086/8088
–IBM-PC Used 8088
–1 MB addressable RAM
–16-bit registers
–16-bit data bus (8-bit for 8088)
–separate floating-point unit (8087)
13. THE IBM-AT
•Intel 80286
–16 MB addressable RAM
–Protected memory
–several times faster than 8086
–introduced IDE bus architecture
–80287 floating point unit
18. ASSEMBLY AND MACHINE LANGUAGE
Machine language
Native to a processor: executed directly by hardware
Instructions consist of binary code: 1s and 0s
Assembly language
Slightly higher-level language
Readability of instructions is better than machine
language
One-to-one correspondence with machine language
instructions
Assemblers translate assembly to machine code
Compilers translate high-level programs to
machine code
Either directly, or
Indirectly via an assembler
21. INSTRUCTIONS AND MACHINE LANGUAGE
Each command of a program is called
an instruction (it instructs the
computer what to do).
Computers only deal with binary data,
hence the instructions must be in
binary format (0s and 1s) .
The set of all instructions (in binary
form) makes up the computer's
machine language. This is also
referred to as the instruction set.
22. INSTRUCTION FIELDS
Machine language instructions usually are made up of
several fields. Each field specifies different
information for the computer. The major two fields
are:
Opcode field which stands for operation code and it
specifies the particular operation that is to be
performed.
Each operation has its unique opcode.
Operands fields which specify where to get the source
and destination operands for the operation specified
by the opcode.
The source/destination of operands can be a constant, the
memory or one of the general-purpose registers.
24. TRANSLATING LANGUAGES
English: D is assigned the sum of A times B plus 10.
High-Level Language: D = A * B + 10
Intel Assembly Language:
mov eax, A
mul B
add eax, 10
mov D, eax
Intel Machine Language:
A1 00404000
F7 25 00404004
83 C0 0A
A3 00404008
A statement in a high-level language is translated
typically into several machine-level instructions
25. ADVANTAGES OF HIGH-LEVEL LANGUAGES
Program development is faster
High-level statements: fewer instructions to code
Program maintenance is easier
Programs are portable
Contain few machine-dependent details
Can be used with little or no modifications on
different machines
Compiler translates to the target machine
language
However, Assembly language programs are not
portable
26. VIRTUAL MACHINE CONCEPT
An effective way to explain how a computer’s hardware
and software are related is called the virtual machine
concept.
A computer can usually execute programs written in its
native machine language. Each instruction in this
language is simple enough to be executed using a
relatively small number of electronic circuits. For
simplicity, we will call this language L0.
Programmers would have a difficult time writing
programs in L0 because it is enormously detailed
and consists purely of numbers. If a new language,
L1 , could be constructed that was easier to use,
programs could be written in L1. There are two ways
to achieve this:
27. Interpretation:
As the L1 program is running, each of its
instructions could be decoded and executed
by a program written in language L0. The L1
program begins running immediately, but
each instruction has to be decoded before it
can execute.
Translation:
The entire L1 program could be converted into
an L0 program by an L0 program specifically
designed for this purpose. Then the resulting
L0 program could be executed directly on the
computer hardware.
28. Virtual Machines
Rather than using only languages, it is easier
to think in terms of a hypothetical computer,
or virtual machine , at each level. we can
define a virtual machine as a software
program that emulates the functions of some
other physical or virtual computer.
The virtual machine VM1 , can execute
commands written in language L1. The
virtual machine VM0 can execute commands
written in language L0.
Each virtual machine can be constructed of
either hardware or software.
29.
30. WHY LEARN ASSEMBLY LANGUAGE?
Two main reasons:
Accessibility to system hardware
To use space and time efficiently
Some application of assembly languages
are:
Real time system. E.g Traffic control system
Embedded system. Where there is no
compiler. E.g Micro chips.
Operating system. Specially kernel part of
operating system. Where direct access of
hard ware is necessary.
31. ASSEMBLER
Software tools are needed for editing, assembling,
linking, and debugging assembly language
programs
An assembler is a program that converts
source-code programs written in assembly
language into object files in machine language
Popular assemblers have emerged over the years
for the Intel family of processors. These include
…
TASM (Turbo Assembler from Borland)
NASM (Netwide Assembler for both Windows and
Linux), and
MASM (Macro Assembler from Microsoft)
32. LINKER AND LINK LIBRARIES
You need a linker program to produce
executable files
It combines your program's object file
created by the assembler with other
object files and link libraries, and
produces a single executable program
LINK32.EXE is the linker program
provided with the MASM distribution
for linking 32-bit programs
33. ASSEMBLE AND LINK PROCESS
Source
File
Source
File
Source
File
Assembler
Object
File
Assembler
Object
File
Assembler
Object
File
Linker
Executable
File
Link
Libraries
A project may consist of multiple source files
Assembler translates each source file separately into an object file
Linker links all object files together with link libraries
34. Locally:
MASM
NASM
TASM
EMULATOR:
Emu8086
Online
Online:(NASM)
Tutorial Point
Assembler
JDOODLE
My-Compiler
WHERE WE CAN WRITE ASSEMBLY
35. NUMBER SYSTEMS
Decimal
(D)
Binary (B) Hexadecimal
(H or X)
Zero 0 0 0
Nine 9 1001 9
Ten 10 1010 A
Eleven 11 1011 B
Twelve 12 1100 C
Thirteen 13 1101 D
Fourteen 14 1110 E
Fifteen (Largest 4 bit no.) 15 1111 F
Forty Two 42 0010 1010 2A
Largest 8 bit no. 255 1111 1111 FF
Largest 16 bit no. 65535 1111 1111 1111 1111 FF FF