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-4.INS < prev    next >
Text File  |  2000-06-30  |  5KB  |  223 lines

  1.  
  2. ; I2NS-4.ASM - BYE5 insert for North Star Horizon or Advantage  10/12/85
  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. ;
  11. ; 10/10/85  Written for use with BYE5.  Excerpts from I2NA-1, I2NS-2 and
  12. ;        work done by Don Appleby.        - Irv Hoff
  13. ;                    
  14. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  15. ;
  16. ;-----------------------------------------------------------------------
  17. ;
  18. ; Equates
  19. ;
  20. NO    EQU    0
  21. YES    EQU    NOT NO
  22. ;
  23. ;
  24. HORIZON    EQU    yes        ; Yes for North Star Horizon
  25. ADVANTG    EQU    no        ; Yes for North Star Advantage
  26. ;
  27. ; (Be sure clock header in locaton 3A is configured with pins connected
  28. ; 1-2, 3-4, 5-6, 7-10, 8-9, 11-12, 13-14 & 15-16 and remove header at
  29. ; location 1A on the selected SIO board for terminal configuraton if
  30. ; ADVANTG is YES.)
  31. ;
  32. ;-----------------------------------------------------------------------
  33. ;
  34. ;
  35. ; Baud rate port equates for NorthStar HSIO-4 board
  36. ;
  37.      IF    HORIZON
  38. PORT    EQU    012H        ; Here are the HSIO-4
  39. MDCTL1    EQU    PORT+1        ; Control port
  40. BDPORT    EQU    010H        ; Baudrate port
  41. ;
  42. ;
  43. ; Baudrates for North Star Horizon with HSIO-4 serial board
  44. ;
  45. BD300    EQU    6        ; 300 bps setting
  46. BD1200    EQU    4        ; 1200 bps setting
  47. BD2400    EQU    3        ; 2400 bps setting
  48. BD9600    EQU    1        ; 9600 bps setting
  49. BD19200    EQU    0        ; 19200 bps setting
  50.      ENDIF            ; HORIZON
  51. ;
  52. ;
  53. ; Baud rate port equates for NorthStar Advantage SIO boards
  54. ;
  55.      IF    ADVANTG
  56. PORT    EQU    60H0(10H*SLOT)    ; Modem data port
  57. MDCTL1    EQU    PORT+1        ; Modem control port
  58. BDPORT    EQU    PORT+8        ; Modem baudrate port
  59. ;
  60. ;
  61. ; Baudrates for North Star Advantage
  62. ;
  63. BD300    EQU    040H        ; 300 bps setting
  64. BD1200    EQU    070H        ; 1200 bps setting
  65. BD2400    EQU    078H        ; 2400 bps setting
  66. BD9600    EQU    07EH        ; 9600 bps setting
  67. BD19200    EQU    07FH        ; 19200 bps setting
  68.      ENDIF            ; ADVANTG
  69. ;
  70. ;
  71. MDRCV    EQU    02H        ; Modem receive ready bit
  72. MDSND    EQU    01H        ; Modem send ready bit
  73. RESET    EQU    38H        ; Framing, overrun and parity errors
  74. ;
  75. MDCOM    EQU    37H        ; RTS, reset flags, RCV, TX, set DTR
  76. MDMODE    EQU    82H        ; Insures 8251 is out of mode, DTR
  77. MDRSET    EQU    42H        ; Resets USART for additional commands
  78. MDSET1    EQU    4EH        ; 1 stop bit, no parity, 8 bits, x16
  79. ;
  80. ;-----------------------------------------------------------------------
  81. ;
  82. ; See if we still have a carrier - if not, return with the zero flag set
  83. ;
  84. MDCARCK:IN    MDCTL1        ; Get status
  85.     ANI    80H        ; Check if carrier is on
  86.     RET
  87. ;.....
  88. ;
  89. ;
  90. ; Disconnect and wait for an incoming call
  91. ;
  92. MDINIT:    MVI    A,10H        ; Clear DTR
  93.     OUT    MDCTL1        ; To insure phone is disconnected
  94.     PUSH    B        ; Preserve in case we need it
  95.     MVI    B,20        ; 2 seconds to drop DTR
  96. ;
  97. OFFTI:    CALL    DELAY        ; 0.1 second delay
  98.     DCR    B
  99.     JNZ    OFFTI        ; Keep waiting until 2 seconds is up
  100. ;
  101.     POP    B        ; Restore the 'BC' register values
  102.     MVI    A,MDMODE    ; Insure 8251 is out of mode, DTR on
  103.     OUT    MDCTL1
  104.     XTHL            ; Small delay to complete command
  105.     XTHL
  106.     MVI    A,MDRSET    ; Reset the 8251 for new command
  107.     OUT    MDCTL1
  108.     XTHL
  109.     XTHL
  110.     MVI    A,MDSET1    ; Set stop pulse, no parity, 8 bits, x16
  111.     OUT    MDCTL1
  112.     XTHL            ; Small delay to complete command
  113.     XTHL
  114.     MVI    A,MDCOM        ; Error reset, RCV, DTR, TX ready
  115.     OUT    MDCTL1
  116.     XTHL            ; Small delay to complete command
  117.     XTHL
  118. ;
  119.      IF    IMODEM
  120.     CALL    IMINIT        ; Initialize modem
  121.      ENDIF            ; IMODEM
  122. ;
  123.     RET
  124. ;.....
  125. ;
  126. ;
  127. ; Input a character from the modem port
  128. ;
  129. MDINP:    IN    PORT        ; Get character
  130.     RET
  131. ;.....
  132. ;
  133. ;
  134. ; Check the status to see if a character is available.  If not, return
  135. ; with the zero flag set.  If yes, use 0FFH to clear the flag.
  136. ;
  137. MDINST:    IN    MDCTL1        ; Get status
  138.     ANI    MDRCV        ; Got a character?
  139.     RZ            ; Return if none
  140. ;
  141.     IN    MDCTL1        ; Get status again
  142.     ANI    RESET        ; Check for framing and overrun
  143.     JZ    MDINST1        ; No errors
  144.     MVI    A,17H        ; Reset error flags
  145.     OUT    MDCTL1
  146.     XRA    A        ; Return false
  147.     RET
  148. ;...
  149. ;
  150. ;
  151. MDINST1:ORI    0FFH        ; We have a character
  152.     RET
  153. ;.....
  154. ;
  155. ;
  156. ; Send a character to the modem
  157. ;
  158. MDOUTP:    OUT    PORT        ; Send it
  159.     RET
  160. ;.....
  161. ;
  162. ;
  163. ; Send a character to the modem
  164. ;
  165. MDOUTST:IN    MDCTL1
  166.     ANI    MDSND
  167.     RET
  168. ;.....
  169. ;
  170. ;
  171. ; Reinitialize the modem and hang up the phone by dropping DTR and
  172. ; leaving it inactive.
  173. ;
  174. MDQUIT:     IF    IMODEM
  175.     CALL    IMQUIT
  176.      ENDIF            ; IMODEM
  177. ;
  178. ;
  179. ; Called by the main program after caller types BYE
  180. ;
  181. MDSTOP:    MVI    A,10H        ; DTR low hangs up phone, keep DTR low
  182.     OUT    MDCTL1        ;   so will not auto-answer at any time
  183.     RET
  184. ;.....
  185. ;
  186. ;
  187. ; The following routine sets the baudrate.  BYE5 asks for the maximum
  188. ; speed you have available.
  189. ;
  190. SETINV:    MVI    A,0FFH
  191.     ORA    A        ; Make sure the zero flag isn't set    
  192.     RET
  193. ;.....
  194. ;
  195. ;
  196. SET300:    MVI    A,BD300        ; Setup for 300 bps
  197.     JMP    LOADBD
  198. ;.....
  199. ;
  200. ;
  201. SET1200:MVI    A,BD1200    ; Setup for 1200 bps
  202.     JMP    LOADBD
  203. ;.....
  204. ;
  205. ;
  206. SET2400:MVI    A,BD2400    ; Setup for 2400 bps
  207. ;
  208.  
  209. LOADBD:    OUT    BDPORT
  210.     XTHL
  211.     XTHL
  212.     MVI    A,MDCOM        ; Reset RTS, flags, DTR, enable R/T
  213.     OUT    MDCTL1
  214.     XTHL            ; Small delay to complete command    
  215.     XTHL
  216.     IN    PORT        ; Clear decks for action
  217.     IN    PORT
  218.     XRA    A        ; Show baudrate change was successful
  219.     RET
  220. ;.....
  221. ;
  222. ;                   end
  223. ;-----------------------------------------------------------------------