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 / B5NH-1.INS < prev    next >
Text File  |  2000-06-30  |  3KB  |  151 lines

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