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 / B5AB-3.INS < prev    next >
Text File  |  2000-06-30  |  9KB  |  373 lines

  1. ; B5AB-3.INS    Apple ][+ or//e, ALS CP/M Card, Apple Super Serial Card
  2. ; 02-Nov-86    BYE5 insert
  3. ;
  4. ;       6551 Asynchronous Communications Interface Adapter (ACIA)
  5. ;            with internal baudrate generator
  6. ;
  7. ;
  8. ; This version is for Apple ][+ or //e computers using the Advanced Logic
  9. ; Systems (ALS) CP/M Card and Apple Super Serial Card.  The ALS CP/M
  10. ; Card runs CP/M Plus.
  11. ;
  12. ;
  13. ; Note:  This is an insert, not an overlay.
  14. ;
  15. ;------------------------------------------------------------------
  16. ; B5AB-3.INS    Created insert.  Tested with BYE510.
  17. ; 02-Nov-86
  18. ;
  19. ;                        - Jerry Levy
  20. ;                          1129 Dundee Dr.
  21. ;                          Dresher, PA 19025
  22. ;                          (215) 657-0898
  23. ;                          (voice - evenings)
  24. ;
  25. ;-------------------------------------------------------------------
  26. ;
  27. ; CONNECTING MODEM TO SSC:
  28. ;
  29. ;    MODEM=DCE            Super Serial Card
  30. ;
  31. ;    TXD    2  -------->    2    RXD    received data
  32. ;    RXD    3  <--------    3    TXD    tranmitted data
  33. ;    SG    7  ---------    7    SG    signal ground
  34. ;    DCD    8  -------->    6    DSR    data set ready (carrier)
  35. ;    DTR    20 <-------    20    DTR    data terminal ready
  36. ;                8-->20  DCD-->DTR (SSC side only)
  37. ;
  38. ; This cable configuration uses DSR signal at the SSC to check carrier.
  39. ; Also, Serial card DCD wired to DTR so that modem result codes are
  40. ; received when carrier is off.
  41. ;
  42. ;
  43. ; Set SSC switches (SW1 switches 1,2,3,4 below are set for 1200 baud):
  44. ;    SW1:    ON - 2,3,4,5,6,7    OFF - 1
  45. ;    SW2:    ON - 1,2,4        OFF - 3,5,6,7
  46. ;        
  47. ; Set modem switches as defined in B5IM-1.DOC.
  48. ;     Hayes 1200 switches:
  49. ;        UP   - 1,2,4,6,7
  50. ;        DOWN - 3,5,8    
  51. ;
  52. ; THESE CABLING AND SWITCH SETTINGS WORK PROPERLY WITH BYE5 AND ARE
  53. ; COMPATIBLE WITH IMP WITHOUT ANY CHANGES. ANY OTHER CONFIGURATIONS
  54. ; MIGHT REQUIRE RESETTING SOME MODEM SWITCHES WHEN GOING FROM BYE5
  55. ; TO IMP, MDM7, MEX, ETC.
  56. ;
  57. ;------------------------------------------------------------------------
  58. ;
  59. ; For the Apple //e, a user-entered Control-Q can trash the local display
  60. ; by reverting back to 40-column mode.  In later versions of BYE5 just
  61. ; set one of the FILTx noise filters to trap Control-Q.
  62. ;
  63. ;------------------------------------------------------------------------
  64. ;
  65. ; If not using a bulletin board program, add the following conditional
  66. ; to the list of them appearing after EXITFCB:
  67. ;
  68. ;    IF    EXFILE AND NOT (MBBS OR QBBS OR OXGATE OR METAL OR PBBS)
  69. ;    DB    0,'BYE     COM'
  70. ;    DB    0,0,0,0,0,0,0
  71. ;    DB    0,0,0,0,0,0,0
  72. ;    DB    0,0,0,0,0,0,0
  73. ;    ENDIF
  74. ;
  75. ; Necessary with BYE510, probably with BYE 509, also.  Check that the
  76. ; RBBS conditionals inside the NOT () are all valid RBBS options in the 
  77. ; RBBS option section of the BYE509-or-later version you are using.   Also
  78. ; check that all valid RBBS options do appear inside the ().  Later BYE
  79. ; versions may include this, so check the EXITFCB label first.  
  80. ;------------------------------------------------------------------------
  81. ;
  82. SLOT    EQU    2        ; Slot 2 is normal
  83. OFFS    EQU    16*SLOT        ; This is the slot offset
  84. ;......
  85. ;
  86. ;    Modem port addresses.  Apple addresses for direct access of
  87. ;    SSC 6551 ACIA registers
  88. ;
  89. PORT    EQU    0C088H+OFFS    ; SSC ACIA Data port    
  90. STPORT    EQU    PORT+1        ; Status port (read) or reset port (write)
  91. CPORT    EQU    PORT+2        ; SSC ACIA Command port
  92. BRPORT    EQU    PORT+3        ; SSC ACIA Control/Baudrate port
  93. ;
  94. ;======================================================================
  95. ;
  96. ; Initialize bios addresses for use by PEEK and POKE routines.
  97. ;
  98. ; The APRD and APWRT stuff is specific to the Apple ][ or //e with ALS
  99. ; CP/M Card.
  100. ;
  101. ;
  102. ALSINIT:
  103.     PUSH PSW ! PUSH B ! PUSH D ! PUSH H
  104.     LHLD    0001H            ; Point to WBOOT jump in bios jmp table
  105.     LXI    D,3*20H            ; Offset to APPLE READ bios jump
  106.     DAD    D            ; Add them
  107.     SHLD APRD+1 ! SHLD APR+1    ; Store locally
  108.     INX H ! INX H ! INX H        ; Bump hl to point to APPLE WRITE jump
  109.     SHLD APWRT+1 ! SHLD APWR+1    ; Store locally
  110.     POP H ! POP D ! POP B ! POP PSW
  111.     RET
  112. ;.....
  113. ;
  114. ; The following two  routines are specific to the Apple ][ or //e with ALS
  115. ; CP/M Card.  The routines respectively read from and write to modem hardware
  116. ; (Apple Super Serial Card ACIA registers) directly.
  117. ;
  118. ;.....
  119. ;
  120. ;
  121. ; Peek at 1 byte from Apple 6502 address space
  122. ;
  123. ;     ENTRY: HL = Address in Apple
  124. ;     EXIT:  A = Data
  125. ;
  126. PEEK:    PUSH    D    ; Preserve, then restore regs
  127.     PUSH    B
  128. APRD:    CALL    ALS1    ; ALS1 overwrites its address here with that
  129.     POP    B    ;   of APPLE READ bios routine
  130.     POP    D
  131.     RET
  132. ;.....
  133. ;
  134. ;
  135. ; Poke 1 byte to Apple 6502 address space
  136. ;
  137. ;     ENTRY: HL = Address in Apple
  138. ;     EXIT:  A = Data
  139. ;
  140. POKE:    PUSH    D
  141.     PUSH    B
  142. APWRT:    CALL    ALS2    ; ALS2 overwrites its address here with that
  143.     POP    B    ;   of APPLE WRITE bios routine
  144.     POP    D
  145.     RET
  146. ;.....
  147. ;
  148. ;
  149. ; Either ALS1 or ALS2 -- only one of them -- gets called once to initialize
  150. ; local addresses for direct bios calls to Apple Read and Apple Write routines.
  151. ;
  152. ALS1:    CALL    ALSINIT
  153. APR:    CALL    0000    ; Filled in by ALSINIT so we do the Apple Read that
  154.     RET        ; this particular call to PEEK was supposed to do
  155.  
  156. ALS2:    CALL    ALSINIT
  157. APWR:    CALL    0000    ; Filled in by ALSINIT so we do the Apple Write
  158.     RET        ; this call to POKE was supposed to do
  159. ;.....
  160. ;
  161. ;
  162. ; Read the baud rate port of the ACIA
  163. ;
  164. RD$BRPORT:
  165.     PUSH    H
  166.     LXI    H,BRPORT
  167.     CALL    PEEK
  168.     POP    H
  169.     RET
  170. ;.....
  171. ;
  172. ;
  173. ; Read the command port of ACIA
  174. ;
  175. RD$CPORT:
  176.     PUSH    H
  177.     LXI    H,CPORT
  178.     CALL    PEEK
  179.     POP    H
  180.     RET
  181. ;.....
  182. ;
  183. ;
  184. ; Read data port of ACIA
  185. ;
  186. RD$PORT:
  187.     PUSH    H
  188.     LXI    H,PORT
  189.     CALL    PEEK
  190.     POP    H
  191.     RET
  192. ;.....
  193. ;
  194. ;
  195. ; Read the status port of the ACIA
  196. ;
  197. RD$STPORT:
  198.     PUSH    H
  199.     LXI    H,STPORT
  200.     CALL    PEEK
  201.     POP    H
  202.     RET
  203. ;.....
  204. ;
  205. ;
  206. ; Write to the baud rate port of the ACIA
  207. ;
  208. WR$BRPORT:
  209.     PUSH    H
  210.     LXI    H,BRPORT
  211.     CALL    POKE
  212.     POP    H
  213.     RET
  214. ;.....
  215. ;
  216. ;
  217. ; Write to the command port of ACIA
  218. ;
  219. WR$CPORT:
  220.     PUSH    H
  221.     LXI    H,CPORT
  222.     CALL    POKE
  223.     POP    H
  224.     RET
  225. ;.....
  226. ;
  227. ;
  228. ; Write to the serial data port of the ACIA
  229. ;
  230. WR$PORT:
  231.     PUSH    H
  232.     LXI    H,PORT
  233.     CALL    POKE
  234.     POP    H
  235.     RET
  236. ;.....
  237. ;
  238. ;
  239. ;----------------------------------------------------------------------
  240. ;
  241. ;
  242. ; Check for a carrier, if none return with the zero flag set.
  243. ;
  244. MDCARCK:
  245.     CALL    RD$STPORT    ; Get status
  246.     ANI    40H        ; Check DSR pin for DCD (see above)
  247.     XRI    40H        ; Reverse the zero flag (the 6551
  248.     RET            ; Has status 0 for DCD/DSR true)
  249. ;......
  250. ;
  251. ; This routine will turn off the serial card and hang up the phone.
  252. ;
  253. MDINIT:
  254.     MVI    A,4AH        ; Turn off DTR
  255.     CALL    WR$CPORT
  256.     PUSH    B        ; Save register
  257.     MVI    B,20        ; Delay 2 sec to drop carrier
  258. ;
  259. OFFTI:    CALL    DELAY        ; 1 sec per loop
  260.     DCR    B
  261.     JNZ    OFFTI        ; Keep going until finished
  262.     POP    B        ; Restore register
  263.     MVI    A,4BH        ; Raise DTR and set parity
  264.     CALL    WR$CPORT
  265.     MVI    A,18H        ; Set 1200, 8 bits, 1 stop
  266.     CALL    WR$BRPORT
  267. ;
  268.       IF    IMODEM
  269.     CALL    IMINIT
  270.       ENDIF            ; IMODEM
  271. ;
  272.     RET
  273. ;......
  274. ;
  275. ;
  276. ; Super Serial Card status checks.  NOT READY indication if bit 3 of STPORT
  277. ; byte equals zero (for receive-readiness check), or bit 4 equals 
  278. ; zero (for transmit-readiness check).
  279. ;......
  280. ;
  281. ; Check the status to see if a character is waiting to be received.
  282. ; Return with zero flag set, if not.  If yes, clear flag and return with
  283. ; 0FFH in A.
  284. ;
  285. MDINST:    CALL    RD$STPORT    ; Get modem status
  286.     ANI    08H        ; Is data available?
  287.     RZ            ; "no" returns zero as bit 3 (zero flag set)
  288.     ORI    0FFH        ; Otherwise return true with 0FFH in A
  289.     RET
  290. ;.....
  291. ;
  292. ;
  293. ; Check if transmit register is empty.  If empty, ready to transmit another
  294. ; character and returns with zero flag clear.  If busy,  returns with zero
  295. ; flag set.
  296. ;
  297. MDOUTST:
  298.     CALL    RD$STPORT    ; Get modem status
  299.     ANI    10H        ; Ready to transmit?
  300.     RET            ; "no" returns zero as bit 4 (zero flag set)
  301. ;.......
  302. ;
  303. ;
  304. ; Input a character from the modem port.
  305. ;
  306. MDINP:    JMP    RD$PORT        ; Get character
  307. ;......
  308. ;
  309. ;
  310. ; Output one character in register A.  Remember, that is register A, not C.
  311. ;
  312. MDOUTP:    JMP    WR$PORT        ; Send character
  313. ;.......
  314. ;
  315. ;
  316. ; Reinitialize the modem and hang up the phone by dropping DTR and
  317. ; leaving it inactive.
  318. ;
  319. MDQUIT:
  320.      IF IMODEM        ; If using a smart modem
  321.     CALL    IMQUIT        ; Tell it to shut down
  322.      ENDIF            ; IMODEM
  323. ;                ; Fall into MDSTOP
  324. ;
  325. ;
  326. ; Called by the main program after caller types BYE
  327. ;
  328. MDSTOP:
  329.     MVI    A,4AH        ; Drop DTA
  330.     JMP    WR$CPORT
  331. ;.....
  332. ;
  333. ;
  334. ; If you do not support a particular baud rate, put it here
  335. ; before SETINV:
  336. ;
  337. ;
  338. SET2400:
  339.     MVI    A,1AH
  340.     JMP    WR$BRPORT
  341. ;.....
  342. ;
  343. ;
  344. SET4800:
  345.     MVI    A,1CH
  346.     JMP    WR$BRPORT
  347. ;.....
  348. ;
  349. ;
  350. SET9600:
  351.     MVI    A,1EH
  352.     JMP    WR$BRPORT
  353. ;.....
  354. ;
  355. ;
  356. SETINV:    ORI    0FFH
  357.     RET
  358. ;.....
  359. ;
  360. ;
  361. SET300:    MVI    A,16H
  362.     JMP    WR$BRPORT    ; Go change the baud rate
  363. ;.....
  364. ;
  365. ;
  366. SET1200:
  367.     MVI    A,18H
  368.     JMP    WR$BRPORT
  369. ;.....
  370. ;
  371. ;            end of insert
  372. ;-------------------------------------------------------------------
  373.