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 / M7H82661.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  10KB  |  344 lines

  1. ;MDM overlay for the H/Z89 running CP/M 2.204 with the Z-89-11 card installed
  2. ;This overlay sould work, but I have not tested it..
  3. ;Equates for enhanced programmable communication interface chip 2661-3.
  4. ;Port Displacements.
  5. ;        EQU    0        data
  6. ;        EQU    1        status
  7. ;        EQU    1        syn1/syn2/dle
  8. ;        EQU    2        mode
  9. ;        EQU    3        command
  10. ;
  11. ;Status Registers
  12. ;        EQU    00000001b    transmitter ready
  13. ;        EQU    00000010b    receiver ready
  14. ;        EQU    00000100b    transmitter empty
  15. ;        EQU    00000100b    data set change
  16. ;        EQU    00001000b    parity error
  17. ;        EQU    00010000b    overrun error
  18. ;        EQU    00100000b    frame error
  19. ;        EQU    00100000b    sync detected
  20. ;        EQU    01000000b    data carrier detect
  21. ;        EQU    10000000b    data set ready
  22. ;
  23. ;Mode Register 1
  24. ;        EQU    00000011b    mode and baudrate factor
  25. ;        EQU    000h        synchronous 1x rate
  26. ;        EQU    001h        asynchronous 1x rate
  27. ;        EQU    002h        asynchronous 16x rate
  28. ;        EQU    003h        asynchronous 64x rate
  29. ;
  30. ;        EQU    00001100b    character length
  31. ;        EQU    000h        length 5
  32. ;        EQU    004h        length 6
  33. ;        EQU    008h        length 7
  34. ;        EQU    00Ch        length 8
  35. ;        EQU    00010000b    Parity control (0=disabled, 1=enabled)
  36. ;        EQU    00100000b    parity type (0=odd, 1=even)
  37. ;
  38. ;        EQU    11000000b    asynchronous stop bit length
  39. ;        EQU    040h        length 1
  40. ;        EQU    080h        length 1.5
  41. ;        EQU    0C0h        length 2
  42. ;
  43. ;        EQU    01000000b    synchronous transparency control
  44. ;                    (0=normal, 1=transparent)
  45. ;        EQU    10000000b    number of sync characters
  46. ;                    (0=double, 1=single)
  47. ;
  48. ;Mode Register 2
  49. ;        EQU    00001111b    baud rate selection
  50. ;        EQU    11110000b    see text
  51. ;
  52. ;Command Register
  53. ;        EQU    00000001b    transmitter enable
  54. ;        EQU    00000010b    data terminal ready
  55. ;        EQU    00000100b    receiver enable
  56. ;        EQU    00001000b    send break (async)
  57. ;        EQU    00001000b    send dle (sync)
  58. ;        EQU    00010000b    reset status errors
  59. ;        EQU    00100000b    request to send
  60. ;
  61. ;        EQU    11000000b    operating mode
  62. ;        EQU    000h        normal
  63. ;        EQU    040h        mode1
  64. ;        EQU    080h        local loop back
  65. ;        EQU    0C0h        remote loop back
  66. ;
  67. ;BAUDRATE SELECTION VALUES
  68. ;
  69. ;        EQU    0        50
  70. ;        EQU    1        75
  71. ;        EQU    2        110
  72. ;        EQU    3        134.5
  73. ;        EQU    4        150
  74. ;        EQU    5        300
  75. ;        EQU    6        600
  76. ;        EQU    7        1200
  77. ;        EQU    8        1800
  78. ;        EQU    9        2000
  79. ;        EQU    10        2400
  80. ;        EQU    11        3600
  81. ;        EQU    12        4800
  82. ;        EQU    13        7200
  83. ;        EQU    14        9600
  84. ;        EQU    15        19200
  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. YES:        EQU    0FFH
  93. NO:        EQU    0
  94. ;
  95. ;
  96. MODDATP:    EQU    0D8H        ;data port for H/Z89
  97. MODCTL1:    EQU    MODDATP+1    ;status port for H/Z89
  98. MODRCVB:    EQU    2        ;bit to test for received data
  99. MODRCVR:    EQU    2        ;modem receive ready
  100. MODSNDB:    EQU    1        ;bit to test for ready to send
  101. MODSNDR:    EQU    1        ;modem send ready bit
  102. ;
  103. ;
  104.         ORG    100H
  105. ;
  106.         DS    3    ;(for  "JMP   START" instruction)
  107. ;
  108. PMMIMODEM:    DB    NO    ;yes=PMMI S-100 Modem            
  109. SMARTMODEM:    DB    YES    ;yes=HAYES Smartmodem, no=non-Hayes    
  110. TOUCHPULSE:    DB    'T'    ;T=touch, P=pulse (Smartmodem-only)    
  111. CLOCK:        DB    20    ;clock speed in MHz x10, 25.5 MHz max.    
  112.                 ;20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
  113. MSPEED:        DB    1    ;0=110 1=300 2=450 3=600 4=710 5=1200    
  114.                 ;6=2400 7=4800 8=9600 9=19200 default
  115. BYTDLY:        DB    5    ;0=0 delay  1=10ms  5=50 ms - 9=90 ms    
  116.                 ;default time to send character in ter-
  117.                 ;minal mode file transfer for slow BBS.
  118. CRDLY:        DB    5    ;0=0 delay 1=100 ms 5=500 ms - 9=900 ms 
  119.                 ;default time for extra wait after CRLF
  120.                 ;in terminal mode file transfer
  121. NOOFCOL:    DB    5    ;number of DIR columns shown        
  122. SETUPTST:    DB    YES    ;yes=user-added Setup routine    
  123. SCRNTEST:    DB    YES    ;Cursor control routine         
  124. ACKNAK:        DB    YES    ;yes=resend a record after any non-ACK    
  125.                 ;no=resend a record after a valid NAK
  126. BAKUPBYTE:    DB    NO    ;yes=change any file same name to .BAK    
  127. CRCDFLT:    DB    YES    ;yes=default to CRC checking        
  128. TOGGLECRC:    DB    YES    ;yes=allow toggling of CRC to Checksum    
  129. CONVBKSP:    DB    NO    ;yes=convert backspace to rub        
  130. TOGGLEBK:    DB    NO    ;yes=allow toggling of bksp to rub    
  131. ADDLF:        DB    NO    ;no=no LF after CR to send file in    
  132.                 ;terminal mode (added by remote echo)
  133. TOGGLELF:    DB    YES    ;yes=allow toggling of LF after CR    
  134. TRANLOGON:    DB    YES    ;yes=allow transmission of logon    
  135.                 ;write logon sequence at location LOGON
  136. SAVCCP:        DB    YES    ;yes=do not overwrite CCP        
  137. LOCONEXTCHR:    DB    NO    ;yes=local command if EXTCHR precedes    
  138.                 ;no=external command if EXTCHR precedes
  139. TOGGLELOC:    DB    YES    ;yes=allow toggling of LOCONEXTCHR    
  140. LSTTST:        DB    YES    ;yes=printer available on printer port    
  141. XOFFTST:    DB    NO    ;yes=checks for XOFF from remote while    
  142.                 ;sending a file in terminal mode
  143. XONWAIT:    DB    NO    ;yes=wait for XON after CR while    
  144.                 ;sending a file in terminal mode
  145. TOGXOFF:    DB    YES    ;yes=allow toggling of XOFF checking    
  146. IGNORCTL:    DB    YES    ;yes=CTL-chars above ^M not displayed    
  147. EXTRA1:        DB    0    ;for future expansion        
  148. EXTRA2:        DB    0    ;for future expansion            
  149. BRKCHR:        DB    '@'-40H    ;^@ = Send a 300 ms. break tone        
  150. NOCONNCT:    DB    'N'-40H    ;^N = Disconnect from the phone line    
  151. LOGCHR:        DB    'L'-40H    ;^L = Send logon            
  152. LSTCHR:        DB    'P'-40H    ;^P = Toggle printer            
  153. UNSAVE:        DB    'R'-40H    ;^R = Close input text buffer        
  154. TRANCHR:    DB    'T'-40H ;^T = Transmit file to remote        
  155. SAVECHR:    DB    'Y'-40H    ;^Y = Open input text buffer        
  156. EXTCHR:        DB    '^'-40H    ;^^ = Send next character        
  157. ;
  158. ;
  159.         DS    2        ;                
  160. ;
  161. IN$MODCTL1:    IN    MODCTL1 ! RET    ;in modem control port        
  162.         DS    7
  163. OUT$MODDATP:    OUT    MODDATP ! RET    ;out modem data port        
  164.         DS    7
  165. IN$MODDATP:    IN    MODDATP ! RET    ;in modem data port        
  166.         DS    31
  167. ;
  168. LOGONPTR:    DW    LOGON        ;for user message.        
  169.         DS    6        ;                
  170. JMP$GOODBYE:    JMP    GOODBYE        ;                
  171. JMP$INITMOD:    JMP    INITMOD        ;go to user written routine    
  172.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    
  173.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    
  174.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    
  175. JMP$SETUPR:    JMP    SETUPR        ;                
  176. JMP$SPCLMENU:    JMP    SPCLMENU    ;                
  177. JMP$SYSVER:    JMP    SYSVER        ;                
  178. JMP$BREAK:    JMP    SENDBRK        ;                
  179. ;
  180. ;
  181. ; Do not change the following six lines.
  182. ;
  183. JMP$ILPRT:    DS    3        ;                
  184. JMP$INBUF    DS    3        ;                
  185. JMP$INLNCOMP:    DS    3        ;                
  186. JMP$INMODEM    DS    3        ;                
  187. JMP$NXTSCRN:    DS    3        ;                
  188. JMP$TIMER:    DS    3        ;                
  189. ;
  190. ;
  191. CLREOS:        CALL    JMP$ILPRT    ;                
  192.         DB    ESC,'J',0,0,0    ;                
  193.         RET            ;                
  194. ;
  195. CLRSCRN:    CALL    JMP$ILPRT    ;                
  196.         DB    ESC,'E',0,0,0    ;CLEAR ENTIRE SCREEN        
  197.         RET            ;                
  198. ;
  199. ;
  200. SYSVER:        CALL    JMP$ILPRT    ;                
  201.         DB    'Version for Zenith Z-89-11'
  202.         DB    CR,LF,0
  203.         DB    RET
  204. ;.....
  205. ;
  206. ;
  207. ;-----------------------------------------------------------------------
  208. ;
  209. ; NOTE:  You can change the SYSVER message to be longer or shorter.  The
  210. ;     end of your last routine should terminate by 0400H (601 bytes
  211. ;     available after start of SYSVER) if using the Hayes Smartmodem
  212. ;     or by address 0C00H (2659 bytes available) otherwise.
  213. ;
  214. ;-----------------------------------------------------------------------
  215. ;
  216. ; You can put in a message at this location which can be called up with
  217. ; CTL-O if TRANLOGON has been set YES.    You can put in several lines if
  218. ; desired.  End with a 0.
  219. ;
  220. LOGON:      DB    'Hello from a Heath H/Z-89 computer',CR,LF,0
  221. ;.....
  222. ;    
  223. ;
  224. ; This routine allows a 300 ms. break tone to be send to reset some
  225. ; time-share computers.
  226. ;
  227. SENDBRK:  MVI    A,1DH        ;SEND A BREAK TONE FOR 300 MS.
  228.       JMP    GOODBYE1
  229. ;.....
  230. ;
  231. ;
  232. ; This routine sends a 300 ms. break tone and sets DTR low for the same
  233. ; length of time to disconnect some modems such as the Bell 212A, etc.
  234. ;
  235. GOODBYE:  MVI    A,05H        ;SET BREAK, DTR LOW
  236. ;
  237. GOODBYE1: OUT    MODDATP+3    ;PUT COMMAND REGISTER OUT OF MODE
  238.       IN    MODDATP+3    ;MAKE SURE IT IS NOW CLEAR
  239.       IN    MODDATP+3    ;TRY ONCE MORE
  240.       MVI    B,3        ;DELAY FOR 300 MS.
  241.       CALL    JMP$TIMER
  242.       MVI    A,37H        ;RESET RTS, FLAGS, DTR LOW, ENABLE R/T
  243.       OUT    MODDATP+3    ;SEND TO COMMAND REGISTER
  244.       IN    MODDATP+3    ;CLEAR ANY INCOMING CHARS.
  245.       IN    MODDATP+3    ;TRY ONCE MORE
  246.       XRA    A        ;CLEAR THE 'A' REG.
  247.       RET
  248. ;.....
  249. ;
  250. ;
  251. ; The following are used in setting up the 2661-3 I/O port.
  252. ;
  253. INITMOD:  MVI    A,1        ;DEFAULT TRANSFER TIME TO 300 BAUD
  254.       STA    MSPEED
  255.       XRA    A        ;SET RTS, FLAGS, DTR, DISABLE R/T
  256.       OUT    MODDATP+3    ;PUT COMMAND REGISTER OUT OF MODE
  257.       IN    MODDATP+3    ;MAKE SURE IT IS NOW CLEAR
  258.       IN    MODDATP+3    ;TRY ONCE MORE
  259.       MVI    A,4EH        ;1 STOP, NO PARITY, 8 BITS, 16X ASYNCH
  260.       OUT    MODDATP+2    ;SEND TO MODE REGISTER 1
  261. ;
  262. INITMOD1: MVI    A,0F5H        ;START WITH 300 BAUD, 
  263.       OUT    MODDATP+2    ;SEND TO MODE REGISTER 2
  264.       MVI    A,37H        ;RESET RTS, FLAGS, DTR LOW, ENABLE R/T
  265.       OUT    MODDATP+3    ;SEND TO COMMAND REGISTER
  266.       IN    MODDATP+3    ;CLEAR ANY INCOMING CHARS.
  267.       IN    MODDATP+3    ;TRY ONCE MORE
  268.       XRA    A        ;CLEAR THE 'A' REG.
  269.       RET
  270. ;.....
  271. ;
  272. ;
  273. ; The following changes the baud rate with the SET command.
  274. ;
  275. SETUPR:      LXI    D,BAUDBUF
  276.       CALL    JMP$ILPRT
  277.       DB    'Input Baud Rate (110, 300, 1200, 9600): ',0
  278.       CALL    JMP$INBUF
  279.       LXI    D,BAUDBUF+2
  280.       CALL    JMP$INLNCOMP
  281.       DB    '110',0
  282.       JNC    OK110
  283.       CALL    JMP$INLNCOMP    ;COMPARE BAUDBUF+2 WITH CHARACTERS BELOW
  284.       DB    '300',0
  285.       JNC    OK300        ;GO IF GOT MATCH
  286.       CALL    JMP$INLNCOMP
  287.       DB    '1200',0
  288.       JNC    OK1200
  289.       CALL    JMP$INLNCOMP
  290.       DB    '9600',0
  291.       JNC    OK9600
  292.       CALL    JMP$ILPRT    ;ALL MATCHES FAILED, ASK AGAIN
  293.       DB    '++ Incorrect entry ++',CR,LF,BELL,0
  294.       JMP    SETUPR        ;TRY AGAIN
  295. ;
  296. OK110:      MVI    A,0        ;MSPEED 110 BAUD VALUE
  297.       LHLD    BD110        ;GET 110 BAUD PARAMETERS IN 'HL'
  298.       JMP    LOADBD        ;GO LOAD THEM
  299. ;
  300. OK300:      MVI    A,1
  301.       LHLD    BD300
  302.       JMP    LOADBD
  303. ;
  304. OK1200:      MVI    A,5
  305.       LHLD    BD1200
  306.       JMP    LOADBD
  307. ;
  308. OK9600:      MVI    A,8
  309.       LHLD    BD9600
  310. ;
  311. LOADBD:      STA    INITMOD+1
  312.       MOV    A,L        ;get least significant baud rate byte
  313.       STA    INITMOD1+1    ;store in INITMOD1
  314.       JMP    INITMOD        ;reset 2661
  315. ;.....
  316. ;
  317. ;
  318. ; TABLE OF BAUDRATE PARAMETERS FOR 2661 I/O
  319. ;
  320. BD110:      DW    00F2H
  321. BD300:      DW    00F5H
  322. BD1200:      DW    00F7H
  323. BD9600:      DW    00FEH
  324. ;
  325. BAUDBUF:  DB    10,0
  326.       DS    10
  327. ;
  328. ;-----------------------------------------------------------------------
  329. ;
  330. ; The following routine could be used to display selections of interest
  331. ; to owners of this computer.  If using the Hayes Smartmodem this is
  332. ; unavailable without a special change.
  333. ;
  334. SPCLMENU: RET
  335. ;
  336. ;-----------------------------------------------------------------------
  337. ;
  338. ;
  339. ; NOTE:  MUST TERMINATE PRIOR TO 0400H (with Smartmodem)
  340. ;                 0C00H (without Smartmodem)
  341. ;
  342.       END
  343. ;
  344.