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

  1. *         Kermit68K: source file K68DEF
  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. * ??????   ??????  Steve Williams   Modified for OS9 (see below)
  19.  
  20. *  This file is adapted in a very straightforward manner from the original
  21. *  k68def.src file.
  22. *
  23. *  Since the OS-9 assembler will not allow the declaration of labels inside
  24. *  a macro definition (ala the'\3 equ VarIndex' used previously) the do.b,
  25. *  do.w, and do.l pseudo instructions are used instead.  These perform a
  26. *  very similiar offset definition function.
  27. *
  28. *  This file has been converted to its own psect for the following reasons:
  29. *
  30. *  1.  It makes defining the dependencies in the make utility makefile much
  31. *      easier, since each object file depends on only one source file.
  32. *
  33. *  2.  It greatly decreases the development cycle time by reducing the disk
  34. *      accesses needed during reassembly.
  35. *
  36. *  3.  The OS-9 symobolic debugger needs global symbols in order to provide
  37. *      meaningful interpretation of programs being debugged.
  38.  
  39. Edition   set       1
  40.           psect     K68Definitions,0,0,Edition,0,0
  41.  
  42. *         Truth values
  43.  
  44. True:     EQU      -1                  True value, in the sense of Scc opcode
  45. False:    EQU       0                  False value, in the sense of Scc opcode
  46.  
  47. *         ASCII control characters
  48.  
  49. Asc_Nul:  EQU       0                  Nul or tape feed
  50. Asc_SOH:  EQU       1                  Start of heading
  51. Asc_STx:  EQU       2                  Start of text
  52. Asc_ETx:  EQU       3                  End of text
  53. Asc_EOT:  EQU       4                  End of transmission
  54. Asc_Enq:  EQU       5                  Enquire
  55. Asc_Ack:  EQU       6                  Acknowledge
  56. Asc_Bel:  EQU       7                  Bell
  57. Asc_BS:   EQU       8                  Backspace
  58. Asc_HT:   EQU       9                  Horizontal tab
  59. Asc_LF:   EQU      10                  Line feed
  60. Asc_VT:   EQU      11                  Vertical tab
  61. Asc_FF:   EQU      12                  Form feed
  62. Asc_CR:   EQU      13                  Carriage return
  63. Asc_SO:   EQU      14                  Shift out
  64. Asc_SI:   EQU      15                  Shift in
  65. Asc_DLE:  EQU      16                  Data link escape
  66. Asc_DC1:  EQU      17                  Device control 1
  67. Asc_DC2:  EQU      18                  Device control 2
  68. Asc_DC3:  EQU      19                  Device control 3
  69. Asc_DC4:  EQU      20                  Device control 4
  70. Asc_NAk:  EQU      21                  Negative acknowledge
  71. Asc_Syn:  EQU      22                  Synchronous idle
  72. Asc_ETB:  EQU      23                  End of transmission block
  73. Asc_Can:  EQU      24                  Cancel
  74. Asc_EM:   EQU      25                  End of medium
  75. Asc_Sub:  EQU      26                  Substitute
  76. Asc_Esc:  EQU      27                  Escape, prefix
  77. Asc_FS:   EQU      28                  File separator
  78. Asc_GS:   EQU      29                  Group separator
  79. Asc_RS:   EQU      30                  Record separator
  80. Asc_US:   EQU      31                  Unit separator
  81. Asc_Del:  EQU     127                  Delete
  82.  
  83. *          Buffers and strings sizes
  84.  
  85. StkMDpth: EQU     512                  Max stack depth (long words)
  86. McrTblLn: equ    2000                  Mcaro table length
  87. RBufLen:  EQU     200                  Receive buffer length
  88. CmdBufLn: EQU     200                  Command buffer length
  89. PromptML: EQU      32                  Prompt string max length
  90. LinNamML: EQU      32                  Line name string max length
  91. FilNamML: EQU      28                  File names max length (for OS9--was 40)
  92. MxPckSiz: EQU      94                  Maximum packet size
  93. MaxTakeF: EQU      20                  Maximum number of nested take files
  94.  
  95. *         Kermit protocol automaton states
  96.  
  97. SndInitS: EQU       0                  Send-Init
  98. OpnFileS: EQU       1                  Open-File
  99. SndFileS: EQU       2                  Send-File
  100. SndDataS: EQU       3                  Send-Data
  101. SendEOFS: EQU       4                  Send-End-Of-File
  102. SendEOTS: EQU       5                  Send-Break
  103. RecInitS: EQU       6                  Receive-Init
  104. RecFileS: EQU       7                  Receive-File
  105. RecDataS: EQU       8                  Receive-Data
  106. SndSrvIS: EQU       9                  Send-Server-Init
  107. SndGCmdS: EQU      10                  Send-Generic-Command
  108. CompletS: EQU      11                  Complete
  109. AbortS:   EQU      12                  Abort
  110.  
  111. *         Logical channels
  112.  
  113. Null:     EQU       0                  Null logical channel number
  114. Terminal: EQU       1                  Terminal line logical channel number
  115. HostLine: EQU       2                  Host line logical channel number
  116. IOFile:   EQU       3                  I/O file logical channel number
  117. TakeFil0: EQU       4                  Outer level take file ...
  118. TakeFil1: EQU       5                  ... and so on
  119.  
  120. *         System I/O routines InpChar, OutChar and ChanCtrl completion codes
  121.  
  122. AllOk:    EQU       0                  No errors
  123. BadChan:  EQU       1                  Inexistent channel
  124. ResChan:  EQU       2                  Access reserved, permission denied
  125. DevNotRd: EQU       3                  Device not ready (e.g. unmounted)
  126. NotInpCh: EQU       4                  Input impossible on this channel
  127. NotOutCh: EQU       5                  Output impossible on this channel
  128. NotOpRd:  EQU       6                  File not open for read
  129. NotOpWr:  EQU       7                  File not open for write
  130. UnrInpF:  EQU       8                  Unrecoverable failure during input
  131. UnrOutF:  EQU       9                  Unrecoverable failure during output
  132. InChLost: EQU      10                  Input character lost
  133. InpBreak: EQU      11                  Break received on input
  134. BufEmpty: EQU      12                  Input buffer empty
  135. BufOvflw: EQU      13                  Input buffer overflow
  136. EndOfFil: EQU      14                  End of file reached on input
  137. DevFull:  EQU      15                  Device full, not enough space
  138. BadCtReq: EQU      16                  I/O control request code invalid
  139.  
  140. *         FilOpen function request codes
  141.  
  142. RdWrOp:   EQU       0                  Open for read/write
  143. ReadOp:   EQU       1                  Open for read
  144. WriteOp:  EQU       2                  Open for write
  145. AppendOp: EQU       3                  Open for append
  146.  
  147. *         I/O channel control requests
  148.  
  149. SetBaud:  EQU       0                  Set baud rate on port
  150. RawMode:  EQU       1                  Enable raw mode
  151. TextMode: EQU       2                  Enable text mode
  152. DoXCntrl: EQU       3                  Enable XON/XOFF protocol
  153. NoXCntrl: EQU       4                  Disable XON/XOFF protocol
  154. SndBreak: EQU       5                  Send a break over RS 232 C line
  155. ClrInpBf: EQU       6                  Clear input buffer
  156. ClrOutBf: EQU       7                  Clear output buffer
  157.  
  158. *         System function request codes
  159.  
  160. SysCommd: equ       0                  Forward a command to system
  161. Directry: EQU       1                  Display a directory listing
  162. SpacInfo: EQU       2                  Display informations about disk usage
  163. DeletFil: EQU       3                  Delete file(s)
  164. CopyFile: EQU       4                  Copy file(s)
  165. ChangDir: EQU       5                  Change the default directory
  166. PrntFile: EQU       6                  Print file(s)
  167. RenamFil: EQU       7                  Rename file(s)
  168. TypeFile: EQU       8                  Type file(s)
  169.  
  170. *         Screen request codes
  171.  
  172. SFilName: EQU       0                  Outgoing file name
  173. RFilName: EQU       1                  Inbound file name
  174. FlAsName: EQU       2                  File as-name
  175. XPckData: EQU       3                  X packet data
  176. FlTranOk: EQU       4                  File transfer ok
  177. FlDiscrd: EQU       5                  File discarded
  178. FlIntrrp: EQU       6                  File interrupted
  179. FlSkippd: EQU       7                  File skipped
  180. PackType: EQU       8                  Packet type
  181. TranCmpl: EQU       9                  Transaction complete
  182. ErrMessg: EQU      10                  Error message
  183. WarnMess: EQU      11                  Warning message
  184. UndelTxt: EQU      12                  Undelimited text
  185. TxtDlBeg: EQU      13                  Text delimited at the beginning
  186. TxtDlEnd: EQU      14                  Text delimited at the end
  187. ScrnMxRq: EQU      14                  Screen function max request code
  188.  
  189. *         Program variables defaults
  190.  
  191. DefDuplx: equ       False              Default duplex
  192. DefPrity: EQU       0                  Default parity
  193. DefEscap: EQU       5                  Default escape character for connect
  194. DefFlow:  EQU       1                  Default line flow control
  195. DefLocal: EQU       True               Default mode, local or remote
  196. DefSpeed: EQU    9600                  Default line speed
  197. DefDelay: EQU       5                  Default initial delay before sending
  198. DefRetIn: EQU      16                  Defaulut retry limit initial connection
  199. DefRetPk: EQU      10                  Defaulut retry limit normal packets
  200.  
  201. *         Send Init parameters
  202.  
  203. MyMxPSiz: EQU      90                  Biggest packet I want receive
  204. MyTimOut: EQU      10                  When I want to be timed out
  205. MyPad:    EQU       0                  How much padding I need
  206. MyPadChr: EQU       Asc_Nul            Padding character I want
  207. MyEOL:    EQU       Asc_CR             End-Of-Line character I want
  208. MyCtlQot: EQU       '#'                Control-Quote character I send
  209. MyRptQot: EQU       $7E                Repeat-Quote character I send
  210. My8BQuot: EQU       '&'                8th-Bit prefix char I will use
  211.  
  212. *         Receive Init default parameters
  213.  
  214. DefMxPSz: EQU      80                  Default biggest packet you can receive
  215. DefTmOut: EQU      10                  Default when you want to be timed out
  216. DefPadNm: EQU       0                  Default how much padding you need
  217. DefPadCr: EQU       Asc_Nul            Default padding character you want
  218. DefEOL:   EQU       Asc_CR             Default End-Of-Line character you want
  219. DefCtlQt: EQU       '#'                Default Control-Quote character you send
  220.  
  221. *    System variables
  222. *    OS-9 will not accept a macro argument as a label, so the variable
  223. *    declarations have been done in another way.  The do.s directive keeps
  224. *    a running offset location counter (separate from the code counter) that
  225. *    can be reset at any time using the org directive.
  226.  
  227.           org       0
  228.  
  229. *    Packet related variables
  230.  
  231. PackNum:  do.b      1                  Packet number
  232. PrevPckN: do.b      1                  Previous packet number
  233. NextPckN: do.b      1                  Next packet number
  234. SendType: do.b      1                  Packet type just sent
  235. IStPckCh: do.b      1                  Incoming packet start character
  236. OStPckCh: do.b      1                  Outbound packet start character
  237. Size:     do.b      1                  Current output data packet size
  238. OldSize:  do.b      1                  Previous output data packet size
  239. First:    do.b      1                  Flag for first character from input
  240. Current:  do.b      1                  Current character from input
  241. Next:     do.b      1                  Next character from input
  242.  
  243. *    Communication line variables
  244.  
  245. Speed:    do.l      1                  Line speed, -1 if unknown
  246. Parity:   do.b      1                  Parity specified, 0, 'E', 'O', 'M', 'S'
  247. Flow:     do.b      1                  Flow control, 1 for xon/xoff
  248. TurnFlag: do.b      1                  Line turnaround handshake flag
  249. TurnChar: do.b      1                  Line turnaround character
  250. Delay:    do.b      1                  Initial delay before sending
  251. Duplex:   do.b      1                  Duplex, full by default
  252. Escape:   do.b      1                  Escape character for connect
  253.  
  254. *    Program variables
  255.  
  256. CmdBfPnt: do.b      1                  Relative pointer to command buffer
  257. ServrCmd: do.b      1                  Server command to send
  258. Retry:    do.b      1                  Retry limit currently in use
  259. RtryInit: do.b      1                  Retry limit initial connection packets
  260. RtryPack: do.b      1                  Retry limit for normal packets
  261. TakLevel: do.b      1                  Take file level
  262.  
  263. LFSave:   do.b      1                  This is for newline processing
  264.  
  265. * If the system uses a single character for text file line delimitation,
  266. * assign to NewLinCh the ASCII value of that character.  For text files,
  267. * that character will be converted to CRLF upon output, and CRLF will be
  268. * converted to that character on input.
  269.  
  270. NewLinCh: EQU       Asc_CR             Line delimiter for text files
  271.  
  272. *    Variables for Send-Init parameters
  273.  
  274. ICtlQuot: do.b      1                  Control prefix in incoming data
  275. OCtlQuot: do.b      1                  Control prefix in outgoing data
  276. IEOL:     do.b      1                  End-Of-Line character to look for
  277. OEOL:     do.b      1                  End-Of-Line character to send
  278. IPadNumb: do.b      1                  How much padding to ask for
  279. OPadNumb: do.b      1                  How much padding to send
  280. IPadChar: do.b      1                  Padding character to ask for
  281. OPadChar: do.b      1                  Padding character to send
  282. ITimInt:  do.b      1                  Timeout interval I use
  283. OTimInt:  do.b      1                  Timeout interval I want you to use
  284. IMPckSiz: do.b      1                  Biggest packet size I want to receive
  285. OMPckSiz: do.b      1                  Biggest packet size I can send
  286. BlChkUs:  do.b      1                  Block check type used
  287. BlChkRq:  do.b      1                  Block check type requested
  288. ReptCnt:  do.b      1                  Repeat count
  289. ReptQuot: do.b      1                  Repeat prefix
  290. ReptFlag: do.b      1                  Repeat processing flag
  291. Bit8Quot: do.b      1                  8th bit prefix
  292. Bit8Flag: do.b      1                  8th bit quoting flag
  293. TimInFlg: do.b      1                  Flag to override the timeout requested
  294. SndPSFlg: do.b      1                  Flag to override the size requested
  295.  
  296. *    Flags
  297.  
  298. MStrFlag: do.b      1                  Flag for input from memory string
  299. TermOut:  do.b      1                  Flag for output to the terminal channel
  300. CtlXSeen: do.b      1                  Flag for cancelling a file
  301. CtlZSeen: do.b      1                  Flag for cancelling a file group
  302. Binary:   do.b      1                  Flag for binary file
  303. FNameCnv: do.b      1                  Flag for converting file names
  304. Keep:     do.b      1                  Flag for incomplete file disposition
  305. Warning:  do.b      1                  Flag for file warning
  306. Display:  do.b      1                  Flag for file transfer display
  307. Quiet:    do.b      1                  Be quiet during file transfer
  308. Local:    do.b      1                  Flag for running in local mode
  309. IntMacro: do.b      1                  Flag for interpreting macros
  310. Done:     do.b      1                  Flag for exiting the command parser
  311.  
  312. *    String and buffer variables
  313.  
  314. LeftOver: do.b      6                  Small buffer for optimal packet filling
  315. Prompt:   do.b      PromptML           Prompt string
  316. LineName: do.b      LinNamML           Communication line name
  317. FilName:  do.b      FilNamML           Current file name
  318. Argumnt1: do.b      CmdBufLn           First command argument
  319. Argumnt2: do.b      CmdBufLn           Second command argument
  320. DataBuf:  do.b      MxPckSiz+4         Packet data buffer
  321. SendBuf:  do.b      MxPckSiz+4         Send packet buffer
  322. RecBuf:   do.b      RBufLen            Receive packet buffer
  323. CmdBuf:   do.b      CmdBufLn           Buffer for command interpretation
  324. MacroTbl: do.b      McrTblLn           Macro definitions table
  325.  
  326. *    Statistic variables
  327.  
  328. ChrsSent: do.l      1                  Chars sent last transaction
  329. TChsSent: do.l      1                  Total characters sent
  330. ChrsRecd: do.l      1                  Chars received last transaction
  331. TChsRecd: do.l      1                  Total characters received
  332. DChsSent: do.l      1                  Data chars sent last transaction
  333. TDChSent: do.l      1                  Total data characters sent
  334. DChsRecd: do.l      1                  Data chars received last transaction
  335. TDChRecd: do.l      1                  Total data characters received
  336. PcksSent: do.l      1                  Packets sent last transaction
  337. TPckSent: do.l      1                  Total packet sent
  338. PcksRecd: do.l      1                  Packets received last transaction
  339. TPckRecd: do.l      1                  Total packet received
  340. NAKsSent: do.l      1                  NAKs sent last transaction
  341. TNAKSent: do.l      1                  Total NAKs sent
  342. NAKsRecd: do.l      1                  NAKs received last transaction
  343. TNAKRecd: do.l      1                  Total NAKs received
  344.  
  345. *    Pointers
  346.  
  347. MStrgPnt: do.l      1                  Pointer for input from memory string
  348. MacroPnt: do.l      1                  Pointer for macro interpretation
  349. MTNxtChF: do.l      1                  Pointer to the end of the macro table
  350.  
  351. *    System dependent routines variables
  352.  
  353. LinLngth: do.b      1                  For the dumb terminal Screen routine
  354. MyFNBuff: do.b      FilNamML           This is for tests on my system
  355.  
  356. *    OS-9/68000 specific variables
  357.  
  358. CR_Last:  do.b      1                  Flag for CR/LF stripping on terminal
  359. TermFlag: do.b      1                  Flag used in OutChar for terminal.
  360. Pathnums: do.w     20                  OS-9 path numbers for logical channels
  361. NumFiles: do.l      1                  Number of files left to process
  362. NextFile: do.l      1                  Pointer to next file name
  363. CmdLinPt: do.l      1                  Pointer to the OS-9 command arguments
  364. FNBuffer: do.b     50*FilNamML         File names buffer for ExpandFN
  365.  
  366. ShellCmd: do.b    128                  Buffer for constructing shell commands
  367.  
  368. OptBuff:  do.b    128                  Save area for terminal input PD options
  369.  
  370. *  Must set the VarIndex variable to the current offset location counter
  371. *  so that the variable section can be set up properly
  372.  
  373. VarIndex: do.w      1                  Seems reasonable to be word aligned
  374.  
  375.           vsect
  376. VarArea:  ds.b      VarIndex           Storage definition for the variables area
  377.           ends
  378.           ends
  379.           end
  380.