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 Details

    • SyscallReadString

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

    • 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