Develop an assembly language programing using MIPS facility
Develop an assembly language programing using MIPS facility to convert the following C assignment Statement B[4] = X - A[8]; We assume that the value of X is in Register $50 and the base address of A and B are in registers $51 and $52.
Solution
B[4] = X - A[8]
X = $S0
A = $S1
B = $S2
lw $S3, 32($S1)
//Loading the value at A[8] in some register $S3.
//Since each element takes 4 bytes hence offset is 8*4 = 32
sub $S4, $S0, $S3 //doing subtraction and storing the result in $S4
sw $S4, 16($S2)
//Storing the value from subtraction into B[4].
//Since each element is taking 4 bytes hence offset is 4*4 = 16
![Develop an assembly language programing using MIPS facility to convert the following C assignment Statement B[4] = X - A[8]; We assume that the value of X is i Develop an assembly language programing using MIPS facility to convert the following C assignment Statement B[4] = X - A[8]; We assume that the value of X is i](/WebImages/17/develop-an-assembly-language-programing-using-mips-facility-1033837-1761536133-0.webp)