mars.mips.instructions.syscalls
Interface Syscall

All Known Implementing Classes:
AbstractSyscall, SyscallClose, SyscallConfirmDialog, SyscallExit, SyscallExit2, SyscallInputDialogDouble, SyscallInputDialogFloat, SyscallInputDialogInt, SyscallInputDialogString, SyscallMessageDialog, SyscallMessageDialogDouble, SyscallMessageDialogFloat, SyscallMessageDialogInt, SyscallMessageDialogString, SyscallMidiOut, SyscallMidiOutSync, SyscallOpen, SyscallPrintChar, SyscallPrintDouble, SyscallPrintFloat, SyscallPrintInt, SyscallPrintIntBinary, SyscallPrintIntHex, SyscallPrintIntUnsigned, SyscallPrintString, SyscallRandDouble, SyscallRandFloat, SyscallRandInt, SyscallRandIntRange, SyscallRandSeed, SyscallRead, SyscallReadChar, SyscallReadDouble, SyscallReadFloat, SyscallReadInt, SyscallReadString, SyscallSbrk, SyscallSleep, SyscallTime, SyscallWrite

public interface Syscall

Interface for any MIPS syscall system service. A qualifying service must be a class in the mars.mips.instructions.syscalls package that implements the Syscall interface, must be compiled into a .class file, and its .class file must be in the same folder as Syscall.class. Mars will detect a qualifying syscall upon startup, create an instance using its no-argument constructor and add it to its syscall list. When its service is invoked at runtime ("syscall" instruction with its service number stored in register $v0), its simulate() method will be invoked.


Method Summary
 String getName()
          Return a name you have chosen for this syscall.
 int getNumber()
          Return the assigned service number.
 void setNumber(int num)
          Set the service number.
 void simulate(ProgramStatement statement)
          Performs syscall function.
 

Method Detail

getName

String getName()
Return a name you have chosen for this syscall. This can be used by a MARS user to refer to the service when choosing to override its default service number in the configuration file.

Returns:
service name as a string

setNumber

void setNumber(int num)
Set the service number. This is provided to allow MARS implementer or user to override the default service number.

Parameters:
num - specified service number to override the default.

getNumber

int getNumber()
Return the assigned service number. This is the number the MIPS programmer must store into $v0 before issuing the SYSCALL instruction.

Returns:
assigned service number

simulate

void simulate(ProgramStatement statement)
              throws ProcessingException
Performs syscall function. It will be invoked when the service is invoked at simulation time. Service is identified by value stored in $v0.

Parameters:
statement - ProgramStatement for this syscall statement.
Throws:
ProcessingException