home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / jsage / znode3 / modem / mxo-lb3r.asm < prev    next >
Encoding:
Assembly Source File  |  1994-09-02  |  11.9 KB  |  411 lines

  1. ; MXO-LB3.ASM- AMPRO "Little Board" overlay for MEX10.       04/04/85
  2. ;
  3. TITLE    'MXO-LB3R.ASM Customized Ampro MEX overlay'
  4. PAGE    45
  5. ;
  6. ;
  7. ; You will want to look this file over carefully. There are a number of
  8. ; options that you can use to configure the program to suit your taste.
  9. ; This file adapts the AMPRO "Little Board" computer to the modem program.  
  10. ;
  11. ; Edit this file for your preferences then follow the "TO USE:" example
  12. ; shown below.
  13. ;
  14. ; Use the "SET" command to change the baudrate when desired.  It starts
  15. ; out at 1200 baud when the program is first called up.
  16. ;
  17. ;    TO USE: First edit this file filling in answers for your own
  18. ;        equipment.  Then assemble with ASM.COM or equivalent
  19. ;        assembler.  Then use MLOAD to overlay the the results
  20. ;        of this program to the original .COM file.
  21. ;
  22. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  23. ; 08/23/85 - Changed incorrect Jump to
  24. ;         GOODBYE routine so modem won't
  25. ;         disconnect on CPM,EXIT,or SYSTEM     - Rick Swenton
  26. ; 08/17/85 - Added code to support 450 baud     - Rick Swenton
  27. ; 04/04/84 - Added DISCV to allow modem disconnect on ESC N
  28. ;         (present GOODBY routine is only called when exiting
  29. ;         MEX to CPM)             -Norman Beeler     
  30. ; 03/29/85 - Added 2400 and 4800 baud capability -Norman Beeler
  31. ; 09/14/84 - Adapt for AMPRO "Little Board"    - Charlie Sanborn
  32. ; 05/28/84 - MEXify labels            - Biff Bueffel
  33. ; 05/23/84 - Corrected clear-screen problem    - Biff Bueffel    
  34. ; 05/22/84 - Rewritten for MEX10        - Biff Bueffel
  35. ; 11/11/83 - Renamed to M7KP-1.ASM, no changes    - Irv Hoff
  36. ; 07/27/83 - Renamed to work with MDM712    - Irv Hoff
  37. ; 07/01/83 - Revised to work with MDM711    - Irv Hoff
  38. ; 06/22/83 - Revised to work with MDM710    - Irv Hoff
  39. ; 05/25/83 - Revised to work with MDM709    - Irv Hoff
  40. ; 04/15/83 - Revised to work with MDM708    - Irv Hoff
  41. ; 04/11/83 - Updated to work with MDM707    - Irv Hoff
  42. ; 04/04/83 - Updated to work with MDM706    - Irv Hoff
  43. ; 02/27/83 - Updated to work with MDM705    - Irv Hoff
  44. ; 02/17/83 - Modified MDM703CF for Kaypro II
  45. ;         computers with external modems    - Irv Hoff
  46. ;
  47. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  48. ;
  49. BELL:        EQU    07H        ;bell
  50. CR:        EQU    0DH        ;carriage return
  51. ESC:        EQU    1BH        ;escape
  52. LF:        EQU    0AH        ;linefeed
  53. ;
  54. YES:        EQU    0FFH
  55. NO:        EQU    0
  56. ;
  57. ;
  58. PORT:        EQU    88H        ;Ampro "B" serial output port
  59. MODCT1:     EQU    PORT+4        ;Modem control port
  60. MODDAT:     EQU    PORT        ;Modem data port
  61. MODCT2:     EQU    PORT+4        ;Modem control port
  62. MDRCVB:     EQU    01H        ;Your bit to test for receive
  63. MDRCVR:     EQU    01H        ;Your value when receive ready
  64. MDSNDB:     EQU    04H        ;Your bit to test for send
  65. MDSNDR:     EQU    04H        ;Your value when send ready        
  66. ;
  67. ; MEX service processor stuff
  68. ;
  69. MEX    EQU    0D00H        ;address of the service processor
  70. INMDM    EQU    255        ;get char from port to A, CY=no more in 100 ms
  71. TIMER    EQU    254        ;delay 100ms * reg B
  72. TMDINP    EQU    253        ;B=# secs to wait for char, cy=no char
  73. CHEKCC    EQU    252        ;check for ^C from KBD, Z=present
  74. SNDRDY    EQU    251        ;test for modem-send ready
  75. RCVRDY    EQU    250        ;test for modem-receive ready
  76. SNDCHR    EQU    249        ;send a character to the modem (after sndrdy)
  77. RCVCHR    EQU    248        ;recv a char from modem (after rcvrdy)
  78. LOOKUP    EQU    247        ;table search: see CMDTBL comments for info
  79. PARSFN    EQU    246        ;parse filename from input stream
  80. BDPARS    EQU    245        ;parse baud-rate from input stream
  81. SBLANK    EQU    244        ;scan input stream to next non-blank
  82. EVALA    EQU    243        ;evaluate numeric from input stream
  83. LKAHED    EQU    242        ;get nxt char w/o removing from input
  84. GNC    EQU    241        ;get char from input, cy=1 if none
  85. ILP    EQU    240        ;inline print
  86. DECOUT    EQU    239        ;decimal output
  87. PRBAUD    EQU    238        ;print baud rate
  88. ;
  89. PRINT    EQU    9        ;MEX/BDOS print-string function call
  90. ;
  91.         ORG    100H
  92. ;
  93. ;
  94. ; Change the clock speed as needed for your system.
  95. ;
  96.         DS    3    ;(for  "JMP   START" instruction)
  97. ;
  98. PMODEM:     DB    NO    ;yes=PMMI S-100 Modem            103H
  99. SMODEM:     DB    NO    ;yes=HAYES Smartmodem, no=non-PMMI    104H
  100. TPULSE:     DB    'T'    ;T=touch, P=pulse (Smartmodem-only)    105H
  101. CLOCK:        DB    40    ;clock speed in MHz x10, 25.5 MHz max.    106H
  102.                 ;20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
  103. MSPEED:     DB    1    ;0=110 1=300 2=450 3=600 4=710 5=1200    107H
  104.                 ;6=2400 7=4800 8=9600 9=19200 default
  105. BYTDLY:     DB    5    ;0=0 delay  1=10ms  5=50 ms - 9=90 ms    108H
  106.                 ;default time to send character in ter-
  107.                 ;minal mode file transfer for slow BBS.
  108. CRDLY:        DB    5    ;0=0 delay 1=100 ms 5=500 ms - 9=900 ms 109H
  109.                 ;default time for extra wait after CRLF
  110.                 ;in terminal mode file transfer
  111. COLUMS:     DB    5    ;number of DIR columns shown        10AH
  112. SETFLG:     DB    YES    ;yes=user-added Setup routine        10BH
  113. SCRTST:     DB    YES    ;Cursor control routine         10CH
  114.         DB    YES    ;yes=resend a record after any non-ACK    10DH
  115.                 ;no=resend a record after a valid NAK
  116. BAKFLG:     DB    NO    ;yes=change any file same name to .BAK    10EH
  117. CRCDFL:     DB    YES    ;yes=default to CRC checking        10FH
  118. TOGCRC:     DB    YES    ;yes=allow toggling of CRC to Checksum    110H
  119. CVTBS:        DB    NO    ;yes=convert backspace to rub        111H
  120. TOGLBK:     DB    YES    ;yes=allow toggling of bksp to rub    112H
  121. ADDLF:        DB    NO    ;no=no LF after CR to send file in    113H
  122.                 ;terminal mode (added by remote echo)
  123. TOGLF:        DB    YES    ;yes=allow toggling of LF after CR    114H
  124.         DB    NO    ;yes=allow transmission of logon    115H
  125.                 ;write logon sequence at location LOGON
  126. SAVCCP:     DB    YES    ;yes=do not overwrite CCP        116H
  127.         DB    NO    ;yes=local command if EXTCHR precedes    117H
  128.                 ;no=external command if EXTCHR precedes
  129.         DB    YES    ;yes=allow toggling of LOCONEXTCHR    118H
  130. LSTTST:     DB    YES    ;yes=printer available on printer port    119H
  131. XOFTST:     DB    NO    ;yes=chcks for XOFF from remote while    11AH
  132.                 ;sending a file in terminal mode
  133. XONWT:        DB    NO    ;yes=wait for XON after CR while    11BH
  134.                 ;sending a file in terminal mode
  135. TOGXOF:     DB    YES    ;yes=allow toggling of XOFF checking    11CH
  136. IGNCTL:     DB    YES    ;yes=CTL-chars above ^M not displayed    11DH
  137. EXTRA1:     DB    0    ;for future expansion            11EH
  138. EXITCHR:        DB    'E'-40H ;^E = Exit to main menu         11FH
  139. BRKCHR:     DB    '@'-40H ;^@ = Send a 300 ms. break tone     120H
  140. NOCONN:     DB    'N'-40H ;^N = Disconnect from the phone line    121H
  141. LOGCHR:     DB    'L'-40H ;^L = Send logon            122H
  142. LSTCHR:     DB    'P'-40H ;^P = Toggle printer            123H
  143. UNSAVE:     DB    'R'-40H ;^R = Close input text buffer        124H
  144. TRNCHR:     DB    'T'-40H ;^T = Transmit file to remote        125H
  145. SAVCHR:     DB    'Y'-40H ;^Y = Open input text buffer        126H
  146. EXTCHR:     DB    '^'-40H ;^^ = Send next character        127H
  147. ;
  148. ;
  149.         DS    2        ;                128H
  150. ;
  151. INCTL1:     MVI    A,10H        ;channel 0, reset interrupts.    12AH
  152.         OUT    MODCT1
  153.         IN    MODCT1        ;get the status bits
  154.         RET
  155.         DS    3
  156. ;
  157. OTDATA:     OUT    MODDAT ! RET    ;out modem data port        134H
  158.         DS    7
  159. INPORT:     IN    MODDAT ! RET    ;in modem data port        13EH
  160.         DS    7
  161. MASKR:        ANI    MDRCVB    ! RET    ;bit to test for receive ready    148H
  162. TESTR:        CPI    MDRCVR ! RET    ;value of receive bit when rdy    14BH
  163. MASKS:        ANI    MDSNDB    ! RET    ;bit to test for send ready    14EH
  164. TESTS:        CPI    MDSNDR    ! RET    ;value of send bit when ready    151H
  165.         DS    6
  166. ;
  167. OUTCTL1:    OUT    MODCT1    ! RET    ;out modem control port     15AH
  168. OUTCTL2:    OUT    MODCT2    ! RET    ;out modem status port        15DH
  169. ;
  170. ;
  171.         DS    2        ;                160H
  172.         DS    3        ;                162H
  173. DISCV:        JMP    GOODBY        ;disconnect on ^N
  174. GOODBV:     RET  !    NOP  !    NOP    ;return to CP/M         168H
  175. INMODV:     JMP    NITMOD        ;go to user written routine    16BH
  176. NEWBDV:     JMP    NEWBAUD     ;Set new baudrate        16EH
  177.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    171H
  178.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    174H
  179. SETUPV:     JMP    SETCMD        ;                177H
  180.         DS    3        ;                17AH
  181. VERSNV:     JMP    SYSVER        ;                17DH
  182. BREAKV:     JMP    SBREAK        ;                180H
  183. ;
  184. ;
  185. ; Do not change the following six lines.
  186. ;
  187. ILPRTV:     DS    3        ;                183H
  188. INBUFV:     DS    3        ;                186H
  189. ILCMPV:     DS    3        ;                189H
  190. INMDMV:     DS    3        ;                18CH
  191.         DS    3        ;                18FH
  192. TIMERV:     DS    3        ;                192H
  193. ;
  194. ;
  195. ; Clear sequences -- CLREOS is clear to end of screen, CLRSCRN is clear
  196. ; entire screen.  Last entry must be 0.  Any other 0's act as NOP's.
  197. ;
  198. CLREOS:     LXI    D,EOSMSG
  199.         MVI    C,PRINT
  200.         CALL    MEX
  201.         RET            
  202. ;
  203. CLS:    LXI    D,CLSMSG
  204.         MVI    C,PRINT
  205.         CALL    MEX
  206.         RET            
  207. ;
  208. ;
  209. SYSVER:     MVI    C,ILP        ;                
  210.         CALL    MEX
  211.         DB    CR,LF
  212.         DB    'Version for AMPRO using Z80 DART on port 088H',CR,LF
  213.         DB    'Overlay Version 2   08/23/85  by Rick Swenton',CR,LF
  214.         DB    CR,LF,LF,LF,0
  215.         RET
  216. ;
  217. ;
  218. ;
  219. ; This routine allows a 300 ms. break tone to be sent to reset some
  220. ; time-share computers.
  221. ;
  222. SBREAK:  MVI    A,5
  223.       OUT    MODCT1
  224.       MVI    A,7AH             ;SEND A BREAK TONE         
  225.       JMP    GOODBY1
  226. ;.....
  227. ;
  228. ;
  229. ; This routine sends a 300 ms. break tone and sets DTR low for the same
  230. ; length of time to disconnect some modems such as the Bell 212A, etc.
  231. ;
  232. GOODBY:  MVI    A,5
  233.       OUT    MODCT1        ;SEND TO THE STATUS PORT
  234.       MVI    A,78H        ;TURN OFF RTS
  235. ;
  236. GOODBY1: OUT    MODCT1
  237.       MVI    B,3        ;DELAY 300 MS.
  238.       MVI    C,TIMER
  239.       CALL    MEX
  240.       MVI    A,5
  241.       OUT    MODCT1
  242.       MVI    A,6AH           ;RESTORE TO NORMAL, 8 BITS, RTS ON, ETC.
  243.       OUT    MODCT1
  244.       RET
  245. ;.....
  246. ;
  247. ;
  248. ; AMPRO initialization -- set up Z80-DART & CTC Channel 01 (clock source)
  249. ;
  250. ;
  251. NITMOD:   MVI    A,00H        ;SELECT REG.
  252.       OUT    MODCT1
  253.       MVI    A,18H        ;THROW OUT OF MODE
  254.       OUT    MODCT1
  255.       MVI    A,04H        ;SELECT REG.
  256.       OUT    MODCT1
  257.       MVI    A,44H        ;SET ASCII PARAMETERS
  258.       OUT    MODCT1
  259.       MVI    A,03H        ;SELECT REG.
  260.       OUT    MODCT1
  261.       MVI    A,0C1H        ;ENABLE RECEIVE
  262.       OUT    MODCT1
  263.       MVI    A,05H        ;SELECT REG.
  264.       OUT    MODCT1
  265.       MVI    A,6AH           ;ENABLE SEND, DTR, RTS
  266.       OUT    MODCT1
  267. ;
  268. NITMOD1:  MVI    A,5        ;SET FILE TRANSFER TIME
  269.       STA    MSPEED
  270.       MVI    A,47H
  271.       OUT    50H        ;SEND TO 'CTC' TIMER
  272.  
  273. NITMOD2:  MVI    A,68H        ;INITIALIZE TO 1200 BAUD
  274.       OUT    50H        ;SEND TO 'CTC' TIMER
  275.       RET
  276. ;.....
  277. ;
  278. ;
  279. ; Sets the modem speed via the SET command.
  280. ;
  281. ;
  282. SETCMD:   MVI    C,SBLANK    ;Any arguments?
  283.       CALL    MEX
  284.       JC    TELL        ;If not, go display baud
  285.       LXI    D,CMDTBL
  286.       MVI    C,LOOKUP
  287.       CALL    MEX        ;Parse argument
  288.       PUSH    H        ;Save any parsed argument addrs on stack
  289.       RNC            ;If we have one, return to it
  290.       POP    H        ;Oops, input not found in table
  291.       MVI    C,ILP
  292.       CALL    MEX        ;Tell user input not valid
  293.       DB    CR,LF,'Only 300, 450, 600, 1200, 2400, 4800 or 9600 allowed with SET'
  294.       DB    CR,LF,0
  295.       RET
  296. ;
  297. CMDTBL:   DB    '30','0'+80H
  298.       DW    OK300
  299.       DB    '45','0'+80H
  300.       DW    OK450
  301.       DB    '60','0'+80H
  302.       DW    OK600
  303.       DB    '120','0'+80H
  304.       DW    OK1200
  305.       DB    '240','0'+80H
  306.       DW    OK2400
  307.       DB    '480','0'+80H
  308.       DW    OK4800
  309.       DB    '960','0'+80H
  310.       DW    OK9600
  311.       DB    0
  312. ;
  313. TELL:      MVI    C,ILP
  314.       CALL    MEX        ;Print current baud rate
  315.       DB    CR,LF,'Baud rate is now: ',0
  316.       LDA    MSPEED
  317.       MVI    C,PRBAUD
  318.       CALL    MEX
  319.       RET
  320. ;
  321. ;
  322. OK300      MVI    A,84H        ;Load DART Reg 4 with x32
  323.       STA    NITMOD+13
  324.       MVI    A,1
  325.       LHLD    BD300
  326.       JMP    LOADBD
  327. ;
  328. OK450      MVI    A,84H        ;Load DART Reg 4 with x32  
  329.       STA    NITMOD+13
  330.       MVI    A,2
  331.       LHLD    BD450
  332.       JMP    LOADBD
  333. ;
  334. OK600      MVI    A,44H        ;Load DART Reg 4 with x16
  335.       STA    NITMOD+13
  336.       MVI    A,3
  337.       LHLD    BD600
  338.       JMP    LOADBD
  339. ;
  340. OK1200      MVI    A,44H        ;Same as for 600
  341.       STA    NITMOD+13
  342.       MVI    A,5
  343.       LHLD    BD1200
  344.       JMP    LOADBD
  345. ;
  346. OK2400      MVI    A,44H
  347.       STA    NITMOD+13
  348.       LHLD    BD2400
  349.       JMP    LOADBD
  350. ;
  351. OK4800      MVI    A,44H
  352.       STA    NITMOD+13
  353.       LHLD    BD4800
  354.       JMP    LOADBD    
  355. ;
  356. OK9600      MVI    A,44H        ;As above
  357.       STA    NITMOD+13
  358.       MVI    A,8
  359.       LHLD    BD9600
  360. ;
  361. LOADBD:   STA    NITMOD1+1    ;CHANGE TIME-TO-SEND TO MATCH BAUDRATE
  362.       MOV    A,L        ;GET BAUDRATE BYTE
  363.       STA    NITMOD2+1    ;SEND TO 'CTC' FOR NEW BAUDRATE
  364.       JMP    NITMOD        ;REINITIALIZE TO NEW BAUDRATE, THEN DONE
  365. ;
  366. ;
  367. NEWBAUD:  CPI    1
  368.       JZ    OK300           
  369.       CPI    2
  370.       JZ    OK450
  371.       CPI    3
  372.       JZ    OK600
  373.       CPI    5
  374.       JZ    OK1200
  375.       CPI    6
  376.       JZ    OK2400
  377.       CPI    7
  378.       JZ    OK4800
  379.       CPI    8
  380.       JZ    OK9600
  381.       RET
  382. ;
  383. ;
  384. ; TABLE OF BAUDRATE PARAMETERS
  385. ;
  386. BD300:      DW    00D0H        ;62400/300    (x32)
  387. BD450:      DW    008AH        ;62400/450    (x32)
  388. BD600:      DW    00D0H        ;62400/600    (x32)
  389. BD1200:   DW    0068H        ;124800/1200  (x16)
  390. BD2400      DW    0034H        ;124800/2400  (x16)
  391. BD4800      DW    001AH        ;124800/4800  (x16)
  392. BD9600:   DW    000DH        ;124800/9600  (x16)
  393. ;
  394. BAUDBUF:  DB    10,0
  395.       DS    10
  396. ;
  397. ; NOTE: The following two lines are terminal dependent, and are
  398. ; currently set for a VT-52. Change for your terminal.
  399. ;
  400. EOSMSG:   DB    01BH,4AH,'$'               
  401. CLSMSG:   DB    01BH,48H,1BH,4AH,'$'
  402. ;-----------------------------------------------------------------------
  403. ;
  404. ;
  405. ; NOTE:  MUST TERMINATE PRIOR TO 0B00 (with Smartmodem)
  406. ;                 
  407. ;
  408.       END
  409. ;
  410.  
  411. -----------