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 / B5B2-2.IQS / B5B2-2.INS
Text File  |  2000-06-30  |  4KB  |  164 lines

  1. ; B2B2-1.ASM - Big Board II overlay file for BYE5 - 03/27/86
  2. ;
  3. ;         Z80 SIO and 8430 CTC timer
  4. ;
  5. ; This overlay adapts BYE5 to the Big Board II computer with the SIO
  6. ; serial port "B" and the Z80 CTC baud rate generator.
  7. ;
  8. ;
  9. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  10. ;
  11. ; 03/27/86  Corrected baudrate port    - Irv Hoff
  12. ; 10/27/85  Written for use with BYE5    - Irv Hoff
  13. ;
  14. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  15. ;
  16. ; SIO Port A, Data = 80H, CTC = 89H
  17. ; SIO Port B, Data = 82H, CTC = 88H
  18. ;
  19. PORT    EQU    80H    ; Your Z80 SIO base port (data or status)
  20. MDCTL1    EQU    PORT+1    ; Modem control port
  21. BRPORT    EQU    88H    ; CTC port for baud rate
  22. ;
  23. ;
  24. ; Table of baud rate parameters
  25. ;
  26. BD300    EQU    128        ; 38400/300
  27. BD1200    EQU    32        ; 38400/1200
  28. BD2400    EQU    16        ; 38400/9600
  29. BD9600    EQU    4        ; 38400/9600
  30. ;
  31. ;
  32. ;-----------------------------------------------------------------------
  33. ;
  34. ; See if we still have a carrier - if not, return with the zero flag set
  35. ;
  36. MDCARCK:MVI    A,10H        ; Reset status
  37.     OUT    MDCTL1
  38.     IN    MDCTL1        ; Get status
  39.     ANI    08H        ; Check for data carrier
  40.     RET
  41. ;.....
  42. ;
  43. ;
  44. ; Disconnect and wait for an incoming call
  45. ;
  46. MDINIT:    MVI    A,0        ; Select default port
  47.     OUT    MDCTL1
  48.     MVI    A,18H        ; Reset channel
  49.     OUT    MDCTL1
  50.     MVI    A,4        ; Setup to write register 4
  51.     OUT    MDCTL1
  52.     MVI    A,44H        ;*1 stop, 8 bits, no parity, 16x
  53.     OUT    MDCTL1
  54.     MVI    A,5        ; Setup to write register 5
  55.     OUT    MDCTL1
  56.     MVI    A,68H        ; Clear RTS causing hangup
  57.     OUT    MDCTL1
  58.     PUSH    B        ; Save in case it's being used elsewhere
  59.     MVI    B,20        ; 2 seconds delay to drop any carrier
  60. ;
  61. OFFTI:    CALL    DELAY        ; 0.1 second delay
  62.     DCR    B
  63.     JNZ    OFFTI        ; Keep looping until finished
  64.     POP    B        ; Restore bc
  65.     MVI    A,3        ; Setup to write register 3
  66.     OUT    MDCTL1
  67.     MVI    A,0C1H        ; Initialize receive register
  68.     OUT    MDCTL1
  69.     MVI    A,5        ; Setup to write register 5
  70.     OUT    MDCTL1
  71.     MVI    A,0EAH        ; Turn on RTS so modem can answer phone
  72.     OUT    MDCTL1
  73. ;
  74.      IF    IMODEM        ; If using intelligent modem
  75.     CALL    IMINIT        ; Go initialize
  76.      ENDIF            ; IMODEM
  77. ;
  78.     RET
  79. ;.....
  80. ;
  81. ;
  82. ; Input a character from the modem port
  83. ;
  84. MDINP:    IN    PORT        ; Get character
  85.     RET
  86. ;.....
  87. ;
  88. ;
  89. ; Check the status to see if a character is available.    If not, return
  90. ; with the zero flag set.  If yes, use 0FFH to clear the flag.
  91. ;
  92. MDINST:    IN    MDCTL1        ; Get status
  93.     ANI    01H        ; Check receive ready bit
  94.     RZ            ; Return if none
  95.     ORI    0FFH        ; Otherwise, set the proper flag
  96.     RET
  97. ;.....
  98. ;
  99. ;
  100. ; Send a character to the modem
  101. ;
  102. MDOUTP:    OUT    PORT        ; Send it
  103.     RET
  104. ;.....
  105. ;
  106. ;
  107. ; See if the output is ready for another character
  108. ;
  109. MDOUTST:IN    MDCTL1
  110.     ANI    04H        ; Check transmit ready bit
  111.     RET
  112. ;.....
  113. ;
  114. ;
  115. ; Reinitialize the modem and hang up the phone by dropping DTR and
  116. ; leaving it inactive.
  117. ;
  118. MDQUIT:     IF    IMODEM        ; If using a smartmodem
  119.     CALL    IMQUIT        ; Tell it to shut down
  120.      ENDIF            ; IMODEM
  121. ;
  122. ;
  123. ; Called by the main program after caller types BYE
  124. ;
  125. MDSTOP:    MVI    A,5        ; Setup to write register 5
  126.     OUT    MDCTL1
  127.     MVI    A,68H        ; Clear RTS causing shutdown
  128.     OUT    MDCTL1
  129.     RET
  130. ;.....
  131. ;
  132. ;
  133. ; The following routine sets the baudrate.  BYE5 asks for the maximum
  134. ; speed you have available.
  135. ;
  136. SETINV:    ORI    0FFH        ; Make sure zero flag is not set
  137.     RET            ; Return
  138. ;.....
  139. ;
  140. ;
  141. SET300:    MVI    B,BD300        ; Get 300 bps parameters in 'HL'
  142.     JMP    LOADBD        ; Go load them
  143. ;
  144. SET1200:MVI    B,BD1200
  145.     JMP    LOADBD
  146. ;
  147. SET2400:MVI    B,BD2400
  148.     JMP    LOADBD
  149. ;
  150. SET9600:MVI    B,BD9600
  151. ;
  152. LOADBD:    MVI    A,47H        ; CTC command word
  153.     OUT    BRPORT
  154.     XTHL            ; Short delay
  155.     XTHL            ; Additional short delay
  156.     MOV    A,B        ; Baudrate
  157.     OUT    BRPORT        ; Reset CTC to new baudrate
  158.     XRA    A        ; Say baudrate was ok
  159.     RET
  160. ;.....
  161. ;
  162. ;                   end
  163. ;-----------------------------------------------------------------------
  164.