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 / B5AA-3.IQS / B5AA-3.INS
Text File  |  2000-06-30  |  7KB  |  320 lines

  1. ; B5AA-3.INS for the Apple PCPI & Super Serial Card for BYE5 - 9/20/85
  2. ;
  3. ;       6551 I/O with internal baudrate generator
  4. ;
  5. ;
  6. ; This version is for Apple ][ computers, using the PCPI Applicard
  7. ; CPM card, and the Apple Super Serial Card.
  8. ;
  9. ;
  10. ; Note:  This is an insert, not an overlay.
  11. ;
  12. ;
  13. ;    MODEM=DCE            Super Serial Card
  14. ;
  15. ;    TXD    2  -------->    2    RXD    received data
  16. ;    RXD    3  <--------    3    TXD    tranmitted data
  17. ;    SG    7  ---------    7    SG    signal ground
  18. ;    DCD    8  -------->    6    DSR    data set ready (carrier)
  19. ;    DTR    20 <-------    20    DTR    data terminal ready
  20. ;
  21. ;
  22. ; This cable configuration uses DSR signal at the SSC to check carrier
  23. ; and Serial card DCD wired to DTR (Jumper pin 20-8) so that modem
  24. ; result codes are received when carrier is off.
  25. ;
  26. ; Set modem switches as defined in B5IM-1.DQC.
  27. ;
  28. ; THIS WORKS PROPERLY WITH BYE5 AND IS COMPATABLE WITH IMP WITHOUT ANY
  29. ; CHANGES, ANY OTHER CONFIGURATION MIGHT REQUIRE RESETTING SOME MODEM
  30. ; SWITCHES WHEN GOING FROM BYE5 TO IMP, MDM7, MEX, ETC.
  31. ;
  32. ;-----------------------------------------------------------------------
  33. ;
  34. ; For the Apple //e, a user entered Control Q can trash the local dis-
  35. ; play by reverting back to 40 column mode.  This is a patch to turn
  36. ; that Control Q into a back space.
  37. ;
  38. ; In BYE5 find the label MINP2A:  Just prior to MINP2A should be the
  39. ; lines:
  40. ;        JNZ    MINP2A
  41. ;        MVI    A,08H
  42. ;
  43. ; Add the following code just before JNZ MINP2A
  44. ;
  45. ;        JZ    CHNGIT
  46. ;        CPI    'Q'-'@'
  47. ;        JNZ    MINP2A
  48. ;    ;
  49. ;    CHNGIT: MVI    A,08H    << note the added label
  50. ;
  51. ; NOTE: In later versions of BYE5 just set one of the FILTx noise
  52. ; filters to trap Control Q.
  53. ;
  54. ;=  =  =  =  =    =  =  =  =  =  =  =  =    =  =  =  =  =  =  =  =    =  =
  55. ;
  56. ; 08/25/86  Fixed bug that prevented BYE5 from dropping DTR to hang up.
  57. ;                                                -Joe England
  58. ;
  59. ; 12/01/85  Changed RDBYTE label to RDBYT to avoid conflict with RDBYTE
  60. ;        label in BYE502.             -Jerry Levy
  61. ;
  62. ; 09/20/85  Created overlay for BYE5.         -Norman Beeler
  63. ;
  64. ;=  =  =  =  =    =  =  =  =  =  =  =  =    =  =  =  =  =  =  =  =    =  =
  65. ;
  66. SLOT    EQU    2        ; Slot 2 is normal
  67. OFFS    EQU    16*SLOT        ; This is the slot offset
  68. ;
  69. PORT    EQU    0C088H+OFFS    ; Dataport    
  70. STPORT    EQU    PORT+1        ; Status port
  71. CPORT    EQU    PORT+2        ; Command port
  72. BRPORT    EQU    PORT+3        ; Baud rate port
  73. ;......
  74. ;
  75. ;
  76. ; PCPI CP/M card I/O equates
  77. ;
  78. RDBYT    EQU    0FFE0H        ; Read a Byte from Apple (A = BYTE)
  79. WRBYTE    EQU    0FFE3H        ; Write a Byte to Apple (C = BYTE)
  80. RDWORD    EQU    0FFE6H        ; Read 2 Bytes from Apple (DE = BYTES)
  81. WRWORD    EQU    0FFE9H        ; Write 2 Bytes to Apple (DE = BYTES)
  82. RDNBYTS    EQU    0FFECH        ; Read N Bytes (DE = COUNT, HL = BUFFER)
  83. WRNBYTS    EQU    0FFEFH        ; Write N Bytes (DE = COUNT, HL = BUFFER)
  84. ;
  85. PEEK1BYTE EQU    6        ; Command to Peek 1 Byte in the Apple
  86. POKE1BYTE EQU    7        ; Command to Poke 1 Byte to the Apple
  87. ;
  88. ;======================================================================
  89. ;
  90. ; These routines are specific to the Apple ][+ with Applicard.    The
  91. ; routines read modem hardware (Apple Super Serial Card ACIA) directly
  92. ; from the Applicard.
  93. ;
  94. ; Peek at 1 byte from Apple 6502 address space
  95. ;
  96. ;     ENTRY: DE = Address in Apple
  97. ;     EXIT:  A = Data
  98. ;
  99. PEEK:    PUSH    B
  100.     MVI    C,PEEK1BYTE
  101.     CALL    WRBYTE
  102.     CALL    WRWORD
  103.     CALL    RDBYT
  104.     POP    B
  105.     RET
  106. ;.....
  107. ;
  108. ;
  109. ; Poke 1 byte to Apple 6502 address space
  110. ;
  111. ;     ENTRY: DE = Address in Apple
  112. ;     EXIT:  A = Data
  113. ;
  114. POKE:    PUSH    B
  115.     MOV    B,A
  116.     MVI    C,POKE1BYTE
  117.     CALL    WRBYTE
  118.     CALL    WRWORD
  119.     MOV    C,B
  120.     CALL    WRBYTE
  121.     POP    B
  122.     RET
  123. ;.....
  124. ;
  125. ;
  126. ; Read the baud rate port of the ACIA
  127. ;
  128. RD$BRPORT:
  129.     PUSH    D
  130.     LXI    D,BRPORT
  131.     CALL    PEEK
  132.     POP    D
  133.     RET
  134. ;.....
  135. ;
  136. ;
  137. ; Read the command port of ACIA
  138. ;
  139. RD$CPORT:
  140.     PUSH    D
  141.     LXI    D,CPORT
  142.     CALL    PEEK
  143.     POP    D
  144.     RET
  145. ;.....
  146. ;
  147. ;
  148. ; Read data port of ACIA
  149. ;
  150. RD$PORT:PUSH    D
  151.     LXI    D,PORT
  152.     CALL    PEEK
  153.     POP    D
  154.     RET
  155. ;.....
  156. ;
  157. ;
  158. ; Read the status port of the ACIA
  159. ;
  160. RD$STPORT:
  161.     PUSH    D
  162.     LXI    D,STPORT
  163.     CALL    PEEK
  164.     POP    D
  165.     RET
  166. ;.....
  167. ;
  168. ;
  169. ; Write to the baud rate port of the ACIA
  170. ;
  171. WR$BRPORT:
  172.     PUSH    D
  173.     LXI    D,BRPORT
  174.     CALL    POKE
  175.     POP    D
  176.     RET
  177. ;.....
  178. ;
  179. ;
  180. ; Write to the command port of ACIA
  181. ;
  182. WR$CPORT:
  183.     PUSH    D
  184.     LXI    D,CPORT
  185.     CALL    POKE
  186.     POP    D
  187.     RET
  188. ;.....
  189. ;
  190. ;
  191. ; Write to the serial data port of the ACIA
  192. ;
  193. WR$PORT:PUSH    D
  194.     LXI    D,PORT
  195.     CALL    POKE
  196.     POP    D
  197.     RET
  198. ;.....
  199. ;
  200. ;
  201. ;----------------------------------------------------------------------
  202. ;
  203. ;
  204. ; Check for a carrier, if none return with the zero flag set.
  205. ;
  206. MDCARCK:CALL    RD$STPORT    ; Get status
  207.     ANI    40H        ; Check DSR pin for DCD (see above)
  208.     XRI    40H        ; Reverse the zero flag (the 6551
  209.     RET            ; Has status 0 for DCD/DSR true)
  210. ;......
  211. ;
  212. ;
  213. ; This routine will turn off the serial card and hang up the phone.
  214. ;
  215. MDINIT:    MVI    A,4AH        ; Turn off DTR
  216.     CALL    WR$CPORT
  217.     PUSH    B        ; Save register
  218.     MVI    B,20        ; Delay 2 sec to drop carrier
  219. ;
  220. OFFTI:    CALL    DELAY        ; 1 sec per loop
  221.     DCR    B
  222.     JNZ    OFFTI        ; Keep going until finished
  223.     POP    B        ; Restore register
  224.     MVI    A,4BH        ; Raise DTR
  225.     CALL    WR$CPORT
  226.     MVI    A,18H        ; Set 1200,8 bits, 1 stop
  227.     CALL    WR$BRPORT
  228. ;
  229.       IF    IMODEM
  230.     CALL    IMINIT
  231.       ENDIF
  232. ;
  233.     RET
  234. ;.......
  235. ;
  236. ;
  237. ; Input a character from the modem port.
  238. ;
  239. MDINP:    CALL    RD$PORT        ; Get character
  240.     RET
  241. ;......
  242. ;
  243. ;
  244. ; Check the status to see if a character is available.  Return with zero
  245. ; flag set, if not.  If yes, use 0FFH to clear the flag.
  246. ;
  247. MDINST:    CALL    RD$STPORT    ; Get modem status
  248.     ANI    8        ; Is data available?
  249.     RZ            ; If no, return
  250.     ORI    0FFH        ; Otherwise return true
  251.     RET
  252. ;......
  253. ;
  254. ;
  255. ; This routine will output a character to the data port.
  256. ;
  257. MDOUTP:    CALL    WR$PORT        ; Send character
  258.     RET
  259. ;.....
  260. ;
  261. ;
  262. ; See if the output is ready for another character.
  263. ;
  264. MDOUTST:CALL    RD$STPORT    ; Get modem status
  265.     ANI    10H        ; Mask out junk
  266.     RET
  267. ;.......
  268. ;
  269. ;
  270. ; Reinitialize the modem and hang up the phone by dropping DTR and
  271. ; leaving it inactive.
  272. ;
  273. MDQUIT:     IF    IMODEM        ; If using a smartmodem
  274.     CALL    IMQUIT        ; Tell it to shut down
  275.      ENDIF            ; IMODEM
  276. ;
  277. ;
  278. ; Called by the main program after caller types BYE
  279. ;
  280. MDSTOP:    MVI    A,4AH        ; Drop DTR
  281.     JMP    WR$CPORT
  282. ;.....
  283. ;
  284. ;
  285. ; If you do not support a particular baud rate, put it here
  286. ; before SETINV:
  287. ;
  288. SETINV:    ORI    0FFH
  289.     RET
  290. ;.....
  291. ;
  292. ;
  293. SET300:    MVI    A,16H
  294.     JMP    WR$BRPORT    ; Go change the baud rate
  295. ;.....
  296. ;
  297. ;
  298. SET1200:MVI    A,18H
  299.     JMP    WR$BRPORT
  300. ;.....
  301. ;
  302. ;
  303. SET2400:MVI    A,1AH
  304.     JMP    WR$BRPORT
  305. ;.....
  306. ;
  307. ;
  308. SET4800:MVI    A,1CH
  309.     JMP    WR$BRPORT
  310. ;.....
  311. ;
  312. ;
  313. SET9600:MVI    A,1EH
  314.     JMP    WR$BRPORT
  315. ;.....
  316. ;
  317. ;                end
  318. ;---------------------------------------------------------------------
  319.