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 / NUAP-1.IQS / nuap-1.ins
Text File  |  1986-04-26  |  4KB  |  168 lines

  1. ; NUAP-1.INS - APPLE ][ with Mountain CPS Serial Card - 04/21/86
  2. ;
  3. ; 2651 with internal baudrate generator
  4. ;
  5. ; NOTE: This is an insert, not an overlay.
  6. ;
  7. ; WARNING:  Carrier detect (DCD) from the modem must go to DSR input on
  8. ;        the 2651 to provide proper operation for both autodialing
  9. ;        and autoreceiving.    If you use the DCD input, it requires
  10. ;        voltage (normally unavailable) during dialing to allow
  11. ;        result codes to be used.  See NUCP-x.INS for more information
  12. ;        on this 2651 peculiarity.  This program assumes you use the
  13. ;        DSR pin 80H to check carrier from the modem.
  14. ;
  15. ; ========
  16. ;
  17. ; 04/21/86  Modified for NUBYE
  18. ; 09/14/85  Changes to MDINIT, corrected error in B2400, 
  19. ;           added support for B4800, B9600        - Norman Beeler
  20. ; 07/17/85  Written to work with BYE5            - Irv Hoff
  21. ; 01/20/84  Created overlay using BY2-2651.ASM        - Norman Beeler
  22. ;
  23. ; ========
  24. ;
  25. ; Define the CPS card slot you are using (normally 1 or 2)
  26. ;
  27. SLOT    EQU    2        ; CPM card slot
  28. ;
  29. ; Modem port equates
  30. ;
  31. PORT    EQU    0E0FAH+SLOT*100H ; Modem data port
  32. MDCTL1    EQU    0E0FBH+SLOT*100H ; Modem status port
  33. XPORT    EQU    0E0FEH+SLOT*100H ; Modem swap port
  34. ;
  35. ;Mode port equates
  36. ;
  37. EBASE    EQU    70H        ; Mode register 2 base
  38. B300    EQU    EBASE+5        ; 300 baud
  39. B1200    EQU    EBASE+7        ; 1200 bps
  40. B2400    EQU    EBASE+10    ; 2400 bps
  41. B4800    EQU    EBASE+12    ; 4800 bps
  42. B9600    EQU    EBASE+14    ; 9600 bps
  43. ;
  44. ; See if we still have a carrier - if not, return with the zero flag set
  45. ;
  46. MDCARCK:LDA    MDCTL1        ; Read port
  47.     ANI    80H        ; Check DSR for carrier (do not use DCD)
  48.     RET
  49. ;
  50. ; Disconnect and wait for an incoming call
  51. ;
  52. MDINIT:     IF    HS2400
  53.     CALL    SET2400
  54.      ENDIF            ; HS2400
  55. ;
  56.      IF    HS1200
  57.     CALL    SET1200
  58.      ENDIF            ; HS1200
  59. ;
  60.      IF    HS300
  61.     CALL    SET300
  62.      ENDIF            ; HS300
  63. ;
  64.     CALL    DELAY
  65.     MVI    A,80H        ; Open CPS command register
  66.     STA    XPORT        ; By storing 80H in XPORT
  67.     MVI    A,5        ; Turn DTR off, modem will quit
  68.     STA    MDCTL1
  69.     MVI    B,20        ; 2 seconds to drop any carrier
  70. ;
  71. MDINIT1:CALL    DELAY        ; .1 second delay
  72.     DCR    B
  73.     JNZ    MDINIT1
  74.     MVI    A,27H        ; With DTR on, modem accepts commands
  75.     STA    MDCTL1
  76.     XRA    A        ; Close the command port
  77.     STA    XPORT        ; By storing 0 in XPORT
  78. ;
  79.      IF    IMODEM
  80.     CALL    IMINIT        ; Initialize smartmodem
  81.      ENDIF            ; IMODEM
  82. ;
  83.     RET
  84. ;
  85. ; Input a character from the modem port
  86. ;
  87. MDINP:    LDA    PORT        ; Get character
  88.     RET
  89. ;
  90. ; Check the status to see if a character is available.    If not, return
  91. ; with the zero flag set.  If yes, use 0FFH to clear the flag.
  92. ;
  93. MDINST:    LDA    MDCTL1        ; Read port
  94.     ANI    2        ; Check receive ready bit
  95.     RZ            ; Nope, nothing there
  96.     ORI    0FFH        ; We got something...
  97.     RET
  98. ;
  99. ; Send a character to the modem
  100. ;
  101. MDOUTP:    STA    PORT        ; Send it
  102.     RET
  103. ;
  104. ; See if the output is ready for another character
  105. ;
  106. MDOUTST:LDA    MDCTL1        ; Read port
  107.     ANI    1        ; Check transmit ready bit
  108.     RET
  109. ;
  110. ; Reinitialize the modem and hang up the phone by dropping DTR and
  111. ; leaving it inactive.
  112. ;
  113. MDQUIT:     IF    IMODEM
  114.     CALL    IMQUIT        ; Initialize modem to default settings
  115.      ENDIF            ; IF IMODEM
  116. ;
  117. ; Called by the main program after caller types BYE
  118. ;
  119. MDSTOP:    MVI    A,80H        ; Open CPS command register
  120.     STA    XPORT        ; By storing 80H in XPORT
  121.     MVI    A,15H        ; Turn DTR off, modem will quit
  122.     STA    MDCTL1
  123.     CALL    DELAY        ; Let it stabilize
  124.     RET
  125. ;
  126. ; The following routine sets the baudrate.  NUBYE5 asks for the maximum
  127. ; speed you have available.
  128. ;
  129. SETINV:    ORI    0FFH        ; Make sure the Zero flag isn't set
  130.     RET
  131. ;
  132. SET300:    CALL    BSETUP
  133.     MVI    A,B300
  134.     JMP    FSETUP
  135. ;
  136. SET1200:CALL    BSETUP
  137.     MVI    A,B1200
  138.     JMP    FSETUP
  139. ;
  140. SET2400:CALL    BSETUP
  141.     MVI    A,B2400
  142.     JMP    FSETUP
  143. ;
  144. SET4800:CALL    BSETUP
  145.     MVI    A,B4800
  146.     JMP    FSETUP
  147. ;
  148. SET9600:CALL    BSETUP
  149.     MVI    A,B9600
  150.     JMP    FSETUP
  151. ;
  152. BSETUP:    MVI    A,80H
  153.     STA    XPORT
  154.     MVI    A,37H        ; Initialize the serial chip
  155.     STA    MDCTL1        ; By storing 37H in MDCTL1
  156.     MVI    A,4EH        ; 1 stop, 8 bits, no parity
  157.     STA    PORT
  158.     XRA    A
  159.     RET
  160. ;
  161. FSETUP:    STA    PORT
  162.     XRA    A
  163.     STA    XPORT        ; Close command port by storing 0
  164.     RET
  165. ;
  166. ; end of insert
  167. ; -------------
  168.