Found 409 Articles for Microcontroller

8085 program to access and exchange the content of Flag register with register B

Jennifer Nicholas
Updated on 30-Jul-2019 22:30:24

792 Views

In this program we will see how to exchange the content of Flat register with register B.Problem StatementWrite 8085 Assembly language program to swap the content of flag register and the register B.DiscussionAs we cannot access the flag register content directly, we have to take the help of stack. By using stack, we can push the content of PSW (Accumulator and Flag). Then we can get it back and store into some other registers. Similarly, from other register, we have to push them into stack, then pop it to PSW.Here if we want to exchange the value of B and ... Read More

8085 program to swap two 16-bit numbers using Direct addressing mode

Anvi Jain
Updated on 30-Jul-2019 22:30:24

839 Views

In this program we will see how to swap two 16-bit numbers in direct addressing mode.Problem StatementWrite 8085 Assembly language program to swap two 16-bit number stored at location 8000H – 8001H and 8002H – 8003H using direct addressing mode.DiscussionHere we are swapping the values using XCHG instruction. This instruction swaps the contents of DE and HL pair contents. We are taking the first number into DE register pair, then the second number into HL pair, then by XCHG we are swapping them.InputAddressData......8000CD8001AB800234800312......Flow DiagramProgramAddressHEX CodesMnemonicsCommentsF0002A, 00, 80LHLD 8000HLoad the first number into HLF003EBXCHGExchange DE and HLF0042A, 02, 80LHLD 8002HLoad the ... Read More

8085 program to swap two 8 bit numbers using Direct addressing mode

Vrundesha Joshi
Updated on 30-Jul-2019 22:30:24

507 Views

In this program we will see how to swap two numbers in direct addressing mode.Problem StatementWrite 8085 Assembly language program to swap two 8-bit number stored at location 8000H and 8001H using direct addressing mode. DiscussionIn this case we are taking the number from memory by using the HL pair. The HL pair is storing the address of the data item. We are taking the first number into B register, and the second number to A register, then storing the content of B to the next position, and storing the value of A into first position.InputAddressData......8000CD800134......Flow DiagramProgramAddressHEX CodesMnemonicsCommentsF00021, 00, 80LXI H, ... Read More

8085 program to swap two 8-bit numbers

Rishi Rathor
Updated on 30-Jul-2019 22:30:24

3K+ Views

In this program we will see how to swap two numbers.Problem StatementWrite 8085 Assembly language program to swap two 8-bit number stored at location 8000Hand 8001H.DiscussionIn 8085, there is an instruction XCHG. Using this we can swap the contents of DE and HL values. We are taking the numbers and storing them into H and D, then using XCHG the contents are swapped.InputAddressData......8000CD800134......Flow DiagramProgramAddressHEX CodesMnemonicsCommentsF0003A, 00, 80LDA 8000HLoad the first number into AF00367MOV H, AStore the number into HF0043A, 01, 80LDA 8001HLoad the second number into AF00757MOV D, AStore the number into DF008EBXCHGExchange DE and HLF0097CMOV A, HTake H content ... Read More

8085 program to find maximum of two 8 bit numbers

Jennifer Nicholas
Updated on 30-Jul-2019 22:30:24

579 Views

In this program we will see how to find the maximum of two numbers.Problem StatementWrite 8085 Assembly language program to find the maximum number of two 8-bit number stored at location 8000H and 8001H.DiscussionThis checking is done by using the CMP instruction. This instruction is very similar to the SUB instruction. The only difference is that it does not update the value of Accumulator after executing. So after comparing, if the CY flag is set, it means that the first number is smaller, and the second one is largerInputFirst inputAddressData......8000FD800123......second inputAddressData......800059800175......Flow DiagramProgramAddressHEX CodesLabelMnemonicsCommentsF00021, 00, 80LXI H, 8000HPoint to the first ... Read More

8085 program to find smallest number between two numbers

Anvi Jain
Updated on 30-Jul-2019 22:30:24

2K+ Views

In this program we will see how to find the smallest of two numbers.Problem StatementWrite 8085 Assembly language program to find the smallest number of two 8-bit number stored at location 8000H and 8001H.DiscussionThis checking is done by using the CMP instruction. This instruction is very similar to the SUB instruction. The only difference is that it does not update the value of Accumulator after executing. So after comparing, if the CY flag is set, it means that the first number is smaller, and the second one is largerInputFirst inputAddressData......8000FD800123......second inputAddressData......800059800175......Flow DiagramProgramAddressHEX CodesLabelMnemonicsCommentsF00021, 00, 80LXI H, 8000HPoint to the first ... Read More

8085 program to find larger of two 8 bit numbers

Vrundesha Joshi
Updated on 30-Jul-2019 22:30:24

3K+ Views

In this program we will see how to find the larger of two numbers.Problem StatementWrite 8085 Assembly language program to find the larger number of two 8-bit number store dat location 8000H and 8001H.DiscussionThis checking is done by using the CMP instruction. This instruction is very similar to the SUB instruction. The only difference is that it does not update the value of Accumulator after executing. So after comparing, if the CY flag is set, it means that the first number is smaller, and the second one is largerInputFirst inputAddressData......8000FD800123......second inputAddressData......800059800175......Flow DiagramProgramAddressHEX CodesLabelMnemonicsCommentsF00021, 00, 80LXI H, 8000HPoint to the first ... Read More

8085 program to find maximum and minimum of 10 numbers

Rishi Rathor
Updated on 30-Jul-2019 22:30:24

1K+ Views

In this program we will see how to find the maximum and minimum number in a block data.Problem StatementWrite 8085 Assembly language program to find the maximum and minimum number in a block often 8-bit numbers.DiscussionIn this program we are taking the first number of the block into register D and E. The D will store the minimum number, and E will store maximum number. In each iteration we will check whether the number is smaller than D or not, if it is smaller, then update D with the new number, and then compare it again with E to check ... Read More

8085 program to check whether the given number is even or odd

Jennifer Nicholas
Updated on 30-Jul-2019 22:30:24

8K+ Views

In this program we will see how to check whether a number is odd or even.Problem StatementWrite 8085 Assembly language program to check whether a number is odd or even.DiscussionThe Odd Even checking is very simple. we can determine one number is odd or even by checking only the LSb. When LSb is 1, the number is odd, otherwise it is even.In this program we are taking a number from memory and then ANDing 01H with it. if the result is nonzero, then the number is odd,  otherwise it is even.Inputfirst inputAddressData......800015......second inputAddressData......80002C......Flow DiagramProgramAddressHEX CodesLabelMnemonicsCommentsF0003A, 00, 80LDA 8000HLoad the number ... Read More

8085 program to find 2's complement of the contents of Flag Register

Anvi Jain
Updated on 30-Jul-2019 22:30:24

332 Views

In this program we will see how to find 2's complement of the content of flag register.Problem StatementWrite 8085 Assembly language program to find 2's complement of the content of flag register.DiscussionWe cannot access the total flag register directly. To use them we have to push the PSW(Accumulator-Flag) into stack, and then pop it to another register pair, then after complementing the LS byte of that register pair, we have to push it again into the stack, and then pop it to PSW  to get it into Flag bits.InputHere we are not putting any input directly. If the flag bits ... Read More

Advertisements