Previous 15994 Revisions Next

r5529 Saturday 29th August, 2009 at 15:49:12 UTC by Angelo Salese
[X1]: Converted the BIOS gfxs to use the custom drawing code
[src/mess/drivers]x1.c

src/mess/drivers/x1.c
r5528r5529
171171         int width = (colorram[x+(y*40*w)] & 0x80)>>7;
172172         int height = (colorram[x+(y*40*w)] & 0x40)>>6;
173173         int pcg_bank = (colorram[x+(y*40*w)] & 0x20)>>5;
174         int region = (width+(height<<1)) & 3;
174         UINT8 *gfx_data = pcg_bank ? memory_region(machine, "pcg") : memory_region(machine, "cgrom");
175175
176176         if(((color & 0x8)>>3) != pri) continue;
177177         if(tile == 0) continue; //correct?
r5528r5529
179179         res_x = (x/(width+1))*8*(width+1);
180180         res_y = (y/(height+1))*8*(height+1);
181181
182         if(pcg_bank)
183182         {
184            UINT8 *PCG_RAM = memory_region(machine, "pcg");
185183            int pen[3],pen_mask,pcg_pen,xi,yi;
186184
187185            pen_mask = color & 7;
188186
189            /* We use custom drawing code for the PCG due of the bitplane disable stuff and the color revert stuff. */
187            /* We use custom drawing code due of the bitplane disable and the color revert stuff. */
190188            for(yi=0;yi<8*(height+1);yi+=(height+1))
191189            {
192190               for(xi=0;xi<8*(width+1);xi+=(width+1))
193191               {
194                  pen[0] = PCG_RAM[((tile*8)+yi/(height+1))+0x0000]>>(7-xi/(width+1)) & (pen_mask & 1)>>0;
195                  pen[1] = PCG_RAM[((tile*8)+yi/(height+1))+0x0800]>>(7-xi/(width+1)) & (pen_mask & 2)>>1;
196                  pen[2] = PCG_RAM[((tile*8)+yi/(height+1))+0x1000]>>(7-xi/(width+1)) & (pen_mask & 4)>>2;
192                  pen[0] = gfx_data[((tile*8)+yi/(height+1))+0x0000]>>(7-xi/(width+1)) & (pen_mask & 1)>>0;
193                  pen[1] = gfx_data[((tile*8)+yi/(height+1))+0x0800]>>(7-xi/(width+1)) & (pen_mask & 2)>>1;
194                  pen[2] = gfx_data[((tile*8)+yi/(height+1))+0x1000]>>(7-xi/(width+1)) & (pen_mask & 4)>>2;
197195
198196                  pcg_pen = pen[2]<<2|pen[1]<<1|pen[0]<<0;
199197
r5528r5529
206204                  if((res_x+xi)>video_screen_get_visible_area(machine->primary_screen)->max_x && (res_y+yi)>video_screen_get_visible_area(machine->primary_screen)->max_y)
207205                     continue;
208206
209                  *BITMAP_ADDR16(bitmap, res_y+yi, res_x+xi) = machine->pens[pcg_pen+0x100];
207                  *BITMAP_ADDR16(bitmap, res_y+yi, res_x+xi) = machine->pens[pcg_pen+0x100*pcg_bank];
210208                  if(width)
211                     *BITMAP_ADDR16(bitmap, res_y+yi, res_x+xi+1) = machine->pens[pcg_pen+0x100];
209                     *BITMAP_ADDR16(bitmap, res_y+yi, res_x+xi+1) = machine->pens[pcg_pen+0x100*pcg_bank];
212210                  if(height)
213                     *BITMAP_ADDR16(bitmap, res_y+yi+1, res_x+xi) = machine->pens[pcg_pen+0x100];
211                     *BITMAP_ADDR16(bitmap, res_y+yi+1, res_x+xi) = machine->pens[pcg_pen+0x100*pcg_bank];
214212                  if(width && height)
215                     *BITMAP_ADDR16(bitmap, res_y+yi+1, res_x+xi+1) = machine->pens[pcg_pen+0x100];
213                     *BITMAP_ADDR16(bitmap, res_y+yi+1, res_x+xi+1) = machine->pens[pcg_pen+0x100*pcg_bank];
216214               }
217215            }
218216         }
219         else
220            drawgfx_opaque(bitmap,cliprect,machine->gfx[region],tile,color,0,0,res_x,res_y);
221217      }
222218   }
223219}
r5528r5529
735731
736732/* TODO: separe the different x1 decodings accordingly */
737733static GFXDECODE_START( x1 )
738   GFXDECODE_ENTRY( "cgrom", 0x00000, x1_chars_8x8,    0, 0x20 )
739   GFXDECODE_ENTRY( "cgrom", 0x00000, x1_chars_8wx8,   0, 0x20 )
740   GFXDECODE_ENTRY( "cgrom", 0x00000, x1_chars_8x8w,   0, 0x20 )
741   GFXDECODE_ENTRY( "cgrom", 0x00000, x1_chars_8wx8w,  0, 0x20 )
742734   /* decoded for debugging purpose, they will be nuked in the end */
735   GFXDECODE_ENTRY( "cgrom", 0x00000, x1_chars_8x8,    0x200, 0x20 )
736   GFXDECODE_ENTRY( "cgrom", 0x00000, x1_chars_8wx8,   0x200, 0x20 )
737   GFXDECODE_ENTRY( "cgrom", 0x00000, x1_chars_8x8w,   0x200, 0x20 )
738   GFXDECODE_ENTRY( "cgrom", 0x00000, x1_chars_8wx8w,  0x200, 0x20 )
743739   GFXDECODE_ENTRY( "pcg",   0x00000, x1_pcg_8x8,      0x100, 1 )
744740   GFXDECODE_ENTRY( "pcg",   0x00000, x1_pcg_8wx8,     0x100, 1 )
745741   GFXDECODE_ENTRY( "pcg",   0x00000, x1_pcg_8x8w,     0x100, 1 )
r5528r5529
755751   for(i=0;i<0x300;i++)
756752      palette_set_color(machine, i,MAKE_RGB(0x00,0x00,0x00));
757753
758   for (i = 0; i < 0x20; i++)
754   for (i = 0x200; i < 0x220; i++)
759755   {
760756      UINT8 r,g,b;
761757
r5528r5529
774770
775771   /* TODO: fix this */
776772   for(i=0;i<8;i++)
773   {
774      palette_set_color_rgb(machine, i+0x000, pal1bit(i >> 2), pal1bit(i >> 1), pal1bit(i >> 0));
777775      palette_set_color_rgb(machine, i+0x100, pal1bit(i >> 2), pal1bit(i >> 1), pal1bit(i >> 0));
776   }
778777}
779778
780779static READ8_DEVICE_HANDLER( x1_porta_r )
r5528r5529
12641263
12651264   ROM_REGION(0x4c600, "cgrom", 0)
12661265   ROM_LOAD("fnt0808.x1", 0x00000, 0x00800, CRC(e3995a57) SHA1(1c1a0d8c9f4c446ccd7470516b215ddca5052fb2) )
1266   ROM_RELOAD(            0x00800, 0x00800)
1267   ROM_RELOAD(            0x01000, 0x00800)
12671268
12681269   ROM_REGION(0x4ac00, "kanji", ROMREGION_ERASEFF)
12691270ROM_END
r5528r5529
12801281
12811282   ROM_REGION(0xc00, "pcg", ROMREGION_ERASEFF)
12821283
1283   ROM_REGION(0x0800, "cgrom", 0)
1284   ROM_LOAD("fnt0808.x1", 0x0000, 0x0800, CRC(e3995a57) SHA1(1c1a0d8c9f4c446ccd7470516b215ddca5052fb2) )
1284   ROM_REGION(0x1800, "cgrom", 0)
1285   ROM_LOAD("fnt0808.x1", 0x00000, 0x00800, CRC(e3995a57) SHA1(1c1a0d8c9f4c446ccd7470516b215ddca5052fb2) )
1286   ROM_RELOAD(            0x00800, 0x00800)
1287   ROM_RELOAD(            0x01000, 0x00800)
12851288
12861289   ROM_REGION(0x4ac00, "kanji", 0)
12871290   /* This is clearly a bad dump: size does not make sense and from 0x28000 on there are only 0xff */
r5528r5529
12971300
12981301   ROM_REGION(0xc00, "pcg", ROMREGION_ERASEFF)
12991302
1300   ROM_REGION(0x0800, "cgrom", 0)
1303   ROM_REGION(0x1800, "cgrom", 0)
13011304   /* This should be larger... hence, we are missing something (maybe part of the other fnt roms?) */
1302   ROM_LOAD("fnt0808.x1", 0x0000, 0x0800, CRC(84a47530) SHA1(06c0995adc7a6609d4272417fe3570ca43bd0454) )
1305   ROM_LOAD("fnt0808.x1", 0x00000, 0x0800, CRC(84a47530) SHA1(06c0995adc7a6609d4272417fe3570ca43bd0454) )
1306   ROM_RELOAD(            0x00800, 0x00800)
1307   ROM_RELOAD(            0x01000, 0x00800)
13031308
13041309   ROM_REGION(0x4ac00, "kanji", 0)
13051310   /* This is clearly a bad dump: size does not make sense and from 0x28000 on there are only 0xff */

Previous 15994 Revisions Next


© 1998-2018 The MESS Team