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 / I2DG-2.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  12KB  |  387 lines

  1.  
  2. ; I2DG-2.ASM - DIGITAL GROUP with IOP overlay for IMP - 06/01/87
  3. ;
  4. ;            8251A I/O and 8430 CTC chip
  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 overlay adapts the DIGITAL GROUP with I/O Processor revision 'C'
  9. ; with IMP.  The IOP processor is intended to buffer simple terminal
  10. ; type devices so that the main processor can run multiple tasks without
  11. ; loss of response to the user.  The hardware consists of 4 asynchronous
  12. ; serial RS232 ports, 2 parallel 8 bit I/O ports, Z80 processor and 16k
  13. ; of byte wide memory.    The I/O processor is an enhanced functional
  14. ; replacement for the DIGITAL GROUP, Inc., COMM-4, except for the signal
  15. ; pinout on the peripheral connector.  Optionally a CTC can be installed
  16. ; to provide software controlled baud rates for the DARTS, this overlay
  17. ; assumes the implimentation of that feature.
  18. ;
  19. ; Edit this file for your preferences then follow the "TO USE:" example
  20. ; shown below.
  21. ;
  22. ; Many terminals will clear the screen with a CTL-Z.  If yours does, put
  23. ; a 1AH at CLEAR: (010AH).  Many terminals use two characters, the first
  24. ; normally an ESC.  For example, ESC *.  In this case put '*' at CLEAR:
  25. ; (The ESC will automatically be typed with no CTL-character present.)
  26. ; If you don't know what your terminal uses, put a 0 at CLEAR: and IMP
  27. ; will scroll up 24 blank lines to clear the CRT for things like MENU,
  28. ; looking at the function key table, typing CTL-Z in command mode, etc.
  29. ;
  30. ; Use the "SET" command to change the baudrate when desired.  The value
  31. ; at MSPEED controls the baudrate when the program is first called up.
  32. ;
  33. ;     TO USE: First edit this file filling in answers for your own
  34. ;          equipment.  Then assemble with ASM.COM or equivalent
  35. ;          assembler.  Then use MLOAD to merge into the main file:
  36. ;
  37. ;        MLOAD IMP.COM=IMP.COM,I2DG-x.HEX
  38. ;
  39. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  40. ;
  41. ; 06/01/87  Improved the GOODBYE routine, added BREAK routine, needs
  42. ;        IMP245 to use it.            - Irv Hoff
  43. ;
  44. ; 06/13/86  Written to work with IMP        - Bob Kramer
  45. ;
  46. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  47. ;
  48. YES    EQU    0FFH
  49. NO    EQU    0
  50. ;
  51. ;
  52. ; Values shown are for an 8251A
  53. ;
  54. PORT    EQU    040H    ; Your base port (data or status)
  55. IOPSTAT    EQU    PORT+1    ; IOP status port
  56. MDCTL1    EQU    PORT+9    ; Modem control port
  57. MDDATP    EQU    PORT+8    ; Modem data port
  58. MDRCV    EQU    02H    ; Modem receive ready
  59. MDSND    EQU    01H    ; Modem send ready bit
  60. MDTXE    EQU    05H    ; Modem send buffer empty, holding buffer empty
  61. ;
  62. COMMND    EQU    042H    ; Baudrate command port for control/status
  63. IOPCH    EQU    36H    ; CTC channel (36H = 0, 37H = 1, 38H = 2)
  64. MDSET    EQU    4EH    ; 1 stop bit, no parity, 8 bits
  65. ;
  66. ;
  67. ;-----------------------------------------------------------------------
  68. ;
  69. ESC    EQU    '['-40H    ; ^[ = Escape
  70. BELL    EQU    'G'-40H    ; ^G = Bell character
  71. LF    EQU    'J'-40H    ; ^J = Linefeed
  72. NEXTRY    EQU    'K'-40H    ; ^K = Try next phone number, abort this try
  73. CR    EQU    'M'-40H    ; ^M = Carriage return
  74. CLEARSC    EQU    'Z'-40H    ; ^Z = Clears screen, command mode only
  75. EOFCHAR    EQU    'Z'-40H    ; ^Z = End of file
  76. ;
  77. ;
  78. ;-----------------------------------------------------------------------
  79. ;
  80.     ORG    0100H
  81. ;
  82.     DS    3        ; Skip the data area below
  83. ;
  84. ;
  85. ; These routines and equates are at the beginning of the program so
  86. ; they can be patched by a monitor or overlay file without re-assembling
  87. ; the program.
  88. ;
  89. MSPEED:     DB    6    ; 0=110 1=300 2=450 3=600 4=710 5=1200        103H
  90.             ; 6=2400 7=4800 8=9600 9=19200 default
  91. HS2400:     DB    YES    ; Yes=2400 bps highest speed            104H
  92. HS1200:     DB    NO    ; Yes=1200 bps highest speed            105H
  93. RACAL:     DB    NO    ; Yes=Racal-Vadic 1200V or 2400V or 2400PA    106H
  94. PROMODM: DB    NO    ; Yes=Prometheus ProModem 1200 bps        107H
  95. RESVD1:     DB    NO    ; Reserved for special modems            108H
  96. RESVD2:     DB    NO    ; Reserved for special modems            109H
  97. ;
  98. CLEAR:     DB    '*'    ; Clear screen character (ESC not needed)    10AH
  99. CLOCK:     DB    40    ; 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. ADDLFD:     DB    NO    ; Yes=add LF after CR to send file in terminal    110H
  112.             ;   mode (normally added by remote echo)
  113. CONVRUB: DB    YES    ; Yes=convert rub to backspace            111H
  114. CRCDFLT: DB    YES    ; Yes=default to CRC checking            112H
  115. IGNRCTL: DB    YES    ; Yes=CTL-chars above ^M not displayed        113H
  116. ;.....
  117. ;
  118. EXTCHR:     DB    '['-40H    ; ESC = preceeds local control character    114H
  119. EXITCHR: DB    'E'    ; Exit character                115H
  120. FILESND: DB    'F'    ; Send file when in terminal mode        116H
  121. NOCONCT: DB    'N'    ; Disconnect from phone line            117H
  122. LOGCHR:     DB    'L'    ; Send logon                    118H
  123. LSTCHR:     DB    'P'    ; Toggle printer                119H
  124. UNSAVCH: DB    'R'    ; Close input text buffer            11AH
  125. SAVECHR: DB    'Y'    ; Open input text buffer            11BH
  126. CLEARS:     DB    'Z'    ; Clears screen, terminal mode            11CH
  127. BRKCHR:     DB    'Q'    ; Send a break tone                11DH
  128. NODTR:     DB    NO    ; YES if no DTR and need ATH0 to disconnect    11EH
  129. ;.....
  130. ;
  131. ; Input and output ports for data and status
  132. ;
  133. I$MDCTL:  IN    MDCTL1        ;                    11FH
  134.       DB    0,0        ;                    121H
  135.       RET            ; IN modem control port         123H
  136.       DB    0,0,0,0,0    ; Spares if needed            124H
  137. ;
  138. I$MDTXE:  IN    MDCTL1        ; (Needed for SIO or DART register 1    129H
  139.       DB    0,0        ;                    12BH
  140.       RET            ;                    12DH
  141.       DB    0,0,0,0,0    ;                    12EH
  142. ;
  143. I$MDDATP: CALL    INRDY        ;                    133H
  144.       IN    MDDATP        ;                    136H
  145.       RET            ;                    138H
  146.       DB    0,0,0,0        ; Spares if needed            139H
  147. ;
  148. O$MDDATP: CALL    OTDATP        ;                    13DH
  149.       RET            ; OUT modem data port            140H
  150.       DB    0,0,0,0,0,0    ; Spares if needed            141H
  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. ; Special exit vector, used by some computers to reset interrupt vectors
  173. ;
  174. J$EXITVEC:RET            ;                    159H
  175.       DB    0,0        ;                    15AH
  176. ;.....
  177. ;
  178. ; Jump vectors needed by each overlay
  179. ;
  180. J$GOODBYE:JMP    GOODBYE        ; Disconnects modem by dropping DTR    15CH
  181. J$INITMOD:JMP    INITMOD        ; Initializes modem, autosets baudrate    15FH
  182. J$STUPR:  JMP    STUPR        ; SET routine to change baudrate    162H
  183. J$SYSVR:  JMP    SYSVR        ; Signon message            165H
  184. ;.....
  185. ;
  186. ; "AT" command strings, can be replaced in individual overlay if needed
  187. ;
  188. J$STRNGA: DS    3        ; 1200 bps "AT" string            168H
  189. J$STRNG1: DS    3        ; 2400 bps "AT" string            16BH
  190. ;
  191. ; Next fourteen lines should not be changed by user overlay as these go
  192. ; to specific locations in the main program, not in the overlay.
  193. ;
  194. J$CMDSPL: DS    3        ; Allows entry of baudrate on CMD line    16EH
  195. J$CRLF:      DS    3        ; Turns up one new line on display    171H
  196. J$DIAL:      DS    3        ; Start of dialing routine        174H
  197. J$DSCONT: DS    3        ; Terminates modem use            177H
  198. J$GOLST:  DS    3        ; Printer routine, needed by Apple //e    17AH
  199. J$ILPRT:  DS    3        ; Prints an inline string, 0 to end    17DH
  200. J$INBUF:  DS    3        ; Stores a keybd string for comparison    180H
  201. J$INLNCP: DS    3        ; Inline "compare strings" routine    183H
  202. J$INMDM:  DS    3        ; Max .1 sec wait for modem character    186H
  203. J$RCVRSP: DS    3        ; For 3801 I/O use (TV-803)        189H
  204. J$SNDCHR: DS    3        ; Sends a character to the modem    18CH
  205. J$SNDSTR: DS    3        ; Sends a string to the modem, $ to end 18FH
  206. J$TIMER:  DS    3        ; .1 second timer (amount in 'B' reg.)    192H
  207. J$BREAK:  JMP    SENDBRK        ; Break routine             195H
  208. J$NEW2:      DB    0,0,0        ; For future needs            198H
  209. ;.....
  210. ;
  211. ; For 2400 bps auto-stepdown units
  212. ;
  213. MANUAL:      DB    0        ; For manual selection flag        19BH
  214. J$300:      JMP    OK300        ; Sets baudrate to 300 baud        19CH
  215. J$1200:      JMP    OK1200        ; Sets baudrate to 1200 bps        19FH
  216. J$2400:      JMP    OK2400        ; Sets baudrate to 2400 bps        1A2H
  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 DIGITAL GROUP w/IOP port at 040H' ;    1AAH
  223.       DB    CR,LF,0
  224.       RET
  225. ;.....
  226. ;
  227. ;-----------------------------------------------------------------------
  228. ;
  229. ; NOTE:  You can change the SYSVER message to be longer or shorter.  The
  230. ;     end of your last routine should terminate by 0400H (601 bytes
  231. ;     available after start of SYSVER).
  232. ;
  233. ;-----------------------------------------------------------------------
  234. ;
  235. ; You can put in a message at this location which can be called up with
  236. ; (special character-L).  You can put in several lines.  End with a 0.
  237. ;
  238. LOGON:    DB    'Hello from a happy Digital Group user!',CR,LF,0
  239. ;
  240. ;-----------------------------------------------------------------------
  241. ;
  242. ; This routine sets a 300 ms break tone
  243. ;
  244. SENDBRK:
  245.     MVI    A,3FH        ; DTR normal, send break tone
  246.     JMP    GOODBYE+2
  247. ;.....
  248. ;
  249. ;
  250. ; This routine sets DTR low for 300 ms to disonnect the phone
  251. ;
  252. GOODBYE:
  253.     MVI    A,3DH        ; Send break, turn off DTR
  254.     OUT    MDCTL1        ; Send to status port
  255.     MVI    B,3        ; Delay 300 ms to hang up phone
  256.     CALL    J$TIMER
  257.     MVI    A,37H        ; Normal send/receive with DTR
  258.     OUT    MDCTL1        ; Send to status port
  259.     RET
  260. ;.....
  261. ;
  262. ;
  263. ; Sets 8251 to 8 bits, RCV and TX ready
  264. ;
  265. INITMOD:
  266.     MVI    A,0        ; Clear IOP status register
  267.     OUT    IOPSTAT
  268.     NOP
  269.     NOP            ; Let IOP settle
  270.     IN    IOPSTAT
  271.     NOP
  272.     NOP            ; Let IOP settle
  273.     MVI    A,MDSET        ; Initialize IOP
  274.     OUT    MDCTL1
  275.     NOP
  276.     NOP            ; Let IOP settle
  277.     IN    MDCTL1
  278.     NOP
  279.     NOP            ; Let IOP settle
  280. ;
  281.     LDA    MSPEED        ; Get the selected value
  282.     CPI    1        ; 300 bps
  283.     JZ    OK300
  284.     CPI    5        ; 1200 bps
  285.     JZ    OK1200
  286.     CPI    6        ; 2400 bps
  287.     JZ    OK2400
  288.     CPI    8        ; 9600 bps
  289.     JZ    OK9600
  290.     JMP    STUPR1        ; Else ask what is wanted
  291. ;.....
  292. ;
  293. ;
  294. STUPR:    CALL    J$CMDSPL    ; Gives us CMDBUF+6
  295.     JNC    STUPR2
  296. ;
  297. STUPR1:    CALL    J$ILPRT
  298.     DB    'Input Baud Rate (300, 1200, 2400, 9600): ',0
  299.     LXI    D,BAUDBUF    ; Point to new input buffer
  300.     CALL    J$INBUF
  301.     CALL    J$CRLF
  302.     LXI    D,BAUDBUF+2
  303. ;
  304. STUPR2:    CALL    J$INLNCP    ; Compare BAUDBUF+2 with chars. below
  305.     DB    '300',0
  306.     JNC    OK300        ; Go if got match
  307.     CALL    J$INLNCP
  308.     DB    '1200',0
  309.     JNC    OK1200
  310.     CALL    J$INLNCP
  311.     DB    '2400',0
  312.     JNC    OK2400
  313.     CALL    J$INLNCP
  314.     DB    '9600',0
  315.     JNC    OK9600
  316.     CALL    J$ILPRT        ; All matches failed, tell operator
  317.     DB    '++ Incorrect entry ++',CR,LF,BELL,CR,LF,0
  318.     JMP    STUPR1        ; Try again
  319. ;
  320. OK300:    MVI    A,1        ; MSPEED 300 baud value
  321.     LXI    H,BD300        ; Get 300 baud parameters in 'HL'
  322.     JMP    LOADBD        ; Go load them
  323. ;
  324. OK1200:    MVI    A,5
  325.     LXI    H,BD1200
  326.     JMP    LOADBD
  327. ;
  328. OK2400:    XRA    A
  329.     STA    MANUAL        ; Reset to maximum auto-speed
  330.     MVI    A,6
  331.     LXI    H,BD2400
  332.     JMP    LOADBD
  333. ;
  334. OK9600:    MVI    A,8
  335.     LXI    H,BD9600
  336. ;
  337. LOADBD:    STA    MSPEED        ; Change time-to-send to match baudrate
  338.     MVI    A,IOPCH
  339.     OUT    IOPSTAT        ; Baudrate generator command port
  340.     MOV    A,L
  341.     OUT    COMMND
  342.     RET
  343. ;.....
  344. ;
  345. ;
  346. ; Character ready from modem?
  347. ;
  348. INRDY:    IN    MDCTL1
  349.     ANI    MDRCV
  350.     RNZ
  351.     XRA    A
  352.     RET
  353. ;.....
  354. ;
  355. ;
  356. ; Out to modem
  357. ;
  358. OTDATP:    PUSH    PSW
  359. ;
  360. OTD1:    IN    MDCTL1
  361.     ANI    MDSND
  362.     JNZ    OTD2
  363.     JMP    OTD1        ; Try it again
  364. ;
  365. OTD2:    POP    PSW
  366.     OUT    MDDATP
  367.     RET
  368. ;.....
  369. ;
  370. ;
  371. ; Table of baudrate parameters
  372. ;
  373. BD300    EQU    1        ; 300 bps
  374. BD1200    EQU    3        ; 1200 bps
  375. BD2400    EQU    4        ; 2400 bps
  376. BD9600    EQU    6        ; 9600 bps
  377. ;
  378. BAUDBUF:DB    10,0,0,0,0,0
  379.     DB    0,0,0,0,0,0
  380. ;
  381. ;                   end
  382. ;-----------------------------------------------------------------------
  383. ;
  384. ; NOTE: Must terminate by 0400H
  385. ;
  386.     END
  387.