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 / B5OX-2.INS < prev    next >
Text File  |  2000-06-30  |  5KB  |  188 lines

  1.  
  2. ; B5OX-2.INS - BYE5 insert for Osborne Executive
  3. ;
  4. ;        Note: This is an insert, not an overlay
  5. ;
  6. ;        This INSert will work ONLY with BYE509 and above
  7. ;
  8. ;=   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  9. ;
  10. ; 07/07/86    Overhauled the insert to be compatible with BYE509
  11. ;        and later releases having proper CP/M Plus support:
  12. ;        - Removed WINDOW configuration parameter as that
  13. ;          function should be provided in the software that uses
  14. ;          the window.
  15. ;        - Removed MDPREP/MDPOSP routines as they are no longer
  16. ;          required.
  17. ;                    - George Peace
  18. ;
  19. ; 08/17/85    - Updated BYE+ version 6 to be compatible with BYE5.
  20. ;                    - George Peace
  21. ;=   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  22. ;-----------------------------------------------------------------------
  23. ;
  24. ; Set base port for SIO & Clock chips
  25. ;
  26. BASEP    EQU    0CH        ; Base port for sio
  27. BASEC    EQU    04H        ; Base port for baud rate generator
  28. ;
  29. ; The following define the port addresses to use.
  30. ;
  31. DATPORT    EQU    BASEP        ; Data port
  32. STPORT    EQU    BASEP+1        ; Status/control port
  33. BPORT    EQU    BASEC        ; Baud rate port
  34. ;
  35. ;
  36. ; Second Byte of 8253 Command:
  37. ;
  38. BDCMD1    EQU    1        ;  300 baud
  39. BDCMD2    EQU    0        ; 1200 bps
  40. BDCMD3    EQU    0        ; 2400 bps
  41. BDCMD4    EQU    0        ; 4800 bps
  42. BDCMD5    EQU    0        ; 9600 bps
  43. ;
  44. ;
  45. ; The following are baud rates for BPORT
  46. ;
  47. B300    EQU    128        ;  300 baud
  48. B1200    EQU    96        ; 1200 bps
  49. B2400    EQU    48        ; 2400 bps
  50. B4800    EQU    24        ; 4800 bps
  51. B9600    EQU    12        ; 9600 bps
  52. ;
  53. ;
  54. ;-----------------------------------------------------------------------
  55. ;
  56. ; Is there a carrier?  If not, return with the zero flag set.
  57. ;
  58. MDCARCK:MVI    A,10H        ; Reset status
  59.     OUT    STPORT
  60.     IN    STPORT        ; Get status
  61.     ANI    8        ; Check for data carrier
  62.     RET            ; Return
  63. ;.....
  64. ;
  65. ;
  66. ; This routine will turn off the serial card and hang up the phone.
  67. ;
  68. MDINIT:    MVI    A,18H        ; Reset channel
  69.     OUT    STPORT
  70.     MVI    A,4        ; Setup to write register 4
  71.     OUT    STPORT
  72.     MVI    A,44H        ; 16x, 1 stop bit, no parity
  73.     OUT    STPORT
  74.     MVI    A,1        ; Setup to write register 1
  75.     OUT    STPORT
  76.     MVI    A,0
  77.     OUT    STPORT
  78.     MVI    A,5        ; Setup to write register 5
  79.     OUT    STPORT
  80.     MVI    A,0        ; Clear DTR causing hangup
  81.     OUT    STPORT
  82.     PUSH    B        ; Save in case it's being used elsewhere
  83.     MVI    B,20        ; 2 second delay
  84. ;
  85. OFFTI:    CALL    DELAY        ; 0.1 second delay
  86.     DCR    B
  87.     JNZ    OFFTI        ; Keep looping until finished
  88.     POP    B        ; Restore bc
  89.     MVI    A,3        ; Setup to write register 3
  90.     OUT    STPORT
  91.     MVI    A,0C1H        ; Initialize receive register
  92.     OUT    STPORT
  93.     MVI    A,5        ; Setup to write register 5
  94.     OUT    STPORT
  95.     MVI    A,0EAH        ; Turn on DTR so modem can answer phone
  96.     OUT    STPORT
  97. ;
  98.      IF    IMODEM        ; If using hayes 300/1200 smartmodem
  99.     CALL    IMINIT        ; Go initialize smartmodem now
  100.      ENDIF            ; IMODEM
  101. ;
  102.     RET            ; Return
  103. ;.....
  104. ;
  105. ;
  106. ; Input a character from the modem port.
  107. ;
  108. MDINP:    IN    DATPORT        ; Get character
  109.     RET            ; Return
  110. ;.....
  111. ;
  112. ;
  113. ; Check the status to see if a character is available.  Return with the
  114. ; zero flat set, if not.  If yes, use 0FFH to clear the flag.
  115. ;
  116. MDINST:    IN    STPORT        ; Get status
  117.     ANI    1        ; Got a character?
  118.     RZ            ; Return if none
  119.     ORI    0FFH        ; ..otherwise, set the proper flag
  120.     RET            ; ...and return
  121. ;.....
  122. ;
  123. ;
  124. ; Send a character to the modem.
  125. ;
  126. MDOUTP:    OUT    DATPORT        ; Send it
  127.     RET            ; Return
  128. ;.....
  129. ;
  130. ;
  131. ; See if the output is ready for another character.
  132. ;
  133. MDOUTST:IN    STPORT
  134.     ANI    4        ; Mask it
  135.     RET            ; Return
  136. ;.....
  137. ;
  138. ;
  139. ; Reinitialize the modem and hang up the phone by dropping DTR and
  140. ; leaving it inactive.
  141. ;
  142. MDQUIT:     IF    IMODEM        ; If using a smartmodem
  143.     CALL    IMQUIT        ; Tell it to shut down
  144.      ENDIF            ; IMODEM
  145. ;
  146. ;
  147. ; Called by the main program after the caller types BYE.
  148. ;
  149. MDSTOP:    MVI    A,5        ; Setup to write register 5
  150.     OUT    STPORT
  151.     MVI    A,44H        ; 16x, 1 stop bit, no parity
  152.     OUT    STPORT
  153.     RET
  154. ;.....
  155. ;
  156. ;
  157. ; If you do not support a partiuclar baud rate, put it here before
  158. ; SETINV:
  159. ;
  160. SETINV:    ORI    0FFH        ; Make sure zero flag is not set
  161.     RET            ; Return
  162. ;.....
  163. ;
  164. ;
  165. SET300:    MVI    A,BDCMD1    ; Get second byte of command
  166.     PUSH    PSW        ; ..store it
  167.     MVI    A,B300        ; Load rate
  168.     JMP    SETBAUD
  169. ;
  170. SET1200:MVI    A,BDCMD2    ; Get second byte of command
  171.     PUSH    PSW        ; ..save it
  172.     MVI    A,B1200        ; Load rate
  173.     JMP    SETBAUD
  174. ;
  175. SET2400:MVI    A,BDCMD3    ; Get second byte of command
  176.     PUSH    PSW        ; ..store it
  177.     MVI    A,B2400        ; Load rate
  178. ;
  179. SETBAUD:OUT    BPORT        ; Send first byte of command
  180.     POP    PSW        ; Restore the rate
  181.     OUT    BPORT        ; Send second byte of command
  182.     XRA    A        ; Say rate is OK
  183.     RET            ; Return
  184. ;.....
  185. ;
  186. ;                   end
  187. ;-----------------------------------------------------------------------
  188.