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 / NUBYE / NUBY-INS.LBR / NUNS-1.IQS / nuns-1.ins
Text File  |  1986-04-26  |  8KB  |  280 lines

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