Package mars.mips.instructions.syscalls
Class SyscallReadString
java.lang.Object
mars.mips.instructions.syscalls.AbstractSyscall
mars.mips.instructions.syscalls.SyscallReadString
- All Implemented Interfaces:
Syscall
Service to read console input string into buffer starting at address in $a0.
-
Constructor Summary
ConstructorsConstructorDescriptionBuild an instance of the syscall with its default service number and name. -
Method Summary
Modifier and TypeMethodDescriptionvoid
simulate
(BasicStatement statement) Performs syscall function to read console input string into buffer starting at address in $a0.Methods inherited from class mars.mips.instructions.syscalls.AbstractSyscall
getName, getNumber, setNumber
-
Constructor Details
-
SyscallReadString
public SyscallReadString()Build an instance of the syscall with its default service number and name.
-
-
Method Details
-
simulate
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 interfaceSyscall
- Specified by:
simulate
in classAbstractSyscall
- Parameters:
statement
- BasicStatement object for this syscall instruction.- Throws:
SimulatorException
InterruptedException
-