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 / M7R1-3.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  10KB  |  327 lines

  1. ; M7R1-3.ASM -- Overlay for Radio Shack TRS-80 Model I equipped with
  2. ;        Omikron Mapper I or similar modification which allows
  3. ;        operation with ram-base-0 CP/M.
  4. ;
  5. ;
  6. ; Edit this file for your preferences then follow the "TO USE:" example
  7. ; shown below.
  8. ;
  9. ;    TO USE: After editing, assemble with ASM.COM or equivalent
  10. ;        assembler.  Then use DDT to overlay the resulting
  11. ;        .HEX file on the MDM7xx.COM file:
  12. ;
  13. ;        A>DDT MDM7xx.COM
  14. ;        DDT VERS 2.2
  15. ;        NEXT  PC
  16. ;        4A00 0100
  17. ;        -IM7R1-3.HEX        (Note the "I" command.)
  18. ;        -R            ("R" loads in the .HEX file.)
  19. ;        NEXT  PC
  20. ;        4A00 0000
  21. ;        -G0            (Return to CP/M.)
  22. ;        A>SAVE 73 MDM7xx.COM    (You now have a modified .COM file.)
  23. ;
  24. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  25. ;
  26. ; 03/21/84 - Modified for Radio Shack Model I.        - Dave Towson
  27. ; 11/11/83 - General purpose overlay file for MDM7xx.   - Irv Hoff
  28. ;
  29. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  30. ;
  31. CR:        EQU    0DH    ;Carriage return
  32. LF:        EQU    0AH    ;Linefeed
  33. ;
  34. YES:        EQU    0FFH
  35. NO:        EQU    0
  36. ;
  37. NUMLIB:        EQU    0E00H    ;Address of telephone number library.
  38.                 ;CHECK THIS - may have changed.
  39. XFRSIZ:        EQU    4    ;Buffer size in Kbytes for Christensen
  40.                 ;protocol receive-to-disk.  Must not be
  41.                 ;greater than 16.
  42. SHOWHEX        EQU    YES    ;Yes = show hexadecimal record numbers
  43.                 ;in addition to decimal during protocol
  44.                 ;file transfer.  No = don't show hex.
  45. ;
  46. RESETP:        EQU    0E8H    ;Reset port for RS-232.
  47. BAUDP:        EQU    0E9H    ;Data-rate port for RS-232.
  48. CONTROLP:    EQU    0EAH    ;Status/control port for RS-232.
  49. DATAP:        EQU    0EBH    ;Data port for RS-232.
  50. SENDMASK:    EQU    40H    ;Bit to test for transmit-buffer-empty.
  51. SENDRDY:    EQU    40H    ;Value when ready.
  52. RECVMASK:    EQU    80H    ;Bit to test for received-data-available.
  53. RECVRDY:    EQU    80H    ;Value when ready.
  54. BRKMASK:    EQU    0FBH    ;And-mask to turn on break.
  55. DISCONMASK:    EQU    03H    ;Or-mask to turn off DTR and RTS.
  56. ;
  57.         ORG    100H
  58. ;
  59. ;
  60. ; Change the clock speed if you have installed a clock modification.
  61. ;
  62.         DS    3    ;For  "JMP   START" instruction.
  63. ;
  64. PMMIMODEM:    DB    NO    ;Yes = PMMI S100 modem.            103H
  65. SMARTMODEM:    DB    NO    ;Yes = HAYES Smartmodem.        104H
  66. TOUCHPULSE:    DB    'P'    ;T=touch, P=pulse (Smartmodem only).    105H
  67. CLOCK:        DB    18    ;Clock speed in MHz x10, 25.5 MHz max.    106H
  68.                 ;20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
  69. MSPEED:        DB    1    ;0=110 1=300 2=450 3=600 4=710 5=1200   107H
  70.                 ;6=2400 7=4800 8=9600 9=19200.
  71.                 ;Default data-rate used for time-to-
  72.                 ;send calculations.
  73. BYTDLY:        DB    5    ;0=0 delay  1=10ms  5=50 ms - 9=90 ms.  108H
  74.                 ;Default time to send character in ter-
  75.                 ;minal mode file transfer for slow BBS.
  76. CRDLY:        DB    5    ;0=0 delay 1=100 ms 5=500 ms - 9=900 ms 109H
  77.                 ;Default time for extra wait after CRLF
  78.                 ;in terminal mode file transfer.
  79. NOOFCOL:    DB    4    ;Number of DIR columns shown.        10AH
  80. SETUPTST:    DB    YES    ;Yes = user-added setup routine.    10BH
  81. SCRNTEST:    DB    YES    ;Clear screen routine installed.    10CH
  82. NORETRY:    DB    NO    ;Yes = aborts after ERRLIM consecutive  10DH
  83.                 ;timeouts.  No = reset the error limit
  84.                 ;to allow more attempts.  Called ACKNAK,
  85.                 ;and used for a different purpose in
  86.                 ;earlier overlays.
  87. BAKUPBYTE:    DB    NO    ;Yes = change any file having same    10EH
  88.                 ;name to .BAK
  89. CRCDFLT:    DB    YES     ;Yes = default to CRC checking.        10FH
  90. TOGGLECRC:    DB    YES    ;Yes = allow toggling of CRC to     110H
  91.                 ;checksum.
  92. CONVBKSP:    DB    NO    ;Yes = convert backspace to rubout.    111H
  93. TOGGLEBK:    DB    YES    ;Yes = allow toggling of bksp to rub.    112H
  94. ADDLF:        DB    NO    ;No = no LF after CR when sending file    113H
  95.                 ;in terminal mode (added by remote).
  96. TOGGLELF:    DB    YES    ;Yes = allow toggling of LF after CR.    114H
  97. TRANLOGON:    DB    NO     ;Yes = allow transmission of logon.    115H
  98.                 ;Put logon sequence at location LOGON.
  99. SAVCCP:        DB    YES    ;Yes = do not overwrite CCP.        116H
  100. LOCONEXTCHR:    DB    NO    ;Yes = local cmd if EXTCHR precedes.    117H
  101.                 ;No = transmitted to remote computer if
  102.                 ;preceded by EXTCHR.
  103. TOGGLELOC:    DB    YES    ;Yes = allow toggling of LOCONEXTCHR.    118H
  104. LSTTST:        DB    YES    ;Yes = printer available on printer    119H
  105.                 ;port.
  106. XOFFTST:    DB    NO    ;Yes = checks for XOFF from remote    11AH
  107.                 ;while sending a file in terminal mode.
  108. XONWAIT:    DB    NO    ;Yes = wait for XON after CR while    11BH
  109.                 ;sending a file in terminal mode.
  110. TOGXOFF:    DB    YES    ;Yes = allow toggling of XOFF checking.    11CH
  111. IGNORCTL:    DB    NO     ;Yes = CTL-chars above ^M not displayed    11DH
  112. EXTRA1:        DB    0    ;For future expansion.            11EH
  113. EXTRA2:        DB    0    ;For future expansion.            11FH
  114. BRKCHR:        DB    'B'-40H    ;^B = Send 300 ms. break tone.        120H
  115. NOCONNCT:    DB    'D'-40H    ;^D = Disconnect from the phone line.    121H
  116. LOGCHR:        DB    'L'-40H    ;^L = Send logon.            122H
  117. LSTCHR:        DB    'P'-40H    ;^P = Toggle printer.            123H
  118. UNSAVE:        DB    'C'-40H    ;^C = Close input text buffer.        124H
  119. TRANCHR:    DB    'T'-40H ;^T = Transmit file to remote.        125H
  120. SAVECHR:    DB    'O'-40H    ;^O = Open input text buffer.        126H
  121. EXTCHR:        DB    'N'-40H    ;^N = Send next character.        127H
  122. ;
  123. ;
  124.         DS    2        ;                128H
  125. ;
  126. IN$MODCTL1:    IN    CONTROLP ! RET    ;Get RS-232 status.        12AH
  127.         DB    0,0,0,0,0,0,0    ;Do not delete these.
  128. ;
  129. OUT$MODDATP:    OUT    DATAP    ! RET    ;Send a character to the RS-232    134H
  130.         DB    0,0,0,0,0,0,0    ;Do not delete these.              
  131. ;
  132. IN$MODDATP:      IN    DATAP    ! RET    ;Get a character from RS-232.    13EH
  133.         DB    0,0,0,0,0,0,0    ;Do not delete these.              
  134. ;
  135. ANI$MODRCVB:    ANI    RECVMASK ! RET    ;Mask for rcvd-char-ready bit.    148H
  136. CPI$MODRCVR:    CPI    RECVRDY ! RET    ;Test for rcvd-char-ready.    14BH
  137. ANI$MODSNDB:    ANI    SENDMASK ! RET    ;Mask for ready-to-send bit.    14EH
  138. CPI$MODSNDR:    CPI    SENDRDY ! RET    ;Test for ready-to-send.        151H
  139.         DS    6        ;                154H
  140. ;
  141.         DS    6        ;                15AH
  142. ;
  143. LOGONPTR:    DW    LOGON        ;For user message.        160H
  144.         DS    6        ;                162H
  145. JMP$GOODBYE:    JMP    GOODBYE        ;                168H
  146. JMP$INITMOD:    JMP    TRSINIT        ;Go to user written routine.    16BH
  147.         RET  !  NOP  !  NOP    ;(by-passes PMMI routine)    16EH
  148.         RET  !  NOP  !  NOP    ;(by-passes PMMI routine)    171H
  149.         RET  !  NOP  !  NOP    ;(by-passes PMMI routine)    174H
  150. JMP$SETUPR:    JMP    SETBAUD        ;                177H
  151. JMP$SPCLMENU:    JMP    SPCLMENU    ;                17AH
  152. JMP$SYSVER:    JMP    SYSVER        ;                17DH
  153. JMP$BREAK:    JMP    SENDBRK        ;                180H
  154. ;
  155. ;
  156. ; Do not change the following six lines.
  157. ;
  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. CLREOS:        CALL    JMP$ILPRT    ;Clear from cursor to EOS.    195H
  166.         DB    1FH,0,0,0,0    ;                198H
  167.         RET            ;                19DH
  168. ;
  169. CLRSCRN:    CALL    JMP$ILPRT    ;Home cursor and clear screen.    19EH
  170.         DB    1CH,1FH,0,0,0    ;                1A1H
  171.         RET            ;                1A6H
  172.     
  173. ;
  174. SYSVER:        CALL    JMP$ILPRT    ;Display version name.        1A7H
  175.         DB    'Version for TRS-80 Model I '            
  176.         DB    'with Omikron Mapper I'                
  177.         DB    CR,LF,0        ;                            
  178.         RET            ;                
  179. ;.....
  180. ;
  181. ;
  182. ; You can put in a message at this location which can be called up with
  183. ; CTL-L if TRANLOGON has been set to YES.  You can use several lines if
  184. ; desired.  End with a 0.
  185. ;
  186. LOGON:        DB    'Put logon message here.',CR,LF,0
  187. ;
  188. ;.....
  189. ;
  190. ;
  191. ; Routine to send a break-tone of approximately 300 ms duration.
  192. ;
  193. SENDBRK:    PUSH    B        ;Save all double registers.
  194.         PUSH    D        ;
  195.         PUSH    H        ;
  196.         LDA    CONTROLB    ;Get current RS-232 control byte.
  197.         ANI    BRKMASK        ;Change bit to turn on break.        
  198.         OUT    CONTROLP    ;Send new byte to control port.
  199.         MVI    B,3        ;Set count for timer.
  200.         CALL    JMP$TIMER    ;Wait 300 milliseconds.        
  201.         LDA    CONTROLB    ;Restore original control byte        
  202.         OUT    CONTROLP    ;to turn off break.
  203.         POP    H        ;Restore double registers.
  204.         POP    D        ;
  205.         POP    B        ;
  206.         RET            ;
  207. ;
  208. ;
  209. ;.....
  210. ;
  211. ;
  212. ; Routine to disconnect modem from telephone line by setting both DTR and
  213. ; RTS to the "off" state.  Send a BREAK (in terminal mode) to reconnect.
  214. ; CHECK THIS - control logic for your modem may be different.
  215. ;
  216. GOODBYE:    LDA    CONTROLB    ;Get current RS-232 control byte.
  217.         ORI    DISCONMASK    ;Change bits to turn off DTR and RTS.
  218.         OUT    CONTROLP    ;Send new byte to control port.
  219.         RET            ;
  220. ;
  221. ;
  222. ;.....
  223. ;
  224. ;
  225. ; RS-232 initialization routine for TRS-80 Model I.
  226. ;
  227. TRSINIT:    OUT    RESETP        ;Reset UART (data in A register is
  228.                     ;insignificant).
  229.         MVI    A,55H        ;Value for 300 baud.
  230.                     ;Use 77H for 1200 baud.
  231.         OUT    BAUDP        ;Set RS-232 data-rate.
  232. ;
  233. ; NOTE:  Be sure to set the default value at entry "MSPEED:"
  234. ;        to agree with the above data-rate.
  235. ;
  236.         MVI    A,0ECH        ;Set RS-232 for 8-bit word,
  237.                     ;no parity, and
  238.         OUT    CONTROLP    ;DTR and RTS on.
  239.         STA    CONTROLB    ;Save the RS-232 control byte.
  240.         RET            ;
  241. ;
  242. ;
  243. ;.....
  244. ;
  245. ;
  246. CONTROLB:    DB    0        ;RS-232 control byte save.
  247. ;
  248. ;
  249. ;.....
  250. ;
  251. ;
  252. ; Routine to change data-rate with the SET command.
  253. ;
  254. SETBAUD:    PUSH    B        ;Save all double registers.
  255.         PUSH    D        ;
  256.         PUSH    H        ;
  257. ;
  258. AGAIN:        LXI    D,BAUDBUF    ;Point to input buffer.
  259.         CALL    JMP$ILPRT    ;Display message.
  260.         DB    'Input Baud Rate (300, 1200): ',0
  261.         CALL    JMP$INBUF    ;Get response.
  262.         LXI    D,BAUDBUF+2    ;Set pointer.
  263.         CALL    JMP$INLNCOMP    ;Compare BAUDBUF+2 with
  264.                     ;valid responses below.
  265.         DB    '300',0        ;300 baud.
  266.         MVI    A,1        ;Value for MSPEED.
  267.         MVI    C,55H        ;Value for data-rate.
  268.         JNC    OK        ;Jump if match.
  269. ;
  270.         CALL    JMP$INLNCOMP    ;Else, try next valid response.
  271.         DB    '1200',0    ;1200 baud.
  272.         MVI    A,5        ;Value for MSPEED.
  273.         MVI    C,77H        ;Value for data-rate.
  274.         JNC    OK        ;Jump if match.
  275.         CALL    JMP$ILPRT    ;Else, bad input.
  276.                     ;Display message.
  277.         DB    '++ INCORRECT ENTRY ++',CR,LF,0
  278.         JMP    AGAIN        ;Try again.
  279. ;
  280. ;
  281. ;.....
  282. ;
  283. ;
  284. OK:        STA    MSPEED        ;Set value for file-send-time
  285.                     ;computations.
  286.         MOV    A,C        ;
  287.         OUT    BAUDP        ;Set RS-232 data-rate.
  288.         POP    H        ;Restore double registers.
  289.         POP    D        ;
  290.         POP    B        ;
  291.         RET            ;
  292. ;
  293. ;
  294. ;.....
  295. ;
  296. ;
  297. BAUDBUF:    DB    10,0        ;Keyboard input buffer.
  298.         DS    10
  299. ;
  300. ;
  301. ;.....
  302. ;
  303. ;
  304. SPCLMENU:      RET
  305. ;
  306. ;
  307. ;.....
  308. ;
  309. ;
  310. ; Routine to determine whether hexadecimal record numbers are displayed
  311. ; during protocol file transfer, and size of buffer used.
  312. ;
  313.         ORG    NUMLIB-2
  314. ;
  315. HEXSHOW:    DB    SHOWHEX        ;Set hex display.
  316. SAVSIZ:        DB    XFRSIZ*8    ;Set buffer size.
  317. ;
  318. ;
  319. ;.....
  320. ;
  321. ;
  322.         END
  323. ;
  324. ;
  325. ;.....
  326.