gfx_elements now have a xor mask that is applied to each source bit offset when decoding. This can be used to deal with endianness when decoding gfx from RAM or from program ROMs, or to reverse the bit order sense when this is useful (e.g. pgm.c) [Alex Jackson]

(nw) This is test/checkpoint right now, final goal is to automatically determine the appropriate xor at startup when the gfxdecode info is processed (e.g. based on the width and endianness of the ROM region)
This commit is contained in:
Alex W. Jackson 2014-03-27 09:21:55 +00:00
parent 076399b3fd
commit ab3a90ca29
35 changed files with 84 additions and 92 deletions

View File

@ -75,7 +75,7 @@ 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, 1, 0)));
m_gfxdecode->set_gfx(0, global_alloc(gfx_element(m_palette, iq151_video32_charlayout, m_chargen, 0, 1, 0)));
}
//-------------------------------------------------

View File

@ -74,7 +74,7 @@ void iq151_video64_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_video64_charlayout, m_chargen, 1, 0)));
m_gfxdecode->set_gfx(0,global_alloc(gfx_element(m_palette, iq151_video64_charlayout, m_chargen, 0, 1, 0)));
}
//-------------------------------------------------

View File

@ -144,6 +144,7 @@ void gfxdecode_device::device_start()
UINT32 width = gl->width;
UINT32 height = gl->height;
UINT32 total = gl->total;
UINT32 xormask = 0;
UINT32 charincrement = gl->charincrement;
gfx_layout glcopy;
int j;
@ -246,7 +247,7 @@ void gfxdecode_device::device_start()
glcopy.total = total;
// allocate the graphics
m_gfx[curgfx].reset(global_alloc(gfx_element(m_palette, glcopy, (region_base != NULL) ? region_base + gfxdecode->start : NULL, gfxdecode->total_color_codes, gfxdecode->color_codes_start)));
m_gfx[curgfx].reset(global_alloc(gfx_element(m_palette, glcopy, (region_base != NULL) ? region_base + gfxdecode->start : NULL, xormask, gfxdecode->total_color_codes, gfxdecode->color_codes_start)));
}
}
@ -359,6 +360,7 @@ gfx_element::gfx_element()
m_gfxdata(NULL),
m_layout_is_raw(false),
m_layout_planes(0),
m_layout_xormask(0),
m_layout_charincrement(0)
{
}
@ -383,11 +385,12 @@ gfx_element::gfx_element(palette_device *palette, UINT8 *base, UINT32 width, UIN
m_gfxdata(base),
m_layout_is_raw(true),
m_layout_planes(0),
m_layout_xormask(0),
m_layout_charincrement(0)
{
}
gfx_element::gfx_element(palette_device *palette, const gfx_layout &gl, const UINT8 *srcdata, UINT32 total_colors, UINT32 color_base)
gfx_element::gfx_element(palette_device *palette, const gfx_layout &gl, const UINT8 *srcdata, UINT32 xormask, UINT32 total_colors, UINT32 color_base)
: m_palette(palette),
m_width(0),
m_height(0),
@ -407,6 +410,7 @@ gfx_element::gfx_element(palette_device *palette, const gfx_layout &gl, const UI
m_gfxdata(NULL),
m_layout_is_raw(false),
m_layout_planes(0),
m_layout_xormask(xormask),
m_layout_charincrement(0)
{
// set the layout
@ -533,20 +537,22 @@ void gfx_element::decode(UINT32 code)
memset(decode_base, 0, m_char_modulo);
// iterate over planes
for (int plane = 0; plane < m_layout_planes; plane++)
int plane, planebit;
for (plane = 0, planebit = 1 << (m_layout_planes - 1);
plane < m_layout_planes;
plane++, planebit >>= 1)
{
int planebit = 1 << (m_layout_planes - 1 - plane);
int planeoffs = code * m_layout_charincrement + m_layout_planeoffset[plane];
// iterate over rows
for (int y = 0; y < m_origheight; y++)
{
int yoffs = planeoffs + m_layout_yoffset[y];
UINT8 *dp = decode_base + y * rowbytes();
UINT8 *dp = decode_base + y * m_line_modulo;
// iterate over columns
for (int x = 0; x < m_origwidth; x++)
if (readbit(m_srcdata, yoffs + m_layout_xoffset[x]))
if (readbit(m_srcdata, (yoffs + m_layout_xoffset[x]) ^ m_layout_xormask))
dp[x] |= planebit;
}
}

View File

@ -138,7 +138,7 @@ class gfx_element
public:
// construction/destruction
gfx_element();
gfx_element(palette_device *palette, const gfx_layout &gl, const UINT8 *srcdata, UINT32 total_colors, UINT32 color_base);
gfx_element(palette_device *palette, const gfx_layout &gl, const UINT8 *srcdata, UINT32 xormask, UINT32 total_colors, UINT32 color_base);
gfx_element(palette_device *palette, UINT8 *base, UINT32 width, UINT32 height, UINT32 rowbytes, UINT32 total_colors, UINT32 color_base, UINT32 color_granularity);
// getters
@ -160,6 +160,7 @@ public:
void set_layout(const gfx_layout &gl, const UINT8 *srcdata);
void set_raw_layout(const UINT8 *srcdata, UINT32 width, UINT32 height, UINT32 total, UINT32 linemod, UINT32 charmod);
void set_source(const UINT8 *source) { m_srcdata = source; if (m_layout_is_raw) m_gfxdata = const_cast<UINT8 *>(source); memset(m_dirty, 1, elements()); }
void set_xormask(UINT32 xormask) { m_layout_xormask = xormask; }
void set_palette(palette_device *palette) { m_palette = palette; }
void set_colors(UINT32 colors) { m_total_colors = colors; }
void set_colorbase(UINT16 colorbase) { m_color_base = colorbase; }
@ -282,6 +283,7 @@ private:
bool m_layout_is_raw; // raw layout?
UINT8 m_layout_planes; // bit planes in the layout
UINT32 m_layout_xormask; // xor mask applied to each bit offset
UINT32 m_layout_charincrement; // per-character increment in source data
dynamic_array<UINT32> m_layout_planeoffset;// plane offsets
dynamic_array<UINT32> m_layout_xoffset; // X offsets

View File

@ -297,7 +297,7 @@ void tc0091lvc_device::device_start()
//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, m_palette->entries() / 16, 0)));
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 tc0091lvc_device::device_reset()

View File

@ -564,7 +564,7 @@ void coolridr_state::video_start()
m_screen->register_screen_bitmap(m_screen1_bitmap);
m_screen->register_screen_bitmap(m_screen2_bitmap);
m_gfxdecode->set_gfx(m_gfx_index, global_alloc(gfx_element(m_palette, h1_tile_layout, m_h1_pcg, 8, 0)));
m_gfxdecode->set_gfx(m_gfx_index, global_alloc(gfx_element(m_palette, h1_tile_layout, m_h1_pcg, 0, 8, 0)));
}
/*

View File

@ -904,12 +904,12 @@ void cps3_state::video_start()
save_pointer(NAME(m_char_ram), 0x800000 /4);
/* create the char set (gfx will then be updated dynamically from RAM) */
m_gfxdecode->set_gfx(0, global_alloc(gfx_element(m_palette, cps3_tiles8x8_layout, (UINT8 *)m_ss_ram, m_palette->entries() / 16, 0)));
m_gfxdecode->set_gfx(0, global_alloc(gfx_element(m_palette, cps3_tiles8x8_layout, (UINT8 *)m_ss_ram, 0, m_palette->entries() / 16, 0)));
//decode_ssram();
/* create the char set (gfx will then be updated dynamically from RAM) */
m_gfxdecode->set_gfx(1, global_alloc(gfx_element(m_palette, cps3_tiles16x16_layout, (UINT8 *)m_char_ram, m_palette->entries() / 64, 0)));
m_gfxdecode->set_gfx(1, global_alloc(gfx_element(m_palette, cps3_tiles16x16_layout, (UINT8 *)m_char_ram, 0, m_palette->entries() / 64, 0)));
m_gfxdecode->gfx(1)->set_granularity(64);
//decode_charram();

View File

@ -390,7 +390,7 @@ static const gfx_layout mpu4_vid_char_8x8_layout =
8,8,
0x1000, /* 0x1000 tiles (128k of GFX RAM, 0x20 bytes per tile) */
4,
{ 8,0,24,16 },
{ 0,8,16,24 },
{ 0,1,2,3,4,5,6,7 },
{ 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32},
8*32
@ -403,7 +403,7 @@ static const gfx_layout mpu4_vid_char_8x16_layout =
8,16,
0x1000, /* 0x1000 tiles (128k of GFX RAM, 0x20 bytes per tile) */
4,
{ 8,0,24,16 },
{ 0,8,16,24 },
{ 0,1,2,3,4,5,6,7 },
{ 0*32, 0*32, 1*32, 1*32, 2*32, 2*32, 3*32, 3*32, 4*32, 4*32, 5*32, 5*32, 6*32, 6*32, 7*32, 7*32},
8*32
@ -416,7 +416,7 @@ static const gfx_layout mpu4_vid_char_16x8_layout =
16,8,
0x1000, /* 0x1000 tiles (128k of GFX RAM, 0x20 bytes per tile) */
4,
{ 8,0,24,16 },
{ 0,8,16,24 },
{ 0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7 },
{ 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32},
8*32
@ -429,7 +429,7 @@ static const gfx_layout mpu4_vid_char_16x16_layout =
16,16,
0x1000, /* 0x1000 tiles (128k of GFX RAM, 0x20 bytes per tile) */
4,
{ 8,0,24,16 },
{ 0,8,16,24 },
{ 0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7 },
{ 0*32, 0*32, 1*32, 1*32, 2*32, 2*32, 3*32, 3*32, 4*32, 4*32, 5*32, 5*32, 6*32, 6*32, 7*32, 7*32},
8*32
@ -482,10 +482,10 @@ VIDEO_START_MEMBER(mpu4vid_state,mpu4_vid)
assert(m_gfx_index != MAX_GFX_ELEMENTS);
/* create the char set (gfx will then be updated dynamically from RAM) */
m_gfxdecode->set_gfx(m_gfx_index+0, global_alloc(gfx_element(m_palette, mpu4_vid_char_8x8_layout, reinterpret_cast<UINT8 *>(m_vid_vidram.target()), m_palette->entries() / 16, 0)));
m_gfxdecode->set_gfx(m_gfx_index+1, global_alloc(gfx_element(m_palette, mpu4_vid_char_8x16_layout, reinterpret_cast<UINT8 *>(m_vid_vidram.target()), m_palette->entries() / 16, 0)));
m_gfxdecode->set_gfx(m_gfx_index+2, global_alloc(gfx_element(m_palette, mpu4_vid_char_16x8_layout, reinterpret_cast<UINT8 *>(m_vid_vidram.target()), m_palette->entries() / 16, 0)));
m_gfxdecode->set_gfx(m_gfx_index+3, global_alloc(gfx_element(m_palette, mpu4_vid_char_16x16_layout, reinterpret_cast<UINT8 *>(m_vid_vidram.target()), m_palette->entries() / 16, 0)));
m_gfxdecode->set_gfx(m_gfx_index+0, global_alloc(gfx_element(m_palette, mpu4_vid_char_8x8_layout, reinterpret_cast<UINT8 *>(m_vid_vidram.target()), NATIVE_ENDIAN_VALUE_LE_BE(8,0), m_palette->entries() / 16, 0)));
m_gfxdecode->set_gfx(m_gfx_index+1, global_alloc(gfx_element(m_palette, mpu4_vid_char_8x16_layout, reinterpret_cast<UINT8 *>(m_vid_vidram.target()), NATIVE_ENDIAN_VALUE_LE_BE(8,0), m_palette->entries() / 16, 0)));
m_gfxdecode->set_gfx(m_gfx_index+2, global_alloc(gfx_element(m_palette, mpu4_vid_char_16x8_layout, reinterpret_cast<UINT8 *>(m_vid_vidram.target()), NATIVE_ENDIAN_VALUE_LE_BE(8,0), m_palette->entries() / 16, 0)));
m_gfxdecode->set_gfx(m_gfx_index+3, global_alloc(gfx_element(m_palette, mpu4_vid_char_16x16_layout, reinterpret_cast<UINT8 *>(m_vid_vidram.target()), NATIVE_ENDIAN_VALUE_LE_BE(8,0), m_palette->entries() / 16, 0)));
m_scn2674->init_stuff();

View File

@ -431,9 +431,8 @@ INPUT_PORTS_END
/*** GFX Decodes *************************************************************/
/* We can't decode the sprite data like this because it isn't tile based.
The 32x32 tile data is 5bpp chunky LSB first (bits 01234 are pixel 0,
bits 567+01 of the next byte are pixel 1, etc.) which MAME can't decode
as-is, so we must invert the bit order of the ROM data */
Note that the bit indexes in these layouts are inverted compared to usual
MAME gfx layouts (0 = LSB, 7 = MSB) */
static const gfx_layout pgm8_charlayout =
{
@ -465,7 +464,6 @@ static const gfx_layout pgm32_charlayout =
GFXDECODE_START( pgm )
GFXDECODE_ENTRY( "tiles", 0, pgm8_charlayout, 0x800, 32 ) /* 8x8x4 Tiles */
GFXDECODE_ENTRY( "tiles", 0, pgm32_charlayout, 0x400, 32 ) /* 32x32x5 Tiles */
GFXDECODE_END
@ -3984,16 +3982,6 @@ ROM_END
/*** Init Stuff **************************************************************/
/* Invert the bit order so that we can decode the 32x32x5bpp tiles */
void pgm_state::invert_tiledata()
{
UINT8 *src = memregion( "tiles" )->base();
size_t srcsize = memregion( "tiles" )->bytes();
for (int i = 0; i < srcsize; i++)
src[i] = BITSWAP8(src[i], 0, 1, 2, 3, 4, 5, 6, 7);
}
/* This function expands the sprite colour data (in the A Roms) from 3 pixels
in each word to a byte per pixel making it easier to use */
@ -4028,7 +4016,6 @@ void pgm_state::pgm_basic_init( bool set_bank)
UINT8 *ROM = memregion("maincpu")->base();
if (set_bank) membank("bank1")->set_base(&ROM[0x100000]);
invert_tiledata();
expand_colourdata();
m_bg_videoram = &m_videoram[0];

View File

@ -169,8 +169,8 @@ static const gfx_layout popobear_char_layout =
0x4000,
8,
{ 0,1,2,3,4,5,6,7 },
{ 8,0,24,16,40,32,56,48 },
{ 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64 },
{ STEP8(0, 8) },
{ STEP8(0, 64) },
8*64
};
@ -224,7 +224,7 @@ void popobear_state::video_start()
/* create the char set (gfx will then be updated dynamically from RAM) */
m_gfxdecode->set_gfx(m_gfx_index, global_alloc(gfx_element(m_palette, popobear_char_layout, (UINT8 *)m_vram_rearranged, m_palette->entries() / 16, 0)));
m_gfxdecode->set_gfx(m_gfx_index, global_alloc(gfx_element(m_palette, popobear_char_layout, (UINT8 *)m_vram_rearranged, NATIVE_ENDIAN_VALUE_LE_BE(8,0), m_palette->entries() / 16, 0)));
m_bg_tilemap[0] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(popobear_state::get_popobear_bg0_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 128, 64);
m_bg_tilemap[1] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(popobear_state::get_popobear_bg1_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 128, 64);

View File

@ -169,7 +169,7 @@ void srmp6_state::video_start()
m_sprram_old = auto_alloc_array_clear(machine(), UINT16, 0x80000/2);
/* create the char set (gfx will then be updated dynamically from RAM) */
m_gfxdecode->set_gfx(0, global_alloc(gfx_element(m_palette, tiles8x8_layout, (UINT8*)m_tileram, m_palette->entries() / 256, 0)));
m_gfxdecode->set_gfx(0, global_alloc(gfx_element(m_palette, tiles8x8_layout, (UINT8*)m_tileram, 0, m_palette->entries() / 256, 0)));
m_gfxdecode->gfx(0)->set_granularity(256);
m_brightness = 0x60;

View File

@ -105,7 +105,6 @@ public:
void draw_sprite_line_basic( int wide, UINT16* dest, UINT8* destpri, int flip, int xpos, int pri, int realxsize, int palt, int draw );
void draw_sprite_new_basic( int wide, int high, int xpos, int ypos, int palt, int flip, bitmap_ind16 &bitmap, bitmap_ind8 &priority_bitmap, int pri );
void draw_sprites( bitmap_ind16& spritebitmap, UINT16 *sprite_source, bitmap_ind8& priority_bitmap );
void invert_tiledata();
void expand_colourdata();
void pgm_basic_init( bool set_bank = true);
};

View File

@ -617,15 +617,15 @@ int atarisy1_state::get_bank(UINT8 prom1, UINT8 prom2, int bpp)
switch (bpp)
{
case 4:
m_gfxdecode->set_gfx(gfx_index,global_alloc(gfx_element(m_palette, objlayout_4bpp, srcdata, 0x40, 256)));
m_gfxdecode->set_gfx(gfx_index,global_alloc(gfx_element(m_palette, objlayout_4bpp, srcdata, 0, 0x40, 256)));
break;
case 5:
m_gfxdecode->set_gfx(gfx_index,global_alloc(gfx_element(m_palette, objlayout_5bpp, srcdata, 0x40, 256)));
m_gfxdecode->set_gfx(gfx_index,global_alloc(gfx_element(m_palette, objlayout_5bpp, srcdata, 0, 0x40, 256)));
break;
case 6:
m_gfxdecode->set_gfx(gfx_index,global_alloc(gfx_element(m_palette, objlayout_6bpp, srcdata, 0x40, 256)));
m_gfxdecode->set_gfx(gfx_index,global_alloc(gfx_element(m_palette, objlayout_6bpp, srcdata, 0, 0x40, 256)));
break;
default:

View File

@ -51,7 +51,7 @@ const gfx_layout namco_c45_road_device::s_tile_layout =
ROAD_TILE_SIZE, ROAD_TILE_SIZE,
ROAD_TILE_COUNT_MAX,
2,
{ NATIVE_ENDIAN_VALUE_LE_BE(8,0), NATIVE_ENDIAN_VALUE_LE_BE(0,8) },
{ 0, 8 },
{// x offset
0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17
@ -206,7 +206,7 @@ void namco_c45_road_device::device_start()
throw device_missing_dependencies();
// create a gfx_element describing the road graphics
m_gfxdecode->set_gfx(0, global_alloc(gfx_element(m_palette, s_tile_layout, 0x10000 + (UINT8 *)&m_ram[0], 0x3f, 0xf00)));
m_gfxdecode->set_gfx(0, global_alloc(gfx_element(m_palette, s_tile_layout, 0x10000 + (UINT8 *)&m_ram[0], NATIVE_ENDIAN_VALUE_LE_BE(8,0), 0x3f, 0xf00)));
// create a tilemap for the road
m_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(namco_c45_road_device::get_road_info), this),

View File

@ -123,8 +123,8 @@ void k001604_device::device_start()
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], 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], m_palette->entries() / 16, 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);

