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.

jobssf.src 8.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. .page 'jobs...sf'
  2. ;
  3. ; use lastjob for drive #
  4. ; cmd is used for job command
  5. ;
  6. setljb
  7. lda lstjob,x
  8. and #1
  9. ora cmd
  10. ;
  11. ; set job up and check t&s
  12. ; .a=command for jobs
  13. ; .x=job number
  14. ;
  15. setjob
  16. pha
  17. stx jobnum
  18. txa
  19. ;asl a ;4/12*****************
  20. ;asl a
  21. asl a
  22. tax
  23. lda hdrs+1,x ; 4/12***********
  24. sta cmd ; save sector
  25. lda hdrs,x ; 4/12***********
  26. beq tserr
  27. ;
  28. cmp maxtrk
  29. bcs tserr ; track too large
  30. ;
  31. tax
  32. pla ; check for write
  33. pha
  34. and #$f0
  35. cmp #write
  36. bne sjb1 ; not write,skip check
  37. pla
  38. pha
  39. lsr a
  40. bcs sjb2 ; drive 1
  41. ;
  42. lda dskver ; get version #
  43. bcc sjb3
  44. sjb2
  45. lda dskver+1 ; get drive 1 ver#
  46. sjb3
  47. beq sjb4 ; no # is ok, too
  48. cmp vernum
  49. bne vnerr ; not same vernum #
  50. ;
  51. sjb4
  52. txa ; restore track #
  53. jsr maxsec
  54. cmp cmd
  55. beq tserr
  56. bcs sjb1 ; sector is ok!
  57. ;
  58. ;
  59. ; illegal track and sector
  60. ;
  61. tserr
  62. jsr hed2ts
  63. tser1
  64. lda #badts
  65. jmp cmder2
  66. ;
  67. ;
  68. hed2ts
  69. lda jobnum
  70. ; asl a ;4/12*************
  71. ; asl a
  72. asl a
  73. tax
  74. lda hdrs,x ; 4/12***********
  75. sta track
  76. lda hdrs+1,x ; 4/12***********
  77. sta sector
  78. rts
  79. ;
  80. ;
  81. tschk
  82. lda track
  83. beq tser1
  84. cmp maxtrk
  85. bcs tser1
  86. ;
  87. jsr maxsec
  88. cmp sector
  89. beq tser1
  90. bcc tser1
  91. rts
  92. ;
  93. vnerr
  94. jsr hed2ts
  95. lda #cbmv2 ; write to wrong version
  96. jmp cmder2
  97. ;
  98. sjb1
  99. ldx jobnum
  100. pla
  101. sta cmd
  102. sta jobs,x
  103. sta lstjob,x
  104. rts
  105. ;
  106. ;
  107. ; do job in .a, set up error count
  108. ; and lstjob. return when job done ok
  109. ; jmp to error if error returns
  110. ;
  111. doread
  112. lda #read
  113. bne dojob ; bra
  114. dowrit
  115. lda #write
  116. dojob
  117. ora drvnum
  118. ldx jobnum
  119. ;
  120. doit sta cmd
  121. doit2 lda cmd
  122. jsr setjob
  123. ; jmp watjob
  124. ;
  125. ; wait until job(.x) is done
  126. ; return when done
  127. ;
  128. watjob jsr tstjob
  129. bcs watjob
  130. pha ; clr jobrtn flag
  131. lda #0
  132. sta jobrtn
  133. pla
  134. rts
  135. ;
  136. ;
  137. ;test if job(.x) is done yet
  138. ;if not done return
  139. ;if ok then return else redo it
  140. ;
  141. tstjob lda jobs,x
  142. bmi notyet
  143. cmp #2
  144. bcc ok
  145. ;
  146. cmp #8 ; check for wp switch on
  147. beq tj10
  148. ;
  149. cmp #11 ; check for id mismatch
  150. beq tj10
  151. ;
  152. cmp #$f ; check for nodrive
  153. bne recov
  154. tj10 bit jobrtn
  155. bmi ok
  156. jmp quit2
  157. ;
  158. ok clc ; c=0 finished ok or quit
  159. rts
  160. ;
  161. notyet sec ; c=1 not yet
  162. rts
  163. ;
  164. ;
  165. recov
  166. tya ; save .y
  167. pha
  168. lda drvnum ; save drive #
  169. pha
  170. lda lstjob,x
  171. and #1
  172. sta drvnum ; set active drive #
  173. ;
  174. tay
  175. lda ledmsk,y
  176. sta erled
  177. ;
  178. jsr dorec
  179. cmp #2
  180. bcs rec01
  181. jmp rec95
  182. rec01
  183. ;
  184. lda lstjob,x ; original job
  185. and #$f0 ; mask job code
  186. pha ; save it
  187. cmp #write
  188. bne rec0 ; not a write
  189. ;
  190. lda drvnum
  191. ora #secsek ; replace w/ sector seek...
  192. sta lstjob,x ; ... during recovery
  193. rec0
  194. bit revcnt
  195. bvs rec5 ; no track offset
  196. ;
  197. lda #0
  198. sta eptr ; clr offset table ptr
  199. sta toff ; clr total offset
  200. rec1
  201. ldy eptr
  202. lda toff
  203. sec
  204. sbc offset,y
  205. sta toff ; keep track of all offsets
  206. lda offset,y
  207. ;######## rom fix ds 01/25/85 GCB 11/20/86 set micro stepping flag ######
  208. jsr ptch12
  209. ; jsr hedoff
  210. ;###########################################################################
  211. ;
  212. inc eptr ; bump table ptr
  213. jsr dorec ; do the recovery
  214. cmp #2 ; error code < 2?
  215. bcc rec3 ; job worked
  216. ;
  217. ldy eptr
  218. lda offset,y
  219. bne rec1 ; null indicates end
  220. rec3
  221. lda toff
  222. ;##### rom fix ds 01/25/85 GCB 11/20/86 clear microstepping flag #####
  223. jsr ptch13 ; *** rom fix ds 01/25/85 ***
  224. ; jsr hedoff
  225. ;#######################################################################
  226. ;
  227. lda jobs,x
  228. cmp #2
  229. bcc rec9 ; no error
  230. rec5
  231. bit revcnt ; check bump-on flag
  232. bpl rec7 ; no bump
  233. ;
  234. quit
  235. pla
  236. cmp #write ; check original job
  237. bne quit2
  238. ;
  239. ora drvnum
  240. sta lstjob,x ; must restore original
  241. quit2
  242. lda jobs,x ; .a= error #
  243. jsr error
  244. rec7
  245. pla
  246. bit jobrtn
  247. bmi rec95 ; return job error
  248. pha
  249. ;
  250. ;do the bump
  251. lda #bump
  252. ora drvnum
  253. sta jobs,x
  254. rec8
  255. lda jobs,x
  256. bmi rec8 ; wait
  257. ;
  258. jsr dorec ; try one last set
  259. cmp #2
  260. bcs quit ; it clearly ain't gonna work
  261. rec9
  262. pla ; check original job for write
  263. cmp #write
  264. bne rec95 ; original job worked
  265. ;
  266. ora drvnum
  267. sta lstjob,x ; set write job back
  268. jsr dorec ; try last set of writes
  269. cmp #2 ; check error code
  270. bcs quit2 ; error
  271. rec95
  272. pla
  273. sta drvnum ; restore drive #
  274. pla
  275. tay ; restore .y
  276. lda jobs,x
  277. clc ; ok!
  278. rts
  279. ;
  280. hedoff ; .a=offset
  281. cmp #0
  282. beq hof3 ; no offset
  283. bmi hof2 ; steps are inward
  284. hof1
  285. ldy #1 ; step out 1 track
  286. jsr movhed
  287. sec
  288. sbc #1
  289. bne hof1 ; not finished
  290. beq hof3
  291. hof2
  292. ldy #$ff ; step in 1 track
  293. jsr movhed
  294. clc
  295. adc #1
  296. bne hof2 ; not finished
  297. hof3
  298. rts
  299. ;
  300. movhed
  301. pha ; save .a
  302. tya ; put phase in .a
  303. ldy drvnum
  304. sta phase,y
  305. mh10
  306. cmp phase,y
  307. beq mh10 ; wait for controller
  308. ;to change it
  309. lda #0
  310. sta phase,y ; clear it out
  311. pla ; restore
  312. rts
  313. ;
  314. ;
  315. dorec ; do last job recovery
  316. lda revcnt ; re-try job revcnt...
  317. and #$3f ; ...# of times
  318. tay
  319. dorec1
  320. lda erled
  321. eor ledprt
  322. sta ledprt
  323. lda lstjob,x ; set last job
  324. sta jobs,x
  325. dorec2
  326. lda jobs,x ; wait
  327. bmi dorec2
  328. cmp #2
  329. bcc dorec3 ; it worked
  330. ;
  331. dey
  332. bne dorec1 ; keep trying
  333. dorec3
  334. pha
  335. lda erled ; leave drive led on
  336. ora ledprt
  337. sta ledprt
  338. pla
  339. rts ; finished
  340. ;
  341. ; set header of active buffer of the
  342. ; current lindx to track,sector,id
  343. ;
  344. sethdr jsr getact
  345. seth
  346. ; asl a ;4/12*****************
  347. ; asl a
  348. asl a
  349. tay
  350. lda track
  351. sta hdrs,y ; 4/12*********** ;set track
  352. lda sector
  353. sta hdrs+1,y ; 4/12*********** ;set sector
  354. lda drvnum ; get proper id(drvnum)
  355. asl a
  356. tax
  357. ; lda dskid,x
  358. ; sta hdrs,y ;4/12***********
  359. ; lda dskid+1,x
  360. ; sta hdrs+1,y ;4/12***********
  361. rts
  362. ;
  363. ; .end