सब्सक्राइब करे youtube चैनल

STAX Rp (only BC or DE) in 8085 in microprocessor STA Address (16b) instruction in 8085 ?

STA Address (16b)

Description – the contents of the accumulator are stored at the memory location specified.

Bytes/M-cycles/T-States 3/4/13

Hex code 32

Flags no flags are affected.

STAX Rp (only BC or DE)

Description – the contents of the accumulator are stored at the memory location pointed to by the register pair. The contents of the accumulator are not affected.

Bytes /M-Cycles /T-States 1/2/7

                               Register pair

Hex codes    02     BC

                      12      DE

Flags no flags are affected.

STC

Description the  carry flag CY is set to 1.

Bytes /M-Cycles/T-States 1/1/4

Hex Code 37

Flags only the CY flag is affected.

SUB R

Description the contents of the register are subtracted from the accumulator and the result is stored in the accumulator.

Bytes/M-Cycles/T-States 1/1/4

                          Register

Hex codes      97    A

                        90     B

                        91     C

                      92         D

                       93         F

                       94          H

                        95          L

Flags all flags are affected by the result of the operation.

SUB   M

Description the contents of the memory location pointed to by HL are subtracted from the accumulator and the result is stored in the accumulator.

Bytes/M-Cycles/T-States 1/2/7

Hex code 96

Flags all flags are affected by the result of the operation.

SUI data (8b)

Description the 8-bit data is subtracted from the contents of the accumulator. The result is stored in the accumulator.

Bytes /M-Cycles/T-States 2/2/7

Hex code D6

Flags all flags are affected by the result of the operation.

XCHG

Description the contents of register H and register D are exchanged, and the contents of register L and register E are exchanged.

Bytes/M-Cycles/T-States 1/1/4

Hex code EB

Flags no flags are affected.

XRA R

Description the contents of the register are exclusive-ORed with the contents of the accumulator. The results are then stored in the accumulator.

Bytes/M-Cycles/T-States 1/1/4    

                                    Register

Hex codes      AF         A

                        A8          B

                        A9          C

                         AA         D

                         AB        E

                          AC       H

                          AD        L

Flags Z, S, and  P are affected based upon the operation. CY and AC are reset.

XRA M

Description the contents of the memory location pointed to by HL are Exclusive-ORed with the contents of the accumulator. The results are stored in the accumulator.

Bytes/M-Cycles/T-States 1/2/7

Hex code  AE

Flags Z, S and P are affected based upon the operation. CY and AC are reset.

XRI Data (8b)

Description the 8 bits of data are exclusive-ORed with the contents of the accumulator. The results are then stored in the accumulator.

Bytes/M-Cycles/T-States 2/2/7

Hex code EE

Flags Z, S and P are affected based upon the operation CY and AC are reset.

XTHL

Description the contents of the L register are exchanged with the stack location pointed to by the stack pointer. The contents of the H register are exchanged with the stack location pointed to by the stack pointer + 1. The stack pointer remains unchanged.

Bytes/M-Cycles/T-States 1/5/16

Hex code E3

Flags no flags are affected.

  1. Interrupts in 8085

Interrupts          type             instructions            hardware               trigger                  vector

TRAP      non-maskable   independent of EI        no external       level and edge      0024H

                                              And DI                          hardware              sensitive

RST 7.5       maskable       controlled by EI and DI    no external      edge-sensitive   003CH

                                                                                        Hardware           

RST 6.5      maskable       controlled by EI and DI     no external      level sensitive    0034H

                                                                                         Hardware

RST 5.5     maskable      controlled by EI and DI        no external      level sensitive    002CH

                                                                                            Hardware

INTR 8085    maskable     controlled by EI and DI     RST code from     level sensitive 038H

                                                                                       External hardware                          |

                                                                                                                                             0000H

Instruction Summary

Data Transfer Instructions

MOV – Copy from source to destination

MVI –  move immediate 8-bit

LDA –  Load accumulator

LDAX –  Load accumulator indirect

LXI  – Load register pair immediate

LHLD – Load H and L registers direct

STA –  Store accumulator direct

STAX  – Store accumulator indirect

XCHG –  Exchange H and L with D and E

SPHL – Copy H and L registers to the stack pointer

XTHL – Exchange H and L with top of stack

PUSH – Push register pair onto stack

POP – Pop of stack of register pair

OUT – output data from accumulator to a port with 8-bit address

IN – Input data to accumulator from a port with 8-bit address

Arithmetic Instructions

ADD – Add register or memory to accumulator

ADC – Add register to accumulator with carry

ADI – Add immediate to accumulator

