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.

lccwrt.src 5.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. .page 'lcc.wrt'
  2. ;
  3. ;
  4. ;
  5. ; * write job
  6. ;
  7. ; write out data buffer
  8. ;
  9. ;
  10. wright cmp #$10 ; test if write
  11. beq wrt05
  12. ;
  13. jmp vrfy
  14. ;
  15. wrt05 jsr chkblk ; get block checksum
  16. sta chksum
  17. ;
  18. lda dskcnt ; test for write protect
  19. and #$10
  20. bne wrt10 ; not protected
  21. ;
  22. lda #8 ; write protect error
  23. jmp errr
  24. ;
  25. wrt10 jsr bingcr ; convert buffer to write image
  26. ;
  27. jsr srch ; find header
  28. ;
  29. ldx #gap1-2 ; wait out header gap
  30. ;
  31. wrt20 bvc *
  32. clv
  33. ;
  34. dex ; test if done yet
  35. bne wrt20
  36. ;
  37. lda #$ff ; make output $ff
  38. sta ddra2
  39. ;
  40. lda pcr2 ; set write mode
  41. and #$ff-$e0
  42. ora #$c0
  43. sta pcr2
  44. ;
  45. lda #$ff ; write 5 gcr sync
  46. ldx #numsyn ;
  47. sta data2
  48. clv
  49. ;
  50. wrtsnc bvc *
  51. ;
  52. clv
  53. dex
  54. bne wrtsnc
  55. ;
  56. ldy #256-topwrt ; write out overflow buffer
  57. ;
  58. wrt30 lda ovrbuf,y ; get a char
  59. bvc * ; wait until ready
  60. clv
  61. ;
  62. sta data2 ; stuff it
  63. iny
  64. bne wrt30 ; do next char
  65. ;
  66. ; write rest of buffer
  67. ;
  68. wrt40 lda (bufpnt),y ; now do buffer
  69. bvc * ; wait until ready
  70. clv
  71. ;
  72. sta data2 ; stuff it again
  73. iny
  74. ; test if done
  75. bne wrt40 ; do the whole thing
  76. ;
  77. bvc * ; wait for last char to write out
  78. ;
  79. ;
  80. lda pcr2 ; goto read mode
  81. ora #$e0
  82. sta pcr2
  83. ;
  84. lda #0 ; make data2 input $00
  85. sta ddra2
  86. ;
  87. jsr wtobin ; convert write image to binary
  88. ;
  89. ldy jobn ; make job a verify
  90. lda jobs,y
  91. eor #$30
  92. sta jobs,y
  93. ;
  94. jmp seak ; scan job que
  95. ;
  96. ;
  97. chkblk lda #0 ; get eor checksum
  98. tay
  99. ;
  100. chkb10 eor (bufpnt),y
  101. iny
  102. bne chkb10
  103. ;
  104. rts ; return checksum in .a
  105. ;
  106. ;
  107. ;
  108. ;
  109. ; * wtobin
  110. ;
  111. ; convert write image back to
  112. ; binary data
  113. ;
  114. ;
  115. wtobin lda #0 ; init pointer
  116. sta savpnt
  117. sta bufpnt ; lsb
  118. sta nxtpnt
  119. ;
  120. lda bufpnt+1 ; goto buffer next
  121. sta nxtbf
  122. ;
  123. lda #>ovrbuf ; use overflow first
  124. sta bufpnt+1
  125. sta savpnt+1
  126. ;
  127. lda #256-topwrt
  128. sta gcrpnt ; get here first
  129. sta bytcnt ; store here
  130. ;
  131. jsr get4gb ; get first four- id and 3 data
  132. ;
  133. lda btab ; save bid
  134. sta bid
  135. ;
  136. ldy bytcnt
  137. ;
  138. lda btab+1
  139. sta (savpnt),y
  140. iny
  141. ;
  142. lda btab+2
  143. sta (savpnt),y
  144. iny
  145. ;
  146. lda btab+3
  147. sta (savpnt),y
  148. iny
  149. ;
  150. sty bytcnt
  151. ;
  152. wtob14 jsr get4gb ; do rest of overflow buffer
  153. ;
  154. ldy bytcnt
  155. ;
  156. lda btab
  157. sta (savpnt),y
  158. iny
  159. ;
  160. lda btab+1
  161. sta (savpnt),y
  162. iny
  163. beq wtob50
  164. ;
  165. lda btab+2
  166. sta (savpnt),y
  167. iny
  168. ;
  169. lda btab+3
  170. sta (savpnt),y
  171. iny
  172. ;
  173. sty bytcnt
  174. bne wtob14 ; jmp
  175. ;
  176. wtob50
  177. ;
  178. lda btab+2
  179. sta (bufpnt),y
  180. iny
  181. ;
  182. lda btab+3
  183. sta (bufpnt),y
  184. iny
  185. ;
  186. sty bytcnt
  187. ;
  188. wtob53 jsr get4gb
  189. ;
  190. ldy bytcnt
  191. ;
  192. lda btab
  193. sta (bufpnt),y
  194. iny
  195. ;
  196. lda btab+1
  197. sta (bufpnt),y
  198. iny
  199. ;
  200. lda btab+2
  201. sta (bufpnt),y
  202. iny
  203. ;
  204. lda btab+3
  205. sta (bufpnt),y
  206. iny
  207. ;
  208. sty bytcnt
  209. cpy #187
  210. bcc wtob53
  211. ;
  212. wtob52 lda #69 ; move buffer up
  213. sta savpnt
  214. ;
  215. lda bufpnt+1
  216. sta savpnt+1
  217. ;
  218. ldy #256-topwrt-1
  219. ;
  220. wtob55 lda (bufpnt),y
  221. sta (savpnt),y
  222. ;
  223. dey
  224. bne wtob55
  225. ;
  226. lda (bufpnt),y
  227. sta (savpnt),y
  228. ;
  229. ldx #256-topwrt ; move overflow over to buffer
  230. ;
  231. wtob57 lda ovrbuf,x
  232. sta (bufpnt),y
  233. ;
  234. iny
  235. inx
  236. bne wtob57
  237. ;
  238. stx gcrflg ; clear buffer gcr flag
  239. ;
  240. ;
  241. rts
  242. ;
  243. ;
  244. ;
  245. ;
  246. ;
  247. ; * verify data block
  248. ;
  249. ; convert to gcr verify image
  250. ;
  251. ; test against data block
  252. ;
  253. ; convert back to binary
  254. ;
  255. ;
  256. vrfy cmp #$20 ; test if verify
  257. beq vrf10
  258. ;
  259. jmp sectsk
  260. ;
  261. vrf10
  262. ;
  263. jsr chkblk ; get block checksum
  264. sta chksum
  265. ;
  266. jsr bingcr ; convert to verify image
  267. ;
  268. jsr dstrt
  269. ;
  270. ldy #256-topwrt
  271. vrf15 lda ovrbuf,y ; get char
  272. bvc *
  273. clv
  274. ;
  275. eor data2 ; test if same
  276. bne vrf20 ; verify error
  277. ;
  278. iny
  279. bne vrf15 ; next byte
  280. ;
  281. ;
  282. vrf30 lda (bufpnt),y ; now do buffer
  283. ;
  284. bvc *
  285. clv ; wait for char
  286. ;
  287. eor data2 ; test if same
  288. bne vrf20 ; error
  289. ;
  290. iny
  291. cpy #$fd ; dont test off bytes
  292. bne vrf30
  293. ;
  294. ;
  295. jmp done ; verify ok
  296. ;
  297. vrf20 lda #7 ; verify error
  298. jmp errr
  299. ;
  300. ;
  301. sectsk jsr srch ; sector seek
  302. jmp done
  303. ;
  304. ;
  305. ;.end