New C2P conversion routine
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40735
This commit is contained in:
parent
4c968411d5
commit
f31a195b12
5 changed files with 253 additions and 461 deletions
|
@ -8,8 +8,6 @@ libvideo_ataricommon_la_SOURCES = $(ATARICOMMON_SRCS)
|
|||
ATARICOMMON_SRCS = \
|
||||
SDL_ataric2p.S \
|
||||
SDL_ataric2p_s.h \
|
||||
SDL_ataric2p060.c \
|
||||
SDL_ataric2p060_c.h \
|
||||
SDL_atarieddi.S \
|
||||
SDL_atarieddi_s.h \
|
||||
SDL_atarievents.c \
|
||||
|
|
|
@ -26,70 +26,24 @@ static char rcsid =
|
|||
#endif
|
||||
|
||||
/*
|
||||
* Chunky to planar conversion routine
|
||||
* 1 byte/pixel -> 4 or 8 bit planes
|
||||
*
|
||||
* Patrice Mandin
|
||||
* Xavier Joubert
|
||||
*/
|
||||
Chunky to planar conversion routine
|
||||
1 byte/pixel -> 4 or 8 bit planes
|
||||
|
||||
/* ------------ Function pointers ------------ */
|
||||
Patrice Mandin
|
||||
Xavier Joubert
|
||||
Mikael Kalms
|
||||
*/
|
||||
|
||||
.globl _Atari_C2pInit
|
||||
.globl _Atari_C2pConvert
|
||||
|
||||
.data
|
||||
|
||||
.even
|
||||
.comm _Atari_C2pInit,4
|
||||
.comm _Atari_C2pConvert,4
|
||||
|
||||
/* ------------ Conversion Table C2P ------------ */
|
||||
|
||||
.globl _Atari_table_c2p
|
||||
|
||||
.data
|
||||
|
||||
.comm _Atari_table_c2p,2048
|
||||
|
||||
/* ------------ Init table C2P, 8 bits ------------ */
|
||||
|
||||
.globl _Atari_C2pInit8
|
||||
|
||||
.text
|
||||
_Atari_C2pInit8:
|
||||
movel d2,sp@-
|
||||
|
||||
lea _Atari_table_c2p,a0
|
||||
movew #255,d0
|
||||
c2p_initbcl:
|
||||
#if defined (__M68020__)
|
||||
lea a0@(0,d0:w:8),a1
|
||||
#else
|
||||
movew d0,d2
|
||||
lslw #3,d2
|
||||
lea a0@(0,d2:w),a1
|
||||
#endif
|
||||
moveq #7,d1
|
||||
c2p_initbyte:
|
||||
btst d1,d0
|
||||
sne d2
|
||||
negw d2
|
||||
moveb d2,a1@(0,d1:w)
|
||||
|
||||
dbra d1,c2p_initbyte
|
||||
|
||||
dbra d0,c2p_initbcl
|
||||
|
||||
movel sp@+,d2
|
||||
rts
|
||||
.globl _SDL_Atari_C2pConvert
|
||||
.globl _SDL_Atari_C2pConvert8
|
||||
.globl _SDL_Atari_C2pConvert4
|
||||
.globl _SDL_Atari_C2pConvert4_pal
|
||||
.globl _SDL_Atari_table_c2p
|
||||
|
||||
/* ------------ Conversion C2P, 8 bits ------------ */
|
||||
|
||||
.globl _Atari_C2pConvert8
|
||||
|
||||
.text
|
||||
_Atari_C2pConvert8:
|
||||
_SDL_Atari_C2pConvert8:
|
||||
movel sp@(4),c2p_source
|
||||
movel sp@(8),c2p_dest
|
||||
movel sp@(12),c2p_width
|
||||
|
@ -100,127 +54,246 @@ _Atari_C2pConvert8:
|
|||
|
||||
moveml d2-d7/a2-a6,sp@-
|
||||
|
||||
movel c2p_source,a0
|
||||
movel c2p_dest,a1
|
||||
lea _Atari_table_c2p,a2
|
||||
movel #0x000f0001,d3
|
||||
#if defined(__M68020__)
|
||||
moveq #0,d0
|
||||
#endif
|
||||
|
||||
movel c2p_height,d7
|
||||
subql #1,d7
|
||||
c2p8_bcly:
|
||||
movel a0,a4 | Save start address of source
|
||||
movel a1,a5 | Save start address of dest
|
||||
movel c2p_source,c2p_cursrc
|
||||
movel c2p_dest,c2p_curdst
|
||||
movel #0x0f0f0f0f,d4
|
||||
movel #0x00ff00ff,d5
|
||||
movel #0x55555555,d6
|
||||
movew c2p_height+2,c2p_row
|
||||
movew c2p_width+2,d0
|
||||
andw #-8,d0
|
||||
movew d0,c2p_rowlen
|
||||
|
||||
| Conversion
|
||||
|
||||
movel c2p_width,d6
|
||||
lsrw #4,d6
|
||||
subql #1,d6
|
||||
c2p8_bclx:
|
||||
| Octets 0-7
|
||||
|
||||
moveq #0,d1
|
||||
moveq #0,d2
|
||||
moveq #7,d5
|
||||
c2p8_bcl07:
|
||||
#if defined(__M68020__)
|
||||
moveb a0@+,d0
|
||||
lea a2@(0,d0:w:8),a3
|
||||
#else
|
||||
moveq #0,d0
|
||||
moveb a0@+,d0
|
||||
lslw #3,d0
|
||||
lea a2@(0,d0:w),a3
|
||||
#endif
|
||||
lsll #1,d1
|
||||
lsll #1,d2
|
||||
orl a3@+,d1
|
||||
orl a3@,d2
|
||||
dbra d5,c2p8_bcl07
|
||||
SDL_Atari_C2p8_rowloop:
|
||||
|
||||
movepl d1,a1@(0)
|
||||
movepl d2,a1@(8)
|
||||
addw d3,a1
|
||||
movel c2p_cursrc,a0
|
||||
movel c2p_curdst,a1
|
||||
|
||||
movel a0,a2
|
||||
addw c2p_rowlen,a2
|
||||
|
||||
movel a0@+,d0
|
||||
movel a0@+,d1
|
||||
movel a0@+,d2
|
||||
movel a0@+,d3
|
||||
/*
|
||||
d0 = a7a6a5a4a3a2a1a0 b7b6b5b4b3b2b1b0 c7c6c5c4c3c2c1c0 d7d6d5d4d3d2d1d0
|
||||
d1 = e7e6e5e4e3e2e1e0 f7f6f5f4f3f2f1f0 g7g6g5g4g3g2g1g0 h7h6h5h4h3h2h1h0
|
||||
d2 = i7i6i5i4i3i2i1i0 j7j6j5j4j3j2j1j0 k7k6k5k4k3k2k1k0 l7l6l5l4l3l2l1l0
|
||||
d3 = m7m6m5m4m3m2m1m0 n7n6n5n4n3n2n1n0 o7o6o5o4o3o2o1o0 p7p6p5p4p3p2p1p0
|
||||
*/
|
||||
movel d1,d7
|
||||
lsrl #4,d7
|
||||
eorl d0,d7
|
||||
andl d4,d7
|
||||
eorl d7,d0
|
||||
lsll #4,d7
|
||||
eorl d7,d1
|
||||
|
||||
movel d3,d7
|
||||
lsrl #4,d7
|
||||
eorl d2,d7
|
||||
andl d4,d7
|
||||
eorl d7,d2
|
||||
lsll #4,d7
|
||||
eorl d7,d3
|
||||
|
||||
movel d2,d7
|
||||
lsrl #8,d7
|
||||
eorl d0,d7
|
||||
andl d5,d7
|
||||
eorl d7,d0
|
||||
lsll #8,d7
|
||||
eorl d7,d2
|
||||
|
||||
movel d3,d7
|
||||
lsrl #8,d7
|
||||
eorl d1,d7
|
||||
andl d5,d7
|
||||
eorl d7,d1
|
||||
lsll #8,d7
|
||||
eorl d7,d3
|
||||
/*
|
||||
d0 = a7a6a5a4e7e6e5e4 i7i6i5i4m7m6m5m4 c7c6c5c4g7g6g5g4 k7k6k5k4o7o6o5o4
|
||||
d1 = a3a2a1a0e3e2e1e0 i3i2i1i0m3m2m1m0 c3c2c1c0g3g2g1g0 k3k2k1k0o3o2o1o0
|
||||
d2 = b7b6b5b4f7f6f5f4 j7j6j5j4n7n6n5n4 d7d6d5d4h7h6h5h4 l7l6l5l4p7p6p5p4
|
||||
d3 = b3b2b1b0f3f2f1f0 j3j2j1j0n3n2n1n0 d3d2d1d0h3h2h1h0 l3l2l1l0p3p2p1p0
|
||||
*/
|
||||
bras SDL_Atari_C2p8_start
|
||||
|
||||
SDL_Atari_C2p8_pix16:
|
||||
|
||||
movel a0@+,d0
|
||||
movel a0@+,d1
|
||||
movel a0@+,d2
|
||||
movel a0@+,d3
|
||||
/*
|
||||
d0 = a7a6a5a4a3a2a1a0 b7b6b5b4b3b2b1b0 c7c6c5c4c3c2c1c0 d7d6d5d4d3d2d1d0
|
||||
d1 = e7e6e5e4e3e2e1e0 f7f6f5f4f3f2f1f0 g7g6g5g4g3g2g1g0 h7h6h5h4h3h2h1h0
|
||||
d2 = i7i6i5i4i3i2i1i0 j7j6j5j4j3j2j1j0 k7k6k5k4k3k2k1k0 l7l6l5l4l3l2l1l0
|
||||
d3 = m7m6m5m4m3m2m1m0 n7n6n5n4n3n2n1n0 o7o6o5o4o3o2o1o0 p7p6p5p4p3p2p1p0
|
||||
*/
|
||||
movel d1,d7
|
||||
lsrl #4,d7
|
||||
movel a3,a1@+
|
||||
eorl d0,d7
|
||||
andl d4,d7
|
||||
eorl d7,d0
|
||||
lsll #4,d7
|
||||
eorl d7,d1
|
||||
|
||||
movel d3,d7
|
||||
lsrl #4,d7
|
||||
eorl d2,d7
|
||||
andl d4,d7
|
||||
eorl d7,d2
|
||||
movel a4,a1@+
|
||||
lsll #4,d7
|
||||
eorl d7,d3
|
||||
|
||||
movel d2,d7
|
||||
lsrl #8,d7
|
||||
eorl d0,d7
|
||||
andl d5,d7
|
||||
eorl d7,d0
|
||||
movel a5,a1@+
|
||||
lsll #8,d7
|
||||
eorl d7,d2
|
||||
|
||||
movel d3,d7
|
||||
lsrl #8,d7
|
||||
eorl d1,d7
|
||||
andl d5,d7
|
||||
eorl d7,d1
|
||||
movel a6,a1@+
|
||||
lsll #8,d7
|
||||
eorl d7,d3
|
||||
/*
|
||||
d0 = a7a6a5a4e7e6e5e4 i7i6i5i4m7m6m5m4 c7c6c5c4g7g6g5g4 k7k6k5k4o7o6o5o4
|
||||
d1 = a3a2a1a0e3e2e1e0 i3i2i1i0m3m2m1m0 c3c2c1c0g3g2g1g0 k3k2k1k0o3o2o1o0
|
||||
d2 = b7b6b5b4f7f6f5f4 j7j6j5j4n7n6n5n4 d7d6d5d4h7h6h5h4 l7l6l5l4p7p6p5p4
|
||||
d3 = b3b2b1b0f3f2f1f0 j3j2j1j0n3n2n1n0 d3d2d1d0h3h2h1h0 l3l2l1l0p3p2p1p0
|
||||
*/
|
||||
|
||||
SDL_Atari_C2p8_start:
|
||||
|
||||
movel d2,d7
|
||||
lsrl #1,d7
|
||||
eorl d0,d7
|
||||
andl d6,d7
|
||||
eorl d7,d0
|
||||
addl d7,d7
|
||||
eorl d7,d2
|
||||
|
||||
movel d3,d7
|
||||
lsrl #1,d7
|
||||
eorl d1,d7
|
||||
andl d6,d7
|
||||
eorl d7,d1
|
||||
addl d7,d7
|
||||
eorl d7,d3
|
||||
/*
|
||||
d0 = a7b7a5b5e7f7e5f5 i7j7i5j5m7n7m5n5 c7d7c5d5g7h7g5h5 k7l7k5l5o7p7o5p5
|
||||
d1 = a3b3a1b1e3f3e1f1 i3j3i1j1m3n3m1n1 c3d3c1d1g3h3g1h1 k3l3k1l1o3p3o1p1
|
||||
d2 = a6b6a4b4e6f6e4f4 i6j6i4j4m6n6m4n4 c6d6c4d4g6h6g4h4 k6l6k4l4o6p6o4p4
|
||||
d3 = a2b2a0b0e2f2e0f0 i2j2i0j0m2n2m0n0 c2d2c0d0g2h2g0h0 k2l2k0l0o2p2o0p0
|
||||
*/
|
||||
movew d2,d7
|
||||
movew d0,d2
|
||||
swap d2
|
||||
movew d2,d0
|
||||
movew d7,d2
|
||||
|
||||
movew d3,d7
|
||||
movew d1,d3
|
||||
swap d3
|
||||
|
||||
| Octets 8-15
|
||||
movew d3,d1
|
||||
movew d7,d3
|
||||
/*
|
||||
d0 = a7b7a5b5e7f7e5f5 i7j7i5j5m7n7m5n5 a6b6a4b4e6f6e4f4 i6j6i4j4m6n6m4n4
|
||||
d1 = a3b3a1b1e3f3e1f1 i3j3i1j1m3n3m1n1 a2b2a0b0e2f2e0f0 i2j2i0j0m2n2m0n0
|
||||
d2 = c7d7c5d5g7h7g5h5 k7l7k5l5o7p7o5p5 c6d6c4d4g6h6g4h4 k6l6k4l4o6p6o4p4
|
||||
d3 = c3d3c1d1g3h3g1h1 k3l3k1l1o3p3o1p1 c2d2c0d0g2h2g0h0 k2l2k0l0o2p2o0p0
|
||||
*/
|
||||
movel d2,d7
|
||||
lsrl #2,d7
|
||||
eorl d0,d7
|
||||
andl #0x33333333,d7
|
||||
eorl d7,d0
|
||||
lsll #2,d7
|
||||
eorl d7,d2
|
||||
|
||||
moveq #0,d1
|
||||
moveq #0,d2
|
||||
moveq #7,d5
|
||||
c2p8_bcl815:
|
||||
#if defined(__M68020__)
|
||||
moveb a0@+,d0
|
||||
lea a2@(0,d0:w:8),a3
|
||||
#else
|
||||
moveq #0,d0
|
||||
moveb a0@+,d0
|
||||
lslw #3,d0
|
||||
lea a2@(0,d0:w),a3
|
||||
#endif
|
||||
lsll #1,d1
|
||||
lsll #1,d2
|
||||
orl a3@+,d1
|
||||
orl a3@,d2
|
||||
dbra d5,c2p8_bcl815
|
||||
|
||||
movepl d1,a1@(0)
|
||||
movepl d2,a1@(8)
|
||||
addw d3,a1
|
||||
movel d3,d7
|
||||
lsrl #2,d7
|
||||
eorl d1,d7
|
||||
andl #0x33333333,d7
|
||||
eorl d7,d1
|
||||
lsll #2,d7
|
||||
eorl d7,d3
|
||||
/*
|
||||
d0 = a7b7c7d7e7f7g7h7 i7j7k7l7m7n7o7p7 a6b6c6d6e6f6g6h6 i6j6k6l6m6n6o6p6
|
||||
d1 = a3b3c3d3e3f3g3h3 i3j3k3l3m3n3o3p3 a2b2c2d2e2f2g2h2 i2j2k2l2m2n2o2p2
|
||||
d2 = a5b5c5d5e5f5g5h5 i5j5k5l5m5n5o5p5 a4b4c4d4e4f4g4h4 i4j4k4l4m4n4o4p4
|
||||
d3 = a1b1c1d1e1f1g1h1 i1j1k1l1m1n1o1p1 a0b0c0d0e0f0g0h0 i0j0k0l0m0n0o0p0
|
||||
*/
|
||||
swap d0
|
||||
swap d1
|
||||
swap d2
|
||||
swap d3
|
||||
|
||||
dbra d6,c2p8_bclx
|
||||
movel d0,a6
|
||||
movel d2,a5
|
||||
movel d1,a4
|
||||
movel d3,a3
|
||||
|
||||
| Double line ?
|
||||
cmpl a0,a2
|
||||
bgt SDL_Atari_C2p8_pix16
|
||||
|
||||
movel a3,a1@+
|
||||
movel a4,a1@+
|
||||
movel a5,a1@+
|
||||
movel a6,a1@+
|
||||
|
||||
/* Double the line ? */
|
||||
|
||||
movel c2p_srcpitch,d0
|
||||
movel c2p_dstpitch,d1
|
||||
|
||||
tstl c2p_dblligne
|
||||
beq c2p8_nodblligne
|
||||
beqs SDL_Atari_C2p8_nodblline
|
||||
|
||||
movel a5,a6 | src line
|
||||
movel a5,a1 | dest line
|
||||
addl c2p_dstpitch,a1
|
||||
movel c2p_curdst,a0
|
||||
movel a0,a1
|
||||
addl d1,a1
|
||||
|
||||
movel c2p_width,d6
|
||||
lsrw #2,d6
|
||||
subql #1,d6
|
||||
c2p8_copydbl:
|
||||
movel a6@+,a1@+
|
||||
dbra d6,c2p8_copydbl
|
||||
movew c2p_width+2,d7
|
||||
lsrw #4,d7
|
||||
subql #1,d7
|
||||
SDL_Atari_C2p8_dblloop:
|
||||
movel a0@+,a1@+
|
||||
movel a0@+,a1@+
|
||||
movel a0@+,a1@+
|
||||
movel a0@+,a1@+
|
||||
dbra d7,SDL_Atari_C2p8_dblloop
|
||||
|
||||
addl c2p_dstpitch,a5
|
||||
c2p8_nodblligne:
|
||||
addl d1,c2p_curdst
|
||||
|
||||
| Next line
|
||||
SDL_Atari_C2p8_nodblline:
|
||||
|
||||
movel a4,a0
|
||||
addl c2p_srcpitch,a0
|
||||
movel a5,a1
|
||||
addl c2p_dstpitch,a1
|
||||
/* Next line */
|
||||
|
||||
dbra d7,c2p8_bcly
|
||||
addl d0,c2p_cursrc
|
||||
addl d1,c2p_curdst
|
||||
|
||||
subqw #1,c2p_row
|
||||
bne SDL_Atari_C2p8_rowloop
|
||||
|
||||
moveml sp@+,d2-d7/a2-a6
|
||||
rts
|
||||
|
||||
/* ------------ Init table C2P, 4 bits ------------ */
|
||||
|
||||
.globl _Atari_C2pInit4
|
||||
|
||||
.text
|
||||
_Atari_C2pInit4:
|
||||
/* Nothing to do */
|
||||
/* work is done in convert_c2p_pal */
|
||||
rts
|
||||
|
||||
/* ------------ Conversion C2P, 4 bits ------------ */
|
||||
|
||||
.globl _Atari_C2pConvert4
|
||||
|
||||
.text
|
||||
_Atari_C2pConvert4:
|
||||
_SDL_Atari_C2pConvert4:
|
||||
movel sp@(4),c2p_source
|
||||
movel sp@(8),c2p_dest
|
||||
movel sp@(12),c2p_width
|
||||
|
@ -233,7 +306,7 @@ _Atari_C2pConvert4:
|
|||
|
||||
movel c2p_source,a0
|
||||
movel c2p_dest,a1
|
||||
lea _Atari_table_c2p,a2
|
||||
lea _SDL_Atari_table_c2p,a2
|
||||
movel #0x00070001,d3
|
||||
#if defined(__M68020__)
|
||||
moveq #0,d0
|
||||
|
@ -328,18 +401,15 @@ c2p4_nodblligne:
|
|||
moveml sp@+,d2-d7/a2-a6
|
||||
rts
|
||||
|
||||
* ------------ Conversion of a light palette in 4 bits ------------ */
|
||||
/* ------------ Conversion of a light palette in 4 bits ------------ */
|
||||
|
||||
.globl _Atari_C2pConvert4_pal
|
||||
|
||||
.text
|
||||
_Atari_C2pConvert4_pal:
|
||||
_SDL_Atari_C2pConvert4_pal:
|
||||
/* a0 is a 256-word light palette */
|
||||
movel sp@(4),a0
|
||||
|
||||
moveml d2-d3,sp@-
|
||||
|
||||
lea _Atari_table_c2p,a1
|
||||
lea _SDL_Atari_table_c2p,a1
|
||||
movew #255,d3
|
||||
c2p_pal_initbcl:
|
||||
movew a0@+,d0
|
||||
|
@ -367,11 +437,17 @@ c2p_pal_initbyte:
|
|||
.data
|
||||
|
||||
.even
|
||||
.comm c2p_source,4
|
||||
.comm c2p_dest,4
|
||||
.comm c2p_width,4
|
||||
.comm c2p_height,4
|
||||
.comm c2p_dblligne,4
|
||||
.comm c2p_srcpitch,4
|
||||
.comm c2p_dstpitch,4
|
||||
.comm _SDL_Atari_C2pConvert,4
|
||||
.comm _SDL_Atari_table_c2p,2048
|
||||
|
||||
.comm c2p_source,4 /* Source framebuffer */
|
||||
.comm c2p_dest,4 /* Destination framebuffer */
|
||||
.comm c2p_width,4 /* Width of zone to convert */
|
||||
.comm c2p_height,4 /* Height of zone to convert */
|
||||
.comm c2p_dblligne,4 /* Double the lines while converting ? */
|
||||
.comm c2p_srcpitch,4 /* Source pitch */
|
||||
.comm c2p_dstpitch,4 /* Destination pitch */
|
||||
.comm c2p_cursrc,4 /* Current source line */
|
||||
.comm c2p_curdst,4 /* Current destination line */
|
||||
.comm c2p_rowlen,2 /* Line length in bytes */
|
||||
.comm c2p_row,2 /* Current line number */
|
||||
|
|
|
@ -1,203 +0,0 @@
|
|||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
#ifdef SAVE_RCSID
|
||||
static char rcsid =
|
||||
"@(#) $Id$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Chunky to planar conversion routine
|
||||
* for 68060 CPU, without movep instruction
|
||||
* 1 byte/pixel -> 4 or 8 bit planes
|
||||
*
|
||||
* Patrice Mandin
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <mint/cookie.h>
|
||||
|
||||
#include "SDL_ataric2p_s.h"
|
||||
|
||||
/*--- Variables ---*/
|
||||
|
||||
/* CPU is 060 ? */
|
||||
int atari_cpu060_avail;
|
||||
|
||||
/*--- Functions ---*/
|
||||
|
||||
void atari_test_cpu060_present(void)
|
||||
{
|
||||
unsigned long cookie_cpu;
|
||||
|
||||
atari_cpu060_avail=0;
|
||||
|
||||
/* Cookie _CPU present ? */
|
||||
if (Getcookie(C__CPU, &cookie_cpu) == C_FOUND) {
|
||||
atari_cpu060_avail = (cookie_cpu == 60);
|
||||
}
|
||||
}
|
||||
|
||||
void Atari_C2pConvert8_060(
|
||||
Uint8 *src, /* Source screen (one byte=one pixel) */
|
||||
Uint8 *dest, /* Destination (8 bits planes) */
|
||||
Uint32 width, /* Dimensions of screen to convert */
|
||||
Uint32 height,
|
||||
Uint32 dblligne, /* Double the lines when converting ? */
|
||||
Uint32 srcpitch, /* Length of one source line in bytes */
|
||||
Uint32 dstpitch /* Length of one destination line in bytes */
|
||||
)
|
||||
{
|
||||
int x,y,z;
|
||||
Uint8 *src_line, *dst_line;
|
||||
|
||||
for (y=0; y<height; y++) {
|
||||
src_line = src;
|
||||
dst_line = dest;
|
||||
|
||||
for (x=0; x<(width>>4); x++) {
|
||||
Uint32 somme1, somme2;
|
||||
Uint32 *convtable;
|
||||
|
||||
/* bytes 0-7 */
|
||||
somme1 = somme2 = 0;
|
||||
for (z=0; z<8 ;z++) {
|
||||
convtable = (Uint32 *) &Atari_table_c2p[(*src_line++)<<3];
|
||||
somme1 <<= 1;
|
||||
somme2 <<= 1;
|
||||
somme1 |= *convtable++;
|
||||
somme2 |= *convtable;
|
||||
}
|
||||
|
||||
*(dst_line+14) = somme2; /* 000000FF */
|
||||
*(dst_line+6) = somme1; /* 000000FF */
|
||||
somme2 >>= 8;
|
||||
somme1 >>= 8;
|
||||
*(dst_line+12) = somme2; /* 0000FF00 */
|
||||
*(dst_line+4) = somme1; /* 0000FF00 */
|
||||
somme2 >>= 8;
|
||||
somme1 >>= 8;
|
||||
*(dst_line+10) = somme2; /* 00FF0000 */
|
||||
*(dst_line+2) = somme1; /* 00FF0000 */
|
||||
somme2 >>= 8;
|
||||
somme1 >>= 8;
|
||||
*(dst_line+8) = somme2; /* FF000000 */
|
||||
*dst_line++ = somme1; /* FF000000 */
|
||||
|
||||
/* bytes 8-15 */
|
||||
somme1 = somme2 = 0;
|
||||
for (z=0; z<8 ;z++) {
|
||||
convtable = (Uint32 *) &Atari_table_c2p[(*src_line++)<<3];
|
||||
somme1 <<= 1;
|
||||
somme2 <<= 1;
|
||||
somme1 |= *convtable++;
|
||||
somme2 |= *convtable;
|
||||
}
|
||||
|
||||
*(dst_line+14) = somme2; /* 000000FF */
|
||||
*(dst_line+6) = somme1; /* 000000FF */
|
||||
somme2 >>= 8;
|
||||
somme1 >>= 8;
|
||||
*(dst_line+12) = somme2; /* 0000FF00 */
|
||||
*(dst_line+4) = somme1; /* 0000FF00 */
|
||||
somme2 >>= 8;
|
||||
somme1 >>= 8;
|
||||
*(dst_line+10) = somme2; /* 00FF0000 */
|
||||
*(dst_line+2) = somme1; /* 00FF0000 */
|
||||
somme2 >>= 8;
|
||||
somme1 >>= 8;
|
||||
*(dst_line+8) = somme2; /* FF000000 */
|
||||
*dst_line = somme1; /* FF000000 */
|
||||
|
||||
dst_line += 15;
|
||||
}
|
||||
|
||||
if (dblligne) {
|
||||
memcpy(dest+dstpitch, dest, width);
|
||||
dest += dstpitch;
|
||||
}
|
||||
|
||||
src += srcpitch;
|
||||
dest += dstpitch;
|
||||
}
|
||||
}
|
||||
|
||||
void Atari_C2pConvert4_060(
|
||||
Uint8 *src, /* Source screen (one byte=one pixel) */
|
||||
Uint8 *dest, /* Destination (4 bits planes) */
|
||||
Uint32 width, /* Dimensions of screen to convert */
|
||||
Uint32 height,
|
||||
Uint32 dblligne, /* Double the lines when converting ? */
|
||||
Uint32 srcpitch, /* Length of one source line in bytes */
|
||||
Uint32 dstpitch /* Length of one destination line in bytes */
|
||||
)
|
||||
{
|
||||
int x,y,z;
|
||||
Uint8 *src_line, *dst_line;
|
||||
|
||||
for (y=0;y<height;y++) {
|
||||
src_line = src;
|
||||
dst_line = dest;
|
||||
|
||||
for (x=0; x<(width>>4);x++) {
|
||||
Uint32 somme;
|
||||
Uint32 *convtable;
|
||||
|
||||
/* bytes 0-7 */
|
||||
somme=0;
|
||||
for (z=0; z<8 ; z++) {
|
||||
convtable = (Uint32 *) &Atari_table_c2p[(*src_line++)<<2];
|
||||
somme <<= 1;
|
||||
somme |= *convtable;
|
||||
}
|
||||
|
||||
*(dst_line+6) = somme; somme >>= 8; /* 000000FF */
|
||||
*(dst_line+4) = somme; somme >>= 8; /* 0000FF00 */
|
||||
*(dst_line+2) = somme; somme >>= 8; /* 00FF0000 */
|
||||
*dst_line++ = somme; /* FF000000 */
|
||||
|
||||
/* bytes 8-15 */
|
||||
somme = 0;
|
||||
for (z=0; z<8 ;z++) {
|
||||
convtable = (Uint32 *) &Atari_table_c2p[(*src_line++)<<2];
|
||||
somme <<= 1;
|
||||
somme |= *convtable;
|
||||
}
|
||||
|
||||
*(dst_line+6) = somme; somme >>= 8; /* 000000FF */
|
||||
*(dst_line+4) = somme; somme >>= 8; /* 0000FF00 */
|
||||
*(dst_line+2) = somme; somme >>= 8; /* 00FF0000 */
|
||||
*dst_line = somme; /* FF000000 */
|
||||
|
||||
dst_line += 7;
|
||||
}
|
||||
|
||||
if (dblligne) {
|
||||
memcpy(dest+dstpitch, dest, width>>1);
|
||||
dest += dstpitch;
|
||||
}
|
||||
|
||||
src += srcpitch;
|
||||
dest += dstpitch;
|
||||
}
|
||||
}
|
|
@ -1,67 +0,0 @@
|
|||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
#ifdef SAVE_RCSID
|
||||
static char rcsid =
|
||||
"@(#) $Id$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Chunky to planar conversion routine
|
||||
* for 68060 CPU, without movep instruction
|
||||
* 1 byte/pixel -> 4 or 8 bit planes
|
||||
*
|
||||
* Patrice Mandin
|
||||
*/
|
||||
|
||||
#ifndef _SDL_ATARI_C2P060_H_
|
||||
#define _SDL_ATARI_C2P060_H_
|
||||
|
||||
/*--- Variables ---*/
|
||||
|
||||
extern int atari_cpu060_avail;
|
||||
|
||||
/*--- Functions ---*/
|
||||
|
||||
extern void atari_test_cpu060_present(void);
|
||||
|
||||
extern void Atari_C2pConvert8_060(
|
||||
Uint8 *src, /* Source screen (one byte=one pixel) */
|
||||
Uint8 *dest, /* Destination (8 bits planes) */
|
||||
Uint32 width, /* Dimensions of screen to convert */
|
||||
Uint32 height,
|
||||
Uint32 dblligne, /* Double the lines when converting ? */
|
||||
Uint32 srcpitch, /* Length of one source line in bytes */
|
||||
Uint32 dstpitch /* Length of one destination line in bytes */
|
||||
);
|
||||
|
||||
extern void Atari_C2pConvert4_060(
|
||||
Uint8 *src, /* Source screen (one byte=one pixel) */
|
||||
Uint8 *dest, /* Destination (4 bits planes) */
|
||||
Uint32 width, /* Dimensions of screen to convert */
|
||||
Uint32 height,
|
||||
Uint32 dblligne, /* Double the lines when converting ? */
|
||||
Uint32 srcpitch, /* Length of one source line in bytes */
|
||||
Uint32 dstpitch /* Length of one destination line in bytes */
|
||||
);
|
||||
|
||||
#endif /* _SDL_ATARI_C2P060_H_ */
|
|
@ -32,17 +32,13 @@ static char rcsid =
|
|||
|
||||
/*--- Variables ---*/
|
||||
|
||||
extern Uint8 Atari_table_c2p[2048]; /* Used by conversions routines */
|
||||
extern Uint8 SDL_Atari_table_c2p[2048]; /* Used by conversions routines */
|
||||
|
||||
/*--- Functions pointers ---*/
|
||||
|
||||
/* Initialize conversion table */
|
||||
|
||||
extern void (*Atari_C2pInit)(void);
|
||||
|
||||
/* Convert a chunky screen to bitplane screen */
|
||||
|
||||
extern void (*Atari_C2pConvert)(
|
||||
extern void (*SDL_Atari_C2pConvert)(
|
||||
Uint8 *src, /* Source screen (one byte=one pixel) */
|
||||
Uint8 *dest, /* Destination (4/8 bits planes) */
|
||||
Uint32 width, /* Dimensions of screen to convert */
|
||||
|
@ -54,13 +50,9 @@ extern void (*Atari_C2pConvert)(
|
|||
|
||||
/*--- 8 bits functions ---*/
|
||||
|
||||
/* Initialize conversion table */
|
||||
|
||||
void Atari_C2pInit8(void);
|
||||
|
||||
/* Convert a chunky screen to bitplane screen */
|
||||
|
||||
void Atari_C2pConvert8(
|
||||
void SDL_Atari_C2pConvert8(
|
||||
Uint8 *src, /* Source screen (one byte=one pixel) */
|
||||
Uint8 *dest, /* Destination (8 bits planes) */
|
||||
Uint32 width, /* Dimensions of screen to convert */
|
||||
|
@ -72,13 +64,9 @@ void Atari_C2pConvert8(
|
|||
|
||||
/*--- 4 bits functions ---*/
|
||||
|
||||
/* Initialize conversion table */
|
||||
|
||||
void Atari_C2pInit4(void);
|
||||
|
||||
/* Convert a chunky screen to bitplane screen */
|
||||
|
||||
void Atari_C2pConvert4(
|
||||
void SDL_Atari_C2pConvert4(
|
||||
Uint8 *src, /* Source screen (one byte=one pixel) */
|
||||
Uint8 *dest, /* Destination (4 bits planes) */
|
||||
Uint32 width, /* Dimensions of screen to convert */
|
||||
|
@ -90,6 +78,6 @@ void Atari_C2pConvert4(
|
|||
|
||||
/* Conversion palette */
|
||||
|
||||
void Atari_C2pConvert4_pal(Uint16 *lightpalette);
|
||||
void SDL_Atari_C2pConvert4_pal(Uint16 *lightpalette);
|
||||
|
||||
#endif /* _ATARI_C2P_h */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue