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 / B5AL-1.IQS / B5AL-1.INS
Text File  |  2000-06-30  |  5KB  |  197 lines

  1.  
  2. ; B5AL-1.INS - BYE5 insert for ALTOS 5000 and 8000 Systems  12/03/85
  3. ;
  4. ;          Z80-SIO and 8430 CTC timer
  5. ;
  6. ; This version is for both the Altos 5000 and Altos 8000 computers
  7. ;      Note:  This is an insert, not an overlay.
  8. ;
  9. ;
  10. ;    When used with the Altos 5000 the serial port labeled JA
  11. ;    is used, and with the Altos 8000 the serial port #2 is 
  12. ;    selected.  
  13. ;
  14. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  15. ;
  16. ; 12/03/85  Written for use with BYE5            - Dennis Recla
  17. ;
  18. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  19. ;
  20. ;
  21. ; Select one of the following with YES or NO
  22. ;
  23. ALTOS5    EQU    NO        ; Altos 5000 series is selected
  24. ALTOS8    EQU    YES        ; Altos 8000 series is selected
  25. ;
  26. ;
  27. ; Set base port for SIO & CTC chips
  28. ;
  29.      IF    ALTOS5
  30. PORT    EQU    1EH        ; Data port
  31. MDCTL1    EQU    PORT+1        ; Modem satus port
  32. BRPORT    EQU    0EH        ; Baud rate generator port (CTC)
  33.      ENDIF            ; ALTOS5
  34. ;
  35.      IF    ALTOS8
  36. PORT    EQU    28H        ; Data port
  37. MDCTL1    EQU    PORT+1        ; Modem status port
  38. BRPORT    EQU    0EH        ; Baud rate generator port (CTC)
  39.      ENDIF            ; ALTOS8
  40. ;
  41. MDRCV    EQU    1        ; Modem receive ready bit
  42. MDSND    EQU    4        ; Modem send ready bit
  43. MDDCD    EQU    8        ; Data carrier detect
  44. ;
  45. ;
  46. ; First byte of CTC Command:
  47. ;
  48. ; To access CTC baud rate command - Note, the ALTOS uses the timer
  49. ; mode for baud rates less than 1200 baud, and the counter mode for
  50. ; baud rates above 1200 baud.
  51. ;
  52. BDCMD1    EQU    07H        ; Uses a "divide by 16" prescaler
  53. BDCMD2    EQU    47H        ; Uses a "divide by 2" flip-flop
  54. ;
  55. ;
  56. BD300    EQU    34H        ; 300 baud     Timer mode
  57. BD1200    EQU    0DH        ; 1200 bps    Timer mode
  58. BD2400    EQU    34H        ; 2400 bps    Counter mode
  59. BD9600    EQU    0DH        ; 9600 bps    Counter mode
  60. ;
  61. ;.....
  62. ;
  63. ;
  64. ;-----------------------------------------------------------------------
  65. ;
  66. ; See if we still have a carrier - if not, return with the zero flag set
  67. ;
  68. MDCARCK:MVI    A,10H        ; Reset status
  69.     OUT    MDCTL1
  70.     IN    MDCTL1        ; Get status
  71.     ANI    MDDCD        ; Check for carrier
  72.     RET
  73. ;.....
  74. ;
  75. ;
  76. ; Disconnect and wait for an incoming call
  77. ;
  78. MDINIT:    MVI    A,0        ; Setup to write register 0
  79.     OUT    MDCTL1
  80.     MVI    A,18H        ; Reset channel
  81.     OUT    MDCTL1
  82.     MVI    A,1        ; Setup to write register 1
  83.     OUT     MDCTL1
  84.     MVI    A,0        ; Turn off all interrupts
  85.     OUT     MDCTL1
  86.     MVI    A,4        ; Setup to write register 4
  87.     OUT    MDCTL1
  88.     MVI    A,44H        ; Set 16x, 1 stop bit, no parity
  89.     OUT    MDCTL1
  90.     MVI    A,3        ; Setup to write register 3
  91.     OUT    MDCTL1
  92.     MVI    A,0C1H        ; 8 bits, Rx enable
  93.     OUT    MDCTL1
  94.     MVI    A,5        ; Setup to write register 5
  95.     OUT    MDCTL1
  96.     MVI    A,68H        ; DTR off
  97.     OUT    MDCTL1
  98.     PUSH    B        ; Save in case it's being used elsewhere
  99.     MVI    B,20        ; 2 second delay to drop any carrier
  100. ;
  101. OFFTI:    CALL    DELAY        ; 1 second delay
  102.     DCR    B
  103.     JNZ    OFFTI        ; Keep looping until finished
  104.     POP    B        ; Restore 'BC'
  105.     MVI    A,5        ; Setup to write register 5
  106.     OUT    MDCTL1
  107.     MVI    A,0EAH        ; Turn DTR back on
  108.     OUT    MDCTL1
  109. ;
  110.      IF    IMODEM        ; If using an intellegent modem
  111.     CALL    IMINIT        ; Go initialize it now
  112.      ENDIF            ; IMODEM
  113. ;
  114.     RET
  115. ;.....
  116. ;
  117. ;
  118. ; Input a character from the modem port
  119. ;
  120. MDINP:    IN    PORT        ; Get character
  121.     RET
  122. ;.....
  123. ;
  124. ;
  125. ; Check the status to see if a character is available. If not, return
  126. ; with the zero flag set.  If yes, use 0FFH to clear the flag.
  127. ;
  128. MDINST:    IN    MDCTL1        ; Get status
  129.     ANI    MDRCV        ; Got a character
  130.     RZ            ; Return if none
  131.     ORI    0FFH        ; Otherwise set the proper flag
  132.     RET
  133. ;.....
  134. ;
  135. ;
  136. ; Send a character to the modem
  137. ;
  138. MDOUTP:    OUT    PORT        ; Send it
  139.     RET
  140. ;.....
  141. ;
  142. ;
  143. ; See if the output is ready for another character
  144. ;
  145. MDOUTST:IN    MDCTL1        ; Get status
  146.     ANI    MDSND        ; Ready for a character?
  147.     RET
  148. ;.....
  149. ;
  150. ;
  151. ; Reinitialize the modem and hang up the phone by dropping DTR and
  152. ; leaving it inactive.
  153. ;
  154. MDQUIT:     IF    IMODEM
  155.     CALL    IMQUIT
  156.      ENDIF            ; IMODEM
  157. ;
  158. ;
  159. ; Called by the main program after caller types BYE
  160. ;
  161. MDSTOP:    MVI    A,5        ; Setup to write register 5
  162.     OUT    MDCTL1
  163.     MVI    A,68H        ; Turn off DTR until next time
  164.     OUT    MDCTL1
  165.     RET
  166. ;.....
  167. ;
  168. ;
  169. ; The following routine sets the baudrate.  BYE5 asks for the maximum
  170. ; speed you have available.
  171. ;
  172. SETINV:    ORI    0FFH        ; Make sure zero flag is not set
  173.     RET
  174. ;.....
  175. ;
  176. ;
  177. SET300:    MVI    B,BD300        ; Set for 300 baud
  178.     MVI    A,BDCMD1
  179.     JMP    SETBAUD
  180. ;
  181. SET1200:MVI    B,BD1200    ; Set for 1200 bps
  182.     MVI    A,BDCMD1
  183.     JMP    SETBAUD
  184. ;
  185. SET2400:MVI    B,BD2400    ; Set for 2400 bps
  186.     MVI    A,BDCMD2
  187. ;
  188. SETBAUD:OUT    BRPORT        ; Send first byte of command
  189.     MOV    A,B        ; Restore the rate
  190.     OUT    BRPORT        ; Send rate
  191.     XRA    A        ; Say rate is ok
  192.     RET
  193. ;.....
  194. ;
  195. ;                   end
  196. ;-----------------------------------------------------------------------
  197.