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 / I2US-1.AZM / I2US-1.ASM
Assembly Source File  |  2000-06-30  |  11KB  |  339 lines

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