Class SyscallOpen

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

public class SyscallOpen extends AbstractSyscall
Service to open file name specified by $a0. File descriptor returned in $v0. (This was changed from $a0 in MARS 3.7 for SPIM compatibility. The table in the Computer Organization and Design book erroneously shows $a0.)
  • Constructor Details

    • SyscallOpen

      public SyscallOpen()
      Build an instance of the syscall with its default service number and name.
  • Method Details

    • simulate

      public void simulate(BasicStatement statement) throws SimulatorException
      Performs syscall function to open file name specified by $a0. File descriptor returned in $v0. Only supported flags ($a1) are read-only (0), write-only (1) and write-append (9). write-only flag creates file if it does not exist, so it is technically write-create. write-append will start writing at end of existing file. Mode ($a2) is ignored.
      Specified by:
      simulate in interface Syscall
      Specified by:
      simulate in class AbstractSyscall
      Parameters:
      statement - BasicStatement object for this syscall instruction.
      Throws:
      SimulatorException