View File

@ -75,7 +75,7 @@ void k037122_device::device_start()
m_layer[0]->set_transparent_pen(0);
m_layer[1]->set_transparent_pen(0);
m_gfxdecode->set_gfx(m_gfx_index,global_alloc(gfx_element(m_palette, k037122_char_layout, (UINT8*)m_char_ram, m_palette->entries() / 16, 0)));
m_gfxdecode->set_gfx(m_gfx_index,global_alloc(gfx_element(m_palette, k037122_char_layout, (UINT8*)m_char_ram, 0, m_palette->entries() / 16, 0)));
save_pointer(NAME(m_reg), 0x400 / 4);
save_pointer(NAME(m_char_ram), 0x200000 / 4);

View File

@ -82,7 +82,7 @@ void konami_decode_gfx(running_machine &machine, gfxdecode_device * gfxdecode, p
memcpy(&gl, layout, sizeof(gl));
gl.total = total;
gfxdecode->set_gfx(gfx_index, global_alloc(gfx_element(&palette, gl, data, palette.entries() >> bpp, 0)));
gfxdecode->set_gfx(gfx_index, global_alloc(gfx_element(&palette, gl, data, 0, palette.entries() >> bpp, 0)));
}

View File

@ -98,7 +98,7 @@ VIDEO_START_MEMBER(m10_state,m10)
m_tx_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(m10_state::get_tile_info),this), tilemap_mapper_delegate(FUNC(m10_state::tilemap_scan),this), 8, 8, 32, 32);
m_tx_tilemap->set_transparent_pen(0);
m_back_gfx = global_alloc(gfx_element(m_palette, backlayout, m_chargen, 8, 0));
m_back_gfx = global_alloc(gfx_element(m_palette, backlayout, m_chargen, 0, 8, 0));
m_gfxdecode->set_gfx(1, m_back_gfx);
return ;
@ -106,7 +106,7 @@ VIDEO_START_MEMBER(m10_state,m10)
VIDEO_START_MEMBER(m10_state,m15)
{
m_gfxdecode->set_gfx(0,global_alloc(gfx_element(m_palette, charlayout, m_chargen, 8, 0)));
m_gfxdecode->set_gfx(0,global_alloc(gfx_element(m_palette, charlayout, m_chargen, 0, 8, 0)));
m_tx_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(m10_state::get_tile_info),this),tilemap_mapper_delegate(FUNC(m10_state::tilemap_scan),this), 8, 8, 32, 32);

