Klasse SID

java.lang.Object
builder.resid.resid.SID
Alle implementierten Schnittstellen:
SIDChip

public final class SID extends Object implements SIDChip
MOS6581/MOS8580 emulation. Based on reSID 1.0beta by Dag Lem, ported to Java by Antti S. Lankila. Slight changes by Ken händel.
Autor:
Ken Händel, Dag Lem, Antti Lankila
  • Felddetails

    • INPUTDIGIBOOST

      private static final int INPUTDIGIBOOST
      Siehe auch:
    • NO_INPUTDIGIBOOST

      private static final int NO_INPUTDIGIBOOST
      Siehe auch:
    • OUTPUT_LEVEL

      private static final int OUTPUT_LEVEL
      Output scaler.
      Siehe auch:
    • voice

      public final Voice[] voice
      SID voices
    • filter

      private Filter filter
      Currently active filter
    • filter6581

      private final Filter6581 filter6581
      Filter used, if model is set to 6581
    • filter8580

      private final Filter8580 filter8580
      Filter used, if model is set to 8580
    • externalFilter

      private final ExternalFilter externalFilter
      External filter that provides high-pass and low-pass filtering to adjust sound tone slightly.
    • potX

      private final Potentiometer potX
      Paddle X register support
    • potY

      private final Potentiometer potY
      Paddle Y register support
    • busValue

      private byte busValue
      Last written value
    • busValueTtl

      private int busValueTtl
      Time to live for the last written value
    • databus_ttl

      private int databus_ttl
      Time to live for the last written value
    • write_address

      private int write_address
      Time to live for the last written value
    • model

      private ChipModel model
      Currently active chip model.
    • nextVoiceSync

      private int nextVoiceSync
      Time until synchronize() must be run.
    • muted

      private final boolean[] muted
  • Konstruktordetails

    • SID

      public SID()
      Constructor.
  • Methodendetails

    • kinkedDac

      static void kinkedDac(double[] dac, double _2R_div_R, boolean term)
      Estimate DAC nonlinearity. The SID contains R-2R ladder, and some likely errors in the resistor lengths which result in errors depending on the bits chosen.

      This model was derived by Dag Lem, and is port of the upcoming reSID version. In average, it shows a value higher than the target by a value that depends on the _2R_div_R parameter. It differs from the version written by Antti Lankila chiefly in the emulation of the lacking termination of the 2R ladder, which destroys the output with respect to the low bits of the DAC.

      Returns the analog value as modeled from the R-2R network.

      Parameter:
      dac - digital value to convert to analog
      _2R_div_R - nonlinearity parameter, 1.0 for perfect linearity.
      term - is the dac terminated by a 2R resistor? (6581 DACs are not)
    • setChipModel

      public void setChipModel(ChipModel model)
      Set chip model.
      Angegeben von:
      setChipModel in Schnittstelle SIDChip
      Parameter:
      model - chip model to use
    • getChipModel

      protected ChipModel getChipModel()
    • reset

      public void reset()
      SID reset.
      Angegeben von:
      reset in Schnittstelle SIDChip
    • input

      public void input(int value)
      16-bit input (EXT IN). Write 16-bit sample to audio input. NB! The caller is responsible for keeping the value within 16 bits. Note that to mix in an external audio signal, the signal should be resampled to 1MHz first to avoid sampling noise.
      Angegeben von:
      input in Schnittstelle SIDChip
      Parameter:
      value - input level to set
    • read

      public byte read(int offset)
      Read registers.

      Reading a write only register returns the last byte written to any SID register. The individual bits in this value start to fade down towards zero after a few cycles. All bits reach zero within approximately $2000 - $4000 cycles. It has been claimed that this fading happens in an orderly fashion, however sampling of write only registers reveals that this is not the case. NB! This is not correctly modeled. The actual use of write only registers has largely been made in the belief that all SID registers are readable. To support this belief the read would have to be done immediately after a write to the same register (remember that an intermediate write to another register would yield that value instead). With this in mind we return the last value written to any SID register for $2000 cycles without modeling the bit fading.

      Angegeben von:
      read in Schnittstelle SIDChip
      Parameter:
      offset - SID register to read
      Gibt zurück:
      value read from chip
    • write

      public void write(int offset, byte value)
      Write registers.
      Angegeben von:
      write in Schnittstelle SIDChip
      Parameter:
      offset - chip register to write
      value - value to write
    • mute

      public void mute(int channel, boolean mute)
      SID voice muting.
      Angegeben von:
      mute in Schnittstelle SIDChip
      Parameter:
      channel - channel to modify
      mute - is muted?
    • setClockFrequency

      public void setClockFrequency(double clockFrequency)
      Setting of clock frequency.
      Angegeben von:
      setClockFrequency in Schnittstelle SIDChip
      Parameter:
      clockFrequency - System clock frequency at Hz
    • ageBusValue

      private void ageBusValue(int n)
    • clock

      public void clock(int cycles, IntConsumer sample)
      Clock SID forward using chosen output sampling algorithm.
      Angegeben von:
      clock in Schnittstelle SIDChip
      Parameter:
      cycles - c64 clocks to clock
      sample - sample consumer
    • clock

      private int clock()
      SID clocking - 1 cycle.
    • voiceSync

      private void voiceSync(boolean sync)
      Return the number of cycles according to current parameters that it takes to reach sync.
    • getFilter6581

      public Filter6581 getFilter6581()
      Get chip's 6581 filter.
      Gibt zurück:
      filter
    • getFilter8580

      public Filter8580 getFilter8580()
      Get chip's 8580 filter.
      Gibt zurück:
      filter
    • setDigiBoost

      public void setDigiBoost(boolean digiBoost)
      Angegeben von:
      setDigiBoost in Schnittstelle SIDChip