Hello everybody!
I've just started to learn the assembly language,so i have problems in really simple,i guess,programms.
First of all,there are these 2 following programms,that we must correct,if there are any mistakes.
The first one,requires to transform the following,in assembly:
for (i=0;i<10;i++)
{
A[i]=0
}
($10=4,$20-->i)<---those are given.
and the answer,we must correct is:
CODE
add $20,$0,$0 #$20=0 ,i
add $21,$0,10 #$21=10
Loop: mul $22,$22,$10 # $22= ix4
sw $0, Astart($22) # A[i]=0
slt $23,$20,$21 # if i<10 then $21=1
addi $20,20,1 #i=i+1
bne $23,0,Loop # if $21<>= goto Loop
the second one requires to transfrom this:
χ[10]=χ[11]+C
C=$13,$10=10,table x starts in address 4000. <---those are given
and the possible answer is:
CODE
lw $8,4000($11)
add $8,&13,$8
sw $8,4000($10)
the third programm,asks to transform this in assembly:
CODE
while (A[i++]!=0)
{
B[i]=A[i]+32
}
and I have no idea how to start.
I know they are simple problems,but I'm totally new to this,plus I have to write an exam based on all these things.
Any help would be precious!
Thank you in advance!