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.

sertalk.src 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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
  18. ;check for clock gone (must be 80us+ from jmp talk1)
  19. and #datin
  20. php
  21. jsr clkhi ; set clock line hi
  22. plp ; see if verify error...
  23. beq tlk02 ; yes...data line low, eoi !!!!
  24. ;
  25. talk2 jsr tstatn ; test atn gone
  26. jsr debnc ; test data line now low
  27. and #datin
  28. bne talk2 ; did not respond
  29. ;
  30. ;
  31. ldx lindx ; prepare to send eoi if needed
  32. lda chnrdy,x
  33. and #eoi
  34. bne noeoi ; no eoi
  35. ;
  36. tlk02 jsr tstatn
  37. jsr debnc ; send an eoi
  38. and #datin ; test if data line is low
  39. bne tlk02 ; yes, wait till hi
  40. ;
  41. tlk03 jsr tstatn
  42. jsr debnc ; wait for data line to go low
  43. and #datin
  44. beq tlk03
  45. ;
  46. noeoi jsr clklow ; set clock low
  47. jsr tstatn
  48. jsr debnc ; wait for data line hi
  49. and #datin
  50. bne noeoi
  51. ;
  52. lda #8 ; set up bit counter
  53. sta cont
  54. ;
  55. isr01 jsr debnc ; let port settle
  56. ;
  57. and #datin
  58. ; test that data line is now high before we send
  59. bne frmerx
  60. ;
  61. isr02 ldx lindx ; get byte to send
  62. lda chndat,x
  63. ror a
  64. sta chndat,x
  65. ;
  66. bcs isrhi ; send a 1
  67. ;
  68. jsr datlow ; send a 0
  69. bne isrclk ; and clock it
  70. ;
  71. isrhi jsr dathi
  72. ;
  73. isrclk jsr clkhi ; rising edge clock
  74. ;
  75. lda drvtrk+1 ; check speed flag
  76. bne isr03 ; no slow down
  77. ;
  78. jsr slowd ; slow down
  79. isr03 jsr clkdat ; pull clock low and release data
  80. ;
  81. dec cont ; more bits?
  82. bne isr01 ; yes
  83. ;
  84. isr04 jsr tstatn
  85. jsr debnc
  86. and #datin
  87. beq isr04
  88. ;
  89. cli ; get next byte to send
  90. jsr get
  91. sei
  92. ;
  93. jmp talk1 ; keep on talkin
  94. ;
  95. frmerx jmp frmerr
  96. ;
  97. ;
  98. dathi lda pb ; set data out hi
  99. and #$ff-datout
  100. sta pb
  101. rts
  102. ;
  103. ;
  104. ;
  105. datlow lda pb
  106. ora #datout
  107. sta pb
  108. rts
  109. ;
  110. ;
  111. ;
  112. clklow lda pb
  113. ora #clkout
  114. sta pb
  115. rts
  116. ;
  117. ;
  118. ;
  119. clkhi lda pb
  120. and #$ff-clkout
  121. sta pb
  122. rts
  123. ;
  124. ;
  125. ;
  126. debnc lda pb
  127. cmp pb
  128. bne debnc
  129. rts
  130. ;
  131. ;.end
  132. ; additions after code sent to japan.
  133. ; rsr 3/30/81 add verify error correction
  134. ; rsr 3/31/81 change ordering to detect verify error