src/mess/drivers/x1.c
| r5524 | r5525 | |
| 157 | 157 | gfx_bitmap_ram = auto_alloc_array(machine, UINT8, 0xc000); |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | | static VIDEO_UPDATE( x1 ) |
| 160 | static void draw_fgtilemap(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int w,int pri) |
| 161 | 161 | { |
| 162 | | int y,x,w; |
| 162 | int y,x; |
| 163 | 163 | |
| 164 | | w = (video_screen_get_width(screen) < 640) ? 1 : 2; |
| 165 | | |
| 166 | | bitmap_fill(bitmap, cliprect, screen->machine->pens[0x100]); |
| 167 | | |
| 168 | 164 | for (y=0;y<25;y++) |
| 169 | 165 | { |
| 170 | 166 | for (x=0;x<40*w;x++) |
| r5524 | r5525 | |
| 178 | 174 | |
| 179 | 175 | if(pcg_bank) { region+= 4; } |
| 180 | 176 | |
| 181 | | if(color & 0x8) continue; |
| 182 | | if(tile == 0) continue; |
| 177 | if(((color & 0x8)>>3) != pri) continue; |
| 178 | if(tile == 0) continue; //correct? |
| 183 | 179 | |
| 184 | | drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[region],tile,color,0,0,(x/(width+1))*8*(width+1),(y/(height+1))*8*(height+1)); |
| 180 | drawgfx_opaque(bitmap,cliprect,machine->gfx[region],tile,color,0,0,(x/(width+1))*8*(width+1),(y/(height+1))*8*(height+1)); |
| 185 | 181 | } |
| 186 | 182 | } |
| 183 | } |
| 187 | 184 | |
| 188 | | { |
| 189 | | int count,xi,yi; |
| 190 | | int pen_r,pen_g,pen_b,color; |
| 191 | | int yi_size; |
| 185 | static void draw_gfxbitmap(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int w) |
| 186 | { |
| 187 | int count,xi,yi,x,y; |
| 188 | int pen_r,pen_g,pen_b,color; |
| 189 | int yi_size; |
| 192 | 190 | |
| 193 | | count = 0; |
| 191 | count = 0; |
| 194 | 192 | |
| 195 | | yi_size = (w == 1) ? 16 : 8; |
| 193 | yi_size = (w == 1) ? 16 : 8; |
| 196 | 194 | |
| 197 | | for(yi=0;yi<yi_size;yi++) |
| 195 | for(yi=0;yi<yi_size;yi++) |
| 196 | { |
| 197 | for(y=0;y<200;y+=8) |
| 198 | 198 | { |
| 199 | | for(y=0;y<200;y+=8) |
| 199 | for(x=0;x<(320*w);x+=8) |
| 200 | 200 | { |
| 201 | | for(x=0;x<(320*w);x+=8) |
| 201 | for(xi=0;xi<8;xi++) |
| 202 | 202 | { |
| 203 | | for(xi=0;xi<8;xi++) |
| 204 | | { |
| 205 | | pen_r = (gfx_bitmap_ram[count+0x4000]>>(7-xi)) & 1; |
| 206 | | pen_g = (gfx_bitmap_ram[count+0x8000]>>(7-xi)) & 1; |
| 207 | | pen_b = (gfx_bitmap_ram[count+0x0000]>>(7-xi)) & 1; |
| 203 | pen_b = (gfx_bitmap_ram[count+0x0000]>>(7-xi)) & 1; |
| 204 | pen_r = (gfx_bitmap_ram[count+0x4000]>>(7-xi)) & 1; |
| 205 | pen_g = (gfx_bitmap_ram[count+0x8000]>>(7-xi)) & 1; |
| 208 | 206 | |
| 209 | | color = pen_r<<1 | pen_g<<2 | pen_b<<0; |
| 207 | color = pen_g<<2 | pen_r<<1 | pen_b<<0; |
| 210 | 208 | |
| 211 | | if(color == 0) |
| 212 | | continue; |
| 209 | if(color == 0) |
| 210 | continue; |
| 213 | 211 | |
| 214 | | if(w == 1) |
| 215 | | { |
| 216 | | if(yi & 1) |
| 217 | | continue; |
| 218 | | |
| 219 | | if((x+xi)<=video_screen_get_visible_area(screen)->max_x && ((y)+0)<video_screen_get_visible_area(screen)->max_y) |
| 220 | | *BITMAP_ADDR16(bitmap, y+(yi >> 1), x+xi) = screen->machine->pens[color+0x100]; |
| 221 | | } |
| 222 | | else |
| 223 | | { |
| 224 | | if((x+xi)<=video_screen_get_visible_area(screen)->max_x && ((y)+0)<video_screen_get_visible_area(screen)->max_y) |
| 225 | | *BITMAP_ADDR16(bitmap, y+yi, x+xi) = screen->machine->pens[color+0x100]; |
| 226 | | } |
| 212 | if(w == 1) |
| 213 | { |
| 214 | if(yi & 1) |
| 215 | continue; |
| 216 | if((x+xi)<=video_screen_get_visible_area(machine->primary_screen)->max_x && (y+(yi >> 1))<video_screen_get_visible_area(machine->primary_screen)->max_y) |
| 217 | *BITMAP_ADDR16(bitmap, y+(yi >> 1), x+xi) = machine->pens[color+0x100]; |
| 227 | 218 | } |
| 228 | | count++; |
| 219 | else |
| 220 | { |
| 221 | if((x+xi)<=video_screen_get_visible_area(machine->primary_screen)->max_x && (y+yi)<video_screen_get_visible_area(machine->primary_screen)->max_y) |
| 222 | *BITMAP_ADDR16(bitmap, y+yi, x+xi) = machine->pens[color+0x100]; |
| 223 | } |
| 229 | 224 | } |
| 225 | count++; |
| 230 | 226 | } |
| 231 | | count+= (w == 2) ? 48 : 24; |
| 232 | 227 | } |
| 228 | count+= (w == 2) ? 48 : 24; |
| 233 | 229 | } |
| 230 | } |
| 234 | 231 | |
| 235 | | for (y=0;y<25;y++) |
| 236 | | { |
| 237 | | for (x=0;x<40*w;x++) |
| 238 | | { |
| 239 | | int tile = videoram[x+(y*40*w)]; |
| 240 | | int color = colorram[x+(y*40*w)] & 0x1f; |
| 241 | | int width = (colorram[x+(y*40*w)] & 0x80)>>7; |
| 242 | | int height = (colorram[x+(y*40*w)] & 0x40)>>6; |
| 243 | | int pcg_bank = (colorram[x+(y*40*w)] & 0x20)>>4; |
| 244 | | int region = (width+(height<<1)) & 3; |
| 232 | static VIDEO_UPDATE( x1 ) |
| 233 | { |
| 234 | int w; |
| 245 | 235 | |
| 246 | | if(pcg_bank) { region+= 4; } |
| 236 | w = (video_screen_get_width(screen) < 640) ? 1 : 2; |
| 247 | 237 | |
| 248 | | if(!(color & 0x8)) continue; |
| 238 | bitmap_fill(bitmap, cliprect, screen->machine->pens[0x100]); |
| 249 | 239 | |
| 250 | | drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[region],tile,color,0,0,(x/(width+1))*8*(width+1),(y/(height+1))*8*(height+1)); |
| 251 | | } |
| 252 | | } |
| 240 | draw_fgtilemap(screen->machine,bitmap,cliprect,w,0); |
| 241 | draw_gfxbitmap(screen->machine,bitmap,cliprect,w); |
| 242 | draw_fgtilemap(screen->machine,bitmap,cliprect,w,1); |
| 243 | |
| 253 | 244 | return 0; |
| 254 | 245 | } |
| 255 | 246 | |
| r5524 | r5525 | |
| 717 | 708 | |
| 718 | 709 | for (i = 0; i < 0x20; i++) |
| 719 | 710 | { |
| 720 | | rgb_t color; |
| 711 | UINT8 r,g,b; |
| 721 | 712 | |
| 722 | | if(i >= 0x10) |
| 713 | if(i & 0x01) |
| 723 | 714 | { |
| 724 | | if (i & 0x01) |
| 725 | | color = RGB_WHITE; |
| 726 | | else |
| 727 | | color = MAKE_RGB(pal1bit(i >> 3), pal1bit(i >> 2), pal1bit(i >> 1)); |
| 728 | | |
| 729 | | palette_set_color(machine, 0x2f-i, color); |
| 715 | r = ((i >> 3) & 1) ? 0xff : 0x00; |
| 716 | g = ((i >> 2) & 1) ? 0xff : 0x00; |
| 717 | b = ((i >> 1) & 1) ? 0xff : 0x00; |
| 730 | 718 | } |
| 731 | | else |
| 732 | | { |
| 733 | | if (i & 0x01) |
| 734 | | color = MAKE_RGB(pal1bit(i >> 3), pal1bit(i >> 2), pal1bit(i >> 1)); |
| 735 | | else |
| 736 | | color = RGB_BLACK; |
| 719 | else { r = g = b = 0x00; } |
| 737 | 720 | |
| 738 | | palette_set_color(machine, i, color); |
| 739 | | } |
| 721 | if(i & 0x10) { r^=0xff; g^=0xff; b^=0xff; } |
| 722 | |
| 723 | palette_set_color_rgb(machine, i, r,g,b); |
| 740 | 724 | } |
| 741 | 725 | |
| 742 | 726 | /* TODO: fix this */ |
| r5524 | r5525 | |
| 1141 | 1125 | MDRV_PALETTE_LENGTH(0x300) |
| 1142 | 1126 | MDRV_PALETTE_INIT(x1) |
| 1143 | 1127 | |
| 1144 | | MDRV_MC6845_ADD("crtc", MC6845, XTAL_4MHz/5, mc6845_intf) /* unknown type and clock / divider, hand tuned to get ~60 fps */ |
| 1128 | MDRV_MC6845_ADD("crtc", MC6845, XTAL_3_579545MHz/4, mc6845_intf) /* unknown type and clock / divider, hand tuned to get ~60 fps */ |
| 1145 | 1129 | |
| 1146 | 1130 | MDRV_GFXDECODE(x1) |
| 1147 | 1131 | |