好的,首先让我说我是集会新手。我正在尝试将程序添加到两个整数中,并输出结果。当我这样做时,这是有效的:
- (void)drawRect:(NSRect)dirtyRect
{
[super drawRect:dirtyRect];
NSAffineTransform* xform = [NSAffineTransform transform];
[xform scaleXBy:pageScale yBy:pageScale];
[xform concat];
[self layoutReport];
[xform invert];
[xform concat];
}
但是,我应该输出变量而不仅仅输出$ t1,但是当我将问题(a)中的行更改为
时 .data
A: .word 0 #declare two integers with initial value 3 and the sum variable
B: .word 0
S: .word 0 #getting the string in advance
line: .asciiz "The sum of A and B (A + B) is "
.text
main:
li $v0, 5 #load input syscall code
syscall #call for operating system to perform operation
sw $v0, A #value read from keyboard returned in register $v0
li $v0, 5 #load input syscall code
syscall #call for operating system to perform operation
sw $v0, B #value read from keyboard returned in register $v0
la $a0,A
lw $t0, ($a0)
la $a0,B
lw $t2, ($a0)
add $t1,$t2,$t0 #adding the numbers
sw $t1,S #--------line in question(b)
li $v0, 4 #load output string syscall
la $a0, line #load address of string to be printed into $a0
syscall
li $v0, 1
la $a0, ($t1) #----------line in question (a)
syscall
我明白了
5
6
A和B的总和(A + B)是268501000
我假设有问题(b) 是问题,因为它似乎没有将信息保存到B.我试图自己解决这个问题,但我很难过。