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 / B5CM-1.IQS / B5CM-1.INS
Text File  |  2000-06-30  |  5KB  |  160 lines

  1.  
  2. ; B5CM-1.INS  -   BYE5 insert for Cermetek modems  -  07/17/85
  3. ;
  4. ;       Cermetek Infomate 212A modem control package
  5. ;
  6. ;          Note:  This is an insert, not an overlay.
  7. ;
  8. ;
  9. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  10. ;
  11. ; 07/17/85  Renamed for use with BYE5        - Irv Hoff
  12. ; 12/14/84  Written for BYE3            - Paul Traina
  13. ;
  14. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  15. ;
  16. ;
  17. ; To use this code, the BYE5 routines for your USART must be modified:
  18. ;
  19. ;    IMODEM    EQU    YES    ; Yes, using intelligent modem
  20. ;
  21. ;    After all USART and baud rate instructions have been executed
  22. ;    and IMMEDIATELY after DTR has been set logic true, (DTR must be
  23. ;    On for the Cermetek to receive and execute commands), add the
  24. ;    following:
  25. ;
  26. ;         IF    IMODEM
  27. ;        CALL    IMINIT
  28. ;         ENDIF
  29. ;
  30. ; The following hardware configuration is assumed:
  31. ; -----------------------------------------------
  32. ;    DTR (Pin 20) is supported
  33. ;    DCD (Pin 8) is supported
  34. ;    RI  (Pin 22) is NOT supported
  35. ;
  36. ; The following software configuration is assumed:
  37. ; -----------------------------------------------
  38. ;    CWAIT    EQU    20    ; Wait up to 20 seconds for carrier
  39. ;    CLOSS    EQU    1    ; If carrier lost wait 1 sec. to hang-up
  40. ;    NORING    EQU    YES    ; Yes, UART ring indicator not available
  41. ;
  42. ; The following Infomate 212A default switches are assumed:
  43. ; --------------------------------------------------------
  44. ;    1=On   asynchronous mode
  45. ;    2=Off  8 data bits
  46. ;    3=Off  DCD active only when carrier is present
  47. ;    4=On   host controls DTR
  48. ;    5=On   battery backup enabled
  49. ;    6=Off  not using exclusion key phone
  50. ;    7=On   undocumented, should be on
  51. ;    8=Off  undocumented, should be off
  52. ;
  53. ; Notes:
  54. ; -----
  55. ;    The Cermetek will automatically set itself to the speed of the
  56. ;    calling modem, provided the speed is 300 or 1200 baud.    This
  57. ;    relieves us of the need to set the modem (still have to check
  58. ;    and set the USART/baud), via software instructions.
  59. ;
  60. ; Command strings sent to modem:
  61. ; -----------------------------
  62. ;    a. '  XY\r'
  63. ;           Lets the modem "learn" what baud rate we're using.
  64. ;
  65. ;    b. The meaning of the second command string follows:
  66. ;      '^NN ~'  Set command character to tilde ('~').
  67. ;      '~P 04'  Do not echo commands, disconnect on loss of carrier
  68. ;      '~U 1'   Tell modem to ignore commands when carrier present
  69. ;      '~C 1'   Tell modem to answer phone after first ring
  70. ;
  71. ;    c. When the operator aborts BYE by typing a ^C when waiting for
  72. ;       a call to come in, the modem should be sent a command string
  73. ;       to reset it to a more "user-friendly" state, and also tell
  74. ;       the modem to stop answering calls.  This third command string
  75. ;       is as follows:
  76. ;      '^NN ~'  Make sure tilde is command character
  77. ;      '~C 0'   Disable auto-answer
  78. ;      '~P 44'  Echo commands
  79. ;
  80. ;-----------------------------------------------------------------------
  81. ;
  82. ;
  83. ; Initialize the Infomate 212a.  DTR must be logic true for the modem to
  84. ; receive and process a command.
  85. ;
  86. IMINIT:    CALL    IMLERN        ; Make modem learn current baud rate
  87.     DB    '  XY',CR
  88.     DB    '  XY',CR,0
  89.     CALL    IMSEND        ; No delay - do not answer the phone
  90.     DB    'N'-40H        ; Send attention character
  91.     DB    'N ~',CR    ; Set new attention character
  92.     DB    '~P 04',CR    ; Disable command echo, enable carrier
  93.     DB    '~U 1',CR    ; Do not process command char if carrier
  94.     DB    '~C 1',CR,0    ; Answer phone after first ring
  95.     RET
  96. ;.....
  97. ;
  98. ;
  99. ; Send string slowly for modem to find baud rate
  100. ;
  101. IMLERN:    MVI    A,YES        ; Set delay flag to yes
  102.     STA    DLYFLG
  103.     XTHL            ; Save HL and get text address
  104.     PUSH    B        ; Save BC
  105.     JMP    IMSEN1        ; Continue with normal routine
  106. ;.....
  107. ;
  108. ;
  109. ; De-initialize the Cermetek.  DTR must be set logic true for modem to
  110. ; receive and process a command.  The ring register setting should be
  111. ; set to 0 so that the modem will not answer calls, also some other re-
  112. ; gisters should be reset, then after all is done, the USART routines
  113. ; should turn off DTR.
  114. ;
  115. IMQUIT:    CALL    IMLERN        ; Make modem learn baud rate
  116.     DB    '  XY',CR
  117.     DB    '  XY',CR,0
  118.     CALL    IMSEND        ; No delay - tell modem to shutdown
  119.     DB    'N'-'@'        ; Send attention character
  120.     DB    'N ~',CR    ; Set new attention character
  121.     DB    '~P 44',CR    ; Enable command echo
  122.     DB    '~U 1',CR    ; Do not process command char if carrier
  123.     DB    '~C 0',CR,0    ; Do not answer phone
  124.     RET
  125. ;.....
  126. ;
  127. ;
  128. ; Send the Command String to the modem, similiar to how ILPRT sends to
  129. ; console.
  130. ;
  131. IMSEND:    XRA    A        ; Make sure there is no delay
  132.     STA    DLYFLG
  133.     XTHL            ; Save HL and get address of message
  134.     PUSH    B        ; Save BC
  135. ;
  136. IMSEN1:    CALL    MDOUTST        ; Get the modem output status
  137.     JZ    IMSEN1        ; Not ready to send yet
  138.     MOV    A,M        ; If ready, get the character
  139.     CALL    MDOUTP        ; Send the character
  140.     INX    H        ; Point to next character
  141.     CALL    DELAY        ; Wait 100 ms here
  142.     MOV    A,M        ; Get next character
  143.     ORA    A        ; Are we all done?
  144.     PUSH    PSW
  145.     LDA    DLYFLG        ; Check to see if we should delay
  146.     ORA    A
  147.     CNZ    DELAY        ; If flag is set, delay another 100ms
  148.     POP    PSW        ; ..for a total of 200ms delay.
  149.     JNZ    IMSEN1        ; If not done, go do another
  150.     POP    B        ; Otherwise restore BC
  151.     XTHL            ; Restore HL and get return address
  152.     RET
  153. ;.....
  154. ;
  155. ;
  156. DLYFLG:    DB    0        ; Delay flag
  157. ;
  158. ;                   end
  159. ;-----------------------------------------------------------------------
  160.