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

  1.  
  2. ; I2SB-1.ASM  -  Intertec Super Brain overlay for IMP  -  09/17/85
  3. ;
  4. ;        USES 8251A I/O and BR1941 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 Intertec Super Brain computer to IMP.
  9. ;
  10. ; Edit this file for your preferences then follow the "TO USE:" example
  11. ; shown below.
  12. ;
  13. ; Many terminals will clear the screen with a CTL-Z.  If yours does, put
  14. ; a 1AH at CLEAR: (010AH).  Many terminals use two characters, the first
  15. ; normally an ESC.  For example, ESC *.  In this case put '*' at CLEAR:
  16. ; (The ESC will automatically be typed with no CTL-character present.)
  17. ; If you don't know what your terminal uses, put a 0 at CLEAR: and IMP
  18. ; will scroll up 24 blank lines to clear the CRT for things like MENU,
  19. ; looking at the function key table, typing CTL-Z in command mode, etc.
  20. ;
  21. ; Use the "SET" command to change the baudrate when desired.  The value
  22. ; at MSPEED controls the baudrate when the program is first called up.
  23. ;
  24. ;    TO USE: First edit this file filling in answers for your own
  25. ;        equipment.  Then assemble with ASM.COM or equivalent
  26. ;        assembler.  Then use MLOAD to merge into the main file:
  27. ;
  28. ;        MLOAD IMP.COM=IMP.COM,I2SB-x.HEX
  29. ;
  30. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  31. ;
  32. ; 09/17/85 - Written to work with IMP        - Irv Hoff
  33. ;
  34. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  35. ;
  36. ;
  37. YES    EQU    0FFH
  38. NO    EQU    0
  39. ;
  40. ;
  41. ; Values shown are for a 8251A
  42. ;
  43. PORT    EQU    58H    ; Your base port (data or status)
  44. MDCTL1    EQU    PORT+1    ; Modem control port
  45. MDDATP    EQU    PORT    ; Modem data port
  46. MDRCV    EQU    02H    ; Modem receive ready
  47. MDSND    EQU    01H    ; Modem send ready bit
  48. MDTXE    EQU    05H    ; Modem send buffer empty, holding buffer empty
  49. ;
  50. ;
  51. MDMODE    EQU    82H    ; Insures 8251 is out of mode with DTR high
  52. MDRSET    EQU    42H    ; Resets USART for additional commands
  53. MDCOM    EQU    17H    ; Reset error flags, RCV, DTR, TX ready
  54. MDSET1    EQU    4EH    ; 1 stop bit, no parity, 8 bits, x16
  55. MDSET2    EQU    0CEH    ; 2 stop bits, no parity, 8 bits, x16
  56. ;
  57. BRPORT    EQU    60H    ; BR1941 Baudrate generator port
  58. ;
  59. ;-----------------------------------------------------------------------
  60. ;
  61. ESC    EQU    '['-40H    ; ^[ = Escape
  62. BELL    EQU    'G'-40H    ; ^G = Bell character
  63. LF    EQU    'J'-40H    ; ^J = Linefeed
  64. NEXTRY    EQU    'K'-40H    ; ^K = Try next phone number, abort this try
  65. CR    EQU    'M'-40H    ; ^M = Carriage return
  66. CLEARSC    EQU    'Z'-40H    ; ^Z = Clears screen, command mode only
  67. EOFCHAR    EQU    'Z'-40H    ; ^Z = End of file
  68. ;
  69. ;
  70. ;-----------------------------------------------------------------------
  71. ;
  72. ;
  73.     ORG    0100H
  74. ;
  75. ;
  76.     DS    3        ; Skip the data area below
  77. ;
  78. ;
  79. ; These routines and equates are at the beginning of the program so
  80. ; they can be patched by a monitor or overlay file without re-assembling
  81. ; the program.
  82. ;
  83. MSPEED:     DB    5    ; 0=110 1=300 2=450 3=600 4=710 5=1200        103H
  84.             ; 6=2400 7=4800 8=9600 9=19200 default
  85. HS2400:     DB    NO    ; Yes=2400 bps highest speed            104H
  86. HS1200:     DB    YES    ; Yes=1200 bps highest speed            105H
  87. RACAL:     DB    NO    ; Yes=Racal-Vadic 1200V or 2400V or 2400PA    106H
  88. PROMODM: DB    NO    ; Yes=Prometheus ProModem 1200 bps        107H
  89. RESVD1:     DB    NO    ; Reserved for special modems            108H
  90. RESVD2:     DB    NO    ; Reserved for special modems            109H
  91. ;
  92. ;
  93. CLEAR:     DB    1AH    ; Clear screen character (ESC not needed)    10AH
  94. CLOCK:     DB    37    ; Clock speed in MHz x10, 25.5 MHz max.     10BH
  95.             ; 20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
  96. BYTDLY:     DB    2    ; 0=0 delay  1=10ms  5=50 ms - 9=90 ms        10CH
  97.             ;   default time to send character in ter-
  98.             ;   minal mode file transfer for slow BBS
  99. CRDLY:     DB    2    ; 0=0 delay 1=100 ms 5=500 ms - 9=900 ms    10DH
  100.             ;   default time for extra wait after CRLF
  101.             ;   in terminal mode file transfer
  102. NOFCOL:     DB    5    ; Number of directory columns shown        10EH
  103. TCHPUL:     DB    'T'    ; T=tone, P=Pulse (Hayes 2400 modems)        10FH
  104. ;.....
  105. ;
  106. ;
  107. ADDLFD:     DB    NO    ; Yes=add LF after CR to send file in terminal    110H
  108.             ;   mode (normally added by remote echo)
  109. CONVRUB: DB    YES    ; Yes=convert rub to backspace            111H
  110. CRCDFLT: DB    YES    ; Yes=default to CRC checking            112H
  111. IGNRCTL: DB    NO    ; Yes=CTL-chars above ^M not displayed        113H
  112. ;.....
  113. ;
  114. ;
  115. EXTCHR:     DB    '['-40H    ; ESC = preceeds local control character    114H
  116. EXITCHR: DB    'E'    ; Exit character                115H
  117. FILESND: DB    'F'    ; Send file when in terminal mode        116H
  118. NOCONCT: DB    'N'    ; Disconnect from phone line            117H
  119. LOGCHR:     DB    'L'    ; Send logon                    118H
  120. LSTCHR:     DB    'P'    ; Toggle printer                119H
  121. UNSAVCH: DB    'R'    ; Close input text buffer            11AH
  122. SAVECHR: DB    'Y'    ; Open input text buffer            11BH
  123. CLEARS:     DB    'Z'    ; Clears screen, terminal mode            11CH
  124. SPARE1:     DB    0    ; For future development            11DH
  125. NODTR:     DB    NO    ; Yes if no DTR and need +++ to disconnect    11EH
  126. ;.....
  127. ;
  128. ;
  129. ; Handles in/out ports for data and status
  130. ;
  131. I$MDCTL1: IN    MDCTL1        ;                    11FH
  132.       RET            ; IN modem control port         121H
  133.       DB    0,0,0,0,0,0,0    ; Spares if needed            122H
  134. ;
  135. I$MDTXE:  IN    MDCTL1        ; (Needed for SIO or DART register 1    129H
  136.       RET            ;                    12BH
  137.       DB    0,0,0,0,0,0,0    ;                    12CH
  138. ;
  139. I$MDDATP: MVI    A,37H        ;                    133H
  140.       OUT    MDCTL1        ;                    135H
  141.       IN    MDDATP        ;                    137H
  142.       RET            ;                    139H
  143.       DB    0,0,0        ; Spares if needed            13AH
  144. ;
  145. O$MDDATP: OUT    MDDATP        ;                    13DH
  146.       RET            ; OUT modem data port            13FH
  147.       DB    0,0,0,0,0,0,0    ; Spares if needed            140H
  148. ;.....
  149. ;
  150. ;
  151. A$MDRCV:  ANI    MDRCV        ;                    147H
  152.       RET            ;                    149H
  153. ;
  154. C$MDRCV:  CPI    MDRCV        ;                    14AH
  155.       RET            ;                    14CH
  156. ;
  157. A$MDSND:  ANI    MDSND        ;                    14DH
  158.       RET            ;                    14FH
  159. ;
  160. C$MDSND:  CPI    MDSND        ;                    150H
  161.       RET            ;                    152H
  162. ;
  163. A$MDTXE:  ANI    MDTXE        ;                    153H
  164.       RET            ;                    155H
  165. ;
  166. C$MDTXE:  CPI    MDTXE        ;                    156H
  167.       RET            ;                    158H
  168. ;.....
  169. ;
  170. ;
  171. ; Special exit vector, used by some computers to reset interrupt vectors
  172. ;
  173. J$EXITVEC:RET            ;                    159H
  174.       DB    0,0        ;                    15AH
  175. ;.....
  176. ;
  177. ;
  178. ; Jump vectors needed by each overlay
  179. ;
  180. J$GOODBYE:JMP    GOODBYE        ; Disconnects modem by dropping DTR    15CH
  181. J$INITMOD:JMP    INITMOD        ; Initializes modem, autosets baudrate    15FH
  182. J$STUPR:  JMP    STUPR        ; SET routine to change baudrate    162H
  183. J$SYSVR:  JMP    SYSVR        ; Signon message            165H
  184. ;.....
  185. ;
  186. ;
  187. ; "AT" command strings, can be replaced in individual overlay if needed
  188. ;
  189. J$STRNGA: DS    3        ; 1200 bps "AT" string            168H
  190. J$STRNG1: DS    3        ; 2400 bps "AT" string            16BH
  191. ;
  192. ;
  193. ; Next fourteen lines should not be changed by user overlay as these go
  194. ; to specific locations in the main program, not in the overlay.
  195. ;
  196. ;
  197. J$CMDSPL: DS    3        ; Allows entry of baudrate on CMD line    16EH
  198. J$CRLF:      DS    3        ; Turns up one new line on display    171H
  199. J$DIAL:      DS    3        ; Start of dialing routine        174H
  200. J$DSCONT: DS    3        ; Terminates modem use            177H
  201. J$GOLST:  DS    3        ; Printer routine, needed by Apple //e    17AH
  202. J$ILPRT:  DS    3        ; Prints an inline string, 0 to end    17DH
  203. J$INBUF:  DS    3        ; Stores a keybd string for comparison    180H
  204. J$INLNCP: DS    3        ; Inline "compare strings" routine    183H
  205. J$INMDM:  DS    3        ; Max .1 sec wait for modem character    186H
  206. J$RCVRSP: DS    3        ; For 3801 I/O use (TV-803)        189H
  207. J$SNDCHR: DS    3        ; Sends a character to the modem    18CH
  208. J$SNDSTR: DS    3        ; Sends a string to the modem, $ to end 18FH
  209. J$TIMER:  DS    3        ; .1 second timer (amount in 'B' reg.)    192H
  210. J$NEW1:      DB    0,0,0        ; For future needs            195H
  211. J$NEW2:      DB    0,0,0        ; For future needs            198H
  212. ;.....
  213. ;
  214. ;
  215. ; For 2400 bps auto-stepdown units
  216. ;
  217. MANUAL:      DB    0        ; For manual selection flag        19BH
  218. J$300:      JMP    OK300        ; Sets baudrate to 300 baud        19CH
  219. J$1200:      JMP    OK1200        ; Sets baudrate to 1200 bps        19FH
  220. J$2400:      JMP    OK2400        ; Sets baudrate to 2400 bps        1A2H
  221. ;.....
  222. ;
  223. ;
  224. LOGPTR:      DW    LOGON        ; Pointer to display LOGON message    1A5H
  225. ;
  226. SYSVR:      CALL    J$ILPRT        ; Display the following line        1A7H
  227.       DB    'Version for North Star Horizon modem port 04H'    ;    1AAH
  228.       DB    CR,LF,0
  229.       RET
  230. ;.....
  231. ;
  232. ;
  233. ;-----------------------------------------------------------------------
  234. ;
  235. ; NOTE:  You can change the SYSVER message to be longer or shorter.  The
  236. ;     end of your last routine should terminate by 0400H (601 bytes
  237. ;     available after start of SYSVER).
  238. ;
  239. ;-----------------------------------------------------------------------
  240. ;
  241. ; You can put in a message at this location which can be called up with
  242. ; (special character-L).  You can put in several lines.  End with a 0.
  243. ;
  244. LOGON:    DB    'This is a North Star Horizon computer...'
  245.     DB    CR,LF,0
  246. ;
  247. ;-----------------------------------------------------------------------
  248. ;
  249. ;
  250. ; This routine sets DTR low for 300 ms to disonnect the phone
  251. ;
  252. GOODBYE:
  253.     MVI    B,'S'-40H    ; X-off to stop host if needed
  254.     CALL    J$SNDCHR
  255.     MVI    B,1        ; Wait a moment to let it react
  256.     CALL    J$TIMER
  257.     MVI    A,3DH        ; Send break, turn off DTR
  258.     OUT    MDCTL1        ; Send to status port
  259.     MVI    B,3        ; Delay 300 ms to hang up phone
  260.     CALL    J$TIMER
  261.     MVI    A,37H        ; Normal send/receive with DTR
  262.     OUT    MDCTL1        ; Send to status port
  263.     RET
  264. ;.....
  265. ;
  266. ;
  267. ; Sets 8251 to 8 bits, DTR, RCV and TX ready
  268. ;
  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. STUPR:    CALL    J$CMDSPL    ; Gives us CMDBUF+6
  281.     JNC    STUPR2
  282. ;
  283. STUPR1:    CALL    J$ILPRT
  284.     DB    'Input Baud Rate (300, 1200): ',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$ILPRT        ; All matches failed, tell operator
  297.     DB    '++ Incorrect entry ++',CR,LF,BELL,CR,LF,0
  298.     JMP    STUPR1        ; Try again
  299. ;
  300. OK300:    MVI    A,1        ; MSPEED 300 baud value
  301.     MVI    B,BD300        ; Get 300 baud parameters in 'HL'
  302.     JMP    LOADBD        ; Go load them
  303. ;
  304. OK1200:    MVI    A,5
  305.     MVI    B,BD1200
  306.     JMP    LOADBD
  307. ;
  308. OK2400:    XRA    A
  309.     STA    MANUAL
  310.     MVI    A,6
  311.     MVI    B,BD2400
  312.     JMP    LOADBD
  313. ;
  314. OK9600:    MVI    A,8
  315.     MVI    B,BD9600
  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.     MVI    A,MDSET1    ; Set stop pulse, no parity 8 bits, x16
  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.     MOV    A,B        ; Get the requested baudrate
  335.     OUT    BRPORT        ; Set the speed now
  336.     IN    PORT        ; Clear data port
  337.     XRA    A        ; Clear the input
  338.     RET
  339. ;.....
  340. ;
  341. ;
  342. ; Table of baaudrate parameters
  343. ;
  344. BD300    EQU    57H        ; Modem 300,printer 1200
  345. BD1200    EQU    77H        ; Modem 1200,printer 1200
  346. BD2400    EQU    0A7H        ; Modem 2400, printer 1200
  347. BD9600    EQU    0E7H        ; Modem 9600,printer 1200
  348. ;
  349. BAUDBUF:DB    10,0,0,0,0,0
  350.     DB    0,0,0,0,0,0
  351. ;
  352. ;                   end
  353. ;-----------------------------------------------------------------------
  354. ;
  355. ; NOTE: Must terminate by 0400H
  356. ;
  357.     END
  358.