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-2.INS < prev    next >
Text File  |  2000-06-30  |  4KB  |  171 lines

  1.  
  2. ; B5EA-2.INS - Eagle II and Eagle III insert for BYE5 - 12/01/85
  3. ;
  4. ;           Z80 SIO and CTC 8340 timer
  5. ;
  6. ; Note:  This is an insert, not an overlay.
  7. ;
  8. ; This version is for the Eagle II and III computers using channel "A"
  9. ; Z80 SIO.  The Z80-CTC is used as the baud rate generator.
  10. ;
  11. ;
  12. ; NOTE:  The Eagle does not support DTR on pin 20 or DCD on pin 8, so
  13. ;     be sure you wire the modem cable like this:
  14. ;
  15. ;              modem     Eagle       
  16. ;            
  17. ;           TXD      2  -->  3  RXD
  18. ;           RXD     3  <--     2  TXD
  19. ;           GND     7  ---     7  GND
  20. ;           DCD     8  -->  5  CTS
  21. ;           DTR    20  <--     4  RTS
  22. ;
  23. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  24. ;
  25. ; 12/01/85  Fixed the LOADBD routine to output correctly, thanks to
  26. ;        Dennis Recla        - Irv Hoff
  27. ;
  28. ; 07/17/85  Written for use with BYE5    - Irv Hoff
  29. ;
  30. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  31. ;
  32. ;-----------------------------------------------------------------------
  33. ;
  34. ; Note: For Port A, Data = 18H, CTC = 01H, Port B, Data = 1AH, CTC = 02H
  35. ;
  36. PORT    EQU    18H        ; Data port
  37. MDCTL1    EQU    PORT+1        ; Status/control port
  38. BRPORT    EQU    01H        ; Baud rate port
  39. ;
  40. ;
  41. BD300:    DW    47D0H        ; 62400/300  (first half is CTC command)
  42. BD1200:    DW    4734H        ; 62400/1200
  43. BD2400:    DW    471AH        ; 62400/2400
  44. ;
  45. ;
  46. ;-----------------------------------------------------------------------
  47. ;
  48. ; See if we still have a carrier - if not, return with the zero flag set
  49. ;
  50. MDCARCK:MVI    A,10H        ; Reset status
  51.     OUT    MDCTL1
  52.     IN    MDCTL1        ; Get status
  53.     ANI    20H        ; Check for data carrier
  54.     RET
  55. ;.....
  56. ;
  57. ;
  58. ; Disconnect and wait for an incoming call
  59. ;
  60. MDINIT:    MVI    A,18H        ; Reset channel
  61.     OUT    MDCTL1
  62.     MVI    A,4        ; Setup to write register 4
  63.     OUT    MDCTL1
  64.     MVI    A,84H        ;*1 stop, 8 bits, no parity, 32x
  65.     OUT    MDCTL1
  66.     MVI    A,5        ; Setup to write register 5
  67.     OUT    MDCTL1
  68.     MVI    A,68H        ; Clear RTS causing hangup
  69.     OUT    MDCTL1
  70.     PUSH    B        ; Save in case it's being used elsewhere
  71.     MVI    B,20        ; 2 seconds delay to drop any carrier
  72. ;
  73. OFFTI:    CALL    DELAY        ; 0.1 second delay
  74.     DCR    B
  75.     JNZ    OFFTI        ; Keep looping until finished
  76.     POP    B        ; Restore bc
  77.     MVI    A,3        ; Setup to write register 3
  78.     OUT    MDCTL1
  79.     MVI    A,0C1H        ; Initialize receive register
  80.     OUT    MDCTL1
  81.     MVI    A,5        ; Setup to write register 5
  82.     OUT    MDCTL1
  83.     MVI    A,0EAH        ; Turn on RTS so modem can answer phone
  84.     OUT    MDCTL1
  85. ;
  86.      IF    IMODEM        ; If using intelligent modem
  87.     CALL    IMINIT        ; Go initialize
  88.      ENDIF            ; IMODEM
  89. ;
  90.     RET
  91. ;.....
  92. ;
  93. ;
  94. ; Input a character from the modem port
  95. ;
  96. MDINP:    IN    PORT        ; Get character
  97.     RET
  98. ;.....
  99. ;
  100. ;
  101. ; Check the status to see if a character is available.    If not, return
  102. ; with the zero flag set.  If yes, use 0FFH to clear the flag.
  103. ;
  104. MDINST:    IN    MDCTL1        ; Get status
  105.     ANI    01H        ; Check receive ready bit
  106.     RZ            ; Return if none
  107.     ORI    0FFH        ; Otherwise, set the proper flag
  108.     RET
  109. ;.....
  110. ;
  111. ;
  112. ; Send a character to the modem
  113. ;
  114. MDOUTP:    OUT    PORT        ; Send it
  115.     RET
  116. ;.....
  117. ;
  118. ;
  119. ; See if the output is ready for another character
  120. ;
  121. MDOUTST:IN    MDCTL1
  122.     ANI    04H        ; Check transmit ready bit
  123.     RET
  124. ;.....
  125. ;
  126. ;
  127. ; Reinitialize the modem and hang up the phone by dropping DTR and
  128. ; leaving it inactive.
  129. ;
  130. MDQUIT:     IF    IMODEM        ; If using a smartmodem
  131.     CALL    IMQUIT        ; Tell it to shut down
  132.      ENDIF            ; IMODEM
  133. ;
  134. ;
  135. ; Called by the main program after caller types BYE
  136. ;
  137. MDSTOP:    MVI    A,5        ; Setup to write register 5
  138.     OUT    MDCTL1
  139.     MVI    A,68H        ; Clear RTS causing shutdown
  140.     OUT    MDCTL1
  141.     RET
  142. ;.....
  143. ;
  144. ;
  145. ; The following routine sets the baudrate.  BYE5 asks for the maximum
  146. ; speed you have available.
  147. ;
  148. SETINV:    ORI    0FFH        ; Make sure zero flag is not set
  149.     RET            ; Return
  150. ;.....
  151. ;
  152. ;
  153. SET300:    LHLD    BD300        ; Get 300 bps parameters in 'HL'
  154.     JMP    LOADBD        ; Go load them
  155. ;
  156. SET1200:LHLD    BD1200
  157.     JMP    LOADBD
  158. ;
  159. SET2400:LHLD    BD2400
  160. ;
  161. LOADBD:    MOV    A,H        ; CTC command word
  162.     OUT    BRPORT
  163.     MOV    A,L        ; Baudrate
  164.     OUT    BRPORT
  165.     XRA    A
  166.     RET
  167. ;.....
  168. ;
  169. ;                   end
  170. ;-----------------------------------------------------------------------
  171.