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 / M7VT-5.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  15KB  |  479 lines

  1. ; M7VT-5.ASM -- DEC Micro Overlay File for MDM7xx / MEX.  15-Sept-84
  2. ;
  3. ;
  4. ;This  Overlay  File  supports  the DEC Micros VT180, Rainbow and
  5. ;DECmate II with CP/M.
  6. ;
  7. ;We  use the COMM-Port of the Micro's.  Baud-rates are "parallel"
  8. ;to the console Baud-rates - no need for  a  "special"  baud-rate
  9. ;routine.   Since  the COMM-port is I/O-wise Reader/Punch, we use
  10. ;the BDOS calls.
  11. ;
  12. ;To  test  for  COMM-status  ,  we  use  I/O  byte redirection in
  13. ;conjunction with direct BIOS-CONSTAT call.
  14. ;
  15. ;This  technique  although  a  little  bit slower than direct I/O
  16. ;using  Interrupt  on  INPUT  is  general  enough  to  be  system
  17. ;independent.   Set  one  of  the  following  switches  to TRUE:
  18. ;
  19. ;RAINBO1 for (old) Version 1 CP/M 80/86
  20. ;RAINBO2 for (current) Version 2 of CP/M 80/86
  21. ;DECMATE for DECmate II with CP/M option
  22. ;ROBIN     for the VT180 (aka ROBIN)
  23. ;
  24. ;    - B. Eiben DEC Large System Marketing Marlboro Mass
  25. ;
  26. ;***********************************************************************
  27. ;
  28. ;  You  will  want  to look this file over carefully.  There are a
  29. ; number of options that you can use to configure the  program  to
  30. ; suit  your taste.  This file places particular emphasis on using
  31. ; an external modem that does not match one of the  other  special
  32. ; overlays.   You would use the normal CP/M "Configure" program to
  33. ; set the modem to whatever baud rate you would normally use (such
  34. ; as 300 or 1200, etc.)  Then perhaps just make a second .COM file
  35. ; if you need both 300 and 1200 and do not wish to write your  own
  36. ; initialization or "set baud" routine.
  37. ;
  38. ;  You  could  look  at other overlay files to see how the GOODBYE
  39. ; and/or SETUPR areas are handled.  You could then  adapt  one  of
  40. ; those,  if appropriate for your equipment in this overlay.  Some
  41. ; examples:
  42. ;
  43. ;     "DP"  Datapoint 1560 overlay using 8251 I/O and CTC timers for
  44. ;              setting baud rates
  45. ;     "H8"  Heath H89 overlay for 8250 I/O and programmable baud rates
  46. ;     "HZ"  Zenith 120 overlay for 2661B initialization and baud rates
  47. ;     "XE"  Xerox 820II overlay for Z80-SIO intialization, etc.
  48. ;
  49. ;  Edit  this  file for your preferences then follow the "TO USE:"
  50. ; example shown below.
  51. ;
  52. ;    TO USE: First edit this file filling in answers for your own
  53. ;        equipment.  Then assemble with ASM.COM or equivalent
  54. ;        assembler.  Then use DDT to overlay the the results
  55. ;        of this program to the original .COM file:
  56. ;
  57. ;        A>DDT MDM7xx.COM
  58. ;        DDT VERS 2.2
  59. ;        NEXT  PC
  60. ;        4300 0100
  61. ;        -IM7VT-1.HEX        (note the "I" command)
  62. ;        -R            ("R" loads in the .HEX file)
  63. ;        NEXT  PC
  64. ;        4300 0000
  65. ;        -G0            (return to CP/M)
  66. ;        A>SAVE 66 MDM7xx.COM    (now have a modified .COM file)
  67. ; -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
  68. ;
  69. ; Or (easier and less error-prone) use Ron Fowlers MLOAD21.COM instead of
  70. ; the above DDT-based merge-technique:
  71. ;
  72. ;        MLOAD21 MODEM.COM=MDM7xx.COM,M7VT-x.HEX
  73. ;    or    MLOAD21 MEX.COM=MEXxxx.COM,M7VT-x.HEX
  74. ;
  75. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  76. ;
  77. ; 15/09/84 - DECmate II - BREAK-sending, and XON/XOFF disabled for binary
  78. ;         send/receive , ROBIN Break-sending (both "lifted" from KERMIT).
  79. ; 29/08/84 - Changed to split Rainbow V1 / V2 (incompatible I/O byte) -B.G.E
  80. ; 11/24/83 - Changed to add Rainbow and Decmate - B.G.E.
  81. ; 11/11/83 - Renamed to M7VT-1.ASM, no changes    - Irv Hoff
  82. ; 08/09/83 - Revised to work with a VT180    - Michael Gwilliam
  83. ; 04/04/83 - First version of this file        - Irv Hoff
  84. ;
  85. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  86. ;
  87. BELL:        EQU    07H        ;bell
  88. CR:        EQU    0DH        ;carriage return
  89. ESC:        EQU    1BH        ;escape
  90. LF:        EQU    0AH        ;linefeed
  91. ;
  92. TRUE:        EQU    0FFH
  93. FALSE:        EQU    0
  94. YES:        EQU    0FFH
  95. NO:        EQU    0
  96. ;
  97. ;
  98. ; Change the following information to match your equipment
  99. ;
  100. ROBIN        EQU    FALSE        ;aka DEC VT180
  101. RAINBO1        EQU    FALSE        ;Rainbow Software V1
  102. RAINBO2        EQU    FALSE        ;Rainbow Software V2
  103. DECMATE        EQU    TRUE        ;.. with CP/M option
  104. ;
  105. BDOS:        EQU    0005        ;address of BDOS entry
  106. PUNCH:        EQU    4        ;punch function
  107. READER:        EQU    3        ;reader function
  108. MODDCDB:    EQU    4        ;carrier detect bit
  109. MODDCDA:    EQU    0        ;value when active
  110. MODRCVB:    EQU    0FFH        ;bit to test for recedive
  111. MODRCVR:    EQU    0FFH        ;value when ready
  112. MODSNDB:    EQU    0FFH        ;bit to test for send
  113. MODSNDR:    EQU    0FFH        ;value when ready
  114. ;
  115. ;
  116.         ORG    100H
  117. ;
  118. ;
  119. ; Change the clock speed to suit your system
  120. ;
  121.         DS    3    ;(for  "JMP   START" instruction)
  122. ;
  123. PMMIMODEM:    DB    NO    ;yes=PMMI S-100 Modem            103H
  124. SMARTMODEM:    DB    NO    ;yes=HAYES Smartmodem, no=non-PMMI    104H
  125. TOUCHPULSE:    DB    'T'    ;T=touch, P=pulse (Smartmodem-only)    105H
  126. CLOCK:        DB    40    ;clock speed in MHz x10, 25.5 MHz max.    106H
  127.                 ;20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
  128. MSPEED:        DB    5    ;0=110 1=300 2=450 3=600 4=710 5=1200    107H
  129.                 ;6=2400 7=4800 8=9600 9=19200 default
  130. BYTDLY:        DB    5    ;0=0 delay  1=10ms  5=50 ms - 9=90 ms    108H
  131.                 ;default time to send character in ter-
  132.                 ;minal mode file transfer for slow BBS.
  133. CRDLY:        DB    5    ;0=0 delay 1=100 ms 5=500 ms - 9=900 ms 109H
  134.                 ;default time for extra wait after CRLF
  135.                 ;in terminal mode file transfer
  136. NOOFCOL:    DB    5    ;number of DIR columns shown        10AH
  137. SETUPTST:    DB    NO    ;yes=user-added Setup routine        10BH
  138. SCRNTEST:    DB    YES    ;Cursor control routine         10CH
  139. ACKNAK:        DB    YES    ;yes=resend a record after any non-ACK    10DH
  140.                 ;no=resend a record after a valid-NAK
  141. BAKUPBYTE:    DB    NO    ;yes=change any file same name to .BAK    10EH
  142. CRCDFLT:    DB    YES    ;yes=default to CRC checking        10FH
  143. TOGGLECRC:    DB    YES    ;yes=allow toggling of CRC to Checksum    110H
  144. CONVBKSP:    DB    YES    ;yes=convert backspace to rub        111H
  145. TOGGLEBK:    DB    YES    ;yes=allow toggling of bksp to rub    112H
  146. BADDLF:        DB    NO    ;no=no LF after CR to send file in    113H
  147.                 ;terminal mode (added by remote echo)
  148. TOGGLELF:    DB    YES    ;yes=allow toggling of LF after CR    114H
  149. TRANLOGON:    DB    YES    ;yes=allow transmission of logon    115H
  150.                 ;write logon sequence at location LOGON
  151. SAVCCP:        DB    YES    ;yes=do not overwrite CCP        116H
  152. LOCONEXTCHR:    DB    YES    ;yes=local command if EXTCHR precedes    117H
  153.                 ;no=external command if EXTCHR precedes
  154. TOGGLELOC:    DB    YES    ;yes=allow toggling of LOCONEXTCHR    118H
  155. LSTTST:        DB    YES    ;yes=printer available on printer port    119H
  156. XOFFTST:    DB    YES    ;yes=checks for XOFF from remote while    11AH
  157.                 ;sending a file in terminal mode
  158. XONWAIT:    DB    NO    ;yes=wait for XON after CR while    11BH
  159.                 ;sending a file in terminal mode
  160. TOGXOFF:    DB    YES    ;yes=allow toggling of XOFF checking    11CH
  161. IGNORCTL:    DB    NO    ;yes=CTL-chars above ^M not displayed    11DH
  162. EXTRA1:        DB    0    ;for future expansion            11EH
  163. EXTRA2:        DB    0    ;for future expansion            11FH
  164. BRKCHR:        DB    'B'-40H    ;^@ = Send 300 ms. break tone        120H
  165. NOCONNCT:    DB    'N'-40H    ;^N = Disconnect from the phone line    121H
  166. LOGCHR:        DB    'L'-40H    ;^L = Send logon            122H
  167. LSTCHR:        DB    'P'-40H    ;^P = Toggle printer            123H
  168. UNSAVE:        DB    'R'-40H    ;^R = Close input text buffer        124H
  169. TRANCHR:    DB    'T'-40H ;^T = Transmit file to remote        125H
  170. SAVECHR:    DB    'Y'-40H    ;^Y = Open input text buffer        126H
  171. EXTCHR:        DB    '\'-40H    ;^\ = Send next character        127H
  172.                 ;changed to be closer to KERMIT (B.G.E)
  173.                 ;changed Break character to ^B (WML)
  174. ;
  175. ;
  176.         DS    2        ;                128H
  177. ;
  178. IN$MODCTL1:    JMP    INCTL        ;in modem control port        12AH
  179.         DS    7
  180. OUT$MODDATP:    JMP    OUTDATA        ;out modem data port        134H
  181.         DS    7
  182. IN$MODDATP:    JMP    INDATA        ;in modem data port        13EH
  183.         DS    7
  184. ANI$MODRCVB:    ANI    MODRCVB    ! RET    ;bit to test for receive ready    148H
  185.  
  186. CPI$MODRCVR:    CPI    MODRCVR    ! RET    ;value of rcv. bit when ready    14BH
  187. ANI$MODSNDB:    MVI    A,MODSNDB ! RET    ;bit to test for send ready    14EH
  188. CPI$MODSNDR:    CPI    MODSNDR    ! RET    ;value of send bit when ready    151H
  189.         DS    6        ;Together these do nothing    156H
  190. ;
  191. OUT$MODCTL1:    RET ! NOP ! NOP        ;out modem control port #2    15AH
  192. OUT$MODCTL2:    RET ! NOP ! NOP        ;out modem control port #1    15DH
  193. ;
  194. LOGONPTR:    DW    LOGON        ;for user message.        160H
  195.         DS    6        ;                162H
  196. JMP$GOODBYE:    JMP    GOODBYE        ;                168H
  197. JMP$INITMOD:    JMP    INITMOD        ;go to user written routine    16BH
  198.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    16EH
  199.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    171H
  200.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    174H
  201. JMP$SETUPR:    JMP    SETUPR        ;                177H
  202. JMP$SPCLMENU:    JMP    SPCLMENU    ;                17AH
  203. JMP$SYSVER:    JMP    SYSVER        ;                17DH
  204. JMP$BREAK:    JMP    SENDBRK        ;                180H
  205. ;
  206. ;
  207. ; Do not change the following six lines.
  208. ;
  209. JMP$ILPRT:    DS    3        ;                183H
  210. JMP$INBUF    DS    3        ;                186H
  211. JMP$INLNCOMP:    DS    3        ;                189H
  212. JMP$INMODEM    DS    3        ;                18CH
  213. JMP$NXTSCRN:    DS    3        ;                18FH
  214. JMP$TIMER    DS    3        ;                192H
  215. ;
  216. ;
  217. ; Routine to clear to end of screen.  If using CLREOS and CLRSCRN, set
  218. ; SCRNTEST to YES at 010AH (above).
  219. ;
  220. CLREOS:        CALL    JMP$ILPRT    ;                195H
  221.         DB    ESC,'[','0','J',0;                198H
  222.         RET            ;                19DH
  223. ;
  224. CLRSCRN:    JMP    DECVT100    ;                19EH
  225.         DB    0,0,0,0,0    ;                1A1H
  226.         RET            ;                1A6H
  227.     
  228. ;
  229. SYSVER:        CALL    JMP$ILPRT    ;                1A7H
  230. XSO    EQU    14            ;"shift out" character
  231. XSI    EQU    15            ;"shift in" character
  232.         DB    'Version for: ',ESC,'[7m',ESC,')0'
  233.         DB    'd',XSO,'x',XSI
  234.         DB    'i',XSO,'x',XSI
  235.         DB    'g',XSO,'x',XSI
  236.         DB    'i',XSO,'x',XSI
  237.         DB    't',XSO,'x',XSI
  238.         DB    'a',XSO,'x',XSI
  239.         DB    'l',ESC,'[m '
  240. IF ROBIN
  241.         DB    'DEC VT180 and external modem'
  242. ENDIF                    ; ROBIN
  243. IF RAINBO1
  244.         DB    'DEC Rainbow V1 and external modem'
  245. ENDIF                    ; RAINBO1
  246. IF RAINBO2
  247.         DB    'DEC Rainbow V2 and external modem'
  248. ENDIF                    ; RAINBO2
  249. IF DECMATE
  250.         DB    'DECMATE II and external modem'
  251. ENDIF                    ; DECMATE
  252.         DB    CR,LF,0
  253.         RET
  254. ;.....
  255. ;
  256. ;
  257. ; Modem I/O primitive
  258. ;
  259. ; Subroutine to output a character to the modem.
  260. ; This routine does it's own status checking.
  261. ;
  262. OUTDATA:  PUSH    B        ;save...
  263.       PUSH    D        ;...the...
  264.       PUSH    H        ;...registers.
  265.       MOV    E,A        ;move output byte into E
  266.       MVI    C,PUNCH        ;use the BDOS function
  267.       CALL    BDOS        ;go
  268.       POP    H        ;restore...  
  269.       POP    D        ;...the...
  270.       POP    B        ;...registers.
  271.       RET
  272. ;.....
  273. ;
  274. ;
  275. ; Subroutine to input a character from the modem.
  276. ; This routine will wait until one becomes available.
  277. ;
  278. INDATA:      PUSH    B        ;save...
  279.       PUSH    D        ;...the...
  280.       PUSH    H        ;...regesters.
  281.       MVI    C,READER    ;use the BDOS function
  282.       CALL    BDOS        ;go
  283.       POP    H        ;restore...
  284.       POP    D        ;...the...
  285.       POP    B        ;...registers.
  286.       RET
  287. ;.....
  288. ; Screen- Clearing needs more space than left above
  289. DECVT100:    CALL JMP$ILPRT        ;
  290.     DB    ESC,'[','2','J',ESC,'[','H',0
  291.         RET
  292. ;
  293. ; The Check for characters at COMM-Port using I/O redirection
  294. ;
  295. IOBYTE    EQU    3        ; some definitions
  296. IF RAINBO1 OR ROBIN
  297. DEFIO    EQU    95H        ; the "standard" setting
  298. BATIO    EQU    56H        ;
  299. ENDIF                ; RAINBO1 OR ROBIN
  300. ;
  301. IF RAINBO2
  302. DEFIO    EQU    15H        ; the "standard" setting
  303. BATIO    EQU    96H        ;
  304. ENDIF                ;RAINBO2
  305. ;
  306. IF DECMATE
  307. DEFIO    EQU    81H        ; the "standard" setting
  308. BATIO    EQU    42H        ;
  309. ENDIF                ; DECMATE
  310. ;
  311. INCTL:    PUSH    B
  312.     PUSH    D
  313.     PUSH    H        ; save the environment
  314.     MVI    A,BATIO        ; change I/O byte
  315.     STA    IOBYTE
  316.     CALL     BCONST        ; call BIOS direct - see INITMOD
  317.     PUSH    A
  318.     MVI    A,DEFIO        ; change I/O byte back
  319.     STA    IOBYTE
  320.     POP    A
  321.     POP    H        ; restore environment
  322.     POP    D
  323.     POP    B
  324.     RET
  325. ;.....          
  326. ;               
  327. ;               
  328. ;-----------------------------------------------------------------------
  329. ;               
  330. ; NOTE:  You can change the SYSVER message to be longer or shorter.  The
  331. ;     end of your last routine should terminate by 0400H (601 bytes
  332. ;     available after start of SYSVER) if using the Hayes Smartmodem
  333. ;     or by address 0C00H (2659 bytes) otherwise.
  334. ;
  335. ;-----------------------------------------------------------------------
  336. ;
  337. ; You can put in a message at this location which can be called up with
  338. ; CTL-O if TRANLOGON has been set TRUE.  You can use several lines if
  339. ; desired.  End with a 0.
  340. ;
  341. LOGON:      DB    'How are you today?',CR,LF,0
  342. ;.....
  343. ;
  344. ;
  345. ; Add your own routine here to send a break tone to reset some time-share
  346. ; computers, if desired.
  347. ;
  348. SENDBRK:  
  349. IF robin ;Definitions & code to send a BREAK (ungenerically, no other way).
  350.  
  351. ;pbausl EQU    90H    ;The Baud-Rate register.
  352. prntst    EQU    49H    ;Printer
  353. ;prndat    EQU    48H
  354. contst    EQU    41H    ;Console
  355. ;condat    EQU    40H
  356. gentst    EQU    51H    ;General port.
  357. ;gendat    EQU    50H
  358. comtst    EQU    59H    ;COMM-Port
  359. ;comdat    EQU    58H
  360. ;output    EQU    01H    ;Output ready bit.
  361. ;input    EQU    02H    ;Input ready bit.
  362.  
  363. comctl    equ    59h        ;VT180 communications port
  364. crtctl    equ    41h        ;VT180 crt port
  365.  
  366. ;VT180 serial port command bits
  367.  
  368. txe    equ    1        ;transmit enable
  369. dtr    equ    2        ;dtr on
  370. rxe    equ    4        ;rx enable
  371. sndbrk    equ    8
  372. rerr    equ    10h        ;reset error
  373. rts    equ    20h        ;RTS on
  374. reset    equ    40h        ;port reset
  375.  
  376. ;Send a break to the communications port.
  377. ;
  378.  
  379.     lxi    h,38500        ;250 ms(?)
  380.     mvi    a,comctl    ;Get address of selected port
  381.     mov    c,a        ;Into C
  382.     mvi    a,sndbrk+dtr
  383. ;    OUT    C,A        ;Want to send to port addressed by C
  384.     db    0EDH,079H    ;Op code for above instruction
  385. sndbr1:    dcx    h        ;timing loop...
  386.     mov    a,l
  387.     ora    h
  388.     jnz    sndbr1        ;...until over
  389.     mvi    a,comctl    ;Get the address for the port
  390.     mov    c,a        ;Into C
  391.     mvi    a,txe+dtr+rxe+rerr+rts    ;enable tr/rc, dtr, reset error
  392. ;    out    c,a        ;Z-80 only instruction
  393.     db    0EDH,079H    ;Op code for above instruction
  394.     out    contst        ;reset ports
  395.     ret
  396. ENDIF;robin
  397. ;
  398. IF decmate            ;[jd] this added to send break on DECmate
  399.  
  400. ; DECmate command codes for 6120 I/O processor
  401. oboff    equ    3fh        ; offset of outbyt routine for 6120
  402. prtctl    equ    02h        ; port control
  403. brdat    equ    06h        ; data to tell 6120 to send a break
  404. brdur    equ    30        ; duration, 30 = 300 ms.
  405.  
  406.     lxi    b,(brdat * 100h) + prtctl ; c/prtctl, b/brdat
  407.     call    outbyt
  408.     lxi    b,brdur*100h        ; b/duration, c/0
  409. ;    fall through into outbyt
  410.  
  411. outbyt:    lhld    1        ; get warm boot address
  412.     lxi    d,oboff        ; offset of outbyt routine
  413.     dad    d        ; compute address
  414.     pchl            ; branch there (a callret)
  415.  
  416. ENDIF;decmate
  417. ;   --------  end of break code added by WML, 9/4/84 ----------
  418. ;.....
  419. ;
  420. ;
  421. ; Add your own routine here to put DTR low and/or send a break tone.
  422. ; Check other routines such as MDM709DP.ASM which is using this feature.
  423. ;
  424. GOODBYE:  RET            ;TRICK-Coding -is RET for Rainbow-versions
  425.                 ; for SENDBRK-code TOO - NO way to send
  426.                 ; talk to the 8086-based USART from the
  427.                 ; Z80 on Rainbow - but Rainbow sends a
  428.                 ; standard BREAK in T-mode.
  429. ;.....
  430. ;
  431. ;
  432. ; You can use this area for any special initialization or setup you may
  433. ; wish to include.  Each must stop with a RET.    You can check the other
  434. ; available overlays for ideas how to write your own routines if that
  435. ; may be of some help.
  436. ;
  437. INITMOD:  LHLD    1        ; Get BIOS Jump-table adress
  438.       LXI    D,3
  439.       DAD    D        ; CONSTAT routine in BIOS
  440.       SHLD    BCONST+1    ; modify our "routine"
  441.  
  442. IF DECMATE
  443.  
  444. nocixon    equ    016h        ; turn off comm. input XON/XOFF
  445. cixon    equ    015h        ; enable comm. inp XON
  446. nocoxon    equ    001h        ; turn off comm. output XON
  447. coxon    equ    000h        ; enable comm. output XON
  448.  
  449.     lxi    b,(nocoxon * 100h) + prtctl ; c/prtctl, b/no out. xon
  450.     call    outbyt1
  451.     ret            ; and return
  452.  
  453. outbyt1: lhld    1        ; get warm boot address
  454.     lxi    d,oboff        ; offset of outbyt routine
  455.     dad    d        ; compute address
  456.     pchl            ; branch there (a callret)
  457.  
  458. ENDIF;DECMATE
  459.  
  460.       RET
  461. ;
  462. BCONST:      JMP    $-$        ; address "filled in" by above code
  463. ;
  464. SETUPR:      RET
  465. ;
  466. ;
  467. ; If using the Hayes Smartmodem this is unavailable without a special
  468. ; change.
  469. ;
  470. SPCLMENU: RET
  471. ;
  472. ;
  473. ; NOTE:  MUST TERMINATE PRIOR TO 0400H (with Smartmodem)
  474. ;                 0C00H (without Smartmodem)
  475. ;.....
  476. ;
  477.       END
  478. ;
  479.