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 / M7TV-7.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  14KB  |  469 lines

  1.  
  2. ; M7TV-7.ASM -- TeleVideo TS-802/803 overlay file for MDM7xx.  09/08/84
  3. ;
  4. ; You will want to look this file over carefully. There are a number of
  5. ; options that you can use to configure the program to suit your taste.
  6. ; This file adapts the modem port on the TeleVideo TS-802 or the TS-803
  7. ; to the modem program.
  8. ;
  9. ; Edit this file for your preferences then follow the "TO USE:" example
  10. ; shown below.
  11. ;
  12. ;       NOTE:  If using a TS-803, the SENDRDY equate must be set to
  13. ;           the value of the same label in the body of MDM7.
  14. ;
  15. ; Use the "SET" command to change the baudrate when desired.  It starts
  16. ; out at 300 baud when the program is first called up.
  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 MDM740.COM
  24. ;        DDT VERS 2.2
  25. ;        NEXT  PC
  26. ;        4A00 0100
  27. ;        -IM7TV-7.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 MDM740.COM    (now have a modified .COM file)
  33. ;
  34. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  35. ;
  36. ; Or (easier and less error-prone) use MLOAD.COM instead of the above
  37. ; DDT.COM merge-technique:
  38. ;
  39. ;        A>MLOAD21 MDM.COM=MDM740.COM,M7TV-7.HEX
  40. ;
  41. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  42. ;
  43. ; 09/10/84  Reason for the last several    - Irv Hoff    
  44. ;        changes were because SENDRDY
  45. ;        is being used, not RCVREADY,
  46. ;        this is now fixed correctly
  47. ; 09/08/84  Fixed 2nd trivial 803 error - Tim Chiaretto
  48. ; 08/15/84  Fixed a trivial 803 error   - Irv Hoff
  49. ; 08/08/84  Fixed for 802/803 both with    - Irv Hoff
  50. ;        information from M7TVI-3
  51. ; 11/11/83  Renamed to M7TV-1.ASM    - Irv Hoff
  52. ; 07/27/83  Renamed to work with MDM711    - Irv Hoff
  53. ; 07/01/83  Revised to work with MDM711    - Irv Hoff
  54. ; 06/22/83  Revised to work with MDM711    - Irv Hoff
  55. ; 05/27/83  Updated to work with MDM709    - Irv Hoff
  56. ; 05/15/83  Revised to work with MDM708    - Irv Hoff
  57. ; 04/27/83  Revised to work with TV802    - Irv Hoff
  58. ; 02/17/83  Modified MDM703CF for Datapoint
  59. ;        1560 computers using an external
  60. ;        modem            - Irv Hoff
  61. ;
  62. ;=======================================================================
  63. ;
  64. YES:        EQU    0FFH
  65. NO:        EQU    0
  66. ;
  67. ;
  68. ; Select one of the following two choices for your computer
  69. ;
  70. TV802:        EQU    NO
  71. TV803:        EQU    YES
  72. ;
  73. ;
  74. ; The following address must be obtained from the body of the main pro-
  75. ; gram, if using a TV803.  Value is immaterial if using a TV802.
  76. ;
  77. SENDRDY:    EQU    1E41H        ;location of label in MDM740
  78. ;
  79. ;=======================================================================
  80. ;
  81. ; Normal equates
  82. ;
  83. BELL:        EQU    07H        ;bell
  84. CR:        EQU    0DH        ;carriage return
  85. ESC:        EQU    1BH        ;escape
  86. LF:        EQU    0AH        ;linefeed
  87. ;
  88. ;
  89. ; Special equates for Televideo computers
  90. ;
  91.          IF    TV802
  92. PORT:        EQU    20H        ;TeleVideo ST-802 data port
  93. BAUDRP:        EQU    08H        ;CTC port for baud rate
  94. MODCTL1:    EQU    PORT+2        ;modem control port
  95. MODCTL2:    EQU    PORT+2        ;modem control port
  96. MODDATP:    EQU    PORT        ;modem data port
  97. MODDCDB:    EQU    4        ;carrier detect bit
  98. MODDCDA:    EQU    0        ;value when active
  99. MODRCVB:    EQU    1        ;bit to test for receive ready
  100. MODRCVR:    EQU    1        ;value when ready
  101. MODSNDB:    EQU    4        ;bit to test for send ready
  102. MODSNDR:    EQU    4        ;value when ready
  103.          ENDIF            ;TV802
  104. ;
  105.          IF    TV803
  106. PORT:        EQU    2FH        ;TeleVideo ST-803 data port
  107. BAUDRP:        EQU    2BH        ;CTC port for baud rate
  108. MODCTL1:    EQU    PORT-2        ;modem control port for input
  109. MODCTL2:    EQU    PORT-1        ;modem control port for output
  110. MODDATP:    EQU    PORT        ;modem data port
  111. MODRCVB:    EQU    80H        ;bit to test for receive ready
  112. MODRCVR:    EQU    80H        ;value when ready
  113. MODSNDB:    EQU    80H        ;bit to test for send ready
  114. MODSNDR:    EQU    80H        ;value when ready
  115.          ENDIF            ;TV803
  116. ;
  117. ;
  118.         ORG    100H
  119. ;
  120.         DS    3    ;(for  "JMP   START" instruction)
  121. ;
  122. PMMIMODEM:    DB    NO    ;yes=PMMI S-100 Modem            103H
  123. AUTODIAL:    DB    NO    ;yes=HAYES Smartmodem, no=non-PMMI    104H
  124. TOUCHPULSE:    DB    'T'    ;T=touch, P=pulse (Smartmodem-only)    105H
  125. CLOCK:        DB    40    ;clock speed in MHz x10, 25.5 MHz max.    106H
  126.                 ;20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
  127. MSPEED:        DB    1    ;0=110 1=300 2=450 3=600 4=710 5=1200    107H
  128.                 ;6=2400 7=4800 8=9600 9=19200 default
  129. BYTDLY:        DB    5    ;0=0 delay  1=10ms  5=50 ms - 9=90 ms    108H
  130.                 ;default time to send character in ter-
  131.                 ;minal mode file transfer for slow BBS.
  132. CRDLY:        DB    5    ;0=0 delay 1=100 ms 5=500 ms - 9=900 ms 109H
  133.                 ;default time for extra wait after CRLF
  134.                 ;in terminal mode file transfer
  135. NOOFCOL:    DB    5    ;number of DIR columns shown        10AH
  136. SETUPTST:    DB    YES    ;yes=user-added Setup routine        10BH
  137. SCRNTEST:    DB    YES    ;Cursor control routine         10CH
  138. RETRY:        DB    NO    ;yes=reset the error limit to try again    10DH
  139.                 ;no=abort after 10 consecutive errors
  140. BAKUPBYTE:    DB    NO    ;yes=change any file same name to .BAK    10EH
  141. CRCDFLT:    DB    YES    ;yes=default to CRC checking        10FH
  142. TOGGLECRC:    DB    YES    ;yes=allow toggling of CRC to Checksum    110H
  143. CONVRUB:    DB    YES    ;yes=convert rub to backspace        111H
  144. TOGGLERUB:    DB    YES    ;yes=allow toggling of rub to backspace    112H
  145. ADDLF:        DB    NO    ;no=no LF after CR to send file in    113H
  146.                 ;terminal mode (added by remote echo)
  147. TOGGLELF:    DB    YES    ;yes=allow toggling of LF after CR    114H
  148. TRANLOGON:    DB    YES    ;yes=allow transmission of logon    115H
  149.                 ;write logon sequence at location LOGON
  150. SAVCCP:        DB    YES    ;yes=do not overwrite CCP        116H
  151. LOCONEXTCHR:    DB    NO    ;yes=local command if EXTCHR precedes    117H
  152.                 ;no=external command if EXTCHR precedes
  153. TOGGLELOC:    DB    YES    ;yes=allow toggling of LOCONEXTCHR    118H
  154. LSTTST:        DB    YES    ;yes=printer available on printer port    119H
  155. XOFFTST:    DB    NO    ;yes=check for XOFF from remote while    11AH
  156.                 ;sending a file in terminal mode
  157. XONWAIT:    DB    NO    ;yes=wait for XON after CR while    11BH
  158.                 ;sending a file in terminal mode
  159. TOGXOFF:    DB    YES    ;yes=allow toggling of XOFF checking    11CH
  160. IGNORCTL:    DB    YES    ;yes=CTL-chars above ^M not displayed    11DH
  161. EXTRA1:        DB    0    ;for future expansion            11EH
  162. EXTRA2:        DB    0    ;for future expansion            11FH
  163. BRKCHR:        DB    '@'-40H    ;^@ = Send a 300 ms. break tone        120H
  164. NOCONNCT:    DB    'N'-40H    ;^L = Disconnect from the phone line    121H
  165. LOGCHR:        DB    'L'-40H    ;^N = Send logon            122H
  166. LSTCHR:        DB    'P'-40H    ;^P = Toggle printer            123H
  167. UNSAVE:        DB    'R'-40H    ;^R = Close input text buffer        124H
  168. TRANCHR:    DB    'T'-40H ;^T = Transmit file to remote        125H
  169. SAVECHR:    DB    'Y'-40H    ;^Y = Open input text buffer        126H
  170. EXTCHR:        DB    '^'-40H    ;^^ = Send next character        127H
  171. ;
  172. ;
  173.         DS    2        ;                128H
  174. ;
  175. IN$MODCTL1:    IN    MODCTL1 ! RET    ;in modem control port        12AH
  176. ;
  177.          IF    TV802
  178.         DS    7
  179.          ENDIF            ;TV802
  180. ;
  181.          IF    TV803
  182. IN$MODCTL2:    IN    MODCTL2 ! RET    ;out modem control port        15AH
  183.          DS    4
  184.          ENDIF            ;TV803
  185. ;
  186. OUT$MODDATP:    OUT    MODDATP ! RET    ;out modem data port        134H
  187.         DS    7
  188. IN$MODDATP:    IN    MODDATP ! RET    ;in modem data port        13EH
  189.         DS    7
  190. ;
  191. ANI$MODRCVB:    ANI    MODRCVB    ! RET    ;bit to test for receive ready    148H
  192. CPI$MODRCVR:    CPI    MODRCVR    ! RET    ;value of rec. bit when ready    14BH
  193. ANI$MODSNDB:    ANI    MODSNDB    ! RET    ;bit to test for send ready    14EH    
  194. CPI$MODSNDR:    CPI    MODSNDR    ! RET    ;value of send bit when ready    151H
  195. ;
  196.          IF    TV802
  197.         DS    6        ;                154H
  198. OUT$MODCTL1:    OUT    MODCTL1    ! RET    ;out modem control port #2    15AH
  199. OUT$MODCTL2:    OUT    MODCTL2    ! RET    ;out modem control port #1    15DH
  200.          ENDIF            ;TV802
  201. ;
  202.          IF    TV803
  203.         DS    10        ;                154H
  204.         RET            ;                15EH
  205.         RET            ;                15FH
  206.          ENDIF            ;TV803
  207. ;
  208. LOGONPTR:    DW    LOGON        ;for user message.        160H
  209.          IF    TV802
  210.         DS    6
  211. JMP$GOODBYE:    JMP    GOODBYE        ;                168H
  212.          ENDIF            ;TV802
  213. ;
  214.          IF    TV803
  215.         DS    9
  216.          ENDIF            ;TV803
  217. ;
  218. JMP$INITMOD:    JMP    INITMOD        ;go to user written routine    16BH
  219.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    16EH
  220.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    171H
  221.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    174H
  222. JMP$SETUPR:    JMP    SETUPR        ;                177H
  223. JMP$SPCLMENU:    JMP    SPCLMENU    ;                17AH
  224. JMP$SYSVER:    JMP    SYSVER        ;                17DH
  225. JMP$BREAK:    JMP    SENDBRK        ;                180H
  226. ;
  227. ;
  228. ; Do not change the following six lines
  229. ;
  230. JMP$ILPRT:    DS    3        ;                183H
  231. JMP$INBUF:    DS    3        ;                186H
  232. JMP$INLNCOMP:    DS    3        ;                189H
  233. JMP$INMODEM:    DS    3        ;                18CH
  234. JMP$NXTSCRN:    DS    3        ;                18FH
  235. JMP$TIMER:    DS    3        ;                192H
  236. ;
  237. ;
  238. ; Clear sequences -- CLREOS is clear to end of screen, CLRSCRN is clear
  239. ; entire screen.  Last entry must be 0.  Any other 0's act as NOP's.
  240. ;
  241. CLREOS:        CALL    JMP$ILPRT    ;                195H
  242.         DB    ESC,79H,0,0,0    ;ESC y - clear to end of screen    198H
  243.         RET            ;                19DH
  244. ;
  245. CLRSCRN:    CALL    JMP$ILPRT    ;                19EH
  246.         DB    ESC,2AH,0,0,0    ;ESC * clear CRT, home cursor    11AH
  247.         RET            ;                1A6H            
  248. ;
  249. ;
  250. SYSVER:        CALL    JMP$ILPRT    ;                1A7H
  251.         DB    'Version for TeleVideo TS-80'
  252. ;
  253.          IF    TV802
  254.         DB    '2, modem port 20H'
  255.          ENDIF            ;TV802
  256. ;
  257.          IF    TV803
  258.         DB    '3, modem port 2FH'
  259.          ENDIF            ;TV803
  260. ;
  261.         DB    CR,LF,0
  262.         RET
  263. ;.....
  264. ;
  265. ;
  266. ;-----------------------------------------------------------------------
  267. ;
  268. ; NOTE:  You can change the SYSVER message to be longer or shorter.  The
  269. ;     end of your last routine should terminate by 0400H (601 bytes
  270. ;     available after start of SYSVER) if using the Hayes Smartmodem
  271. ;     or by address 0C00H (2659 bytes) otherwise.
  272. ;
  273. ;-----------------------------------------------------------------------
  274. ;
  275. ; You can put in a message at this location which can be called up with
  276. ; CTL-O if TRANLOGON has been set YES.    You can put in several lines if
  277. ; desired.  End with a 0.
  278. ;
  279. ;
  280. LOGON:    DB    'Greetings from a TeleVideo user',CR,LF,0
  281. ;
  282. ;=======================================================================
  283. ;
  284. ;
  285. ; This routine allows a 300 ms. break tone to be sent to reset some
  286. ; time-share computers.
  287. ;
  288. SENDBRK:
  289.      IF    TV802
  290.     MVI    A,5
  291.     OUT    MODCTL1
  292.     MVI    A,0F8H        ;send a break tone
  293.     JMP    GOODBYE1
  294.      ENDIF            ;TV802
  295. ;
  296.      IF    TV803
  297.     RET
  298.      ENDIF            ;TV803
  299. ;.....
  300. ;
  301. ;
  302. ; This routine sends a 300 ms. break tone and sets DTR low for the same
  303. ; length of time to disconnect some modems such as the Bell 212A, etc.    
  304. GOODBYE:
  305.      IF    TV802
  306.     MVI    A,5
  307.     OUT    MODCTL1        ;send to the status port
  308.     MVI    A,068H        ;turn off dtr, send break
  309. ;
  310. GOODBYE1:
  311.     OUT    MODCTL1    
  312.     MVI    B,3        ;wait 300 ms.
  313.     CALL    JMP$TIMER
  314.     MVI    A,5
  315.     OUT    MODCTL1
  316.     MVI    A,0E8H        ;restore to normal, 8 bits, dtr on, etc.
  317.     OUT    MODCTL1
  318.      ENDIF            ;TV802
  319. ;
  320.     RET
  321. ;.....
  322. ;
  323. ;
  324. ; televideo ts-802 baud rate change.  sets ctc at port 08h for baudrate
  325. ; in/out.
  326. ;
  327.      IF    TV802
  328. INITMOD:MVI    A,0        ;select reg.
  329.     OUT    MODCTL1        ;send to the status port
  330.     MVI    A,18H        ;reset the z8sio chip
  331.     OUT    MODCTL1        ;send to the status port
  332.     MVI    A,4        ;select reg.
  333.     OUT    MODCTL1        ;send to the status port
  334.     MVI    A,44H        ;16x, 1-stop, no parity
  335.     OUT    MODCTL1        ;send to the status port
  336.     MVI    A,3        ;select reg.
  337.     OUT    MODCTL1        ;send to the status port
  338.     MVI    A,0C1H        ;enable receive section
  339.     OUT    MODCTL1        ;send to the status port
  340.     MVI    A,5        ;select reg.
  341.     OUT    MODCTL1        ;send to the status port
  342.     MVI    A,0EAH        ;dtr, rts, 8-bits, enable send section
  343.     OUT    MODCTL1        ;send to the status port
  344. ;
  345. INITMOD1:
  346.     MVI    A,1        ;default transfer time to 300 baud
  347.     STA    MSPEED
  348.     MVI    A,47H
  349.     OUT    BAUDRP
  350. ;
  351. INITMOD2:
  352.     MVI    A,80H        ;default to 300 baud
  353.     OUT    BAUDRP
  354.     RET
  355.      ENDIF            ;TV802
  356. ;
  357.      IF    TV803
  358. INITMOD:RET
  359. ;
  360. INITMOD1:
  361.     MVI    A,1        ;default transfer time to 300 baud
  362.     STA    MSPEED
  363. ;
  364. INITMOD2:
  365.     MVI    A,20H        ;default to 300 baud
  366.     OUT    BAUDRP
  367.     RET
  368.      ENDIF            ;TV803
  369. ;.....
  370. ;
  371. ;
  372. SETUPR:    LXI    D,BAUDBUF    ;point to new input buffer
  373.     CALL    JMP$ILPRT
  374.     DB    'Input Baud Rate (300, 450, 600, 1200, 9600): ',0
  375.     CALL    JMP$INBUF
  376.     LXI    D,BAUDBUF+2
  377.     CALL    JMP$INLNCOMP    ;compare baudbuf+2 with characters below
  378.     DB    '300',0
  379.     JNC    OK300        ;go if got match
  380.     CALL    JMP$INLNCOMP
  381.     DB    '450',0
  382.     JNC    OK450
  383.     CALL    JMP$INLNCOMP
  384.     DB    '600',0
  385.     JNC    OK600
  386.     CALL    JMP$INLNCOMP
  387.     DB    '1200',0
  388.     JNC    OK1200
  389.     CALL    JMP$INLNCOMP
  390.     DB    '9600',0
  391.     JNC    OK9600
  392.     CALL    JMP$ILPRT    ;all matches failed, tell operator
  393.     DB    '++ Incorrect entry ++',CR,LF,BELL,0
  394.     JMP    SETUPR        ;try again
  395. ;
  396. OK300:    MVI    A,1        ;mspeed 300 baud value
  397.     LHLD    BD300        ;get 300 baud parameters in 'HL'
  398.     JMP    LOADBD        ;go load them
  399. ;
  400. OK450:    MVI    A,2
  401.     LHLD    BD450
  402.     JMP    LOADBD
  403. ;
  404. OK600:    MVI    A,3
  405.     LHLD    BD600
  406.     JMP    LOADBD
  407. ;
  408. OK1200:    MVI    A,5
  409.     LHLD    BD1200
  410.     JMP    LOADBD
  411. ;
  412. OK9600:    MVI    A,8
  413.     LHLD    BD9600
  414. ;
  415. LOADBD:    STA    INITMOD1+1    ;change time-to-send to match baudrate
  416.     MOV    A,L        ;get baudrate byte
  417.     STA    INITMOD2+1    ;store in initmod
  418.     JMP    INITMOD1    ;reinitialize to new baudrate, then done
  419. ;
  420. ;
  421. ; table of baudrate parameters
  422. ;
  423.      IF    TV802
  424. BD300:    DW    0080H        ;38400/300  converted to hex value
  425. BD450:    DW    0055H        ;38400/450  converted to hex value
  426. BD600:    DW    0040H        ;38400/600  converted to hex value
  427. BD1200:    DW    0020H        ;38400/1200 converted to hex value
  428. BD9600:    DW    0004H        ;38400/9600 converted to hex value
  429.      ENDIF            ;TV802
  430. ;
  431.      IF    TV803
  432. BD300:    DW    0020H        ;9600/300  converted to hex value
  433. BD450:    DW    0016H        ;9600/450  converted to hex value
  434. BD600:    DW    0010H        ;9600/600  converted to hex value
  435. BD1200:    DW    0008H        ;9600/1200 converted to hex value
  436. BD9600:    DW    0001H        ;9600/9600 converted to hex value
  437.      ENDIF            ;TV803
  438. ;
  439. BAUDBUF:DB    10,0
  440.     DS    10
  441. ;
  442. ;           (end of initmod and setup routines)
  443. ;-----------------------------------------------------------------------
  444. ;
  445. ; these routines can be used for your equipment, be sure to end with ret
  446. ; if using the hayes smartmodem this is unavailable without a special
  447. ; address change.
  448. ;
  449. SPCLMENU:RET
  450. ;
  451. ; NOTE:  Must terminate prior to 0400H
  452. ;
  453. ;
  454. ;-----------------------------------------------------------------------
  455. ;
  456. ; This overwrites the first line of the SENDRDY routine in the body of
  457. ; the main program, in order to check IN$MODCTL2 rather than IM$MODCLT1.
  458. ;
  459.       IF    TV803
  460.      ORG    SENDRDY
  461.      CALL    IN$MODCTL2
  462.       ENDIF            ;TV803
  463. ;
  464. ;-----------------------------------------------------------------------
  465. ;
  466.      END
  467. ;
  468.