Write an ALP to exchange the nibbles of 8-bit number stored at memory location 4500 H Store the result at 4501 H.
Answers
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 0F and reverse the result by using RLC instruction 4 times.
Store the result in memory location 3051.
Program –
MEMORY ADDRESSMNEMONICSCOMMENT2000LDA 2050A <- M[2050]2003MOV B, AB <- A2004ANI 0FA <- A (AND) 0F2006STA 3050M[3050] <- A2009MOV A, BA <- B200AANI 0FA <- A (AND) 0F200CRLCrotate content of A left by 1 bit without carry200DRLCrotate content of A left by 1 bit without carry200ERLCrotate content of A left by 1 bit without carry200FRLCrotate content of A left by 1 bit without carry2010STA 3051M[3051] <- A2013HLTEND