diff options
| author | 2026-05-16 22:50:40 +0200 | |
|---|---|---|
| committer | 2026-05-17 12:24:12 +0200 | |
| commit | 1941a8d1209634ceea9d3955b0c709167f3fe993 (patch) | |
| tree | d94f3e318c3a0634d076a287719450801730ab52 | |
| parent | 7e8390f23d965222e850a909785bca8e8d26c6b1 (diff) | |
taito/marinedt.cpp: cleanups
| -rw-r--r-- | src/mame/ces/cesclass.cpp | 7 | ||||
| -rw-r--r-- | src/mame/gaelco/gaelco3d.cpp | 8 | ||||
| -rw-r--r-- | src/mame/taito/marinedt.cpp | 245 |
3 files changed, 136 insertions, 124 deletions
diff --git a/src/mame/ces/cesclass.cpp b/src/mame/ces/cesclass.cpp index 12b8760904d..0b7033445a2 100644 --- a/src/mame/ces/cesclass.cpp +++ b/src/mame/ces/cesclass.cpp @@ -19,7 +19,12 @@ TODO: - tsclass: runs on a single LCD, needs mods - tsclass: throws bad U43 and U44 at POST, should also be two roms not one. - tsclass: understand how it draws score and trophy segments -\- cfr. artwork, doesn't seem from lamps? +\- cfr. artwork, doesn't seem from lamps but more like an FPGA extra transfer "in 1bpp" for + 3 digits (2x score, 1x "trophy"): + - $40ce88-$40ceb8 player 1 side + - $40ceba player 1 lamps + - $40cebe-$40cec2 control words? + - $40cec4 player 2 side, same as above **************************************************************************************************/ diff --git a/src/mame/gaelco/gaelco3d.cpp b/src/mame/gaelco/gaelco3d.cpp index cbc6a5ea5ae..f5795ea8e42 100644 --- a/src/mame/gaelco/gaelco3d.cpp +++ b/src/mame/gaelco/gaelco3d.cpp @@ -968,10 +968,10 @@ void gaelco3d_state::gaelco3d(machine_config &config) // Sound hardware SPEAKER(config, "mono").front_center(); - DMADAC(config, m_dmadac[0]).add_route(ALL_OUTPUTS, "mono", 0.45); // speedup: front mono - DMADAC(config, m_dmadac[1]).add_route(ALL_OUTPUTS, "mono", 0.45); // speedup: left rear - DMADAC(config, m_dmadac[2]).add_route(ALL_OUTPUTS, "mono", 0.45); // speedup: right rear - DMADAC(config, m_dmadac[3]).add_route(ALL_OUTPUTS, "mono", 0.45); // speedup: seat speaker + DMADAC(config, m_dmadac[0]).add_route(ALL_OUTPUTS, "mono", 0.45); + DMADAC(config, m_dmadac[1]).add_route(ALL_OUTPUTS, "mono", 0.45); + DMADAC(config, m_dmadac[2]).add_route(ALL_OUTPUTS, "mono", 0.45); + DMADAC(config, m_dmadac[3]).add_route(ALL_OUTPUTS, "mono", 0.45); } void gaelco3d_state::speedup(machine_config &config) diff --git a/src/mame/taito/marinedt.cpp b/src/mame/taito/marinedt.cpp index 258e37bbed3..5577d6e9916 100644 --- a/src/mame/taito/marinedt.cpp +++ b/src/mame/taito/marinedt.cpp @@ -2,20 +2,23 @@ // copyright-holders:Angelo Salese /***************************************************************************************************************** - Marine Date (c) 1981 Taito - - driver by Angelo Salese, - original "wiped off due of not anymore licenseable" driver by insideoutboy. - - TODO: - - discrete sound - - imperfect colors: unused bit 2 of color prom, guessworked sea gradient, mg16 entirely unused. - also unused colors 0x10-0x1f (might be a flashing bank) - - collision detection isn't perfect, sometimes octopus gets stuck and dies even if moves are still available. - HW collision detection isn't perfect even from the reference, presumably needs a trojan run on the real HW. - - ROM writes (irq mask?) - - Merge devices with crbaloon/bking/grchamp drivers (PC3259). - - Currently defaults to cocktail instead of upright. When upright chosen, screen is upside down. (MT 07311) +Marine Date (c) 1981 Taito + +driver by Angelo Salese, +original "wiped off due of not anymore licenseable" driver by insideoutboy. + +TODO: +- discrete sound +- imperfect colors: unused bit 2 of color prom, guessworked sea gradient, mg16 entirely unused. + also unused colors 0x10-0x1f (might be a flashing bank) +- collision detection isn't perfect, sometimes octopus gets stuck and dies even if moves are + still available. + HW collision detection isn't perfect even from the reference, presumably needs a trojan run on + the real HW. +- ROM writes (irq mask?) +- Merge PC3259 device with crbaloon/bking/grchamp drivers. +- Currently defaults to cocktail instead of upright. When upright chosen, screen is upside down. + (MT 07311) ***************************************************************************************************************** @@ -138,12 +141,11 @@ protected: private: // screen updates uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void marinedt_palette(palette_device &palette) const; + void palette_init(palette_device &palette) const; uint8_t trackball_r(); uint8_t pc3259_r(offs_t offset); void vram_w(offs_t offset, uint8_t data); - void obj_0_w(offs_t offset, uint8_t data); - void obj_1_w(offs_t offset, uint8_t data); + template <unsigned N> void obj_w(offs_t offset, uint8_t data); void bgm_w(uint8_t data); void sfx_w(uint8_t data); void layer_enable_w(uint8_t data); @@ -160,6 +162,8 @@ private: required_device<gfxdecode_device> m_gfxdecode; required_ioport_array<4> m_in_track; + uint8_t m_in_select = 0; + tilemap_t *m_tilemap = nullptr; std::unique_ptr<bitmap_ind16> m_seabitmap[2]; struct @@ -171,21 +175,50 @@ private: }m_obj[2]; uint8_t m_layer_en = 0; - uint8_t m_in_select = 0; bool m_screen_flip = false; uint8_t m_sea_bank = 0; void init_seabitmap(); - void obj_reg_w(uint8_t which,uint8_t reg, uint8_t data); uint32_t obj_to_obj_collision(); uint32_t obj_to_layer_collision(); }; -TILE_GET_INFO_MEMBER(marinedt_state::get_tile_info) +void marinedt_state::palette_init(palette_device &palette) const { - int code = m_vram[tile_index]; + uint8_t const *const color_prom = memregion("proms")->base(); + for (int i = 0; i < 64; i++) + { + int bit0, bit1, bit2; - tileinfo.set(0, code, 0, 0); + // red component + bit0 = BIT(color_prom[i], 0); + bit1 = BIT(color_prom[i], 1); + //bit2 = BIT(color_prom[i], 2); + int const r = (0x55 * bit0) + (0xaa * bit1); + + // green component + bit0 = BIT(color_prom[i], 3); + bit1 = BIT(color_prom[i], 4); + int const g = (0x55 * bit0) + (0xaa * bit1); + + // blue component + bit0 = BIT(color_prom[i], 5); + bit1 = BIT(color_prom[i], 6); + bit2 = BIT(color_prom[i], 7); + int b = (0x55 * bit0) + (0xaa * bit1); + // matches yellow haired siren + if (bit2 == 0) + b /= 2; + + palette.set_pen_color(i, rgb_t(r, g, b)); + } + + for (int i = 0; i < 32; i++) + { + int const b = color_prom[i + 0x60]; + palette.set_pen_color(64 + 31 - i, rgb_t(0, 0, b)); + palette.set_pen_color(64 + 63 - i, rgb_t(0xff, 0, b)); + } } // initialize sea bitmap gradient @@ -196,7 +229,7 @@ void marinedt_state::init_seabitmap() m_seabitmap[1] = std::make_unique<bitmap_ind16>(512, 512); m_seabitmap[0]->fill(64, clip); - m_seabitmap[1]->fill(64+32, clip); + m_seabitmap[1]->fill(64 + 32, clip); for (int y = clip.min_y; y <= clip.max_y; y++) { @@ -209,11 +242,18 @@ void marinedt_state::init_seabitmap() blue_pen = 0x5f; m_seabitmap[0]->pix(y, x) = blue_pen; - m_seabitmap[1]->pix(y, x) = blue_pen+0x20; + m_seabitmap[1]->pix(y, x) = blue_pen + 0x20; } } } +TILE_GET_INFO_MEMBER(marinedt_state::get_tile_info) +{ + int code = m_vram[tile_index]; + + tileinfo.set(0, code, 0, 0); +} + void marinedt_state::video_start() { m_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(marinedt_state::get_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); @@ -239,6 +279,7 @@ void marinedt_state::video_start() save_item(NAME(m_obj[1].bitmap)); save_item(NAME(m_layer_en)); save_item(NAME(m_sea_bank)); + save_item(NAME(m_screen_flip)); } uint32_t marinedt_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ) @@ -246,7 +287,7 @@ uint32_t marinedt_state::screen_update( screen_device &screen, bitmap_ind16 &bit if(m_layer_en & 8) copybitmap(bitmap, *m_seabitmap[m_sea_bank], m_screen_flip == false, m_screen_flip == false, m_screen_flip ? 0 : -256, m_screen_flip ? 0 : -224, cliprect); else - bitmap.fill(0,cliprect); + bitmap.fill(0, cliprect); m_tilemap->draw(screen, bitmap, cliprect, 0, 0); @@ -264,13 +305,14 @@ void marinedt_state::vram_w(offs_t offset, uint8_t data) m_tilemap->mark_tile_dirty(offset); } -inline void marinedt_state::obj_reg_w(uint8_t which, uint8_t reg,uint8_t data) +template <unsigned N> void marinedt_state::obj_w(offs_t offset, uint8_t data) { rectangle visarea = m_screen->visible_area(); + const u8 which = N; //const uint8_t base_pen;// = which == 0 ? 0x30 : 0x20; - gfx_element *gfx = m_gfxdecode->gfx(which+1); + gfx_element *gfx = m_gfxdecode->gfx(which + 1); - switch(reg) + switch(offset) { case 0: m_obj[which].offs = data; break; // TODO: are offsets good? @@ -280,19 +322,20 @@ inline void marinedt_state::obj_reg_w(uint8_t which, uint8_t reg,uint8_t data) const uint8_t tilenum = ((m_obj[which].offs & 4) << 1) | ( (m_obj[which].offs & 0x38) >> 3); const uint8_t color = (m_obj[which].offs & 3); - const bool fx = BIT(m_obj[which].offs,6); - const bool fy = BIT(m_obj[which].offs,7); + const bool fx = BIT(m_obj[which].offs, 6); + const bool fy = BIT(m_obj[which].offs, 7); - //base_pen = (which == 0 ? 0x30 : 0x20) + color*4; - m_obj[which].bitmap.fill(0,visarea); + //base_pen = (which == 0 ? 0x30 : 0x20) + color * 4; + m_obj[which].bitmap.fill(0, visarea); // redraw sprite in framebuffer using above - // bitmap,cliprect,tilenum,color,flipx,flipy,xpos,ypos,transpen - gfx->transpen(m_obj[which].bitmap,visarea,tilenum,color,fx,!fy,m_obj[which].x,m_obj[which].y,0); + gfx->transpen(m_obj[which].bitmap, + visarea, + tilenum, + color, + fx, !fy, + m_obj[which].x, m_obj[which].y, 0); } -void marinedt_state::obj_0_w(offs_t offset, uint8_t data) { obj_reg_w(0,offset,data); } -void marinedt_state::obj_1_w(offs_t offset, uint8_t data) { obj_reg_w(1,offset,data); } - uint8_t marinedt_state::trackball_r() { return (m_in_track[m_in_select & 3])->read(); @@ -307,7 +350,7 @@ void marinedt_state::bgm_w(uint8_t data) void marinedt_state::sfx_w(uint8_t data) { /* - x--- ---- unknown, probably ties to PC3259 pin 16 like crbaloon + x--- ---- unknown, probably ties to PC3259 pin 16 like crbaloon (D7 of SOUND port buffer) --x- ---- jet sound SFX ---x ---- foam SFX ---- x--- ink SFX @@ -319,31 +362,31 @@ void marinedt_state::sfx_w(uint8_t data) // popmessage("%02x",data); } +/* + * ---x ---- enabled when shark appears (enables red gradient on sea bitmap apparently) + * ---- x--- sea layer draw enable (disabled in test mode) + * ---- -x-- <unknown>, used in gameplay + * ---- --x- obj 2 draw enable + * ---- ---x obj 1 draw enable + */ void marinedt_state::layer_enable_w(uint8_t data) { - /* - ---x ---- enabled when shark appears (enables red gradient on sea bitmap apparently) - ---- x--- sea layer draw enable (disabled in test mode) - ---- --x- obj 2 draw enable - ---- ---x obj 1 draw enable - */ m_layer_en = data & 0xf; - m_sea_bank = (data & 0x10) >> 4; + m_sea_bank = BIT(data, 4); } +/* + * ---- x--- trackball input select (x/y) + * ---- -x-- trackball player select + * ---- --x- flipscreen + * ---- ---x global coin lockout (disabled in service mode) + */ void marinedt_state::output_w(uint8_t data) { - /* - ---- x--- trackball input select (x/y) - ---- -x-- trackball player select - ---- --x- flipscreen - ---- ---x global coin lockout (disabled in service mode) - */ - m_in_select = (data & 0xc) >> 2; - m_screen_flip = BIT(data,1); + m_screen_flip = BIT(data, 1); flip_screen_set(!m_screen_flip); - machine().bookkeeping().coin_lockout_global_w(!(data & 1)); + machine().bookkeeping().coin_lockout_global_w(!(BIT(data, 0))); } // collision detection @@ -354,20 +397,21 @@ inline uint32_t marinedt_state::obj_to_obj_collision() if((m_layer_en & 3) != 3) return 0; - for(int y=0;y<32;y++) + for(int y = 0; y < 32; y++) { - for(int x=0;x<32;x++) + for(int x = 0; x < 32; x++) { - int resx,resy; + int resx, resy; resx = m_obj[0].x + x; resy = m_obj[0].y + y; - if((m_obj[0].bitmap.pix(resy,resx) & 3) == 0) + if((m_obj[0].bitmap.pix(resy, resx) & 3) == 0) continue; // return value is never read most likely - if(m_obj[1].bitmap.pix(resy,resx) != 0) + // i.e. may really just be reg 3 bit 7 in PC3259 + if(m_obj[1].bitmap.pix(resy, resx) != 0) return ((resy / 8) * 32) | (((resx / 8) - 1) & 0x1f); } } @@ -381,23 +425,24 @@ inline uint32_t marinedt_state::obj_to_layer_collision() if((m_layer_en & 1) == 0) return 0; - for(int y=0;y<32;y++) + for(int y = 0; y < 32; y++) { - for(int x=0;x<32;x++) + for(int x = 0; x < 32; x++) { - uint16_t resx,resy; + uint16_t resx, resy; resx = m_obj[0].x + x; resy = m_obj[0].y + y; - if((m_obj[0].bitmap.pix(resy,resx) & 3) == 0) + if((m_obj[0].bitmap.pix(resy, resx) & 3) == 0) continue; + // shift in gameplay area (cfr. tilemap viewer 0s) if(!m_screen_flip) resy -= 32; // TODO: non screen flip path doesn't work properly - if(m_tilemap->pixmap().pix(resy,resx) != 0) + if(m_tilemap->pixmap().pix(resy, resx) != 0) { if(m_screen_flip) return ((resy / 8) * 32) | (((resx / 8) - 1) & 0x1f); @@ -412,31 +457,30 @@ inline uint32_t marinedt_state::obj_to_layer_collision() uint8_t marinedt_state::pc3259_r(offs_t offset) { - uint32_t rest,reso; + const uint32_t rest = obj_to_layer_collision(); + const uint32_t reso = obj_to_obj_collision(); uint8_t reg = offset >> 2; - uint8_t xt,xo; - rest = obj_to_layer_collision(); - reso = obj_to_obj_collision(); + uint8_t xt, xo; switch(reg) { case 0: xt = rest & 0xf; xo = reso & 0xf; - return xt|(xo<<4); + return xt | (xo << 4); case 1: xt = (rest & 0xf0) >> 4; xo = (reso & 0xf0) >> 4; - return xt|(xo<<4); + return xt | (xo << 4); case 2: xt = (rest & 0x300) >> 8; xo = (reso & 0x300) >> 8; - return xt|(xo<<4); + return xt | (xo << 4); case 3: { uint8_t res = 0; - res |= ((reso != 0)<<7); - res |= ((rest != 0)<<3); + res |= (reso != 0) << 7; + res |= (rest != 0) << 3; return res; } } @@ -459,14 +503,14 @@ void marinedt_state::marinedt_io(address_map &map) map(0x00, 0x00).portr("DSW1"); map(0x01, 0x01).r(FUNC(marinedt_state::trackball_r)); map(0x02, 0x02).select(0xc).r(FUNC(marinedt_state::pc3259_r)); - map(0x02, 0x04).w(FUNC(marinedt_state::obj_0_w)); + map(0x02, 0x04).w(FUNC(marinedt_state::obj_w<0>)); map(0x03, 0x03).portr("SYSTEM"); map(0x04, 0x04).portr("DSW2"); map(0x05, 0x05).w(FUNC(marinedt_state::bgm_w)); map(0x06, 0x06).w(FUNC(marinedt_state::sfx_w)); - map(0x08, 0x0b).w(FUNC(marinedt_state::obj_1_w)); + map(0x08, 0x0b).w(FUNC(marinedt_state::obj_w<1>)); map(0x0d, 0x0d).w(FUNC(marinedt_state::layer_enable_w)); - map(0x0e, 0x0e).nopw(); // watchdog + map(0x0e, 0x0e).nopw(); // watchdog? map(0x0f, 0x0f).w(FUNC(marinedt_state::output_w)); } @@ -585,6 +629,7 @@ GFXDECODE_END void marinedt_state::machine_start() { + save_item(NAME(m_in_select)); } void marinedt_state::machine_reset() @@ -592,45 +637,6 @@ void marinedt_state::machine_reset() m_layer_en = 0; } - -void marinedt_state::marinedt_palette(palette_device &palette) const -{ - uint8_t const *const color_prom = memregion("proms")->base(); - for (int i = 0; i < 64; i++) - { - int bit0, bit1, bit2; - - // red component - bit0 = BIT(color_prom[i], 0); - bit1 = BIT(color_prom[i], 1); - //bit2 = BIT(color_prom[i], 2); - int const r = (0x55 * bit0) + (0xaa * bit1); - - // green component - bit0 = BIT(color_prom[i], 3); - bit1 = BIT(color_prom[i], 4); - int const g = (0x55 * bit0) + (0xaa * bit1); - - // blue component - bit0 = BIT(color_prom[i], 5); - bit1 = BIT(color_prom[i], 6); - bit2 = BIT(color_prom[i], 7); - int b = (0x55 * bit0) + (0xaa * bit1); - // matches yellow haired siren - if (bit2 == 0) - b /= 2; - - palette.set_pen_color(i, rgb_t(r, g, b)); - } - - for (int i = 0; i < 32; i++) - { - int const b = color_prom[i + 0x60]; - palette.set_pen_color(64 + 31 - i, rgb_t(0, 0, b)); - palette.set_pen_color(64 + 63 - i, rgb_t(0xff, 0, b)); - } -} - void marinedt_state::marinedt(machine_config &config) { /* basic machine hardware */ @@ -642,16 +648,17 @@ void marinedt_state::marinedt(machine_config &config) /* video hardware */ SCREEN(config, m_screen, SCREEN_TYPE_RASTER); m_screen->set_screen_update(FUNC(marinedt_state::screen_update)); - m_screen->set_raw(MAIN_CLOCK/2, 328, 0, 256, 263, 32, 256); // template to get ~60 fps + // TODO: unverified, template to get ~60 fps + m_screen->set_raw(MAIN_CLOCK / 2, 328, 0, 256, 263, 32, 256); m_screen->set_palette("palette"); GFXDECODE(config, m_gfxdecode, "palette", gfx_marinedt); - PALETTE(config, "palette", FUNC(marinedt_state::marinedt_palette), 64 + 64); + PALETTE(config, "palette", FUNC(marinedt_state::palette_init), 64 + 64); /* sound hardware */ SPEAKER(config, "mono").front_center(); - //AY8910(config, "aysnd", MAIN_CLOCK/4).add_route(ALL_OUTPUTS, "mono", 0.30); + // ... } @@ -692,4 +699,4 @@ ROM_END } // anonymous namespace -GAME( 1981, marinedt, 0, marinedt, marinedt, marinedt_state, empty_init, ROT270, "Taito", "Marine Date", MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION | MACHINE_IMPERFECT_COLORS | MACHINE_NO_SOUND ) +GAME( 1981, marinedt, 0, marinedt, marinedt, marinedt_state, empty_init, ROT270, "Taito", "Marine Date", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_COLORS | MACHINE_NO_SOUND ) |
