home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / simtel / sigm / vols200 / vol220 / mxo-xr10.asm < prev    next >
Encoding:
Assembly Source File  |  1994-07-13  |  11.4 KB  |  404 lines

  1.  
  2. ; MXO-XR10.ASM -- XOR S-100-4 (Rev B CPU) overlay file for MEX112  10/21/84
  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. ;
  7. ; Edit this file for your preferences then follow the "TO USE:" example
  8. ; shown below.
  9. ;
  10. ; Use the "SET" command to change the baudrate when desired.  It starts
  11. ; out at 300 baud when the program is first called up.
  12. ;
  13. ;    TO USE: First edit this file filling in answers for your own
  14. ;        equipment.  Then assemble with ASM.COM or equivalent
  15. ;        assembler.  Then use MLOAD to overlay the the results
  16. ;        of this program to the original .COM file.
  17. ;
  18. ;        critical customizations:
  19. ;            PORT        - Modem status port for your system
  20. ;            INITMOD1:    - optional patch for Modem-7 term-mode
  21. ;                      command compatability - MEX112 depend
  22. ;            INITMOD2:    - modem port initialization
  23. ;            NEWBAUD:    - reads MSPEED: & inits baudrate
  24. ;            SETUPR:        - custom SET command to change baud 
  25. ;                      rate as well as start, stop & data
  26. ;                      bit transmission parameters
  27. ;            CLREOS: &
  28. ;            CLRSCR:        - terminal command for clearing screen
  29. ;
  30. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  31. ; 10/21/84 - XOR S-100-4 (rev.B CPU) customized    - Howard Vigorita
  32. ; 05/24/84 - MEXified overlay            - Biff Bueffel
  33. ; 11/11/83 - Renamed to M7XE-1.ASM, no changes    - Irv Hoff
  34. ; 07/27/83 - Renamed to work with MDM712    - Irv Hoff
  35. ; 07/01/83 - Revised to work with MDM711    - Irv Hoff
  36. ; 06/22/83 - Revised to work with MDM710    - Irv Hoff
  37. ; 05/27/83 - Updated to work with MDM709    - Irv Hoff
  38. ; 05/15/83 - Revised to work with MDM708    - Irv Hoff
  39. ; 04/11/83 - Updated to work with MDM707    - Irv Hoff
  40. ; 04/04/83 - Updated to work with MDM706    - Irv Hoff
  41. ;
  42. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  43. ;
  44. BELL:        EQU    07H        ;bell
  45. CR:        EQU    0DH        ;carriage return
  46. ESC:        EQU    1BH        ;escape
  47. LF:        EQU    0AH        ;linefeed
  48. ;
  49. YES:        EQU    0FFH
  50. NO:        EQU    0
  51. ;
  52. ; MEX service processor stuff
  53. ;
  54. MEX    EQU    0D00H        ;address of the service processor
  55. INMDM    EQU    255        ;get char from port to A, CY=no more in 100 ms
  56. TIMER    EQU    254        ;delay 100ms * reg B
  57. TMDINP    EQU    253        ;B=# secs to wait for char, cy=no char
  58. CHEKCC    EQU    252        ;check for ^C from KBD, Z=present
  59. SNDRDY    EQU    251        ;test for modem-send ready
  60. RCVRDY    EQU    250        ;test for modem-receive ready
  61. SNDCHR    EQU    249        ;send a character to the modem (after sndrdy)
  62. RCVCHR    EQU    248        ;recv a char from modem (after rcvrdy)
  63. LOOKUP    EQU    247        ;table search: see CMDTBL comments for info
  64. PARSFN    EQU    246        ;parse filename from input stream
  65. BDPARS    EQU    245        ;parse baud-rate from input stream
  66. SBLANK    EQU    244        ;scan input stream to next non-blank
  67. EVALA    EQU    243        ;evaluate numeric from input stream
  68. LKAHED    EQU    242        ;get nxt char w/o removing from input
  69. GNC    EQU    241        ;get char from input, cy=1 if none
  70. ILP    EQU    240        ;inline print
  71. DECOUT    EQU    239        ;decimal output
  72. PRBAUD    EQU    238        ;print baud rate
  73. ;
  74. PRINT    EQU    9        ;MEX/BDOS print-string function call
  75.  
  76. ;
  77. ;
  78. ;    XOR S-100-4 via serial (printer) port
  79. ;        note that on the port's "A" paddle card you must:
  80. ;            1) replace two pull-up resistors w/jumpers
  81. ;            2) connect RTS & CTS w/jumpers
  82. ;
  83. PORT        EQU    01h
  84. MODDATP        EQU    PORT-1        ;data port for XOR
  85. MODCTL1        EQU    PORT        ;modem status port for XOR
  86. MODCTL2        EQU    PORT        ;modem status port for XOR
  87. MODSNDB        EQU    01h        ;bit to test for ready to send
  88. MODSNDR        EQU    MODSNDB        ;change to 0 if bit is 0 when
  89.                     ;ready to send
  90. MODRCVB        EQU    2        ;bit to test for received data
  91. MODRCVR        EQU    MODRCVB        ;change to 0 if bit is 0 when
  92.                     ;data received
  93. ;
  94.         ORG    100H
  95. ;
  96. ;
  97. ; Change the clock speed to suit your system
  98. ;
  99.         DS    3    ;(for  "JMP   START" instruction)
  100. ;
  101. PMMIMODEM:    DB    NO    ;yes=PMMI S-100 Modem            103H
  102. SMARTMODEM:    DB    YES    ;yes=HAYES Smartmodem, no=non-PMMI    104H
  103. TOUCHPULSE:    DB    'T'    ;T=touch, P=pulse (Smartmodem-only)    105H
  104. CLOCK:        DB    40    ;clock speed in MHz x10, 25.5 MHz max.    106H
  105.                 ;20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
  106. MSPEED:        DB    5    ;0=110 1=300 2=450 3=600 4=710 5=1200    107H
  107.                 ;6=2400 7=4800 8=9600 9=19200 default
  108. BYTDLY:        DB    5    ;0=0 delay  1=10ms  5=50 ms - 9=90 ms    108H
  109.                 ;default time to send character in ter-
  110.                 ;minal mode file transfer for slow BBS.
  111. CRDLY:        DB    5    ;0=0 delay 1=100 ms 5=500 ms - 9=900 ms 109H
  112.                 ;default time for extra wait after CRLF
  113.                 ;in terminal mode file transfer
  114. NOOFCOL:    DB    5    ;number of DIR columns shown        10AH
  115. SETUPTST:    DB    YES    ;yes=user-added Setup routine        10BH
  116. SCRNTEST:    DB    YES    ;Cursor control routine         10CH
  117. ACKNAK:        DB    YES    ;yes=resend a record after any non-ACK    10DH
  118.                 ;no=resend a record after a valid NAK
  119. BAKUPBYTE:    DB    NO    ;yes=change any file same name to .BAK    10EH
  120. CRCDFLT:    DB    NO    ;yes=default to CRC checking        10FH
  121. TOGGLECRC:    DB    YES    ;yes=allow toggling of CRC to Checksum    110H
  122. CONVBKSP:    DB    NO    ;yes=convert backspace to rub        111H
  123. TOGGLEBK:    DB    YES    ;yes=allow toggling of bksp to rub    112H
  124. ADDLF:        DB    YES    ;no=no LF after CR to send file in    113H
  125.                 ;terminal mode (added by remote echo)
  126. TOGGLELF:    DB    YES    ;yes=allow toggling of LF after CR    114H
  127. TRANLOGON:    DB    NO    ;yes=allow transmission of logon    115H
  128.                 ;write logon sequence at location LOGON
  129. SAVCCP:        DB    YES    ;yes=do not overwrite CCP        116H
  130. LOCONEXTCHR:    DB    NO    ;yes=local command if EXTCHR precedes    117H
  131.                 ;no=external command if EXTCHR precedes
  132. TOGGLELOC:    DB    YES    ;yes=allow toggling of LOCONEXTCHR    118H
  133. LSTTST:        DB    YES    ;yes=printer available on printer port    119H
  134. XOFFTST:    DB    NO    ;yes=check for XOFF from remote    while    11AH
  135.                 ;sending a file in terminal mode
  136. XONWAIT:    DB    NO    ;yes=wait for XON after CR while    11BH
  137.                 ;sending a file in terminal mode
  138. TOGXOFF:    DB    YES    ;yes=allow toggling of XOFF checking    11CH
  139. IGNORCTL:    DB    YES    ;yes=CTL-chars above ^M not displayed    11DH
  140. EXTRA1:        DB    0    ;for future expansion            11EH
  141. EXTRA2:        DB    0    ;for future expansion            11FH
  142. BRKCHR:        DB    '@'    ; @ = Send a 300 ms. break tone        120H
  143. NOCONNCT:    DB    'D'    ; D = Disconnect from the phone line    121H
  144. LOGCHR:        DB    'L'    ; L = Send logon            122H
  145. LSTCHR:        DB    'P'    ; P = Toggle printer            123H
  146. UNSAVE:        DB    'R'    ; R = Close input text buffer        124H
  147. TRANCHR:    DB    'T'    ; T = Transmit file to remote        125H
  148. SAVECHR:    DB    'Y'    ; Y = Open input text buffer        126H
  149. EXTCHR:        DB    '^'    ; ^ = Send next character        127H
  150. ;
  151. ;
  152.         DS    2        ;                128H
  153. IN$MODCTL1:    IN    MODCTL1 ! RET    ;                12AH
  154.         DS    7
  155. ;
  156. OUT$MODDATP:    OUT    MODDATP ! RET    ;out modem data port        134H
  157.         DS    7
  158. IN$MODDATP:    IN    MODDATP ! RET    ;in modem data port        13EH
  159.         DS    7
  160. ANI$MODRCVB:    ANI    MODRCVB    ! RET    ;bit to test for receive ready    148H
  161. CPI$MODRCVR:    CPI    MODRCVR ! RET    ;value of receive bit when rdy    14BH
  162. ANI$MODSNDB:    ANI    MODSNDB    ! RET    ;bit to test for send ready    14EH
  163. CPI$MODSNDR:    CPI    MODSNDR    ! RET    ;value of send bit when ready    151H
  164.         DS    6        ;                154H
  165. OUT$MODCTL1:    OUT    MODCTL1    ! RET    ;out modem control port     15AH
  166. OUT$MODCTL2:    OUT    MODCTL2    ! RET    ;out modem status port        15DH
  167. ;
  168. ;
  169.         DS    2        ;Not used by MEX        160H
  170.         DS    6        ;                162H
  171. JMP$GOODBYE:    JMP    GOODBYE        ;                168H
  172. JMP$INITMOD:    JMP    INITMOD        ;go to user written routine    16BH
  173. JMP$NEWBAUD:    JMP    NEWBAUD        ;Change baudrate        16EH
  174.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    171H
  175.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    174H
  176. JMP$SETUPR:    JMP    SETUPR        ;                177H
  177.         DS    3        ;                17AH
  178. JMP$SYSVER:    JMP    SYSVER        ;                17DH
  179. JMP$BREAK:    JMP    SENDBRK        ;                180H
  180. ;
  181. ;
  182. ; Do not change the following six lines.
  183. ;
  184. JMP$ILPRT:    DS    3        ;                183H
  185. JMP$INBUF:    DS    3        ;                186H
  186. JMP$INLNCOMP:    DS    3        ;                189H
  187. JMP$INMODEM:    DS    3        ;                18CH
  188. JMP$NXTSCRN:    DS    3        ;                18FH
  189. JMP$TIMER:    DS    3        ;                192H
  190. ;
  191. ;
  192. ; Clear sequences -- CLREOS is clear to end of screen, CLRSCRN is clear
  193. ; entire screen.  
  194. ;
  195. CLREOS:
  196.         LXI    D,EOSMSG
  197.         MVI    C,PRINT
  198.         CALL    MEX
  199.         RET            
  200. ;
  201. CLRSCRN:
  202.         LXI    D,CLSMSG
  203.         MVI    C,PRINT
  204.         CALL    MEX
  205.         RET            
  206. ;
  207. ;
  208. SYSVER:        MVI    C,ILP        ;                1A7H
  209.         CALL    MEX
  210.         DB    'for XOR via serial printer port & Hazeltine w/esc'
  211.         DB    CR,LF,0
  212.         RET
  213. ;
  214. ;
  215. ; This routine allows a 300 ms. break tone to be sent to reset some
  216. ; time-shar computers.
  217. ;
  218. SENDBRK:
  219.       RET
  220. ;.....
  221. ;
  222. ;
  223. ; This routine sends a 300 ms. break tone and sets DTR low for the same
  224. ; length of time to disconnect some modems such as the Bell 212A, etc.    
  225. ;
  226. GOODBYE:
  227. GOODBYE1:
  228.       RET
  229. ;.....
  230. ;
  231. ;    
  232. INITMOD:
  233. INITMOD1: 
  234. ;    patch to change term-mode commands for modem7 compatability:
  235.  
  236. TermTable:    EQU    40B8h        ; address of Mex112 term-mode command
  237.                     ; table. To use with a different Mex
  238.                     ; version hunt down the location of the
  239.                     ; command table that looks like this:
  240.                     ; "+E?@N.PSTU"
  241.     LDA    NOCONNCT
  242.     STA    TermTable+4    ; disconnect
  243.  
  244.     LDA    SAVECHR
  245.     STA    TermTable+7    ; open text buffer
  246.  
  247.     LDA    UNSAVE
  248.     STA    TermTable+9    ; close text buffer
  249. INITMOD2: 
  250. ; XOR S-100-4 (REV-B) initialization -- resets 8251 to 1200 baud
  251. ;
  252.     PUSH    H
  253.     PUSH    B
  254.     JMP    OK1200
  255. ;
  256. ;.....
  257. ;
  258. ;
  259. ; Setup routine to allow changing modem speed with the SET command.
  260. ;
  261. ;
  262. SETUPR:
  263.     PUSH    H
  264.     PUSH    B
  265. ParmL:    LXI    D,ParmBUF    ;point to input buffer for InLnComp
  266.     CALL    JMP$ILPRT
  267.     DB    'Input CR for no change, or',CR,LF
  268.     DB    '       1 for 1 stop bit,  8 data bits, no parity,   or ',CR,LF
  269.     DB    '       2 for 1 stop bit,  7 data bits, even parity, or ',CR,LF
  270.     DB    '       3 for 2 stop bits, 8 data bits, no parity,   or ',CR,LF
  271.     DB    '       4 for 2 stop bits, 7 data bits, even parity, or ',0
  272.     CALL    JMP$INBUF
  273.     LXI    D,ParmBUF+2
  274.     CALL    JMP$INLNCOMP    ;compare BAUDBUF+2 with characters below
  275.     DB    CR,0
  276.     JNC    BaudL        ;go to baudrate if got match
  277.     CALL    JMP$InLnComp
  278.     DB    '1',0
  279.     JNC    OKParm1
  280.     CALL    JMP$InLnComp
  281.     DB    '2',0
  282.     JNC    OKParm2
  283.     CALL    JMP$InLnComp
  284.     DB    '3',0
  285.     JNC    OKParm3
  286.     CALL    JMP$InLnComp
  287.     DB    '4',0
  288.     JNC    OKParm4
  289.     CALL    JMP$ILPRT    ;all matches failed - tell operator
  290.     DB    '++ Incorrect entry ++',CR,LF,0
  291.     JMP    ParmL        ;try again
  292. ;
  293. OKParm1:    LXI    h,Parm1
  294.         JMP    LoadParm
  295. ;
  296. OKParm2:    LXI    h,Parm2
  297.         JMP    LoadParm
  298.  
  299. ;
  300. OKParm3:    LXI    h,Parm3
  301.         JMP    LoadParm
  302.  
  303. ;
  304. OKParm4:    LXI    h,Parm4
  305.         JMP    LoadParm
  306.  
  307. LoadParm:    MOV    b,m
  308.         INX    h
  309.         MOV    c,m
  310.         INX    h
  311.         DCR    b
  312.         INR    b
  313.         JZ    BaudL
  314.         DB    0EDh,0B3h    ;OUTIR
  315.         JMP    LoadParm
  316.  
  317. Parm1:    DB    4,Port,0AAh,40h,0100$1110b,0011$0111b,0    ;1S, 8D, NP
  318. Parm2:    DB    4,Port,0AAh,40h,0111$1010b,0011$0111b,0 ;1S, 7D, EP
  319. Parm3:    DB    4,Port,0AAh,40h,1100$1110b,0011$0111b,0 ;2S, 8D, NP
  320. Parm4:    DB    4,Port,0AAh,40h,1111$1010b,0011$0111b,0 ;2S, 7D, EP
  321. ParmBuf:
  322.     DB    10,0
  323.     DS    10
  324.  
  325.  
  326. BaudL:    LXI    D,BAUDBUF    ;point to input buffer for InLnComp
  327.     CALL    JMP$ILPRT
  328.     DB    'Input Baud Rate (CR=nc, 300,  600, 1200, 9600): ',0
  329.     CALL    JMP$INBUF
  330.     LXI    D,BAUDBUF+2
  331.     CALL    JMP$INLNCOMP    ;compare BAUDBUF+2 with characters below
  332.     DB    '300',0
  333.     JNC    OK300        ;go if got match
  334.     CALL    JMP$InLnComp
  335.     DB    '1200',0
  336.     JNC    OK1200
  337.     CALL    JMP$InLnComp
  338.     DB    '9600',0
  339.     JNC    OK9600
  340.     CALL    JMP$InLnComp
  341.     DB    '600',0
  342.     JNC    OK600
  343.     CALL    JMP$InLnComp
  344.     DB    CR,0
  345.     JNC    NoChg
  346.  
  347. NoneOK:    CALL    JMP$ILPRT    ;all matches failed - tell operator
  348.     DB    '++ Incorrect entry ++',CR,LF,0
  349.     JMP    BaudL        ;try again
  350. ;
  351. OK600:    MVI    A,3
  352.     MVI    b,06h
  353.     JMP    LOADBD
  354. ;
  355. OK9600:    MVI    A,8
  356.     MVI    b,0Eh
  357.     JMP    LOADBD
  358. ;
  359.  
  360. OK1200:    MVI    A,5
  361.     MVI    b,07h
  362.     JMP    LOADBD
  363. ;
  364.  
  365. OK300:    MVI    A,1        ;MSPEED 300 baud value
  366.     MVI    b,05h
  367. ;
  368.  
  369. LOADBD:    STA    MSPEED
  370.     IN    0Ah
  371.     IN    0Bh        ;read baud switches
  372.     ANI    1111$0000b    ;force low nibble off
  373.     MOV    c,a
  374.     MOV    a,b
  375.     ORA    c        ;mask c onto upper nibble
  376.     OUT    0Bh        ;write the baud rate
  377.  
  378. NoChg:    POP    B
  379.     POP    H
  380.     RET
  381. ;
  382. NEWBAUD:
  383.     PUSH    H
  384.     PUSH    B
  385.     CPI    1
  386.     JZ    OK300
  387.     CPI    5
  388.     JZ    OK1200
  389.     JMP    NoChg
  390. ;
  391. BAUDBUF:
  392.     DB    10,0
  393.     DS    10
  394. ;
  395. ;
  396. EOSMSG:
  397.       DB    1Bh,17h,0,0,'$'              
  398. CLSMSG:
  399.       DB    1Bh,12h,1Bh,17h,'$'
  400. ;
  401. ; NOTE:  MUST TERMINATE PRIOR TO 0B00H (with Smartmodem)
  402. ;                 0D00H (without Smartmodem)
  403.       END
  404.