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 / B5SY-1.IQS / B5SY-1.INS
Text File  |  2000-06-30  |  4KB  |  179 lines

  1.  
  2. ; B5MD-1.INS - BYE5 insert for Sanyo 1000/1100/1200/1250 - 09/29/85
  3. ;
  4. ;        8251A and no baudrate generator
  5. ;
  6. ; Pin 8 (DCD) from the modem must be connected to the USART's DSR input,
  7. ; usually Pin 6.
  8. ;
  9. ;         Note:  This is an insert, not an overlay.
  10. ;
  11. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  12. ;
  13. ; 02/07/86  Added Sayno 1100 as an option    - Irv Hoff
  14. ; 09/29/85  Original version for BYE5        - Irv Hoff
  15. ;
  16. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  17. ;
  18. ;
  19. NO    EQU    0
  20. YES    EQU    NOT NO
  21. ;
  22. ;
  23. MBC1000    EQU    NO
  24. MBC1100 EQU    YES
  25. MBC1200 EQU    NO
  26. ;
  27. ;
  28.      IF    MBC1000
  29. PORT    EQU    0FEH        ; Data port
  30.      ENDIF
  31. ;
  32.      IF    MBC1100
  33. PORT    EQU    0DCH        ; Data port
  34.      ENDIF
  35. ;
  36.      IF    MBC1200
  37. PORT    EQU    0ECH        ; Data port
  38.      ENDIF
  39. ;
  40. ;
  41. ;The following define the port address to use
  42. ;
  43. MDCTL1    EQU    PORT+1        ; Status/control port
  44. ;
  45. ;
  46. ; NOTE: The DIP switches must be set for 1200 bps for this to work
  47. ; this to work.
  48. ;    
  49. BPORT    EQU    MDCTL1        ; Baud rate port=8251 control
  50. ;
  51. ;
  52. ;-----------------------------------------------------------------------
  53. ;
  54. ;
  55. ; See if we still have a carrier - if not, return with the zero flag set
  56. ;
  57. MDCARCK:IN    MDCTL1        ; Get status
  58.     ANI    80H        ; Check DSR bit for a carrier
  59.     RET
  60. ;.....
  61. ;
  62. ;
  63. ; Disconnect and wait for an incoming call
  64. ;
  65. MDINIT:    MVI    A,10H        ; Clear DTR
  66.     OUT    MDCTL1        ; Causing hangup
  67.     PUSH    B        ; Preserve in case we need it
  68.     MVI    B,20        ; 2 second delay
  69. ;
  70. OFFTI:    CALL    DELAY        ; 0.1 second delay
  71.     DCR    B
  72.     JNZ    OFFTI        ; Keep looping until finnished
  73.     POP    B        ; Restore BC
  74.     MVI    A,17H        ; Assert DTR so that modem
  75.     OUT    MDCTL1        ; Can answer phone
  76.     XCHG            ; Small delay
  77.     XCHG            ; Small delay
  78. ;
  79.      IF    IMODEM
  80.     CALL    IMINIT
  81.      ENDIF            ; IMODEM
  82. ;
  83.     RET
  84. ;.....
  85. ;
  86. ;
  87. ; Input a character from the modem port
  88. ;
  89. MDINP:    IN    PORT        ; Get character
  90.     RET
  91. ;.....
  92. ;
  93. ;
  94. ; Check the status to see if a character is available.    If not, return
  95. ; with the zero flag set.  If yes, use 0FFH to clear the flag.
  96. ;
  97. MDINST:    IN    MDCTL1        ; Get status
  98.     ANI    02H        ; Check the receive ready bit
  99.     RZ            ; Return if none
  100.     ORI    0FFH        ; We have a character
  101.     RET
  102. ;.....
  103. ;
  104. ;
  105. ; Send a character to the modem
  106. ;
  107. MDOUTP:    OUT    PORT        ; Send it
  108.     RET
  109. ;.....
  110. ;
  111. ;
  112. ; See if the output is ready for another character
  113. ;
  114. MDOUTST:IN    MDCTL1
  115.     ANI    01H        ; Check the transmit ready bit
  116.     RET
  117. ;.....
  118. ;
  119. ;
  120. ; Reinitialize the modem and hang up the phone by dropping DTR and
  121. ; leaving it inactive.
  122. ;
  123. MDQUIT:     IF    IMODEM
  124.     CALL    IMQUIT        ; Tell smartmodem to quit
  125.      ENDIF            ; IMODEM
  126. ;
  127. ;
  128. ; Called by the main program after caller types BYE
  129. ;
  130. MDSTOP:    MVI    A,10H        ; Turn off DTR
  131.     OUT    MDCTL1
  132.     RET
  133. ;.....
  134. ;
  135. ;
  136. ;-----------------------------------------------------------------------
  137. ;             Start of rev 1.x speeds
  138. ;
  139. ; The following routine sets the baudrate.  BYE5 asks for the maximum
  140. ; speed you have available.
  141. ;
  142. SET2400    EQU    $        ; Only supports 300/1200
  143. ;
  144. SETINV:    ORI    0FFH        ; Make sure zero flag not set
  145.     RET
  146. ;.....
  147. ;
  148. ;
  149. SET300:    MVI    B,BD300
  150.     JMP    SETBAUD
  151. ;
  152. SET1200:MVI    B,BD1200
  153. ;
  154. SETBAUD:MVI    A,47H        ; Reset, enable Rx, DTR, Tx
  155.     OUT    MDCTL1        ; Rx,Tx enabled
  156.     XCHG            ; Small delay
  157.     XCHG            ; Small delay
  158.     MOV    A,B        ; Recover Baud Rate Word
  159.     OUT    BPORT
  160.     XCHG            ; Small delay
  161.     XCHG            ; Small delay
  162.     MVI    A,17H        ; ERR reset, DTR, Rx, Tx all on
  163.     OUT    MDCTL1
  164.     XCHG            ; Small delay
  165.     XCHG            ; Small delay
  166.     XRA    A        ; Say rate OK
  167.     RET
  168. ;.....
  169. ;
  170. ;
  171. ; Values to switch the 8251 between x16 and x64 for rev 1.x boards
  172. ;
  173. BD300    EQU    4FH        ; 300 baud
  174. BD1200    EQU    4EH        ; 1200 bps
  175. ;
  176. ;
  177. ;                   end
  178. ;------------------------------------------------------
  179.