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.

306 lines
3.8KB

  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