Problem – Write an assembly language program to swap two 8-bit numbers stored in 8085 microprocessor.
Assumption – Suppose there are two 8-bit numbers. One 8-bit number is stored at location 2500 memory address and another is stored at location 2501 memory address. Let 05 is stored at location 2500 and 06 is stored at location 2501 (not necessarily, can be any two 8-bit numbers).
- Load accumulator with the content of any one location (either 2500 or 2501 or any given location).
- Move the contents of accumulator to any register (say B) so that another location’s content can be loaded to accumulator and the previous data of accumulator get saved in register.
- Store the content of accumulator to another location (data of 2501 to 2500).
- Load accumulator with content of register and then store it to another address location.
|200E||HLT||Terminates the program|
- LDA 2500 – Load accumulator with content of location 2500
- MOV B,A – Copy content of accumulator to register B
- LDA 2501 – Load accumulator with content of location 2501
- STA 2500 – Store content of accumulator to location 2500
- MOV A,B – Copy content of register B to accumulator
- STA 2501 – Store content of accumulator to location 2501
- HLT – Terminates the program
- 8085 program to swap two 16 bit numbers using Direct addressing mode
- 8085 program to swap two 8 bit numbers using Direct addressing mode
- 8085 program to count total even numbers in series of 10 numbers
- 8085 program to count total odd numbers in series of 10 numbers
- 8085 program to add two 16 bit numbers
- 8085 program to add 2-BCD numbers
- 8085 program to add two 8 bit numbers
- 8085 program to divide two 16 bit numbers
- 8085 program to divide two 8 bit numbers
- 8085 program to add numbers in an array
- 8085 program to sum of two 8 bit numbers without carry
- 8085 program to multiply two 16-bit numbers
- 8085 program to multiply two 8 bit numbers
- 8085 program to find the sum of series of even numbers
- 8085 program to subtract two 16-bit numbers with or without borrow
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.