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

  1.  
  2. ; I2SP-2.ASM  -  Coleco Adam with EVESP1 interface for IMP  -  06/01/87
  3. ;
  4. ;        2651 I/O with built-in baudrate generator
  5. ;
  6. ; This overlay adapts IMP.COM to the Coleco Adam with EVE SP1 interface
  7. ; and external modem.
  8. ;
  9. ; You will want to look this file over carefully.  There are a number of
  10. ; options that you can use to configure the program to suit your taste.
  11. ;
  12. ; Edit this file for your preferences then follow the "TO USE:" example
  13. ; shown below.
  14. ;
  15. ; Many terminals will clear the screen with a CTL-Z.  If yours does, put
  16. ; a 1AH at CLEAR: (010AH).  Many terminals use two characters, the first
  17. ; normally an ESC.  For example, ESC *.  In this case put '*' at CLEAR:
  18. ; (The ESC will automatically be typed with no CTL-character present.)
  19. ; If you don't know what your terminal uses, put a 0 at CLEAR: and IMP
  20. ; will scroll up 24 blank lines to clear the CRT for things like MENU,
  21. ; looking at the function key table, typing CTL-Z in command mode, etc.
  22. ;
  23. ; Use the "SET" command to change the baudrate when desired.  The value
  24. ; at MSPEED controls the baudrate when the program is first called up.
  25. ;
  26. ;    TO USE: First edit this file filling in answers for your own
  27. ;        equipment.  Then assemble with ASM.COM or equivalent
  28. ;        assembler.  Then use MLOAD to merge into the main file:
  29. ;
  30. ;        MLOAD IMP.COM=IMP.COM,I2SP-x.HEX
  31. ;
  32. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  33. ;
  34. ; 06/01/87  Improved the GOODBYE routine, added BREAK routine, needs
  35. ;        IMP245 to use it.            - Irv Hoff
  36. ;
  37. ; 07/15/86  Written to work with IMP        - Irv Hoff
  38. ;
  39. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  40. ;
  41. ;
  42. YES    EQU    0FFH
  43. NO    EQU    0
  44. ;
  45. ;
  46. PORT    EQU    44H    ; Modem data port for EVE SP1 interface card
  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. ;
  54. ;-----------------------------------------------------------------------
  55. ;
  56. ESC    EQU    '['-40H    ; ^[ = Escape
  57. BELL    EQU    'G'-40H    ; ^G = Bell character
  58. LF    EQU    'J'-40H    ; ^J = Linefeed
  59. NEXTRY    EQU    'K'-40H    ; ^K = Try next phone number, abort this try
  60. CR    EQU    'M'-40H    ; ^M = Carriage return
  61. CLEARSC    EQU    'Z'-40H    ; ^L = Clears screen, command mode only
  62. EOFCHAR    EQU    'Z'-40H    ; ^Z = End of file
  63. ;
  64. ;
  65. ;-----------------------------------------------------------------------
  66. ;
  67. ;
  68.     ORG    0100H
  69. ;
  70. ;
  71.     DS    3    ; Skip the data area below
  72. ;
  73. ;
  74. ; These routines and equates are at the beginning of the program so
  75. ; they can be patched by a monitor or overlay file without re-assembling
  76. ; the program.
  77. ;
  78. MSPEED:     DB    5    ; 0=110 1=300 2=450 3=600 4=710 5=1200        103H
  79.             ; 6=2400 7=4800 8=9600 9=19200 default
  80. HS2400:     DB    NO    ; Yes=2400 bps highest speed            104H
  81. HS1200:     DB    YES    ; Yes=1200 bps highest speed            105H
  82. RACAL:     DB    NO    ; Yes=Racal-Vadic 1200V or 2400V or 2400PA    106H
  83. PROMODM: DB    NO    ; Yes=Prometheus ProModem 1200 bps        107H
  84. RESVD1:     DB    NO    ; Reserved for special modems            108H
  85. RESVD2:     DB    NO    ; Reserved for special modems            109H
  86. ;
  87. ;
  88. CLEAR:     DB    0CH    ; Clear screen character (ESC not needed)    10AH
  89. CLOCK:     DB    40    ; Clock speed in MHz x10, 25.5 MHz max.     10BH
  90.             ; 20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
  91. BYTDLY:     DB    2    ; 0=0 delay  1=10ms  5=50 ms - 9=90 ms        10CH
  92.             ;   default time to send character in ter-
  93.             ;   minal mode file transfer for slow BBS
  94. CRDLY:     DB    2    ; 0=0 delay 1=100 ms 5=500 ms - 9=900 ms    10DH
  95.             ;   default time for extra wait after CRLF
  96.             ;   in terminal mode file transfer
  97. NOFCOL:     DB    5    ; Number of directory columns shown        10EH
  98. TCHPUL:     DB    'T'    ; T=tone, P=Pulse (Hayes 2400 modems)        10FH
  99. ;.....
  100. ;
  101. ;
  102. ADDLFD:     DB    NO    ; Yes=add LF after CR to send file in terminal    110H
  103.             ;   mode (normally added by remote echo)
  104. CONVRUB: DB    YES    ; Yes=convert rub to backspace            111H
  105. CRCDFLT: DB    YES    ; Yes=default to CRC checking            112H
  106. IGNRCTL: DB    YES    ; Yes=CTL-chars above ^M not displayed        113H
  107. ;.....
  108. ;
  109. ;
  110. EXTCHR:     DB    '['-40H    ; ESC = preceeds local control character    114H
  111. EXITCHR: DB    'E'    ; Exit character                115H
  112. FILESND: DB    'F'    ; Send file when in terminal mode        116H
  113. NOCONCT: DB    'N'    ; Disconnect from phone line            117H
  114. LOGCHR:     DB    'O'    ; Send logon                    118H
  115. LSTCHR:     DB    'P'    ; Toggle printer                119H
  116. UNSAVCH: DB    'R'    ; Close input text buffer            11AH
  117. SAVECHR: DB    'Y'    ; Open input text buffer            11BH
  118. CLEARS:     DB    'Z'    ; Clears screen, terminal mode            11CH
  119. BRKCHR:     DB    'Q'    ; Send a break tone                11DH
  120. NODTR:     DB    NO    ; YES if no DTR and need ATH0 to disconnect    11EH
  121. ;.....
  122. ;
  123. ;
  124. ; Handles in/out ports for data and status
  125. ;
  126. I$MDCTL1: IN    MDCTL1        ;                    11FH
  127.       RET            ;                    121H
  128.       DB    0,0,0,0,0,0,0    ;                    122H
  129. ;
  130. I$MDTXE:  IN    MDCTL1        ;                    129H
  131.       RET            ;                    12BH
  132.       DB    0,0,0,0,0,0,0    ;                    12CH
  133. ;
  134. I$MDDATP: IN    MDDATP        ;                    133H
  135.       RET            ;                    135H
  136.       DB    0,0,0,0,0,0,0    ;                    136H
  137. ;
  138. O$MDDATP: OUT    MDDATP        ;                    13DH
  139.       RET            ;                    13FH
  140.       DB    0,0,0,0,0,0,0    ;                    140H
  141. ;.....
  142. ;
  143. ;
  144. A$MDRCV:  ANI    MDRCV        ;                    147H
  145.       RET            ;                    149H
  146. ;
  147. C$MDRCV:  CPI    MDRCV        ;                    14AH
  148.       RET            ;                    14CH
  149. ;
  150. A$MDSND:  ANI    MDSND        ;                    14DH
  151.       RET            ;                    14FH
  152. ;
  153. C$MDSND:  CPI    MDSND        ;                    150H
  154.       RET            ;                    152H
  155. ;
  156. A$MDTXE:  ANI    MDTXE        ;                    153H
  157.       RET            ;                    155H
  158. ;
  159. C$MDTXE:  CPI    MDTXE        ;                    156H
  160.       RET            ;                    158H
  161. ;.....
  162. ;
  163. ;
  164. ; Special exit vector, used by some computers to reset interrupt vectors
  165. ;
  166. J$EXITVEC:RET            ;                    159H
  167.       DB    0,0        ;                    15AH
  168. ;.....
  169. ;
  170. ;
  171. ; Jump vectors needed by each overlay
  172. ;
  173. J$GOODBYE:JMP    GOODBYE        ; Disconnects modem by dropping DTR    15CH
  174. J$INITMOD:JMP    INITMOD        ; Initializes modem, autosets baudrate    15FH
  175. J$STUPR:  JMP    STUPR        ; SET routine to change baudrate    162H
  176. J$SYSVR:  JMP    SYSVR        ; Signon message            165H
  177. ;.....
  178. ;
  179. ;
  180. ; "AT" command strings, can be replaced in individual overlay if needed
  181. ;
  182. J$STRNGA: DS    3        ; 1200 bps "AT" string            168H
  183. J$STRNG1: DS    3        ; 2400 bps "AT" string            16BH
  184. ;
  185. ;
  186. ; Next fourteen lines should not be changed by user overlay as these go
  187. ; to specific locations in the main program, not in the overlay.
  188. ;
  189. ;
  190. J$CMDSPL: DS    3        ; Allows entry of baudrate on CMD line    16EH
  191. J$CRLF:      DS    3        ; Turns up one new line on display    171H
  192. J$DIAL:      DS    3        ; Start of dialing routine        174H
  193. J$DSCONT: DS    3        ; Terminates modem use            177H
  194. J$GOLST:  DS    3        ; Printer routine, needed by Apple //e    17AH
  195. J$ILPRT:  DS    3        ; Prints an inline string, 0 to end    17DH
  196. J$INBUF:  DS    3        ; Stores a keybd string for comparison    180H
  197. J$INLNCP: DS    3        ; Inline "compare strings" routine    183H
  198. J$INMDM:  DS    3        ; Max .1 sec wait for modem character    186H
  199. J$RCVRSP: DS    3        ; For 3801 I/O use (TV-803)        189H
  200. J$SNDCHR: DS    3        ; Sends a character to the modem    18CH
  201. J$SNDSTR: DS    3        ; Sends a string to the modem, $ to end 18FH
  202. J$TIMER:  DS    3        ; .1 second timer (amount in 'B' reg.)    192H
  203. J$BREAK:  JMP    SENDBRK        ; Break routine             195H
  204. J$NEW2:      DB    0,0,0        ; For future needs            198H
  205. ;.....
  206. ;
  207. ;
  208. ; For 2400 bps auto-stepdown units
  209. ;
  210. MANUAL:      DB    0        ; For manual selection flag        19BH
  211. J$300:      JMP    OK300        ; Sets baudrate to 300 baud        19CH
  212. J$1200:      JMP    OK1200        ; Sets baudrate to 1200 bps        19FH
  213. J$2400:      JMP    OK2400        ; Sets baudrate to 2400 bps        1A2H
  214. ;.....
  215. ;
  216. ;
  217. LOGPTR:      DW    LOGON        ; Pointer to display LOGON message    1A5H
  218. ;
  219. SYSVR:      CALL    J$ILPRT        ; Display the following line        1A7H
  220.       DB    'Version for Coleco ADAM with EVE SP1 Interface'
  221.       DB    CR,LF,0
  222.       RET
  223. ;.....
  224. ;
  225. ;
  226. ;-----------------------------------------------------------------------
  227. ;
  228. ; NOTE:  You can change the SYSVER message to be longer or shorter.  The
  229. ;     end of your last routine should terminate by 0400H (601 bytes
  230. ;     available after start of SYSVER).
  231. ;
  232. ;-----------------------------------------------------------------------
  233. ;
  234. ; You can put in a message at this location which can be called up with
  235. ; (special character-L).  You can put in several lines.  End with a 0.
  236. ;
  237. LOGON:      DB    'Using a Coleco ADAM with external modem here...'
  238.       DB    CR,LF,0
  239. ;
  240. ;-----------------------------------------------------------------------
  241. ;
  242. ; This routine sets a 300 ms break tone
  243. ;
  244. SENDBRK:
  245.     MVI    A,1FH        ; DTR normal, send break tone
  246.     JMP    GOODBYE+2    ; Send the break tone
  247. ;.....
  248. ;
  249. ;
  250. ; This routine sets DTR low for 300 ms to disconnect the phone
  251. ;
  252. GOODBYE:
  253.     MVI    A,1DH        ; Set RTS, flags, DTR, break
  254.     OUT    PORT+3        ; Put command register out of mode
  255.     IN    PORT+3        ; Make sure it is now clear
  256.     IN    PORT+3        ; Try once more
  257.     MVI    B,3        ; Turn off DTR for 300 ms
  258.     CALL    J$TIMER
  259.     MVI    A,37H        ; Turn DTR back on
  260.     OUT    PORT+3        ; Send to command register
  261.     IN    PORT+3        ; Clear any incoming characters
  262.     IN    PORT+3        ; Try once more
  263.     XRA    A        ; Clear the 'A' register
  264.     RET
  265. ;.....
  266. ;
  267. ;
  268. ; Initializes the 2561 I/O for selected baudrate
  269. ;
  270. INITMOD:
  271.     LDA    MSPEED        ; Get the selected value
  272.     CPI    1        ; 300 bps
  273.     JZ    OK300
  274.     CPI    5        ; 1200 bps
  275.     JZ    OK1200
  276.     CPI    6        ; 2400 bps
  277.     JZ    OK2400
  278.     CPI    8        ; 9600
  279.     JZ    OK9600
  280.     CPI    9
  281.     JZ    OK19200        ; 19200 BPS
  282.     JMP    STUPR1        ; Else ask what is wanted
  283. ;
  284. INITMOD1:
  285.     XRA    A        ; Set RTS, flags, DTR, disable R/T
  286.     OUT    PORT+3        ; Put command register out of mode
  287.     IN    PORT+3        ; Makes sure it is now clear
  288.     IN    PORT+3        ; Try once more
  289.     MVI    A,4EH        ; Select 8 data bits no parity 1 stop
  290.     OUT    PORT+2        ; Send to mode register 1
  291.     MOV    A,B        ; Get the baudrate back
  292.     OUT    PORT+2        ; Send to mode register 2
  293.     MVI    A,37H        ; Turn on DTR etc, reset any error flags
  294.     OUT    PORT+3        ; Send to command register
  295.     IN    PORT+3        ; Clear any incoming characters
  296.     IN    PORT+3        ; Try once more
  297.     RET
  298. ;.....
  299. ;
  300. ;
  301. ; Use the 'SET' command to select a desired baud rate
  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, '
  308.     DB    '2400, 9600, 19200): ',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$INLNCP
  327.     DB    '19200',0
  328.     JNC    OK19200
  329.     CALL    J$ILPRT        ; All matches failed, tell operator
  330.     DB    '++ Incorrect entry ++',CR,LF,BELL,CR,LF,0
  331.     JMP    STUPR1        ; Try again
  332. ;
  333. OK300:    MVI    A,1        ; MSPEED 300 baud value
  334.     MVI    B,BD300        ; Get 300 baud value for 2651 in 'B'
  335.     JMP    LOADBD        ; Go load everything
  336. ;
  337. OK1200:    MVI    A,5
  338.     MVI    B,BD1200
  339.     JMP    LOADBD
  340. ;
  341. OK2400:    XRA    A
  342.     STA    MANUAL
  343.     MVI    A,6
  344.     MVI    B,BD2400
  345.     JMP    LOADBD
  346. ;
  347. OK9600:    MVI    A,8
  348.     MVI    B,BD9600
  349.     JMP    LOADBD
  350. ;
  351. OK19200:MVI    A,9
  352.     MVI    B,BD19200
  353. ;
  354. LOADBD:    STA    MSPEED        ; Change time-to-send to match baudrate
  355.     JMP    INITMOD1    ; Reinitialize to new baudrate, done
  356. ;.....
  357. ;
  358. ;
  359. ; Table of baudrate parameters
  360. ;
  361. BD300    EQU    35H        ; 300 baud
  362. BD1200    EQU    37H        ; 1200 bps
  363. BD2400    EQU    3AH        ; 2400 bps
  364. BD9600    EQU    3EH        ; 9600 bps
  365. BD19200    EQU    3FH        ; 19200 bps
  366. ;
  367. BAUDBUF:DB    10,0,0,0,0,0
  368.     DB    0,0,0,0,0,0
  369. ;
  370. ;                   end
  371. ;-----------------------------------------------------------------------
  372. ;
  373. ; NOTE: Must terminate prior to 0400H
  374. ;
  375.     END
  376.