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.

lcccntrl.src 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. .page 'lcc.cntrl'
  2. ;
  3. ;
  4. ;
  5. ; *contrl
  6. ;
  7. ; main controller loop
  8. ;
  9. ; scans job que for jobs
  10. ;
  11. ; finds job on current track
  12. ; if it exists
  13. ;
  14. lcc
  15. ;
  16. tsx ; save current stack pointer
  17. stx savsp
  18. ;
  19. lda t1lc2 ; reset irq flag
  20. ;
  21. lda pcr2 ; enable s.o. to 6502
  22. ora #$0e ; hi output
  23. sta pcr2
  24. ;
  25. ;
  26. ;
  27. top ldy #numjob-1 ; pointer into job que
  28. ;
  29. cont10
  30. lda jobs,y ; find a job (msb set)
  31. bpl cont20 ; not one here
  32. ;
  33. cmp #jumpc ; test if its a jump command
  34. bne cont30
  35. ;
  36. tya ; put job num in .a
  37. jmp ex2
  38. ;
  39. ;
  40. cont30
  41. and #1 ; get drive #
  42. beq cont35
  43. ;
  44. sty jobn
  45. lda #$0f ; bad drive # error
  46. jmp errr
  47. ;
  48. cont35 tax
  49. sta drive
  50. ;
  51. cmp cdrive ; test if current drive
  52. beq cont40
  53. ;
  54. jsr turnon ; turn on drive
  55. lda drive
  56. sta cdrive
  57. jmp end ; go clean up
  58. ;
  59. ;
  60. cont40 lda drvst ; test if motor up to speed
  61. bmi cont50
  62. ;
  63. asl a ; test if stepping
  64. bpl que ; not stepping
  65. ;
  66. cont50 jmp end
  67. ;
  68. cont20 dey
  69. bpl cont10
  70. ;
  71. jmp end
  72. ;
  73. ;
  74. ;
  75. ;
  76. que lda #$20 ; status=running
  77. sta drvst
  78. ;
  79. ldy #numjob-1
  80. sty jobn
  81. ;
  82. que10 jsr setjb
  83. bmi que20
  84. ;
  85. que05 dec jobn
  86. bpl que10
  87. ;
  88. ;
  89. ldy nxtjob
  90. jsr setjb1
  91. ;
  92. lda nxtrk
  93. sta steps
  94. asl steps ; steps*2
  95. ;
  96. lda #$60 ; set status=stepping
  97. sta drvst
  98. ;
  99. ;
  100. ;
  101. lda (hdrpnt),y ; get dest track #
  102. sta drvtrk
  103. fin jmp end
  104. ;
  105. ;
  106. que20 and #1 ; test if same drive
  107. cmp drive
  108. bne que05
  109. ;
  110. lda drvtrk
  111. beq gotu ; uninit. track #
  112. ;
  113. sec ; calc distance to track
  114. sbc (hdrpnt),y
  115. beq gotu ; on track
  116. ;
  117. eor #$ff ; 2's comp
  118. sta nxtrk
  119. inc nxtrk
  120. ;
  121. lda jobn ; save job# and dist to track
  122. sta nxtjob
  123. ;
  124. jmp que05
  125. ;
  126. ;
  127. ;
  128. ;
  129. gotu ldx #4 ; set track and sectr
  130. lda (hdrpnt),y
  131. sta tracc
  132. ;
  133. ;gotu10 cmp trknum-1,x
  134. ;---------- GCB rom06 11/20/86 -------------------------------------
  135. gotu10 cmp fourty_trk_num-1,x ;fix for bit cell time for tracks >35.
  136. ;--------------------------------------------------------------------
  137. ;
  138. dex
  139. bcs gotu10
  140. ;
  141. lda numsec,x
  142. sta sectr
  143. ;
  144. txa ; set density
  145. asl a
  146. asl a
  147. asl a
  148. asl a
  149. asl a
  150. sta work
  151. ;
  152. lda dskcnt
  153. and #$9f ; clear density bits
  154. ora work
  155. sta dskcnt
  156. ;
  157. ldx drive ; drive num in .x
  158. ;
  159. lda job ; yes, go do the job
  160. cmp #bumpc ; test for bump
  161. beq bmp
  162. ;
  163. ;
  164. exe cmp #execd ; test if execute
  165. beq ex
  166. ;
  167. jmp seak ; do a sector seek
  168. ;
  169. ex lda jobn ; jump to buffer
  170. ex2 clc
  171. adc #>bufs
  172. sta bufpnt+1
  173. lda #0
  174. sta bufpnt
  175. ex3 jmp (bufpnt)
  176. ;
  177. ;
  178. bmp
  179. lda #$60 ; set status=stepping
  180. sta drvst
  181. ;
  182. lda dskcnt
  183. and #$ff-$03 ; set phase a
  184. sta dskcnt
  185. ;
  186. ;
  187. ;
  188. lda #256-92 ; step back 45 traks
  189. sta steps
  190. ;
  191. lda #1 ; drvtrk now 1
  192. sta drvtrk
  193. ;
  194. jmp errr ; job done return 1
  195. ;
  196. ;
  197. ;
  198. ;
  199. ;
  200. setjb ldy jobn
  201. setjb1 lda jobs,y
  202. pha
  203. bpl setj10 ; no job here
  204. ;
  205. and #$78
  206. sta job
  207. tya
  208. asl a
  209. adc #<hdrs
  210. sta hdrpnt
  211. tya ; point at buffer
  212. clc
  213. adc #>bufs
  214. sta bufpnt+1
  215. ;
  216. ;
  217. setj10 ldy #0
  218. sty bufpnt
  219. ;
  220. pla
  221. rts
  222. ;
  223. ;
  224. ;
  225. ;.end