c62d2810 |
1 | /* FCE Ultra - NES/Famicom Emulator |
2 | * |
3 | * Copyright notice for this file: |
4 | * Copyright (C) 1998 BERO |
5 | * Copyright (C) 2002 Ben Parnell |
6 | * |
7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by |
9 | * the Free Software Foundation; either version 2 of the License, or |
10 | * (at your option) any later version. |
11 | * |
12 | * This program is distributed in the hope that it will be useful, |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * GNU General Public License for more details. |
16 | * |
17 | * You should have received a copy of the GNU General Public License |
18 | * along with this program; if not, write to the Free Software |
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
20 | */ |
21 | #ifdef C80x86 |
22 | { |
23 | int dummy,dummy1,dummy2; |
24 | __asm__ __volatile__( |
25 | "xorl %%edx,%%edx\n\t" |
26 | "movb (%%esi),%%cl\n\t" |
27 | "movb 8(%%esi),%%dl\n\t" |
28 | "movl %%ebx,%%esi\n\t" |
29 | "addl %%eax,%%esi\n\t" |
30 | "xorl %%ebx,%%ebx\n\t" |
31 | "movb %%cl,%%bl\n\t" |
32 | "movb %%dl,%%al\n\t" |
33 | "shrb $1,%%bl\n\t" |
34 | "andb $0xaa,%%al\n\t" |
35 | "andb $0x55,%%bl\n\t" |
36 | |
37 | "andb $0x55,%%cl\n\t" |
38 | "shlb $1,%%dl\n\t" |
39 | "andb $0xaa,%%dl\n\t" |
40 | "orb %%al, %%bl\n\t" // Stick c1 into bl |
41 | "orb %%cl, %%dl\n\t" // Stick c2 into dl |
42 | "xorl %%eax, %%eax\n\t" |
43 | "xorl %%ecx, %%ecx\n\t" |
44 | /* At this point, bl contains c1, and dl contains c2 */ |
45 | /* and edi contains P, esi contains VRAM[] */ |
46 | /* al will be used for zz, cl will be used for zz2 */ |
47 | "movb %%bl,%%al\n\t" |
48 | "movb %%dl,%%cl\n\t" |
49 | "andb $3,%%al\n\t" |
50 | "andb $3,%%cl\n\t" |
51 | "movb (%%esi,%%eax),%%bh\n\t" |
52 | "movb (%%esi,%%ecx),%%dh\n\t" |
53 | "movb %%bh,6(%%edi)\n\t" |
54 | "movb %%dh,7(%%edi)\n\t" |
55 | |
56 | "movb %%bl,%%al\n\t" |
57 | "movb %%dl,%%cl\n\t" |
58 | "shrb $2,%%al\n\t" |
59 | "shrb $2,%%cl\n\t" |
60 | "andb $3,%%al\n\t" |
61 | "andb $3,%%cl\n\t" |
62 | "movb (%%esi,%%eax),%%bh\n\t" |
63 | "movb (%%esi,%%ecx),%%dh\n\t" |
64 | "movb %%bh,4(%%edi)\n\t" |
65 | "movb %%dh,5(%%edi)\n\t" |
66 | |
67 | "movb %%bl,%%al\n\t" |
68 | "movb %%dl,%%cl\n\t" |
69 | "shrb $4,%%al\n\t" |
70 | "shrb $4,%%cl\n\t" |
71 | "andb $3,%%al\n\t" |
72 | "andb $3,%%cl\n\t" |
73 | "movb (%%esi,%%eax),%%bh\n\t" |
74 | "movb (%%esi,%%ecx),%%dh\n\t" |
75 | "movb %%bh,2(%%edi)\n\t" |
76 | "movb %%dh,3(%%edi)\n\t" |
77 | |
78 | // "movb %%bl,%%al\n\t" |
79 | // "movb %%dl,%%cl\n\t" |
80 | "xorb %%bh,%%bh\n\t" |
81 | "xorb %%dh,%%dh\n\t" |
82 | "shrb $6,%%bl\n\t" |
83 | "shrb $6,%%dl\n\t" |
84 | "movb (%%esi,%%ebx),%%al\n\t" |
85 | "movb (%%esi,%%edx),%%cl\n\t" |
86 | "movb %%al,0(%%edi)\n\t" |
87 | "movb %%cl,1(%%edi)\n\t" |
88 | : "=S" (dummy), "=a" (dummy1), "=b" (dummy2) |
89 | : "D" (P), "S" (C), "a" (cc), "b" (PALRAM) |
90 | : "%ecx", "%edx" |
91 | ); |
92 | |
93 | } |
94 | #else |
95 | { |
96 | uint8 *S=PALRAM+cc; |
97 | register uint8 c1,c2; |
98 | |
99 | c1=((C[0]>>1)&0x55)|(C[8]&0xAA); |
100 | c2=(C[0]&0x55)|((C[8]<<1)&0xAA); |
101 | |
102 | P[6]=S[c1&3]; |
103 | P[7]=S[c2&3]; |
104 | P[4]=S[(c1>>2)&3]; |
105 | P[5]=S[(c2>>2)&3]; |
106 | P[2]=S[(c1>>4)&3]; |
107 | P[3]=S[(c2>>4)&3]; |
108 | |
109 | P[0]=S[c1>>6]; |
110 | P[1]=S[c2>>6]; |
111 | } |
112 | #endif |