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

  1.  
  2. ; B5SB-2.INS - Intertec Superbrain overlay file for BYE5 - 03/17/86
  3. ;
  4. ;      BYE5 routine for 8251A and BR1941 baudrate generator
  5. ;
  6. ;           NOTE:  This is an insert, not an overlay.
  7. ;
  8. ;
  9. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  10. ;
  11. ; 03/17/86  Added some missing equates        - Irv Hoff
  12. ; 07/17/85  Written for use with BYE5        - Irv Hoff
  13. ;
  14. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  15. ;
  16. ; The following define the port addresses to use
  17. ;
  18. PORT    EQU    58H        ; Modem base port
  19. MDCTL1    EQU    59H        ; Modem control port
  20. BRPORT    EQU    60H        ; BR1941 baudrate generator port
  21. ;
  22. MDMODE    EQU    82H        ; Insures 8251 is out of mode, DTR high
  23. MDRSET    EQU    42H        ; Resets USART for additional commands
  24. MDSET1    EQU    4EH        ; 1 stop bit, no parity, 8 bits, x16
  25. MDSET2    EQU    0CEH        ; 2 stop bits, no parity, 8 bits, x16
  26. ;
  27. ;
  28. ; Baudrate table
  29. ;
  30. BD300    EQU    57H        ; Modem 300,  printer 1200
  31. BD1200    EQU    77H        ; Modem 1200, printer 1200
  32. BD2400    EQU    0A7H        ; Modem 2400, printer 1200
  33. BD9600    EQU    0E7H        ; Modem 9600, printer 1200
  34. ;
  35. ;
  36. ;-----------------------------------------------------------------------
  37. ;
  38. ; See if we still have a carrier - if not, return with the zero flag set
  39. ;
  40. MDCARCK:IN    MDCTL1        ; Get status
  41.     ANI    80H        ; Check DSR for carrier from modem
  42.     RET
  43. ;.....
  44. ;
  45. ;
  46. ; Disconnect and wait for an incoming call.
  47. ;
  48. MDINIT:    MVI    A,10H        ; Clear DTR
  49.     OUT    MDCTL1        ; Causing hangup
  50.     PUSH    B        ; Preserve in case we need it
  51.     MVI    B,20        ; 2 seconds to drop DTR
  52.  
  53. OFFTI:    CALL    DELAY        ; 0.1 second delay
  54.     DCR    B
  55.     JNZ    OFFTI        ; Keep waiting until carrier drops
  56.     POP    B        ; Restore BC
  57.     MVI    A,MDMODE    ; Insure 8251 is out of mode
  58.     OUT    MDCTL1
  59.     XTHL            ; Delay a little
  60.     XTHL            ; Delay a little
  61.     MVI    A,MDRSET    ; Reset the 8251A for new command
  62.     OUT    MDCTL1
  63.     XTHL
  64.     XTHL
  65.     MVI    A,MDSET1    ; Set stop pulse, no parity 8 bits, x16
  66.     OUT    MDCTL1
  67.     XTHL
  68.     XTHL
  69.     MVI    A,17H        ; Reset error flags, RCV, DTR, TX ready
  70.     OUT    MDCTL1
  71.     XTHL
  72.     XTHL
  73. ;
  74.      IF    IMODEM
  75.     CALL    IMINIT        ; Initialize smartmodem
  76.      ENDIF            ; IMODEM
  77. ;
  78.     RET
  79. ;.....
  80. ;
  81. ;
  82. ; Input a character from the modem port
  83. ;
  84. MDINP:    IN    PORT        ; Get character
  85.     RET
  86. ;.....
  87. ;
  88. ;
  89. ; Check the status to see if a character is available.    If not, return
  90. ; with the zero flag set.  If yes, use 0FFH to clear the flag.
  91. ;
  92. MDINST:    IN    MDCTL1        ; Get status
  93.     ANI    02H        ; Check the receive ready flag
  94.     RZ            ; Return if none
  95.     IN    MDCTL1        ; Get status again
  96.     ANI    30H        ; Check for framing and overrun
  97.     JZ    MDINST1        ; No errors
  98.     MVI    A,17H        ; Reset error flags
  99.     OUT    MDCTL1
  100.     XRA    A        ; Return false
  101.     RET
  102. ;...
  103. ;
  104. ;
  105. MDINST1:ORI    0FFH        ; We have a character
  106.     RET
  107. ;.....
  108. ;
  109. ;
  110. ; Send a character to the modem
  111. ;
  112. MDOUTP:    OUT    PORT        ; Send it
  113.     RET
  114. ;.....
  115. ;
  116. ;
  117. ; See if the output is ready for another character
  118. ;
  119. MDOUTST:IN    MDCTL1
  120.     ANI    01H        ; Check transmit ready flag
  121.     RET
  122. ;.....
  123. ;
  124. ;
  125. ; Reinitialize the modem and hang up the phone by dropping DTR and
  126. ; leaving it inactive.
  127. ;
  128. MDQUIT:     IF    IMODEM
  129.     CALL    IMQUIT
  130.      ENDIF            ; IMODEM
  131. ;
  132. ;
  133. ; Called by the main program after caller types BYE
  134. ;
  135. MDSTOP:    MVI    A,10H        ; DTR low hangs up phone, keep DTR low
  136.     OUT    MDCTL1        ;   so will not auto-answer at any time
  137.     RET
  138. ;.....
  139. ;
  140. ;
  141. ; The following routine sets the baudrate.
  142. ;
  143. SETINV:    MVI    A,0FFH
  144.     ORA    A        ; Make sure the Zero flag isn't set
  145.     RET
  146. ;.....
  147. ;
  148. ;
  149. SET300:    MVI    A,BD300        ; Load 300 baud
  150.     JMP    SETSPD
  151. ;
  152. SET1200:MVI    A,BD1200    ; Poke in 1200 bps
  153.     JMP    SETSPD
  154. ;
  155. SET2400:MVI    A,BD2400    ; Load 1200 bps
  156. ;
  157. SETSPD:    OUT    BRPORT
  158.     XRA    A        ; Say it is ok
  159.     RET
  160. ;.....
  161. ;
  162. ;                   end
  163. ;-----------------------------------------------------------------------
  164.