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 / I2DP-2.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  11KB  |  378 lines

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