New C2P conversion routine
authorPatrice Mandin <patmandin@gmail.com>
Wed, 12 Nov 2003 18:45:48 +0000
changeset 7340310bb01091f
parent 733 9557ac1857a3
child 735 abec2a842d11
New C2P conversion routine
src/video/ataricommon/Makefile.am
src/video/ataricommon/SDL_ataric2p.S
src/video/ataricommon/SDL_ataric2p060.c
src/video/ataricommon/SDL_ataric2p060_c.h
src/video/ataricommon/SDL_ataric2p_s.h
     1.1 --- a/src/video/ataricommon/Makefile.am	Wed Nov 05 23:11:05 2003 +0000
     1.2 +++ b/src/video/ataricommon/Makefile.am	Wed Nov 12 18:45:48 2003 +0000
     1.3 @@ -8,8 +8,6 @@
     1.4  ATARICOMMON_SRCS = 	\
     1.5  	SDL_ataric2p.S	\
     1.6  	SDL_ataric2p_s.h	\
     1.7 -	SDL_ataric2p060.c	\
     1.8 -	SDL_ataric2p060_c.h	\
     1.9  	SDL_atarieddi.S	\
    1.10  	SDL_atarieddi_s.h	\
    1.11  	SDL_atarievents.c	\
     2.1 --- a/src/video/ataricommon/SDL_ataric2p.S	Wed Nov 05 23:11:05 2003 +0000
     2.2 +++ b/src/video/ataricommon/SDL_ataric2p.S	Wed Nov 12 18:45:48 2003 +0000
     2.3 @@ -26,70 +26,274 @@
     2.4  #endif
     2.5  
     2.6  /*
     2.7 - *	Chunky to planar conversion routine
     2.8 - *	1 byte/pixel -> 4 or 8 bit planes
     2.9 - *
    2.10 - *	Patrice Mandin
    2.11 - *	Xavier Joubert
    2.12 - */
    2.13 +	Chunky to planar conversion routine
    2.14 +	1 byte/pixel -> 4 or 8 bit planes
    2.15  
    2.16 -/* ------------	Function pointers ------------ */
    2.17 +	Patrice Mandin
    2.18 +	Xavier Joubert
    2.19 +	Mikael Kalms
    2.20 +*/
    2.21  
    2.22 -	.globl	_Atari_C2pInit
    2.23 -	.globl	_Atari_C2pConvert
    2.24 -
    2.25 -	.data
    2.26 -
    2.27 -	.even
    2.28 -	.comm	_Atari_C2pInit,4
    2.29 -	.comm	_Atari_C2pConvert,4
    2.30 -
    2.31 -/* ------------	Conversion Table C2P ------------ */
    2.32 -
    2.33 -	.globl	_Atari_table_c2p
    2.34 -
    2.35 -	.data
    2.36 -
    2.37 -	.comm	_Atari_table_c2p,2048
    2.38 -
    2.39 -/* ------------	Init table C2P, 8 bits ------------ */
    2.40 -
    2.41 -	.globl	_Atari_C2pInit8
    2.42 -
    2.43 -	.text
    2.44 -_Atari_C2pInit8:
    2.45 -	movel	d2,sp@-
    2.46 -
    2.47 -	lea	_Atari_table_c2p,a0
    2.48 -	movew	#255,d0
    2.49 -c2p_initbcl:
    2.50 -#if defined (__M68020__)
    2.51 -	lea	a0@(0,d0:w:8),a1
    2.52 -#else
    2.53 -	movew	d0,d2
    2.54 -	lslw	#3,d2
    2.55 -	lea	a0@(0,d2:w),a1
    2.56 -#endif
    2.57 -	moveq	#7,d1
    2.58 -c2p_initbyte:
    2.59 -	btst	d1,d0
    2.60 -	sne	d2
    2.61 -	negw	d2
    2.62 -	moveb	d2,a1@(0,d1:w)
    2.63 -
    2.64 -	dbra	d1,c2p_initbyte
    2.65 -
    2.66 -	dbra	d0,c2p_initbcl
    2.67 -
    2.68 -	movel	sp@+,d2
    2.69 -	rts
    2.70 +	.globl	_SDL_Atari_C2pConvert
    2.71 +	.globl	_SDL_Atari_C2pConvert8
    2.72 +	.globl	_SDL_Atari_C2pConvert4
    2.73 +	.globl	_SDL_Atari_C2pConvert4_pal
    2.74 +	.globl	_SDL_Atari_table_c2p
    2.75  
    2.76  /* ------------	Conversion C2P, 8 bits ------------ */
    2.77  
    2.78 -	.globl	_Atari_C2pConvert8
    2.79 +	.text
    2.80 +_SDL_Atari_C2pConvert8:
    2.81 +	movel	sp@(4),c2p_source
    2.82 +	movel	sp@(8),c2p_dest
    2.83 +	movel	sp@(12),c2p_width
    2.84 +	movel	sp@(16),c2p_height
    2.85 +	movel	sp@(20),c2p_dblligne
    2.86 +	movel	sp@(24),c2p_srcpitch
    2.87 +	movel	sp@(28),c2p_dstpitch
    2.88  
    2.89 -	.text
    2.90 -_Atari_C2pConvert8:
    2.91 +	moveml	d2-d7/a2-a6,sp@-
    2.92 +
    2.93 +	movel	c2p_source,c2p_cursrc
    2.94 +	movel	c2p_dest,c2p_curdst
    2.95 +	movel	#0x0f0f0f0f,d4
    2.96 +	movel	#0x00ff00ff,d5
    2.97 +	movel	#0x55555555,d6
    2.98 +	movew	c2p_height+2,c2p_row
    2.99 +	movew	c2p_width+2,d0
   2.100 +	andw	#-8,d0
   2.101 +	movew	d0,c2p_rowlen
   2.102 +
   2.103 +SDL_Atari_C2p8_rowloop:
   2.104 +
   2.105 +	movel	c2p_cursrc,a0
   2.106 +	movel	c2p_curdst,a1
   2.107 +
   2.108 +	movel	a0,a2
   2.109 +	addw	c2p_rowlen,a2
   2.110 +
   2.111 +	movel	a0@+,d0
   2.112 +	movel	a0@+,d1
   2.113 +	movel	a0@+,d2
   2.114 +	movel	a0@+,d3
   2.115 +/*
   2.116 +	d0 = a7a6a5a4a3a2a1a0 b7b6b5b4b3b2b1b0 c7c6c5c4c3c2c1c0 d7d6d5d4d3d2d1d0
   2.117 +	d1 = e7e6e5e4e3e2e1e0 f7f6f5f4f3f2f1f0 g7g6g5g4g3g2g1g0 h7h6h5h4h3h2h1h0
   2.118 +	d2 = i7i6i5i4i3i2i1i0 j7j6j5j4j3j2j1j0 k7k6k5k4k3k2k1k0 l7l6l5l4l3l2l1l0
   2.119 +	d3 = m7m6m5m4m3m2m1m0 n7n6n5n4n3n2n1n0 o7o6o5o4o3o2o1o0 p7p6p5p4p3p2p1p0
   2.120 +*/
   2.121 +	movel	d1,d7
   2.122 +	lsrl	#4,d7
   2.123 +	eorl	d0,d7
   2.124 +	andl	d4,d7
   2.125 +	eorl	d7,d0
   2.126 +	lsll	#4,d7
   2.127 +	eorl	d7,d1
   2.128 +
   2.129 +	movel	d3,d7
   2.130 +	lsrl	#4,d7
   2.131 +	eorl	d2,d7
   2.132 +	andl	d4,d7
   2.133 +	eorl	d7,d2
   2.134 +	lsll	#4,d7
   2.135 +	eorl	d7,d3
   2.136 +
   2.137 +	movel	d2,d7
   2.138 +	lsrl	#8,d7
   2.139 +	eorl	d0,d7
   2.140 + 	andl	d5,d7
   2.141 +	eorl	d7,d0
   2.142 +	lsll	#8,d7
   2.143 +	eorl	d7,d2
   2.144 +
   2.145 +	movel	d3,d7
   2.146 +	lsrl	#8,d7
   2.147 +	eorl	d1,d7
   2.148 + 	andl	d5,d7
   2.149 +	eorl	d7,d1
   2.150 +	lsll	#8,d7
   2.151 +	eorl	d7,d3
   2.152 +/*
   2.153 +	d0 = a7a6a5a4e7e6e5e4 i7i6i5i4m7m6m5m4 c7c6c5c4g7g6g5g4 k7k6k5k4o7o6o5o4
   2.154 +	d1 = a3a2a1a0e3e2e1e0 i3i2i1i0m3m2m1m0 c3c2c1c0g3g2g1g0 k3k2k1k0o3o2o1o0
   2.155 +	d2 = b7b6b5b4f7f6f5f4 j7j6j5j4n7n6n5n4 d7d6d5d4h7h6h5h4 l7l6l5l4p7p6p5p4
   2.156 +	d3 = b3b2b1b0f3f2f1f0 j3j2j1j0n3n2n1n0 d3d2d1d0h3h2h1h0 l3l2l1l0p3p2p1p0
   2.157 +*/
   2.158 +	bras	SDL_Atari_C2p8_start
   2.159 +
   2.160 +SDL_Atari_C2p8_pix16:
   2.161 +
   2.162 +	movel	a0@+,d0
   2.163 +	movel	a0@+,d1
   2.164 +	movel	a0@+,d2
   2.165 +	movel	a0@+,d3
   2.166 +/*
   2.167 +	d0 = a7a6a5a4a3a2a1a0 b7b6b5b4b3b2b1b0 c7c6c5c4c3c2c1c0 d7d6d5d4d3d2d1d0
   2.168 +	d1 = e7e6e5e4e3e2e1e0 f7f6f5f4f3f2f1f0 g7g6g5g4g3g2g1g0 h7h6h5h4h3h2h1h0
   2.169 +	d2 = i7i6i5i4i3i2i1i0 j7j6j5j4j3j2j1j0 k7k6k5k4k3k2k1k0 l7l6l5l4l3l2l1l0
   2.170 +	d3 = m7m6m5m4m3m2m1m0 n7n6n5n4n3n2n1n0 o7o6o5o4o3o2o1o0 p7p6p5p4p3p2p1p0
   2.171 +*/
   2.172 +	movel	d1,d7
   2.173 +	lsrl	#4,d7
   2.174 +	movel	a3,a1@+
   2.175 +	eorl	d0,d7
   2.176 +	andl	d4,d7
   2.177 +	eorl	d7,d0
   2.178 +	lsll	#4,d7
   2.179 +	eorl	d7,d1
   2.180 +
   2.181 +	movel	d3,d7
   2.182 +	lsrl	#4,d7
   2.183 +	eorl	d2,d7
   2.184 +	andl	d4,d7
   2.185 +	eorl	d7,d2
   2.186 +	movel	a4,a1@+
   2.187 +	lsll	#4,d7
   2.188 +	eorl	d7,d3
   2.189 +
   2.190 +	movel	d2,d7
   2.191 +	lsrl	#8,d7
   2.192 +	eorl	d0,d7
   2.193 +	andl	d5,d7
   2.194 +	eorl	d7,d0
   2.195 +	movel	a5,a1@+
   2.196 +	lsll	#8,d7
   2.197 +	eorl	d7,d2
   2.198 +
   2.199 +	movel	d3,d7
   2.200 +	lsrl	#8,d7
   2.201 +	eorl	d1,d7
   2.202 +	andl	d5,d7
   2.203 +	eorl	d7,d1
   2.204 +	movel	a6,a1@+
   2.205 +	lsll	#8,d7
   2.206 +	eorl	d7,d3
   2.207 +/*
   2.208 +	d0 = a7a6a5a4e7e6e5e4 i7i6i5i4m7m6m5m4 c7c6c5c4g7g6g5g4 k7k6k5k4o7o6o5o4
   2.209 +	d1 = a3a2a1a0e3e2e1e0 i3i2i1i0m3m2m1m0 c3c2c1c0g3g2g1g0 k3k2k1k0o3o2o1o0
   2.210 +	d2 = b7b6b5b4f7f6f5f4 j7j6j5j4n7n6n5n4 d7d6d5d4h7h6h5h4 l7l6l5l4p7p6p5p4
   2.211 +	d3 = b3b2b1b0f3f2f1f0 j3j2j1j0n3n2n1n0 d3d2d1d0h3h2h1h0 l3l2l1l0p3p2p1p0
   2.212 +*/
   2.213 +
   2.214 +SDL_Atari_C2p8_start:
   2.215 +
   2.216 +	movel	d2,d7
   2.217 +	lsrl	#1,d7
   2.218 +	eorl	d0,d7
   2.219 +	andl	d6,d7
   2.220 +	eorl	d7,d0
   2.221 +	addl	d7,d7
   2.222 +	eorl	d7,d2
   2.223 +
   2.224 +	movel	d3,d7
   2.225 +	lsrl	#1,d7
   2.226 +	eorl	d1,d7
   2.227 +	andl	d6,d7
   2.228 +	eorl	d7,d1
   2.229 +	addl	d7,d7
   2.230 +	eorl	d7,d3
   2.231 +/*
   2.232 +	d0 = a7b7a5b5e7f7e5f5 i7j7i5j5m7n7m5n5 c7d7c5d5g7h7g5h5 k7l7k5l5o7p7o5p5
   2.233 +	d1 = a3b3a1b1e3f3e1f1 i3j3i1j1m3n3m1n1 c3d3c1d1g3h3g1h1 k3l3k1l1o3p3o1p1
   2.234 +	d2 = a6b6a4b4e6f6e4f4 i6j6i4j4m6n6m4n4 c6d6c4d4g6h6g4h4 k6l6k4l4o6p6o4p4
   2.235 +	d3 = a2b2a0b0e2f2e0f0 i2j2i0j0m2n2m0n0 c2d2c0d0g2h2g0h0 k2l2k0l0o2p2o0p0
   2.236 +*/
   2.237 +	movew	d2,d7
   2.238 +	movew	d0,d2
   2.239 +	swap	d2
   2.240 +	movew	d2,d0
   2.241 +	movew	d7,d2
   2.242 +
   2.243 +	movew	d3,d7
   2.244 +	movew	d1,d3
   2.245 +	swap	d3
   2.246 +	movew	d3,d1
   2.247 +	movew	d7,d3
   2.248 +/*
   2.249 +	d0 = a7b7a5b5e7f7e5f5 i7j7i5j5m7n7m5n5 a6b6a4b4e6f6e4f4 i6j6i4j4m6n6m4n4
   2.250 +	d1 = a3b3a1b1e3f3e1f1 i3j3i1j1m3n3m1n1 a2b2a0b0e2f2e0f0 i2j2i0j0m2n2m0n0
   2.251 +	d2 = c7d7c5d5g7h7g5h5 k7l7k5l5o7p7o5p5 c6d6c4d4g6h6g4h4 k6l6k4l4o6p6o4p4
   2.252 +	d3 = c3d3c1d1g3h3g1h1 k3l3k1l1o3p3o1p1 c2d2c0d0g2h2g0h0 k2l2k0l0o2p2o0p0
   2.253 +*/
   2.254 +	movel	d2,d7
   2.255 +	lsrl	#2,d7
   2.256 +	eorl	d0,d7
   2.257 +	andl	#0x33333333,d7
   2.258 +	eorl	d7,d0
   2.259 +	lsll	#2,d7
   2.260 +	eorl	d7,d2
   2.261 +
   2.262 +	movel	d3,d7
   2.263 +	lsrl	#2,d7
   2.264 +	eorl	d1,d7
   2.265 +	andl	#0x33333333,d7
   2.266 +	eorl	d7,d1
   2.267 +	lsll	#2,d7
   2.268 +	eorl	d7,d3
   2.269 +/*
   2.270 +	d0 = a7b7c7d7e7f7g7h7 i7j7k7l7m7n7o7p7 a6b6c6d6e6f6g6h6 i6j6k6l6m6n6o6p6
   2.271 +	d1 = a3b3c3d3e3f3g3h3 i3j3k3l3m3n3o3p3 a2b2c2d2e2f2g2h2 i2j2k2l2m2n2o2p2
   2.272 +	d2 = a5b5c5d5e5f5g5h5 i5j5k5l5m5n5o5p5 a4b4c4d4e4f4g4h4 i4j4k4l4m4n4o4p4
   2.273 +	d3 = a1b1c1d1e1f1g1h1 i1j1k1l1m1n1o1p1 a0b0c0d0e0f0g0h0 i0j0k0l0m0n0o0p0
   2.274 +*/
   2.275 +	swap	d0
   2.276 +	swap	d1
   2.277 +	swap	d2
   2.278 +	swap	d3
   2.279 +
   2.280 +	movel	d0,a6
   2.281 +	movel	d2,a5
   2.282 +	movel	d1,a4
   2.283 +	movel	d3,a3
   2.284 +
   2.285 +	cmpl	a0,a2
   2.286 +	bgt	SDL_Atari_C2p8_pix16
   2.287 +
   2.288 +	movel	a3,a1@+
   2.289 +	movel	a4,a1@+
   2.290 +	movel	a5,a1@+
   2.291 +	movel	a6,a1@+
   2.292 +
   2.293 +	/* Double the line ? */
   2.294 +
   2.295 +	movel	c2p_srcpitch,d0
   2.296 +	movel	c2p_dstpitch,d1
   2.297 +
   2.298 +	tstl	c2p_dblligne
   2.299 +	beqs	SDL_Atari_C2p8_nodblline
   2.300 +
   2.301 +	movel	c2p_curdst,a0
   2.302 +	movel	a0,a1
   2.303 +	addl	d1,a1
   2.304 +
   2.305 +	movew	c2p_width+2,d7
   2.306 +	lsrw	#4,d7
   2.307 +	subql	#1,d7
   2.308 +SDL_Atari_C2p8_dblloop:
   2.309 +	movel	a0@+,a1@+
   2.310 +	movel	a0@+,a1@+
   2.311 +	movel	a0@+,a1@+
   2.312 +	movel	a0@+,a1@+
   2.313 +	dbra	d7,SDL_Atari_C2p8_dblloop
   2.314 +
   2.315 +	addl	d1,c2p_curdst
   2.316 +
   2.317 +SDL_Atari_C2p8_nodblline:
   2.318 +
   2.319 +	/* Next line */
   2.320 +
   2.321 +	addl	d0,c2p_cursrc
   2.322 +	addl	d1,c2p_curdst
   2.323 +
   2.324 +	subqw	#1,c2p_row
   2.325 +	bne	SDL_Atari_C2p8_rowloop	
   2.326 +
   2.327 +	moveml	sp@+,d2-d7/a2-a6
   2.328 +	rts
   2.329 +
   2.330 +/* ------------	Conversion C2P, 4 bits ------------ */
   2.331 +
   2.332 +_SDL_Atari_C2pConvert4:
   2.333  	movel	sp@(4),c2p_source
   2.334  	movel	sp@(8),c2p_dest
   2.335  	movel	sp@(12),c2p_width
   2.336 @@ -102,138 +306,7 @@
   2.337  
   2.338  	movel	c2p_source,a0
   2.339  	movel	c2p_dest,a1
   2.340 -	lea	_Atari_table_c2p,a2
   2.341 -	movel	#0x000f0001,d3
   2.342 -#if defined(__M68020__)
   2.343 -	moveq	#0,d0
   2.344 -#endif
   2.345 -	
   2.346 -	movel	c2p_height,d7
   2.347 -	subql	#1,d7
   2.348 -c2p8_bcly:
   2.349 -	movel	a0,a4	| Save start address of source
   2.350 -	movel	a1,a5	| Save start address of dest
   2.351 -
   2.352 -	| Conversion
   2.353 -                 
   2.354 -	movel	c2p_width,d6
   2.355 -	lsrw	#4,d6
   2.356 -	subql	#1,d6
   2.357 -c2p8_bclx:
   2.358 -	| Octets 0-7
   2.359 -	
   2.360 -	moveq	#0,d1
   2.361 -	moveq	#0,d2
   2.362 -	moveq	#7,d5
   2.363 -c2p8_bcl07:
   2.364 -#if defined(__M68020__)
   2.365 -	moveb	a0@+,d0
   2.366 -	lea	a2@(0,d0:w:8),a3
   2.367 -#else
   2.368 -	moveq	#0,d0
   2.369 -	moveb	a0@+,d0
   2.370 -	lslw	#3,d0
   2.371 -	lea	a2@(0,d0:w),a3
   2.372 -#endif
   2.373 -	lsll	#1,d1
   2.374 -	lsll	#1,d2
   2.375 -	orl	a3@+,d1
   2.376 -	orl	a3@,d2
   2.377 -	dbra	d5,c2p8_bcl07
   2.378 -
   2.379 -	movepl	d1,a1@(0)
   2.380 -	movepl	d2,a1@(8)
   2.381 -	addw	d3,a1
   2.382 -	swap	d3
   2.383 -	
   2.384 -	| Octets 8-15
   2.385 -
   2.386 -	moveq	#0,d1
   2.387 -	moveq	#0,d2
   2.388 -	moveq	#7,d5
   2.389 -c2p8_bcl815:
   2.390 -#if defined(__M68020__)
   2.391 -	moveb	a0@+,d0
   2.392 -	lea	a2@(0,d0:w:8),a3
   2.393 -#else
   2.394 -	moveq	#0,d0
   2.395 -	moveb	a0@+,d0
   2.396 -	lslw	#3,d0
   2.397 -	lea	a2@(0,d0:w),a3
   2.398 -#endif
   2.399 -	lsll	#1,d1
   2.400 -	lsll	#1,d2
   2.401 -	orl	a3@+,d1
   2.402 -	orl	a3@,d2
   2.403 -	dbra	d5,c2p8_bcl815
   2.404 -
   2.405 -	movepl	d1,a1@(0)
   2.406 -	movepl	d2,a1@(8)
   2.407 -	addw	d3,a1
   2.408 -	swap	d3
   2.409 -
   2.410 -	dbra	d6,c2p8_bclx
   2.411 -
   2.412 -	| Double line ?
   2.413 -
   2.414 -	tstl	c2p_dblligne
   2.415 -	beq	c2p8_nodblligne
   2.416 -
   2.417 -	movel	a5,a6			| src line
   2.418 -	movel	a5,a1			| dest line
   2.419 -	addl	c2p_dstpitch,a1
   2.420 -
   2.421 -	movel	c2p_width,d6
   2.422 -	lsrw	#2,d6
   2.423 -	subql	#1,d6
   2.424 -c2p8_copydbl:
   2.425 -	movel	a6@+,a1@+
   2.426 -	dbra	d6,c2p8_copydbl
   2.427 -
   2.428 -	addl	c2p_dstpitch,a5
   2.429 -c2p8_nodblligne:
   2.430 -
   2.431 -	| Next line
   2.432 -
   2.433 -	movel	a4,a0		
   2.434 -	addl	c2p_srcpitch,a0
   2.435 -	movel	a5,a1
   2.436 -	addl	c2p_dstpitch,a1
   2.437 -
   2.438 -	dbra	d7,c2p8_bcly
   2.439 -
   2.440 -	moveml	sp@+,d2-d7/a2-a6
   2.441 -	rts
   2.442 -
   2.443 -/* ------------	Init table C2P, 4 bits ------------ */
   2.444 -
   2.445 -	.globl	_Atari_C2pInit4
   2.446 -
   2.447 -	.text
   2.448 -_Atari_C2pInit4:
   2.449 -	/* Nothing to do */
   2.450 -	/* work is done in convert_c2p_pal */
   2.451 -	rts
   2.452 -
   2.453 -/* ------------	Conversion C2P, 4 bits ------------ */
   2.454 -
   2.455 -	.globl	_Atari_C2pConvert4
   2.456 -
   2.457 -	.text
   2.458 -_Atari_C2pConvert4:
   2.459 -	movel	sp@(4),c2p_source
   2.460 -	movel	sp@(8),c2p_dest
   2.461 -	movel	sp@(12),c2p_width
   2.462 -	movel	sp@(16),c2p_height
   2.463 -	movel	sp@(20),c2p_dblligne
   2.464 -	movel	sp@(24),c2p_srcpitch
   2.465 -	movel	sp@(28),c2p_dstpitch
   2.466 -
   2.467 -	moveml	d2-d7/a2-a6,sp@-
   2.468 -
   2.469 -	movel	c2p_source,a0
   2.470 -	movel	c2p_dest,a1
   2.471 -	lea	_Atari_table_c2p,a2
   2.472 +	lea	_SDL_Atari_table_c2p,a2
   2.473  	movel	#0x00070001,d3
   2.474  #if defined(__M68020__)
   2.475  	moveq	#0,d0
   2.476 @@ -328,18 +401,15 @@
   2.477  	moveml	sp@+,d2-d7/a2-a6
   2.478  	rts
   2.479  
   2.480 -* ------------	Conversion of a light palette in 4 bits ------------ */
   2.481 +/* ------------	Conversion of a light palette in 4 bits ------------ */
   2.482  
   2.483 -	.globl	_Atari_C2pConvert4_pal
   2.484 -
   2.485 -	.text
   2.486 -_Atari_C2pConvert4_pal:
   2.487 +_SDL_Atari_C2pConvert4_pal:
   2.488  	/* a0 is a 256-word light palette */
   2.489  	movel	sp@(4),a0
   2.490  
   2.491  	moveml	d2-d3,sp@-
   2.492  
   2.493 -	lea	_Atari_table_c2p,a1
   2.494 +	lea	_SDL_Atari_table_c2p,a1
   2.495  	movew	#255,d3
   2.496  c2p_pal_initbcl:
   2.497  	movew	a0@+,d0
   2.498 @@ -367,11 +437,17 @@
   2.499  	.data
   2.500  
   2.501  	.even
   2.502 -	.comm	c2p_source,4
   2.503 -	.comm	c2p_dest,4
   2.504 -	.comm	c2p_width,4
   2.505 -	.comm	c2p_height,4
   2.506 -	.comm	c2p_dblligne,4
   2.507 -	.comm	c2p_srcpitch,4
   2.508 -	.comm	c2p_dstpitch,4
   2.509 +	.comm	_SDL_Atari_C2pConvert,4
   2.510 +	.comm	_SDL_Atari_table_c2p,2048
   2.511  
   2.512 +	.comm	c2p_source,4	/* Source framebuffer */
   2.513 +	.comm	c2p_dest,4	/* Destination framebuffer */
   2.514 +	.comm	c2p_width,4	/* Width of zone to convert */
   2.515 +	.comm	c2p_height,4	/* Height of zone to convert */
   2.516 +	.comm	c2p_dblligne,4	/* Double the lines while converting ? */
   2.517 +	.comm	c2p_srcpitch,4	/* Source pitch */
   2.518 +	.comm	c2p_dstpitch,4	/* Destination pitch */
   2.519 +	.comm	c2p_cursrc,4	/* Current source line */
   2.520 +	.comm	c2p_curdst,4	/* Current destination line */
   2.521 +	.comm	c2p_rowlen,2	/* Line length in bytes */
   2.522 +	.comm	c2p_row,2	/* Current line number */
     3.1 --- a/src/video/ataricommon/SDL_ataric2p060.c	Wed Nov 05 23:11:05 2003 +0000
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,203 +0,0 @@
     3.4 -/*
     3.5 -    SDL - Simple DirectMedia Layer
     3.6 -    Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002  Sam Lantinga
     3.7 -
     3.8 -    This library is free software; you can redistribute it and/or
     3.9 -    modify it under the terms of the GNU Library General Public
    3.10 -    License as published by the Free Software Foundation; either
    3.11 -    version 2 of the License, or (at your option) any later version.
    3.12 -
    3.13 -    This library is distributed in the hope that it will be useful,
    3.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
    3.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    3.16 -    Library General Public License for more details.
    3.17 -
    3.18 -    You should have received a copy of the GNU Library General Public
    3.19 -    License along with this library; if not, write to the Free
    3.20 -    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    3.21 -
    3.22 -    Sam Lantinga
    3.23 -    slouken@libsdl.org
    3.24 -*/
    3.25 -
    3.26 -#ifdef SAVE_RCSID
    3.27 -static char rcsid =
    3.28 - "@(#) $Id$";
    3.29 -#endif
    3.30 -
    3.31 -/*
    3.32 - *	Chunky to planar conversion routine
    3.33 - *  for 68060 CPU, without movep instruction
    3.34 - *	1 byte/pixel -> 4 or 8 bit planes
    3.35 - *
    3.36 - *	Patrice Mandin
    3.37 - */
    3.38 -
    3.39 -#include <string.h>
    3.40 -
    3.41 -#include <mint/cookie.h>
    3.42 -
    3.43 -#include "SDL_ataric2p_s.h"
    3.44 -
    3.45 -/*--- Variables ---*/
    3.46 -
    3.47 -/* CPU is 060 ? */
    3.48 -int atari_cpu060_avail;
    3.49 -
    3.50 -/*--- Functions ---*/
    3.51 -
    3.52 -void atari_test_cpu060_present(void)
    3.53 -{
    3.54 -	unsigned long cookie_cpu;
    3.55 -
    3.56 -	atari_cpu060_avail=0;
    3.57 -
    3.58 -	/* Cookie _CPU present ? */
    3.59 -	if (Getcookie(C__CPU, &cookie_cpu) == C_FOUND) {
    3.60 -		atari_cpu060_avail = (cookie_cpu == 60);
    3.61 -	}
    3.62 -}
    3.63 -
    3.64 -void Atari_C2pConvert8_060(
    3.65 -	Uint8 *src,			/* Source screen (one byte=one pixel) */
    3.66 -	Uint8 *dest,		/* Destination (8 bits planes) */
    3.67 -	Uint32 width,		/* Dimensions of screen to convert */
    3.68 -	Uint32 height,
    3.69 -	Uint32 dblligne,	/* Double the lines when converting ? */
    3.70 -	Uint32 srcpitch,	/* Length of one source line in bytes */
    3.71 -	Uint32 dstpitch		/* Length of one destination line in bytes */
    3.72 -)
    3.73 -{
    3.74 -	int x,y,z;
    3.75 -	Uint8 *src_line, *dst_line;
    3.76 -
    3.77 -	for (y=0; y<height; y++) {
    3.78 -		src_line = src;
    3.79 -		dst_line = dest;
    3.80 -
    3.81 -		for (x=0; x<(width>>4); x++) {
    3.82 -			Uint32 somme1, somme2;
    3.83 -			Uint32 *convtable;
    3.84 -
    3.85 -			/* bytes 0-7 */
    3.86 -			somme1 = somme2 = 0;
    3.87 -			for (z=0; z<8 ;z++) {
    3.88 -				convtable = (Uint32 *) &Atari_table_c2p[(*src_line++)<<3];
    3.89 -				somme1 <<= 1;
    3.90 -				somme2 <<= 1;
    3.91 -				somme1 |= *convtable++;
    3.92 -				somme2 |= *convtable;
    3.93 -			}
    3.94 -
    3.95 -			*(dst_line+14) = somme2;	/* 000000FF */
    3.96 -			*(dst_line+6) = somme1;		/* 000000FF */
    3.97 -			somme2 >>= 8;
    3.98 -			somme1 >>= 8;
    3.99 -			*(dst_line+12) = somme2;	/* 0000FF00 */
   3.100 -			*(dst_line+4) = somme1;		/* 0000FF00 */
   3.101 -			somme2 >>= 8;
   3.102 -			somme1 >>= 8;
   3.103 -			*(dst_line+10) = somme2;	/* 00FF0000 */
   3.104 -			*(dst_line+2) = somme1;		/* 00FF0000 */
   3.105 -			somme2 >>= 8;
   3.106 -			somme1 >>= 8;
   3.107 -			*(dst_line+8) = somme2;		/* FF000000 */
   3.108 -			*dst_line++ = somme1;		/* FF000000 */
   3.109 -
   3.110 -			/* bytes 8-15 */
   3.111 -			somme1 = somme2 = 0;
   3.112 -			for (z=0; z<8 ;z++) {
   3.113 -				convtable = (Uint32 *) &Atari_table_c2p[(*src_line++)<<3];
   3.114 -				somme1 <<= 1;
   3.115 -				somme2 <<= 1;
   3.116 -				somme1 |= *convtable++;
   3.117 -				somme2 |= *convtable;
   3.118 -			}
   3.119 -
   3.120 -			*(dst_line+14) = somme2;	/* 000000FF */
   3.121 -			*(dst_line+6) = somme1;		/* 000000FF */
   3.122 -			somme2 >>= 8;
   3.123 -			somme1 >>= 8;
   3.124 -			*(dst_line+12) = somme2;	/* 0000FF00 */
   3.125 -			*(dst_line+4) = somme1;		/* 0000FF00 */
   3.126 -			somme2 >>= 8;
   3.127 -			somme1 >>= 8;
   3.128 -			*(dst_line+10) = somme2;	/* 00FF0000 */
   3.129 -			*(dst_line+2) = somme1;		/* 00FF0000 */
   3.130 -			somme2 >>= 8;
   3.131 -			somme1 >>= 8;
   3.132 -			*(dst_line+8) = somme2;		/* FF000000 */
   3.133 -			*dst_line = somme1;			/* FF000000 */
   3.134 -
   3.135 -			dst_line += 15;
   3.136 -		}
   3.137 -
   3.138 -		if (dblligne) {
   3.139 -			memcpy(dest+dstpitch, dest, width);
   3.140 -			dest += dstpitch;
   3.141 -		}
   3.142 -
   3.143 -		src += srcpitch;
   3.144 -		dest += dstpitch;
   3.145 -	}
   3.146 -}
   3.147 -
   3.148 -void Atari_C2pConvert4_060(
   3.149 -	Uint8 *src,			/* Source screen (one byte=one pixel) */
   3.150 -	Uint8 *dest,		/* Destination (4 bits planes) */
   3.151 -	Uint32 width,		/* Dimensions of screen to convert */
   3.152 -	Uint32 height,
   3.153 -	Uint32 dblligne,	/* Double the lines when converting ? */
   3.154 -	Uint32 srcpitch,	/* Length of one source line in bytes */
   3.155 -	Uint32 dstpitch		/* Length of one destination line in bytes */
   3.156 -)
   3.157 -{
   3.158 -	int x,y,z;
   3.159 -	Uint8 *src_line, *dst_line;
   3.160 -
   3.161 -	for (y=0;y<height;y++) {
   3.162 -		src_line = src;
   3.163 -		dst_line = dest;
   3.164 -
   3.165 -		for (x=0; x<(width>>4);x++) {
   3.166 -			Uint32 somme;
   3.167 -			Uint32 *convtable;
   3.168 -
   3.169 -			/* bytes 0-7 */
   3.170 -			somme=0;
   3.171 -			for (z=0; z<8 ; z++) {
   3.172 -				convtable = (Uint32 *) &Atari_table_c2p[(*src_line++)<<2];
   3.173 -				somme <<= 1;
   3.174 -				somme |= *convtable;
   3.175 -			}
   3.176 -
   3.177 -			*(dst_line+6) = somme; somme >>= 8;	/* 000000FF */
   3.178 -			*(dst_line+4) = somme; somme >>= 8;	/* 0000FF00 */
   3.179 -			*(dst_line+2) = somme; somme >>= 8;	/* 00FF0000 */
   3.180 -			*dst_line++ = somme;				/* FF000000 */
   3.181 -
   3.182 -			/* bytes 8-15 */
   3.183 -			somme = 0;
   3.184 -			for (z=0; z<8 ;z++) {
   3.185 -				convtable = (Uint32 *) &Atari_table_c2p[(*src_line++)<<2];
   3.186 -				somme <<= 1;
   3.187 -				somme |= *convtable;
   3.188 -			}
   3.189 -
   3.190 -			*(dst_line+6) = somme; somme >>= 8;	/* 000000FF */
   3.191 -			*(dst_line+4) = somme; somme >>= 8;	/* 0000FF00 */
   3.192 -			*(dst_line+2) = somme; somme >>= 8;	/* 00FF0000 */
   3.193 -			*dst_line = somme;					/* FF000000 */
   3.194 -
   3.195 -			dst_line += 7;
   3.196 -		}
   3.197 -
   3.198 -		if (dblligne) {
   3.199 -			memcpy(dest+dstpitch, dest, width>>1);
   3.200 -			dest += dstpitch;
   3.201 -		}
   3.202 -
   3.203 -		src += srcpitch;
   3.204 -		dest += dstpitch;
   3.205 -	}
   3.206 -}
     4.1 --- a/src/video/ataricommon/SDL_ataric2p060_c.h	Wed Nov 05 23:11:05 2003 +0000
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,67 +0,0 @@
     4.4 -/*
     4.5 -    SDL - Simple DirectMedia Layer
     4.6 -    Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002  Sam Lantinga
     4.7 -
     4.8 -    This library is free software; you can redistribute it and/or
     4.9 -    modify it under the terms of the GNU Library General Public
    4.10 -    License as published by the Free Software Foundation; either
    4.11 -    version 2 of the License, or (at your option) any later version.
    4.12 -
    4.13 -    This library is distributed in the hope that it will be useful,
    4.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
    4.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    4.16 -    Library General Public License for more details.
    4.17 -
    4.18 -    You should have received a copy of the GNU Library General Public
    4.19 -    License along with this library; if not, write to the Free
    4.20 -    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    4.21 -
    4.22 -    Sam Lantinga
    4.23 -    slouken@libsdl.org
    4.24 -*/
    4.25 -
    4.26 -#ifdef SAVE_RCSID
    4.27 -static char rcsid =
    4.28 - "@(#) $Id$";
    4.29 -#endif
    4.30 -
    4.31 -/*
    4.32 - *	Chunky to planar conversion routine
    4.33 - *  for 68060 CPU, without movep instruction
    4.34 - *	1 byte/pixel -> 4 or 8 bit planes
    4.35 - *
    4.36 - *	Patrice Mandin
    4.37 - */
    4.38 -
    4.39 -#ifndef _SDL_ATARI_C2P060_H_
    4.40 -#define _SDL_ATARI_C2P060_H_
    4.41 -
    4.42 -/*--- Variables ---*/
    4.43 -
    4.44 -extern int atari_cpu060_avail;
    4.45 -
    4.46 -/*--- Functions ---*/
    4.47 -
    4.48 -extern void atari_test_cpu060_present(void);
    4.49 -
    4.50 -extern void Atari_C2pConvert8_060(
    4.51 -	Uint8 *src,			/* Source screen (one byte=one pixel) */
    4.52 -	Uint8 *dest,		/* Destination (8 bits planes) */
    4.53 -	Uint32 width,		/* Dimensions of screen to convert */
    4.54 -	Uint32 height,
    4.55 -	Uint32 dblligne,	/* Double the lines when converting ? */
    4.56 -	Uint32 srcpitch,	/* Length of one source line in bytes */
    4.57 -	Uint32 dstpitch		/* Length of one destination line in bytes */
    4.58 -);
    4.59 -
    4.60 -extern void Atari_C2pConvert4_060(
    4.61 -	Uint8 *src,			/* Source screen (one byte=one pixel) */
    4.62 -	Uint8 *dest,		/* Destination (4 bits planes) */
    4.63 -	Uint32 width,		/* Dimensions of screen to convert */
    4.64 -	Uint32 height,
    4.65 -	Uint32 dblligne,	/* Double the lines when converting ? */
    4.66 -	Uint32 srcpitch,	/* Length of one source line in bytes */
    4.67 -	Uint32 dstpitch		/* Length of one destination line in bytes */
    4.68 -);
    4.69 -
    4.70 -#endif /* _SDL_ATARI_C2P060_H_ */
     5.1 --- a/src/video/ataricommon/SDL_ataric2p_s.h	Wed Nov 05 23:11:05 2003 +0000
     5.2 +++ b/src/video/ataricommon/SDL_ataric2p_s.h	Wed Nov 12 18:45:48 2003 +0000
     5.3 @@ -32,17 +32,13 @@
     5.4  
     5.5  /*--- Variables ---*/
     5.6  
     5.7 -extern Uint8 Atari_table_c2p[2048];	/* Used by conversions routines */
     5.8 +extern Uint8 SDL_Atari_table_c2p[2048];	/* Used by conversions routines */
     5.9  
    5.10  /*--- Functions pointers ---*/
    5.11  
    5.12 -/* Initialize conversion table */
    5.13 -
    5.14 -extern void (*Atari_C2pInit)(void);
    5.15 -
    5.16  /* Convert a chunky screen to bitplane screen */
    5.17  
    5.18 -extern void (*Atari_C2pConvert)(
    5.19 +extern void (*SDL_Atari_C2pConvert)(
    5.20  	Uint8 *src,			/* Source screen (one byte=one pixel) */
    5.21  	Uint8 *dest,		/* Destination (4/8 bits planes) */
    5.22  	Uint32 width,		/* Dimensions of screen to convert */
    5.23 @@ -54,13 +50,9 @@
    5.24  
    5.25  /*--- 8 bits functions ---*/
    5.26  
    5.27 -/* Initialize conversion table */
    5.28 -
    5.29 -void Atari_C2pInit8(void);
    5.30 -
    5.31  /* Convert a chunky screen to bitplane screen */
    5.32  
    5.33 -void Atari_C2pConvert8(
    5.34 +void SDL_Atari_C2pConvert8(
    5.35  	Uint8 *src,			/* Source screen (one byte=one pixel) */
    5.36  	Uint8 *dest,		/* Destination (8 bits planes) */
    5.37  	Uint32 width,		/* Dimensions of screen to convert */
    5.38 @@ -72,13 +64,9 @@
    5.39  
    5.40  /*--- 4 bits functions ---*/
    5.41  
    5.42 -/* Initialize conversion table */
    5.43 -
    5.44 -void Atari_C2pInit4(void);
    5.45 -
    5.46  /* Convert a chunky screen to bitplane screen */
    5.47  
    5.48 -void Atari_C2pConvert4(
    5.49 +void SDL_Atari_C2pConvert4(
    5.50  	Uint8 *src,			/* Source screen (one byte=one pixel) */
    5.51  	Uint8 *dest,		/* Destination (4 bits planes) */
    5.52  	Uint32 width,		/* Dimensions of screen to convert */
    5.53 @@ -90,6 +78,6 @@
    5.54  
    5.55  /* Conversion palette */
    5.56  
    5.57 -void Atari_C2pConvert4_pal(Uint16 *lightpalette);
    5.58 +void SDL_Atari_C2pConvert4_pal(Uint16 *lightpalette);
    5.59  
    5.60  #endif /* _ATARI_C2P_h */