home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / cpm / bye5 / b5ns-7.ins < prev    next >
Encoding:
Text File  |  1994-07-13  |  8.9 KB  |  322 lines

  1.  
  2. ; B5NS-6.INS - BYE5 insert for North Star Horizon or Advantage    01/30/86
  3. ;
  4. ;             Uses 8251 I/O
  5. ;
  6. ;        Note:  This is an insert, not an overlay
  7. ;  This version is for the North Star Horizon and Advantage computers.
  8. ;  
  9. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  10. ; 01/30/86  Inserted extra code in LOADBD to change the baud rate
  11. ;           of the 8251 on the NorthStar Horizon standart serial
  12. ;           port. This is acomplished by reseting and telling
  13. ;           the 8251 to use x64 clock rate (for 300) or x16 clock   
  14. ;           rate (for 1200). This is done automatically when the
  15. ;           desired port is straped for 1200 baud operation at the
  16. ;           dip hedder.  Also added equates HORSTAN in order to use
  17. ;           the Horizon stadart serial port and MD300 to select
  18. ;           the x64 mode in the 8251            - Eddy Salvador
  19. ;
  20. ; 11/09/85  Made BDPORT relative to PORT for when PORT is changed to
  21. ;        one of the other 3 HSIO-4 ports.  Changed a typo from "0" to
  22. ;        "-" which calculates PORT for Advantage.  Added some explan-
  23. ;        atory comments.            - Don Appleby
  24. ;
  25. ; 10/10/85  Written for use with BYE5.    Excerpts from I2NA-1, I2NS-2 and
  26. ;        work done by Don Appleby.        - Irv Hoff
  27. ;
  28. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  29. ;
  30. ;-----------------------------------------------------------------------
  31. ;
  32. ; Equates
  33. ;
  34. NO    EQU    0
  35. YES    EQU    NOT NO
  36. ;
  37. HORSTAN EQU     YES             ; Yes for North Star Horizon standart serial
  38.                                 ; port
  39. HORIZON    EQU    NO        ; Yes for North Star Horizon with 4-HSIO
  40. ADVANTG    EQU    NO        ; Yes for North Star Advantage
  41. ;
  42. ; (Be sure clock header in locaton 3A is configured with pins connected
  43. ; 1-2, 3-4, 5-6, 7-10, 8-9, 11-12, 13-14 & 15-16 and remove header at
  44. ; location 1A on the selected SIO board for terminal configuraton if
  45. ; ADVANTG is YES.)
  46. ;-----------------------------------------------------------------------
  47. ;-----------------------------------------------------------------------
  48. ; If HORSTAN = YES strap the baud rate dip hedder for 1200 baud operation
  49. ; on the desired port
  50. ;-----------------------------------------------------------------------
  51. ;***********************************************************************  
  52. ;
  53. ; Baud rate port equates for NorthStar HSIO-4 board
  54. ;
  55.      IF    HORIZON
  56. èPORT    EQU    012H        ; Here are the HSIO-4 (12H,16H,1AH or 1EH)
  57. MDCTL1    EQU    PORT+1        ; Control port
  58. BDPORT    EQU    PORT-2        ; Baudrate port (change PORT as appropriate)
  59. ;
  60. ;
  61. ; Baudrates for North Star Horizon with HSIO-4 serial board
  62. ;
  63. BD300    EQU    6        ; 300 bps setting
  64. BD1200    EQU    4        ; 1200 bps setting
  65. BD2400    EQU    3        ; 2400 bps setting
  66. BD9600    EQU    1        ; 9600 bps setting
  67. BD19200    EQU    0        ; 19200 bps setting
  68.      ENDIF            ; HORIZON
  69. ;
  70. ; Baud rate port equates for NorthStar Standart serial port
  71. ; Change the port equate as required.
  72.  
  73.      IF    HORSTAN
  74. PORT    EQU    012H        ; Data port 
  75. MDCTL1    EQU    PORT+1        ; Control port
  76. BDPORT  EQU     PORT-2          ; There isn't one but we need the equate so
  77.                                 ; tha we won't get an error while compiling
  78. ;
  79. ; Baudrates for North Star Horizon, Only 1200 and 300 are used the rest
  80. ; is ignored because the 8251 can not be made to make miracles.
  81. ;
  82. BD300    EQU    6        ; 300 bps setting
  83. BD1200    EQU    4        ; 1200 bps setting
  84. BD2400    EQU    3        ; 2400 bps setting
  85. BD9600    EQU    1        ; 9600 bps setting
  86. BD19200    EQU    0        ; 19200 bps setting
  87.      ENDIF            ; HORIZON
  88. ;
  89. ;
  90. ; Baud rate port equates for NorthStar Advantage SIO boards
  91. ;
  92.      IF    ADVANTG
  93. PORT    EQU    60H-(10H*SLOT)    ; Modem data port (1,2,3,4,5 or 6 for SLOT)
  94. MDCTL1    EQU    PORT+1        ; Modem control port
  95. BDPORT    EQU    PORT+8        ; Modem baudrate port
  96. ;
  97. ;
  98. ; Baudrates for North Star Advantage
  99. ;
  100. BD300    EQU    040H        ; 300 bps setting
  101. BD1200    EQU    070H        ; 1200 bps setting
  102. BD2400    EQU    078H        ; 2400 bps setting
  103. BD9600    EQU    07EH        ; 9600 bps setting
  104. BD19200    EQU    07FH        ; 19200 bps setting
  105.      ENDIF            ; ADVANTG
  106. ;
  107. ;
  108. MDRCV    EQU    02H        ; Modem receive ready bit
  109. MDSND    EQU    01H        ; Modem send ready bit
  110. RESET    EQU    40H        ; Framing, overrun and parity errors
  111. è;
  112. MDCOM    EQU    37H        ; RTS, reset flags, RCV, TX, set DTR
  113. MDMODE    EQU    80H        ; Insures 8251 is out of mode, DTR
  114. MDRSET    EQU    42H        ; Resets USART for additional commands
  115. MDSET1    EQU    4EH        ; 1 stop bit, no parity, 8 bits, x16
  116. MD300      EQU     4FH             ; 1 stop bit, no parity, 8 bits, x64
  117. ;-----------------------------------------------------------------------
  118. ;***********************************************************************
  119. ;
  120. ;                          END OF CONFIG
  121. ;***********************************************************************
  122. ; See if we still have a carrier - if not, return with the zero flag set
  123. ;
  124. MDCARCK:IN    MDCTL1        ; Get status
  125.     ANI    80H        ; Check if carrier is on
  126.     RET
  127. ;.....
  128. ;
  129. ;
  130. ; Disconnect and wait for an incoming call
  131. ;
  132. MDINIT:    MVI    A,10H        ; Clear DTR
  133.     OUT    MDCTL1        ; To insure phone is disconnected
  134.     PUSH    B        ; Preserve in case we need it
  135.     MVI    B,20        ; 2 seconds to drop DTR
  136. ;
  137. OFFTI:    CALL    DELAY        ; 0.1 second delay
  138.     DCR    B
  139.     JNZ    OFFTI        ; Keep waiting until 2 seconds is up
  140. ;
  141.     POP    B        ; Restore the 'BC' register values
  142.     MVI    A,MDMODE    ; Insure 8251 is out of mode, DTR on
  143.     OUT    MDCTL1
  144.     XTHL            ; Small delay to complete command
  145.     XTHL
  146.     MVI    A,MDRSET    ; Reset the 8251 for new command
  147.     OUT    MDCTL1
  148.     XTHL
  149.     XTHL
  150.     MVI    A,MDSET1    ; Set stop pulse, no parity, 8 bits, x16
  151.     OUT    MDCTL1
  152.     XTHL            ; Small delay to complete command
  153.     XTHL
  154.     MVI    A,MDCOM        ; Error reset, RCV, DTR, TX ready
  155.     OUT    MDCTL1
  156.     XTHL            ; Small delay to complete command
  157.     XTHL
  158. ;
  159.      IF    IMODEM
  160.     CALL    IMINIT        ; Initialize modem
  161.      ENDIF            ; IMODEM
  162. ;
  163.     RET
  164. ;.....
  165. ;
  166. è;
  167. ; Input a character from the modem port
  168. ;
  169. MDINP:    IN    PORT        ; Get character
  170.     RET
  171. ;.....
  172. ;
  173. ;
  174. ; Check the status to see if a character is available.    If not, return
  175. ; with the zero flag set.  If yes, use 0FFH to clear the flag.
  176. ;
  177. MDINST:    IN    MDCTL1        ; Get status
  178.     ANI    MDRCV        ; Got a character?
  179.     RZ            ; Return if none
  180. ;
  181.     IN    MDCTL1        ; Get status again
  182.     ANI    RESET        ; Check for framing and overrun
  183.     JZ    MDINST1        ; No errors
  184.     MVI    A,17H        ; Reset error flags
  185.     OUT    MDCTL1
  186.     XRA    A        ; Return false
  187.     RET
  188. ;...
  189. ;
  190. ;
  191. MDINST1:ORI    0FFH        ; We have a character
  192.     RET
  193. ;.....
  194. ;
  195. ;
  196. ; Send a character to the modem
  197. ;
  198. MDOUTP:    OUT    PORT        ; Send it
  199.     RET
  200. ;.....
  201. ;
  202. ;
  203. ; Send a character to the modem
  204. ;
  205. MDOUTST:IN    MDCTL1
  206.     ANI    MDSND
  207.     RET
  208. ;.....
  209. ;
  210. ;
  211. ; Reinitialize the modem and hang up the phone by dropping DTR and
  212. ; leaving it inactive.
  213. ;
  214. MDQUIT:     IF    IMODEM
  215.     CALL    IMQUIT
  216.      ENDIF            ; IMODEM
  217. ;
  218. ;
  219. ; Called by the main program after caller types BYE
  220. ;
  221. èMDSTOP:    MVI    A,10H        ; DTR low hangs up phone, keep DTR low
  222.     OUT    MDCTL1        ;   so will not auto-answer at any time
  223.     RET
  224. ;.....
  225. ;
  226. ;
  227. ; The following routine sets the baudrate.  BYE5 asks for the maximum
  228. ; speed you have available.
  229. ;
  230. SETINV:    MVI    A,0FFH
  231.     ORA    A        ; Make sure the zero flag isn't set
  232.     RET
  233. ;.....
  234. ;
  235. ;
  236. SET300:    MVI    A,BD300        ; Setup for 300 bps
  237.     JMP    LOADBD
  238. ;.....
  239. ;
  240. ;
  241. SET1200:MVI    A,BD1200    ; Setup for 1200 bps
  242.     JMP    LOADBD
  243. ;.....
  244. ;
  245. ;
  246. SET2400:MVI    A,BD2400    ; Setup for 2400 bps
  247. ;
  248.  
  249. LOADBD:    
  250.         IF      HORSTAN
  251.        
  252.         CPI     BD300
  253.         JZ      BPS2            ; If 300 goto BPS2
  254.         CPI     BD1200
  255.         JZ      BPS1            ; If 1200 goto BPS1
  256.  
  257. ; If the required baud rate change was not for 1200 or 300
  258. ; leave the baud rate as it was and
  259. ; just exit gracefully.......
  260. ;                |
  261. ;                V
  262.  
  263. GETOUT:
  264.         IN      PORT
  265.         IN      PORT            ; Clear any garbage left
  266.         XRA     A               ; Show change
  267.         RET                     ; Exit 
  268.  
  269. BPS1:                           ; Entry point for 1200 baud
  270.         MVI     A,MDMODE        ; Insures 8251 is out of mode           
  271.         OUT     MDCTL1          ; Out with it                
  272.         XTHL
  273.         XTHL                    ; Small wait
  274.         MVI     A,MDRSET        ; Resets USART for additional commands
  275.     OUT     MDCTL1
  276. è    XTHL
  277.     XTHL
  278.     MVI      A,MDSET1    ;1 Stop    bit, no parity, 8 bits, x16
  279.     OUT     MDCTL1        
  280.     XTHL
  281.     XTHL
  282.     MVI     A,MDCOM        ; RTS, Reset flgs, RCV, TX, set DTR
  283.         OUT    MDCTL1       
  284.         XTHL
  285.         XTHL
  286.         JMP     GETOUT
  287. BPS2:                 ; Entry point for 300
  288.     MVI    A,MDMODE
  289.         OUT     MDCTL1
  290.         XTHL
  291.        XTHL
  292.     MVI    A,MDRSET
  293.     OUT     MDCTL1
  294.     XTHL
  295.     XTHL
  296.     MVI    A,MD300           ; 1 stop bit, no parity, 8 bits, x64
  297.     OUT    MDCTL1
  298.     XTHL
  299.     XTHL
  300.     MVI    A,MDCOM
  301.     OUT     MDCTL1
  302.     XTHL    
  303.     XTHL
  304.     JMP     GETOUT
  305.        
  306.         ENDIF                  ; Final resting place of this rutine
  307.  
  308.  
  309.  
  310. ; This one is used by equates HORIZON and ADVANTG
  311.  
  312.         OUT    BDPORT
  313.     XTHL
  314.     XTHL
  315.     MVI    A,MDCOM        ; Reset RTS, flags, DTR, enable R/T
  316.     OUT    MDCTL1
  317.     XTHL            ; Small delay to complete command
  318.     XTHL
  319.     IN    PORT        ; Clear decks for action
  320.     IN    PORT
  321.     XRA    A        ; Show baudrate change was successful
  322.     RET
  323. ;.....
  324. ;
  325. ;                   end B5NS-6.INS
  326. ;-----------------------------------------------------------------------
  327.