You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

267 lines
3.7KB

  1. .PAG 'IEEE...SF'
  2. ;ATN IRQ PROCESS
  3. ; IRQ ON ATN, LISTEN TO PET
  4. ; CLEAR STACK
  5. .SKI 3
  6. ATNIRQ
  7. LDA IEEED ;CLR ATNIRQ
  8. LDA #1
  9. STA ATNPND
  10. RTS
  11. ATNSRV
  12. SEI
  13. LDA #0
  14. STA ATNPND
  15. LDX #TOPWRT
  16. TXS
  17. LDA #DAV+EOI+NDAC
  18. ORA PB ;FREE CONTROL LINES
  19. AND #$FF-TRSEL-NRFD
  20. STA PB
  21. LDA #0
  22. STA DDRA1
  23. LDA #RDD ;SET RECEIVE DIR
  24. STA DDRB1
  25. LDA #$FF
  26. STA IEEED ;FREE DATA LINES
  27. ATN10
  28. LDA PB
  29. AND #$FF-NDAC
  30. ORA #NRFD+ATNA
  31. STA PB
  32. ATN20 BIT PB
  33. BVC ATN30 ;DAV LO
  34. BMI ATN20 ;ATN LO ATNI HI
  35. BPL ATN50 ;ATN HI
  36. ATN30 LDA #$FF-NRFD ;NRFD LO
  37. AND PB
  38. STA PB
  39. AND #EOI
  40. STA EOIFLG ;SAVE EOI
  41. LDA IEEED
  42. EOR #$FF
  43. STA ICMD ;SAVE COMMAND
  44. LDA #NDAC ;NDAC HI
  45. ORA PB
  46. STA PB
  47. DCDE LDY #0
  48. LDA ICMD
  49. AND #%01100000
  50. CMP #$40 ;TALK?
  51. BEQ DCDE60
  52. CMP #$20 ;LISTEN?
  53. BEQ DCDE20
  54. CMP #$60 ;SECONDARY?
  55. BEQ DCDE70
  56. BNE DCDE80 ;OTHER
  57. DCDE20 LDA ICMD
  58. CMP LSNADR
  59. BEQ DCDE40 ;MY LISTEN ADDRESS
  60. CMP #UNLSN
  61. BNE DCDE30
  62. STY LSNACT
  63. DCDE30 STY ADRSED ;NOT PRIMARY ADDRSED
  64. JMP DCDE80
  65. DCDE40 STA LSNACT
  66. STY TLKACT
  67. DCDE50 LDA #32
  68. STA SA ;DEFAULT SA
  69. STA ORGSA
  70. STA ADRSED ;PRIMARY ADDRESSED
  71. BNE DCDE80
  72. DCDE60 STY TLKACT
  73. LDA ICMD
  74. CMP TLKADR
  75. BNE DCDE30
  76. STA TLKACT
  77. STY LSNACT
  78. BEQ DCDE50
  79. DCDE70 LDA ADRSED
  80. BEQ DCDE80 ;NOT ADDRESSED
  81. LDA ICMD
  82. STA ORGSA
  83. PHA
  84. AND #$F
  85. STA SA
  86. PLA
  87. AND #$F0 ;CLOSE?
  88. CMP #$E0
  89. BNE DCDE80
  90. CLI
  91. JSR CLOSE
  92. SEI
  93. DCDE80
  94. ATN40 BIT PB
  95. BVC ATN40
  96. JMP ATN10
  97. ATN50 LDA LSNACT
  98. BEQ ATN60
  99. LDA #$FF-NRFD-ATNA
  100. AND PB
  101. STA PB
  102. JSR LISTEN
  103. JMP IDLE
  104. ATN60 LDA #$FF-ATNA-NDAC
  105. AND PB
  106. ORA #NDAC
  107. STA PB
  108. LDA TLKACT
  109. BEQ ATN70
  110. JSR TALK
  111. ATN70 JMP IDLE
  112. .SKI 5
  113. LISTEN
  114. SEI
  115. LDA #NRFD ;RFD: HI
  116. ORA PB
  117. STA PB
  118. LSN10 BIT PB ;DAV: LO
  119. BMI NOLATN ;ATN IS NOW HIGH
  120. BVS LSN10
  121. JSR FNDWCH ; WAS LDX SA
  122. BCS LSN15
  123. .SKIP
  124. LDA CHNRDY,X
  125. ROR A ;OK, OPEN FOR LISTEN
  126. BCS LSN30
  127. LSN15 LDA ORGSA ; WAS TXA
  128. AND #$F0 ;SA=OPEN?
  129. CMP #$F0
  130. BEQ LSN30
  131. LSN20 LDA SA
  132. CMP #1
  133. BEQ LSN25
  134. LSN21 BIT PB
  135. BMI NOLATN ;ATN IS NOW HIGH
  136. BVC LSN21
  137. LDA #$FF-NDAC
  138. AND PB
  139. STA PB
  140. RTS
  141. .SKIP
  142. NOLATN
  143. JMP ATNSRV
  144. LSN25
  145. SEI
  146. LDA #$FF-NRFD ; ACCEPT ALL DATA
  147. AND PB
  148. STA PB ;RFD LOW
  149. LDA #NDAC
  150. ORA PB ; DAC HI
  151. STA PB
  152. .SKIP
  153. LSN26 BIT PB ; DAV HI
  154. BMI NOLATN ;ATN IS NOW HIGH
  155. BVC LSN26
  156. LDA PB
  157. AND #$FF-NDAC ; DAC LOW
  158. STA PB
  159. LDA #NRFD ; RFD HI
  160. ORA PB
  161. STA PB
  162. LSN28 BIT PB ; WAIT DAV LOW
  163. BMI NOLATN ;ATN IS NOW HIGH
  164. BVC LSN28
  165. JMP LSN25 ; DO UNTIL ATN PULLED
  166. LSN30 LDA #$FF-NRFD
  167. AND PB
  168. STA PB
  169. AND #EOI
  170. STA EOIFLG
  171. LDA IEEED
  172. EOR #$FF
  173. STA DATA
  174. SEI
  175. LDA #NDAC
  176. ORA PB
  177. STA PB
  178. LSN40 BIT PB
  179. BMI NOLATN ;ATN IS NOW HIGH
  180. BVC LSN40
  181. LDA #$FF-NDAC
  182. AND PB
  183. STA PB
  184. CLI
  185. JSR PUT
  186. LSTRTN
  187. JMP LISTEN
  188. .SKI 3
  189. TLK25
  190. LDA #DAV+EOI
  191. ORA PB
  192. STA PB
  193. JMP IDLE
  194. TALK
  195. SEI
  196. JSR FNDRCH
  197. BCS NOTLK ; TEST IF CHANNEL READY
  198. TALK1 LDX LINDX
  199. LDA CHNRDY,X
  200. BMI TLK05
  201. NOTLK RTS
  202. TLK05
  203. LDA #TDD
  204. STA DDRB1
  205. LDA #$FF
  206. STA DDRA1
  207. LDA PB
  208. ORA #TRSEL
  209. STA PB
  210. ;
  211. LDA #NRFD
  212. TLK10 BIT PB ;RFD: HI
  213. BMI NOTATN ;ATN IS NOW HIGH
  214. BEQ TLK10
  215. LDA CHNDAT,X
  216. EOR #$FF
  217. STA IEEED
  218. LDA CHNRDY,X
  219. ORA #$FF-EOI-DAV ;DAV: LO
  220. AND PB
  221. STA PB
  222. TLK20
  223. LDA PB
  224. BMI NOTATN ;ATN IS NOW HIGH
  225. AND #NRFD+NDAC
  226. CMP #NRFD+NDAC
  227. BEQ TLK25
  228. AND #NRFD
  229. BNE TLK20
  230. TLK30
  231. CLI
  232. JSR GET
  233. SEI
  234. LDA #NDAC
  235. TLK35 BIT PB
  236. BMI NOTATN ;ATN IS NOW HIGH
  237. BEQ TLK35
  238. TLKRTN LDA #$FF
  239. STA IEEED
  240. LDA #DAV+EOI
  241. ORA PB
  242. STA PB
  243. LDA #NDAC
  244. TLK40 BIT PB
  245. BMI NOTATN ;ATN IS NOW HIGH
  246. BNE TLK40
  247. BEQ TALK1
  248. ;
  249. NOTATN
  250. JMP ATNSRV
  251. ;
  252. ITERR ;IEEE TALKER ERROR RECOVERY
  253. LDA PB
  254. ORA #DAV
  255. STA PB
  256. RTS
  257. ;
  258. ;
  259. ILERR ;IEEE LISTENER ERROR RECOVERY
  260. LDA #NRFD
  261. ORA PB
  262. AND #$FF-ATNA
  263. STA PB
  264. RTS
  265. ;
  266. .END