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 / I2AE-1.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  13KB  |  423 lines

  1.  
  2. ; I2AE-1.ASM - Action Computer Enterprises DPC-280 IMP overlay - 08/24/87
  3. ;
  4. ;       2661A I/O, built-in baudrate generator at 4.9152 MHz
  5. ;
  6. ; You will want to look this file over carefully. There are a number of
  7. ; options that you can use to configure the program to suit your taste.
  8. ; This file places adapts the Action DPC-280/Televideo 925 to IMP.COM.
  9. ;
  10. ; Edit this file for your preferences then follow the "TO USE:" example
  11. ; shown below.
  12. ;
  13. ; Many terminals will clear the screen with a CTL-Z.  If yours does, put
  14. ; a 1AH at CLEAR: (010AH).  Many terminals use two characters, the first
  15. ; normally an ESC.  For example, ESC *.  In this case put '*' at CLEAR:
  16. ; (The ESC will automatically be typed with no CTL-character present.)
  17. ; If you don't know what your terminal uses, put a 0 at CLEAR: and IMP
  18. ; will scroll up 24 blank lines to clear the CRT for things like MENU,
  19. ; looking at the function key table, typing CTL-Z in command mode, etc.
  20. ;
  21. ; Use the "SET" command to change the baudrate when desired.  The value
  22. ; at MSPEED controls the baudrate when the program is first called up.
  23. ;
  24. ;    TO USE: First edit this file filling in answers for your own
  25. ;        equipment.  Then assemble with ASM.COM or equivalent
  26. ;        assembler.  Then use MLOAD to merge into the main file:
  27. ;
  28. ;        MLOAD IMP.COM=IMP.COM,I2AE-1.HEX
  29. ;
  30. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  31. ;
  32. ; 08/24/81   Modified I2HZ-6.ASM originally intended for the Heath
  33. ;         Computer with a Zenith 100 terminal to work with an
  34. ;         Action Computer Enterprises DPC-280 and a Televidio 925
  35. ;         Terminal.    Changes included different HEX baud rate set
  36. ;         values for the Signetics 2661A Communications Chip
  37. ;         from the values used with the 2661B chip used by the
  38. ;         Heath computer.  Also changed routines for writing
  39. ;         line 25 of the Televideo 925.    - David Hogan
  40. ;
  41. ; 06/01/87  Improved the GOODBYE routine, added BREAK routine, needs
  42. ;        IMP245 to use it.            - Irv Hoff
  43. ;
  44. ; 02/12/86  Added Function keys for the Z-100 as well as 25th line
  45. ;        (status line) display.  These F-keys execute terminal mode
  46. ;        commands and are separate from the ESC-<number> sequences
  47. ;        already present in IMP.  25th line display is currently set
  48. ;        for a green indication of key assignments.    This is a color
  49. ;        which will illuminate monochrome and and color monitors
  50. ;        alike.  (Uses: F0 thru F6 keys and the Home key.)
  51. ;                        - Hampton Childress
  52. ;
  53. ; 09/07/85  Added 19200 Baud            - Fred Townsend
  54. ; 07/17/85  Written to work with IMP        - Irv Hoff
  55. ;
  56. ; =   =   =   =   =   =   =   =   =   =   =       =   =   =   =   =   =
  57. ;
  58. ;
  59. YES    EQU    0FFH
  60. NO    EQU    0
  61. ;
  62. ;
  63. ; Values shown are for a 2661-1 I/O ON ACTION DPC-280 COMPUTER
  64. ;
  65. PORT    EQU    084H    ; Your base port (data or status)
  66. MDCTL1    EQU    PORT+1    ; Modem control port
  67. MDDATP    EQU    PORT    ; Modem data port
  68. MDRCV    EQU    02H    ; Modem receive ready
  69. MDSND    EQU    01H    ; Modem send ready bit
  70. MDTXE    EQU    05H    ; Modem send buffer empty, holding buffer empty
  71. ;
  72. ;
  73. ;-----------------------------------------------------------------------
  74. ;
  75. ESC    EQU    '['-40H    ; ^[ = Escape
  76. BELL    EQU    'G'-40H    ; ^G = Bell character
  77. LF    EQU    'J'-40H    ; ^J = Linefeed
  78. NEXTRY    EQU    'K'-40H    ; ^K = Try next phone number, abort this try
  79. CR    EQU    'M'-40H    ; ^M = Carriage return
  80. CLEARSC    EQU    'Z'-40H    ; ^Z = Clears screen, command mode only
  81. EOFCHAR    EQU    'Z'-40H    ; ^Z = End of file
  82. ;
  83. ;
  84. ;-----------------------------------------------------------------------
  85. ;
  86. ; Change the clock speed if needed, to match your system.  The 2661-1
  87. ; normally runs 4.9152 MHz.
  88. ;
  89. ;
  90.      ORG    0100H
  91. ;
  92. ;
  93.      DS    3    ; Skip the data area below
  94. ;
  95. ;
  96. MSPEED:     DB    5    ; 0=110 1=300 2=450 3=600 4=710 5=1200        103H
  97.             ; 6=2400 7=4800 8=9600 9=19200
  98. HS2400:     DB    YES    ; Yes=2400 bps highest speed            104H
  99. HS1200:     DB    NO    ; Yes=1200 bps highest speed            105H
  100. RACAL:     DB    NO    ; Yes=Racal-Vadic 1200V or 2400V or 2400PA    106H
  101. PROMODM: DB    NO    ; Yes=Prometheus ProModem 1200 bps        107H
  102. RESVD1:     DB    NO    ; Reserved for special modems            108H
  103. RESVD2:     DB    NO    ; Reserved for special modems            109H
  104. ;
  105. ;
  106. CLEAR:     DB    '*'    ; Clear screen character (ESC not needed)    10AH
  107. CLOCK:     DB    49    ; Clock speed in MHz x10, 25.5 MHz max.     10BH
  108.             ; 20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
  109. BYTDLY:     DB    0    ; 0=0 delay  1=10ms  5=50 ms - 9=90 ms        10CH
  110.             ;   default time to send character in ter-
  111.             ;   minal mode file transfer for slow BBS
  112. CRDLY:     DB    0    ; 0=0 delay 1=100 ms 5=500 ms - 9=900 ms    10DH
  113.             ;   default time for extra wait after CRLF
  114.             ;   in terminal mode file transfer
  115. NOFCOL:     DB    5    ; Number of directory columns shown        10EH
  116. TCHPUL:     DB    'T'    ; T=tone, P=Pulse (Hayes 2400 modems)        10FH
  117. ;.....
  118. ;
  119. ;
  120. ADDLFD:     DB    NO    ; Yes=add LF after CR to send file in terminal    110H
  121.             ;   mode (normally added by remote echo)
  122. CONVRUB: DB    YES    ; Yes=convert rub to backspace            111H
  123. CRCDFLT: DB    YES    ; Yes=default to CRC checking            112H
  124. IGNRCTL: DB    YES    ; Yes=CTL-chars above ^M not displayed        113H
  125. ;.....
  126. ;
  127. ;
  128. EXTCHR:     DB    ESC    ; ESC = preceeds local control character    114H
  129. EXITCHR: DB    '@'    ; Exit character            (F0)    115H
  130. FILESND: DB    'E'    ; Send file when in terminal mode    (F5)    116H
  131. NOCONCT: DB    'F'    ; Disconnect from phone line        (F6)    117H
  132. LOGCHR:     DB    'A'    ; Send logon                (F1)    118H
  133. LSTCHR:     DB    'B'    ; Toggle printer            (F2)    119H
  134. UNSAVCH: DB    'D'    ; Close input text buffer        (F4)    11AH
  135. SAVECHR: DB    'C'    ; Open input text buffer        (F3)    11BH
  136. CLEARS:     DB    'G'    ; Clears screen, terminal mode        (Home)    11CH
  137. BRKCHR:     DB    'H'    ; Send a break tone                11DH
  138. NODTR:     DB    NO    ; YES if no DTR and need ATH0 to disconnect    11EH
  139. ;.....
  140. ;
  141. ;
  142. ; Handles in/out ports for data and status
  143. ;
  144. I$MDCTL1: IN    MDCTL1        ;                    11FH
  145.       RET            ; IN modem control port         121H
  146.       DB    0,0,0,0,0,0,0    ; Spares if needed            122H
  147. ;
  148. I$MDTXE:  IN    MDCTL1        ; (Needed for SIO or DART register 1    129H
  149.       RET            ;                    12BH
  150.       DB    0,0,0,0,0,0,0    ;                    12CH
  151. ;
  152. I$MDDATP: IN    MDDATP        ;                    133H
  153.       RET            ;                    135H
  154.       DB    0,0,0,0,0,0,0    ;                    136H
  155. ;
  156. O$MDDATP: OUT    MDDATP        ;                    13DH
  157.       RET            ; OUT modem data port            13FH
  158.       DB    0,0,0,0,0,0,0    ; Spares if needed            140H
  159. ;.....
  160. ;
  161. ;
  162. A$MDRCV:  ANI    MDRCV        ;                    147H
  163.       RET            ;                    149H
  164. ;
  165. C$MDRCV:  CPI    MDRCV        ;                    14AH
  166.       RET            ;                    14CH
  167. ;
  168. A$MDSND:  ANI    MDSND        ;                    14DH
  169.       RET            ;                    14FH
  170. ;
  171. C$MDSND:  CPI    MDSND        ;                    150H
  172.       RET            ;                    152H
  173. ;
  174. A$MDTXE:  ANI    MDTXE        ;                    153H
  175.       RET            ;                    155H
  176. ;
  177. C$MDTXE:  CPI    MDTXE        ;                    156H
  178.       RET            ;                    158H
  179. ;.....
  180. ;
  181. ;
  182. ; Special exit vector, used by some computers to reset interrupt vectors
  183. ; or in this case, to clear the 25th line and clear the screen.
  184. ;
  185. J$EXITVEC:JMP    EXITRM        ;                    159H
  186. ;.....
  187. ;
  188. ;
  189. ; Jump vectors needed by each overlay
  190. ;
  191. J$GOODBYE:JMP    GOODBYE        ; Disconnects modem by dropping DTR    15CH
  192. J$INITMOD:JMP    INITMOD        ; Initializes modem, autosets baudrate    15FH
  193. J$STUPR:  JMP    STUPR        ; SET routine to change baudrate    162H
  194. J$SYSVR:  JMP    SYSVR        ; Signon message            165H
  195. ;.....
  196. ;
  197. ;
  198. ; "AT" command strings, can be replaced in individual overlay if needed
  199. ;
  200. J$STRNGA: DS    3        ; 1200 bps "AT" string            168H
  201. J$STRNG1: DS    3        ; 2400 bps "AT" string            16BH
  202. ;
  203. ;
  204. ; Next fourteen lines should not be changed by user overlay as these go
  205. ; to specific locations in the main program, not in the overlay.
  206. ;
  207. J$CMDSPL: DS    3        ; Allows entry of baudrate on CMD line    16EH
  208. J$CRLF:      DS    3        ; Turns up one new line on display    171H
  209. J$DIAL:      DS    3        ; Start of dialing routine        174H
  210. J$DSCONT: DS    3        ; Terminates modem use            177H
  211. J$GOLST:  DS    3        ; Printer routine, needed by Apple //e    17AH
  212. J$ILPRT:  DS    3        ; Prints an inline string, 0 to end    17DH
  213. J$INBUF:  DS    3        ; Stores a keybd string for comparison    180H
  214. J$INLNCP: DS    3        ; Inline "compare strings" routine    183H
  215. J$INMDM:  DS    3        ; Max .1 sec wait for modem character    186H
  216. J$RCVRSP: DS    3        ; For 3801 I/O use (TV-803)        189H
  217. J$SNDCHR: DS    3        ; Sends a character to the modem    18CH
  218. J$SNDSTR: DS    3        ; Sends a string to the modem, $ to end 18FH
  219. J$TIMER:  DS    3        ; .1 second timer (amount in 'B' reg.)    192H
  220. J$BREAK:  JMP    SENDBRK        ; Break routine             195H
  221. J$NEW2:      DB    0,0,0        ; For future needs            198H
  222. ;.....
  223. ;
  224. ;
  225. ; For 2400 bps auto-stepdown units
  226. ;
  227. MANUAL:      DB    0        ; For manual selection flag        19BH
  228. J$300:      JMP    OK300        ; Sets baudrate to 300 baud        19CH
  229. J$1200:      JMP    OK1200        ; Sets baudrate to 1200 bps        19FH
  230. J$2400:      JMP    OK2400        ; Sets baudrate to 2400 bps        1A2H
  231. ;.....
  232. ;
  233. ;
  234. LOGPTR:      DW    LOGON        ; Pointer to display LOGON message    1A5H
  235. ;
  236. SYSVR:      CALL    J$ILPRT        ; Display the following line        1A7H
  237.       DB    'Version for Action DPC-280 & Televideo 925 terminal';    1AAH
  238.       DB    CR,LF,0
  239.       RET
  240. ;.....
  241. ;
  242. ;
  243. ;-----------------------------------------------------------------------
  244. ;
  245. ; NOTE:  You can change the SYSVER message to be longer or shorter.  The
  246. ;     end of your last routine should terminate by 0400H (601 bytes
  247. ;     available after start of SYSVER).
  248. ;
  249. ;-----------------------------------------------------------------------
  250. ;
  251. ; You can put in a message at this location which can be called up with
  252. ; (special character-L).  You can put in several lines.  End with a 0.
  253. ;
  254. LOGON:    DB    'Hello from an Action DPC-280 S-100 computer',CR,LF,0
  255. ;
  256. ;-----------------------------------------------------------------------
  257. ;
  258. ; This routine sets a 300 ms break tone
  259. ;
  260. SENDBRK:
  261.     MVI    A,1FH        ; DTR normal, send break tone
  262.     JMP    GOODBYE+2    ; Send the break tone
  263. ;.....
  264. ;
  265. ;
  266. ; This routine sets DTR low for 300 ms to disconnect the phone
  267. ;
  268. GOODBYE:
  269.     MVI    A,1DH        ; Set RTS, flags, DTR, break
  270.     OUT    PORT+3        ; Put command register out of mode
  271.     IN    PORT+3        ; Make sure it is now clear
  272.     IN    PORT+3        ; Try once more
  273.     MVI    B,3        ; Turn off DTR for 300 ms
  274.     CALL    J$TIMER
  275.     MVI    A,37H        ; Turn DTR back on
  276.     OUT    PORT+3        ; Send to command register
  277.     IN    PORT+3        ; Clear any incoming characters
  278.     IN    PORT+3        ; Try once more
  279.     XRA    A        ; Clear the 'A' register
  280.     RET
  281. ;.....
  282. ;
  283. ;
  284. ; The following are used in setting up the 2661-1 I/O port and the 25th
  285. ; (status) line
  286. ;
  287. INITMOD:
  288.     CALL J$ILPRT        ; Set up 25th line on the Televideo 925
  289.     DB    ESC,'f'        ; Begin writing to User Line (line 25)
  290.     DB    '1 DIR<cr>|'    ; F1 key
  291.     DB    '2 DIR..|'    ; F2 key
  292.     DB    '3 KMD R|'    ; F3 key
  293.     DB    '4 KMD S|'    ; F4 key
  294.     DB    '5 XMD R|'    ; F5 key
  295.     DB    '6 XMD S|'    ; F6 key
  296.     DB    '7 BYE |'    ; F7 key
  297.     DB    '8 BBS |'    ; F8 key
  298.     DB    '9 TYPE|'    ; F9 key
  299.     DB    '0 bye'        ; F0 key
  300.     DB    CR        ; End input to line 25
  301.     DB    ESC,'g'        ; Turn display of line 25 on
  302.     DB    0        ; All done
  303. ;
  304. ;    Make sure that no more than 79 characters are sent to line
  305. ;    25 in the above routine.  The ESC,'f' and ESC,'g' are not
  306. ;    included in this count.
  307. ;
  308. ; Now set up the modem
  309. ;
  310.     LDA    MSPEED        ; Get the selected value
  311.     CPI    1        ; 300 bps
  312.     JZ    OK300
  313.     CPI    5        ; 1200 bps
  314.     JZ    OK1200
  315.     CPI    6        ; 2400 bps
  316.     JZ    OK2400
  317.     CPI    8        ; 9600 bps
  318.     JZ    OK9600
  319.     CPI    9        ; 19200 bps
  320.     JZ    OK19200
  321.     JMP    STUPR1        ; Else ask what is wanted
  322. ;...
  323. ;
  324. ;
  325. ; The following changes the baud rate with the set command.
  326. ;
  327. STUPR:    CALL    J$CMDSPL    ; Gives us CMDBUF+6
  328.     JNC    STUPR2
  329. ;
  330. STUPR1:    CALL    J$ILPRT
  331.     DB    'Input Baud Rate (300, 1200, 2400, 9600, 19200): ',0
  332.     LXI    D,BAUDBUF    ; Point to new input buffer
  333.     CALL    J$INBUF
  334.     CALL    J$CRLF
  335.     LXI    D,BAUDBUF+2
  336. ;
  337. STUPR2:    CALL    J$INLNCP    ; Compare BAUDBUF+2 with chars. below
  338.     DB    '300',0
  339.     JNC    OK300        ; Go if got match
  340.     CALL    J$INLNCP
  341.     DB    '1200',0
  342.     JNC    OK1200
  343.     CALL    J$INLNCP
  344.     DB    '2400',0
  345.     JNC    OK2400
  346.     CALL    J$INLNCP
  347.     DB    '9600',0
  348.     JNC    OK9600
  349.     CALL    J$INLNCP
  350.     DB    '19200',0
  351.     JNC    OK19200
  352.     CALL    J$ILPRT        ; All matches failed, tell operator
  353.     DB    '++ Incorrect entry ++',CR,LF,BELL,CR,LF,0
  354.     JMP    STUPR1        ; Try again
  355. ;
  356. OK300:    MVI    A,1        ; MSPEED 300 baud value
  357.     MVI    B,BD300
  358.     JMP    LOADBD
  359. ;
  360. OK1200:    MVI    A,5
  361.     MVI    B,BD1200
  362.     JMP    LOADBD
  363. ;
  364. OK2400:    XRA    A
  365.     STA    MANUAL        ; Reset for automatic stepdown
  366.     MVI    A,6
  367.     MVI    B,BD2400
  368.     JMP    LOADBD
  369. ;
  370. OK9600:    MVI    A,8
  371.     MVI    B,BD9600
  372.     JMP    LOADBD
  373. ;
  374. OK19200:MVI    A,9
  375.     MVI    B,BD19200
  376. ;
  377. LOADBD:    STA    MSPEED        ; Change time-to-send to match baudrate
  378.     MOV    A,B        ; Get baudrate byte
  379.     STA    SETSPD+1    ; Store in INITMOD
  380.     XRA    A        ; Set RTS, flags, DTR, disable R/T
  381.     OUT    PORT+3        ; Put command register out of mode
  382.     IN    PORT+3        ; Make sure it is now clear
  383.     IN    PORT+3        ; Try once more  (CE, 2 stop, 4E 1 stop)
  384.     MVI    A,04EH        ; 1 stop, no parity, 8 bits, 16x asynch
  385.     OUT    PORT+2        ; Send to mode register 1
  386. ;
  387. SETSPD:    MVI    A,BD1200    ; Start with 1200 baud (4.9152 clock)
  388.     OUT    PORT+2        ; Send to mode register 2
  389.     MVI    A,37H        ; Reset RTS, flags, DTR low, enable R/T
  390.     OUT    PORT+3        ; Send to command register
  391.     IN    PORT+3        ; Clear any incoming chars.
  392.     IN    PORT+3        ; Try once more
  393.     XRA    A        ; Clear the 'A' register
  394.     RET
  395. ;.....
  396. ;
  397. ;
  398. EXITRM:    CALL J$ILPRT
  399.     DB    ESC,'h'        ; Turn off line 25 of the Televidio 925
  400.     DB    ESC,'*'        ; Clear the CRT
  401.     DB    0        ; Done with J$ILPRT string
  402.     RET
  403. ;.....
  404. ;
  405. ;
  406. ; Table of baudrate parameters for 2661A I/O
  407. ;
  408. BD300    EQU    0F6H
  409. BD1200    EQU    0F9H
  410. BD2400    EQU    0FCH
  411. BD9600    EQU    0FEH
  412. BD19200    EQU    0FFH
  413. ;
  414. BAUDBUF:DB    10,0,0,0,0,0
  415.     DB    0,0,0,0,0,0
  416. ;
  417. ;                   end
  418. ;-----------------------------------------------------------------------
  419. ;
  420. ; Note: Must terminate prior to 0400H
  421. ;
  422.     END
  423.