home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / os968ka / k6gsys.asm < prev    next >
Assembly Source File  |  2020-01-01  |  20KB  |  320 lines

  1. *         Kermit68K: source file K68SYS
  2. *
  3. * Author: Roberto Bagnara (Bagnara@Iboinfn.Bitnet),
  4. * Bologna University, Physics Department, July 1987.
  5. *
  6. * All rights reserved to Bologna University, Italy.
  7. *
  8. * Permission is granted to any individual or institution
  9. * to use, copy, or redistribute this software so long as
  10. * it  is not  sold for  profit, provided  this copyright
  11. * notice is retained.
  12. *
  13. * Modification History:
  14. *
  15. * Version  Date    Who              Comments
  16. *
  17. * 1.0.00   870701  Roberto Bagnara  First official release
  18.  
  19. ********************************* InpChar *****************************
  20. *                                                                     *
  21. *  Try to read a character from the specified logical channel.        *
  22. *                                                                     *
  23. *         Entry conditions : D1.B logical channel number              *
  24. *                                                                     *
  25. *         Exit  conditions : D0.B character received, if any          *
  26. *                            D1.B Completion Code (see below)         *
  27. *                                                                     *
  28. *              CC symbol        Meaning                               *
  29. *                                                                     *
  30. *              AllOk            No errors, character in D0            *
  31. *              BadChan          Inexistent channel                    *
  32. *              ResChan          Access reserved, permission denied    *
  33. *              DevNotRd         Device not ready (e.g. unmounted)     *
  34. *              NotInpCh         Input impossible on this channel      *
  35. *              NotOpRd          File not open for read                *
  36. *              UnrInpF          Unrecoverable failure during input    *
  37. *              InChLost         Input character lost                  *
  38. *              InpBreak         Break received on input               *
  39. *              BufEmpty         Input buffer empty                    *
  40. *              BufOvflw         Input buffer overflow                 *
  41. *              EndOfFil         End of file reached on input          *
  42. *                                                                     *
  43. ***********************************************************************
  44. InpChar:  RTS
  45.  
  46. ********************************* OutChar *****************************
  47. *                                                                     *
  48. *  Try to write a character to the specified logical channel.         *
  49. *                                                                     *
  50. *         Entry conditions : D0.B character to write                  *
  51. *                            D1.B logical channel number              *
  52. *                                                                     *
  53. *         Exit  conditions : D0.B character just sent                 *
  54. *                            D1.B Completion Code (see below)         *
  55. *                                                                     *
  56. *              CC symbol        Meaning                               *
  57. *                                                                     *
  58. *              AllOk            No errors                             *
  59. *              BadChan          Inexistent channel                    *
  60. *              ResChan          Access reserved, permission denied    *
  61. *              DevNotRd         Device not ready (e.g. unmounted)     *
  62. *              NotOutCh         Output impossible on this channel     *
  63. *              NotOpWr          File not open for write               *
  64. *              UnrOutF          Unrecoverable failure during output   *
  65. *              DevFull          Device full, not enough space         *
  66. *                                                                     *
  67. ***********************************************************************
  68. OutChar:  RTS
  69.  
  70. ********************************* ChanCtrl ****************************
  71. *                                                                     *
  72. *  Performs control operations on logical channels.                   *
  73. *                                                                     *
  74. *         Entry conditions : D0.B Request Code (see below)            *
  75. *                                                                     *
  76. *              RC symbol        Meaning                               *
  77. *                                                                     *
  78. *              SetBaud          Set baud rate on port                 *
  79. *              RawMode          Enable raw mode                       *
  80. *              TextMode         Enable text mode                      *
  81. *              DoXCntrl         Enable XON/XOFF protocol              *
  82. *              NoXCntrl         Disable XON/XOFF protocol             *
  83. *              SndBreak         Send a break over RS 232 C line       *
  84. *              ClrInpBf         Clear input buffer                    *
  85. *              ClrOutBf         Clear output buffer                   *
  86. *                                                                     *
  87. *                            D1.B channel number                      *
  88. *                            D2.L additional data (only requested     *
  89. *                                 baud rate now)                      *
  90. *                                                                     *
  91. *         Exit  conditions : D0.B Completion Code (see below)         *
  92. *                                                                     *
  93. *              CC symbol        Meaning                               *
  94. *                                                                     *
  95. *              AllOk            No errors                             *
  96. *              BadChan          Inexistent channel                    *
  97. *              ResChan          Access reserved, permission denied    *
  98. *              DevNotRd         Device not ready (e.g. unmounted)     *
  99. *              BadCtReq         I/O control request code invalid      *
  100. *                                                                     *
  101. ***********************************************************************
  102. ChanCtrl: RTS
  103.  
  104. ********************************* SysInit *****************************
  105. *                                                                     *
  106. *  Initialize any system dependent thing.                             *
  107. *                                                                     *
  108. *         Entry conditions : none                                     *
  109. *                                                                     *
  110. *         Exit  conditions : none                                     *
  111. *                                                                     *
  112. ***********************************************************************
  113. SysInit:  RTS
  114.  
  115. ********************************* SysExod *****************************
  116. *                                                                     *
  117. *  Return control to system.                                          *
  118. *                                                                     *
  119. *         Entry conditions : D0.B completion code, exit status        *
  120. *                                                                     *
  121. *         Exit  conditions : none                                     *
  122. *                                                                     *
  123. ***********************************************************************
  124. SysExod:
  125.  
  126. ********************************** System *****************************
  127. *                                                                     *
  128. *  Performs system commands. Called with a request code and 0, 1 or 2 *
  129. *  null terminated argument strings, depending on request code.       *
  130. *                                                                     *
  131. *         Entry conditions : D0.B Request Code (see below)            *
  132. *                                                                     *
  133. *         RC symbol             Meaning                               *
  134. *                                                                     *
  135. *         Directry              Display a directory listing           *
  136. *         SpacInfo              Display informations about disk usage *
  137. *         DeletFil              Delete file(s)                        *
  138. *         CopyFile              Copy file(s)                          *
  139. *         ChangDir              Change the default directory          *
  140. *         PrntFile              Print file(s)                         *
  141. *         RenamFil              Rename file(s)                        *
  142. *         TypeFile              Type file(s)                          *
  143. *                                                                     *
  144. *                            A0.L pointer to argument 1 (see below)   *
  145. *                            A1.L pointer to argument 2 (see below)   *
  146. *                                                                     *
  147. *         RC symbol             Arguments number and meaning          *
  148. *                                                                     *
  149. *         Directry              0 or 1  directory path                *
  150. *         SpacInfo              0 or 1  device or account name        *
  151. *         DeletFil              1       file name                     *
  152. *         CopyFile              2       source and target file names  *
  153. *         ChangDir              0 or 1  path to new directory         *
  154. *         PrntFile              1       file name                     *
  155. *         RenamFil              2       old and new file names        *
  156. *         TypeFile              1       file name                     *
  157. *                                                                     *
  158. *         Exit  conditions : D0.B completion code                     *
  159. *                                                                     *
  160. ***********************************************************************
  161. System:   RTS
  162.  
  163. ******************************** GetCmdLP *****************************
  164. *                                                                     *
  165. *  Try to return a pointer to the command line, null terminated.      *
  166. *                                                                     *
  167. *         Entry conditions : none                                     *
  168. *                                                                     *
  169. *         Exit  conditions : A0.L pointer to the command line, if any *
  170. *                            D0.B completion code                     *
  171. *                                                                     *
  172. ***********************************************************************
  173. GetCmdLP  RTS
  174.  
  175. ********************************* FilOpen *****************************
  176. *                                                                     *
  177. *  Open a disk file or an I/O channel.                                *
  178. *                                                                     *
  179. *         Entry conditions : D0.B Request Code (see below)            *
  180. *                                                                     *
  181. *              RC symbol        Meaning                               *
  182. *                                                                     *
  183. *              RdWrOp           Open for read/write                   *
  184. *              ReadOp           Open for read                         *
  185. *              WriteOp          Open for write                        *
  186. *              AppendOp         Open for append                       *
  187. *                                                                     *
  188. *                            D1.B logical channel number.             *
  189. *                            A0.L points to file name null terminated *
  190. *                                                                     *
  191. *         Exit  conditions : D0.B completion code                     *
  192. *                            A0.L still points to the file name       *
  193. *                                                                     *
  194. ***********************************************************************
  195. FilOpen:  RTS
  196.  
  197. ******************************** FilClose *****************************
  198. *                                                                     *
  199. *  Close a disk file or an I/O channel.                               *
  200. *                                                                     *
  201. *         Entry conditions : D1.B logical channel number.             *
  202. *                                                                     *
  203. *         Exit  conditions : D0.B completion code                     *
  204. *                                                                     *
  205. ***********************************************************************
  206. FilClose: RTS
  207.  
  208. ********************************* FilDelet ****************************
  209. *                                                                     *
  210. *  Delete a file.                                                     *
  211. *                                                                     *
  212. *         Entry conditions : A0.L points to file name null terminated *
  213. *                                                                     *
  214. *         Exit  conditions : D0.B completion code                     *
  215. *                                                                     *
  216. ***********************************************************************
  217. FilDelet: RTS
  218.  
  219. ********************************* ExpandFN ****************************
  220. *                                                                     *
  221. *  Expand a wildcard file name into an array of file names, returns   *
  222. *  the number of files that match the passed string, with data        *
  223. *  structures set up so that the first file name (if any) will be     *
  224. *  returned by the next GetNxtF call.                                 *
  225. *                                                                     *
  226. *         Entry conditions : A0.L points to file name null terminated *
  227. *                                                                     *
  228. *         Exit  conditions : D0.L number of matches found, negative   *
  229. *                                 if too many matches for user buffer *
  230. *                            A0.L still points to the file name       *
  231. *                                                                     *
  232. ***********************************************************************
  233. ExpandFN: RTS
  234.  
  235. ********************************* GetNxtF *****************************
  236. *                                                                     *
  237. *  Get the next file name from the list created by ExpandFN, returns  *
  238. *  a true completion code if there's another file, copying its name   *
  239. *  into the target string, or false if no more file names in list.    *
  240. *                                                                     *
  241. *         Entry conditions : A0.L points to the target string         *
  242. *                                                                     *
  243. *         Exit  conditions : D0.B completion code                     *
  244. *                            A0.L points to the target string         *
  245. *                                                                     *
  246. ***********************************************************************
  247. GetNxtF:  RTS
  248.  
  249. ********************************* CRemTLoc ****************************
  250. *                                                                     *
  251. *  Convert filenames from remote system in a form suitable for the    *
  252. *  local system.                                                      *
  253. *                                                                     *
  254. *         Entry conditions : A0.L points to the string to be          *
  255. *                                 converted                           *
  256. *                                                                     *
  257. *         Exit  conditions : A0.L points to the same string suitably  *
  258. *                                 converted                           *
  259. *                                                                     *
  260. ***********************************************************************
  261. CRemTLoc: RTS
  262.  
  263. ********************************* CLocTRem ****************************
  264. *                                                                     *
  265. *  Convert filenames in local system syntax in a form suitable for    *
  266. *  the remote Kermit system. The job that this routine must do is     *
  267. *  explained here in detail.                                          *
  268. *                                                                     *
  269. *  Adapted from the "Kermit Protocol Manual", Sixth Edition, p. 16    *
  270. *                                                                     *
  271. *   1. Delete all pathnames and attributes from the file              *
  272. *      specification. The file name should not contain directory      *
  273. *      or device names; if it does, it may cause the recipient to     *
  274. *      try to store the file in an inaccessible or nonexistent area,  *
  275. *      or it may result in a very strange filename.                   *
  276. *                                                                     *
  277. *   2. After stripping any pathname, convert the remainder of the     *
  278. *      file specification to the form "name.type", with no            *
  279. *      restriction on length (except that it fit in the data field    *
  280. *      of the F packet), and:                                         *
  281. *                                                                     *
  282. *         a. Include no more than one dot.                            *
  283. *         b. Not begin or end with a dot.                             *
  284. *         c. The name and type fields contain digits and uppercase    *
  285. *            letters only.                                            *
  286. *                                                                     *
  287. *         Entry conditions : A0.L points to the string to be          *
  288. *                                 converted                           *
  289. *                                                                     *
  290. *         Exit  conditions : A0.L points to the same string suitably  *
  291. *                                 converted                           *
  292. *                                                                     *
  293. ***********************************************************************
  294. CLocTRem: RTS
  295.  
  296. ********************************** NewName ****************************
  297. *                                                                     *
  298. *  Make a new name for the given file to avoid file name collisions.  *
  299. *                                                                     *
  300. *         Entry conditions : A0.L points to the file name string      *
  301. *                                                                     *
  302. *         Exit  conditions : A0.L points to the same string suitably  *
  303. *                                 modified                            *
  304. *                                                                     *
  305. ***********************************************************************
  306. NewName:  RTS
  307.  
  308. ********************************** Sleep ******************************
  309. *                                                                     *
  310. *  Puts the process to sleep.                                         *
  311. *                                                                     *
  312. *         Entry conditions : D0.B time interval to wait (seconds)     *
  313. *                                                                     *
  314. *         Exit  conditions : none                                     *
  315. *                                                                     *
  316. ***********************************************************************
  317. Sleep:    RTS
  318.  
  319.           END
  320.