void k037122_device::device_start() { static const gfx_layout k037122_char_layout = { 8, 8, K037122_NUM_TILES, 8, { 0,1,2,3,4,5,6,7 }, { 1*16, 0*16, 3*16, 2*16, 5*16, 4*16, 7*16, 6*16 }, { 0*128, 1*128, 2*128, 3*128, 4*128, 5*128, 6*128, 7*128 }, 8*128 }; m_char_ram = auto_alloc_array_clear(machine(), UINT32, 0x200000 / 4); m_tile_ram = auto_alloc_array_clear(machine(), UINT32, 0x20000 / 4); m_reg = auto_alloc_array_clear(machine(), UINT32, 0x400 / 4); m_layer[0] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(k037122_device::tile_info_layer0),this), TILEMAP_SCAN_ROWS, 8, 8, 256, 64); m_layer[1] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(k037122_device::tile_info_layer1),this), TILEMAP_SCAN_ROWS, 8, 8, 128, 64); m_layer[0]->set_transparent_pen(0); m_layer[1]->set_transparent_pen(0); machine().gfx[m_gfx_index] = auto_alloc_clear(machine(), gfx_element(machine(), k037122_char_layout, (UINT8*)m_char_ram, machine().total_colors() / 16, 0)); save_pointer(NAME(m_reg), 0x400 / 4); save_pointer(NAME(m_char_ram), 0x200000 / 4); save_pointer(NAME(m_tile_ram), 0x20000 / 4); }
void iq151_video32_device::device_start() { m_videoram = (UINT8*)memregion("videoram")->base(); m_chargen = (UINT8*)memregion("chargen")->base(); machine().gfx[0] = auto_alloc(machine(), gfx_element(machine(), iq151_video32_charlayout, m_chargen, 1, 0)); }
void iq151_video64_device::device_start() { m_videoram = (UINT8*)memregion("videoram")->base(); m_chargen = (UINT8*)memregion("chargen")->base(); m_gfxdecode->set_gfx(0,auto_alloc(machine(), gfx_element(machine(), iq151_video64_charlayout, m_chargen, 1, 0))); }
void iq151_video32_device::device_start() { m_videoram = (UINT8*)memregion("videoram")->base(); m_chargen = (UINT8*)memregion("chargen")->base(); m_gfxdecode->set_gfx(0, global_alloc(gfx_element(m_palette, iq151_video32_charlayout, m_chargen, 0, 1, 0))); }
void casloopy_state::video_start() { /* TODO: proper sizes */ m_paletteram = auto_alloc_array_clear(machine(), UINT16, 0x1000); m_vram = auto_alloc_array_clear(machine(), UINT8, 0x10000); m_bitmap_vram = auto_alloc_array_clear(machine(), UINT8, 0x20000); for (m_gfx_index = 0; m_gfx_index < MAX_GFX_ELEMENTS; m_gfx_index++) if (m_gfxdecode->gfx(m_gfx_index) == 0) break; for(int i=0;i<0x10000;i++) m_vram[i] = i & 0xff; m_gfxdecode->set_gfx(m_gfx_index, global_alloc(gfx_element(m_palette, casloopy_4bpp_layout, m_vram, 0, 0x10, 0))); m_gfxdecode->set_gfx(m_gfx_index+1, global_alloc(gfx_element(m_palette, casloopy_8bpp_layout, m_vram, 0, 1, 0))); }
void tc0091lvc_device::device_start() { if(!m_gfxdecode->started()) throw device_missing_dependencies(); memset(m_palette_ram, 0, sizeof(m_palette_ram)); memset(m_vregs, 0, sizeof(m_palette_ram)); memset(m_bitmap_ram, 0, sizeof(m_palette_ram)); memset(m_pcg_ram, 0, sizeof(m_pcg_ram)); memset(m_sprram_buffer, 0, sizeof(m_sprram_buffer)); // note, the way tiles are addressed suggests that 0x0000-0x3fff of this might be usable, // but we don't map it anywhere, so the first tiles are always blank at the moment. m_pcg1_ram = m_pcg_ram + 0x4000; m_pcg2_ram = m_pcg_ram + 0xc000; m_vram0 = m_pcg_ram + 0x8000; m_vram1 = m_pcg_ram + 0x9000; m_tvram = m_pcg_ram + 0xa000; m_sprram = m_pcg_ram + 0xb000; tx_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(tc0091lvc_device::get_tx_tile_info),this),TILEMAP_SCAN_ROWS,8,8,64,32); bg0_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(tc0091lvc_device::get_bg0_tile_info),this),TILEMAP_SCAN_ROWS,8,8,64,32); bg1_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(tc0091lvc_device::get_bg1_tile_info),this),TILEMAP_SCAN_ROWS,8,8,64,32); tx_tilemap->set_transparent_pen(0); bg0_tilemap->set_transparent_pen(0); bg1_tilemap->set_transparent_pen(0); tx_tilemap->set_scrolldx(-8, -8); bg0_tilemap->set_scrolldx(28, -11); bg1_tilemap->set_scrolldx(38, -21); for (m_gfx_index = 0; m_gfx_index < MAX_GFX_ELEMENTS; m_gfx_index++) if (m_gfxdecode->gfx(m_gfx_index) == 0) break; //printf("m_gfx_index %d\n", m_gfx_index); m_gfxdecode->set_gfx(m_gfx_index, global_alloc(gfx_element(m_palette, char_layout, (UINT8 *)m_pcg_ram, 0, m_palette->entries() / 16, 0))); }
void polygonet_state::video_start() { static const gfx_layout charlayout = { 8, 8, /* 8x8 */ 4096, /* # of tiles */ 4, /* 4bpp */ { 0, 1, 2, 3 }, /* plane offsets */ { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4 }, /* X offsets */ { 0*8*4, 1*8*4, 2*8*4, 3*8*4, 4*8*4, 5*8*4, 6*8*4, 7*8*4 }, /* Y offsets */ 8*8*4 }; /* find first empty slot to decode gfx */ for (m_ttl_gfx_index = 0; m_ttl_gfx_index < MAX_GFX_ELEMENTS; m_ttl_gfx_index++) if (machine().gfx[m_ttl_gfx_index] == 0) break; assert(m_ttl_gfx_index != MAX_GFX_ELEMENTS); /* decode the ttl layer's gfx */ machine().gfx[m_ttl_gfx_index] = auto_alloc(machine(), gfx_element(machine(), charlayout, memregion("gfx1")->base(), machine().total_colors() / 16, 0)); /* create the tilemap */ m_ttl_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(polygonet_state::ttl_get_tile_info),this), tilemap_mapper_delegate(FUNC(polygonet_state::plygonet_scan),this), 8, 8, 64, 32); m_ttl_tilemap->set_transparent_pen(0); /* set up the roz t-map too */ m_roz_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(polygonet_state::roz_get_tile_info),this), tilemap_mapper_delegate(FUNC(polygonet_state::plygonet_scan_cols),this), 16, 16, 32, 64); m_roz_tilemap->set_transparent_pen(0); /* save states */ save_item(NAME(m_ttl_gfx_index)); save_item(NAME(m_ttl_vram)); save_item(NAME(m_roz_vram)); }
void k001604_device::device_start() { static const gfx_layout k001604_char_layout_layer_8x8 = { 8, 8, K001604_NUM_TILES_LAYER0, 8, { 8,9,10,11,12,13,14,15 }, { 1*16, 0*16, 3*16, 2*16, 5*16, 4*16, 7*16, 6*16 }, { 0*128, 1*128, 2*128, 3*128, 4*128, 5*128, 6*128, 7*128 }, 8*128 }; static const gfx_layout k001604_char_layout_layer_16x16 = { 16, 16, K001604_NUM_TILES_LAYER1, 8, { 8,9,10,11,12,13,14,15 }, { 1*16, 0*16, 3*16, 2*16, 5*16, 4*16, 7*16, 6*16, 9*16, 8*16, 11*16, 10*16, 13*16, 12*16, 15*16, 14*16 }, { 0*256, 1*256, 2*256, 3*256, 4*256, 5*256, 6*256, 7*256, 8*256, 9*256, 10*256, 11*256, 12*256, 13*256, 14*256, 15*256 }, 16*256 }; if(!m_gfxdecode->started()) throw device_missing_dependencies(); int roz_tile_size; m_gfx_index[0] = m_gfx_index_1; m_gfx_index[1] = m_gfx_index_2; m_char_ram = auto_alloc_array_clear(machine(), UINT32, 0x200000 / 4); m_tile_ram = auto_alloc_array_clear(machine(), UINT32, 0x20000 / 4); m_reg = auto_alloc_array_clear(machine(), UINT32, 0x400 / 4); /* create tilemaps */ roz_tile_size = m_roz_size ? 16 : 8; if (m_layer_size) { m_layer_8x8[0] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(k001604_device::tile_info_layer_8x8),this), tilemap_mapper_delegate(FUNC(k001604_device::scan_layer_8x8_0_size1),this), 8, 8, 64, 64); m_layer_8x8[1] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(k001604_device::tile_info_layer_8x8),this), tilemap_mapper_delegate(FUNC(k001604_device::scan_layer_8x8_1_size1),this), 8, 8, 64, 64); m_layer_roz = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(k001604_device::tile_info_layer_roz),this), tilemap_mapper_delegate(FUNC(k001604_device::scan_layer_roz_256),this), roz_tile_size, roz_tile_size, 128, 64); } else { m_layer_8x8[0] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(k001604_device::tile_info_layer_8x8),this), tilemap_mapper_delegate(FUNC(k001604_device::scan_layer_8x8_0_size0),this), 8, 8, 64, 64); m_layer_8x8[1] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(k001604_device::tile_info_layer_8x8),this), tilemap_mapper_delegate(FUNC(k001604_device::scan_layer_8x8_1_size0),this), 8, 8, 64, 64); m_layer_roz = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(k001604_device::tile_info_layer_roz),this), tilemap_mapper_delegate(FUNC(k001604_device::scan_layer_roz_128),this), roz_tile_size, roz_tile_size, 128, 64); } m_layer_8x8[0]->set_transparent_pen(0); m_layer_8x8[1]->set_transparent_pen(0); m_gfxdecode->set_gfx(m_gfx_index[0], global_alloc(gfx_element(m_palette, k001604_char_layout_layer_8x8, (UINT8*)&m_char_ram[0], 0, m_palette->entries() / 16, 0))); m_gfxdecode->set_gfx(m_gfx_index[1], global_alloc(gfx_element(m_palette, k001604_char_layout_layer_16x16, (UINT8*)&m_char_ram[0], 0, m_palette->entries() / 16, 0))); save_pointer(NAME(m_reg), 0x400 / 4); save_pointer(NAME(m_char_ram), 0x200000 / 4); save_pointer(NAME(m_tile_ram), 0x20000 / 4); }
void tc0080vco_device::device_start() { /* Is this endian-correct ??? */ #define XOR(a) WORD_XOR_BE(a) static const gfx_layout charlayout = { 8, 8, /* 8x8 pixels */ 256, /* 256 chars */ 3, /* 3 bits per pixel */ { 0x10000*8 + XOR(2)*4, XOR(0)*4, XOR(2)*4 }, { 0, 1, 2, 3, 4, 5, 6, 7 }, { 16*0, 16*1, 16*2, 16*3, 16*4, 16*5, 16*6, 16*7 }, 16*8 }; if(!m_gfxdecode->started()) throw device_missing_dependencies(); m_tilemap[0] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(tc0080vco_device::get_bg0_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 64, 64); m_tilemap[1] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(tc0080vco_device::get_bg1_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 64, 64); m_tilemap[0]->set_transparent_pen(0); m_tilemap[1]->set_transparent_pen(0); m_tilemap[0]->set_scrolldx(m_bg_xoffs, 512); m_tilemap[1]->set_scrolldx(m_bg_xoffs, 512); m_tilemap[0]->set_scrolldy(m_bg_yoffs, m_bg_flip_yoffs); m_tilemap[1]->set_scrolldy(m_bg_yoffs, m_bg_flip_yoffs); /* bg0 tilemap scrollable per pixel row */ m_tilemap[0]->set_scroll_rows(512); /* Perform extra initialisations for text layer */ m_tilemap[2] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(tc0080vco_device::get_tx_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64); m_tilemap[2]->set_scrolldx(0, 0); m_tilemap[2]->set_scrolldy(48, -448); m_tilemap[2]->set_transparent_pen(0); m_ram = auto_alloc_array_clear(machine(), UINT16, TC0080VCO_RAM_SIZE / 2); m_char_ram = m_ram + 0x00000 / 2; /* continues at +0x10000 */ m_tx_ram_0 = m_ram + 0x01000 / 2; m_chain_ram_0 = m_ram + 0x00000 / 2; /* only used from +0x2000 */ m_bg0_ram_0 = m_ram + 0x0c000 / 2; m_bg1_ram_0 = m_ram + 0x0e000 / 2; m_tx_ram_1 = m_ram + 0x11000 / 2; m_chain_ram_1 = m_ram + 0x10000 / 2; /* only used from +0x12000 */ m_bg0_ram_1 = m_ram + 0x1c000 / 2; m_bg1_ram_1 = m_ram + 0x1e000 / 2; m_bgscroll_ram = m_ram + 0x20000 / 2; m_spriteram = m_ram + 0x20400 / 2; m_scroll_ram = m_ram + 0x20800 / 2; /* create the char set (gfx will then be updated dynamically from RAM) */ m_gfxdecode->set_gfx(m_txnum, global_alloc(gfx_element(m_palette, charlayout, (UINT8 *)m_char_ram, 0, 1, 512))); save_pointer(NAME(m_ram), TC0080VCO_RAM_SIZE / 2); machine().save().register_postload(save_prepost_delegate(FUNC(tc0080vco_device::postload), this)); }
void tc0100scn_device::device_start() { static const gfx_layout tc0100scn_charlayout = { 8,8, /* 8*8 characters */ 256, /* 256 characters */ 2, /* 2 bits per pixel */ { 0, 8 }, { 0, 1, 2, 3, 4, 5, 6, 7 }, { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 }, 16*8 /* every sprite takes 16 consecutive bytes */ }; if(!m_gfxdecode->started()) throw device_missing_dependencies(); int xd, yd; /* Set up clipping for multi-TC0100SCN games. We assume this code won't ever affect single screen games: Thundfox is the only one of those with two chips, and we're safe as it uses single width tilemaps. */ /* Single width versions */ m_tilemap[0][0] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(tc0100scn_device::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64); m_tilemap[1][0] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(tc0100scn_device::get_fg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64); m_tilemap[2][0] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(tc0100scn_device::get_tx_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64); /* Double width versions */ m_tilemap[0][1] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(tc0100scn_device::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 128, 64); m_tilemap[1][1] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(tc0100scn_device::get_fg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 128, 64); m_tilemap[2][1] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(tc0100scn_device::get_tx_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 128, 32); m_tilemap[0][0]->set_transparent_pen(0); m_tilemap[1][0]->set_transparent_pen(0); m_tilemap[2][0]->set_transparent_pen(0); m_tilemap[0][1]->set_transparent_pen(0); m_tilemap[1][1]->set_transparent_pen(0); m_tilemap[2][1]->set_transparent_pen(0); /* Standard width tilemaps. I'm setting the optional chip #2 7 bits higher and 2 pixels to the left than chip #1 because that's how thundfox wants it. */ xd = (m_multiscrn_hack == 0) ? (-m_x_offset) : (-m_x_offset - 2); yd = (m_multiscrn_hack == 0) ? (8 - m_y_offset) : (1 - m_y_offset); m_tilemap[0][0]->set_scrolldx(xd - 16, -m_flip_xoffs - xd - 16); m_tilemap[0][0]->set_scrolldy(yd, -m_flip_yoffs - yd); m_tilemap[1][0]->set_scrolldx(xd - 16, -m_flip_xoffs - xd - 16); m_tilemap[1][0]->set_scrolldy(yd, -m_flip_yoffs - yd); m_tilemap[2][0]->set_scrolldx(xd - 16, -m_flip_text_xoffs - xd - 16 - 7); m_tilemap[2][0]->set_scrolldy(yd, -m_flip_text_yoffs - yd); /* Double width tilemaps. We must correct offsets for extra chips, as MAME sees offsets from LHS of whole display not from the edges of individual screens. NB flipscreen tilemap offsets are based on Cameltry */ xd = -m_x_offset - m_multiscrn_xoffs; yd = 8 - m_y_offset; m_tilemap[0][1]->set_scrolldx(xd - 16, -m_flip_xoffs - xd - 16); m_tilemap[0][1]->set_scrolldy(yd, -m_flip_yoffs - yd); m_tilemap[1][1]->set_scrolldx(xd - 16, -m_flip_xoffs - xd - 16); m_tilemap[1][1]->set_scrolldy(yd, -m_flip_yoffs - yd); m_tilemap[2][1]->set_scrolldx(xd - 16, -m_flip_text_xoffs - xd - 16 - 7); m_tilemap[2][1]->set_scrolldy(yd, -m_flip_text_yoffs - yd); m_tilemap[0][0]->set_scroll_rows(512); m_tilemap[1][0]->set_scroll_rows(512); m_tilemap[0][1]->set_scroll_rows(512); m_tilemap[1][1]->set_scroll_rows(512); m_bg_tilemask = 0xffff; /* Mjnquest has 0x7fff tilemask */ m_ram = auto_alloc_array_clear(machine(), UINT16, TC0100SCN_RAM_SIZE / 2); set_layer_ptrs(); /* create the char set (gfx will then be updated dynamically from RAM) */ m_gfxdecode->set_gfx(m_txnum, global_alloc(gfx_element(m_palette, tc0100scn_charlayout, (UINT8 *)m_char_ram, NATIVE_ENDIAN_VALUE_LE_BE(8,0), 256, 0))); gfx_element *gfx = m_gfxdecode->gfx(m_gfxnum); gfx_element *txt = m_gfxdecode->gfx(m_txnum); if (gfx->granularity() == 2) /* Yuyugogo, Yesnoj */ gfx->set_granularity(16); txt->set_granularity(gfx->granularity()); set_colbanks(0, 0, 0); /* standard values, only Wgp & multiscreen games change them */ /* we call this here, so that they can be modified at video_start*/ save_pointer(NAME(m_ram), TC0100SCN_RAM_SIZE / 2); save_item(NAME(m_ctrl)); save_item(NAME(m_dblwidth)); save_item(NAME(m_gfxbank)); machine().save().register_postload(save_prepost_delegate(FUNC(tc0100scn_device::postload), this)); }
void device_gfx_interface::decode_gfx(const gfx_decode_entry *gfxdecodeinfo) { // skip if nothing to do if (gfxdecodeinfo == NULL) return; // local variables to hold mutable copies of gfx layout data gfx_layout glcopy; dynamic_array<UINT32> extxoffs(0); dynamic_array<UINT32> extyoffs(0); // loop over all elements for (int curgfx = 0; curgfx < MAX_GFX_ELEMENTS && gfxdecodeinfo[curgfx].gfxlayout != NULL; curgfx++) { const gfx_decode_entry &gfx = gfxdecodeinfo[curgfx]; // extract the scale factors and xormask UINT32 xscale = GFXENTRY_GETXSCALE(gfx.flags); UINT32 yscale = GFXENTRY_GETYSCALE(gfx.flags); UINT32 xormask = GFXENTRY_ISREVERSE(gfx.flags) ? 7 : 0; // resolve the region UINT32 region_length; const UINT8 *region_base; UINT8 region_width; endianness_t region_endianness; if (gfx.memory_region != NULL) { device_t &basedevice = (GFXENTRY_ISDEVICE(gfx.flags)) ? device() : *device().owner(); if (GFXENTRY_ISRAM(gfx.flags)) { memory_share *share = basedevice.memshare(gfx.memory_region); assert(share != NULL); region_length = 8 * share->bytes(); region_base = reinterpret_cast<UINT8 *>(share->ptr()); region_width = share->width() / 8; region_endianness = share->endianness(); } else { memory_region *region = basedevice.memregion(gfx.memory_region); assert(region != NULL); region_length = 8 * region->bytes(); region_base = region->base(); region_width = region->width(); region_endianness = region->endianness(); } } else { region_length = 0; region_base = NULL; region_width = 1; region_endianness = ENDIANNESS_NATIVE; } if (region_endianness != ENDIANNESS_NATIVE) { switch (region_width) { case 2: xormask |= 0x08; break; case 4: xormask |= 0x18; break; case 8: xormask |= 0x38; break; } } // copy the layout into our temporary variable memcpy(&glcopy, gfx.gfxlayout, sizeof(gfx_layout)); // if the character count is a region fraction, compute the effective total if (IS_FRAC(glcopy.total)) { assert(region_length != 0); glcopy.total = region_length / glcopy.charincrement * FRAC_NUM(glcopy.total) / FRAC_DEN(glcopy.total); } // for non-raw graphics, decode the X and Y offsets if (glcopy.planeoffset[0] != GFX_RAW) { // copy the X and Y offsets into our temporary arrays extxoffs.resize(glcopy.width * xscale); extyoffs.resize(glcopy.height * yscale); memcpy(&extxoffs[0], (glcopy.extxoffs != NULL) ? glcopy.extxoffs : glcopy.xoffset, glcopy.width * sizeof(UINT32)); memcpy(&extyoffs[0], (glcopy.extyoffs != NULL) ? glcopy.extyoffs : glcopy.yoffset, glcopy.height * sizeof(UINT32)); // always use the extended offsets here glcopy.extxoffs = extxoffs; glcopy.extyoffs = extyoffs; // expand X and Y by the scale factors if (xscale > 1) { glcopy.width *= xscale; for (int j = glcopy.width - 1; j >= 0; j--) extxoffs[j] = extxoffs[j / xscale]; } if (yscale > 1) { glcopy.height *= yscale; for (int j = glcopy.height - 1; j >= 0; j--) extyoffs[j] = extyoffs[j / yscale]; } // loop over all the planes, converting fractions for (int j = 0; j < glcopy.planes; j++) { UINT32 value1 = glcopy.planeoffset[j]; if (IS_FRAC(value1)) { assert(region_length != 0); glcopy.planeoffset[j] = FRAC_OFFSET(value1) + region_length * FRAC_NUM(value1) / FRAC_DEN(value1); } } // loop over all the X/Y offsets, converting fractions for (int j = 0; j < glcopy.width; j++) { UINT32 value2 = extxoffs[j]; if (IS_FRAC(value2)) { assert(region_length != 0); extxoffs[j] = FRAC_OFFSET(value2) + region_length * FRAC_NUM(value2) / FRAC_DEN(value2); } } for (int j = 0; j < glcopy.height; j++) { UINT32 value3 = extyoffs[j]; if (IS_FRAC(value3)) { assert(region_length != 0); extyoffs[j] = FRAC_OFFSET(value3) + region_length * FRAC_NUM(value3) / FRAC_DEN(value3); } } } // otherwise, just use the line modulo else { int base = gfx.start; int end = region_length/8; int linemod = glcopy.yoffset[0]; while (glcopy.total > 0) { int elementbase = base + (glcopy.total - 1) * glcopy.charincrement / 8; int lastpixelbase = elementbase + glcopy.height * linemod / 8 - 1; if (lastpixelbase < end) break; glcopy.total--; } } // allocate the graphics m_gfx[curgfx].reset(global_alloc(gfx_element(m_palette, glcopy, (region_base != NULL) ? region_base + gfx.start : NULL, xormask, gfx.total_color_codes, gfx.color_codes_start))); } m_decoded = true; }
void pcd_state::machine_start() { m_gfxdecode->set_gfx(0, global_alloc(gfx_element(machine().device<palette_device>("palette"), pcd_charlayout, &m_charram[0], 0, 1, 0))); m_req_hack = timer_alloc(); }