home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / simtel / sigm / vols200 / vol217 / m8mpmin.aq6 / M8MPMIN.A86
Text File  |  1986-02-09  |  19KB  |  658 lines

  1. ;M8MPMIN.A86 -- Overlay file for the CompuPro I3/I4 under MPM86 with
  2. ;         MSUP.RSP installed             09/18/84
  3. ;
  4. ; This overlay adapts the MDM8xx program to the CompuPro Interfacer 3 or
  5. ; Interfacer 4 cards using the 2651 USART chip, running under MPM86 with
  6. ; MSUP.RSP installed.
  7. ;
  8. ; You will want to look this file over carefully. There are a number of
  9. ; options that you can use to configure the program to suit your taste.
  10. ; This file places particular emphasis on using an external modem that
  11. ; is connected to a serial port.  This includes acoustic modems as well
  12. ; as "intelligent" modems such as the Hayes Smartmodem, Racal-Vadic, Bell
  13. ; Dataphone 212A, etc.
  14. ;
  15. ; This overlay is capable of setting the baud rate, disconnecting the
  16. ; modem, and sending breaks.
  17. ;
  18. ;
  19. ;
  20. ;=========================================================================
  21. ;            <<< N O T E >>> 
  22. ;
  23. ;    To use MDM8xx with THIS overlay and running under MPM86 or MPM8-16
  24. ;    You MUST have MSUP.RSP installed.
  25. ;
  26. ;    To Install MSUP run your MPM GENSYS program and answer all questions
  27. ;    as in CompuPros MPM8-16 suplementary Manual except for the Number
  28. ;    of system flags which should be set to 51 .
  29. ;
  30. ;==========================================================================
  31. ;
  32. ;
  33. ;
  34. ;
  35. ;    TO USE: First edit this file filling in answers for your own
  36. ;        equipment.  Then assemble with ASM86.CMD or equivalent
  37. ;        assembler.  Then use M8CNFG to overlay the results
  38. ;        of this program to the original MDM8xx.H86 file:
  39. ;
  40. ;        ASM86 M8MPMIN
  41. ;        REN M8OVL.H86=M8MPMIN.H86
  42. ;        M8CNFG
  43. ;        GENCMD MDM 8080 CODE[MFF0]
  44. ;
  45. ;
  46. ; =   =      =   =      =   =      =   =      =   =      =   =      =   =      =   =      =   =
  47. ;
  48. ; 09/18/84 - Original Version            - Alex Soya
  49. ;                          P.O. Box 121
  50. ;                          Melbourne Beach
  51. ;                          Florida 32951
  52. ;
  53. ;
  54. ; =   =      =   =      =   =      =   =      =   =      =   =      =   =      =   =      =   =
  55. ;
  56. BELL    EQU    07H            ;bell
  57. CR    EQU    0DH            ;carriage return
  58. ESC    EQU    1BH            ;escape
  59. LF    EQU    0AH            ;linefeed
  60. ;
  61. YES    EQU    0FFH
  62. NO    EQU    0
  63. ;
  64. ; MPM function Call equates:
  65. ;
  66. F_OPQUE EQU    135    ; Open Que
  67. F_RDQUE EQU    138    ; Conditional Read Que
  68. F_WRQUE EQU    140    ; Write to Que
  69. GETSYS    EQU    154    ; Get SYSDAT address
  70. ;
  71. ;
  72. ; Xios Call Function Numbers
  73. ;
  74. XCONST EQU    0    ; XIOS Console Status check
  75. XCONIN EQU    1    ; XIOS Console Input function
  76. XCONOT EQU    2    ; XIOS Console Output
  77. ;
  78. ;
  79. ;
  80. ; Change the following to match your equipment
  81. ;
  82. ;
  83. ; =   =      =   =      =   =      =   =      =   =      =   =      =   =      =   =      =
  84. ;
  85. BASE    EQU    010H            ;base port of CompuPro I3 or I4 cards
  86. UPORT    EQU    BASE+7            ;user (chip select) port
  87. MDM    EQU    6            ;chip that controls modem port
  88. ;
  89. ;
  90. ;
  91. DPORT    EQU    BASE            ;data port
  92. SPORT    EQU    BASE+1            ;status port
  93. MPORT    EQU    BASE+2            ;mode port
  94. CPORT    EQU    BASE+3            ;control port
  95. ;
  96. TBMT    EQU    01H            ;transmit buffer empty
  97. DAV    EQU    02H            ;data available
  98. ;
  99.     ORG    100H
  100. ;
  101. ; Change the clock speed to suit your system
  102. ;
  103.     RS    3            ;(for  "JMP   START" instruction)
  104. ;
  105. PMMIMODEM    DB    NO        ;yes=PMMI S-100 Modem            103H
  106. SMARTMODEM    DB    YES        ;yes=HAYES Smartmodem, no=non-PMMI    104H
  107. TOUCHPULSE    DB    'T'        ;T=touch, P=pulse (Smartmodem-only)    105H
  108. CLOCK        DB    60        ;clock speed in MHz x10, 25.5 MHz max.    106H
  109.                     ;20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
  110. MSPEED        DB    1        ;0=110 1=300 2=450 3=600 4=710 5=1200    107H
  111.                     ;6=2400 7=4800 8=9600 9=19200 default
  112. BYTDLY        DB    5        ;0=0 delay  1=10ms  5=50 ms - 9=90 ms    108H
  113.                     ;default time to send character in ter-
  114.                     ;minal mode file transfer for slow BBS.
  115. CRDLY        DB    5        ;0=0 delay 1=100 ms 5=500 ms - 9=900 ms 109H
  116.                     ;default time for extra wait after CRLF
  117.                     ;in terminal mode file transfer
  118. NOOFCOL        DB    5        ;number of DIR columns shown        10AH
  119. SETUPTST    DB    YES        ;yes=user-added Setup routine        10BH
  120. SCRNTEST    DB    YES        ;Cursor control routine            10CH
  121. ACKNAK        DB    YES        ;yes=resend a record after any non-ACK    10DH
  122.                     ;no=resend a record after a valid-NAK
  123. BAKUPBYTE    DB    NO        ;yes=change any file same name to .BAK    10EH
  124. CRCDFLT        DB    YES        ;yes=default to CRC checking        10FH
  125. TOGGLECRC    DB    YES        ;yes=allow toggling of CRC to Checksum    110H
  126. CONVBKSP    DB    NO        ;yes=convert backspace to rub        111H
  127. TOGGLEBK    DB    YES        ;yes=allow toggling of bksp to rub    112H
  128. ADDLF        DB    NO        ;no=no LF after CR to send file in    113H
  129.                     ;terminal mode (added by remote echo)
  130. TOGGLELF    DB    YES        ;yes=allow toggling of LF after CR    114H
  131. TRANLOGON    DB    YES        ;yes=allow transmission of logon    115H
  132.                     ;write logon sequence at location LOGON
  133. RESERVED    DB    YES        ;Reserved for Future Expansion        116H
  134. LOCONEXTCHR    DB    NO        ;yes=local command if EXTCHR precedes    117H
  135.                     ;no=external command if EXTCHR precedes
  136. TOGGLELOC    DB    YES        ;yes=allow toggling of LOCONEXTCHR    118H
  137. LSTTST        DB    YES        ;yes=printer available on printer port    119H
  138. XOFFTST        DB    NO        ;yes=checks for XOFF from remote while    11AH
  139.                     ;sending a file in terminal mode
  140. XONWAIT        DB    NO        ;yes=wait for XON after CR while    11BH
  141.                     ;sending a file in terminal mode
  142. TOGXOFF        DB    YES        ;yes=allow toggling of XOFF checking    11CH
  143. IGNORCTL    DB    NO        ;yes=CTL-chars above ^M not displayed    11DH
  144. EXTRA1        DB    0        ;for future expansion            11EH
  145. EXITCHR        DB    'E'-40H        ;^E = Exit to main menu            11FH
  146. BRKCHR        DB    '@'-40H        ;^@ = Send 300 ms. break tone        120H
  147. NOCONNCT    DB    'N'-40H        ;^N = Disconnect from the phone line    121H
  148. LOGCHR        DB    'L'-40H        ;^L = Send logon            122H
  149. LSTCHR        DB    'P'-40H        ;^P = Toggle printer            123H
  150. UNSAVE        DB    'R'-40H        ;^R = Close input text buffer        124H
  151. TRANCHR        DB    'T'-40H        ;^T = Transmit file to remote        125H
  152. SAVECHR        DB    'Y'-40H        ;^Y = Open input text buffer        126H
  153. EXTCHR        DB    '^'-40H        ;^^ = Send next character        127H
  154. ;
  155. ;
  156.     RS    3            ;                128H
  157. ;
  158. IN@MODCTL1:
  159.     RET                ;in modem control port        12BH
  160.     DB    0,0,0,0,0,0,0,0,0    ; spares
  161. ;
  162. OUT@MODDATP:
  163.     JMP    OMDP            ;out modem data port        135H
  164.     DB    0,0,0,0,0,0,0        ; spares
  165. ;
  166. IN@MODDATP:
  167.     JMP    IMDP            ;in modem data port        13FH
  168.     DB    0,0,0,0,0,0,0        ; spares
  169. ;
  170. ANI@MODRCVB:    RET            ;bit to test for receive ready    149H
  171.         RS    2        ; Nothing to do here for MPM
  172. ;
  173. CPI@MODRCVR:    JMP TSTMODRDY        ;value of rcv. bit when ready    14CH
  174. ;
  175. ;
  176. ANI@MODSNDB:    RET            ;bit to test for send ready    14FH
  177.         RS    2        ; Nothing to do here for MPM
  178. ;
  179. CPI@MODSNDR:    XOR AL,AL        ; test for send ready        152H
  180.         RET            ; Always ready for MPM
  181. ;
  182.     RS    6            ;                156H
  183. ;
  184. OUT@MODCTL1:    RET 
  185.     RS    2            ;out modem control port #2    15BH
  186. ;
  187. OUT@MODCTL2:    RET 
  188.     RS    2            ;out modem control port #1    15EH
  189. ;
  190. LOGONPTR DW    (Offset LOGON)        ;for user message.        161H
  191.     RS    6            ;                163H
  192.  
  193. JMP@GOODBYE:JMP GOODBYE            ;                169H
  194. JMP@INITMOD:JMP INITMOD            ;go to user written routine    16CH
  195.     RET    
  196.     NOP    
  197.     NOP                ;(by-passes PMMI routine)    16FH
  198.     RET    
  199.     NOP    
  200.     NOP                ;(by-passes PMMI routine)    172H
  201.     RET    
  202.     NOP    
  203.     NOP                ;(by-passes PMMI routine)    175H
  204. JMP@SETUPR:    JMP  SETUPR        ;                178H
  205. JMP@SPCLMENU:  JMP  SPCLMENU        ;                17BH
  206. JMP@SYSVER:    JMPS SYSVER        ;make sure this is SHORT Jump    17EH
  207. JMP@BREAK:     JMP  SENDBRK        ;                180H
  208.  
  209. ;
  210. ; Do not change the following six lines.
  211. ;
  212. JMP@ILPRT:
  213.         RS    3        ;                183H
  214. JMP@INBUF:
  215.         RS    3        ;                186H
  216. JMP@INLNCOMP:
  217.         RS    3        ;                189H
  218. JMP@INMODEM:
  219.         RS    3        ;                18CH
  220. JMP@NXTSCRN:
  221.         RS    3        ;                18FH
  222. JMP@TIMER:
  223.         RS    3        ;                192H
  224. JMP@CTYPE:
  225.         RS    3        ;                195H
  226. JMP@KEYIN:
  227.         RS    3        ;                198H
  228.  
  229. ;
  230. ;
  231. ; Routine to clear to end of screen.  If using CLREOS and CLRSCRN, set
  232. ; SCRNTEST to YES at 010AH (above).
  233. ;
  234. CLREOS: CALL    JMP@ILPRT        ;                195H
  235.     DB    ESC,'Y',0,0,0        ;                198H
  236.     RET                ;                19DH
  237. ;
  238. CLRSCRN:CALL    JMP@ILPRT        ;                19EH
  239.     DB    ESC,'*',0,0,0        ;                1A1H
  240.     RET                ;                1A6H
  241. ;
  242. SYSVER: CALL    JMP@ILPRT        ;                1A7H
  243.     DB    'Version for CompuPro '
  244.     DB    'Interfacer-3 or 4 under MPM86 with MSUP.RSP'
  245.     DB    CR,LF,0
  246.     RET
  247. ;.....
  248. ;
  249. ;
  250. ;-----------------------------------------------------------------------
  251. ;
  252. ; NOTE:     You can change the SYSVER message to be longer or shorter.  The
  253. ;     end of your last routine should terminate by 0400H (601 bytes
  254. ;     available after start of SYSVER) if using the Hayes Smartmodem
  255. ;     or by address 0C00H (2659 bytes) otherwise.
  256. ;
  257. ;-----------------------------------------------------------------------
  258. ;
  259. ; You can put in a message at this location which can be called up with
  260. ; CTL-L if TRANLOGON has been set TRUE.     You can use several lines if
  261. ; desired.  End with a 0.
  262. ;
  263. LOGON    DB    ' Isnt it nice to run 2 modem programs'
  264.     DB    ' at the same time?',CR,LF,0
  265. ;
  266. ;.....
  267. ;
  268. ;
  269. ;
  270. ;
  271. ;....
  272. ;
  273. ;
  274. ; Add your own routine here to send a byte in AL to Modem Data Port
  275. ;
  276. OMDP:                ; Send a character to the Modem console [MPM]
  277.     PUSH DX            ; savem                [MPM]
  278.     PUSH CX            ;                [MPM]
  279.     PUSH BX            ;                [MPM]
  280.     PUSH DS            ;                [MPM]
  281.     MOV CL,AL        ; Character to CL for XIOS    [MPM]
  282.     MOV DL,COMCHA        ; Console no to DL for XIOS    [MPM]
  283.     MOV AL,XCONOT        ; Send the guy out to modem    [MPM]
  284.     CALLF CS:DWORD PTR XIOS ; via xios call            [MPM]
  285.     POP DS            ;                [MPM]
  286.     POP BX            ;                [MPM]
  287.     POP CX            ; restore regs            [MPM]
  288.     POP DX            ;                [MPM]
  289.     RET            ;                [MPM]
  290.  
  291. ;
  292. ;
  293. ;....
  294. ;
  295. ; Add your own routine here to read Modem Data Port into AL
  296. ;
  297. IMDP:            ; Get a character from Modem Console    [MPM]
  298.     PUSH DX            ; savem                [MPM]
  299.     PUSH CX            ;                [MPM]
  300.     PUSH BX            ;                [MPM]
  301.     PUSH DS            ;                [MPM]
  302.     MOV CL,COMCHA        ; Get character to AL via    [MPM]
  303.     MOV AL,XCONIN        ; XIOS function call CONIN    [MPM]
  304.     CALLF CS:DWORD PTR XIOS ;                [MPM]
  305.     POP DS            ;                [MPM]
  306.     POP BX            ;                [MPM]
  307.     POP CX            ; restore regs            [MPM]
  308.     POP DX            ;                [MPM]
  309.     RET            ;                [MPM]
  310. ;
  311. ;
  312. ;......
  313. ;
  314. ;
  315. TSTMODRDY:        ; see if a char is ready for caller    [MPM]
  316.     PUSH DX            ;                [MPM]
  317.     PUSH CX            ; savem                [MPM]
  318.     PUSH BX            ;                [MPM]
  319.     PUSH DS            ;                [MPM]
  320.     MOV AL,XCONST        ; Check Console Status via XIOS [MPM]
  321.     MOV CL,COMCHA        ; Modem is a CONSOLE        [MPM]
  322.     CALLF CS:DWORD PTR XIOS ;                [MPM]
  323.     CMP AL,0FFH        ;                [MPM]
  324.     JE CONRDY        ; IS CONSOLE READY ?        [MPM]
  325.     MOV AL,0FFH        ; nope...            [MPM]
  326.     JMPS CPIEX        ;    tell caller and exit here    [MPM]
  327. CONRDY: MOV AL,0        ; yeap...            [MPM]
  328. CPIEX:    OR AL,AL        ;    nope so tell caller    [MPM]
  329.     POP DS            ;                [MPM]
  330.     POP BX            ;                [MPM]
  331.     POP CX            ;                [MPM]
  332.     POP DX            ;                [MPM]
  333.     RET            ;                [MPM]
  334. ;.....
  335. ;
  336. ;
  337. ;
  338. ; Add your own routine here to send a break tone to reset some time-
  339. ; share computers, if desired.
  340. ;
  341. SENDBRK:PUSHF            ; disable Interupts
  342.     CLI
  343.     CALL    SELECT            ;select chip
  344.     MOV    AL,2FH            ;send break for 300ms
  345.     JMPS    GOODBYE1
  346. ;.....
  347. ;
  348. ;
  349. ; Add your own routine here to put DTR low and/or send a break tone.
  350. ;
  351. GOODBYE:PUSHF            ; disable Interupts
  352.     CLI
  353.     CALL    SELECT
  354.     XOR    AL,AL            ;turn off DTR
  355. ;
  356. GOODBYE1:
  357.     OUT    CPORT,AL
  358.     MOV    CH,3            ;turn off DTR for 300 ms.
  359.     POPF                ; restore interupts
  360.     CALL    JMP@TIMER
  361.     PUSHF
  362.     CLI                ; disable Interupts again
  363.     CALL    SELECT
  364.     MOV    AL,27H            ;turn DTR back on
  365.     OUT    CPORT,AL
  366.     POPF                ; Interupts ok again
  367.     RET
  368. ;.....
  369. ;
  370. ;
  371. ; You can use this area for any special initialization or setup you may
  372. ; wish to include.  Each must stop with a RET.    You can check the other
  373. ; available overlays for ideas how to write your own routines if that
  374. ; may be of some help.
  375. ;
  376. ;The following is used to initialize the xios and MXqueues for execution
  377. ;of MDM86.
  378. ;
  379. INITMOD:
  380.     MOV CL,GETSYS        ; Find SYSDAT            [MPM]
  381.     INT 224            ; In MPM            [MPM]
  382.     MOV AX,ES:.28H        ; Find XIOS OFFSET        [MPM]
  383.     MOV CS:XIOS,AX        ;                [MPM]
  384.     MOV AX,ES:.28H+2    ; Find XIOS SEGMENT        [MPM]
  385.     MOV CS:XIOS+2,AX    ;                [MPM]
  386.  
  387.     CMP  BYTE PTR COMCHA,0    ; Do we have a COM channel?    [MPM]
  388.     JE  OPQU        ; Yep, Continue Initialization    [MPM]
  389.     JMP CONINT        ;                [MPM]
  390.  
  391. OPQU:    MOV CL,161        ; Attach LIST device        [MPM]
  392.     INT 224            ;                [MPM]
  393.     OR AX,AX        ; did we get it ?        [MPM]
  394.     JE FCOMS        ;   Yes, Proceed with COMS    [MPM]
  395.     CALL JMP@ILPRT        ; No, say so            [MPM]
  396.     DB cr,lf,'+++ Printer Busy, NOT ATTACHED +++',cr,lf,0 ; [MPM]
  397.  
  398. FCOMS:    MOV AL,1        ; Find available COM channels    [MPM]
  399.     XOR BX,BX        ; Start with Com Channel 1    [MPM]
  400. NXTQ:    PUSH AX
  401.     PUSH BX
  402.     ADD AL,30H        ; Make Ascii COMCH        [MPM]
  403.     MOV QPBNAM+7,AL        ;                [MPM]
  404.     MOV CL,F_OPQUE        ; Open the que            [MPM]
  405.     MOV DX, OFFSET MXQPB    ;                [MPM]
  406.     INT 224            ;                [MPM]
  407.  
  408.     MOV CL,F_RDQUE        ; Can we read from the que ?    [MPM]
  409.     MOV DX, OFFSET MXQPB    ; Lets give it a try..        [MPM]
  410.     INT 224            ;                [MPM]
  411.  
  412.     OR  AX,AX        ; Was it a good read ?        [MPM]
  413.     JE  GOTCOM        ; we got a COM channel        [MPM]
  414.     POP BX            ;                [MPM]
  415.     POP AX            ; restore these suckers        [MPM]
  416. COMNEX: INC AL            ; and try next            [MPM]
  417.     CMP AL,6        ; done them all ?        [MPM]
  418.     JGE FNDALL        ;   YEP, All channels found    [MPM]
  419.     JMP NXTQ        ; NOPE, Play it again SAM    [MPM]
  420.  
  421. GOTCOM: POP BX            ;                [MPM]
  422.     POP AX            ;                [MPM]
  423.     MOV COMLST[BX],AL    ; Put Channel in list        [MPM]
  424.     INC BX            ;                [MPM]
  425.     JMPS COMNEX        ; and try one more        [MPM]
  426.  
  427. FNDALL: CMP COMLST,0        ; Ok, lets see what we got    [MPM]
  428.     JE  NOCOMS        ; Nothing, so tell the guy    [MPM]
  429.     CMP COMLST+1,0        ; More than one COM channel ?    [MPM]
  430.     JE SING            ; YEAP, Lets be generous    [MPM]
  431.     JMP COMCHC        ;                [MPM]
  432. SING:    MOV AL,BYTE PTR COMLST    ; NOPE, One is all we need    [MPM]
  433.     MOV BYTE PTR COMCHA,AL    ; Keep it for us        [MPM]
  434.     ADD AL,30H        ; make ASCII Channel number    [MPM]
  435.     MOV TELONE,AL        ; stuff into message        [MPM]
  436.     CALL JMP@ILPRT        ; Tell the guy what the deal is [MPM]
  437.     DB cr,lf,'Only One COM channel available',cr,lf ;    [MPM]
  438.     DB 'Communications Channel '            ;    [MPM]
  439. TELONE    DB '0'            ;                [MPM]
  440.     DB ' connected.',cr,lf,lf,0            ;    [MPM]
  441.     JMP  CONINT        ; Now do rest of initialization [MPM]
  442.  
  443. NOCOMS: CALL JMP@ILPRT        ; Ah well, better luck next time[MPM]
  444.     db cr,lf,'+++ NO COMMUNICATIONS CHANNEL AVAILABLE +++' ;[MPM]
  445.     db cr,lf,0        ;                [MPM]
  446.     MOV CL,0
  447.     INT 224            ; Have a nice one.....        [MPM]
  448. COMCHC: CALL JMP@ILPRT        ; Give him CHOICE of channels    [MPM]
  449.     DB cr,lf,'Available Communication Channels : ',0 ;    [MPM]
  450.     XOR BX,BX        ;                [MPM]
  451. COMDIP: MOV AL,COMLST[BX]    ; Get a Channel #        [MPM]
  452.     CMP AL,0        ; Is there one there ? Phew..    [MPM]
  453.     JE  GETCEL        ; Nope, Get Console selection    [MPM]
  454.     ADD AL,30H        ; Make ASCII            [MPM]
  455.     CALL JMP@CTYPE        ; Send it out            [MPM]
  456.     CMP COMLST+1[BX],0    ; More to do            [MPM]
  457.     JE PNXT            ; YES put in a comma        [MPM]
  458.     MOV AL,','        ;                [MPM]
  459.     CALL JMP@CTYPE        ;                [MPM]
  460.     MOV AL,' '        ;                [MPM]
  461.     CALL JMP@CTYPE        ;                [MPM]
  462. PNXT:    INC BX            ; Next...            [MPM]
  463.     JMPS COMDIP        ;                [MPM]
  464.  
  465. GETCEL: CALL JMP@ILPRT        ;                [MPM]
  466.     DB CR,LF,'Enter Selection :',0     ;            [MPM]
  467.     CALL JMP@KEYIN        ; Get Anser            [MPM]
  468.     PUSH AX            ;                [MPM]
  469.     CALL JMP@CTYPE        ; Echo it            [MPM]
  470.     POP  AX            ;                [MPM]
  471.     SUB AL,30H        ; deASCII            [MPM]
  472.     XOR BX,BX        ; Valid COMM Channel ?        [MPM]
  473. CONFRM: CMP COMLST[BX],0    ; Lets go through what we got    [MPM]
  474.     JE INVLID        ; Ah well he wasnt too clever    [MPM]
  475.     CMP COMLST[BX],AL    ; WELL ?            [MPM]
  476.     JE COMOK        ; YEAP, all is fine        [MPM]
  477.     INC BX            ; and look for another one    [MPM]
  478.     JMPS CONFRM        ;                [MPM]
  479.  
  480. INVLID: CALL JMP@ILPRT        ; Give out            [MPM]
  481.     DB cr,lf,'+++ INVALID SELECTION +++',cr,lf,0    ;    [MPM]
  482.     JMP COMCHC        ; Here we go again ....        [MPM]
  483.  
  484. COMOK:    MOV COMCHA,AL        ; Keep the Channel        [MPM]
  485.     XOR BX,BX        ; Now write back what we dont    [MPM]
  486. WRTMX:    CMP COMLST[BX],0    ; Need.     End of list ?        [MPM]
  487.     JE CONINT        ; YEap..  ah thats nice...    [MPM]
  488.     MOV AL, BYTE PTR COMCHA ;                [MPM]
  489.     CMP COMLST[BX],AL    ;                [MPM]
  490.     JE MYCOM        ; DONT WRITE BACK THE ONE I WANT[MPM]
  491.     MOV CL,F_OPQUE        ;                [MPM]
  492.     MOV DX, OFFSET MXQPB    ;                [MPM]
  493.     MOV AL,COMLST[BX]    ; Make que name            [MPM]
  494.     ADD AL,30H        ; In ASCII please        [MPM]
  495.     MOV QPBNAM+7,AL        ;                [MPM]
  496.     PUSH BX            ;                [MPM]
  497.     INT 224            ;                [MPM]
  498.     MOV CL,F_WRQUE        ;                [MPM]
  499.     MOV DX, OFFSET MXQPB    ;                [MPM]
  500.     INT 224            ;                [MPM]
  501.     POP BX            ;                [MPM]
  502. MYCOM:    INC BX            ; WRITE NEXT ONE        [MPM]
  503.     JMPS WRTMX        ;                [MPM]
  504.  
  505.  
  506.  
  507. CONINT: PUSHF            ; disable Interrupts        [MPM]
  508.     CLI
  509.     CALL    SELECT        ; select chip
  510. ;
  511.     MOV    AL,4EH            ;select 8 data bits, no parity, 1 stop
  512.     OUT    MPORT,AL
  513. ;
  514.     MOV    BL,Byte Ptr MSPEED    ;Get Baud rate
  515.     DEC    BL            ;Adjust for Offset into table
  516.     XOR    BH,BH
  517.     MOV    AL,Byte Ptr BDTBL[BX]
  518.     OUT    MPORT,AL
  519.     MOV    AL,27H            ;turn on DTR etc.
  520.     OUT    CPORT,AL
  521.     POPF                ; restore Interrupts    [MPM]
  522.     RET
  523. ;.....
  524. ;
  525. ;
  526. ; Use the 'SET' command to select a desired baud rate
  527. ;
  528. SETUPR: MOV    DX,(Offset BAUDBUF)    ;point to new input buffer
  529.     CALL    JMP@ILPRT
  530.     DB    'Input Baud Rate (300, 600, 1200, 2400, 4800, 9600, 19200): ',0
  531.     CALL    JMP@INBUF
  532.     MOV    DX,(Offset BAUDBUF)+2
  533.     CALL    JMP@INLNCOMP        ;compare BAUDBUF+2 with characters below
  534.     DB    '300',0
  535.     JNB    OK300            ;go if got match
  536.     CALL    JMP@INLNCOMP
  537.     DB    '600',0
  538.     JNB    OK600
  539.     CALL    JMP@INLNCOMP
  540.     DB    '1200',0
  541.     JNB    OK1200
  542.     CALL    JMP@INLNCOMP
  543.     DB    '4800',0
  544.     JNB    OK4800
  545.     CALL    JMP@INLNCOMP
  546.     DB    '2400',0
  547.     JNB    OK2400
  548.     CALL    JMP@INLNCOMP
  549.     DB    '9600',0
  550.     JNB    OK9600
  551.     CALL    JMP@INLNCOMP
  552.     DB    '19200',0
  553.     JNB    OK19200
  554.     CALL    JMP@ILPRT        ;all matches failed, tell operator
  555.     DB    '++ Incorrect entry ++',CR,LF,BELL,0
  556.     JMP    SETUPR            ;try again
  557. ;
  558. OK300:    MOV    AL,1            ;MSPEED 300 baud value
  559.     JMPS    LOADBD            ;go load everything
  560. ;
  561. OK600:    MOV    AL,3
  562.     JMPS    LOADBD
  563. ;
  564. OK1200: MOV    AL,5
  565.     JMPS    LOADBD
  566. ;
  567. OK2400: MOV    AL,6
  568.     JMPS    LOADBD
  569. ;
  570. OK4800: MOV    AL,7
  571.     JMPS    LOADBD
  572. ;
  573. OK9600: MOV    AL,8
  574.     JMPS    LOADBD
  575. ;
  576. OK19200:MOV    AL,9
  577. ;
  578. LOADBD: MOV    Byte Ptr MSPEED,AL    ;change time-to-send to match baudrate
  579.     JMP    CONINT            ;reinitialize to new baudrate, then done
  580. ;...
  581. ;
  582.  
  583.  
  584. ;
  585. SELECT:
  586.     PUSH    AX
  587.     PUSH    BX
  588.     MOV    BL,COMCHA    ; Translate Comm. Channel    [MPM]
  589.     MOV    BH,0        ; make 16 bit            [MPM]
  590.     MOV    AL,CTRTBL[BX]    ; Get corresponding port    [MPM]
  591.     OUT    UPORT,AL    ; Select USART
  592.     POP    BX
  593.     POP    AX
  594.     RET
  595. ;
  596. ;
  597. CTRTBL    DB    -1        ; COMCHANNEL 0 DOES NOT EXIST    [MPM]
  598.     DB    7
  599.     DB    6
  600.     DB    3
  601.     DB    2
  602.     DB    1
  603.     DB    0
  604.     DB    4
  605.     DB    5
  606. ;....
  607. ;
  608. ;
  609. ; TABLE OF BAUDRATE PARAMETERS
  610. ;
  611. BD300    EQU    35H            ;300  baud
  612. BD450    EQU    0            ;450  baud NOT SUPPORTED
  613. BD600    EQU    36H            ;600  baud
  614. BD710    EQU    0            ;710  baud NOT SUPPORTED
  615. BD1200    EQU    37H            ;1200 baud
  616. BD2400    EQU    3AH            ;2400 baud
  617. BD4800    EQU    3CH            ;4800 baud
  618. BD9600    EQU    3EH            ;9600 baud
  619. BD19200 EQU    3FH            ;19200 baud
  620. ;
  621. BAUDBUF DB    10,0
  622.     RS    10
  623.  
  624. BDTBL    DB    BD300,BD450,BD600,BD710,BD1200,BD2400,BD4800,BD9600,BD19200
  625. ;
  626. XIOS    DW 0        ; keep XIOS offset here        [MPM]
  627.     DW 0        ; keep XIOS segment here    [MPM]
  628.  
  629. ;
  630. ;
  631. COMCHA    DB 0                ; COMCHANNEL USED HERE        [MPM]
  632. COMLST    DB 0,0,0,0,0,0,0,0,0        ; MAX 8 CHANNELS + END MAKER    [MPM]
  633.  
  634. MXQPB    DW    0    ;MXmodemN Que Parameter Block            [MPM]
  635.     DW    0    ;                        [MPM]
  636.     DW    1    ;                        [MPM]
  637.     DW    OFFSET QUEBUF                ;        [MPM]
  638. qpbnam    DB    'MXmodem '
  639.  
  640. quebuf    dw    0
  641.  
  642. ;
  643. ;           (END OF INITMOD AND SETUP ROUTINES)
  644. ;=======================================================================
  645. ;
  646. ;
  647. ; If using the Hayes Smartmodem this is unavailable without a special
  648. ; change.
  649. ;
  650. SPCLMENU:RET
  651. ;
  652. ;
  653. ; NOTE:     MUST TERMINATE PRIOR TO 0400H (with Smartmodem)
  654. ;                 0C00H (without Smartmodem)
  655. ;.....
  656. ;
  657.     END
  658.