src/video/ataricommon/SDL_ataric2p.S
author Patrice Mandin <patmandin@gmail.com>
Wed, 12 Nov 2003 18:45:48 +0000
changeset 734 0310bb01091f
parent 297 f6ffac90895c
child 1086 93207759e065
permissions -rw-r--r--
New C2P conversion routine
slouken@281
     1
/*
slouken@281
     2
    SDL - Simple DirectMedia Layer
slouken@297
     3
    Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002  Sam Lantinga
slouken@281
     4
slouken@281
     5
    This library is free software; you can redistribute it and/or
slouken@281
     6
    modify it under the terms of the GNU Library General Public
slouken@281
     7
    License as published by the Free Software Foundation; either
slouken@281
     8
    version 2 of the License, or (at your option) any later version.
slouken@281
     9
slouken@281
    10
    This library is distributed in the hope that it will be useful,
slouken@281
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@281
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
slouken@281
    13
    Library General Public License for more details.
slouken@281
    14
slouken@281
    15
    You should have received a copy of the GNU Library General Public
slouken@281
    16
    License along with this library; if not, write to the Free
slouken@281
    17
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
slouken@281
    18
slouken@281
    19
    Sam Lantinga
slouken@281
    20
    slouken@libsdl.org
slouken@281
    21
*/
slouken@281
    22
slouken@281
    23
#ifdef SAVE_RCSID
slouken@281
    24
static char rcsid =
slouken@281
    25
 "@(#) $Id$";
slouken@281
    26
#endif
slouken@281
    27
slouken@281
    28
/*
patmandin@734
    29
	Chunky to planar conversion routine
patmandin@734
    30
	1 byte/pixel -> 4 or 8 bit planes
slouken@281
    31
patmandin@734
    32
	Patrice Mandin
patmandin@734
    33
	Xavier Joubert
patmandin@734
    34
	Mikael Kalms
patmandin@734
    35
*/
slouken@281
    36
patmandin@734
    37
	.globl	_SDL_Atari_C2pConvert
patmandin@734
    38
	.globl	_SDL_Atari_C2pConvert8
patmandin@734
    39
	.globl	_SDL_Atari_C2pConvert4
patmandin@734
    40
	.globl	_SDL_Atari_C2pConvert4_pal
patmandin@734
    41
	.globl	_SDL_Atari_table_c2p
slouken@281
    42
slouken@281
    43
/* ------------	Conversion C2P, 8 bits ------------ */
slouken@281
    44
patmandin@734
    45
	.text
patmandin@734
    46
_SDL_Atari_C2pConvert8:
patmandin@734
    47
	movel	sp@(4),c2p_source
patmandin@734
    48
	movel	sp@(8),c2p_dest
patmandin@734
    49
	movel	sp@(12),c2p_width
patmandin@734
    50
	movel	sp@(16),c2p_height
patmandin@734
    51
	movel	sp@(20),c2p_dblligne
patmandin@734
    52
	movel	sp@(24),c2p_srcpitch
patmandin@734
    53
	movel	sp@(28),c2p_dstpitch
slouken@281
    54
patmandin@734
    55
	moveml	d2-d7/a2-a6,sp@-
patmandin@734
    56
patmandin@734
    57
	movel	c2p_source,c2p_cursrc
patmandin@734
    58
	movel	c2p_dest,c2p_curdst
patmandin@734
    59
	movel	#0x0f0f0f0f,d4
patmandin@734
    60
	movel	#0x00ff00ff,d5
patmandin@734
    61
	movel	#0x55555555,d6
patmandin@734
    62
	movew	c2p_height+2,c2p_row
patmandin@734
    63
	movew	c2p_width+2,d0
patmandin@734
    64
	andw	#-8,d0
patmandin@734
    65
	movew	d0,c2p_rowlen
patmandin@734
    66
patmandin@734
    67
SDL_Atari_C2p8_rowloop:
patmandin@734
    68
patmandin@734
    69
	movel	c2p_cursrc,a0
