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 / BBSING / MBBS / MBACAT-1.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  7KB  |  208 lines

  1. ;**********************************************************************
  2. ;
  3. ;            MBYE (Modular 'BYE')
  4. ;             Novation Apple-Cat modem routines
  5. ;           v1.0 (02/07/84) by Kim Levitt
  6. ;
  7. ; These routines will allow the easy patching of MBYE for any type of
  8. ; modem/serial port combination.  Certain routines must return status
  9. ; flags, so please be careful to set the flags as directed.
  10. ;
  11. ; This version is for the Apple ][ running with an Apple-Cat modem card.
  12. ; (much thanks to Dave Roznar for the original ACAT code)
  13. ;
  14. ; For the Apple, you should set BYELOW to YES.
  15. ;
  16. ;-----------------------------------------------------------------------
  17. ;
  18. ; 02/07/84  Altered and renamed to work with MBYE    - Kim Levitt
  19. ; 11/27/83  Altered and renamed to work with BYE3.    - Irv Hoff
  20. ; 08/04/83  Updated for ByeII version 1.6        - Paul Traina
  21. ; 10/04/82  Routines added, no fuss, mess, or frills.    - Paul Traina
  22. ;
  23. ;-----------------------------------------------------------------------
  24. ;
  25. ; The following define the slot address to use.
  26. ;
  27. SLOT:    EQU    2        ;Apple-Cat residing in Slot #2
  28. ;
  29. ;***********************************************************************
  30. ;
  31. ;
  32. ; Apple-Cat modem address equates
  33. ;
  34. SLOTVAL:EQU    SLOT*16        ;number to add for proper slot
  35. ;
  36. MCSTATP:EQU    0E080H+SLOTVAL    ;Carrier status
  37. LNCTL:    EQU    0E081H+SLOTVAL    ;Line control
  38. PHCTL:    EQU    0E082H+SLOTVAL    ;Phone control
  39. BSRINT:    EQU    0E083H+SLOTVAL    ;BSR and interrupts
  40. RCVCTL:EQU    0E089H+SLOTVAL    ;Receiver control
  41. MDPORT:    EQU    0E08AH+SLOTVAL    ;Mode (parity/stop bits) port
  42. BAUDPT:    EQU    0E08BH+SLOTVAL    ;Baud rate port
  43. XRINT:    EQU    0E08CH+SLOTVAL    ;Transmitt/Receive interrupts
  44. TRXCTL:    EQU    0E08DH+SLOTVAL    ;Transmitter control
  45. MODSEL:    EQU    0E08FH+SLOTVAL    ;Modem select port
  46. ;
  47. RSPORT:    EQU    0E08FH+SLOTVAL    ;Receive status port
  48. RDPORT:    EQU    0E08BH+SLOTVAL    ;Receive data port
  49. TSPORT;    EQU    0E08FH+SLOTVAL    ;Transmit status port
  50. TDPORT:    EQU    0E08EH+SLOTVAL    ;Transmit data port
  51. ;
  52. ; Values to poke into ports
  53. ;
  54. MAINM:    EQU    0        ;Select main modem
  55. HANG:    EQU    0        ;Hang up phone
  56. RDET:    EQU    1        ;Ring detect
  57. SQLT:    EQU    1        ;Squeltch cat
  58. ANSW:    EQU    2        ;Answer phone
  59. NOXRINT:EQU    5        ;No transmitt/recv interrupts
  60. NOINT:    EQU    6        ;No BSR interrupts
  61. DAV:    EQU    8        ;Data available
  62. TBMT:    EQU    10H        ;Transmit buffer empty
  63. XMT103:    EQU    10H        ;Transmitter 103 mode (also clears RX)
  64. XMITOFF:EQU    1FH        ;Turn of transmitter
  65. CTS:    EQU    20H        ;Carrier detect
  66. ANS103:    EQU    64H        ;Receiver 103 mode
  67. CATERR:    EQU    0C0H        ;Framing/Overrun errors
  68. B110:    EQU     55H        ;Select 110 bps
  69. B300:    EQU     22H        ;Select 300 bps
  70. B8NO1:    EQU     03H        ;8 data bits, no parity, 1 stop bit
  71. B8NO2:    EQU     0BH        ;8 data bits, no parity, 2 stop bits
  72. ;
  73. ;
  74. ;***********************************************************************
  75. ;
  76. ; If any of your routines zaps anything other than the Accumulator, then
  77. ; you must preserve all other registers.
  78. ;
  79. ;***********************************************************************
  80. ;
  81. ; This routine should turn off everything on the modem, hang up the
  82. ; phone, and get it ready to wait for a ring.
  83. ;
  84. MDINIT:    MVI    A,XMITOFF    ;Turn off transmitter
  85.     STA    TRXCTL
  86.     MVI    A,HANG        ;Hang up phone
  87.     STA    PHCTL
  88.     RET
  89. ;
  90. ; The following is a routine to determine if there is a character wait-
  91. ; ing to be received.  If none are there, the Zero flag will be set,
  92. ; otherwise, 255 will be returned in register A.  Remember that the sys-
  93. ; tem will like you a little more if you also mask out framing, parity,
  94. ; and overrun errors.
  95. ;
  96. MDINST:    LDA    RSPORT        ;Get modem status
  97.     ANI    DAV        ;Data available?
  98.     RZ            ;nope
  99.     ORI    0FFH        ;return true
  100.     RET
  101. ;
  102. ; The following is a routine to determine if the transmit buffer is
  103. ; empty.  If it is empty, it will return with the Zero flag clear.  If
  104. ; the transmitter is busy, then it will return with the Zero flag set.
  105. ;
  106. MDOUTST:LDA    TSPORT        ;Get modem status
  107.     ANI    TBMT        ;mask out junk
  108.     RET
  109. ;
  110. ; The following is a routine that will check to make sure we still have
  111. ; carrier.  If there is no carrier, it will return with the Zero flag
  112. ; set.
  113. ;
  114. MDCARCK:LDA    MCSTATP        ;Get carrier status
  115.     ANI    CTS        ;got a carrier?
  116.     RET
  117. ;
  118. ; The following routine will check to see if the phone is ringing, if it
  119. ; isn't, it will return with Zero set, otherwise Zero will be cleared.
  120. ;
  121. MDRING:    LDA    TRXCTL        ;get ring status
  122.     ANI    RDET        ;ringing?
  123.     RET
  124. ;
  125. ; The following is a routine that will input one character from the
  126. ; modem port.  If there is nothing there, it will return garbage... so
  127. ; use the MDINST routine first.
  128. ;
  129. MDINP:    MVI    A,XMT103    ;Clear receiver
  130.     STA    TRXCTL
  131.     LDA    RDPORT        ;Read character
  132.     ANI    7FH        ;strip parity and other garbage
  133.     RET
  134. ;
  135. ; The following is a routine that will output one character in register
  136. ; A to the modem.  REMEMBER, that is register A, not register C.
  137. ;
  138. ; **** Use MDOUTST first to see if buffer is empty ****
  139. ;
  140. MDOUTP:    STA    TDPORT        ;send character
  141.     RET
  142. ;
  143. ; The following routine will make the modem answer the phone.
  144. ;
  145. MDANSW:    MVI    A,ANSW        ;Answer phone
  146.     STA    PHCTL
  147.     MVI    A,SQLT        ;Squelch Cat
  148.     STA    LNCTL
  149.     MVI    A,NOINT        ;Disable BSR and interupts
  150.     STA    BSRINT
  151.     MVI    A,ANS103    ;Set receiver to 103, answer mode
  152.     STA    RCVCTL
  153. ;
  154.     CALL    SET300        ;300 baud
  155.     MVI    A,NOXRINT    ;No XMIT/RCV interrupts
  156.     STA    XRINT
  157.     MVI    A,XMT103    ;Transmitter 103, answer mode
  158.     STA    TRXCTL
  159.     MVI    A,MAINM        ;Select main modem
  160.     STA    MODSEL
  161.     RET
  162. ;
  163. ; These next routines set the proper baud rates for the modem.  If you
  164. ; do not support the particular rate, then simply put in a JMP to SETINV.
  165. ; If the baud rate change was successful, make SURE the Zero flag is set.
  166. ;
  167. ; The following routine returns a 255 because we were not able to set to
  168. ; the proper baud rate because either the serial port or the modem can't
  169. ; handle it.
  170. ;
  171. SET110:             ;110 bps too slow to support
  172. SET450:                ;450 bps not supported
  173. SET600:                ;600 bps not supported
  174. SET710:                ;710 bps not supported
  175. SET1200:    
  176. ;
  177. SETINV:    ORI    0FFH        ;make sure the Zero flag isn't set
  178.     RET
  179. ;
  180. ; Set speed to 110 baud
  181. ;
  182. SET110:    CALL    MDINP        ;Clear out garbage since the modem was
  183.     CALL    MDINP        ;Set to 300 baud upon answer
  184.     MVI    A,B110        ;Set 110 baud
  185.     STA    BAUDPT
  186.     MVI    A,B8NO2        ;Set 8 data bits, no parity, 2 stop bits
  187.     STA    MDPORT
  188.     XRA    A        ;Force zero flag
  189.     RET
  190. ;
  191. ; Set up for 300 bps
  192. ;
  193. SET300:    CALL    MDINP
  194.     CALL    MDINP
  195.     MVI    A,B300        ;Set 300 baud
  196.     STA    BAUDPT
  197.     MVI    A,B8NO1        ;Set 8 data bits, no parity, 1 stop bit
  198.     STA    MDPORT
  199.     XRA    A
  200.     RET
  201. ;
  202. ; Ok, that's all of the modem dependent routines that MBYE uses, so if
  203. ; you patch this file into your copy of MBYE, then it should work out
  204. ; well.
  205. ;
  206. ;***********************************************************************
  207. ;
  208.