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

  1.  
  2. ; B5SP-1.INS - Coleco Adam with EVE SP1 interface for BYE5 - 07/15/86
  3. ;
  4. ;        2651 I/O with built-in baudrate generator
  5. ;
  6. ;        Note:  This is an insert, not an overlay.
  7. ;
  8. ;
  9. ;       The 2651 has a quirk that requires the DCD signal (car-
  10. ;       rier detect) from the modem be brought to the DSR input
  11. ;       on the computer, rather than to its DCD input, else the
  12. ;       computer cannot be programmed properly for auto-recieve..
  13. ;
  14. ;            If using a Hayes Smartmodem 1200,
  15. ;            insure all switches are up except
  16. ;            3, 5 and 8 which should be down.
  17. ;
  18. ;                  modem     computer
  19. ;                 1-----------1
  20. ;                 2-----------2
  21. ;                 3-----------3
  22. ;                 6 n/c         8 n/c
  23. ;                 7-----------7
  24. ;                 8-----------6
  25. ;                20-----------20
  26. ;
  27. ;        The Hayes Smartmodem actually has a short between
  28. ;        its pin 6 and pin 8, internally.  It does not have
  29. ;        any actual DSR information available, giving DCD
  30. ;        information at both its pins 6 and 8.  Other modems
  31. ;        do not use this unorthodox method.
  32. ;
  33. ;                    - Notes by Irv Hoff
  34. ;
  35. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  36. ;
  37. ; 07/15/86  Written for use with BYE5 and later - Irv Hoff
  38. ;
  39. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  40. ;
  41. ; Modem port equates
  42. ;
  43. PORT     EQU    44H        ; Data port for the 2651 I/O
  44. MDCTL1     EQU    PORT+1        ; Status port
  45. MDCTL2     EQU    PORT+2        ; Modem port
  46. MDCTL3     EQU    PORT+3        ; Control port
  47. ;
  48. BD300     EQU    35H        ; 300 baud
  49. BD1200     EQU    37H        ; 1200 bps
  50. BD2400     EQU    3AH        ; 2400 bps
  51. ;.....
  52. ;
  53. ;
  54. ;-----------------------------------------------------------------------
  55. ;
  56. ; See if we still have a carrier - if not, return with the zero flag set
  57. ;
  58. MDCARCK:IN    MDCTL1        ; Status port
  59.     ANI    80H        ; See if there is a carrier (DSR pin)
  60.     RET            ; If yes, return with Zero flag set
  61. ;.....
  62. ;
  63. ;
  64. ; Disconnect and wait for an incoming call
  65. ;
  66. MDINIT:    MVI    A,15H        ; Turn off DTR, RTS to hang up phone
  67.     OUT    MDCTL3        ; Control port
  68.     IN    MDCTL3        ; Make sure it is now clear
  69.     IN    MDCTL3        ; Try once more
  70.     PUSH    B        ; In case it was being used
  71.     MVI    B,20        ; Delay for 2 seconds
  72. ;
  73. OFFTI:    CALL    DELAY        ; .1 second increments
  74.     DCR    B        ; One less to go
  75.     JNZ    OFFTI        ; If not zero, loop until zero
  76.     POP    B        ; Restore to original
  77.     MVI    A,37H        ; Reset RTS, flags, DTR, enable R/T
  78.     OUT    MDCTL3        ; Control port
  79.     IN    MDCTL3        ; Clear any incoming characters
  80.     IN    MDCTL3        ; Try once more
  81. ;
  82.      IF    IMODEM
  83.     CALL    IMINIT        ; Initialize modem
  84.      ENDIF            ; IMODEM
  85. ;
  86.     RET
  87. ;.....
  88. ;
  89. ;
  90. ; The following is a routine that will input one character from the mo-
  91. ; dem port.  If there is nothing there, it will return garbage... so use
  92. ; the MDINST routine first.
  93. ;
  94. MDINP:    IN    PORT
  95.     RET
  96. ;.....
  97. ;
  98. ;
  99. ; The following is a routine to determine if there is a character wait-
  100. ; ing to be received.  If there are none, the zero flag will be set.
  101. ; Otherwise, 0FFH will be returned in 'A' reg.
  102. ;
  103. MDINST:    IN    MDCTL1
  104.     ANI    02H        ; Check for receive ready bit
  105.     RZ
  106.     ORI    0FFH        ; We got something...
  107.     RET
  108. ;.....
  109. ;
  110. ;
  111. ; The following is a routine to determine if the transmit buffer is em-
  112. ; pty.    If not, it returns with the Zero flag set, otherwise it will
  113. ; return with Zero clear.
  114. ;
  115. MDOUTST:IN    MDCTL1
  116.     ANI    01H        ; Check the transmit ready bit
  117.     RZ
  118.     ORI    0FFH
  119.     RET
  120. ;.....
  121. ;
  122. ;
  123. MDQUIT:     IF    IMODEM
  124.     CALL    IMQUIT
  125.      ENDIF            ; IMODEM
  126. ;
  127. MDSTOP:    MVI    A,15H        ; DTR off, modem will quit working
  128.     OUT    MDCTL3
  129.     RET
  130. ;.....
  131. ;
  132. ;
  133. ; The following is a routine that will output one character in the 'A'
  134. ; reg. to the modem.
  135. ;
  136. ;
  137. MDOUTP:    OUT    PORT
  138.     RET
  139. ;.....
  140. ;
  141. ;
  142. ; Set the baudrate, returns with Zero flag set with successful change
  143. ;
  144. SETINV:    MVI    A,0FFH
  145.     ORA    A        ; Make sure the Zero flag is not set
  146.     RET
  147. ;
  148. SET300:    MVI    B,BD300
  149.     JMP    LOADBD
  150. ;
  151. SET1200:MVI    B,BD1200
  152.     JMP    LOADBD
  153. ;
  154. SET2400:MVI    B,BD2400
  155. ;
  156. LOADBD:    MVI    A,4EH        ; 1 Stop, no parity, 8 bits, 16x asynch
  157.     OUT    MDCTL2        ; Send to mode register
  158.     MOV    A,B        ; Get the baudrate
  159.     OUT    MDCTL2        ; Set the desired speed
  160.     MVI    A,37H        ; Reset flags, RTS, DTR, enable R/T
  161.     OUT    MDCTL3        ; Send to command register
  162.     IN    MDCTL3        ; Clear any incoming characters
  163.     IN    MDCTL3        ; Try once again
  164.     XRA    A        ; Shows the baudrate change was ok
  165.     RET
  166. ;.....
  167. ;
  168. ;                   end
  169. ;-----------------------------------------------------------------------
  170.