View File

@ -188,16 +188,14 @@ WRITE16_MEMBER(namcona1_state::namcona1_paletteram_w)
/*************************************************************************/
#define XOR(a) BYTE_XOR_BE(a)
static const gfx_layout shape_layout =
{
8,8,
0x1000,
1,
{ 0 },
{ 0,1,2,3,4,5,6,7 },
{ 8*XOR(0),8*XOR(1),8*XOR(2),8*XOR(3),8*XOR(4),8*XOR(5),8*XOR(6),8*XOR(7) },
{ STEP8(0, 1) },
{ STEP8(0, 8) },
8*8
}; /* shape_layout */
@ -207,9 +205,9 @@ static const gfx_layout cg_layout_8bpp =
0x1000,
8, /* 8BPP */
{ 0,1,2,3,4,5,6,7 },
{ 8*XOR(0),8*XOR(1),8*XOR(2),8*XOR(3),8*XOR(4),8*XOR(5),8*XOR(6),8*XOR(7) },
{ 64*0,64*1,64*2,64*3,64*4,64*5,64*6,64*7 },
64*8
{ STEP8(0, 8) },
{ STEP8(0, 8*8) },
8*8*8
}; /* cg_layout_8bpp */
static const gfx_layout cg_layout_4bpp =
@ -218,9 +216,9 @@ static const gfx_layout cg_layout_4bpp =
0x1000,
4, /* 4BPP */
{ 4,5,6,7 },
{ 8*XOR(0),8*XOR(1),8*XOR(2),8*XOR(3),8*XOR(4),8*XOR(5),8*XOR(6),8*XOR(7) },
{ 64*0,64*1,64*2,64*3,64*4,64*5,64*6,64*7 },
64*8
{ STEP8(0, 8) },
{ STEP8(0, 8*8) },
8*8*8
}; /* cg_layout_4bpp */
READ16_MEMBER(namcona1_state::namcona1_gfxram_r)
@ -289,9 +287,9 @@ void namcona1_state::video_start()
m_shaperam = auto_alloc_array_clear(machine(), UINT16, 0x2000*4/2 );
m_cgram = auto_alloc_array_clear(machine(), UINT16, 0x1000*0x40/2 );
m_gfxdecode->set_gfx(0, global_alloc( gfx_element(m_palette, cg_layout_8bpp, (UINT8 *)m_cgram, m_palette->entries()/256, 0 )));
m_gfxdecode->set_gfx(1, global_alloc( gfx_element(m_palette, cg_layout_4bpp, (UINT8 *)m_cgram, m_palette->entries()/16, 0 )));
m_gfxdecode->set_gfx(2, global_alloc( gfx_element(m_palette, shape_layout, (UINT8 *)m_shaperam, m_palette->entries()/2, 0 )));
m_gfxdecode->set_gfx(0, global_alloc( gfx_element(m_palette, cg_layout_8bpp, (UINT8 *)m_cgram, NATIVE_ENDIAN_VALUE_LE_BE(8,0), m_palette->entries()/256, 0 )));
m_gfxdecode->set_gfx(1, global_alloc( gfx_element(m_palette, cg_layout_4bpp, (UINT8 *)m_cgram, NATIVE_ENDIAN_VALUE_LE_BE(8,0), m_palette->entries()/16, 0 )));
m_gfxdecode->set_gfx(2, global_alloc( gfx_element(m_palette, shape_layout, (UINT8 *)m_shaperam, NATIVE_ENDIAN_VALUE_LE_BE(8,0), m_palette->entries()/2, 0 )));
} /* namcona1_vh_start */

