home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / simtel / sigm / vols200 / vol274 / i2s2-1.asm < prev    next >
Assembly Source File  |  1994-07-13  |  11KB  |  341 lines

  1.  
  2. ; I2S2-1.ASM - Sanyo 1200/1250 overlay for IMP - 10/27/85
  3. ;
  4. ;       USES 8251A I/O and no baudrate generator
  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 adapts the Sayno computer to the IMP modem program.  This
  9. ; model has no baudrate generator and changes the 8251 from "x16" for
  10. ; 1200 bps to "x64" for 300 bps.  The Sayno must be jumpered for 1200
  11. ; bps for this method to work.
  12. ;
  13. ; Edit this file for your preferences then follow the "TO USE:" example
  14. ; shown below.
  15. ;
  16. ; Many terminals will clear the screen with a CTL-Z.  If yours does, put
  17. ; a 1AH at CLEAR: (010AH).  Many terminals use two characters, the first
  18. ; normally an ESC.  For example, ESC *.  In this case put '*' at CLEAR:
  19. ; (The ESC will automatically be typed with no CTL-character present.)
  20. ; If you don't know what your terminal uses, put a 0 at CLEAR: and IMP
  21. ; will scroll up 24 blank lines to clear the CRT for things like MENU,
  22. ; looking at the function key table, typing CTL-Z in command mode, etc.
  23. ;
  24. ; Use the "SET" command to change the baudrate when desired.  The value
  25. ; at MSPEED controls the baudrate when the program is first called up.
  26. ;
  27. ;    TO USE: First edit this file filling in answers for your own
  28. ;        equipment.  Then assemble with ASM.COM or equivalent
  29. ;        assembler.  Then use MLOAD to merge into the main file:
  30. ;
  31. ;        MLOAD IMP.COM=IMP.COM,I2S2-x.HEX
  32. ;
  33. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  34. ;
  35. ; 10/27/85 - Initial IMP version        - Irv Hoff
  36. ;
  37. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  38. ;
  39. ;
  40. YES    EQU    0FFH
  41. NO    EQU    0
  42. ;
  43. ;
  44. ; Values shown are for a 8251A
  45. ;
  46. PORT    EQU    0ECH    ; Your base port (data or status)
  47. MDCTL1    EQU    PORT+1    ; Modem control port
  48. MDDATP    EQU    PORT    ; Modem data port
  49. MDRCV    EQU    02H    ; Modem receive ready
  50. MDSND    EQU    01H    ; Modem send ready bit
  51. MDTXE    EQU    05H    ; Modem send buffer empty, holding buffer empty
  52. ;
  53. MDMODE    EQU    82H    ; Insures 8251 is out of mode with DTR high
  54. MDRSET    EQU    42H    ; Resets USART for additional commands
  55. MDSET0    EQU    4FH    ; 1 stop bit, no parity, 8 bits, x64
  56. MDSET1    EQU    4EH    ; 1 stop bit, no parity, 8 bits, x16
  57. MDSET2    EQU    4CH    ; 2 stop bits, no parity, 8 bits, x16
  58. MDCOM    EQU    37H    ; Reset RTS, error flags, RCV, DTR, TX ready
  59. ;
  60. ;
  61. ;-----------------------------------------------------------------------
  62. ;
  63. ESC    EQU    '['-40H    ; ^[ = Escape
  64. BELL    EQU    'G'-40H    ; ^G = Bell character
  65. LF    EQU    'J'-40H    ; ^J = Linefeed
  66. NEXTRY    EQU    'K'-40H    ; ^K = Try next phone number, abort this try
  67. CR    EQU    'M'-40H    ; ^M = Carriage return
  68. CLEARSC    EQU    'Z'-40H    ; ^Z = Clears screen, command mode only
  69. EOFCHAR    EQU    'Z'-40H    ; ^Z = End of file
  70. ;
  71. ;
  72. ;-----------------------------------------------------------------------
  73. ;
  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    37    ; 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    YES    ; 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    NO    ; Yes if no DTR and need +++ to disconnect    11EH
  128. ;.....
  129. ;
  130. ;
  131. ; Handles in/out ports for data and status
  132. ;
  133. I$MDCTL1: IN    MDCTL1        ;                    11FH
  134.       RET            ; IN modem control port         121H
  135.       DB    0,0,0,0,0,0,0    ; Spares if needed            122H
  136. ;
  137. I$MDTXE:  IN    MDCTL1        ; (Needed for SIO or DART register 1    129H
  138.       RET            ;                    12BH
  139.       DB    0,0,0,0,0,0,0    ;                    12CH
  140. ;
  141. I$MDDATP: MVI    A,37H        ;                    133H
  142.       OUT    MDCTL1        ;                    135H
  143.       IN    MDDATP        ;                    137H
  144.       RET            ;                    139H
  145.       DB    0,0,0        ; Spares if needed            13AH
  146. ;
  147. O$MDDATP: OUT    MDDATP        ;                    13DH
  148.       RET            ; OUT modem data port            13FH
  149.       DB    0,0,0,0,0,0,0    ; Spares if needed            140H
  150. ;.....
  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. ;
  173. ; Special exit vector, used by some computers to reset interrupt vectors
  174. ;
  175. J$EXITVEC:RET            ;                    159H
  176.       DB    0,0        ;                    15AH
  177. ;.....
  178. ;
  179. ;
  180. ; Jump vectors needed by each overlay
  181. ;
  182. J$GOODBYE:JMP    GOODBYE        ; Disconnects modem by dropping DTR    15CH
  183. J$INITMOD:JMP    INITMOD        ; Initializes modem, autosets baudrate    15FH
  184. J$STUPR:  JMP    STUPR        ; SET routine to change baudrate    162H
  185. J$SYSVR:  JMP    SYSVR        ; Signon message            165H
  186. ;.....
  187. ;
  188. ;
  189. ; "AT" command strings, can be replaced in individual overlay if needed
  190. ;
  191. J$STRNGA: DS    3        ; 1200 bps "AT" string            168H
  192. J$STRNG1: DS    3        ; 2400 bps "AT" string            16BH
  193. ;
  194. ;
  195. ; Next fourteen lines should not be changed by user overlay as these go
  196. ; to specific locations in the main program, not in the overlay.
  197. ;
  198. ;
  199. J$CMDSPL: DS    3        ; Allows entry of baudrate on CMD line    16EH
  200. J$CRLF:      DS    3        ; Turns up one new line on display    171H
  201. J$DIAL:      DS    3        ; Start of dialing routine        174H
  202. J$DSCONT: DS    3        ; Terminates modem use            177H
  203. J$GOLST:  DS    3        ; Printer routine, needed by Apple //e    17AH
  204. J$ILPRT:  DS    3        ; Prints an inline string, 0 to end    17DH
  205. J$INBUF:  DS    3        ; Stores a keybd string for comparison    180H
  206. J$INLNCP: DS    3        ; Inline "compare strings" routine    183H
  207. J$INMDM:  DS    3        ; Max .1 sec wait for modem character    186H
  208. J$RCVRSP: DS    3        ; For 3801 I/O use (TV-803)        189H
  209. J$SNDCHR: DS    3        ; Sends a character to the modem    18CH
  210. J$SNDSTR: DS    3        ; Sends a string to the modem, $ to end 18FH
  211. J$TIMER:  DS    3        ; .1 second timer (amount in 'B' reg.)    192H
  212. J$NEW1:      DB    0,0,0        ; For future needs            195H
  213. J$NEW2:      DB    0,0,0        ; For future needs            198H
  214. ;.....
  215. ;
  216. ;
  217. ; For 2400 bps auto-stepdown units
  218. ;
  219. MANUAL:      DB    0        ; For manual selection flag        19BH
  220. J$300:      JMP    OK300        ; Sets baudrate to 300 baud        19CH
  221. J$1200:      JMP    OK1200        ; Sets baudrate to 1200 bps        19FH
  222. J$2400:      JMP    OK2400        ; Sets baudrate to 2400 bps        1A2H
  223. ;.....
  224. ;
  225. ;
  226. LOGPTR:      DW    LOGON        ; Pointer to display LOGON message    1A5H
  227. ;
  228. SYSVR:      CALL    J$ILPRT        ; Display the following line        1A7H
  229.       DB    'Version for Morrow MD3 modem port 0FEH' ;        1AAH
  230.       DB    CR,LF,0
  231.       RET
  232. ;.....
  233. ;
  234. ;
  235. ;-----------------------------------------------------------------------
  236. ;
  237. ; NOTE:  You can change the SYSVER message to be longer or shorter.  The
  238. ;     end of your last routine should terminate by 0400H (601 bytes
  239. ;     available after start of SYSVER).
  240. ;
  241. ;-----------------------------------------------------------------------
  242. ;
  243. ; You can put in a message at this location which can be called up with
  244. ; (special character-L).  You can put in several lines.  End with a 0.
  245. ;
  246. LOGON:    DB    'Hello from a happy Sanyo owner...',CR,LF,0
  247. ;
  248. ;-----------------------------------------------------------------------
  249. ;
  250. ;
  251. ; This routine sets DTR low for 300 ms to disonnect the phone
  252. ;
  253. GOODBYE:
  254.     MVI    B,'S'-40H    ; X-off to stop host if needed
  255.     CALL    J$SNDCHR
  256.     MVI    B,1        ; Wait a moment to let it react
  257.     CALL    J$TIMER
  258.     MVI    A,3DH        ; Send break, turn off DTR
  259.     OUT    MDCTL1        ; Send to status port
  260.     MVI    B,3        ; Delay 300 ms to hang up phone
  261.     CALL    J$TIMER
  262.     MVI    A,37H        ; Normal send/receive with DTR
  263.     OUT    MDCTL1        ; Send to status port
  264.     RET
  265. ;.....
  266. ;
  267. ;
  268. ; Sets 8251 to 8 bits, DTR, RCV and TX ready
  269. ;
  270. INITMOD:
  271.     LDA    MSPEED        ; Get the selected value
  272.     CPI    1        ; 300 bps
  273.     JZ    OK300
  274.     CPI    5        ; 1200 bps
  275.     JZ    OK1200
  276.     JMP    STUPR1        ; Else ask what is wanted
  277. ;.....
  278. ;
  279. ;
  280. ;
  281. STUPR:    CALL    J$CMDSPL    ; Gives us CMDBUF+6
  282.     JNC    STUPR2
  283. ;
  284. STUPR1:    CALL    J$ILPRT
  285.     DB    'Input Baud Rate (300, 1200): ',0
  286.     LXI    D,BAUDBUF    ; Point to new input buffer
  287.     CALL    J$INBUF
  288.     CALL    J$CRLF
  289.     LXI    D,BAUDBUF+2
  290. ;
  291. STUPR2:    CALL    J$INLNCP    ; Compare BAUDBUF+2 with chars. below
  292.     DB    '300',0
  293.     JNC    OK300        ; Go if got match
  294.     CALL    J$INLNCP
  295.     DB    '1200',0
  296.     JNC    OK1200
  297.     CALL    J$ILPRT        ; All matches failed, tell operator
  298.     DB    '++ Incorrect entry ++',CR,LF,BELL,CR,LF,0
  299.     JMP    STUPR1        ; Try again
  300. ;
  301. OK300:    MVI    A,1        ; MSPEED 300 baud value
  302.     MVI    B,MDSET0    ; Divide by 64 for 300 baud
  303.     JMP    LOADBD        ; Go set the baudrate
  304. ;
  305. OK1200:    MVI    A,5
  306.     MVI    B,MDSET1    ; Divide by 16 for 1200 bps
  307.     JMP    LOADBD        ; Go set the baudrate
  308. ;
  309. OK2400:    JMP    OK1200        ; (Does not support 1200 bps)
  310. ;
  311. LOADBD:    STA    MSPEED        ; Change time-to-send to match baudrate
  312.     MVI    A,MDMODE    ; Insure 8251 is out of mode
  313.     OUT    MDCTL1
  314.     XTHL            ; Small delay to complete command
  315.     XTHL
  316.     MVI    A,MDRSET    ; Reset the 8251A for new command
  317.     OUT    MDCTL1
  318.     XTHL            ; Small delay to complete command
  319.     XTHL
  320.     MOV    A,B        ; Set speed
  321.     OUT    MDCTL1
  322.     XTHL            ; Small delay to complete command
  323.     XTHL
  324.     MVI    A,MDCOM        ; Error reset, RCV, DTR, TX ready
  325.     OUT    MDCTL1
  326.     XTHL            ; Small delay to complete command
  327.     XTHL
  328.     RET
  329. ;.....
  330. ;
  331. ;
  332. BAUDBUF:DB    10,0,0,0,0,0
  333.     DB    0,0,0,0,0,0
  334. ;
  335. ;                   end
  336. ;-----------------------------------------------------------------------
  337. ;
  338. ; NOTE: Must terminate by 0400H
  339. ;
  340.     END
  341.