This document summarizes various arithmetic, logic, and shift instructions in x86 assembly language.
It describes increment, decrement, negation, comparison, addition, subtraction, multiplication, division, and logic instructions. It provides syntax examples and explains how they affect flags and can be used for tasks like inputting and outputting decimal numbers.
Shift instructions like logical and arithmetic shifts are covered, along with how they can perform multiplication and division via left and right shifts. Rotate instructions are also introduced. Application examples show how instructions can be combined to perform operations like converting between ASCII and binary representations.
Introduction to ibm pc assembly languagewarda aziz
The Solution manual of COAL
Chapter NO 4. exercise
if anyone has Questions Regarding this exercise.
contact me on my given Email-ID.
i will guide you. Thank you!
CISC & RISC Architecture with contents
History Of CISC & RISC
Need Of CISC
CISC
CISC Characteristics
CISC Architecture
The Search for RISC
RISC Characteristics
Bus Architecture
Pipeline Architecture
Compiler Structure
Commercial Application
Reference
A microprocessor is an electronic component that is used by a computer to do its work. It is a central processing unit on a single integrated circuit chip containing millions of very small components including transistors, resistors, and diodes that work together. Some microprocessors in the 20th century required several chips. Microprocessors help to do everything from controlling elevators to searching the Web. Everything a computer does is described by instructions of computer programs, and microprocessors carry out these instructions many millions of times a second. [1]
Microprocessors were invented in the 1970s for use in embedded systems. The majority are still used that way, in such things as mobile phones, cars, military weapons, and home appliances. Some microprocessors are microcontrollers, so small and inexpensive that they are used to control very simple products like flashlights and greeting cards that play music when you open them. A few especially powerful microprocessors are used in personal computers.
Introduction to ibm pc assembly languagewarda aziz
The Solution manual of COAL
Chapter NO 4. exercise
if anyone has Questions Regarding this exercise.
contact me on my given Email-ID.
i will guide you. Thank you!
CISC & RISC Architecture with contents
History Of CISC & RISC
Need Of CISC
CISC
CISC Characteristics
CISC Architecture
The Search for RISC
RISC Characteristics
Bus Architecture
Pipeline Architecture
Compiler Structure
Commercial Application
Reference
A microprocessor is an electronic component that is used by a computer to do its work. It is a central processing unit on a single integrated circuit chip containing millions of very small components including transistors, resistors, and diodes that work together. Some microprocessors in the 20th century required several chips. Microprocessors help to do everything from controlling elevators to searching the Web. Everything a computer does is described by instructions of computer programs, and microprocessors carry out these instructions many millions of times a second. [1]
Microprocessors were invented in the 1970s for use in embedded systems. The majority are still used that way, in such things as mobile phones, cars, military weapons, and home appliances. Some microprocessors are microcontrollers, so small and inexpensive that they are used to control very simple products like flashlights and greeting cards that play music when you open them. A few especially powerful microprocessors are used in personal computers.
A microprocessor is an electronic component that is used by a computer to do its work. It is a central processing unit on a single integrated circuit chip containing millions of very small components including transistors, resistors, and diodes that work together. Some microprocessors in the 20th century required several chips. Microprocessors help to do everything from controlling elevators to searching the Web. Everything a computer does is described by instructions of computer programs, and microprocessors carry out these instructions many millions of times a second. [1]
Microprocessors were invented in the 1970s for use in embedded systems. The majority are still used that way, in such things as mobile phones, cars, military weapons, and home appliances. Some microprocessors are microcontrollers, so small and inexpensive that they are used to control very simple products like flashlights and greeting cards that play music when you open them. A few especially powerful microprocessors are used in personal computers.
A microprocessor is an electronic component that is used by a computer to do its work. It is a central processing unit on a single integrated circuit chip containing millions of very small components including transistors, resistors, and diodes that work together. Some microprocessors in the 20th century required several chips. Microprocessors help to do everything from controlling elevators to searching the Web. Everything a computer does is described by instructions of computer programs, and microprocessors carry out these instructions many millions of times a second. [1]
Microprocessors were invented in the 1970s for use in embedded systems. The majority are still used that way, in such things as mobile phones, cars, military weapons, and home appliances. Some microprocessors are microcontrollers, so small and inexpensive that they are used to control very simple products like flashlights and greeting cards that play music when you open them. A few especially powerful microprocessors are used in personal computers.
A microprocessor is an electronic component that is used by a computer to do its work. It is a central processing unit on a single integrated circuit chip containing millions of very small components including transistors, resistors, and diodes that work together. Some microprocessors in the 20th century required several chips. Microprocessors help to do everything from controlling elevators to searching the Web. Everything a computer does is described by instructions of computer programs, and microprocessors carry out these instructions many millions of times a second. [1]
Microprocessors were invented in the 1970s for use in embedded systems. The majority are still used that way, in such things as mobile phones, cars, military weapons, and home appliances. Some microprocessors are microcontrollers, so small and inexpensive that they are used to control very simple products like flashlights and greeting cards that play music when you open them. A few especially powerful microprocessors are used in personal computers.
A microprocessor is an electronic component that is used by a computer to do its work. It is a central processing unit on a single integrated circuit chip containing millions of very small components including transistors, resistors, and diodes that work together. Some microprocessors in the 20th century required several chips. Microprocessors help to do everything from controlling elevators to searching the Web. Everything a computer does is described by instructions of computer programs, and microprocessors carry out these instructions many millions of times a second. [1]
Microprocessors were invented in the 1970s for use in embedded systems. The majority are still used that way, in such things as mobile phones, cars, military weapons, and home appliances. Some microprocessors are microcontrollers, so small and inexpensive that they are used to control very simple products like flashlights and greeting cards that play music when you open them. A few especially powerful microprocessors are used in personal computers.
A microprocessor is an electronic component that is used by a computer to do its work. It is a central processing unit on a single integrated circuit chip containing millions of very small components including transistors, resistors, and diodes that work together. Some microprocessors in the 20th century required several chips. Microprocessors help to do everything from controlling elevators to searching the Web. Everything a computer does is described by instructions of computer programs, and microprocessors carry out these instructions many millions of times a second. [1]
Microprocessors were invented in the 1970s for use in embedded systems. The majority are still used that way, in such things as mobile phones, cars, military weapons, and home appliances. Some microprocessors are microcontrollers, so small and inexpensive that they are used to control very simple products like flashlights and greeting cards that play music when you open them. A few especially powerful microprocessors are used in personal computers.
Addressing mode and instruction set using 8051logesh waran
1. Immediate addressing mode:
In this type, the operand is specified in the instruction along with the opcode. In simple way, it means data is provided in instruction itself.
Ex: MOV A,#05H -> Where MOV stands for move, # represents immediate data. 05h is the data. It means the immediate date 05h provided in instruction is moved into A register.
2.Register addressing mode:
Here the operand in contained in the specific register of microcontroller. The user must provide the name of register from where the operand/data need to be fetched. The permitted registers are A, R7-R0 of each register bank. Ex: MOV A,R0-> content of R0 register is copied into Accumulator.
3. Direct addressing mode:
In this mode the direct address of memory location is provided in instruction to fetch the operand. Only internal RAM and SFR's address can be used in this type of instruction.
Ex: MOV A, 30H => Content of RAM address 30H is copied into Accumulator.
4. Register Indirect addressing mode:
Here the address of memory location is indirectly provided by a register. The '@' sign indicates that the register holds the address of memory location i.e. fetch the content of memory location whose address is provided in register.
Ex: MOV A,@R0 => Copy the content of memory location whose address is given in R0 register.
5. Indexed Addressing mode:
This addressing mode is basically used for accessing data from look up table. Here the address of memory is indexed i.e. added to form the actual address of memory.
Ex: MOVC A,@A+DPTR => here 'C' means Code. Here the content of A register is added with content of DPTR and the resultant is the address of memory location from where the data is copied to A register.
Acetabularia Information For Class 9 .docxvaibhavrinwa19
Acetabularia acetabulum is a single-celled green alga that in its vegetative state is morphologically differentiated into a basal rhizoid and an axially elongated stalk, which bears whorls of branching hairs. The single diploid nucleus resides in the rhizoid.
Introduction to AI for Nonprofits with Tapp NetworkTechSoup
Dive into the world of AI! Experts Jon Hill and Tareq Monaur will guide you through AI's role in enhancing nonprofit websites and basic marketing strategies, making it easy to understand and apply.
Honest Reviews of Tim Han LMA Course Program.pptxtimhan337
Personal development courses are widely available today, with each one promising life-changing outcomes. Tim Han’s Life Mastery Achievers (LMA) Course has drawn a lot of interest. In addition to offering my frank assessment of Success Insider’s LMA Course, this piece examines the course’s effects via a variety of Tim Han LMA course reviews and Success Insider comments.
Francesca Gottschalk - How can education support child empowerment.pptxEduSkills OECD
Francesca Gottschalk from the OECD’s Centre for Educational Research and Innovation presents at the Ask an Expert Webinar: How can education support child empowerment?
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdfTechSoup
In this webinar you will learn how your organization can access TechSoup's wide variety of product discount and donation programs. From hardware to software, we'll give you a tour of the tools available to help your nonprofit with productivity, collaboration, financial management, donor tracking, security, and more.
2024.06.01 Introducing a competency framework for languag learning materials ...Sandy Millin
http://sandymillin.wordpress.com/iateflwebinar2024
Published classroom materials form the basis of syllabuses, drive teacher professional development, and have a potentially huge influence on learners, teachers and education systems. All teachers also create their own materials, whether a few sentences on a blackboard, a highly-structured fully-realised online course, or anything in between. Despite this, the knowledge and skills needed to create effective language learning materials are rarely part of teacher training, and are mostly learnt by trial and error.
Knowledge and skills frameworks, generally called competency frameworks, for ELT teachers, trainers and managers have existed for a few years now. However, until I created one for my MA dissertation, there wasn’t one drawing together what we need to know and do to be able to effectively produce language learning materials.
This webinar will introduce you to my framework, highlighting the key competencies I identified from my research. It will also show how anybody involved in language teaching (any language, not just English!), teacher training, managing schools or developing language learning materials can benefit from using the framework.
2. INC & DEC Instructions
• Syntax:
– INC operand ; operand=operand+1
– DEC operand ; operand=operand-1
• Operand can be a general register or memory.
• INC and DEC instructions affect all the flags.
• Examples:
– INC AX legal
– DEC BL legal
– INC [BX] illegal
– INC Byte PTR [BX] legal
– DEC I legal
– INC DS illegal
3. NEG instruction
• Syntax: NEG operand
– Operand 0 – operand
• Finds the two’s complement of operand.
• Operand can be a general register or memory location.
• NEG instruction affects all flags.
• Examples:
– Let AX=FFF0h and I=08h
– NEG AX ; AX0010
– NEG AH ; AH01
– NEG I ; IF8
4. CMP instruction
• Syntax: CMP operand1, operand2
– Operand1-operand2
• Subtracts operand2 from operand1 and
updates the flags based on the result.
• CMP instruction affects all the flags.
yesnoyesMemory
Location
yesyesyesGeneral
Register
ConstantMemory
Location
General
Register
5. ADC and SBB instruction
• Syntax:
– ADC destination, source ; destination=destination+source+CF
– SBB destination, source ; destination=destination-source-CF
• Achieve double-precision addition/subtraction.
• To add or subtract 32-bit numbers
– Add or subtract lower 16 bits
– Add or subtract higher 16 bits with carry or borrow
• Example:
6. Multiplication
• Unsigned multiplication: MUL operand
• Signed multiplication: IMUL operand
• If operand is a Byte
– MUL operand; AX AL * operand
• If operand is a Word
– MUL operand; DX:AX AX * operand
• Operand can be a general register or memory.
Cannot be a constant.
• Only CF and OF are affected.
7. Multiplication – Cont.
• CF=OF=0
– Unsigned multiplication: if upper half of result is 0.
– Signed multiplication: if upper half of result is a sign
extension of lower half.
• Example: Let AX=FFFFh and BX=0002h
– MUL BL; AX01FEh (255 * 2 = 510) CF=OF=1
– IMUL BL; AXFFFEh (-1 * 2 = -2) CF=OF=0
– MUL AL; AXFE01 (255 * 255 = 65025) CF=OF=1
– IMUL AL; AX0001 (-1 * -1 = 1) CF=OF=0
– MUL BX; DX0001 AXFFFE CF=OF=1
– IMUL BX; DXFFFF AXFFFE CF=OF=0
8. Application: Inputting a Decimal
Number
• Inputting a 2-digit decimal number
MOV AH, 1 ;read first digit
INT 21H
SUB AL, ‘0’ ; convert digit from ASCII code to binary
MOV BL, 10
MUL BL ; multiply digit by 10
MOV CL, AL
MOV AH, 1 ; read 2nd digit
INT 21H
SUB AL, ‘0’ ; convert digit from ASCII code to binary
ADD AL, CL ; AL contains the 2-digit number
9. Division
• Unsigned division: DIV operand
• Signed division: IDIV operand
• If operand is a Byte
– DIV Operand ; AX AX/operand
– AH= Remainder, AL= Quotient
• If operand is a Word
– DIV Operand ; DX:AX DX:AX/operand
– DX=Remainder, AX= Quotient
• Operand can be a general register or memory. Cannot
be a constant.
• All flags are undefined.
10. Division - Cont.
• Divide Overflow
– If quotient is too big to fit in specified destination (AL or AX)
– Happens if divisor much smaller than dividend
– Program terminates and displays “Divide Overflow”
• Example: Let DX=0000h, AX=0005h, and BX=FFFEh
– DIV BX; AX=0000 DX=0005
– IDIV BX; AX=FFFE DX=0001
• Example: Let DX=FFFFh, AX=FFFBh, and BX=0002h
– IDIV BX; AX=FFFE DX=FFFF
– DIV BX; DIVIDE Overflow
• Example: Let AX=00FBh (251), and BL=FFh
– DIV BL; AH=FB AL=00
– IDIV BL; DIVIDE Overflow
11. Application: Outputting a Decimal
Number
• Outputting a 2-digit decimal number in AX
MOV BL, 10
DIV BL ; getting least significant digit
ADD AH, ‘0’ ; converting L.S. digit to ASCII
MOV DH, AH ; storing L.S. digit temporarily
MOV AH, 0
DIV BL ; getting most significant digit
ADD AH, ‘0’ ; converting M.S. digit into ASCII
MOV DL, AH ; displaying M.S. digit
MOV AH, 2
INT 21H
MOV DL, DH ; displaying least significant digit
INT21H
12. Logic Instructions
• The AND, OR, and XOR instructions perform
named bit-wise logical operation.
• Syntax:
– AND destination, source
– OR destination, source
– XOR destination, source
10101010
AND 11110000
---------------
10100000
10101010
OR 11110000
---------------
11111010
10101010
XOR 11110000
---------------
01011010
13. Logic Instructions - Cont.
• AND instruction used to clear specific destinations bits
while preserving others.
– A 0 mask bit clears corresponding destination bit
– A 1 mask bit preserves corresponding destination bit
• OR instruction used to set specific destinations bits
while preserving others.
– A 1 mask bit sets corresponding destination bit
– A 0 mask bit preserves corresponding destination bit
• XOR instruction used to complement specific
destinations bits while preserving others.
– A 1 mask bit complements corresponding destination bit
– A 0 mask bit preserves corresponding destination bit
14. Logic Instructions - Cont.
• Effect on flags
– SF, ZF, PF change based on result
– AF undefined
– CF=OF=0
• Examples:
– Converting ASCII digit to a number
– SUB AL, 30h
– AND AL, 0Fh
– Converting a lowercase letter to uppercase
– SUB AL, 20h
– AND AL, 0DFh
– Initializing register with 0
– XOR AL, AL
15. Logic Instructions - Cont.
• NOT instruction
– performs one’s complement operation on destination
– Syntax: NOT destination
– has no effect on flags.
• TEST instruction
– performs an AND operation of destination with source but
does not change destination
– it affects the flags like the AND instruction
– used to examine content of individual bits
• Example
– To test for even numbers
– TEST AL, 1; if ZF=1, number is even
17. Shift Instructions can be classified as:
• Logical shift
• Arithmetic shift
Four (4) types of Shift instructions direction:
• Shift logical left (SHL)
• Shift logical right (SHR)
• Shift arithmetic left (SAL)
• Shift arithmetic right (SAR)
• Syntax:
– Opcode destination, 1 ; for single-bit shift
– Opcode destination, CL ; for shift of N bits
• Logical shifts are used mostly to isolate bits in bytes or
words, while arithmetic shifts are used mostly to multiply
and divide binary numbers by powers of two.
18. Multiplication & Division by Shift
• Multiplication by left shift
– A left shift by 1 bit doubles the destination value,
i.e. multiplies it by 2.
• Division by right shift
– A right shift by 1 bit halves it and rounds down to
the nearest integer, i.e. divides it by 2.
19. Logical Shift (Right/Left)
• The SHR/SHL instruction
– Shifts to the right/left the destination operand by the
number of bits specified in the count operand. As the bits
are being shifted, zeros are shifted in on the left/right.
20.
21.
22.
23.
24.
25. Arithmetic Shift
• The SAR (Shift Arithmetic Right) instruction
shifts to the right the destination operand by
the number of bits specified in the count
operand. As the bits are being shifted, the
most significant bit is shifted in to the right,
preserving the sign bit.
29. QUIZ
• Determine the next value of AL after the execution.
1.
MOV AL, AAH
MOV CL,06H
SHL AL,CL
2.
MOV AL, 6BH
MOV CL, 06H
SHR AL,CL
Ans:
1. AL = 80H
2. AL = 01H
3. AL =1FH
3.
MOV AL,93H
MOV CL,03H
SHL AL,CL
SAR AL,CL
SHR AL,CL
30. ROTATE Instruction
• The different types of rotate instruction are:
– ROL: rotate left
– ROR: rotate right
– RCL: rotate left with carry
– RCR: rotate right with carry