View File

@ -617,6 +617,10 @@ VIDEO_START_MEMBER(pgm_state,pgm)
m_aoffset = 0;
m_boffset = 0;
// temporary, this will be specified in gfxdecode info eventually
m_gfxdecode->gfx(0)->set_xormask(7);
m_gfxdecode->gfx(1)->set_xormask(7);
m_tx_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(pgm_state::get_pgm_tx_tilemap_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
m_tx_tilemap->set_transparent_pen(15);

View File

@ -99,7 +99,7 @@ void polygonet_state::video_start()
assert(m_ttl_gfx_index != MAX_GFX_ELEMENTS);
/* decode the ttl layer's gfx */
m_gfxdecode->set_gfx(m_ttl_gfx_index, global_alloc(gfx_element(m_palette, charlayout, memregion("gfx1")->base(), m_palette->entries() / 16, 0)));
m_gfxdecode->set_gfx(m_ttl_gfx_index, global_alloc(gfx_element(m_palette, charlayout, memregion("gfx1")->base(), 0, m_palette->entries() / 16, 0)));
/* create the tilemap */
m_ttl_tilemap = &machine().tilemap().create(m_gfxdecode, 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);

View File

@ -86,7 +86,7 @@ void rungun_state::video_start()
assert(gfx_index != MAX_GFX_ELEMENTS);
// decode the ttl layer's gfx
m_gfxdecode->set_gfx(gfx_index, global_alloc(gfx_element(m_palette, charlayout, memregion("gfx3")->base(), m_palette->entries() / 16, 0)));
m_gfxdecode->set_gfx(gfx_index, global_alloc(gfx_element(m_palette, charlayout, memregion("gfx3")->base(), 0, m_palette->entries() / 16, 0)));
m_ttl_gfx_index = gfx_index;
// create the tilemap

View File

@ -55,15 +55,13 @@ void segas24_tile::static_set_tile_mask(device_t &device, UINT16 _tile_mask)
dev.tile_mask = _tile_mask;
}
#define XOR(a) WORD_XOR_BE(a)
const gfx_layout segas24_tile::char_layout = {
8, 8,
SYS24_TILES,
4,
{ 0, 1, 2, 3 },
{ XOR(0)*4, XOR(1)*4, XOR(2)*4, XOR(3)*4, XOR(4)*4, XOR(5)*4, XOR(6)*4, XOR(7)*4 },
{ 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 },
{ STEP8(0, 4) },
{ STEP8(0, 32) },
8*32
};
@ -120,7 +118,7 @@ void segas24_tile::device_start()
memset(char_ram, 0, 0x80000);
memset(tile_ram, 0, 0x10000);
m_gfxdecode->set_gfx(char_gfx_index, global_alloc(gfx_element(m_palette, char_layout, (UINT8 *)char_ram, m_palette->entries() / 16, 0)));
m_gfxdecode->set_gfx(char_gfx_index, global_alloc(gfx_element(m_palette, char_layout, (UINT8 *)char_ram, NATIVE_ENDIAN_VALUE_LE_BE(8,0), m_palette->entries() / 16, 0)));
save_pointer(NAME(tile_ram), 0x10000/2);
save_pointer(NAME(char_ram), 0x80000/2);