patmandin@734
    70
	movel	c2p_curdst,a1
patmandin@734
    71
patmandin@734
    72
	movel	a0,a2
patmandin@734
    73
	addw	c2p_rowlen,a2
patmandin@734
    74
patmandin@734
    75
	movel	a0@+,d0
patmandin@734
    76
	movel	a0@+,d1
patmandin@734
    77
	movel	a0@+,d2
patmandin@734
    78
	movel	a0@+,d3
patmandin@734
    79
/*
patmandin@734
    80
	d0 = a7a6a5a4a3a2a1a0 b7b6b5b4b3b2b1b0 c7c6c5c4c3c2c1c0 d7d6d5d4d3d2d1d0
patmandin@734
    81
	d1 = e7e6e5e4e3e2e1e0 f7f6f5f4f3f2f1f0 g7g6g5g4g3g2g1g0 h7h6h5h4h3h2h1h0
patmandin@734
    82
	d2 = i7i6i5i4i3i2i1i0 j7j6j5j4j3j2j1j0 k7k6k5k4k3k2k1k0 l7l6l5l4l3l2l1l0
patmandin@734
    83
	d3 = m7m6m5m4m3m2m1m0 n7n6n5n4n3n2n1n0 o7o6o5o4o3o2o1o0 p7p6p5p4p3p2p1p0
patmandin@734
    84
*/
patmandin@734
    85
	movel	d1,d7
patmandin@734
    86
	lsrl	#4,d7
patmandin@734
    87
	eorl	d0,d7
patmandin@734
    88
	andl	d4,d7
patmandin@734
    89
	eorl	d7,d0
patmandin@734
    90
	lsll	#4,d7
patmandin@734
    91
	eorl	d7,d1
patmandin@734
    92
patmandin@734
    93
	movel	d3,d7
patmandin@734
    94
	lsrl	#4,d7
patmandin@734
    95
	eorl	d2,d7
patmandin@734
    96
	andl	d4,d7
patmandin@734
    97
	eorl	d7,d2
patmandin@734
    98
	lsll	#4,d7
patmandin@734
    99
	eorl	d7,d3
patmandin@734
   100
patmandin@734
   101
	movel	d2,d7
patmandin@734
   102
	lsrl	#8,d7
patmandin@734
   103
	eorl	d0,d7
patmandin@734
   104
 	andl	d5,d7
patmandin@734
   105
	eorl	d7,d0
patmandin@734
   106
	lsll	#8,d7
patmandin@734
   107
	eorl	d7,d2
patmandin@734
   108
patmandin@734
   109
	movel	d3,d7
patmandin@734
   110
	lsrl	#8,d7
patmandin@734
   111
	eorl	d1,d7
patmandin@734
   112
 	andl	d5,d7
patmandin@734
   113
	eorl	d7,d1
patmandin@734
   114
	lsll	#8,d7
patmandin@734
   115
	eorl	d7,d3
patmandin@734
   116
/*
patmandin@734
   117
	d0 = a7a6a5a4e7e6e5e4 i7i6i5i4m7m6m5m4 c7c6c5c4g7g6g5g4 k7k6k5k4o7o6o5o4
patmandin@734
   118
	d1 = a3a2a1a0e3e2e1e0 i3i2i1i0m3m2m1m0 c3c2c1c0g3g2g1g0 k3k2k1k0o3o2o1o0
patmandin@734
   119
	d2 = b7b6b5b4f7f6f5f4 j7j6j5j4n7n6n5n4 d7d6d5d4h7h6h5h4 l7l6l5l4p7p6p5p4
patmandin@734
   120
	d3 = b3b2b1b0f3f2f1f0 j3j2j1j0n3n2n1n0 d3d2d1d0h3h2h1h0 l3l2l1l0p3p2p1p0
patmandin@734
   121
*/
patmandin@734
   122
	bras	SDL_Atari_C2p8_start
patmandin@734
   123
patmandin@734
   124
