Package mars.mips.instructions.syscalls
Class SyscallOpen
java.lang.Object
mars.mips.instructions.syscalls.AbstractSyscall
mars.mips.instructions.syscalls.SyscallOpen
- All Implemented Interfaces:
Syscall
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 Summary
ConstructorsConstructorDescriptionBuild an instance of the syscall with its default service number and name. -
Method Summary
Modifier and TypeMethodDescriptionvoid
simulate
(BasicStatement statement) Performs syscall function to open file name specified by $a0.Methods inherited from class mars.mips.instructions.syscalls.AbstractSyscall
getName, getNumber, setNumber
-
Constructor Details
-
SyscallOpen
public SyscallOpen()Build an instance of the syscall with its default service number and name.
-
-
Method Details
-
simulate
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 interfaceSyscall
- Specified by:
simulate
in classAbstractSyscall
- Parameters:
statement
- BasicStatement object for this syscall instruction.- Throws:
SimulatorException
-