SlideShare a Scribd company logo
Microprocessor Based Systems
Spring 2015
Department of Electrical Engineering
University of Gujrat
 From Book: Chapter 4
 Assembly language syntax
 Name Field
 Operation Field
 Operand Field
 Comment Field
 Program Data
 Variables
Outline
IBM PC Assembly language 2
Assembly language Syntax
IBM PC Assembly language
 Assembly language programs are translated into machine language instructions by an
assembler, so they must be written to conform to the assembler’s specifications.
 In this course we will use the Microsoft Macro Assembler (MASM).
 Programs consist of statements, one per line
 Each statement is either an:
 Instruction, which the assembler translates into machine code.
 Assembler directive, which instructs the assembler to perform some specific task (ex. Allocating
memory space for a variable or creating a procedure).
3
Syntax (Cont.)
IBM PC Assembly language
 Both instructions and directives have up to four fields:
[name] operation [operand(s)] [comment]
 [Fields are optional]
 At least one blank or tab character must separate the fields
 The fields do not have to be aligned in a particular column, but they must appear in the
above order.
 An example of an instruction:
START: MOV CX,5 ; initialize counter
 An example of an assembler directive:
MAIN PROC
4
Name Field
IBM PC Assembly language
 The name field is used for:
 Instruction labels.
 Procedure names.
 Variable names Ex. Table look-up instruction XLAT (used for translation)
 The assembler translates names into memory addresses.
 Names:
 Can be from 1 to 31 characters long (not case sensitive).
 May consist of letters, digits, and the special characters
 ? . @ _ $ % (Thus, embedded blanks are not allowed).
 Names may not begin with a digit
 If a period is used it should be the first character
5
Name Field Examples
6
COUNTER1
2abc
@CHARACTER
A45. 28
TWO WORDS
STD_NUM
.TEST
Begins with a digit
. Not first character
Contains a blank
YOU&ME Contains an illegal character
Operation Field
IBM PC Assembly language
 For an instruction, the operation field contains a symbolic operation code (opcode)
 The assembler translates a symbolic opcode into a machine language opcode
 Opcode symbols often describe the operation’s function (ex. MOV, ADD, SUB)
7
Operation Field
IBM PC Assembly language
 In an assembler directive, the operation field contains a pseudo-operation code
(pseudo-op).
 Pseudo-ops are not translated into machine code, rather, they simply tell the assembler to
do something (ex. The PROC pseudo-op is used to create a procedure).
8
Operand Field
IBM PC Assembly language
 For an instruction, the operand field specifies the data that are needed to be acted on by
the operation.
 An instruction may have zero, one, or two operands
 Examples:
 NOP ; no operands... does nothing
 INC AX ; one operand... adds 1 to the contents of AX
 ADD WORD1,2 ; two operands... adds 2 to the contents of memory word WORD1
9
Destination operand
register or memory location
where the result is stored
(note:some instructions
don’t store the result)
Source operand
usually not modified
by the instruction
Comment Field
IBM PC Assembly language
 The comment field of a statement is used by the programmer to say something about what
the statement does
 A semicolon marks the beginning of this field, and the assembler ignores anything typed after
the semicolon.
 It is almost impossible to understand an assembly language program without comments.
 Good programming practice dictates a comment on almost every line.
10
Comment Field (Cont.)
IBM PC Assembly language
 Examples:
MOV CX, 0 ; move 0 to CX
MOV CX, 0 ; CX counts terms, initially 0
 Thus, comments are used to put the instruction into the context of the program
 It is permissible to make an entire line a comment, and to use them to create space in a
program.
11
Program Data
IBM PC Assembly language
 In an assembly language program we may express data as:
 Binary: bit string followed by ‘B’ or ‘b’
 Decimal: string of decimal digits followed by an optional ‘D’ or ‘d’
 Hex: begins with a decimal digit and ends with ‘H’ or ‘h’
 Characters & Character strings: enclosed in a single or double quotes or by there ASCII
codes.
 Any number may have an optional sign.
12
Program Data (Cont.)
IBM PC Assembly language
Number
Type
13
Number Type
11011 Decimal
1101B Binary
64223 Decimal
-21843D Decimal
1,234 illegal
1BADH Hex
1B4D Illegal
FFFFH Illegal
0FFFFH Hex
Variables
IBM PC Assembly language
 Variables play the same role in assembly language that they do in HLL
 Each variable has a data type and is assigned a memory address by the program
 The table below shows the assembler directives that are used to define the variables
14
Stands forPseudo-op
Define ByteDB
Define WordDW
Define Double WordDD
Define QuoteDQ
Define Ten bytesDT
Bytes of the Words
IBM PC Assembly language 15
 WORD1 DW 1234H
low byte
WORD1
high byte
WORD1+1
Variables – Byte & Word
IBM PC Assembly language
 Syntax:
name DB initial_value
 Example:
 ALPHA DB 4 a memory byte is associated with the name
ALPHA, and initialized to 4.
 BYT DB ? a memory byte is associated with the name
BYT, and uninitialized.
 WRD DW -2 a memory word is associated with the
name WRD, and initialized to -2.
 The decimal range is:
 Unsigned representation: 0 to 255
 Signed representation: -128 to 127
16
Variables - Arrays
IBM PC Assembly language
 an array is a sequence of memory bytes or words.
 Example:
B_ARRAY DB 10H,20H,30H
17
Symbol Address Contents
B_ARRAY 200H 10H
B_ARRAY+1 201H 20H
B_ARRAY+2 202H 30H
Variables – Array (words)
IBM PC Assembly language
 Example:
W_ARRAY DW 1000,40,29887,329
18
Symbol Address Contents
W_ARRAY 0300H 1000D
W_ARRAY+2 0302H 40D
W_ARRAY+4 0304H 29887D
W_ARRAY+6 0306H 329D
8
The DUP Operator
• It is possible to define arrays whose elements share a common initial
value by using the DUP (duplicate) operator.
• Syntax:
repeat_count DUP (value)
• Example:
DELTA DB 212 DUP (?) creates an array of 212
uninitialized bytes.
GAMMA DW 100 DUP (0) set up an array of 100
words, with each entry
initialized to 0.
Character String
IBM PC Assembly language
 Any array of ASCII codes can be initialized with a string of characters.
 Example:
 LETTERS DB 'ABC'
=
LETTERS DB 41H,42H,43H
 Inside a string, the assembler differentiates between upper and lowercase.
 It is possible to combine characters and numbers in one definition:
 Example: MSG DB 'HELLO',0AH,0DH, '$'
