home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / cpm / modem / cp405src.ark / CP4LNK.ASM < prev    next >
Assembly Source File  |  1986-12-25  |  7KB  |  182 lines

  1. ; CP4LNK.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
  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 describes the areas used to communicate between KERMIT
  20. ;    and the customizing overlay.  It is included by the overlay.
  21. ;    This file should be changed only to reflect changes in the
  22. ;    system-independent portion of Kermit (enhancements, I hope).
  23. ;
  24. ; revision history:
  25. ; edit 5: February 6, 1985
  26. ;    Added a storage variable, "PORT", for the port-in-use value 
  27. ;    required for the port status routine (same purpose as SPEED).
  28. ;    Also moved the printer copy flag (PRNFLG:) into the commun-
  29. ;    ications storage area so machine dependant overlay can access it.
  30. ;    [Hal Hostetler]
  31. ;    Also, replace assembly-time conditional "ffussy" with run-time
  32. ;    switch (CJC).
  33. ;
  34. ; edit 4: August 21, 1984 (CJC)
  35. ;    Define a use for the third word of the linkage section: it points
  36. ;    to the version string for CP4SYS.ASM.  Add flsmdm, to flush comm line
  37. ;    on startup.  Add bufadr and bufsec for multiple-sector buffer support.
  38. ;    Shift the entry section up two bytes so we can exit cleanly from DDT.
  39. ;
  40. ; edit 3: August 3, 1984 (CJC)
  41. ;    put "mover" in CP4SYS, so we can do a Z80 block move if so inclined.
  42. ;
  43. ; edit 2: July 10, 1984 (CJC)
  44. ;    integrate Toad Hall changes for LASM compatibility: CP4LNK is linked
  45. ;    by CP4DEF, and links CP4SYS.
  46. ;
  47. ; edit 1: May, 1984 (CJC)
  48. ;    extracted from CPMBASE.M80 version 3.9; modifications are described
  49. ;    in the accompanying .UPD file.
  50. ;
  51.  
  52. ;    Define the entry section.  These addresses contain jumps to
  53. ;    useful routines in KERMIT.  To show we know what we're doing,
  54. ;    we store the length of this section (entsiz) in our linkage
  55. ;    section.  I didn't use ORG and DS because I don't want zeroes
  56. ;    generated for all the space between here and the actual start
  57. ;    of cp4sys.
  58. entry    equ    105H    ; start of entry section
  59. kermit    equ    entry+0    ; reentry address
  60. nout    equ    entry+3    ; output HL in decimal
  61. entsiz    equ    2*3    ; 2 entries, so far.
  62. ;
  63. ;    End of entry section.
  64. ;
  65. ;    Linkage section.  This block (through the definition of lnksiz)
  66. ;    is used by Kermit to reach the routines and data in the overlay.
  67. ;    The section length is stored at the beginning of the overlay
  68. ;    area so Kermit can verify that the overlay section is (a) present,
  69. ;    (b) in the right place, and (c) the same size as (and therefore
  70. ;    presumably the same as) the linkage section Kermit is expecting.
  71. ;
  72.     ASEG
  73.     ORG    OVLADR
  74. ;
  75. lnkflg:    dw    lnksiz    ; linkage information for consistency check.
  76.     dw    entsiz    ; length of entry table, for same.
  77.     dw    sysedt    ; address of overlay revision level message
  78. ;
  79. ;    hooks for system-dependent routines:
  80. ;
  81. ; Input/output routines. 
  82. ;
  83.     jmp    selmdm    ; select modem for I/O
  84.     jmp    outmdm    ; output character in E to modem
  85.     jmp    inpmdm    ; read character from modem. return character or 0 in A.
  86.     jmp    flsmdm    ; flush pending input from modem
  87.     jmp    selcon    ; select console for I/O
  88.     jmp    outcon    ; output character in E to console
  89.     jmp    inpcon    ; read char from console. return character or 0 in A
  90.     jmp    outlpt    ; output character in E to printer
  91. ;
  92. ; screen formatting routines
  93.     jmp    clrlin    ; erase current line
  94.     jmp    clrspc    ; erase current position (after backspace)
  95.     jmp    delchr    ; make delete look like backspace
  96.     jmp    clrtop    ; erase screen and go home
  97. ;
  98. ; these routines are called to display a field on the screen.
  99.     jmp    scrend    ; move to prompt field
  100.     jmp    screrr    ; move to error message field
  101.     jmp    scrfln    ; move to filename field
  102.     jmp    scrnp    ; move to packet count field
  103.     jmp    scrnrt    ; move to retry count field
  104.     jmp    scrst    ; move to status field
  105.     jmp    rppos    ; move to receive packet field (debug)
  106.     jmp    sppos    ; move to send packet field (debug)
  107. ;
  108.     jmp    sysinit    ; program initialization
  109.     jmp    sysexit    ; program termination
  110.     jmp    syscon    ; remote session initialization
  111.     jmp    syscls    ; return to local command level
  112.     jmp    sysinh    ; help text for interrupt (escape) extensions
  113.     jmp    sysint    ; interrupt (escape) extensions, including break
  114.     jmp    sysflt    ; filter for incoming characters.
  115.             ;  called with character in E.
  116.     jmp    sysbye    ; terminate remote session
  117.     jmp    sysspd    ; baud rate change routine.
  118.             ; called with value from table in DE
  119.     jmp    sysprt    ; port change routine.
  120.             ; called with value from table in DE
  121.     jmp    sysscr    ; screen setup for file transfer
  122.             ; called with Kermit's version string in DE
  123.     jmp    csrpos    ; move cursor to row B, column C
  124.     jmp    sysspc    ; calculate free space for current drive
  125.     jmp    mover    ; do block move
  126. ;
  127. ;    Local parameter values
  128. ;
  129. pttab:    dw    ttab    ; points to local equivalents to VT52 escape sequences
  130. spdtab:    dw    spdtbl    ; address of baud rate command table, or zero
  131. spdhlp:    dw    sphtbl    ; address of baud rate help table, or zero
  132. prttab:    dw    prttbl    ; address of port command table, or zero
  133. prthlp:    dw    prhtbl    ; address of port help table, or zero
  134. timout:    dw    fuzval    ; Fuzzy timeout.
  135. vtflg:    db    vtval    ; VT52 emulation flag
  136. escchr:    db    defesc    ; Storage for the escape character.
  137. speed:    dw    0FFFFH    ; storage for the baud rate (initially unknown)
  138. port:    dw    0FFFFH    ; storage for port value (initially unknown) [hh]
  139. prnflg:    db    0    ; printer copy flag [hh]
  140. dbgflg:    db    0    ; debugging flag
  141. ecoflg:    db    0    ; Local echo flag (default off).
  142. flwflg:    db    1    ; File warning flag (default on).
  143. ibmflg:    db    0    ; IBM flag (default off).
  144. cpmflg:    db    0    ;[bt] file-mode flag (default is DEFAULT)
  145. parity:    db    defpar    ; Parity.
  146. spsiz:    db    dspsiz    ; Send packet size.
  147. rpsiz:    db    drpsiz    ; Receive packet size.
  148. stime:    db    dstime    ; Send time out.
  149. rtime:    db    drtime    ; Receive time out.
  150. spad:    db    dspad    ; Send padding.
  151. rpad:    db    drpad    ; Receive padding.
  152. spadch:    db    dspadc    ; Send padding char.
  153. rpadch:    db    drpadc    ; Receive padding char.
  154. seol:    db    dseol    ; Send EOL char.
  155. reol:    db    dreol    ; Receive EOL char.
  156. squote:    db    dsquot    ; Send quote char.
  157. rquote:    db    drquot    ; Receive quote char.
  158. chktyp:    db    dschkt    ; Checksum type desired
  159. tacflg:            ; TACtrap status:
  160. IF    tac
  161.     db    tacval    ; when non-zero, is current TAC intercept character;
  162. ENDIF;tac
  163. IF    NOT tac
  164.     db    0    ; when zero, TACtrap is off.
  165. ENDIF;tac
  166. tacchr:    db    tacval    ; Desired TAC intercept character (even when off)
  167. bufadr:    dw    buff    ; Address of possibly multi-sector buffer for I/O
  168. bufsec:    db    1    ; Number of sectors big buffer can hold (0 means 256)
  169. ffussy:    db    1    ; if nonzero, don't permit <>.,;?*[] in CP/M filespec.
  170. ; space used by directory command; here because space calculation is
  171. ;  (operating) system-dependent
  172. bmax:    ds    2    ; highest block number on drive
  173. bmask:    ds    1    ; (records/block)-1
  174. bshiftf: ds    1    ; number of shifts to multiply by rec/block
  175. nnams:    ds    1    ; counter for filenames per line
  176.  
  177. lnksiz    equ    $-lnkflg ; length of linkage section, for consistency check.
  178.  
  179. IF lasm            ; If we're assembling with LASM,
  180.     LINK    CP4SYS    ;  get the next section.
  181. ENDIF;lasm
  182.