qdosmsq:vectors:setq

Five Vectors for Queues

A queue allows temporary storage of a sub-set of an indeterminate number of bytes.

QDOS MnemonicSMS MnemonicVectorPurpose
IO_QSETIOQ.SETQ$DCSet a queue
IO_TESTIOQ.QTEST$DETest a queue
IO_QINIOQ.PBYT$E0Put a byte in the queue
IO_QOUTIOQ.GBYT$E2Get a byte from the queue
IO_QEOFIOQ.SEOF$E4Set EOF flag
Call ParametersReturn Parameters
D0.LUnusedD0.LError code.
D1.LQueue length/Data D1.L/BPreserved/Data
D2.LUnused D2.LPreserved/Free space
A2.LPointer to queue headerA2.LPreserved.
A3.LUnused A3.LCorrupted.
CodeVectorMeaningVectorsMeaning
ERR_NCIO_QINQueue fullIO_QOUT/IO_QTESTQueue empty
ERR_EFIO_QINEOFIO_QOUT/IO_QTESTQueue empty and EOF
  • All registers not shown above are not used on entry and are preserved on exit.
  • IO_QSET sets the header (see below) to an empty queue. The length of the queue is taken from D1.L.
  • IO_QIN puts the byte in D1.B into the queue and IO_QOUT takes a byte from the queue and puts it in D1.B. The position of these bytes in the queue is determined by the value of the appropriate pointer. After the operation the pointer is advanced to the next position by the rule:
    • New pointer = (Old pointer + 1) MOD queue_length
  • IO_QTEST puts the next byte to be read in D1.B, the free space in D2.L and tests the state of the queue. The two pointers are compared. If they are equal the queue is either empty or at EOF giving rise to the errors ERR_NC or ERR_EF.
  • IO_QEOF sets bit 31 in the first long word of the queue's header. This has the effect of preventing any further input to the queue. If the are any bytes still in the queue, they can be read. After that the queue is effectively dead.
  • The item q_nextq in the header is not used by the five vectors here described, except for bit 31 used as the EOF flag. This item can be used as a pointer to the next queue by software using these vectors.
  • The length of the queue is q_end - q_queue and the maximum number of bytes which the queue can hold at any time is one less than that.
PositionNameLengthPurpose
$00q_eoffBitEOF flag
$00q_nextqLongCan be used as pointer to next queue
$04q_endLongPointer to end of queue
$08q_nextinLongNext location for input
$0Cq_nxtoutLongNext location for output
$10q_queue -Start of queue
  • qdosmsq/vectors/setq.txt
  • Last modified: 2010/07/25 12:00
  • by george.gwilt