static VIDEO_UPDATE( dunhuang ) { int layers_ctrl = -1; #if DUNHUANG_DEBUG if (input_code_pressed(KEYCODE_Z)) { int msk = 0; if (input_code_pressed(KEYCODE_Q)) msk |= 1; if (input_code_pressed(KEYCODE_W)) msk |= 2; if (msk != 0) layers_ctrl &= msk; } #endif fillbitmap(bitmap,get_black_pen(screen->machine),cliprect); switch (dunhuang_layers) { case 0x04: // girl select: bg over fg if (layers_ctrl & 2) tilemap_draw(bitmap,cliprect, tmap2, TILEMAP_DRAW_OPAQUE, 0); if (layers_ctrl & 1) tilemap_draw(bitmap,cliprect, tmap, 0, 0); break; case 0x05: // dips: must hide fg if (layers_ctrl & 1) tilemap_draw(bitmap,cliprect, tmap, TILEMAP_DRAW_OPAQUE, 0); break; case 0x07: // game,demo: fg over bg default: if (layers_ctrl & 1) tilemap_draw(bitmap,cliprect, tmap, TILEMAP_DRAW_OPAQUE, 0); if (layers_ctrl & 2) tilemap_draw(bitmap,cliprect, tmap2, 0, 0); break; } return 0; }
static SCREEN_UPDATE( dunhuang ) { dunhuang_state *state = screen->machine().driver_data<dunhuang_state>(); int layers_ctrl = -1; #if DUNHUANG_DEBUG if (input_code_pressed(screen->machine(), KEYCODE_Z)) { int msk = 0; if (input_code_pressed(screen->machine(), KEYCODE_Q)) msk |= 1; if (input_code_pressed(screen->machine(), KEYCODE_W)) msk |= 2; if (msk != 0) layers_ctrl &= msk; } #endif bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine())); switch (state->m_layers) { case 0x04: // girl select: bg over fg if (layers_ctrl & 2) tilemap_draw(bitmap,cliprect, state->m_tmap2, TILEMAP_DRAW_OPAQUE, 0); if (layers_ctrl & 1) tilemap_draw(bitmap,cliprect, state->m_tmap, 0, 0); break; case 0x05: // dips: must hide fg if (layers_ctrl & 1) tilemap_draw(bitmap,cliprect, state->m_tmap, TILEMAP_DRAW_OPAQUE, 0); break; case 0x07: // game,demo: fg over bg default: if (layers_ctrl & 1) tilemap_draw(bitmap,cliprect, state->m_tmap, TILEMAP_DRAW_OPAQUE, 0); if (layers_ctrl & 2) tilemap_draw(bitmap,cliprect, state->m_tmap2, 0, 0); break; } return 0; }
static void sprite_callback(int *code,int *color,int *priority_mask) { #if 0 if (input_code_pressed(KEYCODE_Q) && (*color & 0x80)) *color = rand(); if (input_code_pressed(KEYCODE_W) && (*color & 0x40)) *color = rand(); if (input_code_pressed(KEYCODE_E) && (*color & 0x20)) *color = rand(); if (input_code_pressed(KEYCODE_R) && (*color & 0x10)) *color = rand(); #endif *priority_mask = (*color & 0x10) ? 0 : 0x02; *color = sprite_colorbase + (*color & 0x0f); }
/* absolutely no clue what to do here :((( */ void a5200_handle_keypads(running_machine *machine) { int i, modifiers; static int atari_last = 0xff; modifiers = 0; /* with shift ? */ if (input_code_pressed(KEYCODE_LSHIFT) || input_code_pressed(KEYCODE_RSHIFT)) modifiers |= 1; /* with control ? */ if (input_code_pressed(KEYCODE_LCONTROL) || input_code_pressed(KEYCODE_RCONTROL)) modifiers |= 2; /* check keypad */ for (i = 0; i < 16; i++) { if( input_port_read(machine, "keypad") & (1 << i) ) { if( i == atari_last ) return; atari_last = i; if( i == 0 ) { pokey1_break_w(i & 0x40); return; } pokey1_kbcode_w((i << 1) | 0x21, 1); return; } } /* check top button */ if ((input_port_read(machine, "djoy_b") & 0x10) == 0) { if (atari_last == 0xFE) return; pokey1_kbcode_w(0x61, 1); //pokey1_break_w(0x40); atari_last = 0xFE; return; } else if (atari_last == 0xFE) pokey1_kbcode_w(0x21, 1); /* remove key pressed status bit from skstat */ pokey1_kbcode_w(0xFF, 0); atari_last = 0xff; }
static void twincobr_log_vram(void) { if ( input_code_pressed(KEYCODE_M) ) { offs_t tile_voffs; int tcode[4]; while (input_code_pressed(KEYCODE_M)) ; logerror("Scrolls BG-X BG-Y FG-X FG-Y TX-X TX-Y\n"); logerror("------> %04x %04x %04x %04x %04x %04x\n",bgscrollx,bgscrolly,fgscrollx,fgscrolly,txscrollx,txscrolly); for ( tile_voffs = 0; tile_voffs < (twincobr_txvideoram_size/2); tile_voffs++ ) { tcode[1] = twincobr_bgvideoram16[tile_voffs]; tcode[2] = twincobr_fgvideoram16[tile_voffs]; tcode[3] = twincobr_txvideoram16[tile_voffs]; logerror("$(%04x) (Col-Tile) BG1:%01x-%03x FG1:%01x-%03x TX1:%02x-%03x\n", tile_voffs, tcode[1] & 0xf000 >> 12, tcode[1] & 0x0fff, tcode[2] & 0xf000 >> 12, tcode[2] & 0x0fff, tcode[3] & 0xf800 >> 11, tcode[3] & 0x07ff); } for ( tile_voffs = (twincobr_txvideoram_size/2); tile_voffs < (twincobr_fgvideoram_size/2); tile_voffs++ ) { tcode[1] = twincobr_bgvideoram16[tile_voffs]; tcode[2] = twincobr_fgvideoram16[tile_voffs]; logerror("$(%04x) (Col-Tile) BG1:%01x-%03x FG1:%01x-%03x\n", tile_voffs, tcode[1] & 0xf000 >> 12, tcode[1] & 0x0fff, tcode[2] & 0xf000 >> 12, tcode[2] & 0x0fff); } for ( tile_voffs = (twincobr_fgvideoram_size/2); tile_voffs < (twincobr_bgvideoram_size/2); tile_voffs++ ) { tcode[1] = twincobr_bgvideoram16[tile_voffs]; logerror("$(%04x) (Col-Tile) BG1:%01x-%03x\n", tile_voffs, tcode[1] & 0xf000 >> 12, tcode[1] & 0x0fff); } } }
void a800_handle_keyboard(running_machine *machine) { static int atari_last = 0xff; int i, modifiers, atari_code; char tag[64]; modifiers = 0; /* with shift ? */ if( input_code_pressed(KEYCODE_LSHIFT) || input_code_pressed(KEYCODE_RSHIFT) ) modifiers |= 1; /* with control ? */ if( input_code_pressed(KEYCODE_LCONTROL) || input_code_pressed(KEYCODE_RCONTROL) ) modifiers |= 2; for( i = 0; i < 64; i++ ) { sprintf(tag, "keyboard_%d", i / 16); if( input_port_read_safe(machine, tag, 0) & (1 << (i&15)) ) { atari_code = keys[i][modifiers]; if( atari_code != AKEY_NONE ) { if( atari_code == atari_last ) return; atari_last = atari_code; if( (atari_code & 0x3f) == AKEY_BREAK ) { pokey1_break_w(atari_code & 0x40); return; } pokey1_kbcode_w(atari_code, 1); return; } } } /* remove key pressed status bit from skstat */ pokey1_kbcode_w(AKEY_NONE, 0); atari_last = AKEY_NONE; }
static SCREEN_UPDATE(galaxi) { galaxi_state *state = screen->machine().driver_data<galaxi_state>(); int layers_ctrl = -1; #ifdef MAME_DEBUG if (input_code_pressed(screen->machine(), KEYCODE_R)) // remapped due to inputs changes. { int msk = 0; if (input_code_pressed(screen->machine(), KEYCODE_T)) msk |= 1; if (input_code_pressed(screen->machine(), KEYCODE_Y)) msk |= 2; if (input_code_pressed(screen->machine(), KEYCODE_U)) msk |= 4; if (input_code_pressed(screen->machine(), KEYCODE_I)) msk |= 8; if (input_code_pressed(screen->machine(), KEYCODE_O)) msk |= 16; if (msk != 0) layers_ctrl &= msk; } #endif if (layers_ctrl & 1) tilemap_draw(bitmap, cliprect, state->m_bg1_tmap, TILEMAP_DRAW_OPAQUE, 0); else bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine())); if (layers_ctrl & 2) tilemap_draw(bitmap, cliprect, state->m_bg2_tmap, 0, 0); if (layers_ctrl & 4) tilemap_draw(bitmap, cliprect, state->m_bg3_tmap, 0, 0); if (layers_ctrl & 8) tilemap_draw(bitmap, cliprect, state->m_bg4_tmap, 0, 0); if (layers_ctrl & 16) tilemap_draw(bitmap, cliprect, state->m_fg_tmap, 0, 0); return 0; }
static SCREEN_UPDATE(quizpun2) { int layers_ctrl = -1; #ifdef MAME_DEBUG if (input_code_pressed(screen->machine, KEYCODE_Z)) { int msk = 0; if (input_code_pressed(screen->machine, KEYCODE_Q)) msk |= 1; if (input_code_pressed(screen->machine, KEYCODE_W)) msk |= 2; if (msk != 0) layers_ctrl &= msk; } #endif if (layers_ctrl & 1) tilemap_draw(bitmap,cliprect, bg_tmap, TILEMAP_DRAW_OPAQUE, 0); else bitmap_fill(bitmap,cliprect,get_black_pen(screen->machine)); bitmap_fill(bitmap,cliprect,get_black_pen(screen->machine)); if (layers_ctrl & 2) tilemap_draw(bitmap,cliprect, fg_tmap, 0, 0); return 0; }
static void logblit(running_machine *machine, const char *tag) { if (!input_code_pressed(machine, KEYCODE_L)) return; if (is_drivedge && VIDEO_TRANSFER_FLAGS == 0x5490) { /* polygon drawing */ logerror("%s: e=%d%d f=%04x s=(%03x-%03x,%03x) w=%03x h=%03x b=%02x%04x c=%02x%02x ss=%04x,%04x ds=%04x,%04x ls=%04x%04x rs=%04x%04x u80=%04x", tag, enable_latch[0], enable_latch[1], VIDEO_TRANSFER_FLAGS, VIDEO_TRANSFER_X, VIDEO_RIGHTCLIP, VIDEO_TRANSFER_Y, VIDEO_TRANSFER_WIDTH, VIDEO_TRANSFER_HEIGHT, VIDEO_TRANSFER_ADDRHI, VIDEO_TRANSFER_ADDRLO, color_latch[0] >> 8, color_latch[1] >> 8, VIDEO_SRC_XSTEP, VIDEO_SRC_YSTEP, VIDEO_DST_XSTEP, VIDEO_DST_YSTEP, VIDEO_LEFTSTEPHI, VIDEO_LEFTSTEPLO, VIDEO_RIGHTSTEPHI, VIDEO_RIGHTSTEPLO, VIDEO_STARTSTEP); }
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; }