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 / B5AP-2.INS < prev    next >
Text File  |  2000-06-30  |  4KB  |  195 lines

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