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 / I2XE-2.AZM / I2XE-2.ASM
Assembly Source File  |  2000-06-30  |  11KB  |  385 lines

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