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 / MODEMS / MODEM7 / M7VG-2.AQM / M7VG-2.ASM
Assembly Source File  |  2000-06-30  |  14KB  |  399 lines

  1. ; M7VG-2.ASM -- V.G. Bitstreamer II & U.S. Robotics S-100 overlay for MDM7xx.  07/17/84
  2. ;
  3. ; This overlay adapts the MDM7xx program to the U.S. Robotics S-100
  4. ; autodial modem. It works equally as well with MEX..
  5. ;
  6. ; You will want to look this file over carefully. There are a number of
  7. ; options that you can use to configure the program to suit your taste.
  8. ;
  9. ; This overlay is capable of setting the baud rate and sending breaks.
  10. ; Although disconnecting the modem is not supported (by use of a function
  11. ; to lower DTR), the control-N command still works, as it uses "+++"
  12. ; which causes the U.S.R. S-100 modem to hang up.  If you are running a
  13. ; system which has a clock speed of more than 4 MHz, be sure to see
  14. ; the routine INITMOD, as you will have to "uncomment" some do-nothing
  15. ; time wasting statements to slow your computer down for the modem.
  16. ;
  17. ;
  18. ;    TO USE: First edit this file filling in answers for your own
  19. ;        equipment.  Then assemble with ASM.COM or equivalent
  20. ;        assembler.  Then use DDT to overlay the the results
  21. ;        of this program to the original .COM file:
  22. ;
  23. ;        A>DDT MDM7xx.COM
  24. ;        DDT VERS 2.2
  25. ;        NEXT  PC
  26. ;        4A00 0100
  27. ;        -IM7US-1.HEX        (note the "I" command)
  28. ;        -R            ("R" loads in the .HEX file)
  29. ;        NEXT  PC
  30. ;        4A00 0000
  31. ;        -G0            (return to CP/M)
  32. ;        A>SAVE 73 MDM7xx.COM    (now have a modified .COM file)
  33. ;
  34. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  35. ;
  36. ; 07/17/84 - Added Vector Graphics Bitstreamer
  37. ;            'STUFF'. NOTE: I use this overlay
  38. ;            with MEX.                          - Rod Hart WA3MEZ
  39. ; 03/17/84 - Updated to match MDM728        - Bob plouffe
  40. ; 12/21/83 - Added "commented" delays in init-
  41. ;         ialization for fast systems.    - Phil Lapsley
  42. ; 12/19/83 - Now sends AT command in the
  43. ;            initialization routine to get
  44. ;            the attention of the USR S-100     - Phil Lapsley
  45. ; 12/17/83 - Created from M7GP-1.ASM        - Phil Lapsley
  46. ; 11/11/83 - Renamed to M7GP-1.ASM, no changes    - Irv Hoff
  47. ; 07/27/83 - Renamed to work with MDM712    - Irv Hoff
  48. ; 07/01/83 - Revised to work with MDM711    - Irv Hoff
  49. ; 07/01/83 - Revised to work with MDM710    - Irv Hoff
  50. ; 05/27/83 - Updated to work with MDM709    - Irv Hoff
  51. ; 05/15/83 - Revised to work with MDM708    - Irv Hoff
  52. ; 04/11/83 - Updated to work with MDM707    - Irv Hoff
  53. ; 04/04/83 - First version of this file        - Irv Hoff
  54. ;
  55. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  56. ;
  57. TRUE:        EQU    01H
  58. FALSE:        EQU    00H
  59. ;
  60. BELL:        EQU    07H        ;bell
  61. CR:        EQU    0DH        ;carriage return
  62. ESC:        EQU    1BH        ;escape
  63. LF:        EQU    0AH        ;linefeed
  64. ;
  65. YES:        EQU    0FFH
  66. NO:        EQU    0
  67. ;
  68. ;
  69. ; Change the following information to match your equipment
  70. ;
  71. PSEL1:        EQU    FALSE        ;TRUE FOR PORT 1.
  72. PSEL2:        EQU    FALSE        ;TRUE FOR PORT 2.
  73. PSEL3:        EQU    TRUE        ;TRUE FOR PORT 3.
  74. ;
  75. BASE:        EQU    042H        ;BITSTREAMER BASE ADDR.
  76. ;
  77.     IF    PSEL1
  78. PORT:        EQU    BASE        ;1ST PORT SELECTED.
  79.     ENDIF
  80. ;
  81.     IF    PSEL2
  82. PORT:        EQU    BASE+2        ;2ND PORT SELECTED.
  83.     ENDIF
  84. ;
  85.     IF    PSEL3
  86. PORT:        EQU    BASE+4        ;3RD PORT SELECTED.
  87.     ENDIF
  88. ;
  89. MODCTL1:    EQU    PORT+1        ;MODEM CONTROL PORT
  90. MODDATP:    EQU    PORT        ;MODEM DATA IN PORT
  91. MODDATO:    EQU    PORT        ;MODEM DATA OUT PORT
  92. MODDCDB:    EQU    080H        ;CARRIER DETECT BIT
  93. MODDCDA:    EQU    080H        ;VALUE WHEN ACTIVE
  94. MODRCVB:    EQU    2        ;BIT TO TEST FOR RECEIVE
  95. MODRCVR:    EQU    2        ;VALUE WHEN READY
  96. MODSNDB:    EQU    1        ;BIT TO TEST FOR SEND
  97. MODSNDR:    EQU    1        ;VALUE WHEN READY
  98. ;
  99.         ORG    100H
  100. ;
  101. ;
  102. ; Change the clock speed to suit your system
  103. ;
  104.         DS    3    ;(for  "JMP   START" instruction)
  105. ;
  106. PMMIMODEM:    DB    NO    ;yes=PMMI S-100 Modem            103H
  107. SMARTMODEM:    DB    YES    ;yes=HAYES Smartmodem, no=non-PMMI    104H
  108. TOUCHPULSE:    DB    'T'    ;T=touch, P=pulse (Smartmodem-only)    105H
  109. CLOCK:        DB    55    ;clock speed in MHz x10, 25.5 MHz max.    106H
  110.                 ;20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
  111. MSPEED:        DB    5    ;0=110 1=300 2=450 3=600 4=710 5=1200    107H
  112.                 ;6=2400 7=4800 8=9600 9=19200 default
  113. BYTDLY:        DB    5    ;0=0 delay  1=10ms  5=50 ms - 9=90 ms    108H
  114.                 ;default time to send character in ter-
  115.                 ;minal mode file transfer for slow BBS.
  116. CRDLY:        DB    5    ;0=0 delay 1=100 ms 5=500 ms - 9=900 ms 109H
  117.                 ;default time for extra wait after CRLF
  118.                 ;in terminal mode file transfer
  119. NOOFCOL:    DB    5    ;number of DIR columns shown        10AH
  120. SETUPTST:    DB    YES    ;yes=user-added Setup routine        10BH
  121. SCRNTEST:    DB    YES    ;Cursor control routine         10CH
  122. NORETRY        DB    NO    ;yes=DON'T ALLOW RETRY/QUIT OPTION    10DH
  123.                 ;no=ALLOW RETRY/QUIT AFTER 10 TIMEOUTS
  124. BAKUPBYTE:    DB    NO    ;yes=change any file same name to .BAK    10EH
  125. CRCDFLT:    DB    YES    ;yes=default to CRC checking        10FH
  126. TOGGLECRC:    DB    YES    ;yes=allow toggling of CRC to Checksum    110H
  127. CONVBKSP:    DB    YES    ;yes=convert backspace to rub        111H
  128. TOGGLEBK:    DB    YES    ;yes=allow toggling of bksp to rub    112H
  129. ADDLF:        DB    NO    ;no=no LF after CR to send file in    113H
  130.                 ;terminal mode (added by remote echo)
  131. TOGGLELF:    DB    YES    ;yes=allow toggling of LF after CR    114H
  132. TRANLOGON:    DB    YES    ;yes=allow transmission of logon    115H
  133.                 ;write logon sequence at location LOGON
  134. SAVCCP:        DB    YES    ;yes=do not overwrite CCP        116H
  135. LOCONEXTCHR:    DB    NO    ;yes=local command if EXTCHR precedes    117H
  136.                 ;no=external command if EXTCHR precedes
  137. TOGGLELOC:    DB    YES    ;yes=allow toggling of LOCONEXTCHR    118H
  138. LSTTST:        DB    YES    ;yes=printer available on printer port    119H
  139. XOFFTST:    DB    NO    ;yes=checks for XOFF from remote while    11AH
  140.                 ;sending a file in terminal mode
  141. XONWAIT:    DB    NO    ;yes=wait for XON after CR while    11BH
  142.                 ;sending a file in terminal mode
  143. TOGXOFF:    DB    YES    ;yes=allow toggling of XOFF checking    11CH
  144. IGNORCTL:    DB    YES    ;yes=CTL-chars above ^M not displayed    11DH
  145. EXTRA1:        DB    0    ;for future expansion            11EH
  146. EXTRA2:        DB    0    ;for future expansion            11FH
  147. BRKCHR:        DB    '@'-40H    ;^@ = Send 300 ms. break tone        120H
  148. NOCONNCT:    DB    'N'-40H    ;^N = Disconnect from the phone line    121H
  149. LOGCHR:        DB    'L'-40H    ;^L = Send logon            122H
  150. LSTCHR:        DB    'P'-40H    ;^P = Toggle printer            123H
  151. UNSAVE:        DB    'R'-40H    ;^R = Close input text buffer        124H
  152. TRANCHR:    DB    'T'-40H ;^T = Transmit file to remote        125H
  153. SAVECHR:    DB    'Y'-40H    ;^Y = Open input text buffer        126H
  154. EXTCHR:        DB    '^'-40H    ;^^ = Send next character        127H
  155. ;
  156. ;
  157.         DS    2        ;                128H
  158. ;
  159. IN$MODCTL1:    IN    MODCTL1    ! RET    ;in modem control port        12AH
  160.         DS    7
  161. OUT$MODDATP:    OUT    MODDATP ! RET    ;out modem data port        134H
  162.         DS    7
  163. IN$MODDATP:    IN    MODDATP ! RET    ;in modem data port        13EH
  164.         DS    7
  165. ANI$MODRCVB:    ANI    MODRCVB    ! RET    ;bit to test for receive ready    148H
  166.  
  167. CPI$MODRCVR:    CPI    MODRCVR    ! RET    ;value of rcv. bit when ready    14BH
  168. ANI$MODSNDB:    ANI    MODSNDB    ! RET    ;bit to test for send ready    14EH
  169. CPI$MODSNDR:    CPI    MODSNDR    ! RET    ;value of send bit when ready    151H
  170.         DS    6        ;                156H
  171. ;
  172. OUT$MODCTL1:    OUT    MODCTL1    ! RET    ;out modem control port #1    15AH
  173. OUT$MODCTL2:    RET  !    NOP  !  NOP    ;ctl-port #2 is not used    15DH
  174. ;
  175. LOGONPTR:    DW    LOGON        ;for user message.        160H
  176.         DS    6        ;                162H
  177. JMP$GOODBYE:    JMP    GOODBYE        ;                168H
  178. JMP$INITMOD:    JMP    INITMOD        ;go to user written routine    16BH
  179.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    16EH
  180.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    171H
  181.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    174H
  182. JMP$SETUPR:    JMP    SETUPR        ;                177H
  183. JMP$SPCLMENU:    JMP    SPCLMENU    ;                17AH
  184. JMP$SYSVER:    JMP    SYSVER        ;                17DH
  185. JMP$BREAK:    JMP    SENDBRK        ;                180H
  186. ;
  187. ;
  188. ; Do not change the following six lines.
  189. ;
  190. JMP$ILPRT:    DS    3        ;                183H
  191. JMP$INBUF    DS    3        ;                186H
  192. JMP$INLNCOMP:    DS    3        ;                189H
  193. JMP$INMODEM    DS    3        ;                18CH
  194. JMP$NXTSCRN:    DS    3        ;                18FH
  195. JMP$TIMER    DS    3        ;                192H
  196. ;
  197. ;
  198. ; Routine to clear to end of screen.  If using CLREOS and CLRSCRN, set
  199. ; SCRNTEST to YES at 010AH (above).
  200. ;
  201. CLREOS:        CALL    JMP$ILPRT    ;                195H
  202.         DB    1BH,6BH,0,0,0    ;                198H
  203.         RET            ;                19DH
  204. ;
  205. CLRSCRN:    CALL    JMP$ILPRT    ;                19EH
  206.         DB    0CH,0,0,0,0    ;                1A1H
  207.         RET            ;                1A6H
  208.     
  209. ;
  210. SYSVER:        CALL    JMP$ILPRT    ;                1A7H
  211.         DB    'Version for U.S.R. Password modem',CR,LF
  212.         DB    '              and',CR,LF
  213.         DB    ' Vector Graphics Bitstreamer II',CR,LF
  214.     IF    PSEL1
  215.         DB    '            (PORT 1)',CR,LF,LF
  216.     ENDIF
  217. ;
  218.     IF    PSEL2
  219.         DB    '            (PORT 2)',CR,LF,LF
  220.     ENDIF
  221. ;
  222.     IF    PSEL3
  223.         DB    '            (PORT 3)',CR,LF,LF
  224.     ENDIF
  225.         DB    0
  226.         RET
  227. ;.....
  228. ;
  229. ;
  230. ;-----------------------------------------------------------------------
  231. ;
  232. ; NOTE:  You can change the SYSVER message to be longer or shorter.  The
  233. ;     end of your last routine should terminate by 0400H (601 bytes
  234. ;     available after start of SYSVER) if using the Hayes Smartmodem
  235. ;     or by address 0C00H (2659 bytes) otherwise.
  236. ;
  237. ;-----------------------------------------------------------------------
  238. ;
  239. ; You can put in a message at this location which can be called up with
  240. ; CTL-O if TRANLOGON has been set TRUE.  You can use several lines if
  241. ; desired.  End with a 0.
  242. ;
  243. LOGON:        DB    'How are you today?',CR,LF,0
  244. ;.....
  245. ;
  246. ;
  247. ; The following routine sends a break "character" to the remote
  248. ; computer for 300 ms.  The "MSPEED" value is needed to decide whether
  249. ; or not the modem is at 300 or 1200 baud.  The routine must
  250. ; know this because U.S.R. set up the RTS bit of the command resgister
  251. ; as a baud rate selection bit, and this routine must be careful not
  252. ; to change it, or the user will end up at a different baud rate
  253. ; after the break "character" is sent.  Note that the "MVI A, 01FH" does
  254. ; not change any flags.
  255. ;
  256. SENDBRK:    MVI    A, 03FH        ; Otherwise, set up for 300/1200
  257. SBRK2:        OUT    MODCTL1        ; Send break
  258.         PUSH    PSW        ; Save value
  259.         MVI    B, 3        ; 300 ms delay value
  260.         CALL    JMP$TIMER    ; Wait that long
  261.         POP    PSW        ; Restore command byte
  262.         ANI    0F7H        ; Turn off break bit
  263.         OUT    MODCTL1        ; Send command byte to UART
  264.         RET
  265. ;.....
  266. ;
  267. ;
  268. ; The U.S.R. S-100 does not have a "quick-disconnect" feature like
  269. ; the Hayes does (by lowering DTR).  Therefore, "GOODBYE" is not
  270. ; implemented.  Yet control-N still works to hang up (see note
  271. ; above in introduction)
  272. ;
  273. GOODBYE:    RET
  274. ;.....
  275. ;
  276. ;
  277. ; You can use this area for any special initialization or setup you may
  278. ; wish to include.  Each must stop with a RET.    This initialization
  279. ; sets up 300 baud, 8 data bits, 1 stop bit, no parity.  Due to a
  280. ; quirk in the U.S.R. S-100 (it seems to have plenty of 'em), after
  281. ; you change baud rates, you should send an "AT" followed by a
  282. ; carriage return.  Therefore, this is done after every initialization
  283. ; when there is no carrier present.
  284. ;
  285. ; NOTE: The U.S.R. S-100 does not operate too well at clock speeds of
  286. ;    over 4 MHz.  If you are running at that speed or higher, you
  287. ;    should uncomment (by removing the preceding semicolon) the
  288. ;    lines with XCHG.  These serve as time wasting routines to
  289. ;    let the U.S.R. S-100 catch up.  This is not a problem when
  290. ;    doing character I/O, as the program checks to see if the
  291. ;    modem is ready to accept a character.
  292. ;
  293. INITMOD:      XRA    A        ; Zero accumulator
  294.         OUT    MODCTL1        ; Clear 8251A
  295.         XCHG            ; For fast systems
  296.         XCHG            ; For fast systems
  297.         OUT    MODCTL1        ; Twice
  298.         XCHG            ; For fast systems
  299.         XCHG            ; For fast systems
  300.         OUT    MODCTL1        ; Three times, even
  301.         XCHG            ; For fast systems
  302.         XCHG            ; For fast systems
  303.         MVI    A, 040H        ; Reset UART command
  304.         OUT    MODCTL1
  305.         XCHG            ; For fast systems
  306.         XCHG            ; For fast systems
  307. MODEBT:        MVI    A, 04EH        ; 8 bits, 1 stop, no parity
  308.         OUT    MODCTL1
  309.         XCHG            ; For fast systems
  310.         XCHG            ; For fast systems
  311. CMDBT:        MVI    A, 037H        ; On hook, Tx/Rx enable, reset errs
  312.         OUT    MODCTL1
  313.         XCHG            ; For fast systems
  314.         XCHG            ; For fast systems
  315. BDCODE:        MVI    A, 5        ; 1200 baud code
  316.         STA    MSPEED
  317.         IN    MODCTL1        ; Get the current status
  318.         ANI    MODDCDB        ; See if there is a carrier
  319.         RNZ            ; If so, don't do AT stuff
  320.         MVI    B, 1        ; 100 ms
  321.         CALL    JMP$TIMER    ; Wait that long for things to settle
  322.         MVI    B, 'A'        ; "A" of AT command
  323.         CALL    OUTMOD        ; Output to the modem
  324.         MVI    B, 'T'        ; "T" of AT command
  325.         CALL    OUTMOD        ; Output
  326.         MVI    B, CR        ; Followed by a carriage return
  327.         CALL    OUTMOD        ; Output that too
  328.         RET
  329. ;
  330. ; Output a character to the U.S.R. S-100
  331. ; (NOTE: This routine is not normally present in most overlays,
  332. ;      and is used by the INITMOD routine above.)
  333. ;
  334. OUTMOD        IN    MODCTL1        ; Get status
  335.         ANI    MODSNDB        ; Mask for ready status
  336.         JZ    OUTMOD        ; Loop if not ready
  337.         MOV    A, B        ; Otherwise get the character
  338.         OUT    MODDATP        ; Output to the data port
  339.         RET            ; And return
  340.  
  341. ;
  342. ; This routine prompts the user for a new baud rate
  343. ; (on the U.S.R. this can be 300 or 1200, as mdm7xx
  344. ; has no provision for 150 baud) and sets the modem to that
  345. ; baud rate.
  346. ;
  347. SETUPR:        LXI    D, BAUDBUF    ; Point to new input buffer
  348.         CALL    JMP$ILPRT    ; Print following line:
  349.         DB    'Input baud rate (300, 1200): ', 0
  350.         CALL    JMP$INBUF    ; Get a line into the buffer
  351.         LXI    D, BAUDBUF + 2    ; compare BAUDBUF+2 with characters
  352.         CALL    JMP$INLNCOMP
  353.         DB    '300', 0
  354.         JNC    OK300
  355.         CALL    JMP$INLNCOMP
  356.         DB    '1200', 0
  357.         JNC    OK1200
  358.         CALL    JMP$ILPRT
  359.         DB    '++ Incorrect entry ++', CR, LF, BELL, 0
  360.         JMP    SETUPR        ; Try again
  361. ;
  362. OK300:        LXI    B, BD300    ; Point to intializers for 300 baud
  363.         MVI    A, 1        ; 300 baud value
  364.         JMP    LOADBD        ; Go load it
  365. ;
  366. ;
  367. OK1200:        LXI    B, BD1200
  368.         MVI    A, 5
  369. ;
  370. LOADBD:        STA    BDCODE + 1    ; Change baud rate code value
  371.         LDAX    B        ; Get mode byte value
  372.         STA    MODEBT + 1    ; Change mode byte
  373.         INX    B        ; Point to cmd byte
  374.         LDAX    B        ; Get cmd byte
  375.         STA    CMDBT + 1    ; Change cmd byte
  376.         JMP    INITMOD        ; (Re)initialize modem
  377. ;
  378. ; Baudrate parameters (mode byte, command byte)
  379. ; All values give 8 data bits, 1 stop bit, no parity.
  380. ;
  381. BD300:        DB    04FH, 037H    ; 300 baud
  382. BD1200:        DB    04EH, 037H    ; 1200 baud
  383. ;
  384. BAUDBUF:    DB    10, 0
  385.         DS    10
  386. ;
  387. ; If using the Hayes Smartmodem this is unavailable without a special
  388. ; change.
  389. ;
  390. SPCLMENU:  RET
  391. ;
  392. ;
  393. ; NOTE:  MUST TERMINATE PRIOR TO 0400H (with Smartmodem)
  394. ;                 0C00H (without Smartmodem)
  395. ;.....
  396. ;
  397.       END
  398. ;
  399.