Microprocessor Programming: by Prof. Y. P. Jadhav. Physics Dept. Smt. C.H.M. College, Ulhasnagar-3
Microprocessor Programming: by Prof. Y. P. Jadhav. Physics Dept. Smt. C.H.M. College, Ulhasnagar-3
YPJ
Copies from register toflags. memory and vice Loads the given data into register Do notdata affect Condition Copies data from register to register versa.
YPJ
Instructions
1 2
Task performed Move 8-bit immediate data to register r. Move 8-bit immediate data to memory whose address is in the HL register (Memory pointer).
MOV rd, rs
MOV M, rs
Move 8-bit data from source register (rs) to destination register (rd).
Move 8-bit data from source register (rs) to memory whose address is in the memory pointer.
MOV rd, M
LXI rp, data (16bit) STA addr LDA addr SHLD addr
Move 8-bit data from memory whose address is in the memory pointer to destination register (rd).
Load 16-bit immediate data in the specified register pair Store the content of register A at the address given in the instruction. Load data into register A directly from the address given in the instruction. Store the content of HL register in to memory (addr) (L) & (addr + 1) (H)
YPJ
6 7
10
LHLD addr
Load the content of memory into HL register (L) (addr) & (H) (addr + 1). Store the content of the register A into the memory whose location is specified by BC or DE register pair Load the content of the memory, whose location is specified by BC or DE register pair, into register A Exchange the content of HL and DE register pair
11
STAX rp
12
LDAX rp
13
XCHG
YPJ
Example:
MOV C,B. Move the content of register B to C. Initially B=10H. After execution B=10H.
C=20H. C=10H. Flags Affected :No flags affected. Addressing mode: Register.
Instructions - to add and subtract, - increment orare decrement data execution in Arithmetic Flag conditions change after of from this group. register, register pair or memory and Instructions instruction - to adjust 8-bit data for BCD arithmetic are in this group.
YPJ
Instructions
Task performed
Add register (r) to Accumulator Add data in memory to Accumulator Add immediate 8-bit data to Accumulator Add register (r) with carry to Accumulator Add data in memory to Accumulator with carry. Add immediate 8-bit data to Accumulator with carry Add (rp) to (HL) and store the result in HL pair Adjusts Accumulator to packed BCD after adding two BCD numbers. Subtract register (r) from Accumulator Subtract data in memory from Accumulator Subtract immediate 8-bit data from Accumulator Subtract register (r) with borrow from Accumulator Subtract data in memory from Accumulator with borrow. Subtract immediate 8-bit data to Accumulator with carry Increment the content of specified register Increment the content of specified memory Increment the content of specified register pair Decrement the content of specified register Decrement the content of specified memory Decrement the content of specified register pair
Addition
ADD r ADD M ADI 8-bit data ADC r ADC M ACI 8-bit data DAD rp DAA
Subtraction
SUB r SUB M SUI 8-bit data SBB r SBB M SBI 8-bit data
YPJ
Logic Instructions
This group instructions perform logic operations such as AND, OR and XOR Compare data between registers or between register and memory Rotate and complement data in registers. Flag conditions are altered after execution of instruction of this group
YPJ
Instructions
1 2
Task performed
Logically AND (r) with (A) Logically AND (M) with (A)
ANA r ANA M
3
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
YPJ
ARITHMETIC GROUP
ADD R (ADD register content with Acc and result in A ). Example: ADD C. (ADD the content of C with A). Suppose the Data at C register is 10H. Initially . C= 10H ,A=10H After execution A=20H,C=10H.
ARITHMEIC GROUP
ADD M(ADD H or L Reg content with Acc and result in A ).
Example: ADD M. (ADD the content of HL with A). Suppose the Data at memory pointed by HL register 1020H is 10H. Initially . H= 10H ,L=20H . A=20H,C=10H. After execution H=10H,L=20H. A=30H.
Flags Affected :All flags are modified. Addressing mode: Register Indirect.
ARITHMETIC GROUP
ADI Data(ADD immediate data with Acc and result in A ). Example: ADI 30H. (ADD 30H with A). Initially A=20H, After execution A=50H.
ARITHMETIC GROUP
ADC R (ADD register content with Acc and carry and result in A ). Example: ADC C. (ADD the content of C with A with carry). Suppose the Data at C register is 10H and carry is 01H. Initially . C= 10H ,A=10H After execution A=21H,C=10H.
ARITHMETIC GROUP
Example: Write a program to perform 16 bit addition of 1234H& 4321H. Store answer at H & L registers. MVI B,21H B=21H MVI A,34H A=34H MVI C,43H C=43H MVI D,12H D=12H ADD B A=34+21H MOV L,A L=55H MOV A,C A=43H ADC D A=43+12H MOV H,A H=55H RST1 STOP.
ARITHMETIC GROUP
SUB R (Subtract register content from Acc and result in A ). Example: SUB B. (Subtract the content of B from A ). Suppose the Data at B register is 10H . Initially B= 10H ,A=20H After execution A=10H,B=10H.
ARITHMETIC GROUP
SBB R (Subtract register content from Acc with borrow and result in A ). Example: SBB B. (Subtract the content of B from A with borrow). Suppose the Data at B register is 10H and borrow is 01H . Initially After execution
B= 0FH ,A=20H
A=10H,B=0FH.
ARITHMETIC GROUP
SUI Data(Subtract immediate data from Acc and result in A ). Example: SUI 30H. (Subtract 30H from A). Initially A=80H, After execution A=50H.
ARITHMETIC GROUP
Example: Subtract data of C800 H from C200H.Store the result at C201. LDA C800H MOV B,A LDA C200H SUB B STA C201H RST1
ARITHMETIC GROUP
DAD Rp (Add specified register pair with HL pair) Example: DAD D.(Add the content of E with L and that of D with H register and result in HL pair) Suppose the content of HL pair is H=20H ,L=40H and DE pair is D=30H, E=10H. Initially H=20H ,L=40H D=30H, E=10H After execution H=50H ,L=50H D=30H, E=10H
ARITHMETIC GROUP
DAA (Decimal adjust accumulator) Example: MVI A,12H ADI 39H DAA . This instruction is used to store result in BCD form.If lower nibble is greater than 9 ,6 is added while if upper nibble is greater than 9,6 is added to it to get BCD result. Initially 12+39=4B After execution 12+39=51 in BCD form.
ARITHMETIC GROUP
INR R (Increment register content by 1 ). Example: INR C. (Increment the content of C by 1). Suppose the Data at C register is 10H. Initially C= 10H After execution C=11H.
Flags Affected :All flags are modified except carry flag. Addressing mode: Register.
ARITHMETIC GROUP
DCR R (Decrement register content by 1 ). Example: DCR C. (Decrement the content of C by 1). Suppose the Data at C register is 10H. Initially C= 10H After execution C=0FH.
Flags Affected :All flags are modified except carry flag. Addressing mode: Register.
ARITHMETIC GROUP
INX Rp (Increment register pair content by 1 ).
Example: INX SP (Increment the content of Stack pointer pair by 1). INX B. (Increment the content of BC pair by 1). Suppose the Data at BC register is 1010H and SP is C200H Initially BC= 1010H After execution BC=1011H.
SP=C200H
SP=C201H.
LOGICAL GROUP
ANA R (Logically AND register content with Acc and result in A ). Example: ANA C (AND the content of C with A). Suppose the Data at C register is 10H. Initially C= 10H ,A=10H After execution A=10H,C=10H.
LOGICAL GROUP
ANI Data (Logically AND immediate data with Acc and result in A ). Example: ANI 10H (AND 10H with A). Initially A=11H After execution A=10H
Flags Affected :S,Z,P are modified Cy = reset, AC = set. Addressing mode: Immediate.
LOGICAL GROUP
ORA R (Logically OR register content with Acc and result in A5 ). Example: ORA C (OR the content of C with A). Suppose the Data at C register is 17H. Initially C= 17H ,A=10H After execution A=17H,C=17H.
LOGICAL GROUP
ORI Data (Logically OR immediate data with Acc and result in A ). Example: ORI 10H (OR 10H with A). Initially A=30H After execution A=30H
LOGICAL GROUP
XRA R (Logically XOR register content with Acc and result in A ). Example: XRA C (XOR the content of C with A). Suppose the Data at C register is 17H. Initially C= 17H ,A=10H After execution A=07H,C=17H.
LOGICAL GROUP
CMP R (Compare register content with Acc and result in A ).
Example: CMP C (Compare the content of C with A). Suppose the Data at C register is 17H. Initially C= 10H ,A=17H After execution A=17H,C=17H.
LOGICAL GROUP
CPI Data (Compare immediate data with Acc ). Example: CPI 10H (Compare the content of C with A). Initially A=17H After execution A=17H.
LOGICAL GROUP
RLC (Rotate accumulator left ). Example: MOV A,03H. RLC Initially A=03H (Rotate accumulator left). After execution A=06H.
LOGICAL GROUP
RAL (Rotate accumulator left with carry ). Example: MOV A,03H. RAL Initially A=03H , carry =01H (Rotate accumulator left with carry). After execution A=07H.
LOGICAL GROUP
RRC (Rotate accumulator right ). Example: MOV A,03H. RRC Initially A=03H , (Rotate accumulator right). After execution A=81H.
LOGICAL GROUP
Write a program to reset last 4 bits of the number 32H Store result at C200H. MVI A, 32H A=32H ANI F0H 00110010 AND 1111000 =00110000=30H STA C200H. C200=30H RST1 Stop
Branch Instructions
Allows the microprocessor to change the sequence of a program execution either unconditionally or under certain test conditions. Cause the microprocessor to transfer the program control from the execution of the instruction of main program to the instructions whose address is specified in the instruction. Conditional branch instructions examine the status of the specified flag and determine if branch instruction is to be executed or not.
YPJ
This group includes: Jump instructions direct or indirect (unconditional and conditional) Call instructions (unconditional and conditional) Return instructions (unconditional and conditional) Restart instructions (unconditional)
YPJ
Instructions Unconditional JMP 16-bit addr Jump Conditional Jump Jcondition addr JC 16-bit addr JNC 16-bit addr JP 16-bit addr JM 16-bit addr JPE 16-bit addr JPO 16-bit addr JZ 16-bit addr JNZ 16-bit addr
Task performed Jump unconditionally to the address specified in the instruction Jump conditionally to the address specified in the instruction. Jump on carry (CY = 1) Jump on no carry (CY = 0) Jump on positive (S = 0) Jump on negative (S = 1) Jump on even parity (P = 1) Jump on odd parity (P = 0) Jump on zero (Z = 1) Jump on not zero (Z = 0)
YPJ
Instructions
Indirect jump
Task performed Initialize memory pointer and then Load (HL) to (PC)
Transfer the program control to the specified memory address:
Restart n
BRANCH GROUP
JMP address(Unconditional jump to address) Example: JMP C200H. After this instruction the Program Counter is loaded with this location and starts executing and the contents of PC are loaded on Stack.
BRANCH GROUP
Conditional Jump Instructions. JC (Jump if Carry flag is set) JNC (Jump if Carry flag is reset) JZ (Jump if zero flag set) JNZ (Jump if zero flag is reset) JPE (Jump if parity flag is set) JPO (Jump if parity odd or P flag is reset ) JP (Jump if sign flag reset ) JM (Jump if sign flag is set or minus)
BRANCH GROUP
Conditional Call Instructions. CC (Call if Carry flag is set) CNC (Call if Carry flag is reset) CZ (Call if zero flag set) CNZ (Call if zero flag is reset) CPE (Call if parity flag is set) CPO (Call if parity odd or P flag is reset ) CP (Call if sign flag reset ) CM (Call if sign flag is set or minus)
BRANCH GROUP
RET (Return from subroutine) Example: MOV A,C RET After this instruction the Program Counter POPS PUSHED contents from stack and starts executing from that address .
BRANCH GROUP
RST (Restart instruction) Example: MOV A,C RST 1. After this instruction the Program Counter goes to address 0008H and starts executing from that address .
BRANCH GROUP
The addresses of the respective RST commands are:
Instructions
Unconditional Call
Task performed
Call unconditionally a subroutine whose address is specified in the instruction. Call conditionally a subroutine whose address is specified in the instruction. Call a subroutine on carry (CY = 1) Call a subroutine on no carry (CY = 0) Call a subroutine on positive (S = 0) Call a subroutine on negative (S = 1) Call a subroutine on even parity (P = 1) Call a subroutine on odd parity (P = 0) Call a subroutine on zero (Z = 1) Call a subroutine on not zero (Z = 0) Return unconditionally from the subroutine. Return conditionally from the subroutine. Return from subroutine on carry (CY = 1) Return from subroutine on no carry (CY = 0) Return from subroutine on positive (S = 0) Return from subroutine on negative (S = 1) Return from subroutine on even parity (P =1) Return from subroutine on odd parity (P = 0) Return from subroutine on zero (Z = 1) Return from subroutine on not zero (Z = 0)
CALL 16-bit addr Ccondition 16-bit addr CC 16-bit addr CNC 16-bit addr CP 16-bit addr CM 16-bit addr CPE 16-bit addr CPO 16-bit addr CZ 16-bit addr CNZ 16-bit addr
Conditional Call
Unconditional Return
RET 16-bit addr Rcondition 16-bit addr RC 16-bit addr RNC 16-bit addr RP 16-bit addr RM 16-bit addr RPE 16-bit addr RPO 16-bit addr RZ 16-bit addr RNZ 16-bit addr
Conditional Return
YPJ
Instructions
CY
ACI 8-bit ADC reg ADC M ADD reg ADD M ADI 8-bit ANA reg ANA M ANI 8-bit CMC CMP reg CMP M A A A A A A 0 0 0 A A A
Status Flags
AC
A A A A A A 1 1 1 NA A A
Z
A A A A A A A A A NA A A
S
A A A A A A A A A NA A A
P
A A A A A A A A A NA A A
CPI 8-bit
DAA DAD Rp DCR reg DCR M
A
A A NA NA
A
A NA A A
A
A NA A A
A
A NA A A
A
A NA A A
YPJ
CY
INR reg INR M ORA reg ORA M ORI 8-bit RAL RAR RLC RRC SBB reg NA NA 0 0 0 A A A A A
AC
A A 0 0 0 NA NA NA NA A
Z
A A A A A NA NA NA NA A
S
A A A A A NA NA NA NA A
P
A A A A A NA NA NA NA A
SBB M
SBI 8-bit STC SUB reg SUB M
A
A A A A
A
A NA A A
A
A NA A A
A
A NA A A
A
A NA A A
SUI 8-bit
XRA reg XRA M XRI 8-bit
A
0 0 0
A
0 0 0
A
A A A
A
A A A
A
A A AYPJ
NOTE: A : Flag affected. NA: Flag not affected. 0 : Flag always zero. 1 : Flag always one.
YPJ
DDD defines the destination register, SSS defines the source register and DD defines the register pair.
Registers
Code
Registers Pairs
Code
B
C D E H L M (Memory) A
000
001 010 011 100 101 110 111
BC
DE HL AF or SP
00
01 10 11
YPJ
Description
: The content of byte 2 of the instruction is directly moved to specified register r. : 2 bytes First byte: Opcode of MVI r. Second byte: 8 bit data. :
No. of bytes
Instruction format
0 D D D 1 Data
Flags affected
: None
YPJ
Example: MVI B, 54H ; This instruction will load 54H directly into register B.
Before execution
After execution
A B D H
F C E L
MVI B, 54H
A D H
F E L
B 54H C
YPJ
: Move 8 bit data immediate to memory location whose address is given by memory pointer - (HL) register pair. : (M) 8 - bit data (byte)
: The content of byte 2 of the instruction is directly moved to specified memory location. : 2 bytes First byte: Opcode of MVI M (3E). Second byte: 8- bit data.
: 0 0 1 1 0 1 1 0
: Move (copy) data from source register (Rs) to destination register (Rd). : (Rd) (Rs) : This instruction copies data from source register to destination register. The Rs and Rd are general purpose registers such as A, B, C, D, E, H and L registers. : 1 byte Opcode of MOV Rd, Rs : 0 1 D D D S S S
YPJ
4 MOV M, Rs
: Move data from source register into memory location whose address is given by memory pointer - (HL) register pair. : (M) (Rs) : The content of source register is copied into specified memory location. : 1 byte Opcode of MOV M, Rs :
Operation Description No. of bytes Instruction format Addressing mode Flags affected
0 1 1 1 0 S S S
YPJ
: Move data from memory location, whose address is pointed by memory pointer, into destination register. : (Rd) (M) : The content of specified memory location is copied into destination register
No. of bytes
Instruction format Addressing mode
0 1 D D D 1 1 0
Flags affected
: None
YPJ
The different ways that a microprocessor can access data are referred to as Addressing modes.
The 8085 have five Addressing modes:
1. 2. 3. 4. 5.
Immediate Addressing Register Addressing Direct Addressing Indirect Addressing Implied Addressing.
YPJ
Immediate Addressing In this mode, 8 or 16-bit data can be specified as a part of instruction. The instructions ending with letter I are generally fall under this category. Here the operand is the specified constant in the instruction itself.
Examples:
LXI H, C000H ; Move immediate 16-bit data ; (C000H) into memory/ data ; pointer i.e. in HL register pair.
YPJ
Register Addressing This mode specifies the source operand or destination operand or both to be in the 8085 registers. This results in faster execution, since it is not necessary (required) to access memory location for operands. Here the operand is the contents of the named registers.
Examples: MOV A,B ; Move the content of register B into the accumulator. ADD C ; Add the content of register C into the accumulator.
YPJ
Direct Addressing
This mode specifies the 16-bit address in the instruction itself. The second and the third bytes of instruction contain 16-bit address. Here the operand is the contents of the specified memory location.
Examples:
LDA D000H ; Loads the 8 bit content of memory D000H into the ; accumulator. SHLD 3000H ; stores the content of HL register pair in to two consecutive ; memory locations, the content of register L into memory ; location 3000H and the content of register H into memory ; location 3001H.
YPJ
Indirect Addressing
In this mode the memory address, at which data is stored or to be stored, is specified by the contents of the register pair. (The specified register pair contains the address of the operand.) Examples:
LDAX D
MOV M, A
; Loads the accumulator with content of memory ; pointed by DE register pair ; Store the content of accumulator in memory ; pointed by memory (HL) pointer.
YPJ
Implied Addressing (indicated by suggestion rather than explicit reference) In implied addressing, opcode only specifies the address of the operands. The addressing mode of certain instructions is implied by the instructions function. For example, the STC (set carry flag) instruction deals only with the carry flag, the DAA (decimal adjust accumulator) instruction deals with the accumulator.
Examples: CMA RAL STC DAA ; Complements the content of accumulator. ; Rotates the content of accumulator left through ;carry. ;(set carry flag) instruction deals only with the carry flag, ;(decimal adjust accumulator) instruction deals with the ; accumulator.
YPJ
Some instructions use a combination of addressing modes. A CALL instruction, for example, combines direct addressing and register indirect addressing. The direct address in a CALL instruction specifies the address of the desired subroutine; the register indirect address is the stack pointer. The CALL instruction pushes the current contents of the program counter into the memory location specified by the stack pointer.
Instruction Formats
The 8085 instruction set consists of one, two and three byte instructions.
The first byte of instruction is always the opcode; in two byte instruction the second byte is usually data (or port address); in the three byte instruction the second and third byte represent address or 16-bit data.
YPJ
1 byte Example: MOV A, B is one byte Instruction. This instruction copies the contents of register B into register A.
2 byte Example: MVI C, 00H. In this instruction the first byte is the opcode for MVI C and is followed by a data byte (00H in this case). This instruction copies immediate data 00H into register C.
3 byte Example: JMP D050H. The opcode of this instruction is C3 first byte and is followed by 16-bit address D050H (2 bytes). This instruction transfers program control to memory location D050H, by loading this address into program counter.
YPJ
Algorithm
A problem is solved by processor in step by step method. We call each step an instruction. Thus the solution of the problem is divided in several instructions. An Algorithm is such sequence of instructions to solve a particular problem.
An algorithm has following characteristics. 1. 2. 3. 4. Input: an algorithm may or may not require input data. Output: Each algorithm is expected to have at least one result. Definiteness: each instruction must be clear and unambiguous. Finiteness: If the instructions of an algorithm are executed, the algorithm should terminate a program after finite number of steps.
YPJ
Flowchart
To develop programming logic programmer has to write down various actions, which are to be performed in proper sequence. A Flowchart is a Graphical representation of an algorithm - that illustrates the sequence of operations to be performed to arrive at the solution. - Special-purpose symbols connected by arrows (flowlines) Flowchart is very useful for clear understanding of programming logic.
YPJ
Purpose
To begin a flowchart To end flowchart To gate input data
To do calculations
To make comparisons
To print result
To execute subroutine
YPJ
MVI A, 8-bit data MVI B, 8-bit data ADD B STA C200H RST 1
MVI A, 8-bit data MVI B, 8-bit data MVI C, 00H ADD B JNC : NO CARRY INR C
NO CARRY :
MVI C, 00H
LXI H C100H MOV A, M INX H ADD M JNC : NO CARRY INR C
NO CARRY :
; carry = 00
; initialize memory pointer ; get first number to accumulator ; increment memory pointer ; add second number ; is carry zero? ; carry = carry + 1 ; increment memory pointer ; store the sum ; increment memory pointer ; store the carry ; end program execution
YPJ
YPJ
5 LXI H C100H MOV A, M INX H ADD M MOV L, A MVI A, 00H ADC A MOV H, A
YPJ
8 BIT DECIMAL SUBSTRACTION if 2nd no is greater than 1st no then the answer will in 2's complement store 1st 8 bit no in the memory location C050 store 2nd 8 bit no in the memory location C051 Result is stored in C052 LXI H,C051 MVI A,99 SUB M INR A DCX H ADD M DAA STA C052 HLT
Write an assembly language program to multiply two 8-bit hexadecimal numbers, using successive addition method. Store the product in HL register pair.
XRA A/ SUB A/ MVI A, 00H MVI B, 8-bit data MVI D, 8-bit data MOV C, A AGAIN: ADD B JNC : NO CARRY INR C NO CARRY : DCR D JNZ : AGAIN MOV H,C MOV L,A RST 1
Write an assembly language program to transfer 16 bytes of data stored in locations at C150H to C15FH to the new memory location starting from C200H onward.
LXI H C150H LXI D C200H MVI C, 10H NEXT: MOV A, M STAX D INX H INX D DCR C JNZ: NEXT HLT
Fibonacci Series Generation To run the Program simply load at memory location C050=01,C051=01
MVI C,09 //Counter
NEXT:
LXI H,C050 //Memory Pointer MOV A,M INX H MOV B,M INX H ADD B DAA MOV M,A DCX H DCR C JNZ:NEXT RST 1
State the task performed, byte size and the addressing modes of the following instructions. Instruction ADI 37H STAX D Task performed Add 37H immediately to register A (accumulator) Store the content of the register A into the memory whose location (address) is specified by DE register pair Move 8-bit data from source register A to destination register B. Byte size 2 1 Addressing mode Immediate addressing Indirect addressing Register addressing
MOA B, A
1
2 3 4 5 6
MVI A, AAH
MVI C,7BH MOV B,A SUB C STA C100H HLT/ RST n
State the function performed by each of the following 8085 microprocessor instructions:
1. LXI D, C350H : Load register pair DE immediately with C350H 2. ADC H : Add content of register C to accumulator with carry (i.e. (A) = (A) +(C) +CY) This instruction modifies all flags. 3. CALL 036EH : The program control is transferred to the address specified by the operand (036EH). Before the transfer of the control the address of the next instruction to the CALL is pushed to the stack. 4. NOP : No operation or do nothing. 5. RST1 : This instruction can be used as software interrupt to transfer the program execution (program control) to address 0008H 6. LDA EO40H : The content of memory location E040H are copied to the accumulator.
The data in the accumulator, register B and register C of 8085 microprocessor is 90H, 2AH and 17H respectively, what will be the content of the accumulator, register B and register C after executing each instruction in the following program
Accumulator (A)
Initially ADD B MOV C, A MVI A, 32H RST 1 90H BAH BAH 32H 32H
(B)
(C)
The data in the accumulator, register C and register D of 8085 microprocessor is 00H, 0FH and 49H respectively, what will be the content of these registers after executing each instruction in the following program A C D
ORA D
RST 1
5FH
5FH
0FH
0FH
0FH
0FH
1.
State how many times the following loop will be executed LXI B 0005H again: DCX B JNZ : again
Infinite number of times Give the content of the accumulator after execution of each of the instruction in the following program segment MVI A, 95H ANI 0FH CMA
A
MVI A, 95H ANI 0FH CMA 95H 05H FAH
Initially the accumulator contents 82H and carry flag is RESET. After executing following instructions in sequence, give the content of accumulator and carry flag.
CY 0 0 1 1
0EH
00H
//five consecutive numbers to be sorted in ascending order Store numbers from memory location C020 START : W: MVI D,05 LXI H,C020 //Counter
X:
//Counter
Y:
Write an assembly language program to find largest hexadecimal number out of an array of 10 numbers stored in memory with starting address C100H.
LXI H C100H MVI C,09H MOV A,M NEXT: INX H CMP M JNC : NO CARRY MOV A,M NO CARRY: DCR C JNZ : NEXT RST 1
Write an assembly language program to Add 3207H to 8051H using DAD instruction. Store the result in memory locations C150H and C151H.
LXI H 3207H LXI B 8051H DAD B SHLD C150H HLT