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

  1.  
  2. ; I2CC-4.ASM - CCS 1100, 2719 or 2830 overlay file for IMP - 06/01/87
  3. ;
  4. ;            Z80 DART AND 8430 CTC TIMER
  5. ;            (Uses 4.000 mhz clock and
  6. ;            on-board 3.6864 MHz clock.)
  7. ;
  8. ; The CCS 2830 uses only the master system clock (4.0 MHz).
  9. ;
  10. ; This file adapts an S-100 computer using a CCS 2719 parallel/serial or
  11. ; CCS2830 board to the modem program.  The CCS 1100 is also available.
  12. ;
  13. ; You can use either Port A or Port B for the modem serial port.  The
  14. ; values for both ports are shown, set for whichever port you prefer by
  15. ; changing the "PORTA" equate.
  16. ;
  17. ; The CTC timer uses the master system clock (4.0 MHz) for the "Timer
  18. ; mode" (07H command byte).  It uses the 3.6864 MHz xtal on the CCS 2719
  19. ; board in the "counter mode" (47H command word.)  Your divisor values
  20. ; for the various speeds would be configured accordingly.
  21. ;
  22. ;
  23. ; NOTE:  Check the clear screen and clear to end of line values as they
  24. ;     differ from what you use.  Insert the appropriate values if so.
  25. ;
  26. ;-----------------------------------------------------------------------
  27. ;
  28. ; You will want to look this file over carefully. There are a number of
  29. ; options that you can use to configure the program to suit your taste.
  30. ;
  31. ; Edit this file for your preferences then follow the "TO USE:" example
  32. ; shown below.
  33. ;
  34. ; Many terminals will clear the screen with a CTL-Z.  If yours does, put
  35. ; a 1AH at CLEAR: (010AH).  Many terminals use two characters, the first
  36. ; normally an ESC.  For example, ESC *.  In this case put '*' at CLEAR:
  37. ; (The ESC will automatically be typed with no CTL-character present.)
  38. ; If you don't know what your terminal uses, put a 0 at CLEAR: and IMP
  39. ; will scroll up 24 blank lines to clear the CRT for things like MENU,
  40. ; looking at the function key table, typing CTL-Z in command mode, etc.
  41. ;
  42. ; Use the "SET" command to change the baudrate when desired.  The value
  43. ; at MSPEED controls the baudrate when the program is first called up.
  44. ;
  45. ;    TO USE: First edit this file filling in answers for your own
  46. ;        equipment.  Then assemble with ASM.COM or equivalent
  47. ;        assembler.  Then use MLOAD to merge the results
  48. ;        of this program to the original .COM file:
  49. ;
  50. ;        A>MLOAD IMP.COM=IMP.COM,I2CC-x.HEX
  51. ;
  52. ;
  53. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  54. ;
  55. ; 06/01/87  Improved the GOODBYE routine, added BREAK routine, needs
  56. ;        IMP245 to use it.            - Irv Hoff
  57. ;
  58. ; 03/27/87  Added choice for the CCS 1100 computer.  Uses divide by 32.
  59. ;                        - Irv Hoff
  60. ;
  61. ; 10/27/85  Restored baud rates to those normally used with this equip-
  62. ;        ment.  If others are needed, install those on an individual
  63. ;        basis, please.  Other incidental changes.
  64. ;                        - Irv Hoff
  65. ; 10/17/85  Added baud rates, and equates    - Fred Townsend
  66. ; 07/17/85  Written for use with IMP        - Irv Hoff
  67. ;
  68. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  69. ;
  70. YES    EQU    0FFH
  71. NO    EQU    0
  72. ;
  73. ;
  74. ; Select one of the following:
  75. ;
  76. CCS1100    EQU    NO
  77. CCS2719    EQU    NO
  78. CCS2830    EQU    YES
  79. ;
  80. ;
  81. ; Values shown are for a Z80 Dart and CTC counter/timer
  82. ;
  83. ;-----------------------------------------------------------------------
  84. ;
  85.      IF    CCS1100
  86. PORT    EQU    02H    ; Your base data port
  87. BRPORT    EQU    0AH    ; Baud rate control port (CTC)
  88.      ENDIF        ; CCS2830
  89. ;
  90. ;-----------------------------------------------------------------------
  91. ;
  92. ; NOTE:  Port A is 54H (CTC timer 50H), Port B is 56H (CTC timer 51H)
  93. ;
  94. PORTA    EQU    YES    ;Yes = Port A, No = Port B (Used on 2719 only)
  95. ;
  96.      IF    CCS2719    AND PORTA
  97. PORT    EQU    54H    ; Your base data port (port A)
  98. BRPORT    EQU    50H    ; Baud rate control port (CTC)
  99.      ENDIF        ; CCS2719 AND PORTA
  100. ;
  101.      IF    CCS2719    AND NOT    PORTA
  102. PORT    EQU    56H    ; Your base data port (port B)
  103. BRPORT    EQU    51H    ; Baud rate control port (CTC)
  104.      ENDIF        ; CCS2719 AND NOT PORTA
  105. ;
  106. ;-----------------------------------------------------------------------
  107. ;
  108. ; NOTE:  The CCS2830 has numerous ports available, insert correct pair
  109. ;
  110.      IF    CCS2830
  111. PORT    EQU    0C4H    ; Your base data port
  112. BRPORT    EQU    0C0H    ; Baud rate control port (CTC)
  113.      ENDIF        ; CCS2830
  114. ;
  115. ;-----------------------------------------------------------------------
  116. ;
  117. ; Common equates
  118. ;
  119. MDCTL1    EQU    PORT+1    ; Modem control port
  120. MDDATP    EQU    PORT    ; Modem data port
  121. MDRCV    EQU    01H    ; Modem receive ready
  122. MDSND    EQU    04H    ; Modem send ready bit
  123. MDTXE    EQU    01H    ; Modem send buffer empty, holding buffer empty
  124. ;
  125. ;
  126. ;-----------------------------------------------------------------------
  127. ;
  128. ESC    EQU    '['-40H    ; ^[ = Escape
  129. BELL    EQU    'G'-40H    ; ^G = Bell character
  130. LF    EQU    'J'-40H    ; ^J = Linefeed
  131. NEXTRY    EQU    'K'-40H    ; ^K = Try next phone number, abort this try
  132. CR    EQU    'M'-40H    ; ^M = Carriage return
  133. CLEARSC    EQU    'Z'-40H    ; ^Z = Clears screen, command mode only
  134. EOFCHAR    EQU    'Z'-40H    ; ^Z = End of file
  135. ;
  136. ;
  137. ;-----------------------------------------------------------------------
  138. ;
  139. ;
  140.     ORG    0100H
  141. ;
  142. ;
  143.     DS    3    ; Skip the data area below
  144. ;
  145. ;
  146. ; These routines and equates are at the beginning of the program so
  147. ; they can be patched by a monitor or overlay file without re-assembling
  148. ; the program.
  149. ;
  150. MSPEED:     DB    5    ; 0=110 1=300 2=450 3=600 4=710 5=1200        103H
  151.             ; 6=2400 7=4800 8=9600 9=19200 default
  152. HS2400:     DB    NO    ; Yes=2400 bps highest speed            104H
  153. HS1200:     DB    YES    ; Yes=1200 bps highest speed            105H
  154. RACAL:     DB    NO    ; Yes=Racal-Vadic 1200V or 2400V or 2400PA    106H
  155. PROMODM: DB    NO    ; Yes=Prometheus ProModem 1200 bps        107H
  156. RESVD1:     DB    NO    ; Reserved for special modems            108H
  157. RESVD2:     DB    NO    ; Reserved for special modems            109H
  158. ;
  159. ;
  160. CLEAR:     DB    0CH    ; Clear screen character (ESC not needed)    10AH
  161. CLOCK:     DB    40    ; Clock speed in MHz x10, 25.5 MHz max.     10BH
  162.             ; 20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
  163. BYTDLY:     DB    2    ; 0=0 delay  1=10ms  5=50 ms - 9=90 ms        10CH
  164.             ;   default time to send character in ter-
  165.             ;   minal mode file transfer for slow BBS
  166. CRDLY:     DB    2    ; 0=0 delay 1=100 ms 5=500 ms - 9=900 ms    10DH
  167.             ;   default time for extra wait after CRLF
  168.             ;   in terminal mode file transfer
  169. NOFCOL:     DB    5    ; Number of directory columns shown        10EH
  170. TCHPUL:     DB    'T'    ; T=tone, P=Pulse (Hayes 2400 modems)        10FH
  171. ;.....
  172. ;
  173. ;
  174. ADDLFD:     DB    NO    ; Yes=add LF after CR to send file in terminal    110H
  175.             ;   mode (normally added by remote echo)
  176. CONVRUB: DB    YES    ; Yes=convert rub to backspace            111H
  177. CRCDFLT: DB    YES    ; Yes=default to CRC checking            112H
  178. IGNRCTL: DB    YES    ; Yes=CTL-chars above ^M not displayed        113H
  179. ;.....
  180. ;
  181. ;
  182. EXTCHR:     DB    '['-40H    ; ESC = preceeds local control character    114H
  183. EXITCHR: DB    'E'    ; Exit character                115H
  184. FILESND: DB    'F'    ; Send file when in terminal mode        116H
  185. NOCONCT: DB    'N'    ; Disconnect from phone line            117H
  186. LOGCHR:     DB    'L'    ; Send logon                    118H
  187. LSTCHR:     DB    'P'    ; Toggle printer                119H
  188. UNSAVCH: DB    'R'    ; Close input text buffer            11AH
  189. SAVECHR: DB    'Y'    ; Open input text buffer            11BH
  190. CLEARS:     DB    'Z'    ; Clears screen, terminal mode            11CH
  191. BRKCHR:     DB    'Q'    ; Send a break tone                11DH
  192. NODTR:     DB    NO    ; YES if no DTR and need ATH0 to disconnect    11EH
  193. ;.....
  194. ;
  195. ;
  196. ; Handles in/out ports for data and status
  197. ;
  198. I$MDCTL1: MVI    A,10H        ; Register 0, reset interrupts        11FH
  199.       OUT    MDCTL1        ;                    121H
  200.       IN    MDCTL1        ;                    123H
  201.       RET            ; IN modem control port         125H
  202.       DB    0,0,0        ; Spares if needed            126H
  203. ;
  204. I$MDTXE:  MVI    A,11H        ; Select read register 1        129H
  205.       OUT    MDCTL1        ;                    12BH
  206.       IN    MDCTL1        ;                    12DH
  207.       RET            ;                    12FH
  208.       DB    0,0,0        ;                    130H
  209. ;
  210. I$MDDATP: IN    MDDATP        ;                    133H
  211.       RET            ;                    135H
  212.       DB    0,0,0,0,0,0,0    ; Spares if needed            136H
  213. ;
  214. O$MDDATP: OUT    MDDATP        ;                    13DH
  215.       RET            ; OUT modem data port            13FH
  216.       DB    0,0,0,0,0,0,0    ; Spares if needed            140H
  217. ;.....
  218. ;
  219. ;
  220. A$MDRCV:  ANI    MDRCV        ;                    147H
  221.       RET            ;                    149H
  222. ;
  223. C$MDRCV:  CPI    MDRCV        ;                    14AH
  224.       RET            ;                    14CH
  225. ;
  226. A$MDSND:  ANI    MDSND        ;                    14DH
  227.       RET            ;                    14FH
  228. ;
  229. C$MDSND:  CPI    MDSND        ;                    150H
  230.       RET            ;                    152H
  231. ;
  232. A$MDTXE:  ANI    MDTXE        ;                    153H
  233.       RET            ;                    155H
  234. ;
  235. C$MDTXE:  CPI    MDTXE        ;                    156H
  236.       RET            ;                    158H
  237. ;.....
  238. ;
  239. ;
  240. ; Special exit vector, used by some computers to reset interrupt vectors
  241. ;
  242. J$EXITVEC:RET            ;                    159H
  243.       DB    0,0        ;                    15AH
  244. ;.....
  245. ;
  246. ;
  247. ; Jump vectors needed by each overlay
  248. ;
  249. J$GOODBYE:JMP    GOODBYE        ; Disconnects modem by dropping DTR    15CH
  250. J$INITMOD:JMP    INITMOD        ; Initializes modem, autosets baudrate    15FH
  251. J$STUPR:  JMP    STUPR        ; SET routine to change baudrate    162H
  252. J$SYSVR:  JMP    SYSVR        ; Signon message            165H
  253. ;.....
  254. ;
  255. ;
  256. ; "AT" command strings, can be replaced in individual overlay if needed
  257. ;
  258. J$STRNGA: DS    3        ; 1200 bps "AT" string            168H
  259. J$STRNG1: DS    3        ; 2400 bps "AT" string            16BH
  260. ;
  261. ;
  262. ; Next fourteen lines should not be changed by user overlay as these go
  263. ; to specific locations in the main program, not in the overlay.
  264. ;
  265. ;
  266. J$CMDSPL: DS    3        ; Allows entry of baudrate on CMD line    16EH
  267. J$CRLF:      DS    3        ; Turns up one new line on display    171H
  268. J$DIAL:      DS    3        ; Start of dialing routine        174H
  269. J$DSCONT: DS    3        ; Terminates modem use            177H
  270. J$GOLST:  DS    3        ; Printer routine, needed by Apple //e    17AH
  271. J$ILPRT:  DS    3        ; Prints an inline string, 0 to end    17DH
  272. J$INBUF:  DS    3        ; Stores a keybd string for comparison    180H
  273. J$INLNCP: DS    3        ; Inline "compare strings" routine    183H
  274. J$INMDM:  DS    3        ; Max .1 sec wait for modem character    186H
  275. J$RCVRSP: DS    3        ; For 3801 I/O use (TV-803)        189H
  276. J$SNDCHR: DS    3        ; Sends a character to the modem    18CH
  277. J$SNDSTR: DS    3        ; Sends a string to the modem, $ to end 18FH
  278. J$TIMER:  DS    3        ; .1 second timer (amount in 'B' reg.)    192H
  279. J$BREAK:  JMP    SENDBRK        ; Break routine             195H
  280. J$NEW2:      DB    0,0,0        ; For future needs            198H
  281. ;.....
  282. ;
  283. ;
  284. ; For 2400 bps auto-stepdown units
  285. ;
  286. MANUAL:      DB    0        ; For manual selection flag        19BH
  287. J$300:      JMP    OK300        ; Sets baudrate to 300 baud        19CH
  288. J$1200:      JMP    OK1200        ; Sets baudrate to 1200 bps        19FH
  289. J$2400:      JMP    OK2400        ; Sets baudrate to 2400 bps        1A2H
  290. ;.....
  291. ;
  292. ;
  293. LOGPTR:      DW    LOGON        ; Pointer to display LOGON message    1A5H
  294. ;
  295. SYSVR:      CALL    J$ILPRT        ; Display the following line        1A7H
  296. ;
  297.        IF    CCS1100
  298.       DB    'Version for CCS 1100 serial port 02h'    ;        1AAH
  299.        ENDIF        ; CCS1100
  300. ;
  301.        IF    CCS2719
  302.       DB    'Version for CCS 2719 serial port 5 ' ;         1AAH
  303.        ENDIF        ; CCS2719
  304. ;
  305.        IF    CCS2719    AND PORTA
  306.       DB    '4'
  307.        ENDIF        ; CCS2719 AND PORTA
  308. ;
  309.        IF    CCS2719    AND NOT    PORTA
  310.       DB    '6'
  311.        ENDIF        ; CCS2719 AND NOT PORTA
  312. ;
  313. ;
  314.        IF    CCS2830
  315.       DB    'Version for CCS 2830 serial port 0C4h'    ;        1AAH
  316.        ENDIF        ; CCS2830
  317. ;
  318.       DB    CR,LF,0
  319.       RET
  320. ;.....
  321. ;
  322. ;
  323. ;-----------------------------------------------------------------------
  324. ;
  325. ; NOTE:  You can change the SYSVER message to be longer or shorter.  The
  326. ;     end of your last routine should terminate by 0400H (601 bytes
  327. ;     available after start of SYSVER).
  328. ;
  329. ;-----------------------------------------------------------------------
  330. ;
  331. ; You can put in a message at this location which can be called up with
  332. ; (special character-L).  You can put in several lines.  End with a 0.
  333. ;
  334. LOGON:    DB    'This is a CCS computer system ',CR,LF,0
  335. ;
  336. ;-----------------------------------------------------------------------
  337. ;
  338. ; This routine sets a 300 ms break tone
  339. ;
  340. SENDBRK:
  341.     MVI    A,5
  342.     OUT    MDCTL1        ; Send to the status port
  343.     MVI    A,0F8H        ; DTR normal, send break tone
  344.     JMP    GOODBYE1    ; Go send the break tone
  345. ;.....
  346. ;
  347. ;
  348. ; This routine sets DTR low for 300 ms to disconnect the modem.
  349. ;
  350. GOODBYE:
  351.     MVI    A,5
  352.     OUT    MDCTL1        ; Send to the status port
  353.     MVI    A,78H        ; Turn off DTR and send break tone
  354. ;
  355. GOODBYE1:
  356.     OUT    MDCTL1
  357.     MVI    B,3        ; Delay 300 ms
  358.     CALL    J$TIMER
  359.     MVI    A,5
  360.     OUT    MDCTL1
  361.     MVI    A,0E8H        ; Restore normal, 8 bits, DTR on, etc.
  362.     OUT    MDCTL1
  363.     RET
  364. ;.....
  365. ;
  366. ;
  367. ; Sets CTC for baud rate.
  368. ;
  369. INITMOD:
  370.     MVI    A,0        ; Select register
  371.     OUT    MDCTL1        ; Send to the status port
  372.     MVI    A,18H        ; Reset the Z8SIO chip
  373.     OUT    MDCTL1        ; Send to the status port
  374.     MVI    A,4        ; Select register
  375.     OUT    MDCTL1        ; Send to the status port
  376.     MVI    A,44H        ; 16x, 1-stop, no parity (1=44, 2=4C)
  377.     OUT    MDCTL1        ; Send to the status port
  378.     MVI    A,3        ; Select register
  379.     OUT    MDCTL1        ; Send to the status port
  380.     MVI    A,0C1H        ; Enable receive section
  381.     OUT    MDCTL1        ; Send to the status port
  382.     MVI    A,5        ; Select register
  383.     OUT    MDCTL1        ; Send to the status port
  384.     MVI    A,0EAH        ; DTR, RTS, 8-bits, enable send section
  385.     OUT    MDCTL1        ; Send to the status port
  386. ;
  387.     LDA    MSPEED        ; Get the selected value
  388.     CPI    1        ; 300 bps
  389.     JZ    OK300
  390.     CPI    5        ; 1200 bps
  391.     JZ    OK1200
  392.     CPI    6        ; 2400 bps
  393.     JZ    OK2400
  394.     CPI    8        ; 9600 bps
  395.     JZ    OK9600
  396. ;
  397.      IF    CCS1100    OR CCS2719
  398.     CPI    9
  399.     JZ    OK19200
  400.      ENDIF            ; CCS1100 OR CCS2719
  401. ;
  402.     JMP    STUPR1        ; Else ask what is wanted
  403. ;.....
  404. ;
  405. ;
  406. STUPR:    CALL    J$CMDSPL    ; Gives us CMDBUF+6
  407.     JNC    STUPR2
  408. ;
  409. STUPR1:    LXI    D,BAUDBUF    ; Point to new input buffer
  410.     CALL    J$ILPRT
  411.     DB    'Input Baud Rate (300, 1200, 2400, 9600'
  412. ;
  413.      IF    CCS1100    OR CCS2719
  414.     DB    ' 19200'
  415.      ENDIF            ; CCS1100 OR CCS2719
  416. ;
  417.     DB    '): ',0
  418.     LXI    D,BAUDBUF    ; Point to new input buffer
  419.     CALL    J$INBUF
  420.     CALL    J$CRLF
  421.     LXI    D,BAUDBUF+2
  422. ;
  423. STUPR2:    CALL    J$INLNCP    ; Compare BAUDBUF+2 with chars. below
  424.     DB    '300',0
  425.     JNC    OK300        ; Go if got match
  426.     CALL    J$INLNCP
  427.     DB    '1200',0
  428.     JNC    OK1200
  429.     CALL    J$INLNCP
  430.     DB    '2400',0
  431.     JNC    OK2400
  432.     CALL    J$INLNCP
  433.     DB    '9600',0
  434.     JNC    OK9600
  435. ;
  436.      IF    CCS1100    OR CCS2719
  437.     CALL    J$INLNCP
  438.     DB    '9600',0
  439.     JNC    OK9600
  440.      ENDIF            ; CCS1100 OR CCS2719
  441. ;
  442.     CALL    J$ILPRT        ; All matches failed, tell operator
  443.     DB    '++ Incorrect entry ++',CR,LF,BELL,CR,LF,0
  444.     JMP    STUPR1        ; Try again
  445. ;
  446. OK300:    MVI    A,1        ; MSPEED 300 baud value
  447.     LXI    H,BD300        ; Get 300 bps parameters in 'HL'
  448.     JMP    LOADBD        ; Go load them
  449. ;
  450. OK1200:    MVI    A,5
  451.     LXI    H,BD1200
  452.     JMP    LOADBD
  453. ;
  454. OK2400:    XRA    A
  455.     STA    MANUAL        ; Reset to maximum auto-speed
  456.     MVI    A,6
  457.     LXI    H,BD2400
  458.     JMP    LOADBD
  459. ;
  460. OK9600:    MVI    A,8
  461.     LXI    H,BD9600
  462.     JMP    LOADBD
  463. ;
  464.      IF    CCS1100    OR CCS2719
  465. OK19200:MVI    A,9
  466.     LXI    H,BD19200
  467.      ENDIF            ; CCS1100 OR CCS2719
  468. ;
  469. LOADBD:    STA    MSPEED        ; Change time-to-send to match baudrate
  470.     MOV    A,H        ; CTC command word
  471.     OUT    BRPORT
  472.     MOV    A,L        ; Baudrate
  473.     OUT    BRPORT
  474.     RET
  475. ;.....
  476. ;
  477. ;
  478. ; TABLE OF BAUD RATE PARAMETERS
  479. ;
  480. ; Note:  For the CCS1100, all baudrates use the 4.0 MHz xtal on both the
  481. ;     timer part of the CTC and the counter part of the CTC.
  482. ;
  483.      IF    CCS1100
  484. BD300    EQU    0720H        ; 9600/300 (first half is CTC command)
  485. BD1200    EQU    4740H        ; 76800/1200
  486. BD2400    EQU    4720H        ; 76800/2400
  487. BD9600    EQU    4708H        ; 76800/9600
  488. BD19200    EQU    4704H        ; 76800/9600
  489.      ENDIF            ; CCS1100
  490. ;
  491. ;
  492. ; Note:  For the CCS2719, 300 baud uses the 4.000 MHz xtal on the timer
  493. ;     part of the CTC, while the other speeds use a 1.8432 MHz on the
  494. ;     serial board for the counter part of the CTC.
  495. ;
  496.      IF    CCS2719
  497. BD300    EQU    0734H        ; 15600/300 (first half is CTC command)
  498. BD1200    EQU    4760H        ; 115200/1200
  499. BD2400    EQU    4730H        ; 115200/2400
  500. BD9600    EQU    470CH        ; 115200/9600
  501. BD19200    EQU    4706H        ; 115200/19200
  502.      ENDIF            ; CCS2719
  503. ;
  504. ;
  505. ; Note:  For the CCS2830, all baudrates use the 4.0 MHz xtal on both the
  506. ;     timer part of the CTC and the counter part of the CTC.
  507. ;
  508.      IF    CCS2830
  509. BD300    EQU    0734H        ; 15600/300 (first half is CTC command)
  510. BD1200    EQU    4768H        ; 124800/1200
  511. BD2400    EQU    4734H        ; 124800/2400
  512. BD9600    EQU    470DH        ; 124800/9600
  513.      ENDIF            ; CCS2830
  514. ;
  515. ;
  516. BAUDBUF:DB    10,0,0,0,0,0
  517.     DB    0,0,0,0,0,0
  518. ;
  519. ;                   end
  520. ;-----------------------------------------------------------------------
  521. ;
  522. ; NOTE: Must terminate prior to 0400H
  523. ;
  524.     END
  525.