chowkinnam 2017-3-3 05:54
Suppose $t0 stores the base address of word array A and $s0 is associated with h, plz convert A[240] = A[240+h] to MIPS assembly code.
有無人可以幫下手:smile_27::smile_27::smile_27::smile_27::smile_27::smile_27::smile_27::smile_27::smile_27:
chowkinnam 2017-3-3 16:06
[quote]原帖由 [i]Susan﹏汪汪[/i] 於 2017-3-3 08:18 AM 發表 [url=http://www.discuss.com.hk/redirect.php?goto=findpost&pid=457305161&ptid=26485008][img]http://www.discuss.com.hk/images/common/back.gif[/img][/url]
加上去address之嘛 [/quote]
姐係 lw $t1, 240($s0)
add $t0, $t0, $s0
sw $t1, 240($s0)
咁樣?我比啲$t0,$s0搞到好亂:lDD_006:
form5 2017-3-3 23:45
#####################################
# $t0 = address of start of A
# $s0 = h
li $t1, 240 # $t1 = 240
add $t2, $t1, $t0 # $t2 = 240 + $t0
add $t3, $t2, $s0 # $t2 = address of A[h + 240]
# now $t3 = address of A[h + 240]
sw $t2, 0($t3) # store the value to A[240]
:lol:lol:lol:lol
[[i] 本帖最後由 form5 於 2017-3-3 11:46 PM 編輯 [/i]]
chowkinnam 2017-3-4 02:14
[quote]原帖由 [i]form5[/i] 於 2017-3-3 11:45 PM 發表 [url=http://www.discuss.com.hk/redirect.php?goto=findpost&pid=457352154&ptid=26485008][img]http://www.discuss.com.hk/images/common/back.gif[/img][/url]
#####################################
# $t0 = address of start of A
# $s0 = h
li $t1, 240 # $t1 = 240 ... [/quote]
我想問如果係while function ?
h=0;
While(h<=10)
{
A[h]=A[h+1]
h=h+1;
}
咁樣點轉?
form5 2017-3-4 21:47
[quote]原帖由 [i]chowkinnam[/i] 於 2017-3-4 02:14 AM 發表 [url=http://computer.discuss.com.hk/redirect.php?goto=findpost&pid=457357003&ptid=26485008][img]http://computer.discuss.com.hk/images/common/back.gif[/img][/url]
我想問如果係while function ?
h=0;
While(h [/quote]
工課自己做啦,你一早甘問味同你做左肋