0
votes

i'm new to mips, stucking at the reading integer lesson. the code is:

        li $v0, 5 
        syscall 

when I click compile all, the program just keep running and won't stop (showing by the pause and the stop button light up, in contrast with the run one line, run all, back one line, back all buttons). When I click the run one line through the whole things, it show an error

Step: execution terminated due to null instruction.

Error in C:(TH) KTMT\TH2\mips1.asm line 2: Runtime exception at 0x00400004: invalid integer input (syscall 5)

Step: execution terminated with errors.

It was supposed to show a table to let me input data. can the problem come from my mars? cause I'm pretty sure the code is correct.

1
There's not enough code here to go wrong. (But it can be confusing if you don't have a prompt for the user to enter data.) What did you type in response to the input? If you type 5.1, for example, or just hit return, or type a string, you'll get that error since this is read integer. - Erik Eidt
it doesn't show me the input table to type in, the input table just doesn't shown up - van nguyen Thai
There's an option: "Settings -> Popup dialog for input syscalls (5,6,7,8,12)". If you check it, the simulator will bring up a dialog box to take your input when your code runs an input syscall; if you clear this option you will be expected to type the input into the "Run I/O" tab of the "Messages" windowpane; this tab will be automatically activated when your code runs an input syscall, but there's no extra prompt unless your program explicitly prints one, so it can be confusing to use without a prompt. - Erik Eidt
thanks, erik. My instructor said nothing about that setting so I was confused, turn out indeed my mars haven't check that box, thanks again, very helpful - van nguyen Thai

1 Answers

0
votes

My mars haven't check in the box: "Settings -> Popup dialog for input syscalls (5,6,7,8,12)", tha's all guys