home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / simtel / sigm / vols200 / vol274 / i2ss-1.asm < prev    next >
Assembly Source File  |  1994-07-13  |  11KB  |  352 lines

  1.  
  2. ; I2SS-1.ASM - IMP overlay for the CompuPro System Support 1 - 07/17/85
  3. ;
  4. ;        2651 I/O with built-in baudrate generator
  5. ;
  6. ; This overlay adapts IMP.COM to the CompuPro System Support 1 serial
  7. ; card using the 2651 USART.  If using a 6 MHz clock 1-2 wait states may
  8. ; be needed to keep from dropping characters.
  9. ;
  10. ; You will want to look this file over carefully.  There are a number of
  11. ; options that you can use to configure the program to suit your taste.
  12. ;
  13. ; Edit this file for your preferences then follow the "TO USE:" example
  14. ; shown below.
  15. ;
  16. ; Many terminals will clear the screen with a CTL-Z.  If yours does, put
  17. ; a 1AH at CLEAR: (010AH).  Many terminals use two characters, the first
  18. ; normally an ESC.  For example, ESC *.  In this case put '*' at CLEAR:
  19. ; (The ESC will automatically be typed with no CTL-character present.)
  20. ; If you don't know what your terminal uses, put a 0 at CLEAR: and IMP
  21. ; will scroll up 24 blank lines to clear the CRT for things like MENU,
  22. ; looking at the function key table, typing CTL-Z in command mode, etc.
  23. ;
  24. ; Use the "SET" command to change the baudrate when desired.  The value
  25. ; at MSPEED controls the baudrate when the program is first called up.
  26. ;
  27. ;    TO USE: First edit this file filling in answers for your own
  28. ;        equipment.  Then assemble with ASM.COM or equivalent
  29. ;        assembler.  Then use MLOAD to merge into the main file:
  30. ;
  31. ;        MLOAD IMP.COM=IMP.COM,I2CO-x.HEX
  32. ;
  33. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  34. ;
  35. ; 07/17/85 - Written to work with IMP        - Irv Hoff
  36. ;
  37. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  38. ;
  39. ;
  40. YES    EQU    0FFH
  41. NO    EQU    0
  42. ;
  43. ;
  44. PORT    EQU    05CH    ; Your base port (data or status)
  45. MDCTL1    EQU    PORT+1    ; Modem control port
  46. MDDATP    EQU    PORT    ; Modem data port
  47. MDRCV    EQU    02H    ; Modem receive ready
  48. MDSND    EQU    01H    ; Modem send ready bit
  49. MDTXE    EQU    05H    ; Modem send buffer empty, holding buffer empty
  50. ;
  51. ;
  52. ;-----------------------------------------------------------------------
  53. ;
  54. ESC    EQU    '['-40H    ; ^[ = Escape
  55. BELL    EQU    'G'-40H    ; ^G = Bell character
  56. LF    EQU    'J'-40H    ; ^J = Linefeed
  57. NEXTRY    EQU    'K'-40H    ; ^K = Try next phone number, abort this try
  58. CR    EQU    'M'-40H    ; ^M = Carriage return
  59. CLEARSC    EQU    'Z'-40H    ; ^Z = Clears screen, command mode only
  60. EOFCHAR    EQU    'Z'-40H    ; ^Z = End of file
  61. ;
  62. ;
  63. ;-----------------------------------------------------------------------
  64. ;
  65. ;
  66.     ORG    0100H
  67. ;
  68. ;
  69.     DS    3    ; Skip the data area below
  70. ;
  71. ;
  72. ; These routines and equates are at the beginning of the program so
  73. ; they can be patched by a monitor or overlay file without re-assembling
  74. ; the program.
  75. ;
  76. MSPEED:     DB    6    ; 0=110 1=300 2=450 3=600 4=710 5=1200        103H
  77.             ; 6=2400 7=4800 8=9600 9=19200 default
  78. HS2400:     DB    YES    ; Yes=2400 bps highest speed            104H
  79. HS1200:     DB    NO    ; Yes=1200 bps highest speed            105H
  80. RACAL:     DB    NO    ; Yes=Racal-Vadic 1200V or 2400V or 2400PA    106H
  81. PROMODM: DB    NO    ; Yes=Prometheus ProModem 1200 bps        107H
  82. RESVD1:     DB    NO    ; Reserved for special modems            108H
  83. RESVD2:     DB    NO    ; Reserved for special modems            109H
  84. ;
  85. ;
  86. CLEAR:     DB    1AH    ; Clear screen character (ESC not needed)    10AH
  87. CLOCK:     DB    40    ; Clock speed in MHz x10, 25.5 MHz max.     10BH
  88.             ; 20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
  89. BYTDLY:     DB    2    ; 0=0 delay  1=10ms  5=50 ms - 9=90 ms        10CH
  90.             ;   default time to send character in ter-
  91.             ;   minal mode file transfer for slow BBS
  92. CRDLY:     DB    2    ; 0=0 delay 1=100 ms 5=500 ms - 9=900 ms    10DH
  93.             ;   default time for extra wait after CRLF
  94.             ;   in terminal mode file transfer
  95. NOFCOL:     DB    5    ; Number of directory columns shown        10EH
  96. TCHPUL:     DB    'T'    ; T=tone, P=Pulse (Hayes 2400 modems)        10FH
  97. ;.....
  98. ;
  99. ;
  100. ADDLFD:     DB    NO    ; Yes=add LF after CR to send file in terminal    110H
  101.             ;   mode (normally added by remote echo)
  102. CONVRUB: DB    YES    ; Yes=convert rub to backspace            111H
  103. CRCDFLT: DB    YES    ; Yes=default to CRC checking            112H
  104. IGNRCTL: DB    NO    ; Yes=CTL-chars above ^M not displayed        113H
  105. ;.....
  106. ;
  107. ;
  108. EXTCHR:     DB    '['-40H    ; ESC = preceeds local control character    114H
  109. EXITCHR: DB    'E'    ; Exit character                115H
  110. FILESND: DB    'F'    ; Send file when in terminal mode        116H
  111. NOCONCT: DB    'N'    ; Disconnect from phone line            117H
  112. LOGCHR:     DB    'L'    ; Send logon                    118H
  113. LSTCHR:     DB    'P'    ; Toggle printer                119H
  114. UNSAVCH: DB    'R'    ; Close input text buffer            11AH
  115. SAVECHR: DB    'Y'    ; Open input text buffer            11BH
  116. CLEARS:     DB    'Z'    ; Clears screen, terminal mode            11CH
  117. SPARE1:     DB    0    ; For future development            11DH
  118. SPARE2:     DB    0    ; For future development            11EH
  119. ;.....
  120. ;
  121. ;
  122. ; Handles in/out ports for data and status
  123. ;
  124. I$MDCTL1: IN    MDCTL1        ;                    11FH
  125.       RET            ;                    121H
  126.       DB    0,0,0,0,0,0,0    ;                    122H
  127. ;
  128. I$MDTXE:  IN    MDCTL1        ;                    129H
  129.       RET            ;                    12BH
  130.       DB    0,0,0,0,0,0,0    ;                    12CH
  131. ;
  132. I$MDDATP: IN    MDDATP        ;                    133H
  133.       RET            ;                    135H
  134.       DB    0,0,0,0,0,0,0    ;                    136H
  135. ;
  136. O$MDDATP: OUT    MDDATP        ; Out modem data port            13DH
  137.       RET            ;                    13FH
  138.       DB    0,0,0,0,0,0,0    ;                    140H
  139. ;.....
  140. ;
  141. ;
  142. A$MDRCV:  ANI    MDRCV        ;                    147H
  143.       RET            ;                    149H
  144. ;
  145. C$MDRCV:  CPI    MDRCV        ;                    14AH
  146.       RET            ;                    14CH
  147. ;
  148. A$MDSND:  ANI    MDSND        ;                    14DH
  149.       RET            ;                    14FH
  150. ;
  151. C$MDSND:  CPI    MDSND        ;                    150H
  152.       RET            ;                    152H
  153. ;
  154. A$MDTXE:  ANI    MDTXE        ;                    153H
  155.       RET            ;                    155H
  156. ;
  157. C$MDTXE:  CPI    MDTXE        ;                    156H
  158.       RET            ;                    158H
  159. ;.....
  160. ;
  161. ;
  162. ; Special exit vector, used by some computers to reset interrupt vectors
  163. ;
  164. J$EXITVEC:RET            ;                    159H
  165.       DB    0,0        ;                    15AH
  166. ;.....
  167. ;
  168. ;
  169. ; Jump vectors needed by each overlay
  170. ;
  171. J$GOODBYE:JMP    GOODBYE        ; Disconnects modem by dropping DTR    15CH
  172. J$INITMOD:JMP    INITMOD        ; Initializes modem, autosets baudrate    15FH
  173. J$STUPR:  JMP    STUPR        ; SET routine to change baudrate    162H
  174. J$SYSVR:  JMP    SYSVR        ; Signon message            165H
  175. ;.....
  176. ;
  177. ;
  178. ; "AT" command strings, can be replaced in individual overlay if needed
  179. ;
  180. J$STRNGA: DS    3        ; 1200 bps "AT" string            168H
  181. J$STRNG1: DS    3        ; 2400 bps "AT" string            16BH
  182. ;
  183. ;
  184. ; Next fourteen lines should not be changed by user overlay as these go
  185. ; to specific locations in the main program, not in the overlay.
  186. ;
  187. ;
  188. J$CMDSPL: DS    3        ; Allows entry of baudrate on CMD line    16EH
  189. J$CRLF:      DS    3        ; Turns up one new line on display    171H
  190. J$DIAL:      DS    3        ; Start of dialing routine        174H
  191. J$DSCONT: DS    3        ; Terminates modem use            177H
  192. J$GOLST:  DS    3        ; Printer routine, needed by Apple //e    17AH
  193. J$ILPRT:  DS    3        ; Prints an inline string, 0 to end    17DH
  194. J$INBUF:  DS    3        ; Stores a keybd string for comparison    180H
  195. J$INLNCP: DS    3        ; Inline "compare strings" routine    183H
  196. J$INMDM:  DS    3        ; Max .1 sec wait for modem character    186H
  197. J$RCVRSP: DS    3        ; For 3801 I/O use (TV-803)        189H
  198. J$SNDCHR: DS    3        ; Sends a character to the modem    18CH
  199. J$SNDSTR: DS    3        ; Sends a string to the modem, $ to end 18FH
  200. J$TIMER:  DS    3        ; .1 second timer (amount in 'B' reg.)    192H
  201. J$NEW1:      DB    0,0,0        ; For future needs            195H
  202. J$NEW2:      DB    0,0,0        ; For future needs            198H
  203. ;.....
  204. ;
  205. ;
  206. ; For 2400 bps auto-stepdown units
  207. ;
  208. MANUAL:      DB    0        ; For manual selection flag        19BH
  209. J$300:      JMP    OK300        ; Sets baudrate to 300 baud        19CH
  210. J$1200:      JMP    OK1200        ; Sets baudrate to 1200 bps        19FH
  211. J$2400:      JMP    OK2400        ; Sets baudrate to 2400 bps        1A2H
  212. ;.....
  213. ;
  214. ;
  215. LOGPTR:      DW    LOGON        ; Pointer to display LOGON message    1A5H
  216. ;
  217. SYSVR:      CALL    J$ILPRT        ; Display the following line        1A7H
  218.       DB    'Version for CompuPro System Support-1'    ;        1AAH
  219.       DB    CR,LF,0
  220.       RET
  221. ;.....
  222. ;
  223. ;
  224. ;-----------------------------------------------------------------------
  225. ;
  226. ; NOTE:  You can change the SYSVER message to be longer or shorter.  The
  227. ;     end of your last routine should terminate by 0400H (601 bytes
  228. ;     available after start of SYSVER).
  229. ;
  230. ;-----------------------------------------------------------------------
  231. ;
  232. ; You can put in a message at this location which can be called up with
  233. ; (special character-L).  You can put in several lines.  End with a 0.
  234. ;
  235. LOGON:      DB    'Nice chatting with you, bye for now.',CR,LF,0
  236. ;
  237. ;-----------------------------------------------------------------------
  238. ;
  239. ; This routine sets DTR low for 300 ms to disconnect the phone
  240. ;
  241. GOODBYE:
  242.     MVI    B,'S'-40H    ; X-off to stop host if needed
  243.     CALL    J$SNDCHR
  244.     MVI    B,1        ; Wait a moment to let it react
  245.     CALL    J$TIMER
  246.     MVI    A,1DH        ; Set RTS, flags, DTR, break
  247.     OUT    PORT+3        ; Put command register out of mode
  248.     IN    PORT+3        ; Make sure it is now clear
  249.     IN    PORT+3        ; Try once more
  250.     MVI    B,3        ; Turn off DTR for 300 ms
  251.     CALL    J$TIMER
  252.     MVI    A,37H        ; Turn DTR back on
  253.     OUT    PORT+3        ; Send to command register
  254.     RET
  255. ;.....
  256. ;
  257. ;
  258. ; Initializes the 2561 I/O for selected baudrate
  259. ;
  260. INITMOD:
  261.     LDA    MSPEED        ; Get the selected value
  262.     CPI    1        ; 300 bps
  263.     JZ    OK300
  264.     CPI    5        ; 1200 bps
  265.     JZ    OK1200
  266.     CPI    6        ; 2400 bps
  267.     JZ    OK2400
  268.     CPI    8        ; 9600 bps
  269.     JZ    OK9600
  270.     JMP    STUPR1        ; Else ask what is wanted
  271. ;
  272. INITMOD1:
  273.     MVI    A,4EH        ; Select 8 data bits no parity 1 stop
  274.     OUT    PORT+2        ; Send to mode register 1
  275.     MVI    A,B        ; Get the baudrate back
  276.     OUT    PORT+2        ; Send to mode register 2
  277.     MVI    A,37H        ; Turn on DTR etc, reset any error flags
  278.     OUT    PORT+3        ; Send to command register
  279.     IN    PORT+3        ; Clear any incoming characters
  280.     IN    PORT+3        ; Try once more
  281.     RET
  282. ;.....
  283. ;
  284. ;
  285. ; Use the 'SET' command to select a desired baud rate
  286. ;
  287. STUPR:    CALL    J$CMDSPL    ; Gives us CMDBUF+6
  288.     JNC    STUPR2
  289. ;
  290. STUPR1:    CALL    J$ILPRT
  291.     DB    'Input Baud Rate (300, 1200, 2400, 9600): ',0
  292.     LXI    D,BAUDBUF    ; Point to new input buffer
  293.     CALL    J$INBUF
  294.     CALL    J$CRLF
  295.     LXI    D,BAUDBUF+2
  296. ;
  297. STUPR2:    CALL    J$INLNCP    ; Compare BAUDBUF+2 with chars. below
  298.     DB    '300',0
  299.     JNC    OK300        ; Go if got match
  300.     CALL    J$INLNCP
  301.     DB    '1200',0
  302.     JNC    OK1200
  303.     CALL    J$INLNCP
  304.     DB    '2400',0
  305.     JNC    OK2400
  306.     CALL    J$INLNCP
  307.     DB    '9600',0
  308.     JNC    OK9600
  309.     CALL    J$ILPRT        ; All matches failed, tell operator
  310.     DB    '++ Incorrect entry ++',CR,LF,BELL,CR,LF,0
  311.     JMP    STUPR1        ; Try again
  312. ;
  313. OK300:    MVI    A,1        ; MSPEED 300 baud value
  314.     MVI    B,BD300        ; Get 300 baud value for 2651 in 'B'
  315.     JMP    LOADBD        ; Go load everything
  316. ;
  317. OK1200:    MVI    A,5
  318.     MVI    B,BD1200
  319.     JMP    LOADBD
  320. ;
  321. OK2400:    XRA    A
  322.     STA    MANUAL
  323.     MVI    A,6
  324.     MVI    B,BD2400
  325.     JMP    LOADBD
  326. ;
  327. OK9600:    MVI    A,8
  328.     MVI    B,BD9600
  329. ;
  330. LOADBD:    STA    MSPEED        ; Change time-to-send to match baudrate
  331.     JMP    INITMOD1    ; Reset to new baudrate
  332. ;.....
  333. ;
  334. ;
  335. ; Baudrate table
  336. ;
  337. BD300    EQU    35H        ; 300 baud
  338. BD1200    EQU    37H        ; 1200 bps
  339. BD2400    EQU    3AH        ; 2400 bps
  340. BD9600    EQU    3EH        ; 9600 bps
  341. BD19200    EQU    3FH        ; 19200 bps
  342. ;
  343. BAUDBUF:DB    10,0,0,0,0,0
  344.     DB    0,0,0,0,0,0
  345. ;
  346. ;                   end
  347. ;-----------------------------------------------------------------------
  348. ;
  349. ; NOTE: Must terminate prior to 0400H
  350. ;
  351.     END
  352.