home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / cpm80 / cpxz80.asm < prev    next >
Assembly Source File  |  2020-01-01  |  7KB  |  351 lines

  1. IF NOT LASM
  2. .printx * CPXZ80.ASM *
  3. ENDIF    ;NOT lasm
  4. ;       KERMIT - (Celtic for "FREE")
  5. ;
  6. ;       This is the CP/M-80 implementation of the Columbia University
  7. ;       KERMIT file transfer protocol.
  8. ;
  9. ;       Version 4.0
  10. ;
  11. ;       Copyright June 1981,1982,1983,1984,1985
  12. ;       Columbia University
  13. ;
  14. ; Originally written by Bill Catchings of the Columbia University Center for
  15. ; Computing Activities, 612 W. 115th St., New York, NY 10025.
  16. ;
  17. ; Contributions by Frank da Cruz, Daphne Tzoar, Bernie Eiben,
  18. ; Bruce Tanner, Nick Bush, Greg Small, Kimmo Laaksonen, Jeff Damens, and many
  19. ; others.
  20. ;
  21. ;       This file contains the system-dependent code and data for
  22. ;    Kermit-80 emulated on an IBM PC or clone running Z80MU.
  23. ;
  24. ; revision history (last edit first)
  25. ;
  26. ; edit 1, 2 December, 1987.  Built code for Z80MU emulation.  Uses BIOS
  27. ;    calls to 0FF12-15 to read/write from/to the PC COM1 port.
  28. ;
  29.  
  30. .printx    * Assembling for Z80MU system *
  31.  
  32. ;
  33. ;      Family is the string used in VERSION to say which of several 
  34. ;       smaller overlay files are used.  These are (will be) derived from 
  35. ;       the juge CP4SYS.ASM file, in which case we will never get here.  
  36. ;       Just a Dollar, but put a sting in for a family of machines.
  37. ;
  38. family:    db    'CPXZ80.ASM  (1)  2-Dec-87$'    ; Used for family versions....
  39.  
  40.  
  41.  
  42. sysxin:        ; continuation of system dependent initialisation code
  43.     ret            ; return from system-dependent routine
  44. ;
  45. ;
  46. ;       system-dependent termination processing
  47. ;       If we've changed anything, this is our last chance to put it back.
  48. sysexit:
  49.     ret
  50.  
  51. ;
  52. ;       system-dependent processing for start of CONNECT command
  53. ;
  54. syscon:
  55.     ret
  56.  
  57. conmsg:        ; Messages printed when entering transparent (CONNECT) mode:
  58. ;
  59. ;
  60. ;       syscls - system-dependent close routine
  61. ;       called when exiting transparent session.
  62. ;
  63. syscls:
  64.     ret
  65. ;
  66. ;       sysinh - help for system-dependent special functions.
  67. ;       called in response to <escape>?, after listing all the
  68. ;       system-independent escape sequences.
  69. ;
  70. sysinh:
  71.     ret
  72.  
  73. ;
  74. ;       sysint - system dependent special functions
  75. ;       called when transparent escape character has been typed;
  76. ;       the second character of the sequence is in A (and in B).
  77. ;       returns:
  78. ;       non-skip: sequence has been processed
  79. ;       skip:   sequence was not recognized
  80. sysint:    ani    137O        ; convert lower case to upper, for testing...
  81.     jmp    rskp        ; take skip return - command not recognized.
  82.  
  83.  
  84. ;
  85. ;
  86. ;       sysflt - system-dependent filter
  87. ;       called with character in E.
  88. ;       if this character should not be printed, return with A = zero.
  89. ;       preserves bc, de, hl.
  90. ;       note: <xon>,<xoff>,<del>, and <nul> are always discarded.
  91. sysflt:
  92.     mov    a,e        ; get character for testing
  93.     ret
  94.  
  95. ;       mdmflt - modem filter [30]
  96. ;       called with character to be sent to printer in E
  97. ;       with parity set as appropriate.
  98. ;       return with accumulator = 0 do do nothing,
  99. ;                               <> 0 to send char in E.
  100. mdmflt:
  101.     mov    a,e        ;[30] get character to test
  102.     ret
  103.  
  104.  
  105.  
  106. ;       prtflt - printer filter [30]
  107. ;       called with character to be sent to printer in E
  108. ;       returns with a = 0 to do nothing
  109. ;                    a <> 0 to print it.
  110. ;
  111. ;       this routine for those printer that automatically insert
  112. ;       a lf on cr, or cr for lf.  Should this be shifted to 
  113. ;       the system indep. stuff, in say 4.06?
  114. prtflt:
  115.     mov    a,e        ; [30] get character to test
  116.     ret
  117.  
  118.  
  119. ;
  120. ; system-dependent processing for BYE command.
  121. ;  for apmmdm, heath, and lobo, hang up the phone.
  122. sysbye:
  123.     ret
  124. ;
  125. ;
  126. ;       This is the system-dependent command to change the baud rate.
  127. ;       DE contains the two-byte value from the baud rate table; this
  128. ;       value is also stored in 'speed'.
  129. sysspd:
  130.     ret
  131. ;
  132. ;
  133. ; The following conditionals were once a huge if not statement.  There
  134. ; wasn't enough room to add the lobo to the list, so it had to be broken
  135. ; into 2, which you can't do with an if not.  I redid it as two ifs and
  136. ; applied them to those that wouldn't set baud. [Hal Hostetler]
  137. spdtbl    EQU    0        ;[hh] SET BAUD not supported.
  138. sphtbl    EQU    0        ;[hh] ran out of room above...
  139. ;
  140. ;
  141. ;       This is the system-dependent SET PORT command.
  142. ;       HL contains the argument from the command table.
  143. sysprt:
  144.     ret
  145.  
  146. prttbl    equ    0        ; SET PORT not supported
  147. prhtbl    equ    0
  148. ;
  149.  
  150. ;
  151. ;       selmdm - select modem port
  152. ;       selcon - select console port
  153. ;       selmdm is called before using inpmdm or outmdm;
  154. ;       selcon is called before using inpcon or outcon.
  155. ;       For iobyt systems, diddle the I/O byte to select console or comm port;
  156. ;       For Decision I, switches Multi I/O board to console or modem serial
  157. ;       port.  [Toad Hall]
  158. ;       For the rest, does nothing.
  159. ;       preserves bc, de, hl.
  160. selmdm:
  161. selcon:
  162.     ret
  163. ;
  164.  
  165. ;       Get character from console, or return zero.
  166. ;       result is returned in A.  destroys bc, de, hl.
  167. ;
  168. inpcon:
  169.     mvi    c,dconio    ;Direct console I/O BDOS call.
  170.     mvi    e,0FFH        ;Input.
  171.     call    BDOS
  172.     ret
  173. ;
  174.  
  175. ;
  176. ;       Output character in E to the console.
  177. ;       destroys bc, de, hl
  178. ;
  179. outcon:
  180.     mov    c,e        ;Console output via BIOS
  181.     jmp    bcnout
  182. ;
  183.  
  184. ;
  185. ;       outmdm - output a char from E to the modem.
  186. ;               the parity bit has been set as necessary.
  187. ;       returns nonskip; bc, de, hl preserved.
  188. outmdm:
  189.     mov    c,e        ; get char to c
  190.     call    0ff12h        ; send to com1 via PC BIOS
  191.     ret
  192. ;
  193. ;
  194. ;       get character from modem; return zero if none available.
  195. ;       for IOBYT systems, the modem port has already been selected.
  196. ;       destroys bc, de, hl.
  197. inpmdm:
  198. ;Note: modem port should already be selected for mdI.  [Toad Hall]
  199.     call    0ff15h        ;Get the port status into A.
  200.     ana    a        ;See if the is non-null.
  201.     ret            ; return with character or NULL in A.
  202.  
  203.  
  204. ;
  205. ;       flsmdm - flush comm line.
  206. ;       Modem is selected.
  207. ;       Currently, just gets characters until none are available.
  208.  
  209. flsmdm:    call    inpmdm        ; Try to get a character
  210.     ora    a        ; Got one?
  211.     jnz    flsmdm        ; If so, try for another
  212.     ret            ; Receiver is drained.  Return.
  213. ;
  214.  
  215. ;
  216. ;       lptstat - get the printer status. Return a=0ffh if ok, or 0 if not.
  217. lptstat:
  218.     xra    a        ; assume it is ok.. this may not be necessary
  219.     ret
  220.  
  221. ;
  222. ;       outlpt - output character in E to printer
  223. ;       console is selected.
  224. ;       preserves de.
  225. outlpt:
  226.     push    d        ; save DE in either case
  227.     call    prtflt        ; go through printer filter [30]
  228.     ana    a        ; if A = 0 do nothing,
  229.     jz    outlp1        ; [30] if a=0 do nothing
  230.     mvi    c,lstout
  231.     call    bdos        ;Char to printer
  232. outlp1:    pop    d        ; restore saved register pair
  233.     ret
  234.  
  235. ;
  236. ; delchr - make delete look like a backspace.  Unless delete is a printing
  237. ;       character, we just need to print a backspace. (we'll output clrspc
  238. ;       afterwards)
  239. ;       For Kaypro and Vector General, delete puts a blotch on the screen.
  240. ;       For Apple and Osborne 1, delete moves but doesn't print.
  241. delchr:
  242.     mvi    e,bs        ;get a backspace
  243.     jmp    outcon
  244.  
  245. ; erase the character at the current cursor position
  246. clrspc:    mvi    e,' '
  247.     call    outcon
  248.     mvi    e,bs        ;get a backspace
  249.     jmp    outcon
  250.  
  251. ; erase the current line
  252. clrlin:    lxi    d,eralin
  253.     jmp    prtstr
  254.  
  255. ; erase the whole screen, and go home. preserves b (but not c)
  256. clrtop:    lxi    d,erascr
  257.     jmp    prtstr
  258.  
  259.  
  260. sysver:    db    'Z80MU on IBM PC $'
  261. IF lasm 
  262. LINK CPXVDU.ASM
  263. ENDIF   ;lasm - m80 will INCLUDE CPXVDU.ASM
  264. 
  265. 
  266. 
  267. 
  268. 
  269. 
  270. 
  271. 
  272. 
  273. 
  274. 
  275. 
  276. 
  277. 
  278. 
  279. 
  280. 
  281. 
  282. 
  283. 
  284. 
  285. 
  286. 
  287. 
  288. 
  289. 
  290. 
  291. 
  292. 
  293. 
  294. 
  295. 
  296. 
  297. 
  298. 
  299. 
  300. 
  301. 
  302. 
  303. 
  304. 
  305. 
  306. 
  307. 
  308. 
  309. 
  310. 
  311. 
  312. 
  313. 
  314. 
  315. 
  316. 
  317. 
  318. 
  319. 
  320. 
  321. 
  322. 
  323. 
  324. 
  325. 
  326. 
  327. 
  328. 
  329. 
  330. 
  331. 
  332. 
  333. 
  334. 
  335. 
  336. 
  337. 
  338. 
  339. 
  340. 
  341. 
  342. 
  343. 
  344. 
  345. 
  346. 
  347. 
  348. 
  349. 
  350.  
  351.