home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / simtel / sigm / vols200 / vol273 / i2dv-1.asm < prev    next >
Encoding:
Assembly Source File  |  1994-07-13  |  10.6 KB  |  371 lines

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