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 / M7P1-1.AQM / M7P1-1.ASM
Assembly Source File  |  2000-06-30  |  15KB  |  456 lines

  1. ; M7P1-1.ASM MODEM7 OVERLAY (MDM712 and later) FOR PMC MICROMATE 101
  2. ;   Beta test version 1
  3. ;
  4. ; History:
  5. ;
  6. ; 01/13/84 Revised per M7GP-1.ASM -- the General purpose overlay file
  7. ;          for MDM7xx dated 11/11/83 and name changed for MDM716
  8. ;          Bill Wells, University of California, Berkeley CA.
  9. ; 11/01/83 IN$MODDATP modified to output 00H then 10H per page 75
  10. ;          of the MicroMate User's Guide (instead of only 10H)
  11. ;          Bill Wells, University of California, Berkeley CA.
  12. ; 10/31/83 BSD Unix communication defaults set by Bill Wells, UCB
  13. ;          Bill Wells, University of California, Berkeley CA.
  14. ;        XOFFTST = YES      (Unix ports use XON/XOFF)
  15. ;               CRCDFLT = NO       (umodem & tmodem do not have CRC)
  16. ;               IGNORCTL = NO      (so vi, more, & tset work)
  17. ; 10/09/83 Modified for MDM712 by Jim Warner, UCSC
  18. ;          BAUDMATCH routine changed to query user about setting of
  19. ;          the IGNORCTL. SET$BAUDRATE, AACCOR, and YES$CNTRL added.
  20. ; 10/02/83 Modified for MDM712 by Greg Small and Bill Wells,
  21. ;          University of California, Berkeley CA.
  22. ; 07/02/83 Patches (MDM709PM.ASM) for MDM709
  23. ;          SETLPR, BAUDMATCH, MSPEED$INIT, BIOSPB, BIOSPB1 added.
  24. ;          Jim Warner - University of California, Santa Cruz.
  25. ;
  26. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  27. ;
  28. ; Notes by Jim Warner:
  29. ;
  30. ;  The baud rate stuff in this adaptation is a little strange.
  31. ;  The initial BAUD rate is whatever it was when the program was
  32. ;  entered.  The hardware is read to determine what that is and
  33. ;  MSPEED is changed to agree with it.  A request for a new BAUD
  34. ;  rate is translated in Digital Research's official BAUD rate
  35. ;  code and poked into a data structure called the Device Table.
  36. ;  Finally, the hardware gets poked to agree with the table by
  37. ;  calling the BIOS routine responsible for intializing devices.
  38. ;
  39. ;  We'll need to see the CP/M 3 System System Guide to find out
  40. ;  if this is done right.
  41. ;
  42. ;    /////////////////////////////////////////
  43. ;    /                    /
  44. ;    /    - - W A R N I N G - -        /
  45. ;    /                    /
  46. ;    /    This code uses CP/M 3 dependent    /
  47. ;    /    stuff.                /
  48. ;    /                    /
  49. ;    /////////////////////////////////////////
  50. ;
  51. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  52. ;
  53. ; Use the "SET" command to change the baudrate when desired. 
  54. ;
  55. ;    To use:    First edit this file, filling in answers for your own
  56. ;        equipment. Then assemble with MAC.COM or equivalent
  57. ;        assembler. Use SID to overlay the results of this
  58. ;        program on the original .COM file:
  59. ;
  60. ;        A>save            (this is for CP/M 3)
  61. ;
  62. ;        A>sid mdm7xx.com
  63. ;        CP/M 3 SID - Version 3.0
  64. ;        NEXT MSZE  PC  END
  65. ;        4580 4580 0100 D9FF
  66. ;        #rm7p1-1.hex        (note the "r" command)
  67. ;        NEXT MSZE  PC  END
  68. ;        040B 4580 0100 D9FF
  69. ;        #G0            (return to CP/M)
  70. ;
  71. ;        CP/M 3 SAVE - Version 3.0
  72. ;        Enter file (type RETURN to exit): mdm7p1.com
  73. ;        Beginning hex address: 0100
  74. ;        Ending hex address: 457F    (MSZE - 1)
  75. ;
  76. ;        A>
  77. ;
  78. ; NEXT, MSZE, PC, END, and Ending hex addresses shown are for MDM716
  79. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  80. ;
  81. ; M7GP-1.ASM 11/11/83:
  82. BELL:        EQU    07H        ;bell
  83. CR:        EQU    0DH        ;carriage return
  84. ESC:        EQU    1BH        ;escape
  85. LF:        EQU    0AH        ;linefeed
  86. ;
  87. YES:        EQU    0FFH
  88. NO:        EQU    0
  89. ;
  90. ; PMC Micromate Model 101 dependant stuff from MDM712PM.ASM - 10/09/83
  91. ; Patches for overlaying distribution version  of MDM712 for use with
  92. ; the PMC-101.  Jim Warner - Univ of Cal Santa Cruz.
  93. ;
  94. PORT:        EQU    89H    ;PMC SERIAL MODEM PORT
  95. MODCTL1:    EQU    PORT+2    ;Modem control port                 gts
  96. MODCTL2:    EQU    PORT+2    ;Modem control port                 gts
  97. MODDATP:    EQU    PORT    ;Modem data port
  98. MODRCVB:    EQU    01H    ;Your bit to test for receive
  99. MODRCVR:    EQU    01H    ;Your value when receive ready.
  100. MODSNDB:    EQU    04H    ;Your bit to test for send.
  101. MODSNDR:    EQU    04H    ;Your value when xmitter available.
  102. ;
  103. P$BAUD        EQU    93H    ;Upper nibble = TERMNL
  104. P$GETBAUD    EQU    95H    ;Lower nibble = MODEM
  105. ;
  106. ; M7GP-1.ASM 11/11/83:
  107. ; Change the following information to match your equipment
  108. ;
  109. ; PORT:        EQU    0C0H
  110. ; MODCTL1:    EQU    PORT        ;MODEM CONTROL PORT
  111. ; MODDATP:    EQU    PORT+1        ;MODEM DATA IN PORT
  112. ; MODDATO:    EQU    PORT+1        ;MODEM DATA OUT PORT
  113. ; MODDCDB:    EQU    4        ;CARRIER DETECT BIT
  114. ; MODDCDA:    EQU    0        ;VALUE WHEN ACTIVE
  115. ; BAUDRP:        EQU    PORT+2        ;BAUD RATE PORT
  116. ; MODCTL2:    EQU    PORT+3        ;2ND MODEM CONTROL PORT
  117. ; MODRCVB:    EQU    2        ;BIT TO TEST FOR RECEIVE
  118. ; MODRCVR:    EQU    2        ;VALUE WHEN READY
  119. ; MODSNDB:    EQU    1        ;BIT TO TEST FOR SEND
  120. ; MODSNDR:    EQU    1        ;VALUE WHEN READY
  121. ;
  122. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  123. ; M7GP-1.ASM 11/11/83 with Unix communication defaults, Bill Wells:
  124. ;
  125.         ORG    100H
  126. ;
  127. ;
  128. ; Change the clock speed to suit your system
  129. ;
  130.         DS    3    ;(for  "JMP   START" instruction)
  131. ;
  132. PMMIMODEM:    DB    NO    ;yes=PMMI S-100 Modem            103H
  133. SMARTMODEM:    DB    NO    ;yes=HAYES Smartmodem, no=non-PMMI    104H
  134. TOUCHPULSE:    DB    'T'    ;T=touch, P=pulse (Smartmodem-only)    105H
  135. CLOCK:        DB    40    ;clock speed in MHz x10, 25.5 MHz max.    106H
  136.                 ;20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
  137. MSPEED:        DB    1    ;0=110 1=300 2=450 3=600 4=710 5=1200    107H
  138.                 ;6=2400 7=4800 8=9600 9=19200 default
  139. BYTDLY:        DB    5    ;0=0 delay  1=10ms  5=50 ms - 9=90 ms    108H
  140.                 ;default time to send character in ter-
  141.                 ;minal mode file transfer for slow BBS.
  142. CRDLY:        DB    5    ;0=0 delay 1=100 ms 5=500 ms - 9=900 ms 109H
  143.                 ;default time for extra wait after CRLF
  144.                 ;in terminal mode file transfer
  145. NOOFCOL:    DB    5    ;number of DIR columns shown        10AH
  146. SETUPTST:    DB    YES    ;yes=user-added Setup routine        10BH jw
  147. SCRNTEST:    DB    NO    ;Cursor control routine         10CH
  148. ACKNAK:        DB    YES    ;yes=resend a record after any non-ACK    10DH
  149.                 ;no=resend a record after a valid-NAK
  150. BAKUPBYTE:    DB    NO    ;yes=change any file same name to .BAK    10EH
  151. CRCDFLT:    DB    NO    ;yes=default to CRC checking        10FH wcw
  152. TOGGLECRC:    DB    YES    ;yes=allow toggling of CRC to Checksum    110H
  153. CONVBKSP:    DB    NO    ;yes=convert backspace to rub        111H
  154. TOGGLEBK:    DB    YES    ;yes=allow toggling of bksp to rub    112H
  155. ADDLF:        DB    NO    ;no=no LF after CR to send file in    113H
  156.                 ;terminal mode (added by remote echo)
  157. TOGGLELF:    DB    YES    ;yes=allow toggling of LF after CR    114H
  158. TRANLOGON:    DB    YES    ;yes=allow transmission of logon    115H
  159.                 ;write logon sequence at location LOGON
  160. SAVCCP:        DB    YES    ;yes=do not overwrite CCP        116H
  161. LOCONEXTCHR:    DB    NO    ;yes=local command if EXTCHR precedes    117H
  162.                 ;no=external command if EXTCHR precedes
  163. TOGGLELOC:    DB    YES    ;yes=allow toggling of LOCONEXTCHR    118H
  164. LSTTST:        DB    YES    ;yes=printer available on printer port    119H
  165. XOFFTST:    DB    YES    ;yes=checks for XOFF from remote while    11AH wcw
  166.                 ;sending a file in terminal mode
  167. XONWAIT:    DB    NO    ;yes=wait for XON after CR while    11BH
  168.                 ;sending a file in terminal mode
  169. TOGXOFF:    DB    YES    ;yes=allow toggling of XOFF checking    11CH
  170. IGNORCTL:    DB    NO    ;yes=CTL-chars above ^M not displayed    11DH wcw
  171. EXTRA1:        DB    0    ;for future expansion            11EH
  172. EXTRA2:        DB    0    ;for future expansion            11FH
  173. BRKCHR:        DB    '@'-40H    ;^@ = Send 300 ms. break tone        120H
  174. NOCONNCT:    DB    'N'-40H    ;^N = Disconnect from the phone line    121H
  175. LOGCHR:        DB    'L'-40H    ;^L = Send logon            122H
  176. LSTCHR:        DB    'P'-40H    ;^P = Toggle printer            123H
  177. UNSAVE:        DB    'R'-40H    ;^R = Close input text buffer        124H
  178. TRANCHR:    DB    'T'-40H ;^T = Transmit file to remote        125H
  179. SAVECHR:    DB    'Y'-40H    ;^Y = Open input text buffer        126H
  180. EXTCHR:        DB    '^'-40H    ;^^ = Send next character        127H
  181. ;
  182. ;
  183.         DS    2        ;                128H
  184. ;
  185. ; M7GP-1.ASM 11/11/83:
  186. ; IN$MODCTL1:    IN    MODCTL1 !; RET    ;in modem control port        12AH
  187. ;        DS    7
  188. ;
  189. ; M712PM.ASM 10/09/83 by Jim Warner, modified by Bill Wells 11/01/83
  190. IN$MODCTL1:    XRA    A        ;Output 00H to command port    12AH wcw
  191.         OUT    MODCTL1         ;                               12BH wcw
  192.         MVI    A,10H        ;Output 10H to command port     12DH jw
  193.         OUT    MODCTL1         ;                               12FH jw
  194.         IN    MODCTL1        ;Get status bits.               131H jw
  195.         RET                     ;                               133H
  196. ;
  197. ; M7GP-1.ASM 11/11/83:
  198. OUT$MODDATP:    OUT    MODDATP ! RET    ;out modem data port        134H
  199.         DS    7               ;                               137H
  200. IN$MODDATP:    IN    MODDATP ! RET    ;in modem data port        13EH
  201.         DS    7               ;                               141H
  202. ANI$MODRCVB:    ANI    MODRCVB    ! RET    ;bit to test for receive ready    148H
  203.  
  204. CPI$MODRCVR:    CPI    MODRCVR    ! RET    ;value of rcv. bit when ready    14BH
  205. ANI$MODSNDB:    ANI    MODSNDB    ! RET    ;bit to test for send ready    14EH
  206. CPI$MODSNDR:    CPI    MODSNDR    ! RET    ;value of send bit when ready    151H
  207.         DS    6        ;                154H
  208. ;
  209. OUT$MODCTL1:    OUT    MODCTL1    ! RET    ;out modem control port #2    15AH
  210. OUT$MODCTL2:    OUT    MODCTL2    ! RET    ;out modem control port #1    15DH
  211. ;
  212. LOGONPTR:    DW    LOGON        ;for user message.        160H
  213.         DS    6        ;                162H
  214. JMP$GOODBYE:    JMP    GOODBYE        ;                168H
  215. JMP$INITMOD:    JMP    INITMOD        ;go to user written routine    16BH
  216.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    16EH
  217.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    171H
  218.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    174H
  219. JMP$SETUPR:    JMP    SETUPR        ;                177H
  220. JMP$SPCLMENU:    JMP    SPCLMENU    ;                17AH
  221. JMP$SYSVER:    JMP    SYSVER        ;                17DH
  222. JMP$BREAK:    JMP    SENDBRK        ;                180H
  223. ;
  224. ;
  225. ; Do not change the following six lines.
  226. ;
  227. JMP$ILPRT:    DS    3        ;                183H
  228. JMP$INBUF    DS    3        ;                186H
  229. JMP$INLNCOMP:    DS    3        ;                189H
  230. JMP$INMODEM    DS    3        ;                18CH
  231. JMP$NXTSCRN:    DS    3        ;                18FH
  232. JMP$TIMER    DS    3        ;                192H
  233. ;
  234. ;
  235. ; Routine to clear to end of screen.  If using CLREOS and CLRSCRN, set
  236. ; SCRNTEST to YES at 010AH (above).
  237. ;
  238. CLREOS:        CALL    JMP$ILPRT    ;                195H
  239.         DB    0,0,0,0,0    ;                198H
  240.         RET            ;                19DH
  241. ;
  242. CLRSCRN:    CALL    JMP$ILPRT    ;                19EH
  243.         DB    0,0,0,0,0    ;                1A1H
  244.         RET            ;                1A6H
  245.     
  246. ;
  247. ; M712PM.ASM 10/09/83 by Jim Warner, modified by Bill Wells 01/13/84
  248. SYSVER:        CALL    JMP$ILPRT    ;                1A7H
  249.         DB    'Modem 7 for PMC Micromate Model 101 - '
  250.         DB    'UC Beta Test Version 1 - 01/14/84'
  251.         DB    CR,LF,0
  252.         LXI    D,LOGON
  253.         MVI    C,9
  254.         CALL    5
  255.         CALL    MSPEED$INIT
  256.         RET
  257. ;.....
  258. ;
  259. ; M7GP-1.ASM 11/11/83:
  260. ;-----------------------------------------------------------------------
  261. ;
  262. ; NOTE:  You can change the SYSVER message to be longer or shorter.  The
  263. ;     end of your last routine should terminate by 0400H (601 bytes
  264. ;     available after start of SYSVER) if using the Hayes Smartmodem
  265. ;     or by address 0C00H (2659 bytes) otherwise.
  266. ;
  267. ;-----------------------------------------------------------------------
  268. ;
  269. ; You can put in a message at this location which can be called up with
  270. ; CTL-O if TRANLOGON has been set TRUE.  You can put in several lines if
  271. ; desired.  End with a 0.
  272. ;
  273. ; M712PM.ASM 10/09/83 by Jim Warner
  274. LOGON:        DB    'Do not use this program to filch'
  275.         DB    ' copyrighted software.',CR,LF,0,'$'
  276. ;.....
  277. ; M7GP-1.ASM 11/11/83:
  278. ;
  279. ;
  280. ; Add your own routine here to send a break tone to reset some time-sharing
  281. ; computers, if desired.
  282. SENDBRK:    RET
  283. ;.....
  284. ;
  285. ;
  286. ; Add your own routine here to put DTR low and/or send a break tone.
  287. ; Check other routines such as MDM709DP.ASM (M7DP-1.ASM) which is
  288. ;    using this feature.
  289. ;
  290. GOODBYE:    RET
  291. ;.....
  292. ;
  293. ;
  294. ; You can use this area for any special initialization or setup you may
  295. ; wish to include.  Each must stop with a RET. You can check the other
  296. ; available overlays for ideas how to write your own routines if that
  297. ; may be of some help.
  298. ;
  299. INITMOD:     RET
  300. ;
  301. SETUPR:        ;Allow baud rate change w SET cmd
  302.         LXI    D,BAUDBUF
  303.         CALL    JMP$ILPRT
  304.         DB    'Input baud rate (110, 300, 600, 1200)',CR,LF
  305.         DB    '                (2400,4800,9600,19200):',0
  306.         CALL    JMP$INBUF
  307.         LXI    D,BAUDBUF+2
  308.         CALL    JMP$INLNCOMP    ;Compare BAUDBUF+2 w char's
  309.         DB    '110',0
  310.         MVI    L,3        ;Code from MODEBAUD.LIB
  311.         JNC    BAUDMATCH
  312. ;
  313.         CALL    JMP$INLNCOMP
  314.         DB    '300',0
  315.         MVI    L,6
  316.         JNC    BAUDMATCH
  317. ;
  318.         CALL    JMP$INLNCOMP
  319.         DB    '600',0
  320.         MVI    L,7
  321.         JNC    BAUDMATCH
  322. ;
  323.         CALL    JMP$INLNCOMP
  324.         DB    '1200',0
  325.         MVI    L,8
  326.         JNC    BAUDMATCH
  327. ;
  328.         CALL    JMP$INLNCOMP
  329.         DB    '2400',0
  330.         MVI    L,10
  331.         JNC    BAUDMATCH
  332. ;
  333.         CALL    JMP$INLNCOMP
  334.         DB    '4800',0
  335.         MVI    L,12
  336.         JNC    BAUDMATCH
  337. ;
  338.         CALL    JMP$INLNCOMP
  339.         DB    '9600',0
  340.         MVI    L,14
  341.         JNC    BAUDMATCH
  342. ;
  343.         CALL    JMP$INLNCOMP
  344.         DB    '19200',0
  345.         MVI    L,15
  346.         JC    SETUPR
  347. ;
  348. BAUDMATCH:    CALL    SET$BAUDRATE
  349.         CALL    MSPEED$INIT
  350.         CALL    AACCOR        ;Allow all Control Char on Recv?
  351.         RET            ; (* SETUP *)
  352. ;
  353. SET$BAUDRATE:    PUSH    H        ;Save baud code
  354.         MVI    C,32H        ;Function: direct bios call.
  355.         LXI    D,BIOSPB    ;BIOS parameter block
  356.         CALL    5
  357.         LXI    D,8+7        ;Index to BAUD rate in 2nd
  358.         DAD    D        ; entry. (i.e. MODEM)
  359.         POP    D        ;Get new code back.
  360.         MOV    A,M        ;Best not to change high
  361.         ANI    0F0H        ; nibble, whatever it is.
  362.         ORA    E        ;Put new code in table.
  363.         MOV    M,A
  364. ;
  365.         MVI    C,32H        ;Function: direct bios call.
  366.         LXI    D,BIOSPB1    ;Initialize device means to
  367.         CALL    5        ; set BAUD rate to PMC.
  368.         RET
  369. ;
  370. ; M712PM.ASM 10/09/83 by Jim Warner, modified by Bill Wells 01/13/84
  371. AACCOR:        CALL    JMP$ILPRT
  372.         DB    'Allow ALL control characters on receive?',CR,LF
  373.         DB    'Answer "Y" to permit control of local',CR,LF
  374.         DB    '  console from remote system.',CR,LF
  375.         DB    'Answer "Y" to use vi on Unix (Y/N): ',0
  376.         LXI    D,BAUDBUF
  377.         CALL    JMP$INBUF
  378.         LXI    D,BAUDBUF+2
  379.         LDAX    D    ; Force input to upper case for compare
  380.         ANI    5FH    ; Added by Gregg Small UCB 1/13/84
  381.         STAX    D    ;
  382.         CALL    JMP$INLNCOMP
  383.         DB    'Y',0
  384.         MVI    A,0FFH
  385.         JC    YES$CNTRL
  386.         INR    A
  387. YES$CNTRL:    STA    IGNORCTL
  388.         RET
  389. ;
  390. ; M712PM.ASM 10/09/83 by Jim Warner
  391. MSPEED$INIT:    IN    P$GETBAUD    ;Read serial speeds.
  392.         ANI    0FH        ;Mask to modem port speed.
  393.         MOV    L,A
  394.         MVI    H,0
  395.         LXI    D,STABLE
  396.         DAD    D
  397.         MOV    A,M        ;Get local speed code
  398.         STA    MSPEED        ; and tell MDM712.
  399.         RET 
  400. ;
  401. BIOSPB        DB    20    ;BIOS fcn: return devtbl address
  402.         DB    0    ;A-reg contents
  403.         DW    0    ;BC-reg contents
  404.         DW    0    ;DE-reg contents
  405.         DW    0    ;HL-reg contents
  406. ;
  407. BIOSPB1        DB    21    ;BIOS fcn: initialize device in c-reg
  408.         DB    0    ;A-reg contents
  409.         DB    1    ;C-reg=1 for MODEM
  410.         DB    0    ;B-reg
  411.         DW    0    ;DE-reg
  412.         DW    0    ;HL-reg
  413. ;
  414. ;This table is used to translate baud rate values as read from
  415. ; the hardware latch into their more restrictive MODEM712
  416. ; equivalents.
  417. ;
  418. ;           MDM712 BAUD                  hardware BAUD 
  419. ;            rate code                    rate code
  420. STABLE        DB    0    ;Really 50 baud, use 110    0
  421.         DB    0    ;Really 75 baud, use 110    1
  422.         DB    0    ;110 baud            2
  423.         DB    0    ;Really 134.5 baud, use 110    3
  424.         DB    0    ;Really 150 baud, use 110    4
  425.         DB    1    ;300 baud            5
  426.         DB    3    ;600 baud            6
  427.         DB    5    ;1200 baud            7
  428.         DB    5    ;Really 1800 baud, use 1200    8
  429.         DB    6    ;Really 2000 baud, use 2400    9
  430.         DB    6    ;2400 baud            A
  431.         DB    6    ;Really 3600 baud, use 2400    B
  432.         DB    7    ;4800 baud            C
  433.         DB    7    ;Really 7200 baud, use 4800    D
  434.         DB    8    ;9600 baud            E
  435.         DB    9    ;19.2k                F
  436. ;
  437. SPCLMENU:    RET
  438. ;.....
  439. ;
  440. ;    
  441. ;
  442. BAUDBUF:    DB    10,0
  443.         DS    10
  444. ;-----------------------------------------------------------------------
  445. ; M7GP-1.ASM 11/11/83:
  446.  
  447. ;
  448. ; NOTE:  MUST TERMINATE PRIOR TO 0400H (with Smartmodem)
  449. ;                 0C00H (without Smartmodem)
  450. ;.....
  451. ;
  452.       END
  453. ;
  454.