8085 program to show masking of lower and higher nibbles of 8 bit number
Problem – Write an assembly language program in 8085 microprocessor to show masking of lower and higher nibble of 8 bit number. Example – Assumption – 8 bit number is stored at memory location 2050. After masking of nibbles, lower order nibble is stored at memory location 3050 and higher order nibble is stored at memory location 3051. Algorithm –
- Load the content of memory location 2050 in accumulator A.
- Move the content of A in register B.
- Perform AND operation of A with 0F and store the result in memory location 3050.
- Move the content of B in A.
- Perform AND operation of A with F0 and reverse the result by using RLC instruction 4 times.
- Store the result in memory location 3051.
|2000||LDA 2050||A <- M|
|2003||MOV B, A||B <- A|
|2004||ANI 0F||A <- A (AND) 0F|
|2006||STA 3050||M <- A|
|2009||MOV A, B||A <- B|
|200A||ANI F0||A <- A (AND) F0|
|200C||RLC||rotate content of A left by 1 bit without carry|
|200D||RLC||rotate content of A left by 1 bit without carry|
|200E||RLC||rotate content of A left by 1 bit without carry|
|200F||RLC||rotate content of A left by 1 bit without carry|
|2010||STA 3051||M <- A|
Explanation – Registers A, B are used:
- LDA 2050: load the content of memory location 2050 in accumulator A.
- MOV B, A: moves the content of A to B.
- ANI 0F: perform AND operation of A with 0F and store the result back to A.
- STA 3050: store content of A in memory location 3050.
- MOV A, B: moves the content of B in A.
- ANI F0: perform AND operation of A with F0 and store the result back to A.
- RLC: rotate content of A left by 1 bit without carry. Use this instruction 4 times to reverse the content of A.
- STA 3051: store the content of A in memory location 3051.
- HLT: stops executing the program and halts any further execution.
- The program is simple and easy to understand, consisting of only a few instructions.
- The program uses the AND instruction to perform the masking operation, which is an efficient method.
- The program stores the masked nibbles in separate memory locations, making it easy to access and use the results in other programs.
- The program assumes that the number is stored in register A, and does not provide error checking for invalid input.
- The program stores the masked nibbles in fixed memory locations, which may cause conflicts with other programs or data.
- The program does not provide any feedback to the user or the system to indicate that the masking has been completed successfully.
- The program does not provide any error checking or recovery mechanisms in case of hardware or software failures.
My Personal Notes arrow_drop_up
Please Login to comment...