View File

@ -449,7 +449,7 @@ VIDEO_START_MEMBER(st0016_state,st0016)
assert(gfx_index != MAX_GFX_ELEMENTS);
/* create the char set (gfx will then be updated dynamically from RAM) */
m_gfxdecode->set_gfx(gfx_index, global_alloc(gfx_element(m_palette, charlayout, (UINT8 *) st0016_charram, 0x40, 0)));
m_gfxdecode->set_gfx(gfx_index, global_alloc(gfx_element(m_palette, charlayout, (UINT8 *) st0016_charram, 0, 0x40, 0)));
st0016_ramgfx = gfx_index;
spr_dx=0;

View File

@ -78,7 +78,7 @@ void st0020_device::device_start()
if (m_gfxdecode->gfx(m_gfx_index) == 0)
break;
m_gfxdecode->set_gfx(m_gfx_index, global_alloc(gfx_element(m_palette, layout_16x8x8_2, (UINT8 *)m_st0020_gfxram, m_palette->entries() / 64, 0)));
m_gfxdecode->set_gfx(m_gfx_index, global_alloc(gfx_element(m_palette, layout_16x8x8_2, (UINT8 *)m_st0020_gfxram, 0, m_palette->entries() / 64, 0)));
m_gfxdecode->gfx(m_gfx_index)->set_granularity(64); /* 256 colour sprites with palette selectable on 64 colour boundaries */

