This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
qdosmsq:vectors:setq [2010/07/23 17:11]
george.gwilt Complete creation.
qdosmsq:vectors:setq [2010/07/25 11:00] (current)
george.gwilt Correct headings of Queue Header
Line 1: Line 1:
 +======Five Vectors for Queues======
 +A queue allows temporary storage of a sub-set of an indeterminate number of bytes.
 +==== Vectors ====
 +^QDOS Mnemonic^SMS Mnemonic^Vector^Purpose^
 +|IO_QSET|IOQ.SETQ|$DC|Set a queue|
 +|IO_TEST|IOQ.QTEST|$DE|Test a queue|
 +|IO_QIN|IOQ.PBYT|$E0|Put a byte in the queue|
 +|IO_QOUT|IOQ.GBYT|$E2|Get a byte from the queue|
 +|IO_QEOF|IOQ.SEOF|$E4|Set EOF flag|
 +==== Parameters ====
 +^Call Parameters^^Return Parameters^^
 +|D0.L|Unused|D0.L|Error code.|
 +|D1.L|Queue length/Data |D1.L/B|Preserved/Data|
 +|D2.L|Unused |D2.L|Preserved/Free space|
 +|A2.L|Pointer to queue header|A2.L|Preserved.|
 +|A3.L|Unused |A3.L|Corrupted.|
 +==== Errors ====
 +|ERR_NC|IO_QIN|Queue full|IO_QOUT/IO_QTEST|Queue empty|
 +===== Notes =====
 +  * 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.
 +==== Queue Header ====
 +|$00|q_eoff|Bit|EOF flag|
 +|$00|q_nextq|Long|Can be used as pointer to next queue|
 +|$04|q_end|Long|Pointer to end of queue|
 +|$08|q_nextin|Long|Next location for input|
 +|$0C|q_nxtout|Long|Next location for output|
 +|$10|q_queue| -|Start of queue| 
  • qdosmsq/vectors/setq.txt
  • Last modified: 2010/07/25 11:00
  • by george.gwilt