diff options
author | Angelo Salese <angelosa@users.noreply.github.com> | 2009-11-25 20:29:10 +0000 |
---|---|---|
committer | Angelo Salese <angelosa@users.noreply.github.com> | 2009-11-25 20:29:10 +0000 |
commit | c8178c6b753bbd89185a1317cb1b5cb3207a5f43 (patch) | |
tree | 241618d22f7fe4a8ee69c801e0eb3d1206a77c1f /src/mame | |
parent | 86170178449a61c7fcb70f6081e159d10cdf3aa5 (diff) |
Implemented use of per tile colour lookup ROM in Portraits, colour decode is still wrong [David Haywood]
Diffstat (limited to 'src/mame')
-rw-r--r-- | src/mame/drivers/portrait.c | 69 | ||||
-rw-r--r-- | src/mame/video/portrait.c | 74 |
2 files changed, 110 insertions, 33 deletions
diff --git a/src/mame/drivers/portrait.c b/src/mame/drivers/portrait.c index eb352c99404..eedc9a8f184 100644 --- a/src/mame/drivers/portrait.c +++ b/src/mame/drivers/portrait.c @@ -88,6 +88,8 @@ DM81LS95 = TriState buffer #include "cpu/mcs48/mcs48.h" #include "sound/tms5220.h" +extern PALETTE_INIT(portrait); + extern UINT8 *portrait_bgvideoram,*portrait_fgvideoram; extern int portrait_scroll; @@ -234,7 +236,7 @@ static const gfx_layout tile_layout = 16,16, /* tile width, height */ 1024, /* number of characters */ 3, /* bits per pixel */ - { 0, 0x4000*8, 0x8000*8 }, /* bitplane offsets */ + { 0x8000*8, 0x4000*8, 0x0000*8 }, /* bitplane offsets */ { RGN_FRAC(1,2)+7, RGN_FRAC(1,2)+6, RGN_FRAC(1,2)+5, RGN_FRAC(1,2)+4, RGN_FRAC(1,2)+3, RGN_FRAC(1,2)+2, RGN_FRAC(1,2)+1, RGN_FRAC(1,2)+0, @@ -245,7 +247,7 @@ static const gfx_layout tile_layout = }; static GFXDECODE_START( portrait ) - GFXDECODE_ENTRY( "gfx1", 0x00000, tile_layout, 0, 0x100 ) + GFXDECODE_ENTRY( "gfx1", 0x00000, tile_layout, 0, 0x800/8 ) GFXDECODE_END static MACHINE_DRIVER_START( portrait ) @@ -268,7 +270,7 @@ static MACHINE_DRIVER_START( portrait ) MDRV_GFXDECODE(portrait) MDRV_PALETTE_LENGTH(0x800) -// MDRV_PALETTE_INIT(portrait) + MDRV_PALETTE_INIT(portrait) MDRV_VIDEO_START(portrait) MDRV_VIDEO_UPDATE(portrait) @@ -292,29 +294,34 @@ ROM_START( portrait ) ROM_LOAD( "port_w.bin", 0x0000, 0x0800, CRC(d3a4e950) SHA1(0a399d43c7690d568874f3b1d55135f803fc223f) ) ROM_LOAD( "port_ma.bin", 0x0800, 0x0800, CRC(ee242e4f) SHA1(fb67e0d136927e04f4fa819f684c97b0d52ee48c) ) - ROM_REGION( 0x20000, "gfx1", ROMREGION_INVERT ) + ROM_REGION( 0x20000, "gfx1", 0 ) ROM_LOAD( "port_00.a1", 0x00000, 0x2000, CRC(eb3e1c12) SHA1(2d38b66f52546b40553244c8a5c961279559f5b6) ) /*bit plane 1*/ ROM_LOAD( "port_10.b1", 0x02000, 0x2000, CRC(0f44e377) SHA1(1955f9f4deab2166f637f43c1f326bd65fc90f6a) ) /*bit plane 1*/ + ROM_LOAD( "port_02.d1", 0x04000, 0x2000, CRC(bd93a3f9) SHA1(9cb479b8840cafd6043ff0cb9d5ca031dcd332ba) ) /*bit plane 2*/ ROM_LOAD( "port_12.e1", 0x06000, 0x2000, CRC(656b9f20) SHA1(c1907aba3d19be79d92cd73784b8e7ae94910da6) ) /*bit plane 2*/ + ROM_LOAD( "port_04.g1", 0x08000, 0x2000, CRC(2a99feb5) SHA1(b373d2a2bd28aad6dd7a15a2166e03a8b7a34d9b) ) /*bit plane 3*/ ROM_LOAD( "port_14.g1", 0x0a000, 0x2000, CRC(224b7a58) SHA1(b84e70d22d1cab41e5773fc9daa2e4e55ec9d96e) ) /*bit plane 3*/ ROM_LOAD( "port_01.a2", 0x10000, 0x2000, CRC(70d27508) SHA1(d011f85b31bb3aa6f386e8e0edb91df10f4c4eb6) ) /*bit plane 1*/ ROM_LOAD( "port_11.b2", 0x12000, 0x2000, CRC(f498e395) SHA1(beb1d12433a350e5b773126de3f2803a9f5620c1) ) /*bit plane 1*/ + ROM_LOAD( "port_03.d2", 0x14000, 0x2000, CRC(03d4153a) SHA1(7ce69ce6a101870dbfca1a9787fb1e660024bc02) ) /*bit plane 2*/ ROM_LOAD( "port_13.e2", 0x16000, 0x2000, CRC(10fa22b8) SHA1(e8f4c24fcdda0ce5e33bc600acd574a232a9bb21) ) /*bit plane 2*/ + ROM_LOAD( "port_05.g2", 0x18000, 0x2000, CRC(43ea7951) SHA1(df0ae7fa802365979514063e1d67cdd45ecada90) ) /*bit plane 3*/ ROM_LOAD( "port_15.h2", 0x1a000, 0x2000, CRC(ab20b438) SHA1(ea5d60f6a9f06397bd0c6ee028b463c684090c01) ) /*bit plane 3*/ ROM_REGION( 0x0800, "user1", 0 ) // sound related? ROM_LOAD( "port_sa.bin", 0x0000, 0x0800, CRC(50510897) SHA1(8af0f42699602a5b33500968c958e3784e03377f) ) - ROM_REGION( 0x840, "proms", 0 ) - /* color prom? */ + ROM_REGION( 0x800, "tileattr", 0 ) // tile attributes ROM_LOAD( "93z511.bin", 0x0000, 0x0800, CRC(d66d9036) SHA1(7a25efbd8f2f94a01aad9e2be9cb18da7b9ec1d1) ) - ROM_LOAD( "port_pr1.bin", 0x0800, 0x0020, CRC(1e2deabb) SHA1(8357e53dba26bca9bc5d7a25c715836f0b3700b9) ) - ROM_LOAD( "port_pr2.n4", 0x0820, 0x0020, CRC(008634f3) SHA1(7cde6b09ede672d562569866d944428198f2ba9c) ) + + ROM_REGION( 0x40, "proms", 0 ) // colors + ROM_LOAD( "port_pr1.bin", 0x00, 0x0020, CRC(1e2deabb) SHA1(8357e53dba26bca9bc5d7a25c715836f0b3700b9) ) + ROM_LOAD( "port_pr2.n4", 0x20, 0x0020, CRC(008634f3) SHA1(7cde6b09ede672d562569866d944428198f2ba9c) ) ROM_END ROM_START( portraita ) @@ -343,15 +350,47 @@ ROM_START( portraita ) ROM_LOAD( "port_05.g2", 0x18000, 0x2000, CRC(43ea7951) SHA1(df0ae7fa802365979514063e1d67cdd45ecada90) ) /*bit plane 3*/ ROM_LOAD( "port_15.h2", 0x1a000, 0x2000, CRC(ab20b438) SHA1(ea5d60f6a9f06397bd0c6ee028b463c684090c01) ) /*bit plane 3*/ - ROM_REGION( 0x0800, "user1", 0 ) // sound related? - ROM_LOAD( "port_sa.bin", 0x0000, 0x0800, CRC(50510897) SHA1(8af0f42699602a5b33500968c958e3784e03377f) ) - - ROM_REGION( 0x840, "proms", 0 ) - /* color prom? */ + ROM_REGION( 0x800, "tileattr", 0 ) // tile attributes (see notes) ROM_LOAD( "93z511.bin", 0x0000, 0x0800, CRC(d66d9036) SHA1(7a25efbd8f2f94a01aad9e2be9cb18da7b9ec1d1) ) - ROM_LOAD( "port_pr1.bin", 0x0800, 0x0020, CRC(1e2deabb) SHA1(8357e53dba26bca9bc5d7a25c715836f0b3700b9) ) - ROM_LOAD( "port_pr2.n4", 0x0820, 0x0020, CRC(008634f3) SHA1(7cde6b09ede672d562569866d944428198f2ba9c) ) + + ROM_REGION( 0x40, "proms", 0 ) // colors + ROM_LOAD( "port_pr1.bin", 0x00, 0x0020, CRC(1e2deabb) SHA1(8357e53dba26bca9bc5d7a25c715836f0b3700b9) ) + ROM_LOAD( "port_pr2.n4", 0x20, 0x0020, CRC(008634f3) SHA1(7cde6b09ede672d562569866d944428198f2ba9c) ) ROM_END +/* tileattr rom + + this appears to be divided into 2 0x400 banks + + 0x000 - 0x3ff relates to tiles 0x000-0x0ff + + 0x400 - 0x7ff relates to tiles 0x100-0x1ff, 0x200-0x2ff, and 0x300-0x3ff + + every 2 tiles are somehow related to 8 bytes in the data + + so tiles 0x00 and 0x01 use bytes 0x000-0x007 + 0x02 0x008 + 0x04 0x010 + 0x06 0x018 + 0x08 0x020 + 0x0a 0x028 + 0x0c 0x030 + 0x0e 0x038 + 0x10 0x040 + ....... + 0xfe and 0xff use bytes 0x3f8-0x3ff + etc. + + it's probably some kind of lookup table for the colours (6bpp = 8 colours, maybe every 2 tiles share the same 8 colours) + I guess either the bank (0/1) can be selected, or bank 0 is hardcoded to tiles 0x000-0x0ff (because tilemaps can use + these tiles too, so it's not a case of it being a sprite/tilemap lookup split) + + anyway.. this is why the portraits logo is broken across 3 areas (0x1f2, 0x2f2, 0x3f2) so that they can share the same + attributes from this rom + + */ + + + GAME( 1983, portrait, 0, portrait, portrait, 0, ROT270, "Olympia", "Portraits (set 1)", GAME_NO_SOUND | GAME_IMPERFECT_GRAPHICS | GAME_WRONG_COLORS ) GAME( 1983, portraita,portrait, portrait, portrait, 0, ROT270, "Olympia", "Portraits (set 2)", GAME_NO_SOUND | GAME_IMPERFECT_GRAPHICS | GAME_WRONG_COLORS ) diff --git a/src/mame/video/portrait.c b/src/mame/video/portrait.c index 1d8290dde11..db32fde1336 100644 --- a/src/mame/video/portrait.c +++ b/src/mame/video/portrait.c @@ -46,6 +46,11 @@ INLINE void get_tile_info( running_machine *machine, tile_data *tileinfo, int ti break; } + if (tilenum<0x100) + color = ((tilenum&0xff)>>1)+0x00; + else + color = ((tilenum&0xff)>>1)+0x80; + SET_TILE_INFO( 0, tilenum, color, flags ); } @@ -64,31 +69,62 @@ VIDEO_START( portrait ) background = tilemap_create( machine, get_bg_tile_info, tilemap_scan_rows, 16, 16, 32, 32 ); foreground = tilemap_create( machine, get_fg_tile_info, tilemap_scan_rows, 16, 16, 32, 32 ); - tilemap_set_transparent_pen( foreground, 0 ); + tilemap_set_transparent_pen( foreground, 7 ); } -#if 0 -/* probably not right */ + + PALETTE_INIT( portrait ) { - int i,bit1,bit2,r,g,b; + int i; + UINT8* lookup = memory_region(machine,"tileattr"); + + /* allocate the colortable */ + machine->colortable = colortable_alloc(machine, 0x40); + +/* + for (i = 0;i < 0x40;i++) + { + int r,g,b,data; + data = color_prom[0]; + + + r = (data >> 0) & 0x7; + g = (data >> 3) & 0x3; + b = (data >> 5) & 0x7; + + colortable_palette_set_color(machine->colortable, i, MAKE_RGB(pal3bit(r), pal2bit(g), pal3bit(b))); + + color_prom++; + } +*/ + + for (i=0;i<0x20;i++) + { + int r,g,b,data; + data = (color_prom[0]<<0) | (color_prom[0x20]<<8); + + r = (data >> 0) & 0x1f; + g = (data >> 5) & 0x1f; + b = (data >> 10) & 0x1f; + + colortable_palette_set_color(machine->colortable, i, MAKE_RGB(pal5bit(r), pal5bit(g), pal5bit(b))); + + // ?? the lookup seems to reference 0x3f colours, unless 1 bit is priority or similar? + colortable_palette_set_color(machine->colortable, i+0x20, MAKE_RGB(pal5bit(r>>1), pal5bit(g>>1), pal5bit(b>>1))); + + color_prom++; + } + + for (i = 0;i < 0x800;i++) { - bit1 = (color_prom[i] >> 1) & 0x01; - bit2 = (color_prom[i] >> 0) & 0x01; - r = 0x47 * bit1 + 0x97 * bit2; - bit1 = (color_prom[i] >> 3) & 0x01; - bit2 = (color_prom[i] >> 2) & 0x01; - g = 0x47 * bit1 + 0x97 * bit2; - bit1 = (color_prom[i] >> 5) & 0x01; - bit2 = (color_prom[i] >> 4) & 0x01; - b = 0x47 * bit1 + 0x97 * bit2; - - palette_set_color(machine,i,MAKE_RGB(r,g,b)); + UINT8 ctabentry = lookup[i]&0x3f; + colortable_entry_set_value(machine->colortable, i, ctabentry); } } -#endif + static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) { @@ -106,7 +142,9 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta * -----x-- msb source[1] */ int tilenum = source[3]; - int color = 0; + + int color = ((tilenum&0xff)>>1)+0x00; + int fy = attr & 0x20; if(attr & 0x04) sx |= 0x100; @@ -140,7 +178,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta drawgfx_transpen(bitmap,cliprect,machine->gfx[0], tilenum,color, 0,fy, - sx,sy,0); + sx,sy,7); source += 0x10; } |