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.

134 lines
2.3KB

  1. .PAGE 'SER.ATN'
  2. ;
  3. ;
  4. ;
  5. ATNIRQ LDA PA1 ; CLEAR IRQ (CA1)
  6. LDA #1
  7. STA ATNPND
  8. RTS
  9. ;
  10. ATNSRV SEI
  11. ;
  12. LDA #0 ; CLEAR PENDING FLAG
  13. STA ATNPND
  14. STA LSNACT ; CLEAR ADDRESS FLAGS
  15. STA TLKACT
  16. ;
  17. LDX #TOPWRT ; RESET STACK
  18. TXS
  19. ;
  20. LDA #$80 ; SET ATN MODE FLAG FOR ACPT ROUTINE
  21. STA EOIFLG ;RESET EOI FLAG TO NON-EOI STATE
  22. STA ATNMOD
  23. ;
  24. JSR CLKHI
  25. JSR DATLOW ; SET DATA LINE LOW AS RESPONSE
  26. ;
  27. LDA PB ; SET ATN ACK TO GET HARDWARE CONTROLL OF DATA LINE
  28. ORA #ATNA
  29. STA PB
  30. ;
  31. ATNS15 LDA PB ; TEST ATN STILL HERE
  32. BPL ATNS20 ; GONE !
  33. AND #CLKIN ; CLOCK STILL LOW
  34. BNE ATNS15
  35. ;
  36. ;
  37. ATN30 JSR ACPTR ; GET A COMMAND BYTE
  38. ;
  39. CMP #UNLSN
  40. BNE ATN35
  41. ;
  42. LDA #0 ; GENERAL UNLISTEN COMMAND
  43. STA LSNACT
  44. BEQ ATN122 ; JMP
  45. ;
  46. ATN35 CMP #UNTLK
  47. BNE ATN40
  48. ;
  49. LDA #0
  50. STA TLKACT ; UNTALK NOW
  51. BEQ ATN122 ; JMP
  52. ;
  53. ATN40 CMP TLKADR ; OUR TALK ADDRESS?
  54. BNE ATN45 ; NOPE
  55. ;
  56. LDA #1 ; YES
  57. STA TLKACT ; SET ACTIVE TALKER FLAG
  58. LDA #0
  59. STA LSNACT ; UNLISTEN
  60. BEQ ATN95 ;JUMP
  61. ;
  62. ATN45 CMP LSNADR ; OUT LISTEN ADDRESS?
  63. BNE ATN50 ; NOPE
  64. ;
  65. LDA #1 ; YES
  66. STA LSNACT
  67. LDA #0
  68. STA TLKACT
  69. BEQ ATN95 ;JUMP
  70. ;
  71. ATN50 TAX ; TEST IF SA
  72. AND #$60
  73. CMP #$60 ; SA = $60 + N
  74. BNE ATN120 ;DID NOT GET A VALID COMMAND
  75. ;
  76. ;
  77. TXA ; A SA FOR ME
  78. STA ORGSA
  79. AND #$0F ; STRIP JUNK
  80. STA SA
  81. ;
  82. LDA ORGSA ; TEST IF CLOSE
  83. AND #$F0
  84. CMP #$E0
  85. BNE ATN122 ; NO
  86. ;
  87. CLI
  88. JSR CLOSE ; CLOSE THE FILE
  89. SEI
  90. ;
  91. ; WARNING:::CLOSE DOESN'T RETURN IN TIME FOR ATN122:::
  92. ;
  93. ATN95 BIT PB ; TEST ATN STILL HERE
  94. BMI ATN30
  95. ;
  96. ;
  97. ; ATN GONE , DO WHAT WE WHERE TOLD TO DO
  98. ;
  99. ;
  100. ATNS20 LDA #0 ; CLEAR ATN MODE
  101. STA ATNMOD
  102. ;
  103. LDA PB ; ATN GONE , RELEASE ATN ACK
  104. AND #$FF-ATNA
  105. STA PB
  106. ;
  107. LDA LSNACT ; LISTEN ?
  108. BEQ ATN100
  109. ;
  110. JSR LISTEN
  111. JMP IDLE
  112. ;
  113. ATN100 LDA TLKACT ; TALK?
  114. BEQ ATN110
  115. ;
  116. JSR DATHI ; RELEASE DATA LINE
  117. JSR CLKLOW ; PULL CLOCK LOW
  118. ;
  119. JSR TALK
  120. ATN110 JMP ILERR ; RELEASE ALL LINES AND GO TO IDLE
  121. ;
  122. ; FIX SO (DEVICE NOT PRESENT) ERRORS REPORTED
  123. ;
  124. ATN120 LDA #$10 ;KILL ALL BUT ATNAK
  125. STA PB
  126. ATN122 BIT PB
  127. BPL ATNS20 ;EXIT OUT SAME WAY AFTER ATN DONE
  128. BMI ATN122 ;JMP
  129. ;
  130. .END
  131. ; RSR 12/8/80 FIX INVERTED LOGIC
  132. ; RSR 12/16/80 FIX BAD LOGIC
  133. ; RSR 12/31/80 FIX EOIFLG AND LOGIC