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 / B5EP-1.IQS / B5EP-1.INS
Text File  |  2000-06-30  |  4KB  |  166 lines

  1.  
  2. ; B5EP-1.INS - BYE5 insert for Epson QX-10 computers - 07/17/85
  3. ;
  4. ;           Z80 SIO and Intel 8253 timer
  5. ;
  6. ;        Note:  This is an insert, not an overlay.
  7. ;
  8. ;
  9. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  10. ;
  11. ; 07/17/85  Written for use with BYE5        - Irv Hoff
  12. ;
  13. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  14. ;
  15. ;
  16. PORT    EQU    11H        ; Data port
  17. MDCTL1    EQU    PORT+2        ; Status/Control port
  18. TMR0    EQU    06H        ; 8253 baudrate generator port
  19. TMR1    EQU    TMR0+1        ; Vector port
  20. ;
  21. ;
  22. ; Now comes the time to decide how we set the baud rate.  Set it prop-
  23. ; erly for your particular 8253 timer configuration
  24. ;
  25. BDVECT    EQU    0B6H        ; QX-10 Vector word
  26. ;
  27. BD300    EQU    416        ; 300 baud
  28. BD1200    EQU    104        ; 1200 bps
  29. BD2400    EQU    52        ; 2400 bps
  30. ;.....
  31. ;
  32. ;
  33. ;-----------------------------------------------------------------------
  34. ;
  35. ; See if we still have a carrier - if not, return with the zero flag set
  36. ;
  37. MDCARCK:MVI    A,10H        ; Reset status
  38.     OUT    MDCTL1
  39.     IN    MDCTL1        ; Get status
  40.     ANI    08H        ; Check for data carrier
  41.     RET
  42. ;.....
  43. ;
  44. ;
  45. ; Disconnect and wait for an incoming call
  46. ;
  47. MDINIT:    MVI    A,18H        ; Reset channel
  48.     OUT    MDCTL1
  49.     MVI    A,4        ; Setup to write register 4
  50.     OUT    MDCTL1
  51.     MVI    A,44H        ; 1 stop, 8 bits, no parity, 32x
  52.     OUT    MDCTL1
  53.     MVI    A,5        ; Setup to write register 5
  54.     OUT    MDCTL1
  55.     MVI    A,68H        ; Clear RTS causing hangup
  56.     OUT    MDCTL1
  57.     PUSH    B        ; Save in case it's being used elsewhere
  58.     MVI    B,20        ; 2 seconds delay to drop any carrier
  59. ;
  60. OFFTI:    CALL    DELAY        ; 0.1 second delay
  61.     DCR    B
  62.     JNZ    OFFTI        ; Keep looping until finished
  63.     POP    B        ; Restore bc
  64.     MVI    A,3        ; Setup to write register 3
  65.     OUT    MDCTL1
  66.     MVI    A,0C1H        ; Initialize receive register
  67.     OUT    MDCTL1
  68.     MVI    A,5        ; Setup to write register 5
  69.     OUT    MDCTL1
  70.     MVI    A,0EAH        ; Turn on RTS so modem can answer phone
  71.     OUT    MDCTL1
  72. ;
  73.      IF    IMODEM        ; If using intelligent modem
  74.     CALL    IMINIT        ; Go initialize
  75.      ENDIF            ; IMODEM
  76. ;
  77.     RET
  78. ;.....
  79. ;
  80. ;
  81. ; Input a character from the modem port
  82. ;
  83. MDINP:    IN    PORT        ; Get character
  84.     RET
  85. ;.....
  86. ;
  87. ;
  88. ; Check the status to see if a character is available.    if not, return
  89. ; with the zero flag set.  If yes, use 0FFH to clear the flag.
  90. ;
  91. MDINST:    IN    MDCTL1        ; Get status
  92.     ANI    01H        ; Check the receive ready bit
  93.     RZ            ; Return if none
  94.     ORI    0FFH        ; Otherwise, set the proper flag
  95.     RET
  96. ;.....
  97. ;
  98. ;
  99. ; Send a character to the modem
  100. ;
  101. MDOUTP:    OUT    PORT        ; Send it
  102.     RET
  103. ;.....
  104. ;
  105. ;
  106. ; See if the output is ready for another character.
  107. ;
  108. MDOUTST:IN    MDCTL1
  109.     ANI    04H        ; Check the transmit ready bit
  110.     RET
  111. ;.....
  112. ;
  113. ;
  114. ; Reinitialize the modem and hang up the phone by dropping DTR and
  115. ; leaving it inactive.
  116. ;
  117. MDQUIT:     IF    IMODEM
  118.     CALL    IMQUIT
  119.      ENDIF            ; IMODEM
  120. ;
  121. ;
  122. ; Called by the main program after caller types BYE
  123. ;
  124. MDSTOP:    MVI    A,5        ; Setup to write register 5
  125.     OUT    MDCTL1
  126.     MVI    A,68H        ; Clear DTR
  127.     OUT    MDCTL1        ; Causing Hang-Up
  128.     IN    PORT        ; Clear out garbage
  129.     IN    PORT        ; Make sure we're clear
  130.     RET            ; Not used
  131. ;.....
  132. ;
  133. ;
  134. ; The following reoutine sets the baudrate.  BYE5 asks for the maximum
  135. ; speed you have available.
  136. ;
  137. SETINV:    ORI    0FFH        ; Make sure zero flag is not set
  138.     RET
  139. ;.....
  140. ;
  141. ;
  142. SET300:    PUSH    H
  143.     LXI    H,BD300
  144.     JMP    SETBAUD
  145. ;
  146. SET1200:PUSH    H
  147.     LXI    H,BD1200
  148.     JMP    SETBAUD
  149. ;
  150. SET2400:PUSH    H
  151.     LXI    H,BD2400
  152. ;
  153. SETBAUD:MVI    A,BDVECT    ; Get vector address
  154.     OUT    TMR1        ; Send to TMR
  155.     MOV    A,L
  156.     OUT    TMR0
  157.     MOV    A,H
  158.     OUT    TMR0        ; Send rate
  159.     POP    H
  160.     XRA    A        ; Say rate is OK
  161.     RET
  162. ;.....
  163. ;
  164. ;                   end
  165. ;----------------------------------------------------------------------
  166.