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

  1. ;
  2. ; B5SV-1.INS - BYE5 insert for Servo-8 Single board computer - 08/02/85
  3. ;
  4. ;        Z80 DART and Z80 CTC baudrate generator
  5. ;
  6. ; This routine adapts the Servo-8 single board computer to BYE5. Baudrate is 
  7. ; sent to the baudrate generator upon powerup, from default
  8. ; jumpers.
  9. ;
  10. ;      ****  Note:  This is an insert, not an overlay.  ****
  11. ;
  12. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  13. ; 08/02/85  Converted for the Servo-8 computer
  14. ;        from B3AD-0.INS & changed name to 
  15. ;           B5SV-1.INS                          - Paul Leighly
  16. ; 06/10/85  Rewritten for BYE335 and later    - Irv Hoff
  17. ; 05/15/85  First version of B3AD        - John Sojak
  18. ;
  19. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  20. ;
  21. ;
  22. PORT    EQU    06H        ; Data port
  23. MDCTL1    EQU    PORT+1        ; Modem control port
  24. BRPORT    EQU    09H        ; Set baud rate generator base port
  25. ;
  26. MDRCV    EQU    1        ; Modem receive ready bit
  27. MDSND    EQU    4        ; Modem send ready bit
  28. MDDCD    EQU    8        ; Data carrier detect
  29. ;
  30. ;
  31. ; Divisors for the CTC baudrate geneator
  32. ;
  33. BD300    EQU    0        ; 300 baud
  34. BD1200    EQU    40H        ; 1200 bps
  35. BD2400    EQU    10              ; 2400 bps
  36. ;
  37. ;
  38. ;-----------------------------------------------------------------------
  39. ;
  40. ; See if we still have a carrier - if not, return with the zero flag set
  41. ;
  42. MDCARCK:MVI    A,10H        ; Reset status
  43.     OUT    MDCTL1
  44.     IN    MDCTL1        ; Get status
  45.     ANI    MDDCD        ; Check for carrier
  46.     RET
  47. ;.....
  48. ;
  49. ;
  50. ; Disconnect and wait for an incoming call
  51. ;
  52. MDINIT:    MVI    A,0        ; Setup to write register 0
  53.     OUT    MDCTL1
  54.     MVI    A,18H        ; Reset channel
  55.     OUT    MDCTL1
  56.     MVI    A,4        ; Setup to write register 4
  57.     OUT    MDCTL1
  58.     MVI    A,84H        ; Set 32x, 1 stop bit, no parity
  59.     OUT    MDCTL1
  60.     MVI    A,3        ; Setup to write register 3
  61.     OUT    MDCTL1
  62.     MVI    A,0C1H        ; 8 bits, Rx enable
  63.     OUT    MDCTL1
  64.     MVI    A,5        ; Setup to write register 5
  65.     OUT    MDCTL1
  66.     MVI    A,6AH        ; DTR off
  67.     OUT    MDCTL1
  68.     PUSH    B        ; Save in case it's being used elsewhere
  69.     MVI    B,20        ; 2 second delay to drop any carrier
  70. ;
  71. OFFTI:    CALL    DELAY        ; 1 second delay
  72.     DCR    B
  73.     JNZ    OFFTI        ; Keep looping until finished
  74.     POP    B        ; Restore 'BC'
  75.     MVI    A,5        ; Setup to write register 5
  76.     OUT    MDCTL1
  77.     MVI    A,0EAH        ; Turn DTR back on
  78.     OUT    MDCTL1
  79. ;
  80.      IF    IMODEM        ; If using an intellegent modem
  81.     CALL    IMINIT        ; Go initialize it now
  82.      ENDIF            ; IMODEM
  83. ;
  84.     RET
  85. ;.....
  86. ;
  87. ;
  88. ; Input a character from the modem port
  89. ;
  90. MDINP:    IN    PORT        ; Get character
  91.     ANI    7FH        ; Strip parity
  92.     RET
  93. ;.....
  94. ;
  95. ;
  96. ; Check the status to see if a character is available.    If not, return
  97. ; with the zero flage set.  If yes, use 0FFH to clear the flag.
  98. ;
  99. MDINST:    IN    MDCTL1        ; Get status
  100.     ANI    MDRCV        ; Got a character
  101.     RZ            ; Return if none
  102.     ORI    0FFH        ; Otherwise set the proper flag
  103.     RET
  104. ;.....
  105. ;
  106. ;
  107. ; Send a character to the modem
  108. ;
  109. MDOUTP:    OUT    PORT        ; Send it
  110.     RET
  111. ;.....
  112. ;
  113. ;
  114. ; See if the output is ready for another character
  115. ;
  116. MDOUTST:IN    MDCTL1        ; Get status
  117.     ANI    MDSND        ; Ready for a character?
  118.     RET
  119. ;.....
  120. ;
  121. ;
  122. ; Reinitialize the modem and hang up the phone by dropping DTR and
  123. ; leaving it inactive.
  124. ;
  125. MDQUIT:     IF    IMODEM
  126.     CALL    IMQUIT
  127.      ENDIF            ; IMODEM
  128. ;
  129. ;
  130. ; Called by the main program after caller types BYE
  131. ;
  132. MDSTOP:    MVI    A,5        ; Setup to write register 5
  133.     OUT    MDCTL1
  134.     MVI    A,6AH        ; Turn off DTR until next time
  135.     OUT    MDCTL1
  136.     RET
  137. ;.....
  138. ;
  139. ;
  140. ; The following routine sets the baudrate.  BYE5 asks for the maximum
  141. ; speed you have available.
  142. ;
  143. SETINV:    ORI    0FFH        ; Make sure zero flag is not set
  144.     RET
  145. ;.....
  146. ;
  147. ;
  148. SET300:    MVI    A,47H
  149.     OUT    BRPORT
  150.     MVI    A,BD300
  151.     OUT    BRPORT
  152.     RET
  153. ;
  154. SET1200:MVI    A,47H
  155.     OUT    BRPORT
  156.     MVI    A,BD1200
  157.     OUT    BRPORT
  158.     RET
  159. ;
  160. SET2400:MVI    A,47H
  161.     OUT    BRPORT
  162.     MVI    A,BD2400
  163.     OUT    BRPORT
  164.     RET
  165. ;
  166. ;.....
  167. ;
  168. ;                   end
  169. ------------------------------------------------------------------------:
  170. 0
  171.     OUT    BRPORT
  172.     RET
  173. ;
  174. ;.....
  175. ;
  176. ;                   en