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 / NUEA-1.IQS / nuea-1.ins
Text File  |  1986-04-26  |  4KB  |  145 lines

  1. ; NUEA-1.INS - Eagle II and Eagle III insert for NUBYE - 04/21/86
  2. ;
  3. ; Z80 SIO and CTC 8340 timer
  4. ;
  5. ; Note:  This is an insert, not an overlay.
  6. ;
  7. ; This version is for the Eagle II and III computers using channel "A"
  8. ; Z80 SIO.  The Z80-CTC is used as the baud rate generator.
  9. ;
  10. ; NOTE:  The Eagle does not support DTR on pin 20 or DCD on pin 8, so
  11. ;     be sure you wire the modem cable like this:
  12. ;
  13. ;              modem     Eagle       
  14. ;            
  15. ;           TXD      2  -->  3  RXD
  16. ;           RXD     3  <--     2  TXD
  17. ;           GND     7  ---     7  GND
  18. ;           DCD     8  -->  5  CTS
  19. ;           DTR    20  <--     4  RTS
  20. ;
  21. ; ========
  22. ;
  23. ; 04/21/86  Modified for NUBYE
  24. ; 12/01/85  Fixed the LOADBD routine to output correctly, thanks to
  25. ;           Dennis Recla        - Irv Hoff
  26. ; 07/17/85  Written for use with BYE5    - Irv Hoff
  27. ;
  28. ; ========
  29. ;
  30. ; Note: For Port A, Data = 18H, CTC = 01H, Port B, Data = 1AH, CTC = 02H
  31. ;
  32. PORT    EQU    18H        ; Data port
  33. MDCTL1    EQU    PORT+1        ; Status/control port
  34. BRPORT    EQU    1        ; Baud rate port
  35. ;
  36. BD300:    DW    47D0H        ; 62400/300  (first half is CTC command)
  37. BD1200:    DW    4734H        ; 62400/1200
  38. BD2400:    DW    471AH        ; 62400/2400
  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    20H        ; Check for data carrier
  46.     RET
  47. ;
  48. ; Disconnect and wait for an incoming call
  49. ;
  50. MDINIT:    MVI    A,18H        ; Reset channel
  51.     OUT    MDCTL1
  52.     MVI    A,4        ; Setup to write register 4
  53.     OUT    MDCTL1
  54.     MVI    A,84H        ;*1 stop, 8 bits, no parity, 32x
  55.     OUT    MDCTL1
  56.     MVI    A,5        ; Setup to write register 5
  57.     OUT    MDCTL1
  58.     MVI    A,68H        ; Clear RTS causing hangup
  59.     OUT    MDCTL1
  60.     PUSH    B        ; Save in case it's being used elsewhere
  61.     MVI    B,20        ; 2 seconds delay to drop any carrier
  62. ;
  63. OFFTI:    CALL    DELAY        ; 0.1 second delay
  64.     DCR    B
  65.     JNZ    OFFTI        ; Keep looping until finished
  66.     POP    B        ; Restore bc
  67.     MVI    A,3        ; Setup to write register 3
  68.     OUT    MDCTL1
  69.     MVI    A,0C1H        ; Initialize receive register
  70.     OUT    MDCTL1
  71.     MVI    A,5        ; Setup to write register 5
  72.     OUT    MDCTL1
  73.     MVI    A,0EAH        ; Turn on RTS so modem can answer phone
  74.     OUT    MDCTL1
  75. ;
  76.      IF    IMODEM        ; If using intelligent modem
  77.     CALL    IMINIT        ; Go initialize
  78.      ENDIF            ; IMODEM
  79. ;
  80.     RET
  81. ;
  82. ; Input a character from the modem port
  83. ;
  84. MDINP:    IN    PORT        ; Get character
  85.     RET
  86. ;
  87. ; Check the status to see if a character is available.    If not, return
  88. ; with the zero flag set.  If yes, use 0FFH to clear the flag.
  89. ;
  90. MDINST:    IN    MDCTL1        ; Get status
  91.     ANI    1        ; Check receive ready bit
  92.     RZ            ; Return if none
  93.     ORI    0FFH        ; Otherwise, set the proper flag
  94.     RET
  95. ;
  96. ; Send a character to the modem
  97. ;
  98. MDOUTP:    OUT    PORT        ; Send it
  99.     RET
  100. ;
  101. ; See if the output is ready for another character
  102. ;
  103. MDOUTST:IN    MDCTL1
  104.     ANI    4        ; Check transmit ready bit
  105.     RET
  106. ;
  107. ; Reinitialize the modem and hang up the phone by dropping DTR and
  108. ; leaving it inactive.
  109. ;
  110. MDQUIT:     IF    IMODEM        ; If using a smartmodem
  111.     CALL    IMQUIT        ; Tell it to shut down
  112.      ENDIF            ; IMODEM
  113. ;
  114. ; Called by the main program after caller types BYE
  115. ;
  116. MDSTOP:    MVI    A,5        ; Setup to write register 5
  117.     OUT    MDCTL1
  118.     MVI    A,68H        ; Clear RTS causing shutdown
  119.     OUT    MDCTL1
  120.     RET
  121. ;
  122. ; The following routine sets the baudrate.  NUBYE asks for the maximum
  123. ; speed you have available.
  124. ;
  125. SETINV:    ORI    0FFH        ; Make sure zero flag is not set
  126.     RET            ; Return
  127. ;
  128. SET300:    LHLD    BD300        ; Get 300 bps parameters in 'HL'
  129.     JMP    LOADBD        ; Go load them
  130. ;
  131. SET1200:LHLD    BD1200
  132.     JMP    LOADBD
  133. ;
  134. SET2400:LHLD    BD2400
  135. ;
  136. LOADBD:    MOV    A,H        ; CTC command word
  137.     OUT    BRPORT
  138.     MOV    A,L        ; Baudrate
  139.     OUT    BRPORT
  140.     XRA    A
  141.     RET
  142. ;
  143. ; end of insert
  144. ; -------------
  145.