/* T.S. 17.12.2005: Yamato: ------- Added temporary bg gradient (bad colors/offset). Gradient table are stored in two(?) ROMs. Each table is 256 bytes long: 128 for normal and 128 bytes for flipped screen. Color format is unknown - probably direct RGB mapping of 8 or 16 (both roms) bits. Also table selection source is unknown. TODO: - bg gradient color decode & table selection Top Roller: ---------- It's made by the same developers as Yamato and use probably the same encrypted SEGA cpu as Yamato. lives - $6155 TODO: - COINB DSW is missing - few issues in cocktail mode - wrong colors (fg text layer) - game sometimes ("round" text , lives) updates only even columns of cell attribs... ------------------------------------------------------------------- Top Roller Jaleco Hardware : Original Jaleco board no 8307-B/8307-A(redump) Main CPU : Encrypted Z80 (probably 315-5018) Sound : AY-3-8910 ROMS CRC32 + positions : [9894374d] d5 [ef789f00] f5 [d45494ba] h5 [1cb48ea0] k5 [84139f46] l5 [e30c1dd8] m5 [904fffb6] d3 [94371cfb] f3 [8a8032a7] h3 [1e8914a6] k3 [b20a9fa2] l3 [7f989dc9] p3 [89327329] a4 bottom board 89327329 [7a945733] c4 bottom board [5f2c2a78] h4 bottom board bad dump / [1d9e3325] (8307-A) [ce3afe26] j4 bottom board */ #include "driver.h" #include "machine/segacrpt.h" #include "sound/ay8910.h" #include "includes/cclimber.h" PALETTE_INIT( yamato ) { int i; #define TOTAL_COLORS(gfxn) (machine->gfx[gfxn]->total_colors * machine->gfx[gfxn]->color_granularity) #define COLOR(gfxn,offs) (colortable[machine->drv->gfxdecodeinfo[gfxn].color_codes_start + (offs)]) /* chars - 12 bits RGB */ for (i = 0;i < 64;i++) { int bit0,bit1,bit2,bit3,r,g,b; /* red component */ bit0 = (color_prom[0] >> 0) & 0x01; bit1 = (color_prom[0] >> 1) & 0x01; bit2 = (color_prom[0] >> 2) & 0x01; bit3 = (color_prom[0] >> 3) & 0x01; r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; /* green component */ bit0 = (color_prom[0] >> 4) & 0x01; bit1 = (color_prom[0] >> 5) & 0x01; bit2 = (color_prom[0] >> 6) & 0x01; bit3 = (color_prom[0] >> 7) & 0x01; g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; /* blue component */ bit0 = (color_prom[64] >> 0) & 0x01; bit1 = (color_prom[64] >> 1) & 0x01; bit2 = (color_prom[64] >> 2) & 0x01; bit3 = (color_prom[64] >> 3) & 0x01; b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; palette_set_color(machine,i,MAKE_RGB(r,g,b)); color_prom++; } color_prom += 64; /* big sprite - 8 bits RGB */ for (i = 0;i < 32;i++) { int bit0,bit1,bit2,r,g,b; /* 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+64,MAKE_RGB(r,g,b)); color_prom++; } /* character and sprite lookup table */ /* they use colors 0-63 */ for (i = 0;i < TOTAL_COLORS(0);i++) { /* pen 0 always uses color 0 (background in River Patrol and Silver Land) */ if (i % 4 == 0) COLOR(0,i) = 0; else COLOR(0,i) = i; } /* big sprite lookup table */ /* it uses colors 64-95 */ for (i = 0;i < TOTAL_COLORS(2);i++) { if (i % 4 == 0) COLOR(2,i) = 0; else COLOR(2,i) = i + 64; } /* fake colors for bg gradient */ for (i = 0;i < 256;i++) { palette_set_color(machine,i+16*4+8*4,MAKE_RGB(0,0,i)); } } PALETTE_INIT( toprollr ) { int i; for (i = 0;i < 32*5;i++) { int bit0,bit1,bit2,r,g,b; /* red component */ bit0 = (color_prom[0] >> 0) & 0x01; bit1 = (color_prom[0] >> 1) & 0x01; bit2 = (color_prom[0] >> 2) & 0x01; r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; /* green component */ bit0 = (color_prom[0] >> 3) & 0x01; bit1 = (color_prom[0] >> 4) & 0x01; bit2 = (color_prom[0] >> 5) & 0x01; g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; /* blue component */ bit0 = 0; bit1 = (color_prom[0] >> 6) & 0x01; bit2 = (color_prom[0] >> 7) & 0x01; b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; palette_set_color(machine,i,MAKE_RGB(r,g,b)); color_prom++; } } static int p0,p1; static WRITE8_HANDLER( p0_w ) { p0 = data; } static WRITE8_HANDLER( p1_w ) { p1 = data; } static READ8_HANDLER( p0_r ) { return p0; } static READ8_HANDLER( p1_r ) { return p1; } static WRITE8_HANDLER( flip_screen_x_w ) { flip_screen_x_set(data); } static WRITE8_HANDLER( flip_screen_y_w ) { flip_screen_y_set(data); } static ADDRESS_MAP_START( yamato_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x5fff) AM_READ(MRA8_ROM) AM_RANGE(0x6000, 0x6fff) AM_READ(MRA8_RAM) AM_RANGE(0x7000, 0x7fff) AM_READ(MRA8_ROM) AM_RANGE(0x8800, 0x8bff) AM_READ(MRA8_RAM) AM_RANGE(0x9000, 0x93ff) AM_READ(MRA8_RAM) /* video RAM */ AM_RANGE(0x9800, 0x9bff) AM_READ(MRA8_RAM) /* column scroll registers */ AM_RANGE(0x9c00, 0x9fff) AM_READ(MRA8_RAM) /* color RAM */ AM_RANGE(0xa000, 0xa000) AM_READ(input_port_0_r) /* IN0 */ AM_RANGE(0xa800, 0xa800) AM_READ(input_port_1_r) /* IN1 */ AM_RANGE(0xb000, 0xb000) AM_READ(input_port_2_r) /* DSW */ AM_RANGE(0xb800, 0xb800) AM_READ(input_port_3_r) /* IN2 */ AM_RANGE(0xba00, 0xba00) AM_READ(input_port_4_r) /* IN3 (maybe a mirror of b800) */ ADDRESS_MAP_END static ADDRESS_MAP_START( yamato_writemem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x5fff) AM_WRITE(MWA8_ROM) AM_RANGE(0x6000, 0x6fff) AM_WRITE(MWA8_RAM) AM_RANGE(0x7000, 0x7fff) AM_WRITE(MWA8_ROM) AM_RANGE(0x8800, 0x88ff) AM_WRITE(cclimber_bigsprite_videoram_w) AM_BASE(&cclimber_bsvideoram) AM_SIZE(&cclimber_bsvideoram_size) AM_RANGE(0x8900, 0x8bff) AM_WRITE(MWA8_RAM) /* not used, but initialized */ AM_RANGE(0x9000, 0x93ff) AM_WRITE(videoram_w) AM_BASE(&videoram) AM_SIZE(&videoram_size) //AM_RANGE(0x9400, 0x97ff) AM_WRITE(videoram_w) /* mirror address, used by Crazy Climber to draw windows */ /* 9800-9bff and 9c00-9fff share the same RAM, interleaved */ /* (9800-981f for scroll, 9c20-9c3f for color RAM, and so on) */ AM_RANGE(0x9800, 0x981f) AM_WRITE(MWA8_RAM) AM_BASE(&cclimber_column_scroll) AM_RANGE(0x9880, 0x989f) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size) AM_RANGE(0x98dc, 0x98df) AM_WRITE(MWA8_RAM) AM_BASE(&cclimber_bigspriteram) AM_RANGE(0x9800, 0x9bff) AM_WRITE(MWA8_RAM) /* not used, but initialized */ AM_RANGE(0x9c00, 0x9fff) AM_WRITE(cclimber_colorram_w) AM_BASE(&colorram) AM_RANGE(0xa000, 0xa000) AM_WRITE(interrupt_enable_w) AM_RANGE(0xa001, 0xa001) AM_WRITE(flip_screen_x_w) AM_RANGE(0xa002, 0xa002) AM_WRITE(flip_screen_y_w) //AM_RANGE(0xa004, 0xa004) AM_WRITE(cclimber_sample_trigger_w) //AM_RANGE(0xa800, 0xa800) AM_WRITE(cclimber_sample_rate_w) //AM_RANGE(0xb000, 0xb000) AM_WRITE(cclimber_sample_volume_w) ADDRESS_MAP_END static ADDRESS_MAP_START( yamato_writeport, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_FLAGS( AMEF_ABITS(8) ) AM_RANGE(0x00, 0x00) AM_WRITE(p0_w) /* ??? */ AM_RANGE(0x01, 0x01) AM_WRITE(p1_w) /* ??? */ ADDRESS_MAP_END static ADDRESS_MAP_START( yamato_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x07ff) AM_READ(MRA8_ROM) AM_RANGE(0x5000, 0x53ff) AM_READ(MRA8_RAM) ADDRESS_MAP_END static ADDRESS_MAP_START( yamato_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x07ff) AM_WRITE(MWA8_ROM) AM_RANGE(0x5000, 0x53ff) AM_WRITE(MWA8_RAM) ADDRESS_MAP_END static ADDRESS_MAP_START( yamato_sound_readport, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_FLAGS( AMEF_ABITS(8) ) AM_RANGE(0x04, 0x04) AM_READ(p0_r) /* ??? */ AM_RANGE(0x08, 0x08) AM_READ(p1_r) /* ??? */ ADDRESS_MAP_END static ADDRESS_MAP_START( yamato_sound_writeport, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_FLAGS( AMEF_ABITS(8) ) AM_RANGE(0x00, 0x00) AM_WRITE(AY8910_control_port_0_w) AM_RANGE(0x01, 0x01) AM_WRITE(AY8910_write_port_0_w) AM_RANGE(0x02, 0x02) AM_WRITE(AY8910_control_port_1_w) AM_RANGE(0x03, 0x03) AM_WRITE(AY8910_write_port_1_w) ADDRESS_MAP_END /* Top Roller */ static int jaleco_rombank=0; static WRITE8_HANDLER(rombank_w) { jaleco_rombank&=~(1<