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 / IMP / I2CP-2.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  14KB  |  455 lines

  1.  
  2. ; I2CP-2.ASM - Overlay file for the CompuPro Interfacer 3/4 - 06/01/87
  3. ;
  4. ;        2651 I/O with built-in baudrage generator
  5. ;
  6. ; The Interfacer board uses the 2651 I/O.  This has a peculiarity that
  7. ; prevents its proper use if you hook pin 8 (DCD) of the modem to pin 8
  8. ; (DCD) of the Interfacer board.  You should instead hook pin 8 of the
  9. ; modem (DCD) to (DSR) on the Interfacer board.  To further complicate
  10. ; the picture, CompuPro uses an unique wiring they refer to as "master"
  11. ; or "slave setting".  Normally the board is delivered with the serial
  12. ; ports hooked as "slave", which makes (DSR) pin 20 instead of the con-
  13. ; ventional pin 6 as on most RS-232 DB-25 connectors.    It then makes
  14. ; (DTR) pin 6 instead of conventional pin 20.  (See page 14 of the In-
  15. ; terfacer 3 manual or page 20 of the Interfacer 4 manual for additional
  16. ; information on this subject.    The schematic below is shown for both
  17. ; configurations.
  18. ;
  19. ; (For interest, the newer version of the 2561 is called the 2661.  It
  20. ; came out in 1981, but has this same bug the 2651 has.  That chip is
  21. ; used in the Heath/Zenith-100 series computers.  The 2651 has another
  22. ; serious bug, if selecting other than 1 stop pulse, it must receive an
  23. ; incoming signal with the same (or more) stop pulses.    Fortunately few
  24. ; people need 1-1/2 or 2 stop pulses so this bug is rarely a problem.)
  25. ;
  26. ; NOTE FOR HAYES SMARTMODEM USERS:
  27. ; -------------------------------
  28. ;    In the past people using the Hayes Smartmodem 1200 and the
  29. ;    Interfacer board have complained they had to put SW6 up to
  30. ;    use with BYE5 but then had to put it down to use with IMP,
  31. ;    MDM7,MES or other autodial modem programs.  With the con-
  32. ;    figuration below, SW6 can be left in whatever position the
  33. ;    user prefers (up, for BYE5) and this will have no effect on
  34. ;    the normal use of IMP, MEX or MDM7.
  35. ;
  36. ;
  37. ; If using "slave" mode:
  38. ; ---------------------
  39. ;    MODEM=DCE    INTERFACER    (Slave mode)
  40. ;
  41. ;    TXD    2  -->    3    RXD    received data
  42. ;    RXD    3  <--    2    TXD    tranmitted data
  43. ;    SG    7  ---    7    SG    signal ground
  44. ;    DCD    8  -->    20 *    DSR    data set ready (carrier)
  45. ;    DTR    20 <--    6  *    DTR    data terminal ready
  46. ;
  47. ;
  48. ; If using "master" mode
  49. ; ----------------------
  50. ;    MODEM=DCE    INTERFACER    (as Master)
  51. ;
  52. ;    TXD    2  -->    2    RXD    received data
  53. ;    RXD    3  <--    3    TXD    tranmitted data
  54. ;    SG    7  ---    7    SG    signal ground
  55. ;    DCD    8  -->    6    DSR    data set ready (carrier)
  56. ;    DTR    20 <--    20    DTR    data terminal ready
  57. ;
  58. ;                    - Notes by Irv Hoff
  59. ;
  60. ;-----------------------------------------------------------------------
  61. ;
  62. ; This overlay adapts IMP.COM to the CompuPro Interfacer 3/4 serial
  63. ; card using the 2651 USART.  If using a 6 MHz clock 1-2 wait states may
  64. ; be needed to keep from dropping characters.  Note: This overlay can be
  65. ; modified to work with the Apple CPS Multifunction card which uses the
  66. ; same 2651 USART.
  67. ;
  68. ; You will want to look this file over carefully.  There are a number of
  69. ; options that you can use to configure the program to suit your taste.
  70. ;
  71. ; Edit this file for your preferences then follow the "TO USE:" example
  72. ; shown below.
  73. ;
  74. ; Many terminals will clear the screen with a CTL-Z.  If yours does, put
  75. ; a 1AH at CLEAR: (010AH).  Many terminals use two characters, the first
  76. ; normally an ESC.  For example, ESC *.  In this case put '*' at CLEAR:
  77. ; (The ESC will automatically be typed with no CTL-character present.)
  78. ; If you don't know what your terminal uses, put a 0 at CLEAR: and IMP
  79. ; will scroll up 24 blank lines to clear the CRT for things like MENU,
  80. ; looking at the function key table, typing CTL-Z in command mode, etc.
  81. ;
  82. ; Use the "SET" command to change the baudrate when desired.  The value
  83. ; at MSPEED controls the baudrate when the program is first called up.
  84. ;
  85. ;    TO USE: First edit this file filling in answers for your own
  86. ;        equipment.  Then assemble with ASM.COM or equivalent
  87. ;        assembler.  Then use MLOAD to merge into the main file:
  88. ;
  89. ;        MLOAD IMP.COM=IMP.COM,I2CP-x.HEX
  90. ;
  91. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  92. ;
  93. ; 06/01/87  Improved the GOODBYE routine, added BREAK routine, needs
  94. ;        IMP245 to use it.  Added information on wiring the modem
  95. ;        cable            - Irv Hoff
  96. ;
  97. ; 05/07/87  Improved the GOODBYE routine, added information on wiring
  98. ;        the modem cable.        - Irv Hoff
  99. ; 10/27/85  Written to work with IMP    - Irv Hoff
  100. ;
  101. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  102. ;
  103. ;
  104. YES    EQU    0FFH
  105. NO    EQU    0
  106. ;
  107. ;
  108. PORT    EQU    010H    ; Modem data port for Interfacer 3 or 4 cards
  109. MDCTL1    EQU    PORT+1    ; Modem control port
  110. MDDATP    EQU    PORT    ; Modem data port
  111. MDRCV    EQU    02H    ; Modem receive ready
  112. MDSND    EQU    01H    ; Modem send ready bit
  113. MDTXE    EQU    05H    ; Modem send buffer empty, holding buffer empty
  114. CHIP    EQU    6    ; Selects slave mode (users 6 or 7)
  115. UPORT    EQU    PORT+7    ; User select port (6 and 7 are slave mode)
  116. ;
  117. ;
  118. ;-----------------------------------------------------------------------
  119. ;
  120. ESC    EQU    '['-40H    ; ^[ = Escape
  121. BELL    EQU    'G'-40H    ; ^G = Bell character
  122. LF    EQU    'J'-40H    ; ^J = Linefeed
  123. NEXTRY    EQU    'K'-40H    ; ^K = Try next phone number, abort this try
  124. CR    EQU    'M'-40H    ; ^M = Carriage return
  125. CLEARSC    EQU    'Z'-40H    ; ^Z = Clears screen, command mode only
  126. EOFCHAR    EQU    'Z'-40H    ; ^Z = End of file
  127. ;
  128. ;
  129. ;-----------------------------------------------------------------------
  130. ;
  131. ;
  132.     ORG    0100H
  133. ;
  134. ;
  135.     DS    3    ; Skip the data area below
  136. ;
  137. ;
  138. ; These routines and equates are at the beginning of the program so
  139. ; they can be patched by a monitor or overlay file without re-assembling
  140. ; the program.
  141. ;
  142. MSPEED:     DB    5    ; 0=110 1=300 2=450 3=600 4=710 5=1200        103H
  143.             ; 6=2400 7=4800 8=9600 9=19200 default
  144. HS2400:     DB    NO    ; Yes=2400 bps highest speed            104H
  145. HS1200:     DB    YES    ; Yes=1200 bps highest speed            105H
  146. RACAL:     DB    NO    ; Yes=Racal-Vadic 1200V or 2400V or 2400PA    106H
  147. PROMODM: DB    NO    ; Yes=Prometheus ProModem 1200 bps        107H
  148. RESVD1:     DB    NO    ; Reserved for special modems            108H
  149. RESVD2:     DB    NO    ; Reserved for special modems            109H
  150. ;
  151. ;
  152. CLEAR:     DB    1AH    ; Clear screen character (ESC not needed)    10AH
  153. CLOCK:     DB    40    ; Clock speed in MHz x10, 25.5 MHz max.     10BH
  154.             ; 20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
  155. BYTDLY:     DB    2    ; 0=0 delay  1=10ms  5=50 ms - 9=90 ms        10CH
  156.             ;   default time to send character in ter-
  157.             ;   minal mode file transfer for slow BBS
  158. CRDLY:     DB    2    ; 0=0 delay 1=100 ms 5=500 ms - 9=900 ms    10DH
  159.             ;   default time for extra wait after CRLF
  160.             ;   in terminal mode file transfer
  161. NOFCOL:     DB    5    ; Number of directory columns shown        10EH
  162. TCHPUL:     DB    'T'    ; T=tone, P=Pulse (Hayes 2400 modems)        10FH
  163. ;.....
  164. ;
  165. ;
  166. ADDLFD:     DB    NO    ; Yes=add LF after CR to send file in terminal    110H
  167.             ;   mode (normally added by remote echo)
  168. CONVRUB: DB    YES    ; Yes=convert rub to backspace            111H
  169. CRCDFLT: DB    YES    ; Yes=default to CRC checking            112H
  170. IGNRCTL: DB    YES    ; Yes=CTL-chars above ^M not displayed        113H
  171. ;.....
  172. ;
  173. ;
  174. EXTCHR:     DB    '['-40H    ; ESC = preceeds local control character    114H
  175. EXITCHR: DB    'E'    ; Exit character                115H
  176. FILESND: DB    'F'    ; Send file when in terminal mode        116H
  177. NOCONCT: DB    'N'    ; Disconnect from phone line            117H
  178. LOGCHR:     DB    'L'    ; Send logon                    118H
  179. LSTCHR:     DB    'P'    ; Toggle printer                119H
  180. UNSAVCH: DB    'R'    ; Close input text buffer            11AH
  181. SAVECHR: DB    'Y'    ; Open input text buffer            11BH
  182. CLEARS:     DB    'Z'    ; Clears screen, terminal mode            11CH
  183. BRKCHR:     DB    'Q'    ; Send a break tone                11DH
  184. NODTR:     DB    NO    ; YES if no DTR and need ATH0 to disconnect    11EH
  185. ;.....
  186. ;
  187. ;
  188. ; Handles in/out ports for data and status
  189. ;
  190. I$MDCTL1: MVI    A,CHIP        ; Select correct user port        11FH
  191.       OUT    UPORT        ;                    121H
  192.       IN    MDCTL1        ;                    123H
  193.       RET            ;                    125H
  194.       DB    0,0,0        ;                    126H
  195. ;
  196. I$MDTXE:  MVI    A,CHIP        ; Select correct user port        129H
  197.       OUT    UPORT        ;                    12BH
  198.       IN    MDCTL1        ;                    12DH
  199.       RET            ;                    12FH
  200.       DB    0,0,0        ;                    130H
  201. ;
  202. I$MDDATP: MVI    A,CHIP        ; Select the correct port        133H
  203.       OUT    UPORT        ;                    135H
  204.       IN    MDDATP        ;                    137H
  205.       RET            ;                    139H
  206.       DB    0,0,0        ;                    13AH
  207. ;
  208. O$MDDATP: PUSH    PSW        ;                    13DH
  209.       MVI    A,CHIP        ;                    13EH
  210.       OUT    UPORT        ;                    140H
  211.       POP    PSW        ;                    142H
  212.       OUT    MDDATP        ; Out modem data port            143H
  213.       RET            ;                    145H
  214.       DB    0        ;                    146H
  215. ;.....
  216. ;
  217. ;
  218. A$MDRCV:  ANI    MDRCV        ;                    147H
  219.       RET            ;                    149H
  220. ;
  221. C$MDRCV:  CPI    MDRCV        ;                    14AH
  222.       RET            ;                    14CH
  223. ;
  224. A$MDSND:  ANI    MDSND        ;                    14DH
  225.       RET            ;                    14FH
  226. ;
  227. C$MDSND:  CPI    MDSND        ;                    150H
  228.       RET            ;                    152H
  229. ;
  230. A$MDTXE:  ANI    MDTXE        ;                    153H
  231.       RET            ;                    155H
  232. ;
  233. C$MDTXE:  CPI    MDTXE        ;                    156H
  234.       RET            ;                    158H
  235. ;.....
  236. ;
  237. ;
  238. ; Special exit vector, used by some computers to reset interrupt vectors
  239. ;
  240. J$EXITVEC:RET            ;                    159H
  241.       DB    0,0        ;                    15AH
  242. ;.....
  243. ;
  244. ;
  245. ; Jump vectors needed by each overlay
  246. ;
  247. J$GOODBYE:JMP    GOODBYE        ; Disconnects modem by dropping DTR    15CH
  248. J$INITMOD:JMP    INITMOD        ; Initializes modem, autosets baudrate    15FH
  249. J$STUPR:  JMP    STUPR        ; SET routine to change baudrate    162H
  250. J$SYSVR:  JMP    SYSVR        ; Signon message            165H
  251. ;.....
  252. ;
  253. ;
  254. ; "AT" command strings, can be replaced in individual overlay if needed
  255. ;
  256. J$STRNGA: DS    3        ; 1200 bps "AT" string            168H
  257. J$STRNG1: DS    3        ; 2400 bps "AT" string            16BH
  258. ;
  259. ;
  260. ; Next fourteen lines should not be changed by user overlay as these go
  261. ; to specific locations in the main program, not in the overlay.
  262. ;
  263. ;
  264. J$CMDSPL: DS    3        ; Allows entry of baudrate on CMD line    16EH
  265. J$CRLF:      DS    3        ; Turns up one new line on display    171H
  266. J$DIAL:      DS    3        ; Start of dialing routine        174H
  267. J$DSCONT: DS    3        ; Terminates modem use            177H
  268. J$GOLST:  DS    3        ; Printer routine, needed by Apple //e    17AH
  269. J$ILPRT:  DS    3        ; Prints an inline string, 0 to end    17DH
  270. J$INBUF:  DS    3        ; Stores a keybd string for comparison    180H
  271. J$INLNCP: DS    3        ; Inline "compare strings" routine    183H
  272. J$INMDM:  DS    3        ; Max .1 sec wait for modem character    186H
  273. J$RCVRSP: DS    3        ; For 3801 I/O use (TV-803)        189H
  274. J$SNDCHR: DS    3        ; Sends a character to the modem    18CH
  275. J$SNDSTR: DS    3        ; Sends a string to the modem, $ to end 18FH
  276. J$TIMER:  DS    3        ; .1 second timer (amount in 'B' reg.)    192H
  277. J$BREAK:  JMP    SENDBRK        ; Break routine             195H
  278. J$NEW2:      DB    0,0,0        ; For future needs            198H
  279. ;.....
  280. ;
  281. ;
  282. ; For 2400 bps auto-stepdown units
  283. ;
  284. MANUAL:      DB    0        ; For manual selection flag        19BH
  285. J$300:      JMP    OK300        ; Sets baudrate to 300 baud        19CH
  286. J$1200:      JMP    OK1200        ; Sets baudrate to 1200 bps        19FH
  287. J$2400:      JMP    OK2400        ; Sets baudrate to 2400 bps        1A2H
  288. ;.....
  289. ;
  290. ;
  291. LOGPTR:      DW    LOGON        ; Pointer to display LOGON message    1A5H
  292. ;
  293. SYSVR:      CALL    J$ILPRT        ; Display the following line        1A7H
  294.       DB    'Version for CompuPro Interfacer-3 or 4 ' ;        1AAH
  295.       DB    '(port ',CHIP+'0',')',CR,LF,0
  296.       RET
  297. ;.....
  298. ;
  299. ;
  300. ;-----------------------------------------------------------------------
  301. ;
  302. ; NOTE:  You can change the SYSVER message to be longer or shorter.  The
  303. ;     end of your last routine should terminate by 0400H (601 bytes
  304. ;     available after start of SYSVER).
  305. ;
  306. ;-----------------------------------------------------------------------
  307. ;
  308. ; You can put in a message at this location which can be called up with
  309. ; (special character-L).  You can put in several lines.  End with a 0.
  310. ;
  311. LOGON:      DB    'Nice chatting with you, bye for now.',CR,LF,0
  312. ;
  313. ;-----------------------------------------------------------------------
  314. ;
  315. ; This routine sets a 300 ms break tone
  316. ;
  317. SENDBRK:
  318.     MVI    A,3FH        ; DTR normal, send break tone
  319.     JMP    GOODBYE1
  320. ;.....
  321. ;
  322. ;
  323. ; This routine sets DTR low for 300 ms to disconnect the phone
  324. ;
  325. GOODBYE:
  326.     MVI    A,CHIP        ;select chip
  327.     OUT    UPORT
  328.     MVI    A,1DH        ; Set RTS, flags, DTR, break
  329. ;
  330. GOODBYE1:
  331.     OUT    PORT+3        ; Put command register out of mode
  332.     IN    PORT+3        ; Make sure it is now clear
  333.     IN    PORT+3        ; Try once more
  334.     MVI    B,3        ; Turn off DTR for 300 ms
  335.     CALL    J$TIMER
  336.     MVI    A,37H        ; Turn DTR back on
  337.     OUT    PORT+3        ; Send to command register
  338.     IN    PORT+3        ; Clear any incoming characters
  339.     IN    PORT+3        ; Try once more
  340.     XRA    A        ; Clear the 'A' register
  341.     RET
  342. ;.....
  343. ;
  344. ;
  345. ; Initializes the 2561 I/O for selected baudrate
  346. ;
  347. INITMOD:
  348.     LDA    MSPEED        ; Get the selected value
  349.     CPI    1        ; 300 bps
  350.     JZ    OK300
  351.     CPI    5        ; 1200 bps
  352.     JZ    OK1200
  353.     CPI    6        ; 2400 bps
  354.     JZ    OK2400
  355.     CPI    8        ; 9600
  356.     JZ    OK9600
  357.     CPI    9
  358.     JZ    OK19200        ; 19200 BPS
  359.     JMP    STUPR1        ; Else ask what is wanted
  360. ;
  361. INITMOD1:
  362.     MVI    A,CHIP        ; Select correct user port
  363.     OUT    UPORT
  364.     XRA    A        ; Set RTS, flags, DTR, disable R/T
  365.     OUT    PORT+3        ; Put command register out of mode
  366.     IN    PORT+3        ; Makes sure it is now clear
  367.     IN    PORT+3        ; Try once more
  368.     MVI    A,4EH        ; Select 8 data bits no parity 1 stop
  369.     OUT    PORT+2        ; Send to mode register 1
  370.     MOV    A,B        ; Get the baudrate back
  371.     OUT    PORT+2        ; Send to mode register 2
  372.     MVI    A,37H        ; Turn on DTR etc, reset any error flags
  373.     OUT    PORT+3        ; Send to command register
  374.     IN    PORT+3        ; Clear any incoming characters
  375.     IN    PORT+3        ; Try once more
  376.     RET
  377. ;.....
  378. ;
  379. ;
  380. ; Use the 'SET' command to select a desired baud rate
  381. ;
  382. STUPR:    CALL    J$CMDSPL    ; Gives us CMDBUF+6
  383.     JNC    STUPR2
  384. ;
  385. STUPR1:    CALL    J$ILPRT
  386.     DB    'Input Baud Rate (300, 1200, '
  387.     DB    '2400, 9600, 19200): ',0
  388.     LXI    D,BAUDBUF    ; Point to new input buffer
  389.     CALL    J$INBUF
  390.     CALL    J$CRLF
  391.     LXI    D,BAUDBUF+2
  392. ;
  393. STUPR2:    CALL    J$INLNCP    ; Compare BAUDBUF+2 with chars. below
  394.     DB    '300',0
  395.     JNC    OK300        ; Go if got match
  396.     CALL    J$INLNCP
  397.     DB    '1200',0
  398.     JNC    OK1200
  399.     CALL    J$INLNCP
  400.     DB    '2400',0
  401.     JNC    OK2400
  402.     CALL    J$INLNCP
  403.     DB    '9600',0
  404.     JNC    OK9600
  405.     CALL    J$INLNCP
  406.     DB    '19200',0
  407.     JNC    OK19200
  408.     CALL    J$ILPRT        ; All matches failed, tell operator
  409.     DB    '++ Incorrect entry ++',CR,LF,BELL,CR,LF,0
  410.     JMP    STUPR1        ; Try again
  411. ;
  412. OK300:    MVI    A,1        ; MSPEED 300 baud value
  413.     MVI    B,BD300        ; Get 300 baud value for 2651 in 'B'
  414.     JMP    LOADBD        ; Go load everything
  415. ;
  416. OK1200:    MVI    A,5
  417.     MVI    B,BD1200
  418.     JMP    LOADBD
  419. ;
  420. OK2400:    XRA    A
  421.     STA    MANUAL
  422.     MVI    A,6
  423.     MVI    B,BD2400
  424.     JMP    LOADBD
  425. ;
  426. OK9600:    MVI    A,8
  427.     MVI    B,BD9600
  428.     JMP    LOADBD
  429. ;
  430. OK19200:MVI    A,9
  431.     MVI    B,BD19200
  432. ;
  433. LOADBD:    STA    MSPEED        ; Change time-to-send to match baudrate
  434.     JMP    INITMOD1    ; Reinitialize to new baudrate, done
  435. ;.....
  436. ;
  437. ;
  438. ; Table of baudrate parameters
  439. ;
  440. BD300    EQU    35H        ; 300 baud
  441. BD1200    EQU    37H        ; 1200 bps
  442. BD2400    EQU    3AH        ; 2400 bps
  443. BD9600    EQU    3EH        ; 9600 bps
  444. BD19200    EQU    3FH        ; 19200 bps
  445. ;
  446. BAUDBUF:DB    10,0,0,0,0,0
  447.     DB    0,0,0,0,0,0
  448. ;
  449. ;                   end
  450. ;-----------------------------------------------------------------------
  451. ;
  452. ; NOTE: Must terminate prior to 0400H
  453. ;
  454.     END
  455.