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 / M7R4-7.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  11KB  |  343 lines

  1. ; M7R4-7.ASM -- TRS-80 Model IV w/montezuma micro overlay for MDM7xx
  2. ; includes options for Hayes Smartmodem and the Anchor Mark XII.
  3. ; Will work with a standard external modem with no options selected.
  4. ;
  5. ; You will want to look this file over carefully. There are a number of
  6. ; options that you can use to configure the program to suit your taste.
  7. ; This file adapts the TRS-80 (Zero ORG CP/M) computer to the modem pro-
  8. ; gram.  Much of  the information contained here is not in the MDM7xx.ASM
  9. ; file. 
  10. ;
  11. ; Edit this file for your preferences then follow the "TO USE:" example
  12. ; shown below.
  13. ;
  14. ; Use the "SET" command to change the baudrate when desired.  It 
  15. ; defaults to 1200 baud for the Anchor or Smartmodem, 300 baud 
  16. ; for an external modem.
  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. ;        4580 0100
  27. ;        -IM7R4-7.HEX        (note the "I" command)
  28. ;        -R            ("R" loads in the .HEX file)
  29. ;        NEXT  PC
  30. ;        4580 0000
  31. ;        -G0            (return to CP/M)
  32. ;        A>SAVE 73 MODEM7.COM    (now have a modified .COM file)
  33. ;
  34. ;        OR you can use MLOAD24:
  35. ;
  36. ;        A>MLOAD24 M740.COM=MDM740.COM,M7R4-7.HEX
  37. ;
  38. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  39. ; 01/27/85 - Fixed disconnect problems        - Ed Richter
  40. ; 07/13/84 - Revised for MDM740 and MOD IV      - Ed Richter
  41. ; 11/11/83 - Renamed to M7R1-1.ASM, no changes    - Irv Hoff
  42. ; 08/27/83 - Revised to work with MDM712    - Irv Hoff
  43. ; 07/25/83 - Adapted for TRS-80 (zero ORG CP/M)    - Phil Becker
  44. ; 06/22/83 - Revised to work with MDM710    - Irv Hoff
  45. ; 05/27/83 - Updated to work with MDM709    - Irv Hoff
  46. ; 05/15/83 - Revised to work with MDM708    - Irv Hoff
  47. ; 04/11/83 - Updated to work with MDM707    - Irv Hoff
  48. ; 04/04/83 - First version of this file        - Irv Hoff
  49. ; 06/30/85 - Fixed Break tone problem           - Richie Dervan
  50. ;
  51. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  52. ;
  53. BELL:        EQU    07H        ;bell
  54. CR:        EQU    0DH        ;carriage return
  55. ESC:        EQU    1BH        ;escape
  56. LF:        EQU    0AH        ;linefeed
  57. ;
  58. YES:        EQU    0FFH
  59. NO:        EQU    0
  60. ;
  61. ;
  62. ; Change the following information to match your equipment.
  63. ; PORT should be set to the base port address for the RS-232 port.
  64. ;
  65. PORT:        EQU    0E8H        ;MASTER RESET PORT
  66. MODCTL1:    EQU    PORT+2        ;MODEM CONTROL PORT
  67. MODDATP:    EQU    PORT+3        ;MODEM DATA IN PORT
  68. MODDCDB:    EQU    20H        ;CARRIER DETECT BIT
  69. BAUDRP:        EQU    PORT+1        ;BAUD RATE PORT
  70. MODCTL2:    EQU    PORT+2        ;2ND MODEM CONTROL PORT
  71. MODRCVB:    EQU    80H        ;BIT TO TEST FOR RECEIVE
  72. MODRCVR:    EQU    80H        ;VALUE WHEN READY
  73. MODSNDB:    EQU    40H        ;BIT TO TEST FOR SEND
  74. MODSNDR:    EQU    40H        ;VALUE WHEN READY
  75. ;
  76.         ORG    100H
  77. ;
  78. ; Change the clock speed to suit your system
  79. ;
  80.         DS    3    ;(for  "JMP   START" instruction)
  81. PMMIMODEM:    DB    NO    ;yes=PMMI S-100 Modem            103H
  82. SMMODEM:    EQU    YES    ;used for this ovlay with Hayes or Anchor
  83. AUTDIAL:    DB     YES        ;yes if HAYES Smartmodem or compatible
  84. TOUCHPULSE:    DB    'T'    ;T=touch, P=pulse (Smartmodem-only)    105H
  85. CLOCK:        DB    40    ;clock speed in MHz x10, 25.5 MHz max.    106H
  86.                 ;20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
  87. MSPEED:        DB    1    ;0=110 1=300 2=450 3=600 4=710 5=1200    107H
  88.                 ;6=2400 7=4800 8=9600 9=19200 default
  89. BYTDLY:        DB    3    ;0=0 delay  1=10ms  5=50 ms - 9=90 ms    108H
  90.                 ;default time to send character in ter-
  91.                 ;minal mode file transfer for slow BBS.
  92. CRDLY:        DB    4    ;0=0 delay 1=100 ms 5=500 ms - 9=900 ms 109H
  93.                 ;default time for extra wait after CRLF
  94.                 ;in terminal mode file transfer
  95. NOOFCOL:    DB    4    ;number of DIR columns shown        10AH
  96. SETUPTST:    DB    YES    ;yes=user-added Setup routine        10BH
  97. SCRNTEST:    DB    YES    ;Cursor control routine         10CH
  98.         DS    1    ;reserved (old ACKNAK flag)        10DH
  99. BAKUPBYTE:    DB    NO     ;yes=change any file same name to .BAK    10EH
  100. CRCDFLT:    DB    YES    ;yes=default to CRC checking        10FH
  101. TOGGLECRC:    DB    YES    ;yes=allow toggling of CRC to Checksum    110H
  102. CONVBKSP:    DB    NO    ;yes=convert backspace to rub        111H
  103. TOGGLEBK:    DB    YES    ;yes=allow toggling of bksp to rub    112H
  104. ADDLF:        DB    NO    ;no=no LF after CR to send file in    113H
  105.                 ;terminal mode (added by remote echo)
  106. TOGGLELF:    DB    YES    ;yes=allow toggling of LF after CR    114H
  107. TRANLOGON:    DB    YES    ;yes=allow transmission of logon    115H
  108.                 ;write logon sequence at location LOGON
  109. SAVCCP:        DB    YES    ;yes=do not overwrite CCP        116H
  110. LOCONEXTCHR:    DB    NO    ;yes=local command if EXTCHR precedes    117H
  111.                 ;no=external command if EXTCHR precedes
  112. TOGGLELOC:    DB    YES    ;yes=allow toggling of LOCONEXTCHR    118H
  113. LSTTST:        DB    YES    ;yes=allow toggling of printer on/off    119H
  114. XOFFTST:    DB    NO    ;yes=checks for XOFF from remote while    11AH
  115.                 ;sending a file in terminal mode
  116. XONWAIT:    DB    NO    ;yes=wait for XON after CR while    11BH
  117.                 ;sending a file in terminal mode
  118. TOGXOFF:    DB    YES    ;yes=allow toggling of XOFF checking    11CH
  119. IGNORCTL:    DB    YES    ;yes=CTL-chars above ^M not displayed    11DH
  120. EXTRA1:        DB    0    ;for future expansion            11EH
  121. EXTRA2:        DB    0    ;for future expansion            11FH
  122. BRKCHR:        DB    'K'-40H    ;^K = Send 300 ms. break tone        120H
  123. NOCONNCT:    DB    'N'-40H    ;^N = Disconnect from the phone line    121H
  124. LOGCHR:        DB    'L'-40H    ;^L = Send logon            122H
  125. LSTCHR:        DB    'P'-40H    ;^P = Toggle printer            123H
  126. UNSAVE:        DB    'R'-40H    ;^R = Close input text buffer        124H
  127. TRANCHR:    DB    'T'-40H ;^T = Transmit file to remote        125H
  128. SAVECHR:    DB    'Y'-40H    ;^Y = Open input text buffer        126H
  129. EXTCHR:        DB    '^'-40h    ;^^ = Send next character        127H
  130.         DS    2
  131. IN$MODCTL1:    JMP     STATSND        ;go to "get status"         12AH
  132.         DS    7
  133. OUT$MODDATP:    OUT    MODDATP ! RET    ;out modem data port        134H
  134.         DS    7
  135. IN$MODDATP:    IN    MODDATP ! RET    ;in modem data port
  136.         DS    7
  137. ANI$MODRCVB:    ANI    MODRCVB    ! RET    ;bit to test for receive ready    148H
  138. CPI$MODRCVR:    CPI    MODRCVR    ! RET    ;value of rcv. bit when ready    14BH
  139. ANI$MODSNDB:    ANI    MODSNDB    ! RET    ;bit to test for send ready    14EH
  140. CPI$MODSNDR:    CPI    MODSNDR    ! RET    ;value of send bit when ready    151H
  141. IN$BAUDRP:    RET ! NOP ! NOP     ;by-pass this
  142. OUT$BAUDRP:    RET ! NOP ! NOP        ;don't need this one
  143. OUT$MODCTL1:    OUT    MODCTL1 ! RET    ;out modem control port #1    15AH
  144. OUT$MODCTL2:    RET ! NOP ! NOP        ;don't need this one        15DH
  145. LOGONPTR:    DW    LOGON        ;for user message.        160H
  146. JMP$DIAL:    DS    3        ;autodial rtn jump            162H
  147. JMP$DISCONT:    DS    3        ;disconnect rtn
  148. JMP$GOODBYE:    JMP     GOODBYE        ;go to disconnect        168H
  149. JMP$INITMOD:    JMP    INITMOD        ;go to user written routine    16BH
  150. JMP$NEWBAUD:    RET ! NOP ! NOP        ;by-pass this           16EH
  151. JMP$NOPARITY:    RET ! NOP ! NOP        ;(by-pass PMMI routine)        171H
  152. JMP$PARITY:    RET ! NOP ! NOP        ;(by-pass PMMI routine)        174H
  153. JMP$SETUPR:    JMP    SETUPR        ;initialize USART and modem    177H
  154. JMP$SPCLMENU:    JMP    SPCLMENU    ;                17AH
  155. JMP$SYSVER:    JMP    SYSVER        ;print header msg        17DH
  156. JMP$BREAK:    JMP    SENDBRK        ;                180H
  157. ; Do not change the following six lines.
  158. JMP$ILPRT:    DS    3        ;                183H
  159. JMP$INBUF:    DS    3        ;                186H
  160. JMP$INLNCOMP:    DS    3        ;                189H
  161. JMP$INMODEM:    DS    3        ;                18CH
  162. JMP$NXTSCRN:    DS    3        ;                18FH
  163. JMP$TIMER:    DS    3        ;                192H
  164. ;
  165. ; Routine to clear to end of screen.  If using CLREOS and CLRSCRN, set
  166. ; SCRNTEST to YES at 010AH (above).
  167. ;
  168. CLREOS:        CALL    JMP$ILPRT    ;                195H
  169.         DB    19H,0,0,0,0    ;                198H
  170.         RET            ;                19DH
  171. ;
  172. CLRSCRN:    CALL    JMP$ILPRT    ;                19EH
  173.         DB    1EH,19H,0,0,0    ;                1A1H
  174.         RET            ;                1A6H
  175.     
  176. ;
  177. SYSVER:        CALL    JMP$ILPRT    ;                1A7H
  178.         DB    'Trade 80 Modem 740 - Richie Dervan',CR,LF
  179.         IF    SMMODEM
  180.         DB    'Version for Hayes or compatible',CR,LF,0
  181.         RET
  182.         ENDIF
  183.         DB    'Version for external modem',CR,LF,0
  184.         RET
  185. ;
  186. ;-----------------------------------------------------------------------
  187. ;
  188. ; NOTE:  You can change the SYSVER message to be longer or shorter.  The
  189. ;     end of your last routine should terminate by 0400H (601 bytes
  190. ;     available after start of SYSVER) if using the Hayes Smartmodem
  191. ;     or by address 0C00H (2659 bytes) otherwise.
  192. ;
  193. ;-----------------------------------------------------------------------
  194. ;
  195. ; You can put in a message at this location which can be called up with
  196. ; CTL-L if TRANLOGON has been set TRUE.  You can use several lines if
  197. ; desired.  End with a 0.
  198. ;
  199. LOGON:        DB    'RICHIE DERVAN',CR,LF,0
  200. ;
  201. ; Add your own routine here to send a break tone to reset some time-share
  202. ; computers, if desired.
  203. ;
  204. SENDBRK:    MVI    A,0E9H        
  205.         OUT    MODCTL1        ;send break tone
  206.          MVI    B,3
  207.         CALL    JMP$TIMER    ;delay 300 msec
  208.         MVI    A,0ECH
  209.         OUT    MODCTL1        ;reset RS232
  210.         RET
  211. ;
  212. ; Routine to return status of the modem port
  213. ;
  214. STATSND:    IN    MODCTL1        ;in modem contol port
  215.         PUSH     B        ;just in case
  216.         ANI    0DFH        ;isolate status and clear CD bit
  217.         MOV    B,A        ;save status
  218.         IN     PORT        ;get CD bit
  219.         ANI    MODDCDB        ;isolate CD bit
  220.         ORA    B        ;merge CD with status
  221.         POP    B        ;restore B
  222.         RET
  223. ;
  224. ; Add your own routine here to put DTR low and/or send a break tone.
  225. ;
  226. GOODBYE:  LDA    AUTDIAL        ;is it auto dial modem
  227.       ORA    A    
  228.       JNZ    GOODBY1        ;yes then go to disconnect
  229.       MVI   A,0EBH        ;no - DTR off, send BRK
  230.           OUT    MODCTL1        ;send cmd
  231.       MVI    B,3
  232.       CALL    JMP$TIMER    ;delay 300 msec
  233.       MVI    A,0ECH
  234.       OUT    MODCTL1        ;reset DTR     
  235.       RET
  236. ;
  237. GOODBY1:  MVI    A,0EAH          ;auto dial disconnect
  238.       OUT    MODCTL1        ;drop dtr
  239.       MVI    B,3
  240.       CALL    JMP$TIMER    ;delay 300 msec
  241.       MVI    A,0ECH        ;reset DTR
  242.       OUT    MODCTL1
  243.       RET
  244.  
  245. ;
  246. ; You can use this area for any special initialization or setup you may
  247. ; wish to include.  Each must stop with a RET.    You can check the other
  248. ; available overlays for ideas how to write your own routines if that
  249. ; may be of some help.
  250. ;
  251. INITMOD:  MVI    A,1
  252.       OUT    PORT        ;reset the USART to
  253.       MVI    A,0ECH        ;8,no,1,DTR, and RTS
  254.       OUT    MODCTL1
  255.       LDA    MSPEED        ;what speed was selected by MSPEED
  256.       CPI    1
  257.       JZ    OK300
  258.       CPI    5        ;initialize to selected speed
  259.       JZ    OK1200
  260.       CPI    6
  261.       JZ    OK2400
  262.       CPI    7
  263.       JZ    OK4800
  264. ;
  265. ;Routine used to initialize and reset speed and baud rate
  266. ;
  267. INIT1:      MVI    A,0000H
  268.       STA    MSPEED
  269. INIT2:      MVI    A,0000H
  270.       OUT    BAUDRP
  271.       RET                          
  272. ;
  273. ;sets the modem speed via the SET command.
  274. ;
  275. SETUPR:   LXI    D,BAUDBUF    ;point to input buffer
  276.       CALL    JMP$ILPRT
  277.       DB    'INPUT BAUD RATE (300, 1200, 2400, 4800, 9600): ',0
  278.       CALL    JMP$INBUF
  279.       LXI    D,BAUDBUF+2
  280.       CALL    JMP$INLNCOMP    ;test input param
  281.       DB    '300',0
  282.       JNC    OK300
  283.       CALL    JMP$INLNCOMP
  284.       DB    '1200',0
  285.       JNC    OK1200
  286.       CALL    JMP$INLNCOMP
  287.       DB    '2400',0
  288.       JNC    OK2400
  289.       CALL    JMP$INLNCOMP
  290.       DB    '4800',0
  291.       JNC    OK4800
  292.       CALL    JMP$INLNCOMP
  293.       DB    '9600',0
  294.       JNC    OK9600
  295.       CALL    JMP$ILPRT    ;bad parameter
  296.       DB    '+++ Baud rate not supported +++',CR,LF,0
  297.       JMP    SETUPR        ;try again
  298. ;
  299. OK300:      MVI    A,1
  300.       LHLD    BD300
  301.       JMP    LOADBD
  302. ;
  303. OK1200:      MVI    A,5
  304.       LHLD    BD1200
  305.       JMP    LOADBD
  306. ;
  307. OK2400:      MVI    A,6
  308.       LHLD    BD2400
  309.       JMP    LOADBD
  310. ;
  311. OK4800:      MVI    A,7
  312.       LHLD    BD4800
  313. ;
  314. OK9600      MVI    A,8
  315.       LHLD    BD9600
  316. ;
  317. LOADBD:   STA    INIT1+1
  318.       MOV    A,L
  319.       STA    INIT2+1
  320.       JMP    INIT1
  321. ;
  322. ; TABLE OF BAUD RATE PARAMS
  323. ;
  324. BD300:      DW    0055H
  325. BD1200:      DW    0077H
  326. BD2400:      DW    00AAH
  327. BD4800:      DW    00CCH
  328. BD9600:      DW    00EEH
  329. ;
  330. BAUDBUF:  DB    10,0
  331.       DS    10
  332. ;----------------------------------------------------------------------
  333. ; If using Smartmodem or Anchor this is unavailable without a special
  334. ; change.
  335. ;
  336. SPCLMENU:  RET
  337. ;----------------------------------------------------------------------
  338. ;
  339. ; NOTE:  MUST TERMINATE PRIOR TO 0400H (with Smartmodem or Anchor)
  340. ;                 0C00H (without Smartmodem)
  341. ;
  342.       END
  343.