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