This is for 8051 Assembly language ONLY Initialize the memor
This is for 8051 Assembly language ONLY.
Initialize the memory locations 30H-36H with the decimal number: 10_D. Use ADD command to add the contents stored at these RAM memory locations (30 H - 36H). Store the result in R2. Show the status of the carry flag (C), auxiliary carry flag (AC), and the parity flag (P) after program execution.Solution
MOV R0, #30H; //initialize RAM starting address
MOV A, #0xA; //load with 10 decimal
MOV R3,#7; //counter for address
//loop for copying 10d into memory location
AGAIN: MOV @R0 , A; //move accumulator data into address pointed by R0
INC R0; //increment R0
DJNZ R3,AGAIN; //loop
MOV A,#0x0;
MOV R3,#7;
MOV R0, #30H;
AGAIN1: ADD A,@R0; //Add content at location pointed by R0 with A i.e A=A+@R0
INC R0; //increment R0;
DJNZ R3, AGAIN1; //Loop
MOV R2,A; //saving the result into R2;
/*
for carry flag(C),Auxillary carry(AC) and Parity Flag(P) please check PSW register in keil during debug
PSW-->
MSB 6 5 4 3 2 1 LSB
CY AC FO RS1 RS0 OV UD P
*/
