Klasse Datasette

java.lang.Object
libsidplay.components.c1530.Datasette

public abstract class Datasette extends Object
Implementation of a C1530 Datasette.
Autor:
Ken Händel
  • Verschachtelte Klassen - Übersicht

    Verschachtelte Klassen
    Modifizierer und Typ
    Klasse
    Beschreibung
    static enum 
    Controls of the datasette.
    static enum 
     
    protected static final class 
    Return value of method fetchGap.
  • Feldübersicht

    Felder
    Modifizierer und Typ
    Feld
    Beschreibung
    private final EventScheduler
    Event scheduler.
    private int
    Remember the reset of tape-counter.
    protected Tap
    Attached TAP tape image.
    private static final int
    At least every DATASETTE_MAX_GAP cycle there should be an alarm.
    private static final double
    Counter is c=g*(sqrt(v*t/d*pi+r^2/d^2)-r/d).
    private static final double
    Counter is c=g*(sqrt(v*t/d*pi+r^2/d^2)-r/d).
    private static final double
    Counter is c=g*(sqrt(v*t/d*pi+r^2/d^2)-r/d).
    private static final double
    Counter is c=g*(sqrt(v*t/d*pi+r^2/d^2)-r/d).
    private static final double
    Counter is c=g*(sqrt(v*t/d*pi+r^2/d^2)-r/d).
    private static final double
    Counter is c=g*(sqrt(v*t/d*pi+r^2/d^2)-r/d).
    private static final double
    Counter is c=g*(sqrt(v*t/d*pi+r^2/d^2)-r/d).
    private static final double
    Counter is c=g*(sqrt(v*t/d*pi+r^2/d^2)-r/d).
    private final Event
    Datasette event.
    private int
    Low/high wave indicator for C16 TAPs.
    private long
    Low/high wave indicator for C16 TAPs.
    private final TapeImage
    Tape image to attach/detach.
    private int
    Last datasette counter value.
    private int
    Last direction of the tape (0/+1/-1).
    protected long
    Pointer and length of the tapBuffer.
    protected long
    Last time we have recorded a flux change.
    private long
    GAP handling.
    private long
    GAP handling.
    private static final int
    Counter is c=g*(sqrt(v*t/d*pi+r^2/d^2)-r/d).
    Which mode is activated (RECORD/START/...)?
    protected boolean
    State of the datasette motor.
    private static final int
    How many cycles it takes to start the datasette motor.
    private long
    Motor stop is delayed.
    protected long
    Pointer and length of the tapBuffer.
    private final boolean
    Shall the datasette reset when the CPU does?
    private static final int
    Size of the temp. tape buffer to read from.
    private final byte[]
    Buffer for the TAP.
    private final int
    How long to wait, if a zero occurs in the tap?
  • Konstruktorübersicht

    Konstruktoren
    Konstruktor
    Beschreibung
    Constructor.
  • Methodenübersicht

    Modifizierer und Typ
    Methode
    Beschreibung
    private void
    Write bit.
    final void
    Triggered by GUI: RECORD/START...
    final void
    Eject tape image.
    private boolean
    fetchGap(Datasette.GapDir gd, long readTap)
    Fetch GAP.
    protected void
    Fast forward on tape.
    int
     
    boolean
     
    float
     
    Get a status icon to display the floppies activity.
     
    boolean
    Read state of button press.
    final void
    insertTape(File tapeFile)
    Insert a tape image into the datasette.
    protected void
    Internal reset datasette.
    private boolean
    moveBufferBack(int offset)
    reads buffer to fit the next gap-read at current_file_seek_position-1 tap_buffer[next_tap] ~ currentFileSeekPosition.
    private boolean
    moveBufferForward(int offset)
    reads buffer to fit the next gap-read tap_buffer[next_tap] ~ currentFileSeekPosition.
    protected void
    Read bit.
    private long
    readGap(int direction)
    Read GAP.
    private long
    Read GAP backward (Tape version 0).
    private long
    readGapBackwardV1(long readTap)
    Read GAP backward (Tape version 1).
    private long
    Read GAP forward.
    final void
    Reset datasette.
    protected void
    Reset counter value.
    protected void
    Rewind on tape.
    abstract void
    setFlag(boolean flag)
    Signal interrupt flag.
    final void
    setMotor(boolean flag)
    Triggered by c64pla_config_changed.
    final void
    Sets the TAP image to work with.
    protected void
    Start datasette motor.
    final void
    toggleWriteBit(boolean writeBit)
    Triggered by CPU port update at PHI2.
    protected void
    Update datasette counter value.

    Von Klasse geerbte Methoden java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Felddetails

    • MAX_COUNTER

      private static final int MAX_COUNTER
      Counter is c=g*(sqrt(v*t/d*pi+r^2/d^2)-r/d). Maximum counter value.
      Siehe auch:
    • DS_D

      private static final double DS_D
      Counter is c=g*(sqrt(v*t/d*pi+r^2/d^2)-r/d). Some constants for the Datasette-Counter.
      Siehe auch:
    • DS_R

      private static final double DS_R
      Counter is c=g*(sqrt(v*t/d*pi+r^2/d^2)-r/d). Some constants for the Datasette-Counter.
      Siehe auch:
    • DS_V_PLAY

      private static final double DS_V_PLAY
      Counter is c=g*(sqrt(v*t/d*pi+r^2/d^2)-r/d). Some constants for the Datasette-Counter.
      Siehe auch:
    • DS_G

      private static final double DS_G
      Counter is c=g*(sqrt(v*t/d*pi+r^2/d^2)-r/d). Some constants for the Datasette-Counter.
      Siehe auch:
    • DS_RPS_FAST

      private static final double DS_RPS_FAST
      Counter is c=g*(sqrt(v*t/d*pi+r^2/d^2)-r/d). At FF/REWIND, Datasette-counter makes ~4 rounds per second.
      Siehe auch:
    • DS_C1

      private static final double DS_C1
      Counter is c=g*(sqrt(v*t/d*pi+r^2/d^2)-r/d). Some constants for the Datasette-Counter.
      Siehe auch:
    • DS_C2

      private static final double DS_C2
      Counter is c=g*(sqrt(v*t/d*pi+r^2/d^2)-r/d). Some constants for the Datasette-Counter.
      Siehe auch:
    • DS_C3

      private static final double DS_C3
      Counter is c=g*(sqrt(v*t/d*pi+r^2/d^2)-r/d). Some constants for the Datasette-Counter.
      Siehe auch:
    • img

      private final TapeImage img
      Tape image to attach/detach.
    • MOTOR_DELAY

      private static final int MOTOR_DELAY
      How many cycles it takes to start the datasette motor.
      Siehe auch:
    • TAP_BUFFER_LENGTH

      private static final int TAP_BUFFER_LENGTH
      Size of the temp. tape buffer to read from.
      Siehe auch:
    • DATASETTE_MAX_GAP

      private static final int DATASETTE_MAX_GAP
      At least every DATASETTE_MAX_GAP cycle there should be an alarm.
      Siehe auch:
    • mode

      protected Datasette.Control mode
      Which mode is activated (RECORD/START/...)?
    • currentImage

      protected Tap currentImage
      Attached TAP tape image.
    • tapBuffer

      private final byte[] tapBuffer
      Buffer for the TAP.
    • nextTap

      protected long nextTap
      Pointer and length of the tapBuffer.
    • lastTap

      protected long lastTap
      Pointer and length of the tapBuffer.
    • resetDatasetteWithMainCPU

      private final boolean resetDatasetteWithMainCPU
      Shall the datasette reset when the CPU does?
    • zeroGapDelay

      private final int zeroGapDelay
      How long to wait, if a zero occurs in the tap?
    • fullwave

      private int fullwave
      Low/high wave indicator for C16 TAPs.
    • fullwaveGap

      private long fullwaveGap
      Low/high wave indicator for C16 TAPs.
    • motor

      protected boolean motor
      State of the datasette motor.
    • lastWriteClk

      protected long lastWriteClk
      Last time we have recorded a flux change.
    • motorStopClk

      private long motorStopClk
      Motor stop is delayed.
    • context

      private final EventScheduler context
      Event scheduler.
    • lastCounter

      private int lastCounter
      Last datasette counter value.
    • event

      private final Event event
      Datasette event.
    • longGapPending

      private long longGapPending
      GAP handling.
    • longGapElapsed

      private long longGapElapsed
      GAP handling.
    • lastDirection

      private int lastDirection
      Last direction of the tape (0/+1/-1).
    • counterOffset

      private int counterOffset
      Remember the reset of tape-counter.
  • Konstruktordetails

    • Datasette

      public Datasette(EventScheduler ctx)
      Constructor.
      Parameter:
      ctx - event context
  • Methodendetails

    • insertTape

      public final void insertTape(File tapeFile) throws IOException
      Insert a tape image into the datasette. A previously attached tape is ejected first.
      Parameter:
      tapeFile - filename of the tape image
      Löst aus:
      IOException - cannot read tape
    • ejectTape

      public final void ejectTape() throws IOException
      Eject tape image.
      Löst aus:
      IOException - cannot write tape image
    • updateCounter

      protected void updateCounter()
      Update datasette counter value.
    • resetCounter

      protected void resetCounter()
      Reset counter value.
    • moveBufferForward

      private boolean moveBufferForward(int offset)
      reads buffer to fit the next gap-read tap_buffer[next_tap] ~ currentFileSeekPosition.
      Parameter:
      offset - offset to move
      Gibt zurück:
      move succeeded
    • moveBufferBack

      private boolean moveBufferBack(int offset)
      reads buffer to fit the next gap-read at current_file_seek_position-1 tap_buffer[next_tap] ~ currentFileSeekPosition.
      Parameter:
      offset - offset to move
      Gibt zurück:
      move succeeded
    • fetchGap

      private boolean fetchGap(Datasette.GapDir gd, long readTap)
      Fetch GAP.
      Parameter:
      gd - IN/OUT parameters
      readTap - ?
      Gibt zurück:
      succeeded
    • readGapForward

      private long readGapForward()
      Read GAP forward.
      Gibt zurück:
      next GAP
    • readGapBackwardV0

      private long readGapBackwardV0()
      Read GAP backward (Tape version 0).
      Gibt zurück:
      previous GAP
    • readGapBackwardV1

      private long readGapBackwardV1(long readTap) throws Exception
      Read GAP backward (Tape version 1). Examine, if previous gap was long by rewinding until 3 non-zero-values in a row found, then reading forward
      Parameter:
      readTap - current tape position
      Gibt zurück:
      previous GAP
      Löst aus:
      Exception - error moving buffer position
    • readGap

      private long readGap(int direction)
      Read GAP.
      Parameter:
      direction - 1: forward, -1: rewind
      Gibt zurück:
      GAP
    • readBit

      protected void readBit()
      Read bit.
      Löst aus:
      IOException - tape image read error
    • setTapeImage

      public final void setTapeImage(Tap image) throws IOException
      Sets the TAP image to work with.
      Parameter:
      image - TAP image
      Löst aus:
      IOException - tape image read error
    • forward

      protected void forward()
      Fast forward on tape.
    • rewind

      protected void rewind()
      Rewind on tape.
    • internalReset

      protected void internalReset()
      Internal reset datasette.
      Löst aus:
      IOException - error reading TAP image
    • reset

      public final void reset()
      Reset datasette.
    • startMotor

      protected void startMotor()
      Start datasette motor.
      Löst aus:
      IOException - tape image read error
    • control

      public final void control(Datasette.Control command)
      Triggered by GUI: RECORD/START...
      Parameter:
      command - triggered datasette control
    • setMotor

      public final void setMotor(boolean flag)
      Triggered by c64pla_config_changed.
      Parameter:
      flag - motor on/off
    • bitWrite

      private void bitWrite() throws IOException
      Write bit.
      Löst aus:
      IOException - tape image write error
    • toggleWriteBit

      public final void toggleWriteBit(boolean writeBit)
      Triggered by CPU port update at PHI2.
      Parameter:
      writeBit - toggle state
    • getMotor

      public boolean getMotor()
    • getCounter

      public int getCounter()
    • getProgress

      public float getProgress()
    • getTapeSense

      public boolean getTapeSense()
      Read state of button press.
      Gibt zurück:
      The read state of a button press.
    • setFlag

      public abstract void setFlag(boolean flag)
      Signal interrupt flag.
      Parameter:
      flag - interrupt flag
    • getStatus

      public Datasette.DatasetteStatus getStatus()
      Get a status icon to display the floppies activity.
      Gibt zurück:
      icon to show
    • getTapeImage

      public TapeImage getTapeImage()