;*****************************************************************************
; FILE SAMGENALL.ASM                                                       *
;                                                                            *
; COPYRIGHT 1981, 1986 CONVERGENT TECHNOLOGIES, INC. ALL RIGHTS RESERVED     *
;                                                                            *
; THIS PROGRAM IS FURNISHED UNDER A LICENSE RESTRICTING ITS USE SOLELY FOR   *
; THE OPERATION OF A DESIGNATED COMPUTER FOR A PARTICULAR PURPOSE, AND MAY   *
; NOT BE COPIED OR OTHERWISE USED WITHOUT THE PRIOR WRITTEN CONSENT OF       *
; CONVERGENT TECHNOLOGIES, INC.  TITLE TO AND OWNERSHIP OF THE PROGRAM,      *
; INCLUDING ITS SOURCE CODE, SHALL AT ALL TIMES REMAIN IN CONVERGENT         *
; TECHNOLOGIES.                                                              *
;                                                                            *
;                                                                            *
; The file SamGen.Mdf contains all of the macro definitions for the macros *
; which are contained in this file, SamGenAll.Asm.  The Sequential Access  *
; Method (SAM) implementation contained in CTOS.Lib may be reconfigured by   *
; creating a tailored SAMGEN module. First, the SAMGEN.ASM source file must  *
; be edited to reflect the new configuration. After editing, the SAMGEN.ASM  *
; file must be assembled and then the resulting object file, SAMGEN.OBJ, must*
; be included in the list of object modules at link time. Alternately, if the*
; new SAM configuration is to be the default SAM configuration, the Librarian*
; utility may be used to overwrite the SAMGEN module contained in CTOS.Lib.  *
; The default SAM configuration contained in CTOS.Lib includes disk,         *
; keyboard, video, parallel printer, null, and spooler byte streams.         *
; In addition, the user may wish to include other byte streams, e.g.         *
; communication or serial printer byte streams.                              *
;******************************************************************************;
$INCLUDE ([Sys]<Sys>samgen.mdf)
Init
$EJECT
;*****************************************************************************
; The DeviceOpen(deviceName,OpenProc) macro defines an OpenProc routine to *
; be called when OpenByteStream is called  with the deviceName specified. To *
; add an additional byte stream to the SAM configuration specified in this   *
; file, add a DeviceOpen macro to this section, defining the new deviceName  *
; and the corresponding OpenProc. To omit a byte stream, delete from this    *
; section the DeviceOpen macro associated with the byte stream to be omitted.*
; To substitute a new byte stream for an existing byte stream, replace the   *
; OpenProc parameter in the appropriate DeviceOpen macro with the new        *
; OpenProc. To add, omit, or substitute byte streams also requires editing   *
; the following sections of macros. Note that the deviceName [Disk] is a   *
; psuedo name for disk byte streams. DO NOT call OpenByteStream with the     *
; device spec [Disk].                                                      *
;                                                                            *
; To add a user written byte stream for device Foo add the following line to *
; this section                                                               *
;                                                                            *
'      DeviceOpen([Foo],OpenByteStreamFoo)                                 *
;                                                                            *
; To omit disk and spooler byte streams delete the following lines from this *
; section                                                                    *
;                                                                            *
'      DeviceOpen([Spl],OpenByteStreamSpl)                                 *
'      DeviceOpen([Disk],OpenByteStreamAD)                                 *
;                                                                            *
; To substitute synchronous byte streams for asynchronous byte streams       *
; replace                                                                    *
;                                                                            *
'      DeviceOpen([Disk],OpenByteStreamAD)                                 *
;                                                                            *
;       with                                                                 *
;                                                                            *
'      DeviceOpen([Disk],OpenByteStreamSD)                                 *
;                                                                            *
;  If you know that you are going to use the 8251 chips on the MegaFrame,    *
;  then replace                                                              *
;                                                                            *
'      DeviceOpen([Comm],OpenByteStreamC)                                  *
'      DeviceOpen([Ptr],OpenByteStreamPtr)                                 *
;                                                                            *
;       with                                                                 *
;                                                                            *
'      DeviceOpen([Comm],OpenByteStream_8251)                              *
'      DeviceOpen([Ptr],OpenByteStreamPtr_8251)                            *
;                                                                            *
;  And delete the DeviceOpen for [8251]                                      *
;                                                                            *
;*****************************************************************************
;
DeviceOpen([Kbd],OpenByteStreamK)
DeviceOpen([Vid],OpenByteStreamVid)
DeviceOpen([Lpt],OpenByteStreamLpt)
DeviceOpen([Ptr],OpenByteStreamPtr)
DeviceOpen([Nul],OpenByteStreamN)
DeviceOpen([Comm],OpenByteStreamC)
DeviceOpen([8251],OpenByteStream_8251)
DeviceOpen([Spl],OpenByteStreamSpl)
DeviceOpen([Disk],OpenByteStreamAD)
DeviceOpen([Gpam],OpenByteStreamGp)