View File

@ -315,7 +315,7 @@ void taitojc_state::video_start()
m_tile_ram = auto_alloc_array_clear(machine(), UINT32, 0x4000/4);
/* create the char set (gfx will then be updated dynamically from RAM) */
m_gfxdecode->set_gfx(m_gfx_index, global_alloc(gfx_element(m_palette, taitojc_char_layout, (UINT8 *)m_char_ram, m_palette->entries() / 16, 0)));
m_gfxdecode->set_gfx(m_gfx_index, global_alloc(gfx_element(m_palette, taitojc_char_layout, (UINT8 *)m_char_ram, 0, m_palette->entries() / 16, 0)));
m_texture = auto_alloc_array(machine(), UINT8, 0x400000);

View File

@ -204,7 +204,7 @@ void tc0080vco_device::device_start()
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, 64, 0)));
m_gfxdecode->set_gfx(m_txnum, global_alloc(gfx_element(m_palette, charlayout, (UINT8 *)m_char_ram, 0, 64, 0)));
save_pointer(NAME(m_ram), TC0080VCO_RAM_SIZE / 2);
machine().save().register_postload(save_prepost_delegate(FUNC(tc0080vco_device::postload), this));

View File

@ -115,7 +115,6 @@ $84fc0 and neighbouring routines poke col scroll area.
#define TC0100SCN_RAM_SIZE 0x14000 /* enough for double-width tilemaps */
#define TC0100SCN_TOTAL_CHARS 256
#define XOR(a) WORD_XOR_BE(a)
const device_type TC0100SCN = &device_creator<tc0100scn_device>;
@ -197,7 +196,7 @@ void tc0100scn_device::device_start()
8,8, /* 8*8 characters */
256, /* 256 characters */
2, /* 2 bits per pixel */
{ XOR(0)*4, XOR(2)*4 },
{ 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 */
@ -286,7 +285,7 @@ void tc0100scn_device::device_start()
/* we call this here, so that they can be modified at video_start*/
/* 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, 64, 0)));
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), 64, 0)));
save_pointer(NAME(m_ram), TC0100SCN_RAM_SIZE / 2);
save_item(NAME(m_ctrl));

View File

@ -133,7 +133,6 @@ Control registers
#define TC0480SCP_RAM_SIZE 0x10000
#define TC0480SCP_TOTAL_CHARS 256
#define XOR(a) WORD_XOR_BE(a)
const device_type TC0480SCP = &device_creator<tc0480scp_device>;
@ -217,7 +216,7 @@ void tc0480scp_device::device_start()
256, /* 256 characters */
4, /* 4 bits per pixel */
{ 0, 1, 2, 3 },
{ XOR(3)*4, XOR(2)*4, XOR(1)*4, XOR(0)*4, XOR(7)*4, XOR(6)*4, XOR(5)*4, XOR(4)*4 },
{ 3*4, 2*4, 1*4, 0*4, 7*4, 6*4, 5*4, 4*4 },
{ 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 },
32*8 /* every sprite takes 32 consecutive bytes */
};
@ -295,7 +294,7 @@ void tc0480scp_device::device_start()
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, tc0480scp_charlayout, (UINT8 *)m_char_ram, 64, 0)));
m_gfxdecode->set_gfx(m_txnum, global_alloc(gfx_element(m_palette, tc0480scp_charlayout, (UINT8 *)m_char_ram, NATIVE_ENDIAN_VALUE_LE_BE(8,0), 64, 0)));
save_pointer(NAME(m_ram), TC0480SCP_RAM_SIZE / 2);
save_item(NAME(m_ctrl));