ACI – Add immediate to accumulator with carry

DAD – Add register pair to H and L registers

SUB – Subtract register or memory from accumulator

SBB – Subtract source and borrow from accumulator

SUI – Subtract immediate from accumulator

SBI – Subtract immediate from accumulator with borrow

INR – Increment register of memory by 1

INX – Increment register pair by 1

DCR – Decrement register or memory by 1

DCX – Decrement register pair by 1

DAA – Decimal adjust accumulator

Control   Instructions

NOP – No operation

HLT – Halt

DI – Disable interrupts

EI – Enable interrupts

RIM – Read interrupt mask

SIM – Set interrupt mask

Branching    Instructions

JMP – Jump unconditionally

JC – Jump on carry

JNC – Jump on no carry

JP – Jump on positive

JM – Jump on minus

JZ – Jump on zero

JNZ Jump on no zero

JPE – Jump on parity even

JPO –  Jump on parity odd

CALL – Call unconditionally

CC – Call on carry

CNC – Call on no carry

CP – Call on positive

CM – Call on minus

CZ – Call on zero

CNZ – Call on no zero

CPE – Call on parity even

CPO – Call on parity odd

RET – Return unconditionally

RC – Return on carry

RNC – Return on no carry

RP – Return on positive

RM – Return on minus

RZ – Return on zero

RNZ – Return on no zero

RPE – Return on parity even

RPO – Return on parity even

RPO – Return on parity odd

PCHL – Load program counter with HL contents

RST – Restart

Logical  Instructions

CMP – Compare register or memory with accumulator

CPI – Compare immediate with accumulator

ANA – Logical AND register or memory with accumulator

ANI – Logical AND immediate with accumulator

XRA – Exclusive – OR register or memory with accumulator

ORI – Logical OR immediate with accumulator

RLC – Rotate accumulator left

RRC – Rotate accumulator right

RAL – Rotate accumulator left through carry

RAR – Rotate accumulator right through carry

CMA – Complement accumulator

CC – Complement carry

STC – Set carry

  1. 8085 Microprocessor programs

Addition of two 8-bit number program

MVI – C,00 Initialize C register to 00

LDA – 4150 Load the value to accumulator

MOV B,A – Move the content of accumulator to B register

LDA – 4151 Load the value to accumulator

ADD – B – Add the value of register B to A

JNC –LOOP Jump on no carry

INR – C Increment value of register C

LOOP: STA – 4152 – Store the value of accumulator (sum).

MOV – A,C – Move content of register C to accumulator

STA – 4153 Store the value of accumulator (carry)

HLT – Halt the program

Observation

Input :  80 (4150)

80 (4251)

Output :  00 (4152)

01 (4153)

Subtraction of two 8-bit numbers program

MVI – C,00 Initialize C to 00

LDA – 4150 Load the value to accumulater

MOV – B,A Move the content of accumulator to B register

LDA – 4151 Load the value to accumulator

SUB – B

JNC  – LOOP Jump on no carry

CMA  – Complement accumulator contents

INR – A Increment value in accumulator

INR – C Increment value in register C

LOOP: STA – 4152 Store the value of A register to memory address

MOV – A,C Move contents of register C to accumulator

STA – 4153 Store the value of accumulator memory address

HLT – Terminate the program

Observation

Input :         06 (4150)

02 (4251)

Output:        04 (4152)

01 (4143)

Multiplication of two 8-bit numbers

Program

MVI – D,00 Initialize register D to 00

MVI – A, 00 Initialize accumulator content to 00

LXI , 4150

MOV – B,M Get the first number in B register

INX – H

MOV – C,M Get the second number in C register

LOOP : ADD – B  add content of A register to register B

JNC – NEXT – Jump on no carry to next

INR – D Increment content of register D

NEXT : DCR  C decrement content of register C

JNZ – LOOP jump on no zero to address

STA – 4152 – Store the result in memory

MOV – A,D

STA – 4153 store the MSB of result in memory

HLT – Terminate the program

Observation

Input : FF (4150)

FF (4151)

Output :  01 (4152)

FE (4153)

Division of two 8 bit numbers

Program

LXI – H, 4150

MOV – B,M get the dividend in B register

MVI – C,00 Clear C register for quotient

INX – H

MOV – A,M gat the divisor in A register

NEXT: CMP – B compare A register with register B

JC – LOOP jump on carry to loop

SUB – B subtract A register from B register C

JMP – NEXT – jump to next

LOOP : STA – 4152 store the remainder in memory

MOV – A,C

STA – 4153

HLT – Terminate the program

Observation

Input : FF (4150)

