summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2026-02-03 05:38:32 +1100
committer Vas Crabb <vas@vastheman.com>2026-02-03 05:38:32 +1100
commitcd971009fd46bced5c73d97c9abdb345a5aab6d2 (patch)
treeac7e4b48d95b16ae8b6d106514e3eebdbdae0b1d
parent34a31c97fac612018dded189a559417a8b690d7e (diff)
Macro cleanup:
* sega/saturn.h, sega/stv.h: Replaced macros in header with inline member functions, reduced duplicate declarations. * tch/rltennis.cpp: Replaced macros with constexpr.
-rw-r--r--src/mame/edevices/fantland.cpp8
-rw-r--r--src/mame/sega/model2_v.cpp2
-rw-r--r--src/mame/sega/saturn.h20
-rw-r--r--src/mame/sega/saturn_m.cpp2
-rw-r--r--src/mame/sega/saturn_v.cpp48
-rw-r--r--src/mame/sega/stv.h9
-rw-r--r--src/mame/tch/kickgoal.cpp13
-rw-r--r--src/mame/tch/rltennis.cpp42
8 files changed, 69 insertions, 75 deletions
diff --git a/src/mame/edevices/fantland.cpp b/src/mame/edevices/fantland.cpp
index 8e6966e5362..9bbadb2f3b7 100644
--- a/src/mame/edevices/fantland.cpp
+++ b/src/mame/edevices/fantland.cpp
@@ -50,8 +50,8 @@ Year + Game Main CPU Sound CPU Sound Video
#include "sound/dac.h"
#include "sound/msm5205.h"
#include "sound/sn76496.h"
-#include "sound/ymopm.h"
#include "sound/ymopl.h"
+#include "sound/ymopm.h"
#include "emupal.h"
#include "screen.h"
@@ -75,9 +75,9 @@ public:
m_wheel(*this, "WHEEL%u", 0U)
{ }
- void fantland(machine_config &config);
- void wheelrun(machine_config &config);
- void galaxygn(machine_config &config);
+ void fantland(machine_config &config) ATTR_COLD;
+ void wheelrun(machine_config &config) ATTR_COLD;
+ void galaxygn(machine_config &config) ATTR_COLD;
template <int Player> ioport_value wheelrun_wheel_r();
diff --git a/src/mame/sega/model2_v.cpp b/src/mame/sega/model2_v.cpp
index edebda9edd3..840fb841d6b 100644
--- a/src/mame/sega/model2_v.cpp
+++ b/src/mame/sega/model2_v.cpp
@@ -670,7 +670,7 @@ void model2_state::render_frame_start()
raster->poly_list_index = 0;
/* reset the sorted z list */
- std::fill(std::begin(poly_sorted_list), std::end(poly_sorted_list), nullptr);
+ std::fill(std::begin(raster->poly_sorted_list), std::end(raster->poly_sorted_list), nullptr);
/* reset the min-max sortable Z values */
raster->min_z = 0xffff;
diff --git a/src/mame/sega/saturn.h b/src/mame/sega/saturn.h
index a4a73dc61c4..ea3f34b13cf 100644
--- a/src/mame/sega/saturn.h
+++ b/src/mame/sega/saturn.h
@@ -129,6 +129,17 @@ protected:
required_device<palette_device> m_palette;
bitmap_rgb32 m_tmpbitmap;
+
+ int m_scsp_last_line = 0;
+
+ void CEF_1() { m_vdp1_regs[0x010/2] |= 0x0002; }
+ void CEF_0() { m_vdp1_regs[0x010/2] &= ~0x0002; }
+ void BEF_1() { m_vdp1_regs[0x010/2] |= 0x0001; }
+ void BEF_0() { m_vdp1_regs[0x010/2] &= ~0x0001; }
+ uint16_t VDP1_TVMR() const { return m_vdp1_regs[0x000/2] & 0xffff; }
+ uint16_t VDP1_VBE() const { return (VDP1_TVMR() & 0x0008) >> 3; }
+ uint16_t VDP1_TVM() const { return (VDP1_TVMR() & 0x0007) >> 0; }
+
DECLARE_VIDEO_START(vdp2_video_start);
uint32_t screen_update_vdp2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(saturn_scanline);
@@ -145,8 +156,6 @@ protected:
uint8_t backupram_r(offs_t offset);
void backupram_w(offs_t offset, uint8_t data);
- int m_scsp_last_line = 0;
-
uint16_t vdp1_regs_r(offs_t offset);
uint32_t vdp1_vram_r(offs_t offset);
uint32_t vdp1_framebuffer0_r(offs_t offset, uint32_t mem_mask = ~0);
@@ -444,13 +453,6 @@ protected:
// These two clocks are synthesized by the 315-5746
#define MASTER_CLOCK_352 XTAL(14'318'181)*4
#define MASTER_CLOCK_320 XTAL(14'318'181)*3.75
-#define CEF_1 m_vdp1_regs[0x010/2]|=0x0002
-#define CEF_0 m_vdp1_regs[0x010/2]&=~0x0002
-#define BEF_1 m_vdp1_regs[0x010/2]|=0x0001
-#define BEF_0 m_vdp1_regs[0x010/2]&=~0x0001
-#define VDP1_TVMR ((m_vdp1_regs[0x000/2])&0xffff)
-#define VDP1_VBE ((VDP1_TVMR & 0x0008) >> 3)
-#define VDP1_TVM ((VDP1_TVMR & 0x0007) >> 0)
extern gfx_decode_entry const gfx_stv[];
diff --git a/src/mame/sega/saturn_m.cpp b/src/mame/sega/saturn_m.cpp
index f8bb64a8278..2dff5bea3f9 100644
--- a/src/mame/sega/saturn_m.cpp
+++ b/src/mame/sega/saturn_m.cpp
@@ -225,7 +225,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(saturn_state::saturn_scanline)
if(scanline == (vblank_line+1) * y_step)
{
/* docs mentions that VBE happens one line after vblank-in. */
- if(VDP1_VBE)
+ if(VDP1_VBE())
m_vdp1.framebuffer_clear_on_next_frame = 1;
}
diff --git a/src/mame/sega/saturn_v.cpp b/src/mame/sega/saturn_v.cpp
index 53d5caede17..e43a17db6f4 100644
--- a/src/mame/sega/saturn_v.cpp
+++ b/src/mame/sega/saturn_v.cpp
@@ -272,8 +272,8 @@ uint16_t saturn_state::vdp1_regs_r(offs_t offset)
modr |= VDP1_DIE << 6; // DIE
modr |= VDP1_DIL << 5; // DIL
modr |= VDP1_FCM << 4; //FCM
- modr |= VDP1_VBE << 3; //VBE
- modr |= VDP1_TVM & 7; //TVM
+ modr |= VDP1_VBE() << 3; //VBE
+ modr |= VDP1_TVM() & 7; //TVM
return modr;
default:
@@ -291,13 +291,13 @@ void saturn_state::vdp1_clear_framebuffer( int which_framebuffer )
{
int start_x, end_x, start_y, end_y;
- start_x = VDP1_EWLR_X1 * ((VDP1_TVM & 1) ? 16 : 8);
+ start_x = VDP1_EWLR_X1 * ((VDP1_TVM() & 1) ? 16 : 8);
start_y = VDP1_EWLR_Y1 * (m_vdp1.framebuffer_double_interlace+1);
- end_x = VDP1_EWRR_X3 * ((VDP1_TVM & 1) ? 16 : 8);
+ end_x = VDP1_EWRR_X3 * ((VDP1_TVM() & 1) ? 16 : 8);
end_y = (VDP1_EWRR_Y3+1) * (m_vdp1.framebuffer_double_interlace+1);
// popmessage("%d %d %d %d %d",VDP1_EWLR_X1,VDP1_EWLR_Y1,VDP1_EWRR_X3,VDP1_EWRR_Y3,m_vdp1.framebuffer_double_interlace);
- if(VDP1_TVM & 1)
+ if(VDP1_TVM() & 1)
{
for(int y=start_y;y<end_y;y++)
for(int x=start_x;x<end_x;x++)
@@ -361,18 +361,18 @@ void saturn_state::vdp1_change_framebuffers()
m_vdp1.framebuffer_current_display ^= 1;
m_vdp1.framebuffer_current_draw ^= 1;
// "this bit is reset to 0 when the frame buffers are changed"
- CEF_0;
+ CEF_0();
if ( VDP1_LOG ) logerror( "Changing framebuffers: %d - draw, %d - display\n", m_vdp1.framebuffer_current_draw, m_vdp1.framebuffer_current_display );
vdp1_prepare_framebuffers();
}
void saturn_state::vdp1_set_framebuffer_config()
{
- if ( m_vdp1.framebuffer_mode == VDP1_TVM &&
+ if ( m_vdp1.framebuffer_mode == VDP1_TVM() &&
m_vdp1.framebuffer_double_interlace == VDP1_DIE ) return;
if ( VDP1_LOG ) logerror( "Setting framebuffer config\n" );
- m_vdp1.framebuffer_mode = VDP1_TVM;
+ m_vdp1.framebuffer_mode = VDP1_TVM();
m_vdp1.framebuffer_double_interlace = VDP1_DIE;
switch( m_vdp1.framebuffer_mode )
{
@@ -381,7 +381,7 @@ void saturn_state::vdp1_set_framebuffer_config()
case 2: m_vdp1.framebuffer_width = 512; m_vdp1.framebuffer_height = 256; break;
case 3: m_vdp1.framebuffer_width = 512; m_vdp1.framebuffer_height = 512; break;
case 4: m_vdp1.framebuffer_width = 512; m_vdp1.framebuffer_height = 256; break;
- default: logerror( "Invalid framebuffer config %x\n", VDP1_TVM ); m_vdp1.framebuffer_width = 512; m_vdp1.framebuffer_height = 256; break;
+ default: logerror( "Invalid framebuffer config %x\n", VDP1_TVM() ); m_vdp1.framebuffer_width = 512; m_vdp1.framebuffer_height = 256; break;
}
if ( VDP1_DIE ) m_vdp1.framebuffer_height *= 2; /* double interlace */
@@ -462,7 +462,7 @@ void saturn_state::vdp1_vram_w(offs_t offset, uint32_t data, uint32_t mem_mask)
void saturn_state::vdp1_framebuffer0_w(offs_t offset, uint32_t data, uint32_t mem_mask)
{
//popmessage ("STV VDP1 Framebuffer 0 WRITE offset %08x data %08x",offset, data);
- if ( VDP1_TVM & 1 )
+ if ( VDP1_TVM() & 1 )
{
/* 8-bit mode */
//printf("VDP1 8-bit mode %08x %02x\n",offset,data);
@@ -505,7 +505,7 @@ uint32_t saturn_state::vdp1_framebuffer0_r(offs_t offset, uint32_t mem_mask)
{
uint32_t result = 0;
//popmessage ("STV VDP1 Framebuffer 0 READ offset %08x",offset);
- if ( VDP1_TVM & 1 )
+ if ( VDP1_TVM() & 1 )
{
/* 8-bit mode */
//printf("VDP1 8-bit mode %08x\n",offset);
@@ -1886,7 +1886,7 @@ void saturn_state::vdp1_draw_normal_sprite(const rectangle &cliprect, int sprite
TIMER_CALLBACK_MEMBER(saturn_state::vdp1_draw_end )
{
/* set CEF to 1*/
- CEF_1;
+ CEF_1();
// TODO: temporary for Batman Forever, presumably anonymous timer not behaving well.
#if 0
@@ -1918,7 +1918,7 @@ void saturn_state::vdp1_process_list()
clear_gouraud_shading();
/*Set CEF bit to 0*/
- CEF_0;
+ CEF_0();
// TODO: is there an actual limit for this?
while (spritecount < 16383) // max 16383 with texture or max 16384 without texture - virtually unlimited
@@ -2168,9 +2168,9 @@ void saturn_state::vdp1_video_update()
if (VDP1_LOG) logerror( "FBCR = %0x, accessed = %d\n", VDP1_FBCR, m_vdp1.fbcr_accessed );
if(VDP1_CEF)
- BEF_1;
+ BEF_1();
else
- BEF_0;
+ BEF_0();
if ( m_vdp1.framebuffer_clear_on_next_frame )
{
@@ -2192,16 +2192,16 @@ void saturn_state::vdp1_video_update()
case 1: /* Setting prohibited */
break;
case 2: /* Manual mode - erase */
- if ( m_vdp1.fbcr_accessed )
+ if (m_vdp1.fbcr_accessed)
{
m_vdp1.framebuffer_clear_on_next_frame = 1;
}
break;
case 3: /* Manual mode - change */
- if ( m_vdp1.fbcr_accessed )
+ if (m_vdp1.fbcr_accessed)
{
vdp1_change_framebuffers();
- if ( VDP1_VBE )
+ if (VDP1_VBE())
{
vdp1_clear_framebuffer(m_vdp1.framebuffer_current_draw);
}
@@ -2213,18 +2213,18 @@ void saturn_state::vdp1_video_update()
}
m_vdp1.fbcr_accessed = 0;
- if (VDP1_LOG) logerror( "PTM = %0x, TVM = %x\n", VDP1_PTM, VDP1_TVM );
+ if (VDP1_LOG) logerror("PTM = %0x, TVM = %x\n", VDP1_PTM, VDP1_TVM());
/*Set CEF bit to 0*/
- //CEF_0;
- switch(VDP1_PTM & 3)
+ //CEF_0();
+ switch (VDP1_PTM & 3)
{
case 0:/*Idle Mode*/
/*Set CEF bit to 0*/
- //CEF_0;
+ //CEF_0();
break;
case 1:/*Draw by request*/
/*Set CEF bit to 0*/
- //CEF_0;
+ //CEF_0();
break;
case 2:/*Automatic Draw*/
if ( framebuffer_changed || VDP1_LOG )
@@ -8976,7 +8976,7 @@ void saturn_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect,
/*Guess:Some games needs that the horizontal sprite size to be doubled
(TODO: understand the proper settings,it might not work like this)*/
- if(VDP1_TVM == 0 && VDP2_HRES & 2) // astrass & findlove
+ if(VDP1_TVM() == 0 && VDP2_HRES & 2) // astrass & findlove
double_x = 1;
else
double_x = 0;
diff --git a/src/mame/sega/stv.h b/src/mame/sega/stv.h
index e1ac88b9e56..fd2fe4af4c3 100644
--- a/src/mame/sega/stv.h
+++ b/src/mame/sega/stv.h
@@ -193,14 +193,5 @@ public:
//#define MASTER_CLOCK_352 57272720
//#define MASTER_CLOCK_320 53693174
-#define CEF_1 m_vdp1_regs[0x010/2]|=0x0002
-#define CEF_0 m_vdp1_regs[0x010/2]&=~0x0002
-#define BEF_1 m_vdp1_regs[0x010/2]|=0x0001
-#define BEF_0 m_vdp1_regs[0x010/2]&=~0x0001
-#define VDP1_TVMR ((m_vdp1_regs[0x000/2])&0xffff)
-#define VDP1_VBE ((VDP1_TVMR & 0x0008) >> 3)
-#define VDP1_TVM ((VDP1_TVMR & 0x0007) >> 0)
-
-extern gfx_decode_entry const gfx_stv[];
#endif // MAME_SEGA_STV_H
diff --git a/src/mame/tch/kickgoal.cpp b/src/mame/tch/kickgoal.cpp
index 7819f6c82da..3af4416376a 100644
--- a/src/mame/tch/kickgoal.cpp
+++ b/src/mame/tch/kickgoal.cpp
@@ -74,6 +74,7 @@ lev 7 : 0x7c : 0000 0000 - x
#include "speaker.h"
#include "tilemap.h"
+
namespace {
class kickgoal_state : public driver_device
@@ -96,11 +97,11 @@ public:
m_soundlatch(*this, "soundlatch")
{ }
- void kickgoal(machine_config &config);
- void actionhw(machine_config &config);
+ void kickgoal(machine_config &config) ATTR_COLD;
+ void actionhw(machine_config &config) ATTR_COLD;
- void init_kickgoal();
- void init_actionhw();
+ void init_kickgoal() ATTR_COLD;
+ void init_actionhw() ATTR_COLD;
protected:
virtual void machine_start() override ATTR_COLD;
@@ -136,6 +137,8 @@ private:
void program_map(address_map &map) ATTR_COLD;
void oki_map(address_map &map) ATTR_COLD;
+ void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
+
/* video-related */
tilemap_t *m_fgtm = nullptr;
tilemap_t *m_bgtm = nullptr;
@@ -160,8 +163,6 @@ private:
int m_sprbase = 0;
- void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
-
/* memory pointers */
required_shared_ptr<u16> m_fgram;
required_shared_ptr<u16> m_bgram;
diff --git a/src/mame/tch/rltennis.cpp b/src/mame/tch/rltennis.cpp
index abe58035373..3ddfecb252e 100644
--- a/src/mame/tch/rltennis.cpp
+++ b/src/mame/tch/rltennis.cpp
@@ -74,31 +74,30 @@ player - when there's nothing to play - first, empty 2k of ROMs are selected.
#include <algorithm>
-#define RLT_REFRESH_RATE 60
-#define RLT_TIMER_FREQ (RLT_REFRESH_RATE*256)
-
-#define BLTFLAG_DST_X_DIR (1<<0)
-#define BLTFLAG_DST_Y_DIR (1<<1)
-#define BLTFLAG_DST_LR (1<<2)
-#define BLTFLAG_DST_UD (1<<3)
-#define BLTFLAG_DISPLAY_UD (1<<5)
+namespace {
-#define BLTFLAG_SRC_X_DIR (1<<8)
-#define BLTFLAG_SRC_Y_DIR (1<<9)
-#define BLTFLAG_SRC_LR (1<<10)
-#define BLTFLAG_SRC_UD (1<<11)
+constexpr int RLT_REFRESH_RATE = 60;
+constexpr int RLT_TIMER_FREQ = RLT_REFRESH_RATE * 256;
+constexpr uint16_t BLTFLAG_DST_X_DIR = 1 << 0;
+constexpr uint16_t BLTFLAG_DST_Y_DIR = 1 << 1;
+constexpr uint16_t BLTFLAG_DST_LR = 1 << 2;
+constexpr uint16_t BLTFLAG_DST_UD = 1 << 3;
+constexpr uint16_t BLTFLAG_DISPLAY_UD = 1 << 5;
-#define BLTSTRT_ROM_MSB (1<<8)
-#define BLTSTRT_TRIGGER (1<<14)
-#define BLTSTRT_LAYER (1<<15)
+constexpr uint16_t BLTFLAG_SRC_X_DIR = 1 << 8;
+constexpr uint16_t BLTFLAG_SRC_Y_DIR = 1 << 9;
+constexpr uint16_t BLTFLAG_SRC_LR = 1 << 10;
+constexpr uint16_t BLTFLAG_SRC_UD = 1 << 11;
-#define SRC_SHIFT 8
+constexpr uint16_t BLTSTRT_ROM_MSB = 1 << 8;
+constexpr uint16_t BLTSTRT_TRIGGER = 1 << 14;
+constexpr uint16_t BLTSTRT_LAYER = 1 << 15;
-#define RLT_NUM_BLITTER_REGS 8
-#define RLT_NUM_BITMAPS 8
+constexpr unsigned SRC_SHIFT = 8;
-namespace {
+constexpr unsigned RLT_NUM_BLITTER_REGS = 8;
+constexpr unsigned RLT_NUM_BITMAPS = 8;
enum
{
@@ -135,7 +134,7 @@ public:
std::fill(std::begin(m_sample_rom_offset), std::end(m_sample_rom_offset), 0);
}
- void rltennis(machine_config &config);
+ void rltennis(machine_config &config) ATTR_COLD;
protected:
virtual void machine_start() override ATTR_COLD;
@@ -167,8 +166,9 @@ private:
INTERRUPT_GEN_MEMBER(interrupt);
TIMER_CALLBACK_MEMBER(sample_player);
- void ramdac_map(address_map &map) ATTR_COLD;
+
void rltennis_main(address_map &map) ATTR_COLD;
+ void ramdac_map(address_map &map) ATTR_COLD;
};
/****************************************************************************************