SDL_Atari_C2p8_pix16:
patmandin@734
   125
patmandin@734
   126
	movel	a0@+,d0
patmandin@734
   127
	movel	a0@+,d1
patmandin@734
   128
	movel	a0@+,d2
patmandin@734
   129
	movel	a0@+,d3
patmandin@734
   130
/*
patmandin@734
   131
	d0 = a7a6a5a4a3a2a1a0 b7b6b5b4b3b2b1b0 c7c6c5c4c3c2c1c0 d7d6d5d4d3d2d1d0
patmandin@734
   132
	d1 = e7e6e5e4e3e2e1e0 f7f6f5f4f3f2f1f0 g7g6g5g4g3g2g1g0 h7h6h5h4h3h2h1h0
patmandin@734
   133
	d2 = i7i6i5i4i3i2i1i0 j7j6j5j4j3j2j1j0 k7k6k5k4k3k2k1k0 l7l6l5l4l3l2l1l0
patmandin@734
   134
	d3 = m7m6m5m4m3m2m1m0 n7n6n5n4n3n2n1n0 o7o6o5o4o3o2o1o0 p7p6p5p4p3p2p1p0
patmandin@734
   135
*/
patmandin@734
   136
	movel	d1,d7
patmandin@734
   137
	lsrl	#4,d7
patmandin@734
   138
	movel	a3,a1@+
patmandin@734
   139
	eorl	d0,d7
patmandin@734
   140
	andl	d4,d7
patmandin@734
   141
	eorl	d7,d0
patmandin@734
   142
	lsll	#4,d7
patmandin@734
   143
	eorl	d7,d1
patmandin@734
   144
patmandin@734
   145
	movel	d3,d7
patmandin@734
   146
	lsrl	#4,d7
patmandin@734
   147
	eorl	d2,d7
patmandin@734
   148
	andl	d4,d7
patmandin@734
   149
	eorl	d7,d2
patmandin@734
   150
	movel	a4,a1@+
patmandin@734
   151
	lsll	#4,d7
patmandin@734
   152
	eorl	d7,d3
patmandin@734
   153
patmandin@734
   154
	movel	d2,d7
patmandin@734
   155
	lsrl	#8,d7
patmandin@734
   156
	eorl	d0,d7
patmandin@734
   157
	andl	d5,d7
patmandin@734
   158
	eorl	d7,d0
patmandin@734
   159
	movel	a5,a1@+
patmandin@734
   160
	lsll	#8,d7
patmandin@734
   161
	eorl	d7,d2
patmandin@734
   162
patmandin@734
   163
	movel	d3,d7
patmandin@734
   164
	lsrl	#8,d7
patmandin@734
   165
	eorl	d1,d7
patmandin@734
   166
	andl	d5,d7
patmandin@734
   167
	eorl	d7,d1
patmandin@734
   168
	movel	a6,a1@+
patmandin@734
   169
	lsll	#8,d7
patmandin@734
   170
	eorl	d7,d3
patmandin@734
   171
/*
patmandin@734
   172
	d0 = a7a6a5a4e7e6e5e4 i7i6i5i4m7m6m5m4 c7c6c5c4g7g6g5g4 k7k6k5k4o7o6o5o4
patmandin@734
   173
	d1 = a3a2a1a0e3e2e1e0 i3i2i1i0m3m2m1m0 c3c2c1c0g3g2g1g0 k3k2k1k0o3o2o1o0
patmandin@734
   174
	d2 = b7b6b5b4f7f6f5f4 j7j6j5j4n7n6n5n4 d7d6d5d4h7h6h5h4 l7l6l5l4p7p6p5p4
patmandin@734
   175
	d3 = b3b2b1b0f3f2f1f0 j3j2j1j0n3n2n1n0 d3d2d1d0h3h2h1h0 l3l2l1l0p3p2p1p0
patmandin@734
   176
*/
patmandin@734
   177
patmandin@734
   178
