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.

292 lines
3.3KB

  1. .PAGE 'GCRBIN.FAST'
  2. MASK1=$F8
  3. MASK2=$07
  4. MASK2X=$C0
  5. MASK3=$3E
  6. MASK4=$01
  7. MASK4X=$F0
  8. MASK5=$0F
  9. MASK5X=$80
  10. MASK6=$7C
  11. MASK7=$03
  12. MASK7X=$E0
  13. MASK8=$1F
  14. ;
  15. ;
  16. ;
  17. ;
  18. ;
  19. ; FAST GCR TO BINARY CONVERSION
  20. ;
  21. ;
  22. GET4GB LDY GCRPNT
  23. ;
  24. LDA (BUFPNT),Y
  25. AND #MASK1
  26. LSR A
  27. LSR A
  28. LSR A
  29. STA GTAB ; HI NIBBLE
  30. ;
  31. LDA (BUFPNT),Y
  32. AND #MASK2
  33. ASL A
  34. ASL A
  35. STA GTAB+1
  36. ;
  37. INY ; NEXT BYTE
  38. BNE XX05 ; TEST FOR NEXT BUFFER
  39. LDA NXTBF
  40. STA BUFPNT+1
  41. LDY NXTPNT
  42. ;
  43. XX05 LDA (BUFPNT),Y
  44. AND #MASK2X
  45. ROL A
  46. ROL A
  47. ROL A
  48. ORA GTAB+1
  49. STA GTAB+1
  50. ;
  51. LDA (BUFPNT),Y
  52. AND #MASK3
  53. LSR A
  54. STA GTAB+2
  55. ;
  56. LDA (BUFPNT),Y
  57. AND #MASK4
  58. ASL A
  59. ASL A
  60. ASL A
  61. ASL A
  62. STA GTAB+3
  63. ;
  64. INY ; NEXT
  65. ;
  66. LDA (BUFPNT),Y
  67. AND #MASK4X
  68. LSR A
  69. LSR A
  70. LSR A
  71. LSR A
  72. ORA GTAB+3
  73. STA GTAB+3
  74. ;
  75. LDA (BUFPNT),Y
  76. AND #MASK5
  77. ASL A
  78. STA GTAB+4
  79. ;
  80. INY ; NEXT BYTE
  81. ;
  82. LDA (BUFPNT),Y
  83. AND #MASK5X
  84. CLC
  85. ROL A
  86. ROL A
  87. AND #1
  88. ORA GTAB+4
  89. STA GTAB+4
  90. ;
  91. LDA (BUFPNT),Y
  92. AND #MASK6
  93. LSR A
  94. LSR A
  95. STA GTAB+5
  96. ;
  97. LDA (BUFPNT),Y
  98. AND #MASK7
  99. ASL A
  100. ASL A
  101. ASL A
  102. STA GTAB+6
  103. ;
  104. INY ; TEST FOR OVERFLOW DURING WRITE TO BINARY CONVERSION
  105. BNE XX06
  106. LDA NXTBF
  107. STA BUFPNT+1
  108. LDY NXTPNT
  109. ;
  110. XX06 LDA (BUFPNT),Y
  111. AND #MASK7X
  112. ROL A
  113. ROL A
  114. ROL A
  115. ROL A
  116. ORA GTAB+6
  117. STA GTAB+6
  118. ;
  119. LDA (BUFPNT),Y
  120. AND #MASK8
  121. STA GTAB+7
  122. INY
  123. ;
  124. STY GCRPNT
  125. ;
  126. ;
  127. LDX GTAB
  128. LDA GCRHI,X
  129. LDX GTAB+1
  130. ORA GCRLO,X
  131. STA BTAB
  132. ;
  133. LDX GTAB+2
  134. LDA GCRHI,X
  135. LDX GTAB+3
  136. ORA GCRLO,X
  137. STA BTAB+1
  138. ;
  139. LDX GTAB+4
  140. LDA GCRHI,X
  141. LDX GTAB+5
  142. ORA GCRLO,X
  143. STA BTAB+2
  144. ;
  145. LDX GTAB+6
  146. LDA GCRHI,X
  147. LDX GTAB+7
  148. ORA GCRLO,X
  149. STA BTAB+3
  150. ;
  151. RTS
  152. ;
  153. ;
  154. ;
  155. GCRHI .BYTE $FF ;ERROR
  156. .BYTE $FF ;ERROR
  157. .BYTE $FF ;ERROR
  158. .BYTE $FF ;ERROR
  159. .BYTE $FF ;ERROR
  160. .BYTE $FF ;ERROR
  161. .BYTE $FF ;ERROR
  162. .BYTE $FF ;ERROR
  163. .BYTE $FF ;ERROR
  164. .BYTE $80
  165. .BYTE $00
  166. .BYTE $10
  167. .BYTE $FF ;ERROR
  168. .BYTE $C0
  169. .BYTE $40
  170. .BYTE $50
  171. .BYTE $FF ;ERROR
  172. .BYTE $FF ;ERROR
  173. .BYTE $20
  174. .BYTE $30
  175. .BYTE $FF ;ERROR
  176. .BYTE $F0
  177. .BYTE $60
  178. .BYTE $70
  179. .BYTE $FF ;ERROR
  180. .BYTE $90
  181. .BYTE $A0
  182. .BYTE $B0
  183. .BYTE $FF ;ERROR
  184. .BYTE $D0
  185. .BYTE $E0
  186. .BYTE $FF ;ERROR
  187. ;
  188. ;
  189. ;
  190. GCRLO .BYTE $FF ;ERROR
  191. .BYTE $FF ;ERROR
  192. .BYTE $FF ;ERROR
  193. .BYTE $FF ;ERROR
  194. .BYTE $FF ;ERROR
  195. .BYTE $FF ;ERROR
  196. .BYTE $FF ;ERROR
  197. .BYTE $FF ;ERROR
  198. .BYTE $FF ;ERROR
  199. .BYTE 8
  200. .BYTE $00
  201. .BYTE 1
  202. .BYTE $FF ;ERROR
  203. .BYTE $C
  204. .BYTE 4
  205. .BYTE 5
  206. .BYTE $FF ;ERROR
  207. .BYTE $FF ;ERROR
  208. .BYTE 2
  209. .BYTE 3
  210. .BYTE $FF ;ERROR
  211. .BYTE $F
  212. .BYTE 6
  213. .BYTE 7
  214. .BYTE $FF ;ERROR
  215. .BYTE 9
  216. .BYTE $A
  217. .BYTE $B
  218. .BYTE $FF ;ERROR
  219. .BYTE $D
  220. .BYTE $E
  221. .BYTE $FF ;ERROR
  222. ;
  223. ;
  224. GCRBIN LDA #0 ; SETUP POINTERS
  225. STA GCRPNT
  226. STA SAVPNT
  227. STA BYTCNT
  228. ;
  229. LDA #>OVRBUF
  230. STA NXTBF
  231. ;
  232. LDA #255-TOPRD
  233. STA NXTPNT
  234. ;
  235. LDA BUFPNT+1
  236. STA SAVPNT+1
  237. ;
  238. JSR GET4GB
  239. ;
  240. LDA BTAB
  241. STA BID ; GET HEADER ID
  242. ;
  243. LDY BYTCNT
  244. LDA BTAB+1
  245. STA (SAVPNT),Y
  246. INY
  247. ;
  248. LDA BTAB+2
  249. STA (SAVPNT),Y
  250. INY
  251. ;
  252. LDA BTAB+3
  253. STA (SAVPNT),Y
  254. INY
  255. ;
  256. GCRB10 STY BYTCNT
  257. ;
  258. JSR GET4GB
  259. ;
  260. LDY BYTCNT
  261. ;
  262. LDA BTAB
  263. STA (SAVPNT),Y
  264. INY
  265. BEQ GCRB20 ; TEST IF DONE YET
  266. ;
  267. LDA BTAB+1
  268. STA (SAVPNT),Y
  269. INY
  270. ;
  271. LDA BTAB+2
  272. STA (SAVPNT),Y
  273. INY
  274. ;
  275. LDA BTAB+3
  276. STA (SAVPNT),Y
  277. INY
  278. ;
  279. BNE GCRB10 ; JMP
  280. ;
  281. GCRB20
  282. LDA BTAB+1
  283. STA CHKSUM
  284. LDA SAVPNT+1 ;RESTORE BUFFER POINTER
  285. STA BUFPNT+1
  286. ;
  287. RTS
  288. ;
  289. ;
  290. ;
  291. .END