Commit e3a4e4b64302b7bd38f206421113312b427d35c8

Authored by bellard
1 parent 40545f84

destination write mask support, fixed banked memory access, read-only access for…

… bus type in SR 0x17 (Volker Ruppert)


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1364 c046a42c-6fe2-441c-8c8c-71466251a162
hw/cirrus_vga.c
@@ -800,7 +800,7 @@ static void cirrus_bitblt_start(CirrusVGAState * s) @@ -800,7 +800,7 @@ static void cirrus_bitblt_start(CirrusVGAState * s)
800 s->cirrus_blt_srcpitch, 800 s->cirrus_blt_srcpitch,
801 s->cirrus_blt_dstaddr, 801 s->cirrus_blt_dstaddr,
802 s->cirrus_blt_srcaddr, 802 s->cirrus_blt_srcaddr,
803 - s->sr[0x2f]); 803 + s->gr[0x2f]);
804 #endif 804 #endif
805 805
806 switch (s->cirrus_blt_mode & CIRRUS_BLTMODE_PIXELWIDTHMASK) { 806 switch (s->cirrus_blt_mode & CIRRUS_BLTMODE_PIXELWIDTHMASK) {
@@ -1042,10 +1042,10 @@ static void cirrus_update_bank_ptr(CirrusVGAState * s, unsigned bank_index) @@ -1042,10 +1042,10 @@ static void cirrus_update_bank_ptr(CirrusVGAState * s, unsigned bank_index)
1042 else 1042 else
1043 offset <<= 12; 1043 offset <<= 12;
1044 1044
1045 - if (s->vram_size <= offset) 1045 + if (s->real_vram_size <= offset)
1046 limit = 0; 1046 limit = 0;
1047 else 1047 else
1048 - limit = s->vram_size - offset; 1048 + limit = s->real_vram_size - offset;
1049 1049
1050 if (((s->gr[0x0b] & 0x01) == 0) && (bank_index != 0)) { 1050 if (((s->gr[0x0b] & 0x01) == 0) && (bank_index != 0)) {
1051 if (limit > 0x8000) { 1051 if (limit > 0x8000) {
@@ -1213,7 +1213,7 @@ cirrus_hook_write_sr(CirrusVGAState * s, unsigned reg_index, int reg_value) @@ -1213,7 +1213,7 @@ cirrus_hook_write_sr(CirrusVGAState * s, unsigned reg_index, int reg_value)
1213 #endif 1213 #endif
1214 break; 1214 break;
1215 case 0x17: // Configuration Readback and Extended Control 1215 case 0x17: // Configuration Readback and Extended Control
1216 - s->sr[reg_index] = reg_value; 1216 + s->sr[reg_index] = (s->sr[reg_index] & 0x38) | (reg_value & 0xc7);
1217 cirrus_update_memory_access(s); 1217 cirrus_update_memory_access(s);
1218 break; 1218 break;
1219 default: 1219 default:
hw/cirrus_vga_rop2.h
@@ -47,6 +47,7 @@ glue(glue(glue(cirrus_patternfill_, ROP_NAME), _),DEPTH) @@ -47,6 +47,7 @@ glue(glue(glue(cirrus_patternfill_, ROP_NAME), _),DEPTH)
47 int x, y, pattern_y, pattern_pitch, pattern_x; 47 int x, y, pattern_y, pattern_pitch, pattern_x;
48 unsigned int col; 48 unsigned int col;
49 const uint8_t *src1; 49 const uint8_t *src1;
  50 + int skipleft = (s->gr[0x2f] & 0x07) * (DEPTH / 8);
50 51
51 #if DEPTH == 8 52 #if DEPTH == 8
52 pattern_pitch = 8; 53 pattern_pitch = 8;
@@ -56,11 +57,11 @@ glue(glue(glue(cirrus_patternfill_, ROP_NAME), _),DEPTH) @@ -56,11 +57,11 @@ glue(glue(glue(cirrus_patternfill_, ROP_NAME), _),DEPTH)
56 pattern_pitch = 32; 57 pattern_pitch = 32;
57 #endif 58 #endif
58 pattern_y = s->cirrus_blt_srcaddr & 7; 59 pattern_y = s->cirrus_blt_srcaddr & 7;
59 - pattern_x = 0; 60 + pattern_x = skipleft;
60 for(y = 0; y < bltheight; y++) { 61 for(y = 0; y < bltheight; y++) {
61 - d = dst; 62 + d = dst + skipleft;
62 src1 = src + pattern_y * pattern_pitch; 63 src1 = src + pattern_y * pattern_pitch;
63 - for (x = 0; x < bltwidth; x += (DEPTH / 8)) { 64 + for (x = skipleft; x < bltwidth; x += (DEPTH / 8)) {
64 #if DEPTH == 8 65 #if DEPTH == 8
65 col = src1[pattern_x]; 66 col = src1[pattern_x];
66 pattern_x = (pattern_x + 1) & 7; 67 pattern_x = (pattern_x + 1) & 7;
@@ -99,7 +100,8 @@ glue(glue(glue(cirrus_colorexpand_transp_, ROP_NAME), _),DEPTH) @@ -99,7 +100,8 @@ glue(glue(glue(cirrus_colorexpand_transp_, ROP_NAME), _),DEPTH)
99 unsigned int col; 100 unsigned int col;
100 unsigned bitmask; 101 unsigned bitmask;
101 unsigned index; 102 unsigned index;
102 - int srcskipleft = 0; 103 + int srcskipleft = s->gr[0x2f] & 0x07;
  104 + int dstskipleft = srcskipleft * (DEPTH / 8);
103 105
104 if (s->cirrus_blt_modeext & CIRRUS_BLTMODEEXT_COLOREXPINV) { 106 if (s->cirrus_blt_modeext & CIRRUS_BLTMODEEXT_COLOREXPINV) {
105 bits_xor = 0xff; 107 bits_xor = 0xff;
@@ -112,8 +114,8 @@ glue(glue(glue(cirrus_colorexpand_transp_, ROP_NAME), _),DEPTH) @@ -112,8 +114,8 @@ glue(glue(glue(cirrus_colorexpand_transp_, ROP_NAME), _),DEPTH)
112 for(y = 0; y < bltheight; y++) { 114 for(y = 0; y < bltheight; y++) {
113 bitmask = 0x80 >> srcskipleft; 115 bitmask = 0x80 >> srcskipleft;
114 bits = *src++ ^ bits_xor; 116 bits = *src++ ^ bits_xor;
115 - d = dst;  
116 - for (x = 0; x < bltwidth; x += (DEPTH / 8)) { 117 + d = dst + dstskipleft;
  118 + for (x = dstskipleft; x < bltwidth; x += (DEPTH / 8)) {
117 if ((bitmask & 0xff) == 0) { 119 if ((bitmask & 0xff) == 0) {
118 bitmask = 0x80; 120 bitmask = 0x80;
119 bits = *src++ ^ bits_xor; 121 bits = *src++ ^ bits_xor;
@@ -142,15 +144,16 @@ glue(glue(glue(cirrus_colorexpand_, ROP_NAME), _),DEPTH) @@ -142,15 +144,16 @@ glue(glue(glue(cirrus_colorexpand_, ROP_NAME), _),DEPTH)
142 unsigned bits; 144 unsigned bits;
143 unsigned int col; 145 unsigned int col;
144 unsigned bitmask; 146 unsigned bitmask;
145 - int srcskipleft = 0; 147 + int srcskipleft = s->gr[0x2f] & 0x07;
  148 + int dstskipleft = srcskipleft * (DEPTH / 8);
146 149
147 colors[0] = s->cirrus_blt_bgcol; 150 colors[0] = s->cirrus_blt_bgcol;
148 colors[1] = s->cirrus_blt_fgcol; 151 colors[1] = s->cirrus_blt_fgcol;
149 for(y = 0; y < bltheight; y++) { 152 for(y = 0; y < bltheight; y++) {
150 bitmask = 0x80 >> srcskipleft; 153 bitmask = 0x80 >> srcskipleft;
151 bits = *src++; 154 bits = *src++;
152 - d = dst;  
153 - for (x = 0; x < bltwidth; x += (DEPTH / 8)) { 155 + d = dst + dstskipleft;
  156 + for (x = dstskipleft; x < bltwidth; x += (DEPTH / 8)) {
154 if ((bitmask & 0xff) == 0) { 157 if ((bitmask & 0xff) == 0) {
155 bitmask = 0x80; 158 bitmask = 0x80;
156 bits = *src++; 159 bits = *src++;
@@ -175,6 +178,8 @@ glue(glue(glue(cirrus_colorexpand_pattern_transp_, ROP_NAME), _),DEPTH) @@ -175,6 +178,8 @@ glue(glue(glue(cirrus_colorexpand_pattern_transp_, ROP_NAME), _),DEPTH)
175 int x, y, bitpos, pattern_y; 178 int x, y, bitpos, pattern_y;
176 unsigned int bits, bits_xor; 179 unsigned int bits, bits_xor;
177 unsigned int col; 180 unsigned int col;
  181 + int srcskipleft = s->gr[0x2f] & 0x07;
  182 + int dstskipleft = srcskipleft * (DEPTH / 8);
178 183
179 if (s->cirrus_blt_modeext & CIRRUS_BLTMODEEXT_COLOREXPINV) { 184 if (s->cirrus_blt_modeext & CIRRUS_BLTMODEEXT_COLOREXPINV) {
180 bits_xor = 0xff; 185 bits_xor = 0xff;
@@ -187,9 +192,9 @@ glue(glue(glue(cirrus_colorexpand_pattern_transp_, ROP_NAME), _),DEPTH) @@ -187,9 +192,9 @@ glue(glue(glue(cirrus_colorexpand_pattern_transp_, ROP_NAME), _),DEPTH)
187 192
188 for(y = 0; y < bltheight; y++) { 193 for(y = 0; y < bltheight; y++) {
189 bits = src[pattern_y] ^ bits_xor; 194 bits = src[pattern_y] ^ bits_xor;
190 - bitpos = 7;  
191 - d = dst;  
192 - for (x = 0; x < bltwidth; x += (DEPTH / 8)) { 195 + bitpos = 7 - srcskipleft;
  196 + d = dst + dstskipleft;
  197 + for (x = dstskipleft; x < bltwidth; x += (DEPTH / 8)) {
193 if ((bits >> bitpos) & 1) { 198 if ((bits >> bitpos) & 1) {
194 PUTPIXEL(); 199 PUTPIXEL();
195 } 200 }
@@ -213,6 +218,8 @@ glue(glue(glue(cirrus_colorexpand_pattern_, ROP_NAME), _),DEPTH) @@ -213,6 +218,8 @@ glue(glue(glue(cirrus_colorexpand_pattern_, ROP_NAME), _),DEPTH)
213 int x, y, bitpos, pattern_y; 218 int x, y, bitpos, pattern_y;
214 unsigned int bits; 219 unsigned int bits;
215 unsigned int col; 220 unsigned int col;
  221 + int srcskipleft = s->gr[0x2f] & 0x07;
  222 + int dstskipleft = srcskipleft * (DEPTH / 8);
216 223
217 colors[0] = s->cirrus_blt_bgcol; 224 colors[0] = s->cirrus_blt_bgcol;
218 colors[1] = s->cirrus_blt_fgcol; 225 colors[1] = s->cirrus_blt_fgcol;
@@ -220,9 +227,9 @@ glue(glue(glue(cirrus_colorexpand_pattern_, ROP_NAME), _),DEPTH) @@ -220,9 +227,9 @@ glue(glue(glue(cirrus_colorexpand_pattern_, ROP_NAME), _),DEPTH)
220 227
221 for(y = 0; y < bltheight; y++) { 228 for(y = 0; y < bltheight; y++) {
222 bits = src[pattern_y]; 229 bits = src[pattern_y];
223 - bitpos = 7;  
224 - d = dst;  
225 - for (x = 0; x < bltwidth; x += (DEPTH / 8)) { 230 + bitpos = 7 - srcskipleft;
  231 + d = dst + dstskipleft;
  232 + for (x = dstskipleft; x < bltwidth; x += (DEPTH / 8)) {
226 col = colors[(bits >> bitpos) & 1]; 233 col = colors[(bits >> bitpos) & 1];
227 PUTPIXEL(); 234 PUTPIXEL();
228 d += (DEPTH / 8); 235 d += (DEPTH / 8);