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.

lcc.seek 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. .PAGE 'LCC.SEEK'
  2. ;
  3. ;
  4. ;
  5. SEAK LDX #90 ; SEARCH 90 HEADERS
  6. STX TMP
  7. ;
  8. LDX #0 ;READ IN 8 GCR BYTES
  9. ;
  10. LDA #$52 ; HEADER BLOCK ID
  11. STA STAB
  12. ;
  13. SEEK10 JSR SYNC ; FIND SYNC CHAR
  14. ;
  15. BVC * ; WAIT FOR BLOCK ID
  16. CLV
  17. ;
  18. LDA DATA2
  19. CMP STAB ; TEST IF HEADER BLOCK
  20. BNE SEEK20 ; NOT HEADER
  21. ;
  22. SEEK15 BVC *
  23. CLV ; READ IN GCR HEADER
  24. ;
  25. LDA DATA2
  26. STA STAB+1,X
  27. ;
  28. INX
  29. CPX #7
  30. BNE SEEK15
  31. ;
  32. JSR CNVBIN ; CONVERT HEADER IN STAB TO BINARY IN HEADER
  33. ;
  34. LDY #4 ; COMPUTE CHECKSUM
  35. LDA #0
  36. ;
  37. SEEK30 EOR HEADER,Y
  38. DEY
  39. BPL SEEK30
  40. ;
  41. CMP #0 ; TEST IF OK
  42. BNE CSERR ; NOPE, CHECKSUM ERROR IN HEADER
  43. ;
  44. LDX CDRIVE ; UPDATE DRIVE TRACK#
  45. LDA HEADER+2
  46. STA DRVTRK,X
  47. ;
  48. LDA JOB ; TEST IF A SEEK JOB
  49. CMP #$30
  50. BEQ ESEEK
  51. ;
  52. LDA CDRIVE
  53. ASL A ; TEST IF CORRECT ID
  54. TAY
  55. LDA DSKID,Y
  56. CMP HEADER
  57. BNE BADID
  58. LDA DSKID+1,Y
  59. CMP HEADER+1
  60. BNE BADID
  61. ;
  62. JMP WSECT ; FIND BEST SECTOR TO SERVICE
  63. ;
  64. ;
  65. SEEK20 DEC TMP ; SEARCH MORE?
  66. BNE SEEK10 ;YES
  67. ;
  68. LDA #2 ; CANT FIND A SECTOR
  69. JSR ERRR
  70. ;
  71. ;
  72. ESEEK LDA HEADER ;HARRIS FIX....
  73. STA DSKID ;....
  74. LDA HEADER+1 ;....
  75. STA DSKID+1 ;....
  76. ;
  77. DONE LDA #1 ; RETURN OK CODE
  78. .BYTE SKIP2
  79. ;
  80. BADID LDA #11 ; DISK ID MISMATCH
  81. .BYTE SKIP2
  82. ;
  83. CSERR LDA #9 ; CHECKSUM ERROR IN HEADER
  84. JMP ERRR
  85. ;
  86. ;
  87. ;
  88. WSECT LDA #$7F ; FIND BEST JOB
  89. STA CSECT
  90. ;
  91. LDA HEADER+3 ; GET UPCOMING SECTOR #
  92. CLC
  93. ADC #2
  94. CMP SECTR
  95. BCC L460
  96. ;
  97. SBC SECTR ;WRAP AROUND
  98. ;
  99. L460 STA NEXTS ; NEXT SECTOR
  100. ;
  101. LDX #NUMJOB-1
  102. STX JOBN
  103. ;
  104. LDX #$FF
  105. ;
  106. L480 JSR SETJB
  107. BPL L470
  108. ;
  109. STA WORK
  110. AND #1
  111. CMP CDRIVE ; TEST IF SAME DRIVE
  112. BNE L470 ; NOPE
  113. ;
  114. LDY #0 ; TEST IF SAME TRACK
  115. LDA (HDRPNT),Y
  116. CMP TRACC
  117. BNE L470
  118. ;
  119. LDA JOB ; TEST IF EXECUTE JOB
  120. CMP #EXECD
  121. BEQ L465
  122. ;
  123. LDY #1
  124. SEC
  125. LDA (HDRPNT),Y
  126. SBC NEXTS
  127. BPL L465
  128. ;
  129. CLC
  130. ADC SECTR
  131. ;
  132. L465 CMP CSECT
  133. BCS L470
  134. ;
  135. PHA ; SAVE IT
  136. LDA JOB
  137. BEQ TSTRDJ ; MUST BE A READ
  138. ;
  139. PLA
  140. CMP #WRTMIN ; [IF(CSECT<9)RETURN;
  141. BCC L470 ; [IF(CSECT>12)RETURN;
  142. ;
  143. CMP #WRTMAX
  144. BCS L470
  145. ;
  146. DOITT STA CSECT ;ITS BETTER
  147. LDA JOBN
  148. TAX
  149. ADC #>BUFS
  150. STA BUFPNT+1
  151. ;
  152. BNE L470
  153. ;
  154. TSTRDJ PLA
  155. CMP #RDMAX ; IF(CSECT>6)RETURN;
  156. BCC DOITT
  157. ;
  158. ;
  159. L470 DEC JOBN
  160. BPL L480
  161. ;
  162. TXA ; TEST IF A JOB TO DO
  163. BPL L490
  164. ;
  165. JMP END ; NO JOB FOUND
  166. ;
  167. L490 STX JOBN
  168. JSR SETJB
  169. LDA JOB
  170. JMP REED
  171. ;
  172. ;
  173. ;
  174. ;
  175. CNVBIN LDA BUFPNT
  176. PHA
  177. LDA BUFPNT+1
  178. PHA ; SAVE BUFFER PNTR
  179. ;
  180. LDA #<STAB
  181. STA BUFPNT ; POINT AT GCR CODE
  182. LDA #>STAB
  183. STA BUFPNT+1
  184. ;
  185. LDA #0
  186. STA GCRPNT
  187. ;
  188. JSR GET4GB ; CONVERT 4 BYTES
  189. ;
  190. LDA BTAB+3
  191. STA HEADER+2
  192. ;
  193. LDA BTAB+2
  194. STA HEADER+3
  195. ;
  196. LDA BTAB+1
  197. STA HEADER+4
  198. ;
  199. ;
  200. JSR GET4GB ; GET 2 MORE
  201. ;
  202. LDA BTAB ; GET ID
  203. STA HEADER+1
  204. LDA BTAB+1
  205. STA HEADER
  206. ;
  207. PLA
  208. STA BUFPNT+1 ;RESTORE POINTER
  209. PLA
  210. STA BUFPNT
  211. ;
  212. RTS
  213. ;
  214. ;
  215. ;
  216. ;
  217. ;
  218. ;
  219. ;
  220. .END