Commit e3a4e4b64302b7bd38f206421113312b427d35c8
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
Showing
2 changed files
with
26 additions
and
19 deletions
hw/cirrus_vga.c
... | ... | @@ -800,7 +800,7 @@ static void cirrus_bitblt_start(CirrusVGAState * s) |
800 | 800 | s->cirrus_blt_srcpitch, |
801 | 801 | s->cirrus_blt_dstaddr, |
802 | 802 | s->cirrus_blt_srcaddr, |
803 | - s->sr[0x2f]); | |
803 | + s->gr[0x2f]); | |
804 | 804 | #endif |
805 | 805 | |
806 | 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 | 1042 | else |
1043 | 1043 | offset <<= 12; |
1044 | 1044 | |
1045 | - if (s->vram_size <= offset) | |
1045 | + if (s->real_vram_size <= offset) | |
1046 | 1046 | limit = 0; |
1047 | 1047 | else |
1048 | - limit = s->vram_size - offset; | |
1048 | + limit = s->real_vram_size - offset; | |
1049 | 1049 | |
1050 | 1050 | if (((s->gr[0x0b] & 0x01) == 0) && (bank_index != 0)) { |
1051 | 1051 | if (limit > 0x8000) { |
... | ... | @@ -1213,7 +1213,7 @@ cirrus_hook_write_sr(CirrusVGAState * s, unsigned reg_index, int reg_value) |
1213 | 1213 | #endif |
1214 | 1214 | break; |
1215 | 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 | 1217 | cirrus_update_memory_access(s); |
1218 | 1218 | break; |
1219 | 1219 | default: | ... | ... |
hw/cirrus_vga_rop2.h
... | ... | @@ -47,6 +47,7 @@ glue(glue(glue(cirrus_patternfill_, ROP_NAME), _),DEPTH) |
47 | 47 | int x, y, pattern_y, pattern_pitch, pattern_x; |
48 | 48 | unsigned int col; |
49 | 49 | const uint8_t *src1; |
50 | + int skipleft = (s->gr[0x2f] & 0x07) * (DEPTH / 8); | |
50 | 51 | |
51 | 52 | #if DEPTH == 8 |
52 | 53 | pattern_pitch = 8; |
... | ... | @@ -56,11 +57,11 @@ glue(glue(glue(cirrus_patternfill_, ROP_NAME), _),DEPTH) |
56 | 57 | pattern_pitch = 32; |
57 | 58 | #endif |
58 | 59 | pattern_y = s->cirrus_blt_srcaddr & 7; |
59 | - pattern_x = 0; | |
60 | + pattern_x = skipleft; | |
60 | 61 | for(y = 0; y < bltheight; y++) { |
61 | - d = dst; | |
62 | + d = dst + skipleft; | |
62 | 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 | 65 | #if DEPTH == 8 |
65 | 66 | col = src1[pattern_x]; |
66 | 67 | pattern_x = (pattern_x + 1) & 7; |
... | ... | @@ -99,7 +100,8 @@ glue(glue(glue(cirrus_colorexpand_transp_, ROP_NAME), _),DEPTH) |
99 | 100 | unsigned int col; |
100 | 101 | unsigned bitmask; |
101 | 102 | unsigned index; |
102 | - int srcskipleft = 0; | |
103 | + int srcskipleft = s->gr[0x2f] & 0x07; | |
104 | + int dstskipleft = srcskipleft * (DEPTH / 8); | |
103 | 105 | |
104 | 106 | if (s->cirrus_blt_modeext & CIRRUS_BLTMODEEXT_COLOREXPINV) { |
105 | 107 | bits_xor = 0xff; |
... | ... | @@ -112,8 +114,8 @@ glue(glue(glue(cirrus_colorexpand_transp_, ROP_NAME), _),DEPTH) |
112 | 114 | for(y = 0; y < bltheight; y++) { |
113 | 115 | bitmask = 0x80 >> srcskipleft; |
114 | 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 | 119 | if ((bitmask & 0xff) == 0) { |
118 | 120 | bitmask = 0x80; |
119 | 121 | bits = *src++ ^ bits_xor; |
... | ... | @@ -142,15 +144,16 @@ glue(glue(glue(cirrus_colorexpand_, ROP_NAME), _),DEPTH) |
142 | 144 | unsigned bits; |
143 | 145 | unsigned int col; |
144 | 146 | unsigned bitmask; |
145 | - int srcskipleft = 0; | |
147 | + int srcskipleft = s->gr[0x2f] & 0x07; | |
148 | + int dstskipleft = srcskipleft * (DEPTH / 8); | |
146 | 149 | |
147 | 150 | colors[0] = s->cirrus_blt_bgcol; |
148 | 151 | colors[1] = s->cirrus_blt_fgcol; |
149 | 152 | for(y = 0; y < bltheight; y++) { |
150 | 153 | bitmask = 0x80 >> srcskipleft; |
151 | 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 | 157 | if ((bitmask & 0xff) == 0) { |
155 | 158 | bitmask = 0x80; |
156 | 159 | bits = *src++; |
... | ... | @@ -175,6 +178,8 @@ glue(glue(glue(cirrus_colorexpand_pattern_transp_, ROP_NAME), _),DEPTH) |
175 | 178 | int x, y, bitpos, pattern_y; |
176 | 179 | unsigned int bits, bits_xor; |
177 | 180 | unsigned int col; |
181 | + int srcskipleft = s->gr[0x2f] & 0x07; | |
182 | + int dstskipleft = srcskipleft * (DEPTH / 8); | |
178 | 183 | |
179 | 184 | if (s->cirrus_blt_modeext & CIRRUS_BLTMODEEXT_COLOREXPINV) { |
180 | 185 | bits_xor = 0xff; |
... | ... | @@ -187,9 +192,9 @@ glue(glue(glue(cirrus_colorexpand_pattern_transp_, ROP_NAME), _),DEPTH) |
187 | 192 | |
188 | 193 | for(y = 0; y < bltheight; y++) { |
189 | 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 | 198 | if ((bits >> bitpos) & 1) { |
194 | 199 | PUTPIXEL(); |
195 | 200 | } |
... | ... | @@ -213,6 +218,8 @@ glue(glue(glue(cirrus_colorexpand_pattern_, ROP_NAME), _),DEPTH) |
213 | 218 | int x, y, bitpos, pattern_y; |
214 | 219 | unsigned int bits; |
215 | 220 | unsigned int col; |
221 | + int srcskipleft = s->gr[0x2f] & 0x07; | |
222 | + int dstskipleft = srcskipleft * (DEPTH / 8); | |
216 | 223 | |
217 | 224 | colors[0] = s->cirrus_blt_bgcol; |
218 | 225 | colors[1] = s->cirrus_blt_fgcol; |
... | ... | @@ -220,9 +227,9 @@ glue(glue(glue(cirrus_colorexpand_pattern_, ROP_NAME), _),DEPTH) |
220 | 227 | |
221 | 228 | for(y = 0; y < bltheight; y++) { |
222 | 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 | 233 | col = colors[(bits >> bitpos) & 1]; |
227 | 234 | PUTPIXEL(); |
228 | 235 | d += (DEPTH / 8); | ... | ... |