SDL_ataric2p.S
上传用户:sun1608
上传日期:2007-02-02
资源大小:6116k
文件大小:6k
源码类别:

流媒体/Mpeg4/MP4

开发平台:

Visual C++

  1. /*
  2.     SDL - Simple DirectMedia Layer
  3.     Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002  Sam Lantinga
  4.     This library is free software; you can redistribute it and/or
  5.     modify it under the terms of the GNU Library General Public
  6.     License as published by the Free Software Foundation; either
  7.     version 2 of the License, or (at your option) any later version.
  8.     This library is distributed in the hope that it will be useful,
  9.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  11.     Library General Public License for more details.
  12.     You should have received a copy of the GNU Library General Public
  13.     License along with this library; if not, write to the Free
  14.     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  15.     Sam Lantinga
  16.     slouken@libsdl.org
  17. */
  18. #ifdef SAVE_RCSID
  19. static char rcsid =
  20.  "@(#) $Id: SDL_ataric2p.S,v 1.1 2002/04/22 21:38:04 wmay Exp $";
  21. #endif
  22. /*
  23.  * Chunky to planar conversion routine
  24.  * 1 byte/pixel -> 4 or 8 bit planes
  25.  *
  26.  * Patrice Mandin
  27.  * Xavier Joubert
  28.  */
  29. /* ------------ Function pointers ------------ */
  30. .globl _Atari_C2pInit
  31. .globl _Atari_C2pConvert
  32. .data
  33. .even
  34. .comm _Atari_C2pInit,4
  35. .comm _Atari_C2pConvert,4
  36. /* ------------ Conversion Table C2P ------------ */
  37. .globl _Atari_table_c2p
  38. .data
  39. .comm _Atari_table_c2p,2048
  40. /* ------------ Init table C2P, 8 bits ------------ */
  41. .globl _Atari_C2pInit8
  42. .text
  43. _Atari_C2pInit8:
  44. movel d2,sp@-
  45. lea _Atari_table_c2p,a0
  46. movew #255,d0
  47. c2p_initbcl:
  48. #if defined (__M68020__)
  49. lea a0@(0,d0:w:8),a1
  50. #else
  51. movew d0,d2
  52. lslw #3,d2
  53. lea a0@(0,d2:w),a1
  54. #endif
  55. moveq #7,d1
  56. c2p_initbyte:
  57. btst d1,d0
  58. sne d2
  59. negw d2
  60. moveb d2,a1@(0,d1:w)
  61. dbra d1,c2p_initbyte
  62. dbra d0,c2p_initbcl
  63. movel sp@+,d2
  64. rts
  65. /* ------------ Conversion C2P, 8 bits ------------ */
  66. .globl _Atari_C2pConvert8
  67. .text
  68. _Atari_C2pConvert8:
  69. movel sp@(4),c2p_source
  70. movel sp@(8),c2p_dest
  71. movel sp@(12),c2p_width
  72. movel sp@(16),c2p_height
  73. movel sp@(20),c2p_dblligne
  74. movel sp@(24),c2p_srcpitch
  75. movel sp@(28),c2p_dstpitch
  76. moveml d2-d7/a2-a6,sp@-
  77. movel c2p_source,a0
  78. movel c2p_dest,a1
  79. lea _Atari_table_c2p,a2
  80. movel #0x000f0001,d3
  81. #if defined(__M68020__)
  82. moveq #0,d0
  83. #endif
  84. movel c2p_height,d7
  85. subql #1,d7
  86. c2p8_bcly:
  87. movel a0,a4 | Save start address of source
  88. movel a1,a5 | Save start address of dest
  89. | Conversion
  90.                  
  91. movel c2p_width,d6
  92. lsrw #4,d6
  93. subql #1,d6
  94. c2p8_bclx:
  95. | Octets 0-7
  96. moveq #0,d1
  97. moveq #0,d2
  98. moveq #7,d5
  99. c2p8_bcl07:
  100. #if defined(__M68020__)
  101. moveb a0@+,d0
  102. lea a2@(0,d0:w:8),a3
  103. #else
  104. moveq #0,d0
  105. moveb a0@+,d0
  106. lslw #3,d0
  107. lea a2@(0,d0:w),a3
  108. #endif
  109. lsll #1,d1
  110. lsll #1,d2
  111. orl a3@+,d1
  112. orl a3@,d2
  113. dbra d5,c2p8_bcl07
  114. movepl d1,a1@(0)
  115. movepl d2,a1@(8)
  116. addw d3,a1
  117. swap d3
  118. | Octets 8-15
  119. moveq #0,d1
  120. moveq #0,d2
  121. moveq #7,d5
  122. c2p8_bcl815:
  123. #if defined(__M68020__)
  124. moveb a0@+,d0
  125. lea a2@(0,d0:w:8),a3
  126. #else
  127. moveq #0,d0
  128. moveb a0@+,d0
  129. lslw #3,d0
  130. lea a2@(0,d0:w),a3
  131. #endif
  132. lsll #1,d1
  133. lsll #1,d2
  134. orl a3@+,d1
  135. orl a3@,d2
  136. dbra d5,c2p8_bcl815
  137. movepl d1,a1@(0)
  138. movepl d2,a1@(8)
  139. addw d3,a1
  140. swap d3
  141. dbra d6,c2p8_bclx
  142. | Double line ?
  143. tstl c2p_dblligne
  144. beq c2p8_nodblligne
  145. movel a5,a6 | src line
  146. movel a5,a1 | dest line
  147. addl c2p_dstpitch,a1
  148. movel c2p_width,d6
  149. lsrw #2,d6
  150. subql #1,d6
  151. c2p8_copydbl:
  152. movel a6@+,a1@+
  153. dbra d6,c2p8_copydbl
  154. addl c2p_dstpitch,a5
  155. c2p8_nodblligne:
  156. | Next line
  157. movel a4,a0
  158. addl c2p_srcpitch,a0
  159. movel a5,a1
  160. addl c2p_dstpitch,a1
  161. dbra d7,c2p8_bcly
  162. moveml sp@+,d2-d7/a2-a6
  163. rts
  164. /* ------------ Init table C2P, 4 bits ------------ */
  165. .globl _Atari_C2pInit4
  166. .text
  167. _Atari_C2pInit4:
  168. /* Nothing to do */
  169. /* work is done in convert_c2p_pal */
  170. rts
  171. /* ------------ Conversion C2P, 4 bits ------------ */
  172. .globl _Atari_C2pConvert4
  173. .text
  174. _Atari_C2pConvert4:
  175. movel sp@(4),c2p_source
  176. movel sp@(8),c2p_dest
  177. movel sp@(12),c2p_width
  178. movel sp@(16),c2p_height
  179. movel sp@(20),c2p_dblligne
  180. movel sp@(24),c2p_srcpitch
  181. movel sp@(28),c2p_dstpitch
  182. moveml d2-d7/a2-a6,sp@-
  183. movel c2p_source,a0
  184. movel c2p_dest,a1
  185. lea _Atari_table_c2p,a2
  186. movel #0x00070001,d3
  187. #if defined(__M68020__)
  188. moveq #0,d0
  189. #endif
  190. movel c2p_height,d7
  191. subql #1,d7
  192. c2p4_bcly:
  193. movel a0,a4 | Save start address of source
  194. movel a1,a5 | Save start address of dest
  195. | Conversion
  196.                  
  197. movel c2p_width,d6
  198. lsrw #4,d6
  199. subql #1,d6
  200. c2p4_bclx:
  201. | Octets 0-7
  202. moveq #0,d1
  203. moveq #7,d5
  204. c2p4_bcl07:
  205. #if defined(__M68020__)
  206. moveb a0@+,d0
  207. lea a2@(0,d0:w:4),a3
  208. #else
  209. moveq #0,d0
  210. moveb a0@+,d0
  211. lslw #2,d0
  212. lea a2@(0,d0:w),a3
  213. #endif
  214. lsll #1,d1
  215. orl a3@,d1
  216. dbra d5,c2p4_bcl07
  217. movepl d1,a1@(0)
  218. addw d3,a1
  219. swap d3
  220. | Octets 8-15
  221. moveq #0,d1
  222. moveq #7,d5
  223. c2p4_bcl815:
  224. #if defined(__M68020__)
  225. moveb a0@+,d0
  226. lea a2@(0,d0:w:4),a3
  227. #else
  228. moveq #0,d0
  229. moveb a0@+,d0
  230. lslw #2,d0
  231. lea a2@(0,d0:w),a3
  232. #endif
  233. lsll #1,d1
  234. orl a3@,d1
  235. dbra d5,c2p4_bcl815
  236. movepl d1,a1@(0)
  237. addw d3,a1
  238. swap d3
  239. dbra d6,c2p4_bclx
  240. | Double line ?
  241. tstl c2p_dblligne
  242. beq c2p4_nodblligne
  243. movel a5,a6 | src line
  244. movel a5,a1 | dest line
  245. addl c2p_dstpitch,a1
  246. movel c2p_width,d6
  247. lsrw #3,d6
  248. subql #1,d6
  249. c2p4_copydbl:
  250. movel a6@+,a1@+
  251. dbra d6,c2p4_copydbl
  252. addl c2p_dstpitch,a5
  253. c2p4_nodblligne:
  254. | Next line
  255. movel a4,a0
  256. addl c2p_srcpitch,a0
  257. movel a5,a1
  258. addl c2p_dstpitch,a1
  259. dbra d7,c2p4_bcly
  260. moveml sp@+,d2-d7/a2-a6
  261. rts
  262. * ------------ Conversion of a light palette in 4 bits ------------ */
  263. .globl _Atari_C2pConvert4_pal
  264. .text
  265. _Atari_C2pConvert4_pal:
  266. /* a0 is a 256-word light palette */
  267. movel sp@(4),a0
  268. moveml d2-d3,sp@-
  269. lea _Atari_table_c2p,a1
  270. movew #255,d3
  271. c2p_pal_initbcl:
  272. movew a0@+,d0
  273. lsrw #4,d0
  274. and #15,d0
  275. moveq #3,d1
  276. c2p_pal_initbyte:
  277. btst d1,d0
  278. sne d2
  279. negw d2
  280. moveb d2,a1@(0,d1:w)
  281. dbra d1,c2p_pal_initbyte
  282. addql #4,a1
  283. dbra d3,c2p_pal_initbcl
  284. moveml sp@+,d2-d3
  285. rts
  286. /* ------------ Buffers ------------ */
  287. .data
  288. .even
  289. .comm c2p_source,4
  290. .comm c2p_dest,4
  291. .comm c2p_width,4
  292. .comm c2p_height,4
  293. .comm c2p_dblligne,4
  294. .comm c2p_srcpitch,4
  295. .comm c2p_dstpitch,4