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

  1.  
  2. ; I2SY-2.ASM - Sayno MBC-1000/1100/1200/1250 overlay for IMP - 03/17/86
  3. ;
  4. ;        USES 8251A I/O (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 Sanyo MBC-1000/1100/1200/1250  (no baudrate gen-
  9. ; erator) to IMP.
  10. ;
  11. ; Edit this file for your preferences then follow the "TO USE:" example
  12. ; shown below.
  13. ;
  14. ; Many terminals will clear the screen with a CTL-Z.  If yours does, put
  15. ; a 1AH at CLEAR: (010AH).  Many terminals use two characters, the first
  16. ; normally an ESC.  For example, ESC *.  In this case put '*' at CLEAR:
  17. ; (The ESC will automatically be typed with no CTL-character present.)
  18. ; If you don't know what your terminal uses, put a 0 at CLEAR: and IMP
  19. ; will scroll up 24 blank lines to clear the CRT for things like MENU,
  20. ; looking at the function key table, typing CTL-Z in command mode, etc.
  21. ;
  22. ; Use the "SET" command to change the baudrate when desired.  The value
  23. ; at MSPEED controls the baudrate when the program is first called up.
  24. ;
  25. ;    TO USE: First edit this file filling in answers for your own
  26. ;        equipment.  Then assemble with ASM.COM or equivalent
  27. ;        assembler.  Then use MLOAD to merge into the main file:
  28. ;
  29. ;        MLOAD IMP.COM=IMP.COM,I2SY-x.HEX
  30. ;
  31. ;-----------------------------------------------------------------------
  32. ;               MBC-1000 mod
  33. ;
  34. ; This modification adapts the Sanyo MBC-1000 computer to use various
  35. ; modem speeds, including 300-1200-2400 bps.  It requires the following
  36. ; hardware changes to use the spare 8253 timer on IC4.    This is on the
  37. ; serial I/O board.
  38. ;
  39. ; NOTE: The Sayno MBC-1000 can be used at 300/1200 bps without these
  40. ;    changes, if you leave the on-board jumper set to 1200 bps.  Then
  41. ;    (as with the other models) the unit will come up at 1200 bps and
  42. ;    the SET command may be used to select 300 if desired.
  43. ;
  44. ;        1. Cut etch from IC18 Pin 1 to JP2 Pin 8.
  45. ;        2. Install jumper from IC18 Pin 1 to IC4 Pin 18.
  46. ;        3. Install jumper from IC4 Pin 17 to JP2 Pin 8.
  47. ;        4. Install jumper from IC4 Pin 16 to IC4 Pin 14.
  48. ;        5. Move jumper strap to JP2 Pin 8 for programmable
  49. ;             baud rate, other pins (1-7) can still be used
  50. ;             for standard baud rate selections.
  51. ;        6. Hardware modification is now complete.
  52. ;
  53. ;
  54. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  55. ;
  56. ; 03/17/86  Added hardware change for MBC-1000    - Irv Hoff
  57. ; 02/04/86  Written to work with IMP        - Irv Hoff
  58. ;
  59. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  60. ;
  61. ;
  62. YES    EQU    0FFH
  63. NO    EQU    0
  64. ;
  65. ;
  66. MOD1000    EQU    NO        ; MBC-1000 with hardware mods, above
  67. MBC1000    EQU    yes        ; Normal MBC-1000, jumper set for 1200
  68. MBC1100    EQU    NO        ; MBC-1100, jumper set for 1200
  69. MBC1200    EQU    NO        ; MBD-1200, jumper set for 1200
  70. ;
  71. ;
  72.      IF    MBC1000    OR MOD1000
  73. PORT    EQU    0A4H
  74.      ENDIF
  75. ;
  76.      IF    MBC1100
  77. PORT    EQU    0DCH
  78.      ENDIF
  79. ;
  80.      IF    MBC1200
  81. PORT    EQU    0ECH
  82.      ENDIF
  83. ;
  84. ;
  85. ; Values shown are for a 8251A
  86. ;
  87. MDDATP    EQU    PORT    ; Modem data port
  88. MDCTL1    EQU    PORT+1    ; Modem control port
  89. MDRCV    EQU    02H    ; Modem receive ready
  90. MDSND    EQU    01H    ; Modem send ready bit
  91. MDTXE    EQU    05H    ; Modem send buffer empty, holding buffer empty
  92. ;
  93. ;
  94. MDMODE    EQU    82H    ; Insures 8251 is out of mode with DTR high
  95. MDRSET    EQU    42H    ; Resets USART for additional commands
  96. MDCOM    EQU    17H    ; Reset error flags, RCV, DTR, TX ready
  97. ;
  98. ;
  99.      IF    MOD1000
  100. BDPORT    EQU    0A2H    ; 8253 baud rate port
  101. BTPORT    EQU    0A3H    ; 8253 timer port
  102.      ENDIF        ; MOD1000
  103. ;
  104. ;
  105. ;-----------------------------------------------------------------------
  106. ;
  107. ESC    EQU    '['-40H    ; ^[ = Escape
  108. BELL    EQU    'G'-40H    ; ^G = Bell character
  109. LF    EQU    'J'-40H    ; ^J = Linefeed
  110. NEXTRY    EQU    'K'-40H    ; ^K = Try next phone number, abort this try
  111. CR    EQU    'M'-40H    ; ^M = Carriage return
  112. CLEARSC    EQU    'Z'-40H    ; ^Z = Clears screen, command mode only
  113. EOFCHAR    EQU    'Z'-40H    ; ^Z = End of file
  114. ;
  115. ;
  116. ;-----------------------------------------------------------------------
  117. ;
  118. ;
  119.     ORG    0100H
  120. ;
  121. ;
  122.     DS    3        ; Skip the data area below
  123. ;
  124. ;
  125. ; These routines and equates are at the beginning of the program so
  126. ; they can be patched by a monitor or overlay file without re-assembling
  127. ; the program.
  128. ;
  129. MSPEED:     DB    5    ; 0=110 1=300 2=450 3=600 4=710 5=1200        103H
  130.             ; 6=2400 7=4800 8=9600 9=19200 default
  131. HS2400:     DB    NO    ; Yes=2400 bps highest speed            104H
  132. HS1200:     DB    YES    ; Yes=1200 bps highest speed            105H
  133. RACAL:     DB    NO    ; Yes=Racal-Vadic 1200V or 2400V or 2400PA    106H
  134. PROMODM: DB    NO    ;*Yes=Prometheus ProModem 1200 bps        107H
  135. RESVD1:     DB    NO    ; Reserved for special modems            108H
  136. RESVD2:     DB    NO    ; Reserved for special modems            109H
  137. ;
  138. ;
  139. CLEAR:     DB    1AH    ; Clear screen character (ESC not needed)    10AH
  140. CLOCK:     DB    40    ; Clock speed in MHz x10, 25.5 MHz max.     10BH
  141.             ; 20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
  142. BYTDLY:     DB    2    ; 0=0 delay  1=10ms  5=50 ms - 9=90 ms        10CH
  143.             ;   default time to send character in ter-
  144.             ;   minal mode file transfer for slow BBS
  145. CRDLY:     DB    2    ; 0=0 delay 1=100 ms 5=500 ms - 9=900 ms    10DH
  146.             ;   default time for extra wait after CRLF
  147.             ;   in terminal mode file transfer
  148. NOFCOL:     DB    5    ; Number of directory columns shown        10EH
  149. TCHPUL:     DB    'T'    ; T=tone, P=Pulse (Hayes 2400 modems)        10FH
  150. ;.....
  151. ;
  152. ;
  153. ADDLFD:     DB    NO    ; Yes=add LF after CR to send file in terminal    110H
  154.             ;   mode (normally added by remote echo)
  155. CONVRUB: DB    YES    ; Yes=convert rub to backspace            111H
  156. CRCDFLT: DB    YES    ; Yes=default to CRC checking            112H
  157. IGNRCTL: DB    NO    ; Yes=CTL-chars above ^M not displayed        113H
  158. ;.....
  159. ;
  160. ;
  161. EXTCHR:     DB    '['-40H    ; ESC = preceeds local control character    114H
  162. EXITCHR: DB    'E'    ; Exit character                115H
  163. FILESND: DB    'F'    ; Send file when in terminal mode        116H
  164. NOCONCT: DB    'N'    ; Disconnect from phone line            117H
  165. LOGCHR:     DB    'L'    ; Send logon                    118H
  166. LSTCHR:     DB    'P'    ; Toggle printer                119H
  167. UNSAVCH: DB    'R'    ; Close input text buffer            11AH
  168. SAVECHR: DB    'Y'    ; Open input text buffer            11BH
  169. CLEARS:     DB    'Z'    ; Clears screen, terminal mode            11CH
  170. SPARE1:     DB    0    ; For future development            11DH
  171. NODTR:     DB    NO    ; Yes if no DTR and need +++ to disconnect    11EH
  172. ;.....
  173. ;
  174. ;
  175. ; Handles in/out ports for data and status
  176. ;
  177. I$MDCTL1: IN    MDCTL1        ;                    11FH
  178.       RET            ; IN modem control port         121H
  179.       DB    0,0,0,0,0,0,0    ; Spares if needed            122H
  180. ;
  181. I$MDTXE:  IN    MDCTL1        ; (Needed for SIO or DART register 1    129H
  182.       RET            ;                    12BH
  183.       DB    0,0,0,0,0,0,0    ;                    12CH
  184. ;
  185. I$MDDATP: MVI    A,37H        ;                    133H
  186.       OUT    MDCTL1        ;                    135H
  187.       IN    MDDATP        ;                    137H
  188.       RET            ;                    139H
  189.       DB    0,0,0        ; Spares if needed            13AH
  190. ;
  191. O$MDDATP: OUT    MDDATP        ;                    13DH
  192.       RET            ; OUT modem data port            13FH
  193.       DB    0,0,0,0,0,0,0    ; Spares if needed            140H
  194. ;.....
  195. ;
  196. ;
  197. A$MDRCV:  ANI    MDRCV        ;                    147H
  198.       RET            ;                    149H
  199. ;
  200. C$MDRCV:  CPI    MDRCV        ;                    14AH
  201.       RET            ;                    14CH
  202. ;
  203. A$MDSND:  ANI    MDSND        ;                    14DH
  204.       RET            ;                    14FH
  205. ;
  206. C$MDSND:  CPI    MDSND        ;                    150H
  207.       RET            ;                    152H
  208. ;
  209. A$MDTXE:  ANI    MDTXE        ;                    153H
  210.       RET            ;                    155H
  211. ;
  212. C$MDTXE:  CPI    MDTXE        ;                    156H
  213.       RET            ;                    158H
  214. ;.....
  215. ;
  216. ;
  217. ; Special exit vector, used by some computers to reset interrupt vectors
  218. ;
  219. J$EXITVEC:RET            ;                    159H
  220.       DB    0,0        ;                    15AH
  221. ;.....
  222. ;
  223. ;
  224. ; Jump vectors needed by each overlay
  225. ;
  226. J$GOODBYE:JMP    GOODBYE        ; Disconnects modem by dropping DTR    15CH
  227. J$INITMOD:JMP    INITMOD        ; Initializes modem, autosets baudrate    15FH
  228. J$STUPR:  JMP    STUPR        ; SET routine to change baudrate    162H
  229. J$SYSVR:  JMP    SYSVR        ; Signon message            165H
  230. ;.....
  231. ;
  232. ;
  233. ; "AT" command strings, can be replaced in individual overlay if needed
  234. ;
  235. J$STRNGA: DS    3        ; 1200 bps "AT" string            168H
  236. J$STRNG1: DS    3        ; 2400 bps "AT" string            16BH
  237. ;
  238. ;
  239. ; Next fourteen lines should not be changed by user overlay as these go
  240. ; to specific locations in the main program, not in the overlay.
  241. ;
  242. ;
  243. J$CMDSPL: DS    3        ; Allows entry of baudrate on CMD line    16EH
  244. J$CRLF:      DS    3        ; Turns up one new line on display    171H
  245. J$DIAL:      DS    3        ; Start of dialing routine        174H
  246. J$DSCONT: DS    3        ; Terminates modem use            177H
  247. J$GOLST:  DS    3        ; Printer routine, needed by Apple //e    17AH
  248. J$ILPRT:  DS    3        ; Prints an inline string, 0 to end    17DH
  249. J$INBUF:  DS    3        ; Stores a keybd string for comparison    180H
  250. J$INLNCP: DS    3        ; Inline "compare strings" routine    183H
  251. J$INMDM:  DS    3        ; Max .1 sec wait for modem character    186H
  252. J$RCVRSP: DS    3        ; For 3801 I/O use (TV-803)        189H
  253. J$SNDCHR: DS    3        ; Sends a character to the modem    18CH
  254. J$SNDSTR: DS    3        ; Sends a string to the modem, $ to end 18FH
  255. J$TIMER:  DS    3        ; .1 second timer (amount in 'B' reg.)    192H
  256. J$NEW1:      DB    0,0,0        ; For future needs            195H
  257. J$NEW2:      DB    0,0,0        ; For future needs            198H
  258. ;.....
  259. ;
  260. ;
  261. ; For 2400 bps auto-stepdown units
  262. ;
  263. MANUAL:      DB    0        ; For manual selection flag        19BH
  264. J$300:      JMP    OK300        ; Sets baudrate to 300 baud        19CH
  265. J$1200:      JMP    OK1200        ; Sets baudrate to 1200 bps        19FH
  266. J$2400:      JMP    OK2400        ; Sets baudrate to 2400 bps        1A2H
  267. ;.....
  268. ;
  269. ;
  270. LOGPTR:      DW    LOGON        ; Pointer to display LOGON message    1A5H
  271. ;
  272. SYSVR:      CALL    J$ILPRT        ; Display the following line        1A7H
  273.       DB    'Version for Sayno computer with external modem' ;    1AAH
  274.       DB    CR,LF,0
  275.       RET
  276. ;.....
  277. ;
  278. ;
  279. ;-----------------------------------------------------------------------
  280. ;
  281. ; NOTE:  You can change the SYSVER message to be longer or shorter.  The
  282. ;     end of your last routine should terminate by 0400H (601 bytes
  283. ;     available after start of SYSVER).
  284. ;
  285. ;-----------------------------------------------------------------------
  286. ;
  287. ; You can put in a message at this location which can be called up with
  288. ; (special character-L).  You can put in several lines.  End with a 0.
  289. ;
  290. LOGON:    DB    'This is a Sanyo computer...'
  291.     DB    CR,LF,0
  292. ;
  293. ;-----------------------------------------------------------------------
  294. ;
  295. ;
  296. ; This routine sets DTR low for 300 ms to disonnect the phone
  297. ;
  298. GOODBYE:MVI    B,'S'-40H    ; X-off to stop host if needed
  299.     CALL    J$SNDCHR
  300.     MVI    B,1        ; Wait a moment to let it react
  301.     CALL    J$TIMER
  302.     MVI    A,3DH        ; Send break, turn off DTR
  303.     OUT    MDCTL1        ; Send to status port
  304.     MVI    B,3        ; Delay 300 ms to hang up phone
  305.     CALL    J$TIMER
  306.     MVI    A,37H        ; Normal send/receive with DTR
  307.     OUT    MDCTL1        ; Send to status port
  308.     RET
  309. ;.....
  310. ;
  311. ;
  312. ; Sets 8251A to 8 bits, DTR, RCV and TX ready
  313. ;
  314. INITMOD:LDA    MSPEED        ; Get the selected value
  315.     CPI    1        ; 300 bps
  316.     JZ    OK300
  317.     CPI    5        ; 1200 bps
  318.     JZ    OK1200
  319. ;
  320.      IF    MOD1000
  321.     CPI    6
  322.     JZ    OK2400
  323.     CPI    8
  324.     JZ    OK9600
  325.     CPI    9
  326.     JZ    OK19200
  327.      ENDIF            ; MOD1000
  328. ;
  329.     JMP    STUPR1        ; Else ask what is wanted
  330. ;.....
  331. ;
  332. ;
  333. STUPR:    CALL    J$CMDSPL    ; Gives us CMDBUF+6
  334.     JNC    STUPR2
  335. ;
  336. STUPR1:    CALL    J$ILPRT
  337.     DB    'Input Baud Rate (300, 1200'
  338. ;
  339.      IF    NOT MOD1000
  340.     DB    '): ',0
  341.      ENDIF            ; NOT MOD1000
  342. ;
  343.      IF    MOD1000
  344.     DB    ', 2400, 9600, 19200): ',0
  345.      ENDIF            ; MOD1000
  346. ;
  347.     LXI    D,BAUDBUF    ; Point to new input buffer
  348.     CALL    J$INBUF
  349.     CALL    J$CRLF
  350.     LXI    D,BAUDBUF+2
  351. ;
  352. STUPR2:    CALL    J$INLNCP    ; Compare BAUDBUF+2 with chars. below
  353.     DB    '300',0
  354.     JNC    OK300        ; Go if got match
  355.     CALL    J$INLNCP
  356.     DB    '1200',0
  357.     JNC    OK1200
  358.     CALL    J$ILPRT        ; All matches failed, tell operator
  359.     DB    '++ Incorrect entry ++',CR,LF,BELL,CR,LF,0
  360.     JMP    STUPR1        ; Try again
  361. ;
  362. ;
  363.      IF    NOT MOD1000
  364. OK300:    MVI    A,1        ; MSPEED 300 baud value
  365.     MVI    B,DV64        ; Get 300 baud parameters in 'HL'
  366.     JMP    LOADBD        ; Go load them
  367. ;
  368. OK1200:    MVI    A,5
  369.     MVI    B,DV16
  370.     JMP    LOADBD
  371. ;
  372. OK2400:    JMP    OK1200        ; Horizon does not support 2400 bps
  373.      ENDIF            ; NOT MOD1000
  374. ;
  375. ;
  376.      IF    MOD1000
  377. OK300:    MVI    A,1
  378.     MVI    B,DV64
  379.     MVI    C,BD300
  380.     JMP    LOADBB
  381.  
  382. OK1200:    MVI    A,5
  383.     MVI    B,DV64
  384.     MVI    C,BD1200
  385.     JMP    LOADBB
  386.  
  387. OK2400:    XRA    A
  388.     STA    MANUAL
  389.     MVI    A,6
  390.     MVI    B,DV16
  391.     MVI    C,BD2400
  392.     JMP    LOADBB
  393. ;
  394. OK9600:    MVI    A,8
  395.     MVI    B,DV16
  396.     MVI    C,BD9600
  397.     JMP    LOADBB
  398. ;
  399. OK19200:MVI    A,9
  400.     MVI    B,DV16
  401.     MVI    C,BD19200
  402. ;
  403. LOADBB:    PUSH    PSW        ; Save the MSPEED value
  404.     MVI    A,96H        ; Square wave output for 8253, Cntr 2
  405.     OUT    BTPORT
  406.     MOV    A,C
  407.     OUT    BDPORT        ; Set the baudrate
  408.     POP    PSW        ; Get the baudrate back
  409.      ENDIF            ; MOD1000
  410. ;
  411. LOADBD:    STA    MSPEED        ; Change time-to-send to match baudrate
  412.     MVI    A,MDMODE    ; Insure 8251 is out of mode
  413.     OUT    MDCTL1
  414.     XTHL            ; Small delay to complete command
  415.     XTHL
  416.     MVI    A,MDRSET    ; Reset the 8251A for new command
  417.     OUT    MDCTL1
  418.     XTHL            ; Small delay to complete command
  419.     XTHL
  420.     MOV    A,B        ; 1 stop, no parity, 8 bits x16 (or x64)
  421.     OUT    MDCTL1
  422.     XTHL            ; Small delay to complete command
  423.     XTHL
  424.     MVI    A,MDCOM        ; Error reset, RCV, DTR, TX ready
  425.     OUT    MDCTL1
  426.     XTHL            ; Small delay to complete command
  427.     XTHL
  428. ;
  429.      IF    MOD1000
  430.     
  431.     IN    PORT        ; Clear data port
  432.     XRA    A        ; Clear the input
  433.     RET
  434. ;.....
  435. ;
  436. ;
  437. ; Table of baudrate parameters
  438. ;
  439. DV64    EQU    4FH        ; 300 baud, x64
  440. DV16    EQU    4EH        ; 1200 bps, x16
  441. ;
  442.      IF    MOD1000
  443. BD300    EQU    64        ; x64
  444. BD1200    EQU    16        ; x64
  445. BD2400    EQU    128        ; x16
  446. BD9600    EQU    32        ; x16
  447. BD19200    EQU    16        ; x16
  448.      ENDIF            ; MOD1000
  449. ;
  450. BAUDBUF:DB    10,0,0,0,0,0
  451.     DB    0,0,0,0,0,0
  452. ;
  453. ;                   end
  454. ;-----------------------------------------------------------------------
  455. ;
  456. ; NOTE: Must terminate by 0400H
  457. ;
  458.     END
  459.