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 / M7IM-2.AQM / M7IM-2.ASM
Assembly Source File  |  2000-06-30  |  11KB  |  334 lines

  1.  
  2. ; M7IM-2.ASM -- IMS (862 I/O)overlay file for MDM7xx.  12/20/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 modem port on the IMS 5000 with 862 I/O to the modem
  7. ; program.  Much of the information contained here is not in the main
  8. ; file.
  9. ;
  10. ; Edit this file for your preferences then follow the "TO USE:" example
  11. ; shown below.
  12. ;
  13. ; Use the "SET" command to change the baudrate when desired.  It starts
  14. ; out at 300 baud when the program is first called up.
  15. ;
  16. ;    TO USE: First edit this file filling in answers for your own
  17. ;        equipment.  Then assemble with ASM.COM or equivalent
  18. ;        assembler.  Then use DDT to overlay the the results
  19. ;        of this program to the original .COM file:
  20. ;
  21. ;        A>DDT MDM7xx.COM
  22. ;        DDT VERS 2.2
  23. ;        NEXT  PC
  24. ;        4400 0100
  25. ;        -IM7IM-2.HEX        (note the "I" command)
  26. ;        -R            ("R" loads in the .HEX file)
  27. ;        NEXT  PC
  28. ;        4400 0000
  29. ;        -G0            (return to CP/M)
  30. ;        A>SAVE 69 MDM7xx.COM    (now have a modified .COM file)
  31. ;
  32. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  33. ;
  34. ; 01/13/84 - Modified to work with the IMS at port 2D    - Steve Noland
  35. ; 12/30/83 - First version of this overlay              - Steve Noland
  36. ;            (adapted from M7TV-1.ASM by Irv Hoff)
  37. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  38. ;
  39. BELL:        EQU    07H        ;bell
  40. CR:        EQU    0DH        ;carriage return
  41. ESC:        EQU    1BH        ;escape
  42. LF:        EQU    0AH        ;linefeed
  43. ;
  44. YES:        EQU    0FFH
  45. NO:        EQU    0
  46. ;
  47. ;
  48. PORT:        EQU    2DH        ;IMS data port
  49. ;
  50. BAUDRP:     EQU    29H        ;CTC port for baud rate
  51. MODCTL1:    EQU    PORT+2        ;Modem control port
  52. MODCTL2:    EQU    PORT+2        ;Modem control port
  53. MODDATP:    EQU    PORT        ;Modem data port
  54. MODDCDB:    EQU    4        ;carrier detect bit
  55. MODDCDA:    EQU    0        ;value when active
  56. MODRCVB:    EQU    1        ;bit to test for receive ready
  57. MODRCVR:    EQU    1        ;value when ready
  58. MODSNDB:    EQU    4        ;bit to test for send ready
  59. MODSNDR:    EQU    4        ;value when ready
  60. ;
  61. ;
  62.         ORG    100H
  63. ;
  64.         DS    3    ;(for  "JMP   START" instruction)
  65. ;
  66. PMMIMODEM:    DB    NO    ;yes=PMMI S-100 Modem            103H
  67. SMARTMODEM:    DB    YES    ;yes=HAYES Smartmodem, no=non-PMMI    104H
  68. TOUCHPULSE:    DB    'T'    ;T=touch, P=pulse (Smartmodem-only)    105H
  69. CLOCK:        DB    40    ;clock speed in MHz x10, 25.5 MHz max.    106H
  70.                 ;20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
  71. MSPEED:     DB    1    ;0=110 1=300 2=450 3=600 4=710 5=1200    107H
  72.                 ;6=2400 7=4800 8=9600 9=19200 default
  73. BYTDLY:     DB    0    ;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    5    ;number of DIR columns shown        10AH
  80. SETUPTST:    DB    YES    ;yes=user-added Setup routine        10BH
  81. SCRNTEST:    DB    YES    ;Cursor control routine         10CH
  82. ACKNAK:     DB    YES    ;yes=resend a record after any non-ACK    10DH
  83.                 ;no=resend a record after a valid NAK
  84. BAKUPBYTE:    DB    NO    ;yes=change any file same name to .BAK    10EH
  85. CRCDFLT:    DB    YES    ;yes=default to CRC checking        10FH
  86. TOGGLECRC:    DB    YES    ;yes=allow toggling of CRC to Checksum    110H
  87. CONVBKSP:    DB    NO    ;yes=convert backspace to rub        111H
  88. TOGGLEBK:    DB    NO    ;yes=allow toggling of bksp to rub    112H
  89. ADDLF:        DB    NO    ;no=no LF after CR to send file in    113H
  90.                 ;terminal mode (added by remote echo)
  91. TOGGLELF:    DB    YES    ;yes=allow toggling of LF after CR    114H
  92. TRANLOGON:    DB    YES    ;yes=allow transmission of logon    115H
  93.                 ;write logon sequence at location LOGON
  94. SAVCCP:     DB    YES    ;yes=do not overwrite CCP        116H
  95. LOCONEXTCHR:    DB    NO    ;yes=local command if EXTCHR precedes    117H
  96.                 ;no=external command if EXTCHR precedes
  97. TOGGLELOC:    DB    YES    ;yes=allow toggling of LOCONEXTCHR    118H
  98. LSTTST:     DB    YES    ;yes=printer available on printer port    119H
  99. XOFFTST:    DB    YES    ;yes=check for XOFF from remote while    11AH
  100.                 ;sending a file in terminal mode
  101. XONWAIT:    DB    NO    ;yes=wait for XON after CR while    11BH
  102.                 ;sending a file in terminal mode
  103. TOGXOFF:    DB    YES    ;yes=allow toggling of XOFF checking    11CH
  104. IGNORCTL:    DB    NO    ;yes=CTL-chars above ^M not displayed    11DH
  105. EXTRA1:     DB    0    ;for future expansion            11EH
  106. EXTRA2:     DB    0    ;for future expansion            11FH
  107. BRKCHR:     DB    '@'-40H ;^@ = Send a 300 ms. break tone     120H
  108. NOCONNCT:    DB    'L'-40H ;^L = Disconnect from the phone line    121H
  109. LOGCHR:     DB    'N'-40H ;^N = Send logon            122H
  110. LSTCHR:     DB    'P'-40H ;^P = Toggle printer            123H
  111. UNSAVE:     DB    'R'-40H ;^R = Close input text buffer        124H
  112. TRANCHR:    DB    'T'-40H ;^T = Transmit file to remote        125H
  113. SAVECHR:    DB    'Y'-40H ;^Y = Open input text buffer        126H
  114. EXTCHR:     DB    '^'-40H ;^^ = Send next character        127H
  115. ;
  116. ;
  117.         DS    2        ;                128H
  118. ;
  119. IN$MODCTL1:    IN    MODCTL1 ! RET    ;in modem control port        12AH
  120.         DS    7
  121. OUT$MODDATP:    OUT    MODDATP ! RET    ;out modem data port        134H
  122.         DS    7
  123. IN$MODDATP:    IN    MODDATP ! RET    ;in modem data port        13EH
  124.         DS    7
  125. ;
  126. ANI$MODRCVB:    ANI    MODRCVB ! RET    ;bit to test for receive ready    148H
  127. CPI$MODRCVR:    CPI    MODRCVR ! RET    ;value of rec. bit when ready    14BH
  128. ANI$MODSNDB:    ANI    MODSNDB ! RET    ;bit to test for send ready    14EH    
  129. CPI$MODSNDR:    CPI    MODSNDR ! RET    ;value of send bit when ready    151H
  130.         DS    6        ;                154H
  131. OUT$MODCTL1:    OUT    MODCTL1 ! RET    ;out modem control port #2    15AH
  132. OUT$MODCTL2:    OUT    MODCTL2 ! RET    ;out modem control port #1    15DH
  133. ;
  134. LOGONPTR:    DW    LOGON        ;for user message.        160H
  135.         DS    6
  136. JMP$GOODBYE:    JMP    GOODBYE     ;                168H
  137. JMP$INITMOD:    JMP    INITMOD     ;go to user written routine    16BH
  138.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    16EH
  139.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    171H
  140.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    174H
  141. JMP$SETUPR:    JMP    SETUPR        ;                177H
  142. JMP$SPCLMENU:    JMP    SPCLMENU    ;                17AH
  143. JMP$SYSVER:    JMP    SYSVER        ;                17DH
  144. JMP$BREAK:    JMP    SENDBRK     ;                180H
  145. ;
  146. ;
  147. ; Do not change the following six lines
  148. ;
  149. JMP$ILPRT:    DS    3        ;                183H
  150. JMP$INBUF:    DS    3        ;                186H
  151. JMP$INLNCOMP:    DS    3        ;                189H
  152. JMP$INMODEM:    DS    3        ;                18CH
  153. JMP$NXTSCRN:    DS    3        ;                18FH
  154. JMP$TIMER:    DS    3        ;                192H
  155. ;
  156. ;
  157. ; Clear sequences -- CLREOS is clear to end of screen, CLRSCRN is clear
  158. ; entire screen.  Last entry must be 0.  Any other 0's act as NOP's.
  159. ;
  160. CLREOS:     CALL    JMP$ILPRT    ;                195H
  161.         DB    ESC,79H,0,0,0    ;ESC y - clear to end of screen 198H
  162.         RET            ;                19DH
  163. ;
  164. CLRSCRN:    CALL    JMP$ILPRT    ;                19EH
  165.         DB    ESC,2AH,0,0,0    ;ESC * clear CRT, home cursor    11AH
  166.         RET            ;                1A6H            
  167. ;
  168. ;
  169. SYSVER:     CALL    JMP$ILPRT    ;                1A7H
  170.         DB    'Version for IMS, modem port 2DH'
  171.         DB    CR,LF,0
  172.         RET
  173. ;.....
  174. ;
  175. ;
  176. ;-----------------------------------------------------------------------
  177. ;
  178. ; NOTE:  You can change the SYSVER message to be longer or shorter.  The
  179. ;     end of your last routine should terminate by 0400H (601 bytes
  180. ;     available after start of SYSVER) if using the Hayes Smartmodem
  181. ;     or by address 0C00H (2659 bytes) otherwise.
  182. ;
  183. ;-----------------------------------------------------------------------
  184. ;
  185. ; You can put in a message at this location which can be called up with
  186. ; CTL-O if TRANLOGON has been set YES.    You can put in several lines if
  187. ; desired.  End with a 0.
  188. ;
  189. ;
  190. LOGON:      DB    'Greetings from an IMS user',CR,LF,0
  191. ;
  192. ;=======================================================================
  193. ;
  194. ;
  195. ; This routine allows a 300 ms. break tone to be sent to reset some
  196. ; time-share computers.
  197. ;
  198. SENDBRK:  MVI    A,5
  199.       OUT    MODCTL1
  200.       MVI    A,0F8H        ;SEND A BREAK TONE
  201.       JMP    GOODBYE1
  202. ;.....
  203. ;
  204. ;
  205. ; This routine sends a 300 ms. break tone and sets DTR low for the same
  206. ; length of time to disconnect some modems such as the Bell 212A, etc.    
  207. ;
  208. GOODBYE:  MVI    A,5
  209.       OUT    MODCTL1     ;SEND TO THE STATUS PORT
  210.       MVI    A,068H        ;TURN OFF DTR, SEND BREAK
  211. ;
  212. GOODBYE1: OUT    MODCTL1 
  213.       MVI    B,3        ;WAIT 300 MS.
  214.       CALL    JMP$TIMER
  215.       MVI    A,5
  216.       OUT    MODCTL1
  217.       MVI    A,0E8H        ;RESTORE TO NORMAL, 8 BITS, DTR ON, ETC.
  218.       OUT    MODCTL1
  219.       RET
  220. ;.....
  221. ;
  222. ;
  223. ; IMS baud rate change.  Sets CTC at port 29H for baudrate
  224. ; in/out.
  225. ;
  226. ;
  227. INITMOD:  MVI    A,0        ;SELECT REG.
  228.       OUT    MODCTL1     ;SEND TO THE STATUS PORT
  229.       MVI    A,18H        ;RESET THE Z8SIO CHIP
  230.       OUT    MODCTL1     ;SEND TO THE STATUS PORT
  231.       MVI    A,4        ;SELECT REG.
  232.       OUT    MODCTL1     ;SEND TO THE STATUS PORT
  233.       MVI    A,44H        ;16X, 1-STOP, NO PARITY
  234.       OUT    MODCTL1     ;SEND TO THE STATUS PORT
  235.       MVI    A,3        ;SELECT REG.
  236.       OUT    MODCTL1     ;SEND TO THE STATUS PORT
  237.       MVI    A,0C1H        ;ENABLE RECEIVE SECTION
  238.       OUT    MODCTL1     ;SEND TO THE STATUS PORT
  239.       MVI    A,5        ;SELECT REG.
  240.       OUT    MODCTL1     ;SEND TO THE STATUS PORT
  241.       MVI    A,0EAH        ;DTR, RTS, 8-BITS, ENABLE SEND SECTION
  242.       OUT    MODCTL1     ;SEND TO THE STATUS PORT
  243. ;
  244. INITMOD1: MVI    A,1        ;DEFAULT TRANSFER TIME TO 300 BAUD
  245.       STA    MSPEED
  246. ;
  247. INITMOD2: MVI    A,05H
  248.       OUT    BAUDRP
  249.       MVI    A,34H        ;DEFAULT TO 300 BAUD
  250.       OUT    BAUDRP
  251.       RET
  252. ;.....
  253. ;
  254. ;
  255. SETUPR:   LXI    D,BAUDBUF    ;POINT TO NEW INPUT BUFFER
  256.       CALL    JMP$ILPRT
  257.       DB    'Input Baud Rate (300, 450, 600, 1200, 9600): ',0
  258.       CALL    JMP$INBUF
  259.       LXI    D,BAUDBUF+2
  260.       CALL    JMP$INLNCOMP    ;COMPARE BAUDBUF+2 WITH CHARACTERS BELOW
  261.       DB    '300',0
  262.       JNC    OK300        ;GO IF GOT MATCH
  263.       CALL    JMP$INLNCOMP
  264.       DB    '450',0
  265.       JNC    OK450
  266.       CALL    JMP$INLNCOMP
  267.       DB    '600',0
  268.       JNC    OK600
  269.       CALL    JMP$INLNCOMP
  270.       DB    '1200',0
  271.       JNC    OK1200
  272.       CALL    JMP$INLNCOMP
  273.       DB    '9600',0
  274.       JNC    OK9600
  275.       CALL    JMP$ILPRT    ;ALL MATCHES FAILED, TELL OPERATOR
  276.       DB    '++ Incorrect entry ++',CR,LF,BELL,0
  277.       JMP    SETUPR        ;TRY AGAIN
  278. ;
  279. OK300:      MVI    A,1        ;MSPEED 300 BAUD VALUE
  280.       LHLD    BD300        ;GET 300 BAUD PARAMETERS IN 'HL'
  281.       JMP    LOADBD        ;GO LOAD THEM
  282. ;
  283. OK450:      MVI    A,2
  284.       LHLD    BD450
  285.       JMP    LOADBD
  286. ;
  287. OK600:      MVI    A,3
  288.       LHLD    BD600
  289.       JMP    LOADBD
  290. ;
  291. OK1200:   MVI    A,5
  292.       LHLD    BD1200
  293.       JMP    LOADBD
  294. ;
  295. OK9600:   MVI    A,8
  296.       LHLD    BD9600
  297. ;
  298. LOADBD:   STA    INITMOD1+1    ;CHANGE TIME-TO-SEND TO MATCH BAUDRATE
  299.       MOV    A,H        ;GET DIVISOR CONTROL BYTE
  300.       STA    INITMOD2+1    ;STORE IN INITMOD
  301.       MOV    A,L        ;GET DIVISOR BYTE
  302.       STA    INITMOD2+5    ;STORE INN INITMOD
  303.       JMP    INITMOD1    ;REINITIALIZE TO NEW BAUDRATE, THEN DONE
  304. ;
  305. ;
  306. ; TABLE OF BAUDRATE PARAMETERS
  307. ;
  308. BD300:      DW    0534H        ;15600/300  CONVERTED TO HEX VALUE
  309. BD450:      DW    0522H        ;15600/450  CONVERTED TO HEX VALUE
  310. BD600:      DW    051AH        ;15600/600  CONVERTED TO HEX VALUE
  311. BD1200:   DW    050DH        ;15600/1200 CONVERTED TO HEX VALUE
  312. BD9600:   DW    4508H        ;76800/9600 CONVERTED TO HEX VALUE    
  313. BD19200:  DW    4504H        ;76800/19200
  314. ;
  315. BAUDBUF:  DB    10,0
  316.       DS    10
  317. ;
  318. ;           (END OF INITMOD AND SETUP ROUTINES)
  319. ;-----------------------------------------------------------------------
  320. ;
  321. ; These routines can be used for your equipment, be sure to end with RET
  322. ; If using the Hayes Smartmodem this is unavailable without a special
  323. ; address change.
  324. ;
  325. SPCLMENU: RET
  326. ;
  327. ;-----------------------------------------------------------------------
  328. ;
  329. ; NOTE:  MUST TERMINATE PRIOR TO 0400H (with Smartmodem)
  330. ;                 0C00H (without Smartmodem)    
  331. ;
  332.       END
  333. ;
  334.