; To add 12 inch Tape or Qic bytestreams, remove the leading percentsignquote
; from the following lines:
;
'     DeviceOpen([Qic],OpenByteStreamQic)
'     DeviceOpen([Tape],OpenByteStreamTape)

$EJECT
;*****************************************************************************
; The tagProcs(tagName,FillBufferProc,FlushBufferProc,CheckPointProc,       *
;               ReleaseProc,SetImageModeProc) macro declares five           *
; device dependent procedures to be called when the various device           *
; independent procedures (ReadByte and ReadBsRecord, Writebyte and           *
; WriteBsRecord, CheckPointBs and ReleaseByteStream, and                     *
; SetImageMode) are called.                                                  *
;                                                                            *
; Note that tagProcs replaces an earlier macro called tagProc,           *
; in 10.0 CTOS and earlier.  tagProc is still defined in SamGen.mdf        *
; to avoid breaking existing usercustomized SamGen files.  Be careful       *
; to use tagProcs exclusively in all new SamGen files, and never           *
; to mix these two macros in a single file                                  *
;                                                                            *
; The tagName parameter is declared as a PUBLIC BYTE and is given a          *
; value. This value is used to route the device independent calls to         *
; the apppropriate device dependent routines.  The appropriate tag           *
; should be declared as an EXTERNAL BYTE within the OpenProc procedure       *
; and the tag byte of the BSWA should be assigned this tag value.            *
;                                                                            *
; To add an additional byte stream to the SAM configuration specified        *
; in this file, add to this section a tagProcs macro for each access         *
; mode associated with the new byte stream, declaring the five device        *
; dependent procedures to be used when a device independent procedure        *
; (ReadByte and ReadBsRecord, Writebyte and WriteBsRecord, CheckPointBs,     *
; ReleaseByteStream, and SetImageMode) is called.  In some cases not         *
; all five entries will apply.  For example, if SetImageMode does            *
; not apply, use the name SetImageModeIllegal.  To omit a byte stream,       *
; delete from this section all the tagProcs macros associated with the       *
; byte stream to be deleted.  To substitute a new byte stream for an         *
; existing byte stream, replace the five device dependent procedures         *
; declared in the tagProcs macros with the new procedure names. To add,      *
; omit, or substitute byte streams also requires editing the previous        *
; section of macros and the following section of macros.                     *
;                                                                            *
; To add a byte stream for device Foo, which can be opened with mode         *
; read or mode write, add the following lines to this section:               *
;                                                                            *
'     tagProcs(tagFooRead,FillBufferFoo,FlushBufIllegal,CheckPointBsFoo,ReleaseByteStreamFoo,SetImageModeFoo)
'     tagProcs(tagFooWrite,FillBufIllegal,FlushBufferFoo,CheckPointBsFoo,ReleaseByteStreamFoo,SetImageModeFoo)
;
; To omit disk and spooler byte streams delete the following lines
; from this section:
;
'     tagProcs(tagDiskRead,FillBufferAD,FlushBufIllegal,CheckPointBsAD,ReleaseByteStreamAD,SetImageModeIllegal)
'     tagProcs(tagDiskWrite,FillBufIllegal,FlushBufferAD,CheckPointBsAD,ReleaseByteStreamAD,SetImageModeIllegal)
'     tagProcs(tagDiskModify,FillBufferAD,FlushBufferAD,CheckPointBsAD,ReleaseByteStreamAD,SetImageModeIllegal)
'     tagProcs(tagSplWrite,FillBufIllegal,FlushBufferAD,CheckpointBsAD,ReleaseByteStreamSpl,SetImageModeSpl)
;
; To substitute synchronous disk byte streams for asynchronous disk byte
; streams replace:
;
'     tagProcs(tagDiskRead,FillBufferAD,FlushBufIllegal,CheckPointBsAD,ReleaseByteStreamAD,SetImageModeIllegal)
'     tagProcs(tagDiskWrite,FillBufIllegal,FlushBufferAD,CheckPointBsAD,ReleaseByteStreamAD,SetImageModeIllegal)
'     tagProcs(tagDiskModify,FillBufferAD,FlushBufferAD,CheckPointBsAD,ReleaseByteStreamAD,SetImageModeIllegal)
'     tagProcs(tagSplWrite,FillBufIllegal,FlushBufferAD,CheckpointBsAD,ReleaseByteStreamSpl,SetImageModeSpl)
'     tagProcs(tagGpamWrite,FillBufIllegal,FlushBufferGp,CheckPointBsGp,ReleaseByteStreamGp,SetImageModeGp)
;
;      with
;
'     tagProcs(tagDiskRead,FillBufferSD,FlushBufIllegal,CheckPointBsSD,ReleaseByteStreamSD,SetImageModeIllegal)
'     tagProcs(tagDiskWrite,FillBufIllegal,FlushBufferSD,CheckPointBsSD,ReleaseByteStreamSD,SetImageModeIllegal)
'     tagProcs(tagDiskModify,FillBufferSD,FlushBufferSD,CheckPointBsSD,ReleaseByteStreamSD,SetImageModeIllegal)
'     tagProcs(tagSplWrite,FillBufIllegal,FlushBufferSD,CheckpointBsSD,ReleaseByteStreamSpl,SetImageModeSpl)
;
;*****************************************************************************
;
tagProcs(tagDiskRead,FillBufferAD,FlushBufIllegal,CheckPointBsAD,ReleaseByteStreamAD,SetImageModeIllegal)
tagProcs(tagDiskWrite,FillBufIllegal,FlushBufferAD,CheckPointBsAD,ReleaseByteStreamAD,SetImageModeIllegal)
tagProcs(tagDiskModify,FillBufferAD,FlushBufferAD,CheckPointBsAD,ReleaseByteStreamAD,SetImageModeIllegal)
tagProcs(tagKbdRead,FillBufferK,FlushBufIllegal,ChkptNop,ReleaseEasy,SetImageModeIllegal)
tagProcs(tagVideoWrite,FillBufIllegal,FlushBufferVid,ChkptNop,ReleaseEasy,SetImageModeIllegal)
tagProcs(tagLptWrite,FillBufIllegal,FlushBufferLpt,CheckPointBsLpt,ReleaseByteStreamLpt,SetImageModeLpt)
tagProcs(tagLptRead,FillBufferLpt,FlushBufIllegal,CheckPointBsLpt,ReleaseByteStreamLpt,SetImageModeIllegal)
tagProcs(tagLptModify,FillBufferLpt,FlushBufferLpt,CheckPointBsLpt,ReleaseByteStreamLpt,SetImageModeLpt)
tagProcs(tagPtrWrite,FillBufIllegal,FlushBufferC,CheckPointBsC,ReleaseByteStreamC,SetImageModeC)
tagProcs(tagNul,FillBufferN,FlushBufferN,ChkptNop,ReleaseEasy,SetImageModeIllegal)
tagProcs(tagCommRead,FillBufferC,FlushBufIllegal,CheckPointBsC,ReleaseByteStreamC,SetImageModeC)
tagProcs(tagCommWrite,FillBufIllegal,FlushBufferC,CheckPointBsC,ReleaseByteStreamC,SetImageModeC)
tagProcs(tagCommModify,FillBufferC,FlushBufferC,CheckPointBsC,ReleaseByteStreamC,SetImageModeC)
tagProcs(tag8251Read,FillBuffer_8251,FlushBufIllegal,CheckPointBs_8251,ReleaseByteStream_8251,SetImageModeC)
tagProcs(tag8251Write,FillBufIllegal,FlushBuffer_8251,CheckPointBs_8251,ReleaseByteStream_8251,SetImageModeC)
tagProcs(tag8251Modify,FillBuffer_8251,FlushBuffer_8251,CheckPointBs_8251,ReleaseByteStream_8251,SetImageModeC)
tagProcs(tagPtr8251Write,FillBufIllegal,FlushBuffer_8251,CheckPointBs_8251,ReleaseByteStream_8251,SetImageModeC)
tagProcs(tagSplWrite,FillBufIllegal,FlushBufferAD,CheckPointBsAD,ReleaseByteStreamSpl,SetImageModeSpl)
tagProcs(tagGpamWrite,FillBufIllegal,FlushBufferGp,CheckPointBsGp,ReleaseByteStreamGp,SetImageModeGP)


