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

  1.  
  2. ; I2TD-1.ASM  -  TurboDos 1.4x overlay file for IMP -  06/01/87
  3. ;
  4. ;            Uses the 8116 Baudrate generator
  5. ;
  6. ; This overlay file adapts TurboDos 1.4x to IMP244 and an external modem.
  7. ;
  8. ; Edit this file for your preferences then follow the "TO USE:" example
  9. ; shown below.
  10. ;
  11. ; Use the "SET" command to change the baudrate when desired.  The value
  12. ; at MSPEED controls the baudrate when the program is first called up.
  13. ;
  14. ;    TO USE: First edit this file filling in answers for your own
  15. ;        equipment.  Then assemble with ASM.COM or equivalent
  16. ;        assembler.  Then use MLOAD to merge into the main file:
  17. ;
  18. ;        MLOAD IMP.COM=IMP.COM,I2TD-x.HEX
  19. ;
  20. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  21. ;
  22. ; 06/01/87  Added 19200 bps, added BREAK routine, needs IMP245 to use
  23. ;    v2     it. (It uses the 19200 bps.)    - Irv Hoff
  24. ;
  25. ; 05/20/87  Initial version            - Greg Davis, Sysop
  26. ;    v1                       Lewisville, TX RCP/M
  27. ;                          (214) 221-1956
  28. ;
  29. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  30. ;
  31. ;
  32. YES    EQU    0FFH
  33. NO    EQU    0
  34. ;
  35. ;
  36. ; TurboDos /// equates
  37. ;
  38. TDOS    EQU    050H    ; T-function entry
  39. CHNL    EQU    0    ; Modem channel ( 0 or 1 )
  40. ;        ^-------; Change this to your channel number
  41. ;
  42. ;-----------------------------------------------------------------------
  43. ;
  44. ESC    EQU    1BH    ; Escape
  45. BELL    EQU    'G'-40H    ; ^G = Bell character
  46. LF    EQU    'J'-40H    ; ^J = Linefeed
  47. NEXTRY    EQU    'K'-40H    ; ^K = Try next phone number, abort this try
  48. CR    EQU    'M'-40H    ; ^M = Carriage return
  49. CLEARSC    EQU    'Z'-40H    ; ^Z = Clear screen, command mode only
  50. EOFCHAR    EQU    'Z'-40H    ; ^Z = End of file
  51. ;
  52. MDRCV    EQU    1    ; Bit to test for receive
  53. MDSND    EQU    0    ; Bit to test for send
  54. MDTXE    EQU    0    ; Modem send buffer empty
  55. ;
  56. ;-----------------------------------------------------------------------
  57. ;
  58. ;
  59.     ORG    0100H
  60. ;
  61.     DS    3    ; Skip the data area below
  62. ;
  63. ; These routines and equates are at the beginning of the program so
  64. ; they can be patched by a monitor or overlay file without re-assembling
  65. ; the program.
  66. ;
  67. MSPEED:     DB    5    ; 0=110 1=300 2=450 3=600 4=710 5=1200        103H
  68.             ; 6=2400 7=4800 8=9600 9=19200 default
  69. HS2400:     DB    NO    ; Yes=2400 bps highest speed            104H
  70. HS1200:     DB    YES    ; Yes=1200 bps highest speed            105H
  71. RACAL:     DB    NO    ; Yes=Racal-Vadic 1200V or 2400V or 2400PA    106H
  72. PROMODM: DB    NO    ; Yes=Prometheus ProModem 1200 bps        107H
  73. RESVD1:     DB    NO    ; Reserved for special modems            108H
  74. RESVD2:     DB    NO    ; Reserved for special modems            109H
  75. ;
  76. CLEAR:     DB    1AH    ; Clear screen character (ESC not needed)    10AH
  77. ;
  78. CLOCK:     DB    40    ; Clock speed in MHz x10, 25.5 MHz max.     10BH
  79.             ; 20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
  80.             ; 4 for Apple ///
  81. BYTDLY:     DB    2    ; 0=0 delay  1=10ms  5=50 ms - 9=90 ms        10CH
  82.             ;   default time to send character in ter-
  83.             ;   minal mode file transfer for slow BBS
  84. CRDLY:     DB    2    ; 0=0 delay 1=100 ms 5=500 ms - 9=900 ms    10DH
  85.             ;   default time for extra wait after CRLF
  86.             ;   in terminal mode file transfer
  87. NOFCOL:     DB    5    ; Number of directory columns shown        10EH
  88. TCHPUL:     DB    'T'    ; T=tone, P=Pulse (Hayes 2400 modems)        10FH
  89. ;
  90. ADDLFD:     DB    NO    ; Yes=add LF after CR to send file in terminal    110H
  91.             ;   mode (normally added by remote echo)
  92. CONVRUB: DB    YES    ; Yes=convert rub to backspace            111H
  93. CRCDFLT: DB    YES    ; Yes=default to CRC checking            112H
  94. IGNRCTL: DB    YES    ; Yes=CTL-chars above ^M not displayed        113H
  95. ;
  96. EXTCHR:     DB    '['-40H    ; ESC = preceeds local control character    114H
  97. EXITCHR: DB    'E'    ; Exit character                115H
  98. FILESND: DB    'F'    ; Send file when in terminal mode        116H
  99. NOCONCT: DB    'N'    ; Disconnect from phone line            117H
  100. LOGCHR:     DB    'L'    ; Send logon                    118H
  101. LSTCHR:     DB    'P'    ; Toggle printer                119H
  102. UNSAVCH: DB    'R'    ; Close input text buffer            11AH
  103. SAVECHR: DB    'Y'    ; Open input text buffer            11BH
  104. CLEARS:     DB    'Z'    ; Clears screen, terminal mode            11CH
  105. SPARE1:     DB    0    ; For future development            11DH
  106. NODTR:     DB    NO    ; Yes if no DTR and need ATH0 to disconnect    11EH
  107. ;
  108. ;
  109. ; Handles in/out ports for data and status
  110. ;
  111. I$MDCTL1: JMP    RCVCTL1        ; In modem control port         11FH
  112.       DB    0,0,0,0,0,0,0    ; Spares if needed            122H
  113. ;
  114. I$MDTXE:  JMP    RCVCTL2        ;                    129H
  115.       DB    0,0,0,0,0,0,0    ;                    12CH
  116. ;
  117. I$MDDATP: JMP    RCVDATP        ;in modem data port            133H
  118.       DB    0,0,0,0,0,0,0    ;                    146H
  119. ;
  120. O$MDDATP: JMP    SNDDATP        ; Out modem data port            13DH
  121.       DB    0,0,0,0,0,0,0    ; Spares if needed            140H
  122. ;
  123. A$MDRCV:  RET            ;                    147H
  124.       DB    0,0        ;                    148H
  125. ;
  126. C$MDRCV:  CPI    0FFH        ; TurboDos returns 0ffh         14AH
  127.       RET            ; if char available            14CH
  128. ;
  129. A$MDSND:  ANI    MDSND        ; Always show ready to send        14DH
  130.       RET            ;                    14FH
  131. ;
  132. C$MDSND:  CPI    MDSND        ;                    150H
  133.       RET            ;                    152H
  134. ;
  135. A$MDTXE:  ANI    MDTXE        ;                    153H
  136.       RET            ;                    155H
  137. ;
  138. C$MDTXE:  CPI    MDTXE        ;                    156H
  139.       RET            ;                    158H
  140. ;
  141. ;
  142. ; Special exit vector, used by some computers to reset interrupt vectors
  143. ;
  144. J$EXITVEC:RET
  145.       DB    0,0
  146. ;
  147. ;
  148. ; Jump vectors needed by each overlay
  149. ;
  150. J$GOODBYE:JMP    GOODBYE        ; Disconnects modem by dropping DTR    15CH
  151. J$INITMOD:JMP    INITMOD        ; Initializes modem, autosets baudrate    15FH
  152. J$STUPR:  JMP    STUPR        ; SET routine to change baudrate    162H
  153. J$SYSVR:  JMP    SYSVR        ; Signon message            165H
  154. ;
  155. ;
  156. ; "AT" command strings, can be replaced in individual overlay if needed
  157. ;
  158. J$STRNGA: DS    3        ; 1200 bps "AT" string            168H
  159. J$STRNG1: DS    3        ; 2400 bps "AT" string            16BH
  160. ;
  161. ;
  162. ; Next fourteen lines should not be changed by user overlay as these go
  163. ; to specific locations in the main program, not in the overlay.
  164. ;
  165. J$CMDSPL: DS    3        ; Allows entry of baudrate on CMD line    16EH
  166. J$CRLF:      DS    3        ; Turns up one new line on display    171H
  167. J$DIAL:      DS    3        ; Start of dialing routine        174H
  168. J$DSCONT: DS    3        ; Terminates modem use            177H
  169. J$GOLST:  DS    3        ; Printer routine, needed by Apple //e    17AH
  170. J$ILPRT:  DS    3        ; Prints an inline string, 0 to end    17DH
  171. J$INBUF:  DS    3        ; Stores a keybd string for comparison    180H
  172. J$INLNCP: DS    3        ; Inline "compare strings" routine    183H
  173. J$INMDM:  DS    3        ; Max .1 sec wait for modem character    186H
  174. J$RCVRSP: DS    3        ; For 3801 I/O use (TV-803)        189H
  175. J$SNDCHR: DS    3        ; Sends a character to the modem    18CH
  176. J$SNDSTR: DS    3        ; Sends a string to the modem, $ to end 18FH
  177. J$TIMER:  DS    3        ; .1 second timer (amount in 'B' reg.)    192H
  178. J$NEW1:      DB    0,0,0        ; For future needs            195H
  179. J$NEW2:      DB    0,0,0        ; For future needs            198H
  180. ;
  181. ;
  182. ; For 2400 bps auto-stepdown units
  183. ;
  184. MANUAL:      DB    0        ; For manual selection flag        19BH
  185. J$300:      JMP    OK300        ; Sets baudrate to 300 baud        19CH
  186. J$1200:      JMP    OK1200        ; Sets baudrate to 1200 bps        19FH
  187. J$2400:      JMP    OK2400        ; Sets baudrate to 2400 bps        1A2H
  188. ;
  189. LOGPTR:      DW    LOGON        ; Pointer to display LOGON message    1A5H
  190. ;
  191. SYSVR:      CALL    J$ILPRT        ; Display the following line        1A7H
  192.       DB    'TurboDos 1.41 Generic Version 1.0 '    ;        1AAH
  193. ;
  194.       DB    CR,LF,0
  195.       RET
  196. ;
  197. ;
  198. ;-----------------------------------------------------------------------
  199. ;
  200. ; NOTE:  You can change the SYSVER message to be longer or shorter.  The
  201. ;     end of your last routine should terminate by 0400H (601 bytes
  202. ;     available after start of SYSVER).
  203. ;
  204. ;-----------------------------------------------------------------------
  205. ;
  206. ; You can put in a message at this location which can be called up with
  207. ; (special character-L).  You can put in several lines.  End with a 0.
  208. ;
  209. LOGON:    DB    'Hello, from a TurboDos /// user',CR,0
  210. ;
  211. ;-----------------------------------------------------------------------
  212.  
  213. ; This routine sets a 300 ms break tone.  It changes the baudrate to
  214. ; 19200 bps then sends enough ASCII null characters to consume 300 ms.
  215. ; (A null character is all spacing except for the stop bit.)  At high
  216. ; speed this effectively gives a steady break tone.  When finished it
  217. ; restores the baudrate to the original speed.
  218. ;
  219. SENDBRK:
  220.     LDA    MSPEED        ; Get current speed
  221.     STA    STRSPD        ; Store for now
  222.     CALL    OK19200        ; Set output to 19200 bps
  223.     LXI    D,575        ; Will take 300 ms at 19,200 bps
  224. ;
  225. SEND1:    XRA    A        ; ASCII null character
  226.     CALL    J$SNDCHR    ; Sends a character to the modem
  227.     DCX    D        ; One less to go
  228.     JNZ    SEND1        ; If not zero, do another
  229. ;
  230.     LDA    STRSPD        ; Get original baudrate back
  231.     JMP    SPDCHK        ; Go set speed to normal
  232. ;
  233. STRSPD:    DB    0        ; Temporary 'store speed' byte
  234. ;.....
  235. ;
  236. ;
  237. ; This routine sets DTR low for 300 ms to disconnect the phone
  238. ;
  239. GOODBYE:
  240.     MVI    C,39        ; T-FCN 39 set modem control
  241.     MVI    D,CHNL        ; Select current modem channel number
  242.     MVI    E,0        ; Turn off DTR
  243.     CALL    TDOS
  244.     MVI    B,2        ; Wait for 300 ms
  245.     CALL    J$TIMER
  246.     MVI    C,39
  247.     MVI    D,CHNL        ; Select current modem channel number
  248.     MVI    E,0C0H        ; Reset DTR normal
  249.     CALL    TDOS
  250. ;.....
  251. ;
  252. ;
  253. INITMOD:
  254.     MVI    C,39        ; T-FCN 39 set modem control
  255.     MVI    D,CHNL        ; Select current modem channel number
  256.     MVI    E,0C0H        ; DTR normal
  257.     CALL    TDOS
  258.     LDA    MSPEED        ; Get Baud Rate value
  259. ;
  260. SPDCHK:    CPI    1        ; Is it 300 baud
  261.     JZ    OK300
  262.     CPI    5        ; Is it 1200 bps
  263.     JZ    OK1200
  264.     CPI    6        ; Is it 2400 bps
  265.     JZ    OK2400
  266.     CPI    7        ; Is it 4800 bps
  267.     JZ    OK4800
  268.     CPI    8        ; Is it 9600 bps
  269.     JZ    OK9600
  270.     CPI    9        ; Is it 19200 bps
  271.     JZ    OK19200
  272.     JMP    STUPR1        ; If none of these, ask for new value
  273. ;
  274. ;
  275. ;-----------------------------------------------------------------------
  276. ;
  277. ; Use the 'SET' command to select a desired baud rate
  278. ;
  279. STUPR:    CALL    J$CMDSPL    ; Gives us CMDBUF+6
  280.     JNC    STUPR2
  281. ;
  282. STUPR1:    CALL    J$ILPRT
  283.     DB    'Input Baud Rate (300, 1200, 2400, '
  284.     DB    '4800, 9600, 19200): ',0
  285.     LXI    D,BAUDBUF    ; Point to new input buffer
  286.     CALL    J$INBUF
  287.     CALL    J$CRLF
  288.     LXI    D,BAUDBUF+2
  289. ;
  290. STUPR2:    CALL    J$INLNCP    ; Compare BAUDBUF+2 with chars. below
  291.     DB    '300',0
  292.     JNC    OK300        ; Go if got match
  293.     CALL    J$INLNCP
  294.     DB    '1200',0
  295.     JNC    OK1200
  296.     CALL    J$INLNCP
  297.     DB    '2400',0
  298.     JNC    OK2400
  299.     CALL    J$INLNCP
  300.     DB    '4800',0
  301.     JNC    OK4800
  302.     CALL    J$INLNCP
  303.     DB    '9600',0
  304.     JNC    OK9600
  305.     CALL    J$ILPRT        ; All matches failed, tell operator
  306.     DB    '++ Incorrect entry ++',CR,LF,BELL,CR,LF,0
  307.     JMP    STUPR1        ; Try again
  308. ;
  309. OK300:    MVI    A,1        ; Load MSPEED 300 baud value
  310.     MVI    E,BD300
  311.     JMP    LOADBD
  312. ;
  313. OK1200:    MVI    A,5
  314.     MVI    E,BD1200
  315.     JMP    LOADBD
  316. ;
  317. OK2400:    XRA    A        ; Reset the automatic 2400 bps flag
  318.     STA    MANUAL
  319.     MVI    A,6
  320.     MVI    E,BD2400
  321.     JMP    LOADBD
  322. ;
  323. OK4800:    MVI    A,7
  324.     MVI    E,BD4800
  325.     JMP    LOADBD
  326. ;
  327. OK9600:    MVI    A,8
  328.     MVI    E,BD9600
  329.     JMP    LOADBD
  330. ;
  331. OK19200:MVI    A,9
  332.     MVI    E,BD19200
  333. ;
  334. LOADBD:    STA    MSPEED        ; Save Modem Speed
  335.     MVI    C,37        ; T-FCN 37 set Comm baud rate
  336.     MVI    D,CHNL        ; Select current modem channel number
  337.     CALL    TDOS
  338.     RET
  339. ;.....
  340. ;
  341. ;
  342. ; BAUD RATE TABLE
  343. ;
  344. BD300    EQU    5        ;  300 baud
  345. BD1200    EQU    7        ;  1200 bps
  346. BD2400    EQU    10        ;  2400 bps
  347. BD4800    EQU    12        ;  4800 bps
  348. BD9600    EQU    14        ;  9600 bps
  349. BD19200    EQU    15        ; 19200 bps
  350. ;.....
  351. ;
  352. ;
  353. RCVCTL1:PUSH    B        ; Test Modem Input Status
  354.     PUSH    D
  355.     PUSH    H
  356.     MVI    C,34        ; T-FCN 34 MODEM Status
  357.     MVI    D,CHNL        ; Select current modem channel number
  358.     CALL    TDOS
  359.     CPI    0FFH
  360.     POP    H        ; Restore Registers
  361.     POP    D
  362.     POP    B
  363.     RET
  364. ;.....
  365. ;
  366. ;
  367. RCVCTL2:MVI    A,0        ; TBE always true....
  368.     RET
  369. ;.....
  370. ;
  371. ;
  372. RCVDATP:PUSH    B        ; Read in a Character
  373.     PUSH    D
  374.     PUSH    H
  375.     MVI    C,35        ; T-FCN 35 Comm channel input
  376.     MVI    D,CHNL        ; Select current modem channel number
  377.     CALL    TDOS
  378.     POP    H
  379.     POP    D
  380.     POP    B
  381.     RET
  382. ;.....
  383. ;
  384. ;
  385. SNDDATP:PUSH    B        ; Send out a Character
  386.     PUSH    D
  387.     PUSH    H
  388.     MVI    C,36        ; T-FCN 36 Comm channel output
  389.     MVI    D,CHNL        ; Select current modem channel number
  390.     MOV    E,A        ; Character in 'E' register
  391.     CALL    TDOS
  392.     POP    H
  393.     POP    D
  394.     POP    B
  395.     RET
  396. ;.....
  397. ;
  398. ;
  399. BAUDBUF:
  400.     DB    10,0,0,0,0,0
  401.     DB    0,0,0,0,0,0
  402. ;.....
  403. ;
  404. ;                   end
  405. ;-----------------------------------------------------------------------
  406. ; NOTE: Must terminate by 0400H
  407. ;
  408.     END
  409.