Skip to content

Commit e71dcb7

Browse files
committed
emupal: add decoder for xxxxxBBBxGGGxRRR format,
cclimber: small cleanup
1 parent 9abb39b commit e71dcb7

File tree

7 files changed

+310
-331
lines changed

7 files changed

+310
-331
lines changed

Diff for: src/emu/emupal.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,12 @@ palette_device &palette_device::set_format(xbgr_333_t, u32 entries)
168168
return *this;
169169
}
170170

171+
palette_device &palette_device::set_format(xbgr_333_nib_t, u32 entries)
172+
{
173+
set_format(2, &raw_to_rgb_converter::standard_rgb_decoder<3,3,3, 0,4,8>, entries);
174+
return *this;
175+
}
176+
171177
palette_device &palette_device::set_format(xrgb_444_t, u32 entries)
172178
{
173179
set_format(2, &raw_to_rgb_converter::standard_rgb_decoder<4,4,4, 8,4,0>, entries);

Diff for: src/emu/emupal.h

+2
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ class palette_device : public device_t, public device_palette_interface
210210
enum xrgb_333_t { xRGB_333, xxxxxxxRRRGGGBBB };
211211
enum xrbg_333_t { xRBG_333, xxxxxxxRRRBBBGGG };
212212
enum xbgr_333_t { xBGR_333, xxxxxxxBBBGGGRRR };
213+
enum xbgr_333_nib_t { xBGR_333_nibble, xxxxxBBBxGGGxRRR };
213214
enum xrgb_444_t { xRGB_444, xxxxRRRRGGGGBBBB };
214215
enum xrbg_444_t { xRBG_444, xxxxRRRRBBBBGGGG };
215216
enum xbrg_444_t { xBRG_444, xxxxBBBBRRRRGGGG };
@@ -297,6 +298,7 @@ class palette_device : public device_t, public device_palette_interface
297298
palette_device &set_format(xrgb_333_t, u32 entries);
298299
palette_device &set_format(xrbg_333_t, u32 entries);
299300
palette_device &set_format(xbgr_333_t, u32 entries);
301+
palette_device &set_format(xbgr_333_nib_t, u32 entries);
300302
palette_device &set_format(xrgb_444_t, u32 entries);
301303
palette_device &set_format(xrbg_444_t, u32 entries);
302304
palette_device &set_format(xbrg_444_t, u32 entries);

Diff for: src/mame/nichibutsu/cclimber.cpp

+237-257
Large diffs are not rendered by default.

Diff for: src/mame/nichibutsu/cclimber.h

+22-22
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// license:BSD-3-Clause
22
// copyright-holders:Nicola Salmoria
3-
#ifndef MAME_NICHIBUT_CCLIMBER_H
4-
#define MAME_NICHIBUT_CCLIMBER_H
3+
#ifndef MAME_NICHIBUTSU_CCLIMBER_H
4+
#define MAME_NICHIBUTSU_CCLIMBER_H
55

66
#pragma once
77

@@ -52,6 +52,7 @@ class cclimber_state : public driver_device
5252
protected:
5353
virtual void machine_start() override;
5454
virtual void machine_reset() override { m_maincpu->pulse_input_line(INPUT_LINE_RESET, attotime::zero); }
55+
virtual void video_start() override;
5556

5657
required_device<cpu_device> m_maincpu;
5758
optional_device<cpu_device> m_audiocpu;
@@ -89,7 +90,6 @@ class cclimber_state : public driver_device
8990
void cclimber_draw_bigsprite(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
9091
void toprollr_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx);
9192

92-
9393
private:
9494
optional_shared_ptr<uint8_t> m_column_scroll;
9595
optional_shared_ptr<uint8_t> m_decrypted_opcodes;
@@ -99,7 +99,6 @@ class cclimber_state : public driver_device
9999
uint8_t bagmanf_a000_r();
100100
void bagmanf_vblank_irq(int state);
101101

102-
DECLARE_VIDEO_START(cclimber);
103102
void cclimber_palette(palette_device &palette) const;
104103

105104
uint32_t screen_update_cclimber(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
@@ -122,13 +121,15 @@ class swimmer_state : public cclimber_state
122121
cclimber_state(mconfig, type, tag),
123122
m_swimmer_background_color(*this, "bgcolor"),
124123
m_soundlatch(*this, "soundlatch")
125-
{}
124+
{ }
126125

127-
void swimmer_root(machine_config &config);
128126
void swimmer(machine_config &config);
129127
void au(machine_config &config);
130128
void guzzler(machine_config &config);
131129

130+
protected:
131+
virtual void video_start() override;
132+
132133
private:
133134
optional_shared_ptr<uint8_t> m_swimmer_background_color;
134135
optional_device<generic_latch_8_device> m_soundlatch;
@@ -145,19 +146,16 @@ class swimmer_state : public cclimber_state
145146
void au_map(address_map &map);
146147
void guzzler_map(address_map &map);
147148

148-
static rgb_t au_palette(u32 raw);
149-
150149
void swimmer_palette(palette_device &palette) const;
151150
void swimmer_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element* gfx);
152151
uint32_t screen_update_swimmer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
153-
void swimmer_set_background_pen();
152+
void set_background_pen();
153+
void set_sidepen(uint16_t pen) { m_sidepen = pen; }
154154
TILE_GET_INFO_MEMBER(swimmer_get_pf_tile_info);
155-
DECLARE_VIDEO_START(swimmer);
156-
DECLARE_VIDEO_START(au);
157155

158-
bool m_swimmer_side_background_enabled = false;
159-
bool m_swimmer_palettebank = false;
160-
int m_swimmer_sidepen = 0x120;
156+
bool m_side_background_enabled = false;
157+
bool m_palettebank = false;
158+
uint16_t m_sidepen = 0;
161159

162160
static constexpr int SWIMMER_BG_SPLIT = 0x18 * 8;
163161
};
@@ -171,12 +169,15 @@ class toprollr_state : public cclimber_state
171169
m_toprollr_bg_coloram(*this, "bg_coloram"),
172170
m_bank1(*this, "bank1"),
173171
m_bank1d(*this, "bank1d")
174-
{}
172+
{ }
175173

