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 / I2SY-3.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  13KB  |  476 lines

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