SDL_Atari_C2p8_start:
patmandin@734
   179
patmandin@734
   180
	movel	d2,d7
patmandin@734
   181
	lsrl	#1,d7
patmandin@734
   182
	eorl	d0,d7
patmandin@734
   183
	andl	d6,d7
patmandin@734
   184
	eorl	d7,d0
patmandin@734
   185
	addl	d7,d7
patmandin@734
   186
	eorl	d7,d2
patmandin@734
   187
patmandin@734
   188
	movel	d3,d7
patmandin@734
   189
	lsrl	#1,d7
patmandin@734
   190
	eorl	d1,d7
patmandin@734
   191
	andl	d6,d7
patmandin@734
   192
	eorl	d7,d1
patmandin@734
   193
	addl	d7,d7
patmandin@734
   194
	eorl	d7,d3
patmandin@734
   195
/*
patmandin@734
   196
	d0 = a7b7a5b5e7f7e5f5 i7j7i5j5m7n7m5n5 c7d7c5d5g7h7g5h5 k7l7k5l5o7p7o5p5
patmandin@734
   197
	d1 = a3b3a1b1e3f3e1f1 i3j3i1j1m3n3m1n1 c3d3c1d1g3h3g1h1 k3l3k1l1o3p3o1p1
patmandin@734
   198
	d2 = a6b6a4b4e6f6e4f4 i6j6i4j4m6n6m4n4 c6d6c4d4g6h6g4h4 k6l6k4l4o6p6o4p4
patmandin@734
   199
	d3 = a2b2a0b0e2f2e0f0 i2j2i0j0m2n2m0n0 c2d2c0d0g2h2g0h0 k2l2k0l0o2p2o0p0
patmandin@734
   200
*/
patmandin@734
   201
	movew	d2,d7
patmandin@734
   202
	movew	d0,d2
patmandin@734
   203
	swap	d2
patmandin@734
   204
	movew	d2,d0
patmandin@734
   205
	movew	d7,d2
patmandin@734
   206
patmandin@734
   207
	movew	d3,d7
patmandin@734
   208
	movew	d1,d3
patmandin@734
   209
	swap	d3
patmandin@734
   210
	movew	d3,d1
patmandin@734
   211
	movew	d7,d3
patmandin@734
   212
/*
patmandin@734
   213
	d0 = a7b7a5b5e7f7e5f5 i7j7i5j5m7n7m5n5 a6b6a4b4e6f6e4f4 i6j6i4j4m6n6m4n4
patmandin@734
   214
	d1 = a3b3a1b1e3f3e1f1 i3j3i1j1m3n3m1n1 a2b2a0b0e2f2e0f0 i2j2i0j0m2n2m0n0
patmandin@734
   215
	d2 = c7d7c5d5g7h7g5h5 k7l7k5l5o7p7o5p5 c6d6c4d4g6h6g4h4 k6l6k4l4o6p6o4p4
patmandin@734
   216
	d3 = c3d3c1d1g3h3g1h1 k3l3k1l1o3p3o1p1 c2d2c0d0g2h2g0h0 k2l2k0l0o2p2o0p0
patmandin@734
   217
*/
patmandin@734
   218
	movel	d2,d7
patmandin@734
   219
	lsrl	#2,d7
patmandin@734
   220
	eorl	d0,d7
patmandin@734
   221
	andl	#0x33333333,d7
patmandin@734
   222
	eorl	d7,d0
patmandin@734
   223
	lsll	#2,d7
patmandin@734
   224
	eorl	d7,d2
patmandin@734
   225
patmandin@734
   226
	movel	d3,d7
patmandin@734
   227
	lsrl	#2,d7
patmandin@734
   228
	eorl	d1,d7
patmandin@734
   229
	andl	#0x33333333,d7
patmandin@734
   230
	eorl	d7,d1
patmandin@734
   231
	lsll	#2,d7
patmandin@734
   232
	eorl	d7,d3
patmandin@734
   233
/*
patmandin@734
   234
	d0 = a7b7c7d7e7f7g7h7 i7j7k7l7m7n7o7p7 a6b6c6d6e6f6g6h6 i6j6k6l6m6n6o6p6
patmandin@734
   235
	d1 = a3b3c3d3e3f3g3h3 i3j3k3l3m3n3o3p3 a2b2c2d2e2f2g2h2 i2j2k2l2m2n2o2p2
patmandin@734
   236
	d2 = a5b5c5d5e5f5g5h5 i5j5k5l5m5n5o5p5 a4b4c4d4e4f4g4h4 i4j4k4l4m4n4o4p4
patmandin@734
   237
	d3 = a1b1c1d1e1f1g1h1 i1j1k1l1m1n1o1p1 a0b0c0d0e0f0g0h0 i0j0k0l0m0n0o0p0
patmandin@734
   238
*/
patmandin@734
   239
	swap	d0
patmandin@734
   240
	swap	d1
patmandin@734
   241
	swap	d2
patmandin@734
   242
	swap	d3
patmandin@734
   243
patmandin@734
   244
	movel	d0,a6
patmandin@734
   245
	movel	d2,a5
patmandin@734
   246
	movel	d1,a4
patmandin@734
   247
	movel	d3,a3
patmandin@734
   248
patmandin@734
   249
	cmpl	a0,a2
patmandin@734
   250
	bgt	SDL_Atari_C2p8_pix16
patmandin@734
   251
patmandin@734
   252
	movel	a3,a1@+
patmandin@734
   253
	movel	a4,a1@+
patmandin@734
   254
	movel	a5,a1@+
patmandin@734
   255
	movel	a6,a1@+
patmandin@734
   256
patmandin@734
   257
	/* Double the line ? */
patmandin@734
   258
patmandin@734
   259
	movel	c2p_srcpitch,d0
patmandin@734
   260
	movel	c2p_dstpitch,d1
patmandin@734
   261
patmandin@734
   262
	tstl	c2p_dblligne
patmandin@734
   263
	beqs	SDL_Atari_C2p8_nodblline
patmandin@734
   264
patmandin@734
   265
	movel	c2p_curdst,a0
patmandin@734
   266
	movel	a0,a1
patmandin@734
   267
	addl	d1,a1
patmandin@734
   268
patmandin@734
   269
	movew	c2p_width+2,d7
patmandin@734
   270
	lsrw	#4,d7
patmandin@734
   271
	subql	#1,d7
patmandin@734
   272
SDL_Atari_C2p8_dblloop:
patmandin@734
   273
	movel	a0@+,a1@+
patmandin@734
   274
	movel	a0@+,a1@+
patmandin@734
   275
	movel	a0@+,a1@+
patmandin@734
   276
	movel	a0@+,a1@+
patmandin@734
   277
	dbra	d7,SDL_Atari_C2p8_dblloop
patmandin@734
   278
patmandin@734
   279
	addl	d1,c2p_curdst
patmandin@734
   280
patmandin@734
   281
SDL_Atari_C2p8_nodblline:
patmandin@734
   282
patmandin@734
   283
	/* Next line */
patmandin@734
   284
patmandin@734
   285
	addl	d0,c2p_cursrc
patmandin@734
   286
	addl	d1,c2p_curdst
patmandin@734
   287
patmandin@734
   288
	subqw	#1,c2p_row
patmandin@734
   289
	bne	SDL_Atari_C2p8_rowloop	
patmandin@734
   290
patmandin@734
   291
	moveml	sp@+,d2-d7/a2-a6
patmandin@734
   292
	rts
patmandin@734
   293
patmandin@734
   294
/* ------------	Conversion C2P, 4 bits ------------ */
patmandin@734
   295
patmandin@734
   296
_SDL_Atari_C2pConvert4:
slouken@281
   297
	movel	sp@(4),c2p_source
slouken@281
   298
	movel	sp@(8),c2p_dest
slouken@281
   299
	movel	sp@(12),c2p_width