20
Byte Variables
name DB initial_value
ALPHA DB 4
BYT DB ?
• -128 to 127 for signed interpretation
• 0 to 255 for unsigned interpretation
21
Word Variables
name DW initial_value
WRD DW -2
• -32768 to 32767 for signed interpretation
• 0 to 65535 for unsigned interpretation
22
Arrays
• B_ARRAY DB 10H, 20H, 30H
Symbol Address Contents
B_ARRAY 0200h 10h
B_ARRAY+1 0201h 20h
B_ARRAY+2 0202h 30h
23
Character Strings
• LETTERS DB ‘ABC’
• LETTER DB 41H, 42H, 43H
• MSG DB ‘HELLO’, 0AH, 0DH, ‘$’
• MSG DB 48H, 45H, 4CH, 4CH, 4FH, 0AH, 0DH, 24H
24
EQU
• The EQU (equates) pseudo-op is used to assign a name
to a constant.
name EQU constant
• LF EQU 0AH
– MOV DL, 0AH
– MOV DL, LF
• PROMPT EQU ‘TYPE YOUR NAME’
– MSG DB ‘TYPE YOUR NAME’
– MSG DB PROMPT
No memory is allocated for EQU Names
25
Same Machine
Code
Few Basic Instructions
• Over a hundred Instructions for 8086
• Some specially designed instructions for
advanced processors
• We discuss six of most useful instructions
26
MOV
• The MOV instruction is used to transfer data
between registers, between a register and a
memory location, or to move a number
directly into a register or memory location.
• MOV destination, source
MOV AX, WORD1
MOV AX, BX
MOV AH, ‘A’
27
XCHG
• The XCHG operation is used to exchange the
contents of two registers, or a register, and a
memory location.
• XCHG destination, source
XCHG AH, BL
XCHG AX, WORD1
28
Legal Combinations of Operands for MOV and XCHG
Destination Operand
Source Operand General
Register
Segment
Register
Memory
Location Constant
General Register Yes Yes Yes No
Segment Register Yes No Yes No
Memory Location Yes Yes No No
Constant Yes No Yes No
29
Destination Operand
Source Operand General
Register
Memory
Location
General Register Yes Yes
Memory Location Yes No
Restrictions on MOV and XCHG
ILLEGAL: MOV WORD1, WORD2
MOV AX, WORD2
MOV WORD1, AX
30
ADD and SUB
• The ADD and SUB instructions are used to add or
subtract the contents of two registers, a register
and a memory location, or to add (subtract) a
number to (from) a register or memory location.
ADD destination, source
SUB destination, source
ADD WORD1, AX
SUB AX, DX
ADD BL, 5
31
Restrictions on ADD and SUB
ILLEGAL: ADD BYTE1, BYTE2
MOV AL, BYTE2 ; AX gets BYTE2
ADD BYTE1, AL ; add it to BYTE1
32
Legal Combinations of Operands for ADD and SUB
Destination Operand
Source Operand General
Register
Memory
Location
General Register Yes Yes
Memory Location Yes No
33
INC and DEC
• INC (increment) is used to add 1 to the
contents of a register or memory location and
DEC (decrement) subtracts 1 form a register or
memory location.
INC destination
DEC destination
INC WORD1
DEC BYTE1
34
NEG
• NEG is used to negate the contents of the
destination.
• NEG does this by replacing the contents by its
two’s complement.
NEG destination
NEG BX
35
Type Agreement of Operands
MOV AX, BYTE1 ; illegal
MOV AH, ‘A’
MOV AX, ‘A’ ; move 0041h into AX
36
Translation of high-Level Language to
Assembly Language
Statement Translation
B = A
MOV AX, A; move A into AX
MOV B, AX; and then into B
37
Translation of high-Level Language to
Assembly Language
Statement Translation
A = 5 – A
MOV AX, 5; put 5 in AX
SUB AX, A; AX contains 5 – A
MOV A, AX; put it in A
A = 5 – A
NEG A ; A = –A
ADD A, 5 ; A = 5 – A
38
Translation of high-Level Language to
Assembly Language
Statement Translation
A = B – 2 x A
MOV AX, B; AX has B
SUB AX, A; AX has B – A
SUB AX, A; AX has B – 2 x A
MOV A, AX; move result to A
39
• Assembly language program occupies code, data and
stack segment in memory
• Same organization reflected in assembly language
programs as well
• Code data and stack are structured as program segments
• Program segments are translated to memory segments
by assembler
40
Size of code and data, a program can have is determined by
specifying a memory model using .MODEL directive
.MODEL memory_model
Model Description
SMALL code in one segment
data in one segment
MEDIUM code in more than one segment
data in one segment
COMPACT code in one segment
data in more than one segment
LARGE code in more than one segment
data in more than one segment
no array larger than 64k bytes
HUGE code in more than one segment
data in more than one segment
arrays may be larger than 64k bytes 41
• A program’s data segment contains all the
variable definitions.
• Constant definitions are often made here as well,
but they may be placed elsewhere in the program
since no memory allocation is involved.
.data directive to declare a data segment
.DATA
WORD1 DW 2
WORD2 DW 5
MSG DB ‘THIS IS A MESSAGE’
MASK EQU 10010111B
42
• The purpose of the stack segment declaration
is to set aside a block of memory (the stack
area) to store the stack.
• The stack area should be big enough to
contain the stack at its maximum size.
.STACK 100H
• If size is omitted, by default 1kB is set aside
43
• The code segment contains a program’s
instructions.
.CODE name
• Inside a code segment, instructions are organized
as procedures.
name PROC
; body of the procedure
name ENDP
• The last line in the program should be the END
directive, followed by name of the main
procedure.
44
MAIN PROC
; instructions go here
MAIN ENDP
; other procedures go here
45
.MODEL SMALL
.STACK 100H
.DATA
; data definitions go here
.CODE
MAIN PROC
; instructions go here
MAIN ENDP
; other procedures go here
END MAIN
46
• CPU communicates with the peripherals
through IO ports
– IN and OUT instructions to access the ports
directly
• Used when fast IO is essential
• Seldom used as
– Port address varies among compluter models
– Easier to program IO with service routine
47
IO Service
routines
BIOS routines
Interact directly with
ports
Stored in ROM
DOS routine
Carry out more
complex tasks
e.g. printing a
character string
48
• I/O service routines
 The Basic Input/Output System (BIOS) routines
 The DOS routines
• The INT (interrupt) instruction is used to
invoke a DOS or BIOS routine.
• INT 16h
– invokes a BIOS routine that performs keyboard
input.
49
• INT 21h may be used to invoke a large number
of DOS functions.
• A particular function is requested by placing a
function number in the AH register and
invoking INT 21h.
50
Input:
AH = 1
Output:
AL = ASCII code if character key is pressed
= 0 if non-character key is pressed
51
MOV AH, 1 ; input key function
INT 21h ; ASCII code in AL
52
Input:
AH = 2
DL = ASCII code of the display character or
= control character
Output:
AL = ASCII code of the display character or
= control character
53
• MOV AH, 2 ; display character function
MOV DL, ‘?’ ; character is ‘?’
INT 21h ; display character
54
ASCII Code HEX Symbol Function
7 BEL beep
8 BS backspace
9 HT tab
A LF line feed (new line)
D CR carriage return (start of current
line)
55
• ECH.ASM will read a character from the
keyboard and display it at the beginning of the
next line.
• The data segment was omitted because no
variables were used.
• When a program terminates, it should return
control to DOS.
• This can be accomplished by executing INT
21h, function 4Ch.
56
TITLEECHO PROGRAM
.MODEL SMALL
.STACK 100H
.CODE
MAIN PROC
; display prompt
MOV AH, 2 ; display character function
MOV DL, '?' ; character is '?'
INT21H ; display it
; input a character
MOV AH, 1 ; read character function
INT 21H ; character in AL
MOV BL, AL ; save it in BL
57
; go to a new line
MOV AH, 2 ; display character function
MOV DL, 0DH ; carriage return
INT 21H ; execute carriage return
MOV DL, 0AH ; line feed
INT 21H ; execute line feed
; display character
MOV DL, BL ; retrieve character
INT 21H ; and display it
; return to DOS
MOV AH, 4CH ; DOS exit function
INT 21H ; exit to DOS
MAIN ENDP
END MAIN
58
59
• An editor is used to create the preceding
program.
• The .ASM is the conventional extension used
to identify an assembly language source file.
60
• The Microsoft Macro Assembler (MASM) is
used to translate the source file (.ASM file)
into a machine language object file (.OBJ file).
• MASM checks the source file for syntax errors.
• If it finds any, it will display the line number of
each error and a short description.
• C:>MASM File_Name;
61
• The Link program takes one or more object
files, fills in any missing addresses, and
combines the object files into a single
executable file (.EXE file)
• This file can be loaded into memory and run.
• C:>LINK File_Name;
62
• To run it, just type the run file name.
• C:>File_Name
63
Input:
DX = offset address of string.
= The string must end with a ‘$’ character.
64
• LEA is used to load effective address of a
character string.
• LEA destination, source
• MSG DB ‘HELLO!$’
LEA DX, MSG ; get message
MOV AH, 9 ; display string function
INT 21h ; display string
65
• When a program is loaded into memory, DOS
prefaces it 256 byte PSP which contains
information about the program
• DOS places segment no of PSP in DS and ES
before executing the program
• To correct this, a program containing a data
segment must start with these instructions;
MOV AX, @DATA
MOV DS, AX
66
Print String
Program
.MODEL SMALL
.STACK 100H
.DATA
MSG DB 'HELLO!$'
.CODE
MAIN PROC
; initialize DS
MOV AX, @DATA
MOV DS, AX ; intialize DS
; display message
LEA DX, MSG ; get message
MOV AH, 9 ; display string function
INT 21H ; display message
; return to DOS
MOV AH, 4CH
INT 21H ; DOS exit
MAIN ENDP
END MAIN 67
• CASE.ASM begins by prompting the user to
enter a lowercase letter, and on the next line
displays another message with the letter in
uppercase.
• The lowercase letters begin at 61h and the
uppercase letters start at 41h, so subtraction
of 20h from the contents of AL does the
conversion.
68
.MODEL SMALL
.STACK 100H
.DATA
CREQU0DH
LF EQU0AH
MSG1 DB 'ENTER A LOWER CASE LETTER: $'
MSG2 DB CR, LF, 'IN UPPER CASE IT IS: '
CHAR DB ?, '$'
.CODE
MAIN PROC
; intialize DS
MOV AX, @DATA ; get data segment
MOV DS, AX ; intialize DS
; print user prompt
LEA DX, MSG1 ; get first message
MOV AH, 9 ; display string function
INT 21H ; display first message
69
; input a character and convert to upper case
MOV AH, 1 ; read character function
INT 21H ; read a small letter into AL
SUB AL, 20H ; convert it to upper case
MOV CHAR, AL ; and store it
; display on the next line
LEA DX, MSG2 ; get second message
MOV AH, 9 ; display string function
INT 21H ; display message and upper case
letter in front
; DOS exit
MOV AH, 4CH
INT 21H ; DOS exit
MAIN ENDP
END MAIN
70
Ad

