src/mess/drivers/x1.c
| r5528 | r5529 | |
| 171 | 171 | int width = (colorram[x+(y*40*w)] & 0x80)>>7; |
| 172 | 172 | int height = (colorram[x+(y*40*w)] & 0x40)>>6; |
| 173 | 173 | 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"); |
| 175 | 175 | |
| 176 | 176 | if(((color & 0x8)>>3) != pri) continue; |
| 177 | 177 | if(tile == 0) continue; //correct? |
| r5528 | r5529 | |
| 179 | 179 | res_x = (x/(width+1))*8*(width+1); |
| 180 | 180 | res_y = (y/(height+1))*8*(height+1); |
| 181 | 181 | |
| 182 | | if(pcg_bank) |
| 183 | 182 | { |
| 184 | | UINT8 *PCG_RAM = memory_region(machine, "pcg"); |
| 185 | 183 | int pen[3],pen_mask,pcg_pen,xi,yi; |
| 186 | 184 | |
| 187 | 185 | pen_mask = color & 7; |
| 188 | 186 | |
| 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. */ |
| 190 | 188 | for(yi=0;yi<8*(height+1);yi+=(height+1)) |
| 191 | 189 | { |
| 192 | 190 | for(xi=0;xi<8*(width+1);xi+=(width+1)) |
| 193 | 191 | { |
| 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; |
| 197 | 195 | |
| 198 | 196 | pcg_pen = pen[2]<<2|pen[1]<<1|pen[0]<<0; |
| 199 | 197 | |
| r5528 | r5529 | |
| 206 | 204 | 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) |
| 207 | 205 | continue; |
| 208 | 206 | |
| 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]; |
| 210 | 208 | 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]; |
| 212 | 210 | 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]; |
| 214 | 212 | 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]; |
| 216 | 214 | } |
| 217 | 215 | } |
| 218 | 216 | } |
| 219 | | else |
| 220 | | drawgfx_opaque(bitmap,cliprect,machine->gfx[region],tile,color,0,0,res_x,res_y); |
| 221 | 217 | } |
| 222 | 218 | } |
| 223 | 219 | } |
| r5528 | r5529 | |
| 735 | 731 | |
| 736 | 732 | /* TODO: separe the different x1 decodings accordingly */ |
| 737 | 733 | static 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 ) |
| 742 | 734 | /* 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 ) |
| 743 | 739 | GFXDECODE_ENTRY( "pcg", 0x00000, x1_pcg_8x8, 0x100, 1 ) |
| 744 | 740 | GFXDECODE_ENTRY( "pcg", 0x00000, x1_pcg_8wx8, 0x100, 1 ) |
| 745 | 741 | GFXDECODE_ENTRY( "pcg", 0x00000, x1_pcg_8x8w, 0x100, 1 ) |
| r5528 | r5529 | |
| 755 | 751 | for(i=0;i<0x300;i++) |
| 756 | 752 | palette_set_color(machine, i,MAKE_RGB(0x00,0x00,0x00)); |
| 757 | 753 | |
| 758 | | for (i = 0; i < 0x20; i++) |
| 754 | for (i = 0x200; i < 0x220; i++) |
| 759 | 755 | { |
| 760 | 756 | UINT8 r,g,b; |
| 761 | 757 | |
| r5528 | r5529 | |
| 774 | 770 | |
| 775 | 771 | /* TODO: fix this */ |
| 776 | 772 | for(i=0;i<8;i++) |
| 773 | { |
| 774 | palette_set_color_rgb(machine, i+0x000, pal1bit(i >> 2), pal1bit(i >> 1), pal1bit(i >> 0)); |
| 777 | 775 | palette_set_color_rgb(machine, i+0x100, pal1bit(i >> 2), pal1bit(i >> 1), pal1bit(i >> 0)); |
| 776 | } |
| 778 | 777 | } |
| 779 | 778 | |
| 780 | 779 | static READ8_DEVICE_HANDLER( x1_porta_r ) |
| r5528 | r5529 | |
| 1264 | 1263 | |
| 1265 | 1264 | ROM_REGION(0x4c600, "cgrom", 0) |
| 1266 | 1265 | ROM_LOAD("fnt0808.x1", 0x00000, 0x00800, CRC(e3995a57) SHA1(1c1a0d8c9f4c446ccd7470516b215ddca5052fb2) ) |
| 1266 | ROM_RELOAD( 0x00800, 0x00800) |
| 1267 | ROM_RELOAD( 0x01000, 0x00800) |
| 1267 | 1268 | |
| 1268 | 1269 | ROM_REGION(0x4ac00, "kanji", ROMREGION_ERASEFF) |
| 1269 | 1270 | ROM_END |
| r5528 | r5529 | |
| 1280 | 1281 | |
| 1281 | 1282 | ROM_REGION(0xc00, "pcg", ROMREGION_ERASEFF) |
| 1282 | 1283 | |
| 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) |
| 1285 | 1288 | |
| 1286 | 1289 | ROM_REGION(0x4ac00, "kanji", 0) |
| 1287 | 1290 | /* This is clearly a bad dump: size does not make sense and from 0x28000 on there are only 0xff */ |
| r5528 | r5529 | |
| 1297 | 1300 | |
| 1298 | 1301 | ROM_REGION(0xc00, "pcg", ROMREGION_ERASEFF) |
| 1299 | 1302 | |
| 1300 | | ROM_REGION(0x0800, "cgrom", 0) |
| 1303 | ROM_REGION(0x1800, "cgrom", 0) |
| 1301 | 1304 | /* 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) |
| 1303 | 1308 | |
| 1304 | 1309 | ROM_REGION(0x4ac00, "kanji", 0) |
| 1305 | 1310 | /* This is clearly a bad dump: size does not make sense and from 0x28000 on there are only 0xff */ |