FF (4251)

Output : 01 (4152)          (Remainder)

FE  (4153)        (quotient)

Largest  Number in an Array of Data

Program

LXI – H, 4200 set pointer for array

MOV – B,M  load the count

INX – H

MOV – A,M  set 1 st element as largest data

DCR – B  decrement the count

LOOP:  INX – H

CMP –  M if A register > M, go to ahead

JNC – AHEAD

MOV – A,M  set the new value as largest

AHEAD : DCR – B

JNZ – LOOP repeat comparisons till count = 0

STA – 4300 store the largest value at 4300

Observation

Input :   05 (4200)

0A (4201)

F1 (4202)

1F (4203)

26 (4204)

FE (4205)

Output : FE (4300)

Smallest  Number in an Array of Data

Program

LXI H, – 4200 set pointer for array

MOV – B,M  load the count

INX – H

MOV – A,M set 1st element as largest data

DCR – B decrement the count

LOOP : INX  – H

CMP  – M if A register < M, go to ahead

JC – AHEAD

MOV – A,M set the new value as smallest

AHEAD : DCR – B

JNZ – LOOP  repeat comparisons till count = 0

STA – 4300  store the largest value at 4300

HLT

Observation

Input : 05 (4200)

0A (4201)

F1 (4202)

1F (4203)

26 (4204)

FE (4205)

Output : 0A (4300)

Arrange an Array of Data in Ascending Order

Program

LXI  – H,4200

MOV – C,M

DCR  – C

REPEA : MOV – D,C

LXI – H,4201

LOOP : MOV – A,M

INX  – H

CMP – M

JC – SKIP

MOV – B,M

MOV – M,A

DCX  – H

MOV – M,B

INX – H

SKIP :     DCR – D

JNZ – LOOP

DCR – C

JNZ – REPEAT

HLT

Observation

Input : 4200         05

4201         05

4202         04

4203        03

4204        02

4205         01

Output : 4200          05

4201         01

4202         02

4203          03

4204           04

4205           05

Arrange an Array of data in Descending Order

Program

LXI    – H, 4200

MOV   – C,M

DCR   –   C

REPEAT :          MOV – D,C

LXI     –  H,4201

LOOP :           MOV – A,M

INX  – H

CMP  – M

JNC – SKIP

MOV – B,M

MOV – M,A

DCX – H

MOV – M,B

INX – H

SKIP :                   DCR – D

JNZ – LOOP

DCR – C

JNZ – REPEAT

HLT

Observation

input :      4200       05              (array size)

4201       01

4202            02

4203            03

4204            04

4205            05

4201              05

4202             04

4203              03

4204             02

4205             01

BCD to Hex Conversion

Program

LXI        H,4150

MOV       A,M     Initialize memory pointer

ADD         A        MSD X2

MOV         B,A      Store MSD X2

ADD           A        MSD X4

ADD           A        MSD X8

ADD           B        MSD X 10

INX             H       Point to LSD

ADD            M      Add to form hex

INX              H

MOV           M,A    Store the result

HLT

Observation

Input :   4150  : 02

4151   : 09           (MSD)

Output : 4152  : 1D H    (LSD)

Hex to BCD Conversion

Program

LXI     H,4`150    Initialize memory pointer

MVI     D, 00        Clear D register for most significant byte

XRA        A         Clear accumulator

MOV     C,M       Get hex data

LOOP2:    ADI   01       Count the number one by one

DAA                 Adjust for BCD count

JNC     LOOPI

INR     D

LOOP1:  DCR  C

JNZ  LOOP2

STA   4151   store the least significant byte

MOV  A,D

STA  4152  Store the most significant byte

HLT

Observation

Input :   4150  : FF

Output : 4151  : 55 (LSB)

4152  : 02 (MSB)

Hex to ASCII Conversion

Program

LDA       4200    Get hexa data

MOV       B,A

ANI         OF   Mask upper nibble

CALL       SUBI  Get ASCII code for upper nibble

STA        4201

MOV       A,B

ANI        F0   Mask lower nibble

RLC

RLC

RLC

RLC

CALL     SUBI Get ASCII code for lower nibble

STA       4202

HLT

SUBI : CPI    0A

JC    SKIP

ADI     07

SKIP : ADI     30

RET

Observation

Input :   4200    E4 (Hexa data)

Output : 4201    34 (ASCII code for 4)

4202     45 (ASCII code for E)

ASCII to hex Conversion

Program

LDA         4500

SUI         30

CPI         OA

JC          07

SKIP : STA     4501

HLT

Observation

Input :   4500     31

Output : 4501     0B