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

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