qdosmsq:sbinternal:chandef

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.

OffsetSizeQDOS MnemonicSMS MnemonicDescription
$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:
ValueQDOS CompanionSMSQ 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

As stated above, different channel types have different definition blocks. The following tables give details of the different definitions.

OffsetSizeQDOS MnemonicSMS MnemonicDescription
$18 LongCH_QINCHN_QINPointer to input queue (or 0 if output)
$1C LongCH_QOUTCHN_QOUTPointer to output queue (or 0 if input)
OffsetSizeQDOS MnemonicSMS MnemonicDescription
$18 LongFS_NEXTCHN_LINKLink to next channel block
$1C ByteFS_ACCESCHN_ACCSAccess mode (D3 on OPEN)
$1D ByteFS_DRIVECHN_DRIDDrive ID
$1E WordFS_FILNRCHN_QDIDFile number on drive (QDOS)
$20 WordFS_NBLOCKCHN_FPOSBlock containing next byte
$22 WordFS_NBYTENext byte from block
$24 WordFS_EBLOCKCHN_FEOFBlock number containing byte after EOF
$26 WordFS_EBYTEByte after EOF
$28 LongFS_CBLOCKCHN_CSBCurrent slave block
$2C ByteFS_UPDTCHN_UPDTSet when file updated
$2D ByteCHN_USEFFile use flags
$32 StringFS_FNAMECHN_NAMEFilename
$58 LongCHN_DDEFPointer to physical definition block
$5C WordCHN_DRNRDrive number
$5E WordCHN_FLIDFile ID
$5E WordCHN_SCTLSector length (direct sector IO)
$60 $40bCHN_OPWK$40 bytes of working space for open
$62 WordCHN_SDIDDirectory ID
$64 LongCHN_SDPSDirectory entry position
$68 LongCHN_SDEFDirectory end of file
$70 $30bCHN_SPRSpare

The mnemonics are the same for SMS and QDOS

OffsetSizeMnemonicDescription
$18 ByteNET_HDRDestination station number
$19 ByteNET_SELFNumber of station which opened the channel
$1A ByteNET_BLKLLsb of data block number
$1B ByteNET_BLKHMsb of data block number
$1C ByteNET_TYPEPacket type: 0 for data, 1 last packet (EOF)
$1D ByteNET_NBYTNumber of bytes in data block
$1E ByteNET_DCHKData checksum
$1F ByteNET_HCHKHeader checksum
$20 $FFbNET_DATAData block
$11F ByteNET_RPNTPointer to current position in data block

The mnemonics are the same for SMS and QDOS

OffsetSizeMnemonicDescription
$18 WordSD_XMINWindow LHS
$1A WordSD_YMIN
$1C WordSD_XSIZEWindow size
$1E WordSD_YSIZE
$20 WordSD_BORWDBorder width
$22 WordSD_XPOSCursor position
$24 WordSD_YPOS
$26 WordSD_XINCCursor increment
$28 WordSD_YINC
$2A 2*LongSD_FONTFont adresses
$32 LongSD_SCRBBase address of screen
$36 LongSD_PMASKPaper colour mask
$3A LongSD_SMASKStrip colour mask
$3E LongSD_IMASKInk colour mask
$42 ByteSD_CATTRCharacter attributes
$43 ByteSD_CURFCursor flag
$44 ByteSD_PCOLRPaper colour byte
$45 ByteSD_SCOLRStrip colour byte
$46 ByteSD_ICOLRInk colour byte
$47 ByteSD_BCOLRBorder colour byte
$48 ByteSD_NLSTANew line status
$49 ByteSD_FMODFill mode
$4A FloatSD_YORGGraphics window y-origin
$50 FloatSD_XORGGraphics window x-origin
$56 FloatSD_SCALGraphics scale factor
$5C LongSD_FBUFPointer to fill buffer
$60 LongSD_FUSEPointer to user defined fill vectors
$64 WordSD_LINELLine length in bytes

Note

SD_CATTR has the following meanings:

BitMeaning
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

The mnemonics are the same for SMS and QDOS

OffsetSizeMnemonicDescription
$18 WordSER_CHNQPort number
$1A WordSER_PARParity: 0 none, 1 odd, 2 even, 3 mark, 4 space
$1C WordSER_THSXTransmit handshake flag: <1 ignore, 0 handshake
$1E WordSER_PROTProtocol flag: -1 for R, 0 for Z, +1 for C
$20 $62bSER_RXQReceive queue header then queue
$82 $62bSER_TXQTransmit queue header then queue

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.

OffsetSizeMnemonicDescription
-$18 WordSD_XHITSx hit size
-$16 WordSD_YHITSy hit size
-$14 WordSD_XHITOx hit origin (screen co-ordinates)
-$12 WordSD_YHITOy hit origin (screen co-ordinates
-$10 WordSD_XOUTSx outline size
-$0E WordSD_YOUTSy outline size
-$0C WordSD_XOUTOx outline origin (screen co-ordinates)
-$0A WordSD_YOUTOy outline origin (screen co-ordinates}
-$08 LongSD_PRWLBPrimary link list bottom up (primary window)
-$08 LongSD_PPRWNPointer to primary window (secondary window)
-$04 LongSD_PRWLTPrimary link list top down (primary window)
$00 LongSD_SEWLLSecondary window list pointer
$04 LongSD_WSAVEWindow save area base
$08 LongSD_WSSIZSize of window save area
$0C LongSD_WWDEFPointer to window working definition
$10 ByteSD_WLSTTWindow lock status
$11 ByteSD_PRWINPrimary window status
$12 ByteSD_WMODEWindow mode
$13 ByteSD_MYSAVTrue if save area is mine
$14 ByteSD_WMOVEWindow move/query flag
$16 WordBorder 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