0
나는 클래스 프로젝트에서 일하고 있는데 무엇을해야 할지를 "정수를 입력하십시오."라는 메시지가 나타나면 theuserfor 2 정수를 물어보고 alsoto에 "(+, *, -, /) 연산자를 입력하십시오"라는 메시지가 나타나면 누군가이 코드를 보면서 내가 뭘 잘못하고 있는지 말해 줄 수 있니? 첫 번째 명령은 인쇄하지만 문자 입력과 함께 오류 메시지가 나타납니다. (-, *,/+) 다음 두 번째 integer.Here가내 QTSPIM 시뮬레이터에서이 코드를 실행할 때 오류가 발생한다.
정말 내가 희망이 도움이
.data
prompt: .asciiz "Please enter an integer\n"
message: .asciiz "Please enter an operator (+, - , * , /):"
usercharacter: .space 2
.text
.globl main
main:
li $v0, 4 #system call code for printing a string is 4
la $a0, prompt #adress of string is argument 0, to print string
syscall # telling the system to execute the action
li $v0, 5 # system call for reading and displaying input
syscall
move $t1, $v0 # store input one into register $a1
li $a0, message
li $v0, 4
syscall
la $a0,usercharacter
li $a1, 2 #allocating a space for 2 caracters
li $v0 12
syscall
li $v0, 4 #system call code for printing a string is 4
la $a0, prompt #adress of string is argument 0, to print string
syscall # telling the system to execute the action
li $v0, 5 # system call for reading and displaying input
syscall
move $t2,$v0 #print the prompt message for the user to input
li,$v0,10
syscall
_ _ ** 어떤 ** 오류 메시지 "나는 에로 메시지 얻을"? 또한, 시스템 호출 12 ('read_character')를 사용하는 방식은 당신이 그것이하는 일을 오해했다고 믿게합니다. – Michael
오류 메시지는 "0x0040003c에서 비 명령 실행을 시도합니다."입니다. 내 코드가하려고하는 것은 사용자로부터 문자를 읽는 것입니다. 어딘가에 대한 코드는 12입니다. 아마 내가 올바르게 사용하지 않을 수도 있습니다. 어떻게 사용하는지 알려주시겠습니까? 귀하의 회신에 감사드립니다. – TINA15
게시 한 코드가 어셈블하는 것처럼 보이지 않습니다. 예를 들어 'main'이라는 레이블이 없습니다. SPIM에서 사용할 수있는 시스템 호출에 대한 정보는 [this this] (https://www.doc.ic.ac.uk/lab/secondyear/spim/node8.html)를 참조하십시오. – Michael