qdosmsq:sbinternal:chandef

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
qdosmsq:sbinternal:chandef [2008/12/08 12:46]
george.gwilt
qdosmsq:sbinternal:chandef [2008/12/08 15:44] (current)
george.gwilt
Line 1: Line 1:
 +====== The Channel Definition Block ======
 +
 +
 +
 +
 +Whenever a channel is opened, a channel definition block is allocated in the common heap. This block contains a certain amount of information regarding said channel. Different channel types have different channel definition blocks, but all channels have the first $18 bytes defined as the block header.
 +
 +
 +===== Block Header =====
 +
 +^Offset^Size^QDOS Mnemonic^SMS Mnemonic^Description^
 +|  $00   |Long |CH_LEN |CHN_LEN |Size of this channel definition block|
 +|  $04   |Long |CH_DRIVR |CHN_DRVR |Address of the driver linkage block|
 +|  $08   |Long |CH_OWNER |CHN_OWNR |Job id of the owner of this channel|
 +|  $0C   |Long |CH_RFLAG |CHN_RFLG |See note below.|
 +|  $10   |Word |CH_TAG |CHN_TAG |Channel tag|
 +|  $12   |Byte |CH_STAT |CHN_STAT |See note below|
 +|  $13   |Byte |CH_ACTN |CHN_ACTN |Action code. (Value in D0 for last TRAP on this channel)|
 +|  $14   |Long |CH_JOBWT |CHN_JBWT |Job id of the job waiting for I/O on this channel|
 +
 +**Notes**
 +  * CH_RFLG - QDOS Companion says that  this is the location to be set when space released. SMS states that it is the location to be cleared when channel is closed.
 +
 +  * CH_STAT - There is a difference between QDOS Companion and the SMSQ documentation about CH_STAT, as follows: ​
 + 
 +^Value^QDOS Companion^SMSQ Documentation^
 +|  1  | | Waiting |
 +|  0  | Ok | OK |
 +|  -1  | A1 has been absolute | waiting AND A1 is relative A6 |
 +|  -128  | A1 passed relative to A6 | |
 +| other negatives | Waiting | |
 +
 +
 +===== Definitions =====
 +
 +
 +As stated above, different channel types have different definition blocks. The following tables give details of the different definitions.
 +
 +==== Pipe Driver ====
 +
 +^Offset^Size^QDOS Mnemonic^SMS Mnemonic^Description^
 +|  $18  |Long|CH_QIN|CHN_QIN|Pointer to input queue (or 0 if output)|
 +|  $1C  |Long|CH_QOUT|CHN_QOUT|Pointer to output queue (or 0 if input)|
 +
 +==== Directory Drivers ====
 +
 +
 +^Offset^Size^QDOS Mnemonic^SMS Mnemonic^Description^
 +|  $18  |Long|FS_NEXT|CHN_LINK|Link to next channel block|
 +|  $1C  |Byte|FS_ACCES|CHN_ACCS|Access mode (D3 on OPEN)|
 +|  $1D  |Byte|FS_DRIVE|CHN_DRID|Drive ID|
 +|  $1E  |Word|FS_FILNR|CHN_QDID|File number on drive (QDOS)|
 +|  $20  |Word|FS_NBLOCK|CHN_FPOS|Block containing next byte|
 +|  $22  |Word|FS_NBYTE||Next byte from block|
 +|  $24  |Word|FS_EBLOCK|CHN_FEOF|Block number containing byte after EOF|
 +|  $26  |Word|FS_EBYTE||Byte after EOF|
 +|  $28  |Long|FS_CBLOCK|CHN_CSB|Current slave block|
 +|  $2C  |Byte|FS_UPDT|CHN_UPDT|Set when file updated|
 +|  $2D  |Byte||CHN_USEF|File use flags|
 +|  $32  |String|FS_FNAME|CHN_NAME|Filename|
 +|  $58  |Long||CHN_DDEF|Pointer to physical definition block|
 +|  $5C  |Word||CHN_DRNR|Drive number|
 +|  $5E  |Word||CHN_FLID|File ID|
 +|  $5E  |Word||CHN_SCTL|Sector length (direct sector IO)|
 +|  $60  |$40b||CHN_OPWK|$40 bytes of working space for open|
 +|  $62  |Word||CHN_SDID|Directory ID|
 +|  $64  |Long||CHN_SDPS|Directory entry position|
 +|  $68  |Long||CHN_SDEF|Directory end of file|
 +|  $70  |$30b||CHN_SPR|Spare|
 +==== Network Driver ====
 +
 +The mnemonics are the same for SMS and QDOS
 +
 +^Offset^Size^Mnemonic^Description^
 +|  $18  |Byte|NET_HDR|Destination station number|
 +|  $19  |Byte|NET_SELF|Number of station which opened the channel|
 +|  $1A  |Byte|NET_BLKL|Lsb of data block number|
 +|  $1B  |Byte|NET_BLKH|Msb of data block number|
 +|  $1C  |Byte|NET_TYPE|Packet type: 0 for data, 1 last packet (EOF)|
 +|  $1D  |Byte|NET_NBYT|Number of bytes in data block|
 +|  $1E  |Byte|NET_DCHK|Data checksum|
 +|  $1F  |Byte|NET_HCHK|Header checksum|
 +|  $20  |$FFb|NET_DATA|Data block|
 +|  $11F  |Byte|NET_RPNT|Pointer to current position in data block|
 +
 +==== Screen Driver ====
 +
 +The mnemonics are the same for SMS and QDOS
 +
 +^Offset^Size^Mnemonic^Description^
 +|  $18  |Word|SD_XMIN|Window LHS|
 +|  $1A  |Word|SD_YMIN||
 +|  $1C  |Word|SD_XSIZE|Window size|
 +|  $1E  |Word|SD_YSIZE||
 +|  $20  |Word|SD_BORWD|Border width|
 +|  $22  |Word|SD_XPOS|Cursor position|
 +|  $24  |Word|SD_YPOS||
 +|  $26  |Word|SD_XINC|Cursor increment|
 +|  $28  |Word|SD_YINC||
 +|  $2A  |2*Long|SD_FONT|Font adresses|
 +|  $32  |Long|SD_SCRB|Base address of screen|
 +|  $36  |Long|SD_PMASK|Paper colour mask|
 +|  $3A  |Long|SD_SMASK|Strip colour mask|
 +|  $3E  |Long|SD_IMASK|Ink colour mask|
 +|  $42  |Byte|SD_CATTR|Character attributes|
 +|  $43  |Byte|SD_CURF|Cursor flag|
 +|  $44  |Byte|SD_PCOLR|Paper colour byte|
 +|  $45  |Byte|SD_SCOLR|Strip colour byte|
 +|  $46  |Byte|SD_ICOLR|Ink colour byte|
 +|  $47  |Byte|SD_BCOLR|Border colour byte|
 +|  $48  |Byte|SD_NLSTA|New line status|
 +|  $49  |Byte|SD_FMOD|Fill mode|
 +|  $4A  |Float|SD_YORG|Graphics window y-origin|
 +|  $50  |Float|SD_XORG|Graphics window x-origin|
 +|  $56  |Float|SD_SCAL|Graphics scale factor|
 +|  $5C  |Long|SD_FBUF|Pointer to fill buffer|
 +|  $60  |Long|SD_FUSE|Pointer to user defined fill vectors|
 +|  $64  |Word|SD_LINEL|Line length in bytes|
 +**Note**
 +
 +SD_CATTR has the following meanings:
 +
 +^Bit^Meaning^
 +|  0  |Underline mode|
 +|  1  |Flash (mode 8 only)|
 +|  2  |Transparent background|
 +|  3  |XOR mode|
 +|  4  |Double height characters|
 +|  5  |Extended width characters|
 +|  6  |Double width characters (or mode 8)|
 +|  7  |Graphics positioned character|
 +
 +==== Serial Ports ====
 +
 +The mnemonics are the same for SMS and QDOS
 +
 +^Offset^Size^Mnemonic^Description^
 +|  $18  |Word|SER_CHNQ|Port number|
 +|  $1A  |Word|SER_PAR|Parity:​ 0 none, 1 odd, 2 even, 3 mark, 4 space|
 +|  $1C  |Word|SER_THSX|Transmit handshake flag: <1 ignore, 0 handshake|
 +|  $1E  |Word|SER_PROT|Protocol flag: -1 for R, 0 for Z, +1 for C|
 +|  $20  |$62b|SER_RXQ|Receive queue header then queue|
 +|  $82  |$62b|SER_TXQ|Transmit queue header then queue|
 +
 +
 +===== The Pointer Environment =====
 +
 +The pointer environment further extends the channel definition block for console channels, but in a downward direction //prior// to the header block detailed above. The layout of these extra fields is as follows.
 +
 +The new format consists of the header as before then the new extra section of $30 bytes which is immediately followed by the standard screen driver block described earlier. The standard block will now, of course, be $30 bytes later. To make easy access to this block the Trap #3 routine SD_EXTOP sets the value of A0 to be $30 bytes larger than formerly. This means that programs using SD_EXTOP to access the standard block of screen channel data can use SD_EXTOP without the need to check and make allowance for the presence of the Pointer Environment.
 +
 +In the following table **Offset** is the amount to be added to A0 when SD_EXTOP is used.
 +
 +The mnemonics are those for SMS. There is no equivalent for QDOS.
 +
 +^Offset^Size^Mnemonic^Description^
 +|  -$18  |Word|SD_XHITS|x hit size|
 +|  -$16  |Word|SD_YHITS|y hit size|
 +|  -$14  |Word|SD_XHITO|x hit origin (screen co-ordinates)|
 +|  -$12  |Word|SD_YHITO|y hit origin (screen co-ordinates|
 +|  -$10  |Word|SD_XOUTS|x outline size|
 +|  -$0E  |Word|SD_YOUTS|y outline size|
 +|  -$0C  |Word|SD_XOUTO|x outline origin (screen co-ordinates)|
 +|  -$0A  |Word|SD_YOUTO|y outline origin (screen co-ordinates}|
 +|  -$08  |Long|SD_PRWLB|Primary link list bottom up (primary window)|
 +|  -$08  |Long|SD_PPRWN|Pointer to primary window (secondary window)|
 +|  -$04  |Long|SD_PRWLT|Primary link list top down (primary window)|
 +|  $00  |Long|SD_SEWLL|Secondary window list pointer|
 +|  $04  |Long|SD_WSAVE|Window save area base|
 +|  $08  |Long|SD_WSSIZ|Size of window save area|
 +|  $0C  |Long|SD_WWDEF|Pointer to window working definition|
 +|  $10  |Byte|SD_WLSTT|Window lock status|
 +|  $11  |Byte|SD_PRWIN|Primary window status|
 +|  $12  |Byte|SD_WMODE|Window mode|
 +|  $13  |Byte|SD_MYSAV|True if save area is mine|
 +|  $14  |Byte|SD_WMOVE|Window move/query flag|
 +|  $16  |Word||Border Colour (GD2)|
 +
 + ​**Notes**
 +
 +  *The window lock status (SD_WLSTT) is -1 locked, 0 unlocked and 1 no lock.
 +  *The primary window status (SD_PRWIN) has bit 7 set for a primary window and bit 0 set if managed (ie IOP_OUTL called).
 +  *The window/move query flag is D2 from IOP_RPTR.
 +  ​
 +=== GD2 Colours ===
 +
 +GD2 colour modes use one word per pixel unlike the modes 4 and 8 which can pack eight pixels into one word. This requires a re-definition of some items as follows.
 +
 +  *The paper, strip and ink colour masks in the standard block contain two colours. These differ if the colour is a stipple and are the same if not.
 +  *The bytes SD_PCOLR, SD_SCOLR and SD_ICOLR contain either the normal mode 4/8 colour or a code showing the type of stipple.
 +    *$00 is no stipple.
 +    *$20 is stipple 0.
 +    *$60 is stipple 1.
 +    *$A0 is stipple 2.
 +    *$E0 is stipple 3.
 +  *For a border, SD_BCOLR is either the mode 4/8 colour or a code showing the type of border.
 +    *$00 shows a solid GD2 colour.
 +    *$80 shows the special border.
 +  *The border colour itself, or the code if the border is special, is held in the last word in the extra block shown above.
 +
 +
 +
 +
 +
  
  • qdosmsq/sbinternal/chandef.txt
  • Last modified: 2008/12/08 15:44
  • by george.gwilt