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 / B5AD-1.INS < prev    next >
Text File  |  2000-06-30  |  4KB  |  174 lines

  1. ;
  2. ; B5AD-1.INS - BYE5 insert for AD Super Six CPU board - 07/17/85
  3. ;
  4. ;        Z80 DART and 8116 baudrate generator
  5. ;
  6. ; This routine adapts the Advanced Digital Super Quad and Super Six
  7. ; single board computers to BYE5.  Baudrate is read in off of a parallel
  8. ; port and sent to the baudrate generator upon powerup, from default
  9. ; jumpers.  Note:  This is an insert, not an overlay.
  10. ;
  11. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  12. ;
  13. ; 07/17/85  Rewritten for BYE5            - Irv Hoff
  14. ; 05/15/85  First version of B3AD        - John Sojak
  15. ;
  16. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  17. ;
  18. ;
  19. PORT    EQU    02H        ; Data port
  20. MDCTL1    EQU    PORT+1        ; Modem control port
  21. BRPORT    EQU    18H        ; Set baud rate generator base port
  22. JUMPRS    EQU    15H        ; Baud rate default jumpers
  23. ;
  24. MDRCV    EQU    1        ; Modem receive ready bit
  25. MDSND    EQU    4        ; Modem send ready bit
  26. MDDCD    EQU    8        ; Data carrier detect
  27. ;
  28. ;
  29. ; Divisors for the 8116 baudrate geneator
  30. ;
  31. BD300    EQU    5        ; 300 baud
  32. BD1200    EQU    7        ; 1200 bps
  33. BD2400    EQU    10        ; 2400 bps
  34. ;
  35. ;
  36. ;-----------------------------------------------------------------------
  37. ;
  38. ; See if we still have a carrier - if not, return with the zero flag set
  39. ;
  40. MDCARCK:MVI    A,10H        ; Reset status
  41.     OUT    MDCTL1
  42.     IN    MDCTL1        ; Get status
  43.     ANI    MDDCD        ; Check for carrier
  44.     RET
  45. ;.....
  46. ;
  47. ;
  48. ; Disconnect and wait for an incoming call
  49. ;
  50. MDINIT:    MVI    A,0        ; Setup to write register 0
  51.     OUT    MDCTL1
  52.     MVI    A,18H        ; Reset channel
  53.     OUT    MDCTL1
  54.     MVI    A,4        ; Setup to write register 4
  55.     OUT    MDCTL1
  56.     MVI    A,44H        ; Set 16x, 1 stop bit, no parity
  57.     OUT    MDCTL1
  58.     MVI    A,3        ; Setup to write register 3
  59.     OUT    MDCTL1
  60.     MVI    A,0C1H        ; 8 bits, Rx enable
  61.     OUT    MDCTL1
  62.     MVI    A,5        ; Setup to write register 5
  63.     OUT    MDCTL1
  64.     MVI    A,68H        ; DTR off
  65.     OUT    MDCTL1
  66.     PUSH    B        ; Save in case it's being used elsewhere
  67.     MVI    B,20        ; 2 second delay to drop any carrier
  68. ;
  69. OFFTI:    CALL    DELAY        ; 1 second delay
  70.     DCR    B
  71.     JNZ    OFFTI        ; Keep looping until finished
  72.     POP    B        ; Restore 'BC'
  73.     MVI    A,5        ; Setup to write register 5
  74.     OUT    MDCTL1
  75.     MVI    A,0E8H        ; Turn DTR back on
  76.     OUT    MDCTL1
  77. ;
  78.      IF    IMODEM        ; If using an intellegent modem
  79.     CALL    IMINIT        ; Go initialize it now
  80.      ENDIF            ; IMODEM
  81. ;
  82.     RET
  83. ;.....
  84. ;
  85. ;
  86. ; Input a character from the modem port
  87. ;
  88. MDINP:    IN    PORT        ; Get character
  89.     RET
  90. ;.....
  91. ;
  92. ;
  93. ; Check the status to see if a character is available.    If not, return
  94. ; with the zero flage set.  If yes, use 0FFH to clear the flag.
  95. ;
  96. MDINST:    IN    MDCTL1        ; Get status
  97.     ANI    MDRCV        ; Got a character
  98.     RZ            ; Return if none
  99.     ORI    0FFH        ; Otherwise set the proper flag
  100.     RET
  101. ;.....
  102. ;
  103. ;
  104. ; Send a character to the modem
  105. ;
  106. MDOUTP:    OUT    PORT        ; Send it
  107.     RET
  108. ;.....
  109. ;
  110. ;
  111. ; See if the output is ready for another character
  112. ;
  113. MDOUTST:IN    MDCTL1        ; Get status
  114.     ANI    MDSND        ; Ready for a character?
  115.     RET
  116. ;.....
  117. ;
  118. ;
  119. ; Reinitialize the modem and hang up the phone by dropping DTR and
  120. ; leaving it inactive.
  121. ;
  122. MDQUIT:     IF    IMODEM
  123.     CALL    IMQUIT
  124.      ENDIF            ; IMODEM
  125. ;
  126. ;
  127. ; Called by the main program after caller types BYE
  128. ;
  129. MDSTOP:    MVI    A,5        ; Setup to write register 5
  130.     OUT    MDCTL1
  131.     MVI    A,68H        ; Turn off DTR until next time
  132.     OUT    MDCTL1
  133.     RET
  134. ;.....
  135. ;
  136. ;
  137. ; The following routine sets the baudrate.  BYE5 asks for the maximum
  138. ; speed you have available.
  139. ;
  140. SETINV:    ORI    0FFH        ; Make sure zero flag is not set
  141.     RET
  142. ;.....
  143. ;
  144. ;
  145. SET300:    MVI    A,BD300
  146.     JMP    SETBAUD
  147. ;
  148. SET1200:MVI    A,BD1200
  149.     JMP    SETBAUD
  150. ;
  151. SET2400:MVI    A,BD2400
  152. ;
  153. ;
  154. ; Sets the baudrate
  155. ;
  156. SETBAUD:RLC            ; Shift the nibble over to the LSN
  157.     RLC            ;   (could have been eliminated in the
  158.     RLC            ;   equate but the intent is easier to
  159.     RLC            ;   understand this way.
  160.     ANI    11110000B    ; Mask off bits - intent again
  161.     PUSH    B
  162.     MOV    B,A
  163.     IN    JUMPRS        ; Get the console baud jumpers
  164.     ANI    00001111B    ; Mask garbage - 4 bits worth of it
  165.     ORA    B        ;   and make a composite of modem and
  166.     OUT    BRPORT        ;   console then tell the generator
  167.     POP    B
  168.     XRA    A        ; Say baudrate is ok
  169.     RET
  170. ;.....
  171. ;
  172. ;                   end
  173. -----------------------------------------------------------------------:
  174.