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

  1.  
  2. ; M7R2-2.ASM -- TRS-80 Model II overlay file for MDM7xx.  05/16/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 TRS-80 Model II (and probably Models 12 and 16)
  7. ; computers to MDM7xx.    Requires Pickles & Trout CP/M.
  8. ;
  9. ; Much of the information contained here is not in the MDM7xx.ASM 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 starts
  15. ; out at 300 baud when the program is first called up.    
  16. ;
  17. ; MAKE SURE TO USE PICKLES & TROUT'S "SETUP.COM" TO SET INITIAL BAUD RATE
  18. ; TO 300 BAUD TO MATCH SETTING BELOW. (J.K.) (No longer needed - D.B.051684)
  19. ;
  20. ;    TO USE: First edit this file filling in answers for your own
  21. ;        equipment.  Then assemble with ASM.COM or equivalent
  22. ;        assembler.  Then use DDT to overlay the the results
  23. ;        of this program to the original .COM file:
  24. ;
  25. ;        A>DDT MDM7xx.COM
  26. ;        DDT VERS 2.2
  27. ;        NEXT  PC
  28. ;        4A00 0100
  29. ;        -IM7Rx-x.HEX        (note the "I" command)
  30. ;        -R            ("R" loads in the .HEX file)
  31. ;        NEXT  PC
  32. ;        0301 0000
  33. ;        -G0            (return to CP/M)
  34. ;        A>SAVE 73 MDM7xx.COM    (now have a modified .COM file)
  35. ;
  36. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  37. ;
  38. ; 05/16/84 - Updated to change baud rates using
  39. ;         Pickles & Trout System Call.       - Dan Blana
  40. ; 11/11/83 - Renamed to M7R2-1.ASM, no changes    - Irv Hoff
  41. ; 09/18/83 - Modified M712XE.ASM for 
  42. ;         TRS-80 Model II and Pickles
  43. ;         & Trout CP/M (should also 
  44. ;         work on Mods 12 and 16)            - Joseph Katz
  45. ;
  46. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  47. ;
  48. BELL:        EQU    07H        ;bell
  49. CR:        EQU    0DH        ;carriage return
  50. ESC:        EQU    1BH        ;escape
  51. LF:        EQU    0AH        ;linefeed
  52. ;
  53. YES:        EQU    0FFH
  54. NO:        EQU    0
  55. ;
  56. ;
  57. PORT:        EQU    0F4H        ;TRS-80 II serial output port A
  58. MODCTL1:    EQU    PORT+2        ;Modem control port
  59. MODDATP:    EQU    PORT        ;Modem data port
  60. MODCTL2:    EQU    PORT+2        ;Modem status port
  61. MODRCVB:    EQU    01H        ;Bit to test for receive
  62. MODRCVR:    EQU    01H        ;Value when receive ready
  63. MODSNDB:    EQU    04H        ;Bit to test for send
  64. MODSNDR:    EQU    04H        ;Value when send ready        
  65. ;
  66. ;
  67.         ORG    100H
  68. ;
  69. ;
  70. ; Change the clock speed to suit your system
  71. ;
  72.         DS    3    ;(for  "JMP   START" instruction)
  73. ;
  74. PMMIMODEM:    DB    NO    ;yes=PMMI S-100 Modem            103H
  75. SMARTMODEM:    DB    YES    ;yes=HAYES Smartmodem, no=non-PMMI    104H
  76. TOUCHPULSE:    DB    'T'    ;T=touch, P=pulse (Smartmodem-only)    105H
  77. CLOCK:        DB    40    ;clock speed in MHz x10, 25.5 MHz max.    106H
  78.                 ;20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
  79. MSPEED:        DB    1    ;0=110 1=300 2=450 3=600 4=710 5=1200    107H
  80.                 ;6=2400 7=4800 8=9600 9=19200 default
  81. BYTDLY:        DB    5    ;0=0 delay  1=10ms  5=50 ms - 9=90 ms    108H
  82.                 ;default time to send character in ter-
  83.                 ;minal mode file transfer for slow BBS.
  84. CRDLY:        DB    5    ;0=0 delay 1=100 ms 5=500 ms - 9=900 ms 109H
  85.                 ;default time for extra wait after CRLF
  86.                 ;in terminal mode file transfer
  87. NOOFCOL:    DB    5    ;number of DIR columns shown        10AH
  88. SETUPTST:    DB    YES    ;yes=user-added Setup routine        10BH
  89. SCRNTEST:    DB    YES    ;Cursor control routine         10CH
  90. ACKNAK:        DB    YES    ;yes=resend a record after any non-ACK    10DH
  91.                 ;no=resend a record after a valid NAK
  92. BAKUPBYTE:    DB    NO    ;yes=change any file same name to .BAK    10EH
  93. CRCDFLT:    DB    YES    ;yes=default to CRC checking        10FH
  94. TOGGLECRC:    DB    YES    ;yes=allow toggling of CRC to Checksum    110H
  95. CONVBKSP:    DB    NO    ;yes=convert backspace to rub        111H
  96. TOGGLEBK:    DB    YES    ;yes=allow toggling of bksp to rub    112H
  97. ADDLF:        DB    NO    ;no=no LF after CR to send file in    113H
  98.                 ;terminal mode (added by remote echo)
  99. TOGGLELF:    DB    YES    ;yes=allow toggling of LF after CR    114H
  100. TRANLOGON:    DB    NO    ;yes=allow transmission of logon    115H
  101.                 ;write logon sequence at location LOGON
  102. SAVCCP:        DB    YES    ;yes=do not overwrite CCP        116H
  103. LOCONEXTCHR:    DB    NO    ;yes=local command if EXTCHR precedes    117H
  104.                 ;no=external command if EXTCHR precedes
  105. TOGGLELOC:    DB    YES    ;yes=allow toggling of LOCONEXTCHR    118H
  106. LSTTST:        DB    YES    ;yes=printer available on printer port    119H
  107. XOFFTST:    DB    NO    ;yes=check for XOFF from remote    while    11AH
  108.                 ;sending a file in terminal mode
  109. XONWAIT:    DB    NO    ;yes=wait for XON after CR while    11BH
  110.                 ;sending a file in terminal mode
  111. TOGXOFF:    DB    YES    ;yes=allow toggling of XOFF checking    11CH
  112. IGNORCTL:    DB    YES    ;yes=CTL-chars above ^M not displayed    11DH
  113. EXTRA1:        DB    0    ;for future expansion            11EH
  114. EXTRA2:        DB    0    ;for future expansion            11FH
  115. BRKCHR:        DB    '@'-40H    ;^@ = Send a 300 ms. break tone        120H
  116. 20H
  117. NOCONNCT:    DB    'N'-40H    ;^N = Disconnect from the phone line    121H
  118. LOGCHR:        DB    'L'-40H    ;^L = Send logon            122H
  119. LSTCHR:        DB    'P'-40H    ;^P = Toggle printer            123H
  120. UNSAVE:        DB    'R'-40H    ;^R = Close input text buffer        124H
  121. TRANCHR:    DB    'T'-40H ;^T = Transmit file to remote        125H
  122. SAVECHR:    DB    'Y'-40H    ;^Y = Open input text buffer        126H
  123. EXTCHR:        DB    '^'-40H    ;^^ = Send next character        127H
  124. ;
  125. ;
  126.         DS    2        ;                128H
  127. IN$MODCTL1:    MVI    A,10H        ;channel 0, reset interrupts    12AH
  128.         OUT    MODCTL1
  129.         IN    MODCTL1        ;get the status bits
  130.         RET
  131.         DS    3
  132. ;
  133. OUT$MODDATP:    OUT    MODDATP ! RET    ;out modem data port        134H
  134.         DS    7
  135. IN$MODDATP:    IN    MODDATP ! RET    ;in modem data port        13EH
  136.         DS    7
  137. ANI$MODRCVB:    ANI    MODRCVB    ! RET    ;bit to test for receive ready    148H
  138. CPI$MODRCVR:    CPI    MODRCVR ! RET    ;value of receive bit when rdy    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.         DS    6        ;                154H
  142. OUT$MODCTL1:    OUT    MODCTL1    ! RET    ;out modem control port     15AH
  143. OUT$MODCTL2:    OUT    MODCTL2    ! RET    ;out modem status port        15DH
  144. ;
  145. ;
  146. LOGONPTR:    DW    LOGON        ;for user message.        160H
  147.         DS    6        ;                162H
  148. JMP$GOODBYE:    JMP    GOODBYE        ;                168H
  149. JMP$INITMOD:    JMP    INITMOD        ;go to user written routine    16BH
  150.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    16EH
  151.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    171H
  152.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    174H
  153. JMP$SETUPR:    JMP    SETUPR        ;                177H
  154. JMP$SPCLMENU:    JMP    SPCLMENU    ;                17AH
  155. JMP$SYSVER:    JMP    SYSVER        ;                17DH
  156. JMP$BREAK:    JMP    SENDBRK        ;                180H
  157. ;
  158. ;
  159. ; Do not change the following six lines.
  160. ;
  161. JMP$ILPRT:    DS    3        ;                183H
  162. JMP$INBUF    DS    3        ;                186H
  163. JMP$INLNCOMP:    DS    3        ;                189H
  164. JMP$INMODEM    DS    3        ;                18CH
  165. JMP$NXTSCRN:    DS    3        ;                18FH
  166. JMP$TIMER:    DS    3        ;                192H
  167. ;
  168. ;
  169. ; Clear sequences -- CLREOS is clear to end of screen, CLRSCRN is clear
  170. ; entire screen.  Last entry must be 0.  Any other 0's act as NOP's.
  171. ;
  172. CLREOS:        CALL    JMP$ILPRT    ;                195H
  173.         DB    02H,0,0,0,0    ;                198H
  174.         RET            ;                19DH
  175. ;
  176. CLRSCRN:    CALL    JMP$ILPRT    ;                19EH
  177.         DB    0CH,0,0,0,0    ;                1A1H
  178.         RET            ;                1A6H
  179. ;
  180. ;
  181. SYSVER:        CALL    JMP$ILPRT    ;                1A7H
  182.         DB    'TRS-80 VERSION (FOR SERIAL PORT A)',CR,LF
  183.         DB    CR,LF,0
  184.         RET
  185. ;.....
  186. ;
  187. ;
  188. ;-----------------------------------------------------------------------
  189. ;
  190. ; NOTE:  You can change the SYSVER message to be longer or shorter.  The
  191. ;     end of your last routine should terminate by 0400H (601 bytes
  192. ;     available after start of SYSVER) if using the Hayes Smartmodem
  193. ;     or by address 0C00H (2659 bytes) otherwise.
  194. ;
  195. ;-----------------------------------------------------------------------
  196. ;
  197. ; You can put in a message at this location which can be called up with
  198. ; CTL-O if TRANLOGON has been set TRUE.  You can put in several lines if
  199. ; desired.  End with a 0.
  200. ;
  201. ;
  202. LOGON:        DB    'This is a TRS-80 computer',CR,LF,0
  203. ;.....
  204. ;
  205. ;
  206. ; This routine allows a 300 ms. break tone to be sent to reset some
  207. ; time-shar computers.
  208. ;
  209. SENDBRK:  MVI    A,5
  210.       OUT    MODCTL1
  211.       MVI    A,0F8H        ;SEND A BREAK TONE
  212.       JMP    GOODBYE1
  213. ;.....
  214. ;
  215. ;
  216. ; This routine sends a 300 ms. break tone and sets DTR low for the same
  217. ; length of time to disconnect some modems such as the Bell 212A, etc.    
  218. ;
  219. GOODBYE:  MVI    A,5
  220.       OUT    MODCTL1        ;SEND TO THE STATUS PORT
  221.       MVI    A,68H        ;TURN OFF DTR
  222. ;
  223. GOODBYE1: OUT    MODCTL1
  224.       MVI    B,3        ;WAIT FOR 300 MS.
  225.       CALL    JMP$TIMER
  226.       MVI    A,5
  227.       OUT    MODCTL1
  228.       MVI    A,0E8H        ;RESTORE TO NORMAL, 8 BITS, DTR ON, ETC.
  229.       OUT    MODCTL1
  230.       RET
  231. ;.....
  232. ;
  233. ;    
  234. ; TRS-80 II initialization -- sets CTC timer 00H for send and receive
  235. ; baudrate.
  236. ;
  237. INITMOD:  
  238.       MVI    A,0        ;SELECT REGISTER
  239.       OUT    MODCTL1
  240.       MVI    A,18H        ;THROW OUT OF MODE
  241.       OUT    MODCTL1
  242.       MVI    A,04H        ;SELECT REGISTER
  243.       OUT    MODCTL1
  244.       MVI    A,44H        ;SET ASCII PARAMETERS
  245.       OUT    MODCTL1
  246.       MVI    A,03H        ;SELECT REG.
  247.       OUT    MODCTL1
  248.       MVI    A,0C1H        ;ENABLE RECEIVE
  249.       OUT    MODCTL1
  250.       MVI    A,05H        ;SELECT REG.
  251.       OUT    MODCTL1
  252.       MVI    A,0EAH        ;ENABLE SEND, 'DTR', 'RTS'
  253.       OUT    MODCTL1
  254.       JMP    OK300        ;DEFAULT SET 300 BAUD RATE P&T FUNC
  255. ;
  256. ;.....
  257. ;
  258. ;
  259. ; Setup routine to allow changing modem speed with the SET command.
  260. ;
  261. SETUPR:      LXI    D,BAUDBUF    ;POINT TO NEW INPUT BUFFER
  262.       CALL    JMP$ILPRT
  263.       DB    'Input Baud Rate (300 OR 1200): ',0
  264.       CALL    JMP$INBUF
  265.       LXI    D,BAUDBUF+2
  266.       CALL    JMP$INLNCOMP    ;COMPARE BAUDBUF+2 WITH CHARACTERS BELOW
  267.       DB    '300',0
  268.       JNC    OK300        ;GO IF GOT MATCH
  269.       CALL    JMP$INLNCOMP    ;SMODEM DOESN'T SUPPORT 
  270.        DB    '600',0
  271.       JNC    OK600
  272.       CALL    JMP$INLNCOMP
  273.       DB    '1200',0
  274.       JNC    OK1200
  275.       CALL    JMP$INLNCOMP    ;SMODEM DOESN'T SUPPORT 9600  
  276.        DB    '9600',0
  277.       JNC    OK9600
  278.       CALL    JMP$ILPRT    ;ALL MATCHES FAILED, TELL OPERATOR
  279.       DB    '++ Incorrect entry ++',CR,LF,BELL,0
  280.       JMP    SETUPR        ;TRY AGAIN
  281. ;
  282. OK300:      MVI    A,1
  283.       LHLD    BD300
  284.       JMP    LOADBD
  285. ;
  286. OK600:      MVI    A,3
  287.       LHLD    BD600
  288.       JMP    LOADBD
  289. ;
  290. OK1200:      MVI    A,5
  291.       LHLD    BD1200
  292.       JMP    LOADBD
  293. ;
  294. OK9600:      MVI    A,8
  295.       LHLD    BD9600
  296. ;
  297. LOADBD:      STA    INITMOD1+1    ;CHANGE TIME-TO-SEND TO MATCH BAUDRATE
  298.       MOV    A,L        ;GET BAUDRATE BYTE
  299.       STA    INITMOD2+1    ;SEND TO 'CTC' TIMER FOR NEW BAUDRATE
  300. ;
  301. INITMOD1: MVI    A,1        ;DEFAULT TRANSFER TIME TO 300 BAUD
  302.       STA    MSPEED
  303.       MVI    A,47H        ;DEFAULT TO 300 BAUD
  304.       OUT    00H        ;SEND TO 'CTC' TIMER
  305. ;
  306. INITMOD2: MVI    A,03H        ;INITIALIZE TO 300 BAUD
  307.       OUT    00H
  308. ;
  309. ; Setup Serial PORT 'A' using P&T Special System Function #0
  310. ;
  311. SSFUNC0:  PUSH    B        ;---- SAVE REGISTERS
  312.       PUSH    D        ;----
  313.       PUSH    H        ;----
  314.       PUSH    PSW        ;----
  315.       LXI    B,0        ;FUNCTION #0 - SETUP SERIAL PORT
  316.                   ;  DISABLE PARITY, ODD PARITY, PORT A
  317.       MVI    D,0E6H        ;RTS=HIGH,01 STOP BIT,8 BITS;DTR=HIGH
  318.       MOV    E,H        ;BAUD FROM BAUD RATE PARAMETERS TBL
  319.       MVI    H,13H        ;XOFF CHAR - 13H (19D)
  320.       MVI    L,11H        ;XON CHAR  - 11H (17D)
  321.       CALL    0040H        ;CALL P&T SPECIAL SYSTEM FUNCTION
  322.       POP    PSW        ;----  RESTORE SAVED REGISTERS
  323.       POP    H        ;----
  324.       POP    D        ;----
  325.       POP    B        ;----        
  326.       RET
  327. ;
  328. ;
  329. ; TABLE OF BAUDRATE PARAMETERS
  330. ;
  331. BD300:      DW    0303H
  332. BD600:      DW    0406H    
  333. BD1200:      DW    050DH
  334. BD9600:      DW    080EH
  335. ;
  336. BAUDBUF:  DB    10,0
  337.       DS    10
  338. ;
  339. ;-----------------------------------------------------------------------
  340. ;
  341. ; The following routine can be used as an auxiliary menu for notes of
  342. ; interest to a particular computer, etc.  If using the Hayes Smartmodem
  343. ; this is unavailable without a special address change.
  344. ;
  345. SPCLMENU: RET
  346. ;
  347. ;-------------------------------------------------