Class SyscallRead

java.lang.Object
mars.mips.instructions.syscalls.AbstractSyscall
mars.mips.instructions.syscalls.SyscallRead
All Implemented Interfaces:
Syscall

public class SyscallRead extends AbstractSyscall
Service to read from file descriptor given in $a0. $a1 specifies buffer and $a2 specifies length. Number of characters read is returned in $v0. (this was changed from $a0 in MARS 3.7 for SPIM compatibility. The table in COD erroneously shows $a0). *
  • Constructor Details

    • SyscallRead

      public SyscallRead()
      Build an instance of the Read file syscall. Default service number is 14 and name is "Read".
  • Method Details

    • simulate

      public void simulate(ProgramStatement statement) throws ProcessingException
      Performs syscall function to read from file descriptor given in $a0. $a1 specifies buffer and $a2 specifies length. Number of characters read is returned in $v0 (starting MARS 3.7).
      Specified by:
      simulate in interface Syscall
      Specified by:
      simulate in class AbstractSyscall
      Parameters:
      statement - ProgramStatement object for this syscall instruction.
      Throws:
      ProcessingException