# Prompt user to enter the integer scores for Exams 1, 2, and Final,
# read the scores,
# compute the weighted average score (using the following formula), and
# display a labeled output about the weighted average score.
# Formula: avg = (128/637)*e1Score + (307/1024)*e2Score + (feScore/2)
# avgScore=128*(1/637)*e1Score+307*(1/1024)*e2Score+(1/2)*feScore
############################ data segment ################################
.data
scorePrompt0: .asciiz "Enter integer score for Exam 1: "
scorePrompt1: .asciiz "Enter integer score for Exam 2: "
scorePrompt2: .asciiz "Enter integer score for Final Exam: "
avgMsg: .asciiz "The weighted average is: "
############################ code segment ################################
.text
.globl main
main:
################################################
# Get the scores, store in $t0, $t1, $t2
################################################
li $v0, 4
la $a0, scorePrompt0 # prompt for a score
syscall
li $v0, 5
syscall # read an integer
move $t0, $v0
li $v0, 4
la $a0, scorePrompt1 # prompt for a score
syscall
li $v0, 5
syscall # read an integer
move $t1, $v0
li $v0, 4
la $a0, scorePrompt2 # prompt for a score
syscall
li $v0, 5
syscall # read an integer
move $t2, $v0
################################################
# Compute weighted average, store in $t4
################################################
# multiply e1Score by 128
sll $t0, $t0, 7
# divide e2Score by 1024
sra $t1, $t1, 10
# divide feScore by 2
sra $t2, $t2, 1
# divide e1score by 637
li $t5, 637
div $t0, $t5
mfhi $t0
# multiply e2score by 307
li $t5, 307
mul $t1, $t1, $t5
li $t4, 0 # ensure $t4 is 0
add $t4, $t4, $t0
add $t4, $t4, $t1
add $t4, $t4, $t2
li $v0, 4
la $a0, avgMsg
syscall
li $v0, 1
move $a0, $t4
syscall
li $v0, 10 # graceful exit service
syscall
上記のコードは一例ですが、私の質問は、私はこのコードは(205/1024)*e1Score + #(256/854)*e2Score + (feScore/2)
であることを変更するにはどうすればよいのですか?試験1、試験2および最終試験の整数スコアを入力し、スコアを読み取り、次の公式を使用して加重平均スコアを計算し、加重平均スコアに関するラベル付きの出力を表示するようにユーザーに求めます。MIPSアセンブリLangauage:試験1、試験2及び期末試験
私はあなたのためにあなたの宿題をすることに消極的です。たぶんあなたが試したことを教えてください。 – jayjay
'div'の後に、' mvlo' [商を与える]と_not_ 'mvhi' [残りを与える] –