* Kermit68K: source file K68SYS * * Author: Roberto Bagnara (Bagnara@Iboinfn.Bitnet), * Bologna University, Physics Department, July 1987. * * All rights reserved to Bologna University, Italy. * * Permission is granted to any individual or institution * to use, copy, or redistribute this software so long as * it is not sold for profit, provided this copyright * notice is retained. * * Modification History: * * Version Date Who Comments * * 1.0.00 870701 Roberto Bagnara First official release ********************************* InpChar ***************************** * * * Try to read a character from the specified logical channel. * * * * Entry conditions : D1.B logical channel number * * * * Exit conditions : D0.B character received, if any * * D1.B Completion Code (see below) * * * * CC symbol Meaning * * * * AllOk No errors, character in D0 * * BadChan Inexistent channel * * ResChan Access reserved, permission denied * * DevNotRd Device not ready (e.g. unmounted) * * NotInpCh Input impossible on this channel * * NotOpRd File not open for read * * UnrInpF Unrecoverable failure during input * * InChLost Input character lost * * InpBreak Break received on input * * BufEmpty Input buffer empty * * BufOvflw Input buffer overflow * * EndOfFil End of file reached on input * * * *********************************************************************** InpChar: RTS ********************************* OutChar ***************************** * * * Try to write a character to the specified logical channel. * * * * Entry conditions : D0.B character to write * * D1.B logical channel number * * * * Exit conditions : D0.B character just sent * * D1.B Completion Code (see below) * * * * CC symbol Meaning * * * * AllOk No errors * * BadChan Inexistent channel * * ResChan Access reserved, permission denied * * DevNotRd Device not ready (e.g. unmounted) * * NotOutCh Output impossible on this channel * * NotOpWr File not open for write * * UnrOutF Unrecoverable failure during output * * DevFull Device full, not enough space * * * *********************************************************************** OutChar: RTS ********************************* ChanCtrl **************************** * * * Performs control operations on logical channels. * * * * Entry conditions : D0.B Request Code (see below) * * * * RC symbol Meaning * * * * SetBaud Set baud rate on port * * RawMode Enable raw mode * * TextMode Enable text mode * * DoXCntrl Enable XON/XOFF protocol * * NoXCntrl Disable XON/XOFF protocol * * SndBreak Send a break over RS 232 C line * * ClrInpBf Clear input buffer * * ClrOutBf Clear output buffer * * * * D1.B channel number * * D2.L additional data (only requested * * baud rate now) * * * * Exit conditions : D0.B Completion Code (see below) * * * * CC symbol Meaning * * * * AllOk No errors * * BadChan Inexistent channel * * ResChan Access reserved, permission denied * * DevNotRd Device not ready (e.g. unmounted) * * BadCtReq I/O control request code invalid * * * *********************************************************************** ChanCtrl: RTS ********************************* SysInit ***************************** * * * Initialize any system dependent thing. * * * * Entry conditions : none * * * * Exit conditions : none * * * *********************************************************************** SysInit: RTS ********************************* SysExod ***************************** * * * Return control to system. * * * * Entry conditions : D0.B completion code, exit status * * * * Exit conditions : none * * * *********************************************************************** SysExod: ********************************** System ***************************** * * * Performs system commands. Called with a request code and 0, 1 or 2 * * null terminated argument strings, depending on request code. * * * * Entry conditions : D0.B Request Code (see below) * * * * RC symbol Meaning * * * * Directry Display a directory listing * * SpacInfo Display informations about disk usage * * DeletFil Delete file(s) * * CopyFile Copy file(s) * * ChangDir Change the default directory * * PrntFile Print file(s) * * RenamFil Rename file(s) * * TypeFile Type file(s) * * * * A0.L pointer to argument 1 (see below) * * A1.L pointer to argument 2 (see below) * * * * RC symbol Arguments number and meaning * * * * Directry 0 or 1 directory path * * SpacInfo 0 or 1 device or account name * * DeletFil 1 file name * * CopyFile 2 source and target file names * * ChangDir 0 or 1 path to new directory * * PrntFile 1 file name * * RenamFil 2 old and new file names * * TypeFile 1 file name * * * * Exit conditions : D0.B completion code * * * *********************************************************************** System: RTS ******************************** GetCmdLP ***************************** * * * Try to return a pointer to the command line, null terminated. * * * * Entry conditions : none * * * * Exit conditions : A0.L pointer to the command line, if any * * D0.B completion code * * * *********************************************************************** GetCmdLP RTS ********************************* FilOpen ***************************** * * * Open a disk file or an I/O channel. * * * * Entry conditions : D0.B Request Code (see below) * * * * RC symbol Meaning * * * * RdWrOp Open for read/write * * ReadOp Open for read * * WriteOp Open for write * * AppendOp Open for append * * * * D1.B logical channel number. * * A0.L points to file name null terminated * * * * Exit conditions : D0.B completion code * * A0.L still points to the file name * * * *********************************************************************** FilOpen: RTS ******************************** FilClose ***************************** * * * Close a disk file or an I/O channel. * * * * Entry conditions : D1.B logical channel number. * * * * Exit conditions : D0.B completion code * * * *********************************************************************** FilClose: RTS ********************************* FilDelet **************************** * * * Delete a file. * * * * Entry conditions : A0.L points to file name null terminated * * * * Exit conditions : D0.B completion code * * * *********************************************************************** FilDelet: RTS ********************************* ExpandFN **************************** * * * Expand a wildcard file name into an array of file names, returns * * the number of files that match the passed string, with data * * structures set up so that the first file name (if any) will be * * returned by the next GetNxtF call. * * * * Entry conditions : A0.L points to file name null terminated * * * * Exit conditions : D0.L number of matches found, negative * * if too many matches for user buffer * * A0.L still points to the file name * * * *********************************************************************** ExpandFN: RTS ********************************* GetNxtF ***************************** * * * Get the next file name from the list created by ExpandFN, returns * * a true completion code if there's another file, copying its name * * into the target string, or false if no more file names in list. * * * * Entry conditions : A0.L points to the target string * * * * Exit conditions : D0.B completion code * * A0.L points to the target string * * * *********************************************************************** GetNxtF: RTS ********************************* CRemTLoc **************************** * * * Convert filenames from remote system in a form suitable for the * * local system. * * * * Entry conditions : A0.L points to the string to be * * converted * * * * Exit conditions : A0.L points to the same string suitably * * converted * * * *********************************************************************** CRemTLoc: RTS ********************************* CLocTRem **************************** * * * Convert filenames in local system syntax in a form suitable for * * the remote Kermit system. The job that this routine must do is * * explained here in detail. * * * * Adapted from the "Kermit Protocol Manual", Sixth Edition, p. 16 * * * * 1. Delete all pathnames and attributes from the file * * specification. The file name should not contain directory * * or device names; if it does, it may cause the recipient to * * try to store the file in an inaccessible or nonexistent area, * * or it may result in a very strange filename. * * * * 2. After stripping any pathname, convert the remainder of the * * file specification to the form "name.type", with no * * restriction on length (except that it fit in the data field * * of the F packet), and: * * * * a. Include no more than one dot. * * b. Not begin or end with a dot. * * c. The name and type fields contain digits and uppercase * * letters only. * * * * Entry conditions : A0.L points to the string to be * * converted * * * * Exit conditions : A0.L points to the same string suitably * * converted * * * *********************************************************************** CLocTRem: RTS ********************************** NewName **************************** * * * Make a new name for the given file to avoid file name collisions. * * * * Entry conditions : A0.L points to the file name string * * * * Exit conditions : A0.L points to the same string suitably * * modified * * * *********************************************************************** NewName: RTS ********************************** Sleep ****************************** * * * Puts the process to sleep. * * * * Entry conditions : D0.B time interval to wait (seconds) * * * * Exit conditions : none * * * *********************************************************************** Sleep: RTS END