home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / cpm / mex / mxo-sv10.asm < prev    next >
Encoding:
Assembly Source File  |  1994-07-13  |  11.1 KB  |  379 lines

  1. ; MXO-SV10.ASM -- SERVO-8 overlay file for MEX10.  13 July 1985
  2. ;
  3. ; You will want to look this file over carefully. There are a number of
  4. ; options that you can use to configure the program to suit your taste.
  5. ; This file adapts the Servo-8 computer to MEX.
  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. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  19. ; 07/13/85 - Corrected bug in modem initialization
  20. ;            routine, which set incorrect data bits
  21. ;            and parity.                        - Paul Leighly
  22. ; 07/12/85 - Converted to Servo-8, and
  23. ;            added additional baud rates        - Joe Griffith
  24. ; 05/24/84 - MEXified overlay            - Biff Bueffel
  25. ; 11/11/83 - Renamed to M7XE-1.ASM, no changes    - Irv Hoff
  26. ; 07/27/83 - Renamed to work with MDM712    - Irv Hoff
  27. ; 07/01/83 - Revised to work with MDM711    - Irv Hoff
  28. ; 06/22/83 - Revised to work with MDM710    - Irv Hoff
  29. ; 05/27/83 - Updated to work with MDM709    - Irv Hoff
  30. ; 05/15/83 - Revised to work with MDM708    - Irv Hoff
  31. ; 04/11/83 - Updated to work with MDM707    - Irv Hoff
  32. ; 04/04/83 - Updated to work with MDM706    - Irv Hoff
  33. ; 03/03/83 - Modified MDM705KP for XEROX
  34. ;         820-II computers with external
  35. ;         modems                - David Wurz    
  36. ;
  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. ; MEX service processor stuff
  48. ;
  49. MEX    EQU    0D00H        ;address of the service processor
  50. INMDM    EQU    255        ;get char from port to A, CY=no more in 100 ms
  51. TIMER    EQU    254        ;delay 100ms * reg B
  52. TMDINP    EQU    253        ;B=# secs to wait for char, cy=no char
  53. CHEKCC    EQU    252        ;check for ^C from KBD, Z=present
  54. SNDRDY    EQU    251        ;test for modem-send ready
  55. RCVRDY    EQU    250        ;test for modem-receive ready
  56. SNDCHR    EQU    249        ;send a character to the modem (after sndrdy)
  57. RCVCHR    EQU    248        ;recv a char from modem (after rcvrdy)
  58. LOOKUP    EQU    247        ;table search: see CMDTBL comments for info
  59. PARSFN    EQU    246        ;parse filename from input stream
  60. BDPARS    EQU    245        ;parse baud-rate from input stream
  61. SBLANK    EQU    244        ;scan input stream to next non-blank
  62. EVALA    EQU    243        ;evaluate numeric from input stream
  63. LKAHED    EQU    242        ;get nxt char w/o removing from input
  64. GNC    EQU    241        ;get char from input, cy=1 if none
  65. ILP    EQU    240        ;inline print
  66. DECOUT    EQU    239        ;decimal output
  67. PRBAUD    EQU    238        ;print baud rate
  68. ;
  69. PRINT    EQU    9        ;MEX/BDOS print-string function call
  70.  
  71. ;
  72. PORT:        EQU    06H        ;Servo-8 DART Data port B
  73. MODCTL1:    EQU    PORT+1        ;Modem control port
  74. MODDATP:    EQU    PORT        ;Modem data port
  75. MODCTL2:    EQU    PORT+1        ;Modem status port
  76. MODRCVB:    EQU    01H        ;Your bit to test for receive
  77. MODRCVR:    EQU    01H        ;Your value when receive ready
  78. MODSNDB:    EQU    04H        ;Your bit to test for send
  79. MODSNDR:    EQU    04H        ;Your value when send ready
  80. CTC1:        EQU    09H        ;Servo-8 CTC Channel 1 
  81. ;
  82.         ORG    100H
  83. ;
  84. ;
  85. ; Change the clock speed to suit your system
  86. ;
  87.         DS    3    ;(for  "JMP   START" instruction)
  88. ;
  89. PMMIMODEM:    DB    NO    ;yes=PMMI S-100 Modem            103H
  90. SMARTMODEM:    DB    YES    ;yes=HAYES Smartmodem, no=non-PMMI    104H
  91. TOUCHPULSE:    DB    'T'    ;T=touch, P=pulse (Smartmodem-only)    105H
  92. CLOCK:        DB    60    ;clock speed in MHz x10, 25.5 MHz max.    106H
  93.                 ;20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
  94. MSPEED:        DB    1    ;0=110 1=300 2=450 3=600 4=710 5=1200    107H
  95.                 ;6=2400 7=4800 8=9600 9=19200 default
  96. BYTDLY:        DB    5    ;0=0 delay  1=10ms  5=50 ms - 9=90 ms    108H
  97.                 ;default time to send character in ter-
  98.                 ;minal mode file transfer for slow BBS.
  99. CRDLY:        DB    5    ;0=0 delay 1=100 ms 5=500 ms - 9=900 ms 109H
  100.                 ;default time for extra wait after CRLF
  101.                 ;in terminal mode file transfer
  102. NOOFCOL:    DB    5    ;number of DIR columns shown        10AH
  103. SETUPTST:    DB    YES    ;yes=user-added Setup routine        10BH
  104. SCRNTEST:    DB    NO    ;Cursor control routine         10CH
  105. ACKNAK:        DB    YES    ;yes=resend a record after any non-ACK    10DH
  106.                 ;no=resend a record after a valid NAK
  107. BAKUPBYTE:    DB    NO    ;yes=change any file same name to .BAK    10EH
  108. CRCDFLT:    DB    YES    ;yes=default to CRC checking        10FH
  109. TOGGLECRC:    DB    YES    ;yes=allow toggling of CRC to Checksum    110H
  110. CONVBKSP:    DB    NO    ;yes=convert backspace to rub        111H
  111. TOGGLEBK:    DB    YES    ;yes=allow toggling of bksp to rub    112H
  112. ADDLF:        DB    NO    ;no=no LF after CR to send file in    113H
  113.                 ;terminal mode (added by remote echo)
  114. TOGGLELF:    DB    YES    ;yes=allow toggling of LF after CR    114H
  115. TRANLOGON:    DB    NO    ;yes=allow transmission of logon    115H
  116.                 ;write logon sequence at location LOGON
  117. SAVCCP:        DB    YES    ;yes=do not overwrite CCP        116H
  118. LOCONEXTCHR:    DB    NO    ;yes=local command if EXTCHR precedes    117H
  119.                 ;no=external command if EXTCHR precedes
  120. TOGGLELOC:    DB    YES    ;yes=allow toggling of LOCONEXTCHR    118H
  121. LSTTST:        DB    YES    ;yes=printer available on printer port    119H
  122. XOFFTST:    DB    NO    ;yes=check for XOFF from remote    while    11AH
  123.                 ;sending a file in terminal mode
  124. XONWAIT:    DB    NO    ;yes=wait for XON after CR while    11BH
  125.                 ;sending a file in terminal mode
  126. TOGXOFF:    DB    YES    ;yes=allow toggling of XOFF checking    11CH
  127. IGNORCTL:    DB    YES    ;yes=CTL-chars above ^M not displayed    11DH
  128. EXTRA1:        DB    0    ;for future expansion            11EH
  129. EXTRA2:        DB    0    ;for future expansion            11FH
  130. BRKCHR:        DB    '@'-40H    ;^@ = Send a 300 ms. break tone        120H
  131. 20H
  132. NOCONNCT:    DB    'N'-40H    ;^N = Disconnect from the phone line    121H
  133. LOGCHR:        DB    'L'-40H    ;^L = Send logon            122H
  134. LSTCHR:        DB    'P'-40H    ;^P = Toggle printer            123H
  135. UNSAVE:        DB    'R'-40H    ;^R = Close input text buffer        124H
  136. TRANCHR:    DB    'T'-40H ;^T = Transmit file to remote        125H
  137. SAVECHR:    DB    'Y'-40H    ;^Y = Open input text buffer        126H
  138. EXTCHR:        DB    '^'-40H    ;^^ = Send next character        127H
  139. ;
  140. ;
  141.         DS    2        ;                128H
  142. IN$MODCTL1:    MVI    A,10H        ;channel 0, reset interrupts    12AH
  143.         OUT    MODCTL1
  144.         IN    MODCTL1        ;get the status bits
  145.         RET
  146.         DS    3
  147. ;
  148. OUT$MODDATP:    OUT    MODDATP ! RET    ;out modem data port        134H
  149.         DS    7
  150. IN$MODDATP:    IN    MODDATP ! RET    ;in modem data port        13EH
  151.         DS    7
  152. ANI$MODRCVB:    ANI    MODRCVB    ! RET    ;bit to test for receive ready    148H
  153. CPI$MODRCVR:    CPI    MODRCVR ! RET    ;value of receive bit when rdy    14BH
  154. ANI$MODSNDB:    ANI    MODSNDB    ! RET    ;bit to test for send ready    14EH
  155. CPI$MODSNDR:    CPI    MODSNDR    ! RET    ;value of send bit when ready    151H
  156.         DS    6        ;                154H
  157. OUT$MODCTL1:    OUT    MODCTL1    ! RET    ;out modem control port     15AH
  158. OUT$MODCTL2:    OUT    MODCTL2    ! RET    ;out modem status port        15DH
  159. ;
  160. ;
  161.         DS    2        ;Not used by MEX        160H
  162.         DS    6        ;                162H
  163. JMP$GOODBYE:    JMP    GOODBYE        ;                168H
  164. JMP$INITMOD:    JMP    INITMOD        ;go to user written routine    16BH
  165. JMP$NEWBAUD    JMP    NEWBAUD        ;Change baudrate        16EH
  166.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    171H
  167.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    174H
  168. JMP$SETUPR:    JMP    SETUPR        ;                177H
  169.         DS    3        ;                17AH
  170. JMP$SYSVER:    JMP    SYSVER        ;                17DH
  171. JMP$BREAK:    JMP    SENDBRK        ;                180H
  172. ;
  173. ;
  174. ; Do not change the following six lines.
  175. ;
  176. JMP$ILPRT:    DS    3        ;                183H
  177. JMP$INBUF    DS    3        ;                186H
  178. JMP$INLNCOMP:    DS    3        ;                189H
  179. JMP$INMODEM    DS    3        ;                18CH
  180. JMP$NXTSCRN:    DS    3        ;                18FH
  181. JMP$TIMER:    DS    3        ;                192H
  182. ;
  183. ;
  184. ; Clear sequences -- CLREOS is clear to end of screen, CLRSCRN is clear
  185. ; entire screen.  
  186. ;
  187. CLREOS:        LXI    D,EOSMSG
  188.         MVI    C,PRINT
  189.         CALL    MEX
  190.         RET            
  191. ;
  192. CLRSCRN:    LXI    D,CLSMSG
  193.         MVI    C,PRINT
  194.         CALL    MEX
  195.         RET            
  196. ;
  197. ;
  198. SYSVER:        MVI    C,ILP        ;                1A7H
  199.         CALL    MEX
  200.         DB    ESC,') Configured for Servo-8 Computer on serial port B ',ESC,'(',CR,LF
  201.         DB    ESC,') By Joe Griffith & Paul Leighly  --> MXO-SV10.ASM ',ESC,'('
  202.         DB    CR,LF,LF,0
  203.         RET
  204. ;
  205. ;
  206. ; This routine allows a 300 ms. break tone to be sent to reset some
  207. ; time-shar computers.
  208. ;
  209. SENDBRK:  MVI    A,5
  210.       OUT    MODCTL1
  211.       MVI    A,0F8H        ;SEND A BREAK TONE
  212.       JMP    GOODBYE1
  213. ;.....
  214. ;
  215. ;
  216. ; This routine sends a 300 ms. break tone and sets DTR low for the same
  217. ; length of time to disconnect some modems such as the Bell 212A, etc.    
  218. ;
  219. GOODBYE:  MVI    A,5
  220.       OUT    MODCTL1        ;SEND TO THE STATUS PORT
  221.       MVI    A,68H        ;TURN OFF DTR
  222. ;
  223. GOODBYE1: OUT    MODCTL1
  224.       MVI    B,3        ;WAIT FOR 300 MS.
  225.       MVI    C,TIMER
  226.       CALL    MEX
  227.       MVI    A,5
  228.       OUT    MODCTL1
  229.       MVI    A,0E8H        ;RESTORE TO NORMAL, 8 BITS, DTR ON, ETC.
  230.       OUT    MODCTL1
  231.       RET
  232. ;.....
  233. ;
  234. ;    
  235. ; Servo-8 initialization -- sets CTC timer 09H for send and receive
  236. ; baudrate.
  237. ;
  238. INITMOD:  MVI    A,0        ;SELECT REGISTER
  239.       OUT    MODCTL1
  240.       MVI    A,18H        ;RESET 
  241.       OUT    MODCTL1
  242.       MVI    A,04H        ;SELECT REGISTER
  243.       OUT    MODCTL1
  244.       MVI    A,84H        ;SET PARAMETERS (8 BITS, 1 STOP, NO PARITY)
  245.       OUT    MODCTL1
  246.       MVI    A,03H        ;SELECT REG.
  247.       OUT    MODCTL1
  248.       MVI    A,0C1H        ;ENABLE RECEIVE
  249.       OUT    MODCTL1
  250.       MVI    A,05H        ;SELECT REG.
  251.       OUT    MODCTL1
  252.       MVI    A,0EAH        ;ENABLE SEND, 'DTR', 'RTS'
  253.       OUT    MODCTL1
  254. ;
  255. INITMOD1: MVI    A,1        ;DEFAULT TRANSFER TIME TO 300 BAUD
  256.       STA    MSPEED
  257.       MVI    A,47H        ;DEFAULT TO 300 BAUD
  258.       OUT    CTC1        ;SEND TO 'CTC' TIMER
  259. ;
  260. INITMOD2: MVI    A,0H        ;INITIALIZE TO 300 BAUD
  261.       OUT    CTC1
  262.       RET
  263. ;.....
  264. ;
  265. ;
  266. ; Setup routine to allow changing modem speed with the SET command.
  267. ;
  268. ;
  269. SETUPR:      MVI    C,SBLANK    ;Any arguments?
  270.       CALL    MEX
  271.       JC    TELL        ;If not, go display baud
  272.       LXI    D,CMDTBL
  273.       MVI    C,LOOKUP
  274.       CALL    MEX        ;Parse argument
  275.       PUSH    H        ;Save any parsed argument addrs on stack
  276.       RNC            ;If we have one, return to it
  277.       POP    H        ;Oops, input not found in table
  278.       MVI    C,ILP
  279.       CALL    MEX        ;Tell user input not valid
  280.       DB    CR,LF,'300, 600, 1200, 2400, 4800, or 9600.',CR,LF
  281.       DB    'Are the only valid baudrates....',CR,LF,0
  282.       RET
  283. ;
  284. CMDTBL:      DB    '30','0'+80H
  285.       DW    OK300
  286.       DB    '60','0'+80H
  287.           DW    OK600
  288.       DB    '120','0'+80H
  289.       DW    OK1200
  290.       DB    '240','0'+80H
  291.           DW    OK2400
  292.           DB    '480','0'+80H
  293.           DW    OK4800
  294.           DB    '960','0'+80H
  295.           DW    OK9600
  296.       DB    0
  297. ;
  298. TELL:      MVI    C,ILP
  299.       CALL    MEX        ;Print current baud rate
  300.       DB    CR,LF,'Baud rate is now: ',0
  301.       LDA    MSPEED
  302.       MVI    C,PRBAUD
  303.       CALL    MEX
  304.       RET
  305. ;
  306. ;
  307. OK300:      MVI    A,1
  308.       LHLD    BD300
  309.       JMP    LOADBD
  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. OK2400:   MVI    A,6
  320.           LHLD  BD2400
  321.           JMP   LOADBD        
  322.  
  323. OK4800:   MVI   A,7
  324.           LHLD  BD4800
  325.           JMP   LOADBD
  326.  
  327. OK9600:      MVI    A,8
  328.       LHLD    BD9600
  329. ;
  330. LOADBD:      STA    INITMOD1+1    ;CHANGE TIME-TO-SEND TO MATCH BAUDRATE
  331.       MOV    A,L        ;GET BAUDRATE BYTE
  332.       STA    INITMOD2+1    ;SEND TO 'CTC' TIMER FOR NEW BAUDRATE
  333.       JMP    INITMOD1    ;REINITIALIZE TO NEW BAUDRATE, THEN DONE
  334. ;
  335. ;
  336. NEWBAUD:  CPI    1
  337.       JZ    OK300
  338.       CPI    3
  339.       JZ    OK600
  340.       CPI    5
  341.       JZ    OK1200
  342.       CPI   6
  343.           JZ    OK2400
  344.           CPI   7
  345.           JZ    OK4800
  346.           CPI   8
  347.           JZ    OK9600
  348.  
  349.       RET
  350. ;
  351. ;
  352. ; TABLE OF BAUDRATE PARAMETERS
  353. ;
  354. BD300:      DW    0000H
  355. BD600:      DW    0080H    
  356. BD1200:      DW    0040H
  357. BD2400:   DW    0020H
  358. BD4800:   DW    0010H  
  359. BD9600:      DW    0008H
  360. ;
  361. BAUDBUF:  DB    10,0
  362.       DS    10
  363. ;
  364. EOSMSG:      DB    ESC,'Y$'              
  365. CLSMSG:      DB    ESC,'+$'
  366. ;
  367. ; NOTE:  MUST TERMINATE PRIOR TO 0B00H (with Smartmodem)
  368. ;                 0D00H (without Smartmodem)
  369. ;
  370.  
  371.       END
  372. ;
  373.       DB    ESC,'+$'
  374. ;
  375. ; NOTE:  MUST TERMINATE PRIOR TO 0B00H (with Smartmodem)
  376. ;                 0D00H (without Smartmodem)
  377. ;
  378.  
  379.