0% found this document useful (0 votes)
8 views24 pages

Microprocessor Class 18

This document outlines various arithmetic and branching instructions used in microprocessors, including addition, subtraction, multiplication, and division operations. It details the types of jumps, calls, and returns, explaining their functionalities and addressing modes. Additionally, it provides examples of how to use these instructions effectively in programming.

Uploaded by

sureshpv36
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views24 pages

Microprocessor Class 18

This document outlines various arithmetic and branching instructions used in microprocessors, including addition, subtraction, multiplication, and division operations. It details the types of jumps, calls, and returns, explaining their functionalities and addressing modes. Additionally, it provides examples of how to use these instructions effectively in programming.

Uploaded by

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

MICROPROCESSOR

PART 18

SIBIN K

Electrical Subject Matter Expert


Arithmetic instructions
● ADD A,R0 ; add contents of A and R0, store the result in A

● ADD A, 20H

● ADD A, @R0 ; add contents of A and memory whose address is given by register R2,

and store result in A

● ADD A, #20H
ADDC – Add with carry

If A holds 89H (10001001)and R0 holds 95H (10010101) with the carry flag set.

● ADDC A,R0 ; the result is 1FH in the accumulator with both the carry flag and the

overflow flag set to 1.

● ADDC A, 20H

● ADDC A, @R0

● ADDC A, #20H
● SUBB A, R3 ; subtracts the contents of R3 and carry together from A and store result

in A

● SUBB A, 20H

● SUBB A, @R2

● SUBB A, #20H
● MUL AB ; multiplies the unsigned 8-bit intigers in the accumulator and register B. the

low-order byte of the 16-bit product is left in the accumulator, and high- order byte in

B. if the product is greater than 255 (FFH) the overflow flag is set; otherwise it is

cleared.
● DIV AB ; it divides the unsigned 8bit intiger in the A by the unsigned 8bit intiger in

register B. the Accumulator receives the intiger part of the quotient; register B

receives the remainder.


● DA A ; decimal adjust Accumulator for addition

● Suppose A holds the value 55H, R3 contains 68H, carry flag is set to 1.

ADDC A, R3

DA A
● INC A ; The contents of A register is incremented by 1

● INC R2

● INC 20H

● INC @R2

● INC DPTR ;
● DEC A ; decrements the content of A by one

● DEC R3

● DEC 20H

● DEC @R2 ; Decrements the contents of memory location whose address is given by

register R2 by 1
Branching instructions
● Jumps
Jumps alter the program flow by replacing the PC contents with the address of the jump
address. There are 3 types of jump instructions. They are:-
● 1. Relative Jump ; jumps upto PC + 127 bytes, PC – 128 bytes away from the PC

● 2. Short Absolute Jump ; Jumps anywhere on a 2K- byte page

● 3. Long Absolute Jump ; anywhere in program memory of 64K


AJMP addr11 ; Absolute jump
AJMP transfers program execution to the absolute short address. The destination
therefor must be within the same 2K memory block of prgrm memory.
● 2byte instruction
LJMP addr16
● Jumps to absolute long address. The destination may therefor be anywhere in
the full 64K program memory address space.
● 3byte instruction
SJMP rel
● Jumps to relative address. The range of destinations allowed is from 128
bytes preceeding this instruction to 127 bytes following it.
● 2 byte instruction
JMP @A+ DPTR
● Add the 8bit unsigned contents of the accumulator with the 16bit data pointer,
and load the resulting sum to the program counter
NOP
● No operation, do nothing and go to next operation
JZ rel ; Jump if Accumulator is zero
● If all bits of the accumulator are zero, branch to the address indicated,
otherwise proceed with the next instruction

JNZ rel
● Jump if accumulator is not zero
● JC rel ; jump if carry is set

● JNC rel ; jump if carry is not set


● JB bit, rel ; If the indicated bit is 1, jump to the address indicated, otherwise
proceed with the next instruction
● JNB bit, rel ;
● JBC bit, rel ; if the indicated bit is one, clear the bit and branch to the address
indicated, otherwise proceed with the next instruction.
CJNE dest.byte , sourc.byte , rel
● Compare and jump if not equal
● It compares the magnitudes of the first two operands and branches if their
values are not equal.
DJNZ dest.byte , sourc.byte
● Decrement and jump if not zero
● DJNZ decrements the location indicated by one, and branches to the address
indicated by the second operand if the resulting value is not zero.
Call and Return
● Software calls may use short and long range addressing. Returns are to any
long range address in memory. Interrupts are calls forced by hardware action
and call subroutines located at predefined address in the prgrm memory
ACALL addr11 ;
● absolute call
● ACALL unconditionally calls a subroutine located at the absolute short
address.

LCALL addr16 ;
● Long call
● LCALL unconditionally calls a subroutine located at the absolute long address.
RET
● Return from sub routine
● Return to anywhere in the program at the address found on the top two bytes of the
stack

RETI
● Return from interrupt
● Return from a routine called by a hardware interrupt and reset the interrupt logic
Thank you 

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy