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

  1. IF NOT lasm
  2. .printx * CPXCIF.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 part for Cifer systems, and
  22. ;       is based on code contributed by John Shearwood of Birmingham
  23. ;       University.  This file was originally CPXTOR.ASM but now an 
  24. ;       FAMILY file on its own.
  25. ;
  26. ;       This file has code that supports Cifer 1886/2886 systems, running 
  27. ;       either CP/M Version 2.2 or 3.0, and driving the VL or AUX port.
  28. ;       xxx is a three letter abbrev. for the system you are adding.
  29. ;
  30. ; revision history:
  31. ;
  32. ; edit 2, 21 July, 1987 by OBSchou to bring it into line for use with 
  33. ;    CPXCOM.ASM.
  34. ;
  35. ; edit 1, 14 July by OBSchou for John Shearwood of Birmingham University, UK.
  36. ;    His edits ar based on the former CPXTOR.ASM family file.
  37. ;
  38. ;    edit 4, Apr 7 1987, JA Shearwood.  Add support for Cifer Aux port.
  39. ;    edit 2, Mar 17 1987, JA Shearwood Add support for Cifer CP/M Plus
  40. ;
  41. ; Keep module name, edit number, and last revision date in memory.
  42. family: db      'CPXCIF.ASM (2)  14-Jul-87 $'
  43. ;
  44. ; Assembly time message to let me know I'm building the right version.
  45. ; LASM generates an 'S' error along with the message, which is messy, but
  46. ; better than trying to put everything inside a IF m80 OR mac80 conditional,
  47. ; because LASM doesn't like nested IF's, either.
  48.  
  49. IF cifer
  50. .printx * Assembling Kermit-80 for Cifer 1886 *
  51. ENDIF
  52.  
  53. IF cifer3
  54. .printx * with CP/M Plus
  55. ENDIF
  56.  
  57. IF cifaux
  58. .printx * with AUX port
  59. ENDIF
  60.  
  61. ;
  62. ;=========================================================================
  63. ;       I/O Byte assignments (2-bit fields for 4 devices at loc 3)
  64. ;
  65. ;bits 6+7               LIST field
  66. ;       0               LIST is Teletype device (TTY:)
  67. ;       1               LIST is CRT device (CRT:)
  68. ;       2               LIST is Lineprinter (LPT:)
  69. ;       3               LIST is user defined (UL1:)
  70. ;
  71. ;bits 4+5               PUNCH field
  72. ;       0               PUNCH is Teletype device (TTY:)
  73. ;       1               PUNCH is high speed punch (PUN:)
  74. ;       2               PUNCH is user defined #1 (UP1:)
  75. ;       3               PUNCH is user defined #2 (UP2:)
  76. ;
  77. ;bits 2+3               READER field
  78. ;       0               READER is Teletype device (TTY:)
  79. ;       1               READER is high speed reader (RDR:)
  80. ;       2               READER is user defined #1 (UR1:)
  81. ;       3               READER is user defined #2 (UR2:)
  82. ;
  83. ;bits 0+1               CONSOLE field
  84. ;       0               CONSOLE is console printer (TTY:)
  85. ;       1               CONSOLE is CRT device (CRT:)
  86. ;       2               CONSOLE is in Batch-mode (BAT:);READER = Input,
  87. ;                       LIST = Output
  88. ;       3               CONSOLE is user defined (UC1:)
  89. ;
  90. ;=========================================================================
  91.  
  92. iobyte  EQU     03H     ;Location of I/O byte
  93.  
  94. IF cifer        ;[13]
  95. batio   equ     80h             ; tty: as console
  96. defio   equ     81h             ; crt: as console
  97. z80     SET     TRUE           ; although it really is...
  98. ENDIF;cifer [13]
  99.  
  100. defesc    EQU     ']'-100O        ;The default escape character.
  101.  
  102. ; Select initial setting for VT-52 emulation flag.
  103. vtval   EQU    1
  104.  
  105. IF iobyt    ; only CP/M 2.2 and VL port use coniob in CPXCOM
  106.         ; rest use this one
  107. coniob:    db    0        ; default console bit pattern
  108. ENDIF    ;iobyt
  109.  
  110.  
  111.  
  112. sysxin:    ;system initialisation not covered by sysinit
  113.     mvi    a,defio
  114.     sta    coniob
  115.  
  116. IF cifer AND NOT cifaux        ; [JAS] Not if AUX port
  117.         lxi     d,ciferi
  118.         call    prtstr
  119. ENDIF   ;cifer AND NOT cifaux
  120.  
  121. IF cifaux            ; [JAS] Only Aux Port
  122.         lhld    00047h        ; Get address of CIOPS table
  123.         lxi     d,6fh
  124.         dad     d        ; Calculate address of SETLNSPD
  125.         shld    cifiop
  126.         inx     h
  127.         inx     h
  128.         inx     h
  129.         shld    ciflod        ; Next entry LODEF
  130.         lxi     d,81h-72h
  131.         dad     d        ; Calculate address of LIDEF
  132.         shld    ciflid
  133.         lhld    00045h        ; Get address of SYSPTRS table
  134.         lxi     d,12h        ; Offset for LIDEF pointer
  135.         dad     d        ; Add to table address
  136.         mov     e,m        ; Get low byte LIDEF pointer
  137.         inx     h
  138.         mov     d,m        ; Get high byte LIDEF pointer
  139.         push    d
  140.         inx     h        ; LIPARM pointer next
  141.         mov     a,m        ; Get low byte of LIPARM pointer
  142.         sta     ciptbl        ; Keep
  143.         inx     h
  144.         mov     a,m        ; Get high byte
  145.         sta     ciptbl+1    ; Keep
  146.         lxi     d,1eh-15h    ; Offset to LODEF
  147.         dad     d
  148.         mov     e,m        ; Low byte
  149.         inx     h
  150.         mov     d,m        ; High byte
  151.         inx     h        ; LOPARM is next entry
  152.         mov     a,m
  153.         sta     coptbl        ; Keep low byte LOPARM
  154.         inx     h
  155.         mov     a,m
  156.         sta     coptbl+1    ; Keep high byte
  157. ; Now set up port for no parity 8 bits xon/xoff protocol both ways
  158.         xchg            ; LODEF into hl register
  159.         push    h        ; Needed later
  160.         mvi     a,0
  161.         mov     m,a        ; Clear byte 0
  162.         inx     h
  163.         mov     m,a        ; Clear byte 1
  164.         inx     h
  165.         mvi     a,099h        ; XON/XOFF protocol, 8bits, no parity
  166.         mov     m,a        ; Flag into byte 2
  167.         pop     h        ; Restore address of LODEF
  168. ciflod  equ     $+1
  169.         call    $        ; LODEF routine (poked above)
  170.         pop     h        ; LIDEF (PUSHed from de earlier)
  171.         push    h        ; Needed later
  172.         mvi     a,0
  173.         mov     m,a        ; Clear byte 0
  174.         inx     h
  175.         mov     m,a        ; Clear byte 1
  176.         inx     h
  177.         mvi     a,099h        ; XON/XOFF protocol, 8bits, no parity
  178.         mov     m,a        ; Flag into byte 2
  179.         pop     h        ; Restore address of LIDEF
  180. ciflid  equ     $+1
  181.         call    $        ; LIDEF routine (poked above)
  182.         lhld    ciptbl        ; Get current input speed
  183.         mov     a,m
  184.         sta     speed
  185.         sta     speed+1
  186.         mov     e,a
  187.         mov     d,a
  188.         call    sysspd        ; Make sure ip and op are the same
  189. ENDIF; cifer AND cifaux 
  190.  
  191.         ret                     ; return from system-dependent routine
  192.  
  193. ;
  194. ;
  195. ;       system-dependent termination processing
  196. ;       If we've changed anything, this is our last chance to put it back.
  197. sysexit:
  198.  
  199. IF cifer AND NOT cifaux
  200.         lxi     d,cifero
  201.         call    prtstr
  202. ENDIF;cifer AND NOT cifaux
  203.  
  204.         ret
  205.  
  206. ;
  207. ;       system-dependent processing for start of CONNECT command
  208. ;
  209. syscon:
  210.         ret
  211.  
  212. conmsg:         ; Messages printed when entering transparent (CONNECT) mode:
  213. ;
  214. ;
  215. ;       syscls - system-dependent close routine
  216. ;       called when exiting transparent session.
  217. ;
  218. syscls:
  219.         ret
  220. ;
  221. ;
  222. ;       sysinh - help for system-dependent special functions.
  223. ;       called in response to <escape>?, after listing all the
  224. ;       system-independent escape sequences.
  225. ;
  226. sysinh:    lxi    d,inhlps    ; we got options...
  227.     call    prtstr        ; print them.
  228.  
  229.         ret
  230.  
  231.  
  232. ;additional, system-dependent help for transparent mode
  233. ; (two-character escape sequences)
  234. inhlps:
  235.  
  236. ; [16] [18] have added super brain and Torch to the list of Breaking machines.
  237.  
  238. IF (cifer AND NOT cifaux)
  239.         db      cr,lf,'B  Transmit a BREAK'
  240. ENDIF   ;(cifer AND NOT cifaux)
  241.         db      '$'                     ;[hh] table terminator
  242.  
  243. ;
  244. ;       sysint - system dependent special functions
  245. ;       called when transparent escape character has been typed;
  246. ;       the second character of the sequence is in A (and in B).
  247. ;       returns:
  248. ;       non-skip: sequence has been processed
  249. ;       skip:   sequence was not recognized
  250. sysint: ani     137O            ; convert lower case to upper, for testing...
  251.  
  252. ; [19] have added superbrain and torch to the list
  253.  
  254. IF (cifer AND NOT cifaux)
  255.         cpi     'B'             ; send break?
  256.         jz      sendbr          ; yes, go do it.  return nonskip when through.
  257. ENDIF   ;(cifer AND NOT cifaux)
  258.  
  259.         jmp     rskp            ; take skip return - command not recognized.
  260.  
  261. ;
  262.  
  263. IF (cifer AND NOT cifaux)
  264. sendbr: lxi     d,brkmes        ; send a break by sending esc * "
  265.         call    prtstr          ; send to screen => breaks to port
  266.         ret
  267. ENDIF;cifer
  268.  
  269. ;    sysflt - system-dependent filter.
  270. ;    called with the character in E.
  271. ;       preserves bc, de, hl.
  272. ;       note: <xon>,<xoff>,<del>, and <nul> are always discarded.
  273. sysflt:
  274.         mov     a,e             ; get character for testing
  275.         ret
  276.  
  277. ;       mdmflt - modem filter [30]
  278. ;       called with character to be sent to printer in E
  279. ;       with parity set as appropriate.
  280. ;       return with accumulator = 0 do do nothing,
  281. ;                               <> 0 to send char in E.
  282. mdmflt:
  283.         mov     a,e             ;[30] get character to test
  284.         ret
  285.  
  286.  
  287.  
  288. ;       prtflt - printer filter [30]
  289. ;       called with character to be sent to printer in E
  290. ;       returns with a = 0 to do nothing
  291. ;                    a <> 0 to print it.
  292. ;
  293. ;       this routine for those printer that automatically insert
  294. ;       a lf on cr, or cr for lf.  Should this be shifted to 
  295. ;       the system indep. stuff, in say 4.06?
  296. prtflt:
  297.         mov     a,e             ; [30] get character to test
  298.         ret
  299.  
  300.  
  301. ;
  302. ;
  303. ; system-dependent processing for BYE command.
  304. ;  for apmmdm, heath, and lobo, hang up the phone.
  305. sysbye:
  306.         ret
  307. ;
  308. ;       This is the system-dependent command to change the baud rate.
  309. ;       DE contains the two-byte value from the baud rate table; this
  310. ;       value is also stored in 'speed'.
  311. sysspd:
  312.  
  313. IF (cifer AND NOT cifaux); This one is wierd.. 
  314.                 ; send an escape string to the screen to set rate.
  315.         push    d               ; Save the data returned
  316.         lxi     d,cifbrt                ; send the start of the escape string (esc ?)
  317.         call    prtstr          ;
  318.         pop     psw             ; get data into a (and flags>..)
  319.         inr     a               ; need to send (a+1-1) 'N' to screen
  320.         push    psw             ; we will need the data again
  321.         call    cifnos          ; send a set of Ns to the screen
  322.         pop     psw             ; (which then sets the VL line on the screen 
  323.         call    cifnos          ; processor card)
  324.         call    prcrlf          ; cr will terminate.. a crlf is handy
  325.         ret
  326.  
  327. cifnos: dcr     a               ; if result = 0 then done
  328.         jz      cifno1          ; if done then say 'Y' for yes.
  329.         push    psw
  330.         mvi     e,'N'           ; else send a string of Ns to screen processor
  331.         mvi     c,dconio
  332.         call    bdos
  333.         pop     psw
  334.         jmp     cifnos
  335. cifno1: mvi     e,'Y'
  336.         mvi     c,dconio
  337.         call    bdos
  338.         ret                     ; sent a sring of 0 or more N then a Y
  339.  
  340. cifbrt: db      esc,'?$'        ; start setting baud rate string
  341. ENDIF ;cifer AND NOT cifaux
  342.  
  343. IF cifaux; [JAS] Set baud rate by massaging LIPARM/LOPARM and calling
  344.                 ;CIOPS routine
  345. ; Set up speed byte in first location of tables
  346.         lhld    coptbl        ; Now sort out baud rate
  347.         mov     a,e        ; That's output speed
  348.         mov     m,a
  349.         xchg
  350.         lhld    ciptbl
  351.         mov     m,a        ; Input speed
  352. ; Call CIOPS routine SETLNSPD with tables in appropriate rp's
  353. cifiop  equ     $+1
  354.         call    $        ; Poked by sysinit
  355.         ret
  356.  
  357. coptbl: dw      0
  358. ciptbl: dw      0
  359. ENDIF; cifaux
  360.  
  361. ;
  362. ;       Speed tables
  363. ; (Note that speed tables MUST be in alphabetical order for later
  364. ; lookup procedures, and must begin with a value showing the total
  365. ; number of entries.  The speed help tables are just for us poor
  366. ; humans.
  367.  
  368. ;       db      string length,string,divisor (2 identical bytes or 1 word)
  369. ; [Toad Hall]
  370.  
  371. IF cifer 
  372. spdtbl: db      10h                     ;16 entries
  373.         db      03h,'110$',     02h,02h
  374.         db      04h,'1200$',    07h,07h
  375.         db      05h,'134.5$',   03h,03h
  376.         db      03h,'150$',     04h,04h
  377.         db      04h,'1800$',    08h,08h
  378.         db      05h,'19200$',   0fh,0fh
  379.         db      04h,'2000$',    09h,09h
  380.         db      04h,'2400$',    0ah,0ah
  381.         db      03h,'300$',     05h,05h
  382.         db      04h,'3600$',    0bh,0bh
  383.         db      04h,'4800$',    0ch,0ch
  384.         db      02h,'50$',      00h,00h
  385.         db      03h,'600$',     06h,06h
  386.         db      04h,'7200$',    0dh,0dh
  387.         db      02h,'75$',      01h,01h
  388.         db      04h,'9600$',    0eh,0eh
  389.  
  390. sphtbl: db      cr,lf,'   50     75    110    134.5  150    300    600   1200'
  391.         db      cr,lf,' 1800   2000   2400   3600   4800   7200   9600  19200$'
  392. ENDIF;cifer 
  393.  
  394. ; The following conditionals were once a huge if not statement.  There
  395. ; wasn't enough room to add the lobo to the list, so it had to be broken
  396. ; into 2, which you can't do with an if not.  I redid it as two ifs and
  397. ; applied them to those that wouldn't set baud. [Hal Hostetler]
  398. ;
  399. ;       This is the system-dependent SET PORT command.
  400. ;       HL contains the argument from the command table.
  401. sysprt:
  402. IF iobyt
  403.         mov     a,m             ;Get the I/O byte
  404.         sta     prtiob          ;Save the desired IO byte for this port
  405.         inx     h               ;Point at next entry
  406.         mov     a,m             ;Get the output function
  407.         sta     prtfun          ;Save it
  408. ENDIF;iobyt
  409.  
  410.         ret
  411. ;
  412. ;
  413. ;
  414. ;       Port tables for GENERIC CPM 2.2
  415. IF gener
  416. ; help text
  417. prhtbl: db      cr,lf,'CRT device'
  418.         db      cr,lf,'PTR device'
  419.         db      cr,lf,'TTY device'
  420.         db      cr,lf,'UC1 device'
  421.         db      cr,lf,'UR1 device'
  422.         db      cr,lf,'UR2 device$'
  423.  
  424. ; command table
  425. prttbl: db      06H             ;Six devices to choose from
  426.         db      03H,'CRT$'
  427.                 dw      crtptb
  428.         db      03H,'PTR$'
  429.                 dw      ptrptb
  430.         db      03H,'TTY$'
  431.                 dw      ttyptb
  432.         db      03H,'UC1$'
  433.                 dw      uc1ptb
  434.         db      03H,'UR1$'
  435.                 dw      ur1ptb
  436.         db      03H,'UR2$'
  437.                 dw      ur2ptb
  438.  
  439. ; port entry table
  440. ; table entries are:
  441. ;       db      iobyte-value, BDOS output function, reserved
  442. crtptb: db      crtio,conout,0
  443. ptrptb: db      ptrio,punout,0
  444. ttyptb: db      ttyio,conout,0
  445. uc1ptb: db      uc1io,conout,0
  446. ur1ptb: db      ur1io,punout,0
  447. ur2ptb: db      ur2io,punout,0
  448. ENDIF;gener
  449.  
  450. ;
  451. ;
  452. IF cifer                        ; no ports yet...
  453. prttbl   EQU     0
  454. prhtbl   EQU     0               ;
  455. ENDIF; cifer
  456.  
  457. IF iobyt
  458. prtfun: db      punout          ;Function to use for output to comm port
  459. prtiob: db      batio           ;I/O byte to use for communicating
  460. ENDIF;iobyt
  461.  
  462. IF NOT (iobyt OR lobo OR cifer)          ;[hh]
  463. prttbl  equ     0               ; SET PORT is not supported
  464. prhtbl  equ     0
  465. ENDIF;NOT (iobyt OR lobo OR cifer)
  466.  
  467. ;
  468. ;
  469. ;       selmdm - select modem port
  470. ;       selcon - select console port
  471. ;       selmdm is called before using inpmdm or outmdm;
  472. ;       selcon is called before using inpcon or outcon.
  473. ;       For iobyt systems, diddle the I/O byte to select console or comm port;
  474. ;       For Decision I, switches Multi I/O board to console or modem serial
  475. ;       port.  [Toad Hall]
  476. ;       For the rest, does nothing.
  477. ;       preserves bc, de, hl.
  478. selmdm:
  479. IF iobyt
  480.         lda     prtiob          ;Set up for output to go to the comm port
  481.         sta     iobyte          ;Switch byte directly
  482. ENDIF;iobyt
  483.  
  484.         ret
  485.  
  486. selcon:
  487. IF iobyt
  488.         lda     coniob          ;Set up for output to go to the console port
  489.         sta     iobyte          ;Switch directly
  490. ENDIF;iobyt
  491.  
  492.         ret
  493. ;
  494. ;       Get character from console, or return zero.
  495. ;       result is returned in A.  destroys bc, de, hl.
  496. ;
  497. inpcon:
  498. IF NOT iobyt
  499.         mvi     c,dconio        ;Direct console I/O BDOS call.
  500.         mvi     e,0FFH          ;Input.
  501.         call    BDOS
  502. ENDIF;NOT iobyt
  503.  
  504. IF iobyt
  505.         call    bconst          ;Get the status
  506.         ora     a               ;Anything there?
  507.         rz                      ;No, forget it
  508.         call    bconin          ;Yes, get the character
  509. ENDIF;iobyt
  510.         ret
  511. ;
  512. ;
  513. ;       Output character in E to the console.
  514. ;       destroys bc, de, hl
  515. ;
  516. outcon:
  517.  
  518. IF NOT iobyt
  519.         mvi     c,dconio        ;Console output bdos call.
  520.         call    bdos            ;Output the char to the console.
  521. ENDIF;NOT iobyt
  522.  
  523. IF iobyt
  524.         mov     c,e             ;Character
  525.         call    bcnout          ;to Console
  526. ENDIF;iobyt
  527.         ret
  528. ;
  529. ;
  530. ;       outmdm - output a char from E to the modem.
  531. ;               the parity bit has been set as necessary.
  532. ;       returns nonskip; bc, de, hl preserved.
  533. outmdm:
  534. IF inout
  535.         in      mnprts          ;Get the output done flag.
  536.         ani     output          ;Is it set?
  537.         jz      outmdm          ;If not, loop until it is.
  538.         mov     a,e
  539.         out     mnport          ;Output it.
  540.         ret
  541. ENDIF;inout
  542.  
  543. IF iobyt
  544. ;**** Note that we enter from outpkt with the I/O byte already set up for
  545. ;  output to go to the comm port
  546.         push    h
  547.         push    b
  548.         lda     prtfun          ;Get the output function
  549.         mov     c,a             ;Into C
  550.         call    bdos            ;And output the character
  551.         pop     b
  552.         pop     h
  553.         ret
  554. ENDIF;iobyt
  555.  
  556. IF cifer3            ; [JAS]
  557.         push    h
  558.         push    b
  559.         mvi     c,auxout        ;Output to the aux output device
  560.         call    bdos
  561.         pop     b
  562.         pop     h
  563.         ret
  564. ENDIF;cifer3
  565.  
  566.  
  567. ;
  568. ;
  569. ;       get character from modem; return zero if none available.
  570. ;       for IOBYT systems, the modem port has already been selected.
  571. ;       destroys bc, de, hl.
  572. inpmdm:
  573. IF iobyt
  574.         call    bconst          ;Is Char at COMM-Port?
  575.         ora     a               ;something there?
  576.         rz                      ; return if nothing there
  577.         call    bconin          ; data present. read data.
  578. ENDIF;iobyt
  579.  
  580. IF inout
  581. ;Note: modem port should already be selected for mdI.  [Toad Hall]
  582.         in      mnprts          ;Get the port status into A.
  583.         ani     input           ;See if the input ready bit is on.
  584.         rz                      ;If not then return.
  585.         in      mnport          ;If so, get the char.
  586. ENDIF;inout
  587.  
  588. IF cifer3            ; [JAS]
  589.         mvi     c,auxist
  590.         call    bdos            ;is char at auxin?
  591.         ora     a               ;something there?
  592.         rz                      ;no
  593.         mvi     c,auxin
  594.         call    bdos            ;read char from auxin
  595. ENDIF;cifer3
  596.  
  597. ret                     ; return with character in A
  598.  
  599.  
  600. ;
  601. ;       flsmdm - flush comm line.
  602. ;       Modem is selected.
  603. ;       Currently, just gets characters until none are available.
  604.  
  605. flsmdm: call    inpmdm          ; Try to get a character
  606.         ora     a               ; Got one?
  607.         jnz     flsmdm          ; If so, try for another
  608.         ret                     ; Receiver is drained.  Return.
  609.  
  610.  
  611. ;
  612. ;
  613. ;       lptstat - get the printer status. Return a=0 if ok, or 0ffh if not.
  614. lptstat:
  615. IF iobyte       ;[33]
  616.         call    bprtst          ; get status
  617. ENDIF   ;iobyte[33]
  618. IF NOT iobyte   ;[33]
  619.         xra     a               ; assume it is ok.. this may not be necessary
  620. ENDIF   ;iobyte [33]
  621.         ret
  622. ;
  623. ;
  624. ;       outlpt - output character in E to printer
  625. ;       console is selected.
  626. ;       preserves de.
  627. outlpt:
  628.         push    d               ; save DE in either case
  629.         call    prtflt          ; go through printer filter [30]
  630.         ana     a               ; if A = 0 do nothing,
  631.         jz      outlp1          ; [30] if a=0 do nothing
  632.  
  633. IF NOT iobyte
  634.         mvi     c,lstout
  635.         call    bdos            ;Char to printer
  636. ENDIF;NOT iobyt
  637. IF iobyt
  638.         mov     c,e
  639.         call    blsout
  640. ENDIF;iobyt
  641.  
  642. outlp1: pop     d               ; restore saved register pair
  643.         ret
  644. ;
  645. ;
  646. ;       Screen manipulation routines
  647. ;       csrpos - move to row B, column C
  648. ;
  649. ;       csrpos for terminals that use a leadin sequence followed
  650. ;        by (row + 31.) and (column + 31.)
  651. ;
  652. IF cifer                        ; [14] cifer does it colums then rows.. swap b and c
  653. csrpos: push    b               ; save coordinates
  654.         lxi     d,curldn        ; get cursor leadin sequence
  655.         call    prtstr          ; print it
  656.         pop     h               ; restore coordinates
  657.         mov     a,l             ; [obs] get column
  658.         adi     (' '-1)         ; space is column one
  659.         mov     e,a
  660.         push    h
  661.         call    outcon          ; output row
  662.         pop     h
  663.         mov     a,h             ; [obs] get row
  664.         adi     (' '-1)         ; space is row one
  665.         mov     e,a
  666.         jmp     outcon          ; output it and return
  667. ENDIF; cifer 
  668.  
  669. ;
  670. ;
  671. ; delchr - make delete look like a backspace.  Unless delete is a printing
  672. ;       character, we just need to print a backspace. (we'll output clrspc
  673. ;       afterwards)
  674. ;       For Kaypro and Vector General, delete puts a blotch on the screen.
  675. ;       For Apple and Osborne 1, delete moves but doesn't print.
  676. delchr:
  677.     mvi    e,bs
  678.     call    outcon
  679.  
  680. ; erase the character at the current cursor position
  681. clrspc: mvi     e,' '
  682.         call    outcon
  683.         mvi     e,bs            ;get a backspace
  684.         jmp     outcon
  685.  
  686. ; erase the current line
  687. clrlin: lxi     d,eralin
  688.         jmp     prtstr
  689.  
  690. ; erase the whole screen, and go home. preserves b (but not c)
  691. clrtop: lxi     d,erascr
  692.         jmp     prtstr
  693.  
  694.  
  695. IF cifer AND NOT cifaux        ;[13]
  696. ttytyp: db      'Cifer 1886 (Parity set to space only)$'
  697. ENDIF; cifer AND NOT cifaux
  698.  
  699. IF cifaux            ;JAS
  700. ttytyp: db      ' Cifer 1886 $'
  701. ENDIF; cifaux
  702.  
  703. IF cifer            ;[JAS]
  704. sysver: db      ' Cifer 1886 $'         ;
  705. outlin: db      esc,'J',cr,lf,tab,tab,'$'
  706. eralin: db      esc,'^K$'               ;Clear to end of line.
  707. erascr: db      esc,'J$'                ;Clear screen and go home.
  708. curldn: db      esc,'P$'                ;Cursor lead-in
  709. ttab:                                   ;Table start location.
  710. ta:     db      esc,'A$',0              ;Cursor up.
  711. tb:     db      esc,'@$',0              ;Cursor down.
  712. tc:     db      esc,'C$',0              ;Cursor right.
  713. td:     db      esc,'D$',0              ;Cursor left.
  714. te:     db      esc,'J',0,0             ;Clear screen and home cursor
  715. tf:     db      '$',0,0,0               ;(can't) Enter Graphics mode
  716. tg:     db      '$',0,0,0               ;(can't) Exit Graphics mode
  717. th:     db      esc,'H$',0              ;Cursor home.
  718. ti:     db      esc,'@$',0              ;reverse linfeed
  719. tj:     db      esc,'B$',0              ;Clear to end of screen
  720. tk:     db      esc,'K$',0              ;Clear to end of line.
  721. ENDIF;cifer
  722. ;
  723. IF cifer AND NOT cifaux            ;[JAS]
  724. ; Setup string for the Cifer.. called as a prtstr param. from sysinit
  725. ciferi: db      esc,'/'                 ;Setup cifer for on line
  726.         db      esc,'*['                ; direct mode on
  727.         db      esc,'%'                 ; protocol on host line on
  728.         db      esc,'*~x'               ; protocol is xon/xoff
  729.         db      esc,'*('                ; protocol out on host is xon/xoff
  730.         db      esc,'?  NNNY',cr        ; set VL port to space parity
  731.                                         ; It cannot do NONE.. Thanks a lot
  732.         db      '$'                     ; all done
  733. ; Finish string for the Cifer.. called as a prtstr param. from sysexit
  734. cifero: db      esc,'&'            ; Host input protocol off
  735.         db      esc,'*)'        ; Host output protocol off
  736.         db      esc,'*]'        ; Direct mode off
  737.         db      esc,'\'            ; Setup cifer for off line
  738.         db      '$'
  739. ; Break string for cifer VL port.
  740. brkmes: db      esc,'*"$'               ;Send a break command string
  741. ENDIF;cifer AND NOT cifaux     [13]
  742.  
  743. ovlend    equ    $    ; End of overlay
  744.  
  745.     END
  746. 
  747.