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 / I2EA-2.AZM / I2EA-2.ASM
Assembly Source File  |  2000-06-30  |  12KB  |  397 lines

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