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.

ser.talk 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. .PAGE 'SER.TALK'
  2. ;
  3. ;
  4. ;
  5. TALK SEI ; FIND IF OPEN CHANNEL
  6. JSR FNDRCH
  7. BCS NOTLK ; NO ONE HOME
  8. ;
  9. TALK1 LDX LINDX
  10. LDA CHNRDY,X
  11. BMI TLK05
  12. ;
  13. NOTLK RTS
  14. ;
  15. ; CODE ADDED TO CORRECT VERIFY ERROR
  16. TLK05 JSR TSTATN ;TEST FOR ATN
  17. JSR DEBNC ;CHECK FOR CLOCK GONE (MUST BE 80US+ FROM JMP TALK1)
  18. AND #DATIN
  19. PHP
  20. JSR CLKHI ;SET CLOCK LINE HI
  21. PLP ;SEE IF VERIFY ERROR...
  22. BEQ TLK02 ;YES...DATA LINE LOW, EOI !!!!
  23. ;
  24. TALK2 JSR TSTATN ; TEST ATN GONE
  25. JSR DEBNC ; TEST DATA LINE NOW LOW
  26. AND #DATIN
  27. BNE TALK2 ; DID NOT RESPOND
  28. ;
  29. ;
  30. LDX LINDX ; PREPARE TO SEND EOI IF NEEDED
  31. LDA CHNRDY,X
  32. AND #EOI
  33. BNE NOEOI ; NO EOI
  34. ;
  35. TLK02 JSR TSTATN
  36. JSR DEBNC ; SEND AN EOI
  37. AND #DATIN ; TEST IF DATA LINE IS LOW
  38. BNE TLK02 ; YES, WAIT TILL HI
  39. ;
  40. TLK03 JSR TSTATN
  41. JSR DEBNC ; WAIT FOR DATA LINE TO GO LOW
  42. AND #DATIN
  43. BEQ TLK03
  44. ;
  45. NOEOI JSR CLKLOW ; SET CLOCK LOW
  46. JSR TSTATN
  47. JSR DEBNC ; WAIT FOR DATA LINE HI
  48. AND #DATIN
  49. BNE NOEOI
  50. ;
  51. LDA #8 ; SET UP BIT COUNTER
  52. STA CONT
  53. ;
  54. ISR01 JSR DEBNC ; LET PORT SETTLE
  55. ;
  56. AND #DATIN ; TEST THAT DATA LINE IS NOW HIGH BEFORE WE SEND
  57. BNE FRMERX
  58. ;
  59. ISR02 LDX LINDX ; GET BYTE TO SEND
  60. LDA CHNDAT,X
  61. ROR A
  62. STA CHNDAT,X
  63. ;
  64. BCS ISRHI ; SEND A 1
  65. ;
  66. JSR DATLOW ; SEND A 0
  67. BNE ISRCLK ; AND CLOCK IT
  68. ;
  69. ISRHI JSR DATHI
  70. ;
  71. ISRCLK JSR CLKHI ; RISING EDGE CLOCK
  72. ;
  73. LDA DRVTRK+1 ; CHECK SPEED FLAG
  74. BNE ISR03 ; NO SLOW DOWN
  75. ;
  76. JSR SLOWD ; SLOW DOWN
  77. ISR03 JSR CLKDAT ; PULL CLOCK LOW AND RELEASE DATA
  78. ;
  79. DEC CONT ; MORE BITS?
  80. BNE ISR01 ; YES
  81. ;
  82. ISR04 JSR TSTATN
  83. JSR DEBNC
  84. AND #DATIN
  85. BEQ ISR04
  86. ;
  87. CLI ; GET NEXT BYTE TO SEND
  88. JSR GET
  89. SEI
  90. ;
  91. JMP TALK1 ; KEEP ON TALKIN
  92. ;
  93. FRMERX JMP FRMERR
  94. ;
  95. ;
  96. DATHI LDA PB ; SET DATA OUT HI
  97. AND #$FF-DATOUT
  98. STA PB
  99. RTS
  100. ;
  101. ;
  102. ;
  103. DATLOW LDA PB
  104. ORA #DATOUT
  105. STA PB
  106. RTS
  107. ;
  108. ;
  109. ;
  110. CLKLOW LDA PB
  111. ORA #CLKOUT
  112. STA PB
  113. RTS
  114. ;
  115. ;
  116. ;
  117. CLKHI LDA PB
  118. AND #$FF-CLKOUT
  119. STA PB
  120. RTS
  121. ;
  122. ;
  123. ;
  124. DEBNC LDA PB
  125. CMP PB
  126. BNE DEBNC
  127. RTS
  128. ;
  129. .END
  130. ; ADDITIONS AFTER CODE SENT TO JAPAN.
  131. ; RSR 3/30/81 ADD VERIFY ERROR CORRECTION
  132. ; RSR 3/31/81 CHANGE ORDERING TO DETECT VERIFY ERROR