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; }
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 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 TIMER_CALLBACK( scanline_timer_device_timer_callback ) { int next_vpos; const device_config *timer = ptr; timer_state *state = get_safe_token(timer); timer_config *config = timer->inline_config; /* get the screen device and verify it */ const device_config *screen = device_list_find_by_tag(timer->machine->config->devicelist, VIDEO_SCREEN, config->screen); assert(screen != NULL); /* first time, start with the first scanline, but do not call the callback */ if (state->first_time) { next_vpos = config->first_vpos; /* indicate that we are done with the first call */ state->first_time = FALSE; } /* not the first time */ else { int vpos = video_screen_get_vpos(screen); /* call the real callback */ config->callback(timer, state->ptr, vpos); /* if the increment is 0 or the next scanline is larger than the screen size, go back to the first one */ if ((config->increment == 0) || ((vpos + config->increment) >= video_screen_get_height(screen))) next_vpos = config->first_vpos; /* otherwise, increment */ else next_vpos = vpos + config->increment; } /* adjust the timer */ timer_adjust_oneshot(state->timer, video_screen_get_time_until_pos(screen, next_vpos, 0), 0); }
static VIDEO_START( madalien ) { int i; static const tilemap_mapper_func scan_functions[4] = { scan_mode0, scan_mode1, scan_mode2, scan_mode3 }; static const int tilemap_cols[4] = { 16, 16, 32, 32 }; tilemap_fg = tilemap_create(machine, get_tile_info_FG, tilemap_scan_cols_flip_x, 8, 8, 32, 32); tilemap_set_transparent_pen(tilemap_fg, 0); tilemap_set_scrolldx(tilemap_fg, 0, 0x50); tilemap_set_scrolldy(tilemap_fg, 0, 0x20); for (i = 0; i < 4; i++) { tilemap_edge1[i] = tilemap_create(machine, get_tile_info_BG_1, scan_functions[i], 16, 16, tilemap_cols[i], 8); tilemap_set_scrolldx(tilemap_edge1[i], 0, 0x50); tilemap_set_scrolldy(tilemap_edge1[i], 0, 0x20); tilemap_edge2[i] = tilemap_create(machine, get_tile_info_BG_2, scan_functions[i], 16, 16, tilemap_cols[i], 8); tilemap_set_scrolldx(tilemap_edge2[i], 0, 0x50); tilemap_set_scrolldy(tilemap_edge2[i], 0, video_screen_get_height(machine->primary_screen) - 256); } headlight_bitmap = auto_bitmap_alloc(machine, 128, 128, BITMAP_FORMAT_INDEXED16); gfx_element_set_source(machine->gfx[0], madalien_charram); drawgfx_opaque(headlight_bitmap, NULL, machine->gfx[2], 0, 0, 0, 0, 0x00, 0x00); drawgfx_opaque(headlight_bitmap, NULL, machine->gfx[2], 0, 0, 0, 1, 0x00, 0x40); }
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; } }
static void _irobot_poly_clear(running_machine *machine, UINT8 *bitmap_base) { memset(bitmap_base, 0, BITMAP_WIDTH * video_screen_get_height(machine->primary_screen)); }