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.

lccfmt2.src 5.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. .page 'lcc.fmt2'
  2. ;
  3. ;
  4. ;
  5. ds08 lda #$66 ; min block size 282*5/4 -256=85
  6. sta dtrck
  7. ;
  8. ldx sectr ; total bytes= min*#secors
  9. ldy #0
  10. tya
  11. ;
  12. ds10 clc ; min*#sectors
  13. adc dtrck
  14. bcc ds14
  15. ;
  16. iny ;
  17. ;
  18. ds14 iny
  19. dex
  20. bne ds10
  21. ;
  22. eor #$ff ; get 2s comp
  23. sec
  24. adc #0
  25. ;
  26. clc
  27. adc tral+1
  28. bcs ds15
  29. ;
  30. dec tral
  31. ;
  32. ds15 tax
  33. tya
  34. eor #$ff
  35. sec
  36. adc #0
  37. clc
  38. adc tral
  39. ;
  40. bpl ds17
  41. ;
  42. lda #tobig ; not enough space
  43. jmp fmterr
  44. ;
  45. ds17 tay
  46. txa
  47. ldx #0
  48. ;
  49. ds20 sec
  50. sbc sectr
  51. bcs ds22
  52. ;
  53. dey
  54. bmi ds30
  55. ;
  56. ds22 inx
  57. bne ds20
  58. ;
  59. ds30 stx dtrck
  60. ;-----rom05-bc---09/12/84------
  61. cpx #gap2 ; test for min size
  62. ;------------------------------
  63. bcs ds32
  64. ;
  65. lda #tosmal ; gap2 to small
  66. jmp fmterr
  67. ;
  68. ds32 clc
  69. adc sectr
  70. sta remdr ; get remaider size
  71. ;
  72. ;
  73. ;
  74. ;
  75. ;
  76. ; create header images
  77. ;
  78. ;
  79. lda #0
  80. sta sect
  81. ;
  82. ldy #0
  83. ldx drive
  84. ;
  85. mak10 lda hbid ; hbid cs s t id id 0f 0f
  86. sta buff0,y
  87. iny
  88. ;
  89. iny ; skip checksum
  90. ;
  91. lda sect ; store sector #
  92. sta buff0,y
  93. iny
  94. ;
  95. lda ftnum ; store track #
  96. sta buff0,y
  97. iny
  98. ;
  99. lda dskid+1,x ; store id low
  100. sta buff0,y
  101. iny
  102. ;
  103. lda dskid,x ; store id hi
  104. sta buff0,y
  105. iny
  106. ;
  107. lda #$0f ; store gap1 bytes
  108. sta buff0,y
  109. iny
  110. sta buff0,y
  111. iny
  112. ;
  113. lda #0 ; create checksum
  114. eor buff0-6,y
  115. eor buff0-5,y
  116. eor buff0-4,y
  117. eor buff0-3,y
  118. ;
  119. sta buff0-7,y ; store checksum
  120. ;
  121. ;
  122. inc sect ; goto next sector
  123. ;
  124. lda sect ; test if done yet
  125. cmp sectr
  126. bcc mak10 ; more to do
  127. ;
  128. tya ; save block size
  129. pha
  130. ;
  131. ;
  132. ;
  133. ;
  134. ; create data block of zero
  135. ;
  136. inx ; .x=0
  137. txa
  138. ;
  139. crtdat sta buff2,x
  140. inx
  141. bne crtdat
  142. ;
  143. ;
  144. ; convert header block to gcr
  145. ;
  146. lda #>buff0
  147. sta bufpnt+1 ; point at buffer
  148. ;
  149. jsr fbtog ; convert to gcr with no bid char
  150. ;
  151. pla ; restore block size
  152. tay ; move buffer up 79 bytes
  153. dey ; for i=n-1 to 0:mem{i+69}:=mem{i}:next
  154. jsr movup ; move buf0 up 69 bytes
  155. ;
  156. jsr movovr ; move ovrbuf up to buffer
  157. ;
  158. ;
  159. ;
  160. ; convert data block to gcr
  161. ; write image
  162. ;
  163. ; leave it in ovrbuf and buffer
  164. ;
  165. ;
  166. lda #>buff2 ; point at buffer
  167. sta bufpnt+1
  168. ;
  169. ;
  170. jsr chkblk ; get block checksum
  171. sta chksum
  172. jsr bingcr
  173. ;
  174. ;
  175. ;
  176. ; start the format now
  177. ;
  178. ; write out sync header gap1
  179. ; data block
  180. ;
  181. ;
  182. ;
  183. lda #0 ; init counter
  184. sta hdrpnt
  185. ;
  186. ;<><><><><><><><><><><><><><><><><><><><><><><><><><><><>
  187. jsr jclear ; *rom ds 09/05/85*, clear disk
  188. ; jsr clear
  189. ;<><><><><><><><><><><><><><><><><><><><><><><><><><><><>
  190. ;
  191. wrtsyn lda #$ff ; write sync
  192. sta data2
  193. ;
  194. ldx #numsyn ; write 4 sync
  195. ;
  196. wrts10 bvc *
  197. clv
  198. ;
  199. dex
  200. bne wrts10
  201. ;
  202. ldx #10 ; write out header
  203. ldy hdrpnt
  204. ;
  205. wrts20 bvc *
  206. clv
  207. ;
  208. lda buff0,y ; get header data
  209. sta data2
  210. ;
  211. iny
  212. dex
  213. bne wrts20
  214. ;
  215. ;
  216. ; * write out gap1
  217. ;
  218. ldx #gap1-2 ; write gcr bytes
  219. ;
  220. wrts30 bvc *
  221. clv
  222. ;
  223. lda #$55
  224. sta data2
  225. ;
  226. dex
  227. bne wrts30
  228. ;
  229. ;
  230. ;
  231. ; * write out data block
  232. ;
  233. lda #$ff ; write data block sync
  234. ;
  235. ldx #numsyn
  236. ;
  237. dbsync bvc *
  238. clv
  239. ;
  240. sta data2
  241. ;
  242. dex
  243. bne dbsync
  244. ;
  245. ldx #256-topwrt ; write out ovrbuf
  246. ;
  247. wrts40 bvc *
  248. clv
  249. ;
  250. lda ovrbuf,x
  251. sta data2
  252. ;
  253. inx
  254. bne wrts40
  255. ;
  256. ;
  257. ldy #0
  258. ;
  259. wrts50 bvc *
  260. clv
  261. ;
  262. lda (bufpnt),y
  263. sta data2
  264. ;
  265. iny
  266. bne wrts50
  267. ;
  268. lda #$55 ; write gap2(dtrck)
  269. ldx dtrck
  270. ;
  271. wgp2 bvc *
  272. clv
  273. ;
  274. sta data2
  275. dex
  276. bne wgp2
  277. ;
  278. ; ldx #20 ; write erase trail gap
  279. ;wgp3 bvc *
  280. ; clv
  281. ; dex
  282. ; bne wgp3
  283. ;
  284. lda hdrpnt ; advance header pointer
  285. clc
  286. adc #10
  287. sta hdrpnt
  288. ;
  289. ;
  290. ;
  291. ; done writing sector
  292. ;
  293. dec sect ; go to next on
  294. bne wrtsyn ; more to do
  295. ;
  296. bvc * ; wait for last one to write
  297. clv
  298. ;
  299. bvc *
  300. clv
  301. ;
  302. jsr kill ; goto read mode
  303. ;
  304. ;
  305. ;
  306. ;.end