home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / simtel / sigm / vols100 / vol181 / flip44.a86 < prev    next >
Encoding:
Text File  |  1994-07-13  |  5.0 KB  |  200 lines

  1.     TITLE    'FLIP - Toggle originate/answer mode under "bye"'
  2. ;
  3. ;    Originally written by Bruce Ratoff.
  4. ;
  5. ;    VERSION LIST: Most recent version first
  6. ;
  7. ;29/Feb/84 Ran through XLT86 to get CP/M-86 version. Bill Bolton
  8. ;
  9. ;18/Jan/84 Added code for bank select on Godbout Intefacer 3/4
  10. ;       I/O board and fiddled a little with the equates.
  11. ;       Version 4.2 Bill Bolton, Software Tools RCPM
  12. ;    
  13. ;17/Jun/82 Added  short  signon  message  with  version  number
  14. ;       equate inserted into message.  Changed prompts to be
  15. ;       consistent with my "FLIP" option in BYE72D (or later)
  16. ;       Bill Bolton, Software Tools RCPM, Australia
  17. ;
  18. ;12/Jun/82 Added timeout before flip OK  message, to allow time
  19. ;       remote modem  to  detect  new carrier, seems to take
  20. ;       about 5 seconds for  CCITT  V21 when going to ANSWER
  21. ;       mode. Bill Bolton, Software Tools RCPM, Australia
  22. ;
  23. ;11/Jun/82 Added code to toggle mode rather than just change to
  24. ;          answer  as CCITT systems have less marked difference
  25. ;          in performance than BELL 103A systems and  switching
  26. ;          to answer mode isn't always a good solution. Now the
  27. ;          remote  user  can  go  back  to  originate.  Removed
  28. ;          PMMI/Hayes stuff (because CCITT users can't use them
  29. ;          and  it isn't really clear what some of the hardware
  30. ;          specific  stuff  does  when  you've  never seen  one
  31. ;          [and  are never likely to]) and set up  for  Telecom
  32. ;          Australia modem. Message rewritten to lower case and
  33. ;          63 char line. Bill Bolton, Software Tools RCPM
  34. ;
  35. ;08/Aug/80 Added conditional assembly for either
  36. ;       PMMI or D C Hayes modem cards (BR)
  37. ;
  38. ;06/Jun/80 PMMI modem conditionals and to re-ask for
  39. ;       input if invalid answer. Keith Petersen, W8SDZ.
  40. ;
  41. ;02/Jun/80 Uppercase message and require exactly
  42. ;       control-c or return, ignoring all else. (BR)
  43. ;
  44. FALSE    EQU    0            ;BASIC LOGIC DEFINITIONS
  45. TRUE    EQU    NOT FALSE
  46. ;
  47. SPEED    EQU    7*4167            ;CPU speed in MHz x a constant
  48. SECONDS    EQU    6*10            ;Number of seconds to pause x 10
  49. ;
  50. INTER3    EQU    TRUE            ;True for CompuPro Interfacer 3/4
  51. ;
  52. MODEM    EQU    06H            ;Modem USART bank number
  53. BASE    EQU    10H            ;Interfacer 3/4 base port number
  54. MODCTL    EQU    13H            ;2651 UART command port
  55. BANK    EQU    17H            ;Interfacer 3/4 bank select port
  56. RTS    EQU    20H            ;RTS bit in comand byte
  57. ;
  58. WBOOT    EQU    0            ;CP/M warm boot entry point
  59. BDOS    EQU    5            ;CP/M BDOS entry point
  60. DBUFF    EQU    80H
  61. ;
  62. PMESSG    EQU    9
  63. CHRINP    EQU    1
  64. ALF    EQU    0AH            ;Ascii line feed
  65. ACR    EQU    0DH            ;Ascii carriage return
  66. ;
  67. VER    EQU    4            ;Major version level
  68. REV    EQU    4            ;Minor revision level
  69. ;
  70. M    EQU    Byte Ptr 0[BX]
  71. ;
  72.     CSEG
  73. ;
  74. FLIP:
  75.     MOV    CL,PMESSG
  76.     MOV    DX,(Offset SIGNON)
  77.     INT    224
  78.  
  79.     if    inter3
  80.     MOV    AL,MODEM
  81.     OUT    BANK,AL            ;Select modem USART
  82.     endif    ;inter3
  83.  
  84.     IN    AL,MODCTL
  85.     AND    AL,RTS            ;In answer mode?
  86.     JNZ    FLIP0
  87.     CALL    ORIGINATE        ;Yes
  88. FLIP0:
  89.     MOV    CL,PMESSG
  90.     MOV    DX,(Offset SWITCHMSG)
  91.     INT    224
  92. ;
  93. FLIP1:
  94.     MOV    CL,PMESSG
  95.     MOV    DX,(Offset SELECTMSG)
  96.     INT    224
  97.     MOV    CL,CHRINP
  98.     INT    224
  99.     AND    AL,05FH            ;Mask to upper case
  100.     CMP    AL,'N'
  101.     JZ    ABORT            ;"No" answer, abort with a message
  102.     CMP    AL,'Y'            ;"Yes" answer
  103.     JNZ    FLIP1            ;No match, ask for another input
  104. ;
  105. ;SET MODEM FOR DTR ON & ORIGINATE
  106. ;
  107.     if    inter3
  108.     MOV    AL,MODEM
  109.     OUT    BANK,AL            ;Select modem USART
  110.     endif    ;inter3
  111.  
  112.     IN    AL,MODCTL        ;Get mode
  113.     XOR    AL,RTS
  114.     OUT    MODCTL,AL        ;Flip the mode
  115.     MOV    CH,SECONDS        ;Wait a few seconds 
  116. PAUSE:
  117.     CALL    DELAY            ;Wait 0.1 seconds
  118.     DEC    CH            ;Done?
  119.     JNZ    PAUSE            ;No
  120.     MOV    CL,PMESSG        ;Yes, show message
  121.     MOV    DX,(Offset DONEMSG)
  122.     INT    224
  123.     MOV    CL,0            ;EXIT TO CP/M WARM BOOT
  124.     MOV    DL,0
  125.     INT    224
  126. ;
  127. ABORT:
  128.     POP    AX            ;Keep stack straight
  129.     MOV    CL,PMESSG
  130.     MOV    DX,(Offset ABORTMSG)
  131.     INT    224
  132.     MOV    CL,0
  133.     MOV    DL,0
  134.     INT    224
  135. ;
  136. ORIGINATE:
  137.     LAHF
  138.     XCHG    AL,AH
  139.     PUSH    AX
  140.     MOV    BX,(Offset OMSG)    ;Point to new message
  141.     MOV    DX,(Offset MODE)    ;Point to message to overwrite
  142.     MOV    CH,(Offset MLEN)-(Offset MODE)    ;Length of message
  143. OLOOP:
  144.     MOV    AL,M            ;Get a byte
  145.     MOV    SI,DX            ;Put a byte
  146.     MOV    [SI],AL
  147.     INC    BX            ;Adjust pointers
  148.     INC    DX
  149.     DEC    CH            ;Done?
  150.     JNZ    OLOOP            ;No
  151.     POP    AX
  152.     XCHG    AL,AH
  153.     SAHF
  154.     RET                ;Yes
  155. ;
  156. DELAY:
  157.     PUSH    CX            ;Preserve outer loop count
  158.     MOV    CX,SPEED        ;Initialise inner loop count
  159. ;
  160. ; For 0.1 sec delay
  161. ;
  162. DELAY1:
  163.     DEC    CX            ;Adjust counter
  164.     MOV    AL,CH
  165.     OR    AL,CL            ;Done ?
  166.     JNZ    DELAY1            ;No
  167.     POP    CX            ;Yes, restore outer loop count
  168.     RET
  169.  
  170.     DSEG
  171.     ORG    100H
  172. ;     
  173. SIGNON    RS    0
  174.     DB    'FLIP Version ',VER+'0','.',REV+'0',ACR,ALF,'$'
  175. ;
  176. SWITCHMSG    RS    0
  177.     DB    ACR,ALF
  178.     DB    'If you answer "Y" to the next question you have 20 seconds to'
  179.     DB    ACR,ALF,'switch your modem or acoustic coupler to the "'
  180. MODE    RS    0
  181.     DB    'ANSWER" mode.   '
  182. MLEN    RS    0
  183.     DB    ACR,ALF,'$'
  184. ;
  185. SELECTMSG    RS    0
  186.     DB    ACR,ALF,'Do you want to FLIP the modem mode (Y/N) ? ','$'
  187. ;
  188. DONEMSG    RS    0
  189.     DB    ACR,ALF,ACR,ALF
  190.     DB    'If you see this the mode change was successful.',ACR,ALF,'$'
  191. ;
  192. ABORTMSG    RS    0
  193.     DB    ACR,ALF,ACR,ALF
  194.     DB    'OK no change in mode then.',ACR,ALF,'$'
  195. ;
  196. OMSG    RS    0
  197.     DB    'ORIGINATE" mode.'
  198. ;
  199.     END
  200.