Class SyscallMidiOut

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

public class SyscallMidiOut extends AbstractSyscall
Service to output simulated MIDI tone to sound card. The call returns immediately upon generating the tone. By contrast, syscall 33 (MidiOutSync) does not return until tone duration has elapsed.
  • Constructor Details

    • SyscallMidiOut

      public SyscallMidiOut()
      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 send MIDI output to sound card. This requires four arguments in registers $a0 through $a3.
      $a0 - pitch (note). Integer value from 0 to 127, with 60 being middle-C on a piano.
      $a1 - duration. Integer value in milliseconds.
      $a2 - instrument. Integer value from 0 to 127, with 0 being acoustic grand piano.
      $a3 - volume. Integer value from 0 to 127.
      Default values, in case any parameters are outside the above ranges, are $a0=60, $a1=1000, $a2=0, $a3=100.
      See MARS documentation elsewhere or www.midi.org for more information. Note that the pitch, instrument and volume value ranges 0-127 are from javax.sound.midi; actual MIDI instruments use the range 1-128.
      Specified by:
      simulate in interface Syscall
      Specified by:
      simulate in class AbstractSyscall
      Parameters:
      statement - BasicStatement object for this syscall instruction.
      Throws:
      SimulatorException