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 / M7RSCPP.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  12KB  |  369 lines

  1. ; M7RCP-1.ASM -- Tandy TRS-80 Mod 4 under Radio Shack's CP/M Plus.  
  2. ;        Overlay file for MDM724 -- 02/05/84
  3. ;
  4. ; This file is based on the M7R4-1 overlay for the Montezuma Micro 
  5. ; CP/M 2.2. It is heavily based on the Tandy Radio Shack Model I with
  6. ; Omicron CP/M 'Mapper' originally by Phil Becker and is credited as 
  7. ; such. 
  8. ;
  9. ; You will want to look this file over carefully. There are a number of
  10. ; options that you can use to configure the program to suit your taste.
  11. ; This file adapts the Tandy Model 4 computer to the modem program.
  12. ; Much of the information contained here is not in the main file.
  13. ;
  14. ; Edit this file for your preferences then follow the "TO USE:" example
  15. ; shown below.
  16. ;
  17. ; Use the MDM724 "SET" command to change the baudrate when desired.  It
  18. ; starts out at 300 baud when the program is first called up.
  19. ;
  20. ;    TO USE: First edit this file filling in answers for your own
  21. ;        equipment.  Assemble with MAC or equivalent
  22. ;        assembler.  Then use SID to overlay the the results
  23. ;        of this program to the original .COM file:
  24. ;
  25. ;        A>SAVE
  26. ;        A>SID MDM724.COM
  27. ;        CP/M 3 SID - Version 3.0 
  28. ;        NEXT MSZE   PC   END
  29. ;        4900 4900  0100  A9FF
  30. ;        #R M7RCP-1.HEX
  31. ;        NEXT MSZE   PC   END
  32. ;          0334 4900  0100  A9FF
  33. ;        #G0
  34. ;        
  35. ;        CP/M 3 SAVE - Version 3.0
  36. ;        Enter file (type RETURN to exit): MDM724.COM
  37. ;        Delete MDM724.COM? Y
  38. ;        Beginning hex address 100
  39. ;        Ending hex address    4900
  40. ;        
  41. ;        A>
  42. ;
  43. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  44. ;
  45. ; 02/02/84 - Modified to work with CP/M+        - Richard Press, M.D.
  46. ; 11/26/83 - Modified for the TRS80 Mod 4    - Steven J. Davidson, M.D.
  47. ;                        & Richard Press, M.D.
  48. ; 08/27/83 - Renamed to work with MDM712    - Irv Hoff
  49. ; 07/25/83 - Adapted for TRS-80 (zero ORG CP/M)    - Phil Becker
  50. ; 06/22/83 - Revised to work with MDM710    - Irv Hoff
  51. ; 05/25/83 - Updated to work with MDM709    - Irv Hoff
  52. ; 05/15/83 - Revised to work with MDM708    - Irv Hoff
  53. ; 04/11/83 - Updated to work with MDM707    - Irv Hoff
  54. ; 04/04/83 - First version of this file        - Irv Hoff
  55. ;
  56. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  57. ;
  58. BELL:        EQU    07H        ;bell
  59. CR:        EQU    0DH        ;carriage return
  60. ESC:        EQU    1BH        ;escape
  61. LF:        EQU    0AH        ;linefeed
  62. ;
  63. YES:        EQU    0FFH
  64. NO:        EQU    0
  65. ;
  66. ;
  67. PORT:        EQU    0EAH        ;TRS80 Mod 4 Modem Status Port
  68. MODCTL1:    EQU    PORT        ;Modem status port
  69. MODCTL2:    EQU    PORT        ;Modem control port
  70. MODDATP:    EQU    PORT+1        ;Modem data port
  71. MODDCDB:    EQU    20H        ;carrier detect bit
  72. MODDCDA:    EQU    20H        ;value when active
  73. BAUDRP:        EQU    PORT-1        ;Baud rate port
  74. MODRCVB:    EQU    80H        ;Recv. Ready Mask bit
  75. MODRCVR:    EQU    80H        ; -value when ready
  76. MODSNDB:    EQU    40H        ;xmit. ready mask bit
  77. MODSNDR:    EQU    40H        ; -value when ready
  78. ;
  79.         ORG    100H
  80. ;
  81.         DS    3    ;(for  "JMP   START" instruction)
  82. ;
  83.  
  84. PMMIMODEM:    DB    NO    ;yes=PMMI S-100 Modem            103H
  85. SMARTMODEM:    DB    NO    ;yes=HAYES Smartmodem            104H
  86. TONEPULSE:    DB    'T'    ;T=tone, P=Pulse (Smartmodem-only)    105H
  87. CLOCK:        DB    40    ;clock speed in MHz x10, 25.5 MHz max.    106H
  88.                 ;20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
  89. MSPEED:        DB    1    ;0=110 1=300 2=450 3=600 4=710 5=1200   107H
  90.                 ;6=2400 7=4800 8=9600 9=19200 default
  91. BYTDLY:        DB    5    ;0=0 delay  1=10ms  5=50 ms - 9=90 ms   108H
  92.                 ;default time to send character in ter-
  93.                 ;minal mode file transfer for slow BBS.
  94. CRDLY:        DB    3    ;0=0 delay 1=100 ms 5=500 ms - 9=900 ms 109H
  95.                 ;default time for extra wait after CRLF
  96.                 ;in terminal mode file transfer
  97. NOOFCOL:    DB    5    ;number of DIR columns shown        10AH
  98. SETUPTST:    DB    YES    ;yes=user-added Setup routine        10BH
  99. SCRNTEST:    DB    YES    ;cursor control routine         10CH
  100. ACKNAK:        DB    YES    ;yes=resend a record after a non-ACK    10DH
  101.                 ;no=resend a record only after NAK
  102. BAKKUPBYTE:    DB    NO    ;yes=change any file same name to .BAK    10EH
  103. CRCDFLT:    DB    YES    ;yes=default to CRC checking        10FH
  104. TOGGLECRC:    DB    YES    ;yes=allow toggling of CRC to Checksum    110H
  105. CONVBKSP:    DB    NO    ;yes=convert backspace to rub        111H
  106. TOGGLEBK:    DB    YES    ;yes=allow toggling of bksp to rub    112H
  107. ADDLF:        DB    NO    ;no=no LF after CR to send file in    113H
  108.                 ;terminal mode (added by remote echo)
  109. TOGGLELF:    DB    YES    ;yes=allow toggling of LF after CR    114H
  110. TRANLOGON:    DB    YES    ;yes=allow transmission of logon    115H
  111.                 ;write logon sequence at location LOGON
  112. SAVCCP:        DB    YES    ;yes=do not overwrite CCP        116H
  113. LOCONEXTCHR:    DB    YES    ;yes=local command if EXTCHR precedes    117H
  114.                 ;no=external command if EXTCHR precedes
  115. TOGGLELOC:    DB    YES    ;yes=allow toggling of LOCONEXTCHR    118H
  116. LSTTST:        DB    YES    ;yes=printer available on printer port    19H
  117. XOFFTST:    DB    NO    ;yes=chcks for XOFF from remote    while    11AH
  118.                 ;sending a file in terminal mode
  119. XONWAIT:    DB    NO    ;yes=wait for XON after CR while    11BH
  120.                 ;sending a file in terminal mode
  121. TOGXOFF:    DB    YES    ;yes=allow toggling of XOFF checking    11CH
  122. IGNORCTL:    DB    YES    ;yes=CTL-chars above ^M not displayed    11DH
  123. EXTRA1:        DB    0    ;for future expansion            11EH
  124. EXTRA2:        DB    0    ;for future expansion            11FH
  125. BRKCHR        DB    'B'-40H    ;Send a 300 ms. break tone        120H
  126. NOCONNCT:    DB    'N'-40H    ;^N = Disconnect from phone line    121H
  127. LOGCHR:        DB    'L'-40H    ;^L = Send logon            122H
  128. LSTCHR:        DB    'P'-40H    ;^P = Toggle printer            123H
  129. UNSAVE:        DB    'T'-40H    ;^R = Close input text buffer        124H
  130. TRANCHR:    DB    'Y'-40H ;^T = Transmit file to remote        125H
  131. SAVECHR:    DB    'R'-40H    ;^Y = Open input text buffer        126H
  132. EXTCHR:        DB    'K'-40H    ;^K = Send next character        127H
  133. ;
  134. ;
  135.         DS    2        ;                128H
  136. ;
  137. IN$MODCTL1:    IN    MODCTL1     ;in modem control port        12AH
  138.         PUSH    B
  139.         ANI    0DFH
  140.         MOV    B,A        ;save status
  141.         JMP    CTLPT2        ;continue
  142.         DS    1
  143. ;
  144. OUT$MODDATP:    OUT    MODDATP ! RET    ;out modem data port        134H
  145. ;
  146. ;
  147. ; CONTINUE STATUS READ
  148. ;
  149. CTLPT2:        IN    0E8H        ;read CD port
  150.         ANI    20H        ;isolate CD
  151.         ORA    B        ;merge status
  152.         POP    B
  153.         RET
  154. ;
  155. IN$MODDATP:    IN    MODDATP ! RET    ;in modem data port        13EH
  156.         DS    7
  157. ANI$MODRCVB:    ANI    MODRCVB    ! RET    ;bit to test for receive ready    148H
  158.  
  159. CPI$MODRCVR:    CPI    MODRCVR    ! RET    ;value of rcv. bit when ready    14BH
  160. ANI$MODSNDB:    ANI    MODSNDB    ! RET    ;bit to test for send ready    14EH
  161. CPI$MODSNDR:    CPI    MODSNDR    ! RET    ;value of send bit when ready    151H
  162.         DS    6        ;                156H
  163. ;
  164. OUT$MODCTL1:    OUT    MODCTL1    ! RET    ;out modem control port #2    15AH
  165. OUT$MODCTL2:    OUT    MODCTL2    ! RET    ;out modem control port #1    15DH
  166. ;
  167. LOGONPTR:    DW    LOGON        ;for user message.        160H
  168.         DS    6        ;                162H
  169. JMP$GOODBYE:    JMP    GOODBYE        ;                168H
  170. JMP$INITMOD:    JMP    INITMOD        ;go to user written routine    16BH
  171.         RET  !  NOP  !  NOP    ;(by-passes PMMI routine)    16EH
  172.         RET  !  NOP  !  NOP    ;(by-passes PMMI routine)    171H
  173.         RET  !  NOP  !  NOP    ;(by-passes PMMI routine)    174H
  174. JMP$SETUPR:    JMP    SETUPR        ;                177H
  175. JMP$SPCLMENU:    JMP    SPCLMENU    ;                17AH
  176. JMP$SYSVER:    JMP    SYSVER        ;                17DH
  177. JMP$BREAK:    JMP    SENDBRK        ;                180H
  178. ;
  179. ;
  180. ; Do not change the following six lines.
  181. ;
  182. JMP$ILPRT:    DS    3        ;                183H
  183. JMP$INBUF    DS    3        ;                186H
  184. JMP$INLNCOMP:    DS    3        ;                189H
  185. JMP$INMODEM    DS    3        ;                18CH
  186. JMP$NXTSCRN:    DS    3        ;                18FH
  187. JMP$TIMER:    DS    3        ;                192H
  188. ;
  189. ; Clear sequences -- CLREOS is clear to end of screen, CLRSCRN is clear
  190. ; entire screen.  Last entry must be 0.  Any other 0's act as NOP's.
  191. ;
  192. CLREOS:        CALL    JMP$ILPRT    ;                 195H
  193.         DB    01BH,04AH,0,0,0    ;                198H
  194.         RET            ;                19DH
  195. ;
  196. CLRSCRN:    CALL    JMP$ILPRT    ;                19EH
  197.         DB    01BH,045H,0,0,0    ;                1A1H
  198.         RET            ;                1A6H
  199. ;
  200. ;
  201. SYSVER:        CALL    JMP$ILPRT    ;                1A7H
  202.         DB    '*** Version for Tandy TRS80 Mod 4 ***'    
  203.                 DB      CR,LF
  204.          DB    '***  with Radio Shack CP/M Plus   ***'
  205.         DB    CR,LF,0
  206.         RET
  207. ;.....
  208. ;
  209. ;
  210. ;-----------------------------------------------------------------------
  211. ;
  212. ; NOTE:  You can change the SYSVER message to be longer or shorter.  The
  213. ;     end of your last routine should terminate by 0400H (601 bytes
  214. ;     available after start of SYSVER) if using the Hayes Smartmodem
  215. ;     or by address 0C00H (2659 bytes) otherwise.
  216. ;
  217. ;-----------------------------------------------------------------------
  218. ;
  219. ; You can put in a message at this location which can be called up with
  220. ; CTL-O if TRANLOGON has been set YES.  You can put in several lines if
  221. ; desired.  End with a 0.
  222. ;
  223. ;
  224. LOGON:      DB    'Hello, This is a TRS80 Mod 4 computer',CR,LF,0
  225. ;
  226. ;=======================================================================
  227. ;
  228. ; This routine allows a 300 ms. break tone to be sent to reset some
  229. ; time-share computers.
  230. ;
  231. SENDBRK:
  232.     MVI    A,0E8H        ; 8 bit words, 1 stop bit, no parity,
  233.     JMP    GOODBYE1    ; DTR & RTS disabled, *BREAK bit SET*
  234. ;
  235. ;.....
  236. ;
  237. ;
  238. ; This routine sends a 300 ms. break tone and sets DTR low for the same
  239. ; length of time to disconnect some modems such as the Bell 212A, etc.
  240. ;
  241. GOODBYE:
  242. ;
  243.     MVI    A,0EBH            ;send break, turn off DTR
  244. ;
  245. GOODBYE1:
  246. ;
  247.     OUT    MODCTL1        ;send to status port
  248.     MVI    B,3        ;delay about 300 ms.
  249.     CALL    JMP$TIMER
  250.     MVI    A,0ECH        ;normal send/receive with DTR
  251.     OUT    MODCTL1        ;send to status port
  252.     RET
  253. ;
  254. ;
  255. ; TRS80 Mod 4 initialization -- sets CTC timer 0 for baudrate in/out.
  256. ;
  257. ; TRS80 Mod 4 specific equates for initialization.
  258. ;
  259. CTCCMD:      EQU    0E8H        ;Master Reset, UART cntrl. register
  260. CTC0:      EQU    0E9H        ;BR19411 Timer control Timer 0 (port A)
  261. IB300      EQU    55H        ;Default 300 baud
  262. ;
  263. INITMOD:  MVI    A,1        ;Reset UART and enable it
  264.       OUT    CTCCMD        
  265. ;
  266.       MVI    A,0ECH        ;8 bits, no parity, 1 stop bit, enable DTR
  267.       OUT    MODCTL1        ;                and RTS
  268. ;
  269. LSBD:      MVI    A,IB300
  270.       OUT    CTC0  
  271. ;
  272. INITMOD1: MVI    A,1        ;default transfer time to 300 baud
  273.       STA    MSPEED
  274.       RET
  275. ;
  276. ;.....
  277. ;
  278. ;
  279. SETUPR:      LXI    D,BAUDBUF    ;point to new input buffer
  280.       CALL    JMP$ILPRT
  281.       DB    'Input Baud Rate (300, 600, 1200, '
  282.       DB    '4800, 9600, 19200): ',0
  283.       CALL    JMP$INBUF
  284.       LXI    D,BAUDBUF+2
  285.       CALL    JMP$INLNCOMP    ;compare BAUDBUF+2 with characters below
  286.       DB    '300',0
  287.       JNC    OK300        ;go if got match
  288.       CALL    JMP$INLNCOMP
  289.       DB    '600',0
  290.       JNC    OK600
  291.       CALL    JMP$INLNCOMP
  292.       DB    '1200',0
  293.       JNC    OK1200
  294.       CALL    JMP$INLNCOMP
  295.       DB    '4800',0
  296.       JNC    OK4800
  297.       CALL    JMP$INLNCOMP
  298.       DB    '9600',0
  299.       JNC    OK9600
  300.        CALL    JMP$INLNCOMP
  301.       DB    '19200',0
  302.       JNC    OK19200
  303.       CALL    JMP$ILPRT    ;all matches failed, tell operator
  304.       DB    '++ Incorrect entry ++',CR,LF,BELL,0
  305.       JMP    SETUPR        ;try again
  306. ;
  307. OK300:      MVI    A,1        ;MSPEED 300 baud value
  308.       LHLD    BD300        ;get 300 baud parameters in 'HL'
  309.       JMP    LOADBD        ;go load them
  310. ;
  311. OK600:    MVI    A,3
  312.       LHLD    BD600
  313.       JMP    LOADBD
  314. ;
  315. OK1200:      MVI    A,5
  316.       LHLD    BD1200
  317.       JMP   LOADBD
  318. ;
  319. OK4800:      MVI    A,7
  320.       LHLD    BD4800
  321.       JMP    LOADBD
  322. ;
  323. OK9600:      MVI    A,8
  324.       LHLD    BD9600
  325.       JMP    LOADBD
  326. ;
  327. OK19200:  MVI    A,9
  328.       LHLD    BD19200        ;fall thru.....
  329. ;
  330. LOADBD:      STA    INITMOD1+1    ;change time-to-send to match baudrate
  331.       MOV    A,L        ;get baudrate byte
  332.       STA    LSBD+1        ;store in INITMOD
  333.       JMP    LSBD        ;reinitialize to new baudrate, then done
  334.       RET        
  335. ;
  336. ;
  337. ; TABLE OF BAUDRATE PARAMETERS
  338. ;
  339. BD300:    DB    55H        ;  300 baud
  340. BD600:    DB    66H        ;  600 baud
  341. BD1200:    DB    77H        ; 1200 baud
  342. BD4800:    DB    0CCH        ; 4800 baud
  343. BD9600:    DB    0EEH        ; 9600 baud
  344. BD19200:
  345. ;
  346.     DB    0FFH        ;19200 baud
  347. ;
  348. BAUDBUF:  DB    10,0
  349.       DS    10
  350. ;
  351. ;           (END OF INITMOD AND SETUP ROUTINES)
  352. ;=======================================================================
  353. ;        
  354. ;
  355. ; These routines can be used for your equipment, be sure to end with RET
  356. ; If using the Hayes Smartmodem this is unavailable without a special
  357. ; change.
  358. ;
  359. SPCLMENU: RET
  360. ;        
  361. ;=======================================================================
  362. ;
  363. ;
  364. ; NOTE:  MUST TERMINATE PRIOR TO 0400H (with Smartmodem)
  365. ;                                0BC0H (without Smartmodem)
  366. ;
  367.       END
  368. ;
  369.