View File

@ -251,13 +251,13 @@ void tceptor_state::decode_bg(const char * region)
memcpy(src, buffer, len);
/* decode the graphics */
m_gfxdecode->set_gfx(gfx_index, global_alloc(gfx_element(m_palette, bg_layout, memregion(region)->base(), 64, 0x0a00)));
m_gfxdecode->set_gfx(gfx_index, global_alloc(gfx_element(m_palette, bg_layout, memregion(region)->base(), 0, 64, 0x0a00)));
}
void tceptor_state::decode_sprite(int gfx_index, const gfx_layout *layout, const void *data)
{
/* decode the graphics */
m_gfxdecode->set_gfx(gfx_index, global_alloc(gfx_element(m_palette, *layout, (const UINT8 *)data, 64, 1024)));
m_gfxdecode->set_gfx(gfx_index, global_alloc(gfx_element(m_palette, *layout, (const UINT8 *)data, 0, 64, 1024)));
}
// fix sprite order

View File

@ -228,8 +228,8 @@ void casloopy_state::video_start()
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, 0x10, 0)));
m_gfxdecode->set_gfx(m_gfx_index+1, global_alloc(gfx_element(m_palette, casloopy_8bpp_layout, m_vram, 1, 0)));
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)));
}
UINT32 casloopy_state::screen_update_casloopy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)

