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

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