mars.mips.instructions.syscalls
Class SyscallReadString
java.lang.Object
mars.mips.instructions.syscalls.AbstractSyscall
mars.mips.instructions.syscalls.SyscallReadString
- All Implemented Interfaces:
- Syscall
public class SyscallReadString
- extends AbstractSyscall
Service to read console input string into buffer starting at address in $a0.
Constructor Summary |
SyscallReadString()
Build an instance of the Read String syscall. |
Method Summary |
void |
simulate(ProgramStatement statement)
Performs syscall function to read console input string into buffer starting at address in $a0. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SyscallReadString
public SyscallReadString()
- Build an instance of the Read String syscall. Default service number
is 8 and name is "ReadString".
simulate
public void simulate(ProgramStatement statement)
throws ProcessingException
- Performs syscall function to read console input string into buffer starting at address in $a0.
Follows semantics of UNIX 'fgets'. For specified length n,
string can be no longer than n-1. If less than that, add
newline to end. In either case, then pad with null byte.
- Specified by:
simulate
in interface Syscall
- Specified by:
simulate
in class AbstractSyscall
- Parameters:
statement
- ProgramStatement object for this syscall instruction.
- Throws:
ProcessingException