More Related Content

What's hot (20)

Organization of the ibm personal computers
Organization of the ibm personal computersOrganization of the ibm personal computers
Organization of the ibm personal computers
warda aziz
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
Tirumalesh Nizampatnam
 
Introduction to ibm pc assembly language
Introduction to ibm pc assembly languageIntroduction to ibm pc assembly language
Introduction to ibm pc assembly language
warda aziz
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 6 (Flow Control ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 6 (Flow Control ...Assembly Language Programming By Ytha Yu, Charles Marut Chap 6 (Flow Control ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 6 (Flow Control ...
Bilal Amjad
 
Representation of numbers and characters
Representation of numbers and charactersRepresentation of numbers and characters
Representation of numbers and characters
warda aziz
 
assembly language programming and organization of IBM PC" by YTHA YU
assembly language programming and organization of IBM PC" by YTHA YUassembly language programming and organization of IBM PC" by YTHA YU
assembly language programming and organization of IBM PC" by YTHA YU
Education
 
Assembly Langauge Chap 1
Assembly Langauge Chap 1Assembly Langauge Chap 1
Assembly Langauge Chap 1
warda aziz
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Bilal Amjad
 
8086 instruction set with types
8086 instruction set with types8086 instruction set with types
8086 instruction set with types
Ravinder Rautela
 
Assembly Language Lecture 4
Assembly Language Lecture 4Assembly Language Lecture 4
Assembly Language Lecture 4
Motaz Saad
 
Logic, shift and rotate instruction
Logic, shift and rotate instructionLogic, shift and rotate instruction
Logic, shift and rotate instruction
kashif Shafqat
 
Chapter 5The proessor status and the FLAGS registers
Chapter 5The proessor status and the FLAGS registersChapter 5The proessor status and the FLAGS registers
Chapter 5The proessor status and the FLAGS registers
warda aziz
 
8086 microprocessor-architecture
8086 microprocessor-architecture8086 microprocessor-architecture
8086 microprocessor-architecture
prasadpawaskar
 
Assembly 8086
Assembly 8086Assembly 8086
Assembly 8086
Mustafa Salah
 
Verilog Tutorial - Verilog HDL Tutorial with Examples
Verilog Tutorial - Verilog HDL Tutorial with ExamplesVerilog Tutorial - Verilog HDL Tutorial with Examples
Verilog Tutorial - Verilog HDL Tutorial with Examples
E2MATRIX
 
Flag Registers (Assembly Language)
Flag Registers (Assembly Language)Flag Registers (Assembly Language)
Flag Registers (Assembly Language)
Anwar Hasan Shuvo
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...
Bilal Amjad
 
Chap 8 The stack and introduction to procedures & Chapter 9 multiplication an...
Chap 8 The stack and introduction to procedures & Chapter 9 multiplication an...Chap 8 The stack and introduction to procedures & Chapter 9 multiplication an...
Chap 8 The stack and introduction to procedures & Chapter 9 multiplication an...
warda aziz
 
8086 Instruction set
8086 Instruction set8086 Instruction set
8086 Instruction set
karthiga selvaraju
 
8086 String Instructions.pdf
8086 String Instructions.pdf8086 String Instructions.pdf
8086 String Instructions.pdf
A. S. M. Badrudduza
 
Organization of the ibm personal computers
Organization of the ibm personal computersOrganization of the ibm personal computers
Organization of the ibm personal computers
warda aziz
 
Introduction to ibm pc assembly language
Introduction to ibm pc assembly languageIntroduction to ibm pc assembly language
Introduction to ibm pc assembly language
warda aziz
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 6 (Flow Control ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 6 (Flow Control ...Assembly Language Programming By Ytha Yu, Charles Marut Chap 6 (Flow Control ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 6 (Flow Control ...
Bilal Amjad
 
Representation of numbers and characters
Representation of numbers and charactersRepresentation of numbers and characters
Representation of numbers and characters
warda aziz
 
assembly language programming and organization of IBM PC" by YTHA YU
assembly language programming and organization of IBM PC" by YTHA YUassembly language programming and organization of IBM PC" by YTHA YU
assembly language programming and organization of IBM PC" by YTHA YU
Education
 
Assembly Langauge Chap 1
Assembly Langauge Chap 1Assembly Langauge Chap 1
Assembly Langauge Chap 1
warda aziz
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Bilal Amjad
 
8086 instruction set with types
8086 instruction set with types8086 instruction set with types
8086 instruction set with types
Ravinder Rautela
 
Assembly Language Lecture 4
Assembly Language Lecture 4Assembly Language Lecture 4
Assembly Language Lecture 4
Motaz Saad
 
Logic, shift and rotate instruction
Logic, shift and rotate instructionLogic, shift and rotate instruction
Logic, shift and rotate instruction
kashif Shafqat
 
Chapter 5The proessor status and the FLAGS registers
Chapter 5The proessor status and the FLAGS registersChapter 5The proessor status and the FLAGS registers
Chapter 5The proessor status and the FLAGS registers
warda aziz
 
8086 microprocessor-architecture
8086 microprocessor-architecture8086 microprocessor-architecture
8086 microprocessor-architecture
prasadpawaskar
 
Verilog Tutorial - Verilog HDL Tutorial with Examples
Verilog Tutorial - Verilog HDL Tutorial with ExamplesVerilog Tutorial - Verilog HDL Tutorial with Examples
Verilog Tutorial - Verilog HDL Tutorial with Examples
E2MATRIX
 
Flag Registers (Assembly Language)
Flag Registers (Assembly Language)Flag Registers (Assembly Language)
Flag Registers (Assembly Language)
Anwar Hasan Shuvo
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...
Bilal Amjad
 
Chap 8 The stack and introduction to procedures & Chapter 9 multiplication an...
Chap 8 The stack and introduction to procedures & Chapter 9 multiplication an...Chap 8 The stack and introduction to procedures & Chapter 9 multiplication an...
Chap 8 The stack and introduction to procedures & Chapter 9 multiplication an...
warda aziz
 

Viewers also liked (20)

Chapter 1
Chapter 1Chapter 1
Chapter 1
Ashhad Kamal
 
Assembly Language Lecture 1
Assembly Language Lecture 1Assembly Language Lecture 1
Assembly Language Lecture 1
Motaz Saad
 
Assembly Language Lecture 5
Assembly Language Lecture 5Assembly Language Lecture 5
Assembly Language Lecture 5
Motaz Saad
 
Assembly Language Basics
Assembly Language BasicsAssembly Language Basics
Assembly Language Basics
Education Front
 
Assembly Language Lecture 2
Assembly Language Lecture 2Assembly Language Lecture 2
Assembly Language Lecture 2
Motaz Saad
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 5 (The Processor...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 5 (The Processor...Assembly Language Programming By Ytha Yu, Charles Marut Chap 5 (The Processor...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 5 (The Processor...
Bilal Amjad
 
Assembly language part I
Assembly language part IAssembly language part I
Assembly language part I
Mohammed A. Imran
 
Processor Basics
Processor BasicsProcessor Basics
Processor Basics
Education Front
 
Chp6 assembly language programming for pic copy
Chp6 assembly language programming for pic   copyChp6 assembly language programming for pic   copy
Chp6 assembly language programming for pic copy
mkazree
 
Part I:Introduction to assembly language
Part I:Introduction to assembly languagePart I:Introduction to assembly language
Part I:Introduction to assembly language
Ahmed M. Abed
 
Assembly language programming_fundamentals 8086
Assembly language programming_fundamentals 8086Assembly language programming_fundamentals 8086
Assembly language programming_fundamentals 8086
Shehrevar Davierwala
 
Assembly Language Lecture 3
Assembly Language Lecture 3Assembly Language Lecture 3
Assembly Language Lecture 3
Motaz Saad
 
Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMINGChapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
Frankie Jones
 
Assembly language programming(unit 4)
Assembly language programming(unit 4)Assembly language programming(unit 4)
Assembly language programming(unit 4)
Ashim Saha
 
Assembly language 8086
Assembly language 8086Assembly language 8086
Assembly language 8086
John Cutajar
 
Compiladoresemulador
CompiladoresemuladorCompiladoresemulador
Compiladoresemulador
David Caicedo
 
assembly language programming organization of IBM PC chapter 9 part-2(decimal...
assembly language programming organization of IBM PC chapter 9 part-2(decimal...assembly language programming organization of IBM PC chapter 9 part-2(decimal...
assembly language programming organization of IBM PC chapter 9 part-2(decimal...
Bilal Amjad
 
assembly language programming organization of IBM PC chapter 9 part-1(MULTIPL...
assembly language programming organization of IBM PC chapter 9 part-1(MULTIPL...assembly language programming organization of IBM PC chapter 9 part-1(MULTIPL...
assembly language programming organization of IBM PC chapter 9 part-1(MULTIPL...
Bilal Amjad
 
System software
System softwareSystem software
System software
sumit singh
 
Lenguaje ensamblador EMU8086
Lenguaje ensamblador EMU8086Lenguaje ensamblador EMU8086
Lenguaje ensamblador EMU8086
Santy Bolo
 
Assembly Language Lecture 1
Assembly Language Lecture 1Assembly Language Lecture 1
Assembly Language Lecture 1
Motaz Saad
 
Assembly Language Lecture 5
Assembly Language Lecture 5Assembly Language Lecture 5
Assembly Language Lecture 5
Motaz Saad
 
Assembly Language Basics
Assembly Language BasicsAssembly Language Basics
Assembly Language Basics
Education Front
 
Assembly Language Lecture 2
Assembly Language Lecture 2Assembly Language Lecture 2
Assembly Language Lecture 2
Motaz Saad
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 5 (The Processor...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 5 (The Processor...Assembly Language Programming By Ytha Yu, Charles Marut Chap 5 (The Processor...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 5 (The Processor...
Bilal Amjad
 
Chp6 assembly language programming for pic copy
Chp6 assembly language programming for pic   copyChp6 assembly language programming for pic   copy
Chp6 assembly language programming for pic copy
mkazree
 
Part I:Introduction to assembly language
Part I:Introduction to assembly languagePart I:Introduction to assembly language
Part I:Introduction to assembly language
Ahmed M. Abed
 
Assembly language programming_fundamentals 8086
Assembly language programming_fundamentals 8086Assembly language programming_fundamentals 8086
Assembly language programming_fundamentals 8086
Shehrevar Davierwala
 
Assembly Language Lecture 3
Assembly Language Lecture 3Assembly Language Lecture 3
Assembly Language Lecture 3
Motaz Saad
 
Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMINGChapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
Frankie Jones
 
Assembly language programming(unit 4)
Assembly language programming(unit 4)Assembly language programming(unit 4)
Assembly language programming(unit 4)
Ashim Saha
 
Assembly language 8086
Assembly language 8086Assembly language 8086
Assembly language 8086
John Cutajar
 
Compiladoresemulador
CompiladoresemuladorCompiladoresemulador
Compiladoresemulador
David Caicedo
 
assembly language programming organization of IBM PC chapter 9 part-2(decimal...
assembly language programming organization of IBM PC chapter 9 part-2(decimal...assembly language programming organization of IBM PC chapter 9 part-2(decimal...
assembly language programming organization of IBM PC chapter 9 part-2(decimal...
Bilal Amjad
 
assembly language programming organization of IBM PC chapter 9 part-1(MULTIPL...
assembly language programming organization of IBM PC chapter 9 part-1(MULTIPL...assembly language programming organization of IBM PC chapter 9 part-1(MULTIPL...
assembly language programming organization of IBM PC chapter 9 part-1(MULTIPL...
Bilal Amjad
 
Lenguaje ensamblador EMU8086
Lenguaje ensamblador EMU8086Lenguaje ensamblador EMU8086
Lenguaje ensamblador EMU8086
Santy Bolo
 
Ad

Similar to Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction to IBM ec Assembly. Language) (20)

outline : basicc elements of assembly language
outline : basicc elements of assembly languageoutline : basicc elements of assembly language
outline : basicc elements of assembly language
rivadiab30663
 
Part III: Assembly Language
Part III: Assembly LanguagePart III: Assembly Language
Part III: Assembly Language
Ahmed M. Abed
 
Wk1to4
Wk1to4Wk1to4
Wk1to4
raymondmy08
 
Chapter 2 programming concepts - I
Chapter 2  programming concepts - IChapter 2  programming concepts - I
Chapter 2 programming concepts - I
SHREEHARI WADAWADAGI
 
12 mt06ped008
12 mt06ped008 12 mt06ped008
12 mt06ped008
vijaydeepakg
 
Introduction to Assembly Language & various basic things
Introduction to Assembly Language & various basic thingsIntroduction to Assembly Language & various basic things
Introduction to Assembly Language & various basic things
ishitasabrincse
 
Lec 04 intro assembly
Lec 04 intro assemblyLec 04 intro assembly
Lec 04 intro assembly
Abdul Khan
 
Alp 05
Alp 05Alp 05
Alp 05
Jaimon Jacob
 
Programming basic computer
Programming basic computerProgramming basic computer
Programming basic computer
Martial Kouadio
 
Assembly language part I
Assembly language part IAssembly language part I
Assembly language part I
n|u - The Open Security Community
 
EC8691-MPMC-PPT.pptx
EC8691-MPMC-PPT.pptxEC8691-MPMC-PPT.pptx
EC8691-MPMC-PPT.pptx
Manikandan813397
 
Arm Cortex material Arm Cortex material3222886.ppt
Arm Cortex material Arm Cortex material3222886.pptArm Cortex material Arm Cortex material3222886.ppt
Arm Cortex material Arm Cortex material3222886.ppt
Manju Badiger
 
Programming the basic computer
Programming the basic computerProgramming the basic computer
Programming the basic computer
Kamal Acharya
 
ISA.pptx
ISA.pptxISA.pptx
ISA.pptx
FarrukhMuneer2
 
Embedded system (Chapter 2) part 2
Embedded system (Chapter 2) part 2Embedded system (Chapter 2) part 2
Embedded system (Chapter 2) part 2
Ikhwan_Fakrudin
 
Chapter 3 programming concepts-ii
Chapter 3  programming concepts-iiChapter 3  programming concepts-ii
Chapter 3 programming concepts-ii
SHREEHARI WADAWADAGI
 
Bca 2nd sem-u-3.1-basic computer programming and micro programmed control
Bca 2nd sem-u-3.1-basic computer programming and micro programmed controlBca 2nd sem-u-3.1-basic computer programming and micro programmed control
Bca 2nd sem-u-3.1-basic computer programming and micro programmed control
Rai University
 
B.sc cs-ii-u-3.1-basic computer programming and micro programmed control
B.sc cs-ii-u-3.1-basic computer programming and micro programmed controlB.sc cs-ii-u-3.1-basic computer programming and micro programmed control
B.sc cs-ii-u-3.1-basic computer programming and micro programmed control
Rai University
 
Chapter 5 and 6 instructions and program control instructions.pdf
Chapter 5 and 6 instructions and program control instructions.pdfChapter 5 and 6 instructions and program control instructions.pdf
Chapter 5 and 6 instructions and program control instructions.pdf
Getnet Tigabie Askale -(GM)
 
Debug tutorial
Debug tutorialDebug tutorial
Debug tutorial
Defri N
 
outline : basicc elements of assembly language
outline : basicc elements of assembly languageoutline : basicc elements of assembly language
outline : basicc elements of assembly language
rivadiab30663
 
Part III: Assembly Language
Part III: Assembly LanguagePart III: Assembly Language
Part III: Assembly Language
Ahmed M. Abed
 
Chapter 2 programming concepts - I
Chapter 2  programming concepts - IChapter 2  programming concepts - I
Chapter 2 programming concepts - I
SHREEHARI WADAWADAGI
 
Introduction to Assembly Language & various basic things
Introduction to Assembly Language & various basic thingsIntroduction to Assembly Language & various basic things
Introduction to Assembly Language & various basic things
ishitasabrincse
 
Lec 04 intro assembly
Lec 04 intro assemblyLec 04 intro assembly
Lec 04 intro assembly
Abdul Khan
 
Programming basic computer
Programming basic computerProgramming basic computer
Programming basic computer
Martial Kouadio
 
Arm Cortex material Arm Cortex material3222886.ppt
Arm Cortex material Arm Cortex material3222886.pptArm Cortex material Arm Cortex material3222886.ppt
Arm Cortex material Arm Cortex material3222886.ppt
Manju Badiger
 
Programming the basic computer
Programming the basic computerProgramming the basic computer
Programming the basic computer
Kamal Acharya
 
Embedded system (Chapter 2) part 2
Embedded system (Chapter 2) part 2Embedded system (Chapter 2) part 2
Embedded system (Chapter 2) part 2
Ikhwan_Fakrudin
 
Bca 2nd sem-u-3.1-basic computer programming and micro programmed control
Bca 2nd sem-u-3.1-basic computer programming and micro programmed controlBca 2nd sem-u-3.1-basic computer programming and micro programmed control
Bca 2nd sem-u-3.1-basic computer programming and micro programmed control
Rai University
 
B.sc cs-ii-u-3.1-basic computer programming and micro programmed control
B.sc cs-ii-u-3.1-basic computer programming and micro programmed controlB.sc cs-ii-u-3.1-basic computer programming and micro programmed control
B.sc cs-ii-u-3.1-basic computer programming and micro programmed control
Rai University
 
Chapter 5 and 6 instructions and program control instructions.pdf
Chapter 5 and 6 instructions and program control instructions.pdfChapter 5 and 6 instructions and program control instructions.pdf
Chapter 5 and 6 instructions and program control instructions.pdf
Getnet Tigabie Askale -(GM)
 
Debug tutorial
Debug tutorialDebug tutorial
Debug tutorial
Defri N
 
Ad

More from Bilal Amjad (13)

IoT Based Smart Energy Meter using Raspberry Pi and Arduino
IoT Based Smart Energy Meter using Raspberry Pi and Arduino IoT Based Smart Energy Meter using Raspberry Pi and Arduino
IoT Based Smart Energy Meter using Raspberry Pi and Arduino
Bilal Amjad
 
Power Systems analysis with MATPOWER and Simscape Electrical (MATLAB/Simulink)
Power Systems analysis with MATPOWER and Simscape Electrical (MATLAB/Simulink) Power Systems analysis with MATPOWER and Simscape Electrical (MATLAB/Simulink)
Power Systems analysis with MATPOWER and Simscape Electrical (MATLAB/Simulink)
Bilal Amjad
 
Solar Radiation monthly prediction and forecasting using Machine Learning tec...
Solar Radiation monthly prediction and forecasting using Machine Learning tec...Solar Radiation monthly prediction and forecasting using Machine Learning tec...
Solar Radiation monthly prediction and forecasting using Machine Learning tec...
Bilal Amjad
 
Big Data in Smart Grid
Big Data in Smart GridBig Data in Smart Grid
Big Data in Smart Grid
Bilal Amjad
 
Flexibility of Power System (Sources of flexibility & flexibility markets)
Flexibility of Power System (Sources of flexibility & flexibility markets)Flexibility of Power System (Sources of flexibility & flexibility markets)
Flexibility of Power System (Sources of flexibility & flexibility markets)
Bilal Amjad
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 8 (The Stack and...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 8 (The Stack and...Assembly Language Programming By Ytha Yu, Charles Marut Chap 8 (The Stack and...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 8 (The Stack and...
Bilal Amjad
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 1(Microcomputer ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 1(Microcomputer ...Assembly Language Programming By Ytha Yu, Charles Marut Chap 1(Microcomputer ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 1(Microcomputer ...
Bilal Amjad
 
Binary and hex input/output (in 8086 assembuly langyage)
Binary and hex input/output (in 8086 assembuly langyage)Binary and hex input/output (in 8086 assembuly langyage)
Binary and hex input/output (in 8086 assembuly langyage)
Bilal Amjad
 
bubble sorting of an array in 8086 assembly language
bubble sorting of an array in 8086 assembly languagebubble sorting of an array in 8086 assembly language
bubble sorting of an array in 8086 assembly language
Bilal Amjad
 
Limit of complex number
Limit of complex numberLimit of complex number
Limit of complex number
Bilal Amjad
 
simple combinational lock
simple combinational locksimple combinational lock
simple combinational lock
Bilal Amjad
 
4-bit camparator
4-bit camparator4-bit camparator
4-bit camparator
Bilal Amjad
 
Orthogonal trajectories
Orthogonal trajectoriesOrthogonal trajectories
Orthogonal trajectories
Bilal Amjad
 
IoT Based Smart Energy Meter using Raspberry Pi and Arduino
IoT Based Smart Energy Meter using Raspberry Pi and Arduino IoT Based Smart Energy Meter using Raspberry Pi and Arduino
IoT Based Smart Energy Meter using Raspberry Pi and Arduino
Bilal Amjad
 
Power Systems analysis with MATPOWER and Simscape Electrical (MATLAB/Simulink)
Power Systems analysis with MATPOWER and Simscape Electrical (MATLAB/Simulink) Power Systems analysis with MATPOWER and Simscape Electrical (MATLAB/Simulink)
Power Systems analysis with MATPOWER and Simscape Electrical (MATLAB/Simulink)
Bilal Amjad
 
Solar Radiation monthly prediction and forecasting using Machine Learning tec...
Solar Radiation monthly prediction and forecasting using Machine Learning tec...Solar Radiation monthly prediction and forecasting using Machine Learning tec...
Solar Radiation monthly prediction and forecasting using Machine Learning tec...
Bilal Amjad
 
Big Data in Smart Grid
Big Data in Smart GridBig Data in Smart Grid
Big Data in Smart Grid
Bilal Amjad
 
Flexibility of Power System (Sources of flexibility & flexibility markets)
Flexibility of Power System (Sources of flexibility & flexibility markets)Flexibility of Power System (Sources of flexibility & flexibility markets)
Flexibility of Power System (Sources of flexibility & flexibility markets)
Bilal Amjad
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 8 (The Stack and...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 8 (The Stack and...Assembly Language Programming By Ytha Yu, Charles Marut Chap 8 (The Stack and...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 8 (The Stack and...
Bilal Amjad
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 1(Microcomputer ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 1(Microcomputer ...Assembly Language Programming By Ytha Yu, Charles Marut Chap 1(Microcomputer ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 1(Microcomputer ...
Bilal Amjad
 
Binary and hex input/output (in 8086 assembuly langyage)
Binary and hex input/output (in 8086 assembuly langyage)Binary and hex input/output (in 8086 assembuly langyage)
Binary and hex input/output (in 8086 assembuly langyage)
Bilal Amjad
 
bubble sorting of an array in 8086 assembly language
bubble sorting of an array in 8086 assembly languagebubble sorting of an array in 8086 assembly language
bubble sorting of an array in 8086 assembly language
Bilal Amjad
 
Limit of complex number
Limit of complex numberLimit of complex number
Limit of complex number
Bilal Amjad
 
simple combinational lock
simple combinational locksimple combinational lock
simple combinational lock
Bilal Amjad
 
4-bit camparator
4-bit camparator4-bit camparator
4-bit camparator
Bilal Amjad
 
Orthogonal trajectories
Orthogonal trajectoriesOrthogonal trajectories
Orthogonal trajectories
Bilal Amjad
 

Recently uploaded (20)

DSP and MV the Color image processing.ppt
DSP and MV the  Color image processing.pptDSP and MV the  Color image processing.ppt
DSP and MV the Color image processing.ppt
HafizAhamed8
 
five-year-soluhhhhhhhhhhhhhhhhhtions.pdf
five-year-soluhhhhhhhhhhhhhhhhhtions.pdffive-year-soluhhhhhhhhhhhhhhhhhtions.pdf
five-year-soluhhhhhhhhhhhhhhhhhtions.pdf
AdityaSharma944496
 
Main cotrol jdbjbdcnxbjbjzjjjcjicbjxbcjcxbjcxb
Main cotrol jdbjbdcnxbjbjzjjjcjicbjxbcjcxbjcxbMain cotrol jdbjbdcnxbjbjzjjjcjicbjxbcjcxbjcxb
Main cotrol jdbjbdcnxbjbjzjjjcjicbjxbcjcxbjcxb
SunilSingh610661
 
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITYADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ijscai
 
fluke dealers in bangalore..............
fluke dealers in bangalore..............fluke dealers in bangalore..............
fluke dealers in bangalore..............
Haresh Vaswani
 
The Gaussian Process Modeling Module in UQLab
The Gaussian Process Modeling Module in UQLabThe Gaussian Process Modeling Module in UQLab
The Gaussian Process Modeling Module in UQLab
Journal of Soft Computing in Civil Engineering
 
Development of MLR, ANN and ANFIS Models for Estimation of PCUs at Different ...
Development of MLR, ANN and ANFIS Models for Estimation of PCUs at Different ...Development of MLR, ANN and ANFIS Models for Estimation of PCUs at Different ...
Development of MLR, ANN and ANFIS Models for Estimation of PCUs at Different ...
Journal of Soft Computing in Civil Engineering
 
Data Structures_Searching and Sorting.pptx
Data Structures_Searching and Sorting.pptxData Structures_Searching and Sorting.pptx
Data Structures_Searching and Sorting.pptx
RushaliDeshmukh2
 
Machine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptxMachine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptx
rajeswari89780
 
new ppt artificial intelligence historyyy
new ppt artificial intelligence historyyynew ppt artificial intelligence historyyy
new ppt artificial intelligence historyyy
PianoPianist
 
Compiler Design Unit1 PPT Phases of Compiler.pptx
Compiler Design Unit1 PPT Phases of Compiler.pptxCompiler Design Unit1 PPT Phases of Compiler.pptx
Compiler Design Unit1 PPT Phases of Compiler.pptx
RushaliDeshmukh2
 
ELectronics Boards & Product Testing_Shiju.pdf
ELectronics Boards & Product Testing_Shiju.pdfELectronics Boards & Product Testing_Shiju.pdf
ELectronics Boards & Product Testing_Shiju.pdf
Shiju Jacob
 
DT REPORT by Tech titan GROUP to introduce the subject design Thinking
DT REPORT by Tech titan GROUP to introduce the subject design ThinkingDT REPORT by Tech titan GROUP to introduce the subject design Thinking
DT REPORT by Tech titan GROUP to introduce the subject design Thinking
DhruvChotaliya2
 
Introduction to Zoomlion Earthmoving.pptx
Introduction to Zoomlion Earthmoving.pptxIntroduction to Zoomlion Earthmoving.pptx
Introduction to Zoomlion Earthmoving.pptx
AS1920
 
Degree_of_Automation.pdf for Instrumentation and industrial specialist
Degree_of_Automation.pdf for  Instrumentation  and industrial specialistDegree_of_Automation.pdf for  Instrumentation  and industrial specialist
Degree_of_Automation.pdf for Instrumentation and industrial specialist
shreyabhosale19
 
Artificial Intelligence introduction.pptx
Artificial Intelligence introduction.pptxArtificial Intelligence introduction.pptx
Artificial Intelligence introduction.pptx
DrMarwaElsherif
 
lecture5.pptxJHKGJFHDGTFGYIUOIUIPIOIPUOHIYGUYFGIH
lecture5.pptxJHKGJFHDGTFGYIUOIUIPIOIPUOHIYGUYFGIHlecture5.pptxJHKGJFHDGTFGYIUOIUIPIOIPUOHIYGUYFGIH
lecture5.pptxJHKGJFHDGTFGYIUOIUIPIOIPUOHIYGUYFGIH
Abodahab
 
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptxExplainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
MahaveerVPandit
 
Artificial Intelligence (AI) basics.pptx
Artificial Intelligence (AI) basics.pptxArtificial Intelligence (AI) basics.pptx
Artificial Intelligence (AI) basics.pptx
aditichinar
 
Data Structures_Linear data structures Linked Lists.pptx
Data Structures_Linear data structures Linked Lists.pptxData Structures_Linear data structures Linked Lists.pptx
Data Structures_Linear data structures Linked Lists.pptx
RushaliDeshmukh2
 
DSP and MV the Color image processing.ppt
DSP and MV the  Color image processing.pptDSP and MV the  Color image processing.ppt
DSP and MV the Color image processing.ppt
HafizAhamed8
 
five-year-soluhhhhhhhhhhhhhhhhhtions.pdf
five-year-soluhhhhhhhhhhhhhhhhhtions.pdffive-year-soluhhhhhhhhhhhhhhhhhtions.pdf
five-year-soluhhhhhhhhhhhhhhhhhtions.pdf
AdityaSharma944496
 
Main cotrol jdbjbdcnxbjbjzjjjcjicbjxbcjcxbjcxb
Main cotrol jdbjbdcnxbjbjzjjjcjicbjxbcjcxbjcxbMain cotrol jdbjbdcnxbjbjzjjjcjicbjxbcjcxbjcxb
Main cotrol jdbjbdcnxbjbjzjjjcjicbjxbcjcxbjcxb
SunilSingh610661
 
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITYADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ijscai
 
fluke dealers in bangalore..............
fluke dealers in bangalore..............fluke dealers in bangalore..............
fluke dealers in bangalore..............
Haresh Vaswani
 
Data Structures_Searching and Sorting.pptx
Data Structures_Searching and Sorting.pptxData Structures_Searching and Sorting.pptx
Data Structures_Searching and Sorting.pptx
RushaliDeshmukh2
 
Machine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptxMachine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptx
rajeswari89780
 
new ppt artificial intelligence historyyy
new ppt artificial intelligence historyyynew ppt artificial intelligence historyyy
new ppt artificial intelligence historyyy
PianoPianist
 
Compiler Design Unit1 PPT Phases of Compiler.pptx
Compiler Design Unit1 PPT Phases of Compiler.pptxCompiler Design Unit1 PPT Phases of Compiler.pptx
Compiler Design Unit1 PPT Phases of Compiler.pptx
RushaliDeshmukh2
 
ELectronics Boards & Product Testing_Shiju.pdf
ELectronics Boards & Product Testing_Shiju.pdfELectronics Boards & Product Testing_Shiju.pdf
ELectronics Boards & Product Testing_Shiju.pdf
Shiju Jacob
 
DT REPORT by Tech titan GROUP to introduce the subject design Thinking
DT REPORT by Tech titan GROUP to introduce the subject design ThinkingDT REPORT by Tech titan GROUP to introduce the subject design Thinking
DT REPORT by Tech titan GROUP to introduce the subject design Thinking
DhruvChotaliya2
 
Introduction to Zoomlion Earthmoving.pptx
Introduction to Zoomlion Earthmoving.pptxIntroduction to Zoomlion Earthmoving.pptx
Introduction to Zoomlion Earthmoving.pptx
AS1920
 
Degree_of_Automation.pdf for Instrumentation and industrial specialist
Degree_of_Automation.pdf for  Instrumentation  and industrial specialistDegree_of_Automation.pdf for  Instrumentation  and industrial specialist
Degree_of_Automation.pdf for Instrumentation and industrial specialist
shreyabhosale19
 
Artificial Intelligence introduction.pptx
Artificial Intelligence introduction.pptxArtificial Intelligence introduction.pptx
Artificial Intelligence introduction.pptx
DrMarwaElsherif
 
lecture5.pptxJHKGJFHDGTFGYIUOIUIPIOIPUOHIYGUYFGIH
lecture5.pptxJHKGJFHDGTFGYIUOIUIPIOIPUOHIYGUYFGIHlecture5.pptxJHKGJFHDGTFGYIUOIUIPIOIPUOHIYGUYFGIH
lecture5.pptxJHKGJFHDGTFGYIUOIUIPIOIPUOHIYGUYFGIH
Abodahab
 
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptxExplainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
MahaveerVPandit
 
Artificial Intelligence (AI) basics.pptx
Artificial Intelligence (AI) basics.pptxArtificial Intelligence (AI) basics.pptx
Artificial Intelligence (AI) basics.pptx
aditichinar
 
Data Structures_Linear data structures Linked Lists.pptx
Data Structures_Linear data structures Linked Lists.pptxData Structures_Linear data structures Linked Lists.pptx
Data Structures_Linear data structures Linked Lists.pptx
RushaliDeshmukh2
 

Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction to IBM ec Assembly. Language)

  • 1. Microprocessor Based Systems Spring 2015 Department of Electrical Engineering University of Gujrat
  • 2.  From Book: Chapter 4  Assembly language syntax  Name Field  Operation Field  Operand Field  Comment Field  Program Data  Variables Outline IBM PC Assembly language 2
  • 3. Assembly language Syntax IBM PC Assembly language  Assembly language programs are translated into machine language instructions by an assembler, so they must be written to conform to the assembler’s specifications.  In this course we will use the Microsoft Macro Assembler (MASM).  Programs consist of statements, one per line  Each statement is either an:  Instruction, which the assembler translates into machine code.  Assembler directive, which instructs the assembler to perform some specific task (ex. Allocating memory space for a variable or creating a procedure). 3
  • 4. Syntax (Cont.) IBM PC Assembly language  Both instructions and directives have up to four fields: [name] operation [operand(s)] [comment]  [Fields are optional]  At least one blank or tab character must separate the fields  The fields do not have to be aligned in a particular column, but they must appear in the above order.  An example of an instruction: START: MOV CX,5 ; initialize counter  An example of an assembler directive: MAIN PROC 4
  • 5. Name Field IBM PC Assembly language  The name field is used for:  Instruction labels.  Procedure names.  Variable names Ex. Table look-up instruction XLAT (used for translation)  The assembler translates names into memory addresses.  Names:  Can be from 1 to 31 characters long (not case sensitive).  May consist of letters, digits, and the special characters  ? . @ _ $ % (Thus, embedded blanks are not allowed).  Names may not begin with a digit  If a period is used it should be the first character 5
  • 6. Name Field Examples 6 COUNTER1 2abc @CHARACTER A45. 28 TWO WORDS STD_NUM .TEST Begins with a digit . Not first character Contains a blank YOU&ME Contains an illegal character
  • 7. Operation Field IBM PC Assembly language  For an instruction, the operation field contains a symbolic operation code (opcode)  The assembler translates a symbolic opcode into a machine language opcode  Opcode symbols often describe the operation’s function (ex. MOV, ADD, SUB) 7
  • 8. Operation Field IBM PC Assembly language  In an assembler directive, the operation field contains a pseudo-operation code (pseudo-op).  Pseudo-ops are not translated into machine code, rather, they simply tell the assembler to do something (ex. The PROC pseudo-op is used to create a procedure). 8
  • 9. Operand Field IBM PC Assembly language  For an instruction, the operand field specifies the data that are needed to be acted on by the operation.  An instruction may have zero, one, or two operands  Examples:  NOP ; no operands... does nothing  INC AX ; one operand... adds 1 to the contents of AX  ADD WORD1,2 ; two operands... adds 2 to the contents of memory word WORD1 9 Destination operand register or memory location where the result is stored (note:some instructions don’t store the result) Source operand usually not modified by the instruction
  • 10. Comment Field IBM PC Assembly language  The comment field of a statement is used by the programmer to say something about what the statement does  A semicolon marks the beginning of this field, and the assembler ignores anything typed after the semicolon.  It is almost impossible to understand an assembly language program without comments.  Good programming practice dictates a comment on almost every line. 10
  • 11. Comment Field (Cont.) IBM PC Assembly language  Examples: MOV CX, 0 ; move 0 to CX MOV CX, 0 ; CX counts terms, initially 0  Thus, comments are used to put the instruction into the context of the program  It is permissible to make an entire line a comment, and to use them to create space in a program. 11
  • 12. Program Data IBM PC Assembly language  In an assembly language program we may express data as:  Binary: bit string followed by ‘B’ or ‘b’  Decimal: string of decimal digits followed by an optional ‘D’ or ‘d’  Hex: begins with a decimal digit and ends with ‘H’ or ‘h’  Characters & Character strings: enclosed in a single or double quotes or by there ASCII codes.  Any number may have an optional sign. 12
  • 13. Program Data (Cont.) IBM PC Assembly language Number Type 13 Number Type 11011 Decimal 1101B Binary 64223 Decimal -21843D Decimal 1,234 illegal 1BADH Hex 1B4D Illegal FFFFH Illegal 0FFFFH Hex
  • 14. Variables IBM PC Assembly language  Variables play the same role in assembly language that they do in HLL  Each variable has a data type and is assigned a memory address by the program  The table below shows the assembler directives that are used to define the variables 14 Stands forPseudo-op Define ByteDB Define WordDW Define Double WordDD Define QuoteDQ Define Ten bytesDT
  • 15. Bytes of the Words IBM PC Assembly language 15  WORD1 DW 1234H low byte WORD1 high byte WORD1+1
  • 16. Variables – Byte & Word IBM PC Assembly language  Syntax: name DB initial_value  Example:  ALPHA DB 4 a memory byte is associated with the name ALPHA, and initialized to 4.  BYT DB ? a memory byte is associated with the name BYT, and uninitialized.  WRD DW -2 a memory word is associated with the name WRD, and initialized to -2.  The decimal range is:  Unsigned representation: 0 to 255  Signed representation: -128 to 127 16
  • 17. Variables - Arrays IBM PC Assembly language  an array is a sequence of memory bytes or words.  Example: B_ARRAY DB 10H,20H,30H 17 Symbol Address Contents B_ARRAY 200H 10H B_ARRAY+1 201H 20H B_ARRAY+2 202H 30H
  • 18. Variables – Array (words) IBM PC Assembly language  Example: W_ARRAY DW 1000,40,29887,329 18 Symbol Address Contents W_ARRAY 0300H 1000D W_ARRAY+2 0302H 40D W_ARRAY+4 0304H 29887D W_ARRAY+6 0306H 329D
  • 19. 8 The DUP Operator • It is possible to define arrays whose elements share a common initial value by using the DUP (duplicate) operator. • Syntax: repeat_count DUP (value) • Example: DELTA DB 212 DUP (?) creates an array of 212 uninitialized bytes. GAMMA DW 100 DUP (0) set up an array of 100 words, with each entry initialized to 0.
  • 20. Character String IBM PC Assembly language  Any array of ASCII codes can be initialized with a string of characters.  Example:  LETTERS DB 'ABC' = LETTERS DB 41H,42H,43H  Inside a string, the assembler differentiates between upper and lowercase.  It is possible to combine characters and numbers in one definition:  Example: MSG DB 'HELLO',0AH,0DH, '$' 20
  • 21. Byte Variables name DB initial_value ALPHA DB 4 BYT DB ? • -128 to 127 for signed interpretation • 0 to 255 for unsigned interpretation 21
  • 22. Word Variables name DW initial_value WRD DW -2 • -32768 to 32767 for signed interpretation • 0 to 65535 for unsigned interpretation 22
  • 23. Arrays • B_ARRAY DB 10H, 20H, 30H Symbol Address Contents B_ARRAY 0200h 10h B_ARRAY+1 0201h 20h B_ARRAY+2 0202h 30h 23
  • 24. Character Strings • LETTERS DB ‘ABC’ • LETTER DB 41H, 42H, 43H • MSG DB ‘HELLO’, 0AH, 0DH, ‘$’ • MSG DB 48H, 45H, 4CH, 4CH, 4FH, 0AH, 0DH, 24H 24
  • 25. EQU • The EQU (equates) pseudo-op is used to assign a name to a constant. name EQU constant • LF EQU 0AH – MOV DL, 0AH – MOV DL, LF • PROMPT EQU ‘TYPE YOUR NAME’ – MSG DB ‘TYPE YOUR NAME’ – MSG DB PROMPT No memory is allocated for EQU Names 25 Same Machine Code
  • 26. Few Basic Instructions • Over a hundred Instructions for 8086 • Some specially designed instructions for advanced processors • We discuss six of most useful instructions 26
  • 27. MOV • The MOV instruction is used to transfer data between registers, between a register and a memory location, or to move a number directly into a register or memory location. • MOV destination, source MOV AX, WORD1 MOV AX, BX MOV AH, ‘A’ 27
  • 28. XCHG • The XCHG operation is used to exchange the contents of two registers, or a register, and a memory location. • XCHG destination, source XCHG AH, BL XCHG AX, WORD1 28
  • 29. Legal Combinations of Operands for MOV and XCHG Destination Operand Source Operand General Register Segment Register Memory Location Constant General Register Yes Yes Yes No Segment Register Yes No Yes No Memory Location Yes Yes No No Constant Yes No Yes No 29 Destination Operand Source Operand General Register Memory Location General Register Yes Yes Memory Location Yes No
  • 30. Restrictions on MOV and XCHG ILLEGAL: MOV WORD1, WORD2 MOV AX, WORD2 MOV WORD1, AX 30
  • 31. ADD and SUB • The ADD and SUB instructions are used to add or subtract the contents of two registers, a register and a memory location, or to add (subtract) a number to (from) a register or memory location. ADD destination, source SUB destination, source ADD WORD1, AX SUB AX, DX ADD BL, 5 31
  • 32. Restrictions on ADD and SUB ILLEGAL: ADD BYTE1, BYTE2 MOV AL, BYTE2 ; AX gets BYTE2 ADD BYTE1, AL ; add it to BYTE1 32
  • 33. Legal Combinations of Operands for ADD and SUB Destination Operand Source Operand General Register Memory Location General Register Yes Yes Memory Location Yes No 33
  • 34. INC and DEC • INC (increment) is used to add 1 to the contents of a register or memory location and DEC (decrement) subtracts 1 form a register or memory location. INC destination DEC destination INC WORD1 DEC BYTE1 34
  • 35. NEG • NEG is used to negate the contents of the destination. • NEG does this by replacing the contents by its two’s complement. NEG destination NEG BX 35
  • 36. Type Agreement of Operands MOV AX, BYTE1 ; illegal MOV AH, ‘A’ MOV AX, ‘A’ ; move 0041h into AX 36
  • 37. Translation of high-Level Language to Assembly Language Statement Translation B = A MOV AX, A; move A into AX MOV B, AX; and then into B 37
  • 38. Translation of high-Level Language to Assembly Language Statement Translation A = 5 – A MOV AX, 5; put 5 in AX SUB AX, A; AX contains 5 – A MOV A, AX; put it in A A = 5 – A NEG A ; A = –A ADD A, 5 ; A = 5 – A 38
  • 39. Translation of high-Level Language to Assembly Language Statement Translation A = B – 2 x A MOV AX, B; AX has B SUB AX, A; AX has B – A SUB AX, A; AX has B – 2 x A MOV A, AX; move result to A 39
  • 40. • Assembly language program occupies code, data and stack segment in memory • Same organization reflected in assembly language programs as well • Code data and stack are structured as program segments • Program segments are translated to memory segments by assembler 40
  • 41. Size of code and data, a program can have is determined by specifying a memory model using .MODEL directive .MODEL memory_model Model Description SMALL code in one segment data in one segment MEDIUM code in more than one segment data in one segment COMPACT code in one segment data in more than one segment LARGE code in more than one segment data in more than one segment no array larger than 64k bytes HUGE code in more than one segment data in more than one segment arrays may be larger than 64k bytes 41
  • 42. • A program’s data segment contains all the variable definitions. • Constant definitions are often made here as well, but they may be placed elsewhere in the program since no memory allocation is involved. .data directive to declare a data segment .DATA WORD1 DW 2 WORD2 DW 5 MSG DB ‘THIS IS A MESSAGE’ MASK EQU 10010111B 42
  • 43. • The purpose of the stack segment declaration is to set aside a block of memory (the stack area) to store the stack. • The stack area should be big enough to contain the stack at its maximum size. .STACK 100H • If size is omitted, by default 1kB is set aside 43
  • 44. • The code segment contains a program’s instructions. .CODE name • Inside a code segment, instructions are organized as procedures. name PROC ; body of the procedure name ENDP • The last line in the program should be the END directive, followed by name of the main procedure. 44
  • 45. MAIN PROC ; instructions go here MAIN ENDP ; other procedures go here 45
  • 46. .MODEL SMALL .STACK 100H .DATA ; data definitions go here .CODE MAIN PROC ; instructions go here MAIN ENDP ; other procedures go here END MAIN 46
  • 47. • CPU communicates with the peripherals through IO ports – IN and OUT instructions to access the ports directly • Used when fast IO is essential • Seldom used as – Port address varies among compluter models – Easier to program IO with service routine 47
  • 48. IO Service routines BIOS routines Interact directly with ports Stored in ROM DOS routine Carry out more complex tasks e.g. printing a character string 48
  • 49. • I/O service routines  The Basic Input/Output System (BIOS) routines  The DOS routines • The INT (interrupt) instruction is used to invoke a DOS or BIOS routine. • INT 16h – invokes a BIOS routine that performs keyboard input. 49
  • 50. • INT 21h may be used to invoke a large number of DOS functions. • A particular function is requested by placing a function number in the AH register and invoking INT 21h. 50
  • 51. Input: AH = 1 Output: AL = ASCII code if character key is pressed = 0 if non-character key is pressed 51
  • 52. MOV AH, 1 ; input key function INT 21h ; ASCII code in AL 52
  • 53. Input: AH = 2 DL = ASCII code of the display character or = control character Output: AL = ASCII code of the display character or = control character 53
  • 54. • MOV AH, 2 ; display character function MOV DL, ‘?’ ; character is ‘?’ INT 21h ; display character 54
  • 55. ASCII Code HEX Symbol Function 7 BEL beep 8 BS backspace 9 HT tab A LF line feed (new line) D CR carriage return (start of current line) 55
  • 56. • ECH.ASM will read a character from the keyboard and display it at the beginning of the next line. • The data segment was omitted because no variables were used. • When a program terminates, it should return control to DOS. • This can be accomplished by executing INT 21h, function 4Ch. 56
  • 57. TITLEECHO PROGRAM .MODEL SMALL .STACK 100H .CODE MAIN PROC ; display prompt MOV AH, 2 ; display character function MOV DL, '?' ; character is '?' INT21H ; display it ; input a character MOV AH, 1 ; read character function INT 21H ; character in AL MOV BL, AL ; save it in BL 57
  • 58. ; go to a new line MOV AH, 2 ; display character function MOV DL, 0DH ; carriage return INT 21H ; execute carriage return MOV DL, 0AH ; line feed INT 21H ; execute line feed ; display character MOV DL, BL ; retrieve character INT 21H ; and display it ; return to DOS MOV AH, 4CH ; DOS exit function INT 21H ; exit to DOS MAIN ENDP END MAIN 58
  • 59. 59
  • 60. • An editor is used to create the preceding program. • The .ASM is the conventional extension used to identify an assembly language source file. 60
  • 61. • The Microsoft Macro Assembler (MASM) is used to translate the source file (.ASM file) into a machine language object file (.OBJ file). • MASM checks the source file for syntax errors. • If it finds any, it will display the line number of each error and a short description. • C:>MASM File_Name; 61
  • 62. • The Link program takes one or more object files, fills in any missing addresses, and combines the object files into a single executable file (.EXE file) • This file can be loaded into memory and run. • C:>LINK File_Name; 62
  • 63. • To run it, just type the run file name. • C:>File_Name 63
  • 64. Input: DX = offset address of string. = The string must end with a ‘$’ character. 64
  • 65. • LEA is used to load effective address of a character string. • LEA destination, source • MSG DB ‘HELLO!$’ LEA DX, MSG ; get message MOV AH, 9 ; display string function INT 21h ; display string 65
  • 66. • When a program is loaded into memory, DOS prefaces it 256 byte PSP which contains information about the program • DOS places segment no of PSP in DS and ES before executing the program • To correct this, a program containing a data segment must start with these instructions; MOV AX, @DATA MOV DS, AX 66
  • 67. Print String Program .MODEL SMALL .STACK 100H .DATA MSG DB 'HELLO!$' .CODE MAIN PROC ; initialize DS MOV AX, @DATA MOV DS, AX ; intialize DS ; display message LEA DX, MSG ; get message MOV AH, 9 ; display string function INT 21H ; display message ; return to DOS MOV AH, 4CH INT 21H ; DOS exit MAIN ENDP END MAIN 67
  • 68. • CASE.ASM begins by prompting the user to enter a lowercase letter, and on the next line displays another message with the letter in uppercase. • The lowercase letters begin at 61h and the uppercase letters start at 41h, so subtraction of 20h from the contents of AL does the conversion. 68
  • 69. .MODEL SMALL .STACK 100H .DATA CREQU0DH LF EQU0AH MSG1 DB 'ENTER A LOWER CASE LETTER: $' MSG2 DB CR, LF, 'IN UPPER CASE IT IS: ' CHAR DB ?, '$' .CODE MAIN PROC ; intialize DS MOV AX, @DATA ; get data segment MOV DS, AX ; intialize DS ; print user prompt LEA DX, MSG1 ; get first message MOV AH, 9 ; display string function INT 21H ; display first message 69
  • 70. ; input a character and convert to upper case MOV AH, 1 ; read character function INT 21H ; read a small letter into AL SUB AL, 20H ; convert it to upper case MOV CHAR, AL ; and store it ; display on the next line LEA DX, MSG2 ; get second message MOV AH, 9 ; display string function INT 21H ; display message and upper case letter in front ; DOS exit MOV AH, 4CH INT 21H ; DOS exit MAIN ENDP END MAIN 70