home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / simtel / sigm / vols100 / vol156 / m7r2-2.asm < prev    next >
Encoding:
Assembly Source File  |  1994-07-13  |  10.9 KB  |  351 lines

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