100% found this document useful (1 vote)
42 views33 pages

Today Assembly Language Slide

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
42 views33 pages

Today Assembly Language Slide

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 33

INTRODUCTION TO

COMPUTER
ENGINEERING
CPE 112
CONTENT
 identification of computer software and hardware
components

Know the operational relationships between central


processing units, input/output devices, operating systems,

Learn about computer languages


Assembly language
Module 1
 General Overview Of Computer
COMPUTER SYSTEM
 HARDWARE SOFTWARE
 EXTERNAL INTERNAL APPlication SYSTEM

 Input output CPU word processing OS,


translators

utility,drivers
3,5 THE COMPARISON OF HARDWARE TO SOFTWARE
Hardware Software

Hardware is a tangible physical Software is a set of instruction or codes that


parts of computer system control the functions of a computer
Hardware devices are
Software are developed
manufactured
Hardware cannot function without
software. software needs hardware to operate
As Hardware are physical
electronic devices, we can see We can see and also use the software but can’t
and touch hardware. actually touch them.
Von Neumman architecture for
computer framework This adopts software models
computer viruses do not affect
hardware Computer viruses can corrupt codes

If hardware is damaged, it can be When software is damaged/corrupt, it can be


replaced with a new one recovered from backup or the windows

Examples include Keyboard,


Mouse,
Monitor, Printer, CPU, Hard disk, Examples include Ms Word, Excel, Power Point,
RAM, ROM etc. Photoshop, MySQL etc.
computer Language
COMPUTER LANGUAGES

computer language is a set of commands,
strings or characters readable by programmers
but easily translatable to machine code. It has
syntax, grammar, and semantics.
 Its of three cathegories:

i. Machine language or machine code


ii. Low level language- Assembly language
iii. High level language
Assembly Language
Example of machine-
language
Here’s what a program-fragment looks like:

10100001 10111100 10010011 00000100


00001000 00000011 00000101 11000000
10010011 00000100 00001000 10100011
11000000 10010100 00000100 00001000

It means: z = x + y;
DIFFERENT HIGH LEVEL LANGUAGES AND THEIR USES
S/N TYPE OF COMMENT
LANGUAGE
1. Android App Java, Kotlin, Dart
2 iOS App Swift, Objective-C
3. Desktop App C#, C++, Python, Java, PHP, JavaScript, GO

4. Operating System C or C++, GO

5. Data Storage Java, Python, C#, SQL, C++


6. Game Development C# or C++

7 Machine Learning and Clojure, Julia, Python, R, JavaScript, Swift


Analytics

8. Web App HTML/CSS + JavaScript + Java, PHP, Python, Ruby, Kotlin,


Typescript

9. Basic Website HTML/CSS + JavaScript


10. E- Commerce Website HTML/CSS + JavaScript + Java, PHP, Python, Ruby

11. Data Science Python, R, MATLAB


12. Deep Learning Swift

13. IOT Swift, C#


14. Backend Services C#, GO

15. Embedded C++, JavaScript


 Machine language
 Native to a processor: executed directly by hardware
 Instructions consist of binary code: 1s and 0s
 Assembly language
 A programming language that uses symbolic names to represent
operations, registers and memory locations.
 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
 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
 GNU assembler distributed by the free software foundation
PREREQUISITE TO ASSEMBLY
LANGUAGE
 NUMBER SYSTEM

 REGISTER ADDRESSING MODE

 ALGORITHM

 FLOWCHAT
ALGORITHM AND
FLOWCHAT
 ALGORITHM means a procedure or a technique used in planning and
solving a particular problems

 Xteristics are:

 Input
 Output
 Must be free from any ambiguity
 must have an end
 It is not dependent on any programming language
 Every step in an algorithm has its own logical sequence so it is easy to debug
How to write Algorithm
 Step 1 Define your algorithms input
 Step 2 Define the variables
 Step 3 Outline the algorithm's operations:
 Step 4 Output the results of your algorithm's operations:

 Flowchart:
 Unlike an algorithm, Flowchart uses different symbols to design a solution to a
problem. It is the graphical representation of sequence of steps to solve a problem.
Advantages of flowchart:

• Flowchart is an excellent way of communicating the logic of a program.


• Easy and efficient to analyze problem using flowchart.
• During program development cycle, the flowchart plays the role of a
blueprint, which makes program development process easier.
• After successful development of a program, it needs continuous timely
maintenance during the course of its operation. The flowchart makes
program or system maintenance easier.
 It is easy to convert the flowchart into any programming language code
Assembly Language
Format
{Label} {Mnemonic/opcode} {Operand}} {;
Comment}

. Labels

are used in assembly language, just as in HLLs, to mark
lines as the targets of GOTOs (jumps).
A mnemonic is an instruction name (e.g., mov, add, etc.).

Operands is the data or where the data is available


Comments can be specified in two ways: Single-
line comments, beginning with a semicolon
character (;). All characters following the semicolon
on the same line are ignored by the assembler
mnemonics
 In assembly language, mnemonics are used
to specify an opcode that represents a
complete and operational machine
language instruction. This is later translated
by the assembler to generate the object
code. For example, the mnemonic MOV is
used in assembly language for copying and
moving data between registers and memory
locations.
 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.
 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.
Assembly Language
Instructions
 Built from two pieces
Add R1, R3, 3

Opcode Operands
What to do Where to
with the data get data
(ALU and put the
operation) results
Types of Opcodes
 Arithmetic, logical
◦ add, sub, mult
◦ and, or
◦ Cmp
 Memory load/store
◦ ld, st
 Control transfer
◦ jmp
◦ bne
 Complex
◦ movs
Operands
 Each operand taken from a
particular addressing mode:
 Examples:

o Register: operands are specified in

registers only. Example:


mov CL, DL ; DL will get copied into
CL
o Immediate: specifies contact values

as operands . E.g
add r1, r7, #10 ; 10 will be moved to
r7 and the content of r7 will be copied
in r1
ASCII
 ASCII, American Standard Code for
Information Interchange, is a scheme used
for assigning numeric values to punctuation
marks, spaces, numbers and other
characters. ASCII uses 7 bits to represent
characters. The values 000 0000 through
111 1111 or 00 through 7F are used giving
ASCII the ability to represent 128 different
characters. An extended version of ASCII
assigns characters from 80 through FF.
CONVERT BLUE TO BINARY
LETTER DEC BINARY

B 66 1000010
 Accessibility to system hardware
 Assembly Language is useful for implementing system software
 Also useful for small embedded system applications
 Space and Time efficiency
 Understanding sources of program inefficiency
 Tuning program performance
 Writing compact code
 Writing assembly programs gives the computer designer the needed
deep understanding of the instruction set and how to design one
 To be able to write compilers for HLLs, we need to be expert with
the machine language. Assembly programming provides this
experience
Advantages of Assembly
Language
1. Shows how program interfaces with the
processor, operating system, and BIOS.
2. Shows how data is represented and
stored in memory and on external
devices.
3. Clarifies how processor accesses and
executes instructions and how
instructions access and process data.
4. Clarifies how a program accesses
external devices.
What is the application of assembly
Language?
 1. Assembly Language is used when speed and
reliability are the overriding factor like small
footprint real-time operating systems.
2. By using assembly language, programmers can
maximize on speed to a level. It is easy to write
than machine code programs.
3. It allows the programmer access to registers or
instructions that are not usually provided by a High-
level language.
4. The main Application of Assembly Language is for
direct hardware manipulation i.e. device drivers.
5. Assembly language also directly correlates which
machine instructions; the only way to get closer to
the machine is to write in binary or hex code.

You might also like