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 / I2S2-2.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  11KB  |  347 lines

  1.  
  2. ; I2S2-2.ASM - Sanyo 1200/1250 overlay for IMP - 06/01/87
  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. ; 06/01/87  Improved the GOODBYE routine, added BREAK routine, needs
  36. ;        IMP245 to use it.            - Irv Hoff
  37. ;
  38. ; 10/27/85  Initial IMP version         - Irv Hoff
  39. ;
  40. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  41. ;
  42. ;
  43. YES    EQU    0FFH
  44. NO    EQU    0
  45. ;
  46. ;
  47. ; Values shown are for a 8251A
  48. ;
  49. PORT    EQU    0ECH    ; Your base port (data or status)
  50. MDCTL1    EQU    PORT+1    ; Modem control port
  51. MDDATP    EQU    PORT    ; Modem data port
  52. MDRCV    EQU    02H    ; Modem receive ready
  53. MDSND    EQU    01H    ; Modem send ready bit
  54. MDTXE    EQU    05H    ; Modem send buffer empty, holding buffer empty
  55. ;
  56. MDMODE    EQU    82H    ; Insures 8251 is out of mode with DTR high
  57. MDRSET    EQU    42H    ; Resets USART for additional commands
  58. MDSET0    EQU    4FH    ; 1 stop bit, no parity, 8 bits, x64
  59. MDSET1    EQU    4EH    ; 1 stop bit, no parity, 8 bits, x16
  60. MDSET2    EQU    4CH    ; 2 stop bits, no parity, 8 bits, x16
  61. MDCOM    EQU    37H    ; Reset RTS, error flags, RCV, DTR, TX ready
  62. ;
  63. ;
  64. ;-----------------------------------------------------------------------
  65. ;
  66. ESC    EQU    '['-40H    ; ^[ = Escape
  67. BELL    EQU    'G'-40H    ; ^G = Bell character
  68. LF    EQU    'J'-40H    ; ^J = Linefeed
  69. NEXTRY    EQU    'K'-40H    ; ^K = Try next phone number, abort this try
  70. CR    EQU    'M'-40H    ; ^M = Carriage return
  71. CLEARSC    EQU    'Z'-40H    ; ^Z = Clears screen, command mode only
  72. EOFCHAR    EQU    'Z'-40H    ; ^Z = End of file
  73. ;
  74. ;
  75. ;-----------------------------------------------------------------------
  76. ;
  77. ;
  78.     ORG    0100H
  79. ;
  80. ;
  81.     DS    3        ; Skip the data area below
  82. ;
  83. ;
  84. ; These routines and equates are at the beginning of the program so
  85. ; they can be patched by a monitor or overlay file without re-assembling
  86. ; the program.
  87. ;
  88. MSPEED:     DB    5    ; 0=110 1=300 2=450 3=600 4=710 5=1200        103H
  89.             ; 6=2400 7=4800 8=9600 9=19200 default
  90. HS2400:     DB    NO    ; Yes=2400 bps highest speed            104H
  91. HS1200:     DB    YES    ; Yes=1200 bps highest speed            105H
  92. RACAL:     DB    NO    ; Yes=Racal-Vadic 1200V or 2400V or 2400PA    106H
  93. PROMODM: DB    NO    ; Yes=Prometheus ProModem 1200 bps        107H
  94. RESVD1:     DB    NO    ; Reserved for special modems            108H
  95. RESVD2:     DB    NO    ; Reserved for special modems            109H
  96. ;
  97. ;
  98. CLEAR:     DB    1AH    ; Clear screen character (ESC not needed)    10AH
  99. CLOCK:     DB    37    ; Clock speed in MHz x10, 25.5 MHz max.     10BH
  100.             ; 20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
  101. BYTDLY:     DB    2    ; 0=0 delay  1=10ms  5=50 ms - 9=90 ms        10CH
  102.             ;   default time to send character in ter-
  103.             ;   minal mode file transfer for slow BBS
  104. CRDLY:     DB    2    ; 0=0 delay 1=100 ms 5=500 ms - 9=900 ms    10DH
  105.             ;   default time for extra wait after CRLF
  106.             ;   in terminal mode file transfer
  107. NOFCOL:     DB    5    ; Number of directory columns shown        10EH
  108. TCHPUL:     DB    'T'    ; T=tone, P=Pulse (Hayes 2400 modems)        10FH
  109. ;.....
  110. ;
  111. ;
  112. ADDLFD:     DB    NO    ; Yes=add LF after CR to send file in terminal    110H
  113.             ;   mode (normally added by remote echo)
  114. CONVRUB: DB    YES    ; Yes=convert rub to backspace            111H
  115. CRCDFLT: DB    YES    ; Yes=default to CRC checking            112H
  116. IGNRCTL: DB    YES    ; Yes=CTL-chars above ^M not displayed        113H
  117. ;.....
  118. ;
  119. ;
  120. EXTCHR:     DB    '['-40H    ; ESC = preceeds local control character    114H
  121. EXITCHR: DB    'E'    ; Exit character                115H
  122. FILESND: DB    'F'    ; Send file when in terminal mode        116H
  123. NOCONCT: DB    'N'    ; Disconnect from phone line            117H
  124. LOGCHR:     DB    'L'    ; Send logon                    118H
  125. LSTCHR:     DB    'P'    ; Toggle printer                119H
  126. UNSAVCH: DB    'R'    ; Close input text buffer            11AH
  127. SAVECHR: DB    'Y'    ; Open input text buffer            11BH
  128. CLEARS:     DB    'Z'    ; Clears screen, terminal mode            11CH
  129. BRKCHR:     DB    'Q'    ; Send a break tone                11DH
  130. NODTR:     DB    NO    ; YES if no DTR and need ATH0 to disconnect    11EH
  131. ;.....
  132. ;
  133. ;
  134. ; Handles in/out ports for data and status
  135. ;
  136. I$MDCTL1: IN    MDCTL1        ;                    11FH
  137.       RET            ; IN modem control port         121H
  138.       DB    0,0,0,0,0,0,0    ; Spares if needed            122H
  139. ;
  140. I$MDTXE:  IN    MDCTL1        ; (Needed for SIO or DART register 1    129H
  141.       RET            ;                    12BH
  142.       DB    0,0,0,0,0,0,0    ;                    12CH
  143. ;
  144. I$MDDATP: MVI    A,37H        ;                    133H
  145.       OUT    MDCTL1        ;                    135H
  146.       IN    MDDATP        ;                    137H
  147.       RET            ;                    139H
  148.       DB    0,0,0        ; Spares if needed            13AH
  149. ;
  150. O$MDDATP: OUT    MDDATP        ;                    13DH
  151.       RET            ; OUT modem data port            13FH
  152.       DB    0,0,0,0,0,0,0    ; Spares if needed            140H
  153. ;.....
  154. ;
  155. ;
  156. A$MDRCV:  ANI    MDRCV        ;                    147H
  157.       RET            ;                    149H
  158. ;
  159. C$MDRCV:  CPI    MDRCV        ;                    14AH
  160.       RET            ;                    14CH
  161. ;
  162. A$MDSND:  ANI    MDSND        ;                    14DH
  163.       RET            ;                    14FH
  164. ;
  165. C$MDSND:  CPI    MDSND        ;                    150H
  166.       RET            ;                    152H
  167. ;
  168. A$MDTXE:  ANI    MDTXE        ;                    153H
  169.       RET            ;                    155H
  170. ;
  171. C$MDTXE:  CPI    MDTXE        ;                    156H
  172.       RET            ;                    158H
  173. ;.....
  174. ;
  175. ;
  176. ; Special exit vector, used by some computers to reset interrupt vectors
  177. ;
  178. J$EXITVEC:RET            ;                    159H
  179.       DB    0,0        ;                    15AH
  180. ;.....
  181. ;
  182. ;
  183. ; Jump vectors needed by each overlay
  184. ;
  185. J$GOODBYE:JMP    GOODBYE        ; Disconnects modem by dropping DTR    15CH
  186. J$INITMOD:JMP    INITMOD        ; Initializes modem, autosets baudrate    15FH
  187. J$STUPR:  JMP    STUPR        ; SET routine to change baudrate    162H
  188. J$SYSVR:  JMP    SYSVR        ; Signon message            165H
  189. ;.....
  190. ;
  191. ;
  192. ; "AT" command strings, can be replaced in individual overlay if needed
  193. ;
  194. J$STRNGA: DS    3        ; 1200 bps "AT" string            168H
  195. J$STRNG1: DS    3        ; 2400 bps "AT" string            16BH
  196. ;
  197. ;
  198. ; Next fourteen lines should not be changed by user overlay as these go
  199. ; to specific locations in the main program, not in the overlay.
  200. ;
  201. ;
  202. J$CMDSPL: DS    3        ; Allows entry of baudrate on CMD line    16EH
  203. J$CRLF:      DS    3        ; Turns up one new line on display    171H
  204. J$DIAL:      DS    3        ; Start of dialing routine        174H
  205. J$DSCONT: DS    3        ; Terminates modem use            177H
  206. J$GOLST:  DS    3        ; Printer routine, needed by Apple //e    17AH
  207. J$ILPRT:  DS    3        ; Prints an inline string, 0 to end    17DH
  208. J$INBUF:  DS    3        ; Stores a keybd string for comparison    180H
  209. J$INLNCP: DS    3        ; Inline "compare strings" routine    183H
  210. J$INMDM:  DS    3        ; Max .1 sec wait for modem character    186H
  211. J$RCVRSP: DS    3        ; For 3801 I/O use (TV-803)        189H
  212. J$SNDCHR: DS    3        ; Sends a character to the modem    18CH
  213. J$SNDSTR: DS    3        ; Sends a string to the modem, $ to end 18FH
  214. J$TIMER:  DS    3        ; .1 second timer (amount in 'B' reg.)    192H
  215. J$BREAK:  JMP    SENDBRK        ; Break routine             195H
  216. J$NEW2:      DB    0,0,0        ; For future needs            198H
  217. ;.....
  218. ;
  219. ;
  220. ; For 2400 bps auto-stepdown units
  221. ;
  222. MANUAL:      DB    0        ; For manual selection flag        19BH
  223. J$300:      JMP    OK300        ; Sets baudrate to 300 baud        19CH
  224. J$1200:      JMP    OK1200        ; Sets baudrate to 1200 bps        19FH
  225. J$2400:      JMP    OK2400        ; Sets baudrate to 2400 bps        1A2H
  226. ;.....
  227. ;
  228. ;
  229. LOGPTR:      DW    LOGON        ; Pointer to display LOGON message    1A5H
  230. ;
  231. SYSVR:      CALL    J$ILPRT        ; Display the following line        1A7H
  232.       DB    'Version for Morrow MD3 modem port 0FEH' ;        1AAH
  233.       DB    CR,LF,0
  234.       RET
  235. ;.....
  236. ;
  237. ;
  238. ;-----------------------------------------------------------------------
  239. ;
  240. ; NOTE:  You can change the SYSVER message to be longer or shorter.  The
  241. ;     end of your last routine should terminate by 0400H (601 bytes
  242. ;     available after start of SYSVER).
  243. ;
  244. ;-----------------------------------------------------------------------
  245. ;
  246. ; You can put in a message at this location which can be called up with
  247. ; (special character-L).  You can put in several lines.  End with a 0.
  248. ;
  249. LOGON:    DB    'Hello from a happy Sanyo owner...',CR,LF,0
  250. ;
  251. ;-----------------------------------------------------------------------
  252. ;
  253. ; This routine sets a 300 ms break tone
  254. ;
  255. SENDBRK:
  256.     MVI    A,3FH        ; DTR normal, send break tone
  257.     JMP    GOODBYE+2
  258. ;.....
  259. ;
  260. ;
  261. ; This routine sets DTR low for 300 ms to disonnect the phone
  262. ;
  263. GOODBYE:
  264.     MVI    A,3DH        ; Send break, turn off DTR
  265.     OUT    MDCTL1        ; Send to status port
  266.     MVI    B,3        ; Delay 300 ms to hang up phone
  267.     CALL    J$TIMER
  268.     MVI    A,37H        ; Normal send/receive with DTR
  269.     OUT    MDCTL1        ; Send to status port
  270.     RET
  271. ;.....
  272. ;
  273. ;
  274. ; Sets 8251 to 8 bits, DTR, RCV and TX ready
  275. ;
  276. INITMOD:
  277.     LDA    MSPEED        ; Get the selected value
  278.     CPI    1        ; 300 bps
  279.     JZ    OK300
  280.     CPI    5        ; 1200 bps
  281.     JZ    OK1200
  282.     JMP    STUPR1        ; Else ask what is wanted
  283. ;.....
  284. ;
  285. ;
  286. ;
  287. STUPR:    CALL    J$CMDSPL    ; Gives us CMDBUF+6
  288.     JNC    STUPR2
  289. ;
  290. STUPR1:    CALL    J$ILPRT
  291.     DB    'Input Baud Rate (300, 1200): ',0
  292.     LXI    D,BAUDBUF    ; Point to new input buffer
  293.     CALL    J$INBUF
  294.     CALL    J$CRLF
  295.     LXI    D,BAUDBUF+2
  296. ;
  297. STUPR2:    CALL    J$INLNCP    ; Compare BAUDBUF+2 with chars. below
  298.     DB    '300',0
  299.     JNC    OK300        ; Go if got match
  300.     CALL    J$INLNCP
  301.     DB    '1200',0
  302.     JNC    OK1200
  303.     CALL    J$ILPRT        ; All matches failed, tell operator
  304.     DB    '++ Incorrect entry ++',CR,LF,BELL,CR,LF,0
  305.     JMP    STUPR1        ; Try again
  306. ;
  307. OK300:    MVI    A,1        ; MSPEED 300 baud value
  308.     MVI    B,MDSET0    ; Divide by 64 for 300 baud
  309.     JMP    LOADBD        ; Go set the baudrate
  310. ;
  311. OK1200:    MVI    A,5
  312.     MVI    B,MDSET1    ; Divide by 16 for 1200 bps
  313.     JMP    LOADBD        ; Go set the baudrate
  314. ;
  315. OK2400:    JMP    OK1200        ; (Does not support 1200 bps)
  316. ;
  317. LOADBD:    STA    MSPEED        ; Change time-to-send to match baudrate
  318.     MVI    A,MDMODE    ; Insure 8251 is out of mode
  319.     OUT    MDCTL1
  320.     XTHL            ; Small delay to complete command
  321.     XTHL
  322.     MVI    A,MDRSET    ; Reset the 8251A for new command
  323.     OUT    MDCTL1
  324.     XTHL            ; Small delay to complete command
  325.     XTHL
  326.     MOV    A,B        ; Set speed
  327.     OUT    MDCTL1
  328.     XTHL            ; Small delay to complete command
  329.     XTHL
  330.     MVI    A,MDCOM        ; Error reset, RCV, DTR, TX ready
  331.     OUT    MDCTL1
  332.     XTHL            ; Small delay to complete command
  333.     XTHL
  334.     RET
  335. ;.....
  336. ;
  337. ;
  338. BAUDBUF:DB    10,0,0,0,0,0
  339.     DB    0,0,0,0,0,0
  340. ;
  341. ;                   end
  342. ;-----------------------------------------------------------------------
  343. ;
  344. ; NOTE: Must terminate by 0400H
  345. ;
  346.     END
  347.