slouken@281
   300
	movel	sp@(16),c2p_height
slouken@281
   301
	movel	sp@(20),c2p_dblligne
slouken@281
   302
	movel	sp@(24),c2p_srcpitch
slouken@281
   303
	movel	sp@(28),c2p_dstpitch
slouken@281
   304
slouken@281
   305
	moveml	d2-d7/a2-a6,sp@-
slouken@281
   306
slouken@281
   307
	movel	c2p_source,a0
slouken@281
   308
	movel	c2p_dest,a1
patmandin@734
   309
	lea	_SDL_Atari_table_c2p,a2
slouken@281
   310
	movel	#0x00070001,d3
slouken@281
   311
#if defined(__M68020__)
slouken@281
   312
	moveq	#0,d0
slouken@281
   313
#endif
slouken@281
   314
	
slouken@281
   315
	movel	c2p_height,d7
slouken@281
   316
	subql	#1,d7
slouken@281
   317
c2p4_bcly:
slouken@281
   318
	movel	a0,a4	| Save start address of source
slouken@281
   319
	movel	a1,a5	| Save start address of dest
slouken@281
   320
slouken@281
   321
	| Conversion
slouken@281
   322
                 			
slouken@281
   323
	movel	c2p_width,d6
slouken@281
   324
	lsrw	#4,d6
slouken@281
   325
	subql	#1,d6
slouken@281
   326
c2p4_bclx:
slouken@281
   327
	| Octets 0-7
slouken@281
   328
	
slouken@281
   329
	moveq	#0,d1
slouken@281
   330
	moveq	#7,d5
slouken@281
   331
c2p4_bcl07:
slouken@281
   332
#if defined(__M68020__)
slouken@281
   333
	moveb	a0@+,d0
slouken@281
   334
	lea	a2@(0,d0:w:4),a3
slouken@281
   335
#else
slouken@281
   336
	moveq	#0,d0
slouken@281
   337
	moveb	a0@+,d0
slouken@281
   338
	lslw	#2,d0
slouken@281
   339
	lea	a2@(0,d0:w),a3
slouken@281
   340
#endif
slouken@281
   341
	lsll	#1,d1
slouken@281
   342
	orl	a3@,d1
slouken@281
   343
	dbra	d5,c2p4_bcl07
slouken@281
   344
slouken@281
   345
	movepl	d1,a1@(0)
slouken@281
   346
	addw	d3,a1
slouken@281
   347
	swap	d3
slouken@281
   348
	
slouken@281
   349
	| Octets 8-15
slouken@281
   350
slouken@281
   351
	moveq	#0,d1
slouken@281
   352
	moveq	#7,d5
slouken@281
   353
c2p4_bcl815:
slouken@281
   354
#if defined(__M68020__)
slouken@281
   355
	moveb	a0@+,d0
slouken@281
   356
	lea	a2@(0,d0:w:4),a3
slouken@281
   357
#else
slouken@281
   358
	moveq	#0,d0
slouken@281
   359
	moveb	a0@+,d0
slouken@281
   360
	lslw	#2,d0
slouken@281
   361
	lea	a2@(0,d0:w),a3
slouken@281
   362
#endif
slouken@281
   363
	lsll	#1,d1
slouken@281
   364
	orl	a3@,d1
slouken@281
   365
	dbra	d5,c2p4_bcl815
slouken@281
   366
slouken@281
   367
	movepl	d1,a1@(0)
slouken@281
   368
	addw	d3,a1
slouken@281
   369
	swap	d3
slouken@281
   370
slouken@281
   371
	dbra	d6,c2p4_bclx
slouken@281
   372
slouken@281
   373
	| Double line ?
slouken@281
   374
slouken@281
   375
	tstl	c2p_dblligne
slouken@281
   376
	beq	c2p4_nodblligne
slouken@281
   377
slouken@281
   378
	movel	a5,a6			| src line
slouken@281
   379
	movel	a5,a1			| dest line
