- use 4 bit clut instead of 3 bit

- calculate palette with resnet info from Popper (same year, same company, very similar hardware)
- make bgcolor emulation more logical
- small cleanups
This commit is contained in:
Michaël Banaan Ananas 2011-03-08 19:51:27 +00:00
parent 32fab82a0f
commit 3d5ae65fd7
3 changed files with 97 additions and 90 deletions

View File

@ -1,7 +1,7 @@
/***************************************************************************
Car Jamboree
Omori Electric CAD (OEC) 1981
Omori Electric CAD (OEC) 1983
c14 c.d19
c13 c.d18 c10
@ -33,7 +33,7 @@ Notes:
just before exploding, animals displaying as the wrong sprite for one
frame when entering the arena
- colours are wrong, sprites and characters only using one of the proms
- colours look wrong, maybe address bitswap?
- background colour calculation is a guess
@ -53,27 +53,22 @@ Notes:
static ADDRESS_MAP_START( carjmbre_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0x87ff) AM_RAM
AM_RANGE(0x8800, 0x8800) AM_READNOP //?? possibly watchdog
// AM_RANGE(0x8800, 0x8800) AM_READNOP // watchdog?
AM_RANGE(0x8803, 0x8803) AM_WRITE(interrupt_enable_w)
AM_RANGE(0x8805, 0x8806) AM_WRITE(carjmbre_bgcolor_w) //guess
AM_RANGE(0x8805, 0x8805) AM_WRITE(carjmbre_bgcolor_w) // guessed
AM_RANGE(0x8806, 0x8806) AM_WRITE(carjmbre_8806_w) // video related?
AM_RANGE(0x8807, 0x8807) AM_WRITE(carjmbre_flipscreen_w)
AM_RANGE(0x8fc1, 0x8fc1) AM_WRITENOP //overrun during initial screen clear
AM_RANGE(0x8fe1, 0x8fe1) AM_WRITENOP //overrun during initial screen clear
// AM_RANGE(0x8fc1, 0x8fc1) AM_WRITENOP // overrun during initial screen clear
// AM_RANGE(0x8fe1, 0x8fe1) AM_WRITENOP // overrun during initial screen clear
AM_RANGE(0x9000, 0x97ff) AM_RAM_WRITE(carjmbre_videoram_w) AM_BASE_MEMBER(carjmbre_state, videoram)
AM_RANGE(0x9800, 0x985f) AM_WRITEONLY AM_BASE_SIZE_MEMBER(carjmbre_state, spriteram, spriteram_size)
AM_RANGE(0x9880, 0x98df) AM_WRITEONLY //spriteram mirror
AM_RANGE(0x9800, 0x985f) AM_MIRROR(0x80) AM_WRITEONLY AM_BASE_SIZE_MEMBER(carjmbre_state, spriteram, spriteram_size)
AM_RANGE(0xa000, 0xa000) AM_READ_PORT("P1")
AM_RANGE(0xa800, 0xa800) AM_READ_PORT("P2")
AM_RANGE(0xb800, 0xb800) AM_READ_PORT("DSW") AM_WRITE(soundlatch_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( carjmbre_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x0fff) AM_ROM
AM_RANGE(0x1000, 0x10ff) AM_READNOP //look to be stray reads from 10/12/14/16/18xx
AM_RANGE(0x1200, 0x12ff) AM_READNOP
AM_RANGE(0x1400, 0x14ff) AM_READNOP
AM_RANGE(0x1600, 0x16ff) AM_READNOP
AM_RANGE(0x1800, 0x18ff) AM_READNOP
AM_RANGE(0x0000, 0x0fff) AM_MIRROR(0x1000) AM_ROM
AM_RANGE(0x2000, 0x27ff) AM_RAM
ADDRESS_MAP_END
@ -129,7 +124,7 @@ static INPUT_PORTS_START( carjmbre )
PORT_DIPSETTING( 0x00, "3" )
PORT_DIPSETTING( 0x08, "4" )
PORT_DIPSETTING( 0x10, "5" )
PORT_DIPSETTING( 0x18, "250 (Cheat)")
PORT_DIPSETTING( 0x18, "Free") // 250 (cheat)
PORT_DIPNAME( 0x20, 0x00, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW1:6")
PORT_DIPSETTING( 0x00, "10k, then every 100k" )
PORT_DIPSETTING( 0x20, "20k, then every 100k" )

View File

@ -27,6 +27,7 @@ public:
WRITE8_HANDLER( carjmbre_flipscreen_w );
WRITE8_HANDLER( carjmbre_bgcolor_w );
WRITE8_HANDLER( carjmbre_8806_w );
WRITE8_HANDLER( carjmbre_videoram_w );
PALETTE_INIT( carjmbre );

View File

@ -1,77 +1,78 @@
/***************************************************************************
Car Jamboree
Omori Electric CAD (OEC) 1981
Omori Electric CAD (OEC) 1983
***************************************************************************/
#include "emu.h"
#include "video/resnet.h"
#include "includes/carjmbre.h"
// palette info from Popper (OEC 1983, very similar video hw)
static const res_net_decode_info carjmbre_decode_info =
{
1, // there may be two proms needed to construct color
0, 63, // start/end
// R, G, B,
{ 0, 0, 0, }, // offsets
{ 0, 3, 6, }, // shifts
{0x07,0x07,0x03, } // masks
};
static const res_net_info carjmbre_net_info =
{
RES_NET_VCC_5V | RES_NET_VBIAS_5V | RES_NET_VIN_TTL_OUT,
{
{ RES_NET_AMP_NONE, 0, 0, 3, { 1000, 470, 220 } },
{ RES_NET_AMP_NONE, 0, 0, 3, { 1000, 470, 220 } },
{ RES_NET_AMP_NONE, 0, 0, 2, { 470, 220, 0 } }
}
};
PALETTE_INIT( carjmbre )
{
int i, bit0, bit1, bit2, r, g, b;
rgb_t *rgb;
rgb = compute_res_net_all(machine, color_prom, &carjmbre_decode_info, &carjmbre_net_info);
palette_set_colors(machine, 0, rgb, 64);
palette_normalize_range(machine->palette, 0, 63, 0, 255);
auto_free(machine, rgb);
}
for (i = 0; i < machine->total_colors(); i++)
{
/* red component */
bit0 = (*color_prom >> 0) & 0x01;
bit1 = (*color_prom >> 1) & 0x01;
bit2 = (*color_prom >> 2) & 0x01;
r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
/* green component */
bit0 = (*color_prom >> 3) & 0x01;
bit1 = (*color_prom >> 4) & 0x01;
bit2 = (*color_prom >> 5) & 0x01;
g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
/* blue component */
bit0 = 0;
bit1 = (*color_prom >> 6) & 0x01;
bit2 = (*color_prom >> 7) & 0x01;
b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette_set_color(machine, i, MAKE_RGB(r,g,b));
color_prom++;
}
}
WRITE8_HANDLER( carjmbre_flipscreen_w )
{
carjmbre_state *state = space->machine->driver_data<carjmbre_state>();
state->flipscreen = data ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0;
state->flipscreen = (data & 1) ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0;
tilemap_set_flip_all(space->machine, state->flipscreen);
}
WRITE8_HANDLER( carjmbre_bgcolor_w )
{
carjmbre_state *state = space->machine->driver_data<carjmbre_state>();
int oldbg, i;
data = ~data & 0x3f;
oldbg = state->bgcolor;
state->bgcolor &= 0xff00 >> (offset * 8);
state->bgcolor |= ((~data) & 0xff) << (offset * 8);
if ( oldbg != state->bgcolor)
if (data != state->bgcolor)
{
int i;
state->bgcolor = data;
if (data & 3)
for (i = 0; i < 64; i += 4)
palette_set_color_rgb(space->machine, i, (state->bgcolor & 0xff) * 0x50,
(state->bgcolor & 0xff) * 0x50, (state->bgcolor & 0xff)!=0 ? 0x50 : 0);
palette_set_color(space->machine, i, palette_get_color(space->machine, data));
else
// restore to initial state (black)
for (i = 0; i < 64; i += 4)
palette_set_color(space->machine, i, RGB_BLACK);
}
}
static TILE_GET_INFO( get_carjmbre_tile_info )
WRITE8_HANDLER( carjmbre_8806_w )
{
carjmbre_state *state = machine->driver_data<carjmbre_state>();
UINT32 tile_number = state->videoram[tile_index] & 0xff;
UINT8 attr = state->videoram[tile_index + 0x400];
tile_number += (attr & 0x80) << 1; /* bank */
SET_TILE_INFO(
0,
tile_number,
(attr & 0x7),
0);
// unknown, gets updated at same time as carjmbre_bgcolor_w
}
WRITE8_HANDLER( carjmbre_videoram_w )
@ -84,6 +85,20 @@ WRITE8_HANDLER( carjmbre_videoram_w )
static TILE_GET_INFO( get_carjmbre_tile_info )
{
carjmbre_state *state = machine->driver_data<carjmbre_state>();
UINT32 tile_number = state->videoram[tile_index] & 0xff;
UINT8 attr = state->videoram[tile_index + 0x400];
tile_number += (attr & 0x80) << 1; /* bank */
SET_TILE_INFO(
0,
tile_number,
attr & 0xf,
0);
}
VIDEO_START( carjmbre )
{
carjmbre_state *state = machine->driver_data<carjmbre_state>();
@ -102,8 +117,7 @@ SCREEN_UPDATE( carjmbre )
//76543210
//x------- graphic bank
//-xxx---- unused
//----x--- ?? probably colour, only used for ramp and pond
//-----xxx colour
//----xxxx colour
tilemap_draw(bitmap, cliprect, state->cj_tilemap, 0, 0);
@ -115,8 +129,7 @@ SCREEN_UPDATE( carjmbre )
//x------- flipy
//-x------ flipx
//--xx---- unused
//----x--- ?? probably colour
//-----xxx colour
//----xxxx colour
//+3 x pos
for (offs = state->spriteram_size - 4; offs >= 0; offs -= 4)
{
@ -126,7 +139,6 @@ SCREEN_UPDATE( carjmbre )
//unused sprites are marked with ypos <= 0x02 (or >= 0xfd if screen flipped)
if (state->spriteram[troffs] > 0x02 && state->spriteram[troffs] < 0xfd)
{
{
sx = state->spriteram[troffs + 3] - 7;
sy = 241 - state->spriteram[troffs];
@ -143,11 +155,10 @@ SCREEN_UPDATE( carjmbre )
drawgfx_transpen(bitmap, cliprect, screen->machine->gfx[1],
state->spriteram[troffs + 1],
state->spriteram[troffs + 2] & 0x07,
state->spriteram[troffs + 2] & 0xf,
flipx,flipy,
sx,sy,0);
}
}
}
return 0;
}