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 / BEEHIVE / COMMS / IMP-OV5B.LBR / I2NC-2.AZM / I2NC-2.ASM
Assembly Source File  |  2000-06-30  |  11KB  |  378 lines

  1.  
  2. ; I2NC-2.ASM  -  NCR Decision Mate 5 overlay for IMP  -  06/01/87
  3. ;
  4. ;     2661C I/O, built-in baudrate generator at 5.0688 MHz
  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 places adapts the NCR Decision Mate 5 computer 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,I2NC-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. ; 02/17/87  Written to work with IMP        - Irv Hoff
  36. ;
  37. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  38. ;
  39. ;
  40. ;
  41. YES    EQU    0FFH
  42. NO    EQU    0
  43. ;
  44. ;
  45. ; Values shown are for a 2661C I/O
  46. ;
  47. PORT    EQU    70H    ; Your base port (data or status)
  48. MDCTL1    EQU    PORT+1    ; Modem control port
  49. MDDATP    EQU    PORT    ; Modem data port
  50. MDRCV    EQU    02H    ; Modem receive ready
  51. MDSND    EQU    01H    ; Modem send ready bit
  52. MDTXE    EQU    05H    ; Modem send buffer empty, holding buffer empty
  53. ;
  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. ;-----------------------------------------------------------------------
  67. ;
  68. ; Change the clock speed if needed, to match your system.  The 2661C
  69. ; normally runs 5.0688 MHz.
  70. ;
  71. ;
  72.      ORG    0100H
  73. ;
  74. ;
  75.      DS    3    ; Skip the data area below
  76. ;
  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
  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    CLEARSC    ; 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. EXTCHR:     DB    '['-40H    ; ESC = preceeds local control character    114H
  110. EXITCHR: DB    'E'    ; Exit character                115H
  111. FILESND: DB    'F'    ; Send file when in terminal mode        116H
  112. NOCONCT: DB    'N'    ; Disconnect from phone line            117H
  113. LOGCHR:     DB    'L'    ; Send logon                    118H
  114. LSTCHR:     DB    'P'    ; Toggle printer                119H
  115. UNSAVCH: DB    'R'    ; Close input text buffer            11AH
  116. SAVECHR: DB    'Y'    ; Open input text buffer            11BH
  117. CLEARS:     DB    'Z'    ; Clears screen, terminal mode            11CH
  118. BRKCHR:     DB    'Q'    ; Send a break tone                11DH
  119. NODTR:     DB    NO    ; YES if no DTR and need ATH0 to disconnect    11EH
  120. ;.....
  121. ;
  122. ;
  123. ; Handles in/out ports for data and status
  124. ;
  125. I$MDCTL1: IN    MDCTL1        ;                    11FH
  126.       RET            ; IN modem control port         121H
  127.       DB    0,0,0,0,0,0,0    ; Spares if needed            122H
  128. ;
  129. I$MDTXE:  IN    MDCTL1        ; (Needed for SIO or DART register 1    129H
  130.       RET            ;                    12BH
  131.       DB    0,0,0,0,0,0,0    ;                    12CH
  132. ;
  133. I$MDDATP: IN    MDDATP        ;                    133H
  134.       RET            ;                    135H
  135.       DB    0,0,0,0,0,0,0    ;                    136H
  136. ;
  137. O$MDDATP: OUT    MDDATP+4        ;                    13DH
  138.       RET            ; OUT modem data port            13FH
  139.       DB    0,0,0,0,0,0,0    ; Spares if needed            140H
  140. ;.....
  141. ;
  142. ;
  143. A$MDRCV:  ANI    MDRCV        ;                    147H
  144.       RET            ;                    149H
  145. ;
  146. C$MDRCV:  CPI    MDRCV        ;                    14AH
  147.       RET            ;                    14CH
  148. ;
  149. A$MDSND:  ANI    MDSND        ;                    14DH
  150.       RET            ;                    14FH
  151. ;
  152. C$MDSND:  CPI    MDSND        ;                    150H
  153.       RET            ;                    152H
  154. ;
  155. A$MDTXE:  ANI    MDTXE        ;                    153H
  156.       RET            ;                    155H
  157. ;
  158. C$MDTXE:  CPI    MDTXE        ;                    156H
  159.       RET            ;                    158H
  160. ;.....
  161. ;
  162. ;
  163. ; Special exit vector, used by some computers to reset interrupt vectors
  164. ;
  165. J$EXITVEC:RET            ;                    159H
  166.       DB    0,0        ;                    15AH
  167. ;.....
  168. ;
  169. ;
  170. ; Jump vectors needed by each overlay
  171. ;
  172. J$GOODBYE:JMP    GOODBYE        ; Disconnects modem by dropping DTR    15CH
  173. J$INITMOD:JMP    INITMOD        ; Initializes modem, autosets baudrate    15FH
  174. J$STUPR:  JMP    STUPR        ; SET routine to change baudrate    162H
  175. J$SYSVR:  JMP    SYSVR        ; Signon message            165H
  176. ;.....
  177. ;
  178. ;
  179. ; "AT" command strings, can be replaced in individual overlay if needed
  180. ;
  181. J$STRNGA: DS    3        ; 1200 bps "AT" string            168H
  182. J$STRNG1: DS    3        ; 2400 bps "AT" string            16BH
  183. ;
  184. ;
  185. ; Next fourteen lines should not be changed by user overlay as these go
  186. ; to specific locations in the main program, not in the overlay.
  187. ;
  188. ;
  189. J$CMDSPL: DS    3        ; Allows entry of baudrate on CMD line    16EH
  190. J$CRLF:      DS    3        ; Turns up one new line on display    171H
  191. J$DIAL:      DS    3        ; Start of dialing routine        174H
  192. J$DSCONT: DS    3        ; Terminates modem use            177H
  193. J$GOLST:  DS    3        ; Printer routine, needed by Apple //e    17AH
  194. J$ILPRT:  DS    3        ; Prints an inline string, 0 to end    17DH
  195. J$INBUF:  DS    3        ; Stores a keybd string for comparison    180H
  196. J$INLNCP: DS    3        ; Inline "compare strings" routine    183H
  197. J$INMDM:  DS    3        ; Max .1 sec wait for modem character    186H
  198. J$RCVRSP: DS    3        ; For 3801 I/O use (TV-803)        189H
  199. J$SNDCHR: DS    3        ; Sends a character to the modem    18CH
  200. J$SNDSTR: DS    3        ; Sends a string to the modem, $ to end 18FH
  201. J$TIMER:  DS    3        ; .1 second timer (amount in 'B' reg.)    192H
  202. J$BREAK:  JMP    SENDBRK        ; Break routine             195H
  203. J$NEW2:      DB    0,0,0        ; For future needs            198H
  204. ;.....
  205. ;
  206. ;
  207. ; For 2400 bps auto-stepdown units
  208. ;
  209. MANUAL:      DB    0        ; For manual selection flag        19BH
  210. J$300:      JMP    OK300        ; Sets baudrate to 300 baud        19CH
  211. J$1200:      JMP    OK1200        ; Sets baudrate to 1200 bps        19FH
  212. J$2400:      JMP    OK2400        ; Sets baudrate to 2400 bps        1A2H
  213. ;.....
  214. ;
  215. ;
  216. LOGPTR:      DW    LOGON        ; Pointer to display LOGON message    1A5H
  217. ;
  218. SYSVR:      CALL    J$ILPRT        ; Display the following line        1A7H
  219.       DB    'Version for NCR Decision Mate 5 modem port 70h' ;    1AAH
  220.       DB    CR,LF,0
  221.       RET
  222. ;.....
  223. ;
  224. ;
  225. ;-----------------------------------------------------------------------
  226. ;
  227. ; NOTE:  You can change the SYSVER message to be longer or shorter.  The
  228. ;     end of your last routine should terminate by 0400H (601 bytes
  229. ;     available after start of SYSVER).
  230. ;
  231. ;-----------------------------------------------------------------------
  232. ;
  233. ; You can put in a message at this location which can be called up with
  234. ; (special character-L).  You can put in several lines.  End with a 0.
  235. ;
  236. LOGON:    DB    'Hello from a NCR Decision Mate 5 computer',CR,LF,0
  237. ;
  238. ;-----------------------------------------------------------------------
  239. ;
  240. ; This routine sets a 300 ms break tone
  241. ;
  242. SENDBRK:
  243.     MVI    A,1FH        ; DTR normal, send break tone
  244.     JMP    GOODBYE+2    ; Send the break tone
  245. ;.....
  246. ;
  247. ;
  248. ; This routine sets DTR low for 300 ms to disconnect the phone
  249. ;
  250. GOODBYE:
  251.     MVI    A,1DH        ; Set RTS, flags, DTR, break
  252.     OUT    PORT+3        ; Put command register out of mode
  253.     IN    PORT+3        ; Make sure it is now clear
  254.     IN    PORT+3        ; Try once more
  255.     MVI    B,3        ; Turn off DTR for 300 ms
  256.     CALL    J$TIMER
  257.     MVI    A,37H        ; Turn DTR back on
  258.     OUT    PORT+3        ; Send to command register
  259.     IN    PORT+3        ; Clear any incoming characters
  260.     IN    PORT+3        ; Try once more
  261.     XRA    A        ; Clear the 'A' register
  262.     RET
  263. ;.....
  264. ;
  265. ;
  266. ; The following are used in setting up the 2661C I/O port
  267. ;
  268. INITMOD:
  269.     LDA    MSPEED        ; Get the selected value
  270.     CPI    1        ; 300 bps
  271.     JZ    OK300
  272.     CPI    5        ; 1200 bps
  273.     JZ    OK1200
  274.     CPI    6        ; 2400 bps
  275.     JZ    OK2400
  276.     CPI    8        ; 9600 bps
  277.     JZ    OK9600
  278.     CPI    9        ; 19200 bps
  279.     JZ    OK19200
  280.     JMP    STUPR1        ; Else ask what is wanted
  281. ;
  282. INITMOD1:
  283.     XRA    A        ; Set RTS, flags, DTR, disable R/T
  284.     OUT    PORT+7        ; Put command register out of mode
  285.     IN    PORT+3        ; Make sure it is now clear
  286.     IN    PORT+3        ; Try once more  (CE, 2 stop, 4E 1 stop)
  287.     MVI    A,04EH        ; 1 stop, no parity, 8 bits, 16x asynch
  288.     OUT    PORT+6        ; Send to mode register 1
  289. ;
  290. INITMOD2:
  291.     MVI    A,0F8H        ; Start with 1200 baud (4.9152 clock)
  292.     OUT    PORT+6        ; Send to mode register 2
  293.     MVI    A,37H        ; Reset RTS, flags, DTR low, enable R/T
  294.     OUT    PORT+7        ; Send to command register
  295.     IN    PORT+3        ; Clear any incoming chars.
  296.     IN    PORT+3        ; Try once more
  297.     XRA    A        ; Clear the 'A' register
  298.     RET
  299. ;.....
  300. ;
  301. ;
  302. ; The following changes the baud rate with the set command.
  303. ;
  304. STUPR:    CALL    J$CMDSPL    ; Gives us CMDBUF+6
  305.     JNC    STUPR2
  306. ;
  307. STUPR1:    CALL    J$ILPRT
  308.     DB    'Input Baud Rate (300, 1200, 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
  335.     JMP    LOADBD
  336. ;
  337. OK1200:    MVI    A,5
  338.     MVI    B,BD1200
  339.     JMP    LOADBD
  340. ;
  341. OK2400:    XRA    A
  342.     STA    MANUAL        ; Reset for automatic stepdown
  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.     MOV    A,B        ; Get baudrate byte
  356.     STA    INITMOD2+1    ; Store in INITMOD
  357.     JMP    INITMOD1    ; Reinitialize to new baudrate, done
  358. ;.....
  359. ;
  360. ;
  361. ; Table of baudrate parameters for 2661C I/O
  362. ;
  363. BD300    EQU    0F5H
  364. BD1200    EQU    0F7H
  365. BD2400    EQU    0FAH
  366. BD9600    EQU    0FEH
  367. BD19200    EQU    0FFH
  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 prior to 0400H
  376. ;
  377.     END
  378.