static VIDEO_UPDATE(calchase) { int x,y,count,i; bitmap_fill(bitmap,cliprect,get_black_pen(screen->machine)); count = (0); for(y=0;y<256;y++) { for(x=0;x<320;x+=32) { for (i=0;i<32;i++) { UINT32 color; color = (vga_vram[count])>>(32-i) & 0x1; if((x+i)<video_screen_get_visible_area(screen)->max_x && ((y)+0)<video_screen_get_visible_area(screen)->max_y) *BITMAP_ADDR32(bitmap, y, x+(32-i)) = screen->machine->pens[color]; } count++; } } return 0; }
static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) { const gfx_element *gfx = machine->gfx[0]; const UINT8 *source = spriteram; const UINT8 *finish = source+0x100; rectangle clip = *video_screen_get_visible_area(machine->primary_screen); clip.max_x -= 24; clip.min_x += 16; while( source<finish ){ int xpos = source[1]-3; int ypos = source[0]-16+3; int tile_number = source[2]+source[3]*0x100; drawgfx_transpen( bitmap, &clip,gfx, tile_number, 0, /* color */ 0,0, /* no flip */ xpos,ypos,0 ); drawgfx_transpen( bitmap, &clip,gfx, tile_number, 0, /* color */ 0,0, /* no flip */ xpos,256+ypos,0 ); source+=4; } }
INLINE void get_crosshair_xy(running_machine *machine, int player, int *x, int *y) { const rectangle *visarea = video_screen_get_visible_area(machine->primary_screen); int width = visarea->max_x + 1 - visarea->min_x; int height = visarea->max_y + 1 - visarea->min_y; *x = ((input_port_read_indexed(machine, 2 + player * 2) & 0xff) * width) / 255; *y = ((input_port_read_indexed(machine, 3 + player * 2) & 0xff) * height) / 255; }
INLINE void get_crosshair_xy(running_machine *machine, int player, int *x, int *y) { static const char *const gunnames[] = { "LIGHT0_X", "LIGHT0_Y", "LIGHT1_X", "LIGHT1_Y" }; const rectangle *visarea = video_screen_get_visible_area(machine->primary_screen); int width = visarea->max_x + 1 - visarea->min_x; int height = visarea->max_y + 1 - visarea->min_y; *x = ((input_port_read_safe(machine, gunnames[player * 2], 0x00) & 0xff) * width) / 255; *y = ((input_port_read_safe(machine, gunnames[1 + player * 2], 0x00) & 0xff) * height) / 255; }
static WRITE16_HANDLER( fuuki16_vregs_w ) { fuuki16_state *state = (fuuki16_state *)space->machine->driver_data; UINT16 old_data = state->vregs[offset]; UINT16 new_data = COMBINE_DATA(&state->vregs[offset]); if ((offset == 0x1c/2) && old_data != new_data) { const rectangle *visarea = video_screen_get_visible_area(space->machine->primary_screen); attotime period = video_screen_get_frame_period(space->machine->primary_screen); timer_adjust_periodic(state->raster_interrupt_timer, video_screen_get_time_until_pos(space->machine->primary_screen, new_data, visarea->max_x + 1), 0, period); } }
static WRITE32_HANDLER( fuuki32_vregs_w ) { if (fuuki32_vregs[offset] != data) { COMBINE_DATA(&fuuki32_vregs[offset]); if (offset == 0x1c/4) { const rectangle *visarea = video_screen_get_visible_area(space->machine->primary_screen); attotime period = video_screen_get_frame_period(space->machine->primary_screen); timer_adjust_periodic(raster_interrupt_timer, video_screen_get_time_until_pos(space->machine->primary_screen, fuuki32_vregs[0x1c/4]>>16, visarea->max_x + 1), 0, period); } }
static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect ) { rectangle clip = *cliprect; const gfx_element *gfx = machine->gfx[1 + sprite_bank]; int i, j; static const int pribase[4]={0x0180, 0x0080, 0x0100, 0x0000}; const rectangle *visarea = video_screen_get_visible_area(machine->primary_screen); /* score covers sprites */ if (flipscreen) { if (clip.max_y > visarea->max_y - 64) clip.max_y = visarea->max_y - 64; } else { if (clip.min_y < visarea->min_y + 64) clip.min_y = visarea->min_y + 64; } for (i=0; i<4; i++) for (j=0x7c; j>=0; j-=4) { int offs = pribase[i] + j; int sy = spriteram[offs]; int sx = spriteram[offs+3]; int code = spriteram[offs+2]; int attr = spriteram[offs+1]; int flipx = attr & 0x40; int flipy = !(attr & 0x80); int color = attr & 0x0f; if (attr & 0x10) code += 512; if (attr & 0x20) code += 256; if (flipscreen) { flipx = !flipx; flipy = !flipy; sx = 240 - sx; sy = 240 - sy; } if (sx >= 256-8) sx -= 256; drawgfx_transpen(bitmap,&clip,gfx, code, color, flipx,flipy, sx,sy,0); } }
static TIMER_CALLBACK( vsync_update ) { const device_config *laserdisc = device_list_first(machine->config->devicelist, LASERDISC); int vblank_scanline; attotime target; /* handle commands */ if (!param) process_commands(laserdisc); /* set a timer to go off on the next VBLANK */ vblank_scanline = video_screen_get_visible_area(machine->primary_screen)->max_y + 1; target = video_screen_get_time_until_pos(machine->primary_screen, vblank_scanline, 0); timer_set(machine, target, NULL, 0, vsync_update); }
static VIDEO_UPDATE(bingor) { int x,y,count; bitmap_fill(bitmap,cliprect,get_black_pen(screen->machine)); count = (0x2000/2); for(y=0;y<256;y++) { for(x=0;x<286;x+=4) { UINT32 color; color = (blit_ram[count] & 0xf000)>>12; if((x+3)<video_screen_get_visible_area(screen)->max_x && ((y)+0)<video_screen_get_visible_area(screen)->max_y) *BITMAP_ADDR32(bitmap, y, x+3) = screen->machine->pens[color]; color = (blit_ram[count] & 0x0f00)>>8; if((x+2)<video_screen_get_visible_area(screen)->max_x && ((y)+0)<video_screen_get_visible_area(screen)->max_y) *BITMAP_ADDR32(bitmap, y, x+2) = screen->machine->pens[color]; color = (blit_ram[count] & 0x00f0)>>4; if((x+1)<video_screen_get_visible_area(screen)->max_x && ((y)+0)<video_screen_get_visible_area(screen)->max_y) *BITMAP_ADDR32(bitmap, y, x+1) = screen->machine->pens[color]; color = (blit_ram[count] & 0x000f)>>0; if((x+0)<video_screen_get_visible_area(screen)->max_x && ((y)+0)<video_screen_get_visible_area(screen)->max_y) *BITMAP_ADDR32(bitmap, y, x+0) = screen->machine->pens[color]; count++; } } return 0; }
void lethalj_scanline_update(const device_config *screen, bitmap_t *bitmap, int scanline, const tms34010_display_params *params) { UINT16 *src = &screenram[(vispage << 17) | ((params->rowaddr << 9) & 0x3fe00)]; UINT16 *dest = BITMAP_ADDR16(bitmap, scanline, 0); int coladdr = params->coladdr << 1; int x; /* blank palette: fill with white */ if (blank_palette) { for (x = params->heblnk; x < params->hsblnk; x++) dest[x] = 0x7fff; if (scanline == video_screen_get_visible_area(screen)->max_y) blank_palette = 0; return; } /* copy the non-blanked portions of this scanline */ for (x = params->heblnk; x < params->hsblnk; x++) dest[x] = src[coladdr++ & 0x1ff] & 0x7fff; }
static VIDEO_UPDATE(jingbell) { int layers_ctrl = video_enable ? -1 : 0; #ifdef MAME_DEBUG if (input_code_pressed(screen->machine, KEYCODE_Z)) { int mask = 0; if (input_code_pressed(screen->machine, KEYCODE_Q)) mask |= 1; if (input_code_pressed(screen->machine, KEYCODE_W)) mask |= 2; if (input_code_pressed(screen->machine, KEYCODE_A)) mask |= 4; if (mask != 0) layers_ctrl &= mask; } #endif if (layers_ctrl & 1) { int zz,i; int startclipmin = 0; const rectangle *visarea = video_screen_get_visible_area(screen); for (i= 0;i < 0x80;i++) { tilemap_set_scrolly(gp98_reel1_tilemap, i, bg_scroll[i]*2); tilemap_set_scrolly(gp98_reel2_tilemap, i, bg_scroll[i+0x80]*2); tilemap_set_scrolly(gp98_reel3_tilemap, i, bg_scroll[i+0x100]*2); tilemap_set_scrolly(gp98_reel4_tilemap, i, bg_scroll[i+0x180]*2); } for (zz=0;zz<0x80-8;zz++) // -8 because of visible area (2*8 = 16) { rectangle clip; int rowenable = bg_scroll2[zz]; /* draw top of screen */ clip.min_x = visarea->min_x; clip.max_x = visarea->max_x; clip.min_y = startclipmin; clip.max_y = startclipmin+2; bitmap_fill(bitmap,&clip,screen->machine->pens[rowenable]); if (rowenable==0) { // 0 and 1 are the same? or is there a global switchoff? tilemap_draw(bitmap,&clip,gp98_reel1_tilemap,0,0); } else if (rowenable==1) { tilemap_draw(bitmap,&clip,gp98_reel2_tilemap,0,0); } else if (rowenable==2) { tilemap_draw(bitmap,&clip,gp98_reel3_tilemap,0,0); } else if (rowenable==3) { tilemap_draw(bitmap,&clip,gp98_reel4_tilemap,0,0); } startclipmin+=2; } } else bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine)); if (layers_ctrl & 2) tilemap_draw(bitmap, cliprect, fg_tilemap, 0, 0); return 0; }
static int SpriteCollision(running_machine *machine, int first,int second) { int Checksum=0; int x,y; const rectangle *visarea = video_screen_get_visible_area(machine->primary_screen); if((zac2650_s2636_0_ram[first * 0x10 + 10] < 0xf0) && (zac2650_s2636_0_ram[second * 0x10 + 10] < 0xf0)) { int fx = (zac2650_s2636_0_ram[first * 0x10 + 10] * 4)-22; int fy = (zac2650_s2636_0_ram[first * 0x10 + 12] * 3)+3; int expand = (first==1) ? 2 : 1; /* Draw first sprite */ drawgfx_opaque(spritebitmap,0, machine->gfx[expand], first * 2, 0, 0,0, fx,fy); /* Get fingerprint */ for (x = fx; x < fx + machine->gfx[expand]->width; x++) { for (y = fy; y < fy + machine->gfx[expand]->height; y++) { if ((x < visarea->min_x) || (x > visarea->max_x) || (y < visarea->min_y) || (y > visarea->max_y)) { continue; } Checksum += *BITMAP_ADDR16(spritebitmap, y, x); } } /* Blackout second sprite */ drawgfx_transpen(spritebitmap,0, machine->gfx[1], second * 2, 1, 0,0, (zac2650_s2636_0_ram[second * 0x10 + 10] * 4)-22,(zac2650_s2636_0_ram[second * 0x10 + 12] * 3) + 3, 0); /* Remove fingerprint */ for (x = fx; x < fx + machine->gfx[expand]->width; x++) { for (y = fy; y < fy + machine->gfx[expand]->height; y++) { if ((x < visarea->min_x) || (x > visarea->max_x) || (y < visarea->min_y) || (y > visarea->max_y)) { continue; } Checksum -= *BITMAP_ADDR16(spritebitmap, y, x); } } /* Zero bitmap */ drawgfx_opaque(spritebitmap,0, machine->gfx[expand], first * 2, 1, 0,0, fx,fy); } return Checksum; }
static void draw_sprites(running_machine *machine, bitmap_t *bitmap) { int offs; const rectangle *visarea = video_screen_get_visible_area(machine->primary_screen); /* -------------------------------------------------------------- */ /* There seems to be a strange setup with this board, in that it */ /* appears that the S2636 runs from a different clock than the */ /* background generator, When the program maps sprite position to */ /* character position it only has 6 pixels of sprite for 8 pixels */ /* of character. */ /* -------------------------------------------------------------- */ /* n.b. The original has several graphic glitches as well, so it */ /* does not seem to be a fault of the emulation! */ /* -------------------------------------------------------------- */ CollisionBackground = 0; /* Read from 0x1e80 bit 7 */ // for collision detection checking copybitmap(tmpbitmap,bitmap,0,0,0,0,visarea); for(offs=0; offs<0x50; offs+=0x10) { if((zac2650_s2636_0_ram[offs+10]<0xF0) && (offs!=0x30)) { int spriteno = (offs / 8); int expand = ((zac2650_s2636_0_ram[0xc0] & (spriteno*2))!=0) ? 2 : 1; int bx = (zac2650_s2636_0_ram[offs+10] * 4) - 22; int by = (zac2650_s2636_0_ram[offs+12] * 3) + 3; int x,y; /* Sprite->Background collision detection */ drawgfx_transpen(bitmap,0, machine->gfx[expand], spriteno, 1, 0,0, bx,by, 0); for (x = bx; x < bx + machine->gfx[expand]->width; x++) { for (y = by; y < by + machine->gfx[expand]->height; y++) { if ((x < visarea->min_x) || (x > visarea->max_x) || (y < visarea->min_y) || (y > visarea->max_y)) { continue; } if (*BITMAP_ADDR16(bitmap, y, x) != *BITMAP_ADDR16(tmpbitmap, y, x)) { CollisionBackground = 0x80; break; } } } drawgfx_transpen(bitmap,0, machine->gfx[expand], spriteno, 0, 0,0, bx,by, 0); } } /* Sprite->Sprite collision detection */ CollisionSprite = 0; // if(SpriteCollision(machine, 0,1)) CollisionSprite |= 0x20; /* Not Used */ if(SpriteCollision(machine, 0,2)) CollisionSprite |= 0x10; if(SpriteCollision(machine, 0,4)) CollisionSprite |= 0x08; if(SpriteCollision(machine, 1,2)) CollisionSprite |= 0x04; if(SpriteCollision(machine, 1,4)) CollisionSprite |= 0x02; // if(SpriteCollision(machine, 2,4)) CollisionSprite |= 0x01; /* Not Used */ }
void batman_scanline_update(const device_config *screen, int scanline) { /* update the scanline parameters */ if (scanline <= video_screen_get_visible_area(screen)->max_y && atarivc_state.rowscroll_enable) { UINT16 *base = &atarigen_alpha[scanline / 8 * 64 + 48]; int scan, i; for (scan = 0; scan < 8; scan++, scanline++) for (i = 0; i < 2; i++) { int data = *base++; switch (data & 15) { case 9: if (scanline > 0) video_screen_update_partial(screen, scanline - 1); atarivc_state.mo_xscroll = (data >> 7) & 0x1ff; atarimo_set_xscroll(0, atarivc_state.mo_xscroll); break; case 10: if (scanline > 0) video_screen_update_partial(screen, scanline - 1); atarivc_state.pf1_xscroll_raw = (data >> 7) & 0x1ff; atarivc_update_pf_xscrolls(); tilemap_set_scrollx(atarigen_playfield_tilemap, 0, atarivc_state.pf0_xscroll); tilemap_set_scrollx(atarigen_playfield2_tilemap, 0, atarivc_state.pf1_xscroll); break; case 11: if (scanline > 0) video_screen_update_partial(screen, scanline - 1); atarivc_state.pf0_xscroll_raw = (data >> 7) & 0x1ff; atarivc_update_pf_xscrolls(); tilemap_set_scrollx(atarigen_playfield_tilemap, 0, atarivc_state.pf0_xscroll); break; case 13: if (scanline > 0) video_screen_update_partial(screen, scanline - 1); atarivc_state.mo_yscroll = (data >> 7) & 0x1ff; atarimo_set_yscroll(0, atarivc_state.mo_yscroll); break; case 14: if (scanline > 0) video_screen_update_partial(screen, scanline - 1); atarivc_state.pf1_yscroll = (data >> 7) & 0x1ff; tilemap_set_scrolly(atarigen_playfield2_tilemap, 0, atarivc_state.pf1_yscroll); break; case 15: if (scanline > 0) video_screen_update_partial(screen, scanline - 1); atarivc_state.pf0_yscroll = (data >> 7) & 0x1ff; tilemap_set_scrolly(atarigen_playfield_tilemap, 0, atarivc_state.pf0_yscroll); break; } } }