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