home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / cpm / modems / modem / cp405src.ark / CP4DEF.ASM < prev    next >
Encoding:
Assembly Source File  |  1986-12-26  |  7.4 KB  |  198 lines

  1. ; CP4DEF.ASM
  2. ;    KERMIT - (Celtic for "FREE")
  3. ;
  4. ;    This is the CP/M-80 implementation of the Columbia University
  5. ;    KERMIT file transfer protocol.
  6. ;
  7. ;    Version 4.0
  8. ;
  9. ;    Copyright June 1981,1982,1983,1984,1985
  10. ;    Columbia University
  11. ;
  12. ; Originally written by Bill Catchings of the Columbia University Center for
  13. ; Computing Activities, 612 W. 115th St., New York, NY 10025.
  14. ;
  15. ; Contributions by Frank da Cruz, Daphne Tzoar, Bernie Eiben,
  16. ; Bruce Tanner, Nick Bush, Greg Small, Kimmo Laaksonen, Jeff Damens, and many
  17. ; others. 
  18. ;
  19. ;    This file contains definitions used by both modules of Kermit.
  20. ;
  21. ; revision history:
  22. ; edit 4: 6-Feb-85 by Charles Carvalho
  23. ;    modify pcc007: replace ffussy assembly switch with runtime test.
  24. ;    add "getvnm" - get CP/M version number.
  25. ;
  26. ; edit 3: 13-Jan-85 by Vanya J.Cooper Pima Commun. College Tel: 602-884-6809
  27. ;
  28. ;pcc007    2-Jan-85    vjc    modules:cp4def,cp4cmd
  29. ;    Cmifil is too fussy about what characters to accept in a
  30. ;    filespec.  My CP/M manual says any printable character is ok
  31. ;    except <>.,;:?*[], and lower case.  In practice, even those work
  32. ;    sometimes.  Kermit itself uses '&' if file warning is on,
  33. ;    and then won't let you reference the file.  Allow all
  34. ;    printable characters except those above.  Add conditional
  35. ;    ffussy, so that if not ffussy, all special characters will be
  36. ;    allowed, just convert lower to upper-case.
  37. ;
  38. ;pcc008    2-Jan-85    vjc    modules:cp4def,cp4tt,cp4utl
  39. ;    Keyboard input during CONNECT mode can get locked out if
  40. ;    there is enough input from the modem port to keep prtchr
  41. ;    busy.  This can happen for example, if the printer is running
  42. ;    at the same speed as the modem line, leaving you helpless to
  43. ;    turn it off or abort the host.  Add a fairness count, so that
  44. ;    at least every prfair characters we look at console input.
  45. ;
  46. ; edit 2: July 10, 1984 (CJC)
  47. ;    Remove defines for TRUE and FALSE, during reorganization for LASM
  48. ;    compatibility.  If we're using LASM, this file is linked by CP4KER
  49. ;    or CP4TYP, and links to CP4MIT or CP4LNK.  Also, push comments around
  50. ;    a little.
  51. ;
  52. ; edit 1: May, 1984 (CJC)
  53. ;    extracted from CPMBASE.M80 version 3.9; modifications are described
  54. ;    in the accompanying .UPD file.
  55. ;
  56.  
  57. ;Symbolic Definitions for some ASCII characters
  58. ;
  59. soh    EQU    01O    ;ASCII SOH (Control-A)
  60. ctrlc    EQU    03O    ;ASCII ETX (Control-C)
  61. bell    EQU    07O    ;ASCII BEL (Control-G)
  62. bs    EQU    10O    ;ASCII backspace (Control-H)
  63. tab    EQU    11O    ;ASCII Tab (Control-I)
  64. lf    EQU    12O    ;ASCII Line Feed (CTRL-J)
  65. ff    EQU    14O    ;ASCII Form Feed (CTRL-L)
  66. cr    EQU    15O    ;ASCII Carriage Return (CTRL-M)
  67. xon    EQU    21O    ;ASCII XON (Control-Q)
  68. xoff    EQU    23O    ;ASCII XOFF (Control-S)
  69. esc    EQU    33O    ;ASCII ESCape
  70. subt    EQU    32O    ;ASCII SUB (CTRL-Z)
  71. del    EQU    177O    ;ASCII DELete (rubout)
  72. ;
  73. ;BDOS calls
  74. bdos    EQU    0005H    ;BDOS entry point, for the following functions:
  75. ;
  76. ;Function Name        Function    Input Parameters Output Parameter
  77. ;=============        ========    ================ ================
  78. ;    (ALL Function Numbers are passed in Register C)
  79. conin    EQU    01H    ;Read Console    NONE         ASCII Char in A
  80. conout    EQU    02H    ;Write Console    ASCII Char in E     NONE
  81. auxin    EQU    03H    ;Auxiliary input
  82. rdrin    EQU    03H    ;Read Reader    NONE         ASCII Char in A
  83. lstout    EQU    05H    ;Write List    ASCII Char in E     NONE
  84. dconio    EQU    06H    ;Direct Con I/O ASCII Char in E     I/O Status in A
  85.             ;                 if E=0FEH,
  86.             ;                  Input if E=0FFH
  87. prstr    EQU    09H    ;Print String    String-Address     NONE
  88.             ;        in DE (term=$)
  89. rdstr    EQU    0AH    ;Read Buffer    Buffer-Address    Read Buffer filled
  90. ;                    in DE
  91. ;    Read Buffer    Byte    Function
  92. ;              1    Maximum Buffer Length
  93. ;              2    Current Buffer Length (returned value)
  94. ;            3-n    Data (returned values)
  95. ;
  96. consta    EQU    0BH    ;Console Stat    NONE        LSB(A)=1 if char ready
  97. getvnm    EQU    0CH    ;Version Number    NONE        H=0 (CP/M), L=BDOS ver
  98. inbdos    EQU    0DH    ;Init BDOS    NONE        NONE
  99. logdsk    EQU    0EH    ;LOG-In disk    Value in E    NONE
  100.             ;        A=0,B=1,...
  101. openf    EQU    0FH    ;Open File    FCB-Addr in DE    Byte Addr.of FCB,
  102.             ;                 or 0FFH if not
  103. closf    EQU    10H    ;Close File    FCB-Addr in DE    Byte Addr.of FCB,
  104.             ;                 or 0FFH if not
  105. sfirst    EQU    11H    ;Search File    FCB-Addr in DE    Byte Addr.of FCB(0-3),
  106.             ;                 or 0FFH if not
  107. snext    EQU    12H    ;Search next    FCB-Addr in DE    Byte Addr.of next FCB,
  108.             ;                 or 0FFH if not
  109. delf    EQU    13H    ;Delete File    FCB-Addr in DE    Byte Addr.of FCB(0-3),
  110.             ;                 or 0FFH if not
  111. readf    EQU    14H    ;Read Record    FCB-Addr in DE    0=successful read
  112.             ;                1=read past EOF
  113.             ;                2=reading random data
  114. writef    EQU    15H    ;Write Record    FCB-Addr in DE    0=successful write
  115.             ;                1=ERROR extending
  116.             ;                2=End of disk data
  117.             ;                255=No more DIR space
  118. makef    EQU    16H    ;Make File    FCB-Addr in DE    0-3= success,
  119.             ;                255= no more dir space
  120. renam    EQU    17H    ;Rename File    FCB-Addr in DE    0-3= success,
  121.             ;                255= file not found
  122. rdlog    EQU    18H    ;Ret. Log Code    NONE        Login Vector in HL
  123. rddrv    EQU    19H    ;Read Drive #    NONE        # of logged in drive in
  124.             ;                (A=0,B=1,C=2....)
  125. setdma    EQU    1AH    ;Set DMA Addr.    Addr. of 128    NONE
  126.             ;        byte buffer in DE
  127. wrtprt    EQU    1CH    ;Write prot dsk    NONE        NONE
  128. getrov    EQU    1DH    ;Get R/O Vect.    NONE        HL= R/O Vect. value
  129. setfat    EQU    1EH    ;Set File Attr.    FCB-Addr.in DE    Dir. code in A
  130. gtdpar    EQU    1FH    ;Get DSK par.    NONE        HL=DPB Address
  131. usrcod    EQU    20H    ;Get/Set Usr.Cd    E=0FFH (get)    A=current code (get)
  132.             ;        E-code (set)    A=no value (set)
  133. rrand    EQU    21H    ;Read  Random    FCB-Addr in DE    A=Return code
  134. wrand    EQU    22H    ;Write Random    FCB-Addr in DE    1=read'g unwritten data
  135.             ;                2=(not used)
  136.             ;                3=can't close curr. ext
  137.             ;                4=seek to unwr. ext.
  138.             ;                5=dir overflow(write)
  139.             ;                6=seek past End of DSK
  140. cflsz    EQU    23H    ;Comp File Sz.    FCB Addr.in DE    Rand.Rec.field set to
  141.             ;                 File size
  142. setrar    EQU    24H    ;Set Rand. Rec.    FCB-Addr.in DE    Rand.Rec.field set
  143.  
  144. ; CPM 2 only:
  145. punout    EQU    04H    ;Write Punch    ASCII Char in E     NONE
  146. gtiob    EQU    07H    ;Get I/O status NONE         I/O Status in A
  147. ptiob    EQU    08H    ;Put I/O status    I/O Status in E     NONE
  148. getalv    EQU    1BH    ;Get All.Vect.    NONE        All.Vect in HL
  149.  
  150. ; CPM 3 only:
  151. auxout    EQU    04H    ;Auxiliary output
  152. auxist    EQU    07H    ;Get AUXIN: status         A=FF if character
  153.             ;                 ready, A=0 if none
  154. auxost    EQU    08H    ;Get AUXOUT: status         A=FF if ready, A=0
  155.             ;                 if not ready
  156. getfs    EQU    2EH    ;Get free space    E=drive        # rec free in dma addr
  157. ;
  158. parevn    EQU    00H    ;Even parity.
  159. parmrk    EQU    03H    ;Mark parity.
  160. parnon    EQU    06H    ;No parity (eighth bit is data).
  161. parodd    EQU    09H    ;Odd parity.
  162. parspc    EQU    0CH    ;Space parity.
  163.  
  164. defpar    EQU    parnon    ;Default parity.
  165. ibmpar    EQU    parmrk    ;IBM COMTEN's parity.
  166.  
  167. fcb    EQU    5CH    ;Location of File Control Block.
  168. fcbext    equ    fcb+12
  169. fcbrno    equ    fcb+33
  170. buff    EQU    80H    ;Location of file output buffer (DMA).
  171. bufsiz    EQU    80H    ;Size of DMA.
  172.  
  173. maxpkt  EQU    '~'-' '+2O;Maximum size of a packet.
  174. maxtry    EQU    05O    ; Number of retries on a packet.
  175. imxtry    EQU    20O    ; Number of retries send initiate.
  176. prfair    EQU    100    ;[pcc008] Prtchr fairness count
  177.  
  178. ; opcodes for command parser
  179. cmkey    EQU    01H    ;Parse a keyword.
  180. cmifi    EQU    02H    ;Parse an input file spec (can be wild).
  181. cmofi    EQU    03H    ;Parse an output file spec.
  182. cmcfm    EQU    04H    ;Parse a confirm.
  183. cmtxt    EQU    05H    ;Parse text.
  184. cmifin    EQU    10H    ;Parse an input file spec (but no
  185.             ;Error output
  186.  
  187. ;
  188. ; If this is being assembled by LASM, we need to LINK to one of two modules;
  189. ; if we're not using LASM, no problem.
  190. ; CP4KER.ASM defines "cp4ker" TRUE, and CP4TYP.ASM defines it FALSE, so we can
  191. ; determine what's going on.
  192. IF lasm AND cp4ker    ; building CP4KER with LASM?
  193.     LINK    CP4MIT    ; yes, chain to next piece.
  194. ENDIF;lasm AND cp4ker
  195. IF lasm AND NOT cp4ker    ; LASM, but not building CP4KER?
  196.     LINK    CP4LNK    ; yes, chain to different piece.
  197. ENDIF;lasm AND NOT cp4ker
  198.