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.

lccbingcr.src 4.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. .page 'lcc.bingcr - fast'
  2. ; fast binary to gcr
  3. ;
  4. ;
  5. put4bg lda #0 ; clear table
  6. sta gtab+1
  7. sta gtab+4
  8. ;
  9. ldy gcrpnt
  10. ;
  11. lda btab
  12. and #$f0
  13. lsr a
  14. lsr a
  15. lsr a
  16. lsr a
  17. tax
  18. lda bgtab,x
  19. ;
  20. asl a
  21. asl a
  22. asl a
  23. sta gtab
  24. ;
  25. lda btab
  26. and #$0f
  27. tax
  28. lda bgtab,x
  29. ;
  30. ror a
  31. ror gtab+1
  32. ror a
  33. ror gtab+1
  34. ;
  35. and #$07
  36. ora gtab
  37. sta (bufpnt),y
  38. ;
  39. iny
  40. ;
  41. lda btab+1
  42. and #$f0
  43. lsr a
  44. lsr a
  45. lsr a
  46. lsr a
  47. tax
  48. lda bgtab,x
  49. ;
  50. asl a
  51. ora gtab+1
  52. sta gtab+1
  53. ;
  54. ;
  55. lda btab+1
  56. and #$0f
  57. tax
  58. lda bgtab,x
  59. ;
  60. rol a
  61. rol a
  62. rol a
  63. rol a
  64. sta gtab+2
  65. ;
  66. rol a
  67. and #1
  68. ora gtab+1
  69. sta (bufpnt),y
  70. ;
  71. iny
  72. ;
  73. lda btab+2
  74. and #$f0
  75. lsr a
  76. lsr a
  77. lsr a
  78. lsr a
  79. tax
  80. lda bgtab,x
  81. ;
  82. clc
  83. ror a
  84. ora gtab+2
  85. sta (bufpnt),y
  86. iny
  87. ;
  88. ror a
  89. and #$80
  90. sta gtab+3
  91. ;
  92. lda btab+2
  93. and #$0f
  94. tax
  95. lda bgtab,x
  96. asl a
  97. asl a
  98. and #$7c
  99. ora gtab+3
  100. sta gtab+3
  101. ;
  102. lda btab+3
  103. and #$f0
  104. lsr a
  105. lsr a
  106. lsr a
  107. lsr a
  108. tax
  109. lda bgtab,x
  110. ;
  111. ror a
  112. ror gtab+4
  113. ror a
  114. ror gtab+4
  115. ror a
  116. ror gtab+4
  117. ;
  118. and #$03
  119. ora gtab+3
  120. sta (bufpnt),y
  121. iny
  122. bne bing35
  123. ;
  124. lda savpnt+1
  125. sta bufpnt+1
  126. ;
  127. ;
  128. bing35 lda btab+3
  129. and #$0f
  130. tax
  131. lda bgtab,x
  132. ora gtab+4
  133. sta (bufpnt),y
  134. iny
  135. sty gcrpnt
  136. rts
  137. ;
  138. ;
  139. ;
  140. bgtab .byte $0a
  141. .byte $0b
  142. .byte $12
  143. .byte $13
  144. .byte $0e
  145. .byte $0f
  146. .byte $16
  147. .byte $17
  148. .byte $09
  149. .byte $19
  150. .byte $1a
  151. .byte $1b
  152. .byte $0d
  153. .byte $1d
  154. .byte $1e
  155. .byte $15
  156. ;
  157. ;
  158. ;
  159. ;******************************
  160. ;*
  161. ;*
  162. ;* binary to gcr conversion
  163. ;*
  164. ;*
  165. ;* does inplace conversion of
  166. ;* buffer to gcr using overflow
  167. ;* block
  168. ;*
  169. ;*
  170. ;* creates write image
  171. ;*
  172. ;* 1 block id char
  173. ;* 256 data bytes
  174. ;* 1 check sum
  175. ;* 2 off bytes
  176. ;* ---
  177. ;* 260 binary bytes
  178. ;*
  179. ;* 260 binary bytes >> 325 gcr
  180. ;*
  181. ;* 325 = 256 + 69 overflow
  182. ;*
  183. ;*
  184. ;********************************
  185. ;*
  186. bingcr lda #0 ; init pointers
  187. sta bufpnt
  188. sta savpnt
  189. sta bytcnt
  190. ;
  191. lda #256-topwrt
  192. sta gcrpnt ; start saving gcr here
  193. ;
  194. sta gcrflg ; buffer converted flag
  195. ;
  196. lda bufpnt+1 ; save buffer pointer
  197. sta savpnt+1
  198. ;
  199. lda #>ovrbuf ; point at overflow
  200. sta bufpnt+1
  201. ;
  202. lda dbid ; store data block id
  203. sta btab ; and next 3 data bytes
  204. ;
  205. ldy bytcnt
  206. ;
  207. lda (savpnt),y
  208. sta btab+1
  209. iny
  210. ;
  211. lda (savpnt),y
  212. sta btab+2
  213. iny
  214. ;
  215. lda (savpnt),y
  216. sta btab+3
  217. iny
  218. ;
  219. bing07 sty bytcnt ; next byte to get
  220. ;
  221. jsr put4bg ; convert and store
  222. ;
  223. ldy bytcnt
  224. ;
  225. lda (savpnt),y
  226. sta btab
  227. iny
  228. beq bing20
  229. ;
  230. lda (savpnt),y
  231. sta btab+1
  232. iny
  233. ;
  234. lda (savpnt),y
  235. sta btab+2
  236. iny
  237. ;
  238. lda (savpnt),y
  239. sta btab+3
  240. iny
  241. ;
  242. bne bing07 ; jmp
  243. ;
  244. ;
  245. bing20 lda chksum ; store chksum
  246. sta btab+1
  247. ;
  248. lda #0 ; store 0 off byte
  249. sta btab+2
  250. sta btab+3
  251. ;
  252. jmp put4bg ; convert and store and return
  253. ;
  254. ;
  255. ;
  256. ;.end