slouken@281
   380
	addl	c2p_dstpitch,a1
slouken@281
   381
slouken@281
   382
	movel	c2p_width,d6
slouken@281
   383
	lsrw	#3,d6
slouken@281
   384
	subql	#1,d6
slouken@281
   385
c2p4_copydbl:
slouken@281
   386
	movel	a6@+,a1@+
slouken@281
   387
	dbra	d6,c2p4_copydbl
slouken@281
   388
slouken@281
   389
	addl	c2p_dstpitch,a5
slouken@281
   390
c2p4_nodblligne:
slouken@281
   391
slouken@281
   392
	| Next line
slouken@281
   393
slouken@281
   394
	movel	a4,a0		
slouken@281
   395
	addl	c2p_srcpitch,a0
slouken@281
   396
	movel	a5,a1
slouken@281
   397
	addl	c2p_dstpitch,a1
slouken@281
   398
slouken@281
   399
	dbra	d7,c2p4_bcly
slouken@281
   400
slouken@281
   401
	moveml	sp@+,d2-d7/a2-a6
slouken@281
   402
	rts
slouken@281
   403
patmandin@734
   404
/* ------------	Conversion of a light palette in 4 bits ------------ */
slouken@281
   405
patmandin@734
   406
_SDL_Atari_C2pConvert4_pal:
slouken@281
   407
	/* a0 is a 256-word light palette */
slouken@281
   408
	movel	sp@(4),a0
slouken@281
   409
slouken@281
   410
	moveml	d2-d3,sp@-
slouken@281
   411
patmandin@734
   412
	lea	_SDL_Atari_table_c2p,a1
slouken@281
   413
	movew	#255,d3
slouken@281
   414
c2p_pal_initbcl:
slouken@281
   415
	movew	a0@+,d0
slouken@281
   416
	lsrw	#4,d0
slouken@281
   417
	and	#15,d0
slouken@281
   418
slouken@281
   419
	moveq	#3,d1
slouken@281
   420
c2p_pal_initbyte:
slouken@281
   421
	btst	d1,d0
slouken@281
   422
	sne	d2
slouken@281
   423
	negw	d2
slouken@281
   424
	moveb	d2,a1@(0,d1:w)
slouken@281
   425
slouken@281
   426
	dbra	d1,c2p_pal_initbyte
slouken@281
   427
slouken@281
   428
	addql	#4,a1
slouken@281
   429
	dbra	d3,c2p_pal_initbcl
slouken@281
   430
slouken@281
   431
	moveml	sp@+,d2-d3
slouken@281
   432
slouken@281
   433
	rts
slouken@281
   434
slouken@281
   435
/* ------------	Buffers ------------ */
slouken@281
   436
slouken@281
   437
	.data
slouken@281
   438
slouken@281
   439
	.even
patmandin@734
   440
	.comm	_SDL_Atari_C2pConvert,4
patmandin@734
   441
	.comm	_SDL_Atari_table_c2p,2048
slouken@281
   442
patmandin@734
   443
	.comm	c2p_source,4	/* Source framebuffer */
patmandin@734
   444
	.comm	c2p_dest,4	/* Destination framebuffer */
patmandin@734
   445
	.comm	c2p_width,4	/* Width of zone to convert */
patmandin@734
   446
	.comm	c2p_height,4	/* Height of zone to convert */
patmandin@734
   447
	.comm	c2p_dblligne,4	/* Double the lines while converting ? */
patmandin@734
   448
	.comm	c2p_srcpitch,4	/* Source pitch */
patmandin@734
   449
	.comm	c2p_dstpitch,4	/* Destination pitch */
patmandin@734
   450
	.comm	c2p_cursrc,4	/* Current source line */
patmandin@734
   451
	.comm	c2p_curdst,4	/* Current destination line */
patmandin@734
   452
	.comm	c2p_rowlen,2	/* Line length in bytes */
patmandin@734
   453
	.comm	c2p_row,2	/* Current line number */