home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / CPM / BYE5 / B5EA-3.IQS / B5EA-3.INS
Text File  |  2000-06-30  |  5KB  |  203 lines

  1. ; B5EA-3.INS  -  Eagle IIE Series insert for BYE5  -  02/15/86
  2. ;
  3. ;           Z80 SIO and CTC 8340 timer
  4. ;
  5. ; Note:  This is an insert, not an overlay.
  6. ;
  7. ; This version is for the Eagle IIE Series computers using channel 'A'
  8. ; Z80 SIO.  The Z80-CTC is used as the baud rate generator.
  9. ;
  10. ;
  11. ; NOTE:  The Eagle does not support DTR on pin 20 or DCD on pin 8, so
  12. ;     be sure you wire the modem cable like this:
  13. ;
  14. ;              modem    Eagle
  15. ;
  16. ;           TXD     2  -->  2  RXD
  17. ;           RXD     3  <--  3  TXD
  18. ;           GND     7  ---  7  GND
  19. ;           DCD     8  -->  5  CTS
  20. ;           DTR    20  <--  4  RTS
  21. ;
  22. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  23. ;
  24. ; 02/15/86  Added additional code to poke Baud Rate values to High Memory
  25. ;    v3     as the Eagle IIE warm boot routine always looks for a value
  26. ;        in memory and re-initializes the port with these values.
  27. ;        Set the value of HIMEM to your machine.  The three vaules I
  28. ;        have encountered are:
  29. ;
  30. ;        0DE3AH for bundled hard disk operating system (IIE/IV)
  31. ;        0E23AH for Xebec operating system (File 10 added to
  32. ;               floppy system)
  33. ;        0EA3AH for floppy-only system  (IIE/II)
  34. ;
  35. ;        Also corrected error in the RS-232C Pin-out information for
  36. ;        the Eagle IIE which uses a non-standard convention on the
  37. ;        serial ports.  Pins 2/3 are are reversed from the norm.
  38. ;                    - Ken Kosakowski
  39. ;
  40. ; 12/01/85  Fixed the LOADBD routine to output correctly, thanks to
  41. ;    v2     Dennis Recla        - Irv Hoff
  42. ;
  43. ; 07/17/85  Written for use with BYE5    - Irv Hoff
  44. ;    v1
  45. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  46. ;
  47. ;-----------------------------------------------------------------------
  48. ;
  49. ; Note: For Port A, Data = 18H, CTC = 01H, Port B, Data = 1AH, CTC = 02H
  50. ;
  51. PORT    EQU    18H        ; Data port
  52. MDCTL1    EQU    PORT+1        ; Status/control port
  53. BRPORT    EQU    01H        ; Baud rate port
  54. HIMEM    EQU    0E23AH        ; Location that the warm boot routine
  55.                 ; Peeks to re-initialize baudrate on
  56.                 ; Warm boot
  57. ;
  58. BD300    EQU    47D0H        ; 62400/300  (first half is CTC command)
  59. BD1200    EQU    4734H        ; 62400/1200
  60. BD2400    EQU    471AH        ; 62400/2400
  61. ;
  62. MBD300    EQU    0734H        ; 124800/300  (first half is CTC command)
  63. MBD1200    EQU    4768H        ; 124800/1200
  64. MBD2400    EQU    4734H        ; 124800/2400
  65. ;
  66. ;
  67. ;-----------------------------------------------------------------------
  68. ;
  69. ; See if we still have a carrier - if not, return with the zero flag set
  70. ;
  71. MDCARCK:MVI    A,10H        ; Reset status
  72.     OUT    MDCTL1
  73.     IN    MDCTL1        ; Get status
  74.     ANI    20H        ; Check for data carrier
  75.     RET
  76. ;.....
  77. ;
  78. ;
  79. ; Disconnect and wait for an incoming call
  80. ;
  81. MDINIT:    MVI    A,18H        ; Reset channel
  82.     OUT    MDCTL1
  83.     MVI    A,4        ; Setup to write register 4
  84.     OUT    MDCTL1
  85.     MVI    A,84H        ; *1 stop, 8 bits, no parity, 32x
  86.     OUT    MDCTL1
  87.     MVI    A,5        ; Setup to write register 5
  88.     OUT    MDCTL1
  89.     MVI    A,68H        ; Clear RTS causing hangup
  90.     OUT    MDCTL1
  91.     PUSH    B        ; Save in case it's being used elsewhere
  92.     MVI    B,20        ; 2 seconds delay to drop any carrier
  93. ;
  94. OFFTI:    CALL    DELAY        ; 0.1 second delay
  95.     DCR    B
  96.     JNZ    OFFTI        ; Keep looping until finished
  97.     POP    B        ; Restore bc
  98.     MVI    A,3        ; Setup to write register 3
  99.     OUT    MDCTL1
  100.     MVI    A,0C1H        ; Initialize receive register
  101.     OUT    MDCTL1
  102.     MVI    A,5        ; Setup to write register 5
  103.     OUT    MDCTL1
  104.     MVI    A,0EAH        ; Turn on RTS so modem can answer phone
  105.     OUT    MDCTL1
  106. ;
  107.      IF    IMODEM        ; If using intelligent modem
  108.     CALL    IMINIT        ; Go initialize
  109.      ENDIF            ; IMODEM
  110. ;
  111.     RET
  112. ;.....
  113. ;
  114. ;
  115. ; Input a character from the modem port
  116. ;
  117. MDINP:    IN    PORT        ; Get character
  118.     RET
  119. ;.....
  120. ;
  121. ;
  122. ; Check the status to see if a character is available.    If not, return
  123. ; with the zero flag set.  If yes, use 0FFH to clear the flag.
  124. ;
  125. MDINST:    IN    MDCTL1        ; Get status
  126.     ANI    01H        ; Check receive ready bit
  127.     RZ            ; Return if none
  128.     ORI    0FFH        ; Otherwise, set the proper flag
  129.     RET
  130. ;.....
  131. ;
  132. ;
  133. ; Send a character to the modem
  134. ;
  135. MDOUTP:    OUT    PORT        ; Send it
  136.     RET
  137. ;.....
  138. ;
  139. ;
  140. ; See if the output is ready for another character
  141. ;
  142. MDOUTST:IN    MDCTL1
  143.     ANI    04H        ; Check transmit ready bit
  144.     RET
  145. ;.....
  146. ;
  147. ;
  148. ; Reinitialize the modem and hang up the phone by dropping DTR and
  149. ; leaving it inactive.
  150. ;
  151. MDQUIT:     IF    IMODEM        ; If using a smartmodem
  152.     CALL    IMQUIT        ; Tell it to shut down
  153.      ENDIF            ; IMODEM
  154. ;
  155. ;
  156. ; Called by the main program after caller types BYE
  157. ;
  158. MDSTOP:    MVI    A,5        ; Setup to write register 5
  159.     OUT    MDCTL1
  160.     MVI    A,68H        ; Clear RTS causing shutdown
  161.     OUT    MDCTL1
  162.     RET
  163. ;.....
  164. ;
  165. ;
  166. ; The following routine sets the baudrate.  BYE5 asks for the maximum
  167. ; speed you have available.
  168. ;
  169. SETINV:    ORI    0FFH        ; Make sure zero flag is not set
  170.     RET            ; Return
  171. ;.....
  172. ;
  173. ;
  174. SET300:    LXI    D,BD300        ; Get 300 bps parameters in 'HL' for CTC
  175.     LXI    H,MBD300    ; Now get the parameters for high memory
  176.     JMP    LOADBD        ; Poke them into memory
  177. ;
  178. SET1200:LXI    D,BD1200
  179.     LXI    H,MBD1200
  180.     JMP    LOADBD
  181. ;
  182. SET2400:LXI    D,BD2400
  183.     LHLD    MBD2400
  184. ;
  185. LOADBD:    MOV    A,D        ; CTC command word
  186.     OUT    BRPORT
  187.     MOV    A,E        ; Baudrate
  188.     OUT    BRPORT
  189. ;
  190. ;
  191. ; Poke the Eagle CTC code to High Memory
  192. ;
  193.     MOV    A,H        ; CTC command word
  194.     STA    HIMEM        ; Warm boot looks hear for port speed
  195.     MOV    A,L        ; Baudrate
  196.     STA    HIMEM+1
  197.     XRA    A        ; Show change was satisfactory
  198.     RET
  199. ;.....
  200. ;
  201. ;                   end
  202. ;-----------------------------------------------------------------------
  203.