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 / B5DP-1.INS < prev    next >
Text File  |  2000-06-30  |  4KB  |  173 lines

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