## mars.mips.instructions.syscalls
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 COD erroneously shows $a0).

Constructor Summary
`SyscallOpen()` Build an instance of the Open file syscall.

Method Summary
`void` `simulate(ProgramStatement statement)` Performs syscall function to open file name specified by $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

### SyscallOpen

    public SyscallOpen()

  Build an instance of the Open file syscall. Default service number is 13 and name is "Open".

Method Detail

### simulate

    public void simulate(ProgramStatement statement)
                  throws ProcessingException

  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` - ProgramStatement object for this syscall instruction.
  Throws:
    `ProcessingException`