More minor cleanup.

This commit is contained in:
Vas Crabb 2022-07-24 19:19:37 +10:00
parent bdcc5ec6ad
commit 107d02141d
7 changed files with 51 additions and 64 deletions

View File

@ -427,12 +427,10 @@ void a26_rom_fe_device::install_memory_handlers(address_space *space)
space->install_read_handler(0x1000, 0x1fff, read8sm_delegate(*this, FUNC(a26_rom_fe_device::read)));
space->install_write_handler(0x1000, 0x1fff, write8sm_delegate(*this, FUNC(a26_rom_fe_device::write)));
space->install_readwrite_tap(0x1fe, 0x1fe, "trigger_bank",
[this](offs_t, u8 &, u8) { if(!machine().side_effects_disabled()) trigger_bank(); },
[this](offs_t, u8 &, u8) { if(!machine().side_effects_disabled()) trigger_bank(); }
);
[this] (offs_t, u8 &, u8) { if (!machine().side_effects_disabled()) trigger_bank(); },
[this] (offs_t, u8 &, u8) { if (!machine().side_effects_disabled()) trigger_bank(); });
space->install_read_tap(0x1ff, 0x1ff, "bank",
[this](offs_t, u8 &data, u8) { if(!machine().side_effects_disabled()) switch_bank(data); }
);
[this] (offs_t, u8 &data, u8) { if (!machine().side_effects_disabled()) switch_bank(data); });
}
/*
@ -449,15 +447,13 @@ void a26_rom_fe_device::install_memory_handlers(address_space *space)
uint8_t a26_rom_fe_device::read(offs_t offset)
{
uint8_t data;
// Super Chip RAM reads are mapped in 0x1080-0x10ff
if (!m_ram.empty() && offset >= 0x80 && offset < 0x100)
{
return m_ram[offset & (m_ram.size() - 1)];
}
data = m_rom[offset + (m_base_bank * 0x1000)];
uint8_t const data = m_rom[offset + (m_base_bank * 0x1000)];
if (!machine().side_effects_disabled())
{
@ -534,8 +530,7 @@ void a26_rom_3e_device::install_memory_handlers(address_space *space)
space->install_read_handler(0x1000, 0x1fff, read8sm_delegate(*this, FUNC(a26_rom_3e_device::read)));
space->install_write_handler(0x1000, 0x1fff, write8sm_delegate(*this, FUNC(a26_rom_3e_device::write)));
space->install_write_tap(0x00, 0x3f, "bank",
[this](offs_t offset, u8 &data, u8) { if(!machine().side_effects_disabled()) write_bank(offset, data); }
);
[this] (offs_t offset, u8 &data, u8) { if (!machine().side_effects_disabled()) write_bank(offset, data); });
}
uint8_t a26_rom_3e_device::read(offs_t offset)
@ -599,8 +594,7 @@ void a26_rom_3f_device::install_memory_handlers(address_space *space)
space->install_read_handler(0x1000, 0x1fff, read8sm_delegate(*this, FUNC(a26_rom_3f_device::read)));
space->install_write_handler(0x1000, 0x1fff, write8sm_delegate(*this, FUNC(a26_rom_3f_device::write)));
space->install_write_tap(0x00, 0x3f, "bank",
[this](offs_t offset, u8 &data, u8) { if(!machine().side_effects_disabled()) write_bank(offset, data); }
);
[this] (offs_t offset, u8 &data, u8) { if (!machine().side_effects_disabled()) write_bank(offset, data); });
}
uint8_t a26_rom_3f_device::read(offs_t offset)
@ -793,9 +787,8 @@ void a26_rom_ua_device::install_memory_handlers(address_space *space)
{
space->install_read_handler(0x1000, 0x1fff, read8sm_delegate(*this, FUNC(a26_rom_ua_device::read)));
space->install_readwrite_tap(0x200, 0x27f, "bank",
[this](offs_t offset, u8 &data, u8) { if(!machine().side_effects_disabled()) change_bank(offset); },
[this](offs_t offset, u8 &data, u8) { if(!machine().side_effects_disabled()) change_bank(offset); }
);
[this] (offs_t offset, u8 &data, u8) { if (!machine().side_effects_disabled()) change_bank(offset); },
[this] (offs_t offset, u8 &data, u8) { if (!machine().side_effects_disabled()) change_bank(offset); });
}
uint8_t a26_rom_ua_device::read(offs_t offset)
@ -980,9 +973,8 @@ void a26_rom_jvp_device::install_memory_handlers(address_space *space)
{
space->install_read_handler(0x1000, 0x1fff, read8sm_delegate(*this, FUNC(a26_rom_jvp_device::read)));
space->install_readwrite_tap(0xfa0, 0xfc0, "bank",
[this](offs_t offset, u8 &data, u8) { if(!machine().side_effects_disabled()) change_bank(offset); },
[this](offs_t offset, u8 &data, u8) { if(!machine().side_effects_disabled()) change_bank(offset); }
);
[this] (offs_t offset, u8 &data, u8) { if (!machine().side_effects_disabled()) change_bank(offset); },
[this] (offs_t offset, u8 &data, u8) { if (!machine().side_effects_disabled()) change_bank(offset); });
}
uint8_t a26_rom_jvp_device::read(offs_t offset)
@ -1149,9 +1141,8 @@ void a26_rom_x07_device::install_memory_handlers(address_space *space)
{
space->install_read_handler(0x1000, 0x1fff, read8sm_delegate(*this, FUNC(a26_rom_x07_device::read)));
space->install_readwrite_tap(0x0000, 0x0fff, "bank",
[this](offs_t offset, u8 &, u8) { if(!machine().side_effects_disabled()) change_bank(offset); },
[this](offs_t offset, u8 &, u8) { if(!machine().side_effects_disabled()) change_bank(offset); }
);
[this] (offs_t offset, u8 &, u8) { if (!machine().side_effects_disabled()) change_bank(offset); },
[this] (offs_t offset, u8 &, u8) { if (!machine().side_effects_disabled()) change_bank(offset); });
}
uint8_t a26_rom_x07_device::read(offs_t offset)

View File

@ -44,8 +44,8 @@
DEFINE_DEVICE_TYPE(A26_ROM_SUPERCHARGER, a26_rom_ss_device, "a2600_ss", "Atari 2600 ROM Cart Supercharger")
a26_rom_ss_device::a26_rom_ss_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: a26_rom_base_device(mconfig, A26_ROM_SUPERCHARGER, tag, owner, clock),
a26_rom_ss_device::a26_rom_ss_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
a26_rom_base_device(mconfig, A26_ROM_SUPERCHARGER, tag, owner, clock),
m_cassette(*this, "cassette"),
m_reg(0),
m_write_delay(0),
@ -111,9 +111,8 @@ void a26_rom_ss_device::install_memory_handlers(address_space *space)
{
space->install_read_handler(0x1000, 0x1fff, read8sm_delegate(*this, FUNC(a26_rom_ss_device::read)));
space->install_readwrite_tap(0x0000, 0x1fff, "bank",
[this](offs_t offset, u8 &, u8) { if(!machine().side_effects_disabled()) tap(offset); },
[this](offs_t offset, u8 &, u8) { if(!machine().side_effects_disabled()) tap(offset); }
);
[this] (offs_t offset, u8 &, u8) { if (!machine().side_effects_disabled()) tap(offset); },
[this] (offs_t offset, u8 &, u8) { if (!machine().side_effects_disabled()) tap(offset); });
}
void a26_rom_ss_device::tap(offs_t offset)

View File

@ -86,8 +86,8 @@ public:
void rom_alloc(uint32_t size, const char *tag);
void ram_alloc(uint32_t size);
uint8_t* get_rom_base() { return m_rom; }
uint8_t* get_ram_base() { return &m_ram[0]; }
uint8_t *get_rom_base() { return m_rom; }
uint8_t *get_ram_base() { return &m_ram[0]; }
uint32_t get_rom_size() { return m_rom_size; }
uint32_t get_ram_size() { return m_ram.size(); }

View File

@ -112,11 +112,6 @@ void a2600_base_state::a2600_mem(address_map &map) // 6507 has 13-bit address sp
#endif
}
void a2600_state::a2600_mem(address_map &map)
{
a2600_base_state::a2600_mem(map);
}
void a2600_pop_state::memory_map(address_map &map) // 6507 has 13-bit address space, 0x0000 - 0x1fff
{
a2600_base_state::a2600_mem(map);

View File

@ -90,7 +90,7 @@ public:
m_cartslot(*this, "cartslot")
{ }
void a2600_mem(address_map &map);
using a2600_base_state::a2600_mem;
void a2600(machine_config &config);
void a2600p(machine_config &config);

View File

@ -186,10 +186,12 @@ void mainsnk_state::palette(palette_device &palette) const
for (int i = 0; i < num_colors; i++)
{
int bit0 = BIT(color_prom[i + 2*num_colors], 3);
int bit1 = BIT(color_prom[i], 1);
int bit2 = BIT(color_prom[i], 2);
int bit3 = BIT(color_prom[i], 3);
int bit0, bit1, bit2, bit3;
bit0 = BIT(color_prom[i + 2*num_colors], 3);
bit1 = BIT(color_prom[i], 1);
bit2 = BIT(color_prom[i], 2);
bit3 = BIT(color_prom[i], 3);
int const r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
bit0 = BIT(color_prom[i + 2*num_colors], 2);

View File

@ -127,10 +127,12 @@ void munchmo_state::palette(palette_device &palette) const
for (int i = 0; i < palette.entries(); i++)
{
int bit0, bit1, bit2;
// red component
int bit0 = BIT(color_prom[i], 0);
int bit1 = BIT(color_prom[i], 1);
int bit2 = BIT(color_prom[i], 2);
bit0 = BIT(color_prom[i], 0);
bit1 = BIT(color_prom[i], 1);
bit2 = BIT(color_prom[i], 2);
int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
// green component
@ -171,7 +173,7 @@ void munchmo_state::video_start()
void munchmo_state::draw_status(bitmap_ind16 &bitmap, const rectangle &cliprect)
{
gfx_element *gfx = m_gfxdecode->gfx(0);
gfx_element *const gfx = m_gfxdecode->gfx(0);
for (int row = 0; row < 4; row++)
{
@ -198,13 +200,13 @@ void munchmo_state::draw_background(bitmap_ind16 &bitmap, const rectangle &clipr
{
// ROM B1.2C contains 256 tilemaps defining 4x4 configurations of the tiles in ROM B2.2B
gfx_element *gfx = m_gfxdecode->gfx(1);
gfx_element *const gfx = m_gfxdecode->gfx(1);
for (int offs = 0; offs < 0x100; offs++)
{
int sy = (offs % 16) * 32;
int sx = (offs / 16) * 32;
int tile_number = m_videoram[offs];
int const sy = (offs % 16) * 32;
int const sx = (offs / 16) * 32;
int const tile_number = m_videoram[offs];
for (int row = 0; row < 4; row++)
{
@ -219,32 +221,30 @@ void munchmo_state::draw_background(bitmap_ind16 &bitmap, const rectangle &clipr
}
}
{
int scrollx = -(m_vreg[2] *2 + (m_vreg[3] >> 7)) - 64 - 128 - 16;
int scrolly = 0;
int const scrollx = -(m_vreg[2] *2 + (m_vreg[3] >> 7)) - 64 - 128 - 16;
int const scrolly = 0;
copyscrollbitmap(bitmap, *m_tmpbitmap, 1, &scrollx, 1, &scrolly, cliprect);
}
copyscrollbitmap(bitmap, *m_tmpbitmap, 1, &scrollx, 1, &scrolly, cliprect);
}
void munchmo_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
{
int scroll = m_vreg[2];
int flags = m_vreg[3]; // XB??????
int xadjust = - 128 - 16 - ((flags & 0x80) ? 1 : 0);
int bank = (flags & 0x40) ? 1 : 0;
gfx_element *gfx = m_gfxdecode->gfx(2 + bank);
int color_base = m_palette_bank * 4 + 3;
int firstsprite = m_vreg[0] & 0x3f;
int const scroll = m_vreg[2];
int const flags = m_vreg[3]; // XB??????
int const xadjust = - 128 - 16 - ((flags & 0x80) ? 1 : 0);
int const bank = (flags & 0x40) ? 1 : 0;
gfx_element *const gfx = m_gfxdecode->gfx(2 + bank);
int const color_base = m_palette_bank * 4 + 3;
int const firstsprite = m_vreg[0] & 0x3f;
for (int i = firstsprite; i < firstsprite + 0x40; i++)
{
for (int j = 0; j < 8; j++)
{
int offs = (j << 6) | (i & 0x3f);
int tile_number = m_sprite_tile[offs]; // ETTTTTTT
int attributes = m_sprite_attr[offs]; // XYYYYYCC
int sx = m_sprite_xpos[offs]; // XXXXXXX?
int sy = (offs >> 6) << 5; // Y YY------
int const offs = (j << 6) | (i & 0x3f);
int const tile_number = m_sprite_tile[offs]; // ETTTTTTT
int const attributes = m_sprite_attr[offs]; // XYYYYYCC
int sx = m_sprite_xpos[offs]; // XXXXXXX?
int sy = (offs >> 6) << 5; // Y YY------
sy += (attributes >> 2) & 0x1f;
if (attributes & 0x80)
{
@ -253,7 +253,7 @@ void munchmo_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect
gfx->transpen(bitmap, cliprect,
0x7f - (tile_number & 0x7f),
color_base - (attributes & 0x03),
0, 0, // no flip
0, 0, // no flip
sx, sy, 7);
}
}