views:

278

answers:

1

I'm writing a program in assembly using MIPS architecture for a class, and I'm having trouble figuring out how to grab an input character by a user and store it in a register to process.

The program would open a console, output a message, the user can then input a character and then this determines what is supposed to happen next in the program.

Like I said, I'm having trouble figuring out how to grab the character so that I can act upon it in the program.

thanks

A: 

This is a very good starting point: MIPS Quick Tutorial

Here is a snippet from the tutorial

li  $v0, 5          # load appropriate system call code into register $v0;
                    # code for reading integer is 5
syscall           # call operating system to perform operation
sw  $v0, int_value  # value read from keyboard returned in register $v0;
                     # store this in desired location

You won't be working directly with interrupts with any assembly you are writing in user-space.

dboarman