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 / NUBYE / NUBY-INS.LBR / NUDV-1.IQS / nudv-1.ins
Text File  |  1986-04-26  |  4KB  |  158 lines

  1. ; NUDV-1.INS - DATAVUE 3000 insert for NUBYE - 04/21/86
  2. ;
  3. ; DART I/O and CTC timer.
  4. ;
  5. ; Note:  This is an insert, not an overlay.
  6. ;
  7. ; This version is for the DATAVUE 3000 using channel "A" of the
  8. ; Z80 DART.  The Z80-CTC is used as the baud rate generator.
  9. ;
  10. ;
  11. ; ========
  12. ;
  13. ; 04/21/86  Modified for NUBYE
  14. ; 09/10/85  Minor modifications    for BYE5xx        - Tom Brady
  15. ; 07/06/85  Modified for DATAVUE 3000            - Jim Gooch
  16. ; 06/10/85  Written for use with BYE335 and later    - Irv Hoff
  17. ; 02/08/84  Initial Version                - Jerry Haigwood
  18. ;
  19. ; ========
  20. ;
  21. PORT    EQU    0B0H        ; Data port
  22. MDCTL1    EQU    PORT+1        ; Status/control port
  23. BRPORT    EQU    071H        ; Baud rate port
  24. ;
  25. BD300:    DB    80H    ;(first half is CTC count)
  26. BD1200:    DB    20H    ;(second is CTC command)
  27. BD2400:    DB    10H
  28. BD9600:    DB    4
  29. ;
  30. ; See if we still have a carrier - if not, return with the zero flag set
  31. ;
  32. MDCARCK:
  33.     MVI    A,10H        ; Reset status, RR0
  34.     OUT    MDCTL1
  35.     IN    MDCTL1        ; Get status
  36.     ANI    8        ; Check for data carrier
  37.     RET
  38. ;
  39. ; Disconnect and wait for an incoming call
  40. ;
  41. MDINIT:    DI
  42.     MVI    A,18H        ; ERR RESET, WREG 0
  43.     OUT    MDCTL1
  44.     MVI    A,11H        ; RST EXT/STAT INT, WREG 1
  45.     OUT    MDCTL1
  46.     XRA    A        ; DISABLE ALL INTERRUPTS
  47.     OUT    MDCTL1
  48.     MVI    A,4        ; WREG 4
  49.     OUT    MDCTL1
  50.     MVI    A,44H        ; 16X,8,N,1
  51.     OUT    MDCTL1
  52.     MVI    A,5        ; WREG 5
  53.     OUT    MDCTL1
  54.     MVI    A,68H        ; Clear RTS causing hangup
  55.     OUT    MDCTL1
  56.     PUSH    B        ; Save in case it's being used elsewhere
  57.     MVI    B,20        ; 2 seconds delay to drop any carrier
  58.     CALL    DLP1        
  59.     MVI    A,3        ; Setup to write register 3
  60.     OUT    MDCTL1
  61.     MVI    A,0C1H        ; Initialize receive register
  62.     OUT    MDCTL1
  63.     MVI    A,5        ; Setup to write register 5
  64.     OUT    MDCTL1
  65.     MVI    A,0EAH        ; Turn on RTS so modem can answer phone
  66.     OUT    MDCTL1        ; DTR, 8 BITS, TX ENA, RTS
  67.     MVI    A,10H        ; Reset status, RR0
  68.     OUT    MDCTL1
  69.     MVI    B,2        ; slight additional delay
  70.     CALL    DLP1
  71.     POP    B
  72. ;
  73.      IF    IMODEM        ; If using intelligent modem
  74.     CALL    IMINIT        ; Go initialize
  75.      ENDIF            ; IMODEM
  76. ;
  77.     EI            ; enable interrupts
  78.     RET
  79. ;
  80. ; Input a character from the modem port
  81. ;
  82. MDINP:
  83.     IN    PORT        ; Get character
  84.     RET
  85. ;
  86. ; Check the status to see if a character is available.    If not, return
  87. ; with the zero flag set.  If yes, use 0FFH to clear the flag.
  88. ;
  89. MDINST:
  90.     MVI    A,10H        ; Reset status, RR0
  91.     OUT    MDCTL1
  92.     IN    MDCTL1        ; Get status
  93.     ANI    1        ; Check receive ready bit
  94.     RZ            ; Return if none
  95.     ORI    0FFH        ; Otherwise, set the proper flag
  96.     RET
  97. ;
  98. ; Send a character to the modem
  99. ;
  100. MDOUTP:    OUT    PORT        ; Send it
  101.     RET
  102. ;
  103. ; See if the output is ready for another character
  104. ;
  105. MDOUTST:
  106.     MVI    A,10H        ; Reset status, RR0
  107.     OUT    MDCTL1
  108.     IN    MDCTL1        ; Get status
  109.     ANI    4        ; Check transmit ready bit
  110.     RET
  111. ;
  112. ; Reinitialize the modem and hang up the phone by dropping DTR and
  113. ; leaving it inactive.
  114. ;
  115. MDQUIT:
  116.      IF    IMODEM        ; If using a smartmodem
  117.     CALL    IMQUIT        ; Tell it to shut down
  118.      ENDIF            ; IMODEM
  119. ;
  120. ; Called by the main program after caller types BYE
  121. ;
  122. MDSTOP:    MVI    A,5        ; Setup to write register 5
  123.     OUT    MDCTL1
  124.     MVI    A,68H        ; Clear RTS causing shutdown
  125.     OUT    MDCTL1
  126.     RET
  127. ;
  128. ; The following routine sets the baudrate.  NUBYE asks for the maximum
  129. ; speed you have available.
  130. ;
  131. SETINV:
  132.     ORI    0FFH        ; Make sure zero flag is not set
  133.     RET            ; Return
  134. ;
  135. SET300:
  136.     DI
  137.     LXI    H,BD300        ; Get 300 bps parameters in 'HL'
  138.     JMP    SETBAUD        ; Go load them
  139. ;
  140. SET1200:
  141.     DI
  142.     LXI    H,BD1200
  143.     JMP    SETBAUD
  144. ;
  145. SET2400:
  146.     DI
  147.     LHLD    BD2400
  148. ;
  149. SETBAUD:    
  150.     MVI    A,47H        ; CTC command word
  151.     OUT    BRPORT
  152.     MOV    A,M    ; Baudrate
  153.     OUT    BRPORT
  154.     EI
  155.     RET
  156. ;
  157. ; end of insert
  158. ; -------------