View File

@ -1782,8 +1782,8 @@ void mz2500_state::machine_start()
save_pointer(NAME(m_emm_ram), 0x100000);
/* TODO: gfx[4] crashes as per now */
m_gfxdecode->set_gfx(3, global_alloc(gfx_element(m_palette, mz2500_pcg_layout_1bpp, (UINT8 *)m_pcg_ram, 0x10, 0)));
m_gfxdecode->set_gfx(4, global_alloc(gfx_element(m_palette, mz2500_pcg_layout_3bpp, (UINT8 *)m_pcg_ram, 4, 0)));
m_gfxdecode->set_gfx(3, global_alloc(gfx_element(m_palette, mz2500_pcg_layout_1bpp, (UINT8 *)m_pcg_ram, 0, 0x10, 0)));
m_gfxdecode->set_gfx(4, global_alloc(gfx_element(m_palette, mz2500_pcg_layout_3bpp, (UINT8 *)m_pcg_ram, 0, 4, 0)));
}
void mz2500_state::machine_reset()

View File

@ -988,7 +988,7 @@ void smc777_state::machine_start()
save_pointer(NAME(m_gvram), 0x8000);
save_pointer(NAME(m_pcg), 0x800);
m_gfxdecode->set_gfx(0, global_alloc(gfx_element(m_palette, smc777_charlayout, (UINT8 *)m_pcg, 8, 0)));
m_gfxdecode->set_gfx(0, global_alloc(gfx_element(m_palette, smc777_charlayout, (UINT8 *)m_pcg, 0, 8, 0)));
}
void smc777_state::machine_reset()

View File

@ -2526,7 +2526,7 @@ MACHINE_START_MEMBER(x1_state,x1)
save_pointer(NAME(m_emm_ram), 0x1000000);
save_pointer(NAME(m_pcg_ram), 0x1800);
m_gfxdecode->set_gfx(3, global_alloc(gfx_element(m_palette, x1_pcg_8x8, (UINT8 *)m_pcg_ram, 1, 0)));
m_gfxdecode->set_gfx(3, global_alloc(gfx_element(m_palette, x1_pcg_8x8, (UINT8 *)m_pcg_ram, 0, 1, 0)));
}
PALETTE_INIT_MEMBER(x1_state,x1)

View File

@ -1094,11 +1094,11 @@ VIDEO_START_MEMBER(x68k_state,x68000)
break;
/* create the char set (gfx will then be updated dynamically from RAM) */
m_gfxdecode->set_gfx(gfx_index, global_alloc(gfx_element(m_palette, x68k_pcg_8, memregion("user1")->base(), 32, 0)));
m_gfxdecode->set_gfx(gfx_index, global_alloc(gfx_element(m_palette, x68k_pcg_8, memregion("user1")->base(), 0, 32, 0)));
gfx_index++;
m_gfxdecode->set_gfx(gfx_index, global_alloc(gfx_element(m_palette, x68k_pcg_16, memregion("user1")->base(), 32, 0)));
m_gfxdecode->set_gfx(gfx_index, global_alloc(gfx_element(m_palette, x68k_pcg_16, memregion("user1")->base(), 0, 32, 0)));
m_gfxdecode->gfx(gfx_index)->set_colors(32);
/* Tilemaps */