176174
void toprollr(machine_config &config);
177175

178176
void init_toprollr();
179177

178+
protected:
179+
virtual void video_start() override;
180+
180181
private:
181182
optional_shared_ptr<uint8_t> m_toprollr_bg_videoram;
182183
optional_shared_ptr<uint8_t> m_toprollr_bg_coloram;
@@ -193,18 +194,17 @@ class toprollr_state : public cclimber_state
193194
TILE_GET_INFO_MEMBER(toprollr_get_pf_tile_info);
194195
TILE_GET_INFO_MEMBER(toprollr_get_bs_tile_info);
195196
TILE_GET_INFO_MEMBER(toproller_get_bg_tile_info);
196-
DECLARE_VIDEO_START(toprollr);
197197

198-
tilemap_t *m_toproller_bg_tilemap = nullptr;
199-
uint8_t m_toprollr_rombank = 0U;
198+
tilemap_t *m_bg_tilemap = nullptr;
199+
uint8_t m_rombank = 0;
200200
};
201201

202202
class yamato_state : public cclimber_state
203203
{
204204
public:
205205
yamato_state(const machine_config &mconfig, device_type type, const char* tag) :
206206
cclimber_state(mconfig, type, tag)
207-
{}
207+
{ }
208208

209209
void yamato(machine_config &config);
210210

@@ -225,10 +225,10 @@ class yamato_state : public cclimber_state
225225
void yamato_palette(palette_device &palette) const;
226226
uint32_t screen_update_yamato(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
227227

228-
uint8_t m_yamato_p0 = 0U;
229-
uint8_t m_yamato_p1 = 0U;
228+
uint8_t m_yamato_p0 = 0;
229+
uint8_t m_yamato_p1 = 0;
230230

231231
static constexpr int YAMATO_SKY_PEN_BASE = 0x60;
232232
};
233233

234-
#endif // MAME_NICHIBUT_CCLIMBER_H
234+
#endif // MAME_NICHIBUTSU_CCLIMBER_H

Diff for: src/mame/nichibutsu/cclimber_m.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include "emu.h"
44
#include "cclimber.h"
55

6-
/* set to 1 to fix protection check after bonus round (see notes in pacman.c driver) */
6+
// set to 1 to fix protection check after bonus round (see notes in pacman.c driver)
77
#define CANNONB_HACK 0
88

99
void cclimber_state::cclimber_decode(const uint8_t convtable[8][16])
@@ -15,14 +15,14 @@ void cclimber_state::cclimber_decode(const uint8_t convtable[8][16])
1515
int i,j;
1616
uint8_t src = rom[A];
1717

18-
/* pick the translation table from bit 0 of the address */
19-
/* and from bits 1 7 of the source data */
18+
// pick the translation table from bit 0 of the address
19+
// and from bits 1 7 of the source data
2020
i = (A & 1) | (src & 0x02) | ((src & 0x80) >> 5);
2121

22-
/* pick the offset in the table from bits 0 2 4 6 of the source data */
22+
// pick the offset in the table from bits 0 2 4 6 of the source data
2323
j = (src & 0x01) | ((src & 0x04) >> 1) | ((src & 0x10) >> 2) | ((src & 0x40) >> 3);
2424

25-
/* decode the opcodes */
25+
// decode the opcodes
2626
m_decrypted_opcodes[A] = (src & 0xaa) | convtable[i][j];
2727
}
2828
}
@@ -31,7 +31,7 @@ void cclimber_state::init_cclimber()
3131
{
3232
static const uint8_t convtable[8][16] =
3333
{
34-
/* 0xff marks spots which are unused and therefore unknown */
34+
// 0xff marks spots which are unused and therefore unknown
3535
{ 0x44,0x14,0x54,0x10,0x11,0x41,0x05,0x50,0x51,0x00,0x40,0x55,0x45,0x04,0x01,0x15 },
3636
{ 0x44,0x10,0x15,0x55,0x00,0x41,0x40,0x51,0x14,0x45,0x11,0x50,0x01,0x54,0x04,0x05 },
3737
{ 0x45,0x10,0x11,0x44,0x05,0x50,0x51,0x04,0x41,0x14,0x15,0x40,0x01,0x54,0x55,0x00 },
@@ -66,7 +66,7 @@ void cclimber_state::init_ckongb()
6666
{
6767
uint8_t *rom = memregion("maincpu")->base();
6868

69-
for (int A = 0x0000; A < 0x6000; A++) /* all the program ROMs are encrypted */
69+
for (int A = 0x0000; A < 0x6000; A++) // all the program ROMs are encrypted
7070
{
7171
rom[A] = rom[A] ^ 0xf0;
7272
}
@@ -88,7 +88,7 @@ void cclimber_state::init_cannonb()
8888
{
8989
uint8_t *rom = memregion("maincpu")->base();
9090

91-
for (int A = 0x0000; A < 0x1000; A++) /* only first ROM is encrypted */
91+
for (int A = 0x0000; A < 0x1000; A++) // only first ROM is encrypted
9292
{
9393
uint8_t src;
9494
int i;

0 commit comments

Comments
 (0)