Package drivers.ser

Class InputBuffer

java.lang.Object
drivers.ser.InputBuffer

public class InputBuffer extends Object
This is a buffer that is filled in from the serial port and then input to SMSQE. This is a buffer, not a queue. The head of the queue is that element which would be removed by a call to remove() or poll(). In a FIFO queue, all new elements are inserted at the tail of the queue.
  • Constructor Summary

    Constructors
    Constructor
    Description
    InputBuffer(int psize)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    int
    fetchLine(com.fazecast.jSerialComm.SerialPort serPort, MC68000Cpu cpu, int totalToFetch)
    Fetch multiple bytes until a LF (0xA) is found.
    int
    fetchMultipleBytes(com.fazecast.jSerialComm.SerialPort serPort, MC68000Cpu cpu, int totalToFetch)
    Fetch multiple bytes.
    int
    testOrGetByte(com.fazecast.jSerialComm.SerialPort serPort, boolean get)
    return Tests to see whether there is a byte available.If yes, returns this byte (as +ve int) , but does not take it out of the buffer.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • InputBuffer

      public InputBuffer(int psize)
  • Method Details

    • clearBuffer

      public void clearBuffer()
    • testOrGetByte

      public int testOrGetByte(com.fazecast.jSerialComm.SerialPort serPort, boolean get)
      return Tests to see whether there is a byte available.If yes, returns this byte (as +ve int) , but does not take it out of the buffer.
      Parameters:
      serPort - serial port for this buffer
      get -
      Returns:
      the byte as +ive int, or -SMSQE error codes (nc or eof) if there is no byte available.
    • fetchMultipleBytes

      public int fetchMultipleBytes(com.fazecast.jSerialComm.SerialPort serPort, MC68000Cpu cpu, int totalToFetch)
      Fetch multiple bytes.
      Parameters:
      serPort - serial port whence to get bytes
      cpu -
      totalToFetch - total number of bytes (still) to fetch.
      Returns:
      SMSQE error code.
    • fetchLine

      public int fetchLine(com.fazecast.jSerialComm.SerialPort serPort, MC68000Cpu cpu, int totalToFetch)
      Fetch multiple bytes until a LF (0xA) is found. If it is preceded by a LF, remove LF.
      Parameters:
      serPort - serial port whence to get bytes
      cpu -
      totalToFetch - total number of bytes (still) to fetch.
      Returns:
      SMSQE error code.