我似乎无法在这段代码中计算正常工资。它只是计算加班时间的比率,而不是包括正常工资在内的全部工资。这是 OAMulator 编译器的链接。
SET 40 #put the value 40 into the accumulator
STA 50 #store the value 40 in address 50 (I chose 50 arbitrarily)
SET 1.5 #put the value 1.5 into the accumulator
STA 51 #store the value 1.5 in address 51
LDA 0 #input the number of hours worked
STA 52 #store the number of hours worked in address 52
LDA 0 #input the payrate
STA 53 #store the payrate at address 53
LDA 52 #load the number of hours worked into the accumulator
SUB 50 #subtract the number 40 (stored in address 50)
STA 54 #store overtime hours at address 54
BRP RT #if hours is more than 40, branch to overtime
LDA 50 #load 40 into the accumulator
MLT 53 #multiply by the payrate.
STA 55 #store REGULAR PAY pay in address 55
RT, LDA 52 #load the number of hours worked
LDA 54 #overtime hours
MLT 51 #overtime rate
MLT 53 #payrate
ADD 55 #add the regular pay
STA 56 #all of the pay
BR FINAL #branch to where you are going to print the week's pay
STA 56 #store total pay including regular pay and overtime pay in address 56
FINAL,STA 0 #output final pay
HLT
这里有什么问题,我该如何解决?