Here we will see how to split two nibbles of an 8-bit number.
Write 8085 Assembly language program to split two nibbles of an 8-bit number. Number is stored at F050, we will store result at F051 and F052.
To get the nibbles separately, at first we are taking number into B register as a copy. Now mask upper nibble to get lower nibble and store it, then take the number from B again, mask lower nibble to get upper nibble, then rotate it four times to make it lower order nibble, after that store it to another location.
|F000||3A, 50 F0|| ||LDA F050||Take the number from memory to Accumulator|
|F003||47|| ||MOV B,A||Store the number Acc to B|
|F004||E6, 0F|| ||ANI 0F||AND Acc with 0F to get lower nibble|
|F006||32, 52, F0|| ||STA F052||Store lower nibble to memory|
|F009||78|| ||MOV A,B||Load main number from B to A|
|F00A||E6, F0|| ||ANI F0||AND Acc and F0 to get upper nibble|
|F00C||07|| ||RLC||Rotate Acc to left|
|F00D||07|| ||RLC||Rotate Acc to left|
|F00E||07|| ||RLC||Rotate Acc to left|
|F00F||07|| ||RLC||Rotate Acc to left|
|F010||32, 51, F0|| ||STA F051||Store upper nibble at F051|
|F013||76|| ||HLT||Terminate the program|