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 / I2TS-2.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  13KB  |  393 lines

  1.  
  2. ; I2TS-2.ASM - IMP overlay for AERCO RP/M with Clifford & Assc. Z-SI/O
  3. ;                            06/01/87
  4. ;        USES 8251A I/O (no baudrate generator)
  5. ;
  6. ;
  7. ; Taken from I2NH-1.ASM for N* Horizon and adapted for the Timex Sin-
  8. ; clair 2068 - AERCO Disk I/F with RP/M - Z-SI/O AERCO version of the
  9. ; the Z-SI/O RS-232C card.
  10. ;
  11. ; Can also be used with the 2050 modem card converted for RS-232C ser-
  12. ; vice.  This overlay will not work with the stock WC-2050 modem.
  13. ;
  14. ;   NOTE: You CAN use the 'stock' WC-2050 modem for communications
  15. ;      at 300 baud onlt.  You must dial the phone manually, then
  16. ;      connect the 2050 to the phone circuit.  Or you can place
  17. ;      a switch in the 2050's 9v. line to turn the modem on and
  18. ;      off between calls.  (A sloppy way of doing it but every-
  19. ;      body has a 2050 in the closet.)
  20. ;
  21. ; To gain the full potential that IMP can offer, build or buy a RS-232C
  22. ; interface and get a Hayes, Avatek or other modem that is supported by
  23. ; this overlay and get connected.
  24. ;                    - Notes by Dave Clifford Sysop
  25. ;                      The TIME<X>CHANGE MBBS-RCP/M
  26. ;                      (213) 329-3922
  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. ; This file adapts Timex Sinclair 2068 w/AERCO RP/M system and Clifford
  31. ; & Associates Z-SI/O card to IMP.
  32. ;
  33. ; Edit this file for your preferences then follow the "TO USE:" example
  34. ; shown below.
  35. ;
  36. ; Many terminals will clear the screen with a CTL-Z.  If yours does, put
  37. ; a 1AH at CLEAR: (010AH).  Many terminals use two characters, the first
  38. ; normally an ESC.  For example, ESC *.  In this case put '*' at CLEAR:
  39. ; (The ESC will automatically be typed with no CTL-character present.)
  40. ; If you don't know what your terminal uses, put a 0 at CLEAR: and IMP
  41. ; will scroll up 24 blank lines to clear the CRT for things like MENU,
  42. ; looking at the function key table, typing CTL-Z in command mode, etc.
  43. ;
  44. ; Use the "SET" command to change the baudrate when desired.  The value
  45. ; at MSPEED controls the baudrate when the program is first called up.
  46. ;
  47. ;    TO USE: First edit this file filling in answers for your own
  48. ;        equipment.  Then assemble with ASM.COM or equivalent
  49. ;        assembler.  Then use MLOAD to merge into the main file:
  50. ;
  51. ;        MLOAD IMP.COM=IMP.COM,I2TS-1.HEX
  52. ;
  53. ;                    - Notes by Irv Hoff W6FFC
  54. ;
  55. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  56. ;
  57. ; 06/01/87  Improved the GOODBYE routine, added BREAK routine, needs
  58. ;        IMP245 to use it.            - Irv Hoff
  59. ;
  60. ; 12/11/86  Adapted for the Timex Sinclair computer.
  61. ;                        - Dave Clifford
  62. ; 09/03/85  Written to work with IMP        - Irv Hoff
  63. ;
  64. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  65. ;
  66. YES    EQU    0FFH
  67. NO    EQU    0
  68. ;
  69. ;
  70. ; Values shown are for the AERCO version Z-SI/O Card
  71. ; For JLO-DISK version change PORT to 0D7H and MDCTL1 to 0DFH
  72. ; For 2050 change PORT to 73H and MDCTL1 to 77H
  73. ;
  74. PORT    EQU    73H    ; Your base port (data or status)
  75. MDCTL1    EQU    77H    ; Modem control port
  76. MDDATP    EQU    PORT    ; Modem data port
  77. MDRCV    EQU    02H    ; Modem receive ready
  78. MDSND    EQU    01H    ; Modem send ready bit
  79. MDTXE    EQU    05H    ; Modem send buffer empty, holding buffer empty
  80. ;
  81. ;
  82. MDMODE    EQU    82H    ; Insures 8251 is out of mode with DTR high
  83. MDRSET    EQU    42H    ; Resets USART for additional commands
  84. MDSET1    EQU    4EH    ; 1 stop bit, no parity, 8 bits, x16
  85. MDSET2    EQU    0CEH    ; 2 stop bits, no parity, 8 bits, x16
  86. MDCOM    EQU    17H    ; Reset error flags, RCV, DTR, TX ready
  87. ;
  88. ;
  89. ;-----------------------------------------------------------------------
  90. ;
  91. ESC    EQU    '['-40H    ; ^[ = Escape
  92. BELL    EQU    'G'-40H    ; ^G = Bell character
  93. LF    EQU    'J'-40H    ; ^J = Linefeed
  94. NEXTRY    EQU    'K'-40H    ; ^K = Try next phone number, abort this try
  95. CR    EQU    'M'-40H    ; ^M = Carriage return
  96. CLEARSC    EQU    'Z'-40H    ; ^Z = Clears screen, command mode only
  97. EOFCHAR    EQU    'Z'-40H    ; ^Z = End of file
  98. ;
  99. ;
  100. ;-----------------------------------------------------------------------
  101. ;
  102. ;
  103.     ORG    0100H
  104. ;
  105. ;
  106.     DS    3        ; Skip the data area below
  107. ;
  108. ;
  109. ; These routines and equates are at the beginning of the program so
  110. ; they can be patched by a monitor or overlay file without re-assembling
  111. ; the program.
  112. ;
  113. MSPEED:     DB    1    ; 0=110 1=300 2=450 3=600 4=710 5=1200        103H
  114.             ; 6=2400 7=4800 8=9600 9=19200 default
  115. HS2400:     DB    NO    ; Yes=2400 bps highest speed            104H
  116. HS1200:     DB    YES    ; Yes=1200 bps highest speed            105H
  117. RACAL:     DB    NO    ; Yes=Racal-Vadic 1200V or 2400V or 2400PA    106H
  118. PROMODM: DB    NO    ; Yes=Prometheus ProModem 1200 bps        107H
  119. RESVD1:     DB    NO    ; Reserved for special modems            108H
  120. RESVD2:     DB    NO    ; Reserved for special modems            109H
  121. ;
  122. ;
  123. CLEAR:     DB    0    ; Clear screen character (ESC not needed)    10AH
  124. CLOCK:     DB    37    ; Clock speed in MHz x10, 25.5 MHz max.     10BH
  125.             ; 20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
  126. BYTDLY:     DB    2    ; 0=0 delay  1=10ms  5=50 ms - 9=90 ms        10CH
  127.             ;   default time to send character in ter-
  128.             ;   minal mode file transfer for slow BBS
  129. CRDLY:     DB    2    ; 0=0 delay 1=100 ms 5=500 ms - 9=900 ms    10DH
  130.             ;   default time for extra wait after CRLF
  131.             ;   in terminal mode file transfer
  132. NOFCOL:     DB    5    ; Number of directory columns shown        10EH
  133. TCHPUL:     DB    'T'    ; T=tone, P=Pulse (Hayes 2400 modems)        10FH
  134. ;.....
  135. ;
  136. ;
  137. ADDLFD:     DB    NO    ; Yes=add LF after CR to send file in terminal    110H
  138.             ;   mode (normally added by remote echo)
  139. CONVRUB: DB    YES    ; Yes=convert rub to backspace            111H
  140. CRCDFLT: DB    YES    ; Yes=default to CRC checking            112H
  141. IGNRCTL: DB    YES    ; Yes=CTL-chars above ^M not displayed        113H
  142. ;.....
  143. ;
  144. ;
  145. EXTCHR:     DB    '['-40H    ; ESC = preceeds local control character    114H
  146. EXITCHR: DB    'E'    ; Exit character                115H
  147. FILESND: DB    'F'    ; Send file when in terminal mode        116H
  148. NOCONCT: DB    'N'    ; Disconnect from phone line            117H
  149. LOGCHR:     DB    'L'    ; Send logon                    118H
  150. LSTCHR:     DB    'P'    ; Toggle printer                119H
  151. UNSAVCH: DB    'R'    ; Close input text buffer            11AH
  152. SAVECHR: DB    'Y'    ; Open input text buffer            11BH
  153. CLEARS:     DB    'Z'    ; Clears screen, terminal mode            11CH
  154. BRKCHR:     DB    'Q'    ; Send a break tone                11DH
  155. NODTR:     DB    NO    ; YES if no DTR and need ATH0 to disconnect    11EH
  156. ;.....
  157. ;
  158. ;
  159. ; Handles in/out ports for data and status
  160. ;
  161. I$MDCTL1: IN    MDCTL1        ;                    11FH
  162.       RET            ; IN modem control port         121H
  163.       DB    0,0,0,0,0,0,0    ; Spares if needed            122H
  164. ;
  165. I$MDTXE:  IN    MDCTL1        ; (Needed for SIO or DART register 1    129H
  166.       RET            ;                    12BH
  167.       DB    0,0,0,0,0,0,0    ;                    12CH
  168. ;
  169. I$MDDATP: MVI    A,37H        ;                    133H
  170.       OUT    MDCTL1        ;                    135H
  171.       IN    MDDATP        ;                    137H
  172.       RET            ;                    139H
  173.       DB    0,0,0        ; Spares if needed            13AH
  174. ;
  175. O$MDDATP: OUT    MDDATP        ;                    13DH
  176.       RET            ; OUT modem data port            13FH
  177.       DB    0,0,0,0,0,0,0    ; Spares if needed            140H
  178. ;.....
  179. ;
  180. ;
  181. A$MDRCV:  ANI    MDRCV        ;                    147H
  182.       RET            ;                    149H
  183. ;
  184. C$MDRCV:  CPI    MDRCV        ;                    14AH
  185.       RET            ;                    14CH
  186. ;
  187. A$MDSND:  ANI    MDSND        ;                    14DH
  188.       RET            ;                    14FH
  189. ;
  190. C$MDSND:  CPI    MDSND        ;                    150H
  191.       RET            ;                    152H
  192. ;
  193. A$MDTXE:  ANI    MDTXE        ;                    153H
  194.       RET            ;                    155H
  195. ;
  196. C$MDTXE:  CPI    MDTXE        ;                    156H
  197.       RET            ;                    158H
  198. ;.....
  199. ;
  200. ;
  201. ; Special exit vector, used by some computers to reset interrupt vectors
  202. ;
  203. J$EXITVEC:RET            ;                    159H
  204.       DB    0,0        ;                    15AH
  205. ;.....
  206. ;
  207. ;
  208. ; Jump vectors needed by each overlay
  209. ;
  210. J$GOODBYE:JMP    GOODBYE        ; Disconnects modem by dropping DTR    15CH
  211. J$INITMOD:JMP    INITMOD        ; Initializes modem, autosets baudrate    15FH
  212. J$STUPR:  JMP    STUPR        ; SET routine to change baudrate    162H
  213. J$SYSVR:  JMP    SYSVR        ; Signon message            165H
  214. ;.....
  215. ;
  216. ;
  217. ; "AT" command strings, can be replaced in individual overlay if needed
  218. ;
  219. J$STRNGA: DS    3        ; 1200 bps "AT" string            168H
  220. J$STRNG1: DS    3        ; 2400 bps "AT" string            16B:IMP
  221. ;
  222. ;
  223. ; Next fourteen lines should not be changed by user overlay as these go
  224. ; to specific locations in the main program, not in the overlay.
  225. ;
  226. ;
  227. J$CMDSPL: DS    3        ; Allows entry of baudrate on CMD line    16EH
  228. J$CRLF:      DS    3        ; Turns up one new line on display    171H
  229. J$DIAL:      DS    3        ; Start of dialing routine        174H
  230. J$DSCONT: DS    3        ; Terminates modem use            177H
  231. J$GOLST:  DS    3        ; Printer routine, needed by Apple //e    17AH
  232. J$ILPRT:  DS    3        ; Prints an inline string, 0 to end    17DH
  233. J$INBUF:  DS    3        ; Stores a keybd string for comparison    180H
  234. J$INLNCP: DS    3        ; Inline "compare strings" routine    183H
  235. J$INMDM:  DS    3        ; Max .1 sec wait for modem character    186H
  236. J$RCVRSP: DS    3        ; For 3801 I/O use (TV-803)        189H
  237. J$SNDCHR: DS    3        ; Sends a character to the modem    18CH
  238. J$SNDSTR: DS    3        ; Sends a string to the modem, $ to end 18FH
  239. J$TIMER:  DS    3        ; .1 second timer (amount in 'B' reg.)    192H
  240. J$BREAK:  JMP    SENDBRK        ; Break routine             195H
  241. J$NEW2:      DB    0,0,0        ; For future needs            198H
  242. ;.....
  243. ;
  244. ;
  245. ; For 2400 bps auto-stepdown units
  246. ;
  247. MANUAL:      DB    0        ; For manual selection flag        19BH
  248. J$300:      JMP    OK300        ; Sets baudrate to 300 baud        19CH
  249. J$1200:      JMP    OK1200        ; Sets baudrate to 1200 bps        19FH
  250. J$2400:      JMP    OK2400        ; Sets baudrate to 2400 bps        1A2H
  251. ;.....
  252. ;
  253. ;
  254. LOGPTR:      DW    LOGON        ; Pointer to display LOGON message    1A5H
  255. ;
  256. SYSVR:      CALL    J$ILPRT        ; Display the following line        1A7H
  257.       DB    'Version for AERCO & Z-SI/O Card at port 73H/77H' ;    1AAH
  258.       DB    CR,LF,0
  259.       RET
  260. ;.....
  261. ;
  262. ;
  263. ;-----------------------------------------------------------------------
  264. ;
  265. ; NOTE:  You can change the SYSVER message to be longer or shorter.  The
  266. ;     end of your last routine should terminate by 0400H (601 bytes
  267. ;     available after start of SYSVER).
  268. ;
  269. ;-----------------------------------------------------------------------
  270. ;
  271. ; You can put in a message at this location which can be called up with
  272. ; (special character-L).  You can put in several lines.  End with a 0.
  273. ;
  274. ; You can put an auto-log on for an MBBS type board like this...
  275. ;        'Firstname;Lastname;PASSWORD'
  276. ;
  277. LOGON:    DB    'Hello from a Timex/SINCLAIR 2068 computer...'
  278.     DB    CR,LF,0
  279. ;
  280. ;-----------------------------------------------------------------------
  281. ;
  282. ; This routine sets a 300 ms break tone
  283. ;
  284. SENDBRK:
  285.     MVI    A,3FH        ; DTR normal, send break tone
  286.     JMP    GOODBYE+2
  287. ;.....
  288. ;
  289. ;
  290. ; This routine sets DTR low for 300 ms to disonnect the phone
  291. ;
  292. GOODBYE:
  293.     MVI    A,3DH        ; Send break, turn off DTR
  294.     OUT    MDCTL1        ; Send to status port
  295.     MVI    B,3        ; Delay 300 ms to hang up phone
  296.     CALL    J$TIMER
  297.     MVI    A,37H        ; Normal send/receive with DTR
  298.     OUT    MDCTL1        ; Send to status port
  299.     RET
  300. ;.....
  301. ;
  302. ;
  303. ; Sets 8251 to 8 bits, DTR, RCV and TX ready
  304. ;
  305. INITMOD:
  306.     MVI    A,MDMODE    ; Insure 8251 is out of mode
  307.     OUT    MDCTL1
  308.     XTHL            ; Small delay to complete command
  309.     XTHL
  310.     MVI    A,MDRSET    ; Reset the 8251A for new command
  311.     OUT    MDCTL1
  312.     XTHL            ; Small delay to complete command
  313.     XTHL
  314.     MVI    A,MDSET1    ; Set stop pulse, no parity 8 bits, x16
  315.     OUT    MDCTL1
  316.     XTHL            ; Small delay to complete command
  317.     XTHL
  318.     MVI    A,MDCOM        ; Error reset, RCV, DTR, TX ready
  319.     OUT    MDCTL1
  320.     XTHL            ; Small delay to complete command
  321.     XTHL
  322. ;
  323.     LDA    MSPEED        ; Get the selected value
  324.     CPI    1        ; 300 bps
  325.     JZ    OK300
  326.     CPI    5        ; 1200 bps
  327.     JZ    OK1200
  328.     JMP    STUPR1        ; Else ask what is wanted
  329. ;.....
  330. ;
  331. ;
  332. STUPR:    CALL    J$CMDSPL    ; Gives us CMDBUF+6
  333.     JNC    STUPR2
  334. ;
  335. STUPR1:    CALL    J$ILPRT
  336.     DB    'Input Baud Rate (300, 1200): ',0
  337.     LXI    D,BAUDBUF    ; Point to new input buffer
  338.     CALL    J$INBUF
  339.     CALL    J$CRLF
  340.     LXI    D,BAUDBUF+2
  341. ;
  342. STUPR2:    CALL    J$INLNCP    ; Compare BAUDBUF+2 with chars. below
  343.     DB    '300',0
  344.     JNC    OK300        ; Go if got match
  345.     CALL    J$INLNCP
  346.     DB    '1200',0
  347.     JNC    OK1200
  348.     CALL    J$ILPRT        ; All matches failed, tell operator
  349.     DB    '++ Incorrect entry ++',CR,LF,BELL,CR,LF,0
  350.     JMP    STUPR1        ; Try again
  351. ;
  352. OK300:    MVI    A,1        ; MSPEED 300 baud value
  353.     MVI    B,BD300        ; Get 300 baud parameters in 'HL'
  354.     JMP    LOADBD        ; Go load them
  355. ;
  356. OK1200:    MVI    A,5
  357.     MVI    B,BD1200
  358.     JMP    LOADBD
  359. ;
  360. OK2400:    JMP    OK1200        ; Stock Z-SI/O does not support 2400 bps
  361. ;
  362. LOADBD:    STA    MSPEED        ; Change time-to-send to match baudrate
  363.     MVI    A,87H        ; Insure out of mode
  364.     OUT    MDCTL1        ; Modem status port
  365.     XCHG            ; Slight extra delay
  366.     MVI    A,40H        ; Initialize 8251
  367.     OUT    MDCTL1        ; Modem status port
  368.     MOV    A,B        ; Get the speed currently wanted
  369.     OUT    MDCTL1        ; Modem status port
  370.     XCHG            ; Slight pause
  371.     MVI    A,17H        ; DTR, RCV, XMT, error reset
  372.     OUT    MDCTL1        ; Modem status port
  373.     IN    PORT        ; Clear data port
  374.     XRA    A        ; Clear the input
  375.     RET
  376. ;.....
  377. ;
  378. ;
  379. ; Table of baudrate parameters
  380. ;
  381. BD300    EQU    4FH        ; 300 baud, x64
  382. BD1200    EQU    4EH        ; 1200 bps, x16
  383. ;
  384. BAUDBUF:DB    10,0,0,0,0,0
  385.     DB    0,0,0,0,0,0
  386. ;
  387. ;                   end
  388. ;-----------------------------------------------------------------------
  389. ;
  390. ; NOTE: Must terminate by 0400H
  391. ;
  392.     END
  393.