void blstroid_scanline_update(const device_config *screen, int scanline) { int offset = (scanline / 8) * 64 + 40; /* check for interrupts */ if (offset < 0x1000) if (atarigen_playfield[offset] & 0x8000) { int width, vpos; attotime period_on; attotime period_off; /* FIXME: - the only thing this IRQ does it tweak the starting MO link */ /* unfortunately, it does it too early for the given MOs! */ /* perhaps it is not actually hooked up on the real PCB... */ return; /* set a timer to turn the interrupt on at HBLANK of the 7th scanline */ /* and another to turn it off one scanline later */ width = video_screen_get_width(screen); vpos = video_screen_get_vpos(screen); period_on = video_screen_get_time_until_pos(screen, vpos + 7, width * 0.9); period_off = video_screen_get_time_until_pos(screen, vpos + 8, width * 0.9); timer_set(period_on, NULL, 0, irq_on); timer_set(period_off, NULL, 0, irq_off); } }
void nbmj8891_vramflip(int vram) { static int nbmj8891_flipscreen_old = 0; int x, y; UINT8 color1, color2; UINT8 *vidram; int width = video_screen_get_width(Machine->primary_screen); int height = video_screen_get_height(Machine->primary_screen); if (nbmj8891_flipscreen == nbmj8891_flipscreen_old) return; vidram = vram ? nbmj8891_videoram1 : nbmj8891_videoram0; for (y = 0; y < (height / 2); y++) { for (x = 0; x < width; x++) { color1 = vidram[(y * width) + x]; color2 = vidram[((y ^ 0xff) * width) + (x ^ 0x1ff)]; vidram[(y * width) + x] = color2; vidram[((y ^ 0xff) * width) + (x ^ 0x1ff)] = color1; } } nbmj8891_flipscreen_old = nbmj8891_flipscreen; nbmj8891_screen_refresh = 1; }
static void nbmj8991_vramflip(running_machine *machine) { static int nbmj8991_flipscreen_old = 0; int x, y; UINT8 color1, color2; int width = video_screen_get_width(machine->primary_screen); int height = video_screen_get_height(machine->primary_screen); if (nbmj8991_flipscreen == nbmj8991_flipscreen_old) return; for (y = 0; y < height / 2; y++) { for (x = 0; x < width / 2; x++) { // rotate 180 degrees ( 0, 0) - ( 511, 511) color1 = nbmj8991_videoram[(y * width) + x]; color2 = nbmj8991_videoram[(((height - 1) - y) * width) + (((width / 2) - 1) - x)]; nbmj8991_videoram[(y * width) + x] = color2; nbmj8991_videoram[(((height - 1) - y) * width) + (((width / 2) - 1) - x)] = color1; // rotate 180 degrees ( 512, 0) - (1023, 511) color1 = nbmj8991_videoram[(y * width) + (x + (width / 2))]; color2 = nbmj8991_videoram[(((height - 1) - y) * width) + ((((width / 2) - 1) - x) + (width / 2))]; nbmj8991_videoram[(y * width) + (x + (width / 2))] = color2; nbmj8991_videoram[(((height - 1) - y) * width) + ((((width / 2) - 1) - x) + (width / 2))] = color1; } } nbmj8991_flipscreen_old = nbmj8991_flipscreen; nbmj8991_screen_refresh = 1; }
static void TMS9928A_start (running_machine *machine, const TMS9928a_interface *intf) { assert_always(((intf->vram == 0x1000) || (intf->vram == 0x2000) || (intf->vram == 0x4000)), "4, 8 or 16 kB vram please"); tms.model = intf->model; tms.top_border = TMS_50HZ ? TOP_BORDER_50HZ : TOP_BORDER_60HZ; tms.bottom_border = TMS_50HZ ? BOTTOM_BORDER_50HZ : BOTTOM_BORDER_60HZ; tms.INTCallback = intf->int_callback; /* determine the visible area */ tms.visarea.min_x = LEFT_BORDER - MIN(intf->borderx, LEFT_BORDER); tms.visarea.max_x = LEFT_BORDER + 32*8 - 1 + MIN(intf->borderx, RIGHT_BORDER); tms.visarea.min_y = tms.top_border - MIN(intf->bordery, tms.top_border); tms.visarea.max_y = tms.top_border + 24*8 - 1 + MIN(intf->bordery, tms.bottom_border); /* configure the screen if we weren't overridden */ if (video_screen_get_width(machine->primary_screen) == LEFT_BORDER+32*8+RIGHT_BORDER && video_screen_get_height(machine->primary_screen) == TOP_BORDER_60HZ+24*8+BOTTOM_BORDER_60HZ) video_screen_configure(machine->primary_screen, LEFT_BORDER + 32*8 + RIGHT_BORDER, tms.top_border + 24*8 + tms.bottom_border, &tms.visarea, video_screen_get_frame_period(machine->primary_screen).attoseconds); /* Video RAM */ tms.vramsize = intf->vram; tms.vMem = auto_alloc_array_clear(machine, UINT8, intf->vram); /* Sprite back buffer */ tms.dBackMem = auto_alloc_array(machine, UINT8, IMAGE_SIZE); /* back bitmap */ tms.tmpbmp = auto_bitmap_alloc (machine, 256, 192, video_screen_get_format(machine->primary_screen)); TMS9928A_reset (); tms.LimitSprites = 1; state_save_register_item(machine, "tms9928a", NULL, 0, tms.Regs[0]); state_save_register_item(machine, "tms9928a", NULL, 0, tms.Regs[1]); state_save_register_item(machine, "tms9928a", NULL, 0, tms.Regs[2]); state_save_register_item(machine, "tms9928a", NULL, 0, tms.Regs[3]); state_save_register_item(machine, "tms9928a", NULL, 0, tms.Regs[4]); state_save_register_item(machine, "tms9928a", NULL, 0, tms.Regs[5]); state_save_register_item(machine, "tms9928a", NULL, 0, tms.Regs[6]); state_save_register_item(machine, "tms9928a", NULL, 0, tms.Regs[7]); state_save_register_item(machine, "tms9928a", NULL, 0, tms.StatusReg); state_save_register_item(machine, "tms9928a", NULL, 0, tms.ReadAhead); state_save_register_item(machine, "tms9928a", NULL, 0, tms.FirstByte); state_save_register_item(machine, "tms9928a", NULL, 0, tms.latch); state_save_register_item(machine, "tms9928a", NULL, 0, tms.Addr); state_save_register_item(machine, "tms9928a", NULL, 0, tms.INT); state_save_register_item_pointer(machine, "tms9928a", NULL, 0, tms.vMem, intf->vram); }
static void nbmj8891_gfxdraw(void) { UINT8 *GFX = memory_region(REGION_GFX1); int width = video_screen_get_width(Machine->primary_screen); int x, y; int dx1, dx2, dy1, dy2; int startx, starty; int sizex, sizey; int skipx, skipy; int ctrx, ctry; UINT8 color, color1, color2; int gfxaddr; nb1413m3_busyctr = 0; startx = blitter_destx + blitter_sizex; starty = blitter_desty + blitter_sizey; if (blitter_direction_x) { sizex = blitter_sizex ^ 0xff; skipx = 1; } else { sizex = blitter_sizex; skipx = -1; } if (blitter_direction_y) { sizey = blitter_sizey ^ 0xff; skipy = 1; } else { sizey = blitter_sizey; skipy = -1; } gfxaddr = (nbmj8891_gfxrom << 17) + (blitter_src_addr << 1); for (y = starty, ctry = sizey; ctry >= 0; y += skipy, ctry--) { for (x = startx, ctrx = sizex; ctrx >= 0; x += skipx, ctrx--) { if ((gfxaddr > (memory_region_length(REGION_GFX1) - 1))) { #ifdef MAME_DEBUG popmessage("GFXROM ADDRESS OVER!!"); #endif gfxaddr &= (memory_region_length(REGION_GFX1) - 1); } color = GFX[gfxaddr++]; // for hanamomo if ((nb1413m3_type == NB1413M3_HANAMOMO) && ((gfxaddr >= 0x20000) && (gfxaddr < 0x28000))) { color |= ((color & 0x0f) << 4); } dx1 = (2 * x + 0) & 0x1ff; dx2 = (2 * x + 1) & 0x1ff; if (gfxdraw_mode) { // 2 layer type dy1 = y & 0xff; dy2 = (y + nbmj8891_scrolly) & 0xff; } else { // 1 layer type dy1 = (y + nbmj8891_scrolly) & 0xff; dy2 = 0; } if (!nbmj8891_flipscreen) { dx1 ^= 0x1ff; dx2 ^= 0x1ff; dy1 ^= 0xff; dy2 ^= 0xff; } if (blitter_direction_x) { // flip color1 = (color & 0x0f) >> 0; color2 = (color & 0xf0) >> 4; } else { // normal color1 = (color & 0xf0) >> 4; color2 = (color & 0x0f) >> 0; } color1 = nbmj8891_clut[((nbmj8891_clutsel & 0x7f) << 4) + color1]; color2 = nbmj8891_clut[((nbmj8891_clutsel & 0x7f) << 4) + color2]; if ((!gfxdraw_mode) || (nbmj8891_vram & 0x01)) { // layer 1 if (color1 != 0xff) { nbmj8891_videoram0[(dy1 * width) + dx1] = color1; update_pixel0(dx1, dy1); } if (color2 != 0xff) { nbmj8891_videoram0[(dy1 * width) + dx2] = color2; update_pixel0(dx2, dy1); } } if (gfxdraw_mode && (nbmj8891_vram & 0x02)) { // layer 2 if (nbmj8891_vram & 0x08) { // transparent enable if (color1 != 0xff) { nbmj8891_videoram1[(dy2 * width) + dx1] = color1; update_pixel1(dx1, dy2); } if (color2 != 0xff) { nbmj8891_videoram1[(dy2 * width) + dx2] = color2; update_pixel1(dx2, dy2); } } else { // transparent disable nbmj8891_videoram1[(dy2 * width) + dx1] = color1; update_pixel1(dx1, dy2); nbmj8891_videoram1[(dy2 * width) + dx2] = color2; update_pixel1(dx2, dy2); } } nb1413m3_busyctr++; } }
static void update_pixel1(int x, int y) { UINT8 color = nbmj8891_videoram1[(y * video_screen_get_width(Machine->primary_screen)) + x]; *BITMAP_ADDR16(nbmj8891_tmpbitmap1, y, x) = (color == 0x7f) ? 0xff : color; }
static void update_pixel0(int x, int y) { UINT8 color = nbmj8891_videoram0[(y * video_screen_get_width(Machine->primary_screen)) + x]; *BITMAP_ADDR16(nbmj8891_tmpbitmap0, y, x) = color; }
static void nbmj8991_gfxdraw(running_machine *machine) { UINT8 *GFX = memory_region(machine, "gfx1"); int width = video_screen_get_width(machine->primary_screen); int x, y; int dx1, dx2, dy; int startx, starty; int sizex, sizey; int skipx, skipy; int ctrx, ctry; UINT8 color, color1, color2; int gfxaddr, gfxlen; nb1413m3_busyctr = 0; if (blitter_direction_x) { startx = blitter_destx; sizex = blitter_sizex ^ 0xff; skipx = 1; } else { startx = blitter_destx + blitter_sizex; sizex = blitter_sizex; skipx = -1; } if (blitter_direction_y) { starty = blitter_desty; sizey = blitter_sizey ^ 0xff; skipy = 1; } else { starty = blitter_desty + blitter_sizey; sizey = blitter_sizey; skipy = -1; } gfxlen = memory_region_length(machine, "gfx1"); gfxaddr = (nbmj8991_gfxrom << 17) + (blitter_src_addr << 1); for (y = starty, ctry = sizey; ctry >= 0; y += skipy, ctry--) { for (x = startx, ctrx = sizex; ctrx >= 0; x += skipx, ctrx--) { if ((gfxaddr > (gfxlen - 1))) { #ifdef MAME_DEBUG popmessage("GFXROM ADDRESS OVER!!"); #endif gfxaddr &= (gfxlen - 1); } color = GFX[gfxaddr++]; dx1 = (2 * x + 0) & 0x3ff; dx2 = (2 * x + 1) & 0x3ff; dy = y & 0x1ff; if (!nbmj8991_flipscreen) { dx1 ^= 0x1ff; dx2 ^= 0x1ff; dy ^= 0x1ff; } if (blitter_direction_x) { // flip color1 = (color & 0x0f) >> 0; color2 = (color & 0xf0) >> 4; } else { // normal color1 = (color & 0xf0) >> 4; color2 = (color & 0x0f) >> 0; } color1 = nbmj8991_clut[((nbmj8991_clutsel & 0x7f) * 0x10) + color1]; color2 = nbmj8991_clut[((nbmj8991_clutsel & 0x7f) * 0x10) + color2]; if (color1 != 0xff) { nbmj8991_videoram[(dy * width) + dx1] = color1; update_pixel(machine, dx1, dy); } if (color2 != 0xff) { nbmj8991_videoram[(dy * width) + dx2] = color2; update_pixel(machine, dx2, dy); } nb1413m3_busyctr++; } }
static void update_pixel(running_machine *machine, int x, int y) { UINT8 color = nbmj8991_videoram[(y * video_screen_get_width(machine->primary_screen)) + x]; *BITMAP_ADDR16(nbmj8991_tmpbitmap, y, x) = color; }
static WRITE16_HANDLER(wheelfir_blit_w) { //wheelfir_blitdata[offset]=data; int width = video_screen_get_width(space->machine->primary_screen); int height = video_screen_get_height(space->machine->primary_screen); int vpage=0; COMBINE_DATA(&wheelfir_blitdata[offset]); /* a bit of a hack really .. */ if(offset==0x6) { int sixdat = data&0xff; int x,y; x = wheelfir_six_pos % 512; y = wheelfir_six_pos / 512; x &= 511; y &= 511; wheelfir_six_pos++; *BITMAP_ADDR16(wheelfir_tmp_bitmap[2], y, x) = sixdat; return; } /* probably wrong, see above! */ if(offset==0xf && data==0xffff) { int x,y; int xsize,ysize; UINT8 *rom = memory_region(space->machine, "gfx1"); int dir=0; wheelfir_six_pos = 0; mame_printf_debug("XX %.4x - ",wheelfir_blitdata[0]-wheelfir_blitdata[1]); mame_printf_debug("YY %.4x - ",wheelfir_blitdata[2]-wheelfir_blitdata[3]); for(x=0;x<16;x++) mame_printf_debug("%x-",wheelfir_blitdata[x]); mame_printf_debug("\n"); xsize = ((wheelfir_blitdata[1]&0xff)-(wheelfir_blitdata[0]&0xff))&0xff; ysize = ((wheelfir_blitdata[3]&0xff)-(wheelfir_blitdata[2]&0xff))&0x0ff; if(wheelfir_blitdata[7]&0x1) dir=1; else { dir=-1; xsize=0x100-xsize; } for(y=0;y<=ysize+1/*((wheelfir_blitdata[9]?wheelfir_blitdata[9]:16)*/;y++) for(x=0;x<=xsize+1/*(wheelfir_blitdata[9]?wheelfir_blitdata[9]:16)*/;x++) { int destx=wheelfir_blitdata[0]&0xff; int desty=wheelfir_blitdata[2]&0xff; int pagenumber = (wheelfir_blitdata[6]&0x3e00)>>9; int gfxbase = pagenumber * 0x20000; int xbit = (wheelfir_blitdata[6]&0x0100)>>8; int offs; int pix; int diffx,diffy; if (wheelfir_blitdata[7]&0x0040)destx +=0x100; // if (wheelfir_blitdata[7]&0x0080) desty +=0x100; // if (wheelfir_blitdata[9]&0x0004) destx +=0x100; // if (wheelfir_blitdata[9]&0x0008) desty +=0x100; diffx=wheelfir_blitdata[0]>>8; diffy=wheelfir_blitdata[2]>>8; // diffx-=0xf700; // diffx&=511; // diffy-=0xf400; // diffy&=1023; diffx &= 0xff; diffy &= 0xff; if (xbit) diffx+=0x100; diffx+=x; diffy+=y; destx+=x*dir; desty+=y; offs=gfxbase+diffy*512+diffx; offs&=0x3fffff; pix = rom[offs]; if(pix && destx >0 && desty >0 && destx<width && desty <height) *BITMAP_ADDR16(wheelfir_tmp_bitmap[vpage], desty, destx) = pix; } }