; To add 12 inch Tape or Qic bytestreams, remove the leading percentsignquote
; from the following lines:
;
'     tagProcs(tagQicRead,FillBufferQic,FlushBufIllegal,ChkptNop,ReleaseByteStreamQic,SetImageModeIllegal)
'     tagProcs(tagQicWrite,FillBufIllegal,FlushBufferQic,chkptNop,ReleaseBytestreamQic,SetImageModeIllegal)
'     tagProcs(tagTapeRead,FillBufferTape,FlushBufIllegal,ChkptNop,ReleaseByteStreamTape,SetImageModeIllegal)
'     tagProcs(tagTapeWrite,FillBufIllegal,FlushBufferTape,chkptNop,ReleaseBytestreamTape,SetImageModeIllegal)

;
$EJECT
;*****************************************************************************
; The DevDepProc(devDepCall,devDepProc) macro declares a routine devDepProc*
; to be called when the device dependent routine devDepCall is called. This  *
; macros allows for substitution of alternate routines to handle any device  *
; dependent byte stream routines defined (such as QueryVidBs, GetBsLfa,      *
; SetBsLfa, or SetImageMode) or the omission of any device dependent routines*
; not needed.                                                                *
;                                                                            *
; To substitue synchronous disk byte stream implementations of the device    *
; dependent routines GetBsLfa and SetBsLfa for the asynchronous              *
; implementations, replace                                                   *
;                                                                            *
'     DevDepProc(GetBsLfa,GetBsLfaAsync)                                   *
'     DevDepProc(SetBsLfa,SetBsLfaAsync)                                   *
;                                                                            *
;      with                                                                  *
;                                                                            *
'     DevDepProc(GetBsLfa,GetBsLfaSync)                                    *
'     DevDepProc(SetBsLfa,SetBsLfaSync)                                    *
;                                                                            *
; To omit the device dependent routine QueryVidBs delete the following       *
; line                                                                       *
;                                                                            *
'     DevDepProc(QueryVidBs,QueryVideoBs)                                  *
;                                                                            *
;*****************************************************************************
;
DevDepProc(QueryVidBs,QueryVideoBs)
DevDepProc(GetBsLfa,GetBsLfaAsync)
DevDepProc(SetBsLfa,SetBsLfaAsync)
DevDepProc(SetImageMode,SetImageModeBrn)
Final
,FlushBufferSD,CheckPointBsSD,ReleaseByteStreamSD,SetImageModeIllegal)
'     tagProcs(tagDiskModify,Fill