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

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