home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / beehive / comms / imp-ovl.arc / I2IBM.ASM < prev    next >
Encoding:
Assembly Source File  |  1991-02-03  |  11.0 KB  |  403 lines

  1.  
  2.     TITLE 'I2IBM.ASM - IBM PC w/NEC V20 overlay file for IMP2 - 05/23/86'
  3. ;        Run under V20CPM.COM                
  4. ;
  5. ; You will want to look this file over carefully. There are a number of
  6. ; options that you can use to configure the program to suit your taste.
  7. ;
  8. ; Edit this file for your preferences then follow the "TO USE:" example
  9. ; shown below.
  10. ;
  11. ; Many terminals will clear the screen with a CTL-Z.  If yours does, put
  12. ; a 1AH at CLEAR: (010AH).  Many terminals use two characters, the first
  13. ; normally an ESC.  For example, ESC *.  In this case put '*' at CLEAR:
  14. ; (The ESC will automatically be typed with no CTL-character present.)
  15. ; If you don't know what your terminal uses, put a 0 at CLEAR: and IMP2
  16. ; will scroll up 24 blank lines to clear the CRT for things like MENU,
  17. ; looking at the function key table, typing CTL-Z in command mode, etc.
  18. ;
  19. ; Use the "SET" command to change the baudrate when desired.  The value
  20. ; at MSPEED controls the baudrate when the program is first called up.
  21. ;
  22. ;    TO USE: First edit this file filling in answers for your own
  23. ;        equipment.  Then assemble with ASM.CPM or equivalent
  24. ;        assembler.  Then use MLOAD to merge into the main file:
  25. ;
  26. ;        MLOAD IMP.CPM=IMP244.CPM,I2IBM
  27. ;
  28. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  29. ;
  30. ; 05/23/86 - Adapted to IBM PC with NEC V20     - Dennis Fagan
  31. ; 07/17/85 - Written to work with IMP2        - Irv Hoff
  32. ;
  33. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  34. ;
  35. ;
  36. YES    EQU    0FFH
  37. NO    EQU    0
  38. ;
  39. ;
  40. PORT    EQU    3F8H    ; Base port (data or Baud rate)
  41. MODCMD     EQU    PORT+3    ; Modem control port
  42. MODDAT     EQU    PORT    ; Modem data port
  43. MODSTT    EQU    PORT+5    ; Modem status port
  44. MODST2    EQU    PORT+6    ; Modem status port 2
  45. ;
  46. MDRCV    EQU    01H    ; Modem receive ready
  47. MDTXE    EQU    20H    ; Modem transmit ready                         
  48. MDCTS    EQU    10H    ; Modem CTS
  49. ;
  50. BRPORT    EQU    PORT    ; Baud rate generator port
  51. ;
  52. ;
  53. ;-----------------------------------------------------------------------
  54. ;
  55. ESC    EQU    '['-40H    ; ^[ = Escape
  56. BELL    EQU    'G'-40H    ; ^G = Bell character
  57. LF    EQU    'J'-40H    ; ^J = Linefeed
  58. èNEXTRY    EQU    'K'-40H    ; ^K = Try next phone number, abort this try
  59. CR    EQU    'M'-40H    ; ^M = Carriage return
  60. CLEARSC    EQU    'Z'-40H    ; ^Z = Clears screen, command mode only
  61. EOFCHAR    EQU    'Z'-40H    ; ^Z = End of file
  62. ;
  63. ;
  64. ;-----------------------------------------------------------------------
  65. ;
  66. ; NOTE:    The following patch enables status checking on an 8250 Comm. IC.
  67. ;    This chip senses RXRDY & TXRDY on one port and CTS on another.
  68. ;    The ORG of this patch is version dependent.  This is for IMP244.
  69. ;    To install on another version, examine the code referenced from
  70. ;    loc. 186 and change the CALL 11F to a CALL 129.
  71. ;
  72.      ORG    1ED1H
  73.     CALL    I$MDRTXE
  74. ;
  75.     ORG    0100H
  76. ;
  77. ;
  78.     DS    3    ; Skip the data area below
  79. ;
  80. ;
  81. ; These routines and equates are at the beginning of the program so
  82. ; they can be patched by a monitor or overlay file without re-assembling
  83. ; the program.
  84. ;
  85. MSPEED:     DB    5    ; 0=110 1=300 2=450 3=600 4=710 5=1200        103H
  86.             ; 6=2400 7=4800 8=9600 9=19200 default
  87. HS2400:     DB    NO     ; Yes=2400 bps highest speed            104H
  88. HS1200:     DB    YES    ; Yes=1200 bps highest speed            105H
  89. RACAL:     DB    NO    ; Yes=Racal-Vadic 1200V or 2400V or 2400PA    106H
  90. PROMODM: DB    NO    ; Yes=Prometheus ProModem 1200 bps        107H
  91. RESVD1:     DB    NO    ; Reserved for special modems            108H
  92. RESVD2:     DB    NO    ; Reserved for special modems            109H
  93. ;
  94. ;
  95. CLEAR:     DB    1AH    ; Clear screen character (ESC not needed)    10AH
  96. CLOCK:     DB    38    ; Clock speed in MHz x10, 25.5 MHz max.     10BH
  97.             ; 20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
  98. BYTDLY:     DB    2    ; 0=0 delay  1=10ms  5=50 ms - 9=90 ms        10CH
  99.             ;   default time to send character in ter-
  100.             ;   minal mode file transfer for slow BBS
  101. CRDLY:     DB    2    ; 0=0 delay 1=100 ms 5=500 ms - 9=900 ms    10DH
  102.             ;   default time for extra wait after CRLF
  103.             ;   in terminal mode file transfer
  104. NOFCOL:     DB    5    ; Number of directory columns shown        10EH
  105. TCHPUL:     DB    'T'    ; T=tone, P=Pulse (Hayes 2400 modems)        10FH
  106. ;.....
  107. ;
  108. ;
  109. ADDLFD:     DB    NO    ; Yes=add LF after CR to send file in terminal    110H
  110.             ;   mode (normally added by remote echo)
  111. CONVRUB: DB    NO    ; Yes=convert rub to backspace            111H
  112. CRCDFLT: DB    YES    ; Yes=default to CRC checking            112H
  113. IGNRCTL: DB    NO    ; Yes=CTL-chars above ^M not displayed        113H
  114. ;.....
  115. ;
  116. ;
  117. EXTCHR:     DB    '['-40H    ; ESC = preceeds local control character    114H
  118. EXITCHR: DB    'E'    ; Exit character                115H
  119. FILESND: DB    'F'    ; Send file when in terminal mode        116H
  120. NOCONCT: DB    'N'    ; Disconnect from phone line            117H
  121. èLOGCHR:     DB    'L'    ; Send logon                    118H
  122. LSTCHR:     DB    'P'    ; Toggle printer                119H
  123. UNSAVCH: DB    'R'    ; Close input text buffer            11AH
  124. SAVECHR: DB    'Y'    ; Open input text buffer            11BH
  125. CLEARS:     DB    'Z'    ; Clears screen, terminal mode            11CH
  126. SPARE1:     DB    0    ; For future development            11DH
  127. NODTR:      DB    YES    ; Text string DTR                     11EH
  128. ;.....
  129. ;
  130. ;
  131. ; Handles in/out ports for data and status
  132. ;
  133.       ORG    11FH
  134. I$MDCTL:  PUSH  H          ; Read Modem status                   11FH
  135.       PUSH    D
  136.       PUSH    B    
  137.       LXI    D,MODST2    ; Select port
  138.       JMP    INCOM1        ; Common code
  139. ;
  140.       ORG    129H
  141. I$MDRTXE: PUSH    H                  ; Read RX/TX status               129H
  142.       PUSH    D
  143.       PUSH    B
  144.       LXI    D,MODSTT    ; Select port
  145.       JMP    INCOM1        ; Common code
  146. ;
  147.       ORG    133H
  148. I$MDDATP: PUSH  H        ; Read data                133H
  149.       PUSH    D
  150.       PUSH    B
  151.       LXI    D,MODDAT    ; Select port
  152.       JMP    INCOM1        ; Common code
  153. ;
  154.       ORG    13DH
  155. O$MDDATP: PUSH    H          ; Write data                13DH
  156.       PUSH    D
  157.       PUSH    B
  158.       LXI    D,MODDAT    ; Select port
  159.       JMP    OUCOM1
  160. ;.....
  161. ;
  162. ;
  163.       ORG    147H
  164. A$MDRCV:  ANI    MDRCV        ;                    147H
  165.       RET            ;                    149H
  166. ;
  167. C$MDRCV:  CPI    MDRCV        ;                    14AH
  168.       RET            ;                    14CH
  169. ;
  170. A$MDSND:  ANI    MDCTS        ;                    14DH
  171.       RET            ;                    14FH
  172. ;
  173. C$MDSND:  CPI    MDCTS        ;                    150H
  174.       RET            ;                    152H
  175. ;
  176. A$MDTXE:  ANI    MDTXE        ;                    153H
  177.       RET            ;                    155H
  178. ;
  179. C$MDTXE:  CPI    MDTXE        ;                    156H
  180.       RET            ;                    158H
  181. ;.....
  182. ;
  183. ;
  184. ; Special exit vector, used by some computers to reset interrupt vectors
  185. è;
  186. J$EXITVEC:RET            ;                    159H
  187.       DB    0,0        ;                    15AH
  188. ;.....
  189. ;
  190. ;
  191. ; Jump vectors needed by each overlay
  192. ;
  193. J$GOODBYE:JMP    GOODBYE        ; Disconnects modem by dropping DTR    15CH
  194. J$INITMOD:JMP    INITMOD        ; Initializes modem, autosets baudrate    15FH
  195. J$STUPR:  JMP    STUPR        ; SET routine to change baudrate    162H
  196. J$SYSVR:  JMP    SYSVR        ; Signon message            165H
  197. ;.....
  198. ;
  199. ;
  200. ; "AT" command strings, can be replaced in individual overlay if needed
  201. ;
  202. J$STRNGA: DS    3        ; 1200 bps "AT" string            168H
  203. J$STRNG1: DS    3        ; 2400 bps "AT" string            16B:IMP
  204. ;
  205. ;
  206. ; Next fourteen lines should not be changed by user overlay as these go
  207. ; to specific locations in the main program, not in the overlay.
  208. ;
  209. ;
  210. J$CMDSPL: DS    3        ; Allows entry of baudrate on CMD line    16EH
  211. J$CRLF:      DS    3        ; Turns up one new line on display    171H
  212. J$DIAL:      DS    3        ; Start of dialing routine        174H
  213. J$DSCONT: DS    3        ; Terminates modem use            177H
  214. J$GOLST:  DS    3        ; Printer routine, needed by Apple //e    17AH
  215. J$ILPRT:  DS    3        ; Prints an inline string, 0 to end    17DH
  216. J$INBUF:  DS    3        ; Stores a keybd string for comparison    180H
  217. J$INLNCP: DS    3        ; Inline "compare strings" routine    183H
  218. J$INMDM:  DS    3        ; Max .1 sec wait for modem character    186H
  219. J$RCVRSP: DS    3        ; For 3801 I/O use (TV-803)        189H
  220. J$SNDCHR: DS    3        ; Sends a character to the modem    18CH
  221. J$SNDSTR: DS    3        ; Sends a string to the modem, $ to end 18FH
  222. J$TIMER:  DS    3        ; .1 second timer (amount in 'B' reg.)    192H
  223. J$NEW1:      DB    0,0,0        ; For future needs            195H
  224. J$NEW2:      DB    0,0,0        ; For future needs            198H
  225. ;.....
  226. ;
  227. ;
  228. ; For 2400 bps auto-stepdown units
  229. ;
  230. MANUAL:      DB    0        ; For manual selection flag        19BH
  231. J$300:      JMP    OK300        ; Sets baudrate to 300 baud        19CH
  232. J$1200:      JMP    OK1200        ; Sets baudrate to 1200 bps        19FH
  233. J$2400:      JMP    OK2400        ; Sets baudrate to 2400 bps        1A2H
  234. ;.....
  235. ;
  236. ;
  237. LOGPTR:      DW    LOGON        ; Pointer to display LOGON message    1A5H
  238. ;
  239. SYSVR:      CALL    J$ILPRT        ; Display the following line        1A7H
  240. è      DB    'Version for IBM PC running a NEC V20' ;        1AAH
  241.       DB     ' under V2080',CR,LF,0
  242.       RET
  243. ;.....
  244. ;
  245. ;
  246. ;-----------------------------------------------------------------------
  247. ;
  248. ; NOTE:  You can change the SYSVER message to be longer or shorter.  The
  249. ;     end of your last routine should terminate by 0400H (601 bytes
  250. ;     available after start of SYSVER).
  251. ;
  252. ;-----------------------------------------------------------------------
  253. ;
  254. ; You can put in a message at this location which can be called up with
  255. ; (special character-L).  You can put in several lines.  End with a 0.
  256. ;
  257. LOGON:    DB    'This is an IBM PC',CR,LF,0
  258. ;
  259. ;-----------------------------------------------------------------------
  260. ;
  261. ;
  262. GOODBYE:
  263.     MVI    B,'S'-40H    ; X-off to stop host if needed
  264.     CALL    J$SNDCHR
  265.     RET
  266. ;
  267. OUTD2:    PUSH    H
  268.     PUSH    D
  269.     PUSH    B
  270.     LXI    D,MODDAT+1    ; Select port
  271. ;
  272. OUCOM1:    MOV    C,A        ; Set value
  273.     MVI    B,1        ; Set output (B<>0)
  274.     DB    21H        ; Trick jump over INCOM1
  275. ;
  276. INCOM1:    MVI    B,0        ; Set input (B=0)
  277.     MVI    A,1        ; Flag direct port I/O
  278.     DW    0EDEDH        ; NEC V20 to 8086 code change
  279.     DB    62H        ; Via INT 62
  280.     POP    B        ; Restore
  281.     POP    D
  282.     POP    H
  283.     RET            ; Done with I/O
  284. ;
  285. OUTC2:    PUSH    H
  286.     PUSH    D
  287.     PUSH    B
  288.     LXI    D,MODCMD+1    ; Select port
  289.     JMP    OUCOM1        ; Common code
  290. ;
  291. OUTCMD:    PUSH    H
  292.     PUSH    D
  293.     PUSH    B
  294.     LXI    D,MODCMD    ; Select port
  295.     JMP    OUCOM1        ; Common code
  296. ;
  297. ;
  298. ; IBM PC initialization -- sets CTC timer for send and receive baudrate
  299. ;
  300. ;
  301. INITMOD:
  302.     LDA    MSPEED        ; Get the selected value
  303.     CPI    10
  304.     JC    LOADBD        ; set it
  305.     JMP    STUPR1        ; Else ask what is wanted
  306. ;.....
  307. ;
  308. ;
  309. ; Sets the modem speed via the SET command.
  310. ;
  311. ;
  312. STUPR:    CALL    J$CMDSPL    ; Gives us CMDBUF+6
  313.     JNC    STUPR2
  314. ;
  315. STUPR1:    CALL    J$ILPRT
  316.     DB    'Input Baud Rate ( 110, 300, 600, 1200, 2400, 4800, 9600): ',0
  317.     LXI    D,BAUDBUF    ; Point to new input buffer
  318.     CALL    J$INBUF
  319.     CALL    J$CRLF
  320.     LXI    D,BAUDBUF+2
  321. ;
  322. STUPR2:    CALL    J$INLNCP    ; Compare BAUDBUF+2 with chars. below
  323.     DB    '110',0
  324.     JNC    OK110
  325.     CALL    J$INLNCP
  326.     DB    '300',0
  327.     JNC    OK300        ; Go if got match
  328.     CALL    J$INLNCP
  329.     DB    '600',0
  330.     JNC    OK600
  331.     CALL    J$INLNCP
  332.     DB    '1200',0
  333.     JNC    OK1200
  334.     CALL    J$INLNCP
  335.     DB    '2400',0
  336.     JNC    OK2400
  337.     CALL    J$INLNCP
  338.     DB    '4800',0
  339.     JNC    OK4800
  340.     CALL    J$INLNCP
  341.     DB    '9600',0
  342.     JNC    OK9600
  343. BRER:    CALL    J$ILPRT        ; All matches failed, tell operator
  344.     DB    '++ Incorrect entry ++',CR,LF,BELL,CR,LF,0
  345.     JMP    STUPR1        ; Try again
  346. ;
  347. OK110:    SUB    A        ; A=0
  348.     DB    11H        ; Trick jump
  349. ;
  350. OK300:    MVI    A,1        ; A=1
  351.     DB    11H      
  352. ;
  353. OK600:     MVI    A,3
  354.     DB    11H
  355. ;
  356. èOK1200:    MVI    A,5
  357.     DB    11H
  358. ;
  359. OK2400:    MVI    A,6
  360.     DB    11H
  361. ;
  362. OK4800:    MVI    A,7
  363.     DB    11H
  364. ;
  365. OK9600:    MVI    A,8
  366. ;
  367. LOADBD:    STA    MSPEED        ; Change time-to-send to match baudrate
  368.     MOV    E,A        ; Get baudrate byte
  369.     MVI    D,0
  370.     LXI    H,BAUDTB    ; Build pntr
  371.     DAD    D
  372.     DAD    D
  373.     MOV    A,M        ; Fetch timer val
  374.     ORA    A
  375.     JZ    BRER        ; Non-supported
  376.     MVI    A,80H        ; Setup for baud divisor
  377.     CALL    OUTCMD
  378.     MOV    A,M        ; Set LSH
  379.     CALL    O$MDDATP
  380.     INX    H
  381.     MOV    A,M        ; Set MSH
  382.     CALL    OUTD2
  383.     MVI    A,3
  384.     CALL    OUTCMD        ; 8 Bit data,no parity,1 SB
  385.     JMP    OUTC2        ; DTR/RTS  
  386. ;
  387. BAUDTB:    DW     417H        ; 110
  388.     DW    180H        ; 300
  389.     DW    0
  390.     DW    0C0H        ; 600
  391.     DW    0
  392.     DW    060H        ; 1200
  393.     DW    030H        ; 2400
  394.     DW    018H        ; 4800
  395.     DW    00CH        ; 9600
  396.     DW    0
  397. ;
  398. BAUDBUF:DB    10,0,0,0,0,0
  399.     DB    0,0,0,0,0,0
  400. ;
  401. ;                   end
  402. ;-----------------------------------------------------------------------
  403. ;
  404. ; NOTE: Must terminate prior to 0400H
  405. ;
  406.     END
  407. 
  408.