mars.mips.instructions.syscalls
Class SyscallReadString

java.lang.Object
  extended by mars.mips.instructions.syscalls.AbstractSyscall
      extended by 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 mars.mips.instructions.syscalls.AbstractSyscall
getName, getNumber, setNumber
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SyscallReadString

public SyscallReadString()
Build an instance of the Read String syscall. Default service number is 8 and name is "ReadString".

Method Detail

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