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 / M7BT-1.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  11KB  |  367 lines

  1. ; M7BT-1.ASM -- Beehive "TOPPER" overlay file for MDM7xx.  11/20/85
  2. ;
  3. ;
  4. ; This overlay adapts the MDM7xx program to the Beehive TOPPER 
  5. ; computer, using the Z80 DART and Z80 CTC.
  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 places particular emphasis on using the Beehive TOPPER 
  10. ; computer with the Z80 DART main serial port and the Z80 CTC baud rate
  11. ; generator.  Note that in the TOPPER the Z80 CTC controls the RX speed
  12. ; and the TX speed from different CTC port addresses.  The allows the
  13. ; TOPPER to operate the RX and TX at different baud rates, in this 
  14. ; overlay both will be SET at the same baud rate.
  15. ;
  16. ; Edit this file for your preferences then follow the "TO USE:" example
  17. ; shown below.
  18. ;
  19. ;    TO USE: First edit this file filling in answers for your own
  20. ;        equipment.  Then assemble with ASM.COM, LASM.COM, or 
  21. ;        equivalent assembler.  Then use MLOAD to overlay the 
  22. ;         results of this program to the original .COM file:
  23. ;
  24. ;        MLOAD MODEM.COM=MDM7xx.COM,M7BT-1.HEX
  25. ;                         ^       ^
  26. ;                         |       |
  27. ;  Name you want for program     Name of the MODEM source file.
  28. ;                  MDM740, MODM700, etc
  29. ;
  30. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  31. ; History:
  32. ;
  33. ; 11/20/85 - Original version from Lillypond Softwares -  Dennis Recla
  34. ;                Garland, Texas  (214) 270-1834    
  35. ;
  36. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  37. ;
  38. BELL:        EQU    07H        ;bell
  39. CR:        EQU    0DH        ;carriage return
  40. ESC:        EQU    1BH        ;escape
  41. LF:        EQU    0AH        ;linefeed
  42. ;
  43. YES:        EQU    0FFH
  44. NO:        EQU    0
  45. ;
  46. ;
  47. ; Change the following information to match your equipment
  48. ;
  49. PORT:        EQU    9AH
  50. MODCTL1        EQU    PORT        ;DART Modem Control Port
  51. MODDATP:    EQU    PORT-2        ;DART Data Port
  52. MODRCVB:    EQU    1        ;Bit to test for receive
  53. MODRCVR:    EQU    1        ;Value when ready
  54. MODSNDB:    EQU    4        ;Bit to test for send
  55. MODSNDR:    EQU    4        ;Value when ready
  56. CTC1:        EQU    90H        ;CTC addr RX speed
  57. CTC2:        EQU    91H        ;CTC addr TX speed
  58. ;
  59.         ORG    100H
  60. ;
  61. ;
  62. ; Change the clock speed if needed, to match your system
  63. ;
  64.         DS    3    ;(for  "JMP   START" instruction)
  65. ;
  66. PMMIMODEM:    DB    NO    ;yes=PMMI S-100 Modem            103H
  67. SMARTMODEM:    DB    YES    ;yes=HAYES Smartmodem, no=non-PMMI    104H
  68. TOUCHPULSE:    DB    'T'    ;T=touch, P=pulse (Smartmodem-only)    105H
  69. CLOCK:        DB    40    ;clock speed in MHz x10, 25.5 MHz max.    106H
  70.                 ;20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
  71. MSPEED:        DB    5    ;0=110 1=300 2=450 3=600 4=710 5=1200   107H
  72.                 ;6=2400 7=4800 8=9600 9=19200 default
  73. BYTDLY:        DB    5    ;0=0 delay  1=10ms  5=50 ms - 9=90 ms   108H
  74.                 ;default time to send character in ter-
  75.                 ;minal mode file transfer for slow BBS.
  76. CRDLY:        DB    5    ;0=0 delay 1=100 ms 5=500 ms - 9=900 ms 109H
  77.                 ;default time for extra wait after CRLF
  78.                 ;in terminal mode file transfer
  79. NOOFCOL:    DB    5    ;number of DIR columns shown        10AH
  80. SETUPTST:    DB    YES    ;yes=user-added Setup routine        10BH
  81. SCRNTEST:    DB    YES    ;Cursor control routine         10CH
  82. ACKNAK:        DB    YES    ;yes=resend a record after any non-ACK    10DH
  83.                 ;no=resend a record after a valid-NAK
  84. BAKUPBYTE:    DB    YES    ;yes=change any file same name to .BAK    10EH
  85. CRCDFLT:    DB    YES    ;yes=default to CRC checking        10FH
  86. TOGGLECRC:    DB    YES    ;yes=allow toggling of CRC to Checksum    110H
  87. CONVBKSP:    DB    NO    ;yes=convert backspace to rub        111H
  88. TOGGLEBK:    DB    YES    ;yes=allow toggling of bksp to rub    112H
  89. ADDLF:        DB    NO    ;no=no LF after CR to send file in    113H
  90.                 ;terminal mode (added by remote echo)
  91. TOGGLELF:    DB    YES    ;yes=allow toggling of LF after CR    114H
  92. TRANLOGON:    DB    YES    ;yes=allow transmission of logon    115H
  93.                 ;write logon sequence at location LOGON
  94. SAVCCP:        DB    YES    ;yes=do not overwrite CCP        116H
  95. LOCONEXTCHR:    DB    NO    ;yes=local command if EXTCHR precedes    117H
  96.                 ;no=external command if EXTCHR precedes
  97. TOGGLELOC:    DB    YES    ;yes=allow toggling of LOCONEXTCHR    118H
  98. LSTTST:        DB    YES    ;yes=printer available on printer port    119H
  99. XOFFTST:    DB    YES    ;yes=checks for XOFF from remote while    11AH
  100.                 ;sending a file in terminal mode
  101. XONWAIT:    DB    NO    ;yes=wait for XON after CR while    11BH
  102.                 ;sending a file in terminal mode
  103. TOGXOFF:    DB    YES    ;yes=allow toggling of XOFF checking    11CH
  104. IGNORCTL:    DB    YES    ;yes=CTL-chars above ^M not displayed    11DH
  105. EXTRA1:        DB    0    ;for future expansion            11EH
  106. EXTRA2:        DB    0    ;for future expansion            11FH
  107. BRKCHR:        DB    '@'-40H    ;^@ = Send 300 ms. break tone        120H
  108. NOCONNCT:    DB    'N'-40H    ;^N = Disconnect from the phone line    121H
  109. LOGCHR:        DB    'L'-40H    ;^L = Send logon            122H
  110. LSTCHR:        DB    'P'-40H    ;^P = Toggle printer            123H
  111. UNSAVE:        DB    'R'-40H    ;^R = Close input text buffer        124H
  112. TRANCHR:    DB    'T'-40H ;^T = Transmit file to remote        125H
  113. SAVECHR:    DB    'Y'-40H    ;^Y = Open input text buffer        126H
  114. EXTCHR:        DB    '^'-40H    ;^^ = Send next character        127H
  115. ;
  116. ;
  117.         DS    2        ;                128H
  118. ;
  119. IN$MODCTL1:    IN    MODCTL1 ! RET    ;in modem control port             12AH
  120.         DS    7
  121. OUT$MODDATP:    OUT    MODDATP ! RET    ;out modem data port        134H
  122.         DS    7
  123. IN$MODDATP:    IN    MODDATP ! RET    ;in modem data port        13EH
  124.         DS    7
  125. ANI$MODRCVB:    ANI    MODRCVB    ! RET    ;bit to test for receive ready    148H
  126. CPI$MODRCVR:    CPI    MODRCVR    ! RET    ;value of rcv. bit when ready    14BH
  127. ANI$MODSNDB:    ANI    MODSNDB    ! RET    ;bit to test for send ready    14EH
  128. CPI$MODSNDR:    CPI    MODSNDR    ! RET    ;value of send bit when ready    151H
  129.         DS    12        ;                156H
  130. ;
  131. ;
  132. LOGONPTR:    DW    LOGON        ;for user message.        160H
  133.         DS    6        ;                162H
  134. JMP$GOODBYE:    JMP    GOODBYE        ;                168H
  135. JMP$INITMOD:    JMP    INITMOD        ;go to user written routine    16BH
  136.         RET  !  NOP  !  NOP    ;(by-passes PMMI routine)    16EH
  137.         RET  !  NOP  !  NOP    ;(by-passes PMMI routine)    171H
  138.         RET  !  NOP  !  NOP    ;(by-passes PMMI routine)    174H
  139. JMP$SETUPR:    JMP    SETUPR        ;                177H
  140. JMP$SPCLMENU:    JMP    SPCLMENU    ;                17AH
  141. JMP$SYSVER:    JMP    SYSVER        ;                17DH
  142. JMP$BREAK:    JMP    SENDBRK        ;                180H
  143. ;
  144. ;
  145. ; Do not change the following six lines.
  146. ;
  147. JMP$ILPRT:    DS    3        ;                183H
  148. JMP$INBUF    DS    3        ;                186H
  149. JMP$INLNCOMP:    DS    3        ;                189H
  150. JMP$INMODEM    DS    3        ;                18CH
  151. JMP$NXTSCRN:    DS    3        ;                18FH
  152. JMP$TIMER    DS    3        ;                192H
  153. ;
  154. ; Routine to clear to end of screen.  If using CLREOS and CLRSCRN, set
  155. ; SCRNTEST to YES at 010AH (above).
  156. ;
  157. CLREOS:        CALL    JMP$ILPRT    ;                195H
  158.         DB    ESC,'J',0,0,0    ;                198H
  159.         RET            ;                19DH
  160. ;
  161. CLRSCRN:    CALL    JMP$ILPRT    ;                19EH
  162.         DB    ESC,'E',0,0,0    ;                1A1H
  163.         RET            ;                1A6H
  164.     
  165. ;
  166. SYSVER:        CALL    JMP$ILPRT    ;                1A7H
  167.         DB    'Version for Beehive Topper Computer',CR,LF
  168.         DB      ' From ',ESC,'d','C','Lillypond Softwares '
  169.         DB    ESC,'d','@','11/20/85',CR,LF
  170.         DB    '  Initial baud rate set for 1200',CR,LF,0
  171.         RET
  172. ;.....
  173. ;
  174. ;
  175. ;-----------------------------------------------------------------------
  176. ;
  177. ; NOTE:  You can change the SYSVER message to be longer or shorter.  The
  178. ;     end of your last routine should terminate by 0400H (601 bytes
  179. ;     available after start of SYSVER) if using the Hayes Smartmodem
  180. ;     or by address 0C00H (2659 bytes) otherwise.
  181. ;
  182. ;-----------------------------------------------------------------------
  183. ;
  184. ; You can put in a message at this location which can be called up with
  185. ; CTL-O if TRANLOGON has been set TRUE.  You can use several lines if
  186. ; desired.  End with a 0.
  187. ;
  188. LOGON:        DB    'This is a Beehive Topper Computer',CR,LF,0
  189. ;.....
  190. ;
  191. ;
  192. ; Routine to send a 300 msec. break tone to reset some time-share
  193. ; computers.
  194. ;
  195. SENDBRK:    MVI     A,5        ;
  196.         OUT     PORT
  197.         MVI     A,0FAH        ; Send BREAK tone from DART
  198.         JMP    GOODBYE1    
  199. ;.....
  200. ;
  201. ;
  202. ; Routine to put DTR low for 300 msec. to disconnect from Modem.
  203. ;
  204. GOODBYE:      MVI    A,05H        ;Write register 5 of DART
  205.         OUT    PORT
  206.         MVI    A,68H        ;Drop DTR and RTS
  207. ;    
  208. GOODBYE1:    OUT    PORT
  209.         MVI    B,3        ;Wait for 300 Msec.
  210.         CALL    JMP$TIMER    ;Turn on the timer.
  211.         MVI    A,5        ;Write register 5 again
  212.         OUT    PORT
  213.         MVI    A,0EAH        ;Put things back to normal.
  214.         OUT     PORT
  215.         RET
  216. ;.....
  217. ;
  218. ;
  219. ; The following is used to initialize the TOPPER Z80 DART.
  220. ; MAIN Port is used,Baud rate is initially set to 1200.
  221. ;
  222. INITMOD:  DI        ;no interupts during setup
  223. ;
  224.       MVI    A,5    ;default transfer speed to 1200 baud
  225.       STA    MSPEED     ;
  226. ;
  227.       MVI   A,01H   ;Write register 1 of DART
  228.           OUT   PORT    ;Control Port
  229.           MVI   A,00H   ;Turn off all the interupts from DART
  230.           OUT   PORT    ;  Topper is all interupt driven
  231. ;
  232.       MVI    A,03H    ;write register 3 of DART
  233.       OUT     PORT    ;
  234.       MVI    A,0C1H    ;rcv 8 bits/char, rcv enable
  235.       OUT    PORT    ; (1100 0001)
  236. ;
  237.       MVI    A,04H    ;write register 4 of DART 
  238.       OUT    PORT    ;contol port
  239.       MVI    A,44H    ;x16, 1 stop bit, no parity
  240.       OUT    PORT    ; (0100 0100)    
  241. ;
  242.       MVI    A,05H    ;write register 5 of DART
  243.       OUT    PORT    ;
  244.       MVI    A,0EAH    ;DTR,8 bits/char, tx enable, rts enable
  245.       OUT    PORT    ; (1110 1010)
  246. ;
  247.       MVI    A,47H    ;counter mode,contol word time constant follows
  248.       CALL  CTCSET      
  249.       MVI    A,40H    ; 
  250.       CALL  CTCSET
  251. ;      
  252.       EI        ;System interupts back on
  253. ;
  254.       RET
  255. ;
  256. ;.....
  257. ; Come here to set up the various Baud rates you require.
  258. SETUPR:      LXI    D,BAUDBUF    ;point to input buffer for INLNCOMP
  259.       CALL    JMP$ILPRT    ;
  260.       DB    'Input Baud Rate (300, 1200, 2400, 4800, 9600, 19200): ',0
  261.       CALL    JMP$INBUF    ;
  262.       LXI    D,BAUDBUF+2    ;
  263.       CALL    JMP$INLNCOMP    ;compare BAUDBUF+2 with characters below
  264.       DB    '300',0        ;
  265.       JNC    B300        ;jump if good match
  266.       CALL    JMP$INLNCOMP    
  267.       DB    '1200',0    ;
  268.       JNC    B1200        ;
  269.       CALL     JMP$INLNCOMP    ;
  270.       DB    '2400',0
  271.       JNC    B2400
  272.       CALL    JMP$INLNCOMP
  273.       DB    '4800',0
  274.       JNC    B4800
  275.       CALL    JMP$INLNCOMP
  276.       DB    '9600',0    ;
  277.       JNC    B9600        ;
  278.       CALL    JMP$INLNCOMP
  279.       DB    '19200',0
  280.       JNC    B19200
  281.       CALL    JMP$ILPRT    ;no matches, tell operator
  282.       DB    LF,'++ Incorrect entry ++',CR,LF,LF,BELL,0
  283.       JMP    SETUPR        ;try it again
  284. ;
  285. ;
  286. B300:      MVI    A,1        ;MSPEED 300 baud value
  287.       STA    MSPEED        
  288.       CALL    DART1        ;set up DART
  289.       MVI    A,40H        ;300 Baud divisor
  290.       CALL  CTCSET
  291.       RET
  292. ;
  293. B1200:      MVI    A,5        ;MSPEED 1200 baud value
  294.       STA    MSPEED        
  295.       CALL    DART        ;set up DART
  296.       MVI    A,40H
  297.       CALL  CTCSET
  298.       RET
  299. ;
  300. B2400:      MVI    A,6        ;MSPEED 2400 baud value
  301.       STA    MSPEED        
  302.       CALL    DART        ;set up DART
  303.       MVI    A,20H
  304.       CALL  CTCSET
  305.       RET
  306. ;
  307. B4800:      MVI    A,7        ;MSPEED 4800 baud value
  308.       STA    MSPEED        
  309.       CALL    DART        ;set up DART
  310.       MVI    A,10H
  311.       CALL  CTCSET
  312.       RET
  313. ;
  314. B9600:      MVI    A,8        ;MSPEED 9600 baud value
  315.       STA    MSPEED        
  316.       CALL  DART        ;set up DART
  317.       MVI    A,08H
  318.       CALL  CTCSET
  319.       RET
  320. ;
  321. B19200:   MVI    A,9        ;MSPEED 19200 baud value
  322.       STA    MSPEED        
  323.       CALL  DART
  324.       MVI    A,04H        ;write register 4
  325.       CALL  CTCSET
  326.       RET
  327. ;
  328. DART:      MVI    A,04H        ;write register 4 DART
  329.       OUT    PORT        ;control port
  330.       MVI    A,44H        ;x16, 1 stop bit, no parity
  331.       JMP   DART2        ;
  332. ;
  333. DART1:      MVI    A,04H        ;write register 4 DART
  334.       OUT    PORT        ;control port
  335.       MVI    A,64H        ;x64
  336. DART2:      OUT    PORT        ;
  337.       MVI    A,47H        ;prescale x16, time constant follows
  338. ;                 control word
  339.       CALL  CTCSET
  340.          RET
  341. ;
  342. CTCSET:      OUT    CTC1        ;set the RX speed
  343. ;
  344.       OUT    CTC2        ;set the TX speed
  345.       RET
  346.  
  347.  
  348. BAUDBUF:  DB    10,0
  349.       DS    10    
  350. ;
  351. ; If using the Hayes Smartmodem this is unavailable without a special
  352. ; change.
  353. ;
  354. SPCLMENU:  RET
  355. ;
  356. ;
  357. ; NOTE:  MUST TERMINATE PRIOR TO 0400H (with Smartmodem)
  358. ;                 0C00H (without Smartmodem)
  359. ;.....
  360. ;
  361.       END
  362. ;
  363.