summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/video
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2017-05-07 23:18:47 +1000
committer Vas Crabb <vas@vastheman.com>2017-05-14 21:44:11 +1000
commit0f0d39ef81562c75e79176dd3bebb1e491ca39d5 (patch)
tree201cee7fdf55ee800f83859a92efd2cfe66cf2b3 /src/devices/video
parente6c4be2b4d71c7a6c95be0bae111eb416ff0f9e7 (diff)
Move static data out of devices into the device types. This is a significant change, so please pay attention.
The core changes are: * Short name, full name and source file are no longer members of device_t, they are part of the device type * MACHINE_COFIG_START no longer needs a driver class * MACHINE_CONFIG_DERIVED_CLASS is no longer necessary * Specify the state class you want in the GAME/COMP/CONS line * The compiler will work out the base class where the driver init member is declared * There is one static device type object per driver rather than one per machine configuration Use DECLARE_DEVICE_TYPE or DECLARE_DEVICE_TYPE_NS to declare device type. * DECLARE_DEVICE_TYPE forward-declares teh device type and class, and declares extern object finders. * DECLARE_DEVICE_TYPE_NS is for devices classes in namespaces - it doesn't forward-declare the device type. Use DEFINE_DEVICE_TYPE or DEFINE_DEVICE_TYPE_NS to define device types. * These macros declare storage for the static data, and instantiate the device type and device finder templates. The rest of the changes are mostly just moving stuff out of headers that shouldn't be there, renaming stuff for consistency, and scoping stuff down where appropriate. Things I've actually messed with substantially: * More descriptive names for a lot of devices * Untangled the fantasy sound from the driver state, which necessitates breaking up sound/flip writes * Changed DECO BSMT2000 ready callback into a device delegate * Untangled Microprose 3D noise from driver state * Used object finders for CoCo multipak, KC85 D002, and Irem sound subdevices * Started to get TI-99 stuff out of the TI-990 directory and arrange bus devices properly * Started to break out common parts of Samsung ARM SoC devices * Turned some of FM, SID, SCSP DSP, EPIC12 and Voodoo cores into something resmbling C++ * Tried to make Z180 table allocation/setup a bit safer * Converted generic keyboard/terminal to not use WRITE8 - space/offset aren't relevant * Dynamically allocate generic terminal buffer so derived devices (e.g. teleprinter) can specify size * Imporved encapsulation of Z80DART channels * Refactored the SPC7110 bit table generator loop to make it more readable * Added wrappers for SNES PPU operations so members can be made protected * Factored out some boilerplate for YM chips with PSG * toaplan2 gfx * stic/intv resolution * Video System video * Out Run/Y-board sprite alignment * GIC video hookup * Amstrad CPC ROM box members * IQ151 ROM cart region * MSX cart IRQ callback resolution time * SMS passthrough control devices starting subslots I've smoke-tested several drivers, but I've probably missed something. Things I've missed will likely blow up spectacularly with failure to bind errors and the like. Let me know if there's more subtle breakage (could have happened in FM or Voodoo). And can everyone please, please try to keep stuff clean. In particular, please stop polluting the global namespace. Keep things out of headers that don't need to be there, and use things that can be scoped down rather than macros. It feels like an uphill battle trying to get this stuff under control while more of it's added.
Diffstat (limited to 'src/devices/video')
-rw-r--r--src/devices/video/315_5124.cpp76
-rw-r--r--src/devices/video/315_5124.h143
-rw-r--r--src/devices/video/315_5313.cpp152
-rw-r--r--src/devices/video/315_5313.h177
-rw-r--r--src/devices/video/bufsprite.cpp35
-rw-r--r--src/devices/video/bufsprite.h49
-rw-r--r--src/devices/video/cdp1861.cpp40
-rw-r--r--src/devices/video/cdp1861.h71
-rw-r--r--src/devices/video/cdp1862.cpp6
-rw-r--r--src/devices/video/cdp1862.h18
-rw-r--r--src/devices/video/cesblit.cpp9
-rw-r--r--src/devices/video/cesblit.h14
-rw-r--r--src/devices/video/cgapal.h10
-rw-r--r--src/devices/video/clgd542x.cpp12
-rw-r--r--src/devices/video/clgd542x.h17
-rw-r--r--src/devices/video/crt9007.cpp190
-rw-r--r--src/devices/video/crt9007.h77
-rw-r--r--src/devices/video/crt9021.cpp30
-rw-r--r--src/devices/video/crt9021.h29
-rw-r--r--src/devices/video/crt9212.cpp35
-rw-r--r--src/devices/video/crt9212.h40
-rw-r--r--src/devices/video/crtc_ega.cpp14
-rw-r--r--src/devices/video/crtc_ega.h73
-rw-r--r--src/devices/video/dl1416.cpp26
-rw-r--r--src/devices/video/dl1416.h22
-rw-r--r--src/devices/video/dm9368.cpp17
-rw-r--r--src/devices/video/dm9368.h12
-rw-r--r--src/devices/video/ef9340_1.cpp6
-rw-r--r--src/devices/video/ef9340_1.h12
-rw-r--r--src/devices/video/ef9345.cpp22
-rw-r--r--src/devices/video/ef9345.h18
-rw-r--r--src/devices/video/ef9364.cpp64
-rw-r--r--src/devices/video/ef9364.h23
-rw-r--r--src/devices/video/ef9365.cpp156
-rw-r--r--src/devices/video/ef9365.h67
-rw-r--r--src/devices/video/ef9369.cpp9
-rw-r--r--src/devices/video/ef9369.h21
-rw-r--r--src/devices/video/epic12.cpp78
-rw-r--r--src/devices/video/epic12.h357
-rw-r--r--src/devices/video/epic12in.hxx14
-rw-r--r--src/devices/video/epic12pixel.hxx106
-rw-r--r--src/devices/video/fixfreq.cpp47
-rw-r--r--src/devices/video/fixfreq.h14
-rw-r--r--src/devices/video/gb_lcd.cpp140
-rw-r--r--src/devices/video/gb_lcd.h49
-rw-r--r--src/devices/video/gba_lcd.cpp4
-rw-r--r--src/devices/video/gba_lcd.h31
-rw-r--r--src/devices/video/gf4500.cpp6
-rw-r--r--src/devices/video/gf4500.h12
-rw-r--r--src/devices/video/gf7600gs.cpp4
-rw-r--r--src/devices/video/gf7600gs.h10
-rw-r--r--src/devices/video/hd44102.cpp52
-rw-r--r--src/devices/video/hd44102.h12
-rw-r--r--src/devices/video/hd44352.cpp4
-rw-r--r--src/devices/video/hd44352.h15
-rw-r--r--src/devices/video/hd44780.cpp38
-rw-r--r--src/devices/video/hd44780.h30
-rw-r--r--src/devices/video/hd61830.cpp95
-rw-r--r--src/devices/video/hd61830.h20
-rw-r--r--src/devices/video/hd63484.cpp4
-rw-r--r--src/devices/video/hd63484.h24
-rw-r--r--src/devices/video/hd66421.cpp27
-rw-r--r--src/devices/video/hd66421.h26
-rw-r--r--src/devices/video/hlcd0515.cpp15
-rw-r--r--src/devices/video/hlcd0515.h41
-rw-r--r--src/devices/video/hlcd0538.cpp14
-rw-r--r--src/devices/video/hlcd0538.h38
-rw-r--r--src/devices/video/hp1ll3.cpp96
-rw-r--r--src/devices/video/hp1ll3.h104
-rw-r--r--src/devices/video/huc6202.cpp32
-rw-r--r--src/devices/video/huc6202.h34
-rw-r--r--src/devices/video/huc6260.cpp27
-rw-r--r--src/devices/video/huc6260.h33
-rw-r--r--src/devices/video/huc6261.cpp25
-rw-r--r--src/devices/video/huc6261.h19
-rw-r--r--src/devices/video/huc6270.cpp47
-rw-r--r--src/devices/video/huc6270.h18
-rw-r--r--src/devices/video/huc6271.cpp8
-rw-r--r--src/devices/video/huc6271.h25
-rw-r--r--src/devices/video/huc6272.cpp4
-rw-r--r--src/devices/video/huc6272.h34
-rw-r--r--src/devices/video/i8244.cpp19
-rw-r--r--src/devices/video/i8244.h106
-rw-r--r--src/devices/video/i82730.cpp18
-rw-r--r--src/devices/video/i82730.h26
-rw-r--r--src/devices/video/i8275.cpp61
-rw-r--r--src/devices/video/i8275.h30
-rw-r--r--src/devices/video/jangou_blitter.cpp4
-rw-r--r--src/devices/video/jangou_blitter.h25
-rw-r--r--src/devices/video/m50458.cpp10
-rw-r--r--src/devices/video/m50458.h32
-rw-r--r--src/devices/video/mb90082.cpp8
-rw-r--r--src/devices/video/mb90082.h32
-rw-r--r--src/devices/video/mb_vcu.cpp4
-rw-r--r--src/devices/video/mb_vcu.h13
-rw-r--r--src/devices/video/mc6845.cpp96
-rw-r--r--src/devices/video/mc6845.h105
-rw-r--r--src/devices/video/mc6847.cpp70
-rw-r--r--src/devices/video/mc6847.h111
-rw-r--r--src/devices/video/mga2064w.cpp4
-rw-r--r--src/devices/video/mga2064w.h12
-rw-r--r--src/devices/video/mos6566.cpp56
-rw-r--r--src/devices/video/mos6566.h61
-rw-r--r--src/devices/video/msm6222b.cpp17
-rw-r--r--src/devices/video/msm6222b.h27
-rw-r--r--src/devices/video/msm6255.cpp9
-rw-r--r--src/devices/video/msm6255.h15
-rw-r--r--src/devices/video/pc_vga.cpp54
-rw-r--r--src/devices/video/pc_vga.h93
-rw-r--r--src/devices/video/pcd8544.cpp23
-rw-r--r--src/devices/video/pcd8544.h19
-rw-r--r--src/devices/video/poly.h98
-rw-r--r--src/devices/video/polylgcy.cpp32
-rw-r--r--src/devices/video/polylgcy.h24
-rw-r--r--src/devices/video/ppu2c0x.cpp70
-rw-r--r--src/devices/video/ppu2c0x.h197
-rw-r--r--src/devices/video/psx.cpp115
-rw-r--r--src/devices/video/psx.h333
-rw-r--r--src/devices/video/ramdac.cpp4
-rw-r--r--src/devices/video/ramdac.h11
-rw-r--r--src/devices/video/saa5050.cpp56
-rw-r--r--src/devices/video/saa5050.h33
-rw-r--r--src/devices/video/scn2674.cpp225
-rw-r--r--src/devices/video/scn2674.h16
-rw-r--r--src/devices/video/sed1200.cpp20
-rw-r--r--src/devices/video/sed1200.h20
-rw-r--r--src/devices/video/sed1330.cpp177
-rw-r--r--src/devices/video/sed1330.h14
-rw-r--r--src/devices/video/sed1520.cpp4
-rw-r--r--src/devices/video/sed1520.h17
-rw-r--r--src/devices/video/snes_ppu.cpp18
-rw-r--r--src/devices/video/snes_ppu.h110
-rw-r--r--src/devices/video/sprite.h22
-rw-r--r--src/devices/video/t6a04.cpp12
-rw-r--r--src/devices/video/t6a04.h10
-rw-r--r--src/devices/video/tea1002.cpp4
-rw-r--r--src/devices/video/tea1002.h9
-rw-r--r--src/devices/video/tlc34076.cpp6
-rw-r--r--src/devices/video/tlc34076.h34
-rw-r--r--src/devices/video/tms34061.cpp21
-rw-r--r--src/devices/video/tms34061.h94
-rw-r--r--src/devices/video/tms3556.cpp174
-rw-r--r--src/devices/video/tms3556.h56
-rw-r--r--src/devices/video/tms9927.cpp27
-rw-r--r--src/devices/video/tms9927.h34
-rw-r--r--src/devices/video/tms9928a.cpp132
-rw-r--r--src/devices/video/tms9928a.h66
-rw-r--r--src/devices/video/upd3301.cpp77
-rw-r--r--src/devices/video/upd3301.h31
-rw-r--r--src/devices/video/upd7220.cpp128
-rw-r--r--src/devices/video/upd7220.h41
-rw-r--r--src/devices/video/upd7227.cpp27
-rw-r--r--src/devices/video/upd7227.h15
-rw-r--r--src/devices/video/v9938.cpp48
-rw-r--r--src/devices/video/v9938.h43
-rw-r--r--src/devices/video/vector.cpp4
-rw-r--r--src/devices/video/vector.h44
-rw-r--r--src/devices/video/vic4567.cpp48
-rw-r--r--src/devices/video/vic4567.h108
-rw-r--r--src/devices/video/vooddefs.h190
-rw-r--r--src/devices/video/voodoo.cpp627
-rw-r--r--src/devices/video/voodoo.h684
-rw-r--r--src/devices/video/voodoo_pci.cpp4
-rw-r--r--src/devices/video/voodoo_pci.h12
-rw-r--r--src/devices/video/zeus2.cpp6
-rw-r--r--src/devices/video/zeus2.h16
166 files changed, 4515 insertions, 4718 deletions
diff --git a/src/devices/video/315_5124.cpp b/src/devices/video/315_5124.cpp
index 9588f3e6052..e49325d6c25 100644
--- a/src/devices/video/315_5124.cpp
+++ b/src/devices/video/315_5124.cpp
@@ -68,6 +68,11 @@ PAL frame timing
#include "video/315_5124.h"
+#define SEGA315_5124_PALETTE_SIZE (64 + 16)
+#define SEGA315_5378_PALETTE_SIZE 4096
+
+#define VRAM_SIZE 0x4000
+
#define STATUS_VINT 0x80 /* Pending vertical interrupt flag */
#define STATUS_SPROVR 0x40 /* Sprite overflow flag */
#define STATUS_SPRCOL 0x20 /* Object collision flag */
@@ -84,8 +89,8 @@ PAL frame timing
#define DISPLAY_DISABLED_HPOS 24 /* not verified, works if above 18 (for 'pstrike2') and below 25 (for 'fantdizzy') */
#define DISPLAY_CB_HPOS 2 /* fixes 'roadrash' (SMS game) title scrolling, due to line counter reload timing */
-#define DRAW_TIME_GG 94 /* 9 + 2 + 14 + 8 + 13 + 96/2 */
-#define DRAW_TIME_SMS 46 /* 9 + 2 + 14 + 8 + 13 */
+#define DRAW_TIME_GG 94 /* 9 + 2 + 14 + 8 + 13 + 96/2 */
+#define DRAW_TIME_SMS 46 /* 9 + 2 + 14 + 8 + 13 */
#define PRIORITY_BIT 0x1000
#define BACKDROP_COLOR ((m_vdp_mode == 4 ? 0x10 : 0x00) + (m_reg[0x07] & 0x0f))
@@ -97,17 +102,17 @@ PAL frame timing
#define BOTTOM_BORDER 4
#define BOTTOM_BLANKING 5
-static const uint8_t ntsc_192[6] = { 3, 13, 27, 192, 24, 3 };
-static const uint8_t ntsc_224[6] = { 3, 13, 11, 224, 8, 3 };
-static const uint8_t ntsc_240[6] = { 3, 13, 3, 240, 0, 3 };
-static const uint8_t pal_192[6] = { 3, 13, 54, 192, 48, 3 };
-static const uint8_t pal_224[6] = { 3, 13, 38, 224, 32, 3 };
-static const uint8_t pal_240[6] = { 3, 13, 30, 240, 24, 3 };
+static constexpr uint8_t ntsc_192[6] = { 3, 13, 27, 192, 24, 3 };
+static constexpr uint8_t ntsc_224[6] = { 3, 13, 11, 224, 8, 3 };
+static constexpr uint8_t ntsc_240[6] = { 3, 13, 3, 240, 0, 3 };
+static constexpr uint8_t pal_192[6] = { 3, 13, 54, 192, 48, 3 };
+static constexpr uint8_t pal_224[6] = { 3, 13, 38, 224, 32, 3 };
+static constexpr uint8_t pal_240[6] = { 3, 13, 30, 240, 24, 3 };
-const device_type SEGA315_5124 = device_creator<sega315_5124_device>;
-const device_type SEGA315_5246 = device_creator<sega315_5246_device>;
-const device_type SEGA315_5378 = device_creator<sega315_5378_device>;
+DEFINE_DEVICE_TYPE(SEGA315_5124, sega315_5124_device, "sega315_5124", "Sega 315-5124 SMS1 VDP")
+DEFINE_DEVICE_TYPE(SEGA315_5246, sega315_5246_device, "sega315_5246", "Sega 315-5246 SMS2 VDP")
+DEFINE_DEVICE_TYPE(SEGA315_5378, sega315_5378_device, "sega315_5378", "Sega 315-5378 Gamegear VDP")
PALETTE_INIT_MEMBER(sega315_5124_device, sega315_5124)
@@ -161,24 +166,13 @@ ADDRESS_MAP_END
sega315_5124_device::sega315_5124_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t( mconfig, SEGA315_5124, "Sega 315-5124 VDP", tag, owner, clock, "sega315_5124", __FILE__)
- , device_memory_interface(mconfig, *this)
- , device_video_interface(mconfig, *this)
- , m_cram_size( SEGA315_5124_CRAM_SIZE )
- , m_palette_offset( 0 )
- , m_supports_224_240( false )
- , m_is_pal(false)
- , m_int_cb(*this)
- , m_csync_cb(*this)
- , m_pause_cb(*this)
- , m_space_config("videoram", ENDIANNESS_LITTLE, 8, 14, 0, nullptr, *ADDRESS_MAP_NAME(sega315_5124))
- , m_palette(*this, "palette")
+ : sega315_5124_device(mconfig, SEGA315_5124, tag, owner, clock, SEGA315_5124_CRAM_SIZE, 0, false)
{
}
-sega315_5124_device::sega315_5124_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, uint8_t cram_size, uint8_t palette_offset, bool supports_224_240, const char *shortname, const char *source)
- : device_t( mconfig, type, name, tag, owner, clock, shortname, source)
+sega315_5124_device::sega315_5124_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint8_t cram_size, uint8_t palette_offset, bool supports_224_240)
+ : device_t(mconfig, type, tag, owner, clock)
, device_memory_interface(mconfig, *this)
, device_video_interface(mconfig, *this)
, m_cram_size( cram_size )
@@ -195,13 +189,13 @@ sega315_5124_device::sega315_5124_device(const machine_config &mconfig, device_t
sega315_5246_device::sega315_5246_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : sega315_5124_device( mconfig, SEGA315_5246, "Sega 315-5246 VDP", tag, owner, clock, SEGA315_5124_CRAM_SIZE, 0, true, "sega315_5246", __FILE__)
+ : sega315_5124_device(mconfig, SEGA315_5246, tag, owner, clock, SEGA315_5124_CRAM_SIZE, 0, true)
{
}
sega315_5378_device::sega315_5378_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : sega315_5124_device( mconfig, SEGA315_5378, "Sega 315-5378 VDP", tag, owner, clock, SEGA315_5378_CRAM_SIZE, 0x10, true, "sega315_5378", __FILE__)
+ : sega315_5124_device(mconfig, SEGA315_5378, tag, owner, clock, SEGA315_5378_CRAM_SIZE, 0x10, true)
{
}
@@ -318,7 +312,7 @@ void sega315_5124_device::hcount_latch_at_hpos( int hpos )
/* The hcount value returned by the VDP seems to be based on the previous hpos */
int hclock = hpos - 1;
if (hclock < 0)
- hclock += SEGA315_5124_WIDTH;
+ hclock += WIDTH;
m_hcounter = ((hclock - active_scr_start) >> 1) & 0xff;
}
@@ -347,7 +341,7 @@ void sega315_5124_device::device_timer(emu_timer &timer, device_timer_id id, int
case TIMER_DRAW:
update_palette();
- draw_scanline( SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH, param, m_screen->vpos() - param );
+ draw_scanline( LBORDER_START + LBORDER_WIDTH, param, m_screen->vpos() - param );
break;
case TIMER_LBORDER:
@@ -358,8 +352,8 @@ void sega315_5124_device::device_timer(emu_timer &timer, device_timer_id id, int
update_palette();
/* Draw left border */
- rec.min_x = SEGA315_5124_LBORDER_START;
- rec.max_x = SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH - 1;
+ rec.min_x = LBORDER_START;
+ rec.max_x = LBORDER_START + LBORDER_WIDTH - 1;
m_tmpbitmap.fill(m_palette->pen(m_current_palette[BACKDROP_COLOR]), rec);
m_y1_bitmap.fill(( m_reg[0x07] & 0x0f ) ? 1 : 0, rec);
}
@@ -373,8 +367,8 @@ void sega315_5124_device::device_timer(emu_timer &timer, device_timer_id id, int
update_palette();
/* Draw right border */
- rec.min_x = SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 256;
- rec.max_x = rec.min_x + SEGA315_5124_RBORDER_WIDTH - 1;
+ rec.min_x = LBORDER_START + LBORDER_WIDTH + 256;
+ rec.max_x = rec.min_x + RBORDER_WIDTH - 1;
m_tmpbitmap.fill(m_palette->pen(m_current_palette[BACKDROP_COLOR]), rec);
m_y1_bitmap.fill(( m_reg[0x07] & 0x0f ) ? 1 : 0, rec);
}
@@ -480,8 +474,8 @@ void sega315_5124_device::process_line_timer()
}
/* Draw borders */
- m_lborder_timer->adjust( m_screen->time_until_pos( vpos, SEGA315_5124_LBORDER_START ), vpos );
- m_rborder_timer->adjust( m_screen->time_until_pos( vpos, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 256 ), vpos );
+ m_lborder_timer->adjust( m_screen->time_until_pos( vpos, LBORDER_START ), vpos );
+ m_rborder_timer->adjust( m_screen->time_until_pos( vpos, LBORDER_START + LBORDER_WIDTH + 256 ), vpos );
/* Draw middle of the border */
/* We need to do this through the regular drawing function */
@@ -513,8 +507,8 @@ void sega315_5124_device::process_line_timer()
}
/* Draw borders */
- m_lborder_timer->adjust( m_screen->time_until_pos( vpos, SEGA315_5124_LBORDER_START ), vpos );
- m_rborder_timer->adjust( m_screen->time_until_pos( vpos, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 256 ), vpos );
+ m_lborder_timer->adjust( m_screen->time_until_pos( vpos, LBORDER_START ), vpos );
+ m_rborder_timer->adjust( m_screen->time_until_pos( vpos, LBORDER_START + LBORDER_WIDTH + 256 ), vpos );
/* Draw active display */
select_sprites( vpos - vpos_limit );
@@ -536,8 +530,8 @@ void sega315_5124_device::process_line_timer()
}
/* Draw borders */
- m_lborder_timer->adjust( m_screen->time_until_pos( vpos, SEGA315_5124_LBORDER_START ), vpos );
- m_rborder_timer->adjust( m_screen->time_until_pos( vpos, SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 256 ), vpos );
+ m_lborder_timer->adjust( m_screen->time_until_pos( vpos, LBORDER_START ), vpos );
+ m_rborder_timer->adjust( m_screen->time_until_pos( vpos, LBORDER_START + LBORDER_WIDTH + 256 ), vpos );
/* Draw middle of the border */
/* We need to do this through the regular drawing function */
@@ -594,7 +588,7 @@ void sega315_5124_device::check_pending_flags()
remaining time, what could also occur due to the ahead time of the timeslice. */
if (m_pending_flags_timer->remaining() == attotime::zero)
{
- hpos = SEGA315_5124_WIDTH - 1;
+ hpos = WIDTH - 1;
}
else
{
@@ -1606,7 +1600,7 @@ void sega315_5124_device::device_start()
m_display_timer = timer_alloc(TIMER_LINE);
m_display_timer->adjust(m_screen->time_until_pos(0, DISPLAY_CB_HPOS), 0, m_screen->scan_period());
m_pending_flags_timer = timer_alloc(TIMER_FLAGS);
- m_pending_flags_timer->adjust(m_screen->time_until_pos(0, SEGA315_5124_WIDTH - 1), 0, m_screen->scan_period());
+ m_pending_flags_timer->adjust(m_screen->time_until_pos(0, WIDTH - 1), 0, m_screen->scan_period());
m_draw_timer = timer_alloc(TIMER_DRAW);
m_lborder_timer = timer_alloc(TIMER_LBORDER);
m_rborder_timer = timer_alloc(TIMER_RBORDER);
diff --git a/src/devices/video/315_5124.h b/src/devices/video/315_5124.h
index e3ab1f23559..8ca1b734d9f 100644
--- a/src/devices/video/315_5124.h
+++ b/src/devices/video/315_5124.h
@@ -8,8 +8,8 @@
**************************************************************************/
-#ifndef MAME_DEVICES_VIDEO_315_5124_H
-#define MAME_DEVICES_VIDEO_315_5124_H
+#ifndef MAME_VIDEO_315_5124_H
+#define MAME_VIDEO_315_5124_H
#pragma once
@@ -17,45 +17,12 @@
/***************************************************************************
- CONSTANTS
-***************************************************************************/
-
-#define SEGA315_5124_WIDTH 342 /* 342 pixels */
-#define SEGA315_5124_HEIGHT_NTSC 262 /* 262 lines */
-#define SEGA315_5124_HEIGHT_PAL 313 /* 313 lines */
-#define SEGA315_5124_LBORDER_START (9 + 2 + 14 + 8)
-#define SEGA315_5124_LBORDER_WIDTH 13 /* 13 pixels */
-#define SEGA315_5124_RBORDER_WIDTH 15 /* 15 pixels */
-#define SEGA315_5124_TBORDER_START (3 + 13)
-#define SEGA315_5124_NTSC_192_TBORDER_HEIGHT (0x1b) /* 27 lines */
-//#define SEGA315_5124_NTSC_192_BBORDER_HEIGHT (0x18) /* 24 lines */
-#define SEGA315_5124_NTSC_224_TBORDER_HEIGHT (0x0b) /* 11 lines */
-//#define SEGA315_5124_NTSC_224_BBORDER_HEIGHT (0x08) /* 8 lines */
-//#define SEGA315_5124_PAL_192_TBORDER_HEIGHT (0x36) /* 54 lines */
-//#define SEGA315_5124_PAL_192_BBORDER_HEIGHT (0x30) /* 48 lines */
-//#define SEGA315_5124_PAL_224_TBORDER_HEIGHT (0x26) /* 38 lines */
-//#define SEGA315_5124_PAL_224_BBORDER_HEIGHT (0x20) /* 32 lines */
-#define SEGA315_5124_PAL_240_TBORDER_HEIGHT (0x1e) /* 30 lines */
-//#define SEGA315_5124_PAL_240_BBORDER_HEIGHT (0x18) /* 24 lines */
-
-
-#define SEGA315_5124_PALETTE_SIZE (64+16)
-#define SEGA315_5378_PALETTE_SIZE 4096
-
-
-#define SEGA315_5378_CRAM_SIZE 0x40 /* 32 colors x 2 bytes per color = 64 bytes */
-#define SEGA315_5124_CRAM_SIZE 0x20 /* 32 colors x 1 bytes per color = 32 bytes */
-
-#define VRAM_SIZE 0x4000
-
-
-/***************************************************************************
TYPE DEFINITIONS
***************************************************************************/
-extern const device_type SEGA315_5124; /* aka SMS1 vdp */
-extern const device_type SEGA315_5246; /* aka SMS2 vdp */
-extern const device_type SEGA315_5378; /* aka Gamegear vdp */
+DECLARE_DEVICE_TYPE(SEGA315_5124, sega315_5124_device) /* aka SMS1 vdp */
+DECLARE_DEVICE_TYPE(SEGA315_5246, sega315_5246_device) /* aka SMS2 vdp */
+DECLARE_DEVICE_TYPE(SEGA315_5378, sega315_5378_device) /* aka Gamegear vdp */
class sega315_5124_device : public device_t,
@@ -63,17 +30,33 @@ class sega315_5124_device : public device_t,
public device_video_interface
{
public:
+ static constexpr unsigned WIDTH = 342; /* 342 pixels */
+ static constexpr unsigned HEIGHT_NTSC = 262; /* 262 lines */
+ static constexpr unsigned HEIGHT_PAL = 313; /* 313 lines */
+ static constexpr unsigned LBORDER_START = 9 + 2 + 14 + 8;
+ static constexpr unsigned LBORDER_WIDTH = 13; /* 13 pixels */
+ static constexpr unsigned RBORDER_WIDTH = 15; /* 15 pixels */
+ static constexpr unsigned TBORDER_START = 3 + 13;
+ static constexpr unsigned NTSC_192_TBORDER_HEIGHT = 0x1b; /* 27 lines */
+ //static constexpr unsigned NTSC_192_BBORDER_HEIGHT = 0x18; /* 24 lines */
+ static constexpr unsigned NTSC_224_TBORDER_HEIGHT = 0x0b; /* 11 lines */
+ //static constexpr unsigned NTSC_224_BBORDER_HEIGHT = 0x08; /* 8 lines */
+ //static constexpr unsigned PAL_192_TBORDER_HEIGHT = 0x36; /* 54 lines */
+ //static constexpr unsigned PAL_192_BBORDER_HEIGHT = 0x30; /* 48 lines */
+ //static constexpr unsigned PAL_224_TBORDER_HEIGHT = 0x26; /* 38 lines */
+ //static constexpr unsigned PAL_224_BBORDER_HEIGHT = 0x20; /* 32 lines */
+ static constexpr unsigned PAL_240_TBORDER_HEIGHT = 0x1e; /* 30 lines */
+ //static constexpr unsigned PAL_240_BBORDER_HEIGHT = 0x18; /* 24 lines */
+
+
// construction/destruction
sega315_5124_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- sega315_5124_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, uint8_t cram_size, uint8_t palette_offset, bool supports_224_240, const char *shortname, const char *source);
static void set_signal_type(device_t &device, bool is_pal) { downcast<sega315_5124_device &>(device).m_is_pal = is_pal; }
-
-
- template<class _Object> static devcb_base &set_int_callback(device_t &device, _Object object) { return downcast<sega315_5124_device &>(device).m_int_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_csync_callback(device_t &device, _Object object) { return downcast<sega315_5124_device &>(device).m_csync_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_pause_callback(device_t &device, _Object object) { return downcast<sega315_5124_device &>(device).m_pause_cb.set_callback(object); }
+ template <class Object> static devcb_base &set_int_callback(device_t &device, Object &&cb) { return downcast<sega315_5124_device &>(device).m_int_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_csync_callback(device_t &device, Object &&cb) { return downcast<sega315_5124_device &>(device).m_csync_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_pause_callback(device_t &device, Object &&cb) { return downcast<sega315_5124_device &>(device).m_pause_cb.set_callback(std::forward<Object>(cb)); }
DECLARE_READ8_MEMBER( vram_read );
DECLARE_WRITE8_MEMBER( vram_write );
@@ -84,34 +67,24 @@ public:
DECLARE_PALETTE_INIT( sega315_5124 );
- void hcount_latch() { hcount_latch_at_hpos( m_screen->hpos() ); };
- void hcount_latch_at_hpos( int hpos );
+ void hcount_latch() { hcount_latch_at_hpos(m_screen->hpos()); };
+ void hcount_latch_at_hpos(int hpos);
void stop_timers();
bitmap_rgb32 &get_bitmap() { return m_tmpbitmap; };
bitmap_ind8 &get_y1_bitmap() { return m_y1_bitmap; };
/* update the screen */
- uint32_t screen_update( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect );
+ uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
- virtual void set_sega315_5124_compatibility_mode( bool sega315_5124_compatibility_mode ) { };
+ virtual void set_sega315_5124_compatibility_mode(bool sega315_5124_compatibility_mode) { }
protected:
- void set_display_settings();
- void set_frame_timing();
- virtual void update_palette();
- virtual void cram_write(uint8_t data);
- virtual void draw_scanline( int pixel_offset_x, int pixel_plot_y, int line );
- virtual void blit_scanline( int *line_buffer, int *priority_selected, int pixel_offset_x, int pixel_plot_y, int line );
- virtual uint16_t get_name_table_row(int row);
- void process_line_timer();
- void select_sprites( int line );
- void draw_scanline_mode4( int *line_buffer, int *priority_selected, int line );
- void draw_sprites_mode4( int *line_buffer, int *priority_selected, int line );
- void draw_sprites_tms9918_mode( int *line_buffer, int line );
- void draw_scanline_mode2( int *line_buffer, int line );
- void draw_scanline_mode0( int *line_buffer, int line );
- void check_pending_flags();
+ static constexpr unsigned SEGA315_5378_CRAM_SIZE = 0x40; /* 32 colors x 2 bytes per color = 64 bytes */
+ static constexpr unsigned SEGA315_5124_CRAM_SIZE = 0x20; /* 32 colors x 1 bytes per color = 32 bytes */
+
+
+ sega315_5124_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint8_t cram_size, uint8_t palette_offset, bool supports_224_240);
// device-level overrides
virtual void device_start() override;
@@ -119,7 +92,23 @@ protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
virtual machine_config_constructor device_mconfig_additions() const override;
- virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override { return (spacenum == AS_0) ? &m_space_config : nullptr; }
+ virtual const address_space_config *memory_space_config(address_spacenum spacenum) const override { return (spacenum == AS_0) ? &m_space_config : nullptr; }
+
+ void set_display_settings();
+ void set_frame_timing();
+ virtual void update_palette();
+ virtual void cram_write(uint8_t data);
+ virtual void draw_scanline(int pixel_offset_x, int pixel_plot_y, int line);
+ virtual void blit_scanline(int *line_buffer, int *priority_selected, int pixel_offset_x, int pixel_plot_y, int line);
+ virtual uint16_t get_name_table_row(int row);
+ void process_line_timer();
+ void select_sprites(int line);
+ void draw_scanline_mode4(int *line_buffer, int *priority_selected, int line);
+ void draw_sprites_mode4(int *line_buffer, int *priority_selected, int line);
+ void draw_sprites_tms9918_mode(int *line_buffer, int line);
+ void draw_scanline_mode2(int *line_buffer, int line);
+ void draw_scanline_mode0(int *line_buffer, int line);
+ void check_pending_flags();
void vdp_postload();
@@ -130,7 +119,7 @@ protected:
uint8_t m_reg9copy; /* Internal copy of register 9 (Y-Scroll) */
uint8_t m_addrmode; /* Type of VDP action */
uint16_t m_addr; /* Contents of internal VDP address register */
- uint8_t m_cram_size; /* CRAM size */
+ const uint8_t m_cram_size; /* CRAM size */
uint8_t m_cram_mask; /* Mask to switch between SMS and GG CRAM sizes */
int m_cram_dirty; /* Have there been any changes to the CRAM area */
int m_pending_reg_write;
@@ -147,8 +136,8 @@ protected:
const uint8_t *m_frame_timing;
bitmap_rgb32 m_tmpbitmap;
bitmap_ind8 m_y1_bitmap;
- uint8_t m_palette_offset;
- bool m_supports_224_240;
+ const uint8_t m_palette_offset;
+ const bool m_supports_224_240;
bool m_display_disabled;
uint16_t m_sprite_base;
uint16_t m_sprite_pattern_line[8];
@@ -175,14 +164,14 @@ protected:
const address_space_config m_space_config;
/* Timers */
- static const device_timer_id TIMER_LINE = 0;
- static const device_timer_id TIMER_DRAW = 1;
- static const device_timer_id TIMER_LBORDER = 2;
- static const device_timer_id TIMER_RBORDER = 3;
- static const device_timer_id TIMER_HINT = 4;
- static const device_timer_id TIMER_VINT = 5;
- static const device_timer_id TIMER_NMI = 6;
- static const device_timer_id TIMER_FLAGS = 7;
+ static constexpr device_timer_id TIMER_LINE = 0;
+ static constexpr device_timer_id TIMER_DRAW = 1;
+ static constexpr device_timer_id TIMER_LBORDER = 2;
+ static constexpr device_timer_id TIMER_RBORDER = 3;
+ static constexpr device_timer_id TIMER_HINT = 4;
+ static constexpr device_timer_id TIMER_VINT = 5;
+ static constexpr device_timer_id TIMER_NMI = 6;
+ static constexpr device_timer_id TIMER_FLAGS = 7;
required_device<palette_device> m_palette;
};
@@ -205,7 +194,7 @@ public:
DECLARE_PALETTE_INIT( sega315_5378 );
- virtual void set_sega315_5124_compatibility_mode( bool sega315_5124_compatibility_mode ) override;
+ virtual void set_sega315_5124_compatibility_mode(bool sega315_5124_compatibility_mode) override;
protected:
virtual void device_reset() override;
@@ -267,4 +256,4 @@ protected:
devcb = &sega315_5378_device::set_pause_callback(*device, DEVCB_##_devcb);
-#endif // MAME_DEVICES_VIDEO_315_5124_H
+#endif // MAME_VIDEO_315_5124_H
diff --git a/src/devices/video/315_5313.cpp b/src/devices/video/315_5313.cpp
index c6f9e28e456..a8af6681295 100644
--- a/src/devices/video/315_5313.cpp
+++ b/src/devices/video/315_5313.cpp
@@ -9,17 +9,155 @@
#include "sound/sn76496.h"
+
+/* The VDP occupies addresses C00000h to C0001Fh.
+
+ C00000h - Data port (8=r/w, 16=r/w)
+ C00002h - Data port (mirror)
+ C00004h - Control port (8=r/w, 16=r/w)
+ C00006h - Control port (mirror)
+ C00008h - HV counter (8/16=r/o)
+ C0000Ah - HV counter (mirror)
+ C0000Ch - HV counter (mirror)
+ C0000Eh - HV counter (mirror)
+ C00011h - SN76489 PSG (8=w/o)
+ C00013h - SN76489 PSG (mirror)
+ C00015h - SN76489 PSG (mirror)
+ C00017h - SN76489 PSG (mirror)
+*/
+
+#define MEGADRIV_VDP_VRAM(address) m_vram[(address)&0x7fff]
+
+
+
+/*
+
+ $00 - Mode Set Register No. 1
+ -----------------------------
+
+ d7 - No effect
+ d6 - No effect
+ d5 - No effect
+ d4 - IE1 (Horizontal interrupt enable)
+ d3 - 1= Invalid display setting
+ d2 - Palette select
+ d1 - M3 (HV counter latch enable)
+ d0 - Display disable
+
+ */
+
+#define MEGADRIVE_REG0_UNUSED ((m_regs[0x00]&0xc0)>>6)
+#define MEGADRIVE_REG0_BLANK_LEFT ((m_regs[0x00]&0x20)>>5) // like SMS, not used by any commercial games?
+#define MEGADRIVE_REG0_IRQ4_ENABLE ((m_regs[0x00]&0x10)>>4)
+#define MEGADRIVE_REG0_INVALID_MODE ((m_regs[0x00]&0x08)>>3) // invalid display mode, unhandled
+#define MEGADRIVE_REG0_SPECIAL_PAL ((m_regs[0x00]&0x04)>>2) // strange palette mode, unhandled
+#define MEGADRIVE_REG0_HVLATCH_ENABLE ((m_regs[0x00]&0x02)>>1) // HV Latch, used by lightgun games
+#define MEGADRIVE_REG0_DISPLAY_DISABLE ((m_regs[0x00]&0x01)>>0)
+
+/*
+
+ $01 - Mode Set Register No. 2
+ -----------------------------
+
+ d7 - TMS9918 / Genesis display select
+ d6 - DISP (Display Enable)
+ d5 - IE0 (Vertical Interrupt Enable)
+ d4 - M1 (DMA Enable)
+ d3 - M2 (PAL / NTSC)
+ d2 - SMS / Genesis display select
+ d1 - 0 (No effect)
+ d0 - 0 (See notes)
+
+*/
+
+#define MEGADRIVE_REG01_TMS9918_SELECT ((m_regs[0x01]&0x80)>>7)
+#define MEGADRIVE_REG01_DISP_ENABLE ((m_regs[0x01]&0x40)>>6)
+#define MEGADRIVE_REG01_IRQ6_ENABLE ((m_regs[0x01]&0x20)>>5)
+#define MEGADRIVE_REG01_DMA_ENABLE ((m_regs[0x01]&0x10)>>4)
+#define MEGADRIVE_REG01_240_LINE ((m_regs[0x01]&0x08)>>3)
+#define MEGADRIVE_REG01_SMS_SELECT ((m_regs[0x01]&0x04)>>2)
+#define MEGADRIVE_REG01_UNUSED ((m_regs[0x01]&0x02)>>1)
+#define MEGADRIVE_REG01_STRANGE_VIDEO ((m_regs[0x01]&0x01)>>0) // unhandled, does strange things to the display
+
+#define MEGADRIVE_REG02_UNUSED1 ((m_regs[0x02]&0xc0)>>6)
+#define MEGADRIVE_REG02_PATTERN_ADDR_A ((m_regs[0x02]&0x38)>>3)
+#define MEGADRIVE_REG02_UNUSED2 ((m_regs[0x02]&0x07)>>0)
+
+#define MEGADRIVE_REG03_UNUSED1 ((m_regs[0x03]&0xc0)>>6)
+#define MEGADRIVE_REG03_PATTERN_ADDR_W ((m_regs[0x03]&0x3e)>>1)
+#define MEGADRIVE_REG03_UNUSED2 ((m_regs[0x03]&0x01)>>0)
+
+#define MEGADRIVE_REG04_UNUSED ((m_regs[0x04]&0xf8)>>3)
+#define MEGADRIVE_REG04_PATTERN_ADDR_B ((m_regs[0x04]&0x07)>>0)
+
+#define MEGADRIVE_REG05_UNUSED ((m_regs[0x05]&0x80)>>7)
+#define MEGADRIVE_REG05_SPRITE_ADDR ((m_regs[0x05]&0x7f)>>0)
+
+/* 6? */
+
+#define MEGADRIVE_REG07_UNUSED ((m_regs[0x07]&0xc0)>>6)
+#define MEGADRIVE_REG07_BGCOLOUR ((m_regs[0x07]&0x3f)>>0)
+
+/* 8? */
+/* 9? */
+
+#define MEGADRIVE_REG0A_HINT_VALUE ((m_regs[0x0a]&0xff)>>0)
+
+#define MEGADRIVE_REG0B_UNUSED ((m_regs[0x0b]&0xf0)>>4)
+#define MEGADRIVE_REG0B_IRQ2_ENABLE ((m_regs[0x0b]&0x08)>>3)
+#define MEGADRIVE_REG0B_VSCROLL_MODE ((m_regs[0x0b]&0x04)>>2)
+#define MEGADRIVE_REG0B_HSCROLL_MODE ((m_regs[0x0b]&0x03)>>0)
+
+#define MEGADRIVE_REG0C_RS0 ((m_regs[0x0c]&0x80)>>7)
+#define MEGADRIVE_REG0C_UNUSED1 ((m_regs[0x0c]&0x40)>>6)
+#define MEGADRIVE_REG0C_SPECIAL ((m_regs[0x0c]&0x20)>>5)
+#define MEGADRIVE_REG0C_UNUSED2 ((m_regs[0x0c]&0x10)>>4)
+#define MEGADRIVE_REG0C_SHADOW_HIGLIGHT ((m_regs[0x0c]&0x08)>>3)
+#define MEGADRIVE_REG0C_INTERLEAVE ((m_regs[0x0c]&0x06)>>1)
+#define MEGADRIVE_REG0C_RS1 ((m_regs[0x0c]&0x01)>>0)
+
+#define MEGADRIVE_REG0D_UNUSED ((m_regs[0x0d]&0xc0)>>6)
+#define MEGADRIVE_REG0D_HSCROLL_ADDR ((m_regs[0x0d]&0x3f)>>0)
+
+/* e? */
+
+#define MEGADRIVE_REG0F_AUTO_INC ((m_regs[0x0f]&0xff)>>0)
+
+#define MEGADRIVE_REG10_UNUSED1 ((m_regs[0x10]&0xc0)>>6)
+#define MEGADRIVE_REG10_VSCROLL_SIZE ((m_regs[0x10]&0x30)>>4)
+#define MEGADRIVE_REG10_UNUSED2 ((m_regs[0x10]&0x0c)>>2)
+#define MEGADRIVE_REG10_HSCROLL_SIZE ((m_regs[0x10]&0x03)>>0)
+
+#define MEGADRIVE_REG11_WINDOW_RIGHT ((m_regs[0x11]&0x80)>>7)
+#define MEGADRIVE_REG11_UNUSED ((m_regs[0x11]&0x60)>>5)
+#define MEGADRIVE_REG11_WINDOW_HPOS ((m_regs[0x11]&0x1f)>>0)
+
+#define MEGADRIVE_REG12_WINDOW_DOWN ((m_regs[0x12]&0x80)>>7)
+#define MEGADRIVE_REG12_UNUSED ((m_regs[0x12]&0x60)>>5)
+#define MEGADRIVE_REG12_WINDOW_VPOS ((m_regs[0x12]&0x1f)>>0)
+
+#define MEGADRIVE_REG13_DMALENGTH1 ((m_regs[0x13]&0xff)>>0)
+
+#define MEGADRIVE_REG14_DMALENGTH2 ((m_regs[0x14]&0xff)>>0)
+
+#define MEGADRIVE_REG15_DMASOURCE1 ((m_regs[0x15]&0xff)>>0)
+#define MEGADRIVE_REG16_DMASOURCE2 ((m_regs[0x16]&0xff)>>0)
+
+#define MEGADRIVE_REG17_DMASOURCE3 ((m_regs[0x17]&0xff)>>0)
+#define MEGADRIVE_REG17_DMATYPE ((m_regs[0x17]&0xc0)>>6)
+#define MEGADRIVE_REG17_UNUSED ((m_regs[0x17]&0x3f)>>0)
+
+
#define MAX_HPOSITION 480
-const device_type SEGA315_5313 = device_creator<sega315_5313_device>;
+DEFINE_DEVICE_TYPE(SEGA315_5313, sega315_5313_device, "sega315_5313", "Sega 315-5313 Megadrive VDP")
-sega315_5313_device::sega315_5313_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : sega315_5124_device(mconfig, SEGA315_5313, "Sega 315-5313 Megadrive VDP", tag, owner, clock, SEGA315_5124_CRAM_SIZE, 0, true, "sega315_5313", __FILE__), m_render_bitmap(nullptr),
- m_render_line(nullptr), m_render_line_raw(nullptr), m_megadriv_scanline_timer(nullptr),
- m_sndirqline_callback(*this),
- m_lv6irqline_callback(*this),
- m_lv4irqline_callback(*this), m_command_pending(0), m_command_part1(0), m_command_part2(0), m_vdp_code(0), m_vdp_address(0), m_vram_fill_pending(0), m_vram_fill_length(0), m_irq4counter(0),
+sega315_5313_device::sega315_5313_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ sega315_5124_device(mconfig, SEGA315_5313, tag, owner, clock, SEGA315_5124_CRAM_SIZE, 0, true),
+ m_render_bitmap(nullptr), m_render_line(nullptr), m_render_line_raw(nullptr), m_megadriv_scanline_timer(nullptr),
+ m_sndirqline_callback(*this), m_lv6irqline_callback(*this), m_lv4irqline_callback(*this),
+ m_command_pending(0), m_command_part1(0), m_command_part2(0), m_vdp_code(0), m_vdp_address(0), m_vram_fill_pending(0), m_vram_fill_length(0), m_irq4counter(0),
m_imode_odd_frame(0), m_sprite_collision(0), m_irq6_pending(0), m_irq4_pending(0), m_scanline_counter(0), m_vblank_flag(0), m_imode(0), m_visible_scanlines(0), m_irq6_scanline(0),
m_z80irq_scanline(0), m_total_scanlines(0), m_base_total_scanlines(0), m_framerate(0), m_vdp_pal(0), m_use_cram(0),
m_dma_delay(0), m_regs(nullptr), m_vram(nullptr), m_cram(nullptr), m_vsram(nullptr), m_internal_sprite_attribute_table(nullptr), m_irq6_on_timer(nullptr), m_irq4_on_timer(nullptr),
diff --git a/src/devices/video/315_5313.h b/src/devices/video/315_5313.h
index 592c0be54e5..5be1f05d4b6 100644
--- a/src/devices/video/315_5313.h
+++ b/src/devices/video/315_5313.h
@@ -1,6 +1,8 @@
// license:BSD-3-Clause
// copyright-holders:David Haywood
/* Sega Megadrive / Genesis VDP */
+#ifndef MAME_VIDEO_315_5313_H
+#define MAME_VIDEO_315_5313_H
#pragma once
@@ -8,144 +10,6 @@
#include "cpu/m68000/m68000.h"
-/* The VDP occupies addresses C00000h to C0001Fh.
-
- C00000h - Data port (8=r/w, 16=r/w)
- C00002h - Data port (mirror)
- C00004h - Control port (8=r/w, 16=r/w)
- C00006h - Control port (mirror)
- C00008h - HV counter (8/16=r/o)
- C0000Ah - HV counter (mirror)
- C0000Ch - HV counter (mirror)
- C0000Eh - HV counter (mirror)
- C00011h - SN76489 PSG (8=w/o)
- C00013h - SN76489 PSG (mirror)
- C00015h - SN76489 PSG (mirror)
- C00017h - SN76489 PSG (mirror)
-*/
-
-#define MEGADRIV_VDP_VRAM(address) m_vram[(address)&0x7fff]
-
-
-
-/*
-
- $00 - Mode Set Register No. 1
- -----------------------------
-
- d7 - No effect
- d6 - No effect
- d5 - No effect
- d4 - IE1 (Horizontal interrupt enable)
- d3 - 1= Invalid display setting
- d2 - Palette select
- d1 - M3 (HV counter latch enable)
- d0 - Display disable
-
- */
-
-#define MEGADRIVE_REG0_UNUSED ((m_regs[0x00]&0xc0)>>6)
-#define MEGADRIVE_REG0_BLANK_LEFT ((m_regs[0x00]&0x20)>>5) // like SMS, not used by any commercial games?
-#define MEGADRIVE_REG0_IRQ4_ENABLE ((m_regs[0x00]&0x10)>>4)
-#define MEGADRIVE_REG0_INVALID_MODE ((m_regs[0x00]&0x08)>>3) // invalid display mode, unhandled
-#define MEGADRIVE_REG0_SPECIAL_PAL ((m_regs[0x00]&0x04)>>2) // strange palette mode, unhandled
-#define MEGADRIVE_REG0_HVLATCH_ENABLE ((m_regs[0x00]&0x02)>>1) // HV Latch, used by lightgun games
-#define MEGADRIVE_REG0_DISPLAY_DISABLE ((m_regs[0x00]&0x01)>>0)
-
-/*
-
- $01 - Mode Set Register No. 2
- -----------------------------
-
- d7 - TMS9918 / Genesis display select
- d6 - DISP (Display Enable)
- d5 - IE0 (Vertical Interrupt Enable)
- d4 - M1 (DMA Enable)
- d3 - M2 (PAL / NTSC)
- d2 - SMS / Genesis display select
- d1 - 0 (No effect)
- d0 - 0 (See notes)
-
-*/
-
-#define MEGADRIVE_REG01_TMS9918_SELECT ((m_regs[0x01]&0x80)>>7)
-#define MEGADRIVE_REG01_DISP_ENABLE ((m_regs[0x01]&0x40)>>6)
-#define MEGADRIVE_REG01_IRQ6_ENABLE ((m_regs[0x01]&0x20)>>5)
-#define MEGADRIVE_REG01_DMA_ENABLE ((m_regs[0x01]&0x10)>>4)
-#define MEGADRIVE_REG01_240_LINE ((m_regs[0x01]&0x08)>>3)
-#define MEGADRIVE_REG01_SMS_SELECT ((m_regs[0x01]&0x04)>>2)
-#define MEGADRIVE_REG01_UNUSED ((m_regs[0x01]&0x02)>>1)
-#define MEGADRIVE_REG01_STRANGE_VIDEO ((m_regs[0x01]&0x01)>>0) // unhandled, does strange things to the display
-
-#define MEGADRIVE_REG02_UNUSED1 ((m_regs[0x02]&0xc0)>>6)
-#define MEGADRIVE_REG02_PATTERN_ADDR_A ((m_regs[0x02]&0x38)>>3)
-#define MEGADRIVE_REG02_UNUSED2 ((m_regs[0x02]&0x07)>>0)
-
-#define MEGADRIVE_REG03_UNUSED1 ((m_regs[0x03]&0xc0)>>6)
-#define MEGADRIVE_REG03_PATTERN_ADDR_W ((m_regs[0x03]&0x3e)>>1)
-#define MEGADRIVE_REG03_UNUSED2 ((m_regs[0x03]&0x01)>>0)
-
-#define MEGADRIVE_REG04_UNUSED ((m_regs[0x04]&0xf8)>>3)
-#define MEGADRIVE_REG04_PATTERN_ADDR_B ((m_regs[0x04]&0x07)>>0)
-
-#define MEGADRIVE_REG05_UNUSED ((m_regs[0x05]&0x80)>>7)
-#define MEGADRIVE_REG05_SPRITE_ADDR ((m_regs[0x05]&0x7f)>>0)
-
-/* 6? */
-
-#define MEGADRIVE_REG07_UNUSED ((m_regs[0x07]&0xc0)>>6)
-#define MEGADRIVE_REG07_BGCOLOUR ((m_regs[0x07]&0x3f)>>0)
-
-/* 8? */
-/* 9? */
-
-#define MEGADRIVE_REG0A_HINT_VALUE ((m_regs[0x0a]&0xff)>>0)
-
-#define MEGADRIVE_REG0B_UNUSED ((m_regs[0x0b]&0xf0)>>4)
-#define MEGADRIVE_REG0B_IRQ2_ENABLE ((m_regs[0x0b]&0x08)>>3)
-#define MEGADRIVE_REG0B_VSCROLL_MODE ((m_regs[0x0b]&0x04)>>2)
-#define MEGADRIVE_REG0B_HSCROLL_MODE ((m_regs[0x0b]&0x03)>>0)
-
-#define MEGADRIVE_REG0C_RS0 ((m_regs[0x0c]&0x80)>>7)
-#define MEGADRIVE_REG0C_UNUSED1 ((m_regs[0x0c]&0x40)>>6)
-#define MEGADRIVE_REG0C_SPECIAL ((m_regs[0x0c]&0x20)>>5)
-#define MEGADRIVE_REG0C_UNUSED2 ((m_regs[0x0c]&0x10)>>4)
-#define MEGADRIVE_REG0C_SHADOW_HIGLIGHT ((m_regs[0x0c]&0x08)>>3)
-#define MEGADRIVE_REG0C_INTERLEAVE ((m_regs[0x0c]&0x06)>>1)
-#define MEGADRIVE_REG0C_RS1 ((m_regs[0x0c]&0x01)>>0)
-
-#define MEGADRIVE_REG0D_UNUSED ((m_regs[0x0d]&0xc0)>>6)
-#define MEGADRIVE_REG0D_HSCROLL_ADDR ((m_regs[0x0d]&0x3f)>>0)
-
-/* e? */
-
-#define MEGADRIVE_REG0F_AUTO_INC ((m_regs[0x0f]&0xff)>>0)
-
-#define MEGADRIVE_REG10_UNUSED1 ((m_regs[0x10]&0xc0)>>6)
-#define MEGADRIVE_REG10_VSCROLL_SIZE ((m_regs[0x10]&0x30)>>4)
-#define MEGADRIVE_REG10_UNUSED2 ((m_regs[0x10]&0x0c)>>2)
-#define MEGADRIVE_REG10_HSCROLL_SIZE ((m_regs[0x10]&0x03)>>0)
-
-#define MEGADRIVE_REG11_WINDOW_RIGHT ((m_regs[0x11]&0x80)>>7)
-#define MEGADRIVE_REG11_UNUSED ((m_regs[0x11]&0x60)>>5)
-#define MEGADRIVE_REG11_WINDOW_HPOS ((m_regs[0x11]&0x1f)>>0)
-
-#define MEGADRIVE_REG12_WINDOW_DOWN ((m_regs[0x12]&0x80)>>7)
-#define MEGADRIVE_REG12_UNUSED ((m_regs[0x12]&0x60)>>5)
-#define MEGADRIVE_REG12_WINDOW_VPOS ((m_regs[0x12]&0x1f)>>0)
-
-#define MEGADRIVE_REG13_DMALENGTH1 ((m_regs[0x13]&0xff)>>0)
-
-#define MEGADRIVE_REG14_DMALENGTH2 ((m_regs[0x14]&0xff)>>0)
-
-#define MEGADRIVE_REG15_DMASOURCE1 ((m_regs[0x15]&0xff)>>0)
-#define MEGADRIVE_REG16_DMASOURCE2 ((m_regs[0x16]&0xff)>>0)
-
-#define MEGADRIVE_REG17_DMASOURCE3 ((m_regs[0x17]&0xff)>>0)
-#define MEGADRIVE_REG17_DMATYPE ((m_regs[0x17]&0xc0)>>6)
-#define MEGADRIVE_REG17_UNUSED ((m_regs[0x17]&0x3f)>>0)
-
-
#define MCFG_SEGA315_5313_IS_PAL(_bool) \
sega315_5313_device::set_signal_type(*device, _bool);
@@ -175,35 +39,35 @@
// Temporary solution while 32x VDP mixing and scanline interrupting is moved outside MD VDP
-typedef device_delegate<void (int x, uint32_t priority, uint16_t &lineptr)> md_32x_scanline_delegate;
-typedef device_delegate<void (int scanline, int irq6)> md_32x_interrupt_delegate;
-typedef device_delegate<void (int scanline)> md_32x_scanline_helper_delegate;
-
#define MCFG_SEGA315_5313_32X_SCANLINE_CB(_class, _method) \
- sega315_5313_device::set_md_32x_scanline(*device, md_32x_scanline_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
+ sega315_5313_device::set_md_32x_scanline(*device, sega315_5313_device::md_32x_scanline_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
#define MCFG_SEGA315_5313_32X_INTERRUPT_CB(_class, _method) \
- sega315_5313_device::set_md_32x_interrupt(*device, md_32x_interrupt_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
+ sega315_5313_device::set_md_32x_interrupt(*device, sega315_5313_device::md_32x_interrupt_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
#define MCFG_SEGA315_5313_32X_SCANLINE_HELPER_CB(_class, _method) \
- sega315_5313_device::set_md_32x_scanline_helper(*device, md_32x_scanline_helper_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
+ sega315_5313_device::set_md_32x_scanline_helper(*device, sega315_5313_device::md_32x_scanline_helper_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
class sega315_5313_device : public sega315_5124_device
{
public:
+ typedef device_delegate<void (int x, uint32_t priority, uint16_t &lineptr)> md_32x_scanline_delegate;
+ typedef device_delegate<void (int scanline, int irq6)> md_32x_interrupt_delegate;
+ typedef device_delegate<void (int scanline)> md_32x_scanline_helper_delegate;
+
sega315_5313_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- template<class _Object> static devcb_base &set_sndirqline_callback(device_t &device, _Object object) { return downcast<sega315_5313_device &>(device).m_sndirqline_callback.set_callback(object); }
- template<class _Object> static devcb_base &set_lv6irqline_callback(device_t &device, _Object object) { return downcast<sega315_5313_device &>(device).m_lv6irqline_callback.set_callback(object); }
- template<class _Object> static devcb_base &set_lv4irqline_callback(device_t &device, _Object object) { return downcast<sega315_5313_device &>(device).m_lv4irqline_callback.set_callback(object); }
+ template <class Object> static devcb_base &set_sndirqline_callback(device_t &device, Object &&cb) { return downcast<sega315_5313_device &>(device).m_sndirqline_callback.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_lv6irqline_callback(device_t &device, Object &&cb) { return downcast<sega315_5313_device &>(device).m_lv6irqline_callback.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_lv4irqline_callback(device_t &device, Object &&cb) { return downcast<sega315_5313_device &>(device).m_lv4irqline_callback.set_callback(std::forward<Object>(cb)); }
static void set_alt_timing(device_t &device, int use_alt_timing);
static void set_palwrite_base(device_t &device, int palwrite_base);
static void static_set_palette_tag(device_t &device, const char *tag);
- static void set_md_32x_scanline(device_t &device, md_32x_scanline_delegate callback) { downcast<sega315_5313_device &>(device).m_32x_scanline_func = callback; }
- static void set_md_32x_interrupt(device_t &device, md_32x_interrupt_delegate callback) { downcast<sega315_5313_device &>(device).m_32x_interrupt_func = callback; }
- static void set_md_32x_scanline_helper(device_t &device, md_32x_scanline_helper_delegate callback) { downcast<sega315_5313_device &>(device).m_32x_scanline_helper_func = callback; }
+ static void set_md_32x_scanline(device_t &device, md_32x_scanline_delegate &&cb) { downcast<sega315_5313_device &>(device).m_32x_scanline_func = std::move(cb); }
+ static void set_md_32x_interrupt(device_t &device, md_32x_interrupt_delegate &&cb) { downcast<sega315_5313_device &>(device).m_32x_interrupt_func = std::move(cb); }
+ static void set_md_32x_scanline_helper(device_t &device, md_32x_scanline_helper_delegate &&cb) { downcast<sega315_5313_device &>(device).m_32x_scanline_helper_func = std::move(cb); }
int m_use_alt_timing; // use MAME scanline timer instead, render only one scanline to a single line buffer, to be rendered by a partial update call.. experimental
@@ -220,8 +84,8 @@ public:
TIMER_CALLBACK_MEMBER(irq4_on_timer_callback);
void vdp_handle_eof();
void device_reset_old();
- void vdp_clear_irq6_pending(void) { m_irq6_pending = 0; };
- void vdp_clear_irq4_pending(void) { m_irq4_pending = 0; };
+ void vdp_clear_irq6_pending() { m_irq6_pending = 0; };
+ void vdp_clear_irq4_pending() { m_irq4_pending = 0; };
// set some VDP variables at start (shall be moved to a device interface?)
void set_scanline_counter(int scanline) { m_scanline_counter = scanline; }
@@ -234,7 +98,7 @@ public:
int get_imode() { return m_imode; }
- void vdp_clear_bitmap(void)
+ void vdp_clear_bitmap()
{
if (m_render_bitmap)
m_render_bitmap->fill(0);
@@ -265,7 +129,6 @@ protected:
md_32x_scanline_helper_delegate m_32x_scanline_helper_func;
private:
-
int m_command_pending; // 2nd half of command pending..
uint16_t m_command_part1;
uint16_t m_command_part2;
@@ -355,4 +218,6 @@ private:
};
-extern const device_type SEGA315_5313;
+DECLARE_DEVICE_TYPE(SEGA315_5313, sega315_5313_device)
+
+#endif // MAME_VIDEO_315_5313_H
diff --git a/src/devices/video/bufsprite.cpp b/src/devices/video/bufsprite.cpp
index b7cd1302158..1c7180ec8cd 100644
--- a/src/devices/video/bufsprite.cpp
+++ b/src/devices/video/bufsprite.cpp
@@ -17,34 +17,31 @@
//**************************************************************************
// device type definition
-const device_type BUFFERED_SPRITERAM8 = device_creator<buffered_spriteram8_device>;
-const device_type BUFFERED_SPRITERAM16 = device_creator<buffered_spriteram16_device>;
-const device_type BUFFERED_SPRITERAM32 = device_creator<buffered_spriteram32_device>;
-const device_type BUFFERED_SPRITERAM64 = device_creator<buffered_spriteram64_device>;
+DEFINE_DEVICE_TYPE(BUFFERED_SPRITERAM8, buffered_spriteram8_device, "buffered_spriteram8", "Buffered 8-bit Sprite RAM")
+DEFINE_DEVICE_TYPE(BUFFERED_SPRITERAM16, buffered_spriteram16_device, "buffered_spriteram16", "Buffered 16-bit Sprite RAM")
+DEFINE_DEVICE_TYPE(BUFFERED_SPRITERAM32, buffered_spriteram32_device, "buffered_spriteram32", "Buffered 32-bit Sprite RAM")
+DEFINE_DEVICE_TYPE(BUFFERED_SPRITERAM64, buffered_spriteram64_device, "buffered_spriteram64", "Buffered 64-bit Sprite RAM")
-template <typename _Type>
-buffered_spriteram_device<_Type>::buffered_spriteram_device(
+template <typename Type>
+buffered_spriteram_device<Type>::buffered_spriteram_device(
const machine_config &mconfig,
device_type type,
- const char *name,
const char *tag,
device_t *owner,
- uint32_t clock,
- const char *shortname,
- const char *source)
- : device_t(mconfig, type, name, tag, owner, clock, shortname, source)
+ uint32_t clock)
+ : device_t(mconfig, type, tag, owner, clock)
, m_spriteram(*this, DEVICE_SELF)
{
}
-template <typename _Type>
-void buffered_spriteram_device<_Type>::device_start()
+template <typename Type>
+void buffered_spriteram_device<Type>::device_start()
{
- if (m_spriteram != nullptr)
+ if (m_spriteram)
{
- m_buffered.resize(m_spriteram.bytes() / sizeof(_Type));
+ m_buffered.resize(m_spriteram.bytes() / sizeof(Type));
save_item(NAME(m_buffered));
}
}
@@ -52,27 +49,27 @@ void buffered_spriteram_device<_Type>::device_start()
buffered_spriteram8_device::buffered_spriteram8_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : buffered_spriteram_device<u8>(mconfig, BUFFERED_SPRITERAM8, "Buffered 8-bit Sprite RAM", tag, owner, clock, "buffered_spriteram8", __FILE__)
+ : buffered_spriteram_device<u8>(mconfig, BUFFERED_SPRITERAM8, tag, owner, clock)
{
}
buffered_spriteram16_device::buffered_spriteram16_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : buffered_spriteram_device<u16>(mconfig, BUFFERED_SPRITERAM16, "Buffered 16-bit Sprite RAM", tag, owner, clock, "buffered_spriteram16", __FILE__)
+ : buffered_spriteram_device<u16>(mconfig, BUFFERED_SPRITERAM16, tag, owner, clock)
{
}
buffered_spriteram32_device::buffered_spriteram32_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : buffered_spriteram_device<u32>(mconfig, BUFFERED_SPRITERAM32, "Buffered 32-bit Sprite RAM", tag, owner, clock, "buffered_spriteram32", __FILE__)
+ : buffered_spriteram_device<u32>(mconfig, BUFFERED_SPRITERAM32, tag, owner, clock)
{
}
buffered_spriteram64_device::buffered_spriteram64_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : buffered_spriteram_device<u64>(mconfig, BUFFERED_SPRITERAM64, "Buffered 64-bit Sprite RAM", tag, owner, clock, "buffered_spriteram64", __FILE__)
+ : buffered_spriteram_device<u64>(mconfig, BUFFERED_SPRITERAM64, tag, owner, clock)
{
}
diff --git a/src/devices/video/bufsprite.h b/src/devices/video/bufsprite.h
index 2293efef536..995f0894eaf 100644
--- a/src/devices/video/bufsprite.h
+++ b/src/devices/video/bufsprite.h
@@ -8,8 +8,8 @@
*********************************************************************/
-#ifndef MAME_DEVICES_VIDEO_BUFSPRITE_H
-#define MAME_DEVICES_VIDEO_BUFSPRITE_H
+#ifndef MAME_VIDEO_BUFSPRITE_H
+#define MAME_VIDEO_BUFSPRITE_H
#pragma once
@@ -20,10 +20,10 @@
//**************************************************************************
// device type definition
-extern const device_type BUFFERED_SPRITERAM8;
-extern const device_type BUFFERED_SPRITERAM16;
-extern const device_type BUFFERED_SPRITERAM32;
-extern const device_type BUFFERED_SPRITERAM64;
+DECLARE_DEVICE_TYPE(BUFFERED_SPRITERAM8, buffered_spriteram8_device)
+DECLARE_DEVICE_TYPE(BUFFERED_SPRITERAM16, buffered_spriteram16_device)
+DECLARE_DEVICE_TYPE(BUFFERED_SPRITERAM32, buffered_spriteram32_device)
+DECLARE_DEVICE_TYPE(BUFFERED_SPRITERAM64, buffered_spriteram64_device)
@@ -48,50 +48,47 @@ extern const device_type BUFFERED_SPRITERAM64;
// ======================> buffered_spriteram_device
// base class to manage buffered spriteram
-template<typename _Type>
+template <typename Type>
class buffered_spriteram_device : public device_t
{
public:
- // construction
- buffered_spriteram_device(
- const machine_config &mconfig,
- device_type type,
- const char *name,
- const char *tag,
- device_t *owner,
- uint32_t clock,
- const char *shortname,
- const char *source);
-
// getters
- _Type *live() const { return m_spriteram; }
- _Type *buffer() { return &m_buffered[0]; }
+ Type *live() const { return m_spriteram; }
+ Type *buffer() { return &m_buffered[0]; }
uint32_t bytes() const { return m_spriteram.bytes(); }
// operations
- _Type *copy(uint32_t srcoffset = 0, uint32_t srclength = 0x7fffffff)
+ Type *copy(uint32_t srcoffset = 0, uint32_t srclength = 0x7fffffff)
{
assert(m_spriteram != nullptr);
if (m_spriteram != nullptr)
- memcpy(&m_buffered[0], m_spriteram + srcoffset, (std::min<size_t>)(srclength, m_spriteram.bytes() / sizeof(_Type) - srcoffset) * sizeof(_Type));
+ memcpy(&m_buffered[0], m_spriteram + srcoffset, (std::min<size_t>)(srclength, m_spriteram.bytes() / sizeof(Type) - srcoffset) * sizeof(Type));
return &m_buffered[0];
}
// read/write handlers
- void write(address_space &space, offs_t offset, _Type data, _Type mem_mask = ~_Type(0)) { copy(); }
+ void write(address_space &space, offs_t offset, Type data, Type mem_mask = ~Type(0)) { copy(); }
// VBLANK handlers
DECLARE_WRITE_LINE_MEMBER(vblank_copy_rising) { if (state) copy(); }
DECLARE_WRITE_LINE_MEMBER(vblank_copy_falling) { if (!state) copy(); }
protected:
+ // construction
+ buffered_spriteram_device(
+ const machine_config &mconfig,
+ device_type type,
+ const char *tag,
+ device_t *owner,
+ uint32_t clock);
+
// first-time setup
virtual void device_start() override;
private:
// internal state
- required_shared_ptr<_Type> m_spriteram;
- std::vector<_Type> m_buffered;
+ required_shared_ptr<Type> m_spriteram;
+ std::vector<Type> m_buffered;
};
@@ -135,4 +132,4 @@ public:
};
-#endif // MAME_DEVICES_VIDEO_BUFSPRITE_H
+#endif // MAME_VIDEO_BUFSPRITE_H
diff --git a/src/devices/video/cdp1861.cpp b/src/devices/video/cdp1861.cpp
index 9e3723bdfdd..72a4fec46a7 100644
--- a/src/devices/video/cdp1861.cpp
+++ b/src/devices/video/cdp1861.cpp
@@ -15,9 +15,9 @@
// MACROS / CONSTANTS
//**************************************************************************
-#define CDP1861_CYCLES_DMA_START 2*8
-#define CDP1861_CYCLES_DMA_ACTIVE 8*8
-#define CDP1861_CYCLES_DMA_WAIT 6*8
+#define CDP1861_CYCLES_DMA_START (2*8)
+#define CDP1861_CYCLES_DMA_ACTIVE (8*8)
+#define CDP1861_CYCLES_DMA_WAIT (6*8)
@@ -26,7 +26,7 @@
//**************************************************************************
// device type definition
-const device_type CDP1861 = device_creator<cdp1861_device>;
+DEFINE_DEVICE_TYPE(CDP1861, cdp1861_device, "cdp1861", "RCA CDP1861")
@@ -39,7 +39,7 @@ const device_type CDP1861 = device_creator<cdp1861_device>;
//-------------------------------------------------
cdp1861_device::cdp1861_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, CDP1861, "CDP1861", tag, owner, clock, "cdp1861", __FILE__),
+ : device_t(mconfig, CDP1861, tag, owner, clock),
device_video_interface(mconfig, *this),
m_write_irq(*this),
m_write_dma_out(*this),
@@ -85,8 +85,8 @@ void cdp1861_device::device_start()
void cdp1861_device::device_reset()
{
- m_int_timer->adjust(m_screen->time_until_pos(CDP1861_SCANLINE_INT_START, 0));
- m_efx_timer->adjust(m_screen->time_until_pos(CDP1861_SCANLINE_EFX_TOP_START, 0));
+ m_int_timer->adjust(m_screen->time_until_pos(SCANLINE_INT_START, 0));
+ m_efx_timer->adjust(m_screen->time_until_pos(SCANLINE_EFX_TOP_START, 0));
m_dma_timer->adjust(clocks_to_attotime(CDP1861_CYCLES_DMA_START));
m_disp = 0;
@@ -110,14 +110,14 @@ void cdp1861_device::device_timer(emu_timer &timer, device_timer_id id, int para
switch (id)
{
case TIMER_INT:
- if (scanline == CDP1861_SCANLINE_INT_START)
+ if (scanline == SCANLINE_INT_START)
{
if (m_disp)
{
m_write_irq(ASSERT_LINE);
}
- m_int_timer->adjust(m_screen->time_until_pos( CDP1861_SCANLINE_INT_END, 0));
+ m_int_timer->adjust(m_screen->time_until_pos( SCANLINE_INT_END, 0));
}
else
{
@@ -126,31 +126,31 @@ void cdp1861_device::device_timer(emu_timer &timer, device_timer_id id, int para
m_write_irq(CLEAR_LINE);
}
- m_int_timer->adjust(m_screen->time_until_pos(CDP1861_SCANLINE_INT_START, 0));
+ m_int_timer->adjust(m_screen->time_until_pos(SCANLINE_INT_START, 0));
}
break;
case TIMER_EFX:
switch (scanline)
{
- case CDP1861_SCANLINE_EFX_TOP_START:
+ case SCANLINE_EFX_TOP_START:
m_write_efx(ASSERT_LINE);
- m_efx_timer->adjust(m_screen->time_until_pos(CDP1861_SCANLINE_EFX_TOP_END, 0));
+ m_efx_timer->adjust(m_screen->time_until_pos(SCANLINE_EFX_TOP_END, 0));
break;
- case CDP1861_SCANLINE_EFX_TOP_END:
+ case SCANLINE_EFX_TOP_END:
m_write_efx(CLEAR_LINE);
- m_efx_timer->adjust(m_screen->time_until_pos(CDP1861_SCANLINE_EFX_BOTTOM_START, 0));
+ m_efx_timer->adjust(m_screen->time_until_pos(SCANLINE_EFX_BOTTOM_START, 0));
break;
- case CDP1861_SCANLINE_EFX_BOTTOM_START:
+ case SCANLINE_EFX_BOTTOM_START:
m_write_efx(ASSERT_LINE);
- m_efx_timer->adjust(m_screen->time_until_pos(CDP1861_SCANLINE_EFX_BOTTOM_END, 0));
+ m_efx_timer->adjust(m_screen->time_until_pos(SCANLINE_EFX_BOTTOM_END, 0));
break;
- case CDP1861_SCANLINE_EFX_BOTTOM_END:
+ case SCANLINE_EFX_BOTTOM_END:
m_write_efx(CLEAR_LINE);
- m_efx_timer->adjust(m_screen->time_until_pos(CDP1861_SCANLINE_EFX_TOP_START, 0));
+ m_efx_timer->adjust(m_screen->time_until_pos(SCANLINE_EFX_TOP_START, 0));
break;
}
break;
@@ -160,7 +160,7 @@ void cdp1861_device::device_timer(emu_timer &timer, device_timer_id id, int para
{
if (m_disp)
{
- if (scanline >= CDP1861_SCANLINE_DISPLAY_START && scanline < CDP1861_SCANLINE_DISPLAY_END)
+ if (scanline >= SCANLINE_DISPLAY_START && scanline < SCANLINE_DISPLAY_END)
{
m_write_dma_out(CLEAR_LINE);
}
@@ -174,7 +174,7 @@ void cdp1861_device::device_timer(emu_timer &timer, device_timer_id id, int para
{
if (m_disp)
{
- if (scanline >= CDP1861_SCANLINE_DISPLAY_START && scanline < CDP1861_SCANLINE_DISPLAY_END)
+ if (scanline >= SCANLINE_DISPLAY_START && scanline < SCANLINE_DISPLAY_END)
{
m_write_dma_out(ASSERT_LINE);
}
diff --git a/src/devices/video/cdp1861.h b/src/devices/video/cdp1861.h
index c925583d853..41a9609b651 100644
--- a/src/devices/video/cdp1861.h
+++ b/src/devices/video/cdp1861.h
@@ -21,8 +21,8 @@
**********************************************************************/
-#ifndef MAME_DEVICES_VIDEO_CDP1861_H
-#define MAME_DEVICES_VIDEO_CDP1861_H
+#ifndef MAME_VIDEO_CDP1861_H
+#define MAME_VIDEO_CDP1861_H
#pragma once
@@ -30,36 +30,6 @@
//**************************************************************************
-// MACROS / CONSTANTS
-//**************************************************************************
-
-#define CDP1861_VISIBLE_COLUMNS 64
-#define CDP1861_VISIBLE_LINES 128
-
-#define CDP1861_HBLANK_START 14 * 8
-#define CDP1861_HBLANK_END 12
-#define CDP1861_HSYNC_START 0
-#define CDP1861_HSYNC_END 12
-#define CDP1861_SCREEN_WIDTH 14 * 8
-
-#define CDP1861_TOTAL_SCANLINES 262
-
-#define CDP1861_SCANLINE_DISPLAY_START 80
-#define CDP1861_SCANLINE_DISPLAY_END 208
-#define CDP1861_SCANLINE_VBLANK_START 262
-#define CDP1861_SCANLINE_VBLANK_END 16
-#define CDP1861_SCANLINE_VSYNC_START 16
-#define CDP1861_SCANLINE_VSYNC_END 0
-#define CDP1861_SCANLINE_INT_START CDP1861_SCANLINE_DISPLAY_START - 2
-#define CDP1861_SCANLINE_INT_END CDP1861_SCANLINE_DISPLAY_START
-#define CDP1861_SCANLINE_EFX_TOP_START CDP1861_SCANLINE_DISPLAY_START - 4
-#define CDP1861_SCANLINE_EFX_TOP_END CDP1861_SCANLINE_DISPLAY_START
-#define CDP1861_SCANLINE_EFX_BOTTOM_START CDP1861_SCANLINE_DISPLAY_END - 4
-#define CDP1861_SCANLINE_EFX_BOTTOM_END CDP1861_SCANLINE_DISPLAY_END
-
-
-
-//**************************************************************************
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
@@ -77,7 +47,7 @@
MCFG_VIDEO_SET_SCREEN(_tag) \
MCFG_SCREEN_ADD(_tag, RASTER) \
MCFG_SCREEN_UPDATE_DEVICE(_cdptag, cdp1861_device, screen_update) \
- MCFG_SCREEN_RAW_PARAMS(_clock, CDP1861_SCREEN_WIDTH, CDP1861_HBLANK_END, CDP1861_HBLANK_START, CDP1861_TOTAL_SCANLINES, CDP1861_SCANLINE_VBLANK_END, CDP1861_SCANLINE_VBLANK_START)
+ MCFG_SCREEN_RAW_PARAMS(_clock, cdp1861_device::SCREEN_WIDTH, cdp1861_device::HBLANK_END, cdp1861_device::HBLANK_START, cdp1861_device::TOTAL_SCANLINES, cdp1861_device::SCANLINE_VBLANK_END, cdp1861_device::SCANLINE_VBLANK_START)
@@ -91,12 +61,36 @@ class cdp1861_device : public device_t,
public device_video_interface
{
public:
+ static constexpr unsigned VISIBLE_COLUMNS = 64;
+ static constexpr unsigned VISIBLE_LINES = 128;
+
+ static constexpr unsigned HBLANK_START = 14 * 8;
+ static constexpr unsigned HBLANK_END = 12;
+ static constexpr unsigned HSYNC_START = 0;
+ static constexpr unsigned HSYNC_END = 12;
+ static constexpr unsigned SCREEN_WIDTH = 14 * 8;
+
+ static constexpr unsigned TOTAL_SCANLINES = 262;
+
+ static constexpr unsigned SCANLINE_DISPLAY_START = 80;
+ static constexpr unsigned SCANLINE_DISPLAY_END = 208;
+ static constexpr unsigned SCANLINE_VBLANK_START = 262;
+ static constexpr unsigned SCANLINE_VBLANK_END = 16;
+ static constexpr unsigned SCANLINE_VSYNC_START = 16;
+ static constexpr unsigned SCANLINE_VSYNC_END = 0;
+ static constexpr unsigned SCANLINE_INT_START = SCANLINE_DISPLAY_START - 2;
+ static constexpr unsigned SCANLINE_INT_END = SCANLINE_DISPLAY_START;
+ static constexpr unsigned SCANLINE_EFX_TOP_START = SCANLINE_DISPLAY_START - 4;
+ static constexpr unsigned SCANLINE_EFX_TOP_END = SCANLINE_DISPLAY_START;
+ static constexpr unsigned SCANLINE_EFX_BOTTOM_START = SCANLINE_DISPLAY_END - 4;
+ static constexpr unsigned SCANLINE_EFX_BOTTOM_END = SCANLINE_DISPLAY_END;
+
// construction/destruction
cdp1861_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- template<class _Object> static devcb_base &set_irq_wr_callback(device_t &device, _Object object) { return downcast<cdp1861_device &>(device).m_write_irq.set_callback(object); }
- template<class _Object> static devcb_base &set_dma_out_wr_callback(device_t &device, _Object object) { return downcast<cdp1861_device &>(device).m_write_dma_out.set_callback(object); }
- template<class _Object> static devcb_base &set_efx_wr_callback(device_t &device, _Object object) { return downcast<cdp1861_device &>(device).m_write_efx.set_callback(object); }
+ template <class Object> static devcb_base &set_irq_wr_callback(device_t &device, Object &&cb) { return downcast<cdp1861_device &>(device).m_write_irq.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_dma_out_wr_callback(device_t &device, Object &&cb) { return downcast<cdp1861_device &>(device).m_write_dma_out.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_efx_wr_callback(device_t &device, Object &&cb) { return downcast<cdp1861_device &>(device).m_write_efx.set_callback(std::forward<Object>(cb)); }
DECLARE_WRITE8_MEMBER( dma_w );
DECLARE_WRITE_LINE_MEMBER( disp_on_w );
@@ -137,7 +131,6 @@ private:
// device type definition
-extern const device_type CDP1861;
-
+DECLARE_DEVICE_TYPE(CDP1861, cdp1861_device)
-#endif // MAME_DEVICES_VIDEO_CDP1861_H
+#endif // MAME_VIDEO_CDP1861_H
diff --git a/src/devices/video/cdp1862.cpp b/src/devices/video/cdp1862.cpp
index 4d7525195c0..498bb4a8584 100644
--- a/src/devices/video/cdp1862.cpp
+++ b/src/devices/video/cdp1862.cpp
@@ -17,7 +17,7 @@
// MACROS / CONSTANTS
//**************************************************************************
-static const int CDP1862_BACKGROUND_COLOR_SEQUENCE[] = { 2, 0, 1, 4 };
+static constexpr int CDP1862_BACKGROUND_COLOR_SEQUENCE[] = { 2, 0, 1, 4 };
@@ -26,7 +26,7 @@ static const int CDP1862_BACKGROUND_COLOR_SEQUENCE[] = { 2, 0, 1, 4 };
//**************************************************************************
// device type definition
-const device_type CDP1862 = device_creator<cdp1862_device>;
+DEFINE_DEVICE_TYPE(CDP1862, cdp1862_device, "cdp1862", "RCA CDP1862")
@@ -79,7 +79,7 @@ inline void cdp1862_device::initialize_palette()
//-------------------------------------------------
cdp1862_device::cdp1862_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, CDP1862, "CDP1862", tag, owner, clock, "cdp1862", __FILE__),
+ : device_t(mconfig, CDP1862, tag, owner, clock),
device_video_interface(mconfig, *this),
m_read_rd(*this),
m_read_bd(*this),
diff --git a/src/devices/video/cdp1862.h b/src/devices/video/cdp1862.h
index c93cf05c2c5..d0699565f6b 100644
--- a/src/devices/video/cdp1862.h
+++ b/src/devices/video/cdp1862.h
@@ -21,10 +21,10 @@
**********************************************************************/
-#pragma once
+#ifndef MAME_VIDEO_CDP1862_H
+#define MAME_VIDEO_CDP1862_H
-#ifndef __CDP1862__
-#define __CDP1862__
+#pragma once
@@ -71,9 +71,9 @@ public:
// construction/destruction
cdp1862_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- template<class _Object> static devcb_base &set_rd_rd_callback(device_t &device, _Object object) { return downcast<cdp1862_device &>(device).m_read_rd.set_callback(object); }
- template<class _Object> static devcb_base &set_bd_rd_callback(device_t &device, _Object object) { return downcast<cdp1862_device &>(device).m_read_bd.set_callback(object); }
- template<class _Object> static devcb_base &set_gd_rd_callback(device_t &device, _Object object) { return downcast<cdp1862_device &>(device).m_read_gd.set_callback(object); }
+ template <class Object> static devcb_base &set_rd_rd_callback(device_t &device, Object &&cb) { return downcast<cdp1862_device &>(device).m_read_rd.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_bd_rd_callback(device_t &device, Object &&cb) { return downcast<cdp1862_device &>(device).m_read_bd.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_gd_rd_callback(device_t &device, Object &&cb) { return downcast<cdp1862_device &>(device).m_read_gd.set_callback(std::forward<Object>(cb)); }
static void static_set_luminance(device_t &device, double r, double b, double g, double bkg) { downcast<cdp1862_device &>(device).m_lum_r = r; downcast<cdp1862_device &>(device).m_lum_b = b; downcast<cdp1862_device &>(device).m_lum_g = g; downcast<cdp1862_device &>(device).m_lum_bkg = bkg; }
static void static_set_chrominance(device_t &device, double r, double b, double g, double bkg) { downcast<cdp1862_device &>(device).m_chr_r = r; downcast<cdp1862_device &>(device).m_chr_b = b; downcast<cdp1862_device &>(device).m_chr_g = g; downcast<cdp1862_device &>(device).m_chr_bkg = bkg; }
@@ -115,8 +115,6 @@ private:
// device type definition
-extern const device_type CDP1862;
-
-
+DECLARE_DEVICE_TYPE(CDP1862, cdp1862_device)
-#endif
+#endif // MAME_VIDEO_CDP1862_H
diff --git a/src/devices/video/cesblit.cpp b/src/devices/video/cesblit.cpp
index 88d98f5ea84..e25b4cb56c5 100644
--- a/src/devices/video/cesblit.cpp
+++ b/src/devices/video/cesblit.cpp
@@ -60,7 +60,7 @@
***************************************************************************/
// device type definition
-const device_type CESBLIT = device_creator<cesblit_device>;
+DEFINE_DEVICE_TYPE(CESBLIT, cesblit_device, "cesblit", "CES Blitter FPGA")
/***************************************************************************
LIVE DEVICE
@@ -71,12 +71,13 @@ const device_type CESBLIT = device_creator<cesblit_device>;
//-------------------------------------------------
cesblit_device::cesblit_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, CESBLIT, "CES Blitter FPGA", tag, owner, clock, "cesblit", __FILE__),
+ device_t(mconfig, CESBLIT, tag, owner, clock),
device_video_interface(mconfig, *this),
device_memory_interface(mconfig, *this),
- m_space_config("blitter_space", ENDIANNESS_BIG, 16,23),
+ m_space_config("blitter_space", ENDIANNESS_BIG, 16, 23),
m_blit_irq_cb(*this)
-{ }
+{
+}
//-------------------------------------------------
// device_start - device-specific startup
diff --git a/src/devices/video/cesblit.h b/src/devices/video/cesblit.h
index 24aa79f3a70..93b0598c830 100644
--- a/src/devices/video/cesblit.h
+++ b/src/devices/video/cesblit.h
@@ -6,10 +6,10 @@
***************************************************************************/
-#pragma once
+#ifndef MAME_VIDEO_CESBLIT_H
+#define MAME_VIDEO_CESBLIT_H
-#ifndef CESBLIT_H
-#define CESBLIT_H
+#pragma once
/***************************************************************************
INTERFACE CONFIGURATION MACROS
@@ -46,7 +46,7 @@ public:
// static configuration
void set_compute_addr(compute_addr_t compute_addr) { m_compute_addr = compute_addr; }
static void static_set_compute_addr(device_t &device, compute_addr_t compute_addr) { downcast<cesblit_device &>(device).set_compute_addr(compute_addr); }
- template<class _Object> static devcb_base &static_set_irq_callback(device_t &device, _Object object) { return downcast<cesblit_device &>(device).m_blit_irq_cb.set_callback(object); }
+ template <class Object> static devcb_base &static_set_irq_callback(device_t &device, Object &&cb) { return downcast<cesblit_device &>(device).m_blit_irq_cb.set_callback(std::forward<Object>(cb)); }
DECLARE_WRITE16_MEMBER(color_w);
DECLARE_WRITE16_MEMBER(addr_hi_w);
@@ -59,7 +59,7 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_stop() override;
- virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_PROGRAM) const override { return (spacenum == AS_PROGRAM) ? &m_space_config: nullptr; }
+ virtual const address_space_config *memory_space_config(address_spacenum spacenum) const override { return (spacenum == AS_PROGRAM) ? &m_space_config : nullptr; }
void do_blit();
@@ -80,6 +80,6 @@ protected:
***************************************************************************/
// device type definition
-extern const device_type CESBLIT;
+DECLARE_DEVICE_TYPE(CESBLIT, cesblit_device)
-#endif
+#endif // MAME_VIDEO_CESBLIT_H
diff --git a/src/devices/video/cgapal.h b/src/devices/video/cgapal.h
index c5dfafd636e..15c282be953 100644
--- a/src/devices/video/cgapal.h
+++ b/src/devices/video/cgapal.h
@@ -1,5 +1,11 @@
// license:BSD-3-Clause
// copyright-holders:Wilbert Pol
-#define CGA_PALETTE_SETS 83 /* one for colour, one for mono,
- * 81 for colour composite */
+#ifndef MAME_VIDEO_CGAPAL_H
+#define MAME_VIDEO_CGAPAL_H
+
+#pragma once
+
+static constexpr unsigned CGA_PALETTE_SETS = 83; // one for colour, one for mono, 81 for colour composite
extern const unsigned char cga_palette[16 * CGA_PALETTE_SETS][3];
+
+#endif // MAME_VIDEO_CGAPAL_H
diff --git a/src/devices/video/clgd542x.cpp b/src/devices/video/clgd542x.cpp
index bcb36beef49..e14f268d18b 100644
--- a/src/devices/video/clgd542x.cpp
+++ b/src/devices/video/clgd542x.cpp
@@ -41,22 +41,22 @@
#define TEXT_COPY_9COLUMN(ch) (((ch & 0xe0) == 0xc0)&&(vga.attribute.data[0x10]&4))
-const device_type CIRRUS_GD5428 = device_creator<cirrus_gd5428_device>;
-const device_type CIRRUS_GD5430 = device_creator<cirrus_gd5430_device>;
+DEFINE_DEVICE_TYPE(CIRRUS_GD5428, cirrus_gd5428_device, "clgd5428", "Cirrus Logic GD5428")
+DEFINE_DEVICE_TYPE(CIRRUS_GD5430, cirrus_gd5430_device, "clgd5430", "Cirrus Logic GD5430")
cirrus_gd5428_device::cirrus_gd5428_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : cirrus_gd5428_device(mconfig, CIRRUS_GD5428, "Cirrus Logic GD5428", tag, owner, clock, "clgd5428", __FILE__)
+ : cirrus_gd5428_device(mconfig, CIRRUS_GD5428, tag, owner, clock)
{
}
-cirrus_gd5428_device::cirrus_gd5428_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source)
- : svga_device(mconfig, type, name, tag, owner, clock, shortname, source)
+cirrus_gd5428_device::cirrus_gd5428_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
+ : svga_device(mconfig, type, tag, owner, clock)
{
}
cirrus_gd5430_device::cirrus_gd5430_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : cirrus_gd5428_device(mconfig, CIRRUS_GD5430, "Cirrus Logic GD5430", tag, owner, clock, "clgd5430", __FILE__)
+ : cirrus_gd5428_device(mconfig, CIRRUS_GD5430, tag, owner, clock)
{
}
diff --git a/src/devices/video/clgd542x.h b/src/devices/video/clgd542x.h
index 1579c2a0c0b..9bfffe8a15e 100644
--- a/src/devices/video/clgd542x.h
+++ b/src/devices/video/clgd542x.h
@@ -5,6 +5,10 @@
Cirrus Logic GD542x/3x video chipsets
*/
+#ifndef MAME_VIDEO_CLGD542X_H
+#define MAME_VIDEO_CLGD542X_H
+
+#pragma once
#include "video/pc_vga.h"
@@ -16,7 +20,7 @@ class cirrus_gd5428_device : public svga_device
public:
// construction/destruction
cirrus_gd5428_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- cirrus_gd5428_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source);
+
virtual READ8_MEMBER(port_03c0_r) override;
virtual WRITE8_MEMBER(port_03c0_w) override;
virtual READ8_MEMBER(port_03b0_r) override;
@@ -27,7 +31,10 @@ public:
virtual WRITE8_MEMBER(mem_w) override;
virtual uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) override;
+
protected:
+ cirrus_gd5428_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
+
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
@@ -83,6 +90,7 @@ protected:
uint8_t m_vclk_denom[4];
inline uint8_t cirrus_vga_latch_write(int offs, uint8_t data);
+
private:
void cirrus_define_video_mode();
uint8_t cirrus_seq_reg_read(uint8_t index);
@@ -104,10 +112,13 @@ class cirrus_gd5430_device : public cirrus_gd5428_device
{
public:
cirrus_gd5430_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
protected:
virtual void device_start() override;
};
// device type definition
-extern const device_type CIRRUS_GD5428;
-extern const device_type CIRRUS_GD5430;
+DECLARE_DEVICE_TYPE(CIRRUS_GD5428, cirrus_gd5428_device)
+DECLARE_DEVICE_TYPE(CIRRUS_GD5430, cirrus_gd5430_device)
+
+#endif // MAME_VIDEO_CLGD542X_H
diff --git a/src/devices/video/crt9007.cpp b/src/devices/video/crt9007.cpp
index 90eb521ffc2..bf018d821f7 100644
--- a/src/devices/video/crt9007.cpp
+++ b/src/devices/video/crt9007.cpp
@@ -36,13 +36,16 @@
#include "screen.h"
+//#define VERBOSE 1
+#include "logmacro.h"
+
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
-const device_type CRT9007 = device_creator<crt9007_t>;
+DEFINE_DEVICE_TYPE(CRT9007, crt9007_device, "crt9007", "SMC SRT9007 VPAC")
@@ -50,8 +53,6 @@ const device_type CRT9007 = device_creator<crt9007_t>;
// MACROS / CONSTANTS
//**************************************************************************
-#define LOG 0
-
#define HAS_VALID_PARAMETERS \
(m_reg[0x00] && m_reg[0x01] && m_reg[0x07] && m_reg[0x08] && m_reg[0x09])
@@ -221,7 +222,7 @@ const int STATUS_LIGHT_PEN_UPDATE = 0x20;
//**************************************************************************
// default address map
-static ADDRESS_MAP_START( crt9007, AS_0, 8, crt9007_t )
+static ADDRESS_MAP_START( crt9007, AS_0, 8, crt9007_device )
AM_RANGE(0x0000, 0x3fff) AM_RAM
ADDRESS_MAP_END
@@ -235,7 +236,7 @@ ADDRESS_MAP_END
// readbyte - read a byte at the given address
//-------------------------------------------------
-inline uint8_t crt9007_t::readbyte(offs_t address)
+inline uint8_t crt9007_device::readbyte(offs_t address)
{
return space().read_byte(address);
}
@@ -245,7 +246,7 @@ inline uint8_t crt9007_t::readbyte(offs_t address)
// trigger_interrupt -
//-------------------------------------------------
-inline void crt9007_t::trigger_interrupt(int line)
+inline void crt9007_device::trigger_interrupt(int line)
{
if (INTERRUPT_ENABLE & line)
{
@@ -255,7 +256,7 @@ inline void crt9007_t::trigger_interrupt(int line)
if (!(status & STATUS_INTERRUPT_PENDING))
{
- if (LOG) logerror("CRT9007 '%s' INT 1\n", tag());
+ LOG("CRT9007 INT 1\n");
m_write_int(ASSERT_LINE);
}
}
@@ -266,7 +267,7 @@ inline void crt9007_t::trigger_interrupt(int line)
// update_cblank_line -
//-------------------------------------------------
-inline void crt9007_t::update_cblank_line()
+inline void crt9007_device::update_cblank_line()
{
int x = m_screen->hpos();
int y = m_screen->vpos();
@@ -278,7 +279,7 @@ inline void crt9007_t::update_cblank_line()
{
m_cblank = cblank;
- if (LOG) logerror("CRT9007 '%s' y %03u x %04u : CBLANK %u\n", tag(), y, x, m_cblank);
+ LOG("CRT9007 y %03u x %04u : CBLANK %u\n", y, x, m_cblank);
m_write_cblank(m_cblank);
}
@@ -289,7 +290,7 @@ inline void crt9007_t::update_cblank_line()
// update_hsync_timer -
//-------------------------------------------------
-inline void crt9007_t::update_hsync_timer(int state)
+inline void crt9007_device::update_hsync_timer(int state)
{
int y = m_screen->vpos();
@@ -306,7 +307,7 @@ inline void crt9007_t::update_hsync_timer(int state)
// update_vsync_timer -
//-------------------------------------------------
-inline void crt9007_t::update_vsync_timer(int state)
+inline void crt9007_device::update_vsync_timer(int state)
{
int next_y = state ? m_vsync_start : m_vsync_end;
@@ -320,7 +321,7 @@ inline void crt9007_t::update_vsync_timer(int state)
// update_vlt_timer -
//-------------------------------------------------
-inline void crt9007_t::update_vlt_timer(int state)
+inline void crt9007_device::update_vlt_timer(int state)
{
// this signal is active during all visible scan lines and during the horizontal trace at vertical retrace
int y = m_screen->vpos();
@@ -338,7 +339,7 @@ inline void crt9007_t::update_vlt_timer(int state)
// update_curs_timer -
//-------------------------------------------------
-inline void crt9007_t::update_curs_timer(int state)
+inline void crt9007_device::update_curs_timer(int state)
{
// this signal is active for 1 character time for all scanlines within the data row
// TODO
@@ -349,7 +350,7 @@ inline void crt9007_t::update_curs_timer(int state)
// update_drb_timer -
//-------------------------------------------------
-inline void crt9007_t::update_drb_timer(int state)
+inline void crt9007_device::update_drb_timer(int state)
{
// this signal is active for 1 full scan line (VLT edge to edge) at the top scan line of each new row
// there is 1 extra DRB signal during the 1st scanline of the vertical retrace interval
@@ -385,7 +386,7 @@ inline void crt9007_t::update_drb_timer(int state)
// update_dma_timer -
//-------------------------------------------------
-inline void crt9007_t::update_dma_timer()
+inline void crt9007_device::update_dma_timer()
{
// TODO
}
@@ -395,7 +396,7 @@ inline void crt9007_t::update_dma_timer()
// recompute_parameters -
//-------------------------------------------------
-inline void crt9007_t::recompute_parameters()
+inline void crt9007_device::recompute_parameters()
{
// check that necessary registers have been loaded
if (!HAS_VALID_PARAMETERS) return;
@@ -428,11 +429,8 @@ inline void crt9007_t::recompute_parameters()
//visarea.set(m_hsync_end, horiz_pix_total - 1, m_vsync_end, vert_pix_total - 1);
- //if (LOG)
- //{
- // logerror("CRT9007 '%s' Screen: %u x %u @ %f Hz\n", tag(), horiz_pix_total, vert_pix_total, 1 / ATTOSECONDS_TO_DOUBLE(refresh));
- // logerror("CRT9007 '%s' Visible Area: (%u, %u) - (%u, %u)\n", tag(), visarea.min_x, visarea.min_y, visarea.max_x, visarea.max_y);
- //}
+ //LOG("CRT9007 Screen: %u x %u @ %f Hz\n", horiz_pix_total, vert_pix_total, 1 / ATTOSECONDS_TO_DOUBLE(refresh));
+ //LOG("CRT9007 Visible Area: (%u, %u) - (%u, %u)\n", visarea.min_x, visarea.min_y, visarea.max_x, visarea.max_y);
//m_screen->configure(horiz_pix_total, vert_pix_total, visarea, refresh);
@@ -448,11 +446,11 @@ inline void crt9007_t::recompute_parameters()
//**************************************************************************
//-------------------------------------------------
-// crt9007_t - constructor
+// crt9007_device - constructor
//-------------------------------------------------
-crt9007_t::crt9007_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, CRT9007, "SMC CRT9007", tag, owner, clock, "crt9007", __FILE__),
+crt9007_device::crt9007_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ device_t(mconfig, CRT9007, tag, owner, clock),
device_memory_interface(mconfig, *this),
device_video_interface(mconfig, *this),
m_space_config("videoram", ENDIANNESS_LITTLE, 8, 14, 0, nullptr, *ADDRESS_MAP_NAME(crt9007)),
@@ -477,7 +475,7 @@ crt9007_t::crt9007_t(const machine_config &mconfig, const char *tag, device_t *o
// device_start - device-specific startup
//-------------------------------------------------
-void crt9007_t::device_start()
+void crt9007_device::device_start()
{
// allocate timers
m_hsync_timer = timer_alloc(TIMER_HSYNC);
@@ -506,7 +504,7 @@ void crt9007_t::device_start()
// device_reset - device-specific reset
//-------------------------------------------------
-void crt9007_t::device_reset()
+void crt9007_device::device_reset()
{
m_disp = 0;
m_vs = 0;
@@ -553,7 +551,7 @@ void crt9007_t::device_reset()
// device_clock_changed - handle clock change
//-------------------------------------------------
-void crt9007_t::device_clock_changed()
+void crt9007_device::device_clock_changed()
{
recompute_parameters();
}
@@ -563,7 +561,7 @@ void crt9007_t::device_clock_changed()
// device_timer - handle timer events
//-------------------------------------------------
-void crt9007_t::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
+void crt9007_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
int x = m_screen->hpos();
int y = m_screen->vpos();
@@ -573,7 +571,7 @@ void crt9007_t::device_timer(emu_timer &timer, device_timer_id id, int param, vo
case TIMER_HSYNC:
m_hs = param;
- if (LOG) logerror("CRT9007 '%s' y %03u x %04u : HS %u\n", tag(), y, x, m_hs);
+ LOG("CRT9007 y %03u x %04u : HS %u\n", y, x, m_hs);
m_write_hs(m_hs);
@@ -585,7 +583,7 @@ void crt9007_t::device_timer(emu_timer &timer, device_timer_id id, int param, vo
case TIMER_VSYNC:
m_vs = param;
- if (LOG) logerror("CRT9007 '%s' y %03u x %04u : VS %u\n", tag(), y, x, m_vs);
+ LOG("CRT9007 y %03u x %04u : VS %u\n", y, x, m_vs);
m_write_vs(param);
@@ -607,7 +605,7 @@ void crt9007_t::device_timer(emu_timer &timer, device_timer_id id, int param, vo
case TIMER_VLT:
m_vlt = param;
- if (LOG) logerror("CRT9007 '%s' y %03u x %04u : VLT %u\n", tag(), y, x, m_vlt);
+ LOG("CRT9007 y %03u x %04u : VLT %u\n", y, x, m_vlt);
m_write_vlt(param);
@@ -615,7 +613,7 @@ void crt9007_t::device_timer(emu_timer &timer, device_timer_id id, int param, vo
break;
case TIMER_CURS:
- if (LOG) logerror("CRT9007 '%s' y %03u x %04u : CURS %u\n", tag(), y, x, param);
+ LOG("CRT9007 y %03u x %04u : CURS %u\n", y, x, param);
m_write_curs(param);
@@ -625,7 +623,7 @@ void crt9007_t::device_timer(emu_timer &timer, device_timer_id id, int param, vo
case TIMER_DRB:
m_drb = param;
- if (LOG) logerror("CRT9007 '%s' y %03u x %04u : DRB %u\n", tag(), y, x, m_drb);
+ LOG("CRT9007 y %03u x %04u : DRB %u\n", y, x, m_drb);
m_write_drb(param);
@@ -637,7 +635,7 @@ void crt9007_t::device_timer(emu_timer &timer, device_timer_id id, int param, vo
m_dma_delay = DMA_BURST_DELAY;
m_dmar = 1;
- if (LOG) logerror("CRT9007 '%s' DMAR 1\n", tag());
+ LOG("CRT9007 DMAR 1\n");
m_write_dmar(ASSERT_LINE);
}
@@ -658,7 +656,7 @@ void crt9007_t::device_timer(emu_timer &timer, device_timer_id id, int param, vo
// any address spaces owned by this device
//-------------------------------------------------
-const address_space_config *crt9007_t::memory_space_config(address_spacenum spacenum) const
+const address_space_config *crt9007_device::memory_space_config(address_spacenum spacenum) const
{
return (spacenum == AS_0) ? &m_space_config : nullptr;
}
@@ -668,19 +666,19 @@ const address_space_config *crt9007_t::memory_space_config(address_spacenum spac
// read - register read
//-------------------------------------------------
-READ8_MEMBER( crt9007_t::read )
+READ8_MEMBER( crt9007_device::read )
{
uint8_t data = 0;
switch (offset)
{
case 0x15:
- if (LOG) logerror("CRT9007 '%s' Start\n", tag());
+ LOG("CRT9007 Start\n");
m_disp = 1;
break;
case 0x16:
- if (LOG) logerror("CRT9007 '%s' Reset\n", tag());
+ LOG("CRT9007 Reset\n");
device_reset();
break;
@@ -697,7 +695,7 @@ READ8_MEMBER( crt9007_t::read )
// reset interrupt pending bit
m_status &= ~STATUS_INTERRUPT_PENDING;
- if (LOG) logerror("CRT9007 '%s' INT 0\n", tag());
+ LOG("CRT9007 INT 0\n");
m_write_int(CLEAR_LINE);
break;
@@ -713,7 +711,7 @@ READ8_MEMBER( crt9007_t::read )
break;
default:
- logerror("CRT9007 '%s' Read from Invalid Register: %02x!\n", tag(), offset);
+ logerror("CRT9007 Read from Invalid Register: %02x!\n", offset);
}
return data;
@@ -724,7 +722,7 @@ READ8_MEMBER( crt9007_t::read )
// write - register write
//-------------------------------------------------
-WRITE8_MEMBER( crt9007_t::write )
+WRITE8_MEMBER( crt9007_device::write )
{
m_reg[offset] = data;
@@ -732,160 +730,136 @@ WRITE8_MEMBER( crt9007_t::write )
{
case 0x00:
recompute_parameters();
- if (LOG) logerror("CRT9007 '%s' Characters per Horizontal Period: %u\n", tag(), CHARACTERS_PER_HORIZONTAL_PERIOD);
+ LOG("CRT9007 Characters per Horizontal Period: %u\n", CHARACTERS_PER_HORIZONTAL_PERIOD);
break;
case 0x01:
recompute_parameters();
- if (LOG) logerror("CRT9007 '%s' Characters per Data Row: %u\n", tag(), CHARACTERS_PER_DATA_ROW);
+ LOG("CRT9007 Characters per Data Row: %u\n", CHARACTERS_PER_DATA_ROW);
break;
case 0x02:
recompute_parameters();
- if (LOG) logerror("CRT9007 '%s' Horizontal Delay: %u\n", tag(), HORIZONTAL_DELAY);
+ LOG("CRT9007 Horizontal Delay: %u\n", HORIZONTAL_DELAY);
break;
case 0x03:
recompute_parameters();
- if (LOG) logerror("CRT9007 '%s' Horizontal Sync Width: %u\n", tag(), HORIZONTAL_SYNC_WIDTH);
+ LOG("CRT9007 Horizontal Sync Width: %u\n", HORIZONTAL_SYNC_WIDTH);
break;
case 0x04:
recompute_parameters();
- if (LOG) logerror("CRT9007 '%s' Vertical Sync Width: %u\n", tag(), VERTICAL_SYNC_WIDTH);
+ LOG("CRT9007 Vertical Sync Width: %u\n", VERTICAL_SYNC_WIDTH);
break;
case 0x05:
recompute_parameters();
- if (LOG) logerror("CRT9007 '%s' Vertical Delay: %u\n", tag(), VERTICAL_DELAY);
+ LOG("CRT9007 Vertical Delay: %u\n", VERTICAL_DELAY);
break;
case 0x06:
recompute_parameters();
- if (LOG)
- {
- logerror("CRT9007 '%s' Pin Configuration: %u\n", tag(), PIN_CONFIGURATION);
- logerror("CRT9007 '%s' Cursor Skew: %u\n", tag(), CURSOR_SKEW);
- logerror("CRT9007 '%s' Blank Skew: %u\n", tag(), BLANK_SKEW);
- }
+ LOG("CRT9007 Pin Configuration: %u\n", PIN_CONFIGURATION);
+ LOG("CRT9007 Cursor Skew: %u\n", CURSOR_SKEW);
+ LOG("CRT9007 Blank Skew: %u\n", BLANK_SKEW);
break;
case 0x07:
recompute_parameters();
- if (LOG) logerror("CRT9007 '%s' Visible Data Rows per Frame: %u\n", tag(), VISIBLE_DATA_ROWS_PER_FRAME);
+ LOG("CRT9007 Visible Data Rows per Frame: %u\n", VISIBLE_DATA_ROWS_PER_FRAME);
break;
case 0x08:
recompute_parameters();
- if (LOG) logerror("CRT9007 '%s' Scan Lines per Data Row: %u\n", tag(), SCAN_LINES_PER_DATA_ROW);
+ LOG("CRT9007 Scan Lines per Data Row: %u\n", SCAN_LINES_PER_DATA_ROW);
break;
case 0x09:
recompute_parameters();
- if (LOG) logerror("CRT9007 '%s' Scan Lines per Frame: %u\n", tag(), SCAN_LINES_PER_FRAME);
+ LOG("CRT9007 Scan Lines per Frame: %u\n", SCAN_LINES_PER_FRAME);
break;
case 0x0a:
- if (LOG)
- {
- logerror("CRT9007 '%s' DMA Burst Count: %u\n", tag(), DMA_BURST_COUNT);
- logerror("CRT9007 '%s' DMA Burst Delay: %u\n", tag(), DMA_BURST_DELAY);
- logerror("CRT9007 '%s' DMA Disable: %u\n", tag(), DMA_DISABLE);
- }
+ LOG("CRT9007 DMA Burst Count: %u\n", DMA_BURST_COUNT);
+ LOG("CRT9007 DMA Burst Delay: %u\n", DMA_BURST_DELAY);
+ LOG("CRT9007 DMA Disable: %u\n", DMA_DISABLE);
break;
case 0x0b:
- if (LOG)
- {
- logerror("CRT9007 '%s' %s Height Cursor\n", tag(), SINGLE_HEIGHT_CURSOR ? "Single" : "Double");
- logerror("CRT9007 '%s' Operation Mode: %u\n", tag(), OPERATION_MODE);
- logerror("CRT9007 '%s' Interlace Mode: %u\n", tag(), INTERLACE_MODE);
- logerror("CRT9007 '%s' %s Mechanism\n", tag(), PAGE_BLANK ? "Page Blank" : "Smooth Scroll");
- }
+ LOG("CRT9007 %s Height Cursor\n", SINGLE_HEIGHT_CURSOR ? "Single" : "Double");
+ LOG("CRT9007 Operation Mode: %u\n", OPERATION_MODE);
+ LOG("CRT9007 Interlace Mode: %u\n", INTERLACE_MODE);
+ LOG("CRT9007 %s Mechanism\n", PAGE_BLANK ? "Page Blank" : "Smooth Scroll");
break;
case 0x0c:
break;
case 0x0d:
- if (LOG)
- {
- logerror("CRT9007 '%s' Table Start Register: %04x\n", tag(), TABLE_START);
- logerror("CRT9007 '%s' Address Mode: %u\n", tag(), ADDRESS_MODE);
- }
+ LOG("CRT9007 Table Start Register: %04x\n", TABLE_START);
+ LOG("CRT9007 Address Mode: %u\n", ADDRESS_MODE);
break;
case 0x0e:
break;
case 0x0f:
- if (LOG)
- {
- logerror("CRT9007 '%s' Auxialiary Address Register 1: %04x\n", tag(), AUXILIARY_ADDRESS_1);
- logerror("CRT9007 '%s' Row Attributes: %u\n", tag(), ROW_ATTRIBUTES_1);
- }
+ LOG("CRT9007 Auxialiary Address Register 1: %04x\n", AUXILIARY_ADDRESS_1);
+ LOG("CRT9007 Row Attributes: %u\n", ROW_ATTRIBUTES_1);
break;
case 0x10:
- if (LOG) logerror("CRT9007 '%s' Sequential Break Register 1: %u\n", tag(), SEQUENTIAL_BREAK_1);
+ LOG("CRT9007 Sequential Break Register 1: %u\n", SEQUENTIAL_BREAK_1);
break;
case 0x11:
- if (LOG) logerror("CRT9007 '%s' Data Row Start Register: %u\n", tag(), DATA_ROW_START);
+ LOG("CRT9007 Data Row Start Register: %u\n", DATA_ROW_START);
break;
case 0x12:
- if (LOG) logerror("CRT9007 '%s' Data Row End/Sequential Break Register 2: %u\n", tag(), SEQUENTIAL_BREAK_2);
+ LOG("CRT9007 Data Row End/Sequential Break Register 2: %u\n", SEQUENTIAL_BREAK_2);
break;
case 0x13:
break;
case 0x14:
- if (LOG)
- {
- logerror("CRT9007 '%s' Auxiliary Address Register 2: %04x\n", tag(), AUXILIARY_ADDRESS_2);
- logerror("CRT9007 '%s' Row Attributes: %u\n", tag(), ROW_ATTRIBUTES_2);
- }
+ LOG("CRT9007 Auxiliary Address Register 2: %04x\n", AUXILIARY_ADDRESS_2);
+ LOG("CRT9007 Row Attributes: %u\n", ROW_ATTRIBUTES_2);
break;
case 0x15:
- if (LOG) logerror("CRT9007 '%s' Start\n", tag());
+ LOG("CRT9007 Start\n");
m_disp = 1;
break;
case 0x16:
- if (LOG) logerror("CRT9007 '%s' Reset\n", tag());
+ LOG("CRT9007 Reset\n");
device_reset();
break;
case 0x17:
- if (LOG)
- {
- logerror("CRT9007 '%s' Smooth Scroll Offset: %u\n", tag(), SMOOTH_SCROLL_OFFSET);
- logerror("CRT9007 '%s' Smooth Scroll Offset Overflow: %u\n", tag(), SMOOTH_SCROLL_OFFSET_OVERFLOW);
- }
+ LOG("CRT9007 Smooth Scroll Offset: %u\n", SMOOTH_SCROLL_OFFSET);
+ LOG("CRT9007 Smooth Scroll Offset Overflow: %u\n", SMOOTH_SCROLL_OFFSET_OVERFLOW);
break;
case 0x18:
- if (LOG) logerror("CRT9007 '%s' Vertical Cursor Register: %u\n", tag(), VERTICAL_CURSOR);
+ LOG("CRT9007 Vertical Cursor Register: %u\n", VERTICAL_CURSOR);
break;
case 0x19:
- if (LOG) logerror("CRT9007 '%s' Horizontal Cursor Register: %u\n", tag(), HORIZONTAL_CURSOR);
+ LOG("CRT9007 Horizontal Cursor Register: %u\n", HORIZONTAL_CURSOR);
break;
case 0x1a:
- if (LOG)
- {
- logerror("CRT9007 '%s' Frame Timer: %u\n", tag(), FRAME_TIMER);
- logerror("CRT9007 '%s' Light Pen Interrupt: %u\n", tag(), LIGHT_PEN_INTERRUPT);
- logerror("CRT9007 '%s' Vertical Retrace Interrupt: %u\n", tag(), VERTICAL_RETRACE_INTERRUPT);
- }
+ LOG("CRT9007 Frame Timer: %u\n", FRAME_TIMER);
+ LOG("CRT9007 Light Pen Interrupt: %u\n", LIGHT_PEN_INTERRUPT);
+ LOG("CRT9007 Vertical Retrace Interrupt: %u\n", VERTICAL_RETRACE_INTERRUPT);
break;
default:
- logerror("CRT9007 '%s' Write to Invalid Register: %02x!\n", tag(), offset);
+ logerror("CRT9007 Write to Invalid Register: %02x!\n", offset);
}
}
@@ -894,9 +868,9 @@ WRITE8_MEMBER( crt9007_t::write )
// ack_w - DMA acknowledge
//-------------------------------------------------
-WRITE_LINE_MEMBER( crt9007_t::ack_w )
+WRITE_LINE_MEMBER( crt9007_device::ack_w )
{
- if (LOG) logerror("CRT9007 '%s' ACK: %u\n", tag(), state);
+ LOG("CRT9007 ACK: %u\n", state);
if (m_dmar && !m_ack && state)
{
@@ -912,9 +886,9 @@ WRITE_LINE_MEMBER( crt9007_t::ack_w )
// lpstb_w - light pen strobe
//-------------------------------------------------
-WRITE_LINE_MEMBER( crt9007_t::lpstb_w )
+WRITE_LINE_MEMBER( crt9007_device::lpstb_w )
{
- if (LOG) logerror("CRT9007 '%s' LPSTB: %u\n", tag(), state);
+ LOG("CRT9007 LPSTB: %u\n", state);
if (!m_lpstb && state)
{
@@ -929,7 +903,7 @@ WRITE_LINE_MEMBER( crt9007_t::lpstb_w )
// set_character_width -
//-------------------------------------------------
-void crt9007_t::set_character_width(int value)
+void crt9007_device::set_character_width(int value)
{
m_hpixels_per_column = value;
diff --git a/src/devices/video/crt9007.h b/src/devices/video/crt9007.h
index dbfbc7986fb..0618a62853e 100644
--- a/src/devices/video/crt9007.h
+++ b/src/devices/video/crt9007.h
@@ -29,17 +29,10 @@
**********************************************************************/
-#pragma once
-
-#ifndef __CRT9007__
-#define __CRT9007__
-
-
-
+#ifndef MAME_VIDEO_CRT9007_H
+#define MAME_VIDEO_CRT9007_H
-//**************************************************************************
-// MACROS / CONSTANTS
-//**************************************************************************
+#pragma once
@@ -49,40 +42,40 @@
//**************************************************************************
#define MCFG_CRT9007_CHARACTER_WIDTH(_value) \
- crt9007_t::static_set_character_width(*device, _value);
+ crt9007_device::static_set_character_width(*device, _value);
#define MCFG_CRT9007_INT_CALLBACK(_write) \
- devcb = &crt9007_t::set_int_wr_callback(*device, DEVCB_##_write);
+ devcb = &crt9007_device::set_int_wr_callback(*device, DEVCB_##_write);
#define MCFG_CRT9007_DMAR_CALLBACK(_write) \
- devcb = &crt9007_t::set_dmar_wr_callback(*device, DEVCB_##_write);
+ devcb = &crt9007_device::set_dmar_wr_callback(*device, DEVCB_##_write);
#define MCFG_CRT9007_VS_CALLBACK(_write) \
- devcb = &crt9007_t::set_vs_wr_callback(*device, DEVCB_##_write);
+ devcb = &crt9007_device::set_vs_wr_callback(*device, DEVCB_##_write);
#define MCFG_CRT9007_HS_CALLBACK(_write) \
- devcb = &crt9007_t::set_hs_wr_callback(*device, DEVCB_##_write);
+ devcb = &crt9007_device::set_hs_wr_callback(*device, DEVCB_##_write);
#define MCFG_CRT9007_VLT_CALLBACK(_write) \
- devcb = &crt9007_t::set_vlt_wr_callback(*device, DEVCB_##_write);
+ devcb = &crt9007_device::set_vlt_wr_callback(*device, DEVCB_##_write);
#define MCFG_CRT9007_CURS_CALLBACK(_write) \
- devcb = &crt9007_t::set_curs_wr_callback(*device, DEVCB_##_write);
+ devcb = &crt9007_device::set_curs_wr_callback(*device, DEVCB_##_write);
#define MCFG_CRT9007_DRB_CALLBACK(_write) \
- devcb = &crt9007_t::set_drb_wr_callback(*device, DEVCB_##_write);
+ devcb = &crt9007_device::set_drb_wr_callback(*device, DEVCB_##_write);
#define MCFG_CRT9007_WBEN_CALLBACK(_write) \
- devcb = &crt9007_t::set_wben_wr_callback(*device, DEVCB_##_write);
+ devcb = &crt9007_device::set_wben_wr_callback(*device, DEVCB_##_write);
#define MCFG_CRT9007_CBLANK_CALLBACK(_write) \
- devcb = &crt9007_t::set_cblank_wr_callback(*device, DEVCB_##_write);
+ devcb = &crt9007_device::set_cblank_wr_callback(*device, DEVCB_##_write);
#define MCFG_CRT9007_SLG_CALLBACK(_write) \
- devcb = &crt9007_t::set_slg_wr_callback(*device, DEVCB_##_write);
+ devcb = &crt9007_device::set_slg_wr_callback(*device, DEVCB_##_write);
#define MCFG_CRT9007_SLD_CALLBACK(_write) \
- devcb = &crt9007_t::set_sld_wr_callback(*device, DEVCB_##_write);
+ devcb = &crt9007_device::set_sld_wr_callback(*device, DEVCB_##_write);
@@ -90,29 +83,29 @@
// TYPE DEFINITIONS
//**************************************************************************
-// ======================> crt9007_t
+// ======================> crt9007_device
-class crt9007_t : public device_t,
+class crt9007_device : public device_t,
public device_memory_interface,
public device_video_interface
{
public:
// construction/destruction
- crt9007_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
- static void static_set_character_width(device_t &device, int value) { downcast<crt9007_t &>(device).m_hpixels_per_column = value; }
-
- template<class _Object> static devcb_base &set_int_wr_callback(device_t &device, _Object object) { return downcast<crt9007_t &>(device).m_write_int.set_callback(object); }
- template<class _Object> static devcb_base &set_dmar_wr_callback(device_t &device, _Object object) { return downcast<crt9007_t &>(device).m_write_dmar.set_callback(object); }
- template<class _Object> static devcb_base &set_vs_wr_callback(device_t &device, _Object object) { return downcast<crt9007_t &>(device).m_write_vs.set_callback(object); }
- template<class _Object> static devcb_base &set_hs_wr_callback(device_t &device, _Object object) { return downcast<crt9007_t &>(device).m_write_hs.set_callback(object); }
- template<class _Object> static devcb_base &set_vlt_wr_callback(device_t &device, _Object object) { return downcast<crt9007_t &>(device).m_write_vlt.set_callback(object); }
- template<class _Object> static devcb_base &set_curs_wr_callback(device_t &device, _Object object) { return downcast<crt9007_t &>(device).m_write_curs.set_callback(object); }
- template<class _Object> static devcb_base &set_drb_wr_callback(device_t &device, _Object object) { return downcast<crt9007_t &>(device).m_write_drb.set_callback(object); }
- template<class _Object> static devcb_base &set_wben_wr_callback(device_t &device, _Object object) { return downcast<crt9007_t &>(device).m_write_wben.set_callback(object); }
- template<class _Object> static devcb_base &set_cblank_wr_callback(device_t &device, _Object object) { return downcast<crt9007_t &>(device).m_write_cblank.set_callback(object); }
- template<class _Object> static devcb_base &set_slg_wr_callback(device_t &device, _Object object) { return downcast<crt9007_t &>(device).m_write_slg.set_callback(object); }
- template<class _Object> static devcb_base &set_sld_wr_callback(device_t &device, _Object object) { return downcast<crt9007_t &>(device).m_write_sld.set_callback(object); }
+ crt9007_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+ static void static_set_character_width(device_t &device, int value) { downcast<crt9007_device &>(device).m_hpixels_per_column = value; }
+
+ template <class Object> static devcb_base &set_int_wr_callback(device_t &device, Object &&cb) { return downcast<crt9007_device &>(device).m_write_int.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_dmar_wr_callback(device_t &device, Object &&cb) { return downcast<crt9007_device &>(device).m_write_dmar.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_vs_wr_callback(device_t &device, Object &&cb) { return downcast<crt9007_device &>(device).m_write_vs.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_hs_wr_callback(device_t &device, Object &&cb) { return downcast<crt9007_device &>(device).m_write_hs.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_vlt_wr_callback(device_t &device, Object &&cb) { return downcast<crt9007_device &>(device).m_write_vlt.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_curs_wr_callback(device_t &device, Object &&cb) { return downcast<crt9007_device &>(device).m_write_curs.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_drb_wr_callback(device_t &device, Object &&cb) { return downcast<crt9007_device &>(device).m_write_drb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_wben_wr_callback(device_t &device, Object &&cb) { return downcast<crt9007_device &>(device).m_write_wben.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_cblank_wr_callback(device_t &device, Object &&cb) { return downcast<crt9007_device &>(device).m_write_cblank.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_slg_wr_callback(device_t &device, Object &&cb) { return downcast<crt9007_device &>(device).m_write_slg.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_sld_wr_callback(device_t &device, Object &&cb) { return downcast<crt9007_device &>(device).m_write_sld.set_callback(std::forward<Object>(cb)); }
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
@@ -214,8 +207,6 @@ private:
// device type definition
-extern const device_type CRT9007;
-
-
+DECLARE_DEVICE_TYPE(CRT9007, crt9007_device)
-#endif
+#endif // MAME_VIDEO_CRT9007_H
diff --git a/src/devices/video/crt9021.cpp b/src/devices/video/crt9021.cpp
index b34ed316bd4..5b4d7195cde 100644
--- a/src/devices/video/crt9021.cpp
+++ b/src/devices/video/crt9021.cpp
@@ -38,20 +38,16 @@
#include "screen.h"
-
-//**************************************************************************
-// DEVICE DEFINITIONS
-//**************************************************************************
-
-const device_type CRT9021 = device_creator<crt9021_t>;
+//#define VERBOSE 1
+#include "logmacro.h"
//**************************************************************************
-// MACROS / CONSTANTS
+// DEVICE DEFINITIONS
//**************************************************************************
-#define LOG 0
+DEFINE_DEVICE_TYPE(CRT9021, crt9021_device, "crt9021", "SMC CRT9021 VAC")
@@ -60,11 +56,11 @@ const device_type CRT9021 = device_creator<crt9021_t>;
//**************************************************************************
//-------------------------------------------------
-// crt9021_t - constructor
+// crt9021_device - constructor
//-------------------------------------------------
-crt9021_t::crt9021_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, CRT9021, "SMC CRT9021", tag, owner, clock, "crt9021", __FILE__),
+crt9021_device::crt9021_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ device_t(mconfig, CRT9021, tag, owner, clock),
device_video_interface(mconfig, *this),
m_data(0),
m_ms0(0),
@@ -96,7 +92,7 @@ crt9021_t::crt9021_t(const machine_config &mconfig, const char *tag, device_t *o
// device_start - device-specific startup
//-------------------------------------------------
-void crt9021_t::device_start()
+void crt9021_device::device_start()
{
// register bitmap
m_screen->register_screen_bitmap(m_bitmap);
@@ -132,9 +128,9 @@ void crt9021_t::device_start()
// ld_sh_w - load/shift
//-------------------------------------------------
-WRITE_LINE_MEMBER( crt9021_t::ld_sh_w )
+WRITE_LINE_MEMBER( crt9021_device::ld_sh_w )
{
- if (LOG) logerror("CRT9021 '%s' LD/SH: %u\n", tag(), state);
+ LOG("CRT9021 LD/SH: %u\n", state);
if (!m_ld_sh && state)
{
@@ -172,9 +168,9 @@ WRITE_LINE_MEMBER( crt9021_t::ld_sh_w )
// vsync_w - vertical sync
//-------------------------------------------------
-WRITE_LINE_MEMBER( crt9021_t::vsync_w )
+WRITE_LINE_MEMBER( crt9021_device::vsync_w )
{
- if (LOG) logerror("CRT9021 '%s' VSYNC: %u\n", tag(), state);
+ LOG("CRT9021 VSYNC: %u\n", state);
}
@@ -182,7 +178,7 @@ WRITE_LINE_MEMBER( crt9021_t::vsync_w )
// screen_update - update screen
//-------------------------------------------------
-uint32_t crt9021_t::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
+uint32_t crt9021_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
m_bitmap.fill(rgb_t::black(), cliprect);
diff --git a/src/devices/video/crt9021.h b/src/devices/video/crt9021.h
index 36639d3b498..2a0b3620c4d 100644
--- a/src/devices/video/crt9021.h
+++ b/src/devices/video/crt9021.h
@@ -23,10 +23,10 @@
**********************************************************************/
-#pragma once
+#ifndef MAME_VIDEO_CRT9021_H
+#define MAME_VIDEO_CRT9021_H
-#ifndef __CRT9021__
-#define __CRT9021__
+#pragma once
@@ -39,26 +39,25 @@
#define MCFG_CRT9021_DRAW_CHARACTER_CALLBACK_OWNER(_class, _method) \
- crt9021_t::static_set_display_callback(*device, crt9021_draw_character_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
+ crt9021_device::static_set_display_callback(*device, crt9021_device::draw_character_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
-typedef device_delegate<void (bitmap_rgb32 &bitmap, int y, int x, uint8_t video, int intout)> crt9021_draw_character_delegate;
-
-// ======================> crt9021_t
+// ======================> crt9021_device
-class crt9021_t : public device_t,
- public device_video_interface
+class crt9021_device : public device_t, public device_video_interface
{
public:
+ typedef device_delegate<void (bitmap_rgb32 &bitmap, int y, int x, uint8_t video, int intout)> draw_character_delegate;
+
// construction/destruction
- crt9021_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ crt9021_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- static void static_set_display_callback(device_t &device, crt9021_draw_character_delegate callback) { downcast<crt9021_t &>(device).m_display_cb = callback; }
+ static void static_set_display_callback(device_t &device, draw_character_delegate &&cb) { downcast<crt9021_device &>(device).m_display_cb = std::move(cb); }
void write(uint8_t data) { m_data = data; }
DECLARE_WRITE8_MEMBER( write ) { write(data); }
@@ -97,7 +96,7 @@ private:
MS_UNDERLINE
};
- crt9021_draw_character_delegate m_display_cb;
+ draw_character_delegate m_display_cb;
bitmap_rgb32 m_bitmap;
@@ -131,8 +130,6 @@ private:
// device type definition
-extern const device_type CRT9021;
-
-
+DECLARE_DEVICE_TYPE(CRT9021, crt9021_device)
-#endif
+#endif // MAME_VIDEO_CRT9021_H
diff --git a/src/devices/video/crt9212.cpp b/src/devices/video/crt9212.cpp
index 922826f37ff..575624d3dda 100644
--- a/src/devices/video/crt9212.cpp
+++ b/src/devices/video/crt9212.cpp
@@ -9,21 +9,16 @@
#include "emu.h"
#include "crt9212.h"
-
-
-//**************************************************************************
-// DEVICE DEFINITIONS
-//**************************************************************************
-
-const device_type CRT9212 = device_creator<crt9212_t>;
+//#define VERBOSE 1
+#include "logmacro.h"
//**************************************************************************
-// MACROS / CONSTANTS
+// DEVICE DEFINITIONS
//**************************************************************************
-#define LOG 0
+DEFINE_DEVICE_TYPE(CRT9212, crt9212_device, "crt9212", "SMC CRT9212 DRB")
@@ -32,11 +27,11 @@ const device_type CRT9212 = device_creator<crt9212_t>;
//**************************************************************************
//-------------------------------------------------
-// crt9212_t - constructor
+// crt9212_device - constructor
//-------------------------------------------------
-crt9212_t::crt9212_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, CRT9212, "SMC CRT9212", tag, owner, clock, "crt9212", __FILE__),
+crt9212_device::crt9212_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ device_t(mconfig, CRT9212, tag, owner, clock),
m_write_dout(*this),
m_write_rof(*this),
m_write_wof(*this),
@@ -64,7 +59,7 @@ crt9212_t::crt9212_t(const machine_config &mconfig, const char *tag, device_t *o
// device_start - device-specific startup
//-------------------------------------------------
-void crt9212_t::device_start()
+void crt9212_device::device_start()
{
// resolve callbacks
m_write_dout.resolve_safe();
@@ -97,7 +92,7 @@ void crt9212_t::device_start()
// clrcnt_w - clear counter
//-------------------------------------------------
-WRITE_LINE_MEMBER( crt9212_t::clrcnt_w )
+WRITE_LINE_MEMBER( crt9212_device::clrcnt_w )
{
if (m_clrcnt && !state)
{
@@ -112,7 +107,7 @@ WRITE_LINE_MEMBER( crt9212_t::clrcnt_w )
// rclk_w - read clock
//-------------------------------------------------
-WRITE_LINE_MEMBER( crt9212_t::rclk_w )
+WRITE_LINE_MEMBER( crt9212_device::rclk_w )
{
if (!m_rclk && state)
{
@@ -139,7 +134,7 @@ WRITE_LINE_MEMBER( crt9212_t::rclk_w )
m_clrcnt_edge = false;
}
- if (m_ren_int && (m_rac < CRT9212_RAM_SIZE))
+ if (m_ren_int && (m_rac < RAM_SIZE))
{
// output data
m_write_dout(m_ram[m_rac][!m_buffer]);
@@ -147,7 +142,7 @@ WRITE_LINE_MEMBER( crt9212_t::rclk_w )
// increment read address counter
m_rac++;
- if (m_rac == CRT9212_RAM_SIZE - 1)
+ if (m_rac == RAM_SIZE - 1)
{
// set read overflow
m_write_rof(1);
@@ -165,11 +160,11 @@ WRITE_LINE_MEMBER( crt9212_t::rclk_w )
// wclk_w - write clock
//-------------------------------------------------
-WRITE_LINE_MEMBER( crt9212_t::wclk_w )
+WRITE_LINE_MEMBER( crt9212_device::wclk_w )
{
if (!m_wclk && state)
{
- if (m_wen_int && (m_wac < CRT9212_RAM_SIZE))
+ if (m_wen_int && (m_wac < RAM_SIZE))
{
// input data
m_ram[m_rac][m_buffer] = m_data_latch;
@@ -177,7 +172,7 @@ WRITE_LINE_MEMBER( crt9212_t::wclk_w )
// increment write address counter
m_wac++;
- if (m_wac == CRT9212_RAM_SIZE - 1)
+ if (m_wac == RAM_SIZE - 1)
{
// set write overflow
m_write_wof(1);
diff --git a/src/devices/video/crt9212.h b/src/devices/video/crt9212.h
index 699594b98e0..99023a0fe76 100644
--- a/src/devices/video/crt9212.h
+++ b/src/devices/video/crt9212.h
@@ -23,19 +23,11 @@
**********************************************************************/
-#pragma once
-
-#ifndef __CRT9212__
-#define __CRT9212__
-
-
-
+#ifndef MAME_VIDEO_CRT9212_H
+#define MAME_VIDEO_CRT9212_H
-//**************************************************************************
-// MACROS / CONSTANTS
-//**************************************************************************
+#pragma once
-const int CRT9212_RAM_SIZE = 135;
@@ -44,16 +36,16 @@ const int CRT9212_RAM_SIZE = 135;
//**************************************************************************
#define MCFG_CRT9212_WEN2_VCC() \
- crt9212_t::static_set_wen2(*device, 1);
+ crt9212_device::static_set_wen2(*device, 1);
#define MCFG_CRT9212_DOUT_CALLBACK(_write) \
- devcb = &crt9212_t::set_dout_wr_callback(*device, DEVCB_##_write);
+ devcb = &crt9212_device::set_dout_wr_callback(*device, DEVCB_##_write);
#define MCFG_CRT9212_ROF_CALLBACK(_write) \
- devcb = &crt9212_t::set_rof_wr_callback(*device, DEVCB_##_write);
+ devcb = &crt9212_device::set_rof_wr_callback(*device, DEVCB_##_write);
#define MCFG_CRT9212_WOF_CALLBACK(_write) \
- devcb = &crt9212_t::set_wof_wr_callback(*device, DEVCB_##_write);
+ devcb = &crt9212_device::set_wof_wr_callback(*device, DEVCB_##_write);
@@ -61,19 +53,19 @@ const int CRT9212_RAM_SIZE = 135;
// TYPE DEFINITIONS
//**************************************************************************
-// ======================> crt9212_t
+// ======================> crt9212_device
-class crt9212_t : public device_t
+class crt9212_device : public device_t
{
public:
// construction/destruction
- crt9212_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ crt9212_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- static void static_set_wen2(device_t &device, int state) { downcast<crt9212_t &>(device).m_wen2 = state; }
+ static void static_set_wen2(device_t &device, int state) { downcast<crt9212_device &>(device).m_wen2 = state; }
- template<class _Object> static devcb_base &set_dout_wr_callback(device_t &device, _Object object) { return downcast<crt9212_t &>(device).m_write_dout.set_callback(object); }
- template<class _Object> static devcb_base &set_rof_wr_callback(device_t &device, _Object object) { return downcast<crt9212_t &>(device).m_write_rof.set_callback(object); }
- template<class _Object> static devcb_base &set_wof_wr_callback(device_t &device, _Object object) { return downcast<crt9212_t &>(device).m_write_wof.set_callback(object); }
+ template <class Object> static devcb_base &set_dout_wr_callback(device_t &device, Object &&cb) { return downcast<crt9212_device &>(device).m_write_dout.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_rof_wr_callback(device_t &device, Object &&cb) { return downcast<crt9212_device &>(device).m_write_rof.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_wof_wr_callback(device_t &device, Object &&cb) { return downcast<crt9212_device &>(device).m_write_wof.set_callback(std::forward<Object>(cb)); }
DECLARE_WRITE8_MEMBER( write ) { m_data = data; }
DECLARE_WRITE_LINE_MEMBER( clrcnt_w );
@@ -90,6 +82,8 @@ protected:
virtual void device_start() override;
private:
+ static constexpr int RAM_SIZE = 135;
+
devcb_write8 m_write_dout;
devcb_write_line m_write_rof;
devcb_write_line m_write_wof;
@@ -110,7 +104,7 @@ private:
uint8_t m_data_latch;
int m_ren_int;
int m_wen_int;
- uint8_t m_ram[CRT9212_RAM_SIZE][2];
+ uint8_t m_ram[RAM_SIZE][2];
int m_buffer;
int m_rac;
int m_wac;
diff --git a/src/devices/video/crtc_ega.cpp b/src/devices/video/crtc_ega.cpp
index f993d883047..b7318d33f99 100644
--- a/src/devices/video/crtc_ega.cpp
+++ b/src/devices/video/crtc_ega.cpp
@@ -13,15 +13,15 @@
#include "screen.h"
+#define VERBOSE 1
+#include "logmacro.h"
-#define LOG (1)
-
-const device_type CRTC_EGA = device_creator<crtc_ega_device>;
+DEFINE_DEVICE_TYPE(CRTC_EGA, crtc_ega_device, "crtc_ega", "IBM EGA CRT Controller")
crtc_ega_device::crtc_ega_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, CRTC_EGA, "crtc_EGA", tag, owner, clock, "crtc_ega", __FILE__), device_video_interface(mconfig, *this, false)
+ : device_t(mconfig, CRTC_EGA, tag, owner, clock), device_video_interface(mconfig, *this, false)
, m_res_out_de_cb(*this), m_res_out_hsync_cb(*this), m_res_out_vsync_cb(*this), m_res_out_vblank_cb(*this)
, m_horiz_char_total(0), m_horiz_disp(0), m_horiz_blank_start(0), m_horiz_blank_end(0)
, m_ena_vert_access(0), m_de_skew(0)
@@ -80,7 +80,7 @@ READ8_MEMBER( crtc_ega_device::register_r )
WRITE8_MEMBER( crtc_ega_device::register_w )
{
- if (LOG) logerror("%s CRTC_EGA: reg 0x%02x = 0x%02x\n", machine().describe_context(), m_register_address_latch, data);
+ LOG("%s CRTC_EGA: reg 0x%02x = 0x%02x\n", machine().describe_context(), m_register_address_latch, data);
switch (m_register_address_latch)
{
@@ -198,7 +198,7 @@ void crtc_ega_device::recompute_parameters(bool postload)
rectangle visarea(0, max_visible_x, 0, max_visible_y);
- if (LOG) logerror("CRTC_EGA config screen: HTOTAL: 0x%x VTOTAL: 0x%x MAX_X: 0x%x MAX_Y: 0x%x HSYNC: 0x%x-0x%x VSYNC: 0x%x-0x%x Freq: %ffps\n",
+ LOG("CRTC_EGA config screen: HTOTAL: 0x%x VTOTAL: 0x%x MAX_X: 0x%x MAX_Y: 0x%x HSYNC: 0x%x-0x%x VSYNC: 0x%x-0x%x Freq: %ffps\n",
horiz_pix_total, vert_pix_total, max_visible_x, max_visible_y, hsync_on_pos, hsync_off_pos - 1, vsync_on_pos, vsync_off_pos - 1, 1 / ATTOSECONDS_TO_DOUBLE(refresh));
if ( m_screen != nullptr )
@@ -209,7 +209,7 @@ void crtc_ega_device::recompute_parameters(bool postload)
else
{
m_has_valid_parameters = false;
- if (LOG) logerror("CRTC_EGA bad config screen: HTOTAL: 0x%x VTOTAL: 0x%x MAX_X: 0x%x MAX_Y: 0x%x HSYNC: 0x%x-0x%x VSYNC: 0x%x-0x%x\n",
+ LOG("CRTC_EGA bad config screen: HTOTAL: 0x%x VTOTAL: 0x%x MAX_X: 0x%x MAX_Y: 0x%x HSYNC: 0x%x-0x%x VSYNC: 0x%x-0x%x\n",
horiz_pix_total, vert_pix_total, max_visible_x, max_visible_y, hsync_on_pos, hsync_off_pos - 1, vsync_on_pos, vsync_off_pos - 1);
}
diff --git a/src/devices/video/crtc_ega.h b/src/devices/video/crtc_ega.h
index 587cb7e90b9..cd30ba53f33 100644
--- a/src/devices/video/crtc_ega.h
+++ b/src/devices/video/crtc_ega.h
@@ -6,17 +6,8 @@
**********************************************************************/
-#ifndef __CRTC_EGA__
-#define __CRTC_EGA__
-
-
-/* callback definitions */
-typedef device_delegate<void (bitmap_ind16 &bitmap, const rectangle &cliprect)> crtc_ega_begin_update_delegate;
-
-typedef device_delegate<void (bitmap_ind16 &bitmap, const rectangle &cliprect, uint16_t ma, uint8_t ra,
- uint16_t y, uint8_t x_count, int8_t cursor_x)> crtc_ega_row_update_delegate;
-
-typedef device_delegate<void (bitmap_ind16 &bitmap, const rectangle &cliprect)> crtc_ega_end_update_delegate;
+#ifndef MAME_VIDEO_CRTC_EGA_H
+#define MAME_VIDEO_CRTC_EGA_H
#define CRTC_EGA_BEGIN_UPDATE(_name) void _name(bitmap_ind16 &bitmap, const rectangle &cliprect)
@@ -30,13 +21,13 @@ typedef device_delegate<void (bitmap_ind16 &bitmap, const rectangle &cliprect)>
#define MCFG_CRTC_EGA_SET_SCREEN MCFG_VIDEO_SET_SCREEN
#define MCFG_CRTC_EGA_BEGIN_UPDATE_CB(_class, _method) \
- crtc_ega_device::set_begin_update_callback(*device, crtc_ega_begin_update_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
+ crtc_ega_device::set_begin_update_callback(*device, crtc_ega_device::begin_update_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
#define MCFG_CRTC_EGA_ROW_UPDATE_CB(_class, _method) \
- crtc_ega_device::set_row_update_callback(*device, crtc_ega_row_update_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
+ crtc_ega_device::set_row_update_callback(*device, crtc_ega_device::row_update_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
#define MCFG_CRTC_EGA_END_UPDATE_CB(_class, _method) \
- crtc_ega_device::set_end_update_callback(*device, crtc_ega_end_update_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
+ crtc_ega_device::set_end_update_callback(*device, crtc_ega_device::end_update_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
#define MCFG_CRTC_EGA_HPIXELS_PER_COLUMN(_pix) \
crtc_ega_device::set_hpixels_per_column(*device, _pix);
@@ -58,20 +49,26 @@ class crtc_ega_device : public device_t,
public device_video_interface
{
public:
+ /* callback definitions */
+ typedef device_delegate<void (bitmap_ind16 &bitmap, const rectangle &cliprect)> begin_update_delegate;
+ typedef device_delegate<void (bitmap_ind16 &bitmap, const rectangle &cliprect, uint16_t ma, uint8_t ra, uint16_t y, uint8_t x_count, int8_t cursor_x)> row_update_delegate;
+ typedef device_delegate<void (bitmap_ind16 &bitmap, const rectangle &cliprect)> end_update_delegate;
+
+
crtc_ega_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- template<class _Object> static devcb_base &set_res_out_de_callback(device_t &device, _Object object)
- { return downcast<crtc_ega_device &>(device).m_res_out_de_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_res_out_hsync_callback(device_t &device, _Object object)
- { return downcast<crtc_ega_device &>(device).m_res_out_hsync_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_res_out_vsync_callback(device_t &device, _Object object)
- { return downcast<crtc_ega_device &>(device).m_res_out_vsync_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_res_out_vblank_callback(device_t &device, _Object object)
- { return downcast<crtc_ega_device &>(device).m_res_out_vblank_cb.set_callback(object); }
-
- static void set_begin_update_callback(device_t &device, crtc_ega_begin_update_delegate callback) { downcast<crtc_ega_device &>(device).m_begin_update_cb = callback; }
- static void set_row_update_callback(device_t &device, crtc_ega_row_update_delegate callback) { downcast<crtc_ega_device &>(device).m_row_update_cb = callback; }
- static void set_end_update_callback(device_t &device, crtc_ega_end_update_delegate callback) { downcast<crtc_ega_device &>(device).m_end_update_cb = callback; }
+ template <class Object> static devcb_base &set_res_out_de_callback(device_t &device, Object &&cb)
+ { return downcast<crtc_ega_device &>(device).m_res_out_de_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_res_out_hsync_callback(device_t &device, Object &&cb)
+ { return downcast<crtc_ega_device &>(device).m_res_out_hsync_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_res_out_vsync_callback(device_t &device, Object &&cb)
+ { return downcast<crtc_ega_device &>(device).m_res_out_vsync_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_res_out_vblank_callback(device_t &device, Object &&cb)
+ { return downcast<crtc_ega_device &>(device).m_res_out_vblank_cb.set_callback(std::forward<Object>(cb)); }
+
+ static void set_begin_update_callback(device_t &device, begin_update_delegate &&cb) { downcast<crtc_ega_device &>(device).m_begin_update_cb = std::move(cb); }
+ static void set_row_update_callback(device_t &device, row_update_delegate &&cb) { downcast<crtc_ega_device &>(device).m_row_update_cb = std::move(cb); }
+ static void set_end_update_callback(device_t &device, end_update_delegate &&cb) { downcast<crtc_ega_device &>(device).m_end_update_cb = std::move(cb); }
static void set_hpixels_per_column(device_t &device, int hpixels_per_column) { downcast<crtc_ega_device &>(device).m_hpixels_per_column = hpixels_per_column; }
/* select one of the registers for reading or writing */
@@ -119,16 +116,16 @@ private:
/* if specified, this gets called before any pixel update,
optionally return a pointer that will be passed to the
update and tear down callbacks */
- crtc_ega_begin_update_delegate m_begin_update_cb;
+ begin_update_delegate m_begin_update_cb;
/* this gets called for every row, the driver must output
x_count * hpixels_per_column pixels.
cursor_x indicates the character position where the cursor is, or -1
if there is no cursor on this row */
- crtc_ega_row_update_delegate m_row_update_cb;
+ row_update_delegate m_row_update_cb;
/* if specified, this gets called after all row updating is complete */
- crtc_ega_end_update_delegate m_end_update_cb;
+ end_update_delegate m_end_update_cb;
/* ega/vga register file */
uint8_t m_horiz_char_total; /* 0x00 */
@@ -190,13 +187,13 @@ private:
int16_t m_cursor_x;
/* timers */
- static const device_timer_id TIMER_LINE = 0;
- static const device_timer_id TIMER_DE_OFF = 1;
- static const device_timer_id TIMER_CUR_ON = 2;
- static const device_timer_id TIMER_CUR_OFF = 3;
- static const device_timer_id TIMER_HSYNC_ON = 4;
- static const device_timer_id TIMER_HSYNC_OFF = 5;
- static const device_timer_id TIMER_LIGHT_PEN_LATCH = 6;
+ static constexpr device_timer_id TIMER_LINE = 0;
+ static constexpr device_timer_id TIMER_DE_OFF = 1;
+ static constexpr device_timer_id TIMER_CUR_ON = 2;
+ static constexpr device_timer_id TIMER_CUR_OFF = 3;
+ static constexpr device_timer_id TIMER_HSYNC_ON = 4;
+ static constexpr device_timer_id TIMER_HSYNC_OFF = 5;
+ static constexpr device_timer_id TIMER_LIGHT_PEN_LATCH = 6;
emu_timer *m_line_timer;
emu_timer *m_de_off_timer;
@@ -230,6 +227,6 @@ private:
void update_cursor_state();
};
-extern const device_type CRTC_EGA;
+DECLARE_DEVICE_TYPE(CRTC_EGA, crtc_ega_device)
-#endif
+#endif // MAME_VIDEO_CRTC_EGA_H
diff --git a/src/devices/video/dl1416.cpp b/src/devices/video/dl1416.cpp
index f79c33e9717..dfa7315e522 100644
--- a/src/devices/video/dl1416.cpp
+++ b/src/devices/video/dl1416.cpp
@@ -96,7 +96,7 @@ class dl1414t_device : public dl1414_device
{
public:
dl1414t_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock)
- : dl1414_device(mconfig, DL1414T, "DL1414T", tag, owner, clock, "dl1414t", __FILE__)
+ : dl1414_device(mconfig, DL1414T, tag, owner, clock)
{
}
@@ -112,7 +112,7 @@ class dl1416b_device : public dl1416_device
{
public:
dl1416b_device(machine_config const &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : dl1416_device(mconfig, DL1416B, "DL1416B", tag, owner, clock, "dl1416b", __FILE__)
+ : dl1416_device(mconfig, DL1416B, tag, owner, clock)
{
}
@@ -136,7 +136,7 @@ class dl1416t_device : public dl1416_device
{
public:
dl1416t_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : dl1416_device(mconfig, DL1416T, "DL1416T", tag, owner, clock, "dl1416t", __FILE__)
+ : dl1416_device(mconfig, DL1416T, tag, owner, clock)
{
}
@@ -164,9 +164,9 @@ protected:
DEVICE TYPE GLOBALS
*****************************************************************************/
-device_type const DL1414T = device_creator<dl1414t_device>;
-device_type const DL1416B = device_creator<dl1416b_device>;
-device_type const DL1416T = device_creator<dl1416t_device>;
+DEFINE_DEVICE_TYPE(DL1414T, dl1414t_device, "dl1414t", "DL1414T")
+DEFINE_DEVICE_TYPE(DL1416B, dl1416b_device, "dl1416b", "DL1416B")
+DEFINE_DEVICE_TYPE(DL1416T, dl1416t_device, "dl1416t", "DL1416T")
@@ -177,13 +177,10 @@ device_type const DL1416T = device_creator<dl1416t_device>;
dl1414_device::dl1414_device(
machine_config const &mconfig,
device_type type,
- char const *name,
char const *tag,
device_t *owner,
- uint32_t clock,
- char const *shortname,
- char const *source)
- : device_t(mconfig, type, name, tag, owner, clock, shortname, source)
+ uint32_t clock)
+ : device_t(mconfig, type, tag, owner, clock)
, m_update_cb(*this)
, m_digit_ram{ 0x00, 0x00, 0x00, 0x00 }
, m_cursor_state{ false, false, false, false }
@@ -199,13 +196,10 @@ dl1414_device::dl1414_device(
dl1416_device::dl1416_device(
machine_config const &mconfig,
device_type type,
- char const *name,
char const *tag,
device_t *owner,
- uint32_t clock,
- char const *shortname,
- char const *source)
- : dl1414_device(mconfig, type, name, tag, owner, clock, shortname, source)
+ uint32_t clock)
+ : dl1414_device(mconfig, type, tag, owner, clock)
, m_cu_in(true)
{
}
diff --git a/src/devices/video/dl1416.h b/src/devices/video/dl1416.h
index e5f5a894321..dbc67b97787 100644
--- a/src/devices/video/dl1416.h
+++ b/src/devices/video/dl1416.h
@@ -11,8 +11,10 @@
*
****************************************************************************/
-#ifndef MAME_DEVICES_VIDEO_DL1416_H
-#define MAME_DEVICES_VIDEO_DL1416_H
+#ifndef MAME_VIDEO_DL1416_H
+#define MAME_VIDEO_DL1416_H
+
+#pragma once
/***************************************************************************
@@ -42,8 +44,8 @@ extern device_type const DL1416T;
class dl1414_device : public device_t
{
public:
- template<typename Object> static devcb_base &set_update_handler(device_t &device, Object &&object)
- { return downcast<dl1414_device &>(device).m_update_cb.set_callback(std::forward<Object>(object)); }
+ template <typename Object> static devcb_base &set_update_handler(device_t &device, Object &&cb)
+ { return downcast<dl1414_device &>(device).m_update_cb.set_callback(std::forward<Object>(cb)); }
// signal-level interface
DECLARE_WRITE_LINE_MEMBER(wr_w); // write strobe (rising edge)
@@ -58,12 +60,9 @@ protected:
dl1414_device(
machine_config const &mconfig,
device_type type,
- char const *name,
char const *tag,
device_t *owner,
- uint32_t clock,
- char const *shortname,
- char const *source);
+ uint32_t clock);
// device-level overrides
virtual void device_start() override;
@@ -95,12 +94,9 @@ protected:
dl1416_device(
machine_config const &mconfig,
device_type type,
- char const *name,
char const *tag,
device_t *owner,
- uint32_t clock,
- char const *shortname,
- char const *source);
+ uint32_t clock);
// device-level overrides
virtual void device_start() override;
@@ -112,4 +108,4 @@ private:
bool m_cu_in;
};
-#endif // MAME_DEVICES_VIDEO_DL1416_H
+#endif // MAME_VIDEO_DL1416_H
diff --git a/src/devices/video/dm9368.cpp b/src/devices/video/dm9368.cpp
index 8b06f49f81d..9c53b911daf 100644
--- a/src/devices/video/dm9368.cpp
+++ b/src/devices/video/dm9368.cpp
@@ -9,13 +9,15 @@
#include "emu.h"
#include "dm9368.h"
+//#define VERBOSE 1
+#include "logmacro.h"
//**************************************************************************
// DEVICE DEFINITION
//**************************************************************************
-const device_type DM9368 = device_creator<dm9368_device>;
+DEFINE_DEVICE_TYPE(DM9368, dm9368_device, "dm9368", "Fairchild DM9368 7-Segment Decoder")
@@ -23,10 +25,7 @@ const device_type DM9368 = device_creator<dm9368_device>;
// MACROS / CONSTANTS
//**************************************************************************
-#define LOG 0
-
-
-const uint8_t dm9368_device::m_segment_data[16] =
+constexpr uint8_t dm9368_device::m_segment_data[16] =
{
0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x67, 0x77, 0x7c, 0x39, 0x5e, 0x79, 0x71
};
@@ -42,7 +41,7 @@ const uint8_t dm9368_device::m_segment_data[16] =
//-------------------------------------------------
dm9368_device::dm9368_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, DM9368, "DM9368 7-Segment Decoder", tag, owner, clock, "dm9368", __FILE__),
+ device_t(mconfig, DM9368, tag, owner, clock),
device_output_interface(mconfig, *this),
m_write_rbo(*this),
m_rbi(1),
@@ -72,19 +71,19 @@ void dm9368_device::device_start()
void dm9368_device::a_w(uint8_t data)
{
- int a = data & 0x0f;
+ int const a = data & 0x0f;
uint8_t value = 0;
if (!m_rbi && !a)
{
- if (LOG) logerror("DM9368 '%s' Blanked Rippling Zero\n", tag());
+ LOG("DM9368 Blanked Rippling Zero\n");
// blank rippling 0
m_rbo = 0;
}
else
{
- if (LOG) logerror("DM9368 '%s' Output Data: %u = %02x\n", tag(), a, m_segment_data[a]);
+ LOG("DM9368 Output Data: %u = %02x\n", a, m_segment_data[a]);
value = m_segment_data[a];
diff --git a/src/devices/video/dm9368.h b/src/devices/video/dm9368.h
index 2c6c1ca908c..f28c4347db4 100644
--- a/src/devices/video/dm9368.h
+++ b/src/devices/video/dm9368.h
@@ -17,10 +17,10 @@
**********************************************************************/
-#pragma once
+#ifndef MAME_VIDEO_DM9368_H
+#define MAME_VIDEO_DM9368_H
-#ifndef __DM9368__
-#define __DM9368__
+#pragma once
@@ -67,8 +67,6 @@ private:
// device type definition
-extern const device_type DM9368;
-
-
+DECLARE_DEVICE_TYPE(DM9368, dm9368_device)
-#endif
+#endif // MAME_VIDEO_DM9368_H
diff --git a/src/devices/video/ef9340_1.cpp b/src/devices/video/ef9340_1.cpp
index 8bc8838b592..484cc67cfbf 100644
--- a/src/devices/video/ef9340_1.cpp
+++ b/src/devices/video/ef9340_1.cpp
@@ -17,17 +17,17 @@
// device type definition
-const device_type EF9340_1 = device_creator<ef9340_1_device>;
+DEFINE_DEVICE_TYPE(EF9340_1, ef9340_1_device, "ef9340_1", "Thomson EF9340+EF9341")
-static const uint8_t bgr2rgb[8] =
+static constexpr uint8_t bgr2rgb[8] =
{
0x00, 0x04, 0x02, 0x06, 0x01, 0x05, 0x03, 0x07
};
ef9340_1_device::ef9340_1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, EF9340_1, "EF9340+EF9341", tag, owner, clock, "ef9340_1", __FILE__)
+ : device_t(mconfig, EF9340_1, tag, owner, clock)
, device_video_interface(mconfig, *this), m_line_timer(nullptr)
//, m_start_vpos(START_Y)
//, m_start_vblank(START_Y + SCREEN_HEIGHT)
diff --git a/src/devices/video/ef9340_1.h b/src/devices/video/ef9340_1.h
index 6a7246ae42a..e5cbd23964a 100644
--- a/src/devices/video/ef9340_1.h
+++ b/src/devices/video/ef9340_1.h
@@ -9,10 +9,10 @@
***************************************************************************/
-#pragma once
+#ifndef MAME_VIDEO_EF9340_1_H
+#define MAME_VIDEO_EF9340_1_H
-#ifndef __EF9340_1_H__
-#define __EF9340_1_H__
+#pragma once
@@ -47,7 +47,7 @@ protected:
void ef9340_scanline(int vpos);
/* timers */
- static const device_timer_id TIMER_LINE = 0;
+ static constexpr device_timer_id TIMER_LINE = 0;
emu_timer *m_line_timer;
@@ -75,6 +75,6 @@ protected:
// device type definition
-extern const device_type EF9340_1;
+DECLARE_DEVICE_TYPE(EF9340_1, ef9340_1_device)
-#endif /* __EF9340_1_H__ */
+#endif // MAME_VIDEO_EF9340_1_H
diff --git a/src/devices/video/ef9345.cpp b/src/devices/video/ef9345.cpp
index 1379a20587e..e0385007b7b 100644
--- a/src/devices/video/ef9345.cpp
+++ b/src/devices/video/ef9345.cpp
@@ -9,7 +9,7 @@
This code is based on Daniel Coulom's implementation in DCVG5k
and DCAlice released by Daniel Coulom under GPL license
- TS9347 variant support added by Jean-François DEL NERO
+ TS9347 variant support added by Jean-François DEL NERO
*********************************************************************/
#include "emu.h"
@@ -29,8 +29,8 @@
//**************************************************************************
// devices
-const device_type EF9345 = device_creator<ef9345_device>;
-const device_type TS9347 = device_creator<ts9347_device>;
+DEFINE_DEVICE_TYPE(EF9345, ef9345_device, "ef9345", "EF9345")
+DEFINE_DEVICE_TYPE(TS9347, ts9347_device, "ts9347", "TS9347")
// default address map
static ADDRESS_MAP_START( ef9345, AS_0, 8, ef9345_device )
@@ -102,18 +102,12 @@ inline void ef9345_device::inc_y(uint8_t r)
//-------------------------------------------------
ef9345_device::ef9345_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, EF9345, "EF9345", tag, owner, clock, "ef9345", __FILE__),
- device_memory_interface(mconfig, *this),
- device_video_interface(mconfig, *this),
- m_space_config("videoram", ENDIANNESS_LITTLE, 8, 16, 0, nullptr, *ADDRESS_MAP_NAME(ef9345)),
- m_charset(*this, DEVICE_SELF),
- m_variant(EF9345_MODE::TYPE_EF9345),
- m_palette(*this, finder_base::DUMMY_TAG)
+ ef9345_device(mconfig, EF9345, tag, owner, clock, EF9345_MODE::TYPE_EF9345)
{
}
-ef9345_device::ef9345_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, EF9345_MODE variant, const char *shortname, const char *source) :
- device_t(mconfig, type, name, tag, owner, clock, shortname, source),
+ef9345_device::ef9345_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, EF9345_MODE variant) :
+ device_t(mconfig, type, tag, owner, clock),
device_memory_interface(mconfig, *this),
device_video_interface(mconfig, *this),
m_space_config("videoram", ENDIANNESS_LITTLE, 8, 16, 0, nullptr, *ADDRESS_MAP_NAME(ef9345)),
@@ -124,7 +118,9 @@ ef9345_device::ef9345_device(const machine_config &mconfig, device_type type, co
}
ts9347_device::ts9347_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : ef9345_device(mconfig, TS9347, "TS9347",tag, owner, clock, EF9345_MODE::TYPE_TS9347,"ts9347",__FILE__){ }
+ : ef9345_device(mconfig, TS9347, tag, owner, clock, EF9345_MODE::TYPE_TS9347)
+{
+}
//-------------------------------------------------
// static_set_palette_tag: Set the tag of the
diff --git a/src/devices/video/ef9345.h b/src/devices/video/ef9345.h
index a6102fe96cc..8f58eb2c4a6 100644
--- a/src/devices/video/ef9345.h
+++ b/src/devices/video/ef9345.h
@@ -8,12 +8,11 @@
*********************************************************************/
+#ifndef MAME_VIDEO_EF9345_H
+#define MAME_VIDEO_EF9345_H
#pragma once
-#ifndef __EF9345_H__
-#define __EF9345_H__
-
#define MCFG_EF9345_PALETTE(_palette_tag) \
ef9345_device::static_set_palette_tag(*device, "^" _palette_tag);
@@ -49,7 +48,7 @@ protected:
};
// pass-through constructor
- ef9345_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, EF9345_MODE variant, const char *shortname, const char *source);
+ ef9345_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, EF9345_MODE variant);
// device-level overrides
virtual void device_start() override;
@@ -57,7 +56,7 @@ protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
// device_config_memory_interface overrides
- virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override;
+ virtual const address_space_config *memory_space_config(address_spacenum spacenum) const override;
// address space configurations
const address_space_config m_space_config;
@@ -69,7 +68,6 @@ protected:
inline void inc_y(uint8_t r);
private:
-
void set_busy_flag(int period);
void draw_char_40(uint8_t *c, uint16_t x, uint16_t y);
void draw_char_80(uint8_t *c, uint16_t x, uint16_t y);
@@ -125,12 +123,12 @@ private:
class ts9347_device : public ef9345_device
{
-public :
+public:
ts9347_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
};
// device type definition
-extern const device_type EF9345;
-extern const device_type TS9347;
+DECLARE_DEVICE_TYPE(EF9345, ef9345_device)
+DECLARE_DEVICE_TYPE(TS9347, ts9347_device)
-#endif
+#endif // MAME_VIDEO_EF9345_H
diff --git a/src/devices/video/ef9364.cpp b/src/devices/video/ef9364.cpp
index 6957a57d676..5be327900f4 100644
--- a/src/devices/video/ef9364.cpp
+++ b/src/devices/video/ef9364.cpp
@@ -28,13 +28,13 @@
// devices
-const device_type EF9364 = device_creator<ef9364_device>;
+DEFINE_DEVICE_TYPE(EF9364, ef9364_device, "ef9364", "Thomson EF9364")
//-------------------------------------------------
// default address map
//-------------------------------------------------
static ADDRESS_MAP_START( ef9364, AS_0, 8, ef9364_device )
- AM_RANGE(0x00000, ( ( EF9364_TXTPLANE_MAX_SIZE * EF9364_MAX_TXTPLANES ) - 1 ) ) AM_RAM
+ AM_RANGE(0x00000, ( ( ef9364_device::TXTPLANE_MAX_SIZE * ef9364_device::MAX_TXTPLANES ) - 1 ) ) AM_RAM
ADDRESS_MAP_END
//-------------------------------------------------
@@ -60,7 +60,7 @@ const address_space_config *ef9364_device::memory_space_config(address_spacenum
//-------------------------------------------------
ef9364_device::ef9364_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, EF9364, "EF9364", tag, owner, clock, "ef9364", __FILE__),
+ device_t(mconfig, EF9364, tag, owner, clock),
device_memory_interface(mconfig, *this),
device_video_interface(mconfig, *this),
m_space_config("textram", ENDIANNESS_LITTLE, 8, 12, 0, nullptr, *ADDRESS_MAP_NAME(ef9364)),
@@ -117,8 +117,8 @@ void ef9364_device::device_start()
{
m_textram = &space(0);
- bitplane_xres = EF9364_NB_OF_COLUMNS*8;
- bitplane_yres = EF9364_NB_OF_ROWS*(8+4);
+ bitplane_xres = NB_OF_COLUMNS*8;
+ bitplane_yres = NB_OF_ROWS*(8+4);
vsync_scanline_pos = 250;
@@ -149,7 +149,7 @@ void ef9364_device::device_reset()
char_latch = 0x00;
- for(i=0;i<EF9364_NB_OF_COLUMNS * EF9364_NB_OF_ROWS * nb_of_pages;i++)
+ for(i = 0; i < NB_OF_COLUMNS * NB_OF_ROWS * nb_of_pages; i++)
{
m_textram->write_byte ( i , 0x7F );
}
@@ -199,15 +199,15 @@ uint32_t ef9364_device::screen_update(screen_device &screen, bitmap_rgb32 &bitma
int x,y,r;
unsigned char c;
- for( r = 0 ; r < EF9364_NB_OF_ROWS ; r++ )
+ for( r = 0 ; r < NB_OF_ROWS ; r++ )
{
for( y = 0 ; y < 8 ; y++ )
{
- for( x = 0 ; x < EF9364_NB_OF_COLUMNS * 8 ; x++ )
+ for( x = 0 ; x < NB_OF_COLUMNS * 8 ; x++ )
{
if( ( ( x >> 3 ) != x_curs_pos ) || ( r != y_curs_pos ) || !cursor_state)
{
- c = m_textram->read_byte( ( r * EF9364_NB_OF_COLUMNS ) + ( x>>3 ) );
+ c = m_textram->read_byte( ( r * NB_OF_COLUMNS ) + ( x>>3 ) );
if( m_charset[((c&0x7F)<<3) + y] & (0x80>>(x&7)) )
m_screen_out.pix32((r*12)+y, x) = palette[1];
@@ -261,11 +261,11 @@ void ef9364_device::command_w(uint8_t cmd)
switch( cmd&7 )
{
case 0x0: // Page Erase & Cursor home
- for( y=0 ; y < EF9364_NB_OF_ROWS ; y++ )
+ for( y=0 ; y < NB_OF_ROWS ; y++ )
{
- for( x=0 ; x < EF9364_NB_OF_COLUMNS ; x++ )
+ for( x=0 ; x < NB_OF_COLUMNS ; x++ )
{
- m_textram->write_byte ( y * EF9364_NB_OF_COLUMNS + x , 0x7F );
+ m_textram->write_byte ( y * NB_OF_COLUMNS + x , 0x7F );
}
}
x_curs_pos = 0;
@@ -273,32 +273,32 @@ void ef9364_device::command_w(uint8_t cmd)
break;
case 0x1: // Erase to end of the line and return cursor
- for( ; x_curs_pos < EF9364_NB_OF_COLUMNS ; x_curs_pos++ )
+ for( ; x_curs_pos < NB_OF_COLUMNS ; x_curs_pos++ )
{
- m_textram->write_byte ( y_curs_pos * EF9364_NB_OF_COLUMNS + x_curs_pos , 0x7F );
+ m_textram->write_byte ( y_curs_pos * NB_OF_COLUMNS + x_curs_pos , 0x7F );
}
x_curs_pos = 0;
break;
case 0x2: // Line feed
y_curs_pos++;
- if( y_curs_pos >= EF9364_NB_OF_ROWS )
+ if( y_curs_pos >= NB_OF_ROWS )
{
// Scroll
- for( j = 1 ; j < EF9364_NB_OF_ROWS ; j++ )
+ for( j = 1 ; j < NB_OF_ROWS ; j++ )
{
- for( i = 0 ; i < EF9364_NB_OF_COLUMNS ; i++ )
+ for( i = 0 ; i < NB_OF_COLUMNS ; i++ )
{
- m_textram->write_byte ( (j-1) * EF9364_NB_OF_COLUMNS + i , m_textram->read_byte ( j * EF9364_NB_OF_COLUMNS + i ) );
+ m_textram->write_byte ( (j-1) * NB_OF_COLUMNS + i , m_textram->read_byte ( j * NB_OF_COLUMNS + i ) );
}
}
// Erase last line
- for( i = 0 ; i < EF9364_NB_OF_COLUMNS ; i++ )
+ for( i = 0 ; i < NB_OF_COLUMNS ; i++ )
{
- m_textram->write_byte ( ( EF9364_NB_OF_ROWS - 1 ) * EF9364_NB_OF_COLUMNS + i , 0x7F );
+ m_textram->write_byte ( ( NB_OF_ROWS - 1 ) * NB_OF_COLUMNS + i , 0x7F );
}
- y_curs_pos = EF9364_NB_OF_ROWS - 1;
+ y_curs_pos = NB_OF_ROWS - 1;
}
break;
@@ -312,9 +312,9 @@ void ef9364_device::command_w(uint8_t cmd)
break;
case 0x5: // Erasure of cursor Line.
- for( x = 0 ; x < EF9364_NB_OF_COLUMNS ; x++ )
+ for( x = 0 ; x < NB_OF_COLUMNS ; x++ )
{
- m_textram->write_byte ( y_curs_pos * EF9364_NB_OF_COLUMNS + x , 0x7F );
+ m_textram->write_byte ( y_curs_pos * NB_OF_COLUMNS + x , 0x7F );
}
break;
@@ -325,30 +325,30 @@ void ef9364_device::command_w(uint8_t cmd)
case 0x7: // Write char
if(cmd&0x8)
- m_textram->write_byte ( y_curs_pos * EF9364_NB_OF_COLUMNS + x_curs_pos , char_latch );
+ m_textram->write_byte ( y_curs_pos * NB_OF_COLUMNS + x_curs_pos , char_latch );
x_curs_pos++;
- if( x_curs_pos >= EF9364_NB_OF_COLUMNS )
+ if( x_curs_pos >= NB_OF_COLUMNS )
{
x_curs_pos=0;
y_curs_pos++;
- if( y_curs_pos >= EF9364_NB_OF_ROWS )
+ if( y_curs_pos >= NB_OF_ROWS )
{
// Scroll
- for( j = 1 ; j < EF9364_NB_OF_ROWS ; j++ )
+ for( j = 1 ; j < NB_OF_ROWS ; j++ )
{
- for( i = 0 ; i < EF9364_NB_OF_COLUMNS ; i++ )
+ for( i = 0 ; i < NB_OF_COLUMNS ; i++ )
{
- m_textram->write_byte ( (j-1) * EF9364_NB_OF_COLUMNS + i , m_textram->read_byte ( j * EF9364_NB_OF_COLUMNS + i ) );
+ m_textram->write_byte ( (j-1) * NB_OF_COLUMNS + i , m_textram->read_byte ( j * NB_OF_COLUMNS + i ) );
}
}
// Erase last line
- for( i = 0 ; i < EF9364_NB_OF_COLUMNS ; i++ )
+ for( i = 0 ; i < NB_OF_COLUMNS ; i++ )
{
- m_textram->write_byte ( ( EF9364_NB_OF_ROWS - 1 ) * EF9364_NB_OF_COLUMNS + i , 0x7F );
+ m_textram->write_byte ( ( NB_OF_ROWS - 1 ) * NB_OF_COLUMNS + i , 0x7F );
}
- y_curs_pos = EF9364_NB_OF_ROWS - 1;
+ y_curs_pos = NB_OF_ROWS - 1;
}
}
break;
diff --git a/src/devices/video/ef9364.h b/src/devices/video/ef9364.h
index 2adc99905ee..2a6f20c0f48 100644
--- a/src/devices/video/ef9364.h
+++ b/src/devices/video/ef9364.h
@@ -8,16 +8,10 @@
*********************************************************************/
-#pragma once
-
-#ifndef __EF9364_H__
-#define __EF9364_H__
+#ifndef MAME_VIDEO_EF9364_H
+#define MAME_VIDEO_EF9364_H
-#define EF9364_NB_OF_COLUMNS 64
-#define EF9364_NB_OF_ROWS 16
-
-#define EF9364_TXTPLANE_MAX_SIZE ( EF9364_NB_OF_COLUMNS * EF9364_NB_OF_ROWS )
-#define EF9364_MAX_TXTPLANES 2
+#pragma once
#define MCFG_EF9364_PALETTE(_palette_tag) \
ef9364_device::static_set_palette_tag(*device, "^" _palette_tag);
@@ -39,6 +33,12 @@ class ef9364_device : public device_t,
public device_video_interface
{
public:
+ static constexpr unsigned NB_OF_COLUMNS = 64;
+ static constexpr unsigned NB_OF_ROWS = 16;
+
+ static constexpr unsigned TXTPLANE_MAX_SIZE = NB_OF_COLUMNS * NB_OF_ROWS;
+ static constexpr unsigned MAX_TXTPLANES = 2;
+
// construction/destruction
ef9364_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
@@ -47,7 +47,6 @@ public:
static void static_set_nb_of_pages(device_t &device, int nb_bitplanes );
// device interface
-
void update_scanline(uint16_t scanline);
void set_color_entry( int index, uint8_t r, uint8_t g, uint8_t b );
@@ -98,6 +97,6 @@ private:
};
// device type definition
-extern const device_type EF9364;
+DECLARE_DEVICE_TYPE(EF9364, ef9364_device)
-#endif
+#endif // MAME_VIDEO_EF9364_H
diff --git a/src/devices/video/ef9365.cpp b/src/devices/video/ef9365.cpp
index ee57644ccaa..84f0ce7655f 100644
--- a/src/devices/video/ef9365.cpp
+++ b/src/devices/video/ef9365.cpp
@@ -69,15 +69,34 @@
#include "screen.h"
+//#define VERBOSE 1
+#include "logmacro.h"
+
+
+namespace {
+
+#define EF936X_REG_STATUS 0x00
+#define EF936X_REG_CMD 0x00
+#define EF936X_REG_CTRL1 0x01
+#define EF936X_REG_CTRL2 0x02
+#define EF936X_REG_CSIZE 0x03
+#define EF936X_REG_DELTAX 0x05
+#define EF936X_REG_DELTAY 0x07
+#define EF936X_REG_X_MSB 0x08
+#define EF936X_REG_X_LSB 0x09
+#define EF936X_REG_Y_MSB 0x0A
+#define EF936X_REG_Y_LSB 0x0B
+#define EF936X_REG_XLP 0x0C
+#define EF936X_REG_YLP 0x0D
+
-#ifdef DBGMODE
//-------------------------------------------------
// Some debug mode const strings
// to trace the commands and registers accesses.
//-------------------------------------------------
// Registers list
-const char * register_names[]=
+const char *const register_names[]=
{
"0x00 - CMD / STATUS",
"0x01 - CTRL 1 ",
@@ -98,7 +117,7 @@ const char * register_names[]=
};
// Commands list
-const char * commands_names[]=
+const char *const commands_names[]=
{
"0x00 - Set bit 1 of CTRL1 : Pen selection",
"0x01 - Clear bit 1 of CTRL1 : Eraser selection",
@@ -122,10 +141,11 @@ const char * commands_names[]=
"0x80<>0xFF - Small vector generation",
};
-#endif
+} // anonymous namespace
+
// devices
-const device_type EF9365 = device_creator<ef9365_device>;
+DEFINE_DEVICE_TYPE(EF9365, ef9365_device, "ef9365", "Thomson EF9365")
ROM_START( ef9365 )
ROM_REGION( 0x1E0, "ef9365", 0 )
@@ -147,7 +167,7 @@ const tiny_rom_entry *ef9365_device::device_rom_region() const
// Up to 512*512 per bitplane, 8 bitplanes max.
//-------------------------------------------------
static ADDRESS_MAP_START( ef9365, AS_0, 8, ef9365_device )
- AM_RANGE(0x00000, ( ( EF936X_BITPLANE_MAX_SIZE * EF936X_MAX_BITPLANES ) - 1 ) ) AM_RAM
+ AM_RANGE(0x00000, ( ( ef9365_device::BITPLANE_MAX_SIZE * ef9365_device::MAX_BITPLANES ) - 1 ) ) AM_RAM
ADDRESS_MAP_END
//-------------------------------------------------
@@ -174,7 +194,7 @@ const address_space_config *ef9365_device::memory_space_config(address_spacenum
//-------------------------------------------------
ef9365_device::ef9365_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, EF9365, "EF9365", tag, owner, clock, "ef9365", __FILE__),
+ device_t(mconfig, EF9365, tag, owner, clock),
device_memory_interface(mconfig, *this),
device_video_interface(mconfig, *this),
m_space_config("videoram", ENDIANNESS_LITTLE, 8, 18, 0, nullptr, *ADDRESS_MAP_NAME(ef9365)),
@@ -216,48 +236,48 @@ void ef9365_device::static_set_display_mode(device_t &device, int display_mode )
{
switch(display_mode)
{
- case EF936X_256x256_DISPLAY_MODE:
- downcast<ef9365_device &>(device).bitplane_xres = 256;
- downcast<ef9365_device &>(device).bitplane_yres = 256;
- downcast<ef9365_device &>(device).vsync_scanline_pos = 250;
- downcast<ef9365_device &>(device).overflow_mask_x = 0xFF00;
- downcast<ef9365_device &>(device).overflow_mask_y = 0xFF00;
+ case DISPLAY_MODE_256x256:
+ downcast<ef9365_device &>(device).bitplane_xres = 256;
+ downcast<ef9365_device &>(device).bitplane_yres = 256;
+ downcast<ef9365_device &>(device).vsync_scanline_pos = 250;
+ downcast<ef9365_device &>(device).overflow_mask_x = 0xFF00;
+ downcast<ef9365_device &>(device).overflow_mask_y = 0xFF00;
break;
- case EF936X_512x512_DISPLAY_MODE:
- downcast<ef9365_device &>(device).bitplane_xres = 512;
- downcast<ef9365_device &>(device).bitplane_yres = 512;
- downcast<ef9365_device &>(device).vsync_scanline_pos = 506;
- downcast<ef9365_device &>(device).overflow_mask_x = 0xFE00;
- downcast<ef9365_device &>(device).overflow_mask_y = 0xFE00;
+ case DISPLAY_MODE_512x512:
+ downcast<ef9365_device &>(device).bitplane_xres = 512;
+ downcast<ef9365_device &>(device).bitplane_yres = 512;
+ downcast<ef9365_device &>(device).vsync_scanline_pos = 506;
+ downcast<ef9365_device &>(device).overflow_mask_x = 0xFE00;
+ downcast<ef9365_device &>(device).overflow_mask_y = 0xFE00;
break;
- case EF936X_512x256_DISPLAY_MODE:
- downcast<ef9365_device &>(device).bitplane_xres = 512;
- downcast<ef9365_device &>(device).bitplane_yres = 256;
- downcast<ef9365_device &>(device).vsync_scanline_pos = 250;
- downcast<ef9365_device &>(device).overflow_mask_x = 0xFE00;
- downcast<ef9365_device &>(device).overflow_mask_y = 0xFF00;
+ case DISPLAY_MODE_512x256:
+ downcast<ef9365_device &>(device).bitplane_xres = 512;
+ downcast<ef9365_device &>(device).bitplane_yres = 256;
+ downcast<ef9365_device &>(device).vsync_scanline_pos = 250;
+ downcast<ef9365_device &>(device).overflow_mask_x = 0xFE00;
+ downcast<ef9365_device &>(device).overflow_mask_y = 0xFF00;
break;
- case EF936X_128x128_DISPLAY_MODE:
- downcast<ef9365_device &>(device).bitplane_xres = 128;
- downcast<ef9365_device &>(device).bitplane_yres = 128;
- downcast<ef9365_device &>(device).vsync_scanline_pos = 124;
- downcast<ef9365_device &>(device).overflow_mask_x = 0xFF80;
- downcast<ef9365_device &>(device).overflow_mask_y = 0xFF80;
+ case DISPLAY_MODE_128x128:
+ downcast<ef9365_device &>(device).bitplane_xres = 128;
+ downcast<ef9365_device &>(device).bitplane_yres = 128;
+ downcast<ef9365_device &>(device).vsync_scanline_pos = 124;
+ downcast<ef9365_device &>(device).overflow_mask_x = 0xFF80;
+ downcast<ef9365_device &>(device).overflow_mask_y = 0xFF80;
break;
- case EF936X_64x64_DISPLAY_MODE:
- downcast<ef9365_device &>(device).bitplane_xres = 64;
- downcast<ef9365_device &>(device).bitplane_yres = 64;
- downcast<ef9365_device &>(device).vsync_scanline_pos = 62;
- downcast<ef9365_device &>(device).overflow_mask_x = 0xFFC0;
- downcast<ef9365_device &>(device).overflow_mask_y = 0xFFC0;
+ case DISPLAY_MODE_64x64:
+ downcast<ef9365_device &>(device).bitplane_xres = 64;
+ downcast<ef9365_device &>(device).bitplane_yres = 64;
+ downcast<ef9365_device &>(device).vsync_scanline_pos = 62;
+ downcast<ef9365_device &>(device).overflow_mask_x = 0xFFC0;
+ downcast<ef9365_device &>(device).overflow_mask_y = 0xFFC0;
break;
- default:
- downcast<ef9365_device &>(device).logerror("Invalid EF9365 Display mode: %02x\n", display_mode);
- downcast<ef9365_device &>(device).bitplane_xres = 256;
- downcast<ef9365_device &>(device).bitplane_yres = 256;
- downcast<ef9365_device &>(device).vsync_scanline_pos = 250;
- downcast<ef9365_device &>(device).overflow_mask_x = 0xFF00;
- downcast<ef9365_device &>(device).overflow_mask_y = 0xFF00;
+ default:
+ downcast<ef9365_device &>(device).logerror("Invalid EF9365 Display mode: %02x\n", display_mode);
+ downcast<ef9365_device &>(device).bitplane_xres = 256;
+ downcast<ef9365_device &>(device).bitplane_yres = 256;
+ downcast<ef9365_device &>(device).vsync_scanline_pos = 250;
+ downcast<ef9365_device &>(device).overflow_mask_x = 0xFF00;
+ downcast<ef9365_device &>(device).overflow_mask_y = 0xFF00;
break;
}
}
@@ -512,9 +532,9 @@ void ef9365_device::plot(int x_pos,int y_pos)
for( p = 0 ; p < nb_of_bitplanes ; p++ )
{
if( m_current_color & (0x01 << p) )
- m_videoram->write_byte ( (EF936X_BITPLANE_MAX_SIZE*p) + (((y_pos*bitplane_xres) + x_pos)>>3), m_videoram->read_byte( (EF936X_BITPLANE_MAX_SIZE*p) + (((y_pos*bitplane_xres) + x_pos)>>3)) | (0x80 >> (((y_pos*bitplane_xres) + x_pos)&7) ) );
+ m_videoram->write_byte ( (BITPLANE_MAX_SIZE*p) + (((y_pos*bitplane_xres) + x_pos)>>3), m_videoram->read_byte( (BITPLANE_MAX_SIZE*p) + (((y_pos*bitplane_xres) + x_pos)>>3)) | (0x80 >> (((y_pos*bitplane_xres) + x_pos)&7) ) );
else
- m_videoram->write_byte ( (EF936X_BITPLANE_MAX_SIZE*p) + (((y_pos*bitplane_xres) + x_pos)>>3), m_videoram->read_byte( (EF936X_BITPLANE_MAX_SIZE*p) + (((y_pos*bitplane_xres) + x_pos)>>3)) & ~(0x80 >> (((y_pos*bitplane_xres) + x_pos)&7) ) );
+ m_videoram->write_byte ( (BITPLANE_MAX_SIZE*p) + (((y_pos*bitplane_xres) + x_pos)>>3), m_videoram->read_byte( (BITPLANE_MAX_SIZE*p) + (((y_pos*bitplane_xres) + x_pos)>>3)) & ~(0x80 >> (((y_pos*bitplane_xres) + x_pos)&7) ) );
}
}
else
@@ -522,7 +542,7 @@ void ef9365_device::plot(int x_pos,int y_pos)
// Eraser
for( p = 0 ; p < nb_of_bitplanes ; p++ )
{
- m_videoram->write_byte ( (EF936X_BITPLANE_MAX_SIZE*p) + (((y_pos*bitplane_xres) + x_pos)>>3), m_videoram->read_byte( (EF936X_BITPLANE_MAX_SIZE*p) + (((y_pos*bitplane_xres) + x_pos)>>3)) | (0x80 >> (((y_pos*bitplane_xres) + x_pos)&7) ) );
+ m_videoram->write_byte ( (BITPLANE_MAX_SIZE*p) + (((y_pos*bitplane_xres) + x_pos)>>3), m_videoram->read_byte( (BITPLANE_MAX_SIZE*p) + (((y_pos*bitplane_xres) + x_pos)>>3)) | (0x80 >> (((y_pos*bitplane_xres) + x_pos)&7) ) );
}
}
}
@@ -890,19 +910,17 @@ void ef9365_device::dump_bitplanes_word()
pixel_ptr = ( ( ( ( bitplane_yres - 1 ) - ( get_y_reg() & ( bitplane_yres - 1 ) ) ) * bitplane_xres ) + ( get_x_reg() & ( bitplane_xres - 1 ) ) );
- #ifdef DBGMODE
- printf("dump : x = %d , y = %d\n", get_x_reg() ,get_y_reg());
- #endif
+ LOG("dump : x = %d , y = %d\n", get_x_reg() ,get_y_reg());
for( p = 0; p < nb_of_bitplanes ; p++ )
{
if( pixel_ptr & 0x4 )
{
- m_readback_latch[p] = ( m_videoram->read_byte( (EF936X_BITPLANE_MAX_SIZE*p) + (pixel_ptr>>3) ) ) & 0xF ;
+ m_readback_latch[p] = ( m_videoram->read_byte( (BITPLANE_MAX_SIZE*p) + (pixel_ptr>>3) ) ) & 0xF ;
}
else
{
- m_readback_latch[p] = ( m_videoram->read_byte( (EF936X_BITPLANE_MAX_SIZE*p) + (pixel_ptr>>3) ) >> 4 ) & 0xF ;
+ m_readback_latch[p] = ( m_videoram->read_byte( (BITPLANE_MAX_SIZE*p) + (pixel_ptr>>3) ) >> 4 ) & 0xF ;
}
}
@@ -927,9 +945,9 @@ void ef9365_device::screen_scanning( int force_clear )
for( p = 0 ; p < nb_of_bitplanes ; p++ )
{
if( m_current_color & (0x01 << p) )
- m_videoram->write_byte ( (EF936X_BITPLANE_MAX_SIZE*p) + (((y*bitplane_xres) + x)>>3), m_videoram->read_byte( (EF936X_BITPLANE_MAX_SIZE*p) + (((y*bitplane_xres) + x)>>3)) | (0x80 >> (((y*bitplane_xres) + x)&7) ) );
+ m_videoram->write_byte ( (BITPLANE_MAX_SIZE*p) + (((y*bitplane_xres) + x)>>3), m_videoram->read_byte( (BITPLANE_MAX_SIZE*p) + (((y*bitplane_xres) + x)>>3)) | (0x80 >> (((y*bitplane_xres) + x)&7) ) );
else
- m_videoram->write_byte ( (EF936X_BITPLANE_MAX_SIZE*p) + (((y*bitplane_xres) + x)>>3), m_videoram->read_byte( (EF936X_BITPLANE_MAX_SIZE*p) + (((y*bitplane_xres) + x)>>3)) & ~(0x80 >> (((y*bitplane_xres) + x)&7) ) );
+ m_videoram->write_byte ( (BITPLANE_MAX_SIZE*p) + (((y*bitplane_xres) + x)>>3), m_videoram->read_byte( (BITPLANE_MAX_SIZE*p) + (((y*bitplane_xres) + x)>>3)) & ~(0x80 >> (((y*bitplane_xres) + x)&7) ) );
}
}
}
@@ -942,7 +960,7 @@ void ef9365_device::screen_scanning( int force_clear )
{
for( p = 0 ; p < nb_of_bitplanes ; p++ )
{
- m_videoram->write_byte ( (EF936X_BITPLANE_MAX_SIZE*p) + (((y*bitplane_xres) + x)>>3), m_videoram->read_byte( (EF936X_BITPLANE_MAX_SIZE*p) + (((y*bitplane_xres) + x)>>3)) | (0x80 >> (((y*bitplane_xres) + x)&7) ) );
+ m_videoram->write_byte ( (BITPLANE_MAX_SIZE*p) + (((y*bitplane_xres) + x)>>3), m_videoram->read_byte( (BITPLANE_MAX_SIZE*p) + (((y*bitplane_xres) + x)>>3)) | (0x80 >> (((y*bitplane_xres) + x)&7) ) );
}
}
}
@@ -961,9 +979,7 @@ void ef9365_device::ef9365_exec(uint8_t cmd)
if( ( cmd>>4 ) == 0 )
{
- #ifdef DBGMODE
- printf("EF9365 Command : %s\n", commands_names[cmd & 0xF]);
- #endif
+ LOG("EF9365 Command : %s\n", commands_names[cmd & 0xF]);
switch(cmd & 0xF)
{
@@ -1041,12 +1057,10 @@ void ef9365_device::ef9365_exec(uint8_t cmd)
{
if ( ( cmd>>4 ) == 1 )
{
- #ifdef DBGMODE
if( cmd & 0x08 )
- printf("EF9365 Command : [0x%.2X] %s\n", cmd, commands_names[0x11]);
+ LOG("EF9365 Command : [0x%.2X] %s\n", cmd, commands_names[0x11]);
else
- printf("EF9365 Command : [0x%.2X] %s\n", cmd, commands_names[0x10]);
- #endif
+ LOG("EF9365 Command : [0x%.2X] %s\n", cmd, commands_names[0x10]);
tmp_delta_x = m_registers[EF936X_REG_DELTAX];
tmp_delta_y = m_registers[EF936X_REG_DELTAY];
@@ -1094,9 +1108,7 @@ void ef9365_device::ef9365_exec(uint8_t cmd)
{
if( ( cmd>>4 ) >= 0x8 )
{
- #ifdef DBGMODE
- printf("EF9365 Command : [0x%.2X] %s\n", cmd, commands_names[0x13]);
- #endif
+ LOG("EF9365 Command : [0x%.2X] %s\n", cmd, commands_names[0x13]);
tmp_delta_x = ( cmd >> 5 ) & 3;
tmp_delta_y = ( cmd >> 3 ) & 3;
@@ -1137,9 +1149,7 @@ void ef9365_device::ef9365_exec(uint8_t cmd)
{
// Draw character
- #ifdef DBGMODE
- printf("EF9365 Command : [0x%.2X] %s\n", cmd, commands_names[0x12]);
- #endif
+ LOG("EF9365 Command : [0x%.2X] %s\n", cmd, commands_names[0x12]);
busy_cycles = draw_character( cmd - 0x20, 0 , 0 );
set_busy_flag( cycles_to_us( busy_cycles ) );
@@ -1167,7 +1177,7 @@ uint32_t ef9365_device::screen_update(screen_device &screen, bitmap_rgb32 &bitma
for( p = 0; p < nb_of_bitplanes; p++)
{
- if( m_videoram->read_byte( (EF936X_BITPLANE_MAX_SIZE*p) + (ptr>>3)) & (0x80>>(ptr&7)))
+ if( m_videoram->read_byte( (BITPLANE_MAX_SIZE*p) + (ptr>>3)) & (0x80>>(ptr&7)))
{
color_index |= (0x01<<p);
}
@@ -1291,9 +1301,7 @@ READ8_MEMBER( ef9365_device::data_r )
break;
}
- #ifdef DBGMODE
- printf("EF9365 [ %s ] RD> [ 0x%.2X ] - %s\n", register_names[offset&0xF],return_value, machine().describe_context() );
- #endif
+ LOG("EF9365 [ %s ] RD> [ 0x%.2X ] - %s\n", register_names[offset&0xF],return_value, machine().describe_context() );
return return_value;
}
@@ -1304,9 +1312,7 @@ READ8_MEMBER( ef9365_device::data_r )
WRITE8_MEMBER( ef9365_device::data_w )
{
- #ifdef DBGMODE
- printf("EF9365 [ %s ] <WR [ 0x%.2X ] - %s\n", register_names[offset&0xF],data, machine().describe_context() );
- #endif
+ LOG("EF9365 [ %s ] <WR [ 0x%.2X ] - %s\n", register_names[offset&0xF],data, machine().describe_context() );
switch(offset & 0xF)
{
diff --git a/src/devices/video/ef9365.h b/src/devices/video/ef9365.h
index 4352076528f..3f5beda3dde 100644
--- a/src/devices/video/ef9365.h
+++ b/src/devices/video/ef9365.h
@@ -8,25 +8,22 @@
*********************************************************************/
-#pragma once
-
-#ifndef __EF9365_H__
-#define __EF9365_H__
+#ifndef MAME_VIDEO_EF9365_H
+#define MAME_VIDEO_EF9365_H
-#define EF936X_BITPLANE_MAX_SIZE 0x8000
-#define EF936X_MAX_BITPLANES 8
+#pragma once
-#define MCFG_EF936X_PALETTE(_palette_tag) \
- ef9365_device::static_set_palette_tag(*device, "^" _palette_tag);
+#define MCFG_EF936X_PALETTE(palette_tag) \
+ ef9365_device::static_set_palette_tag(*device, ("^" palette_tag));
-#define MCFG_EF936X_BITPLANES_CNT(_bitplanes_number) \
- ef9365_device::static_set_nb_bitplanes(*device,_bitplanes_number);
+#define MCFG_EF936X_BITPLANES_CNT(bitplanes_number) \
+ ef9365_device::static_set_nb_bitplanes(*device, (bitplanes_number));
-#define MCFG_EF936X_DISPLAYMODE(_display_mode) \
- ef9365_device::static_set_display_mode(*device,_display_mode);
+#define MCFG_EF936X_DISPLAYMODE(display_mode) \
+ ef9365_device::static_set_display_mode(*device, (ef9365_device::display_mode));
-#define MCFG_EF936X_IRQ_HANDLER(_devcb) \
- devcb = &ef9365_device::set_irq_handler(*device, DEVCB_##_devcb);
+#define MCFG_EF936X_IRQ_HANDLER(cb) \
+ devcb = &ef9365_device::set_irq_handler(*device, (DEVCB_##cb));
//**************************************************************************
// TYPE DEFINITIONS
@@ -39,6 +36,15 @@ class ef9365_device : public device_t,
public device_video_interface
{
public:
+ static constexpr unsigned BITPLANE_MAX_SIZE = 0x8000;
+ static constexpr unsigned MAX_BITPLANES = 8;
+
+ static constexpr int DISPLAY_MODE_256x256 = 0x00;
+ static constexpr int DISPLAY_MODE_512x512 = 0x01;
+ static constexpr int DISPLAY_MODE_512x256 = 0x02;
+ static constexpr int DISPLAY_MODE_128x128 = 0x03;
+ static constexpr int DISPLAY_MODE_64x64 = 0x04;
+
// construction/destruction
ef9365_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
@@ -73,8 +79,6 @@ protected:
// address space configurations
const address_space_config m_space_config;
- // inline helper
-
private:
int get_char_pix( unsigned char c, int x, int y );
void plot(int x_pos,int y_pos);
@@ -94,7 +98,7 @@ private:
void update_interrupts();
// internal state
- static const device_timer_id BUSY_TIMER = 0;
+ static constexpr device_timer_id BUSY_TIMER = 0;
required_region_ptr<uint8_t> m_charset;
address_space *m_videoram;
@@ -118,7 +122,7 @@ private:
uint16_t overflow_mask_y;
int vsync_scanline_pos;
- uint8_t m_readback_latch[EF936X_MAX_BITPLANES]; // Last DRAM Readback buffer (Filled after a Direct Memory Access Request command)
+ uint8_t m_readback_latch[MAX_BITPLANES]; // Last DRAM Readback buffer (Filled after a Direct Memory Access Request command)
int m_readback_latch_pix_offset;
uint32_t clock_freq;
@@ -132,27 +136,6 @@ private:
};
// device type definition
-extern const device_type EF9365;
-
-#define EF936X_REG_STATUS 0x00
-#define EF936X_REG_CMD 0x00
-#define EF936X_REG_CTRL1 0x01
-#define EF936X_REG_CTRL2 0x02
-#define EF936X_REG_CSIZE 0x03
-#define EF936X_REG_DELTAX 0x05
-#define EF936X_REG_DELTAY 0x07
-#define EF936X_REG_X_MSB 0x08
-#define EF936X_REG_X_LSB 0x09
-#define EF936X_REG_Y_MSB 0x0A
-#define EF936X_REG_Y_LSB 0x0B
-#define EF936X_REG_XLP 0x0C
-#define EF936X_REG_YLP 0x0D
-
-#define EF936X_256x256_DISPLAY_MODE 0x00
-#define EF936X_512x512_DISPLAY_MODE 0x01
-#define EF936X_512x256_DISPLAY_MODE 0x02
-#define EF936X_128x128_DISPLAY_MODE 0x03
-#define EF936X_64x64_DISPLAY_MODE 0x04
-
-
-#endif
+DECLARE_DEVICE_TYPE(EF9365, ef9365_device)
+
+#endif // MAME_VIDEO_EF9365_H
diff --git a/src/devices/video/ef9369.cpp b/src/devices/video/ef9369.cpp
index 84d69c88117..2a00ff76de3 100644
--- a/src/devices/video/ef9369.cpp
+++ b/src/devices/video/ef9369.cpp
@@ -7,15 +7,16 @@
***************************************************************************/
#include "emu.h"
-#include <algorithm>
#include "ef9369.h"
+#include <algorithm>
+
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
-const device_type EF9369 = device_creator<ef9369_device>;
+DEFINE_DEVICE_TYPE(EF9369, ef9369_device, "ef9369", "Thomson EF9369 Single Chip Color Palette")
//**************************************************************************
@@ -27,8 +28,8 @@ const device_type EF9369 = device_creator<ef9369_device>;
//-------------------------------------------------
ef9369_device::ef9369_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, EF9369, "EF9369 Single Chip Color Palette", tag, owner, clock, "ef9369", __FILE__),
- m_address(0)
+ : device_t(mconfig, EF9369, tag, owner, clock)
+ , m_address(0)
{
std::fill(m_ca, m_ca + NUMCOLORS, 0);
std::fill(m_cb, m_cb + NUMCOLORS, 0);
diff --git a/src/devices/video/ef9369.h b/src/devices/video/ef9369.h
index 63b28d2cac7..b25a892a662 100644
--- a/src/devices/video/ef9369.h
+++ b/src/devices/video/ef9369.h
@@ -24,10 +24,10 @@
***************************************************************************/
-#pragma once
+#ifndef MAME_VIDEO_EF9369_H
+#define MAME_VIDEO_EF9369_H
-#ifndef __EF9369_H__
-#define __EF9369_H__
+#pragma once
@@ -39,14 +39,13 @@
MCFG_DEVICE_ADD(_tag, EF9369, 0) \
#define MCFG_EF9369_COLOR_UPDATE_CB(_class, _method) \
- ef9369_device::set_color_update_callback(*device, ef9369_color_update_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
+ ef9369_device::set_color_update_callback(*device, ef9369_device::color_update_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
-typedef device_delegate<void (int entry, bool m, uint8_t ca, uint8_t cb, uint8_t cc)> ef9369_color_update_delegate;
#define EF9369_COLOR_UPDATE(name) void name(int entry, bool m, uint8_t ca, uint8_t cb, uint8_t cc)
// ======================> ef9369_device
@@ -54,17 +53,19 @@ typedef device_delegate<void (int entry, bool m, uint8_t ca, uint8_t cb, uint8_t
class ef9369_device : public device_t
{
public:
+ typedef device_delegate<void (int entry, bool m, uint8_t ca, uint8_t cb, uint8_t cc)> color_update_delegate;
+
// construction/destruction
ef9369_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// configuration
- static void set_color_update_callback(device_t &device, ef9369_color_update_delegate callback) { downcast<ef9369_device &>(device).m_color_update_cb = callback; }
+ static void set_color_update_callback(device_t &device, color_update_delegate &&cb) { downcast<ef9369_device &>(device).m_color_update_cb = std::move(cb); }
DECLARE_READ8_MEMBER(data_r);
DECLARE_WRITE8_MEMBER(data_w);
DECLARE_WRITE8_MEMBER(address_w);
- static const int NUMCOLORS = 16;
+ static constexpr int NUMCOLORS = 16;
protected:
// device-level overrides
@@ -72,7 +73,7 @@ protected:
virtual void device_reset() override;
private:
- ef9369_color_update_delegate m_color_update_cb;
+ color_update_delegate m_color_update_cb;
// state
uint8_t m_ca[NUMCOLORS], m_cb[NUMCOLORS], m_cc[NUMCOLORS]; // actually 4-bit
@@ -81,6 +82,6 @@ private:
};
// device type definition
-extern const device_type EF9369;
+DECLARE_DEVICE_TYPE(EF9369, ef9369_device)
-#endif // __EF9369_H__
+#endif // MAME_VIDEO_EF9369_H
diff --git a/src/devices/video/epic12.cpp b/src/devices/video/epic12.cpp
index 68d1098abd5..b0ca59b160a 100644
--- a/src/devices/video/epic12.cpp
+++ b/src/devices/video/epic12.cpp
@@ -6,13 +6,13 @@
#include "epic12.h"
-
-const device_type EPIC12 = device_creator<epic12_device>;
+DEFINE_DEVICE_TYPE(EPIC12, epic12_device, "epic12", "EPIC12 Blitter")
epic12_device::epic12_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, EPIC12, "EP1C12 Blitter", tag, owner, clock, "epic12", __FILE__),
- device_video_interface(mconfig, *this), m_ram16(nullptr), m_gfx_size(0), m_bitmaps(nullptr), m_use_ram(nullptr),
- m_main_ramsize(0), m_main_rammask(0), m_maincpu(nullptr), m_ram16_copy(nullptr), m_work_queue(nullptr)
+ : device_t(mconfig, EPIC12, tag, owner, clock)
+ , device_video_interface(mconfig, *this)
+ , m_ram16(nullptr), m_gfx_size(0), m_bitmaps(nullptr), m_use_ram(nullptr)
+ , m_main_ramsize(0), m_main_rammask(0), m_maincpu(nullptr), m_ram16_copy(nullptr), m_work_queue(nullptr)
{
m_is_unsafe = 0;
m_delay_scale = 0;
@@ -29,7 +29,7 @@ epic12_device::epic12_device(const machine_config &mconfig, const char *tag, dev
m_gfx_scroll_0_y_shadowcopy = 0;
m_gfx_scroll_1_x_shadowcopy = 0;
m_gfx_scroll_1_y_shadowcopy = 0;
- epic12_device_blit_delay = 0;
+ blit_delay = 0;
}
TIMER_CALLBACK_MEMBER( epic12_device::blitter_delay_callback )
@@ -84,11 +84,11 @@ void epic12_device::device_reset()
{
for (x=0;x<0x20;x++)
{
- epic12_device_colrtable[x][y] = (x*y) / 0x1f;
- if (epic12_device_colrtable[x][y]>0x1f) epic12_device_colrtable[x][y] = 0x1f;
+ colrtable[x][y] = (x*y) / 0x1f;
+ if (colrtable[x][y]>0x1f) colrtable[x][y] = 0x1f;
- epic12_device_colrtable_rev[x^0x1f][y] = (x*y) / 0x1f;
- if (epic12_device_colrtable_rev[x^0x1f][y]>0x1f) epic12_device_colrtable_rev[x^0x1f][y] = 0x1f;
+ colrtable_rev[x^0x1f][y] = (x*y) / 0x1f;
+ if (colrtable_rev[x^0x1f][y]>0x1f) colrtable_rev[x^0x1f][y] = 0x1f;
}
}
@@ -97,8 +97,8 @@ void epic12_device::device_reset()
{
for (x=0;x<0x20;x++)
{
- epic12_device_colrtable_add[x][y] = (x+y);
- if (epic12_device_colrtable_add[x][y]>0x1f) epic12_device_colrtable_add[x][y] = 0x1f;
+ colrtable_add[x][y] = (x+y);
+ if (colrtable_add[x][y]>0x1f) colrtable_add[x][y] = 0x1f;
}
}
@@ -106,10 +106,10 @@ void epic12_device::device_reset()
}
// todo, get these into the device class without ruining performance
-uint8_t epic12_device_colrtable[0x20][0x40];
-uint8_t epic12_device_colrtable_rev[0x20][0x40];
-uint8_t epic12_device_colrtable_add[0x20][0x20];
-uint64_t epic12_device_blit_delay;
+uint8_t epic12_device::colrtable[0x20][0x40];
+uint8_t epic12_device::colrtable_rev[0x20][0x40];
+uint8_t epic12_device::colrtable_add[0x20][0x20];
+uint64_t epic12_device::blit_delay;
inline uint16_t epic12_device::READ_NEXT_WORD(offs_t *addr)
{
@@ -204,7 +204,7 @@ inline void epic12_device::gfx_upload(offs_t *addr)
-epic12_device_blitfunction epic12_device_f0_ti1_tr1_blit_funcs[] =
+const epic12_device::blitfunction epic12_device::f0_ti1_tr1_blit_funcs[64] =
{
epic12_device::draw_sprite_f0_ti1_tr1_s0_d0, epic12_device::draw_sprite_f0_ti1_tr1_s1_d0, epic12_device::draw_sprite_f0_ti1_tr1_s2_d0, epic12_device::draw_sprite_f0_ti1_tr1_s3_d0, epic12_device::draw_sprite_f0_ti1_tr1_s4_d0, epic12_device::draw_sprite_f0_ti1_tr1_s5_d0, epic12_device::draw_sprite_f0_ti1_tr1_s6_d0, epic12_device::draw_sprite_f0_ti1_tr1_s7_d0,
epic12_device::draw_sprite_f0_ti1_tr1_s0_d1, epic12_device::draw_sprite_f0_ti1_tr1_s1_d1, epic12_device::draw_sprite_f0_ti1_tr1_s2_d1, epic12_device::draw_sprite_f0_ti1_tr1_s3_d1, epic12_device::draw_sprite_f0_ti1_tr1_s4_d1, epic12_device::draw_sprite_f0_ti1_tr1_s5_d1, epic12_device::draw_sprite_f0_ti1_tr1_s6_d1, epic12_device::draw_sprite_f0_ti1_tr1_s7_d1,
@@ -216,7 +216,7 @@ epic12_device_blitfunction epic12_device_f0_ti1_tr1_blit_funcs[] =
epic12_device::draw_sprite_f0_ti1_tr1_s0_d7, epic12_device::draw_sprite_f0_ti1_tr1_s1_d7, epic12_device::draw_sprite_f0_ti1_tr1_s2_d7, epic12_device::draw_sprite_f0_ti1_tr1_s3_d7, epic12_device::draw_sprite_f0_ti1_tr1_s4_d7, epic12_device::draw_sprite_f0_ti1_tr1_s5_d7, epic12_device::draw_sprite_f0_ti1_tr1_s6_d7, epic12_device::draw_sprite_f0_ti1_tr1_s7_d7,
};
-epic12_device_blitfunction epic12_device_f0_ti1_tr0_blit_funcs[] =
+const epic12_device::blitfunction epic12_device::f0_ti1_tr0_blit_funcs[64] =
{
epic12_device::draw_sprite_f0_ti1_tr0_s0_d0, epic12_device::draw_sprite_f0_ti1_tr0_s1_d0, epic12_device::draw_sprite_f0_ti1_tr0_s2_d0, epic12_device::draw_sprite_f0_ti1_tr0_s3_d0, epic12_device::draw_sprite_f0_ti1_tr0_s4_d0, epic12_device::draw_sprite_f0_ti1_tr0_s5_d0, epic12_device::draw_sprite_f0_ti1_tr0_s6_d0, epic12_device::draw_sprite_f0_ti1_tr0_s7_d0,
epic12_device::draw_sprite_f0_ti1_tr0_s0_d1, epic12_device::draw_sprite_f0_ti1_tr0_s1_d1, epic12_device::draw_sprite_f0_ti1_tr0_s2_d1, epic12_device::draw_sprite_f0_ti1_tr0_s3_d1, epic12_device::draw_sprite_f0_ti1_tr0_s4_d1, epic12_device::draw_sprite_f0_ti1_tr0_s5_d1, epic12_device::draw_sprite_f0_ti1_tr0_s6_d1, epic12_device::draw_sprite_f0_ti1_tr0_s7_d1,
@@ -228,7 +228,7 @@ epic12_device_blitfunction epic12_device_f0_ti1_tr0_blit_funcs[] =
epic12_device::draw_sprite_f0_ti1_tr0_s0_d7, epic12_device::draw_sprite_f0_ti1_tr0_s1_d7, epic12_device::draw_sprite_f0_ti1_tr0_s2_d7, epic12_device::draw_sprite_f0_ti1_tr0_s3_d7, epic12_device::draw_sprite_f0_ti1_tr0_s4_d7, epic12_device::draw_sprite_f0_ti1_tr0_s5_d7, epic12_device::draw_sprite_f0_ti1_tr0_s6_d7, epic12_device::draw_sprite_f0_ti1_tr0_s7_d7,
};
-epic12_device_blitfunction epic12_device_f1_ti1_tr1_blit_funcs[] =
+const epic12_device::blitfunction epic12_device::f1_ti1_tr1_blit_funcs[64] =
{
epic12_device::draw_sprite_f1_ti1_tr1_s0_d0, epic12_device::draw_sprite_f1_ti1_tr1_s1_d0, epic12_device::draw_sprite_f1_ti1_tr1_s2_d0, epic12_device::draw_sprite_f1_ti1_tr1_s3_d0, epic12_device::draw_sprite_f1_ti1_tr1_s4_d0, epic12_device::draw_sprite_f1_ti1_tr1_s5_d0, epic12_device::draw_sprite_f1_ti1_tr1_s6_d0, epic12_device::draw_sprite_f1_ti1_tr1_s7_d0,
epic12_device::draw_sprite_f1_ti1_tr1_s0_d1, epic12_device::draw_sprite_f1_ti1_tr1_s1_d1, epic12_device::draw_sprite_f1_ti1_tr1_s2_d1, epic12_device::draw_sprite_f1_ti1_tr1_s3_d1, epic12_device::draw_sprite_f1_ti1_tr1_s4_d1, epic12_device::draw_sprite_f1_ti1_tr1_s5_d1, epic12_device::draw_sprite_f1_ti1_tr1_s6_d1, epic12_device::draw_sprite_f1_ti1_tr1_s7_d1,
@@ -240,7 +240,7 @@ epic12_device_blitfunction epic12_device_f1_ti1_tr1_blit_funcs[] =
epic12_device::draw_sprite_f1_ti1_tr1_s0_d7, epic12_device::draw_sprite_f1_ti1_tr1_s1_d7, epic12_device::draw_sprite_f1_ti1_tr1_s2_d7, epic12_device::draw_sprite_f1_ti1_tr1_s3_d7, epic12_device::draw_sprite_f1_ti1_tr1_s4_d7, epic12_device::draw_sprite_f1_ti1_tr1_s5_d7, epic12_device::draw_sprite_f1_ti1_tr1_s6_d7, epic12_device::draw_sprite_f1_ti1_tr1_s7_d7,
};
-epic12_device_blitfunction epic12_device_f1_ti1_tr0_blit_funcs[] =
+const epic12_device::blitfunction epic12_device::f1_ti1_tr0_blit_funcs[64] =
{
epic12_device::draw_sprite_f1_ti1_tr0_s0_d0, epic12_device::draw_sprite_f1_ti1_tr0_s1_d0, epic12_device::draw_sprite_f1_ti1_tr0_s2_d0, epic12_device::draw_sprite_f1_ti1_tr0_s3_d0, epic12_device::draw_sprite_f1_ti1_tr0_s4_d0, epic12_device::draw_sprite_f1_ti1_tr0_s5_d0, epic12_device::draw_sprite_f1_ti1_tr0_s6_d0, epic12_device::draw_sprite_f1_ti1_tr0_s7_d0,
epic12_device::draw_sprite_f1_ti1_tr0_s0_d1, epic12_device::draw_sprite_f1_ti1_tr0_s1_d1, epic12_device::draw_sprite_f1_ti1_tr0_s2_d1, epic12_device::draw_sprite_f1_ti1_tr0_s3_d1, epic12_device::draw_sprite_f1_ti1_tr0_s4_d1, epic12_device::draw_sprite_f1_ti1_tr0_s5_d1, epic12_device::draw_sprite_f1_ti1_tr0_s6_d1, epic12_device::draw_sprite_f1_ti1_tr0_s7_d1,
@@ -254,7 +254,7 @@ epic12_device_blitfunction epic12_device_f1_ti1_tr0_blit_funcs[] =
-epic12_device_blitfunction epic12_device_f0_ti0_tr1_blit_funcs[] =
+const epic12_device::blitfunction epic12_device::f0_ti0_tr1_blit_funcs[64] =
{
epic12_device::draw_sprite_f0_ti0_tr1_s0_d0, epic12_device::draw_sprite_f0_ti0_tr1_s1_d0, epic12_device::draw_sprite_f0_ti0_tr1_s2_d0, epic12_device::draw_sprite_f0_ti0_tr1_s3_d0, epic12_device::draw_sprite_f0_ti0_tr1_s4_d0, epic12_device::draw_sprite_f0_ti0_tr1_s5_d0, epic12_device::draw_sprite_f0_ti0_tr1_s6_d0, epic12_device::draw_sprite_f0_ti0_tr1_s7_d0,
epic12_device::draw_sprite_f0_ti0_tr1_s0_d1, epic12_device::draw_sprite_f0_ti0_tr1_s1_d1, epic12_device::draw_sprite_f0_ti0_tr1_s2_d1, epic12_device::draw_sprite_f0_ti0_tr1_s3_d1, epic12_device::draw_sprite_f0_ti0_tr1_s4_d1, epic12_device::draw_sprite_f0_ti0_tr1_s5_d1, epic12_device::draw_sprite_f0_ti0_tr1_s6_d1, epic12_device::draw_sprite_f0_ti0_tr1_s7_d1,
@@ -266,7 +266,7 @@ epic12_device_blitfunction epic12_device_f0_ti0_tr1_blit_funcs[] =
epic12_device::draw_sprite_f0_ti0_tr1_s0_d7, epic12_device::draw_sprite_f0_ti0_tr1_s1_d7, epic12_device::draw_sprite_f0_ti0_tr1_s2_d7, epic12_device::draw_sprite_f0_ti0_tr1_s3_d7, epic12_device::draw_sprite_f0_ti0_tr1_s4_d7, epic12_device::draw_sprite_f0_ti0_tr1_s5_d7, epic12_device::draw_sprite_f0_ti0_tr1_s6_d7, epic12_device::draw_sprite_f0_ti0_tr1_s7_d7,
};
-epic12_device_blitfunction epic12_device_f0_ti0_tr0_blit_funcs[] =
+const epic12_device::blitfunction epic12_device::f0_ti0_tr0_blit_funcs[64] =
{
epic12_device::draw_sprite_f0_ti0_tr0_s0_d0, epic12_device::draw_sprite_f0_ti0_tr0_s1_d0, epic12_device::draw_sprite_f0_ti0_tr0_s2_d0, epic12_device::draw_sprite_f0_ti0_tr0_s3_d0, epic12_device::draw_sprite_f0_ti0_tr0_s4_d0, epic12_device::draw_sprite_f0_ti0_tr0_s5_d0, epic12_device::draw_sprite_f0_ti0_tr0_s6_d0, epic12_device::draw_sprite_f0_ti0_tr0_s7_d0,
epic12_device::draw_sprite_f0_ti0_tr0_s0_d1, epic12_device::draw_sprite_f0_ti0_tr0_s1_d1, epic12_device::draw_sprite_f0_ti0_tr0_s2_d1, epic12_device::draw_sprite_f0_ti0_tr0_s3_d1, epic12_device::draw_sprite_f0_ti0_tr0_s4_d1, epic12_device::draw_sprite_f0_ti0_tr0_s5_d1, epic12_device::draw_sprite_f0_ti0_tr0_s6_d1, epic12_device::draw_sprite_f0_ti0_tr0_s7_d1,
@@ -278,7 +278,7 @@ epic12_device_blitfunction epic12_device_f0_ti0_tr0_blit_funcs[] =
epic12_device::draw_sprite_f0_ti0_tr0_s0_d7, epic12_device::draw_sprite_f0_ti0_tr0_s1_d7, epic12_device::draw_sprite_f0_ti0_tr0_s2_d7, epic12_device::draw_sprite_f0_ti0_tr0_s3_d7, epic12_device::draw_sprite_f0_ti0_tr0_s4_d7, epic12_device::draw_sprite_f0_ti0_tr0_s5_d7, epic12_device::draw_sprite_f0_ti0_tr0_s6_d7, epic12_device::draw_sprite_f0_ti0_tr0_s7_d7,
};
-epic12_device_blitfunction epic12_device_f1_ti0_tr1_blit_funcs[] =
+const epic12_device::blitfunction epic12_device::f1_ti0_tr1_blit_funcs[64] =
{
epic12_device::draw_sprite_f1_ti0_tr1_s0_d0, epic12_device::draw_sprite_f1_ti0_tr1_s1_d0, epic12_device::draw_sprite_f1_ti0_tr1_s2_d0, epic12_device::draw_sprite_f1_ti0_tr1_s3_d0, epic12_device::draw_sprite_f1_ti0_tr1_s4_d0, epic12_device::draw_sprite_f1_ti0_tr1_s5_d0, epic12_device::draw_sprite_f1_ti0_tr1_s6_d0, epic12_device::draw_sprite_f1_ti0_tr1_s7_d0,
epic12_device::draw_sprite_f1_ti0_tr1_s0_d1, epic12_device::draw_sprite_f1_ti0_tr1_s1_d1, epic12_device::draw_sprite_f1_ti0_tr1_s2_d1, epic12_device::draw_sprite_f1_ti0_tr1_s3_d1, epic12_device::draw_sprite_f1_ti0_tr1_s4_d1, epic12_device::draw_sprite_f1_ti0_tr1_s5_d1, epic12_device::draw_sprite_f1_ti0_tr1_s6_d1, epic12_device::draw_sprite_f1_ti0_tr1_s7_d1,
@@ -290,7 +290,7 @@ epic12_device_blitfunction epic12_device_f1_ti0_tr1_blit_funcs[] =
epic12_device::draw_sprite_f1_ti0_tr1_s0_d7, epic12_device::draw_sprite_f1_ti0_tr1_s1_d7, epic12_device::draw_sprite_f1_ti0_tr1_s2_d7, epic12_device::draw_sprite_f1_ti0_tr1_s3_d7, epic12_device::draw_sprite_f1_ti0_tr1_s4_d7, epic12_device::draw_sprite_f1_ti0_tr1_s5_d7, epic12_device::draw_sprite_f1_ti0_tr1_s6_d7, epic12_device::draw_sprite_f1_ti0_tr1_s7_d7,
};
-epic12_device_blitfunction epic12_device_f1_ti0_tr0_blit_funcs[] =
+const epic12_device::blitfunction epic12_device::f1_ti0_tr0_blit_funcs[64] =
{
epic12_device::draw_sprite_f1_ti0_tr0_s0_d0, epic12_device::draw_sprite_f1_ti0_tr0_s1_d0, epic12_device::draw_sprite_f1_ti0_tr0_s2_d0, epic12_device::draw_sprite_f1_ti0_tr0_s3_d0, epic12_device::draw_sprite_f1_ti0_tr0_s4_d0, epic12_device::draw_sprite_f1_ti0_tr0_s5_d0, epic12_device::draw_sprite_f1_ti0_tr0_s6_d0, epic12_device::draw_sprite_f1_ti0_tr0_s7_d0,
epic12_device::draw_sprite_f1_ti0_tr0_s0_d1, epic12_device::draw_sprite_f1_ti0_tr0_s1_d1, epic12_device::draw_sprite_f1_ti0_tr0_s2_d1, epic12_device::draw_sprite_f1_ti0_tr0_s3_d1, epic12_device::draw_sprite_f1_ti0_tr0_s4_d1, epic12_device::draw_sprite_f1_ti0_tr0_s5_d1, epic12_device::draw_sprite_f1_ti0_tr0_s6_d1, epic12_device::draw_sprite_f1_ti0_tr0_s7_d1,
@@ -320,7 +320,7 @@ inline void epic12_device::gfx_draw_shadow_copy(address_space &space, offs_t *ad
// todo, calcualte clipping.
- epic12_device_blit_delay += w*h;
+ blit_delay += w*h;
}
@@ -409,7 +409,7 @@ inline void epic12_device::gfx_draw(offs_t *addr)
}
else
{
- epic12_device_f0_ti1_tr1_blit_funcs[s_mode | (d_mode<<3)](draw_params);
+ f0_ti1_tr1_blit_funcs[s_mode | (d_mode<<3)](draw_params);
}
}
else
@@ -420,7 +420,7 @@ inline void epic12_device::gfx_draw(offs_t *addr)
}
else
{
- epic12_device_f0_ti1_tr0_blit_funcs[s_mode | (d_mode<<3)](draw_params);
+ f0_ti1_tr0_blit_funcs[s_mode | (d_mode<<3)](draw_params);
}
}
}
@@ -434,7 +434,7 @@ inline void epic12_device::gfx_draw(offs_t *addr)
}
else
{
- epic12_device_f1_ti1_tr1_blit_funcs[s_mode | (d_mode<<3)](draw_params);
+ f1_ti1_tr1_blit_funcs[s_mode | (d_mode<<3)](draw_params);
}
}
else
@@ -445,7 +445,7 @@ inline void epic12_device::gfx_draw(offs_t *addr)
}
else
{
- epic12_device_f1_ti1_tr0_blit_funcs[s_mode | (d_mode<<3)](draw_params);
+ f1_ti1_tr0_blit_funcs[s_mode | (d_mode<<3)](draw_params);
}
}
}
@@ -495,7 +495,7 @@ inline void epic12_device::gfx_draw(offs_t *addr)
}
else
{
- epic12_device_f0_ti0_tr1_blit_funcs[s_mode | (d_mode<<3)](draw_params);
+ f0_ti0_tr1_blit_funcs[s_mode | (d_mode<<3)](draw_params);
}
}
else
@@ -506,7 +506,7 @@ inline void epic12_device::gfx_draw(offs_t *addr)
}
else
{
- epic12_device_f0_ti0_tr0_blit_funcs[s_mode | (d_mode<<3)](draw_params);
+ f0_ti0_tr0_blit_funcs[s_mode | (d_mode<<3)](draw_params);
}
}
}
@@ -520,7 +520,7 @@ inline void epic12_device::gfx_draw(offs_t *addr)
}
else
{
- epic12_device_f1_ti0_tr1_blit_funcs[s_mode | (d_mode<<3)](draw_params);
+ f1_ti0_tr1_blit_funcs[s_mode | (d_mode<<3)](draw_params);
}
}
else
@@ -531,7 +531,7 @@ inline void epic12_device::gfx_draw(offs_t *addr)
}
else
{
- epic12_device_f1_ti0_tr0_blit_funcs[s_mode | (d_mode<<3)](draw_params);
+ f1_ti0_tr0_blit_funcs[s_mode | (d_mode<<3)](draw_params);
}
}
}
@@ -681,7 +681,7 @@ void *epic12_device::blit_request_callback_unsafe(void *param, int threadid)
{
epic12_device *object = reinterpret_cast<epic12_device *>(param);
- epic12_device_blit_delay = 0;
+ blit_delay = 0;
object->gfx_exec_unsafe();
return nullptr;
}
@@ -721,13 +721,13 @@ WRITE32_MEMBER( epic12_device::gfx_exec_w )
osd_work_item_release(m_blitter_request);
}
- epic12_device_blit_delay = 0;
+ blit_delay = 0;
gfx_create_shadow_copy(space); // create a copy of the blit list so we can safely thread it.
- if (epic12_device_blit_delay)
+ if (blit_delay)
{
m_blitter_busy = 1;
- m_blitter_delay_timer->adjust(attotime::from_nsec(epic12_device_blit_delay*8)); // NOT accurate timing (currently ignored anyway)
+ m_blitter_delay_timer->adjust(attotime::from_nsec(blit_delay*8)); // NOT accurate timing (currently ignored anyway)
}
m_gfx_addr_shadowcopy = m_gfx_addr;
@@ -760,10 +760,10 @@ WRITE32_MEMBER( epic12_device::gfx_exec_w_unsafe )
osd_work_item_release(m_blitter_request);
}
- if (epic12_device_blit_delay)
+ if (blit_delay)
{
m_blitter_busy = 1;
- int delay = epic12_device_blit_delay*(15 * m_delay_scale / 50);
+ int delay = blit_delay*(15 * m_delay_scale / 50);
//printf("delay %d\n", delay);
m_blitter_delay_timer->adjust(attotime::from_nsec(delay));
}
diff --git a/src/devices/video/epic12.h b/src/devices/video/epic12.h
index 07edae65a79..ce2bb88c5d3 100644
--- a/src/devices/video/epic12.h
+++ b/src/devices/video/epic12.h
@@ -1,6 +1,10 @@
// license:BSD-3-Clause
// copyright-holders:David Haywood, Luca Elia, MetalliC
/* emulation of Altera Cyclone EPIC12 FPGA programmed as a blitter */
+#ifndef MAME_VIDEO_EPIC12_H
+#define MAME_VIDEO_EPIC12_H
+
+#pragma once
#define MCFG_EPIC12_ADD(_tag) \
MCFG_DEVICE_ADD(_tag, EPIC12, 0)
@@ -9,42 +13,7 @@
epic12_device::set_mainramsize(*device, _rgn);
-extern uint8_t epic12_device_colrtable[0x20][0x40];
-extern uint8_t epic12_device_colrtable_rev[0x20][0x40];
-extern uint8_t epic12_device_colrtable_add[0x20][0x20];
-extern uint64_t epic12_device_blit_delay;
-
-struct _clr_t
-{
- uint8_t b,g,r,t;
-};
-
-typedef struct _clr_t clr_t;
-
-union colour_t
-{
- clr_t trgb;
- uint32_t u32;
-};
-
-typedef void (*epic12_device_blitfunction)(bitmap_rgb32 *,
- const rectangle *,
- uint32_t *, /* gfx */
- int , /* src_x */
- int , /* src_y */
- const int , /* dst_x_start */
- const int , /* dst_y_start */
- int , /* dimx */
- int , /* dimy */
- const int , /* flipy */
- const uint8_t , /* s_alpha */
- const uint8_t , /* d_alpha */
- //int , /* tint */
- const clr_t * );
-
-
-class epic12_device : public device_t,
- public device_video_interface
+class epic12_device : public device_t, public device_video_interface
{
public:
epic12_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
@@ -114,6 +83,167 @@ public:
void gfx_exec_unsafe(void);
static void *blit_request_callback_unsafe(void *param, int threadid);
+protected:
+ struct clr_t
+ {
+ // clr_t to r5g5b5
+ uint32_t to_pen() const
+ {
+ // --t- ---- rrrr r--- gggg g--- bbbb b--- format
+ return (r << (16 + 3)) | (g << (8 + 3)) | (b << 3);
+
+ // --t- ---- ---r rrrr ---g gggg ---b bbbb format
+ //return (r << 16) | (g << 8) | b;
+ }
+
+
+ void add_with_clr_mul_fixed(const clr_t &clr0, uint8_t mulfixed_val, const clr_t &mulfixed_clr0)
+ {
+ r = colrtable_add[clr0.r][colrtable[mulfixed_clr0.r][mulfixed_val]];
+ g = colrtable_add[clr0.g][colrtable[mulfixed_clr0.g][mulfixed_val]];
+ b = colrtable_add[clr0.b][colrtable[mulfixed_clr0.b][mulfixed_val]];
+ }
+
+ void add_with_clr_mul_3param(const clr_t &clr0, const clr_t &clr1, const clr_t &clr2)
+ {
+ r = colrtable_add[clr0.r][colrtable[clr2.r][clr1.r]];
+ g = colrtable_add[clr0.g][colrtable[clr2.g][clr1.g]];
+ b = colrtable_add[clr0.b][colrtable[clr2.b][clr1.b]];
+ }
+
+ void add_with_clr_square(const clr_t &clr0, const clr_t &clr1)
+ {
+ r = colrtable_add[clr0.r][colrtable[clr1.r][clr1.r]];
+ g = colrtable_add[clr0.r][colrtable[clr1.g][clr1.g]];
+ b = colrtable_add[clr0.r][colrtable[clr1.b][clr1.b]];
+ }
+
+ void add_with_clr_mul_fixed_rev(const clr_t &clr0, uint8_t val, const clr_t &clr1)
+ {
+ r = colrtable_add[clr0.r][colrtable_rev[val][clr1.r]];
+ g = colrtable_add[clr0.g][colrtable_rev[val][clr1.g]];
+ b = colrtable_add[clr0.b][colrtable_rev[val][clr1.b]];
+ }
+
+ void add_with_clr_mul_rev_3param(const clr_t &clr0, const clr_t &clr1, const clr_t &clr2)
+ {
+ r = colrtable_add[clr0.r][colrtable_rev[clr2.r][clr1.r]];
+ g = colrtable_add[clr0.g][colrtable_rev[clr2.g][clr1.g]];
+ b = colrtable_add[clr0.b][colrtable_rev[clr2.b][clr1.b]];
+ }
+
+ void add_with_clr_mul_rev_square(const clr_t &clr0, const clr_t &clr1)
+ {
+ r = colrtable_add[clr0.r][colrtable_rev[(clr1.r)][(clr1.r)]];
+ g = colrtable_add[clr0.g][colrtable_rev[(clr1.g)][(clr1.g)]];
+ b = colrtable_add[clr0.b][colrtable_rev[(clr1.b)][(clr1.b)]];
+ }
+
+
+ void add(const clr_t &clr0, const clr_t &clr1)
+ {
+ //r = clr0.r + clr1.r;
+ //g = clr0.g + clr1.g;
+ //b = clr0.b + clr1.b;
+
+ // use pre-clamped lookup table
+ r = colrtable_add[clr0.r][clr1.r];
+ g = colrtable_add[clr0.g][clr1.g];
+ b = colrtable_add[clr0.b][clr1.b];
+ }
+
+
+ void mul(const clr_t &clr1)
+ {
+ r = colrtable[r][clr1.r];
+ g = colrtable[g][clr1.g];
+ b = colrtable[b][clr1.b];
+ }
+
+ void square(const clr_t &clr1)
+ {
+ r = colrtable[clr1.r][clr1.r];
+ g = colrtable[clr1.g][clr1.g];
+ b = colrtable[clr1.b][clr1.b];
+ }
+
+ void mul_3param(const clr_t &clr1, const clr_t &clr2)
+ {
+ r = colrtable[clr2.r][clr1.r];
+ g = colrtable[clr2.g][clr1.g];
+ b = colrtable[clr2.b][clr1.b];
+ }
+
+ void mul_rev(const clr_t &clr1)
+ {
+ r = colrtable_rev[r][clr1.r];
+ g = colrtable_rev[g][clr1.g];
+ b = colrtable_rev[b][clr1.b];
+ }
+
+ void mul_rev_square(const clr_t &clr1)
+ {
+ r = colrtable_rev[clr1.r][clr1.r];
+ g = colrtable_rev[clr1.g][clr1.g];
+ b = colrtable_rev[clr1.b][clr1.b];
+ }
+
+
+ void mul_rev_3param(const clr_t &clr1, const clr_t &clr2)
+ {
+ r = colrtable_rev[clr2.r][clr1.r];
+ g = colrtable_rev[clr2.g][clr1.g];
+ b = colrtable_rev[clr2.b][clr1.b];
+ }
+
+ void mul_fixed(uint8_t val, const clr_t &clr0)
+ {
+ r = colrtable[val][clr0.r];
+ g = colrtable[val][clr0.g];
+ b = colrtable[val][clr0.b];
+ }
+
+ void mul_fixed_rev(uint8_t val, const clr_t &clr0)
+ {
+ r = colrtable_rev[val][clr0.r];
+ g = colrtable_rev[val][clr0.g];
+ b = colrtable_rev[val][clr0.b];
+ }
+
+ void copy(const clr_t &clr0)
+ {
+ r = clr0.r;
+ g = clr0.g;
+ b = clr0.b;
+ }
+
+
+ uint8_t b, g, r, t;
+ };
+
+ union colour_t
+ {
+ clr_t trgb;
+ uint32_t u32;
+ };
+
+ typedef void (*blitfunction)(
+ bitmap_rgb32 *,
+ const rectangle *,
+ uint32_t *gfx,
+ int src_x,
+ int src_y,
+ const int dst_x_start,
+ const int dst_y_start,
+ int dimx,
+ int dimy,
+ const int flipy,
+ const uint8_t s_alpha,
+ const uint8_t d_alpha,
+ //int tint,
+ const clr_t *);
+
+
#define BLIT_FUNCTION static void
#define BLIT_PARAMS bitmap_rgb32 *bitmap, const rectangle *clip, uint32_t *gfx, int src_x, int src_y, const int dst_x_start, const int dst_y_start, int dimx, int dimy, const int flipy, const uint8_t s_alpha, const uint8_t d_alpha, const clr_t *tint_clr
@@ -668,146 +798,13 @@ public:
// convert separate r,g,b biases (0..80..ff) to clr_t (-1f..0..1f)
- static inline void tint_to_clr(uint8_t r, uint8_t g, uint8_t b, clr_t *clr)
+ void tint_to_clr(uint8_t r, uint8_t g, uint8_t b, clr_t *clr)
{
clr->r = r>>2;
clr->g = g>>2;
clr->b = b>>2;
};
- // clr_t to r5g5b5
- static inline uint32_t clr_to_pen(const clr_t *clr)
- {
- // --t- ---- rrrr r--- gggg g--- bbbb b--- format
- return (clr->r << (16+3)) | (clr->g << (8+3)) | (clr->b << 3);
-
- // --t- ---- ---r rrrr ---g gggg ---b bbbb format
- // return (clr->r << (16)) | (clr->g << (8)) | (clr->b);
- };
-
-
- static inline void clr_add_with_clr_mul_fixed(clr_t *clr, const clr_t *clr0, const uint8_t mulfixed_val, const clr_t *mulfixed_clr0)
- {
- clr->r = epic12_device_colrtable_add[clr0->r][epic12_device_colrtable[(mulfixed_clr0->r)][mulfixed_val]];
- clr->g = epic12_device_colrtable_add[clr0->g][epic12_device_colrtable[(mulfixed_clr0->g)][mulfixed_val]];
- clr->b = epic12_device_colrtable_add[clr0->b][epic12_device_colrtable[(mulfixed_clr0->b)][mulfixed_val]];
- }
-
- static inline void clr_add_with_clr_mul_3param(clr_t *clr, const clr_t *clr0, const clr_t *clr1, const clr_t *clr2)
- {
- clr->r = epic12_device_colrtable_add[clr0->r][epic12_device_colrtable[(clr2->r)][(clr1->r)]];
- clr->g = epic12_device_colrtable_add[clr0->g][epic12_device_colrtable[(clr2->g)][(clr1->g)]];
- clr->b = epic12_device_colrtable_add[clr0->b][epic12_device_colrtable[(clr2->b)][(clr1->b)]];
- }
-
- static inline void clr_add_with_clr_square(clr_t *clr, const clr_t *clr0, const clr_t *clr1)
- {
- clr->r = epic12_device_colrtable_add[clr0->r][epic12_device_colrtable[(clr1->r)][(clr1->r)]];
- clr->g = epic12_device_colrtable_add[clr0->r][epic12_device_colrtable[(clr1->g)][(clr1->g)]];
- clr->b = epic12_device_colrtable_add[clr0->r][epic12_device_colrtable[(clr1->b)][(clr1->b)]];
- }
-
- static inline void clr_add_with_clr_mul_fixed_rev(clr_t *clr, const clr_t *clr0, const uint8_t val, const clr_t *clr1)
- {
- clr->r = epic12_device_colrtable_add[clr0->r][epic12_device_colrtable_rev[val][(clr1->r)]];
- clr->g = epic12_device_colrtable_add[clr0->g][epic12_device_colrtable_rev[val][(clr1->g)]];
- clr->b = epic12_device_colrtable_add[clr0->b][epic12_device_colrtable_rev[val][(clr1->b)]];
- }
-
- static inline void clr_add_with_clr_mul_rev_3param(clr_t *clr, const clr_t *clr0, const clr_t *clr1, const clr_t *clr2)
- {
- clr->r = epic12_device_colrtable_add[clr0->r][epic12_device_colrtable_rev[(clr2->r)][(clr1->r)]];
- clr->g = epic12_device_colrtable_add[clr0->g][epic12_device_colrtable_rev[(clr2->g)][(clr1->g)]];
- clr->b = epic12_device_colrtable_add[clr0->b][epic12_device_colrtable_rev[(clr2->b)][(clr1->b)]];
- }
-
- static inline void clr_add_with_clr_mul_rev_square(clr_t *clr, const clr_t *clr0, const clr_t *clr1)
- {
- clr->r = epic12_device_colrtable_add[clr0->r][epic12_device_colrtable_rev[(clr1->r)][(clr1->r)]];
- clr->g = epic12_device_colrtable_add[clr0->g][epic12_device_colrtable_rev[(clr1->g)][(clr1->g)]];
- clr->b = epic12_device_colrtable_add[clr0->b][epic12_device_colrtable_rev[(clr1->b)][(clr1->b)]];
- }
-
-
- static inline void clr_add(clr_t *clr, const clr_t *clr0, const clr_t *clr1)
- {
- /*
- clr->r = clr0->r + clr1->r;
- clr->g = clr0->g + clr1->g;
- clr->b = clr0->b + clr1->b;
- */
- // use pre-clamped lookup table
- clr->r = epic12_device_colrtable_add[clr0->r][clr1->r];
- clr->g = epic12_device_colrtable_add[clr0->g][clr1->g];
- clr->b = epic12_device_colrtable_add[clr0->b][clr1->b];
-
- }
-
-
- static inline void clr_mul(clr_t *clr0, const clr_t *clr1)
- {
- clr0->r = epic12_device_colrtable[(clr0->r)][(clr1->r)];
- clr0->g = epic12_device_colrtable[(clr0->g)][(clr1->g)];
- clr0->b = epic12_device_colrtable[(clr0->b)][(clr1->b)];
- }
-
- static inline void clr_square(clr_t *clr0, const clr_t *clr1)
- {
- clr0->r = epic12_device_colrtable[(clr1->r)][(clr1->r)];
- clr0->g = epic12_device_colrtable[(clr1->g)][(clr1->g)];
- clr0->b = epic12_device_colrtable[(clr1->b)][(clr1->b)];
- }
-
- static inline void clr_mul_3param(clr_t *clr0, const clr_t *clr1, const clr_t *clr2)
- {
- clr0->r = epic12_device_colrtable[(clr2->r)][(clr1->r)];
- clr0->g = epic12_device_colrtable[(clr2->g)][(clr1->g)];
- clr0->b = epic12_device_colrtable[(clr2->b)][(clr1->b)];
- }
-
- static inline void clr_mul_rev(clr_t *clr0, const clr_t *clr1)
- {
- clr0->r = epic12_device_colrtable_rev[(clr0->r)][(clr1->r)];
- clr0->g = epic12_device_colrtable_rev[(clr0->g)][(clr1->g)];
- clr0->b = epic12_device_colrtable_rev[(clr0->b)][(clr1->b)];
- }
-
- static inline void clr_mul_rev_square(clr_t *clr0, const clr_t *clr1)
- {
- clr0->r = epic12_device_colrtable_rev[(clr1->r)][(clr1->r)];
- clr0->g = epic12_device_colrtable_rev[(clr1->g)][(clr1->g)];
- clr0->b = epic12_device_colrtable_rev[(clr1->b)][(clr1->b)];
- }
-
-
- static inline void clr_mul_rev_3param(clr_t *clr0, const clr_t *clr1, const clr_t *clr2)
- {
- clr0->r = epic12_device_colrtable_rev[(clr2->r)][(clr1->r)];
- clr0->g = epic12_device_colrtable_rev[(clr2->g)][(clr1->g)];
- clr0->b = epic12_device_colrtable_rev[(clr2->b)][(clr1->b)];
- }
-
- static inline void clr_mul_fixed(clr_t *clr, const uint8_t val, const clr_t *clr0)
- {
- clr->r = epic12_device_colrtable[val][(clr0->r)];
- clr->g = epic12_device_colrtable[val][(clr0->g)];
- clr->b = epic12_device_colrtable[val][(clr0->b)];
- }
-
- static inline void clr_mul_fixed_rev(clr_t *clr, const uint8_t val, const clr_t *clr0)
- {
- clr->r = epic12_device_colrtable_rev[val][(clr0->r)];
- clr->g = epic12_device_colrtable_rev[val][(clr0->g)];
- clr->b = epic12_device_colrtable_rev[val][(clr0->b)];
- }
-
- static inline void clr_copy(clr_t *clr, const clr_t *clr0)
- {
- clr->r = clr0->r;
- clr->g = clr0->g;
- clr->b = clr0->b;
- }
-
// (1|s|d) * s_factor * s + (1|s|d) * d_factor * d
@@ -821,10 +818,11 @@ public:
// 7: *
-protected:
virtual void device_start() override;
virtual void device_reset() override;
+ TIMER_CALLBACK_MEMBER( blitter_delay_callback );
+
osd_work_queue *m_work_queue;
osd_work_item *m_blitter_request;
@@ -832,9 +830,22 @@ protected:
emu_timer *m_blitter_delay_timer;
int m_blitter_busy;
- TIMER_CALLBACK_MEMBER( blitter_delay_callback );
+ static uint8_t colrtable[0x20][0x40];
+ static uint8_t colrtable_rev[0x20][0x40];
+ static uint8_t colrtable_add[0x20][0x20];
+ static uint64_t blit_delay;
+
+ static const blitfunction f0_ti1_tr1_blit_funcs[64];
+ static const blitfunction f0_ti1_tr0_blit_funcs[64];
+ static const blitfunction f1_ti1_tr1_blit_funcs[64];
+ static const blitfunction f1_ti1_tr0_blit_funcs[64];
+ static const blitfunction f0_ti0_tr1_blit_funcs[64];
+ static const blitfunction f0_ti0_tr0_blit_funcs[64];
+ static const blitfunction f1_ti0_tr1_blit_funcs[64];
+ static const blitfunction f1_ti0_tr0_blit_funcs[64];
};
+DECLARE_DEVICE_TYPE(EPIC12, epic12_device)
-extern const device_type EPIC12;
+#endif // MAME_VIDEO_EPIC12_H
diff --git a/src/devices/video/epic12in.hxx b/src/devices/video/epic12in.hxx
index 13f29e6f609..a74249f986e 100644
--- a/src/devices/video/epic12in.hxx
+++ b/src/devices/video/epic12in.hxx
@@ -86,23 +86,23 @@ void epic12_device::FUNCNAME(BLIT_PARAMS)
// wrong/unsafe slowdown sim
if (dimy > starty && dimx > startx)
{
- epic12_device_blit_delay += (dimy - starty)*(dimx - startx);
+ blit_delay += (dimy - starty)*(dimx - startx);
- //printf("delay is now %d\n", epic12_device_blit_delay);
+ //printf("delay is now %d\n", blit_delay);
}
#if BLENDED == 1
#if _SMODE == 0
#if _DMODE == 0
- const uint8_t* salpha_table = epic12_device_colrtable[s_alpha];
- const uint8_t* dalpha_table = epic12_device_colrtable[d_alpha];
+ const uint8_t* salpha_table = colrtable[s_alpha];
+ const uint8_t* dalpha_table = colrtable[d_alpha];
#endif
#if _DMODE == 5
- const uint8_t* salpha_table = epic12_device_colrtable[s_alpha];
+ const uint8_t* salpha_table = colrtable[s_alpha];
#endif
#if _DMODE == 1
- const uint8_t* salpha_table = epic12_device_colrtable[s_alpha];
+ const uint8_t* salpha_table = colrtable[s_alpha];
#endif
#endif
@@ -110,7 +110,7 @@ void epic12_device::FUNCNAME(BLIT_PARAMS)
#if _SMODE == 2
#if _DMODE == 0
- const uint8_t* dalpha_table = epic12_device_colrtable[d_alpha];
+ const uint8_t* dalpha_table = colrtable[d_alpha];
#endif
#endif
#endif
diff --git a/src/devices/video/epic12pixel.hxx b/src/devices/video/epic12pixel.hxx
index 65666470e40..f324e629b97 100644
--- a/src/devices/video/epic12pixel.hxx
+++ b/src/devices/video/epic12pixel.hxx
@@ -42,7 +42,7 @@
// source * intesity and clamp
#if TINT == 1
- clr_mul(&s_clr.trgb, tint_clr);
+ s_clr.trgb.mul(*tint_clr);
#endif
#if BLENDED == 1
@@ -58,98 +58,98 @@
//g_profiler.start(PROFILER_USER1);
// this is used extensively in the games (ingame, futari title screens etc.)
- s_clr.trgb.r = epic12_device_colrtable_add[salpha_table[(s_clr.trgb.r)]][dalpha_table[(d_clr.trgb.r)]];
- s_clr.trgb.g = epic12_device_colrtable_add[salpha_table[(s_clr.trgb.g)]][dalpha_table[(d_clr.trgb.g)]];
- s_clr.trgb.b = epic12_device_colrtable_add[salpha_table[(s_clr.trgb.b)]][dalpha_table[(d_clr.trgb.b)]];
+ s_clr.trgb.r = colrtable_add[salpha_table[(s_clr.trgb.r)]][dalpha_table[(d_clr.trgb.r)]];
+ s_clr.trgb.g = colrtable_add[salpha_table[(s_clr.trgb.g)]][dalpha_table[(d_clr.trgb.g)]];
+ s_clr.trgb.b = colrtable_add[salpha_table[(s_clr.trgb.b)]][dalpha_table[(d_clr.trgb.b)]];
#elif _DMODE == 1
//g_profiler.start(PROFILER_USER2);
// futari ~7%
- s_clr.trgb.r = epic12_device_colrtable_add[salpha_table[(s_clr.trgb.r)]][epic12_device_colrtable[(s_clr.trgb.r)][(d_clr.trgb.r)]];
- s_clr.trgb.g = epic12_device_colrtable_add[salpha_table[(s_clr.trgb.g)]][epic12_device_colrtable[(s_clr.trgb.g)][(d_clr.trgb.g)]];
- s_clr.trgb.b = epic12_device_colrtable_add[salpha_table[(s_clr.trgb.b)]][epic12_device_colrtable[(s_clr.trgb.b)][(d_clr.trgb.b)]];
+ s_clr.trgb.r = colrtable_add[salpha_table[(s_clr.trgb.r)]][colrtable[(s_clr.trgb.r)][(d_clr.trgb.r)]];
+ s_clr.trgb.g = colrtable_add[salpha_table[(s_clr.trgb.g)]][colrtable[(s_clr.trgb.g)][(d_clr.trgb.g)]];
+ s_clr.trgb.b = colrtable_add[salpha_table[(s_clr.trgb.b)]][colrtable[(s_clr.trgb.b)][(d_clr.trgb.b)]];
#elif _DMODE == 2
//g_profiler.start(PROFILER_USER3);
- clr_mul_fixed(&clr0.trgb, s_alpha, &s_clr.trgb);
- clr_add_with_clr_square(&s_clr.trgb, &clr0.trgb, &d_clr.trgb);
+ clr0.trgb.mul_fixed(s_alpha, s_clr.trgb);
+ s_clr.trgb.add_with_clr_square(clr0.trgb, d_clr.trgb);
#elif _DMODE == 3
//g_profiler.start(PROFILER_USER4);
- clr_mul_fixed(&clr0.trgb, s_alpha, &s_clr.trgb);
- clr_add(&s_clr.trgb, &clr0.trgb, &d_clr.trgb);
+ clr0.trgb.mul_fixed(s_alpha, s_clr.trgb);
+ s_clr.trgb.add(clr0.trgb, d_clr.trgb);
#elif _DMODE == 4
//g_profiler.start(PROFILER_USER5);
- clr_mul_fixed(&clr0.trgb, s_alpha, &s_clr.trgb);
- clr_add_with_clr_mul_fixed_rev(&s_clr.trgb, &clr0.trgb, d_alpha, &d_clr.trgb);
+ clr0.trgb.mul_fixed(s_alpha, s_clr.trgb);
+ s_clr.trgb.add_with_clr_mul_fixed_rev(clr0.trgb, d_alpha, d_clr.trgb);
#elif _DMODE == 5
// futari black character select ~13%
//g_profiler.start(PROFILER_USER6);
- s_clr.trgb.r = epic12_device_colrtable_add[salpha_table[(s_clr.trgb.r)]][epic12_device_colrtable_rev[(s_clr.trgb.r)][(d_clr.trgb.r)]];
- s_clr.trgb.g = epic12_device_colrtable_add[salpha_table[(s_clr.trgb.g)]][epic12_device_colrtable_rev[(s_clr.trgb.g)][(d_clr.trgb.g)]];
- s_clr.trgb.b = epic12_device_colrtable_add[salpha_table[(s_clr.trgb.b)]][epic12_device_colrtable_rev[(s_clr.trgb.b)][(d_clr.trgb.b)]];
+ s_clr.trgb.r = colrtable_add[salpha_table[(s_clr.trgb.r)]][colrtable_rev[(s_clr.trgb.r)][(d_clr.trgb.r)]];
+ s_clr.trgb.g = colrtable_add[salpha_table[(s_clr.trgb.g)]][colrtable_rev[(s_clr.trgb.g)][(d_clr.trgb.g)]];
+ s_clr.trgb.b = colrtable_add[salpha_table[(s_clr.trgb.b)]][colrtable_rev[(s_clr.trgb.b)][(d_clr.trgb.b)]];
#elif _DMODE == 6
//g_profiler.start(PROFILER_USER7);
- clr_mul_fixed(&clr0.trgb, s_alpha, &s_clr.trgb);
- clr_add_with_clr_mul_rev_square(&s_clr.trgb, &clr0.trgb, &d_clr.trgb);
+ clr0.trgb.mul_fixed(s_alpha, s_clr.trgb);
+ s_clr.trgb.add_with_clr_mul_rev_square(clr0.trgb, d_clr.trgb);
#elif _DMODE == 7
//g_profiler.start(PROFILER_USER8);
- clr_mul_fixed(&clr0.trgb, s_alpha, &s_clr.trgb);
- clr_add(&s_clr.trgb, &clr0.trgb, &d_clr.trgb);
+ clr0.trgb.mul_fixed(s_alpha, s_clr.trgb);
+ s_clr.trgb.add(clr0.trgb, d_clr.trgb);
#endif
//g_profiler.stop();
#elif _SMODE == 1
//g_profiler.start(PROFILER_USER6);
- clr_square(&clr0.trgb, &s_clr.trgb);
+ clr0.trgb.square(s_clr.trgb);
#elif _SMODE == 2
// g_profiler.start(PROFILER_USER4);
#if _DMODE == 0
// this is used heavily on espgal2 highscore screen (~28%) optimized to avoid use of temp clr0 variable
- s_clr.trgb.r = epic12_device_colrtable_add[epic12_device_colrtable[(d_clr.trgb.r)][(s_clr.trgb.r)]][dalpha_table[(d_clr.trgb.r)]];
- s_clr.trgb.g = epic12_device_colrtable_add[epic12_device_colrtable[(d_clr.trgb.g)][(s_clr.trgb.g)]][dalpha_table[(d_clr.trgb.g)]];
- s_clr.trgb.b = epic12_device_colrtable_add[epic12_device_colrtable[(d_clr.trgb.b)][(s_clr.trgb.b)]][dalpha_table[(d_clr.trgb.b)]];
+ s_clr.trgb.r = colrtable_add[colrtable[(d_clr.trgb.r)][(s_clr.trgb.r)]][dalpha_table[(d_clr.trgb.r)]];
+ s_clr.trgb.g = colrtable_add[colrtable[(d_clr.trgb.g)][(s_clr.trgb.g)]][dalpha_table[(d_clr.trgb.g)]];
+ s_clr.trgb.b = colrtable_add[colrtable[(d_clr.trgb.b)][(s_clr.trgb.b)]][dalpha_table[(d_clr.trgb.b)]];
#elif _DMODE == 1
- clr_mul_3param(&clr0.trgb, &s_clr.trgb, &d_clr.trgb);
- clr_add_with_clr_mul_3param(&s_clr.trgb, &clr0.trgb, &d_clr.trgb, &s_clr.trgb);
+ clr0.trgb.mul_3param(s_clr.trgb, d_clr.trgb);
+ s_clr.trgb.add_with_clr_mul_3param(clr0.trgb, d_clr.trgb, s_clr.trgb);
#elif _DMODE == 2
- clr_mul_3param(&clr0.trgb, &s_clr.trgb, &d_clr.trgb);
- clr_add_with_clr_square(&s_clr.trgb, &clr0.trgb, &d_clr.trgb);
+ clr0.trgb.mul_3param(s_clr.trgb, d_clr.trgb);
+ s_clr.trgb.add_with_clr_square(clr0.trgb, d_clr.trgb);
#elif _DMODE == 3
- clr_mul_3param(&clr0.trgb, &s_clr.trgb, &d_clr.trgb);
- clr_add(&s_clr.trgb, &clr0.trgb, &d_clr.trgb);
+ clr0.trgb.mul_3param(s_clr.trgb, d_clr.trgb);
+ s_clr.trgb.add(clr0.trgb, d_clr.trgb);
#elif _DMODE == 4
- clr_mul_3param(&clr0.trgb, &s_clr.trgb, &d_clr.trgb);
- clr_add_with_clr_mul_fixed_rev(&s_clr.trgb, &clr0.trgb, d_alpha, &d_clr.trgb);
+ clr0.trgb.mul_3param(s_clr.trgb, d_clr.trgb);
+ s_clr.trgb.add_with_clr_mul_fixed_rev(clr0.trgb, d_alpha, d_clr.trgb);
#elif _DMODE == 5
- clr_mul_3param(&clr0.trgb, &s_clr.trgb, &d_clr.trgb);
- clr_add_with_clr_mul_rev_3param(&s_clr.trgb, &clr0.trgb, &d_clr.trgb, &s_clr.trgb);
+ clr0.trgb.mul_3param(s_clr.trgb, d_clr.trgb);
+ s_clr.trgb.add_with_clr_mul_rev_3param(clr0.trgb, d_clr.trgb, s_clr.trgb);
#elif _DMODE == 6
- clr_mul_3param(&clr0.trgb, &s_clr.trgb, &d_clr.trgb);
- clr_add_with_clr_mul_rev_square(&s_clr.trgb, &clr0.trgb, &d_clr.trgb);
+ clr0.trgb.mul_3param(s_clr.trgb, d_clr.trgb);
+ s_clr.trgb.add_with_clr_mul_rev_square(clr0.trgb, d_clr.trgb);
#elif _DMODE == 7
- clr_mul_3param(&clr0.trgb, &s_clr.trgb, &d_clr.trgb);
- clr_add(&s_clr.trgb, &clr0.trgb, &d_clr.trgb);
+ clr0.trgb.mul_3param(s_clr.trgb, d_clr.trgb);
+ s_clr.trgb.add(clr0.trgb, d_clr.trgb);
#endif
//g_profiler.stop();
#elif _SMODE == 3
//g_profiler.start(PROFILER_USER1);
- clr_copy(&clr0.trgb, &s_clr.trgb);
+ clr0.trgb.copy(s_clr.trgb);
#elif _SMODE == 4
//g_profiler.start(PROFILER_USER2);
- clr_mul_fixed_rev(&clr0.trgb, s_alpha, &s_clr.trgb);
+ clr0.trgb.mul_fixed_rev(s_alpha, s_clr.trgb);
#elif _SMODE == 5
//g_profiler.start(PROFILER_USER3);
- clr_mul_rev_square(&clr0.trgb, &s_clr.trgb);
+ clr0.trgb.mul_rev_square(s_clr.trgb);
#elif _SMODE == 6
//g_profiler.start(PROFILER_USER4);
- clr_mul_rev_3param(&clr0.trgb, &s_clr.trgb, &d_clr.trgb);
+ clr0.trgb.mul_rev_3param(s_clr.trgb, d_clr.trgb);
#elif _SMODE == 7
//g_profiler.start(PROFILER_USER5);
- clr_copy(&clr0.trgb, &s_clr.trgb);
+ clr0.trgb.copy(s_clr.trgb);
#endif
@@ -158,22 +158,22 @@
#if _SMODE != 0
#if _DMODE == 0
- clr_add_with_clr_mul_fixed(&s_clr.trgb, &clr0.trgb, d_alpha, &d_clr.trgb);
+ s_clr.trgb.add_with_clr_mul_fixed(clr0.trgb, d_alpha, d_clr.trgb);
#elif _DMODE == 1
- clr_add_with_clr_mul_3param(&s_clr.trgb, &clr0.trgb, &d_clr.trgb, &s_clr.trgb);
+ s_clr.trgb.add_with_clr_mul_3param(clr0.trgb, d_clr.trgb, s_clr.trgb);
#elif _DMODE == 2
- clr_add_with_clr_square(&s_clr.trgb, &clr0.trgb, &d_clr.trgb);
+ s_clr.trgb.add_with_clr_square(clr0.trgb, d_clr.trgb);
#elif _DMODE == 3
- clr_add(&s_clr.trgb, &clr0.trgb, &d_clr.trgb);
+ s_clr.trgb.add(clr0.trgb, d_clr.trgb);
#elif _DMODE == 4
- clr_add_with_clr_mul_fixed_rev(&s_clr.trgb, &clr0.trgb, d_alpha, &d_clr.trgb);
+ s_clr.trgb.add_with_clr_mul_fixed_rev(clr0.trgb, d_alpha, d_clr.trgb);
#elif _DMODE == 5
- clr_add_with_clr_mul_rev_3param(&s_clr.trgb, &clr0.trgb, &d_clr.trgb, &s_clr.trgb);
+ s_clr.trgb.add_with_clr_mul_rev_3param(clr0.trgb, d_clr.trgb, s_clr.trgb);
#elif _DMODE == 6
- clr_add_with_clr_mul_rev_square(&s_clr.trgb, &clr0.trgb, &d_clr.trgb);
+ s_clr.trgb.add_with_clr_mul_rev_square(clr0.trgb, d_clr.trgb);
#elif _DMODE == 7
- clr_add(&s_clr.trgb, &clr0.trgb, &d_clr.trgb);
+ s_clr.trgb.add(clr0.trgb, d_clr.trgb);
#endif
//g_profiler.stop();
@@ -184,8 +184,8 @@
#endif
// write result
- *bmp = clr_to_pen(&s_clr.trgb)|(pen&0x20000000);
- //*bmp = (s_clr.u32<<3)|(pen&0x20000000); // using the union is actually significantly slower than our clr_to_pen function!
+ *bmp = s_clr.trgb.to_pen()|(pen&0x20000000);
+ //*bmp = (s_clr.u32<<3)|(pen&0x20000000); // using the union is actually significantly slower than our to_pen function!
#endif // END NOT REALLY SIMPLE
diff --git a/src/devices/video/fixfreq.cpp b/src/devices/video/fixfreq.cpp
index 88875b8eb67..a64c6d812b3 100644
--- a/src/devices/video/fixfreq.cpp
+++ b/src/devices/video/fixfreq.cpp
@@ -16,14 +16,9 @@
#include "emu.h"
#include "fixfreq.h"
-/***************************************************************************
-
- Local variables
+//#define VERBOSE 1
+#include "logmacro.h"
-***************************************************************************/
-
-//#define VERBOSE_OUT(x) printf x
-#define VERBOSE_OUT(x)
/***************************************************************************
@@ -31,11 +26,12 @@
***************************************************************************/
// device type definition
-const device_type FIXFREQ = device_creator<fixedfreq_device>;
+DEFINE_DEVICE_TYPE(FIXFREQ, fixedfreq_device, "fixfreq", "Fixed-Frequency Monochrome Monitor")
-fixedfreq_device::fixedfreq_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source)
- : device_t(mconfig, type, name, tag, owner, clock, shortname, source),
- device_video_interface(mconfig, *this, false), m_htotal(0), m_vtotal(0), m_vid(0), m_last_x(0), m_last_y(0), m_cur_bm(0),
+fixedfreq_device::fixedfreq_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
+ : device_t(mconfig, type, tag, owner, clock),
+ device_video_interface(mconfig, *this, false),
+ m_htotal(0), m_vtotal(0), m_vid(0), m_last_x(0), m_last_y(0), m_cur_bm(0),
// default to NTSC "704x480@30i"
m_monitor_clock(13500000),
m_hvisible(704),
@@ -48,26 +44,13 @@ fixedfreq_device::fixedfreq_device(const machine_config &mconfig, device_type ty
m_vbackporch(525),
m_fieldcount(2),
m_sync_threshold(0.3),
- m_gain(1.0 / 3.7), m_vint(0), m_int_trig(0), m_mult(0), m_sig_vsync(0), m_sig_composite(0), m_sig_field(0)
+ m_gain(1.0 / 3.7),
+ m_vint(0), m_int_trig(0), m_mult(0), m_sig_vsync(0), m_sig_composite(0), m_sig_field(0)
{
}
fixedfreq_device::fixedfreq_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, FIXFREQ, "Fixed Frequency Monochrome Monitor", tag, owner, clock, "fixfreq", __FILE__),
- device_video_interface(mconfig, *this, false),
- // default to NTSC "704x480@30i"
- m_monitor_clock(13500000),
- m_hvisible(704),
- m_hfrontporch(728),
- m_hsync(791),
- m_hbackporch(858),
- m_vvisible(480),
- m_vfrontporch(486),
- m_vsync(492),
- m_vbackporch(525),
- m_fieldcount(2),
- m_sync_threshold(0.3),
- m_gain(1.0 / 3.7)
+ : fixedfreq_device(mconfig, FIXFREQ, tag, owner, clock)
{
}
@@ -160,7 +143,7 @@ void fixedfreq_device::recompute_parameters(bool postload)
m_int_trig = (exp(- 3.0/(3.0+3.0))) - exp(-1.0);
m_mult = (double) (m_monitor_clock) / (double) m_htotal * 1.0; // / (3.0 + 3.0);
- VERBOSE_OUT(("trigger %f with len %f\n", m_int_trig, 1e6 / m_mult));
+ LOG("trigger %f with len %f\n", m_int_trig, 1e6 / m_mult);
m_bitmap[0] = std::make_unique<bitmap_rgb32>(m_htotal, m_vtotal);
m_bitmap[1] = std::make_unique<bitmap_rgb32>(m_htotal, m_vtotal);
@@ -211,7 +194,7 @@ int fixedfreq_device::sync_separator(const attotime &time, double newval)
{
m_sig_field = last_comp; /* force false-progressive */
m_sig_field = (m_sig_field ^ 1) ^ last_comp; /* if there is no field switch, auto switch */
- VERBOSE_OUT(("Field: %d\n", m_sig_field));
+ LOG("Field: %d\n", m_sig_field);
}
if (!last_comp && m_sig_composite)
{
@@ -266,16 +249,16 @@ NETDEV_ANALOG_CALLBACK_MEMBER(fixedfreq_device::update_vid)
}
if (sync & 1)
{
- VERBOSE_OUT(("VSYNC %d %d\n", pixels, m_last_y + m_sig_field));
+ LOG("VSYNC %d %d\n", pixels, m_last_y + m_sig_field);
}
if (sync & 2)
{
- VERBOSE_OUT(("HSYNC up %d\n", pixels));
+ LOG("HSYNC up %d\n", pixels);
//if (m_last_y == 27) printf("HSYNC up %d %d\n", m_last_y, pixels);
}
if (sync & 4)
{
- VERBOSE_OUT(("HSYNC down %f %d %f\n", time.as_double()* 1e6, pixels, m_vid));
+ LOG("HSYNC down %f %d %f\n", time.as_double()* 1e6, pixels, m_vid);
}
if (sync & 1)
diff --git a/src/devices/video/fixfreq.h b/src/devices/video/fixfreq.h
index 080013ad1a6..e475c2f8b4f 100644
--- a/src/devices/video/fixfreq.h
+++ b/src/devices/video/fixfreq.h
@@ -11,8 +11,8 @@
***************************************************************************/
-#ifndef MAME_DEVICES_VIDEO_FIXFREQ_H
-#define MAME_DEVICES_VIDEO_FIXFREQ_H
+#ifndef MAME_VIDEO_FIXFREQ_H
+#define MAME_VIDEO_FIXFREQ_H
#include "machine/netlist.h"
#include "screen.h"
@@ -67,13 +67,11 @@
// ======================> vga_device
-class fixedfreq_device : public device_t,
- public device_video_interface
+class fixedfreq_device : public device_t, public device_video_interface
{
public:
// construction/destruction
fixedfreq_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- fixedfreq_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source);
// inline configuration helpers
static void set_minitor_clock(device_t &device, uint32_t clock) { downcast<fixedfreq_device &>(device).m_monitor_clock = clock; }
@@ -102,6 +100,8 @@ public:
NETDEV_ANALOG_CALLBACK_MEMBER(update_vid);
protected:
+ fixedfreq_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
+
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
@@ -156,6 +156,6 @@ private:
// device type definition
-extern const device_type FIXFREQ;
+DECLARE_DEVICE_TYPE(FIXFREQ, fixedfreq_device)
-#endif // MAME_DEVICES_VIDEO_FIXFREQ_H
+#endif // MAME_VIDEO_FIXFREQ_H
diff --git a/src/devices/video/gb_lcd.cpp b/src/devices/video/gb_lcd.cpp
index 7e50ad9da51..953e0e88165 100644
--- a/src/devices/video/gb_lcd.cpp
+++ b/src/devices/video/gb_lcd.cpp
@@ -160,9 +160,8 @@ TODO:
#include "screen.h"
-
-#define ENABLE_LOGGING 0
-#define LOG(x) do { if (ENABLE_LOGGING) logerror x; } while(0)
+//#define VERBOSE 1
+#include "logmacro.h"
#define LCDCONT m_vid_regs[0x00] /* LCD control register */
@@ -312,49 +311,44 @@ static const uint8_t ags_oam_fingerprint[0x100] = {
#endif
-const device_type DMG_PPU = device_creator<dmg_ppu_device>;
-const device_type MGB_PPU = device_creator<mgb_ppu_device>;
-const device_type SGB_PPU = device_creator<sgb_ppu_device>;
-const device_type CGB_PPU = device_creator<cgb_ppu_device>;
+DEFINE_DEVICE_TYPE(DMG_PPU, dmg_ppu_device, "dmg_ppu", "DMG PPU")
+DEFINE_DEVICE_TYPE(MGB_PPU, mgb_ppu_device, "mgb_ppu", "MGB PPU")
+DEFINE_DEVICE_TYPE(SGB_PPU, sgb_ppu_device, "sgb_ppu", "SGB PPU")
+DEFINE_DEVICE_TYPE(CGB_PPU, cgb_ppu_device, "cgb_ppu", "CGB PPU")
-dmg_ppu_device::dmg_ppu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source, uint32_t vram_size)
- : device_t(mconfig, type, name, tag, owner, clock, shortname, source)
- , device_video_interface(mconfig, *this)
- , m_lr35902(*this, finder_base::DUMMY_TAG)
- , m_sgb_border_hack(0)
- , m_enable_experimental_engine(false)
- , m_oam_size(0x100)
- , m_vram_size(vram_size)
+dmg_ppu_device::dmg_ppu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint32_t vram_size)
+ : device_t(mconfig, type, tag, owner, clock)
+ , device_video_interface(mconfig, *this)
+ , m_lr35902(*this, finder_base::DUMMY_TAG)
+ , m_sgb_border_hack(0)
+ , m_enable_experimental_engine(false)
+ , m_oam_size(0x100)
+ , m_vram_size(vram_size)
{
}
dmg_ppu_device::dmg_ppu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, DMG_PPU, "DMG PPU", tag, owner, clock, "dmg_ppu", __FILE__)
- , device_video_interface(mconfig, *this)
- , m_lr35902(*this, finder_base::DUMMY_TAG)
- , m_sgb_border_hack(0)
- , m_oam_size(0x100)
- , m_vram_size(0x2000)
+ : dmg_ppu_device(mconfig, DMG_PPU, tag, owner, clock, 0x2000)
{
m_enable_experimental_engine = true;
}
mgb_ppu_device::mgb_ppu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : dmg_ppu_device(mconfig, MGB_PPU, "MGB PPU", tag, owner, clock, "mgb_ppu", __FILE__, 0x2000)
+ : dmg_ppu_device(mconfig, MGB_PPU, tag, owner, clock, 0x2000)
{
m_enable_experimental_engine = true;
}
sgb_ppu_device::sgb_ppu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : dmg_ppu_device(mconfig, SGB_PPU, "SGB PPU", tag, owner, clock, "sgb_ppu", __FILE__, 0x2000)
+ : dmg_ppu_device(mconfig, SGB_PPU, tag, owner, clock, 0x2000)
{
m_enable_experimental_engine = false;
}
cgb_ppu_device::cgb_ppu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : dmg_ppu_device(mconfig, CGB_PPU, "CGB PPU", tag, owner, clock, "cgb_ppu", __FILE__, 0x4000)
+ : dmg_ppu_device(mconfig, CGB_PPU, tag, owner, clock, 0x4000)
{
m_enable_experimental_engine = false;
}
@@ -686,7 +680,7 @@ void dmg_ppu_device::calculate_window_cycles()
{
m_window_cycles = 0;
- LOG(("m_window_x = %d, m_window_y = %d\n", m_window_x, m_window_y));
+ LOG("m_window_x = %d, m_window_y = %d\n", m_window_x, m_window_y);
if ((LCDCONT & WINDOW_ENABLED) && m_window_x < 167 && m_window_y < 144)
{
@@ -785,7 +779,7 @@ void dmg_ppu_device::select_sprites()
{
if (sprite_occurs[i])
{
- LOG(("sprite_occurs[%d] = %02x\n", i, sprite_occurs[i]));
+ LOG("sprite_occurs[%d] = %02x\n", i, sprite_occurs[i]);
}
if (sprite_occurs[i])
@@ -799,7 +793,7 @@ void dmg_ppu_device::select_sprites()
}
}
- LOG(("m_sprite_cycles = %d\n", m_sprite_cycles));
+ LOG("m_sprite_cycles = %d\n", m_sprite_cycles);
}
}
}
@@ -820,14 +814,14 @@ void dmg_ppu_device::update_line_state(uint64_t cycles)
m_line.scrollx_to_apply++;
}
-//LOG(("tile_cycle = %u, starting = %s, drawing = %s\n", m_line.tile_cycle, m_line.starting ? "true" : "false", m_line.drawing ? "true" : "false"));
+ //LOG("tile_cycle = %u, starting = %s, drawing = %s\n", m_line.tile_cycle, m_line.starting ? "true" : "false", m_line.drawing ? "true" : "false");
// output next pixel
if (m_line.drawing)
{
if (m_line.scrollx_to_apply > 0)
{
// TODO: Determine when the scrollx shifts are applied when window-x is <= 0x07
-LOG(("scrollx_to_apply: %u\n", m_line.scrollx_to_apply));
+ LOG("scrollx_to_apply: %u\n", m_line.scrollx_to_apply);
if (!m_line.window_active)
{
m_line.shift_register <<= 2;
@@ -843,7 +837,7 @@ LOG(("scrollx_to_apply: %u\n", m_line.scrollx_to_apply));
{
if (m_line.pixels_drawn < 8)
{
- LOG(("draw pixel %u\n", m_line.pixels_drawn));
+ LOG("draw pixel %u\n", m_line.pixels_drawn);
}
plot_pixel(m_line.pixels_drawn, m_current_line, m_gb_bpal[m_line.shift_register >> 14]);
m_bg_zbuf[m_line.pixels_drawn] = m_line.shift_register >> 14;
@@ -875,7 +869,7 @@ LOG(("scrollx_to_apply: %u\n", m_line.scrollx_to_apply));
}
if (m_line.pixels_drawn < 8)
{
- LOG(("m_current_line: %u, tile_count: %02x, plane0 = %02x, plane1 = %02x, shift_register = %04x\n", m_current_line, m_line.tile_count, m_line.plane0, m_line.plane1, m_line.shift_register));
+ LOG("m_current_line: %u, tile_count: %02x, plane0 = %02x, plane1 = %02x, shift_register = %04x\n", m_current_line, m_line.tile_count, m_line.plane0, m_line.plane1, m_line.shift_register);
}
if (m_line.sequence_counter >= 2)
{
@@ -908,7 +902,7 @@ LOG(("scrollx_to_apply: %u\n", m_line.scrollx_to_apply));
m_line.pattern = m_vram.get()[m_line.pattern_address] ^ m_gb_tile_no_mod;
if (m_line.tile_count < 8)
{
- LOG(("tile_count = %u, y = %u, pattern = %02x, pattern_address = %04x\n", m_line.tile_count, m_current_line, m_line.pattern, m_line.pattern_address));
+ LOG("tile_count = %u, y = %u, pattern = %02x, pattern_address = %04x\n", m_line.tile_count, m_current_line, m_line.pattern, m_line.pattern_address);
}
break;
@@ -916,7 +910,7 @@ LOG(("scrollx_to_apply: %u\n", m_line.scrollx_to_apply));
m_line.tile_address = m_gb_chrgen_offs + ((m_line.pattern << 4) | ((m_line.y & 0x07) << 1));
if (m_line.tile_count < 8)
{
- LOG(("tile_count = %u, tile_address = %04x, pattern = %02x, y = %u, m_gb_chrgen_offs = %04x\n", m_line.tile_count, m_line.tile_address, m_line.pattern, m_line.y & 7, m_gb_chrgen_offs));
+ LOG("tile_count = %u, tile_address = %04x, pattern = %02x, y = %u, m_gb_chrgen_offs = %04x\n", m_line.tile_count, m_line.tile_address, m_line.pattern, m_line.y & 7, m_gb_chrgen_offs);
}
break;
@@ -975,7 +969,7 @@ LOG(("scrollx_to_apply: %u\n", m_line.scrollx_to_apply));
break;
case 9: // eat scrollx delay cycles before starting window
- LOG(("eating scrollx_to_apply: %u\n", m_line.scrollx_to_apply));
+ LOG("eating scrollx_to_apply: %u\n", m_line.scrollx_to_apply);
m_line.window_compare_position--;
m_line.scrollx_to_apply--;
m_cycles_left++;
@@ -1018,12 +1012,12 @@ void dmg_ppu_device::check_start_of_window()
// Check for start of window
if (m_line.window_compare_position < 16)
{
- LOG(("check window this line, m_current_line = %u, WNDPOSY = %u, WNDPOSX = %u, m_line.window_compare_position = %u, tile_cycle = %u, window_start_y = %u, pixels_drawn = %u\n", m_current_line, WNDPOSY, WNDPOSX, m_line.window_compare_position, m_line.tile_cycle, m_line.window_start_y[m_line.window_start_y_index], m_line.pixels_drawn));
+ LOG("check window this line, m_current_line = %u, WNDPOSY = %u, WNDPOSX = %u, m_line.window_compare_position = %u, tile_cycle = %u, window_start_y = %u, pixels_drawn = %u\n", m_current_line, WNDPOSY, WNDPOSX, m_line.window_compare_position, m_line.tile_cycle, m_line.window_start_y[m_line.window_start_y_index], m_line.pixels_drawn);
}
if (/*LCDCONT*/(m_line.window_enable[m_line.window_enable_index] & WINDOW_ENABLED) && !m_line.window_active && (m_frame_window_active || /*m_current_line >= m_window_y*/ m_line.window_should_trigger || m_current_line == m_line.window_start_y[m_line.window_start_y_index]) && m_line.window_compare_position == /*WNDPOSX*/ m_line.window_start_x[m_line.window_start_y_index] && m_line.window_compare_position < 0xA6)
{
-LOG(("enable window, m_current_line = %u, WNDPOSY = %u, WNDPOSX = %u, m_line.window_compare_position = %u, pixels_drawn = %u\n", m_current_line, WNDPOSY, WNDPOSX, m_line.window_compare_position, m_line.pixels_drawn));
+ LOG("enable window, m_current_line = %u, WNDPOSY = %u, WNDPOSX = %u, m_line.window_compare_position = %u, pixels_drawn = %u\n", m_current_line, WNDPOSY, WNDPOSX, m_line.window_compare_position, m_line.pixels_drawn);
m_line.starting = true;
m_line.window_active = true;
m_frame_window_active = true;
@@ -2050,7 +2044,7 @@ void dmg_ppu_device::update_state()
if (LCDCONT & ENABLED)
{
- LOG(("m_cycles_left = %u, cycles = %u, CURLINE = %u, m_next_state = %s\n", m_cycles_left, cycles, CURLINE, state_to_string(m_next_state)));
+ LOG("m_cycles_left = %u, cycles = %u, CURLINE = %u, m_next_state = %s\n", m_cycles_left, cycles, CURLINE, state_to_string(m_next_state));
if (m_cycles_left > 0)
{
@@ -2129,7 +2123,7 @@ void dmg_ppu_device::update_state()
check_stat_irq();
m_stat_lyc_int = ((CMPLINE == CURLINE) && (LCDSTAT & LY_LYC_INT_ENABLED)) ? true : false;
- LOG(("GB_LCD_STATE_LYXX_M0_INC: CMPLINE = %02x, CURLINE = %02x, LCDSTAT = %02x, m_stat_lyc_int = %s\n", CMPLINE, CURLINE, LCDSTAT, m_stat_lyc_int ? "true":"false"));
+ LOG("GB_LCD_STATE_LYXX_M0_INC: CMPLINE = %02x, CURLINE = %02x, LCDSTAT = %02x, m_stat_lyc_int = %s\n", CMPLINE, CURLINE, LCDSTAT, m_stat_lyc_int ? "true":"false");
/* Reset LY==LYC STAT bit */
LCDSTAT &= ~LY_LYC_FLAG;
/* Check if we're going into VBlank next */
@@ -2179,7 +2173,7 @@ void dmg_ppu_device::update_state()
{
m_line.window_should_trigger = true;
}
-LOG(("window should trigger = %s, m_current_line = %u, m_window_y = %u\n", m_line.window_should_trigger ? "true" : "false", m_current_line, m_window_y));
+ LOG("window should trigger = %s, m_current_line = %u, m_window_y = %u\n", m_line.window_should_trigger ? "true" : "false", m_current_line, m_window_y);
state_cycles = 80 - 8;
m_next_state = GB_LCD_STATE_LYXX_M3;
@@ -2221,7 +2215,7 @@ LOG(("window should trigger = %s, m_current_line = %u, m_window_y = %u\n", m_lin
{
m_line.window_should_trigger = true;
}
-LOG(("window should trigger = %s, m_current_line = %u, m_window_y = %u\n", m_line.window_should_trigger ? "true" : "false", m_current_line, m_window_y));
+ LOG("window should trigger = %s, m_current_line = %u, m_window_y = %u\n", m_line.window_should_trigger ? "true" : "false", m_current_line, m_window_y);
m_next_state = GB_LCD_STATE_LYXX_M3;
state_cycles = 80 - 8;
break;
@@ -2305,7 +2299,7 @@ LOG(("window should trigger = %s, m_current_line = %u, m_window_y = %u\n", m_lin
case GB_LCD_STATE_LY9X_M1_INC: /* Increment scanline counter */
increment_scanline();
- LOG(("GB_LCD_STATE_LY9X_M1_INC: m_stat_lyc_int = %s\n", m_stat_lyc_int ? "true" : "false"));
+ LOG("GB_LCD_STATE_LY9X_M1_INC: m_stat_lyc_int = %s\n", m_stat_lyc_int ? "true" : "false");
/* Reset LY==LYC STAT bit */
LCDSTAT &= ~LY_LYC_FLAG;
if (m_current_line == 153)
@@ -2439,7 +2433,7 @@ void cgb_ppu_device::update_hdma_state(uint64_t cycles)
void cgb_ppu_device::hdma_trans(uint16_t length)
{
- LOG(("hdma_trans\n"));
+ LOG("hdma_trans\n");
m_hdma_length = length;
m_hdma_cycles_to_start = 4;
update_state();
@@ -2448,7 +2442,7 @@ void cgb_ppu_device::hdma_trans(uint16_t length)
void cgb_ppu_device::hdma_trans_execute()
{
- LOG(("hdma_trans_execute\n"));
+ LOG("hdma_trans_execute\n");
uint16_t length = m_hdma_length;
uint16_t src, dst;
@@ -2456,7 +2450,7 @@ void cgb_ppu_device::hdma_trans_execute()
// 102 Dalmatians uses destination 0000 and expects data to be DMAed.
dst = 0x8000 | (HDMA3 << 8) | (HDMA4 & 0xF0);
- //LOG(("length = %04x, src = %04x, dst = %04x\n", length, src, dst));
+ //LOG("length = %04x, src = %04x, dst = %04x\n", length, src, dst);
while (length > 0)
{
if (dst & 0x8000)
@@ -2507,7 +2501,7 @@ void cgb_ppu_device::update_state()
if (LCDCONT & ENABLED)
{
- LOG(("m_cycles_left = %d, cycles = %d, m_next_state = %s\n", m_cycles_left, cycles, state_to_string(m_next_state)));
+ LOG("m_cycles_left = %d, cycles = %d, m_next_state = %s\n", m_cycles_left, cycles, state_to_string(m_next_state));
if (m_cycles_left > 0)
{
@@ -2595,7 +2589,7 @@ void cgb_ppu_device::update_state()
m_stat_mode2_int = (LCDSTAT & MODE_2_INT_ENABLED) ? true : false;
check_stat_irq();
m_stat_lyc_int = ((m_cmp_line == CURLINE) && (LCDSTAT & LY_LYC_INT_ENABLED)) ? true : false;
- LOG(("GB_LCD_STATE_LYXX_M0_INC: m_cmp_line = %u, CURLINE = %u, LCDSTAT = %02x, m_stat_lyc_int = %s\n", m_cmp_line, CURLINE, LCDSTAT, m_stat_lyc_int ? "true" : "false"));
+ LOG("GB_LCD_STATE_LYXX_M0_INC: m_cmp_line = %u, CURLINE = %u, LCDSTAT = %02x, m_stat_lyc_int = %s\n", m_cmp_line, CURLINE, LCDSTAT, m_stat_lyc_int ? "true" : "false");
m_hdma_possible = 0;
/* Check if we're going into VBlank next */
if (CURLINE == 144)
@@ -2742,7 +2736,7 @@ void cgb_ppu_device::update_state()
break;
case GB_LCD_STATE_LY00_M1: /* we stay in VBlank but current line counter should already be incremented */
- LOG(("GB_LCD_STATE_LY00_M1, CURLINE=%u, CMPLINE=%u, m_stat_lyc_int=%s\n", CURLINE, CMPLINE, m_stat_lyc_int ? "true" : "false"));
+ LOG("GB_LCD_STATE_LY00_M1, CURLINE=%u, CMPLINE=%u, m_stat_lyc_int=%s\n", CURLINE, CMPLINE, m_stat_lyc_int ? "true" : "false");
/* Check LY=LYC for line #153 */
if (CURLINE == CMPLINE)
{
@@ -2760,7 +2754,7 @@ void cgb_ppu_device::update_state()
case GB_LCD_STATE_LY00_M1_1:
increment_scanline();
m_stat_lyc_int = ((CMPLINE == CURLINE) && (LCDSTAT & LY_LYC_INT_ENABLED)) ? true : false;
- LOG(("GB_LCD_STATE_LY00_M1_1, m_stat_lyc_int = %s\n", m_stat_lyc_int ? "true" : "false"));
+ LOG("GB_LCD_STATE_LY00_M1_1, m_stat_lyc_int = %s\n", m_stat_lyc_int ? "true" : "false");
m_next_state = GB_LCD_STATE_LY00_M1_2;
state_cycles = 4;
break;
@@ -2889,7 +2883,7 @@ READ8_MEMBER(dmg_ppu_device::vram_r)
if (!machine().side_effect_disabled())
{
update_state();
- LOG(("vram_r: offset=0x%04x\n", offset));
+ LOG("vram_r: offset=0x%04x\n", offset);
}
return (m_vram_locked == LOCKED) ? 0xff : m_vram[offset + (m_vram_bank * 0x2000)];
@@ -2911,7 +2905,7 @@ READ8_MEMBER(dmg_ppu_device::oam_r)
if (!machine().side_effect_disabled())
{
update_state();
- LOG(("oam_r: offset=0x%02x\n", offset));
+ LOG("oam_r: offset=0x%02x\n", offset);
}
return (m_oam_locked == LOCKED || m_oam_locked_reading == LOCKED || m_oam_dma_processing) ? 0xff : m_oam[offset];
@@ -2934,9 +2928,9 @@ READ8_MEMBER(dmg_ppu_device::video_r)
if (!machine().side_effect_disabled())
{
update_state();
- if (offset == 1) LOG(("STAT read\n"));
- if (offset == 0x28) LOG(("BCPS read, palette is %s\n", m_pal_locked == LOCKED ? "LOCKED" : "UNLOCKED"));
- if (offset == 0x29) LOG(("BCPD read, palette is %s\n", m_pal_locked == LOCKED ? "LOCKED" : "UNLOCKED"));
+ if (offset == 1) LOG("STAT read\n");
+ if (offset == 0x28) LOG("BCPS read, palette is %s\n", m_pal_locked == LOCKED ? "LOCKED" : "UNLOCKED");
+ if (offset == 0x29) LOG("BCPD read, palette is %s\n", m_pal_locked == LOCKED ? "LOCKED" : "UNLOCKED");
}
return m_vid_regs[offset];
@@ -2945,7 +2939,7 @@ READ8_MEMBER(dmg_ppu_device::video_r)
bool dmg_ppu_device::stat_write(uint8_t new_data)
{
- LOG(("stat_write: old_data = %02x, new_data = %02x\n", LCDSTAT & 0x78, new_data & 0x78));
+ LOG("stat_write: old_data = %02x, new_data = %02x\n", LCDSTAT & 0x78, new_data & 0x78);
bool new_lyc_int = m_stat_lyc_int;
@@ -3040,22 +3034,22 @@ void dmg_ppu_device::check_stat_irq()
{
bool new_stat_int = m_stat_mode0_int || m_stat_mode1_int || m_stat_mode2_int || m_stat_lyc_int || m_stat_write_int;
- LOG(("m_mode = %d, m_stat_mode0_int = %s, m_stat_mode1_int = %s, m_stat_mode2_int = %s, m_stat_lyc_int = %s\n",
+ LOG("m_mode = %d, m_stat_mode0_int = %s, m_stat_mode1_int = %s, m_stat_mode2_int = %s, m_stat_lyc_int = %s\n",
m_mode,
m_stat_mode0_int ? "true" : "false",
m_stat_mode1_int ? "true" : "false",
m_stat_mode2_int ? "true" : "false",
m_stat_lyc_int ? "true" : "false"
- ));
+ );
if (new_stat_int && !m_stat_int)
{
- LOG(("--m_stat_mode0_int = %s, m_stat_mode1_int = %s, m_stat_mode2_int = %s, m_stat_lyc_int = %s\n",
+ LOG("--m_stat_mode0_int = %s, m_stat_mode1_int = %s, m_stat_mode2_int = %s, m_stat_lyc_int = %s\n",
m_stat_mode0_int ? "true" : "false",
m_stat_mode1_int ? "true" : "false",
m_stat_mode2_int ? "true" : "false",
m_stat_lyc_int ? "true" : "false"
- ));
+ );
m_lr35902->set_input_line(lr35902_cpu_device::LCD_INT, ASSERT_LINE);
m_lr35902->execute_set_input(lr35902_cpu_device::LCD_INT, ASSERT_LINE);
@@ -3069,7 +3063,7 @@ void dmg_ppu_device::check_stat_irq()
WRITE8_MEMBER(dmg_ppu_device::video_w)
{
update_state();
- LOG(("video_w: offset = %02x, data = %02x\n", offset, data));
+ LOG("video_w: offset = %02x, data = %02x\n", offset, data);
switch (offset)
{
@@ -3123,7 +3117,7 @@ WRITE8_MEMBER(dmg_ppu_device::video_w)
{
if (CURLINE == data || (m_state == GB_LCD_STATE_LY00_M1 && CURLINE == 0 && data == 153))
{
- LOG(("write LYC, if\n"));
+ LOG("write LYC, if\n");
LCDSTAT |= LY_LYC_FLAG;
/* Generate lcd interrupt if requested */
if (LCDSTAT & LY_LYC_INT_ENABLED)
@@ -3142,7 +3136,7 @@ WRITE8_MEMBER(dmg_ppu_device::video_w)
}
else
{
- LOG(("write LYC, else\n"));
+ LOG("write LYC, else\n");
LCDSTAT &= ~LY_LYC_FLAG;
m_stat_lyc_int = false;
check_stat_irq();
@@ -3180,7 +3174,7 @@ WRITE8_MEMBER(dmg_ppu_device::video_w)
break;
case 0x03: /* SCX - Scroll X */
update_scanline(m_lr35902->attotime_to_cycles(m_lcd_timer->remaining()));
- LOG(("SCX: scrollx_delay = %d, m_cycles_left = %d\n", m_line.scrollx_delay, m_cycles_left));
+ LOG("SCX: scrollx_delay = %d, m_cycles_left = %d\n", m_line.scrollx_delay, m_cycles_left);
if (m_line.scrollx_delay > 0)
{
// Additional delay cycles; not sure if this is correct.
@@ -3190,10 +3184,10 @@ WRITE8_MEMBER(dmg_ppu_device::video_w)
}
break;
case 0x0A: /* WY - Window Y position */
- LOG(("WY write, m_cycles_left = %d\n", m_cycles_left));
+ LOG("WY write, m_cycles_left = %d\n", m_cycles_left);
break;
case 0x0B: /* WX - Window X position */
- LOG(("WX write, m_cycles_left = %d\n", m_cycles_left));
+ LOG("WX write, m_cycles_left = %d\n", m_cycles_left);
break;
default: /* Unknown register, no change */
return;
@@ -3206,9 +3200,9 @@ READ8_MEMBER(cgb_ppu_device::video_r)
if (!machine().side_effect_disabled())
{
update_state();
- if (offset == 1) LOG(("STAT read\n"));
- if (offset == 0x28) LOG(("BCPS read, palette is %s\n", m_pal_locked == LOCKED ? "LOCKED" : "UNLOCKED"));
- if (offset == 0x29) LOG(("BCPD read, palette is %s\n", m_pal_locked == LOCKED ? "LOCKED" : "UNLOCKED"));
+ if (offset == 1) LOG("STAT read\n");
+ if (offset == 0x28) LOG("BCPS read, palette is %s\n", m_pal_locked == LOCKED ? "LOCKED" : "UNLOCKED");
+ if (offset == 0x29) LOG("BCPD read, palette is %s\n", m_pal_locked == LOCKED ? "LOCKED" : "UNLOCKED");
}
switch (offset)
@@ -3232,7 +3226,7 @@ READ8_MEMBER(cgb_ppu_device::video_r)
bool cgb_ppu_device::stat_write(uint8_t new_data)
{
- LOG(("stat_write: old_data = %02x, new_data = %02x\n", LCDSTAT & 0x78, new_data & 0x78));
+ LOG("stat_write: old_data = %02x, new_data = %02x\n", LCDSTAT & 0x78, new_data & 0x78);
bool new_lyc_int = m_stat_lyc_int;
@@ -3292,7 +3286,7 @@ bool cgb_ppu_device::stat_write(uint8_t new_data)
WRITE8_MEMBER(cgb_ppu_device::video_w)
{
update_state();
- LOG(("video_w\n"));
+ LOG("video_w\n");
switch (offset)
{
@@ -3343,7 +3337,7 @@ WRITE8_MEMBER(cgb_ppu_device::video_w)
{
if (CURLINE == data && m_state != GB_LCD_STATE_LY00_M1 && m_state != GB_LCD_STATE_LYXX_M0_PRE_INC)
{
- LOG(("write LYC, if, CURLINE=%u\n", CURLINE));
+ LOG("write LYC, if, CURLINE=%u\n", CURLINE);
LCDSTAT |= LY_LYC_FLAG;
/* Generate lcd interrupt if requested */
@@ -3355,7 +3349,7 @@ WRITE8_MEMBER(cgb_ppu_device::video_w)
}
else
{
- LOG(("write LYC, else, CURLINE=%u\n", CURLINE));
+ LOG("write LYC, else, CURLINE=%u\n", CURLINE);
LCDSTAT &= ~LY_LYC_FLAG;
check_stat_irq();
@@ -3429,7 +3423,7 @@ WRITE8_MEMBER(cgb_ppu_device::video_w)
}
break;
case 0x28: /* BCPS - Background palette specification */
- LOG(("BCPS write %02x\n", data));
+ LOG("BCPS write %02x\n", data);
GBCBCPS = data;
if (data & 0x01)
@@ -3438,7 +3432,7 @@ WRITE8_MEMBER(cgb_ppu_device::video_w)
GBCBCPD = m_cgb_bpal[(data >> 1) & 0x1F] & 0xFF;
break;
case 0x29: /* BCPD - background palette data */
- LOG(("BCPD write %02x, palette is %s\n", data, m_pal_locked == LOCKED ? "LOCKED" : "UNLOCKED"));
+ LOG("BCPD write %02x, palette is %s\n", data, m_pal_locked == LOCKED ? "LOCKED" : "UNLOCKED");
if (m_pal_locked == LOCKED)
{
diff --git a/src/devices/video/gb_lcd.h b/src/devices/video/gb_lcd.h
index 6e3587439d9..974e2d76cab 100644
--- a/src/devices/video/gb_lcd.h
+++ b/src/devices/video/gb_lcd.h
@@ -6,31 +6,19 @@
*
****************************************************************************/
-#ifndef __GB_LCD_H__
-#define __GB_LCD_H__
+#ifndef MAME_VIDEO_GB_LCD_H
+#define MAME_VIDEO_GB_LCD_H
-#include "cpu/lr35902/lr35902.h"
+#pragma once
+#include "cpu/lr35902/lr35902.h"
-struct layer_struct {
- uint8_t enabled;
- uint8_t *bg_tiles;
- uint8_t *bg_map;
- uint8_t xindex;
- uint8_t xshift;
- uint8_t xstart;
- uint8_t xend;
- /* GBC specific */
- uint8_t *gbc_map;
- int16_t bgline;
-};
class dmg_ppu_device : public device_t,
public device_video_interface
{
public:
- dmg_ppu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source, uint32_t vram_size);
dmg_ppu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
static void static_set_lr35902_tag(device_t &device, const char *tag) { downcast<dmg_ppu_device &>(device).m_lr35902.set_tag(tag); }
@@ -65,6 +53,19 @@ protected:
LY_LYC_FLAG = 0x04
};
+ struct layer_struct {
+ uint8_t enabled;
+ uint8_t *bg_tiles;
+ uint8_t *bg_map;
+ uint8_t xindex;
+ uint8_t xshift;
+ uint8_t xstart;
+ uint8_t xend;
+ /* GBC specific */
+ uint8_t *gbc_map;
+ int16_t bgline;
+ };
+
inline void plot_pixel(int x, int y, uint16_t color);
void select_sprites();
@@ -72,6 +73,8 @@ protected:
virtual void update_sprites();
virtual void update_scanline(uint32_t cycles_to_go);
+ dmg_ppu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint32_t vram_size);
+
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
@@ -226,8 +229,8 @@ protected:
void check_start_of_window();
private:
- uint32_t m_oam_size;
- uint32_t m_vram_size;
+ const uint32_t m_oam_size;
+ const uint32_t m_vram_size;
};
@@ -288,10 +291,10 @@ protected:
};
-extern const device_type DMG_PPU;
-extern const device_type MGB_PPU;
-extern const device_type SGB_PPU;
-extern const device_type CGB_PPU;
+DECLARE_DEVICE_TYPE(DMG_PPU, dmg_ppu_device)
+DECLARE_DEVICE_TYPE(MGB_PPU, mgb_ppu_device)
+DECLARE_DEVICE_TYPE(SGB_PPU, sgb_ppu_device)
+DECLARE_DEVICE_TYPE(CGB_PPU, cgb_ppu_device)
#define MCFG_DMG_PPU_ADD(_tag, _cpu_tag ) \
@@ -311,4 +314,4 @@ extern const device_type CGB_PPU;
dmg_ppu_device::static_set_lr35902_tag(*device, "^" _cpu_tag);
-#endif /* GB_LCD_H_ */
+#endif // MAME_VIDEO_GB_LCD_H
diff --git a/src/devices/video/gba_lcd.cpp b/src/devices/video/gba_lcd.cpp
index 71d094ae8cf..21184df0888 100644
--- a/src/devices/video/gba_lcd.cpp
+++ b/src/devices/video/gba_lcd.cpp
@@ -140,10 +140,10 @@ private:
uint16_t m_attr2;
};
-const device_type GBA_LCD = device_creator<gba_lcd_device>;
+DEFINE_DEVICE_TYPE(GBA_LCD, gba_lcd_device, "gba_lcd", "GBA LCD")
gba_lcd_device::gba_lcd_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, GBA_LCD, "GBA LCD", tag, owner, clock, "gba_lcd", __FILE__)
+ : device_t(mconfig, GBA_LCD, tag, owner, clock)
, device_video_interface(mconfig, *this)
, m_int_hblank_cb(*this)
, m_int_vblank_cb(*this)
diff --git a/src/devices/video/gba_lcd.h b/src/devices/video/gba_lcd.h
index 3df855b4535..263e5973bee 100644
--- a/src/devices/video/gba_lcd.h
+++ b/src/devices/video/gba_lcd.h
@@ -10,11 +10,10 @@
***************************************************************************/
-#pragma once
-
-#ifndef __GBA_LCD_H__
-#define __GBA_LCD_H__
+#ifndef MAME_VIDEO_GBA_LCD_H
+#define MAME_VIDEO_GBA_LCD_H
+#pragma once
@@ -23,7 +22,7 @@
//**************************************************************************
// device type definition
-extern const device_type GBA_LCD;
+DECLARE_DEVICE_TYPE(GBA_LCD, gba_lcd_device)
//**************************************************************************
@@ -103,29 +102,29 @@ public:
TIMER_CALLBACK_MEMBER(perform_hbl);
TIMER_CALLBACK_MEMBER(perform_scan);
- template<class _Object> static devcb_base &set_int_hblank_callback(device_t &device, _Object object)
+ template <class Object> static devcb_base &set_int_hblank_callback(device_t &device, Object &&cb)
{
- return downcast<gba_lcd_device &>(device).m_int_hblank_cb.set_callback(object);
+ return downcast<gba_lcd_device &>(device).m_int_hblank_cb.set_callback(std::forward<Object>(cb));
}
- template<class _Object> static devcb_base &set_int_vblank_callback(device_t &device, _Object object)
+ template <class Object> static devcb_base &set_int_vblank_callback(device_t &device, Object &&cb)
{
- return downcast<gba_lcd_device &>(device).m_int_vblank_cb.set_callback(object);
+ return downcast<gba_lcd_device &>(device).m_int_vblank_cb.set_callback(std::forward<Object>(cb));
}
- template<class _Object> static devcb_base &set_int_vcount_callback(device_t &device, _Object object)
+ template <class Object> static devcb_base &set_int_vcount_callback(device_t &device, Object &&cb)
{
- return downcast<gba_lcd_device &>(device).m_int_vcount_cb.set_callback(object);
+ return downcast<gba_lcd_device &>(device).m_int_vcount_cb.set_callback(std::forward<Object>(cb));
}
- template<class _Object> static devcb_base &set_dma_hblank_callback(device_t &device, _Object object)
+ template <class Object> static devcb_base &set_dma_hblank_callback(device_t &device, Object &&cb)
{
- return downcast<gba_lcd_device &>(device).m_dma_hblank_cb.set_callback(object);
+ return downcast<gba_lcd_device &>(device).m_dma_hblank_cb.set_callback(std::forward<Object>(cb));
}
- template<class _Object> static devcb_base &set_dma_vblank_callback(device_t &device, _Object object)
+ template <class Object> static devcb_base &set_dma_vblank_callback(device_t &device, Object &&cb)
{
- return downcast<gba_lcd_device &>(device).m_dma_vblank_cb.set_callback(object);
+ return downcast<gba_lcd_device &>(device).m_dma_vblank_cb.set_callback(std::forward<Object>(cb));
}
protected:
@@ -250,4 +249,4 @@ private:
static constexpr uint32_t TRANSPARENT_PIXEL = 0x80000000;
};
-#endif /* GBA_LCD_H_ */
+#endif // MAME_VIDEO_GBA_LCD_H
diff --git a/src/devices/video/gf4500.cpp b/src/devices/video/gf4500.cpp
index 6b539cf65a3..4f48a14b9ef 100644
--- a/src/devices/video/gf4500.cpp
+++ b/src/devices/video/gf4500.cpp
@@ -31,12 +31,12 @@ static inline void ATTR_PRINTF(3,4) verboselog( device_t &device, int n_level, c
#define GF4500_FRAMEBUF_OFFSET 0x20000
-const device_type GF4500 = device_creator<gf4500_device>;
+DEFINE_DEVICE_TYPE(GF4500, gf4500_device, "gf4500", "NVIDIA GoForce 4500")
gf4500_device::gf4500_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, GF4500, "NVIDIA GoForce 4500", tag, owner, clock, "gf4500", __FILE__), m_data(nullptr), m_screen_x(0), m_screen_y(0), m_screen_x_max(0), m_screen_y_max(0), m_screen_x_min(0), m_screen_y_min(0)
- {
+ : device_t(mconfig, GF4500, tag, owner, clock), m_data(nullptr), m_screen_x(0), m_screen_y(0), m_screen_x_max(0), m_screen_y_max(0), m_screen_x_min(0), m_screen_y_min(0)
+{
}
diff --git a/src/devices/video/gf4500.h b/src/devices/video/gf4500.h
index 01435ea5b61..e06af73c5c4 100644
--- a/src/devices/video/gf4500.h
+++ b/src/devices/video/gf4500.h
@@ -8,15 +8,16 @@
*/
-#ifndef __GF4500_H__
-#define __GF4500_H__
+#ifndef MAME_VIDEO_GF4500_H
+#define MAME_VIDEO_GF4500_H
+
+#pragma once
class gf4500_device : public device_t
{
public:
gf4500_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- ~gf4500_device() {}
DECLARE_READ32_MEMBER( read );
@@ -49,7 +50,6 @@ private:
MCFG_DEVICE_ADD(_tag, GF4500, 0)
-extern const device_type GF4500;
-
+DECLARE_DEVICE_TYPE(GF4500, gf4500_device)
-#endif /* __GF4500_H__ */
+#endif // MAME_VIDEO_GF4500_H
diff --git a/src/devices/video/gf7600gs.cpp b/src/devices/video/gf7600gs.cpp
index 4b35d3a8f97..407178ab73f 100644
--- a/src/devices/video/gf7600gs.cpp
+++ b/src/devices/video/gf7600gs.cpp
@@ -3,7 +3,7 @@
#include "emu.h"
#include "gf7600gs.h"
-const device_type GEFORCE_7600GS = device_creator<geforce_7600gs_device>;
+DEFINE_DEVICE_TYPE(GEFORCE_7600GS, geforce_7600gs_device, "geforce_7600gs", "NVIDIA GeForce 7600GS")
DEVICE_ADDRESS_MAP_START(map1, 32, geforce_7600gs_device)
ADDRESS_MAP_END
@@ -15,7 +15,7 @@ DEVICE_ADDRESS_MAP_START(map3, 32, geforce_7600gs_device)
ADDRESS_MAP_END
geforce_7600gs_device::geforce_7600gs_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : pci_device(mconfig, GEFORCE_7600GS, "NVidia GeForce 7600GS", tag, owner, clock, "geforce_7600gs", __FILE__)
+ : pci_device(mconfig, GEFORCE_7600GS, tag, owner, clock)
{
}
diff --git a/src/devices/video/gf7600gs.h b/src/devices/video/gf7600gs.h
index f2a44ca903a..b2d21011c83 100644
--- a/src/devices/video/gf7600gs.h
+++ b/src/devices/video/gf7600gs.h
@@ -1,7 +1,9 @@
// license:BSD-3-Clause
// copyright-holders:Olivier Galibert
-#ifndef GF7600GS_H
-#define GF7600GS_H
+#ifndef MAME_VIDEO_GF7600GS_H
+#define MAME_VIDEO_GF7600GS_H
+
+#pragma once
#include "machine/pci.h"
@@ -22,6 +24,6 @@ private:
DECLARE_ADDRESS_MAP(map3, 32);
};
-extern const device_type GEFORCE_7600GS;
+DECLARE_DEVICE_TYPE(GEFORCE_7600GS, geforce_7600gs_device)
-#endif
+#endif // MAME_VIDEO_GF7600GS_H
diff --git a/src/devices/video/hd44102.cpp b/src/devices/video/hd44102.cpp
index 00d2cf8d85d..43a413920e8 100644
--- a/src/devices/video/hd44102.cpp
+++ b/src/devices/video/hd44102.cpp
@@ -9,15 +9,15 @@
#include "emu.h"
#include "hd44102.h"
+//#define VERBOSE 1
+#include "logmacro.h"
+
//**************************************************************************
// MACROS / CONSTANTS
//**************************************************************************
-#define LOG 0
-
-
#define CONTROL_DISPLAY_OFF 0x38
#define CONTROL_DISPLAY_ON 0x39
#define CONTROL_COUNT_DOWN_MODE 0x3a
@@ -34,7 +34,7 @@
// device type definition
-const device_type HD44102 = device_creator<hd44102_device>;
+DEFINE_DEVICE_TYPE(HD44102, hd44102_device, "hd44102", "Hitachi HD44102 LCD Controller")
//**************************************************************************
@@ -68,7 +68,7 @@ inline void hd44102_device::count_up_or_down()
//-------------------------------------------------
hd44102_device::hd44102_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, HD44102, "HD44102", tag, owner, clock, "hd44102", __FILE__),
+ : device_t(mconfig, HD44102, tag, owner, clock),
device_video_interface(mconfig, *this),
m_cs2(0),
m_page(0),
@@ -172,51 +172,51 @@ WRITE8_MEMBER( hd44102_device::control_w )
switch (data)
{
case CONTROL_DISPLAY_OFF:
- if (LOG) logerror("HD44102 '%s' Display Off\n", tag());
+ LOG("HD44102 Display Off\n");
m_status |= STATUS_DISPLAY_OFF;
break;
case CONTROL_DISPLAY_ON:
- if (LOG) logerror("HD44102 '%s' Display On\n", tag());
+ LOG("HD44102 Display On\n");
m_status &= ~STATUS_DISPLAY_OFF;
break;
case CONTROL_COUNT_DOWN_MODE:
- if (LOG) logerror("HD44102 '%s' Count Down Mode\n", tag());
+ LOG("HD44102 Count Down Mode\n");
m_status &= ~STATUS_COUNT_UP;
break;
case CONTROL_COUNT_UP_MODE:
- if (LOG) logerror("HD44102 '%s' Count Up Mode\n", tag());
+ LOG("HD44102 Count Up Mode\n");
m_status |= STATUS_COUNT_UP;
break;
default:
{
- int x = (data & CONTROL_X_ADDRESS_MASK) >> 6;
- int y = data & CONTROL_Y_ADDRESS_MASK;
+ const int x = (data & CONTROL_X_ADDRESS_MASK) >> 6;
+ const int y = data & CONTROL_Y_ADDRESS_MASK;
- if ((data & CONTROL_Y_ADDRESS_MASK) == CONTROL_DISPLAY_START_PAGE)
- {
- if (LOG) logerror("HD44102 '%s' Display Start Page %u\n", tag(), x);
+ if ((data & CONTROL_Y_ADDRESS_MASK) == CONTROL_DISPLAY_START_PAGE)
+ {
+ LOG("HD44102 Display Start Page %u\n", x);
- m_page = x;
- }
- else if (y > 49)
- {
- logerror("HD44102 '%s' Invalid Address X %u Y %u (%02x)!\n", tag(), data, x, y);
- }
- else
- {
- if (LOG) logerror("HD44102 '%s' Address X %u Y %u (%02x)\n", tag(), data, x, y);
+ m_page = x;
+ }
+ else if (y > 49)
+ {
+ logerror("HD44102 Invalid Address X %u Y %u (%02x)!\n", data, x, y);
+ }
+ else
+ {
+ LOG("HD44102 Address X %u Y %u (%02x)\n", data, x, y);
- m_x = x;
- m_y = y;
- }
+ m_x = x;
+ m_y = y;
+ }
}
}
}
diff --git a/src/devices/video/hd44102.h b/src/devices/video/hd44102.h
index 7aa19f2a8ea..c9746d417ec 100644
--- a/src/devices/video/hd44102.h
+++ b/src/devices/video/hd44102.h
@@ -6,10 +6,10 @@
**********************************************************************/
-#pragma once
+#ifndef MAME_VIDEO_HD44102_H
+#define MAME_VIDEO_HD44102_H
-#ifndef __HD44102__
-#define __HD44102__
+#pragma once
@@ -78,8 +78,6 @@ private:
// device type definition
-extern const device_type HD44102;
-
-
+DECLARE_DEVICE_TYPE(HD44102, hd44102_device)
-#endif
+#endif // MAME_VIDEO_HD44102_H
diff --git a/src/devices/video/hd44352.cpp b/src/devices/video/hd44352.cpp
index 55eef9b31a2..7fa4b53f1d0 100644
--- a/src/devices/video/hd44352.cpp
+++ b/src/devices/video/hd44352.cpp
@@ -24,7 +24,7 @@
// devices
-const device_type HD44352 = device_creator<hd44352_device>;
+DEFINE_DEVICE_TYPE(HD44352, hd44352_device, "hd44352", "Hitachi HD44352 LCD Controller")
//**************************************************************************
// live device
@@ -35,7 +35,7 @@ const device_type HD44352 = device_creator<hd44352_device>;
//-------------------------------------------------
hd44352_device::hd44352_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock):
- device_t(mconfig, HD44352, "hd44352", tag, owner, clock, "hd44352", __FILE__),
+ device_t(mconfig, HD44352, tag, owner, clock),
m_on_cb(*this),
m_char_rom(*this, DEVICE_SELF)
{
diff --git a/src/devices/video/hd44352.h b/src/devices/video/hd44352.h
index f5546f93e91..a7dff37b904 100644
--- a/src/devices/video/hd44352.h
+++ b/src/devices/video/hd44352.h
@@ -6,10 +6,10 @@
***************************************************************************/
-#pragma once
+#ifndef MAME_VIDEO_HD44352_H
+#define MAME_VIDEO_HD44352_H
-#ifndef __hd44352_H__
-#define __hd44352_H__
+#pragma once
#define MCFG_HD44352_ON_CB(_devcb) \
@@ -22,14 +22,13 @@
// ======================> hd44352_device
-class hd44352_device :
- public device_t
+class hd44352_device : public device_t
{
public:
// construction/destruction
hd44352_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- template<class _Object> static devcb_base &set_on_callback(device_t &device, _Object object) { return downcast<hd44352_device &>(device).m_on_cb.set_callback(object); }
+ template <class Object> static devcb_base &set_on_callback(device_t &device, Object &&cb) { return downcast<hd44352_device &>(device).m_on_cb.set_callback(std::forward<Object>(cb)); }
// device interface
uint8_t data_read();
@@ -77,6 +76,6 @@ private:
};
// device type definition
-extern const device_type HD44352;
+DECLARE_DEVICE_TYPE(HD44352, hd44352_device)
-#endif
+#endif // MAME_VIDEO_HD44352_H
diff --git a/src/devices/video/hd44780.cpp b/src/devices/video/hd44780.cpp
index 5b40d9d14a9..8f3451352ab 100644
--- a/src/devices/video/hd44780.cpp
+++ b/src/devices/video/hd44780.cpp
@@ -13,14 +13,16 @@
#include "emu.h"
#include "video/hd44780.h"
-#define LOG 0
+//#define VERBOSE 1
+#include "logmacro.h"
+
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
-const device_type HD44780 = device_creator<hd44780_device>;
-const device_type KS0066_F05 = device_creator<ks0066_f05_device>;
+DEFINE_DEVICE_TYPE(HD44780, hd44780_device, "hd44780_a00", "Hitachi HD44780 A00 LCD Controller")
+DEFINE_DEVICE_TYPE(KS0066_F05, ks0066_f05_device, "ks0066_f05", "Samsung KS0066 F05 LCD Controller")
//-------------------------------------------------
@@ -46,20 +48,20 @@ ROM_END
//-------------------------------------------------
hd44780_device::hd44780_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : hd44780_device(mconfig, HD44780, "HD44780 A00", tag, owner, clock, "hd44780_a00", __FILE__)
+ : hd44780_device(mconfig, HD44780, tag, owner, clock)
{
set_charset_type(CHARSET_HD44780_A00);
}
-hd44780_device::hd44780_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source)
- : device_t(mconfig, type, name, tag, owner, clock, shortname, source)
+hd44780_device::hd44780_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
+ : device_t(mconfig, type, tag, owner, clock)
, m_cgrom(nullptr)
, m_cgrom_region(*this, DEVICE_SELF)
{
}
ks0066_f05_device::ks0066_f05_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- hd44780_device(mconfig, KS0066_F05, "KS0066 F05", tag, owner, clock, "ks0066_f05", __FILE__)
+ hd44780_device(mconfig, KS0066_F05, tag, owner, clock)
{
set_charset_type(CHARSET_KS0066_F05);
}
@@ -392,7 +394,7 @@ WRITE8_MEMBER(hd44780_device::control_write)
correct_ac();
set_busy_flag(37);
- if (LOG) logerror("HD44780 '%s': set DDRAM address %x\n", tag(), m_ac);
+ LOG("HD44780: set DDRAM address %x\n", m_ac);
return;
}
else if (BIT(m_ir, 6))
@@ -402,7 +404,7 @@ WRITE8_MEMBER(hd44780_device::control_write)
m_ac = m_ir & 0x3f;
set_busy_flag(37);
- if (LOG) logerror("HD44780 '%s': set CGRAM address %x\n", tag(), m_ac);
+ LOG("HD44780: set CGRAM address %x\n", m_ac);
return;
}
else if (BIT(m_ir, 5))
@@ -420,7 +422,7 @@ WRITE8_MEMBER(hd44780_device::control_write)
correct_ac();
set_busy_flag(37);
- if (LOG) logerror("HD44780 '%s': char size 5x%d, data len %d, lines %d\n", tag(), m_char_size, m_data_len, m_num_line);
+ LOG("HD44780: char size 5x%d, data len %d, lines %d\n", m_char_size, m_data_len, m_num_line);
return;
}
else if (BIT(m_ir, 4))
@@ -428,7 +430,7 @@ WRITE8_MEMBER(hd44780_device::control_write)
// cursor or display shift
int direction = (BIT(m_ir, 2)) ? +1 : -1;
- if (LOG) logerror("HD44780 '%s': %s shift %d\n", tag(), BIT(m_ir, 3) ? "display" : "cursor", direction);
+ LOG("HD44780: %s shift %d\n", BIT(m_ir, 3) ? "display" : "cursor", direction);
if (BIT(m_ir, 3))
shift_display(direction);
@@ -445,7 +447,7 @@ WRITE8_MEMBER(hd44780_device::control_write)
m_blink_on = BIT(m_ir, 0);
set_busy_flag(37);
- if (LOG) logerror("HD44780 '%s': display %d, cursor %d, blink %d\n", tag(), m_display_on, m_cursor_on, m_blink_on);
+ LOG("HD44780: display %d, cursor %d, blink %d\n", m_display_on, m_cursor_on, m_blink_on);
}
else if (BIT(m_ir, 2))
{
@@ -454,12 +456,12 @@ WRITE8_MEMBER(hd44780_device::control_write)
m_shift_on = BIT(m_ir, 0);
set_busy_flag(37);
- if (LOG) logerror("HD44780 '%s': entry mode set: direction %d, shift %d\n", tag(), m_direction, m_shift_on);
+ LOG("HD44780: entry mode set: direction %d, shift %d\n", m_direction, m_shift_on);
}
else if (BIT(m_ir, 1))
{
// return home
- if (LOG) logerror("HD44780 '%s': return home\n", tag());
+ LOG("HD44780: return home\n");
m_ac = 0;
m_active_ram = DDRAM;
@@ -470,7 +472,7 @@ WRITE8_MEMBER(hd44780_device::control_write)
else if (BIT(m_ir, 0))
{
// clear display
- if (LOG) logerror("HD44780 '%s': clear display\n", tag());
+ LOG("HD44780: clear display\n");
m_ac = 0;
m_active_ram = DDRAM;
@@ -505,7 +507,7 @@ WRITE8_MEMBER(hd44780_device::data_write)
{
if (m_busy_flag)
{
- logerror("HD44780 '%s': Ignoring data write %02x due of busy flag\n", tag(), data);
+ logerror("HD44780: Ignoring data write %02x due of busy flag\n", data);
return;
}
@@ -528,7 +530,7 @@ WRITE8_MEMBER(hd44780_device::data_write)
m_dr = data;
}
- if (LOG) logerror("HD44780 '%s': %sRAM write %x %x '%c'\n", tag(), m_active_ram == DDRAM ? "DD" : "CG", m_ac, m_dr, isprint(m_dr) ? m_dr : '.');
+ LOG("HD44780: %sRAM write %x %x '%c'\n", m_active_ram == DDRAM ? "DD" : "CG", m_ac, m_dr, isprint(m_dr) ? m_dr : '.');
if (m_active_ram == DDRAM)
m_ddram[m_ac] = m_dr;
@@ -545,7 +547,7 @@ READ8_MEMBER(hd44780_device::data_read)
{
uint8_t data = (m_active_ram == DDRAM) ? m_ddram[m_ac] : m_cgram[m_ac];
- if (LOG) logerror("HD44780 '%s': %sRAM read %x %c\n", tag(), m_active_ram == DDRAM ? "DD" : "CG", m_ac, data);
+ LOG("HD44780: %sRAM read %x %c\n", m_active_ram == DDRAM ? "DD" : "CG", m_ac, data);
if (m_data_len == 4)
{
diff --git a/src/devices/video/hd44780.h b/src/devices/video/hd44780.h
index bb62a27d1d8..f56f286ce13 100644
--- a/src/devices/video/hd44780.h
+++ b/src/devices/video/hd44780.h
@@ -6,10 +6,10 @@
***************************************************************************/
-#pragma once
+#ifndef MAME_VIDEO_HD44780_H
+#define MAME_VIDEO_HD44780_H
-#ifndef __HD44780_H__
-#define __HD44780_H__
+#pragma once
#define MCFG_HD44780_ADD( _tag ) \
@@ -22,28 +22,28 @@
hd44780_device::static_set_lcd_size(*device, _lines, _chars);
#define MCFG_HD44780_PIXEL_UPDATE_CB(_class, _method) \
- hd44780_device::static_set_pixel_update_cb(*device, hd44780_pixel_update_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
+ hd44780_device::static_set_pixel_update_cb(*device, hd44780_device::pixel_update_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
-typedef device_delegate<void (bitmap_ind16 &bitmap, uint8_t line, uint8_t pos, uint8_t y, uint8_t x, int state)> hd44780_pixel_update_delegate;
#define HD44780_PIXEL_UPDATE(name) void name(bitmap_ind16 &bitmap, uint8_t line, uint8_t pos, uint8_t y, uint8_t x, int state)
// ======================> hd44780_device
-class hd44780_device : public device_t
+class hd44780_device : public device_t
{
public:
+ typedef device_delegate<void (bitmap_ind16 &bitmap, uint8_t line, uint8_t pos, uint8_t y, uint8_t x, int state)> pixel_update_delegate;
+
// construction/destruction
hd44780_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- hd44780_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source);
// static configuration helpers
static void static_set_lcd_size(device_t &device, int _lines, int _chars) { hd44780_device &dev=downcast<hd44780_device &>(device); dev.m_lines = _lines; dev.m_chars = _chars; }
- static void static_set_pixel_update_cb(device_t &device, hd44780_pixel_update_delegate callback) { downcast<hd44780_device &>(device).m_pixel_update_cb = callback; }
+ static void static_set_pixel_update_cb(device_t &device, pixel_update_delegate &&cb) { downcast<hd44780_device &>(device).m_pixel_update_cb = std::move(cb); }
// device interface
virtual DECLARE_WRITE8_MEMBER(write);
@@ -57,6 +57,8 @@ public:
virtual uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
protected:
+ hd44780_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
+
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
@@ -92,15 +94,15 @@ private:
void pixel_update(bitmap_ind16 &bitmap, uint8_t line, uint8_t pos, uint8_t y, uint8_t x, int state);
// internal state
- static const device_timer_id TIMER_BUSY = 0;
- static const device_timer_id TIMER_BLINKING = 1;
+ static constexpr device_timer_id TIMER_BUSY = 0;
+ static constexpr device_timer_id TIMER_BLINKING = 1;
emu_timer * m_blink_timer;
emu_timer * m_busy_timer;
uint8_t m_lines; // number of lines
uint8_t m_chars; // chars for line
- hd44780_pixel_update_delegate m_pixel_update_cb; // pixel update callback
+ pixel_update_delegate m_pixel_update_cb; // pixel update callback
bool m_busy_flag; // busy flag
uint8_t m_ddram[0x80]; // internal display data RAM
@@ -141,7 +143,7 @@ public:
};
// device type definition
-extern const device_type HD44780;
-extern const device_type KS0066_F05;
+DECLARE_DEVICE_TYPE(HD44780, hd44780_device)
+DECLARE_DEVICE_TYPE(KS0066_F05, ks0066_f05_device)
-#endif
+#endif // MAME_VIDEO_HD44780_H
diff --git a/src/devices/video/hd61830.cpp b/src/devices/video/hd61830.cpp
index 21fb8f66513..f235b1b3d12 100644
--- a/src/devices/video/hd61830.cpp
+++ b/src/devices/video/hd61830.cpp
@@ -11,13 +11,16 @@
#include "screen.h"
+//#define VERBOSE 1
+#include "logmacro.h"
+
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
-const device_type HD61830 = device_creator<hd61830_device>;
+DEFINE_DEVICE_TYPE(HD61830, hd61830_device, "hd61830", "Hitachi HD61830B LCD Controller")
const device_type HD61830B = HD61830;
@@ -49,44 +52,17 @@ const tiny_rom_entry *hd61830_device::device_rom_region() const
// MACROS / CONSTANTS
//**************************************************************************
-#define LOG 0
-
-static const int CYCLES[] =
+static constexpr int CYCLES[] =
{
4, 4, 4, 4, 4, -1, -1, -1, 4, 4, 4, 4, 6, 6, 36, 36
};
-const int MODE_EXTERNAL_CG = 0x01;
-const int MODE_GRAPHIC = 0x02;
-const int MODE_CURSOR = 0x04;
-const int MODE_BLINK = 0x08;
-const int MODE_MASTER = 0x10;
-const int MODE_DISPLAY_ON = 0x20;
-
-
-
-//**************************************************************************
-// INLINE HELPERS
-//**************************************************************************
-
-//-------------------------------------------------
-// readbyte - read a byte at the given address
-//-------------------------------------------------
-
-inline uint8_t hd61830_device::readbyte(offs_t address)
-{
- return space().read_byte(address);
-}
-
-
-//-------------------------------------------------
-// writebyte - write a byte at the given address
-//-------------------------------------------------
-
-inline void hd61830_device::writebyte(offs_t address, uint8_t data)
-{
- space().write_byte(address, data);
-}
+static constexpr int MODE_EXTERNAL_CG = 0x01;
+static constexpr int MODE_GRAPHIC = 0x02;
+static constexpr int MODE_CURSOR = 0x04;
+static constexpr int MODE_BLINK = 0x08;
+static constexpr int MODE_MASTER = 0x10;
+static constexpr int MODE_DISPLAY_ON = 0x20;
@@ -99,7 +75,7 @@ inline void hd61830_device::writebyte(offs_t address, uint8_t data)
//-------------------------------------------------
hd61830_device::hd61830_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, HD61830, "HD61830 LCDC", tag, owner, clock, "hd61830", __FILE__),
+ device_t(mconfig, HD61830, tag, owner, clock),
device_memory_interface(mconfig, *this),
device_video_interface(mconfig, *this),
m_read_rd(*this),
@@ -199,7 +175,7 @@ void hd61830_device::set_busy_flag()
READ8_MEMBER( hd61830_device::status_r )
{
- if (LOG) logerror("HD61830 '%s' Status Read: %s\n", tag(), m_bf ? "busy" : "ready");
+ LOG("HD61830 Status Read: %s\n", m_bf ? "busy" : "ready");
return m_bf ? 0x80 : 0;
}
@@ -223,7 +199,7 @@ READ8_MEMBER( hd61830_device::data_r )
{
uint8_t data = m_dor;
- if (LOG) logerror("HD61830 '%s' Display Data Read %02x\n", tag(), m_dor);
+ LOG("HD61830 Display Data Read %02x\n", m_dor);
m_dor = readbyte(m_cac);
@@ -241,7 +217,7 @@ WRITE8_MEMBER( hd61830_device::data_w )
{
if (m_bf)
{
- logerror("HD61830 '%s' Ignoring data write %02x due to business\n", tag(), data);
+ logerror("HD61830 Ignoring data write %02x due to business\n", data);
return;
}
@@ -250,53 +226,50 @@ WRITE8_MEMBER( hd61830_device::data_w )
case INSTRUCTION_MODE_CONTROL:
m_mcr = data;
- if (LOG)
- {
- logerror("HD61830 '%s' %s CG\n", tag(), (data & MODE_EXTERNAL_CG) ? "External" : "Internal");
- logerror("HD61830 '%s' %s Display Mode\n", tag(), (data & MODE_GRAPHIC) ? "Graphic" : "Character");
- logerror("HD61830 '%s' %s Mode\n", tag(), (data & MODE_MASTER) ? "Master" : "Slave");
- logerror("HD61830 '%s' Cursor %s\n", tag(), (data & MODE_CURSOR) ? "On" : "Off");
- logerror("HD61830 '%s' Blink %s\n", tag(), (data & MODE_BLINK) ? "On" : "Off");
- logerror("HD61830 '%s' Display %s\n", tag(), (data & MODE_DISPLAY_ON) ? "On" : "Off");
- }
+ LOG("HD61830 %s CG\n", (data & MODE_EXTERNAL_CG) ? "External" : "Internal");
+ LOG("HD61830 %s Display Mode\n", (data & MODE_GRAPHIC) ? "Graphic" : "Character");
+ LOG("HD61830 %s Mode\n", (data & MODE_MASTER) ? "Master" : "Slave");
+ LOG("HD61830 Cursor %s\n", (data & MODE_CURSOR) ? "On" : "Off");
+ LOG("HD61830 Blink %s\n", (data & MODE_BLINK) ? "On" : "Off");
+ LOG("HD61830 Display %s\n", (data & MODE_DISPLAY_ON) ? "On" : "Off");
break;
case INSTRUCTION_CHARACTER_PITCH:
m_hp = (data & 0x07) + 1;
m_vp = (data >> 4) + 1;
- if (LOG) logerror("HD61830 '%s' Horizontal Character Pitch: %u\n", tag(), m_hp);
- if (LOG) logerror("HD61830 '%s' Vertical Character Pitch: %u\n", tag(), m_vp);
+ LOG("HD61830 Horizontal Character Pitch: %u\n", m_hp);
+ LOG("HD61830 Vertical Character Pitch: %u\n", m_vp);
break;
case INSTRUCTION_NUMBER_OF_CHARACTERS:
m_hn = (data & 0x7f) + 1;
- if (LOG) logerror("HD61830 '%s' Number of Characters: %u\n", tag(), m_hn);
+ LOG("HD61830 Number of Characters: %u\n", m_hn);
break;
case INSTRUCTION_NUMBER_OF_TIME_DIVISIONS:
m_nx = (data & 0x7f) + 1;
- if (LOG) logerror("HD61830 '%s' Number of Time Divisions: %u\n", tag(), m_nx);
+ LOG("HD61830 Number of Time Divisions: %u\n", m_nx);
break;
case INSTRUCTION_CURSOR_POSITION:
m_cp = (data & 0x7f) + 1;
- if (LOG) logerror("HD61830 '%s' Cursor Position: %u\n", tag(), m_cp);
+ LOG("HD61830 Cursor Position: %u\n", m_cp);
break;
case INSTRUCTION_DISPLAY_START_LOW:
m_dsa = (m_dsa & 0xff00) | data;
- if (LOG) logerror("HD61830 '%s' Display Start Address Low %04x\n", tag(), m_dsa);
+ LOG("HD61830 Display Start Address Low %04x\n", m_dsa);
break;
case INSTRUCTION_DISPLAY_START_HIGH:
m_dsa = (data << 8) | (m_dsa & 0xff);
- if (LOG) logerror("HD61830 '%s' Display Start Address High %04x\n", tag(), m_dsa);
+ LOG("HD61830 Display Start Address High %04x\n", m_dsa);
break;
case INSTRUCTION_CURSOR_ADDRESS_LOW:
@@ -309,19 +282,19 @@ WRITE8_MEMBER( hd61830_device::data_w )
m_cac = (m_cac & 0xff00) | data;
}
- if (LOG) logerror("HD61830 '%s' Cursor Address Low %02x: %04x\n", tag(), data, m_cac);
+ LOG("HD61830 Cursor Address Low %02x: %04x\n", data, m_cac);
break;
case INSTRUCTION_CURSOR_ADDRESS_HIGH:
m_cac = (data << 8) | (m_cac & 0xff);
- if (LOG) logerror("HD61830 '%s' Cursor Address High %02x: %04x\n", tag(), data, m_cac);
+ LOG("HD61830 Cursor Address High %02x: %04x\n", data, m_cac);
break;
case INSTRUCTION_DISPLAY_DATA_WRITE:
writebyte(m_cac, data);
- if (LOG) logerror("HD61830 '%s' Display Data Write %02x -> %04x row %u col %u\n", tag(), data, m_cac, m_cac / 40, m_cac % 40);
+ LOG("HD61830 Display Data Write %02x -> %04x row %u col %u\n", data, m_cac, m_cac / 40, m_cac % 40);
m_cac++;
break;
@@ -333,7 +306,7 @@ WRITE8_MEMBER( hd61830_device::data_w )
md &= ~(1 << bit);
- if (LOG) logerror("HD61830 '%s' Clear Bit %u at %04x\n", tag(), bit + 1, m_cac);
+ LOG("HD61830 Clear Bit %u at %04x\n", bit + 1, m_cac);
writebyte(m_cac, md);
@@ -348,7 +321,7 @@ WRITE8_MEMBER( hd61830_device::data_w )
md |= 1 << bit;
- if (LOG) logerror("HD61830 '%s' Set Bit %u at %04x\n", tag(), bit + 1, m_cac);
+ LOG("HD61830 Set Bit %u at %04x\n", bit + 1, m_cac);
writebyte(m_cac, md);
@@ -357,7 +330,7 @@ WRITE8_MEMBER( hd61830_device::data_w )
break;
default:
- logerror("HD61830 '%s' Illegal Instruction %02x!\n", tag(), m_ir);
+ logerror("HD61830 Illegal Instruction %02x!\n", m_ir);
return;
}
diff --git a/src/devices/video/hd61830.h b/src/devices/video/hd61830.h
index 05f2ac1b3a2..e454ec79a97 100644
--- a/src/devices/video/hd61830.h
+++ b/src/devices/video/hd61830.h
@@ -6,10 +6,10 @@
**********************************************************************/
-#pragma once
+#ifndef MAME_VIDEO_HD61830_H
+#define MAME_VIDEO_HD61830_H
-#ifndef __HD61830__
-#define __HD61830__
+#pragma once
@@ -37,7 +37,7 @@ public:
// construction/destruction
hd61830_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- template<class _Object> static devcb_base &set_rd_rd_callback(device_t &device, _Object object) { return downcast<hd61830_device &>(device).m_read_rd.set_callback(object); }
+ template <class Object> static devcb_base &set_rd_rd_callback(device_t &device, Object &&cb) { return downcast<hd61830_device &>(device).m_read_rd.set_callback(std::forward<Object>(cb)); }
DECLARE_READ8_MEMBER( status_r );
DECLARE_WRITE8_MEMBER( control_w );
@@ -55,10 +55,10 @@ protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
// device_memory_interface overrides
- virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override;
+ virtual const address_space_config *memory_space_config(address_spacenum spacenum) const override;
- inline uint8_t readbyte(offs_t address);
- inline void writebyte(offs_t address, uint8_t data);
+ uint8_t readbyte(offs_t address) { return space().read_byte(address); }
+ void writebyte(offs_t address, uint8_t data) { space().write_byte(address, data); }
private:
enum
@@ -116,9 +116,7 @@ private:
// device type definition
-extern const device_type HD61830;
+DECLARE_DEVICE_TYPE(HD61830, hd61830_device)
extern const device_type HD61830B;
-
-
-#endif
+#endif // MAME_VIDEO_HD61830_H
diff --git a/src/devices/video/hd63484.cpp b/src/devices/video/hd63484.cpp
index 06f7a1dc20c..0345362ebd6 100644
--- a/src/devices/video/hd63484.cpp
+++ b/src/devices/video/hd63484.cpp
@@ -25,7 +25,7 @@
//-------------------------------------------------
hd63484_device::hd63484_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, HD63484, "HD63484 CRTC", tag, owner, clock, "hd63484", __FILE__),
+ : device_t(mconfig, HD63484, tag, owner, clock),
device_memory_interface(mconfig, *this),
device_video_interface(mconfig, *this),
m_auto_configure_screen(true),
@@ -331,7 +331,7 @@ enum
-------------------------------------------------*/
// devices
-const device_type HD63484 = device_creator<hd63484_device>;
+DEFINE_DEVICE_TYPE(HD63484, hd63484_device, "hd63484", "Hitachi HD63484 ACRTC")
ROM_START( hd63484 )
diff --git a/src/devices/video/hd63484.h b/src/devices/video/hd63484.h
index 83e2bbcb232..0bdb703f388 100644
--- a/src/devices/video/hd63484.h
+++ b/src/devices/video/hd63484.h
@@ -7,15 +7,11 @@
**************************************************************************/
-#pragma once
-
-#ifndef __HD63484__
-#define __HD63484__
-
-
+#ifndef MAME_VIDEO_HD63484_H
+#define MAME_VIDEO_HD63484_H
+#pragma once
-typedef device_delegate<void (bitmap_ind16 &bitmap, const rectangle &cliprect, int y, int x, uint16_t data)> hd63484_display_delegate;
/***************************************************************************
@@ -30,7 +26,7 @@ typedef device_delegate<void (bitmap_ind16 &bitmap, const rectangle &cliprect, i
MCFG_DEVICE_ADDRESS_MAP(AS_0, _map)
#define MCFG_HD63484_DISPLAY_CALLBACK_OWNER(_class, _method) \
- hd63484_device::static_set_display_callback(*device, hd63484_display_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
+ hd63484_device::static_set_display_callback(*device, hd63484_device::display_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
#define MCFG_HD63484_AUTO_CONFIGURE_SCREEN(_val) \
hd63484_device::static_set_auto_configure_screen(*device, _val);
@@ -40,15 +36,17 @@ typedef device_delegate<void (bitmap_ind16 &bitmap, const rectangle &cliprect, i
// ======================> hd63484_device
-class hd63484_device : public device_t,
+class hd63484_device : public device_t,
public device_memory_interface,
public device_video_interface
{
public:
+ typedef device_delegate<void (bitmap_ind16 &bitmap, const rectangle &cliprect, int y, int x, uint16_t data)> display_delegate;
+
// construction/destruction
hd63484_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- static void static_set_display_callback(device_t &device, hd63484_display_delegate callback) { downcast<hd63484_device &>(device).m_display_cb = callback; }
+ static void static_set_display_callback(device_t &device, display_delegate &&cb) { downcast<hd63484_device &>(device).m_display_cb = std::move(cb); }
static void static_set_auto_configure_screen(device_t &device, bool auto_configure_screen) { downcast<hd63484_device &>(device).m_auto_configure_screen = auto_configure_screen; }
DECLARE_WRITE16_MEMBER( address_w );
@@ -115,7 +113,7 @@ private:
void register_save_state();
- hd63484_display_delegate m_display_cb;
+ display_delegate m_display_cb;
bool m_auto_configure_screen;
uint8_t m_ar;
@@ -188,6 +186,6 @@ private:
};
// device type definition
-extern const device_type HD63484;
+DECLARE_DEVICE_TYPE(HD63484, hd63484_device)
-#endif /* __HD63484_H__ */
+#endif // MAME_VIDEO_HD63484_H
diff --git a/src/devices/video/hd66421.cpp b/src/devices/video/hd66421.cpp
index a19dc11c750..a6c834d5db0 100644
--- a/src/devices/video/hd66421.cpp
+++ b/src/devices/video/hd66421.cpp
@@ -11,14 +11,17 @@
#include "emu.h"
#include "hd66421.h"
+
//**************************************************************************
// MACROS / CONSTANTS
//**************************************************************************
+//#define HD66421_BRIGHTNESS_DOES_NOT_WORK
+
#define LOG_LEVEL 1
#define _logerror(level,x) do { if (LOG_LEVEL > level) logerror x; } while (0)
-#define HD66421_RAM_SIZE (HD66421_WIDTH * HD66421_HEIGHT / 4) // 2-bits per pixel
+#define HD66421_RAM_SIZE (hd66421_device::WIDTH * hd66421_device::HEIGHT / 4) // 2-bits per pixel
// R0 - control register 1
#define LCD_R0_RMW 0x80 // read-modify-write mode
@@ -65,7 +68,7 @@
//**************************************************************************
// devices
-const device_type HD66421 = device_creator<hd66421_device>;
+DEFINE_DEVICE_TYPE(HD66421, hd66421_device, "hd66421", "Hitachi HD66421 LCD Controller")
// default address map
@@ -117,7 +120,7 @@ inline void hd66421_device::writebyte(offs_t address, uint8_t data)
//-------------------------------------------------
hd66421_device::hd66421_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, HD66421, "Hitachi HD66421 LCD Controller", tag, owner, clock, "hd66421", __FILE__),
+ : device_t(mconfig, HD66421, tag, owner, clock),
device_memory_interface(mconfig, *this),
m_space_config("videoram", ENDIANNESS_LITTLE, 8, 17, 0, nullptr, *ADDRESS_MAP_NAME(hd66421)),
m_cmd(0),
@@ -181,20 +184,20 @@ WRITE8_MEMBER( hd66421_device::reg_dat_w )
case LCD_REG_RAM :
{
uint8_t r1;
- writebyte(m_y * (HD66421_WIDTH / 4) + m_x, data);
+ writebyte(m_y * (WIDTH / 4) + m_x, data);
r1 = m_reg[LCD_REG_CONTROL_2];
if (r1 & 0x02)
m_x++;
else
m_y++;
- if (m_x >= (HD66421_WIDTH / 4))
+ if (m_x >= (WIDTH / 4))
{
m_x = 0;
m_y++;
}
- if (m_y >= HD66421_HEIGHT)
+ if (m_y >= HEIGHT)
m_y = 0;
}
break;
@@ -222,11 +225,11 @@ uint32_t hd66421_device::update_screen(screen_device &screen, bitmap_ind16 &bitm
if (temp > 31) temp = 31;
bright = 1.0 * temp / 31;
pen[i] = i;
- #ifdef HD66421_BRIGHTNESS_DOES_NOT_WORK
+#ifdef HD66421_BRIGHTNESS_DOES_NOT_WORK
m_palette->set_pen_color(pen[i], 255 * bright, 255 * bright, 255 * bright);
- #else
+#else
m_palette->set_pen_contrast(pen[i], bright);
- #endif
+#endif
}
// draw bitmap (bottom to top)
@@ -234,7 +237,7 @@ uint32_t hd66421_device::update_screen(screen_device &screen, bitmap_ind16 &bitm
{
int x, y;
x = 0;
- y = HD66421_HEIGHT - 1;
+ y = HEIGHT - 1;
for (int i = 0; i < HD66421_RAM_SIZE; i++)
{
@@ -242,7 +245,7 @@ uint32_t hd66421_device::update_screen(screen_device &screen, bitmap_ind16 &bitm
plot_pixel(bitmap, x++, y, pen[(readbyte(i) >> 4) & 3]);
plot_pixel(bitmap, x++, y, pen[(readbyte(i) >> 2) & 3]);
plot_pixel(bitmap, x++, y, pen[(readbyte(i) >> 0) & 3]);
- if (x >= HD66421_WIDTH)
+ if (x >= WIDTH)
{
x = 0;
y = y - 1;
@@ -251,7 +254,7 @@ uint32_t hd66421_device::update_screen(screen_device &screen, bitmap_ind16 &bitm
}
else
{
- rectangle rect(0, HD66421_WIDTH - 1, 0, HD66421_HEIGHT - 1);
+ rectangle rect(0, WIDTH - 1, 0, HEIGHT - 1);
bitmap.fill(m_palette->white_pen(), rect);
}
diff --git a/src/devices/video/hd66421.h b/src/devices/video/hd66421.h
index d7a00d91107..3be6de49536 100644
--- a/src/devices/video/hd66421.h
+++ b/src/devices/video/hd66421.h
@@ -8,23 +8,11 @@
***************************************************************************/
-#pragma once
-
-#ifndef __HD66421_H__
-#define __HD66421_H__
-
-
-///*************************************************************************
-// MACROS / CONSTANTS
-///*************************************************************************
-
-//#define HD66421_BRIGHTNESS_DOES_NOT_WORK
-
-#define HD66421_WIDTH 160
-#define HD66421_HEIGHT 100
+#ifndef MAME_VIDEO_HD66421_H
+#define MAME_VIDEO_HD66421_H
+#pragma once
-/*----------- defined in video/hd66421.c -----------*/
///*************************************************************************
// INTERFACE CONFIGURATION MACROS
@@ -43,6 +31,9 @@ class hd66421_device : public device_t,
public device_memory_interface
{
public:
+ static constexpr unsigned WIDTH = 160;
+ static constexpr unsigned HEIGHT = 100;
+
// construction/destruction
hd66421_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
@@ -78,7 +69,6 @@ private:
// device type definition
-extern const device_type HD66421;
-
+DECLARE_DEVICE_TYPE(HD66421, hd66421_device)
-#endif
+#endif // MAME_VIDEO_HD66421_H
diff --git a/src/devices/video/hlcd0515.cpp b/src/devices/video/hlcd0515.cpp
index 2f691eb839d..c930897d0bd 100644
--- a/src/devices/video/hlcd0515.cpp
+++ b/src/devices/video/hlcd0515.cpp
@@ -17,26 +17,27 @@
#include "video/hlcd0515.h"
-const device_type HLCD0515 = device_creator<hlcd0515_device>;
-const device_type HLCD0569 = device_creator<hlcd0569_device>;
+DEFINE_DEVICE_TYPE(HLCD0515, hlcd0515_device, "hlcd0515", "Hughes HLCD 0515 LCD Driver")
+DEFINE_DEVICE_TYPE(HLCD0569, hlcd0569_device, "hlcd0569", "Hughes HLCD 0569 LCD Driver")
//-------------------------------------------------
// constructor
//-------------------------------------------------
-hlcd0515_device::hlcd0515_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, u8 colmax, const char *shortname, const char *source)
- : device_t(mconfig, type, name, tag, owner, clock, shortname, source),
- m_colmax(colmax), m_write_cols(*this), m_write_data(*this)
+hlcd0515_device::hlcd0515_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 colmax)
+ : device_t(mconfig, type, tag, owner, clock)
+ , m_colmax(colmax)
+ , m_write_cols(*this), m_write_data(*this)
{
}
hlcd0515_device::hlcd0515_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : hlcd0515_device(mconfig, HLCD0515, "HLCD 0515 LCD Driver", tag, owner, clock, 25, "hlcd0515", __FILE__)
+ : hlcd0515_device(mconfig, HLCD0515, tag, owner, clock, 25)
{
}
hlcd0569_device::hlcd0569_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : hlcd0515_device(mconfig, HLCD0569, "HLCD 0569 LCD Driver", tag, owner, clock, 24, "hlcd0569", __FILE__)
+ : hlcd0515_device(mconfig, HLCD0569, tag, owner, clock, 24)
{
}
diff --git a/src/devices/video/hlcd0515.h b/src/devices/video/hlcd0515.h
index 899ed199576..16a62d74756 100644
--- a/src/devices/video/hlcd0515.h
+++ b/src/devices/video/hlcd0515.h
@@ -6,18 +6,10 @@
*/
-#ifndef _HLCD0515_H_
-#define _HLCD0515_H_
-
-
-// COL/ROW pins (offset for ROW)
-#define MCFG_HLCD0515_WRITE_COLS_CB(_devcb) \
- devcb = &hlcd0515_device::set_write_cols_callback(*device, DEVCB_##_devcb);
-
-// DATA OUT pin, don't use on HLCD0569
-#define MCFG_HLCD0515_WRITE_DATA_CB(_devcb) \
- devcb = &hlcd0515_device::set_write_data_callback(*device, DEVCB_##_devcb);
+#ifndef MAME_VIDEO_HLCD0515_H
+#define MAME_VIDEO_HLCD0515_H
+#pragma once
// pinout reference
@@ -50,21 +42,32 @@
Internally, this is divided by 2, and by number of rows to get display refresh frequency.
*/
+
+// COL/ROW pins (offset for ROW)
+#define MCFG_HLCD0515_WRITE_COLS_CB(_devcb) \
+ devcb = &hlcd0515_device::set_write_cols_callback(*device, DEVCB_##_devcb);
+
+// DATA OUT pin, don't use on HLCD0569
+#define MCFG_HLCD0515_WRITE_DATA_CB(_devcb) \
+ devcb = &hlcd0515_device::set_write_data_callback(*device, DEVCB_##_devcb);
+
+
class hlcd0515_device : public device_t
{
public:
hlcd0515_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
- hlcd0515_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, u8 colmax, const char *shortname, const char *source);
// static configuration helpers
- template<typename Object> static devcb_base &set_write_cols_callback(device_t &device, Object &&object) { return downcast<hlcd0515_device &>(device).m_write_cols.set_callback(std::forward<Object>(object)); }
- template<typename Object> static devcb_base &set_write_data_callback(device_t &device, Object &&object) { return downcast<hlcd0515_device &>(device).m_write_data.set_callback(std::forward<Object>(object)); }
+ template <typename Object> static devcb_base &set_write_cols_callback(device_t &device, Object &&cb) { return downcast<hlcd0515_device &>(device).m_write_cols.set_callback(std::forward<Object>(cb)); }
+ template <typename Object> static devcb_base &set_write_data_callback(device_t &device, Object &&cb) { return downcast<hlcd0515_device &>(device).m_write_data.set_callback(std::forward<Object>(cb)); }
DECLARE_WRITE_LINE_MEMBER(write_clock);
DECLARE_WRITE_LINE_MEMBER(write_cs);
DECLARE_WRITE_LINE_MEMBER(write_data) { m_data = (state) ? 1 : 0; }
protected:
+ hlcd0515_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 colmax);
+
// device-level overrides
virtual void device_start() override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
@@ -72,7 +75,7 @@ protected:
virtual void set_control();
void clock_data(int col);
- u8 m_colmax; // number of column pins
+ const u8 m_colmax; // number of column pins
int m_cs; // input pin state
int m_clock; // "
@@ -104,9 +107,7 @@ protected:
};
+DECLARE_DEVICE_TYPE(HLCD0515, hlcd0515_device)
+DECLARE_DEVICE_TYPE(HLCD0569, hlcd0569_device)
-extern const device_type HLCD0515;
-extern const device_type HLCD0569;
-
-
-#endif /* _HLCD0515_H_ */
+#endif // MAME_VIDEO_HLCD0515_H
diff --git a/src/devices/video/hlcd0538.cpp b/src/devices/video/hlcd0538.cpp
index 402ece29d6e..c409e6be528 100644
--- a/src/devices/video/hlcd0538.cpp
+++ b/src/devices/video/hlcd0538.cpp
@@ -16,26 +16,26 @@
#include "video/hlcd0538.h"
-const device_type HLCD0538 = device_creator<hlcd0538_device>;
-const device_type HLCD0539 = device_creator<hlcd0539_device>;
+DEFINE_DEVICE_TYPE(HLCD0538, hlcd0538_device, "hlcd0538", "Hughes HLCD 0538 LCD Driver")
+DEFINE_DEVICE_TYPE(HLCD0539, hlcd0539_device, "hlcd0539", "Hughes HLCD 0539 LCD Driver")
//-------------------------------------------------
// constructor
//-------------------------------------------------
-hlcd0538_device::hlcd0538_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, const char *shortname, const char *source)
- : device_t(mconfig, type, name, tag, owner, clock, shortname, source),
- m_write_cols(*this), m_write_interrupt(*this)
+hlcd0538_device::hlcd0538_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock)
+ : device_t(mconfig, type, tag, owner, clock)
+ , m_write_cols(*this), m_write_interrupt(*this)
{
}
hlcd0538_device::hlcd0538_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : hlcd0538_device(mconfig, HLCD0538, "HLCD 0538 LCD Driver", tag, owner, clock, "hlcd0538", __FILE__)
+ : hlcd0538_device(mconfig, HLCD0538, tag, owner, clock)
{
}
hlcd0539_device::hlcd0539_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : hlcd0538_device(mconfig, HLCD0539, "HLCD 0539 LCD Driver", tag, owner, clock, "hlcd0539", __FILE__)
+ : hlcd0538_device(mconfig, HLCD0539, tag, owner, clock)
{
}
diff --git a/src/devices/video/hlcd0538.h b/src/devices/video/hlcd0538.h
index 3d49460b80a..8bdbb4a83f1 100644
--- a/src/devices/video/hlcd0538.h
+++ b/src/devices/video/hlcd0538.h
@@ -6,18 +6,10 @@
*/
-#ifndef _HLCD0538_H_
-#define _HLCD0538_H_
-
-
-// C/R pins (0538: d0-d7 for rows)
-#define MCFG_HLCD0538_WRITE_COLS_CB(_devcb) \
- devcb = &hlcd0538_device::set_write_cols_callback(*device, DEVCB_##_devcb);
-
-// INTERRUPT pin
-#define MCFG_HLCD0538_INTERRUPT_CB(_devcb) \
- devcb = &hlcd0538_device::set_write_interrupt_callback(*device, DEVCB_##_devcb);
+#ifndef MAME_VIDEO_HLCD0538_H
+#define MAME_VIDEO_HLCD0538_H
+#pragma once
// pinout reference
@@ -47,21 +39,32 @@
HLCD 0539 has 8 more C pins(1-8) in place of R pins.
*/
+
+// C/R pins (0538: d0-d7 for rows)
+#define MCFG_HLCD0538_WRITE_COLS_CB(_devcb) \
+ devcb = &hlcd0538_device::set_write_cols_callback(*device, DEVCB_##_devcb);
+
+// INTERRUPT pin
+#define MCFG_HLCD0538_INTERRUPT_CB(_devcb) \
+ devcb = &hlcd0538_device::set_write_interrupt_callback(*device, DEVCB_##_devcb);
+
+
class hlcd0538_device : public device_t
{
public:
hlcd0538_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
- hlcd0538_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, const char *shortname, const char *source);
// static configuration helpers
- template<typename Object> static devcb_base &set_write_cols_callback(device_t &device, Object &&object) { return downcast<hlcd0538_device &>(device).m_write_cols.set_callback(std::forward<Object>(object)); }
- template<typename Object> static devcb_base &set_write_interrupt_callback(device_t &device, Object &&object) { return downcast<hlcd0538_device &>(device).m_write_interrupt.set_callback(std::forward<Object>(object)); }
+ template <typename Object> static devcb_base &set_write_cols_callback(device_t &device, Object &&cb) { return downcast<hlcd0538_device &>(device).m_write_cols.set_callback(std::forward<Object>(cb)); }
+ template <typename Object> static devcb_base &set_write_interrupt_callback(device_t &device, Object &&cb) { return downcast<hlcd0538_device &>(device).m_write_interrupt.set_callback(std::forward<Object>(cb)); }
DECLARE_WRITE_LINE_MEMBER(write_clk);
DECLARE_WRITE_LINE_MEMBER(write_lcd);
DECLARE_WRITE_LINE_MEMBER(write_data) { m_data = (state) ? 1 : 0; }
protected:
+ hlcd0538_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
+
// device-level overrides
virtual void device_start() override;
@@ -84,8 +87,7 @@ public:
-extern const device_type HLCD0538;
-extern const device_type HLCD0539;
-
+DECLARE_DEVICE_TYPE(HLCD0538, hlcd0538_device)
+DECLARE_DEVICE_TYPE(HLCD0539, hlcd0539_device)
-#endif /* _HLCD0538_H_ */
+#endif // MAME_VIDEO_HLCD0538_H
diff --git a/src/devices/video/hp1ll3.cpp b/src/devices/video/hp1ll3.cpp
index b87c8a15342..21b6a2b4550 100644
--- a/src/devices/video/hp1ll3.cpp
+++ b/src/devices/video/hp1ll3.cpp
@@ -37,6 +37,98 @@
#include "screen.h"
+///*************************************************************************
+// MACROS / CONSTANTS
+///*************************************************************************
+
+/*
+ * command types (send)
+ *
+ * 0 -- no data
+ * 1 -- write 1 word of data, then command
+ * 2 -- write 2 words of data, then command
+ * 3 -- write command, then 11 words of data (= CONF only?)
+ * 4 -- write 1 word of data, then command, then write X words of data, then write NOP
+ *
+ * (read)
+ *
+ * 3 -- ???
+ * 4 -- write 1 word of data, then command, then read X words of data, then write NOP
+ */
+#define NOP 0 // type 0
+#define CONF 2 // type 3, configure GPU (screen size, timings...). 11 words of data.
+#define DISVID 3 // type 0, disable video
+#define ENVID 4 // type 0, enable video
+#define WRMEM 7 // type 4, write GPU memory at offset, terminate by NOP
+#define RDMEM 8 // type 4, read GPU memory from offset, terminate by NOP
+#define WRSAD 9 // type 1, set screen area start address
+#define WRORG 10 // type 1, set ???
+#define WRDAD 11 // type 1, set data area start address (16x16 area fill, sprite and cursor)
+#define WRRR 12 // type 1, set replacement rule (rasterop)
+#define MOVEP 13 // type 2, move pointer
+#define IMOVEP 14
+#define DRAWP 15 // type 2, draw line
+#define IDRAWP 16
+#define RDP 17
+#define WRUDL 18 // type 1, set user-defined line pattern (16-bit)
+#define WRWINSIZ 19 // type 2, set ???
+#define WRWINORG 20 // type 2, set ???
+#define COPY 21 // type 2
+#define FILL 22 // type 1, fill area
+#define FRAME 23 // type _, draw rectangle
+#define SCROLUP 24 // type 2
+#define SCROLDN 25 // type 2
+#define SCROLLF 26 // type 2
+#define SCROLRT 27 // type 2
+#define RDWIN 28 // type 1
+#define WRWIN 29 // type 1
+#define RDWINPARM 30
+#define CR 31
+#define CRLFx 32
+#define LABEL 36 // type 1, draw text
+#define ENSP 38 // type 0, enable sprite
+#define DISSP 39 // type 0, disable sprite
+#define MOVESP 40 // type 2, move sprite
+#define IMOVESP 41
+#define RDSP 42
+#define DRAWPX 43 // type _, draw single pixel
+#define WRFAD 44 // type 1, set font area start address
+#define ENCURS 45 // type 0
+#define DISCURS 46 // type 0
+#define ID 63
+
+
+/*
+ * Replacement Rules (rops). sources:
+ *
+ * - NetBSD's diofbvar.h (definitions for Topcat chip)
+ * - pdf/hp/9000_300/specs/A-5958-4362-9_Series_300_Display_Color_Card_Theory_of_Operation_Oct85.pdf
+ * refers to TOPCAT documentation p/n A-1FH2-2001-7 (not online)
+ */
+#define RR_FORCE_ZERO 0x0
+#define RR_CLEAR RR_FORCE_ZERO
+#define RR_AND 0x1
+#define RR_AND_NOT_OLD 0x2
+#define RR_NEW 0x3
+#define RR_COPY RR_NEW
+#define RR_AND_NOT_NEW 0x4
+#define RR_OLD 0x5
+#define RR_XOR 0x6
+#define RR_OR 0x7
+#define RR_NOR 0x8
+#define RR_XNOR 0x9
+#define RR_NOT_OLD 0xa
+#define RR_INVERT RR_NOT_OLD
+#define RR_OR_NOT_OLD 0xb
+#define RR_NOT_NEW 0xc
+#define RR_COPYINVERTED RR_NOT_NEW
+#define RR_OR_NOT_NEW 0xd
+#define RR_NAND 0xe
+#define RR_FORCE_ONE 0xf
+
+#define WS 16 // bits in a word
+
+
//**************************************************************************
// MACROS / CONSTANTS
//**************************************************************************
@@ -64,7 +156,7 @@
//**************************************************************************
// devices
-const device_type HP1LL3 = device_creator<hp1ll3_device>;
+DEFINE_DEVICE_TYPE(HP1LL3, hp1ll3_device, "hp1ll3", "Hewlett-Packard 1LL3-0005 GPU")
//**************************************************************************
@@ -76,7 +168,7 @@ const device_type HP1LL3 = device_creator<hp1ll3_device>;
//-------------------------------------------------
hp1ll3_device::hp1ll3_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, HP1LL3, "Hewlett-Package 1LL3-0005 GPU", tag, owner, clock, "hp1ll3", __FILE__)
+ : device_t(mconfig, HP1LL3, tag, owner, clock)
, device_video_interface(mconfig, *this)
{
}
diff --git a/src/devices/video/hp1ll3.h b/src/devices/video/hp1ll3.h
index f95b8dcb32b..ab8b047a977 100644
--- a/src/devices/video/hp1ll3.h
+++ b/src/devices/video/hp1ll3.h
@@ -6,103 +6,11 @@
***************************************************************************/
+#ifndef MAME_VIDEO_HP1LL3_H
+#define MAME_VIDEO_HP1LL3_H
#pragma once
-#ifndef __HP1LL3_H__
-#define __HP1LL3_H__
-
-///*************************************************************************
-// MACROS / CONSTANTS
-///*************************************************************************
-
-/*
- * command types (send)
- *
- * 0 -- no data
- * 1 -- write 1 word of data, then command
- * 2 -- write 2 words of data, then command
- * 3 -- write command, then 11 words of data (= CONF only?)
- * 4 -- write 1 word of data, then command, then write X words of data, then write NOP
- *
- * (read)
- *
- * 3 -- ???
- * 4 -- write 1 word of data, then command, then read X words of data, then write NOP
- */
-#define NOP 0 // type 0
-#define CONF 2 // type 3, configure GPU (screen size, timings...). 11 words of data.
-#define DISVID 3 // type 0, disable video
-#define ENVID 4 // type 0, enable video
-#define WRMEM 7 // type 4, write GPU memory at offset, terminate by NOP
-#define RDMEM 8 // type 4, read GPU memory from offset, terminate by NOP
-#define WRSAD 9 // type 1, set screen area start address
-#define WRORG 10 // type 1, set ???
-#define WRDAD 11 // type 1, set data area start address (16x16 area fill, sprite and cursor)
-#define WRRR 12 // type 1, set replacement rule (rasterop)
-#define MOVEP 13 // type 2, move pointer
-#define IMOVEP 14
-#define DRAWP 15 // type 2, draw line
-#define IDRAWP 16
-#define RDP 17
-#define WRUDL 18 // type 1, set user-defined line pattern (16-bit)
-#define WRWINSIZ 19 // type 2, set ???
-#define WRWINORG 20 // type 2, set ???
-#define COPY 21 // type 2
-#define FILL 22 // type 1, fill area
-#define FRAME 23 // type _, draw rectangle
-#define SCROLUP 24 // type 2
-#define SCROLDN 25 // type 2
-#define SCROLLF 26 // type 2
-#define SCROLRT 27 // type 2
-#define RDWIN 28 // type 1
-#define WRWIN 29 // type 1
-#define RDWINPARM 30
-#define CR 31
-#define CRLFx 32
-#define LABEL 36 // type 1, draw text
-#define ENSP 38 // type 0, enable sprite
-#define DISSP 39 // type 0, disable sprite
-#define MOVESP 40 // type 2, move sprite
-#define IMOVESP 41
-#define RDSP 42
-#define DRAWPX 43 // type _, draw single pixel
-#define WRFAD 44 // type 1, set font area start address
-#define ENCURS 45 // type 0
-#define DISCURS 46 // type 0
-#define ID 63
-
-
-/*
- * Replacement Rules (rops). sources:
- *
- * - NetBSD's diofbvar.h (definitions for Topcat chip)
- * - pdf/hp/9000_300/specs/A-5958-4362-9_Series_300_Display_Color_Card_Theory_of_Operation_Oct85.pdf
- * refers to TOPCAT documentation p/n A-1FH2-2001-7 (not online)
- */
-#define RR_FORCE_ZERO 0x0
-#define RR_CLEAR RR_FORCE_ZERO
-#define RR_AND 0x1
-#define RR_AND_NOT_OLD 0x2
-#define RR_NEW 0x3
-#define RR_COPY RR_NEW
-#define RR_AND_NOT_NEW 0x4
-#define RR_OLD 0x5
-#define RR_XOR 0x6
-#define RR_OR 0x7
-#define RR_NOR 0x8
-#define RR_XNOR 0x9
-#define RR_NOT_OLD 0xa
-#define RR_INVERT RR_NOT_OLD
-#define RR_OR_NOT_OLD 0xb
-#define RR_NOT_NEW 0xc
-#define RR_COPYINVERTED RR_NOT_NEW
-#define RR_OR_NOT_NEW 0xd
-#define RR_NAND 0xe
-#define RR_FORCE_ONE 0xf
-
-#define WS 16 // bits in a word
-
///*************************************************************************
// INTERFACE CONFIGURATION MACROS
@@ -118,8 +26,7 @@
// ======================> hp1ll3_device
-class hp1ll3_device : public device_t,
- public device_video_interface
+class hp1ll3_device : public device_t, public device_video_interface
{
public:
// construction/destruction
@@ -170,7 +77,6 @@ private:
// device type definition
-extern const device_type HP1LL3;
-
+DECLARE_DEVICE_TYPE(HP1LL3, hp1ll3_device)
-#endif
+#endif // MAME_VIDEO_HP1LL3_H
diff --git a/src/devices/video/huc6202.cpp b/src/devices/video/huc6202.cpp
index e5a4d2438c1..bbacd956e26 100644
--- a/src/devices/video/huc6202.cpp
+++ b/src/devices/video/huc6202.cpp
@@ -7,27 +7,29 @@
**********************************************************************/
#include "emu.h"
-#include "huc6270.h"
#include "huc6202.h"
+#include "huc6270.h"
+
-const device_type HUC6202 = device_creator<huc6202_device>;
+DEFINE_DEVICE_TYPE(HUC6202, huc6202_device, "huc6202", "Hudson HuC6202 VPC")
huc6202_device::huc6202_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, HUC6202, "HuC6202 VPC", tag, owner, clock, "huc6202", __FILE__),
- m_next_pixel_0_cb(*this),
- m_time_til_next_event_0_cb(*this),
- m_vsync_changed_0_cb(*this),
- m_hsync_changed_0_cb(*this),
- m_read_0_cb(*this),
- m_write_0_cb(*this),
- m_next_pixel_1_cb(*this),
- m_time_til_next_event_1_cb(*this),
- m_vsync_changed_1_cb(*this),
- m_hsync_changed_1_cb(*this),
- m_read_1_cb(*this),
- m_write_1_cb(*this), m_window1(0), m_window2(0), m_io_device(0), m_map_index(0), m_map_dirty(0)
+ : device_t(mconfig, HUC6202, tag, owner, clock)
+ , m_next_pixel_0_cb(*this)
+ , m_time_til_next_event_0_cb(*this)
+ , m_vsync_changed_0_cb(*this)
+ , m_hsync_changed_0_cb(*this)
+ , m_read_0_cb(*this)
+ , m_write_0_cb(*this)
+ , m_next_pixel_1_cb(*this)
+ , m_time_til_next_event_1_cb(*this)
+ , m_vsync_changed_1_cb(*this)
+ , m_hsync_changed_1_cb(*this)
+ , m_read_1_cb(*this)
+ , m_write_1_cb(*this)
+ , m_window1(0), m_window2(0), m_io_device(0), m_map_index(0), m_map_dirty(0)
{
}
diff --git a/src/devices/video/huc6202.h b/src/devices/video/huc6202.h
index 5ad529a3e35..3a3c90076e3 100644
--- a/src/devices/video/huc6202.h
+++ b/src/devices/video/huc6202.h
@@ -6,9 +6,10 @@
**********************************************************************/
-#ifndef __HUC6202_H_
-#define __HUC6202_H_
+#ifndef MAME_VIDEO_HUC6202_H
+#define MAME_VIDEO_HUC6202_H
+#pragma once
#define MCFG_HUC6202_NEXT_PIXEL_0_CB(_devcb) \
@@ -54,18 +55,18 @@ public:
// construction/destruction
huc6202_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- template<class _Object> static devcb_base &set_next_pixel_0_callback(device_t &device, _Object object) { return downcast<huc6202_device &>(device).m_next_pixel_0_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_time_til_next_event_0_callback(device_t &device, _Object object) { return downcast<huc6202_device &>(device).m_time_til_next_event_0_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_vsync_changed_0_callback(device_t &device, _Object object) { return downcast<huc6202_device &>(device).m_vsync_changed_0_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_hsync_changed_0_callback(device_t &device, _Object object) { return downcast<huc6202_device &>(device).m_hsync_changed_0_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_read_0_callback(device_t &device, _Object object) { return downcast<huc6202_device &>(device).m_read_0_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_write_0_callback(device_t &device, _Object object) { return downcast<huc6202_device &>(device).m_write_0_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_next_pixel_1_callback(device_t &device, _Object object) { return downcast<huc6202_device &>(device).m_next_pixel_1_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_time_til_next_event_1_callback(device_t &device, _Object object) { return downcast<huc6202_device &>(device).m_time_til_next_event_1_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_vsync_changed_1_callback(device_t &device, _Object object) { return downcast<huc6202_device &>(device).m_vsync_changed_1_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_hsync_changed_1_callback(device_t &device, _Object object) { return downcast<huc6202_device &>(device).m_hsync_changed_1_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_read_1_callback(device_t &device, _Object object) { return downcast<huc6202_device &>(device).m_read_1_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_write_1_callback(device_t &device, _Object object) { return downcast<huc6202_device &>(device).m_write_1_cb.set_callback(object); }
+ template <class Object> static devcb_base &set_next_pixel_0_callback(device_t &device, Object &&cb) { return downcast<huc6202_device &>(device).m_next_pixel_0_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_time_til_next_event_0_callback(device_t &device, Object &&cb) { return downcast<huc6202_device &>(device).m_time_til_next_event_0_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_vsync_changed_0_callback(device_t &device, Object &&cb) { return downcast<huc6202_device &>(device).m_vsync_changed_0_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_hsync_changed_0_callback(device_t &device, Object &&cb) { return downcast<huc6202_device &>(device).m_hsync_changed_0_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_read_0_callback(device_t &device, Object &&cb) { return downcast<huc6202_device &>(device).m_read_0_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_write_0_callback(device_t &device, Object &&cb) { return downcast<huc6202_device &>(device).m_write_0_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_next_pixel_1_callback(device_t &device, Object &&cb) { return downcast<huc6202_device &>(device).m_next_pixel_1_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_time_til_next_event_1_callback(device_t &device, Object &&cb) { return downcast<huc6202_device &>(device).m_time_til_next_event_1_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_vsync_changed_1_callback(device_t &device, Object &&cb) { return downcast<huc6202_device &>(device).m_vsync_changed_1_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_hsync_changed_1_callback(device_t &device, Object &&cb) { return downcast<huc6202_device &>(device).m_hsync_changed_1_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_read_1_callback(device_t &device, Object &&cb) { return downcast<huc6202_device &>(device).m_read_1_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_write_1_callback(device_t &device, Object &&cb) { return downcast<huc6202_device &>(device).m_write_1_cb.set_callback(std::forward<Object>(cb)); }
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
@@ -123,7 +124,6 @@ private:
};
-extern const device_type HUC6202;
+DECLARE_DEVICE_TYPE(HUC6202, huc6202_device)
-
-#endif
+#endif // MAME_VIDEO_HUC6202_H
diff --git a/src/devices/video/huc6260.cpp b/src/devices/video/huc6260.cpp
index 1676924dee2..3b00c9f7c7f 100644
--- a/src/devices/video/huc6260.cpp
+++ b/src/devices/video/huc6260.cpp
@@ -21,13 +21,18 @@
#include "screen.h"
+//#define VERBOSE 1
+#include "logmacro.h"
-#define LOG 0
#define HUC6260_HSYNC_LENGTH 237
-#define HUC6260_HSYNC_START ( HUC6260_WPF - HUC6260_HSYNC_LENGTH )
+#define HUC6260_HSYNC_START ( huc6260_device::WPF - HUC6260_HSYNC_LENGTH )
+constexpr unsigned huc6260_device::PALETTE_SIZE;
+constexpr unsigned huc6260_device::WPF;
+constexpr unsigned huc6260_device::LPF;
+
PALETTE_INIT_MEMBER(huc6260_device, huc6260)
{
int i;
@@ -45,11 +50,11 @@ PALETTE_INIT_MEMBER(huc6260_device, huc6260)
}
-const device_type HUC6260 = device_creator<huc6260_device>;
+DEFINE_DEVICE_TYPE(HUC6260, huc6260_device, "huc6260", "Hudson HuC6260 VCE")
huc6260_device::huc6260_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, HUC6260, "HuC6260 VCE", tag, owner, clock, "huc6260", __FILE__),
+ : device_t(mconfig, HUC6260, tag, owner, clock),
device_video_interface(mconfig, *this),
m_next_pixel_data_cb(*this),
m_time_til_next_event_cb(*this),
@@ -83,7 +88,7 @@ void huc6260_device::device_timer(emu_timer &timer, device_timer_id id, int para
bitmap_line[ h ] = m_palette[ m_pixel_data ];
m_pixel_clock = ( m_pixel_clock + 1 ) % m_pixels_per_clock;
- h = ( h + 1 ) % HUC6260_WPF;
+ h = ( h + 1 ) % WPF;
switch( h )
{
@@ -92,7 +97,7 @@ void huc6260_device::device_timer(emu_timer &timer, device_timer_id id, int para
// if ( v == 0 )
// {
// /* Check if the screen should be resized */
-// m_height = HUC6260_LPF - ( m_blur ? 1 : 0 );
+// m_height = LPF - ( m_blur ? 1 : 0 );
// if ( m_height != video_screen_get_height( m_screen ) )
// {
// rectangle visible_area;
@@ -103,7 +108,7 @@ void huc6260_device::device_timer(emu_timer &timer, device_timer_id id, int para
// visible_area.max_x = 64 + 1024 + 64 - 1;
// visible_area.max_y = 18 + 242 - 1;
//
-// video_screen_configure( m_screen, HUC6260_WPF, m_height, &visible_area, HZ_TO_ATTOSECONDS( device->clock / ( HUC6260_WPF * m_height ) ) );
+// video_screen_configure( m_screen, WPF, m_height, &visible_area, HZ_TO_ATTOSECONDS( device->clock / ( WPF * m_height ) ) );
// }
// }
break;
@@ -160,10 +165,10 @@ void huc6260_device::device_timer(emu_timer &timer, device_timer_id id, int para
event_hpos = hpos + next_event_clocks;
event_vpos = vpos;
- while ( event_hpos > HUC6260_WPF )
+ while ( event_hpos > WPF )
{
event_vpos += 1;
- event_hpos -= HUC6260_WPF;
+ event_hpos -= WPF;
}
if ( event_vpos < v || ( event_vpos == v && event_hpos <= h ) )
@@ -256,7 +261,7 @@ WRITE8_MEMBER( huc6260_device::write )
void huc6260_device::device_start()
{
m_timer = timer_alloc();
- m_bmp = std::make_unique<bitmap_ind16>(HUC6260_WPF, HUC6260_LPF );
+ m_bmp = std::make_unique<bitmap_ind16>(WPF, LPF);
/* Resolve callbacks */
m_hsync_changed_cb.resolve();
@@ -299,7 +304,7 @@ void huc6260_device::device_reset()
}
static MACHINE_CONFIG_FRAGMENT( huc6260 )
- MCFG_PALETTE_ADD("palette", HUC6260_PALETTE_SIZE )
+ MCFG_PALETTE_ADD("palette", huc6260_device::PALETTE_SIZE)
MCFG_PALETTE_INIT_OWNER(huc6260_device, huc6260)
MACHINE_CONFIG_END
diff --git a/src/devices/video/huc6260.h b/src/devices/video/huc6260.h
index f90a7946e20..c560f3df0f1 100644
--- a/src/devices/video/huc6260.h
+++ b/src/devices/video/huc6260.h
@@ -6,17 +6,10 @@
**********************************************************************/
+#ifndef MAME_VIDEO_HUC6260_H
+#define MAME_VIDEO_HUC6260_H
-#ifndef __HUC6260_H_
-#define __HUC6260_H_
-
-
-
-#define HUC6260_PALETTE_SIZE 1024
-
-/* Screen timing stuff */
-#define HUC6260_WPF 1365 /* width of a line in frame including blanking areas */
-#define HUC6260_LPF 263 /* max number of lines in a single frame */
+#pragma once
#define MCFG_HUC6260_NEXT_PIXEL_DATA_CB(_devcb) \
@@ -36,13 +29,20 @@ class huc6260_device : public device_t,
public device_video_interface
{
public:
+ static constexpr unsigned PALETTE_SIZE = 1024;
+
+ /* Screen timing stuff */
+ static constexpr unsigned WPF = 1365; // width of a line in frame including blanking areas
+ static constexpr unsigned LPF = 263; // max number of lines in a single frame
+
+
// construction/destruction
huc6260_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- template<class _Object> static devcb_base &set_next_pixel_data_callback(device_t &device, _Object object) { return downcast<huc6260_device &>(device).m_next_pixel_data_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_time_til_next_event_callback(device_t &device, _Object object) { return downcast<huc6260_device &>(device).m_time_til_next_event_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_vsync_changed_callback(device_t &device, _Object object) { return downcast<huc6260_device &>(device).m_vsync_changed_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_hsync_changed_callback(device_t &device, _Object object) { return downcast<huc6260_device &>(device).m_hsync_changed_cb.set_callback(object); }
+ template <class Object> static devcb_base &set_next_pixel_data_callback(device_t &device, Object &&cb) { return downcast<huc6260_device &>(device).m_next_pixel_data_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_time_til_next_event_callback(device_t &device, Object &&cb) { return downcast<huc6260_device &>(device).m_time_til_next_event_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_vsync_changed_callback(device_t &device, Object &&cb) { return downcast<huc6260_device &>(device).m_vsync_changed_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_hsync_changed_callback(device_t &device, Object &&cb) { return downcast<huc6260_device &>(device).m_hsync_changed_cb.set_callback(std::forward<Object>(cb)); }
void video_update(bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_READ8_MEMBER( read );
@@ -91,7 +91,6 @@ private:
};
-extern const device_type HUC6260;
-
+DECLARE_DEVICE_TYPE(HUC6260, huc6260_device)
-#endif
+#endif // MAME_VIDEO_HUC6260_H
diff --git a/src/devices/video/huc6261.cpp b/src/devices/video/huc6261.cpp
index e9ca25d236d..9029b57d54f 100644
--- a/src/devices/video/huc6261.cpp
+++ b/src/devices/video/huc6261.cpp
@@ -18,18 +18,21 @@
#include "screen.h"
+//#define VERBOSE 1
+#include "logmacro.h"
-#define LOG 0
#define HUC6261_HSYNC_LENGTH 237
-#define HUC6261_HSYNC_START ( HUC6261_WPF - HUC6261_HSYNC_LENGTH )
+#define HUC6261_HSYNC_START ( huc6261_device::WPF - HUC6261_HSYNC_LENGTH )
+constexpr unsigned huc6261_device::WPF;
+constexpr unsigned huc6261_device::LPF;
-const device_type HUC6261 = device_creator<huc6261_device>;
+DEFINE_DEVICE_TYPE(HUC6261, huc6261_device, "huc6261", "Hudson HuC6261 VCE")
huc6261_device::huc6261_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, HUC6261, "HuC6261", tag, owner, clock, "huc6261", __FILE__),
+ : device_t(mconfig, HUC6261, tag, owner, clock),
device_video_interface(mconfig, *this),
m_huc6270_a_tag(nullptr), m_huc6270_b_tag(nullptr), m_huc6272_tag(nullptr),
m_huc6270_a(nullptr), m_huc6270_b(nullptr), m_huc6272(nullptr),
@@ -118,7 +121,7 @@ void huc6261_device::device_timer(emu_timer &timer, device_timer_id id, int para
bitmap_line[ h ] = yuv2rgb( m_palette[ m_pixel_data_b ] );
m_pixel_clock = ( m_pixel_clock + 1 ) % m_pixels_per_clock;
- h = ( h + 1 ) % HUC6261_WPF;
+ h = ( h + 1 ) % WPF;
switch( h )
{
@@ -128,7 +131,7 @@ void huc6261_device::device_timer(emu_timer &timer, device_timer_id id, int para
// if ( v == 0 )
// {
// /* Check if the screen should be resized */
-// m_height = HUC6261_LPF - ( m_blur ? 1 : 0 );
+// m_height = LPF - ( m_blur ? 1 : 0 );
// if ( m_height != video_screen_get_height( m_screen ) )
// {
// rectangle visible_area;
@@ -139,7 +142,7 @@ void huc6261_device::device_timer(emu_timer &timer, device_timer_id id, int para
// visible_area.max_x = 64 + 1024 + 64 - 1;
// visible_area.max_y = 18 + 242 - 1;
//
-// video_screen_configure( m_screen, HUC6261_WPF, m_height, &visible_area, HZ_TO_ATTOSECONDS( device->clock / ( HUC6261_WPF * m_height ) ) );
+// video_screen_configure( m_screen, WPF, m_height, &visible_area, HZ_TO_ATTOSECONDS( device->clock / ( WPF * m_height ) ) );
// }
// }
break;
@@ -189,7 +192,7 @@ void huc6261_device::device_timer(emu_timer &timer, device_timer_id id, int para
/* Ask our slave device for time until next possible event */
{
- uint16_t next_event_clocks = HUC6261_WPF; //m_get_time_til_next_event( 0, 0xffff );
+ uint16_t next_event_clocks = WPF; //m_get_time_til_next_event( 0, 0xffff );
int event_hpos, event_vpos;
/* Adjust for pixel clocks per pixel */
@@ -200,10 +203,10 @@ void huc6261_device::device_timer(emu_timer &timer, device_timer_id id, int para
event_hpos = hpos + next_event_clocks;
event_vpos = vpos;
- while ( event_hpos > HUC6261_WPF )
+ while ( event_hpos > WPF )
{
event_vpos += 1;
- event_hpos -= HUC6261_WPF;
+ event_hpos -= WPF;
}
if ( event_vpos < v || ( event_vpos == v && event_hpos <= h ) )
@@ -420,7 +423,7 @@ void huc6261_device::device_start()
m_huc6270_b = machine().device<huc6270_device>(m_huc6270_b_tag);
m_huc6272 = machine().device<huc6272_device>(m_huc6272_tag);
- m_bmp = std::make_unique<bitmap_rgb32>(HUC6261_WPF, HUC6261_LPF );
+ m_bmp = std::make_unique<bitmap_rgb32>(WPF, LPF);
/* We want to have valid devices */
assert( m_huc6270_a != nullptr );
diff --git a/src/devices/video/huc6261.h b/src/devices/video/huc6261.h
index 1e49f35dd9c..195c1e05127 100644
--- a/src/devices/video/huc6261.h
+++ b/src/devices/video/huc6261.h
@@ -6,17 +6,14 @@
**********************************************************************/
+#ifndef MAME_VIDEO_HUC6261_H
+#define MAME_VIDEO_HUC6261_H
-#ifndef __HUC6261_H_
-#define __HUC6261_H_
+#pragma once
#include "video/huc6270.h"
#include "video/huc6272.h"
-/* Screen timing stuff */
-#define HUC6261_WPF 1365 /* width of a line in frame including blanking areas */
-#define HUC6261_LPF 263 /* max number of lines in a single frame */
-
#define MCFG_HUC6261_VDC1(_tag) \
huc6261_device::set_vdc1_tag(*device, _tag);
@@ -32,6 +29,10 @@ class huc6261_device : public device_t,
public device_video_interface
{
public:
+ // Screen timing stuff
+ static constexpr unsigned WPF = 1365; // width of a line in frame including blanking areas
+ static constexpr unsigned LPF = 263; // max number of lines in a single frame
+
// construction/destruction
huc6261_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
@@ -77,12 +78,12 @@ private:
emu_timer *m_timer;
std::unique_ptr<bitmap_rgb32> m_bmp;
int32_t m_uv_lookup[65536][3];
+
inline uint32_t yuv2rgb(uint32_t yuv);
inline void apply_pal_offs(uint16_t *pix_data);
};
-extern const device_type HUC6261;
-
+DECLARE_DEVICE_TYPE(HUC6261, huc6261_device)
-#endif
+#endif // MAME_VIDEO_HUC6261_H
diff --git a/src/devices/video/huc6270.cpp b/src/devices/video/huc6270.cpp
index bf367eaa4eb..9b71192b005 100644
--- a/src/devices/video/huc6270.cpp
+++ b/src/devices/video/huc6270.cpp
@@ -54,7 +54,9 @@ TODO
#include "emu.h"
#include "huc6270.h"
-#define LOG 0
+//#define VERBOSE 1
+#include "logmacro.h"
+
enum {
MAWR = 0x00,
@@ -91,15 +93,15 @@ ALLOW_SAVE_TYPE(huc6270_device::huc6270_h_state);
#define HUC6270_CR 0x01 /* Set when sprite #0 overlaps with another sprite */
-const device_type HUC6270 = device_creator<huc6270_device>;
+DEFINE_DEVICE_TYPE(HUC6270, huc6270_device, "huc6270", "Hudson HuC6270 VDC")
-const uint8_t huc6270_device::vram_increments[4] = { 1, 32, 64, 128 };
+constexpr uint8_t huc6270_device::vram_increments[4];
huc6270_device::huc6270_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, HUC6270, "HuC6270 VDC", tag, owner, clock, "huc6270", __FILE__),
- m_vram_size(0),
- m_irq_changed_cb(*this)
+ : device_t(mconfig, HUC6270, tag, owner, clock)
+ , m_vram_size(0)
+ , m_irq_changed_cb(*this)
{
}
@@ -109,18 +111,15 @@ huc6270_device::huc6270_device(const machine_config &mconfig, const char *tag, d
*/
inline void huc6270_device::fetch_bat_tile_row()
{
- uint16_t bat_data, data1, data2, data3, data4, tile_palette;
- int i;
-
- bat_data = m_vram[ m_bat_address & m_vram_mask ];
- tile_palette = ( bat_data >> 8 ) & 0xF0;
- data1 = m_vram[ ( ( ( bat_data & 0x0FFF ) << 4 ) + m_bat_row + 0 ) & m_vram_mask ];
- data2 = ( data1 >> 7 ) & 0x1FE;
- data3 = m_vram[ ( ( ( bat_data & 0x0FFF ) << 4 ) + m_bat_row + 8 ) & m_vram_mask ];
- data4 = ( data3 >> 5 ) & 0x7F8;
+ const uint16_t bat_data = m_vram[ m_bat_address & m_vram_mask ];
+ const uint16_t tile_palette = ( bat_data >> 8 ) & 0xF0;
+ uint16_t data1 = m_vram[ ( ( ( bat_data & 0x0FFF ) << 4 ) + m_bat_row + 0 ) & m_vram_mask ];
+ uint16_t data2 = ( data1 >> 7 ) & 0x1FE;
+ uint16_t data3 = m_vram[ ( ( ( bat_data & 0x0FFF ) << 4 ) + m_bat_row + 8 ) & m_vram_mask ];
+ uint16_t data4 = ( data3 >> 5 ) & 0x7F8;
data3 <<= 2;
- for ( i = 7; i >= 0; i-- )
+ for ( int i = 7; i >= 0; i-- )
{
uint16_t c = ( data1 & 0x01 ) | ( data2 & 0x02 ) | ( data3 & 0x04 ) | ( data4 & 0x08 );
@@ -304,7 +303,7 @@ inline void huc6270_device::handle_vblank()
{
int i;
- if (LOG) logerror("SATB transfer from %05x\n", m_dvssr << 1 );
+ LOG("SATB transfer from %05x\n", m_dvssr << 1 );
for ( i = 0; i < 4 * 64; i += 4 )
{
m_sat[i + 0] = m_vram[ ( m_dvssr + i + 0 ) & m_vram_mask ] & 0x03FF;
@@ -364,7 +363,7 @@ inline void huc6270_device::next_horz_state()
{
case HUC6270_HDS:
m_bxr_latched = m_bxr;
-//if (LOG) printf("latched bxr vpos=%d, hpos=%d\n", video_screen_get_vpos(device->machine->first_screen()), video_screen_get_hpos(device->machine->first_screen()));
+ //LOG("latched bxr vpos=%d, hpos=%d\n", video_screen_get_vpos(device->machine->first_screen()), video_screen_get_hpos(device->machine->first_screen()));
m_horz_state = HUC6270_HDW;
m_horz_to_go = ( m_hdr & 0x7F ) + 1;
{
@@ -509,7 +508,7 @@ WRITE_LINE_MEMBER( huc6270_device::vsync_changed )
int desr_inc = ( m_dcr & 0x0008 ) ? -1 : +1;
int sour_inc = ( m_dcr & 0x0004 ) ? -1 : +1;
- if (LOG) logerror("doing dma sour = %04x, desr = %04x, lenr = %04x\n", m_sour, m_desr, m_lenr );
+ LOG("doing dma sour = %04x, desr = %04x, lenr = %04x\n", m_sour, m_desr, m_lenr );
do {
uint16_t data = m_vram[ m_sour & m_vram_mask ];
m_vram[ m_desr & m_vram_mask ] = data;
@@ -608,7 +607,7 @@ READ8_MEMBER( huc6270_device::read )
WRITE8_MEMBER( huc6270_device::write )
{
- if (LOG) logerror("%s: huc6270 write %02x <- %02x ", machine().describe_context(), offset, data);
+ LOG("%s: huc6270 write %02x <- %02x ", machine().describe_context(), offset, data);
switch ( offset & 3 )
{
@@ -644,18 +643,18 @@ WRITE8_MEMBER( huc6270_device::write )
// m_status |= HUC6270_RR;
// m_irq_changed_cb( ASSERT_LINE );
// }
-//if (LOG) printf("%04x: RCR (%03x) written at %d,%d\n", activecpu_get_pc(), huc6270->m_rcr, video_screen_get_vpos(device->machine->first_screen()), video_screen_get_hpos(device->machine->first_screen()) );
+//LOG("%04x: RCR (%03x) written at %d,%d\n", activecpu_get_pc(), huc6270->m_rcr, video_screen_get_vpos(device->machine->first_screen()), video_screen_get_hpos(device->machine->first_screen()) );
break;
case BXR: /* background x-scroll register LSB */
m_bxr = ( m_bxr & 0x0300 ) | data;
-//if (LOG) printf("*********************** BXR written %d at %d,%d\n", m_bxr, video_screen_get_vpos(device->machine->first_screen()), video_screen_get_hpos(device->machine->first_screen()) );
+//LOG("*********************** BXR written %d at %d,%d\n", m_bxr, video_screen_get_vpos(device->machine->first_screen()), video_screen_get_hpos(device->machine->first_screen()) );
break;
case BYR: /* background y-scroll register LSB */
m_byr = ( m_byr & 0x0100 ) | data;
m_byr_latched = m_byr;
-//if (LOG) printf("******************** BYR written %d at %d,%d\n", huc6270->m_byr, video_screen_get_vpos(device->machine->first_screen()), video_screen_get_hpos(device->machine->first_screen()) );
+//LOG("******************** BYR written %d at %d,%d\n", huc6270->m_byr, video_screen_get_vpos(device->machine->first_screen()), video_screen_get_hpos(device->machine->first_screen()) );
break;
case MWR: /* memory width register LSB */
@@ -795,7 +794,7 @@ WRITE8_MEMBER( huc6270_device::write )
}
break;
}
- if (LOG) logerror("\n");
+ LOG("\n");
}
diff --git a/src/devices/video/huc6270.h b/src/devices/video/huc6270.h
index a66dc703a34..8ecbbdf7c40 100644
--- a/src/devices/video/huc6270.h
+++ b/src/devices/video/huc6270.h
@@ -6,8 +6,10 @@
**********************************************************************/
-#ifndef __HUC6270_H_
-#define __HUC6270_H_
+#ifndef MAME_VIDEO_HUC6270_H
+#define MAME_VIDEO_HUC6270_H
+
+#pragma once
#define MCFG_HUC6270_VRAM_SIZE(_size) \
@@ -16,14 +18,14 @@
#define MCFG_HUC6270_IRQ_CHANGED_CB(_devcb) \
devcb = &huc6270_device::set_irq_changed_callback(*device, DEVCB_##_devcb);
-class huc6270_device : public device_t
+class huc6270_device : public device_t
{
public:
// construction/destruction
huc6270_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
static void set_vram_size(device_t &device, uint32_t vram_size) { downcast<huc6270_device &>(device).m_vram_size = vram_size; }
- template<class _Object> static devcb_base &set_irq_changed_callback(device_t &device, _Object object) { return downcast<huc6270_device &>(device).m_irq_changed_cb.set_callback(object); }
+ template <class Object> static devcb_base &set_irq_changed_callback(device_t &device, Object &&cb) { return downcast<huc6270_device &>(device).m_irq_changed_cb.set_callback(std::forward<Object>(cb)); }
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
@@ -52,7 +54,6 @@ protected:
inline void next_horz_state();
private:
-
enum huc6270_v_state {
HUC6270_VSW,
HUC6270_VDS,
@@ -130,11 +131,10 @@ private:
std::unique_ptr<uint16_t[]> m_vram;
uint16_t m_vram_mask;
- const static uint8_t vram_increments[4];
+ static constexpr uint8_t vram_increments[4] = { 1, 32, 64, 128 };
};
-extern const device_type HUC6270;
-
+DECLARE_DEVICE_TYPE(HUC6270, huc6270_device)
-#endif
+#endif // MAME_VIDEO_HUC6270_H
diff --git a/src/devices/video/huc6271.cpp b/src/devices/video/huc6271.cpp
index b9379c9d6af..a17d85f9679 100644
--- a/src/devices/video/huc6271.cpp
+++ b/src/devices/video/huc6271.cpp
@@ -16,7 +16,7 @@
//**************************************************************************
// device type definition
-const device_type huc6271 = device_creator<huc6271_device>;
+DEFINE_DEVICE_TYPE(HUC6271, huc6271_device, "huc6271", "Hudson HuC6271 \"Rainbow\"")
//**************************************************************************
@@ -32,9 +32,9 @@ static ADDRESS_MAP_START( data_map, AS_DATA, 32, huc6271_device )
ADDRESS_MAP_END
huc6271_device::huc6271_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, huc6271, "HuC6271 \"Rainbow\"", tag, owner, clock, "huc6271", __FILE__),
- device_memory_interface(mconfig, *this),
- m_data_space_config("data", ENDIANNESS_LITTLE, 32, 32, 0, nullptr, *ADDRESS_MAP_NAME(data_map))
+ : device_t(mconfig, HUC6271, tag, owner, clock)
+ , device_memory_interface(mconfig, *this)
+ , m_data_space_config("data", ENDIANNESS_LITTLE, 32, 32, 0, nullptr, *ADDRESS_MAP_NAME(data_map))
{
}
diff --git a/src/devices/video/huc6271.h b/src/devices/video/huc6271.h
index 1197991160e..eba09821ff0 100644
--- a/src/devices/video/huc6271.h
+++ b/src/devices/video/huc6271.h
@@ -6,10 +6,10 @@
***************************************************************************/
-#pragma once
+#ifndef MAME_VIDEO_HUC6271_H
+#define MAME_VIDEO_HUC6271_H
-#ifndef __HUC6271DEV_H__
-#define __HUC6271DEV_H__
+#pragma once
@@ -17,8 +17,8 @@
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
-#define MCFG_HUC6271_ADD(_tag,_freq) \
- MCFG_DEVICE_ADD(_tag, huc6271, _freq)
+#define MCFG_HUC6271_ADD(tag, freq) \
+ MCFG_DEVICE_ADD((tag), HUC6271, (freq))
//**************************************************************************
// TYPE DEFINITIONS
@@ -39,10 +39,9 @@ public:
protected:
// device-level overrides
-// virtual void device_validity_check(validity_checker &valid) const;
virtual void device_start() override;
virtual void device_reset() override;
- virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_DATA) const override;
+ virtual const address_space_config *memory_space_config(address_spacenum spacenum) const override;
private:
const address_space_config m_data_space_config;
@@ -50,14 +49,6 @@ private:
// device type definition
-extern const device_type huc6271;
-
-
-
-//**************************************************************************
-// GLOBAL VARIABLES
-//**************************************************************************
-
-
+DECLARE_DEVICE_TYPE(HUC6271, huc6271_device)
-#endif
+#endif // MAME_VIDEO_HUC6271_H
diff --git a/src/devices/video/huc6272.cpp b/src/devices/video/huc6272.cpp
index af38859df0e..cea9315df2d 100644
--- a/src/devices/video/huc6272.cpp
+++ b/src/devices/video/huc6272.cpp
@@ -20,7 +20,7 @@
//**************************************************************************
// device type definition
-const device_type huc6272 = device_creator<huc6272_device>;
+DEFINE_DEVICE_TYPE(HUC6272, huc6272_device, "huc6272", "Hudson HuC6272 \"King\"")
static ADDRESS_MAP_START( microprg_map, AS_PROGRAM, 16, huc6272_device )
AM_RANGE(0x00, 0x0f) AM_RAM AM_SHARE("microprg_ram")
@@ -41,7 +41,7 @@ ADDRESS_MAP_END
//-------------------------------------------------
huc6272_device::huc6272_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, huc6272, "HuC6272 \"King\"", tag, owner, clock, "huc6272", __FILE__),
+ : device_t(mconfig, HUC6272, tag, owner, clock),
device_memory_interface(mconfig, *this),
m_program_space_config("microprg", ENDIANNESS_LITTLE, 16, 4, 0, nullptr, *ADDRESS_MAP_NAME(microprg_map)),
m_data_space_config("kram", ENDIANNESS_LITTLE, 32, 21, 0, nullptr, *ADDRESS_MAP_NAME(kram_map)),
diff --git a/src/devices/video/huc6272.h b/src/devices/video/huc6272.h
index ed903eae786..51788d08a69 100644
--- a/src/devices/video/huc6272.h
+++ b/src/devices/video/huc6272.h
@@ -6,10 +6,10 @@
***************************************************************************/
-#pragma once
+#ifndef MAME_VIDEO_HUC6272_H
+#define MAME_VIDEO_HUC6272_H
-#ifndef __huc6272DEV_H__
-#define __huc6272DEV_H__
+#pragma once
#include "bus/scsi/scsi.h"
#include "bus/scsi/scsicd.h"
@@ -20,14 +20,14 @@
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
-#define MCFG_HUC6272_ADD(_tag,_freq) \
- MCFG_DEVICE_ADD(_tag, huc6272, _freq)
+#define MCFG_HUC6272_ADD(tag, freq) \
+ MCFG_DEVICE_ADD((tag), HUC6272, (freq))
-#define MCFG_HUC6272_IRQ_CHANGED_CB(_devcb) \
- devcb = &huc6272_device::set_irq_changed_callback(*device, DEVCB_##_devcb);
+#define MCFG_HUC6272_IRQ_CHANGED_CB(cb) \
+ devcb = &huc6272_device::set_irq_changed_callback(*device, (DEVCB_##cb));
-#define MCFG_HUC6272_RAINBOW(_tag) \
- huc6272_device::set_rainbow_tag(*device, _tag);
+#define MCFG_HUC6272_RAINBOW(tag) \
+ huc6272_device::set_rainbow_tag(*device, (tag));
//**************************************************************************
@@ -43,7 +43,7 @@ public:
// construction/destruction
huc6272_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- template<class _Object> static devcb_base &set_irq_changed_callback(device_t &device, _Object object) { return downcast<huc6272_device &>(device).m_irq_changed_cb.set_callback(object); }
+ template <class Object> static devcb_base &set_irq_changed_callback(device_t &device, Object &&cb) { return downcast<huc6272_device &>(device).m_irq_changed_cb.set_callback(std::forward<Object>(cb)); }
static void set_rainbow_tag(device_t &device, const char *tag) { downcast<huc6272_device &>(device).m_huc6271_tag = tag; }
// I/O operations
@@ -97,7 +97,7 @@ private:
required_shared_ptr<uint16_t> m_microprg_ram;
required_shared_ptr<uint32_t> m_kram_page0;
required_shared_ptr<uint32_t> m_kram_page1;
- required_device<SCSI_PORT_DEVICE> m_scsibus;
+ required_device<scsi_port_device> m_scsibus;
required_device<input_buffer_device> m_scsi_data_in;
required_device<output_latch_device> m_scsi_data_out;
required_device<input_buffer_device> m_scsi_ctrl_in;
@@ -111,14 +111,6 @@ private:
};
// device type definition
-extern const device_type huc6272;
-
-
-
-//**************************************************************************
-// GLOBAL VARIABLES
-//**************************************************************************
-
-
+DECLARE_DEVICE_TYPE(HUC6272, huc6272_device)
-#endif
+#endif // MAME_VIDEO_HUC6272_H
diff --git a/src/devices/video/i8244.cpp b/src/devices/video/i8244.cpp
index bf1de11dcbb..8ca44d172a2 100644
--- a/src/devices/video/i8244.cpp
+++ b/src/devices/video/i8244.cpp
@@ -17,8 +17,8 @@
// device type definition
-const device_type I8244 = device_creator<i8244_device>;
-const device_type I8245 = device_creator<i8245_device>;
+DEFINE_DEVICE_TYPE(I8244, i8244_device, "i8244", "Intel 8244")
+DEFINE_DEVICE_TYPE(I8245, i8245_device, "i8245", "Intel 8245")
// Kevtris verified that the data below matches a dump
@@ -105,20 +105,13 @@ static const uint8_t bgr2rgb[8] =
//-------------------------------------------------
i8244_device::i8244_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, I8244, "I8244", tag, owner, clock, "i8244", __FILE__)
- , device_sound_interface(mconfig, *this)
- , device_video_interface(mconfig, *this)
- , m_irq_func(*this)
- , m_postprocess_func(*this)
- , m_start_vpos(START_Y)
- , m_start_vblank(START_Y + SCREEN_HEIGHT)
- , m_screen_lines(LINES)
+ : i8244_device(mconfig, I8244, tag, owner, clock, i8244_device::LINES)
{
}
-i8244_device::i8244_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, int lines, const char *shortname, const char *source)
- : device_t(mconfig, type, name, tag, owner, clock, shortname, source)
+i8244_device::i8244_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int lines)
+ : device_t(mconfig, type, tag, owner, clock)
, device_sound_interface(mconfig, *this)
, device_video_interface(mconfig, *this)
, m_irq_func(*this)
@@ -131,7 +124,7 @@ i8244_device::i8244_device(const machine_config &mconfig, device_type type, cons
i8245_device::i8245_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : i8244_device(mconfig, I8245, "I8245", tag, owner, clock, i8245_device::LINES, "i8245", __FILE__)
+ : i8244_device(mconfig, I8245, tag, owner, clock, i8245_device::LINES)
{
}
diff --git a/src/devices/video/i8244.h b/src/devices/video/i8244.h
index c3e3dcfd5ee..a67652fd1e4 100644
--- a/src/devices/video/i8244.h
+++ b/src/devices/video/i8244.h
@@ -8,10 +8,10 @@
***************************************************************************/
-#pragma once
+#ifndef MAME_VIDEO_I8244_H
+#define MAME_VIDEO_I8244_H
-#ifndef __I8244_H__
-#define __I8244_H__
+#pragma once
@@ -38,38 +38,6 @@
TYPE DEFINITIONS
***************************************************************************/
-union vdc_t {
- uint8_t reg[0x100];
- struct {
- struct {
- uint8_t y,x,color,res;
- } sprites[4];
- struct {
- uint8_t y,x,ptr,color;
- } foreground[12];
- struct {
- struct {
- uint8_t y,x,ptr,color;
- } single[4];
- } quad[4];
- uint8_t shape[4][8];
- uint8_t control;
- uint8_t status;
- uint8_t collision;
- uint8_t color;
- uint8_t y;
- uint8_t x;
- uint8_t res;
- uint8_t shift1;
- uint8_t shift2;
- uint8_t shift3;
- uint8_t sound;
- uint8_t res2[5+0x10];
- uint8_t hgrid[2][0x10];
- uint8_t vgrid[0x10];
- } s;
-};
-
// ======================> i8244_device
@@ -80,12 +48,11 @@ class i8244_device : public device_t
public:
// construction/destruction
i8244_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- i8244_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, int lines, const char *shortname, const char *source);
// static configuration helpers
static void set_screen_tag(device_t &device, const char *screen_tag) { downcast<i8244_device &>(device).m_screen_tag = screen_tag; }
- template<class _Object> static devcb_base &set_irq_cb(device_t &device, _Object object) { return downcast<i8244_device &>(device).m_irq_func.set_callback(object); }
- template<class _Object> static devcb_base &set_postprocess_cb(device_t &device, _Object object) { return downcast<i8244_device &>(device).m_postprocess_func.set_callback(object); }
+ template <class Object> static devcb_base &set_irq_cb(device_t &device, Object &&cb) { return downcast<i8244_device &>(device).m_irq_func.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_postprocess_cb(device_t &device, Object &&cb) { return downcast<i8244_device &>(device).m_postprocess_func.set_callback(std::forward<Object>(cb)); }
DECLARE_READ8_MEMBER(read);
DECLARE_WRITE8_MEMBER(write);
@@ -98,15 +65,49 @@ public:
inline bitmap_ind16 *get_bitmap() { return &m_tmp_bitmap; }
// Global constants
- static const int START_ACTIVE_SCAN = 42;
- static const int BORDER_SIZE = 10;
- static const int END_ACTIVE_SCAN = 42 + 10 + 320 + 10;
- static const int START_Y = 1;
- static const int SCREEN_HEIGHT = 243;
- static const int LINE_CLOCKS = 455;
- static const int LINES = 262;
+ static constexpr int START_ACTIVE_SCAN = 42;
+ static constexpr int BORDER_SIZE = 10;
+ static constexpr int END_ACTIVE_SCAN = 42 + 10 + 320 + 10;
+ static constexpr int START_Y = 1;
+ static constexpr int SCREEN_HEIGHT = 243;
+ static constexpr int LINE_CLOCKS = 455;
+ static constexpr int LINES = 262;
protected:
+ union vdc_t {
+ uint8_t reg[0x100];
+ struct {
+ struct {
+ uint8_t y,x,color,res;
+ } sprites[4];
+ struct {
+ uint8_t y,x,ptr,color;
+ } foreground[12];
+ struct {
+ struct {
+ uint8_t y,x,ptr,color;
+ } single[4];
+ } quad[4];
+ uint8_t shape[4][8];
+ uint8_t control;
+ uint8_t status;
+ uint8_t collision;
+ uint8_t color;
+ uint8_t y;
+ uint8_t x;
+ uint8_t res;
+ uint8_t shift1;
+ uint8_t shift2;
+ uint8_t shift3;
+ uint8_t sound;
+ uint8_t res2[5+0x10];
+ uint8_t hgrid[2][0x10];
+ uint8_t vgrid[0x10];
+ } s;
+ };
+
+ i8244_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int lines);
+
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
@@ -121,11 +122,11 @@ protected:
offs_t fix_register_mirrors( offs_t offset );
// Local constants
- static const uint8_t VDC_CONTROL_REG_STROBE_XY = 0x02;
+ static constexpr uint8_t VDC_CONTROL_REG_STROBE_XY = 0x02;
/* timers */
- static const device_timer_id TIMER_LINE = 0;
- static const device_timer_id TIMER_HBLANK = 1;
+ static constexpr device_timer_id TIMER_LINE = 0;
+ static constexpr device_timer_id TIMER_HBLANK = 1;
// callbacks
devcb_write_line m_irq_func;
@@ -156,13 +157,12 @@ public:
// construction/destruction
i8245_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- static const int LINES = 312;
+ static constexpr int LINES = 312;
};
// device type definition
-extern const device_type I8244;
-extern const device_type I8245;
-
+DECLARE_DEVICE_TYPE(I8244, i8244_device)
+DECLARE_DEVICE_TYPE(I8245, i8245_device)
-#endif /* __I8244_H__ */
+#endif // MAME_VIDEO_I8244_H
diff --git a/src/devices/video/i82730.cpp b/src/devices/video/i82730.cpp
index 296dc0ef2d4..1137ff6b0df 100644
--- a/src/devices/video/i82730.cpp
+++ b/src/devices/video/i82730.cpp
@@ -27,9 +27,9 @@
// DEVICE DEFINITIONS
//**************************************************************************
-const device_type I82730 = device_creator<i82730_device>;
+DEFINE_DEVICE_TYPE(I82730, i82730_device, "i82730", "Intel 82730")
-const char *i82730_device::m_command_names[] =
+const char *const i82730_device::s_command_names[] =
{
/* 00 */ "NOP",
/* 01 */ "START DISPLAY",
@@ -55,7 +55,7 @@ const char *i82730_device::m_command_names[] =
//-------------------------------------------------
i82730_device::i82730_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, I82730, "I82730", tag, owner, clock, "i82730", __FILE__),
+ device_t(mconfig, I82730, tag, owner, clock),
device_video_interface(mconfig, *this),
m_sint_handler(*this),
m_cpu_tag(nullptr), m_program(nullptr),
@@ -250,8 +250,8 @@ void i82730_device::execute_command()
uint8_t command = read_byte(m_cbp + 1);
uint16_t tmp;
- if (VERBOSE_COMMANDS && command < ARRAY_LENGTH(m_command_names))
- logerror("%s('%s'): executing command: %s [cbp = %08x]\n", shortname(), basetag(), m_command_names[command], m_cbp);
+ if (VERBOSE_COMMANDS && command < ARRAY_LENGTH(s_command_names))
+ logerror("%s('%s'): executing command: %s [cbp = %08x]\n", shortname(), basetag(), s_command_names[command], m_cbp);
tmp = read_word(m_cbp + 2);
m_list_switch = BIT(tmp, 6);
@@ -303,7 +303,7 @@ void i82730_device::execute_command()
// LPEN ENABLE
case 0x07:
- fatalerror("%s('%s'): Unimplemented command %s\n", shortname(), basetag(), m_command_names[command]);
+ fatalerror("%s('%s'): Unimplemented command %s\n", shortname(), basetag(), s_command_names[command]);
break;
// READ STATUS
@@ -314,17 +314,17 @@ void i82730_device::execute_command()
// LD CUR POS
case 0x09:
- fatalerror("%s('%s'): Unimplemented command %s\n", shortname(), basetag(), m_command_names[command]);
+ fatalerror("%s('%s'): Unimplemented command %s\n", shortname(), basetag(), s_command_names[command]);
break;
// SELF TEST
case 0x0a:
- fatalerror("%s('%s'): Unimplemented command %s\n", shortname(), basetag(), m_command_names[command]);
+ fatalerror("%s('%s'): Unimplemented command %s\n", shortname(), basetag(), s_command_names[command]);
break;
// TEST ROW BUFFER
case 0x0b:
- fatalerror("%s('%s'): Unimplemented command %s\n", shortname(), basetag(), m_command_names[command]);
+ fatalerror("%s('%s'): Unimplemented command %s\n", shortname(), basetag(), s_command_names[command]);
break;
default:
diff --git a/src/devices/video/i82730.h b/src/devices/video/i82730.h
index 2e459803d93..f9de659e825 100644
--- a/src/devices/video/i82730.h
+++ b/src/devices/video/i82730.h
@@ -8,10 +8,10 @@
***************************************************************************/
-#pragma once
+#ifndef MAME_VIDEO_I82730_H
+#define MAME_VIDEO_I82730_H
-#ifndef __I82730_H__
-#define __I82730_H__
+#pragma once
@@ -27,15 +27,13 @@
devcb = &i82730_device::set_sint_handler(*device, DEVCB_##_devcb);
#define MCFG_I82730_UPDATE_ROW_CB(_class, _method) \
- i82730_device::set_update_row_callback(*device, i82730_update_row_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
+ i82730_device::set_update_row_callback(*device, i82730_device::update_row_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
-typedef device_delegate<void (bitmap_rgb32 &bitmap, uint16_t *data, uint8_t lc, uint16_t y, int x_count)> i82730_update_row_delegate;
-
#define I82730_UPDATE_ROW(name) \
void name(bitmap_rgb32 &bitmap, uint16_t *data, uint8_t lc, uint16_t y, int x_count)
@@ -45,16 +43,18 @@ typedef device_delegate<void (bitmap_rgb32 &bitmap, uint16_t *data, uint8_t lc,
class i82730_device : public device_t, public device_video_interface
{
public:
+ typedef device_delegate<void (bitmap_rgb32 &bitmap, uint16_t *data, uint8_t lc, uint16_t y, int x_count)> update_row_delegate;
+
// construction/destruction
i82730_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// callbacks
- template<class _Object> static devcb_base &set_sint_handler(device_t &device, _Object object)
- { return downcast<i82730_device &>(device).m_sint_handler.set_callback(object); }
+ template <class Object> static devcb_base &set_sint_handler(device_t &device, Object &&cb)
+ { return downcast<i82730_device &>(device).m_sint_handler.set_callback(std::forward<Object>(cb)); }
// inline configuration
static void set_cpu_tag(device_t &device, device_t *owner, const char *tag);
- static void set_update_row_callback(device_t &device, i82730_update_row_delegate callback) { downcast<i82730_device &>(device).m_update_row_cb = callback; }
+ static void set_update_row_callback(device_t &device, update_row_delegate &&cb) { downcast<i82730_device &>(device).m_update_row_cb = std::move(cb); }
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
@@ -80,7 +80,7 @@ private:
VDIP = 0x100 // virtual display in progress
};
- static const char* m_command_names[];
+ static const char *const s_command_names[];
bool sysbus_16bit() { return BIT(m_sysbus, 0); }
@@ -97,7 +97,7 @@ private:
TIMER_CALLBACK_MEMBER(row_update);
devcb_write_line m_sint_handler;
- i82730_update_row_delegate m_update_row_cb;
+ update_row_delegate m_update_row_cb;
const char *m_cpu_tag;
address_space *m_program;
@@ -151,6 +151,6 @@ private:
};
// device type definition
-extern const device_type I82730;
+DECLARE_DEVICE_TYPE(I82730, i82730_device)
-#endif // __I82730_H__
+#endif // MAME_VIDEO_I82730_H
diff --git a/src/devices/video/i8275.cpp b/src/devices/video/i8275.cpp
index b2f7cfc8daf..99081d83d59 100644
--- a/src/devices/video/i8275.cpp
+++ b/src/devices/video/i8275.cpp
@@ -19,16 +19,17 @@
#include "screen.h"
+//#define VERBOSE 1
+#include "logmacro.h"
+
//**************************************************************************
// MACROS / CONSTANTS
//**************************************************************************
-#define LOG 0
-
-const int DMA_BURST_SPACING[] = { 0, 7, 15, 23, 31, 39, 47, 55 };
+static const int DMA_BURST_SPACING[] = { 0, 7, 15, 23, 31, 39, 47, 55 };
#define DOUBLE_SPACED_ROWS \
@@ -82,7 +83,7 @@ const int i8275_device::character_attribute[3][16] =
//**************************************************************************
// device type definition
-const device_type I8275 = device_creator<i8275_device>;
+DEFINE_DEVICE_TYPE(I8275, i8275_device, "i8275x", "Intel 8275 CRTC")
@@ -95,7 +96,7 @@ const device_type I8275 = device_creator<i8275_device>;
//-------------------------------------------------
i8275_device::i8275_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, I8275, "I8275 CRTC", tag, owner, clock, "i8275x", __FILE__),
+ device_t(mconfig, I8275, tag, owner, clock),
device_video_interface(mconfig, *this),
m_write_irq(*this),
m_write_drq(*this),
@@ -204,24 +205,24 @@ void i8275_device::device_timer(emu_timer &timer, device_timer_id id, int param,
switch (id)
{
case TIMER_HRTC_ON:
- //if (LOG) logerror("I8275 '%s' y %u x %u HRTC 1\n", tag(), y, x);
+ //LOG("I8275 y %u x %u HRTC 1\n", y, x);
m_write_hrtc(1);
break;
case TIMER_DRQ_ON:
- //if (LOG) logerror("I8275 '%s' y %u x %u DRQ 1\n", tag(), y, x);
+ //LOG("I8275 y %u x %u DRQ 1\n", y, x);
m_write_drq(1);
break;
case TIMER_SCANLINE:
if (!(m_status & ST_VE)) break;
- //if (LOG) logerror("I8275 '%s' y %u x %u HRTC 0\n", tag(), y, x);
+ //LOG("I8275 y %u x %u HRTC 0\n", y, x);
m_write_hrtc(0);
if (m_scanline == 0)
{
- //if (LOG) logerror("I8275 '%s' y %u x %u VRTC 0\n", tag(), y, x);
+ //LOG("I8275 y %u x %u VRTC 0\n", y, x);
m_write_vrtc(0);
}
@@ -234,7 +235,7 @@ void i8275_device::device_timer(emu_timer &timer, device_timer_id id, int param,
m_status |= ST_DU;
m_du = true;
- //if (LOG) logerror("I8275 '%s' y %u x %u DMA Underrun\n", tag(), y, x);
+ //LOG("I8275 y %u x %u DMA Underrun\n", y, x);
m_write_drq(0);
}
@@ -259,7 +260,7 @@ void i8275_device::device_timer(emu_timer &timer, device_timer_id id, int param,
{
if (m_status & ST_IE)
{
- //if (LOG) logerror("I8275 '%s' y %u x %u IRQ 1\n", tag(), y, x);
+ //LOG("I8275 y %u x %u IRQ 1\n", y, x);
m_status |= ST_IR;
m_write_irq(ASSERT_LINE);
}
@@ -267,7 +268,7 @@ void i8275_device::device_timer(emu_timer &timer, device_timer_id id, int param,
if (m_scanline == m_vrtc_scanline)
{
- //if (LOG) logerror("I8275 '%s' y %u x %u VRTC 1\n", tag(), y, x);
+ //LOG("I8275 y %u x %u VRTC 1\n", y, x);
m_write_vrtc(1);
// reset field attributes
@@ -459,7 +460,7 @@ READ8_MEMBER( i8275_device::read )
if (m_status & ST_IR)
{
- //if (LOG) logerror("I8275 '%s' IRQ 0\n", tag());
+ //LOG("I8275 IRQ 0\n");
m_write_irq(CLEAR_LINE);
}
@@ -488,15 +489,15 @@ WRITE8_MEMBER( i8275_device::write )
{
if (offset & 0x01)
{
- if (LOG) logerror("I8275 '%s' Command %02x\n", tag(), data);
+ LOG("I8275 Command %02x\n", data);
switch (data >> 5)
{
case CMD_RESET:
- if (LOG) logerror("I8275 '%s' Reset\n", tag());
+ LOG("I8275 Reset\n");
m_status &= ~ST_IE;
- if (LOG) logerror("I8275 '%s' IRQ 0\n", tag());
+ LOG("I8275 IRQ 0\n");
m_write_irq(CLEAR_LINE);
m_write_drq(0);
@@ -505,49 +506,47 @@ WRITE8_MEMBER( i8275_device::write )
break;
case CMD_START_DISPLAY:
- {
- m_param[REG_DMA] = data;
- if (LOG) logerror("I8275 '%s' Start Display %u %u\n", tag(), DMA_BURST_COUNT, DMA_BURST_SPACE);
- m_status |= (ST_IE | ST_VE);
- }
+ m_param[REG_DMA] = data;
+ LOG("I8275 Start Display %u %u\n", DMA_BURST_COUNT, DMA_BURST_SPACE);
+ m_status |= (ST_IE | ST_VE);
break;
case CMD_STOP_DISPLAY:
- if (LOG) logerror("I8275 '%s' Stop Display\n", tag());
+ LOG("I8275 Stop Display\n");
m_status &= ~ST_VE;
break;
case CMD_READ_LIGHT_PEN:
- if (LOG) logerror("I8275 '%s' Read Light Pen\n", tag());
+ LOG("I8275 Read Light Pen\n");
m_param_idx = REG_LPEN_COL;
m_param_end = REG_LPEN_ROW;
break;
case CMD_LOAD_CURSOR:
- if (LOG) logerror("I8275 '%s' Load Cursor\n", tag());
+ LOG("I8275 Load Cursor\n");
m_param_idx = REG_CUR_COL;
m_param_end = REG_CUR_ROW;
break;
case CMD_ENABLE_INTERRUPT:
- if (LOG) logerror("I8275 '%s' Enable Interrupt\n", tag());
+ LOG("I8275 Enable Interrupt\n");
m_status |= ST_IE;
break;
case CMD_DISABLE_INTERRUPT:
- if (LOG) logerror("I8275 '%s' Disable Interrupt\n", tag());
+ LOG("I8275 Disable Interrupt\n");
m_status &= ~ST_IE;
break;
case CMD_PRESET_COUNTERS:
- if (LOG) logerror("I8275 '%s' Preset Counters\n", tag());
+ LOG("I8275 Preset Counters\n");
m_scanline = 0;
break;
}
}
else
{
- if (LOG) logerror("I8275 '%s' Parameter %02x\n", tag(), data);
+ LOG("I8275 Parameter %02x\n", data);
m_param[m_param_idx] = data;
@@ -567,7 +566,7 @@ WRITE8_MEMBER( i8275_device::write )
WRITE8_MEMBER( i8275_device::dack_w )
{
- //if (LOG) logerror("I8275 '%s' y %u x %u DACK %04x:%02x %u\n", tag(), m_screen->vpos(), m_screen->hpos(), offset, data, m_buffer_idx);
+ //LOG("I8275 y %u x %u DACK %04x:%02x %u\n", m_screen->vpos(), m_screen->hpos(), offset, data, m_buffer_idx);
m_write_drq(0);
@@ -673,7 +672,7 @@ void i8275_device::recompute_parameters()
int max_visible_x = (CHARACTERS_PER_ROW * m_hpixels_per_column) - 1;
int max_visible_y = (CHARACTER_ROWS_PER_FRAME * SCANLINES_PER_ROW) - 1;
- if (LOG) logerror("width %u height %u max_x %u max_y %u refresh %f\n", horiz_pix_total, vert_pix_total, max_visible_x, max_visible_y, 1 / ATTOSECONDS_TO_DOUBLE(refresh));
+ LOG("width %u height %u max_x %u max_y %u refresh %f\n", horiz_pix_total, vert_pix_total, max_visible_x, max_visible_y, 1 / ATTOSECONDS_TO_DOUBLE(refresh));
rectangle visarea;
visarea.set(0, max_visible_x, 0, max_visible_y);
@@ -686,7 +685,7 @@ void i8275_device::recompute_parameters()
m_vrtc_scanline = CHARACTER_ROWS_PER_FRAME * SCANLINES_PER_ROW;
m_vrtc_drq_scanline = vert_pix_total - SCANLINES_PER_ROW;
- if (LOG) logerror("irq_y %u vrtc_y %u drq_y %u\n", m_irq_scanline, m_vrtc_scanline, m_vrtc_drq_scanline);
+ LOG("irq_y %u vrtc_y %u drq_y %u\n", m_irq_scanline, m_vrtc_scanline, m_vrtc_drq_scanline);
m_scanline_timer->adjust(m_screen->time_until_pos(0, 0), 0, m_screen->scan_period());
diff --git a/src/devices/video/i8275.h b/src/devices/video/i8275.h
index affc47e1f64..edb2e43e855 100644
--- a/src/devices/video/i8275.h
+++ b/src/devices/video/i8275.h
@@ -29,10 +29,10 @@
**********************************************************************/
-#pragma once
+#ifndef MAME_VIDEO_I8275_H
+#define MAME_VIDEO_I8275_H
-#ifndef __I8275x__
-#define __I8275x__
+#pragma once
@@ -48,7 +48,7 @@
i8275_device::static_set_character_width(*device, _value);
#define MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(_class, _method) \
- i8275_device::static_set_display_callback(*device, i8275_draw_character_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
+ i8275_device::static_set_display_callback(*device, i8275_device::draw_character_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
#define MCFG_I8275_DRQ_CALLBACK(_write) \
devcb = &i8275_device::set_drq_wr_callback(*device, DEVCB_##_write);
@@ -68,8 +68,6 @@
// TYPE DEFINITIONS
//**************************************************************************
-typedef device_delegate<void (bitmap_rgb32 &bitmap, int x, int y, uint8_t linecount, uint8_t charcode, uint8_t lineattr, uint8_t lten, uint8_t rvv, uint8_t vsp, uint8_t gpa, uint8_t hlgt)> i8275_draw_character_delegate;
-
// ======================> i8275_device
@@ -77,16 +75,18 @@ class i8275_device : public device_t,
public device_video_interface
{
public:
+ typedef device_delegate<void (bitmap_rgb32 &bitmap, int x, int y, uint8_t linecount, uint8_t charcode, uint8_t lineattr, uint8_t lten, uint8_t rvv, uint8_t vsp, uint8_t gpa, uint8_t hlgt)> draw_character_delegate;
+
// construction/destruction
i8275_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
static void static_set_character_width(device_t &device, int value) { downcast<i8275_device &>(device).m_hpixels_per_column = value; }
- static void static_set_display_callback(device_t &device, i8275_draw_character_delegate callback) { downcast<i8275_device &>(device).m_display_cb = callback; }
+ static void static_set_display_callback(device_t &device, draw_character_delegate &&cb) { downcast<i8275_device &>(device).m_display_cb = std::move(cb); }
- template<class _Object> static devcb_base &set_drq_wr_callback(device_t &device, _Object object) { return downcast<i8275_device &>(device).m_write_drq.set_callback(object); }
- template<class _Object> static devcb_base &set_irq_wr_callback(device_t &device, _Object object) { return downcast<i8275_device &>(device).m_write_irq.set_callback(object); }
- template<class _Object> static devcb_base &set_hrtc_wr_callback(device_t &device, _Object object) { return downcast<i8275_device &>(device).m_write_hrtc.set_callback(object); }
- template<class _Object> static devcb_base &set_vrtc_wr_callback(device_t &device, _Object object) { return downcast<i8275_device &>(device).m_write_vrtc.set_callback(object); }
+ template <class Object> static devcb_base &set_drq_wr_callback(device_t &device, Object &&cb) { return downcast<i8275_device &>(device).m_write_drq.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_irq_wr_callback(device_t &device, Object &&cb) { return downcast<i8275_device &>(device).m_write_irq.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_hrtc_wr_callback(device_t &device, Object &&cb) { return downcast<i8275_device &>(device).m_write_hrtc.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_vrtc_wr_callback(device_t &device, Object &&cb) { return downcast<i8275_device &>(device).m_write_vrtc.set_callback(std::forward<Object>(cb)); }
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
@@ -183,7 +183,7 @@ protected:
devcb_write_line m_write_hrtc;
devcb_write_line m_write_vrtc;
- i8275_draw_character_delegate m_display_cb;
+ draw_character_delegate m_display_cb;
int m_hpixels_per_column;
bitmap_rgb32 m_bitmap;
@@ -228,8 +228,6 @@ protected:
// device type definition
-extern const device_type I8275;
-
-
+DECLARE_DEVICE_TYPE(I8275, i8275_device)
-#endif
+#endif // MAME_VIDEO_I8275_H
diff --git a/src/devices/video/jangou_blitter.cpp b/src/devices/video/jangou_blitter.cpp
index d7d446fb813..b5e75a44eff 100644
--- a/src/devices/video/jangou_blitter.cpp
+++ b/src/devices/video/jangou_blitter.cpp
@@ -23,7 +23,7 @@
//**************************************************************************
// device type definition
-const device_type JANGOU_BLITTER = device_creator<jangou_blitter_device>;
+DEFINE_DEVICE_TYPE(JANGOU_BLITTER, jangou_blitter_device, "jangou_blitter", "Jangou Blitter Custom Chip")
//**************************************************************************
@@ -35,7 +35,7 @@ const device_type JANGOU_BLITTER = device_creator<jangou_blitter_device>;
//-------------------------------------------------
jangou_blitter_device::jangou_blitter_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, JANGOU_BLITTER, "Jangou Blitter Custom Chip", tag, owner, clock, "jangou_blitter", __FILE__)
+ : device_t(mconfig, JANGOU_BLITTER, tag, owner, clock)
{
}
diff --git a/src/devices/video/jangou_blitter.h b/src/devices/video/jangou_blitter.h
index 031a0cc7ebe..5160f42850e 100644
--- a/src/devices/video/jangou_blitter.h
+++ b/src/devices/video/jangou_blitter.h
@@ -1,16 +1,11 @@
// license:BSD-3-Clause
// copyright-holders:Angelo Salese
-/***************************************************************************
-Template for skeleton device
-
-***************************************************************************/
+#ifndef MAME_VIDEO_JANGOU_BLITTER_H
+#define MAME_VIDEO_JANGOU_BLITTER_H
#pragma once
-#ifndef __JANGOU_BLITTERDEV_H__
-#define __JANGOU_BLITTERDEV_H__
-
//**************************************************************************
@@ -39,7 +34,7 @@ public:
DECLARE_WRITE8_MEMBER( bltflip_w );
DECLARE_READ_LINE_MEMBER( status_r );
- uint8_t m_blit_buffer[256 * 256];
+ const uint8_t &blit_buffer(unsigned y, unsigned x) const { return m_blit_buffer[(256 * y) + x]; }
protected:
// device-level overrides
@@ -47,6 +42,8 @@ protected:
virtual void device_reset() override;
private:
+ uint8_t m_blit_buffer[256 * 256];
+
void plot_gfx_pixel( uint8_t pix, int x, int y );
uint8_t gfx_nibble( uint32_t niboffset );
uint8_t m_pen_data[0x10];
@@ -58,14 +55,6 @@ private:
// device type definition
-extern const device_type JANGOU_BLITTER;
-
-
-
-//**************************************************************************
-// GLOBAL VARIABLES
-//**************************************************************************
-
-
+DECLARE_DEVICE_TYPE(JANGOU_BLITTER, jangou_blitter_device)
-#endif
+#endif // MAME_VIDEO_JANGOU_BLITTER_H
diff --git a/src/devices/video/m50458.cpp b/src/devices/video/m50458.cpp
index b8fa3984599..1b34b718c8e 100644
--- a/src/devices/video/m50458.cpp
+++ b/src/devices/video/m50458.cpp
@@ -27,7 +27,7 @@
//**************************************************************************
// device type definition
-const device_type M50458 = device_creator<m50458_device>;
+DEFINE_DEVICE_TYPE(M50458, m50458_device, "m50458", "Mitsubishi M50458 OSD")
static ADDRESS_MAP_START( m50458_vram, AS_0, 16, m50458_device )
AM_RANGE(0x0000, 0x023f) AM_RAM // vram
@@ -174,10 +174,10 @@ inline void m50458_device::write_word(offs_t address, uint16_t data)
//-------------------------------------------------
m50458_device::m50458_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, M50458, "M50458 OSD", tag, owner, clock, "m50458", __FILE__),
- device_memory_interface(mconfig, *this),
- device_video_interface(mconfig, *this),
- m_space_config("videoram", ENDIANNESS_LITTLE, 16, 16, 0, nullptr, *ADDRESS_MAP_NAME(m50458_vram))
+ : device_t(mconfig, M50458, tag, owner, clock)
+ , device_memory_interface(mconfig, *this)
+ , device_video_interface(mconfig, *this)
+ , m_space_config("videoram", ENDIANNESS_LITTLE, 16, 16, 0, nullptr, *ADDRESS_MAP_NAME(m50458_vram))
{
}
diff --git a/src/devices/video/m50458.h b/src/devices/video/m50458.h
index 15c8e03ff00..d4eebc4e9a8 100644
--- a/src/devices/video/m50458.h
+++ b/src/devices/video/m50458.h
@@ -6,10 +6,10 @@ Mitsubishi M50458 OSD chip
***************************************************************************/
-#pragma once
+#ifndef MAME_VIDEO_M50458_H
+#define MAME_VIDEO_M50458_H
-#ifndef __M50458DEV_H__
-#define __M50458DEV_H__
+#pragma once
@@ -26,12 +26,6 @@ Mitsubishi M50458 OSD chip
// TYPE DEFINITIONS
//**************************************************************************
-enum m50458_state_t
-{
- OSD_SET_ADDRESS = 0,
- OSD_SET_DATA
-};
-
// ======================> m50458_device
class m50458_device : public device_t,
@@ -59,11 +53,17 @@ public:
virtual const tiny_rom_entry *device_rom_region() const override;
protected:
+ enum m50458_state_t
+ {
+ OSD_SET_ADDRESS = 0,
+ OSD_SET_DATA
+ };
+
// device-level overrides
virtual void device_validity_check(validity_checker &valid) const override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override;
+ virtual const address_space_config *memory_space_config(address_spacenum spacenum) const override;
int m_latch;
int m_reset_line;
@@ -92,14 +92,6 @@ private:
// device type definition
-extern const device_type M50458;
-
-
-
-//**************************************************************************
-// GLOBAL VARIABLES
-//**************************************************************************
-
-
+DECLARE_DEVICE_TYPE(M50458, m50458_device)
-#endif
+#endif // MAME_VIDEO_M50458_H
diff --git a/src/devices/video/mb90082.cpp b/src/devices/video/mb90082.cpp
index d962d701fa4..ef668a91732 100644
--- a/src/devices/video/mb90082.cpp
+++ b/src/devices/video/mb90082.cpp
@@ -21,7 +21,7 @@
//**************************************************************************
// device type definition
-const device_type MB90082 = device_creator<mb90082_device>;
+DEFINE_DEVICE_TYPE(MB90082, mb90082_device, "mb90082", "Fujitsu MB90082 OSD")
static ADDRESS_MAP_START( mb90082_vram, AS_0, 16, mb90082_device )
AM_RANGE(0x0000, 0x023f) AM_RAM // main screen vram
@@ -86,9 +86,9 @@ inline void mb90082_device::write_word(offs_t address, uint16_t data)
//-------------------------------------------------
mb90082_device::mb90082_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, MB90082, "MB90082 OSD", tag, owner, clock, "mb90082", __FILE__),
- device_memory_interface(mconfig, *this),
- m_space_config("videoram", ENDIANNESS_LITTLE, 16, 16, 0, nullptr, *ADDRESS_MAP_NAME(mb90082_vram))
+ : device_t(mconfig, MB90082, tag, owner, clock)
+ , device_memory_interface(mconfig, *this)
+ , m_space_config("videoram", ENDIANNESS_LITTLE, 16, 16, 0, nullptr, *ADDRESS_MAP_NAME(mb90082_vram))
{
}
diff --git a/src/devices/video/mb90082.h b/src/devices/video/mb90082.h
index 493c8fc0079..9014b14a79e 100644
--- a/src/devices/video/mb90082.h
+++ b/src/devices/video/mb90082.h
@@ -6,10 +6,10 @@
***************************************************************************/
-#pragma once
+#ifndef MAME_VIDEO_MB90082DEV_H
+#define MAME_VIDEO_MB90082DEV_H
-#ifndef __MB90082DEV_H__
-#define __MB90082DEV_H__
+#pragma once
@@ -24,12 +24,6 @@
// TYPE DEFINITIONS
//**************************************************************************
-enum
-{
- OSD_COMMAND = 0,
- OSD_DATA
-};
-
// ======================> mb90082_device
@@ -52,9 +46,15 @@ protected:
virtual void device_validity_check(validity_checker &valid) const override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override;
+ virtual const address_space_config *memory_space_config(address_spacenum spacenum) const override;
private:
+ enum
+ {
+ OSD_COMMAND = 0,
+ OSD_DATA
+ };
+
uint8_t m_cmd_ff;
uint8_t m_cmd,m_cmd_param;
uint8_t m_reset_line;
@@ -72,14 +72,6 @@ private:
// device type definition
-extern const device_type MB90082;
-
-
-
-//**************************************************************************
-// GLOBAL VARIABLES
-//**************************************************************************
-
-
+DECLARE_DEVICE_TYPE(MB90082, mb90082_device)
-#endif
+#endif // MAME_VIDEO_MB90082DEV_H
diff --git a/src/devices/video/mb_vcu.cpp b/src/devices/video/mb_vcu.cpp
index 39ad396f185..d149d5880a0 100644
--- a/src/devices/video/mb_vcu.cpp
+++ b/src/devices/video/mb_vcu.cpp
@@ -30,7 +30,7 @@ TODO:
//**************************************************************************
// device type definition
-const device_type MB_VCU = device_creator<mb_vcu_device>;
+DEFINE_DEVICE_TYPE(MB_VCU, mb_vcu_device, "mb_vcu", "Mazer Blazer custom VCU")
//-------------------------------------------------
// static_set_palette_tag: Set the tag of the
@@ -151,7 +151,7 @@ inline void mb_vcu_device::write_io(offs_t address, uint8_t data)
//-------------------------------------------------
mb_vcu_device::mb_vcu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, MB_VCU, "Mazer Blazer custom VCU", tag, owner, clock, "mb_vcu", __FILE__)
+ : device_t(mconfig, MB_VCU, tag, owner, clock)
, device_memory_interface(mconfig, *this)
, device_video_interface(mconfig, *this)
, m_videoram_space_config("videoram", ENDIANNESS_LITTLE, 8, 19, 0, nullptr, *ADDRESS_MAP_NAME(mb_vcu_vram))
diff --git a/src/devices/video/mb_vcu.h b/src/devices/video/mb_vcu.h
index 8c15ded23dc..4171f14b03b 100644
--- a/src/devices/video/mb_vcu.h
+++ b/src/devices/video/mb_vcu.h
@@ -1,9 +1,9 @@
// license:LGPL-2.1+
// copyright-holders:Angelo Salese
-#pragma once
+#ifndef MAME_VIDEO_MB_VCU_H
+#define MAME_VIDEO_MB_VCU_H
-#ifndef __MB_VCUDEV_H__
-#define __MB_VCUDEV_H__
+#pragma once
//**************************************************************************
@@ -45,7 +45,8 @@ protected:
virtual void device_validity_check(validity_checker &valid) const override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override;
+ virtual const address_space_config *memory_space_config(address_spacenum spacenum) const override;
+
private:
inline uint8_t read_byte(offs_t address);
inline void write_byte(offs_t address, uint8_t data);
@@ -76,7 +77,7 @@ private:
// device type definition
-extern const device_type MB_VCU;
+DECLARE_DEVICE_TYPE(MB_VCU, mb_vcu_device)
//**************************************************************************
@@ -89,4 +90,4 @@ extern const device_type MB_VCU;
#define MCFG_MB_VCU_PALETTE(_palette_tag) \
mb_vcu_device::static_set_palette_tag(*device, "^" _palette_tag);
-#endif
+#endif // MAME_VIDEO_MB_VCU_H
diff --git a/src/devices/video/mc6845.cpp b/src/devices/video/mc6845.cpp
index b5804a94f4c..4bf1c757c2e 100644
--- a/src/devices/video/mc6845.cpp
+++ b/src/devices/video/mc6845.cpp
@@ -43,23 +43,23 @@
#include "screen.h"
+//#define VERBOSE 1
+#include "logmacro.h"
-#define LOG (0)
-
-const device_type MC6845 = device_creator<mc6845_device>;
-const device_type MC6845_1 = device_creator<mc6845_1_device>;
-const device_type R6545_1 = device_creator<r6545_1_device>;
-const device_type C6545_1 = device_creator<c6545_1_device>;
-const device_type H46505 = device_creator<h46505_device>;
-const device_type HD6845 = device_creator<hd6845_device>;
-const device_type SY6545_1 = device_creator<sy6545_1_device>;
-const device_type SY6845E = device_creator<sy6845e_device>;
-const device_type HD6345 = device_creator<hd6345_device>;
-const device_type AMS40041 = device_creator<ams40041_device>;
-const device_type AMS40489 = device_creator<ams40489_device>;
-const device_type MOS8563 = device_creator<mos8563_device>;
-const device_type MOS8568 = device_creator<mos8568_device>;
+DEFINE_DEVICE_TYPE(MC6845, mc6845_device, "mc6845", "Motorola MC6845 CRTC")
+DEFINE_DEVICE_TYPE(MC6845_1, mc6845_1_device, "mc6845_1", "Motorola MC6845-1 CRTC")
+DEFINE_DEVICE_TYPE(R6545_1, r6545_1_device, "r6545_1", "Rockwell R6545-1 CRTC")
+DEFINE_DEVICE_TYPE(C6545_1, c6545_1_device, "c6545_1", "C6545-1 CRTC")
+DEFINE_DEVICE_TYPE(H46505, h46505_device, "h46505", "Hitachi HD46505 CRTC")
+DEFINE_DEVICE_TYPE(HD6845, hd6845_device, "hd6845", "Hitachi HD6845 CRTC")
+DEFINE_DEVICE_TYPE(SY6545_1, sy6545_1_device, "sy6545_1", "Synertek SY6545-1 CRTC")
+DEFINE_DEVICE_TYPE(SY6845E, sy6845e_device, "sy6845e", "Synertek SY6845E CRTC")
+DEFINE_DEVICE_TYPE(HD6345, hd6345_device, "hd6345", "Hitachi HD6345 CRTC")
+DEFINE_DEVICE_TYPE(AMS40041, ams40041_device, "ams40041", "AMS40041 CRTC")
+DEFINE_DEVICE_TYPE(AMS40489, ams40489_device, "ams40489", "AMS40489 ASIC (CRTC)")
+DEFINE_DEVICE_TYPE(MOS8563, mos8563_device, "mos8563", "MOS 8563 VDC")
+DEFINE_DEVICE_TYPE(MOS8568, mos8568_device, "mos8568", "MOS 8568 VDC")
/* mode macros */
@@ -91,8 +91,8 @@ const device_type MOS8568 = device_creator<mos8568_device>;
#define ATTR_ALTERNATE_CHARSET BIT(attr, 7)
-mc6845_device::mc6845_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source)
- : device_t(mconfig, type, name, tag, owner, clock, shortname, source),
+mc6845_device::mc6845_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
+ : device_t(mconfig, type, tag, owner, clock),
device_video_interface(mconfig, *this, false),
m_show_border_area(true),
m_interlace_adjust(0),
@@ -109,19 +109,7 @@ mc6845_device::mc6845_device(const machine_config &mconfig, device_type type, co
}
mc6845_device::mc6845_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, MC6845, "MC6845 CRTC", tag, owner, clock, "mc6845", __FILE__),
- device_video_interface(mconfig, *this, false),
- m_show_border_area(true),
- m_interlace_adjust(0),
- m_visarea_adjust_min_x(0),
- m_visarea_adjust_max_x(0),
- m_visarea_adjust_min_y(0),
- m_visarea_adjust_max_y(0),
- m_hpixels_per_column(0),
- m_out_de_cb(*this),
- m_out_cur_cb(*this),
- m_out_hsync_cb(*this),
- m_out_vsync_cb(*this)
+ : mc6845_device(mconfig, MC6845, tag, owner, clock)
{
}
@@ -210,7 +198,7 @@ READ8_MEMBER( mc6845_device::register_r )
WRITE8_MEMBER( mc6845_device::register_w )
{
- if (LOG) logerror("%s:M6845 reg 0x%02x = 0x%02x\n", machine().describe_context(), m_register_address_latch, data);
+ LOG("%s:M6845 reg 0x%02x = 0x%02x\n", machine().describe_context(), m_register_address_latch, data);
switch (m_register_address_latch)
{
@@ -358,7 +346,7 @@ READ8_MEMBER( mos8563_device::register_r )
WRITE8_MEMBER( mos8563_device::register_w )
{
- if (LOG) logerror("%s:MOS8563 reg 0x%02x = 0x%02x\n", machine().describe_context(), m_register_address_latch, data);
+ LOG("%s:MOS8563 reg 0x%02x = 0x%02x\n", machine().describe_context(), m_register_address_latch, data);
switch (m_register_address_latch)
{
@@ -445,7 +433,7 @@ READ8_MEMBER( hd6345_device::register_r )
WRITE8_MEMBER( hd6345_device::register_w )
{
- if (LOG) logerror("%s:HD6345 reg 0x%02x = 0x%02x\n", machine().describe_context(), m_register_address_latch, data);
+ LOG("%s:HD6345 reg 0x%02x = 0x%02x\n", machine().describe_context(), m_register_address_latch, data);
switch (m_register_address_latch)
{
@@ -587,7 +575,7 @@ void mc6845_device::recompute_parameters(bool postload)
else
visarea.set(0 + m_visarea_adjust_min_x, max_visible_x + m_visarea_adjust_max_x, 0 + m_visarea_adjust_min_y, max_visible_y + m_visarea_adjust_max_y);
- if (LOG) logerror("M6845 config screen: HTOTAL: %d VTOTAL: %d MAX_X: %d MAX_Y: %d HSYNC: %d-%d VSYNC: %d-%d Freq: %ffps\n",
+ LOG("M6845 config screen: HTOTAL: %d VTOTAL: %d MAX_X: %d MAX_Y: %d HSYNC: %d-%d VSYNC: %d-%d Freq: %ffps\n",
horiz_pix_total, vert_pix_total, max_visible_x, max_visible_y, hsync_on_pos, hsync_off_pos - 1, vsync_on_pos, vsync_off_pos - 1, 1 / ATTOSECONDS_TO_DOUBLE(refresh));
if ( m_screen != nullptr )
@@ -1049,7 +1037,7 @@ uint32_t mc6845_device::screen_update(screen_device &screen, bitmap_rgb32 &bitma
}
else
{
- if (LOG) logerror("M6845: Invalid screen parameters - display disabled!!!\n");
+ LOG("M6845: Invalid screen parameters - display disabled!!!\n");
}
return 0;
@@ -1328,7 +1316,7 @@ void mos8563_device::device_start()
m_update_ready_bit = 1;
// default update_row delegate
- m_update_row_cb = mc6845_update_row_delegate(FUNC(mos8563_device::vdc_update_row), this);
+ m_update_row_cb = update_row_delegate(FUNC(mos8563_device::vdc_update_row), this);
m_char_blink_state = false;
m_char_blink_count = 0;
@@ -1441,8 +1429,8 @@ const address_space_config *mos8563_device::memory_space_config(address_spacenum
{
switch (spacenum)
{
- case AS_0: return &m_videoram_space_config;
- default: return nullptr;
+ case AS_0: return &m_videoram_space_config;
+ default: return nullptr;
}
}
@@ -1453,66 +1441,66 @@ ADDRESS_MAP_END
r6545_1_device::r6545_1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : mc6845_device(mconfig, R6545_1, "R6545-1 CRTC", tag, owner, clock, "r6545_1", __FILE__)
+ : mc6845_device(mconfig, R6545_1, tag, owner, clock)
{
}
h46505_device::h46505_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : mc6845_device(mconfig, H46505, "H46505 CRTC", tag, owner, clock, "h46505", __FILE__)
+ : mc6845_device(mconfig, H46505, tag, owner, clock)
{
}
mc6845_1_device::mc6845_1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : mc6845_device(mconfig, MC6845_1, "MC6845-1 CRTC", tag, owner, clock, "mc6845_1", __FILE__)
+ : mc6845_device(mconfig, MC6845_1, tag, owner, clock)
{
}
hd6845_device::hd6845_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : mc6845_device(mconfig, HD6845, "HD6845 CRTC", tag, owner, clock, "hd6845", __FILE__)
+ : mc6845_device(mconfig, HD6845, tag, owner, clock)
{
}
c6545_1_device::c6545_1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : mc6845_device(mconfig, C6545_1, "C6545-1 CRTC", tag, owner, clock, "c6545_1", __FILE__)
+ : mc6845_device(mconfig, C6545_1, tag, owner, clock)
{
}
sy6545_1_device::sy6545_1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : mc6845_device(mconfig, SY6545_1, "SY6545-1 CRTC", tag, owner, clock, "sy6545_1", __FILE__)
+ : mc6845_device(mconfig, SY6545_1, tag, owner, clock)
{
}
sy6845e_device::sy6845e_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : mc6845_device(mconfig, SY6845E, "SY6845E CRTC", tag, owner, clock, "sy6845e", __FILE__)
+ : mc6845_device(mconfig, SY6845E, tag, owner, clock)
{
}
hd6345_device::hd6345_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : mc6845_device(mconfig, HD6345, "HD6345 CRTC", tag, owner, clock, "hd6345", __FILE__)
+ : mc6845_device(mconfig, HD6345, tag, owner, clock)
{
}
ams40041_device::ams40041_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : mc6845_device(mconfig, AMS40041, "AMS40041 CRTC", tag, owner, clock, "ams40041", __FILE__)
+ : mc6845_device(mconfig, AMS40041, tag, owner, clock)
{
}
ams40489_device::ams40489_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : mc6845_device(mconfig, AMS40489, "AMS40489 ASIC (CRTC)", tag, owner, clock, "ams40489", __FILE__)
+ : mc6845_device(mconfig, AMS40489, tag, owner, clock)
{
}
-mos8563_device::mos8563_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source)
- : mc6845_device(mconfig, type, name, tag, owner, clock, shortname, source),
+mos8563_device::mos8563_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
+ : mc6845_device(mconfig, type, tag, owner, clock),
device_memory_interface(mconfig, *this),
m_videoram_space_config("videoram", ENDIANNESS_LITTLE, 8, 16, 0, nullptr, *ADDRESS_MAP_NAME(mos8563_videoram_map)),
m_palette(*this, "palette")
@@ -1522,17 +1510,13 @@ mos8563_device::mos8563_device(const machine_config &mconfig, device_type type,
mos8563_device::mos8563_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : mc6845_device(mconfig, MOS8563, "MOS8563", tag, owner, clock, "mos8563", __FILE__),
- device_memory_interface(mconfig, *this),
- m_videoram_space_config("videoram", ENDIANNESS_LITTLE, 8, 16, 0, nullptr, *ADDRESS_MAP_NAME(mos8563_videoram_map)),
- m_palette(*this, "palette")
+ : mos8563_device(mconfig, MOS8563, tag, owner, clock)
{
- set_clock_scale(1.0/8);
}
mos8568_device::mos8568_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : mos8563_device(mconfig, MOS8568, "MOS8568", tag, owner, clock, "mos8568", __FILE__)
+ : mos8563_device(mconfig, MOS8568, tag, owner, clock)
{
}
diff --git a/src/devices/video/mc6845.h b/src/devices/video/mc6845.h
index 5bbe24cb432..dead2602689 100644
--- a/src/devices/video/mc6845.h
+++ b/src/devices/video/mc6845.h
@@ -6,9 +6,10 @@
**********************************************************************/
-#ifndef __MC6845__
-#define __MC6845__
+#ifndef MAME_VIDEO_MC6845_H
+#define MAME_VIDEO_MC6845_H
+#pragma once
#define MCFG_MC6845_ADD(_tag, _variant, _screen_tag, _clock) \
@@ -36,19 +37,19 @@
mc6845_device::set_char_width(*device, _pixels);
#define MCFG_MC6845_RECONFIGURE_CB(_class, _method) \
- mc6845_device::set_reconfigure_callback(*device, mc6845_reconfigure_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
+ mc6845_device::set_reconfigure_callback(*device, mc6845_device::reconfigure_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
#define MCFG_MC6845_BEGIN_UPDATE_CB(_class, _method) \
- mc6845_device::set_begin_update_callback(*device, mc6845_begin_update_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
+ mc6845_device::set_begin_update_callback(*device, mc6845_device::begin_update_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
#define MCFG_MC6845_UPDATE_ROW_CB(_class, _method) \
- mc6845_device::set_update_row_callback(*device, mc6845_update_row_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
+ mc6845_device::set_update_row_callback(*device, mc6845_device::update_row_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
#define MCFG_MC6845_END_UPDATE_CB(_class, _method) \
- mc6845_device::set_end_update_callback(*device, mc6845_end_update_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
+ mc6845_device::set_end_update_callback(*device, mc6845_device::end_update_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
#define MCFG_MC6845_ADDR_CHANGED_CB(_class, _method) \
- mc6845_device::set_on_update_addr_change_callback(*device, mc6845_on_update_addr_changed_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
+ mc6845_device::set_on_update_addr_change_callback(*device, mc6845_device::on_update_addr_changed_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
#define MCFG_MC6845_OUT_DE_CB(_write) \
devcb = &mc6845_device::set_out_de_callback(*device, DEVCB_##_write);
@@ -64,42 +65,31 @@
/* callback definitions */
-typedef device_delegate<void (int width, int height, const rectangle &visarea, attoseconds_t frame_period)> mc6845_reconfigure_delegate;
#define MC6845_RECONFIGURE(name) void name(int width, int height, const rectangle &visarea, attoseconds_t frame_period)
-typedef device_delegate<void (bitmap_rgb32 &bitmap, const rectangle &cliprect)> mc6845_begin_update_delegate;
#define MC6845_BEGIN_UPDATE(name) void name(bitmap_rgb32 &bitmap, const rectangle &cliprect)
-typedef device_delegate<void (bitmap_rgb32 &bitmap, const rectangle &cliprect, uint16_t ma, uint8_t ra,
- uint16_t y, uint8_t x_count, int8_t cursor_x, int de, int hbp, int vbp)> mc6845_update_row_delegate;
#define MC6845_UPDATE_ROW(name) void name(bitmap_rgb32 &bitmap, const rectangle &cliprect, uint16_t ma, uint8_t ra, \
uint16_t y, uint8_t x_count, int8_t cursor_x, int de, int hbp, int vbp)
-typedef device_delegate<void (bitmap_rgb32 &bitmap, const rectangle &cliprect)> mc6845_end_update_delegate;
#define MC6845_END_UPDATE(name) void name(bitmap_rgb32 &bitmap, const rectangle &cliprect)
-typedef device_delegate<void (int address, int strobe)> mc6845_on_update_addr_changed_delegate;
#define MC6845_ON_UPDATE_ADDR_CHANGED(name) void name(int address, int strobe)
class mc6845_device : public device_t,
public device_video_interface
{
- friend class mc6845_1_device;
- friend class r6545_1_device;
- friend class c6545_1_device;
- friend class h46505_device;
- friend class hd6845_device;
- friend class sy6545_1_device;
- friend class sy6845e_device;
- friend class hd6345_device;
- friend class ams40041_device;
- friend class ams40489_device;
-
public:
+ typedef device_delegate<void (int width, int height, const rectangle &visarea, attoseconds_t frame_period)> reconfigure_delegate;
+ typedef device_delegate<void (bitmap_rgb32 &bitmap, const rectangle &cliprect)> begin_update_delegate;
+ typedef device_delegate<void (bitmap_rgb32 &bitmap, const rectangle &cliprect, uint16_t ma, uint8_t ra,
+ uint16_t y, uint8_t x_count, int8_t cursor_x, int de, int hbp, int vbp)> update_row_delegate;
+ typedef device_delegate<void (bitmap_rgb32 &bitmap, const rectangle &cliprect)> end_update_delegate;
+ typedef device_delegate<void (int address, int strobe)> on_update_addr_changed_delegate;
+
// construction/destruction
mc6845_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- mc6845_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source);
static void set_show_border_area(device_t &device, bool show) { downcast<mc6845_device &>(device).m_show_border_area = show; }
static void set_visarea_adjust(device_t &device, int min_x, int max_x, int min_y, int max_y)
@@ -112,16 +102,16 @@ public:
}
static void set_char_width(device_t &device, int pixels) { downcast<mc6845_device &>(device).m_hpixels_per_column = pixels; }
- static void set_reconfigure_callback(device_t &device, mc6845_reconfigure_delegate callback) { downcast<mc6845_device &>(device).m_reconfigure_cb = callback; }
- static void set_begin_update_callback(device_t &device, mc6845_begin_update_delegate callback) { downcast<mc6845_device &>(device).m_begin_update_cb = callback; }
- static void set_update_row_callback(device_t &device, mc6845_update_row_delegate callback) { downcast<mc6845_device &>(device).m_update_row_cb = callback; }
- static void set_end_update_callback(device_t &device, mc6845_end_update_delegate callback) { downcast<mc6845_device &>(device).m_end_update_cb = callback; }
- static void set_on_update_addr_change_callback(device_t &device, mc6845_on_update_addr_changed_delegate callback) { downcast<mc6845_device &>(device).m_on_update_addr_changed_cb = callback; }
+ static void set_reconfigure_callback(device_t &device, reconfigure_delegate &&cb) { downcast<mc6845_device &>(device).m_reconfigure_cb = std::move(cb); }
+ static void set_begin_update_callback(device_t &device, begin_update_delegate &&cb) { downcast<mc6845_device &>(device).m_begin_update_cb = std::move(cb); }
+ static void set_update_row_callback(device_t &device, update_row_delegate &&cb) { downcast<mc6845_device &>(device).m_update_row_cb = std::move(cb); }
+ static void set_end_update_callback(device_t &device, end_update_delegate &&cb) { downcast<mc6845_device &>(device).m_end_update_cb = std::move(cb); }
+ static void set_on_update_addr_change_callback(device_t &device, on_update_addr_changed_delegate &&cb) { downcast<mc6845_device &>(device).m_on_update_addr_changed_cb = std::move(cb); }
- template<class _Object> static devcb_base &set_out_de_callback(device_t &device, _Object object) { return downcast<mc6845_device &>(device).m_out_de_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_out_cur_callback(device_t &device, _Object object) { return downcast<mc6845_device &>(device).m_out_cur_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_out_hsync_callback(device_t &device, _Object object) { return downcast<mc6845_device &>(device).m_out_hsync_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_out_vsync_callback(device_t &device, _Object object) { return downcast<mc6845_device &>(device).m_out_vsync_cb.set_callback(object); }
+ template <class Object> static devcb_base &set_out_de_callback(device_t &device, Object &&cb) { return downcast<mc6845_device &>(device).m_out_de_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_out_cur_callback(device_t &device, Object &&cb) { return downcast<mc6845_device &>(device).m_out_cur_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_out_hsync_callback(device_t &device, Object &&cb) { return downcast<mc6845_device &>(device).m_out_hsync_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_out_vsync_callback(device_t &device, Object &&cb) { return downcast<mc6845_device &>(device).m_out_vsync_cb.set_callback(std::forward<Object>(cb)); }
/* select one of the registers for reading or writing */
DECLARE_WRITE8_MEMBER( address_w );
@@ -168,6 +158,8 @@ public:
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
protected:
+ mc6845_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
+
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
@@ -290,26 +282,26 @@ protected:
int m_hpixels_per_column; /* number of pixels per video memory address */
- mc6845_reconfigure_delegate m_reconfigure_cb;
+ reconfigure_delegate m_reconfigure_cb;
/* if specified, this gets called before any pixel update,
optionally return a pointer that will be passed to the
update and tear down callbacks */
- mc6845_begin_update_delegate m_begin_update_cb;
+ begin_update_delegate m_begin_update_cb;
/* this gets called for every row, the driver must output
x_count * hpixels_per_column pixels.
cursor_x indicates the character position where the cursor is, or -1
if there is no cursor on this row */
- mc6845_update_row_delegate m_update_row_cb;
+ update_row_delegate m_update_row_cb;
/* if specified, this gets called after all row updating is complete */
- mc6845_end_update_delegate m_end_update_cb;
+ end_update_delegate m_end_update_cb;
/* Called whenever the update address changes
* For vblank/hblank timing strobe indicates the physical update.
* vblank/hblank timing not supported yet! */
- mc6845_on_update_addr_changed_delegate m_on_update_addr_changed_cb;
+ on_update_addr_changed_delegate m_on_update_addr_changed_cb;
/* if specified, this gets called for every change of the display enable pin (pin 18) */
devcb_write_line m_out_de_cb;
@@ -435,7 +427,6 @@ class mos8563_device : public mc6845_device,
public device_memory_interface
{
public:
- mos8563_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source);
mos8563_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override;
@@ -453,6 +444,8 @@ public:
MC6845_UPDATE_ROW( vdc_update_row );
protected:
+ mos8563_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
+
// device-level overrides
virtual machine_config_constructor device_mconfig_additions() const override;
virtual void device_start() override;
@@ -507,20 +500,18 @@ protected:
};
-extern const device_type MC6845;
-extern const device_type MC6845_1;
-extern const device_type R6545_1;
-extern const device_type C6545_1;
-extern const device_type H46505;
-extern const device_type HD6845;
-extern const device_type SY6545_1;
-extern const device_type SY6845E;
-extern const device_type HD6345;
-extern const device_type AMS40041;
-extern const device_type AMS40489;
-extern const device_type MOS8563;
-extern const device_type MOS8568;
-
-
-
-#endif
+DECLARE_DEVICE_TYPE(MC6845, mc6845_device)
+DECLARE_DEVICE_TYPE(MC6845_1, mc6845_1_device)
+DECLARE_DEVICE_TYPE(R6545_1, r6545_1_device)
+DECLARE_DEVICE_TYPE(C6545_1, c6545_1_device)
+DECLARE_DEVICE_TYPE(H46505, h46505_device)
+DECLARE_DEVICE_TYPE(HD6845, hd6845_device)
+DECLARE_DEVICE_TYPE(SY6545_1, sy6545_1_device)
+DECLARE_DEVICE_TYPE(SY6845E, sy6845e_device)
+DECLARE_DEVICE_TYPE(HD6345, hd6345_device)
+DECLARE_DEVICE_TYPE(AMS40041, ams40041_device)
+DECLARE_DEVICE_TYPE(AMS40489, ams40489_device)
+DECLARE_DEVICE_TYPE(MOS8563, mos8563_device)
+DECLARE_DEVICE_TYPE(MOS8568, mos8568_device)
+
+#endif // MAME_VIDEO_MC6845_H
diff --git a/src/devices/video/mc6847.cpp b/src/devices/video/mc6847.cpp
index e3781147f60..22f6cef81a0 100644
--- a/src/devices/video/mc6847.cpp
+++ b/src/devices/video/mc6847.cpp
@@ -129,12 +129,12 @@ const uint32_t mc6847_base_device::s_palette[mc6847_base_device::PALETTE_LENGTH]
// ctor
//-------------------------------------------------
-mc6847_friend_device::mc6847_friend_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock,
- const uint8_t *fontdata, bool is_mc6847t1, double tpfs, int field_sync_falling_edge_scanline, bool supports_partial_body_scanlines, const char *shortname, const char *source)
- : device_t(mconfig, type, name, tag, owner, clock, shortname, source),
- m_write_hsync(*this),
- m_write_fsync(*this),
- m_character_map(fontdata, is_mc6847t1)
+mc6847_friend_device::mc6847_friend_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock,
+ const uint8_t *fontdata, bool is_mc6847t1, double tpfs, int field_sync_falling_edge_scanline, bool supports_partial_body_scanlines)
+ : device_t(mconfig, type, tag, owner, clock)
+ , m_write_hsync(*this)
+ , m_write_fsync(*this)
+ , m_character_map(fontdata, is_mc6847t1)
{
m_tpfs = tpfs;
m_supports_partial_body_scanlines = supports_partial_body_scanlines;
@@ -154,9 +154,9 @@ inline emu_timer *mc6847_friend_device::setup_timer(device_timer_id id, double o
{
emu_timer *timer = timer_alloc(id);
timer->adjust(
- attotime::from_ticks(offset * 4, m_clock * 4),
- 0,
- attotime::from_ticks(period * 4, m_clock * 4));
+ attotime::from_ticks(offset * 4, m_clock * 4),
+ 0,
+ attotime::from_ticks(period * 4, m_clock * 4));
return timer;
}
@@ -166,7 +166,7 @@ inline emu_timer *mc6847_friend_device::setup_timer(device_timer_id id, double o
// device_start - device-specific startup
//-------------------------------------------------
-void mc6847_friend_device::device_start(void)
+void mc6847_friend_device::device_start()
{
m_write_hsync.resolve_safe();
m_write_fsync.resolve_safe();
@@ -204,7 +204,7 @@ void mc6847_friend_device::device_start(void)
// device_start - device-specific reset
//-------------------------------------------------
-void mc6847_friend_device::device_reset(void)
+void mc6847_friend_device::device_reset()
{
device_t::device_reset();
m_video_changed = true;
@@ -216,7 +216,7 @@ void mc6847_friend_device::device_reset(void)
// device_post_load - device-specific post load
//-------------------------------------------------
-void mc6847_friend_device::device_post_load(void)
+void mc6847_friend_device::device_post_load()
{
device_t::device_post_load();
m_video_changed = true;
@@ -228,7 +228,7 @@ void mc6847_friend_device::device_post_load(void)
// update_field_sync_timer
//-------------------------------------------------
-void mc6847_friend_device::update_field_sync_timer(void)
+void mc6847_friend_device::update_field_sync_timer()
{
// are we expecting field sync?
bool expected_field_sync = (m_physical_scanline < m_field_sync_falling_edge_scanline)
@@ -268,7 +268,7 @@ void mc6847_friend_device::device_timer(emu_timer &timer, device_timer_id id, in
// new_frame
//-------------------------------------------------
-inline void mc6847_friend_device::new_frame(void)
+inline void mc6847_friend_device::new_frame()
{
m_physical_scanline = 0;
m_logical_scanline = 0;
@@ -397,7 +397,7 @@ inline void mc6847_friend_device::change_field_sync(bool line)
// next_scanline
//-------------------------------------------------
-inline void mc6847_friend_device::next_scanline(void)
+inline void mc6847_friend_device::next_scanline()
{
/* advance to next scanline */
m_physical_scanline++;
@@ -464,7 +464,7 @@ void mc6847_friend_device::field_sync_changed(bool line)
// enter_bottom_border
//-------------------------------------------------
-void mc6847_friend_device::enter_bottom_border(void)
+void mc6847_friend_device::enter_bottom_border()
{
}
@@ -526,7 +526,7 @@ void mc6847_friend_device::video_flush()
// describe_context
//-------------------------------------------------
-const char *mc6847_friend_device::describe_context(void)
+const char *mc6847_friend_device::describe_context()
{
static char buffer[128];
snprintf(buffer, ARRAY_LENGTH(buffer), "%s (scanline %s:%d)",
@@ -546,8 +546,8 @@ const char *mc6847_friend_device::describe_context(void)
// ctor
//-------------------------------------------------
-mc6847_base_device::mc6847_base_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const uint8_t *fontdata, double tpfs, const char *shortname, const char *source) :
- mc6847_friend_device(mconfig, type, name, tag, owner, clock, fontdata, (type == MC6847T1_NTSC) || (type == MC6847T1_PAL), tpfs, 25+191, true, shortname, source),
+mc6847_base_device::mc6847_base_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, const uint8_t *fontdata, double tpfs) :
+ mc6847_friend_device(mconfig, type, tag, owner, clock, fontdata, (type == MC6847T1_NTSC) || (type == MC6847T1_PAL), tpfs, 25+191, true),
m_input_cb(*this),
m_black_and_white(false),
m_fixed_mode(0),
@@ -1760,14 +1760,14 @@ mc6847_base_device::pixel_t mc6847_base_device::artifacter::mix_color(double fac
// VARIATIONS
//**************************************************************************
-const device_type MC6847_NTSC = device_creator<mc6847_ntsc_device>;
-const device_type MC6847_PAL = device_creator<mc6847_pal_device>;
-const device_type MC6847Y_NTSC = device_creator<mc6847y_ntsc_device>;
-const device_type MC6847Y_PAL = device_creator<mc6847y_pal_device>;
-const device_type MC6847T1_NTSC = device_creator<mc6847t1_ntsc_device>;
-const device_type MC6847T1_PAL = device_creator<mc6847t1_pal_device>;
-const device_type S68047 = device_creator<s68047_device>;
-const device_type M5C6847P1 = device_creator<m5c6847p1_device>;
+DEFINE_DEVICE_TYPE(MC6847_NTSC, mc6847_ntsc_device, "mc6847_ntsc", "Motorola MC6847 VDG (NTSC)")
+DEFINE_DEVICE_TYPE(MC6847_PAL, mc6847_pal_device, "mc6847_pal", "Motorola MC6847 VDG (PAL)")
+DEFINE_DEVICE_TYPE(MC6847Y_NTSC, mc6847y_ntsc_device, "mc6847y_ntsc", "Motorola MC6847Y VDG (NTSC)")
+DEFINE_DEVICE_TYPE(MC6847Y_PAL, mc6847y_pal_device, "mc6847y_pal", "Motorola MC6847Y VDG (PAL)")
+DEFINE_DEVICE_TYPE(MC6847T1_NTSC, mc6847t1_ntsc_device, "mc6847t1_ntsc", "Motorola MC6847T1 VDG (NTSC)")
+DEFINE_DEVICE_TYPE(MC6847T1_PAL, mc6847t1_pal_device, "mc6847t1_pal", "Motorola MC6847T1 VDG (PAL)")
+DEFINE_DEVICE_TYPE(S68047, s68047_device, "s68047", "AMI S68047")
+DEFINE_DEVICE_TYPE(M5C6847P1, m5c6847p1_device, "m5c6847p1", "Mitsubishi M5C6847P-1 VDG")
@@ -1776,7 +1776,7 @@ const device_type M5C6847P1 = device_creator<m5c6847p1_device>;
//-------------------------------------------------
mc6847_ntsc_device::mc6847_ntsc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : mc6847_base_device(mconfig, MC6847_NTSC, "MC6847_NTSC", tag, owner, clock, ntsc_square_fontdata8x12, 262.0, "mc6847_ntsc", __FILE__)
+ : mc6847_base_device(mconfig, MC6847_NTSC, tag, owner, clock, ntsc_square_fontdata8x12, 262.0)
{
}
@@ -1787,7 +1787,7 @@ mc6847_ntsc_device::mc6847_ntsc_device(const machine_config &mconfig, const char
//-------------------------------------------------
mc6847_pal_device::mc6847_pal_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : mc6847_base_device(mconfig, MC6847_PAL, "MC6847_PAL", tag, owner, clock, pal_square_fontdata8x12, 313.0, "mc6847_pal", __FILE__)
+ : mc6847_base_device(mconfig, MC6847_PAL, tag, owner, clock, pal_square_fontdata8x12, 313.0)
{
}
@@ -1798,7 +1798,7 @@ mc6847_pal_device::mc6847_pal_device(const machine_config &mconfig, const char *
//-------------------------------------------------
mc6847y_ntsc_device::mc6847y_ntsc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : mc6847_base_device(mconfig, MC6847Y_NTSC, "MC6847Y_NTSC", tag, owner, clock, ntsc_square_fontdata8x12, 262.5, "mc6847y", __FILE__)
+ : mc6847_base_device(mconfig, MC6847Y_NTSC, tag, owner, clock, ntsc_square_fontdata8x12, 262.5)
{
}
@@ -1809,7 +1809,7 @@ mc6847y_ntsc_device::mc6847y_ntsc_device(const machine_config &mconfig, const ch
//-------------------------------------------------
mc6847y_pal_device::mc6847y_pal_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : mc6847_base_device(mconfig, MC6847Y_PAL, "MC6847Y_PAL", tag, owner, clock, pal_square_fontdata8x12, 313.0, "mc6847y_pal", __FILE__)
+ : mc6847_base_device(mconfig, MC6847Y_PAL, tag, owner, clock, pal_square_fontdata8x12, 313.0)
{
}
@@ -1820,7 +1820,7 @@ mc6847y_pal_device::mc6847y_pal_device(const machine_config &mconfig, const char
//-------------------------------------------------
mc6847t1_ntsc_device::mc6847t1_ntsc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : mc6847_base_device(mconfig, MC6847T1_NTSC, "MC6847T1_NTSC", tag, owner, clock, ntsc_round_fontdata8x12, 262.0, "mc6847t1_ntsc", __FILE__)
+ : mc6847_base_device(mconfig, MC6847T1_NTSC, tag, owner, clock, ntsc_round_fontdata8x12, 262.0)
{
}
@@ -1831,7 +1831,7 @@ mc6847t1_ntsc_device::mc6847t1_ntsc_device(const machine_config &mconfig, const
//-------------------------------------------------
mc6847t1_pal_device::mc6847t1_pal_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : mc6847_base_device(mconfig, MC6847T1_PAL, "MC6847T1_PAL", tag, owner, clock, pal_round_fontdata8x12, 313.0, "mc6847t1_pal", __FILE__)
+ : mc6847_base_device(mconfig, MC6847T1_PAL, tag, owner, clock, pal_round_fontdata8x12, 313.0)
{
}
@@ -1842,7 +1842,7 @@ mc6847t1_pal_device::mc6847t1_pal_device(const machine_config &mconfig, const ch
//-------------------------------------------------
s68047_device::s68047_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : mc6847_base_device(mconfig, S68047, "S68047", tag, owner, clock, s68047_fontdata8x12, 262.0, "s68047", __FILE__)
+ : mc6847_base_device(mconfig, S68047, tag, owner, clock, s68047_fontdata8x12, 262.0)
{
}
@@ -1891,6 +1891,6 @@ const uint32_t s68047_device::s_s68047_hack_palette[16] =
//-------------------------------------------------
m5c6847p1_device::m5c6847p1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : mc6847_base_device(mconfig, M5C6847P1, "M5C6847P-1", tag, owner, clock, ntsc_square_fontdata8x12, 262.5, "m5c6847p1", __FILE__)
+ : mc6847_base_device(mconfig, M5C6847P1, tag, owner, clock, ntsc_square_fontdata8x12, 262.5)
{
}
diff --git a/src/devices/video/mc6847.h b/src/devices/video/mc6847.h
index 100d3033877..781def31804 100644
--- a/src/devices/video/mc6847.h
+++ b/src/devices/video/mc6847.h
@@ -7,24 +7,14 @@
Implementation of Motorola 6847 video hardware chip
***************************************************************************/
-#ifndef MAME_DEVICES_VIDEO_MC6847_H
-#define MAME_DEVICES_VIDEO_MC6847_H
+#ifndef MAME_VIDEO_MC6847_H
+#define MAME_VIDEO_MC6847_H
#pragma once
#include "screen.h"
-#define MC6847_MODE_AG 0x80
-#define MC6847_MODE_GM2 0x40
-#define MC6847_MODE_GM1 0x20
-#define MC6847_MODE_GM0 0x10
-#define MC6847_MODE_CSS 0x08
-#define MC6847_MODE_AS 0x04
-#define MC6847_MODE_INTEXT 0x02
-#define MC6847_MODE_INV 0x01
-
-
//**************************************************************************
// MC6847 CONFIGURATION / INTERFACE
//**************************************************************************
@@ -52,7 +42,7 @@
devcb = &mc6847_friend_device::set_fsync_wr_callback(*device, DEVCB_##_write);
#define MCFG_MC6847_CHARROM_CALLBACK(_class, _method) \
- mc6847_friend_device::set_get_char_rom(*device, mc6847_get_char_rom_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
+ mc6847_friend_device::set_get_char_rom(*device, mc6847_friend_device::get_char_rom_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
#define MCFG_MC6847_INPUT_CALLBACK(_read) \
devcb = &mc6847_base_device::set_input_callback(*device, DEVCB_##_read);
@@ -64,7 +54,6 @@
mc6847_base_device::set_black_and_white(*device, _bw);
-typedef device_delegate<uint8_t (uint8_t ch, int line)> mc6847_get_char_rom_delegate;
#define MC6847_GET_CHARROM_MEMBER(_name) uint8_t _name(uint8_t ch, int line)
@@ -81,34 +70,36 @@ INPUT_PORTS_EXTERN(mc6847_artifacting);
class mc6847_friend_device : public device_t
{
public:
+ // video mode constants
+ static constexpr uint8_t MODE_AG = 0x80;
+ static constexpr uint8_t MODE_GM2 = 0x40;
+ static constexpr uint8_t MODE_GM1 = 0x20;
+ static constexpr uint8_t MODE_GM0 = 0x10;
+ static constexpr uint8_t MODE_CSS = 0x08;
+ static constexpr uint8_t MODE_AS = 0x04;
+ static constexpr uint8_t MODE_INTEXT = 0x02;
+ static constexpr uint8_t MODE_INV = 0x01;
+
+ typedef device_delegate<uint8_t (uint8_t ch, int line)> get_char_rom_delegate;
+
// inlines
- bool hs_r(void) { return m_horizontal_sync; }
- bool fs_r(void) { return m_field_sync; }
+ bool hs_r() const { return m_horizontal_sync; }
+ bool fs_r() const { return m_field_sync; }
- template<class _Object> static devcb_base &set_hsync_wr_callback(device_t &device, _Object object) { return downcast<mc6847_friend_device &>(device).m_write_hsync.set_callback(object); }
- template<class _Object> static devcb_base &set_fsync_wr_callback(device_t &device, _Object object) { return downcast<mc6847_friend_device &>(device).m_write_fsync.set_callback(object); }
+ template <class Object> static devcb_base &set_hsync_wr_callback(device_t &device, Object &&cb) { return downcast<mc6847_friend_device &>(device).m_write_hsync.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_fsync_wr_callback(device_t &device, Object &&cb) { return downcast<mc6847_friend_device &>(device).m_write_fsync.set_callback(std::forward<Object>(cb)); }
- static void set_get_char_rom(device_t &device, mc6847_get_char_rom_delegate callback) { downcast<mc6847_friend_device &>(device).m_charrom_cb = callback; }
+ static void set_get_char_rom(device_t &device, get_char_rom_delegate &&cb) { downcast<mc6847_friend_device &>(device).m_charrom_cb = std::move(cb); }
protected:
- mc6847_friend_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock,
- const uint8_t *fontdata, bool is_mc6847t1, double tpfs, int field_sync_falling_edge_scanline, bool supports_partial_body_scanlines, const char *shortname, const char *source);
-
- // video mode constants
- static const uint8_t MODE_AG = 0x80;
- static const uint8_t MODE_GM2 = 0x40;
- static const uint8_t MODE_GM1 = 0x20;
- static const uint8_t MODE_GM0 = 0x10;
- static const uint8_t MODE_CSS = 0x08;
- static const uint8_t MODE_AS = 0x04;
- static const uint8_t MODE_INTEXT = 0x02;
- static const uint8_t MODE_INV = 0x01;
+ mc6847_friend_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock,
+ const uint8_t *fontdata, bool is_mc6847t1, double tpfs, int field_sync_falling_edge_scanline, bool supports_partial_body_scanlines);
// timer constants
- static const device_timer_id TIMER_FRAME = 0;
- static const device_timer_id TIMER_HSYNC_OFF = 1;
- static const device_timer_id TIMER_HSYNC_ON = 2;
- static const device_timer_id TIMER_FSYNC = 3;
+ static constexpr device_timer_id TIMER_FRAME = 0;
+ static constexpr device_timer_id TIMER_HSYNC_OFF = 1;
+ static constexpr device_timer_id TIMER_HSYNC_ON = 2;
+ static constexpr device_timer_id TIMER_FSYNC = 3;
// fonts
static const uint8_t pal_round_fontdata8x12[];
@@ -211,7 +202,7 @@ protected:
// artifacting config
void setup_config(device_t *device);
- void poll_config(void) { m_artifacting = (m_config!=nullptr) ? m_config->read() : 0; }
+ void poll_config() { m_artifacting = (m_config!=nullptr) ? m_config->read() : 0; }
// artifacting application
template<int xscale>
@@ -275,30 +266,30 @@ protected:
/* if specified, this reads the external char rom off of the driver state */
// moved here from mc6847_base_device so to be useable in GIME
- mc6847_get_char_rom_delegate m_charrom_cb;
+ get_char_rom_delegate m_charrom_cb;
// incidentals
character_map m_character_map;
artifacter m_artifacter;
// device-level overrides
- virtual void device_start(void) override;
+ virtual void device_start() override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
- virtual void device_reset(void) override;
- virtual void device_post_load(void) override;
+ virtual void device_reset() override;
+ virtual void device_post_load() override;
// other overridables
- virtual void new_frame(void);
+ virtual void new_frame();
virtual void horizontal_sync_changed(bool line);
virtual void field_sync_changed(bool line);
- virtual void enter_bottom_border(void);
+ virtual void enter_bottom_border();
virtual void record_border_scanline(uint16_t physical_scanline);
virtual void record_body_scanline(uint16_t physical_scanline, uint16_t logical_scanline) = 0;
virtual void record_partial_body_scanline(uint16_t physical_scanline, uint16_t logical_scanline, int32_t start_clock, int32_t end_clock) = 0;
// miscellaneous
- void video_flush(void);
- const char *describe_context(void);
+ void video_flush();
+ const char *describe_context();
// setup functions
emu_timer *setup_timer(device_timer_id id, double offset, double period);
@@ -348,7 +339,7 @@ protected:
}
// checks to see if the video has changed
- ATTR_FORCE_INLINE bool has_video_changed(void)
+ ATTR_FORCE_INLINE bool has_video_changed()
{
/* poll the artifacting config */
m_artifacter.poll_config();
@@ -410,7 +401,7 @@ protected:
// template function for emitting samples
template<int xscale>
uint32_t emit_mc6847_samples(uint8_t mode, const uint8_t *data, int length, pixel_t *RESTRICT pixels, const pixel_t *RESTRICT palette,
- mc6847_get_char_rom_delegate get_char_rom, int x, int y)
+ get_char_rom_delegate const &get_char_rom, int x, int y)
{
uint32_t result;
if (mode & MODE_AG)
@@ -505,8 +496,8 @@ private:
// functions
void change_horizontal_sync(bool line);
void change_field_sync(bool line);
- void update_field_sync_timer(void);
- void next_scanline(void);
+ void update_field_sync_timer();
+ void next_scanline();
int32_t get_clocks_since_hsync();
// debugging
@@ -517,7 +508,7 @@ private:
class mc6847_base_device : public mc6847_friend_device
{
public:
- template<class _Object> static devcb_base &set_input_callback(device_t &device, _Object object) { return downcast<mc6847_base_device &>(device).m_input_cb.set_callback(object); }
+ template <class Object> static devcb_base &set_input_callback(device_t &device, Object &&cb) { return downcast<mc6847_base_device &>(device).m_input_cb.set_callback(std::forward<Object>(cb)); }
static void set_get_fixed_mode(device_t &device, uint8_t mode) { downcast<mc6847_base_device &>(device).m_fixed_mode = mode; }
static void set_black_and_white(device_t &device, bool bw) { downcast<mc6847_base_device &>(device).m_black_and_white = bw; }
@@ -538,7 +529,7 @@ public:
DECLARE_WRITE_LINE_MEMBER( inv_w ) { change_mode(MODE_INV, state); }
protected:
- mc6847_base_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const uint8_t *fontdata, double tpfs, const char *shortname, const char *source);
+ mc6847_base_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, const uint8_t *fontdata, double tpfs);
// device-level overrides
virtual void device_start() override;
@@ -552,7 +543,7 @@ protected:
void set_custom_palette(const pixel_t *custom_palette)
{
- if ( m_palette != m_bw_palette )
+ if (m_palette != m_bw_palette)
{
m_palette = custom_palette ? custom_palette : s_palette;
}
@@ -692,13 +683,13 @@ public:
};
-extern const device_type MC6847_NTSC;
-extern const device_type MC6847_PAL;
-extern const device_type MC6847Y_NTSC;
-extern const device_type MC6847Y_PAL;
-extern const device_type MC6847T1_NTSC;
-extern const device_type MC6847T1_PAL;
-extern const device_type S68047;
-extern const device_type M5C6847P1;
+DECLARE_DEVICE_TYPE(MC6847_NTSC, mc6847_ntsc_device)
+DECLARE_DEVICE_TYPE(MC6847_PAL, mc6847_pal_device)
+DECLARE_DEVICE_TYPE(MC6847Y_NTSC, mc6847t1_ntsc_device)
+DECLARE_DEVICE_TYPE(MC6847Y_PAL, mc6847y_pal_device)
+DECLARE_DEVICE_TYPE(MC6847T1_NTSC, mc6847t1_ntsc_device)
+DECLARE_DEVICE_TYPE(MC6847T1_PAL, mc6847t1_pal_device)
+DECLARE_DEVICE_TYPE(S68047, s68047_device)
+DECLARE_DEVICE_TYPE(M5C6847P1, m5c6847p1_device)
-#endif // MAME_DEVICES_VIDEO_MC6847_H
+#endif // MAME_VIDEO_MC6847_H
diff --git a/src/devices/video/mga2064w.cpp b/src/devices/video/mga2064w.cpp
index 3dfd13dcec1..7bc5816c942 100644
--- a/src/devices/video/mga2064w.cpp
+++ b/src/devices/video/mga2064w.cpp
@@ -3,10 +3,10 @@
#include "emu.h"
#include "mga2064w.h"
-const device_type MGA2064W = device_creator<mga2064w_device>;
+DEFINE_DEVICE_TYPE(MGA2064W, mga2064w_device, "mga2064w", "Matrox Millennium")
mga2064w_device::mga2064w_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : pci_device(mconfig, MGA2064W, "Matrox Millennium", tag, owner, clock, "mga2064w", __FILE__)
+ : pci_device(mconfig, MGA2064W, tag, owner, clock)
{
}
diff --git a/src/devices/video/mga2064w.h b/src/devices/video/mga2064w.h
index 844f75254d1..8da3bdb0527 100644
--- a/src/devices/video/mga2064w.h
+++ b/src/devices/video/mga2064w.h
@@ -1,7 +1,9 @@
// license:BSD-3-Clause
// copyright-holders:Olivier Galibert
-#ifndef MGA2064W_H
-#define MGA2064W_H
+#ifndef MAME_VIDEO_MGA2064W_H
+#define MAME_VIDEO_MGA2064W_H
+
+#pragma once
#include "machine/pci.h"
@@ -15,10 +17,8 @@ public:
protected:
virtual void device_start() override;
virtual void device_reset() override;
-
-private:
};
-extern const device_type MGA2064W;
+DECLARE_DEVICE_TYPE(MGA2064W, mga2064w_device);
-#endif
+#endif // MAME_VIDEO_MGA2064W_H
diff --git a/src/devices/video/mos6566.cpp b/src/devices/video/mos6566.cpp
index 17bdd0018c5..a521238515e 100644
--- a/src/devices/video/mos6566.cpp
+++ b/src/devices/video/mos6566.cpp
@@ -215,13 +215,13 @@ static const rgb_t PALETTE_MOS[] =
// DEVICE DEFINITIONS
//**************************************************************************
-const device_type MOS6566 = device_creator<mos6566_device>;
-const device_type MOS6567 = device_creator<mos6567_device>;
-const device_type MOS8562 = device_creator<mos8562_device>;
-const device_type MOS8564 = device_creator<mos8564_device>;
-const device_type MOS6569 = device_creator<mos6569_device>;
-const device_type MOS8565 = device_creator<mos8565_device>;
-const device_type MOS8566 = device_creator<mos8566_device>;
+DEFINE_DEVICE_TYPE(MOS6566, mos6566_device, "mos6566", "MOS 6566 VIC-II")
+DEFINE_DEVICE_TYPE(MOS6567, mos6567_device, "mos6567", "MOS 6567 VIC-II")
+DEFINE_DEVICE_TYPE(MOS8562, mos8562_device, "mos8562", "MOS 8562 VIC-II")
+DEFINE_DEVICE_TYPE(MOS8564, mos8564_device, "mos8564", "MOS 8564 VIC-II")
+DEFINE_DEVICE_TYPE(MOS6569, mos6569_device, "mos6569", "MOS 6569 VIC-II")
+DEFINE_DEVICE_TYPE(MOS8565, mos8565_device, "mos8565", "MOS 8565 VIC-II")
+DEFINE_DEVICE_TYPE(MOS8566, mos8566_device, "mos8566", "MOS 8566 VIC-II")
// default address maps
@@ -576,12 +576,12 @@ inline void mos6566_device::draw_multi( uint16_t p, uint8_t c0, uint8_t c1, uint
//-------------------------------------------------
mos6566_device::mos6566_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : mos6566_device(mconfig, MOS6566, "MOS6566", tag, owner, clock, TYPE_6566, "mos6566", __FILE__)
+ : mos6566_device(mconfig, MOS6566, tag, owner, clock, TYPE_6566)
{
}
-mos6566_device::mos6566_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, uint32_t variant, const char *shortname, const char *source)
- : device_t(mconfig, type, name, tag, owner, clock, shortname, source),
+mos6566_device::mos6566_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint32_t variant)
+ : device_t(mconfig, type, tag, owner, clock),
device_memory_interface(mconfig, *this),
device_video_interface(mconfig, *this),
device_execute_interface(mconfig, *this),
@@ -601,28 +601,44 @@ mos6566_device::mos6566_device(const machine_config &mconfig, device_type type,
}
mos6567_device::mos6567_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- :mos6566_device(mconfig, MOS6567, "MOS6567", tag, owner, clock, TYPE_6567, "mos6567", __FILE__) { }
+ : mos6567_device(mconfig, MOS6567, tag, owner, clock, TYPE_6567)
+{
+}
-mos6567_device::mos6567_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, uint32_t variant, const char *shortname, const char *source)
- :mos6566_device(mconfig, type, name, tag, owner, clock, variant, shortname, source) { }
+mos6567_device::mos6567_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint32_t variant)
+ : mos6566_device(mconfig, type, tag, owner, clock, variant)
+{
+}
mos8562_device::mos8562_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- :mos6567_device(mconfig, MOS8562, "MOS8562", tag, owner, clock, TYPE_8562, "mos8562", __FILE__) { }
+ : mos6567_device(mconfig, MOS8562, tag, owner, clock, TYPE_8562)
+{
+}
mos8564_device::mos8564_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- :mos6567_device(mconfig, MOS8564, "MOS8564", tag, owner, clock, TYPE_8564, "mos8564", __FILE__) { }
+ : mos6567_device(mconfig, MOS8564, tag, owner, clock, TYPE_8564)
+{
+}
mos6569_device::mos6569_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- :mos6566_device(mconfig, MOS6569, "MOS6569", tag, owner, clock, TYPE_6569, "mos6569", __FILE__) { }
+ : mos6569_device(mconfig, MOS6569, tag, owner, clock, TYPE_6569)
+{
+}
-mos6569_device::mos6569_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, uint32_t variant, const char *shortname, const char *source)
- :mos6566_device(mconfig, type, name, tag, owner, clock, variant, shortname, source) { }
+mos6569_device::mos6569_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint32_t variant)
+ : mos6566_device(mconfig, type, tag, owner, clock, variant)
+{
+}
mos8565_device::mos8565_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- :mos6569_device(mconfig, MOS8565, "MOS8565", tag, owner, clock, TYPE_8565, "mos8565", __FILE__) { }
+ : mos6569_device(mconfig, MOS8565, tag, owner, clock, TYPE_8565)
+{
+}
mos8566_device::mos8566_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- :mos6569_device(mconfig, MOS8566, "MOS8566", tag, owner, clock, TYPE_8566, "mos8566", __FILE__) { }
+ : mos6569_device(mconfig, MOS8566, tag, owner, clock, TYPE_8566)
+{
+}
//-------------------------------------------------
diff --git a/src/devices/video/mos6566.h b/src/devices/video/mos6566.h
index eedd627d6f9..b045286f1cf 100644
--- a/src/devices/video/mos6566.h
+++ b/src/devices/video/mos6566.h
@@ -77,10 +77,10 @@
***************************************************************************/
-#pragma once
+#ifndef MAME_VIDEO_MOS6566_H
+#define MAME_VIDEO_MOS6566_H
-#ifndef __MOS6566__
-#define __MOS6566__
+#pragma once
@@ -210,16 +210,15 @@ class mos6566_device : public device_t,
{
public:
// construction/destruction
- mos6566_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, uint32_t variant, const char *shortname, const char *source);
mos6566_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
static void static_set_cpu_tag(device_t &device, const char *tag) { downcast<mos6566_device &>(device).m_cpu.set_tag(tag); }
- template<class _Object> static devcb_base &set_irq_wr_callback(device_t &device, _Object object) { return downcast<mos6566_device &>(device).m_write_irq.set_callback(object); }
- template<class _Object> static devcb_base &set_ba_wr_callback(device_t &device, _Object object) { return downcast<mos6566_device &>(device).m_write_ba.set_callback(object); }
- template<class _Object> static devcb_base &set_aec_wr_callback(device_t &device, _Object object) { return downcast<mos6566_device &>(device).m_write_aec.set_callback(object); }
- template<class _Object> static devcb_base &set_k_wr_callback(device_t &device, _Object object) { return downcast<mos6566_device &>(device).m_write_k.set_callback(object); }
+ template <class Object> static devcb_base &set_irq_wr_callback(device_t &device, Object &&cb) { return downcast<mos6566_device &>(device).m_write_irq.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_ba_wr_callback(device_t &device, Object &&cb) { return downcast<mos6566_device &>(device).m_write_ba.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_aec_wr_callback(device_t &device, Object &&cb) { return downcast<mos6566_device &>(device).m_write_aec.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_k_wr_callback(device_t &device, Object &&cb) { return downcast<mos6566_device &>(device).m_write_k.set_callback(std::forward<Object>(cb)); }
- virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override;
+ virtual const address_space_config *memory_space_config(address_spacenum spacenum) const override;
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
@@ -250,17 +249,13 @@ protected:
TYPE_8569 // PAL-N VIC-IIe (C128)
};
+ mos6566_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint32_t variant);
+
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
virtual void execute_run() override;
- int m_icount;
- int m_variant;
-
- const address_space_config m_videoram_space_config;
- const address_space_config m_colorram_space_config;
-
inline void set_interrupt( int mask );
inline void clear_interrupt( int mask );
inline void set_ba(int state);
@@ -286,6 +281,12 @@ protected:
void draw_graphics();
void draw_sprites();
+ int m_icount;
+ const int m_variant;
+
+ const address_space_config m_videoram_space_config;
+ const address_space_config m_colorram_space_config;
+
devcb_write_line m_write_irq;
devcb_write_line m_write_ba;
devcb_write_line m_write_aec;
@@ -374,7 +375,9 @@ class mos6567_device : public mos6566_device
public:
// construction/destruction
mos6567_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- mos6567_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, uint32_t variant, const char *shortname, const char *source);
+
+protected:
+ mos6567_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint32_t variant);
};
@@ -396,6 +399,7 @@ public:
// construction/destruction
mos8564_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+protected:
// device_execute_interface overrides
virtual uint64_t execute_clocks_to_cycles(uint64_t clocks) const override { return (clocks / 8); }
virtual uint64_t execute_cycles_to_clocks(uint64_t cycles) const override { return (cycles * 8); }
@@ -409,7 +413,9 @@ class mos6569_device : public mos6566_device
public:
// construction/destruction
mos6569_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- mos6569_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, uint32_t variant, const char *shortname, const char *source);
+
+protected:
+ mos6569_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint32_t variant);
// device-level overrides
virtual void execute_run() override;
@@ -434,6 +440,7 @@ public:
// construction/destruction
mos8566_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+protected:
// device_execute_interface overrides
virtual uint64_t execute_clocks_to_cycles(uint64_t clocks) const override { return (clocks / 8); }
virtual uint64_t execute_cycles_to_clocks(uint64_t cycles) const override { return (cycles * 8); }
@@ -441,14 +448,12 @@ public:
// device type definitions
-extern const device_type MOS6566;
-extern const device_type MOS6567;
-extern const device_type MOS8562;
-extern const device_type MOS8564;
-extern const device_type MOS6569;
-extern const device_type MOS8565;
-extern const device_type MOS8566;
-
-
-
-#endif
+DECLARE_DEVICE_TYPE(MOS6566, mos6566_device)
+DECLARE_DEVICE_TYPE(MOS6567, mos6567_device)
+DECLARE_DEVICE_TYPE(MOS8562, mos8562_device)
+DECLARE_DEVICE_TYPE(MOS8564, mos8564_device)
+DECLARE_DEVICE_TYPE(MOS6569, mos6569_device)
+DECLARE_DEVICE_TYPE(MOS8565, mos8565_device)
+DECLARE_DEVICE_TYPE(MOS8566, mos8566_device)
+
+#endif // MAME_VIDEO_MOS6566_H
diff --git a/src/devices/video/msm6222b.cpp b/src/devices/video/msm6222b.cpp
index 632314a49dd..1e342e04084 100644
--- a/src/devices/video/msm6222b.cpp
+++ b/src/devices/video/msm6222b.cpp
@@ -13,28 +13,29 @@
#include "emu.h"
#include "msm6222b.h"
-const device_type MSM6222B = device_creator<msm6222b_device>;
-const device_type MSM6222B_01 = device_creator<msm6222b_01_device>;
+DEFINE_DEVICE_TYPE(MSM6222B, msm6222b_device, "msm6222b", "Oki MSM6222B-xx LCD Controller")
+DEFINE_DEVICE_TYPE(MSM6222B_01, msm6222b_01_device, "msm6222b01", "Oki MSM6222B-01 LCD Controller")
ROM_START( msm6222b_01 )
ROM_REGION( 0x1000, "cgrom", 0 )
ROM_LOAD( "msm6222b-01.bin", 0x0000, 0x1000, CRC(8ffa8521) SHA1(e108b520e6d20459a7bbd5958bbfa1d551a690bd) )
ROM_END
-msm6222b_device::msm6222b_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source) :
- device_t(mconfig, type, name, tag, owner, clock, shortname, source), cursor_direction(false), cursor_blinking(false), two_line(false), shift_on_write(false), double_height(false), cursor_on(false), display_on(false), adc(0), shift(0),
- m_cgrom(*this, finder_base::DUMMY_TAG)
+msm6222b_device::msm6222b_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) :
+ device_t(mconfig, type, tag, owner, clock),
+ m_cgrom(*this, finder_base::DUMMY_TAG),
+ cursor_direction(false), cursor_blinking(false), two_line(false), shift_on_write(false), double_height(false), cursor_on(false), display_on(false), adc(0), shift(0)
{
}
msm6222b_device::msm6222b_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, MSM6222B, "msm6222b-xx", tag, owner, clock, "msm6222b", __FILE__), cursor_direction(false), cursor_blinking(false), two_line(false), shift_on_write(false), double_height(false), cursor_on(false), display_on(false), adc(0), shift(0),
- m_cgrom(*this, DEVICE_SELF)
+ msm6222b_device(mconfig, MSM6222B, tag, owner, clock)
{
+ m_cgrom.set_tag(DEVICE_SELF);
}
msm6222b_01_device::msm6222b_01_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- msm6222b_device(mconfig, MSM6222B_01, "msm6222b-01", tag, owner, clock, "msm6222b01", __FILE__)
+ msm6222b_device(mconfig, MSM6222B_01, tag, owner, clock)
{
// load the fixed cgrom
m_cgrom.set_tag("cgrom");
diff --git a/src/devices/video/msm6222b.h b/src/devices/video/msm6222b.h
index c09bb0ee973..9cf3623e25f 100644
--- a/src/devices/video/msm6222b.h
+++ b/src/devices/video/msm6222b.h
@@ -10,8 +10,10 @@
***************************************************************************/
-#ifndef __MSM6222B_H__
-#define __MSM6222B_H__
+#ifndef MAME_VIDEO_MSM6222B_H
+#define MAME_VIDEO_MSM6222B_H
+
+#pragma once
#define MCFG_MSM6222B_ADD( _tag ) \
MCFG_DEVICE_ADD( _tag, MSM6222B, 0 )
@@ -22,7 +24,6 @@
class msm6222b_device : public device_t {
public:
msm6222b_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- msm6222b_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source);
void control_w(uint8_t data);
uint8_t control_r();
@@ -33,20 +34,22 @@ public:
const uint8_t *render();
protected:
+ msm6222b_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
+
virtual void device_start() override;
+ optional_region_ptr<uint8_t> m_cgrom;
+
+ void cursor_step(bool direction);
+ void shift_step(bool direction);
+ bool blink_on() const;
+
private:
uint8_t cgram[8*8];
uint8_t ddram[80];
uint8_t render_buf[80*16];
bool cursor_direction, cursor_blinking, two_line, shift_on_write, double_height, cursor_on, display_on;
uint8_t adc, shift;
-protected:
- optional_region_ptr<uint8_t> m_cgrom;
-
- void cursor_step(bool direction);
- void shift_step(bool direction);
- bool blink_on() const;
};
class msm6222b_01_device : public msm6222b_device {
@@ -57,7 +60,7 @@ protected:
virtual const tiny_rom_entry *device_rom_region() const override;
};
-extern const device_type MSM6222B;
-extern const device_type MSM6222B_01;
+DECLARE_DEVICE_TYPE(MSM6222B, msm6222b_device)
+DECLARE_DEVICE_TYPE(MSM6222B_01, msm6222b_01_device)
-#endif
+#endif // MAME_VIDEO_MSM6222B_H
diff --git a/src/devices/video/msm6255.cpp b/src/devices/video/msm6255.cpp
index 516dd8a0f12..d7ee5ce7903 100644
--- a/src/devices/video/msm6255.cpp
+++ b/src/devices/video/msm6255.cpp
@@ -9,15 +9,14 @@
#include "emu.h"
#include "msm6255.h"
+//#define VERBOSE 1
+#include "logmacro.h"
//**************************************************************************
// MACROS / CONSTANTS
//**************************************************************************
-#define LOG 0
-
-
#define MOR_GRAPHICS 0x01
#define MOR_4_BIT_PARALLEL 0x02
#define MOR_2_BIT_PARALLEL 0x04
@@ -52,7 +51,7 @@
//**************************************************************************
// device type definition
-const device_type MSM6255 = device_creator<msm6255_device>;
+DEFINE_DEVICE_TYPE(MSM6255, msm6255_device, "msm6255", "Oki MSM6255 LCD Controller")
// I/O map
DEVICE_ADDRESS_MAP_START( map, 8, msm6255_device )
@@ -76,7 +75,7 @@ ADDRESS_MAP_END
//-------------------------------------------------
msm6255_device::msm6255_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, MSM6255, "MSM6255", tag, owner, clock, "msm6255", __FILE__),
+ device_t(mconfig, MSM6255, tag, owner, clock),
device_memory_interface(mconfig, *this),
device_video_interface(mconfig, *this),
m_space_config("videoram", ENDIANNESS_LITTLE, 8, 20, 0, nullptr, *ADDRESS_MAP_NAME(msm6255)),
diff --git a/src/devices/video/msm6255.h b/src/devices/video/msm6255.h
index 45e43d24b20..8028d69f86c 100644
--- a/src/devices/video/msm6255.h
+++ b/src/devices/video/msm6255.h
@@ -6,11 +6,10 @@
**********************************************************************/
-#pragma once
-
-#ifndef __MSM6255__
-#define __MSM6255__
+#ifndef MAME_VIDEO_MSM6255_H
+#define MAME_VIDEO_MSM6255_H
+#pragma once
@@ -44,7 +43,7 @@ protected:
virtual void device_reset() override;
// device_memory_interface overrides
- virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override;
+ virtual const address_space_config *memory_space_config(address_spacenum spacenum) const override;
private:
// registers
@@ -87,8 +86,6 @@ private:
// device type definition
-extern const device_type MSM6255;
-
-
+DECLARE_DEVICE_TYPE(MSM6255, msm6255_device)
-#endif
+#endif // MAME_VIDEO_MSM6255_H
diff --git a/src/devices/video/pc_vga.cpp b/src/devices/video/pc_vga.cpp
index b6869a63b59..076f93aeb7e 100644
--- a/src/devices/video/pc_vga.cpp
+++ b/src/devices/video/pc_vga.cpp
@@ -121,78 +121,78 @@ enum
***************************************************************************/
// device type definition
-const device_type VGA = device_creator<vga_device>;
-const device_type TSENG_VGA = device_creator<tseng_vga_device>;
-const device_type S3_VGA = device_creator<s3_vga_device>;
-const device_type GAMTOR_VGA = device_creator<gamtor_vga_device>;
-const device_type ATI_VGA = device_creator<ati_vga_device>;
-const device_type IBM8514A = device_creator<ibm8514a_device>;
-const device_type MACH8 = device_creator<mach8_device>;
-
-vga_device::vga_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source)
- : device_t(mconfig, type, name, tag, owner, clock, shortname, source)
+DEFINE_DEVICE_TYPE(VGA, vga_device, "vga", "VGA")
+DEFINE_DEVICE_TYPE(TSENG_VGA, tseng_vga_device, "tseng_vga", "Tseng Labs VGA")
+DEFINE_DEVICE_TYPE(S3_VGA, s3_vga_device, "s3_vga", "S3 Graphics VGA")
+DEFINE_DEVICE_TYPE(GAMTOR_VGA, gamtor_vga_device, "gamtor_vga", "GAMTOR VGA")
+DEFINE_DEVICE_TYPE(ATI_VGA, ati_vga_device, "ati_vga", "ATi VGA")
+DEFINE_DEVICE_TYPE(IBM8514A, ibm8514a_device, "ibm8514a", "IBM 8514/A Video")
+DEFINE_DEVICE_TYPE(MACH8, mach8_device, "mach8", "Mach8")
+
+vga_device::vga_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
+ : device_t(mconfig, type, tag, owner, clock)
, m_palette(*this, "^palette")
, m_screen(*this,"^screen")
{
}
vga_device::vga_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : vga_device(mconfig, VGA, "VGA", tag, owner, clock, "vga", __FILE__)
+ : vga_device(mconfig, VGA, tag, owner, clock)
{
}
-svga_device::svga_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source)
- : vga_device(mconfig, type, name, tag, owner, clock, shortname, source)
+svga_device::svga_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
+ : vga_device(mconfig, type, tag, owner, clock)
{
}
tseng_vga_device::tseng_vga_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : svga_device(mconfig, TSENG_VGA, "TSENG LABS VGA", tag, owner, clock, "tseng_vga", __FILE__)
+ : svga_device(mconfig, TSENG_VGA, tag, owner, clock)
{
}
s3_vga_device::s3_vga_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : s3_vga_device(mconfig, S3_VGA, "S3 Graphics VGA", tag, owner, clock, "s3_vga", __FILE__)
+ : s3_vga_device(mconfig, S3_VGA, tag, owner, clock)
{
}
-s3_vga_device::s3_vga_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source)
- : ati_vga_device(mconfig, type, name, tag, owner, clock, shortname, source)
+s3_vga_device::s3_vga_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
+ : ati_vga_device(mconfig, type, tag, owner, clock)
{
}
gamtor_vga_device::gamtor_vga_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : svga_device(mconfig, GAMTOR_VGA, "GAMTOR VGA", tag, owner, clock, "gamtor_vga", __FILE__)
+ : svga_device(mconfig, GAMTOR_VGA, tag, owner, clock)
{
}
ati_vga_device::ati_vga_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : ati_vga_device(mconfig, ATI_VGA, "ATI VGA", tag, owner, clock, "ati_vga", __FILE__)
+ : ati_vga_device(mconfig, ATI_VGA, tag, owner, clock)
{
}
-ati_vga_device::ati_vga_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source)
- : svga_device(mconfig, type, name, tag, owner, clock, shortname, source)
+ati_vga_device::ati_vga_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
+ : svga_device(mconfig, type, tag, owner, clock)
{
}
ibm8514a_device::ibm8514a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : ibm8514a_device(mconfig, IBM8514A, "IBM8514A Video", tag, owner, clock, "ibm8514a", __FILE__)
+ : ibm8514a_device(mconfig, IBM8514A, tag, owner, clock)
{
}
-ibm8514a_device::ibm8514a_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source)
- : device_t(mconfig, type, name, tag, owner, clock, shortname, source)
+ibm8514a_device::ibm8514a_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
+ : device_t(mconfig, type, tag, owner, clock)
{
}
-mach8_device::mach8_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source)
- : ibm8514a_device(mconfig, type, name, tag, owner, clock, shortname, source)
+mach8_device::mach8_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
+ : ibm8514a_device(mconfig, type, tag, owner, clock)
{
}
mach8_device::mach8_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : mach8_device(mconfig, MACH8, "MACH8", tag, owner, clock, "mach8", __FILE__)
+ : mach8_device(mconfig, MACH8, tag, owner, clock)
{
}
diff --git a/src/devices/video/pc_vga.h b/src/devices/video/pc_vga.h
index dbfad026886..1107282b8c2 100644
--- a/src/devices/video/pc_vga.h
+++ b/src/devices/video/pc_vga.h
@@ -8,8 +8,8 @@
***************************************************************************/
-#ifndef MAME_DEVICES_VIDEO_PC_VGA_H
-#define MAME_DEVICES_VIDEO_PC_VGA_H
+#ifndef MAME_VIDEO_PC_VGA_H
+#define MAME_VIDEO_PC_VGA_H
#include "screen.h"
@@ -18,21 +18,6 @@ MACHINE_CONFIG_EXTERN( pcvideo_trident_vga );
MACHINE_CONFIG_EXTERN( pcvideo_gamtor_vga );
MACHINE_CONFIG_EXTERN( pcvideo_s3_vga );
-enum
-{
- SCREEN_OFF = 0,
- TEXT_MODE,
- VGA_MODE,
- EGA_MODE,
- CGA_MODE,
- MONO_MODE,
- RGB8_MODE,
- RGB15_MODE,
- RGB16_MODE,
- RGB24_MODE,
- RGB32_MODE
-};
-
// ======================> vga_device
class vga_device : public device_t
@@ -59,7 +44,22 @@ public:
virtual TIMER_CALLBACK_MEMBER(vblank_timer_cb);
protected:
- vga_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source);
+ enum
+ {
+ SCREEN_OFF = 0,
+ TEXT_MODE,
+ VGA_MODE,
+ EGA_MODE,
+ CGA_MODE,
+ MONO_MODE,
+ RGB8_MODE,
+ RGB15_MODE,
+ RGB16_MODE,
+ RGB24_MODE,
+ RGB32_MODE
+ };
+
+ vga_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
virtual void device_start() override;
@@ -89,20 +89,20 @@ protected:
{
uint8_t res = 0;
- switch(vga.gc.logical_op & 3)
+ switch (vga.gc.logical_op & 3)
{
- case 0: /* NONE */
- res = (data & mask) | (vga.gc.latch[plane] & ~mask);
- break;
- case 1: /* AND */
- res = (data | ~mask) & (vga.gc.latch[plane]);
- break;
- case 2: /* OR */
- res = (data & mask) | (vga.gc.latch[plane]);
- break;
- case 3: /* XOR */
- res = (data & mask) ^ (vga.gc.latch[plane]);
- break;
+ case 0: /* NONE */
+ res = (data & mask) | (vga.gc.latch[plane] & ~mask);
+ break;
+ case 1: /* AND */
+ res = (data | ~mask) & (vga.gc.latch[plane]);
+ break;
+ case 2: /* OR */
+ res = (data & mask) | (vga.gc.latch[plane]);
+ break;
+ case 3: /* XOR */
+ res = (data & mask) ^ (vga.gc.latch[plane]);
+ break;
}
return res;
@@ -238,7 +238,7 @@ protected:
// device type definition
-extern const device_type VGA;
+DECLARE_DEVICE_TYPE(VGA, vga_device)
// ======================> svga_device
@@ -250,7 +250,7 @@ public:
protected:
// construction/destruction
- svga_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source);
+ svga_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
void svga_vh_rgb8(bitmap_rgb32 &bitmap, const rectangle &cliprect);
void svga_vh_rgb15(bitmap_rgb32 &bitmap, const rectangle &cliprect);
@@ -380,8 +380,9 @@ public:
uint8_t wait_vector_count;
} ibm8514;
+
protected:
- ibm8514a_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source);
+ ibm8514a_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
virtual void device_start() override;
virtual void device_config_complete() override;
@@ -402,7 +403,7 @@ private:
};
// device type definition
-extern const device_type IBM8514A;
+DECLARE_DEVICE_TYPE(IBM8514A, ibm8514a_device)
#define MCFG_8514A_ADD(_tag, _param) \
MCFG_DEVICE_ADD(_tag, IBM8514A, 0) \
@@ -413,7 +414,7 @@ extern const device_type IBM8514A;
downcast<ibm8514a_device*>(device)->set_vga_owner();
-class mach8_device : public ibm8514a_device
+class mach8_device : public ibm8514a_device
{
public:
mach8_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
@@ -445,7 +446,7 @@ public:
READ16_MEMBER(mach8_clksel_r) { return mach8.clksel; }
protected:
- mach8_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source);
+ mach8_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
virtual void device_start() override;
struct
{
@@ -457,7 +458,7 @@ protected:
};
// device type definition
-extern const device_type MACH8;
+DECLARE_DEVICE_TYPE(MACH8, mach8_device)
#define MCFG_MACH8_ADD(_tag, _param) \
MCFG_DEVICE_ADD(_tag, MACH8, 0) \
@@ -511,12 +512,12 @@ private:
// device type definition
-extern const device_type TSENG_VGA;
+DECLARE_DEVICE_TYPE(TSENG_VGA, tseng_vga_device)
// ======================> ati_vga_device
-class ati_vga_device : public svga_device
+class ati_vga_device : public svga_device
{
public:
// construction/destruction
@@ -535,7 +536,7 @@ public:
mach8_device* get_8514() { return m_8514; }
protected:
- ati_vga_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source);
+ ati_vga_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
virtual void device_start() override;
private:
void ati_define_video_mode();
@@ -549,7 +550,7 @@ private:
};
// device type definition
-extern const device_type ATI_VGA;
+DECLARE_DEVICE_TYPE(ATI_VGA, ati_vga_device)
// ======================> s3_vga_device
@@ -577,7 +578,7 @@ public:
ibm8514a_device* get_8514() { return m_8514; }
protected:
- s3_vga_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source);
+ s3_vga_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
virtual void device_start() override;
@@ -640,7 +641,7 @@ private:
};
// device type definition
-extern const device_type S3_VGA;
+DECLARE_DEVICE_TYPE(S3_VGA, s3_vga_device)
// ======================> gamtor_vga_device
@@ -663,7 +664,7 @@ public:
// device type definition
-extern const device_type GAMTOR_VGA;
+DECLARE_DEVICE_TYPE(GAMTOR_VGA, gamtor_vga_device)
/*
pega notes (paradise)
@@ -706,4 +707,4 @@ extern const device_type GAMTOR_VGA;
*/
-#endif /* MAME_DEVICES_VIDEO_PC_VGA_H */
+#endif // MAME_VIDEO_PC_VGA_H
diff --git a/src/devices/video/pcd8544.cpp b/src/devices/video/pcd8544.cpp
index 89ce964d6c0..0cca6742b05 100644
--- a/src/devices/video/pcd8544.cpp
+++ b/src/devices/video/pcd8544.cpp
@@ -11,14 +11,15 @@
#include "screen.h"
+//#define VERBOSE 1
+#include "logmacro.h"
-#define LOG 0
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
-const device_type PCD8544 = device_creator<pcd8544_device>;
+DEFINE_DEVICE_TYPE(PCD8544, pcd8544_device, "pcd8544_device", "Philips PCD8544 LCD Controller")
//**************************************************************************
@@ -30,7 +31,7 @@ const device_type PCD8544 = device_creator<pcd8544_device>;
//-------------------------------------------------
pcd8544_device::pcd8544_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, PCD8544, "PCD8544", tag, owner, clock, "pcd8544", __FILE__)
+ device_t(mconfig, PCD8544, tag, owner, clock)
{
}
@@ -85,7 +86,7 @@ void pcd8544_device::exec_command(uint8_t cmd)
if(cmd & 0x80)
{
m_op_vol = cmd & 0x7f;
- if (LOG) logerror("PCD8544: set Vop %d\n", m_op_vol);
+ LOG("PCD8544: set Vop %d\n", m_op_vol);
}
else if(cmd & 0x40)
{
@@ -94,12 +95,12 @@ void pcd8544_device::exec_command(uint8_t cmd)
else if(cmd & 0x20)
{
m_mode = cmd & 0x07;
- if (LOG) logerror("PCD8544: set PD=%d V=%d H=%d\n", BIT(m_mode, 2), BIT(m_mode, 1), BIT(m_mode, 0));
+ LOG("PCD8544: set PD=%d V=%d H=%d\n", BIT(m_mode, 2), BIT(m_mode, 1), BIT(m_mode, 0));
}
else if(cmd & 0x10)
{
m_bias = cmd & 0x07;
- if (LOG) logerror("PCD8544: set bias system %d\n", m_bias);
+ LOG("PCD8544: set bias system %d\n", m_bias);
}
else if(cmd & 0x08)
{
@@ -108,7 +109,7 @@ void pcd8544_device::exec_command(uint8_t cmd)
else if(cmd & 0x04)
{
m_temp_coef = cmd & 0x03;
- if (LOG) logerror("PCD8544: set temperature coefficient %d\n", m_temp_coef);
+ LOG("PCD8544: set temperature coefficient %d\n", m_temp_coef);
}
else if (cmd)
{
@@ -120,17 +121,17 @@ void pcd8544_device::exec_command(uint8_t cmd)
if(cmd & 0x80)
{
m_addr_x = (cmd & 0x7f) % 84;
- if (LOG) logerror("PCD8544: set X-address %d\n", cmd & 0x7f);
+ LOG("PCD8544: set X-address %d\n", cmd & 0x7f);
}
else if(cmd & 0x40)
{
m_addr_y = (cmd & 0x07) % 6;
- if (LOG) logerror("PCD8544: set Y-address %d\n", cmd & 0x07);
+ LOG("PCD8544: set Y-address %d\n", cmd & 0x07);
}
else if(cmd & 0x20)
{
m_mode = cmd & 0x07;
- if (LOG) logerror("PCD8544: set PD=%d V=%d H=%d\n", BIT(m_mode, 2), BIT(m_mode, 1), BIT(m_mode, 0));
+ LOG("PCD8544: set PD=%d V=%d H=%d\n", BIT(m_mode, 2), BIT(m_mode, 1), BIT(m_mode, 0));
}
else if(cmd & 0x10)
{
@@ -139,7 +140,7 @@ void pcd8544_device::exec_command(uint8_t cmd)
else if(cmd & 0x08)
{
m_control = ((cmd & 0x04) >> 1) | (cmd & 0x01);
- if (LOG) logerror("PCD8544: set D=%d E=%d\n", BIT(m_control, 1), BIT(m_control, 0));
+ LOG("PCD8544: set D=%d E=%d\n", BIT(m_control, 1), BIT(m_control, 0));
}
else if (cmd)
{
diff --git a/src/devices/video/pcd8544.h b/src/devices/video/pcd8544.h
index e8066f6eb65..8a5c71e6e95 100644
--- a/src/devices/video/pcd8544.h
+++ b/src/devices/video/pcd8544.h
@@ -6,24 +6,23 @@
***************************************************************************/
-#pragma once
+#ifndef MAME_VIDEO_PCD8544_H
+#define MAME_VIDEO_PCD8544_H
-#ifndef __PCD8544_H__
-#define __PCD8544_H__
+#pragma once
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
-typedef device_delegate<void (device_t &device, bitmap_ind16 &bitmap, const rectangle &cliprect , uint8_t *vram, int inv)> pcd8544_screen_update_delegate;
#define PCD8544_SCREEN_UPDATE(name) void name(device_t &device, bitmap_ind16 &bitmap, const rectangle &cliprect , uint8_t *vram, int inv)
#define MCFG_PCD8544_ADD( _tag ) \
MCFG_DEVICE_ADD( _tag, PCD8544, 0 )
#define MCFG_PCD8544_SCREEN_UPDATE_CALLBACK(_class, _method) \
- pcd8544_device::static_set_screen_update_cb(*device, pcd8544_screen_update_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
+ pcd8544_device::static_set_screen_update_cb(*device, pcd8544_device::screen_update_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
// ======================> pcd8544_device
@@ -31,9 +30,11 @@ typedef device_delegate<void (device_t &device, bitmap_ind16 &bitmap, const rect
class pcd8544_device : public device_t
{
public:
+ typedef device_delegate<void (device_t &device, bitmap_ind16 &bitmap, const rectangle &cliprect , uint8_t *vram, int inv)> screen_update_delegate;
+
// construction/destruction
pcd8544_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- static void static_set_screen_update_cb(device_t &device, pcd8544_screen_update_delegate _cb) { downcast<pcd8544_device &>(device).m_screen_update_cb = _cb; }
+ static void static_set_screen_update_cb(device_t &device, screen_update_delegate &&cb) { downcast<pcd8544_device &>(device).m_screen_update_cb = std::move(cb); }
// device interface
DECLARE_WRITE_LINE_MEMBER(sdin_w);
@@ -50,7 +51,7 @@ protected:
void write_data(uint8_t data);
private:
- pcd8544_screen_update_delegate m_screen_update_cb; // screen update callback
+ screen_update_delegate m_screen_update_cb; // screen update callback
int m_sdin;
int m_sclk;
int m_dc;
@@ -67,6 +68,6 @@ private:
};
// device type definition
-extern const device_type PCD8544;
+DECLARE_DEVICE_TYPE(PCD8544, pcd8544_device)
-#endif
+#endif // MAME_VIDEO_PCD8544_H
diff --git a/src/devices/video/poly.h b/src/devices/video/poly.h
index a8b606bc08e..2c88c29a47f 100644
--- a/src/devices/video/poly.h
+++ b/src/devices/video/poly.h
@@ -32,8 +32,8 @@
***************************************************************************/
-#ifndef MAME_DEVICES_VIDEO_POLY_H
-#define MAME_DEVICES_VIDEO_POLY_H
+#ifndef MAME_VIDEO_POLY_H
+#define MAME_VIDEO_POLY_H
#pragma once
@@ -50,56 +50,21 @@
// keep statistics
#define KEEP_POLY_STATISTICS 0
-// turn this on to log the reasons for any long waits
-#define LOG_WAITS 0
-
-// number of profiling ticks before we consider a wait "long"
-#define LOG_WAIT_THRESHOLD 1000
-
-
-
-/***************************************************************************
- CONSTANTS
-***************************************************************************/
-
-#define POLYFLAG_INCLUDE_BOTTOM_EDGE 0x01
-#define POLYFLAG_INCLUDE_RIGHT_EDGE 0x02
-#define POLYFLAG_NO_WORK_QUEUE 0x04
-
-#define SCANLINES_PER_BUCKET 8
-#define CACHE_LINE_SIZE 64 // this is a general guess
-#define TOTAL_BUCKETS (512 / SCANLINES_PER_BUCKET)
-#define UNITS_PER_POLY (100 / SCANLINES_PER_BUCKET)
-
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
-//-------------------------------------------------
-// global helpers for float base types
-//-------------------------------------------------
-
-inline float poly_floor(float x) { return floorf(x); }
-inline float poly_abs(float x) { return fabsf(x); }
-inline float poly_recip(float x) { return 1.0f / x; }
-
-
-//-------------------------------------------------
-// global helpers for double base types
-//-------------------------------------------------
-
-inline double poly_floor(double x) { return floor(x); }
-inline double poly_abs(double x) { return fabs(x); }
-inline double poly_recip(double x) { return 1.0 / x; }
-
-
// poly_manager is a template class
template<typename _BaseType, class _ObjectData, int _MaxParams, int _MaxPolys>
class poly_manager
{
public:
+ static constexpr uint8_t FLAG_INCLUDE_BOTTOM_EDGE = 0x01;
+ static constexpr uint8_t FLAG_INCLUDE_RIGHT_EDGE = 0x02;
+ static constexpr uint8_t FLAG_NO_WORK_QUEUE = 0x04;
+
// each vertex has an X/Y coordinate and a set of parameters
struct vertex_t
{
@@ -159,6 +124,17 @@ public:
int zclip_if_less(int numverts, const vertex_t *v, vertex_t *outv, int paramcount, _BaseType clipval);
private:
+ // turn this on to log the reasons for any long waits
+ static constexpr bool POLY_LOG_WAITS = false;
+
+ // number of profiling ticks before we consider a wait "long"
+ static constexpr osd_ticks_t POLY_LOG_WAIT_THRESHOLD = 1000;
+
+ static constexpr int SCANLINES_PER_BUCKET = 8;
+ static constexpr int CACHE_LINE_SIZE = 64; // this is a general guess
+ static constexpr int TOTAL_BUCKETS = (512 / SCANLINES_PER_BUCKET);
+ static constexpr int UNITS_PER_POLY = (100 / SCANLINES_PER_BUCKET);
+
// polygon_info describes a single polygon, which includes the poly_params
struct polygon_info
{
@@ -180,6 +156,24 @@ private:
extent_t extent[SCANLINES_PER_BUCKET]; // array of scanline extents
};
+ //-------------------------------------------------
+ // global helpers for float base types
+ //-------------------------------------------------
+
+ static float poly_floor(float x) { return floorf(x); }
+ static float poly_abs(float x) { return fabsf(x); }
+ static float poly_recip(float x) { return 1.0f / x; }
+
+
+ //-------------------------------------------------
+ // global helpers for double base types
+ //-------------------------------------------------
+
+ static double poly_floor(double x) { return floor(x); }
+ static double poly_abs(double x) { return fabs(x); }
+ static double poly_recip(double x) { return 1.0 / x; }
+
+
// class for managing an array of items
template<class _Type, int _Count>
class poly_array
@@ -309,7 +303,7 @@ poly_manager<_BaseType, _ObjectData, _MaxParams, _MaxPolys>::poly_manager(runnin
#endif
// create the work queue
- if (!(flags & POLYFLAG_NO_WORK_QUEUE))
+ if (!(flags & FLAG_NO_WORK_QUEUE))
m_queue = osd_work_queue_alloc(WORK_QUEUE_FLAG_MULTI | WORK_QUEUE_FLAG_HIGH_FREQ);
// request a pre-save callback for synchronization
@@ -336,7 +330,7 @@ poly_manager<_BaseType, _ObjectData, _MaxParams, _MaxPolys>::poly_manager(screen
#endif
// create the work queue
- if (!(flags & POLYFLAG_NO_WORK_QUEUE))
+ if (!(flags & FLAG_NO_WORK_QUEUE))
m_queue = osd_work_queue_alloc(WORK_QUEUE_FLAG_MULTI | WORK_QUEUE_FLAG_HIGH_FREQ);
// request a pre-save callback for synchronization
@@ -454,7 +448,7 @@ void poly_manager<_BaseType, _ObjectData, _MaxParams, _MaxPolys>::wait(const cha
osd_ticks_t time;
// remember the start time if we're logging
- if (LOG_WAITS)
+ if (POLY_LOG_WAITS)
time = get_profile_ticks();
// wait for all pending work items to complete
@@ -467,10 +461,10 @@ void poly_manager<_BaseType, _ObjectData, _MaxParams, _MaxPolys>::wait(const cha
work_item_callback(&m_unit[unitnum], 0);
// log any long waits
- if (LOG_WAITS)
+ if (POLY_LOG_WAITS)
{
time = get_profile_ticks() - time;
- if (time > LOG_WAIT_THRESHOLD)
+ if (time > POLY_LOG_WAIT_THRESHOLD)
machine().logerror("Poly:Waited %d cycles for %s\n", (int)time, debug_reason);
}
@@ -528,7 +522,7 @@ uint32_t poly_manager<_BaseType, _ObjectData, _MaxParams, _MaxPolys>::render_til
// clip coordinates
int32_t v1yclip = v1y;
- int32_t v2yclip = v2y + ((m_flags & POLYFLAG_INCLUDE_BOTTOM_EDGE) ? 1 : 0);
+ int32_t v2yclip = v2y + ((m_flags & FLAG_INCLUDE_BOTTOM_EDGE) ? 1 : 0);
v1yclip = std::max(v1yclip, cliprect.min_y);
v2yclip = std::min(v2yclip, cliprect.max_y + 1);
if (v2yclip - v1yclip <= 0)
@@ -570,7 +564,7 @@ uint32_t poly_manager<_BaseType, _ObjectData, _MaxParams, _MaxPolys>::render_til
}
// include the right edge if requested
- if (m_flags & POLYFLAG_INCLUDE_RIGHT_EDGE)
+ if (m_flags & FLAG_INCLUDE_RIGHT_EDGE)
istopx++;
// apply left/right clipping
@@ -673,7 +667,7 @@ uint32_t poly_manager<_BaseType, _ObjectData, _MaxParams, _MaxPolys>::render_tri
// clip coordinates
int32_t v1yclip = v1y;
- int32_t v3yclip = v3y + ((m_flags & POLYFLAG_INCLUDE_BOTTOM_EDGE) ? 1 : 0);
+ int32_t v3yclip = v3y + ((m_flags & FLAG_INCLUDE_BOTTOM_EDGE) ? 1 : 0);
v1yclip = std::max(v1yclip, cliprect.min_y);
v3yclip = std::min(v3yclip, cliprect.max_y + 1);
if (v3yclip - v1yclip <= 0)
@@ -784,7 +778,7 @@ uint32_t poly_manager<_BaseType, _ObjectData, _MaxParams, _MaxPolys>::render_tri
}
// include the right edge if requested
- if (m_flags & POLYFLAG_INCLUDE_RIGHT_EDGE)
+ if (m_flags & FLAG_INCLUDE_RIGHT_EDGE)
istopx++;
// apply left/right clipping
@@ -971,7 +965,7 @@ uint32_t poly_manager<_BaseType, _ObjectData, _MaxParams, _MaxPolys>::render_pol
// clip coordinates
int32_t minyclip = miny;
- int32_t maxyclip = maxy + ((m_flags & POLYFLAG_INCLUDE_BOTTOM_EDGE) ? 1 : 0);
+ int32_t maxyclip = maxy + ((m_flags & FLAG_INCLUDE_BOTTOM_EDGE) ? 1 : 0);
minyclip = std::max(minyclip, cliprect.min_y);
maxyclip = std::min(maxyclip, cliprect.max_y + 1);
if (maxyclip - minyclip <= 0)
@@ -1104,7 +1098,7 @@ uint32_t poly_manager<_BaseType, _ObjectData, _MaxParams, _MaxPolys>::render_pol
}
// include the right edge if requested
- if (m_flags & POLYFLAG_INCLUDE_RIGHT_EDGE)
+ if (m_flags & FLAG_INCLUDE_RIGHT_EDGE)
istopx++;
// apply left/right clipping
diff --git a/src/devices/video/polylgcy.cpp b/src/devices/video/polylgcy.cpp
index 5e8383062ca..2b3f8ccee02 100644
--- a/src/devices/video/polylgcy.cpp
+++ b/src/devices/video/polylgcy.cpp
@@ -10,8 +10,12 @@
#include "emu.h"
#include "polylgcy.h"
+
#include <atomic>
+
+namespace {
+
/***************************************************************************
DEBUGGING
***************************************************************************/
@@ -71,7 +75,7 @@ struct poly_edge
const poly_vertex * v1; /* pointer to first vertex */
const poly_vertex * v2; /* pointer to second vertex */
float dxdy; /* dx/dy along the edge */
- float dpdy[MAX_VERTEX_PARAMS];/* per-parameter dp/dy values */
+ float dpdy[POLYLGCY_MAX_VERTEX_PARAMS];/* per-parameter dp/dy values */
};
@@ -133,9 +137,11 @@ struct polygon_info
poly_draw_scanline_func callback; /* callback to handle a scanline's worth of work */
int32_t xorigin; /* X origin for all parameters */
int32_t yorigin; /* Y origin for all parameters */
- poly_param param[MAX_VERTEX_PARAMS];/* array of parameter data */
+ poly_param param[POLYLGCY_MAX_VERTEX_PARAMS];/* array of parameter data */
};
+} // anonymous namespace
+
/* full poly manager description */
struct legacy_poly_manager
@@ -331,13 +337,13 @@ legacy_poly_manager *poly_alloc(running_machine &machine, int max_polys, size_t
poly->extra = allocate_array(machine, &poly->extra_size, poly->extra_count);
/* allocate triangle work units */
- poly->unit_size = (flags & POLYFLAG_ALLOW_QUADS) ? sizeof(quad_work_unit) : sizeof(tri_work_unit);
+ poly->unit_size = (flags & POLYLGCY_FLAG_ALLOW_QUADS) ? sizeof(quad_work_unit) : sizeof(tri_work_unit);
poly->unit_count = std::min(poly->polygon_count * UNITS_PER_POLY, 65535U);
poly->unit_next = 0;
poly->unit = (work_unit **)allocate_array(machine, &poly->unit_size, poly->unit_count);
/* create the work queue */
- if (!(flags & POLYFLAG_NO_WORK_QUEUE))
+ if (!(flags & POLYLGCY_FLAG_NO_WORK_QUEUE))
poly->queue = osd_work_queue_alloc(WORK_QUEUE_FLAG_MULTI | WORK_QUEUE_FLAG_HIGH_FREQ);
/* request a pre-save callback for synchronization */
@@ -500,7 +506,7 @@ uint32_t poly_render_triangle(legacy_poly_manager *poly, void *dest, const recta
/* clip coordinates */
v1yclip = v1y;
- v3yclip = v3y + ((poly->flags & POLYFLAG_INCLUDE_BOTTOM_EDGE) ? 1 : 0);
+ v3yclip = v3y + ((poly->flags & POLYLGCY_FLAG_INCLUDE_BOTTOM_EDGE) ? 1 : 0);
v1yclip = std::max(v1yclip, cliprect.min_y);
v3yclip = std::min(v3yclip, cliprect.max_y + 1);
if (v3yclip - v1yclip <= 0)
@@ -572,7 +578,7 @@ uint32_t poly_render_triangle(legacy_poly_manager *poly, void *dest, const recta
}
/* include the right edge if requested */
- if (poly->flags & POLYFLAG_INCLUDE_RIGHT_EDGE)
+ if (poly->flags & POLYLGCY_FLAG_INCLUDE_RIGHT_EDGE)
istopx++;
/* apply left/right clipping */
@@ -772,7 +778,7 @@ uint32_t poly_render_quad(legacy_poly_manager *poly, void *dest, const rectangle
int32_t pixels = 0;
uint32_t startunit;
- assert(poly->flags & POLYFLAG_ALLOW_QUADS);
+ assert(poly->flags & POLYLGCY_FLAG_ALLOW_QUADS);
/* arrays make things easier */
v[0] = v1;
@@ -800,7 +806,7 @@ uint32_t poly_render_quad(legacy_poly_manager *poly, void *dest, const rectangle
/* clip coordinates */
minyclip = miny;
- maxyclip = maxy + ((poly->flags & POLYFLAG_INCLUDE_BOTTOM_EDGE) ? 1 : 0);
+ maxyclip = maxy + ((poly->flags & POLYLGCY_FLAG_INCLUDE_BOTTOM_EDGE) ? 1 : 0);
minyclip = std::max(minyclip, cliprect.min_y);
maxyclip = std::min(maxyclip, cliprect.max_y + 1);
if (maxyclip - minyclip <= 0)
@@ -937,7 +943,7 @@ uint32_t poly_render_quad(legacy_poly_manager *poly, void *dest, const rectangle
}
/* include the right edge if requested */
- if (poly->flags & POLYFLAG_INCLUDE_RIGHT_EDGE)
+ if (poly->flags & POLYLGCY_FLAG_INCLUDE_RIGHT_EDGE)
istopx++;
/* apply left/right clipping */
@@ -1002,7 +1008,7 @@ uint32_t poly_render_quad_fan(legacy_poly_manager *poly, void *dest, const recta
uint32_t poly_render_polygon(legacy_poly_manager *poly, void *dest, const rectangle &cliprect, poly_draw_scanline_func callback, int paramcount, int numverts, const poly_vertex *v)
{
- poly_edge fedgelist[MAX_POLYGON_VERTS - 1], bedgelist[MAX_POLYGON_VERTS - 1];
+ poly_edge fedgelist[POLYLGCY_MAX_POLYGON_VERTS - 1], bedgelist[POLYLGCY_MAX_POLYGON_VERTS - 1];
const poly_edge *ledge, *redge;
poly_edge *edgeptr;
int minv, maxv, curv;
@@ -1014,7 +1020,7 @@ uint32_t poly_render_polygon(legacy_poly_manager *poly, void *dest, const rectan
uint32_t startunit;
int vertnum;
- assert(poly->flags & POLYFLAG_ALLOW_QUADS);
+ assert(poly->flags & POLYLGCY_FLAG_ALLOW_QUADS);
/* determine min/max Y vertices */
minv = maxv = 0;
@@ -1032,7 +1038,7 @@ uint32_t poly_render_polygon(legacy_poly_manager *poly, void *dest, const rectan
/* clip coordinates */
minyclip = miny;
- maxyclip = maxy + ((poly->flags & POLYFLAG_INCLUDE_BOTTOM_EDGE) ? 1 : 0);
+ maxyclip = maxy + ((poly->flags & POLYLGCY_FLAG_INCLUDE_BOTTOM_EDGE) ? 1 : 0);
minyclip = std::max(minyclip, cliprect.min_y);
maxyclip = std::min(maxyclip, cliprect.max_y + 1);
if (maxyclip - minyclip <= 0)
@@ -1169,7 +1175,7 @@ uint32_t poly_render_polygon(legacy_poly_manager *poly, void *dest, const rectan
}
/* include the right edge if requested */
- if (poly->flags & POLYFLAG_INCLUDE_RIGHT_EDGE)
+ if (poly->flags & POLYLGCY_FLAG_INCLUDE_RIGHT_EDGE)
istopx++;
/* apply left/right clipping */
diff --git a/src/devices/video/polylgcy.h b/src/devices/video/polylgcy.h
index fe7f13205f4..142ca5c073b 100644
--- a/src/devices/video/polylgcy.h
+++ b/src/devices/video/polylgcy.h
@@ -32,23 +32,23 @@
***************************************************************************/
-#pragma once
+#ifndef MAME_VIDEO_POLYLGCY_H
+#define MAME_VIDEO_POLYLGCY_H
-#ifndef __POLYLGCY_H__
-#define __POLYLGCY_H__
+#pragma once
/***************************************************************************
CONSTANTS
***************************************************************************/
-#define MAX_VERTEX_PARAMS 6
-#define MAX_POLYGON_VERTS 32
+static constexpr unsigned POLYLGCY_MAX_VERTEX_PARAMS = 6;
+static constexpr unsigned POLYLGCY_MAX_POLYGON_VERTS = 32;
-#define POLYFLAG_INCLUDE_BOTTOM_EDGE 0x01
-#define POLYFLAG_INCLUDE_RIGHT_EDGE 0x02
-#define POLYFLAG_NO_WORK_QUEUE 0x04
-#define POLYFLAG_ALLOW_QUADS 0x08
+static constexpr uint8_t POLYLGCY_FLAG_INCLUDE_BOTTOM_EDGE = 0x01;
+static constexpr uint8_t POLYLGCY_FLAG_INCLUDE_RIGHT_EDGE = 0x02;
+static constexpr uint8_t POLYLGCY_FLAG_NO_WORK_QUEUE = 0x04;
+static constexpr uint8_t POLYLGCY_FLAG_ALLOW_QUADS = 0x08;
@@ -65,7 +65,7 @@ struct poly_vertex
{
float x; /* X coordinate */
float y; /* Y coordinate */
- float p[MAX_VERTEX_PARAMS]; /* interpolated parameter values */
+ float p[POLYLGCY_MAX_VERTEX_PARAMS]; /* interpolated parameter values */
};
@@ -82,7 +82,7 @@ struct poly_extent
{
int16_t startx; /* starting X coordinate (inclusive) */
int16_t stopx; /* ending X coordinate (exclusive) */
- poly_param_extent param[MAX_VERTEX_PARAMS]; /* starting and dx values for each parameter */
+ poly_param_extent param[POLYLGCY_MAX_VERTEX_PARAMS]; /* starting and dx values for each parameter */
};
@@ -152,4 +152,4 @@ uint32_t poly_render_polygon(legacy_poly_manager *poly, void *dest, const rectan
int poly_zclip_if_less(int numverts, const poly_vertex *v, poly_vertex *outv, int paramcount, float clipval);
-#endif /* __POLYLGCY_H__ */
+#endif // MAME_VIDEO_POLYLGCY_H
diff --git a/src/devices/video/ppu2c0x.cpp b/src/devices/video/ppu2c0x.cpp
index 0d787209d15..a64f890c805 100644
--- a/src/devices/video/ppu2c0x.cpp
+++ b/src/devices/video/ppu2c0x.cpp
@@ -75,15 +75,15 @@ static const pen_t default_colortable[] =
//**************************************************************************
// devices
-const device_type PPU_2C02 = device_creator<ppu2c02_device>;
-const device_type PPU_2C03B = device_creator<ppu2c03b_device>;
-const device_type PPU_2C04 = device_creator<ppu2c04_device>;
-const device_type PPU_2C07 = device_creator<ppu2c07_device>;
-const device_type PPU_PALC = device_creator<ppupalc_device>;
-const device_type PPU_2C05_01 = device_creator<ppu2c05_01_device>;
-const device_type PPU_2C05_02 = device_creator<ppu2c05_02_device>;
-const device_type PPU_2C05_03 = device_creator<ppu2c05_03_device>;
-const device_type PPU_2C05_04 = device_creator<ppu2c05_04_device>;
+DEFINE_DEVICE_TYPE(PPU_2C02, ppu2c02_device, "ppu2c02", "2C02 PPU")
+DEFINE_DEVICE_TYPE(PPU_2C03B, ppu2c03b_device, "ppu2c03b", "2C03B PPC")
+DEFINE_DEVICE_TYPE(PPU_2C04, ppu2c04_device, "ppu2c04", "2C04 PPU")
+DEFINE_DEVICE_TYPE(PPU_2C07, ppu2c07_device, "ppu2c07", "2C07 PPU")
+DEFINE_DEVICE_TYPE(PPU_PALC, ppupalc_device, "ppupalc", "Generic PAL Clone PPU")
+DEFINE_DEVICE_TYPE(PPU_2C05_01, ppu2c05_01_device, "ppu2c05_01", "2C05_01 PPU")
+DEFINE_DEVICE_TYPE(PPU_2C05_02, ppu2c05_02_device, "ppu2c05_02", "2C05_02 PPU")
+DEFINE_DEVICE_TYPE(PPU_2C05_03, ppu2c05_03_device, "ppu2c05_03", "2C05_03 PPU")
+DEFINE_DEVICE_TYPE(PPU_2C05_04, ppu2c05_04_device, "ppu2c05_04", "2C05_04 PPU")
// default address map
@@ -105,10 +105,10 @@ const address_space_config *ppu2c0x_device::memory_space_config(address_spacenum
// static
-void ppu2c0x_device::set_nmi_delegate(device_t &device,ppu2c0x_nmi_delegate cb)
+void ppu2c0x_device::set_nmi_delegate(device_t &device, nmi_delegate &&cb)
{
ppu2c0x_device &dev = downcast<ppu2c0x_device &>(device);
- dev.m_nmi_callback_proc = cb;
+ dev.m_nmi_callback_proc = std::move(cb);
}
//-------------------------------------------------
// ppu2c0x_device - constructor
@@ -117,14 +117,14 @@ void ppu2c0x_device::set_nmi_delegate(device_t &device,ppu2c0x_nmi_delegate cb)
void ppu2c0x_device::device_config_complete()
{
/* reset the callbacks */
- m_latch = ppu2c0x_latch_delegate();
- m_scanline_callback_proc = ppu2c0x_scanline_delegate();
- m_hblank_callback_proc = ppu2c0x_hblank_delegate();
- m_vidaccess_callback_proc = ppu2c0x_vidaccess_delegate();
+ m_latch = latch_delegate();
+ m_scanline_callback_proc = scanline_delegate();
+ m_hblank_callback_proc = hblank_delegate();
+ m_vidaccess_callback_proc = vidaccess_delegate();
}
-ppu2c0x_device::ppu2c0x_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source)
- : device_t(mconfig, type, name, tag, owner, clock, shortname, source)
+ppu2c0x_device::ppu2c0x_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
+ : device_t(mconfig, type, tag, owner, clock)
, device_memory_interface(mconfig, *this)
, device_video_interface(mconfig, *this)
, m_space_config("videoram", ENDIANNESS_LITTLE, 8, 17, 0, nullptr, *ADDRESS_MAP_NAME(ppu2c0x))
@@ -152,62 +152,62 @@ ppu2c0x_device::ppu2c0x_device(const machine_config &mconfig, device_type type,
memset(m_palette_ram, 0, ARRAY_LENGTH(m_palette_ram));
- m_scanlines_per_frame = PPU_NTSC_SCANLINES_PER_FRAME;
- m_vblank_first_scanline = PPU_VBLANK_FIRST_SCANLINE;
+ m_scanlines_per_frame = NTSC_SCANLINES_PER_FRAME;
+ m_vblank_first_scanline = VBLANK_FIRST_SCANLINE;
/* usually, no security value... */
m_security_value = 0;
- m_nmi_callback_proc = ppu2c0x_nmi_delegate();
+ m_nmi_callback_proc = nmi_delegate();
}
// NTSC NES
-ppu2c02_device::ppu2c02_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : ppu2c0x_device(mconfig, PPU_2C02, "2C02 PPU", tag, owner, clock, "ppu2c02", __FILE__)
+ppu2c02_device::ppu2c02_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : ppu2c0x_device(mconfig, PPU_2C02, tag, owner, clock)
{
}
// Playchoice 10
-ppu2c03b_device::ppu2c03b_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : ppu2c0x_device(mconfig, PPU_2C03B, "2C03B PPU", tag, owner, clock, "ppu2c03b", __FILE__)
+ppu2c03b_device::ppu2c03b_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : ppu2c0x_device(mconfig, PPU_2C03B, tag, owner, clock)
{
}
// Vs. Unisystem
-ppu2c04_device::ppu2c04_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : ppu2c0x_device(mconfig, PPU_2C04, "2C04 PPU", tag, owner, clock, "ppu2c04", __FILE__)
+ppu2c04_device::ppu2c04_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : ppu2c0x_device(mconfig, PPU_2C04, tag, owner, clock)
{
}
// PAL NES
-ppu2c07_device::ppu2c07_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : ppu2c0x_device(mconfig, PPU_2C07, "2C07 PPU", tag, owner, clock, "ppu2c07", __FILE__)
+ppu2c07_device::ppu2c07_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : ppu2c0x_device(mconfig, PPU_2C07, tag, owner, clock)
{
- m_scanlines_per_frame = PPU_PAL_SCANLINES_PER_FRAME;
+ m_scanlines_per_frame = PAL_SCANLINES_PER_FRAME;
}
// PAL clones
-ppupalc_device::ppupalc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : ppu2c0x_device(mconfig, PPU_PALC, "Generic PAL Clone PPU", tag, owner, clock, "ppupalc", __FILE__)
+ppupalc_device::ppupalc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : ppu2c0x_device(mconfig, PPU_PALC, tag, owner, clock)
{
- m_scanlines_per_frame = PPU_PAL_SCANLINES_PER_FRAME;
- m_vblank_first_scanline = PPU_VBLANK_FIRST_SCANLINE_PALC;
+ m_scanlines_per_frame = PAL_SCANLINES_PER_FRAME;
+ m_vblank_first_scanline = VBLANK_FIRST_SCANLINE_PALC;
}
// The PPU_2C05 variants have different protection value, set at device start, but otherwise are all the same...
// Vs. Unisystem (Ninja Jajamaru Kun)
-ppu2c05_01_device::ppu2c05_01_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : ppu2c0x_device(mconfig, PPU_2C05_01, "2C05_01 PPU", tag, owner, clock, "ppu2c05_01", __FILE__)
+ppu2c05_01_device::ppu2c05_01_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : ppu2c0x_device(mconfig, PPU_2C05_01, tag, owner, clock)
{
m_security_value = 0x1b; // game (jajamaru) doesn't seem to ever actually check it
}
// Vs. Unisystem (Mighty Bomb Jack)
-ppu2c05_02_device::ppu2c05_02_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : ppu2c0x_device(mconfig, PPU_2C05_02, "2C05_02 PPU", tag, owner, clock, "ppu2c05_02", __FILE__)
+ppu2c05_02_device::ppu2c05_02_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : ppu2c0x_device(mconfig, PPU_2C05_02, tag, owner, clock)
{
m_security_value = 0x3d;
}
// Vs. Unisystem (Gumshoe)
-ppu2c05_03_device::ppu2c05_03_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : ppu2c0x_device(mconfig, PPU_2C05_03, "2C05_03 PPU", tag, owner, clock, "ppu2c05_03", __FILE__)
+ppu2c05_03_device::ppu2c05_03_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : ppu2c0x_device(mconfig, PPU_2C05_03, tag, owner, clock)
{
m_security_value = 0x1c;
}
// Vs. Unisystem (Top Gun)
-ppu2c05_04_device::ppu2c05_04_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : ppu2c0x_device(mconfig, PPU_2C05_04, "2C05_04 PPU", tag, owner, clock, "ppu2c05_04", __FILE__)
+ppu2c05_04_device::ppu2c05_04_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : ppu2c0x_device(mconfig, PPU_2C05_04, tag, owner, clock)
{
m_security_value = 0x1b;
}
@@ -948,7 +948,7 @@ void ppu2c0x_device::render_scanline( void )
void ppu2c0x_device::update_scanline( void )
{
- if (m_scanline <= PPU_BOTTOM_VISIBLE_SCANLINE)
+ if (m_scanline <= BOTTOM_VISIBLE_SCANLINE)
{
/* Render this scanline if appropriate */
if (m_regs[PPU_CONTROL1] & (PPU_CONTROL1_BACKGROUND | PPU_CONTROL1_SPRITES))
@@ -1149,7 +1149,7 @@ WRITE8_MEMBER( ppu2c0x_device::write )
}
#ifdef MAME_DEBUG
- if (m_scanline <= PPU_BOTTOM_VISIBLE_SCANLINE)
+ if (m_scanline <= BOTTOM_VISIBLE_SCANLINE)
{
logerror("PPU register %d write %02x during non-vblank scanline %d (MAME %d, beam pos: %d)\n", offset, data, m_scanline, m_screen->vpos(), m_screen->hpos());
}
@@ -1200,7 +1200,7 @@ WRITE8_MEMBER( ppu2c0x_device::write )
case PPU_SPRITE_DATA: /* 4 */
// If the PPU is currently rendering the screen, 0xff is written instead of the desired data.
if (m_use_sprite_write_limitation)
- if (m_scanline <= PPU_BOTTOM_VISIBLE_SCANLINE)
+ if (m_scanline <= BOTTOM_VISIBLE_SCANLINE)
data = 0xff;
m_spriteram[m_regs[PPU_SPRITE_ADDRESS]] = data;
m_regs[PPU_SPRITE_ADDRESS] = (m_regs[PPU_SPRITE_ADDRESS] + 1) & 0xff;
diff --git a/src/devices/video/ppu2c0x.h b/src/devices/video/ppu2c0x.h
index b37d765c475..0ae702fdf1d 100644
--- a/src/devices/video/ppu2c0x.h
+++ b/src/devices/video/ppu2c0x.h
@@ -9,10 +9,10 @@
******************************************************************************/
-#pragma once
+#ifndef MAME_VIDEO_PPU2C0X_H
+#define MAME_VIDEO_PPU2C0X_H
-#ifndef __PPU_2C03B_H__
-#define __PPU_2C03B_H__
+#pragma once
///*************************************************************************
// MACROS / CONSTANTS
@@ -30,58 +30,6 @@
#define PPU_DRAW_OAM 1
-// registers definition
-enum
-{
- PPU_CONTROL0 = 0,
- PPU_CONTROL1,
- PPU_STATUS,
- PPU_SPRITE_ADDRESS,
- PPU_SPRITE_DATA,
- PPU_SCROLL,
- PPU_ADDRESS,
- PPU_DATA,
- PPU_MAX_REG
-};
-
-// bit definitions for (some of) the registers
-enum
-{
- PPU_CONTROL0_INC = 0x04,
- PPU_CONTROL0_SPR_SELECT = 0x08,
- PPU_CONTROL0_CHR_SELECT = 0x10,
- PPU_CONTROL0_SPRITE_SIZE = 0x20,
- PPU_CONTROL0_NMI = 0x80,
-
- PPU_CONTROL1_DISPLAY_MONO = 0x01,
- PPU_CONTROL1_BACKGROUND_L8 = 0x02,
- PPU_CONTROL1_SPRITES_L8 = 0x04,
- PPU_CONTROL1_BACKGROUND = 0x08,
- PPU_CONTROL1_SPRITES = 0x10,
- PPU_CONTROL1_COLOR_EMPHASIS = 0xe0,
-
- PPU_STATUS_8SPRITES = 0x20,
- PPU_STATUS_SPRITE0_HIT = 0x40,
- PPU_STATUS_VBLANK = 0x80
-};
-
-enum
-{
- PPU_NTSC_SCANLINES_PER_FRAME = 262,
- PPU_PAL_SCANLINES_PER_FRAME = 312,
-
- PPU_BOTTOM_VISIBLE_SCANLINE = 239,
- PPU_VBLANK_FIRST_SCANLINE = 241,
- PPU_VBLANK_FIRST_SCANLINE_PALC = 291,
- PPU_VBLANK_LAST_SCANLINE_NTSC = 260,
- PPU_VBLANK_LAST_SCANLINE_PAL = 310
-
- // Both the scanline immediately before and immediately after VBLANK
- // are non-rendering and non-vblank.
-};
-
-/*----------- defined in video/ppu2c0x.c -----------*/
-
///*************************************************************************
// INTERFACE CONFIGURATION MACROS
///*************************************************************************
@@ -117,7 +65,7 @@ enum
ppu2c0x_device::set_color_base(*device, _color);
#define MCFG_PPU2C0X_SET_NMI(_class, _method) \
- ppu2c0x_device::set_nmi_delegate(*device, ppu2c0x_nmi_delegate(&_class::_method, #_class "::" #_method, nullptr, (_class *)nullptr));
+ ppu2c0x_device::set_nmi_delegate(*device, ppu2c0x_device::nmi_delegate(&_class::_method, #_class "::" #_method, nullptr, (_class *)nullptr));
#define MCFG_PPU2C0X_IGNORE_SPRITE_WRITE_LIMIT \
ppu2c0x_device::use_sprite_write_limitation_disable(*device);
@@ -125,12 +73,6 @@ enum
///*************************************************************************
// TYPE DEFINITIONS
///*************************************************************************
-typedef device_delegate<void (int scanline, int vblank, int blanked)> ppu2c0x_scanline_delegate;
-typedef device_delegate<void (int scanline, int vblank, int blanked)> ppu2c0x_hblank_delegate;
-typedef device_delegate<void (int *ppu_regs)> ppu2c0x_nmi_delegate;
-typedef device_delegate<int (int address, int data)> ppu2c0x_vidaccess_delegate;
-typedef device_delegate<void (offs_t offset)> ppu2c0x_latch_delegate;
-
// ======================> ppu2c0x_device
@@ -139,25 +81,35 @@ class ppu2c0x_device : public device_t,
public device_video_interface
{
public:
- // construction/destruction
- ppu2c0x_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source);
+ typedef device_delegate<void (int scanline, int vblank, int blanked)> scanline_delegate;
+ typedef device_delegate<void (int scanline, int vblank, int blanked)> hblank_delegate;
+ typedef device_delegate<void (int *ppu_regs)> nmi_delegate;
+ typedef device_delegate<int (int address, int data)> vidaccess_delegate;
+ typedef device_delegate<void (offs_t offset)> latch_delegate;
+
+ enum
+ {
+ NTSC_SCANLINES_PER_FRAME = 262,
+ PAL_SCANLINES_PER_FRAME = 312,
+
+ BOTTOM_VISIBLE_SCANLINE = 239,
+ VBLANK_FIRST_SCANLINE = 241,
+ VBLANK_FIRST_SCANLINE_PALC = 291,
+ VBLANK_LAST_SCANLINE_NTSC = 260,
+ VBLANK_LAST_SCANLINE_PAL = 310
+
+ // Both the scanline immediately before and immediately after VBLANK
+ // are non-rendering and non-vblank.
+ };
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
DECLARE_READ8_MEMBER( palette_read );
DECLARE_WRITE8_MEMBER( palette_write );
- virtual void device_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
- virtual void device_config_complete() override;
- // device_config_memory_interface overrides
- virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override;
- // address space configurations
- const address_space_config m_space_config;
-
static void set_cpu_tag(device_t &device, const char *tag) { downcast<ppu2c0x_device &>(device).m_cpu.set_tag(tag); }
static void set_color_base(device_t &device, int colorbase) { downcast<ppu2c0x_device &>(device).m_color_base = colorbase; }
- static void set_nmi_delegate(device_t &device, ppu2c0x_nmi_delegate cb);
+ static void set_nmi_delegate(device_t &device, nmi_delegate &&cb);
/* routines */
void init_palette( palette_device &palette, int first_entry );
@@ -174,9 +126,9 @@ public:
int get_colorbase() { return m_color_base; };
int get_current_scanline() { return m_scanline; };
- void set_scanline_callback( ppu2c0x_scanline_delegate cb ) { m_scanline_callback_proc = cb; m_scanline_callback_proc.bind_relative_to(*owner()); };
- void set_hblank_callback( ppu2c0x_hblank_delegate cb ) { m_hblank_callback_proc = cb; m_hblank_callback_proc.bind_relative_to(*owner()); };
- void set_vidaccess_callback( ppu2c0x_vidaccess_delegate cb ) { m_vidaccess_callback_proc = cb; m_vidaccess_callback_proc.bind_relative_to(*owner()); };
+ void set_scanline_callback( scanline_delegate &&cb ) { m_scanline_callback_proc = std::move(cb); m_scanline_callback_proc.bind_relative_to(*owner()); };
+ void set_hblank_callback( hblank_delegate &&cb ) { m_hblank_callback_proc = std::move(cb); m_hblank_callback_proc.bind_relative_to(*owner()); };
+ void set_vidaccess_callback( vidaccess_delegate &&cb ) { m_vidaccess_callback_proc = std::move(cb); m_vidaccess_callback_proc.bind_relative_to(*owner()); };
void set_scanlines_per_frame( int scanlines ) { m_scanlines_per_frame = scanlines; };
// MMC5 has to be able to check this
@@ -185,12 +137,10 @@ public:
int get_tilenum() { return m_tilecount; };
//27/12/2002 (HACK!)
- void set_latch( ppu2c0x_latch_delegate cb ) { m_latch = cb; m_latch.bind_relative_to(*owner()); };
+ void set_latch( latch_delegate &&cb ) { m_latch = std::move(cb); m_latch.bind_relative_to(*owner()); };
// void update_screen(bitmap_t &bitmap, const rectangle &cliprect);
- required_device<cpu_device> m_cpu;
-
// some bootleg / clone hardware appears to ignore this
static void use_sprite_write_limitation_disable(device_t &device)
{
@@ -199,14 +149,64 @@ public:
}
protected:
+ // registers definition
+ enum
+ {
+ PPU_CONTROL0 = 0,
+ PPU_CONTROL1,
+ PPU_STATUS,
+ PPU_SPRITE_ADDRESS,
+ PPU_SPRITE_DATA,
+ PPU_SCROLL,
+ PPU_ADDRESS,
+ PPU_DATA,
+ PPU_MAX_REG
+ };
+
+ // bit definitions for (some of) the registers
+ enum
+ {
+ PPU_CONTROL0_INC = 0x04,
+ PPU_CONTROL0_SPR_SELECT = 0x08,
+ PPU_CONTROL0_CHR_SELECT = 0x10,
+ PPU_CONTROL0_SPRITE_SIZE = 0x20,
+ PPU_CONTROL0_NMI = 0x80,
+
+ PPU_CONTROL1_DISPLAY_MONO = 0x01,
+ PPU_CONTROL1_BACKGROUND_L8 = 0x02,
+ PPU_CONTROL1_SPRITES_L8 = 0x04,
+ PPU_CONTROL1_BACKGROUND = 0x08,
+ PPU_CONTROL1_SPRITES = 0x10,
+ PPU_CONTROL1_COLOR_EMPHASIS = 0xe0,
+
+ PPU_STATUS_8SPRITES = 0x20,
+ PPU_STATUS_SPRITE0_HIT = 0x40,
+ PPU_STATUS_VBLANK = 0x80
+ };
+
+ // construction/destruction
+ ppu2c0x_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
+
+ virtual void device_start() override;
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
+ virtual void device_config_complete() override;
+
+ // device_config_memory_interface overrides
+ virtual const address_space_config *memory_space_config(address_spacenum spacenum) const override;
+
+ // address space configurations
+ const address_space_config m_space_config;
+
+ required_device<cpu_device> m_cpu;
+
int m_scanlines_per_frame; /* number of scanlines per frame */
int m_security_value; /* 2C05 protection */
int m_vblank_first_scanline; /* the very first scanline where VBLANK occurs */
private:
- static const device_timer_id TIMER_HBLANK = 0;
- static const device_timer_id TIMER_NMI = 1;
- static const device_timer_id TIMER_SCANLINE = 2;
+ static constexpr device_timer_id TIMER_HBLANK = 0;
+ static constexpr device_timer_id TIMER_NMI = 1;
+ static constexpr device_timer_id TIMER_SCANLINE = 2;
inline uint8_t readbyte(offs_t address);
inline void writebyte(offs_t address, uint8_t data);
@@ -216,10 +216,10 @@ private:
std::unique_ptr<pen_t[]> m_colortable; /* color table modified at run time */
std::unique_ptr<pen_t[]> m_colortable_mono; /* monochromatic color table modified at run time */
int m_scanline; /* scanline count */
- ppu2c0x_scanline_delegate m_scanline_callback_proc; /* optional scanline callback */
- ppu2c0x_hblank_delegate m_hblank_callback_proc; /* optional hblank callback */
- ppu2c0x_vidaccess_delegate m_vidaccess_callback_proc; /* optional video access callback */
- ppu2c0x_nmi_delegate m_nmi_callback_proc; /* nmi access callback from interface */
+ scanline_delegate m_scanline_callback_proc; /* optional scanline callback */
+ hblank_delegate m_hblank_callback_proc; /* optional hblank callback */
+ vidaccess_delegate m_vidaccess_callback_proc; /* optional video access callback */
+ nmi_delegate m_nmi_callback_proc; /* nmi access callback from interface */
int m_regs[PPU_MAX_REG]; /* registers */
int m_refresh_data; /* refresh-related */
int m_refresh_latch; /* refresh-related */
@@ -237,7 +237,7 @@ private:
int m_scan_scale; /* scan scale */
int m_tilecount; /* MMC5 can change attributes to subsets of the 34 visible tiles */
int m_draw_phase; /* MMC5 uses different regs for BG and OAM */
- ppu2c0x_latch_delegate m_latch;
+ latch_delegate m_latch;
// timers
emu_timer *m_hblank_timer; /* hblank period at end of each scanline */
@@ -295,15 +295,14 @@ public:
// device type definition
//extern const device_type PPU_2C0X;
-extern const device_type PPU_2C02; // NTSC NES
-extern const device_type PPU_2C03B; // Playchoice 10
-extern const device_type PPU_2C04; // Vs. Unisystem
-extern const device_type PPU_2C07; // PAL NES
-extern const device_type PPU_PALC; // PAL Clones
-extern const device_type PPU_2C05_01; // Vs. Unisystem (Ninja Jajamaru Kun)
-extern const device_type PPU_2C05_02; // Vs. Unisystem (Mighty Bomb Jack)
-extern const device_type PPU_2C05_03; // Vs. Unisystem (Gumshoe)
-extern const device_type PPU_2C05_04; // Vs. Unisystem (Top Gun)
-
-
-#endif
+DECLARE_DEVICE_TYPE(PPU_2C02, ppu2c02_device) // NTSC NES
+DECLARE_DEVICE_TYPE(PPU_2C03B, ppu2c03b_device) // Playchoice 10
+DECLARE_DEVICE_TYPE(PPU_2C04, ppu2c04_device) // Vs. Unisystem
+DECLARE_DEVICE_TYPE(PPU_2C07, ppu2c07_device) // PAL NES
+DECLARE_DEVICE_TYPE(PPU_PALC, ppupalc_device) // PAL Clones
+DECLARE_DEVICE_TYPE(PPU_2C05_01, ppu2c05_01_device) // Vs. Unisystem (Ninja Jajamaru Kun)
+DECLARE_DEVICE_TYPE(PPU_2C05_02, ppu2c05_02_device) // Vs. Unisystem (Mighty Bomb Jack)
+DECLARE_DEVICE_TYPE(PPU_2C05_03, ppu2c05_03_device) // Vs. Unisystem (Gumshoe)
+DECLARE_DEVICE_TYPE(PPU_2C05_04, ppu2c05_04_device) // Vs. Unisystem (Top Gun)
+
+#endif // MAME_VIDEO_PPU2C0X_H
diff --git a/src/devices/video/psx.cpp b/src/devices/video/psx.cpp
index 6b2963babdf..ad49dfe4802 100644
--- a/src/devices/video/psx.cpp
+++ b/src/devices/video/psx.cpp
@@ -8,34 +8,33 @@
*/
#include "emu.h"
-
-#define DEBUG_VIEWER ( 0 )
#include "video/psx.h"
#include "screen.h"
+#define STOP_ON_ERROR ( 0 )
+
#define VERBOSE_LEVEL ( 0 )
// device type definition
-const device_type CXD8514Q = device_creator<cxd8514q_device>;
-const device_type CXD8538Q = device_creator<cxd8538q_device>;
-const device_type CXD8561Q = device_creator<cxd8561q_device>;
-const device_type CXD8561BQ = device_creator<cxd8561bq_device>;
-const device_type CXD8561CQ = device_creator<cxd8561cq_device>;
-const device_type CXD8654Q = device_creator<cxd8654q_device>;
-
-psxgpu_device::psxgpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source) :
- device_t(mconfig, type, name, tag, owner, clock, shortname, source),
- m_vblank_handler(*this)
-#if DEBUG_VIEWER
-,
- m_screen(*this, "screen")
+DEFINE_DEVICE_TYPE(CXD8514Q, cxd8514q_device, "cxd8514q", "CXD8514Q GPU")
+DEFINE_DEVICE_TYPE(CXD8538Q, cxd8538q_device, "cxd8538q", "CXD8538Q GPU")
+DEFINE_DEVICE_TYPE(CXD8561Q, cxd8561q_device, "cxd8561q", "CXD8561Q GPU")
+DEFINE_DEVICE_TYPE(CXD8561BQ, cxd8561bq_device, "cxd8561bq", "CXD8561BQ GPU")
+DEFINE_DEVICE_TYPE(CXD8561CQ, cxd8561cq_device, "cxd8561cq", "CXD8561CQ GPU")
+DEFINE_DEVICE_TYPE(CXD8654Q, cxd8654q_device, "cxd8654q", "CXD8654Q GPU")
+
+psxgpu_device::psxgpu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
+ : device_t(mconfig, type, tag, owner, clock)
+ , m_vblank_handler(*this)
+#if PSXGPU_DEBUG_VIEWER
+ , m_screen(*this, "screen")
#endif
{
}
-void psxgpu_device::device_start( void )
+void psxgpu_device::device_start()
{
m_vblank_handler.resolve_safe();
@@ -49,38 +48,38 @@ void psxgpu_device::device_start( void )
}
}
-void psxgpu_device::device_reset( void )
+void psxgpu_device::device_reset()
{
gpu_reset();
}
cxd8514q_device::cxd8514q_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : psxgpu_device(mconfig, CXD8514Q, "CXD8514Q GPU", tag, owner, clock, "cxd8514q", __FILE__)
+ : psxgpu_device(mconfig, CXD8514Q, tag, owner, clock)
{
}
cxd8538q_device::cxd8538q_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : psxgpu_device(mconfig, CXD8538Q, "CXD8538Q GPU", tag, owner, clock, "cxd8538q", __FILE__)
+ : psxgpu_device(mconfig, CXD8538Q, tag, owner, clock)
{
}
cxd8561q_device::cxd8561q_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : psxgpu_device(mconfig, CXD8561Q, "CXD8561Q GPU", tag, owner, clock, "cxd8561q", __FILE__)
+ : psxgpu_device(mconfig, CXD8561Q, tag, owner, clock)
{
}
cxd8561bq_device::cxd8561bq_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : psxgpu_device(mconfig, CXD8561BQ, "CXD8561BQ", tag, owner, clock, "cxd8561bq", __FILE__)
+ : psxgpu_device(mconfig, CXD8561BQ, tag, owner, clock)
{
}
cxd8561cq_device::cxd8561cq_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : psxgpu_device(mconfig, CXD8561CQ, "CXD8561CQ GPU", tag, owner, clock, "cxd8561cq", __FILE__)
+ : psxgpu_device(mconfig, CXD8561CQ, tag, owner, clock)
{
}
cxd8654q_device::cxd8654q_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : psxgpu_device(mconfig, CXD8654Q, "CXD8654Q GPU", tag, owner, clock, "cxd8654q", __FILE__)
+ : psxgpu_device(mconfig, CXD8654Q, tag, owner, clock)
{
}
@@ -117,9 +116,9 @@ static inline void ATTR_PRINTF(3,4) verboselog( device_t& device, int n_level, c
}
}
-#if DEBUG_VIEWER
+#if PSXGPU_DEBUG_VIEWER
-void psxgpu_device::DebugMeshInit( void )
+void psxgpu_device::DebugMeshInit()
{
int width = m_screen->width();
int height = m_screen->height();
@@ -241,12 +240,12 @@ void psxgpu_device::DebugMesh( int n_coordx, int n_coordy )
}
}
-void psxgpu_device::DebugMeshEnd( void )
+void psxgpu_device::DebugMeshEnd()
{
m_debug.n_coord = 0;
}
-void psxgpu_device::DebugCheckKeys( void )
+void psxgpu_device::DebugCheckKeys()
{
if( machine().input().code_pressed_once( KEYCODE_M ) )
{
@@ -437,7 +436,7 @@ void psxgpu_device::updatevisiblearea()
break;
}
-#if DEBUG_VIEWER
+#if PSXGPU_DEBUG_VIEWER
if( m_debug.b_mesh || m_debug.b_texture )
{
n_screenheight = 1024;
@@ -461,7 +460,7 @@ void psxgpu_device::psx_gpu_init( int n_gputype )
m_n_gputype = n_gputype;
-#if DEBUG_VIEWER
+#if PSXGPU_DEBUG_VIEWER
DebugMeshInit();
#endif
@@ -622,7 +621,7 @@ uint32_t psxgpu_device::update_screen(screen_device &screen, bitmap_ind16 &bitma
int n_overscantop;
int n_overscanleft;
-#if DEBUG_VIEWER
+#if PSXGPU_DEBUG_VIEWER
if( DebugMeshDisplay( bitmap, cliprect ) )
{
return 0;
@@ -1393,7 +1392,7 @@ void psxgpu_device::FlatPolygon( int n_points )
uint16_t *p_vram;
-#if DEBUG_VIEWER
+#if PSXGPU_DEBUG_VIEWER
if( m_debug.n_skip == 1 )
{
return;
@@ -1546,7 +1545,7 @@ void psxgpu_device::FlatTexturedPolygon( int n_points )
uint16_t *p_vram;
uint32_t n_bgr;
-#if DEBUG_VIEWER
+#if PSXGPU_DEBUG_VIEWER
if( m_debug.n_skip == 2 )
{
return;
@@ -1745,7 +1744,7 @@ void psxgpu_device::GouraudPolygon( int n_points )
uint16_t *p_vram;
-#if DEBUG_VIEWER
+#if PSXGPU_DEBUG_VIEWER
if( m_debug.n_skip == 3 )
{
return;
@@ -1956,7 +1955,7 @@ void psxgpu_device::GouraudTexturedPolygon( int n_points )
uint16_t *p_vram;
uint32_t n_bgr;
-#if DEBUG_VIEWER
+#if PSXGPU_DEBUG_VIEWER
if( m_debug.n_skip == 4 )
{
return;
@@ -2175,7 +2174,7 @@ void psxgpu_device::GouraudTexturedPolygon( int n_points )
}
}
-void psxgpu_device::MonochromeLine( void )
+void psxgpu_device::MonochromeLine()
{
PAIR n_x;
PAIR n_y;
@@ -2193,7 +2192,7 @@ void psxgpu_device::MonochromeLine( void )
uint32_t n_b;
uint16_t *p_vram;
-#if DEBUG_VIEWER
+#if PSXGPU_DEBUG_VIEWER
if( m_debug.n_skip == 5 )
{
return;
@@ -2270,7 +2269,7 @@ void psxgpu_device::MonochromeLine( void )
}
}
-void psxgpu_device::GouraudLine( void )
+void psxgpu_device::GouraudLine()
{
PAIR n_x;
PAIR n_y;
@@ -2297,7 +2296,7 @@ void psxgpu_device::GouraudLine( void )
PAIR n_cb2;
uint16_t *p_vram;
-#if DEBUG_VIEWER
+#if PSXGPU_DEBUG_VIEWER
if( m_debug.n_skip == 6 )
{
return;
@@ -2386,7 +2385,7 @@ void psxgpu_device::GouraudLine( void )
}
}
-void psxgpu_device::FrameBufferRectangleDraw( void )
+void psxgpu_device::FrameBufferRectangleDraw()
{
PAIR n_r;
PAIR n_g;
@@ -2397,7 +2396,7 @@ void psxgpu_device::FrameBufferRectangleDraw( void )
int16_t n_x;
uint16_t *p_vram;
-#if DEBUG_VIEWER
+#if PSXGPU_DEBUG_VIEWER
if( m_debug.n_skip == 7 )
{
return;
@@ -2436,7 +2435,7 @@ void psxgpu_device::FrameBufferRectangleDraw( void )
}
}
-void psxgpu_device::FlatRectangle( void )
+void psxgpu_device::FlatRectangle()
{
int16_t n_y;
int16_t n_x;
@@ -2459,7 +2458,7 @@ void psxgpu_device::FlatRectangle( void )
int32_t n_h;
uint16_t *p_vram;
-#if DEBUG_VIEWER
+#if PSXGPU_DEBUG_VIEWER
if( m_debug.n_skip == 8 )
{
return;
@@ -2506,7 +2505,7 @@ void psxgpu_device::FlatRectangle( void )
}
}
-void psxgpu_device::FlatRectangle8x8( void )
+void psxgpu_device::FlatRectangle8x8()
{
int16_t n_y;
int16_t n_x;
@@ -2529,7 +2528,7 @@ void psxgpu_device::FlatRectangle8x8( void )
int32_t n_h;
uint16_t *p_vram;
-#if DEBUG_VIEWER
+#if PSXGPU_DEBUG_VIEWER
if( m_debug.n_skip == 9 )
{
return;
@@ -2576,7 +2575,7 @@ void psxgpu_device::FlatRectangle8x8( void )
}
}
-void psxgpu_device::FlatRectangle16x16( void )
+void psxgpu_device::FlatRectangle16x16()
{
int16_t n_y;
int16_t n_x;
@@ -2599,7 +2598,7 @@ void psxgpu_device::FlatRectangle16x16( void )
int32_t n_h;
uint16_t *p_vram;
-#if DEBUG_VIEWER
+#if PSXGPU_DEBUG_VIEWER
if( m_debug.n_skip == 10 )
{
return;
@@ -2646,7 +2645,7 @@ void psxgpu_device::FlatRectangle16x16( void )
}
}
-void psxgpu_device::FlatTexturedRectangle( void )
+void psxgpu_device::FlatTexturedRectangle()
{
int16_t n_y;
int16_t n_x;
@@ -2680,7 +2679,7 @@ void psxgpu_device::FlatTexturedRectangle( void )
uint16_t *p_clut;
uint16_t n_bgr;
-#if DEBUG_VIEWER
+#if PSXGPU_DEBUG_VIEWER
if( m_debug.n_skip == 11 )
{
return;
@@ -2749,7 +2748,7 @@ void psxgpu_device::FlatTexturedRectangle( void )
}
}
-void psxgpu_device::Sprite8x8( void )
+void psxgpu_device::Sprite8x8()
{
int16_t n_y;
int16_t n_x;
@@ -2783,7 +2782,7 @@ void psxgpu_device::Sprite8x8( void )
uint16_t *p_clut;
uint16_t n_bgr;
-#if DEBUG_VIEWER
+#if PSXGPU_DEBUG_VIEWER
if( m_debug.n_skip == 12 )
{
return;
@@ -2852,7 +2851,7 @@ void psxgpu_device::Sprite8x8( void )
}
}
-void psxgpu_device::Sprite16x16( void )
+void psxgpu_device::Sprite16x16()
{
int16_t n_y;
int16_t n_x;
@@ -2886,7 +2885,7 @@ void psxgpu_device::Sprite16x16( void )
uint16_t *p_clut;
uint16_t n_bgr;
-#if DEBUG_VIEWER
+#if PSXGPU_DEBUG_VIEWER
if( m_debug.n_skip == 13 )
{
return;
@@ -2955,7 +2954,7 @@ void psxgpu_device::Sprite16x16( void )
}
}
-void psxgpu_device::Dot( void )
+void psxgpu_device::Dot()
{
int32_t n_x;
int32_t n_y;
@@ -2964,7 +2963,7 @@ void psxgpu_device::Dot( void )
uint32_t n_b;
uint16_t *p_vram;
-#if DEBUG_VIEWER
+#if PSXGPU_DEBUG_VIEWER
if( m_debug.n_skip == 14 )
{
return;
@@ -2993,7 +2992,7 @@ void psxgpu_device::Dot( void )
}
}
-void psxgpu_device::MoveImage( void )
+void psxgpu_device::MoveImage()
{
int16_t n_w;
int16_t n_h;
@@ -3003,7 +3002,7 @@ void psxgpu_device::MoveImage( void )
int16_t n_dstx;
uint16_t *p_vram;
-#if DEBUG_VIEWER
+#if PSXGPU_DEBUG_VIEWER
if( m_debug.n_skip == 15 )
{
return;
@@ -3749,7 +3748,7 @@ void psxgpu_device::vblank(screen_device &screen, bool vblank_state)
{
if( vblank_state )
{
-#if DEBUG_VIEWER
+#if PSXGPU_DEBUG_VIEWER
DebugCheckKeys();
#endif
@@ -3758,7 +3757,7 @@ void psxgpu_device::vblank(screen_device &screen, bool vblank_state)
}
}
-void psxgpu_device::gpu_reset( void )
+void psxgpu_device::gpu_reset()
{
verboselog( *this, 1, "reset gpu\n" );
n_gpu_buffer_offset = 0;
diff --git a/src/devices/video/psx.h b/src/devices/video/psx.h
index d3b56642222..b60e1d1a69f 100644
--- a/src/devices/video/psx.h
+++ b/src/devices/video/psx.h
@@ -7,10 +7,12 @@
*
*/
+#ifndef MAME_VIDEO_PSX_H
+#define MAME_VIDEO_PSX_H
+
#pragma once
-#ifndef __PSXGPU_H__
-#define __PSXGPU_H__
+#define PSXGPU_DEBUG_VIEWER ( 0 )
#define MCFG_PSX_GPU_VBLANK_HANDLER(_devcb) \
@@ -21,211 +23,212 @@
MCFG_PSX_GPU_READ_HANDLER(DEVREAD32(tag, psxgpu_device, read)) \
MCFG_PSX_GPU_WRITE_HANDLER(DEVWRITE32(tag, psxgpu_device, write)) \
MCFG_DEVICE_ADD( tag, type, clock ) \
- ((psxgpu_device *) device)->vramSize = _vramSize; \
+ psxgpu_device::set_vram_size(*device, _vramSize); \
MCFG_PSX_GPU_VBLANK_HANDLER(DEVWRITELINE(cputag ":irq", psxirq_device, intin0)) \
- MCFG_PSX_DMA_CHANNEL_READ( cputag, 2, psx_dma_write_delegate(&psxgpu_device::dma_read, (psxgpu_device *) device ) ) \
- MCFG_PSX_DMA_CHANNEL_WRITE( cputag, 2, psx_dma_read_delegate(&psxgpu_device::dma_write, (psxgpu_device *) device ) )
+ MCFG_PSX_DMA_CHANNEL_READ( cputag, 2, psxdma_device::write_delegate(&psxgpu_device::dma_read, (psxgpu_device *) device ) ) \
+ MCFG_PSX_DMA_CHANNEL_WRITE( cputag, 2, psxdma_device::read_delegate(&psxgpu_device::dma_write, (psxgpu_device *) device ) )
#define MCFG_PSXGPU_REPLACE( cputag, tag, type, _vramSize, clock ) \
MCFG_DEVICE_MODIFY( cputag ) \
MCFG_PSX_GPU_READ_HANDLER(DEVREAD32(tag, psxgpu_device, read)) \
MCFG_PSX_GPU_WRITE_HANDLER(DEVWRITE32(tag, psxgpu_device, write)) \
MCFG_DEVICE_REPLACE( tag, type, clock ) \
- ((psxgpu_device *) device)->vramSize = _vramSize; \
+ psxgpu_device::set_vram_size(*device, _vramSize); \
MCFG_PSX_GPU_VBLANK_HANDLER(DEVWRITELINE(cputag ":irq", psxirq_device, intin0)) \
- MCFG_PSX_DMA_CHANNEL_READ( cputag, 2, psx_dma_write_delegate(&psxgpu_device::dma_read, (psxgpu_device *) device ) ) \
- MCFG_PSX_DMA_CHANNEL_WRITE( cputag, 2, psx_dma_read_delegate(&psxgpu_device::dma_write, (psxgpu_device *) device ) )
+ MCFG_PSX_DMA_CHANNEL_READ( cputag, 2, psxdma_device::write_delegate(&psxgpu_device::dma_read, (psxgpu_device *) device ) ) \
+ MCFG_PSX_DMA_CHANNEL_WRITE( cputag, 2, psxdma_device::read_delegate(&psxgpu_device::dma_write, (psxgpu_device *) device ) )
#define MCFG_PSXGPU_VBLANK_CALLBACK( _delegate ) \
((screen_device *) config.device_find( device, "screen" ))->register_vblank_callback( _delegate );
-extern const device_type CXD8514Q;
-extern const device_type CXD8538Q;
-extern const device_type CXD8561Q;
-extern const device_type CXD8561BQ;
-extern const device_type CXD8561CQ;
-extern const device_type CXD8654Q;
-
-#define STOP_ON_ERROR ( 0 )
-
-#define MAX_LEVEL ( 32 )
-#define MID_LEVEL ( ( MAX_LEVEL / 2 ) << 8 )
-#define MAX_SHADE ( 0x100 )
-#define MID_SHADE ( 0x80 )
+DECLARE_DEVICE_TYPE(CXD8514Q, cxd8514q_device)
+DECLARE_DEVICE_TYPE(CXD8538Q, cxd8538q_device)
+DECLARE_DEVICE_TYPE(CXD8561Q, cxd8561q_device)
+DECLARE_DEVICE_TYPE(CXD8561BQ, cxd8561bq_device)
+DECLARE_DEVICE_TYPE(CXD8561CQ, cxd8561cq_device)
+DECLARE_DEVICE_TYPE(CXD8654Q, cxd8654q_device)
-#define DEBUG_COORDS ( 10 )
-
-struct psx_gpu_debug
+class psxgpu_device : public device_t
{
- std::unique_ptr<bitmap_ind16> mesh;
- int b_clear;
- int b_mesh;
- int n_skip;
- int b_texture;
- int n_interleave;
- int n_coord;
- int n_coordx[ DEBUG_COORDS ];
- int n_coordy[ DEBUG_COORDS ];
-};
+public:
+ virtual machine_config_constructor device_mconfig_additions() const override;
-struct FLATVERTEX
-{
- PAIR n_coord;
-};
+ // static configuration helpers
+ template <class Object> static devcb_base &set_vblank_handler(device_t &device, Object &&cb) { return downcast<psxgpu_device &>(device).m_vblank_handler.set_callback(std::forward<Object>(cb)); }
+ static void set_vram_size(device_t &device, int size) { downcast<psxgpu_device &>(device).vramSize = size; }
-struct GOURAUDVERTEX
-{
- PAIR n_bgr;
- PAIR n_coord;
-};
+ uint32_t update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ DECLARE_WRITE32_MEMBER( write );
+ DECLARE_READ32_MEMBER( read );
+ void dma_read( uint32_t *ram, uint32_t n_address, int32_t n_size );
+ void dma_write( uint32_t *ram, uint32_t n_address, int32_t n_size );
+ void lightgun_set( int, int );
+ void vblank(screen_device &screen, bool vblank_state);
+ DECLARE_PALETTE_INIT( psx );
-struct FLATTEXTUREDVERTEX
-{
- PAIR n_coord;
- PAIR n_texture;
-};
+protected:
+ static constexpr unsigned MAX_LEVEL = 32;
+ static constexpr unsigned MID_LEVEL = (MAX_LEVEL / 2) << 8;
+ static constexpr unsigned MAX_SHADE = 0x100;
+ static constexpr unsigned MID_SHADE = 0x80;
-struct GOURAUDTEXTUREDVERTEX
-{
- PAIR n_bgr;
- PAIR n_coord;
- PAIR n_texture;
-};
+ // construction/destruction
+ psxgpu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
-union PACKET
-{
- uint32_t n_entry[ 16 ];
+ virtual void device_start() override;
+ virtual void device_reset() override;
- struct
- {
- PAIR n_cmd;
- struct FLATVERTEX vertex[ 2 ];
- PAIR n_size;
- } MoveImage;
+ int vramSize;
- struct
- {
- PAIR n_bgr;
- PAIR n_coord;
- PAIR n_size;
- } FlatRectangle;
+private:
+ static constexpr unsigned DEBUG_COORDS = 10;
- struct
+ struct psx_gpu_debug
{
- PAIR n_bgr;
- PAIR n_coord;
- } FlatRectangle8x8;
-
- struct
+ std::unique_ptr<bitmap_ind16> mesh;
+ int b_clear;
+ int b_mesh;
+ int n_skip;
+ int b_texture;
+ int n_interleave;
+ int n_coord;
+ int n_coordx[ DEBUG_COORDS ];
+ int n_coordy[ DEBUG_COORDS ];
+ };
+
+ struct FLATVERTEX
{
- PAIR n_bgr;
PAIR n_coord;
- } FlatRectangle16x16;
+ };
- struct
+ struct GOURAUDVERTEX
{
PAIR n_bgr;
PAIR n_coord;
- PAIR n_texture;
- } Sprite8x8;
+ };
- struct
+ struct FLATTEXTUREDVERTEX
{
- PAIR n_bgr;
PAIR n_coord;
PAIR n_texture;
- } Sprite16x16;
+ };
- struct
+ struct GOURAUDTEXTUREDVERTEX
{
PAIR n_bgr;
PAIR n_coord;
PAIR n_texture;
- PAIR n_size;
- } FlatTexturedRectangle;
+ };
- struct
+ union PACKET
{
- PAIR n_bgr;
- struct FLATVERTEX vertex[ 4 ];
- } FlatPolygon;
-
- struct
- {
- struct GOURAUDVERTEX vertex[ 4 ];
- } GouraudPolygon;
-
- struct
- {
- PAIR n_bgr;
- struct FLATVERTEX vertex[ 2 ];
- } MonochromeLine;
-
- struct
- {
- struct GOURAUDVERTEX vertex[ 2 ];
- } GouraudLine;
-
- struct
- {
- PAIR n_bgr;
- struct FLATTEXTUREDVERTEX vertex[ 4 ];
- } FlatTexturedPolygon;
+ uint32_t n_entry[ 16 ];
+
+ struct
+ {
+ PAIR n_cmd;
+ struct FLATVERTEX vertex[ 2 ];
+ PAIR n_size;
+ } MoveImage;
+
+ struct
+ {
+ PAIR n_bgr;
+ PAIR n_coord;
+ PAIR n_size;
+ } FlatRectangle;
+
+ struct
+ {
+ PAIR n_bgr;
+ PAIR n_coord;
+ } FlatRectangle8x8;
+
+ struct
+ {
+ PAIR n_bgr;
+ PAIR n_coord;
+ } FlatRectangle16x16;
+
+ struct
+ {
+ PAIR n_bgr;
+ PAIR n_coord;
+ PAIR n_texture;
+ } Sprite8x8;
+
+ struct
+ {
+ PAIR n_bgr;
+ PAIR n_coord;
+ PAIR n_texture;
+ } Sprite16x16;
+
+ struct
+ {
+ PAIR n_bgr;
+ PAIR n_coord;
+ PAIR n_texture;
+ PAIR n_size;
+ } FlatTexturedRectangle;
+
+ struct
+ {
+ PAIR n_bgr;
+ struct FLATVERTEX vertex[ 4 ];
+ } FlatPolygon;
+
+ struct
+ {
+ struct GOURAUDVERTEX vertex[ 4 ];
+ } GouraudPolygon;
+
+ struct
+ {
+ PAIR n_bgr;
+ struct FLATVERTEX vertex[ 2 ];
+ } MonochromeLine;
+
+ struct
+ {
+ struct GOURAUDVERTEX vertex[ 2 ];
+ } GouraudLine;
+
+ struct
+ {
+ PAIR n_bgr;
+ struct FLATTEXTUREDVERTEX vertex[ 4 ];
+ } FlatTexturedPolygon;
+
+ struct
+ {
+ struct GOURAUDTEXTUREDVERTEX vertex[ 4 ];
+ } GouraudTexturedPolygon;
+
+ struct
+ {
+ PAIR n_bgr;
+ struct FLATVERTEX vertex;
+ } Dot;
+ };
- struct
- {
- struct GOURAUDTEXTUREDVERTEX vertex[ 4 ];
- } GouraudTexturedPolygon;
-
- struct
- {
- PAIR n_bgr;
- struct FLATVERTEX vertex;
- } Dot;
-};
-
-class psxgpu_device : public device_t
-{
-public:
- // construction/destruction
- psxgpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source);
- virtual machine_config_constructor device_mconfig_additions() const override;
-
- // static configuration helpers
- template<class _Object> static devcb_base &set_vblank_handler(device_t &device, _Object object) { return downcast<psxgpu_device &>(device).m_vblank_handler.set_callback(object); }
-
- uint32_t update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- DECLARE_WRITE32_MEMBER( write );
- DECLARE_READ32_MEMBER( read );
- void dma_read( uint32_t *ram, uint32_t n_address, int32_t n_size );
- void dma_write( uint32_t *ram, uint32_t n_address, int32_t n_size );
- void lightgun_set( int, int );
- int vramSize;
- void vblank(screen_device &screen, bool vblank_state);
- DECLARE_PALETTE_INIT( psx );
-
-protected:
- virtual void device_start() override;
- virtual void device_reset() override;
-
-private:
void updatevisiblearea();
void decode_tpage( uint32_t tpage );
void FlatPolygon( int n_points );
void FlatTexturedPolygon( int n_points );
void GouraudPolygon( int n_points );
void GouraudTexturedPolygon( int n_points );
- void MonochromeLine( void );
- void GouraudLine( void );
- void FrameBufferRectangleDraw( void );
- void FlatRectangle( void );
- void FlatRectangle8x8( void );
- void FlatRectangle16x16( void );
- void FlatTexturedRectangle( void );
- void Sprite8x8( void );
- void Sprite16x16( void );
- void Dot( void );
- void MoveImage( void );
+ void MonochromeLine();
+ void GouraudLine();
+ void FrameBufferRectangleDraw();
+ void FlatRectangle();
+ void FlatRectangle8x8();
+ void FlatRectangle16x16();
+ void FlatTexturedRectangle();
+ void Sprite8x8();
+ void Sprite16x16();
+ void Dot();
+ void MoveImage();
void psx_gpu_init( int n_gputype );
void gpu_reset();
void gpu_read( uint32_t *p_ram, int32_t n_size );
@@ -302,12 +305,12 @@ private:
devcb_write_line m_vblank_handler;
-#if defined(DEBUG_VIEWER) && DEBUG_VIEWER
+#if defined(PSXGPU_DEBUG_VIEWER) && PSXGPU_DEBUG_VIEWER
required_device<screen_device> m_screen;
- void DebugMeshInit( void );
+ void DebugMeshInit();
void DebugMesh( int n_coordx, int n_coordy );
- void DebugMeshEnd( void );
- void DebugCheckKeys( void );
+ void DebugMeshEnd();
+ void DebugCheckKeys();
int DebugMeshDisplay( bitmap_ind16 &bitmap, const rectangle &cliprect );
int DebugTextureDisplay( bitmap_ind16 &bitmap );
@@ -357,4 +360,4 @@ public:
cxd8654q_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
};
-#endif
+#endif // MAME_VIDEO_PSX_H
diff --git a/src/devices/video/ramdac.cpp b/src/devices/video/ramdac.cpp
index 195365fff91..7014d464a5a 100644
--- a/src/devices/video/ramdac.cpp
+++ b/src/devices/video/ramdac.cpp
@@ -29,7 +29,7 @@ ADDRESS_MAP_END
//**************************************************************************
// device type definition
-const device_type RAMDAC = device_creator<ramdac_device>;
+DEFINE_DEVICE_TYPE(RAMDAC, ramdac_device, "ramdac", "RAMDAC")
//**************************************************************************
@@ -41,7 +41,7 @@ const device_type RAMDAC = device_creator<ramdac_device>;
//-------------------------------------------------
ramdac_device::ramdac_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, RAMDAC, "RAMDAC", tag, owner, clock, "ramdac", __FILE__),
+ : device_t(mconfig, RAMDAC, tag, owner, clock),
device_memory_interface(mconfig, *this),
m_space_config("videoram", ENDIANNESS_LITTLE, 8, 10, 0, nullptr, *ADDRESS_MAP_NAME(ramdac_palram)),
m_palette(*this, finder_base::DUMMY_TAG),
diff --git a/src/devices/video/ramdac.h b/src/devices/video/ramdac.h
index 9ae4ce030d2..709cda23711 100644
--- a/src/devices/video/ramdac.h
+++ b/src/devices/video/ramdac.h
@@ -6,10 +6,10 @@
***************************************************************************/
-#pragma once
+#ifndef MAME_VIDEO_RAMDAC_H
+#define MAME_VIDEO_RAMDAC_H
-#ifndef __ramdacDEV_H__
-#define __ramdacDEV_H__
+#pragma once
@@ -85,7 +85,6 @@ private:
// device type definition
-extern const device_type RAMDAC;
-
+DECLARE_DEVICE_TYPE(RAMDAC, ramdac_device)
-#endif
+#endif // MAME_VIDEO_RAMDAC_H
diff --git a/src/devices/video/saa5050.cpp b/src/devices/video/saa5050.cpp
index a06a30299e0..cebcbe7e40e 100644
--- a/src/devices/video/saa5050.cpp
+++ b/src/devices/video/saa5050.cpp
@@ -26,14 +26,14 @@
// DEVICE DEFINITIONS
//**************************************************************************
-const device_type SAA5050 = device_creator<saa5050_device>;
-const device_type SAA5051 = device_creator<saa5051_device>;
-const device_type SAA5052 = device_creator<saa5052_device>;
-const device_type SAA5053 = device_creator<saa5053_device>;
-const device_type SAA5054 = device_creator<saa5054_device>;
-const device_type SAA5055 = device_creator<saa5055_device>;
-const device_type SAA5056 = device_creator<saa5056_device>;
-const device_type SAA5057 = device_creator<saa5057_device>;
+DEFINE_DEVICE_TYPE(SAA5050, saa5050_device, "saa5050", "Mullard SA5050")
+DEFINE_DEVICE_TYPE(SAA5051, saa5051_device, "saa5051", "Mullard SA5051")
+DEFINE_DEVICE_TYPE(SAA5052, saa5052_device, "saa5052", "Mullard SA5052")
+DEFINE_DEVICE_TYPE(SAA5053, saa5053_device, "saa5053", "Mullard SA5053")
+DEFINE_DEVICE_TYPE(SAA5054, saa5054_device, "saa5054", "Mullard SA5054")
+DEFINE_DEVICE_TYPE(SAA5055, saa5055_device, "saa5055", "Mullard SA5055")
+DEFINE_DEVICE_TYPE(SAA5056, saa5056_device, "saa5056", "Mullard SA5056")
+DEFINE_DEVICE_TYPE(SAA5057, saa5057_device, "saa5057", "Mullard SA5057")
//-------------------------------------------------
@@ -174,8 +174,8 @@ const tiny_rom_entry *saa5057_device::device_rom_region() const
// saa5050_device - constructor
//-------------------------------------------------
-saa5050_device::saa5050_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source) :
- device_t(mconfig, type, name, tag, owner, clock, shortname, source),
+saa5050_device::saa5050_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) :
+ device_t(mconfig, type, tag, owner, clock),
m_char_rom(*this, "chargen"),
m_read_d(*this),
m_frame_count(0),
@@ -186,36 +186,44 @@ saa5050_device::saa5050_device(const machine_config &mconfig, device_type type,
}
saa5050_device::saa5050_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, SAA5050, "SAA5050 Video", tag, owner, clock, "saa5050", __FILE__),
- m_char_rom(*this, "chargen"),
- m_read_d(*this),
- m_frame_count(0),
- m_cols(0),
- m_rows(0),
- m_size(0)
+ saa5050_device(mconfig, SAA5050, tag, owner, clock)
{
}
saa5051_device::saa5051_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : saa5050_device(mconfig, SAA5051, "SAA5051", tag, owner, clock, "saa5051", __FILE__) { }
+ : saa5050_device(mconfig, SAA5051, tag, owner, clock)
+{
+}
saa5052_device::saa5052_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : saa5050_device(mconfig, SAA5052, "SAA5052", tag, owner, clock, "saa5052", __FILE__) { }
+ : saa5050_device(mconfig, SAA5052, tag, owner, clock)
+{
+}
saa5053_device::saa5053_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : saa5050_device(mconfig, SAA5053, "SAA5053", tag, owner, clock, "saa5053", __FILE__) { }
+ : saa5050_device(mconfig, SAA5053, tag, owner, clock)
+{
+}
saa5054_device::saa5054_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : saa5050_device(mconfig, SAA5054, "SAA5054", tag, owner, clock, "saa5054", __FILE__) { }
+ : saa5050_device(mconfig, SAA5054, tag, owner, clock)
+{
+}
saa5055_device::saa5055_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : saa5050_device(mconfig, SAA5055, "SAA5055", tag, owner, clock, "saa5055", __FILE__) { }
+ : saa5050_device(mconfig, SAA5055, tag, owner, clock)
+{
+}
saa5056_device::saa5056_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : saa5050_device(mconfig, SAA5056, "SAA5056", tag, owner, clock, "saa5056", __FILE__) { }
+ : saa5050_device(mconfig, SAA5056, tag, owner, clock)
+{
+}
saa5057_device::saa5057_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : saa5050_device(mconfig, SAA5057, "SAA5057", tag, owner, clock, "saa5057", __FILE__) { }
+ : saa5050_device(mconfig, SAA5057, tag, owner, clock)
+{
+}
diff --git a/src/devices/video/saa5050.h b/src/devices/video/saa5050.h
index c88d840227c..4d943cefd0b 100644
--- a/src/devices/video/saa5050.h
+++ b/src/devices/video/saa5050.h
@@ -23,10 +23,10 @@
**********************************************************************/
-#pragma once
+#ifndef MAME_VIDEO_SAA5050_H
+#define MAME_VIDEO_SAA5050_H
-#ifndef __SAA5050__
-#define __SAA5050__
+#pragma once
@@ -54,12 +54,11 @@ class saa5050_device : public device_t
{
public:
// construction/destruction
- saa5050_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source);
saa5050_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
static void static_set_screen_size(device_t &device, int cols, int rows, int size) { downcast<saa5050_device &>(device).m_cols = cols; downcast<saa5050_device &>(device).m_rows = rows; downcast<saa5050_device &>(device).m_size = size; }
- template<class _Object> static devcb_base &set_d_rd_callback(device_t &device, _Object object) { return downcast<saa5050_device &>(device).m_read_d.set_callback(object); }
+ template <class Object> static devcb_base &set_d_rd_callback(device_t &device, Object &&cb) { return downcast<saa5050_device &>(device).m_read_d.set_callback(std::forward<Object>(cb)); }
// optional information overrides
virtual const tiny_rom_entry *device_rom_region() const override;
@@ -78,6 +77,8 @@ public:
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
protected:
+ saa5050_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
+
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
@@ -254,15 +255,13 @@ public:
// device type definition
-extern const device_type SAA5050; // English
-extern const device_type SAA5051; // German
-extern const device_type SAA5052; // Swedish/Finnish
-extern const device_type SAA5053; // Italian
-extern const device_type SAA5054; // Belgian
-extern const device_type SAA5055; // US ASCII
-extern const device_type SAA5056; // Hebrew
-extern const device_type SAA5057; // Cyrillic
-
-
-
-#endif
+DECLARE_DEVICE_TYPE(SAA5050, saa5050_device) // English
+DECLARE_DEVICE_TYPE(SAA5051, saa5051_device) // German
+DECLARE_DEVICE_TYPE(SAA5052, saa5052_device) // Swedish/Finnish
+DECLARE_DEVICE_TYPE(SAA5053, saa5053_device) // Italian
+DECLARE_DEVICE_TYPE(SAA5054, saa5054_device) // Belgian
+DECLARE_DEVICE_TYPE(SAA5055, saa5055_device) // US ASCII
+DECLARE_DEVICE_TYPE(SAA5056, saa5056_device) // Hebrew
+DECLARE_DEVICE_TYPE(SAA5057, saa5057_device) // Cyrillic
+
+#endif // MAME_VIDEO_SAA5050_H
diff --git a/src/devices/video/scn2674.cpp b/src/devices/video/scn2674.cpp
index 517580c2231..e5058e3a90c 100644
--- a/src/devices/video/scn2674.cpp
+++ b/src/devices/video/scn2674.cpp
@@ -9,11 +9,11 @@
#include "screen.h"
+//#define VERBOSE 1
+#include "logmacro.h"
-#define S674VERBOSE 0
-#define LOG2674(x) do { if (S674VERBOSE) logerror x; } while (0)
-const device_type SCN2674_VIDEO = device_creator<scn2674_device>;
+DEFINE_DEVICE_TYPE(SCN2674_VIDEO, scn2674_device, "scn2674", "Signetics SCN2674 AVDC")
// default address map
@@ -22,19 +22,34 @@ static ADDRESS_MAP_START( scn2674_vram, AS_0, 8, scn2674_device )
ADDRESS_MAP_END
scn2674_device::scn2674_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, SCN2674_VIDEO, "Signetics SCN2674 AVDC", tag, owner, clock, "scn2674_device", __FILE__),
- device_video_interface(mconfig, *this),
- device_memory_interface(mconfig, *this),
- m_irq_cb(*this), m_IR_pointer(0), m_screen1_l(0), m_screen1_h(0), m_cursor_l(0), m_cursor_h(0), m_screen2_l(0), m_screen2_h(0), m_irq_register(0), m_status_register(0), m_irq_mask(0),
- m_gfx_enabled(0), m_display_enabled(0), m_display_enabled_field(0), m_display_enabled_scanline(0), m_cursor_enabled(0), m_hpixels_per_column(0), m_text_hpixels_per_column(0),
- m_gfx_hpixels_per_column(0), m_IR0_double_ht_wd(0), m_IR0_scanline_per_char_row(0), m_IR0_sync_select(0), m_IR0_buffer_mode_select(0), m_IR1_interlace_enable(0), m_IR1_equalizing_constant(0),
- m_IR2_row_table(0), m_IR2_horz_sync_width(0), m_IR2_horz_back_porch(0), m_IR3_vert_front_porch(0), m_IR3_vert_back_porch(0), m_IR4_rows_per_screen(0), m_IR4_character_blink_rate_divisor(0),
- m_IR5_character_per_row(0), m_IR6_cursor_first_scanline(0), m_IR6_cursor_last_scanline(0), m_IR7_cursor_underline_position(0), m_IR7_cursor_rate_divisor(0), m_IR7_cursor_blink(0),
- m_IR7_vsync_width(0), m_IR8_display_buffer_first_address_LSB(0), m_IR9_display_buffer_first_address_MSB(0), m_IR9_display_buffer_last_address(0), m_IR10_display_pointer_address_lower(0),
- m_IR11_display_pointer_address_upper(0), m_IR11_reset_scanline_counter_on_scrollup(0), m_IR11_reset_scanline_counter_on_scrolldown(0), m_IR12_scroll_start(0), m_IR12_split_register_1(0),
- m_IR13_scroll_end(0), m_IR13_split_register_2(0), m_IR14_scroll_lines(0), m_IR14_double_1(0), m_IR14_double_2(0), m_spl1(0), m_spl2(0), m_dbl1(0), m_buffer(0), m_linecounter(0), m_address(0),
- m_start1change(0), m_irq_state(0), m_scanline_timer(nullptr),
- m_space_config("videoram", ENDIANNESS_LITTLE, 8, 16, 0, nullptr, *ADDRESS_MAP_NAME(scn2674_vram))
+ : device_t(mconfig, SCN2674_VIDEO, tag, owner, clock)
+ , device_video_interface(mconfig, *this)
+ , device_memory_interface(mconfig, *this)
+ , m_irq_cb(*this)
+ , m_IR_pointer(0)
+ , m_screen1_l(0), m_screen1_h(0), m_cursor_l(0), m_cursor_h(0), m_screen2_l(0), m_screen2_h(0)
+ , m_irq_register(0), m_status_register(0), m_irq_mask(0)
+ , m_gfx_enabled(0), m_display_enabled(0), m_display_enabled_field(0), m_display_enabled_scanline(0), m_cursor_enabled(0)
+ , m_hpixels_per_column(0), m_text_hpixels_per_column(0), m_gfx_hpixels_per_column(0)
+ , m_IR0_double_ht_wd(0), m_IR0_scanline_per_char_row(0), m_IR0_sync_select(0), m_IR0_buffer_mode_select(0)
+ , m_IR1_interlace_enable(0), m_IR1_equalizing_constant(0)
+ , m_IR2_row_table(0), m_IR2_horz_sync_width(0), m_IR2_horz_back_porch(0)
+ , m_IR3_vert_front_porch(0), m_IR3_vert_back_porch(0)
+ , m_IR4_rows_per_screen(0), m_IR4_character_blink_rate_divisor(0)
+ , m_IR5_character_per_row(0)
+ , m_IR6_cursor_first_scanline(0), m_IR6_cursor_last_scanline(0)
+ , m_IR7_cursor_underline_position(0), m_IR7_cursor_rate_divisor(0), m_IR7_cursor_blink(0), m_IR7_vsync_width(0)
+ , m_IR8_display_buffer_first_address_LSB(0)
+ , m_IR9_display_buffer_first_address_MSB(0), m_IR9_display_buffer_last_address(0)
+ , m_IR10_display_pointer_address_lower(0)
+ , m_IR11_display_pointer_address_upper(0), m_IR11_reset_scanline_counter_on_scrollup(0), m_IR11_reset_scanline_counter_on_scrolldown(0)
+ , m_IR12_scroll_start(0), m_IR12_split_register_1(0)
+ , m_IR13_scroll_end(0), m_IR13_split_register_2(0)
+ , m_IR14_scroll_lines(0), m_IR14_double_1(0), m_IR14_double_2(0)
+ , m_spl1(0), m_spl2(0), m_dbl1(0)
+ , m_buffer(0), m_linecounter(0), m_address(0), m_start1change(0), m_irq_state(0)
+ , m_scanline_timer(nullptr)
+ , m_space_config("videoram", ENDIANNESS_LITTLE, 8, 16, 0, nullptr, *ADDRESS_MAP_NAME(scn2674_vram))
{
}
@@ -119,7 +134,7 @@ void scn2674_device::device_reset()
// 15 Initialization Registers (8-bit each)
void scn2674_device::write_init_regs(uint8_t data)
{
- LOG2674(("scn2674_write_init_regs %02x %02x\n",m_IR_pointer,data));
+ LOG("scn2674_write_init_regs %02x %02x\n",m_IR_pointer,data);
switch ( m_IR_pointer) /* display some debug info, set mame specific variables */
{
@@ -129,18 +144,18 @@ void scn2674_device::write_init_regs(uint8_t data)
m_IR0_sync_select = (data&0x04)>>2;
m_IR0_buffer_mode_select = (data&0x03);
- LOG2674(("IR0 - Double Ht Wd %02x\n",m_IR0_double_ht_wd));//affects IR14 as well
- LOG2674(("IR0 - Scanlines per Character Row %02x\n",m_IR0_scanline_per_char_row));//value+1 = scanlines
- LOG2674(("IR0 - Sync Select %02x\n",m_IR0_sync_select));//1 = csync
- LOG2674(("IR0 - Buffer Mode Select %02x\n",m_IR0_buffer_mode_select)); //0 independent 1 transparent 2 shared 3 row
+ LOG("IR0 - Double Ht Wd %02x\n",m_IR0_double_ht_wd);//affects IR14 as well
+ LOG("IR0 - Scanlines per Character Row %02x\n",m_IR0_scanline_per_char_row);//value+1 = scanlines
+ LOG("IR0 - Sync Select %02x\n",m_IR0_sync_select);//1 = csync
+ LOG("IR0 - Buffer Mode Select %02x\n",m_IR0_buffer_mode_select); //0 independent 1 transparent 2 shared 3 row
break;
case 1:
m_IR1_interlace_enable = (data&0x80)>>7;
m_IR1_equalizing_constant = (data&0x7f)+1;
- LOG2674(("IR1 - Interlace Enable %02x\n",m_IR1_interlace_enable));
- LOG2674(("IR1 - Equalizing Constant %02i CCLKs\n",m_IR1_equalizing_constant));
+ LOG("IR1 - Interlace Enable %02x\n",m_IR1_interlace_enable);
+ LOG("IR1 - Equalizing Constant %02i CCLKs\n",m_IR1_equalizing_constant);
break;
case 2:
@@ -148,25 +163,25 @@ void scn2674_device::write_init_regs(uint8_t data)
m_IR2_horz_sync_width = (((data&0x78)>>3)*2) + 2;
m_IR2_horz_back_porch = ((data&0x07)*4) - 1;
- LOG2674(("IR2 - Row Table %02x\n",m_IR2_row_table));
- LOG2674(("IR2 - Horizontal Sync Width %02i CCLKs\n",m_IR2_horz_sync_width));
- LOG2674(("IR2 - Horizontal Back Porch %02i CCLKs\n",m_IR2_horz_back_porch));
+ LOG("IR2 - Row Table %02x\n",m_IR2_row_table);
+ LOG("IR2 - Horizontal Sync Width %02i CCLKs\n",m_IR2_horz_sync_width);
+ LOG("IR2 - Horizontal Back Porch %02i CCLKs\n",m_IR2_horz_back_porch);
break;
case 3:
m_IR3_vert_front_porch = (((data&0xe0)>>5) * 4)+4 ;
m_IR3_vert_back_porch = ((data&0x1f) * 2) + 4;
- LOG2674(("IR3 - Vertical Front Porch %02i Lines\n",m_IR3_vert_front_porch));
- LOG2674(("IR3 - Vertical Back Porch %02i Lines\n",m_IR3_vert_back_porch));
+ LOG("IR3 - Vertical Front Porch %02i Lines\n",m_IR3_vert_front_porch);
+ LOG("IR3 - Vertical Back Porch %02i Lines\n",m_IR3_vert_back_porch);
break;
case 4:
m_IR4_rows_per_screen = (data&0x7f) + 1;
m_IR4_character_blink_rate_divisor = ((data & 0x80)>>7 ? 128:64);
- LOG2674(("IR4 - Rows Per Screen %02i\n",m_IR4_rows_per_screen));
- LOG2674(("IR4 - Character Blink Rate = 1/%02i\n",m_IR4_character_blink_rate_divisor));
+ LOG("IR4 - Rows Per Screen %02i\n",m_IR4_rows_per_screen);
+ LOG("IR4 - Character Blink Rate = 1/%02i\n",m_IR4_character_blink_rate_divisor);
break;
case 5:
@@ -174,14 +189,14 @@ void scn2674_device::write_init_regs(uint8_t data)
cccc cccc
c = Characters Per Row */
m_IR5_character_per_row = data + 1;
- LOG2674(("IR5 - Active Characters Per Row %02i\n",m_IR5_character_per_row));
+ LOG("IR5 - Active Characters Per Row %02i\n",m_IR5_character_per_row);
break;
case 6:
m_IR6_cursor_last_scanline = (data & 0x0f);
m_IR6_cursor_first_scanline = (data & 0xf0)>>4;
- LOG2674(("IR6 - First Line of Cursor %02x\n",m_IR6_cursor_first_scanline));
- LOG2674(("IR6 - Last Line of Cursor %02x\n",m_IR6_cursor_last_scanline));
+ LOG("IR6 - First Line of Cursor %02x\n",m_IR6_cursor_first_scanline);
+ LOG("IR6 - Last Line of Cursor %02x\n",m_IR6_cursor_last_scanline);
break;
case 7:
@@ -193,28 +208,28 @@ void scn2674_device::write_init_regs(uint8_t data)
m_IR7_vsync_width = vsync_table[(data & 0xC0)>>6];
- LOG2674(("IR7 - Underline Position %02x\n",m_IR7_cursor_underline_position));
- LOG2674(("IR7 - Cursor rate 1/%02i\n",m_IR7_cursor_rate_divisor));
- LOG2674(("IR7 - Cursor blink %02x\n",m_IR7_cursor_blink));
- LOG2674(("IR7 - Vsync Width %02i Lines\n",m_IR7_vsync_width));
+ LOG("IR7 - Underline Position %02x\n",m_IR7_cursor_underline_position);
+ LOG("IR7 - Cursor rate 1/%02i\n",m_IR7_cursor_rate_divisor);
+ LOG("IR7 - Cursor blink %02x\n",m_IR7_cursor_blink);
+ LOG("IR7 - Vsync Width %02i Lines\n",m_IR7_vsync_width);
break;
}
case 8:
m_IR8_display_buffer_first_address_LSB = data;
- LOG2674(("IR8 - Display Buffer First Address LSB %02x\n",m_IR8_display_buffer_first_address_LSB));
+ LOG("IR8 - Display Buffer First Address LSB %02x\n",m_IR8_display_buffer_first_address_LSB);
break;
case 9:
m_IR9_display_buffer_first_address_MSB = data & 0x0f;
m_IR9_display_buffer_last_address = (data & 0xf0)>>4;
- LOG2674(("IR9 - Display Buffer First Address MSB %02x\n",m_IR9_display_buffer_first_address_MSB));
- LOG2674(("IR9 - Display Buffer Last Address %02x\n",m_IR9_display_buffer_last_address));
+ LOG("IR9 - Display Buffer First Address MSB %02x\n",m_IR9_display_buffer_first_address_MSB);
+ LOG("IR9 - Display Buffer Last Address %02x\n",m_IR9_display_buffer_last_address);
break;
case 10:
m_IR10_display_pointer_address_lower = data;
- LOG2674(("IR10 - Display Pointer Address Lower %02x\n",m_IR10_display_pointer_address_lower));
+ LOG("IR10 - Display Pointer Address Lower %02x\n",m_IR10_display_pointer_address_lower);
break;
case 11:
@@ -222,23 +237,23 @@ void scn2674_device::write_init_regs(uint8_t data)
m_IR11_reset_scanline_counter_on_scrollup= (data&0x40 >> 6);
m_IR11_reset_scanline_counter_on_scrolldown= (data&0x80 >> 7);
- LOG2674(("IR11 - Display Pointer Address Lower %02x\n",m_IR11_display_pointer_address_upper));
- LOG2674(("IR11 - Reset Scanline Counter on Scroll Up %02x\n",m_IR11_reset_scanline_counter_on_scrollup));
- LOG2674(("IR11 - Reset Scanline Counter on Scroll Down %02x\n",m_IR11_reset_scanline_counter_on_scrolldown));
+ LOG("IR11 - Display Pointer Address Lower %02x\n",m_IR11_display_pointer_address_upper);
+ LOG("IR11 - Reset Scanline Counter on Scroll Up %02x\n",m_IR11_reset_scanline_counter_on_scrollup);
+ LOG("IR11 - Reset Scanline Counter on Scroll Down %02x\n",m_IR11_reset_scanline_counter_on_scrolldown);
break;
case 12:
m_IR12_scroll_start = (data & 0x80)>>7;
m_IR12_split_register_1 = (data & 0x7f);
- LOG2674(("IR12 - Scroll Start %02x\n",m_IR12_scroll_start));
- LOG2674(("IR12 - Split Register 1 %02x\n",m_IR12_split_register_1));
+ LOG("IR12 - Scroll Start %02x\n",m_IR12_scroll_start);
+ LOG("IR12 - Split Register 1 %02x\n",m_IR12_split_register_1);
break;
case 13:
m_IR13_scroll_end = (data & 0x80)>>7;
m_IR13_split_register_2 = (data & 0x7f);
- LOG2674(("IR13 - Scroll End %02x\n",m_IR13_scroll_end));
- LOG2674(("IR13 - Split Register 2 %02x\n",m_IR13_split_register_2));
+ LOG("IR13 - Scroll End %02x\n",m_IR13_scroll_end);
+ LOG("IR13 - Split Register 2 %02x\n",m_IR13_split_register_2);
break;
case 14:
@@ -246,15 +261,15 @@ void scn2674_device::write_init_regs(uint8_t data)
if (!m_IR0_double_ht_wd)
{
m_IR14_double_2 = (data & 0x30)>>4;
- LOG2674(("IR14 - Double 2 %02x\n",m_IR14_double_2));
+ LOG("IR14 - Double 2 %02x\n",m_IR14_double_2);
}
//0 normal, 1, double width, 2, double width and double tops 3, double width and double bottoms
//1 affects SSR1, 2 affects SSR2
//If Double Height enabled in IR0, Screen start 1 upper (bits 7 and 6)replace Double 1, and Double 2 is unused
m_IR14_double_1 = (data & 0xc0)>>6;
- LOG2674(("IR14 - Double 1 %02x\n",m_IR14_double_1));
+ LOG("IR14 - Double 1 %02x\n",m_IR14_double_1);
- LOG2674(("IR14 - Scroll Lines %02i\n",m_IR14_scroll_lines));
+ LOG("IR14 - Scroll Lines %02i\n",m_IR14_scroll_lines);
break;
case 15: /* not valid! */
@@ -276,7 +291,7 @@ void scn2674_device::write_command(uint8_t data)
if (data==0x00)
{
/* master reset, configures registers */
- LOG2674(("master reset\n"));
+ LOG("master reset\n");
m_IR_pointer=0;
m_irq_register = 0x00;
m_status_register = 0x20;//RDFLG activated
@@ -292,7 +307,7 @@ void scn2674_device::write_command(uint8_t data)
{
/* set IR pointer */
operand = data & 0x0f;
- LOG2674(("set IR pointer %02x\n",operand));
+ LOG("set IR pointer %02x\n",operand);
m_IR_pointer=operand;
@@ -303,7 +318,7 @@ void scn2674_device::write_command(uint8_t data)
if ((data&0xe3)==0x22)
{
/* Disable GFX */
- LOG2674(("disable GFX %02x\n",data));
+ LOG("disable GFX %02x\n",data);
m_gfx_enabled = 0;
recompute_parameters();
}
@@ -311,7 +326,7 @@ void scn2674_device::write_command(uint8_t data)
if ((data&0xe3)==0x23)
{
/* Enable GFX */
- LOG2674(("enable GFX %02x\n",data));
+ LOG("enable GFX %02x\n",data);
m_gfx_enabled = 1;
recompute_parameters();
}
@@ -324,9 +339,9 @@ void scn2674_device::write_command(uint8_t data)
m_display_enabled = 0;
if (operand)
- LOG2674(("display OFF - float DADD bus %02x\n",data));
+ LOG("display OFF - float DADD bus %02x\n",data);
else
- LOG2674(("display OFF - no float DADD bus %02x\n",data));
+ LOG("display OFF - no float DADD bus %02x\n",data);
}
if ((data&0xe9)==0x29)
@@ -337,12 +352,12 @@ void scn2674_device::write_command(uint8_t data)
if (operand)
{
m_display_enabled_field = 1;
- LOG2674(("display ON - next field %02x\n",data));
+ LOG("display ON - next field %02x\n",data);
}
else
{
m_display_enabled_scanline = 1;
- LOG2674(("display ON - next scanline %02x\n",data));
+ LOG("display ON - next scanline %02x\n",data);
}
recompute_parameters(); // start the scanline timer
}
@@ -350,14 +365,14 @@ void scn2674_device::write_command(uint8_t data)
if ((data&0xf1)==0x30)
{
/* Cursor Off */
- LOG2674(("cursor off %02x\n",data));
+ LOG("cursor off %02x\n",data);
m_cursor_enabled = 0;
}
if ((data&0xf1)==0x31)
{
/* Cursor On */
- LOG2674(("cursor on %02x\n",data));
+ LOG("cursor on %02x\n",data);
m_cursor_enabled = 1;
}
@@ -367,17 +382,17 @@ void scn2674_device::write_command(uint8_t data)
{
/* Reset Interrupt / Status bit */
operand = data & 0x1f;
- LOG2674(("reset interrupt / status bit %02x\n",operand));
+ LOG("reset interrupt / status bit %02x\n",operand);
m_irq_register &= ~(data & 0x1f);
m_status_register &= ~(data & 0x1f);
- LOG2674(("IRQ Status after reset\n"));
- LOG2674(("Split 2 IRQ: %d Active\n",(m_irq_register>>0)&1));
- LOG2674(("Ready IRQ: %d Active\n",(m_irq_register>>1)&1));
- LOG2674(("Split 1 IRQ: %d Active\n",(m_irq_register>>2)&1));
- LOG2674(("Line Zero IRQ: %d Active\n",(m_irq_register>>3)&1));
- LOG2674(("V-Blank IRQ: %d Active\n",(m_irq_register>>4)&1));
+ LOG("IRQ Status after reset\n");
+ LOG("Split 2 IRQ: %d Active\n",(m_irq_register>>0)&1);
+ LOG("Ready IRQ: %d Active\n",(m_irq_register>>1)&1);
+ LOG("Split 1 IRQ: %d Active\n",(m_irq_register>>2)&1);
+ LOG("Line Zero IRQ: %d Active\n",(m_irq_register>>3)&1);
+ LOG("V-Blank IRQ: %d Active\n",(m_irq_register>>4)&1);
m_irq_state = 0;
@@ -396,12 +411,12 @@ void scn2674_device::write_command(uint8_t data)
/* Disable Interrupt mask*/
operand = data & 0x1f;
m_irq_mask &= ~(operand);
- LOG2674(("IRQ Mask after disable %x\n",operand));
- LOG2674(("Split 2 IRQ: %d Unmasked\n",(m_irq_mask>>0)&1));
- LOG2674(("Ready IRQ: %d Unmasked\n",(m_irq_mask>>1)&1));
- LOG2674(("Split 1 IRQ: %d Unmasked\n",(m_irq_mask>>2)&1));
- LOG2674(("Line Zero IRQ: %d Unmasked\n",(m_irq_mask>>3)&1));
- LOG2674(("V-Blank IRQ: %d Unmasked\n",(m_irq_mask>>4)&1));
+ LOG("IRQ Mask after disable %x\n",operand);
+ LOG("Split 2 IRQ: %d Unmasked\n",(m_irq_mask>>0)&1);
+ LOG("Ready IRQ: %d Unmasked\n",(m_irq_mask>>1)&1);
+ LOG("Split 1 IRQ: %d Unmasked\n",(m_irq_mask>>2)&1);
+ LOG("Line Zero IRQ: %d Unmasked\n",(m_irq_mask>>3)&1);
+ LOG("V-Blank IRQ: %d Unmasked\n",(m_irq_mask>>4)&1);
}
@@ -411,12 +426,12 @@ void scn2674_device::write_command(uint8_t data)
operand = data & 0x1f;
m_irq_mask |= (data & 0x1f);
- LOG2674(("IRQ Mask after enable %x\n",operand));
- LOG2674(("Split 2 IRQ: %d Unmasked\n",(m_irq_mask>>0)&1));
- LOG2674(("Ready IRQ: %d Unmasked\n",(m_irq_mask>>1)&1));
- LOG2674(("Split 1 IRQ: %d Unmasked\n",(m_irq_mask>>2)&1));
- LOG2674(("Line Zero IRQ: %d Unmasked\n",(m_irq_mask>>3)&1));
- LOG2674(("V-Blank IRQ: %d Unmasked\n",(m_irq_mask>>4)&1));
+ LOG("IRQ Mask after enable %x\n",operand);
+ LOG("Split 2 IRQ: %d Unmasked\n",(m_irq_mask>>0)&1);
+ LOG("Ready IRQ: %d Unmasked\n",(m_irq_mask>>1)&1);
+ LOG("Split 1 IRQ: %d Unmasked\n",(m_irq_mask>>2)&1);
+ LOG("Line Zero IRQ: %d Unmasked\n",(m_irq_mask>>3)&1);
+ LOG("V-Blank IRQ: %d Unmasked\n",(m_irq_mask>>4)&1);
}
@@ -428,38 +443,38 @@ void scn2674_device::write_command(uint8_t data)
case 0xa4:
/* read at pointer address */
m_buffer = space().read_byte(m_screen2_l | (m_screen2_h << 8));
- LOG2674(("DELAYED read at pointer address %02x\n",data));
+ LOG("DELAYED read at pointer address %02x\n",data);
break;
case 0xa2:
/* write at pointer address */
space().write_byte(m_screen2_l | (m_screen2_h << 8), m_buffer);
- LOG2674(("DELAYED write at pointer address %02x\n",data));
+ LOG("DELAYED write at pointer address %02x\n",data);
break;
case 0xa6: // used by the Octopus
/* write at pointer address */
space().write_byte((m_IR10_display_pointer_address_lower | (m_IR11_display_pointer_address_upper << 8)), m_buffer);
- LOG2674(("DELAYED write at display pointer address %02x\n",data));
+ LOG("DELAYED write at display pointer address %02x\n",data);
break;
case 0xa9:
/* increment cursor address */
if(!(++m_cursor_l))
m_cursor_h++;
- LOG2674(("DELAYED increase cursor address %02x\n",data));
+ LOG("DELAYED increase cursor address %02x\n",data);
break;
case 0xac:
/* read at cursor address */
m_buffer = space().read_byte(m_cursor_l | (m_cursor_h << 8));
- LOG2674(("DELAYED read at cursor address %02x\n",data));
+ LOG("DELAYED read at cursor address %02x\n",data);
break;
case 0xaa:
/* write at cursor address */
space().write_byte(m_cursor_l | (m_cursor_h << 8), m_buffer);
- LOG2674(("DELAYED write at cursor address %02x\n",data));
+ LOG("DELAYED write at cursor address %02x\n",data);
break;
case 0xad:
@@ -467,7 +482,7 @@ void scn2674_device::write_command(uint8_t data)
m_buffer = space().read_byte(m_cursor_l | (m_cursor_h << 8));
if(!(++m_cursor_l))
m_cursor_h++;
- LOG2674(("DELAYED read at cursor address+increment %02x\n",data));
+ LOG("DELAYED read at cursor address+increment %02x\n",data);
break;
case 0xab:
@@ -476,7 +491,7 @@ void scn2674_device::write_command(uint8_t data)
space().write_byte(m_cursor_l | (m_cursor_h << 8), m_buffer);
if(!(++m_cursor_l))
m_cursor_h++;
- LOG2674(("DELAYED write at cursor address+increment %02x\n",data));
+ LOG("DELAYED write at cursor address+increment %02x\n",data);
break;
case 0xbb:
@@ -486,12 +501,12 @@ void scn2674_device::write_command(uint8_t data)
space().write_byte(i, m_buffer); // get the last
m_cursor_l = m_screen2_l;
m_cursor_h = m_screen2_h;
- LOG2674(("DELAYED write from cursor address to pointer address %02x\n",data));
+ LOG("DELAYED write from cursor address to pointer address %02x\n",data);
break;
case 0xbd:
/* read from cursor address to pointer address */
- LOG2674(("DELAYED read from cursor address to pointer address %02x\n",data));
+ LOG("DELAYED read from cursor address to pointer address %02x\n",data);
break;
case 0xbf:
@@ -501,7 +516,7 @@ void scn2674_device::write_command(uint8_t data)
space().write_byte(i, m_buffer); // get the last
m_cursor_l = m_IR10_display_pointer_address_lower;
m_cursor_h = m_IR11_display_pointer_address_upper;
- LOG2674(("DELAYED write from cursor address to pointer address %02x\n",data));
+ LOG("DELAYED write from cursor address to pointer address %02x\n",data);
break;
}
}
@@ -537,19 +552,19 @@ READ8_MEMBER( scn2674_device::read )
*/
case 0:
- LOG2674(("Read Irq Register %02x %06x\n",m_irq_register,space.device().safe_pc()));
+ LOG("Read Irq Register %02x %06x\n",m_irq_register,space.device().safe_pc());
return m_irq_register;
case 1:
- LOG2674(("Read Status Register %02X %06x\n",m_status_register,space.device().safe_pc()));
+ LOG("Read Status Register %02X %06x\n",m_status_register,space.device().safe_pc());
return m_status_register;
- case 2: LOG2674(("Read Screen1_l Register %06x\n",space.device().safe_pc()));return m_screen1_l;
- case 3: LOG2674(("Read Screen1_h Register %06x\n",space.device().safe_pc()));return m_screen1_h & 0x3f;
- case 4: LOG2674(("Read Cursor_l Register %06x\n",space.device().safe_pc()));return m_cursor_l;
- case 5: LOG2674(("Read Cursor_h Register %06x\n",space.device().safe_pc()));return m_cursor_h;
- case 6: LOG2674(("Read Screen2_l Register %06x\n",space.device().safe_pc()));return m_screen2_l;
- case 7: LOG2674(("Read Screen2_h Register %06x\n",space.device().safe_pc()));return m_screen2_h;
+ case 2: LOG("Read Screen1_l Register %06x\n",space.device().safe_pc());return m_screen1_l;
+ case 3: LOG("Read Screen1_h Register %06x\n",space.device().safe_pc());return m_screen1_h & 0x3f;
+ case 4: LOG("Read Cursor_l Register %06x\n",space.device().safe_pc());return m_cursor_l;
+ case 5: LOG("Read Cursor_h Register %06x\n",space.device().safe_pc());return m_cursor_h;
+ case 6: LOG("Read Screen2_l Register %06x\n",space.device().safe_pc());return m_screen2_l;
+ case 7: LOG("Read Screen2_h Register %06x\n",space.device().safe_pc());return m_screen2_h;
}
return 0xff;
@@ -592,7 +607,7 @@ WRITE8_MEMBER( scn2674_device::write )
{
m_IR14_double_1 = m_dbl1;
m_screen1_h &= 0x3f;
- LOG2674(("IR14 - Double 1 overridden %02x\n",m_IR14_double_1));
+ LOG("IR14 - Double 1 overridden %02x\n",m_IR14_double_1);
}
if(!m_screen->vblank())
m_start1change = (m_linecounter / m_IR0_scanline_per_char_row) + 1;
@@ -624,7 +639,7 @@ void scn2674_device::recompute_parameters()
return;
}
- LOG2674(("width %u height %u max_x %u max_y %u refresh %f\n", horiz_pix_total, vert_pix_total, max_visible_x, max_visible_y, 1 / ATTOSECONDS_TO_DOUBLE(refresh)));
+ LOG("width %u height %u max_x %u max_y %u refresh %f\n", horiz_pix_total, vert_pix_total, max_visible_x, max_visible_y, 1 / ATTOSECONDS_TO_DOUBLE(refresh));
rectangle visarea;
visarea.set(0, max_visible_x, 0, max_visible_y);
@@ -660,7 +675,7 @@ void scn2674_device::device_timer(emu_timer &timer, device_timer_id id, int para
m_status_register |= 0x10;
if(m_irq_mask & 0x10)
{
- LOG2674(("vblank irq\n"));
+ LOG("vblank irq\n");
m_irq_state = 1;
m_irq_register |= 0x10;
m_irq_cb(1);
@@ -679,7 +694,7 @@ void scn2674_device::device_timer(emu_timer &timer, device_timer_id id, int para
m_status_register |= 0x08;
if (m_irq_mask & 0x08)
{
- LOG2674(("SCN2674 Line Zero\n"));
+ LOG("SCN2674 Line Zero\n");
m_irq_state = 1;
m_irq_register |= 0x08;
m_irq_cb(1);
@@ -691,7 +706,7 @@ void scn2674_device::device_timer(emu_timer &timer, device_timer_id id, int para
m_status_register |= 0x04;
if(m_irq_mask & 0x04)
{
- LOG2674(("SCN2674 Split Screen 1 irq\n"));
+ LOG("SCN2674 Split Screen 1 irq\n");
m_irq_state = 1;
m_irq_register |= 0x04;
m_irq_cb(1);
@@ -707,7 +722,7 @@ void scn2674_device::device_timer(emu_timer &timer, device_timer_id id, int para
m_status_register |= 0x01;
if(m_irq_mask & 0x01)
{
- LOG2674(("SCN2674 Split Screen 2 irq\n"));
+ LOG("SCN2674 Split Screen 2 irq\n");
m_irq_state = 1;
m_irq_register |= 0x01;
m_irq_cb(1);
diff --git a/src/devices/video/scn2674.h b/src/devices/video/scn2674.h
index 2353a84cbcb..1c7c724a399 100644
--- a/src/devices/video/scn2674.h
+++ b/src/devices/video/scn2674.h
@@ -1,7 +1,9 @@
// license:BSD-3-Clause
// copyright-holders:Carl
-#ifndef SCN2674_H
-#define SCN2674_H
+#ifndef MAME_VIDEO_SCN2674_H
+#define MAME_VIDEO_SCN2674_H
+
+#pragma once
#define MCFG_SCN2674_VIDEO_ADD(_tag, _clock, _irq) \
@@ -29,10 +31,10 @@ public:
typedef device_delegate<void (bitmap_rgb32 &bitmap, int x, int y, uint8_t linecount, uint8_t charcode, uint16_t address, uint8_t cursor, uint8_t dw, uint8_t lg, uint8_t ul, uint8_t blink)> draw_character_delegate;
// static configuration
- template<class _Object> static devcb_base &set_irq_callback(device_t &device, _Object object) { return downcast<scn2674_device &>(device).m_irq_cb.set_callback(object); }
+ template <class Object> static devcb_base &set_irq_callback(device_t &device, Object &&cb) { return downcast<scn2674_device &>(device).m_irq_cb.set_callback(std::forward<Object>(cb)); }
static void static_set_character_width(device_t &device, int value) { downcast<scn2674_device &>(device).m_text_hpixels_per_column = value; }
static void static_set_gfx_character_width(device_t &device, int value) { downcast<scn2674_device &>(device).m_gfx_hpixels_per_column = value; }
- static void static_set_display_callback(device_t &device, draw_character_delegate callback) { downcast<scn2674_device &>(device).m_display_cb = callback; }
+ static void static_set_display_callback(device_t &device, draw_character_delegate &&cb) { downcast<scn2674_device &>(device).m_display_cb = std::move(cb); }
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
@@ -40,7 +42,7 @@ public:
DECLARE_WRITE8_MEMBER( buffer_w ) { m_buffer = data; }
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
- virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override { return (spacenum == AS_0) ? &m_space_config : nullptr; }
+ virtual const address_space_config *memory_space_config(address_spacenum spacenum) const override { return (spacenum == AS_0) ? &m_space_config : nullptr; }
protected:
virtual void device_start() override;
@@ -127,6 +129,6 @@ private:
};
-extern const device_type SCN2674_VIDEO;
+DECLARE_DEVICE_TYPE(SCN2674_VIDEO, scn2674_device)
-#endif
+#endif // MAME_VIDEO_SCN2674_H
diff --git a/src/devices/video/sed1200.cpp b/src/devices/video/sed1200.cpp
index d25d6ea9d61..371832f579a 100644
--- a/src/devices/video/sed1200.cpp
+++ b/src/devices/video/sed1200.cpp
@@ -16,10 +16,10 @@
#include "emu.h"
#include "sed1200.h"
-const device_type SED1200D0A = device_creator<sed1200d0a_device>;
-const device_type SED1200F0A = device_creator<sed1200f0a_device>;
-const device_type SED1200D0B = device_creator<sed1200d0b_device>;
-const device_type SED1200F0B = device_creator<sed1200f0b_device>;
+DEFINE_DEVICE_TYPE(SED1200D0A, sed1200d0a_device, "sed1200da", "Epson SED1200D-0A")
+DEFINE_DEVICE_TYPE(SED1200F0A, sed1200f0a_device, "sed1200fa", "Epson SED1200F-0A")
+DEFINE_DEVICE_TYPE(SED1200D0B, sed1200d0b_device, "sed1200db", "Epson SED1200D-0B")
+DEFINE_DEVICE_TYPE(SED1200F0B, sed1200f0b_device, "sed1200fb", "Epson SED1200F-0B")
ROM_START( sed1200x0a )
ROM_REGION( 0x800, "cgrom", 0 )
@@ -31,28 +31,28 @@ ROM_START( sed1200x0b )
ROM_LOAD( "sed1200-b.bin", 0x000, 0x800, CRC(d0741f51) SHA1(c8c856f1357286a2c8c806af81724a828345357e))
ROM_END
-sed1200_device::sed1200_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source) :
- device_t(mconfig, type, name, tag, owner, clock, shortname, source), cursor_direction(false), cursor_blinking(false), cursor_full(false), cursor_on(false), display_on(false), cursor_address(0), cgram_address(0), cgrom(nullptr)
+sed1200_device::sed1200_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) :
+ device_t(mconfig, type, tag, owner, clock), cursor_direction(false), cursor_blinking(false), cursor_full(false), cursor_on(false), display_on(false), cursor_address(0), cgram_address(0), cgrom(nullptr)
{
}
sed1200d0a_device::sed1200d0a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- sed1200_device(mconfig, SED1200D0A, "sed1200d-0a", tag, owner, clock, "sed1200da", __FILE__)
+ sed1200_device(mconfig, SED1200D0A, tag, owner, clock)
{
}
sed1200f0a_device::sed1200f0a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- sed1200_device(mconfig, SED1200F0A, "sed1200f-0a", tag, owner, clock, "sed1200fa", __FILE__)
+ sed1200_device(mconfig, SED1200F0A, tag, owner, clock)
{
}
sed1200d0b_device::sed1200d0b_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- sed1200_device(mconfig, SED1200D0B, "sed1200d-0b", tag, owner, clock, "sed1200db", __FILE__)
+ sed1200_device(mconfig, SED1200D0B, tag, owner, clock)
{
}
sed1200f0b_device::sed1200f0b_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- sed1200_device(mconfig, SED1200F0B, "sed1200f-0b", tag, owner, clock, "sed1200fb", __FILE__)
+ sed1200_device(mconfig, SED1200F0B, tag, owner, clock)
{
}
diff --git a/src/devices/video/sed1200.h b/src/devices/video/sed1200.h
index 454e3585968..521bd4e027c 100644
--- a/src/devices/video/sed1200.h
+++ b/src/devices/video/sed1200.h
@@ -12,8 +12,10 @@
***************************************************************************/
-#ifndef __SED1200_H__
-#define __SED1200_H__
+#ifndef MAME_VIDEO_SED1200_H
+#define MAME_VIDEO_SED1200_H
+
+#pragma once
#define MCFG_SED1200D0A_ADD( _tag ) \
MCFG_DEVICE_ADD( _tag, SED1200D0A, 0 )
@@ -29,8 +31,6 @@
class sed1200_device : public device_t {
public:
- sed1200_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source);
-
void control_w(uint8_t data);
uint8_t control_r();
void data_w(uint8_t data);
@@ -38,6 +38,8 @@ public:
const uint8_t *render();
protected:
+ sed1200_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
+
virtual void device_start() override;
private:
@@ -84,9 +86,9 @@ protected:
virtual const tiny_rom_entry *device_rom_region() const override;
};
-extern const device_type SED1200D0A;
-extern const device_type SED1200F0A;
-extern const device_type SED1200D0B;
-extern const device_type SED1200F0B;
+DECLARE_DEVICE_TYPE(SED1200D0A, sed1200d0a_device)
+DECLARE_DEVICE_TYPE(SED1200F0A, sed1200f0a_device)
+DECLARE_DEVICE_TYPE(SED1200D0B, sed1200d0b_device)
+DECLARE_DEVICE_TYPE(SED1200F0B, sed1200f0b_device)
-#endif
+#endif // MAME_VIDEO_SED1200_H
diff --git a/src/devices/video/sed1330.cpp b/src/devices/video/sed1330.cpp
index d7cb154cb91..0336205784a 100644
--- a/src/devices/video/sed1330.cpp
+++ b/src/devices/video/sed1330.cpp
@@ -9,14 +9,15 @@
#include "emu.h"
#include "sed1330.h"
+//#define VERBOSE 1
+#include "logmacro.h"
+
//**************************************************************************
// MACROS / CONSTANTS
//**************************************************************************
-#define LOG 0
-
#define INSTRUCTION_SYSTEM_SET 0x40
#define INSTRUCTION_SLEEP_IN 0x53 // unimplemented
@@ -61,7 +62,7 @@
//**************************************************************************
// device type definition
-const device_type SED1330 = device_creator<sed1330_device>;
+DEFINE_DEVICE_TYPE(SED1330, sed1330_device, "sed1330", "Epson SED1330")
// default address map
@@ -139,7 +140,7 @@ inline void sed1330_device::increment_csr()
//-------------------------------------------------
sed1330_device::sed1330_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, SED1330, "SED1330", tag, owner, clock, "sed1330", __FILE__),
+ : device_t(mconfig, SED1330, tag, owner, clock),
device_memory_interface(mconfig, *this),
device_video_interface(mconfig, *this),
m_bf(0),
@@ -230,7 +231,7 @@ const address_space_config *sed1330_device::memory_space_config(address_spacenum
READ8_MEMBER( sed1330_device::status_r )
{
- if (LOG) logerror("SED1330 '%s' Status Read: %s\n", tag(), m_bf ? "busy" : "ready");
+ LOG("SED1330 Status Read: %s\n", m_bf ? "busy" : "ready");
return m_bf << 6;
}
@@ -257,15 +258,12 @@ WRITE8_MEMBER( sed1330_device::command_w )
case INSTRUCTION_CSRDIR_DOWN:
m_cd = data & 0x03;
- if (LOG)
+ switch (m_cd)
{
- switch (m_cd)
- {
- case CSRDIR_RIGHT: logerror("SED1330 '%s' Cursor Direction: Right\n", tag()); break;
- case CSRDIR_LEFT: logerror("SED1330 '%s' Cursor Direction: Left\n", tag()); break;
- case CSRDIR_UP: logerror("SED1330 '%s' Cursor Direction: Up\n", tag()); break;
- case CSRDIR_DOWN: logerror("SED1330 '%s' Cursor Direction: Down\n", tag()); break;
- }
+ case CSRDIR_RIGHT: LOG("SED1330 Cursor Direction: Right\n"); break;
+ case CSRDIR_LEFT: LOG("SED1330 Cursor Direction: Left\n"); break;
+ case CSRDIR_UP: LOG("SED1330 Cursor Direction: Up\n"); break;
+ case CSRDIR_DOWN: LOG("SED1330 Cursor Direction: Down\n"); break;
}
break;
}
@@ -280,7 +278,7 @@ READ8_MEMBER( sed1330_device::data_r )
{
uint8_t data = readbyte(m_csr);
- if (LOG) logerror("SED1330 '%s' Memory Read %02x from %04x\n", tag(), data, m_csr);
+ LOG("SED1330 Memory Read %02x from %04x\n", data, m_csr);
increment_csr();
@@ -306,45 +304,39 @@ WRITE8_MEMBER( sed1330_device::data_w )
m_ws = BIT(data, 3);
m_iv = BIT(data, 5);
- if (LOG)
- {
- logerror("SED1330 '%s' %s CG ROM\n", tag(), BIT(data, 0) ? "External" : "Internal");
- logerror("SED1330 '%s' D6 Correction: %s\n", tag(), BIT(data, 1) ? "enabled" : "disabled");
- logerror("SED1330 '%s' Character Height: %u\n", tag(), BIT(data, 2) ? 16 : 8);
- logerror("SED1330 '%s' %s Panel Drive\n", tag(), BIT(data, 3) ? "Dual" : "Single");
- logerror("SED1330 '%s' Screen Top-Line Correction: %s\n", tag(), BIT(data, 5) ? "disabled" : "enabled");
- }
+ LOG("SED1330 %s CG ROM\n", BIT(data, 0) ? "External" : "Internal");
+ LOG("SED1330 D6 Correction: %s\n", BIT(data, 1) ? "enabled" : "disabled");
+ LOG("SED1330 Character Height: %u\n", BIT(data, 2) ? 16 : 8);
+ LOG("SED1330 %s Panel Drive\n", BIT(data, 3) ? "Dual" : "Single");
+ LOG("SED1330 Screen Top-Line Correction: %s\n", BIT(data, 5) ? "disabled" : "enabled");
break;
case 1:
m_fx = (data & 0x07) + 1;
m_wf = BIT(data, 7);
- if (LOG)
- {
- logerror("SED1330 '%s' Horizontal Character Size: %u\n", tag(), m_fx);
- logerror("SED1330 '%s' %s AC Drive\n", tag(), BIT(data, 7) ? "2-frame" : "16-line");
- }
+ LOG("SED1330 Horizontal Character Size: %u\n", m_fx);
+ LOG("SED1330 %s AC Drive\n", BIT(data, 7) ? "2-frame" : "16-line");
break;
case 2:
m_fy = (data & 0x0f) + 1;
- if (LOG) logerror("SED1330 '%s' Vertical Character Size: %u\n", tag(), m_fy);
+ LOG("SED1330 Vertical Character Size: %u\n", m_fy);
break;
case 3:
m_cr = data + 1;
- if (LOG) logerror("SED1330 '%s' Visible Characters Per Line: %u\n", tag(), m_cr);
+ LOG("SED1330 Visible Characters Per Line: %u\n", m_cr);
break;
case 4:
m_tcr = data + 1;
- if (LOG) logerror("SED1330 '%s' Total Characters Per Line: %u\n", tag(), m_tcr);
+ LOG("SED1330 Total Characters Per Line: %u\n", m_tcr);
break;
case 5:
m_lf = data + 1;
- if (LOG) logerror("SED1330 '%s' Frame Height: %u\n", tag(), m_lf);
+ LOG("SED1330 Frame Height: %u\n", m_lf);
break;
case 6:
@@ -353,11 +345,11 @@ WRITE8_MEMBER( sed1330_device::data_w )
case 7:
m_ap = (data << 8) | (m_ap & 0xff);
- if (LOG) logerror("SED1330 '%s' Virtual Screen Width: %u\n", tag(), m_ap);
+ LOG("SED1330 Virtual Screen Width: %u\n", m_ap);
break;
default:
- logerror("SED1330 '%s' Invalid parameter byte %02x\n", tag(), data);
+ logerror("SED1330 Invalid parameter byte %02x\n", data);
}
break;
@@ -366,41 +358,38 @@ WRITE8_MEMBER( sed1330_device::data_w )
m_d = BIT(data, 0);
m_fc = data & 0x03;
m_fp = data >> 2;
- if (LOG)
- {
- logerror("SED1330 '%s' Display: %s\n", tag(), BIT(data, 0) ? "enabled" : "disabled");
+ LOG("SED1330 Display: %s\n", BIT(data, 0) ? "enabled" : "disabled");
- switch (m_fc)
- {
- case FC_OFF: logerror("SED1330 '%s' Cursor: disabled\n", tag()); break;
- case FC_SOLID: logerror("SED1330 '%s' Cursor: solid\n", tag()); break;
- case FC_FLASH_32: logerror("SED1330 '%s' Cursor: fFR/32\n", tag()); break;
- case FC_FLASH_64: logerror("SED1330 '%s' Cursor: fFR/64\n", tag()); break;
- }
+ switch (m_fc)
+ {
+ case FC_OFF: LOG("SED1330 Cursor: disabled\n"); break;
+ case FC_SOLID: LOG("SED1330 Cursor: solid\n"); break;
+ case FC_FLASH_32: LOG("SED1330 Cursor: fFR/32\n"); break;
+ case FC_FLASH_64: LOG("SED1330 Cursor: fFR/64\n"); break;
+ }
- switch (m_fp & 0x03)
- {
- case FC_OFF: logerror("SED1330 '%s' Display Page 1: disabled\n", tag()); break;
- case FC_SOLID: logerror("SED1330 '%s' Display Page 1: enabled\n", tag()); break;
- case FC_FLASH_32: logerror("SED1330 '%s' Display Page 1: flash fFR/32\n", tag()); break;
- case FC_FLASH_64: logerror("SED1330 '%s' Display Page 1: flash fFR/64\n", tag()); break;
- }
+ switch (m_fp & 0x03)
+ {
+ case FC_OFF: LOG("SED1330 Display Page 1: disabled\n"); break;
+ case FC_SOLID: LOG("SED1330 Display Page 1: enabled\n"); break;
+ case FC_FLASH_32: LOG("SED1330 Display Page 1: flash fFR/32\n"); break;
+ case FC_FLASH_64: LOG("SED1330 Display Page 1: flash fFR/64\n"); break;
+ }
- switch ((m_fp >> 2) & 0x03)
- {
- case FC_OFF: logerror("SED1330 '%s' Display Page 2/4: disabled\n", tag()); break;
- case FC_SOLID: logerror("SED1330 '%s' Display Page 2/4: enabled\n", tag()); break;
- case FC_FLASH_32: logerror("SED1330 '%s' Display Page 2/4: flash fFR/32\n", tag()); break;
- case FC_FLASH_64: logerror("SED1330 '%s' Display Page 2/4: flash fFR/64\n", tag()); break;
- }
+ switch ((m_fp >> 2) & 0x03)
+ {
+ case FC_OFF: LOG("SED1330 Display Page 2/4: disabled\n"); break;
+ case FC_SOLID: LOG("SED1330 Display Page 2/4: enabled\n"); break;
+ case FC_FLASH_32: LOG("SED1330 Display Page 2/4: flash fFR/32\n"); break;
+ case FC_FLASH_64: LOG("SED1330 Display Page 2/4: flash fFR/64\n"); break;
+ }
- switch ((m_fp >> 4) & 0x03)
- {
- case FC_OFF: logerror("SED1330 '%s' Display Page 3: disabled\n", tag()); break;
- case FC_SOLID: logerror("SED1330 '%s' Display Page 3: enabled\n", tag()); break;
- case FC_FLASH_32: logerror("SED1330 '%s' Display Page 3: flash fFR/32\n", tag()); break;
- case FC_FLASH_64: logerror("SED1330 '%s' Display Page 3: flash fFR/64\n", tag()); break;
- }
+ switch ((m_fp >> 4) & 0x03)
+ {
+ case FC_OFF: LOG("SED1330 Display Page 3: disabled\n"); break;
+ case FC_SOLID: LOG("SED1330 Display Page 3: enabled\n"); break;
+ case FC_FLASH_32: LOG("SED1330 Display Page 3: flash fFR/32\n"); break;
+ case FC_FLASH_64: LOG("SED1330 Display Page 3: flash fFR/64\n"); break;
}
break;
@@ -413,12 +402,12 @@ WRITE8_MEMBER( sed1330_device::data_w )
case 1:
m_sad1 = (data << 8) | (m_sad1 & 0xff);
- if (LOG) logerror("SED1330 '%s' Display Page 1 Start Address: %04x\n", tag(), m_sad1);
+ LOG("SED1330 Display Page 1 Start Address: %04x\n", m_sad1);
break;
case 2:
m_sl1 = data + 1;
- if (LOG) logerror("SED1330 '%s' Display Block 1 Screen Lines: %u\n", tag(), m_sl1);
+ LOG("SED1330 Display Block 1 Screen Lines: %u\n", m_sl1);
break;
case 3:
@@ -427,12 +416,12 @@ WRITE8_MEMBER( sed1330_device::data_w )
case 4:
m_sad2 = (data << 8) | (m_sad2 & 0xff);
- if (LOG) logerror("SED1330 '%s' Display Page 2 Start Address: %04x\n", tag(), m_sad2);
+ LOG("SED1330 Display Page 2 Start Address: %04x\n", m_sad2);
break;
case 5:
m_sl2 = data + 1;
- if (LOG) logerror("SED1330 '%s' Display Block 2 Screen Lines: %u\n", tag(), m_sl2);
+ LOG("SED1330 Display Block 2 Screen Lines: %u\n", m_sl2);
break;
case 6:
@@ -441,7 +430,7 @@ WRITE8_MEMBER( sed1330_device::data_w )
case 7:
m_sad3 = (data << 8) | (m_sad3 & 0xff);
- if (LOG) logerror("SED1330 '%s' Display Page 3 Start Address: %04x\n", tag(), m_sad3);
+ LOG("SED1330 Display Page 3 Start Address: %04x\n", m_sad3);
break;
case 8:
@@ -450,11 +439,11 @@ WRITE8_MEMBER( sed1330_device::data_w )
case 9:
m_sad4 = (data << 8) | (m_sad4 & 0xff);
- if (LOG) logerror("SED1330 '%s' Display Page 4 Start Address: %04x\n", tag(), m_sad4);
+ LOG("SED1330 Display Page 4 Start Address: %04x\n", m_sad4);
break;
default:
- logerror("SED1330 '%s' Invalid parameter byte %02x\n", tag(), data);
+ logerror("SED1330 Invalid parameter byte %02x\n", data);
}
break;
@@ -463,21 +452,18 @@ WRITE8_MEMBER( sed1330_device::data_w )
{
case 0:
m_crx = (data & 0x0f) + 1;
- if (LOG) logerror("SED1330 '%s' Horizontal Cursor Size: %u\n", tag(), m_crx);
+ LOG("SED1330 Horizontal Cursor Size: %u\n", m_crx);
break;
case 1:
m_cry = (data & 0x0f) + 1;
m_cm = BIT(data, 7);
- if (LOG)
- {
- logerror("SED1330 '%s' Vertical Cursor Location: %u\n", tag(), m_cry);
- logerror("SED1330 '%s' Cursor Shape: %s\n", tag(), BIT(data, 7) ? "Block" : "Underscore");
- }
+ LOG("SED1330 Vertical Cursor Location: %u\n", m_cry);
+ LOG("SED1330 Cursor Shape: %s\n", BIT(data, 7) ? "Block" : "Underscore");
break;
default:
- logerror("SED1330 '%s' Invalid parameter byte %02x\n", tag(), data);
+ logerror("SED1330 Invalid parameter byte %02x\n", data);
}
break;
@@ -490,17 +476,17 @@ WRITE8_MEMBER( sed1330_device::data_w )
case 1:
m_sag = (data << 8) | (m_sag & 0xff);
- if (LOG) logerror("SED1330 '%s' Character Generator RAM Start Address: %04x\n", tag(), m_sag);
+ LOG("SED1330 Character Generator RAM Start Address: %04x\n", m_sag);
break;
default:
- logerror("SED1330 '%s' Invalid parameter byte %02x\n", tag(), data);
+ logerror("SED1330 Invalid parameter byte %02x\n", data);
}
break;
case INSTRUCTION_HDOT_SCR:
m_hdotscr = data & 0x07;
- if (LOG) logerror("SED1330 '%s' Horizontal Dot Scroll: %u\n", tag(), m_hdotscr);
+ LOG("SED1330 Horizontal Dot Scroll: %u\n", m_hdotscr);
break;
case INSTRUCTION_OVLAY:
@@ -508,20 +494,17 @@ WRITE8_MEMBER( sed1330_device::data_w )
m_dm = (data >> 2) & 0x03;
m_ov = BIT(data, 4);
- if (LOG)
+ switch (m_mx)
{
- switch (m_mx)
- {
- case MX_OR: logerror("SED1330 '%s' Display Composition Method: OR\n", tag()); break;
- case MX_XOR: logerror("SED1330 '%s' Display Composition Method: Exclusive-OR\n", tag()); break;
- case MX_AND: logerror("SED1330 '%s' Display Composition Method: AND\n", tag()); break;
- case MX_PRIORITY_OR: logerror("SED1330 '%s' Display Composition Method: Priority-OR\n", tag()); break;
- }
-
- logerror("SED1330 '%s' Display Page 1 Mode: %s\n", tag(), BIT(data, 2) ? "Graphics" : "Text");
- logerror("SED1330 '%s' Display Page 3 Mode: %s\n", tag(), BIT(data, 3) ? "Graphics" : "Text");
- logerror("SED1330 '%s' Display Composition Layers: %u\n", tag(), BIT(data, 4) ? 3 : 2);
+ case MX_OR: LOG("SED1330 Display Composition Method: OR\n"); break;
+ case MX_XOR: LOG("SED1330 Display Composition Method: Exclusive-OR\n"); break;
+ case MX_AND: LOG("SED1330 Display Composition Method: AND\n"); break;
+ case MX_PRIORITY_OR: LOG("SED1330 Display Composition Method: Priority-OR\n"); break;
}
+
+ LOG("SED1330 Display Page 1 Mode: %s\n", BIT(data, 2) ? "Graphics" : "Text");
+ LOG("SED1330 Display Page 3 Mode: %s\n", BIT(data, 3) ? "Graphics" : "Text");
+ LOG("SED1330 Display Composition Layers: %u\n", BIT(data, 4) ? 3 : 2);
break;
case INSTRUCTION_CSRW:
@@ -533,11 +516,11 @@ WRITE8_MEMBER( sed1330_device::data_w )
case 1:
m_csr = (data << 8) | (m_csr & 0xff);
- if (LOG) logerror("SED1330 '%s' Cursor Address %04x\n", tag(), m_csr);
+ LOG("SED1330 Cursor Address %04x\n", m_csr);
break;
default:
- logerror("SED1330 '%s' Invalid parameter byte %02x\n", tag(), data);
+ logerror("SED1330 Invalid parameter byte %02x\n", data);
}
break;
#if 0
@@ -545,7 +528,7 @@ WRITE8_MEMBER( sed1330_device::data_w )
break;
#endif
case INSTRUCTION_MWRITE:
- if (LOG) logerror("SED1330 '%s' Memory Write %02x to %04x (row %u col %u line %u)\n", tag(), data, m_csr, m_csr/80/8, m_csr%80, m_csr/80);
+ LOG("SED1330 Memory Write %02x to %04x (row %u col %u line %u)\n", data, m_csr, m_csr/80/8, m_csr%80, m_csr/80);
writebyte(m_csr, data);
@@ -556,7 +539,7 @@ WRITE8_MEMBER( sed1330_device::data_w )
break;
#endif
default:
- logerror("SED1330 '%s' Unsupported instruction %02x\n", tag(), m_ir);
+ logerror("SED1330 Unsupported instruction %02x\n", m_ir);
}
m_pbc++;
diff --git a/src/devices/video/sed1330.h b/src/devices/video/sed1330.h
index a71e35e0e83..fd38f03e689 100644
--- a/src/devices/video/sed1330.h
+++ b/src/devices/video/sed1330.h
@@ -6,10 +6,10 @@
**********************************************************************/
-#pragma once
+#ifndef MAME_VIDEO_SED1330_H
+#define MAME_VIDEO_SED1330_H
-#ifndef __SED1330__
-#define __SED1330__
+#pragma once
@@ -56,7 +56,7 @@ protected:
virtual void device_reset() override;
// device_memory_interface overrides
- virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override;
+ virtual const address_space_config *memory_space_config(address_spacenum spacenum) const override;
inline uint8_t readbyte(offs_t address);
inline void writebyte(offs_t address, uint8_t m_data);
@@ -118,8 +118,6 @@ private:
// device type definition
-extern const device_type SED1330;
-
-
+DECLARE_DEVICE_TYPE(SED1330, sed1330_device)
-#endif
+#endif // MAME_VIDEO_SED1330_H
diff --git a/src/devices/video/sed1520.cpp b/src/devices/video/sed1520.cpp
index 83f884d5756..708d685ad18 100644
--- a/src/devices/video/sed1520.cpp
+++ b/src/devices/video/sed1520.cpp
@@ -19,7 +19,7 @@
// DEVICE DEFINITIONS
//**************************************************************************
-const device_type SED1520 = device_creator<sed1520_device>;
+DEFINE_DEVICE_TYPE(SED1520, sed1520_device, "sed1520", "Epson SED1520")
//**************************************************************************
@@ -31,7 +31,7 @@ const device_type SED1520 = device_creator<sed1520_device>;
//-------------------------------------------------
sed1520_device::sed1520_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, SED1520, "SED1520", tag, owner, clock, "sed1520", __FILE__), m_lcd_on(0), m_busy(0), m_page(0), m_column(0), m_old_column(0), m_start_line(0),
+ device_t(mconfig, SED1520, tag, owner, clock), m_lcd_on(0), m_busy(0), m_page(0), m_column(0), m_old_column(0), m_start_line(0),
m_adc(0), m_static_drive(0), m_modify_write(false),
m_screen_update_func(nullptr)
{
diff --git a/src/devices/video/sed1520.h b/src/devices/video/sed1520.h
index 29bc5b1dd15..2bd554055f0 100644
--- a/src/devices/video/sed1520.h
+++ b/src/devices/video/sed1520.h
@@ -6,10 +6,10 @@
***************************************************************************/
-#pragma once
+#ifndef MAME_VIDEO_SED1520_H
+#define MAME_VIDEO_SED1520_H
-#ifndef __SED1520_H__
-#define __SED1520_H__
+#pragma once
#define MCFG_SED1520_ADD( _tag, _cb ) \
@@ -20,7 +20,6 @@
// TYPE DEFINITIONS
//**************************************************************************
-typedef uint32_t (*sed1520_screen_update_func)(device_t &device, bitmap_ind16 &bitmap, const rectangle &cliprect, uint8_t *vram, int start_line, int adc);
#define SED1520_UPDATE_CB(name) uint32_t name(device_t &device, bitmap_ind16 &bitmap, const rectangle &cliprect, uint8_t *vram, int start_line, int adc)
@@ -29,11 +28,13 @@ typedef uint32_t (*sed1520_screen_update_func)(device_t &device, bitmap_ind16 &b
class sed1520_device : public device_t
{
public:
+ typedef uint32_t (*screen_update_func)(device_t &device, bitmap_ind16 &bitmap, const rectangle &cliprect, uint8_t *vram, int start_line, int adc);
+
// construction/destruction
sed1520_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// static configuration helpers
- static void static_set_screen_update_cb(device_t &device, sed1520_screen_update_func _cb) { downcast<sed1520_device &>(device).m_screen_update_func = _cb; }
+ static void static_set_screen_update_cb(device_t &device, screen_update_func _cb) { downcast<sed1520_device &>(device).m_screen_update_func = _cb; }
// device interface
virtual DECLARE_WRITE8_MEMBER(write);
@@ -60,13 +61,13 @@ private:
uint8_t m_adc;
uint8_t m_static_drive;
bool m_modify_write;
- sed1520_screen_update_func m_screen_update_func;
+ screen_update_func m_screen_update_func;
uint8_t m_vram[0x140];
};
// device type definition
-extern const device_type SED1520;
+DECLARE_DEVICE_TYPE(SED1520, sed1520_device)
-#endif
+#endif // MAME_VIDEO_SED1520_H
diff --git a/src/devices/video/snes_ppu.cpp b/src/devices/video/snes_ppu.cpp
index 8fcfb4af3e6..836690f2a72 100644
--- a/src/devices/video/snes_ppu.cpp
+++ b/src/devices/video/snes_ppu.cpp
@@ -189,7 +189,7 @@ enum
// DEVICE DEFINITIONS
//**************************************************************************
-const device_type SNES_PPU = device_creator<snes_ppu_device>;
+DEFINE_DEVICE_TYPE(SNES_PPU, snes_ppu_device, "snes_ppu", "SNES PPU")
//**************************************************************************
@@ -201,14 +201,14 @@ const device_type SNES_PPU = device_creator<snes_ppu_device>;
//-------------------------------------------------
snes_ppu_device::snes_ppu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, SNES_PPU, "SNES PPU", tag, owner, clock, "snes_ppu", __FILE__),
- device_video_interface(mconfig, *this),
- m_openbus_cb(*this),
- m_options(*this, ":OPTIONS"),
- m_debug1(*this, ":DEBUG1"),
- m_debug2(*this, ":DEBUG2"),
- m_debug3(*this, ":DEBUG3"),
- m_debug4(*this, ":DEBUG4")
+ : device_t(mconfig, SNES_PPU, tag, owner, clock)
+ , device_video_interface(mconfig, *this)
+ , m_openbus_cb(*this)
+ , m_options(*this, ":OPTIONS")
+ , m_debug1(*this, ":DEBUG1")
+ , m_debug2(*this, ":DEBUG2")
+ , m_debug3(*this, ":DEBUG3")
+ , m_debug4(*this, ":DEBUG4")
{
}
diff --git a/src/devices/video/snes_ppu.h b/src/devices/video/snes_ppu.h
index ab1a30245df..2a3ac575edf 100644
--- a/src/devices/video/snes_ppu.h
+++ b/src/devices/video/snes_ppu.h
@@ -6,8 +6,8 @@
***************************************************************************/
-#ifndef MAME_DEVICES_VIDEO_SNES_PPU_H
-#define MAME_DEVICES_VIDEO_SNES_PPU_H
+#ifndef MAME_VIDEO_SNES_PPU_H
+#define MAME_VIDEO_SNES_PPU_H
#pragma once
@@ -34,37 +34,6 @@
#define SNES_LAYER_DEBUG 0
-/* offset-per-tile modes */
-enum
-{
- SNES_OPT_NONE = 0,
- SNES_OPT_MODE2,
- SNES_OPT_MODE4,
- SNES_OPT_MODE6
-};
-
-/* layers */
-enum
-{
- SNES_BG1 = 0,
- SNES_BG2,
- SNES_BG3,
- SNES_BG4,
- SNES_OAM,
- SNES_COLOR
-};
-
-
-struct SNES_SCANLINE
-{
- int enable, clip;
-
- uint16_t buffer[SNES_SCR_WIDTH];
- uint8_t priority[SNES_SCR_WIDTH];
- uint8_t layer[SNES_SCR_WIDTH];
- uint8_t blend_exception[SNES_SCR_WIDTH];
-};
-
// ======================> snes_ppu_device
class snes_ppu_device : public device_t,
@@ -75,7 +44,68 @@ public:
snes_ppu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// inline configuration helpers
- template<class _Object> static devcb_base &static_set_open_bus_callback(device_t &device, _Object object) { return downcast<snes_ppu_device &>(device).m_openbus_cb.set_callback(object); }
+ template <class Object> static devcb_base &static_set_open_bus_callback(device_t &device, Object &&cb) { return downcast<snes_ppu_device &>(device).m_openbus_cb.set_callback(std::forward<Object>(cb)); }
+
+ void refresh_scanline(bitmap_rgb32 &bitmap, uint16_t curline);
+
+ int16_t current_x() const { return m_screen->hpos() / m_htmult; }
+ int16_t current_y() const { return m_screen->vpos(); }
+ void set_latch_hv(int16_t x, int16_t y);
+
+ uint8_t read(address_space &space, uint32_t offset, uint8_t wrio_bit7);
+ void write(address_space &space, uint32_t offset, uint8_t data);
+
+ int vtotal() const { return ((m_stat78 & 0x10) == SNES_NTSC) ? SNES_VTOTAL_NTSC : SNES_VTOTAL_PAL; }
+ uint16_t htmult() const { return m_htmult; }
+ uint8_t interlace() const { return m_interlace; }
+ bool screen_disabled() const { return bool(m_screen_disabled); }
+ uint8_t last_visible_line() const { return m_beam.last_visible_line; }
+ uint16_t current_vert() const { return m_beam.current_vert; }
+ uint8_t saved_oam_address_low() const { return m_oam.saved_address_low; }
+ uint8_t saved_oam_address_high() const { return m_oam.saved_address_high; }
+
+ void clear_time_range_over() { m_stat77 &= 0x3f; }
+ void toggle_field() { m_stat78 ^= 0x80; }
+ void reset_interlace()
+ {
+ m_htmult = 1;
+ m_interlace = 1;
+ m_obj_interlace = 1;
+ }
+ void set_current_vert(uint16_t value) { m_beam.current_vert = value; }
+ void set_first_sprite() { m_oam.first_sprite = m_oam.priority_rotation ? ((m_oam.address >> 1) & 127) : 0; }
+
+protected:
+ /* offset-per-tile modes */
+ enum
+ {
+ SNES_OPT_NONE = 0,
+ SNES_OPT_MODE2,
+ SNES_OPT_MODE4,
+ SNES_OPT_MODE6
+ };
+
+ /* layers */
+ enum
+ {
+ SNES_BG1 = 0,
+ SNES_BG2,
+ SNES_BG3,
+ SNES_BG4,
+ SNES_OAM,
+ SNES_COLOR
+ };
+
+
+ struct SNES_SCANLINE
+ {
+ int enable, clip;
+
+ uint16_t buffer[SNES_SCR_WIDTH];
+ uint8_t priority[SNES_SCR_WIDTH];
+ uint8_t layer[SNES_SCR_WIDTH];
+ uint8_t blend_exception[SNES_SCR_WIDTH];
+ };
uint8_t m_regs[0x40];
@@ -252,17 +282,10 @@ public:
void update_windowmasks(void);
void update_offsets(void);
inline void draw_blend(uint16_t offset, uint16_t *colour, uint8_t prevent_color_math, uint8_t black_pen_clip, int switch_screens);
- void refresh_scanline(bitmap_rgb32 &bitmap, uint16_t curline);
- inline int16_t current_x() { return m_screen->hpos() / m_htmult; }
- inline int16_t current_y() { return m_screen->vpos(); }
- void set_latch_hv(int16_t x, int16_t y);
void dynamic_res_change();
inline uint32_t get_vram_address();
- uint8_t read(address_space &space, uint32_t offset, uint8_t wrio_bit7);
- void write(address_space &space, uint32_t offset, uint8_t data);
-
DECLARE_READ8_MEMBER( oam_read );
DECLARE_WRITE8_MEMBER( oam_write );
DECLARE_READ8_MEMBER( cgram_read );
@@ -273,7 +296,6 @@ public:
std::unique_ptr<uint16_t[]> m_cgram; /* Palette RAM */
std::unique_ptr<uint8_t[]> m_vram; /* Video RAM (TODO: Should be 16-bit, but it's easier this way) */
-protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
@@ -289,7 +311,7 @@ private:
// device type definition
-extern const device_type SNES_PPU;
+DECLARE_DEVICE_TYPE(SNES_PPU, snes_ppu_device)
/***************************************************************************
@@ -299,4 +321,4 @@ extern const device_type SNES_PPU;
#define MCFG_SNES_PPU_OPENBUS_CB(_read) \
devcb = &snes_ppu_device::static_set_open_bus_callback(*device, DEVCB_##_read);
-#endif // MAME_DEVICES_VIDEO_SNES_PPU_H
+#endif // MAME_VIDEO_SNES_PPU_H
diff --git a/src/devices/video/sprite.h b/src/devices/video/sprite.h
index d17fdc13bb9..9919d83ec00 100644
--- a/src/devices/video/sprite.h
+++ b/src/devices/video/sprite.h
@@ -6,10 +6,10 @@
***************************************************************************/
-#pragma once
+#ifndef MAME_VIDEO_SPRITE_H
+#define MAME_VIDEO_SPRITE_H
-#ifndef __SPRITE_H__
-#define __SPRITE_H__
+#pragma once
// ======================> sparse_dirty_rect
@@ -81,13 +81,13 @@ class sprite_device : public device_t
protected:
// construction/destruction - only for subclasses
- sprite_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, const char *shortname, const char *file, int dirty_granularity = 3)
- : device_t(mconfig, type, name, tag, owner, 0, shortname, file),
- m_xorigin(0),
- m_yorigin(0),
- m_spriteram(nullptr),
- m_spriteram_bytes(0),
- m_dirty(dirty_granularity)
+ sprite_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, int dirty_granularity = 3)
+ : device_t(mconfig, type, tag, owner, 0)
+ , m_xorigin(0)
+ , m_yorigin(0)
+ , m_spriteram(nullptr)
+ , m_spriteram_bytes(0)
+ , m_dirty(dirty_granularity)
{
force_clear();
}
@@ -207,4 +207,4 @@ typedef sprite_device<uint16_t, bitmap_ind32> sprite16_device_ind32;
typedef sprite_device<uint32_t, bitmap_ind32> sprite32_device_ind32;
-#endif // __SPRITE_H__
+#endif // MAME_VIDEO_SPRITE_H
diff --git a/src/devices/video/t6a04.cpp b/src/devices/video/t6a04.cpp
index c9b35f05d26..641d447baa6 100644
--- a/src/devices/video/t6a04.cpp
+++ b/src/devices/video/t6a04.cpp
@@ -15,7 +15,7 @@
#include "video/t6a04.h"
// devices
-const device_type T6A04 = device_creator<t6a04_device>;
+DEFINE_DEVICE_TYPE(T6A04, t6a04_device, "t6a04", "Toshiba T6A04 LCD Controller")
//-------------------------------------------------
// device_validity_check - perform validity checks
@@ -37,10 +37,12 @@ void t6a04_device::device_validity_check(validity_checker &valid) const
//-------------------------------------------------
t6a04_device::t6a04_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, T6A04, "T6A04", tag, owner, clock, "t6a04", __FILE__), m_busy_flag(0), m_display_on(0), m_contrast(0), m_xpos(0), m_ypos(0), m_zpos(0), m_direction(0),
- m_active_counter(0), m_word_len(0), m_opa1(0), m_opa2(0), m_output_reg(0),
- m_height(0),
- m_width(0)
+ device_t(mconfig, T6A04, tag, owner, clock),
+ m_busy_flag(0), m_display_on(0), m_contrast(0),
+ m_xpos(0), m_ypos(0), m_zpos(0),
+ m_direction(0), m_active_counter(0), m_word_len(0),
+ m_opa1(0), m_opa2(0), m_output_reg(0),
+ m_height(0), m_width(0)
{
}
diff --git a/src/devices/video/t6a04.h b/src/devices/video/t6a04.h
index fb5cb23d92c..bee192f8ac6 100644
--- a/src/devices/video/t6a04.h
+++ b/src/devices/video/t6a04.h
@@ -6,10 +6,10 @@
***************************************************************************/
-#pragma once
+#ifndef MAME_VIDEO_T6A04_H
+#define MAME_VIDEO_T6A04_H
-#ifndef __T6A04_H__
-#define __T6A04_H__
+#pragma once
//**************************************************************************
// TYPE DEFINITIONS
@@ -64,9 +64,9 @@ private:
};
// device type definition
-extern const device_type T6A04;
+DECLARE_DEVICE_TYPE(T6A04, t6a04_device)
#define MCFG_T6A04_SIZE(_width, _height) \
t6a04_device::set_size(*device, _width, _height);
-#endif
+#endif // MAME_VIDEO_T6A04_H
diff --git a/src/devices/video/tea1002.cpp b/src/devices/video/tea1002.cpp
index 5343de12830..162fa128bfd 100644
--- a/src/devices/video/tea1002.cpp
+++ b/src/devices/video/tea1002.cpp
@@ -39,7 +39,7 @@ const int tea1002_device::m_amplitute[] =
// DEVICE DEFINITIONS
//**************************************************************************
-const device_type TEA1002 = device_creator<tea1002_device>;
+DEFINE_DEVICE_TYPE(TEA1002, tea1002_device, "tea1002", "Mullard TEA1002 PAL colour encoder")
//**************************************************************************
@@ -51,7 +51,7 @@ const device_type TEA1002 = device_creator<tea1002_device>;
//-------------------------------------------------
tea1002_device::tea1002_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, TEA1002, "TEA1002 PAL colour encoder", tag, owner, clock, "tea1002", __FILE__)
+ device_t(mconfig, TEA1002, tag, owner, clock)
{
}
diff --git a/src/devices/video/tea1002.h b/src/devices/video/tea1002.h
index d0f4b38f876..dcfa46f7bb1 100644
--- a/src/devices/video/tea1002.h
+++ b/src/devices/video/tea1002.h
@@ -19,10 +19,10 @@
***************************************************************************/
-#pragma once
+#ifndef MAME_VIDEO_TEA1002_H
+#define MAME_VIDEO_TEA1002_H
-#ifndef __TEA1002_H__
-#define __TEA1002_H__
+#pragma once
@@ -61,5 +61,6 @@ private:
// device type definition
extern const device_type TEA1002;
+DECLARE_DEVICE_TYPE(TEA1002, tea1002_device)
-#endif // __TEA1002_H__
+#endif // MAME_VIDEO_TEA1002_H
diff --git a/src/devices/video/tlc34076.cpp b/src/devices/video/tlc34076.cpp
index ba4283fc683..2b8cb788aca 100644
--- a/src/devices/video/tlc34076.cpp
+++ b/src/devices/video/tlc34076.cpp
@@ -35,15 +35,15 @@
//**************************************************************************
// device type definition
-const device_type TLC34076 = device_creator<tlc34076_device>;
+DEFINE_DEVICE_TYPE(TLC34076, tlc34076_device, "tlc34076", "TI TLC34076 VIP")
//-------------------------------------------------
// tlc34076_device - constructor
//-------------------------------------------------
tlc34076_device::tlc34076_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, TLC34076, "TLC34076 VIP", tag, owner, clock, "tlc34076", __FILE__),
- m_dacbits(6)
+ : device_t(mconfig, TLC34076, tag, owner, clock)
+ , m_dacbits(6)
{
}
diff --git a/src/devices/video/tlc34076.h b/src/devices/video/tlc34076.h
index 6375ecdf4be..6a1b54d2adf 100644
--- a/src/devices/video/tlc34076.h
+++ b/src/devices/video/tlc34076.h
@@ -9,21 +9,10 @@
***************************************************************************/
-#pragma once
-
-#ifndef __TLC34076_H__
-#define __TLC34076_H__
-
-
-/***************************************************************************
- CONSTANTS
-***************************************************************************/
+#ifndef MAME_VIDEO_TLC34076_H
+#define MAME_VIDEO_TLC34076_H
-enum tlc34076_bits
-{
- TLC34076_6_BIT = 6,
- TLC34076_8_BIT = 8
-};
+#pragma once
/***************************************************************************
@@ -33,6 +22,12 @@ enum tlc34076_bits
class tlc34076_device : public device_t
{
public:
+ enum tlc34076_bits
+ {
+ TLC34076_6_BIT = 6,
+ TLC34076_8_BIT = 8
+ };
+
// construction/destruction
tlc34076_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
@@ -65,12 +60,11 @@ private:
DEVICE CONFIGURATION MACROS
***************************************************************************/
-#define MCFG_TLC34076_ADD(_tag, _bits) \
- MCFG_DEVICE_ADD(_tag, TLC34076, 0) \
- tlc34076_device::static_set_bits(*device, _bits);
-
+#define MCFG_TLC34076_ADD(tag, bits) \
+ MCFG_DEVICE_ADD((tag), TLC34076, 0) \
+ tlc34076_device::static_set_bits(*device, (tlc34076_device::bits));
-extern const device_type TLC34076;
+DECLARE_DEVICE_TYPE(TLC34076, tlc34076_device)
-#endif /* __TLC34076_H__ */
+#endif // MAME_VIDEO_TLC34076_H
diff --git a/src/devices/video/tms34061.cpp b/src/devices/video/tms34061.cpp
index 3a74d450c52..7947dd59875 100644
--- a/src/devices/video/tms34061.cpp
+++ b/src/devices/video/tms34061.cpp
@@ -17,8 +17,9 @@
#include "screen.h"
+//#define VERBOSE 1
+#include "logmacro.h"
-#define VERBOSE (0)
//**************************************************************************
@@ -29,10 +30,10 @@
// tms34061_device - constructor
//-------------------------------------------------
-const device_type TMS34061 = device_creator<tms34061_device>;
+DEFINE_DEVICE_TYPE(TMS34061, tms34061_device, "tms34061", "TI TMS34061 VSC")
tms34061_device::tms34061_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, TMS34061, "TMS34061 VSC", tag, owner, clock, "tms34061", __FILE__),
+ : device_t(mconfig, TMS34061, tag, owner, clock),
device_video_interface(mconfig, *this),
m_rowshift(0),
m_vramsize(0),
@@ -190,7 +191,7 @@ void tms34061_device::register_w(address_space &space, offs_t offset, uint8_t da
}
/* log it */
- if (VERBOSE) logerror("%s:tms34061 %s = %04x\n", space.machine().describe_context(), regnames[regnum], m_regs[regnum]);
+ LOG("%s:tms34061 %s = %04x\n", space.machine().describe_context(), regnames[regnum], m_regs[regnum]);
/* update the state of things */
switch (regnum)
@@ -268,7 +269,7 @@ uint8_t tms34061_device::register_r(address_space &space, offs_t offset)
}
/* log it */
- if (VERBOSE) logerror("%s:tms34061 %s read = %04X\n", space.machine().describe_context(), regnames[regnum], result);
+ LOG("%s:tms34061 %s read = %04X\n", space.machine().describe_context(), regnames[regnum], result);
return (offset & 0x02) ? (result >> 8) : result;
}
@@ -375,7 +376,7 @@ void tms34061_device::xypixel_w(address_space &space, int offset, uint8_t data)
/* mask to the VRAM size */
pixeloffs &= m_vrammask;
- if (VERBOSE) logerror("%s:tms34061 xy (%04x) = %02x/%02x\n", space.machine().describe_context(), pixeloffs, data, m_latchdata);
+ LOG("%s:tms34061 xy (%04x) = %02x/%02x\n", space.machine().describe_context(), pixeloffs, data, m_latchdata);
/* set the pixel data */
m_vram[pixeloffs] = data;
@@ -431,7 +432,7 @@ void tms34061_device::write(address_space &space, int col, int row, int func, ui
offs = ((row << m_rowshift) | col) & m_vrammask;
if (m_regs[TMS34061_CONTROL2] & 0x0040)
offs |= (m_regs[TMS34061_CONTROL2] & 3) << 16;
- if (VERBOSE) logerror("%s:tms34061 direct (%04x) = %02x/%02x\n", space.machine().describe_context(), offs, data, m_latchdata);
+ LOG("%s:tms34061 direct (%04x) = %02x/%02x\n", space.machine().describe_context(), offs, data, m_latchdata);
if (m_vram[offs] != data || m_latchram[offs] != m_latchdata)
{
m_vram[offs] = data;
@@ -445,7 +446,7 @@ void tms34061_device::write(address_space &space, int col, int row, int func, ui
if (m_regs[TMS34061_CONTROL2] & 0x0040)
offs |= (m_regs[TMS34061_CONTROL2] & 3) << 16;
offs &= m_vrammask;
- if (VERBOSE) logerror("%s:tms34061 shiftreg write (%04x)\n", space.machine().describe_context(), offs);
+ LOG("%s:tms34061 shiftreg write (%04x)\n", space.machine().describe_context(), offs);
memcpy(&m_vram[offs], m_shiftreg, (size_t)1 << m_rowshift);
memset(&m_latchram[offs], m_latchdata, (size_t)1 << m_rowshift);
@@ -457,7 +458,7 @@ void tms34061_device::write(address_space &space, int col, int row, int func, ui
if (m_regs[TMS34061_CONTROL2] & 0x0040)
offs |= (m_regs[TMS34061_CONTROL2] & 3) << 16;
offs &= m_vrammask;
- if (VERBOSE) logerror("%s:tms34061 shiftreg read (%04x)\n", space.machine().describe_context(), offs);
+ LOG("%s:tms34061 shiftreg read (%04x)\n", space.machine().describe_context(), offs);
m_shiftreg = &m_vram[offs];
break;
@@ -542,7 +543,7 @@ READ8_MEMBER( tms34061_device::latch_r )
WRITE8_MEMBER( tms34061_device::latch_w )
{
- if (VERBOSE) logerror("tms34061_latch = %02X\n", data);
+ LOG("tms34061_latch = %02X\n", data);
m_latchdata = data;
}
diff --git a/src/devices/video/tms34061.h b/src/devices/video/tms34061.h
index c82bebd2db9..ab5aaa652fd 100644
--- a/src/devices/video/tms34061.h
+++ b/src/devices/video/tms34061.h
@@ -9,9 +9,10 @@
* *
****************************************************************************/
+#ifndef MAME_VIDEO_TMS34061_H
+#define MAME_VIDEO_TMS34061_H
-#ifndef __TMS34061_H__
-#define __TMS34061_H__
+#pragma once
#define MCFG_TMS34061_ROWSHIFT(_shift) \
@@ -24,55 +25,28 @@
devcb = &tms34061_device::set_interrupt_callback(*device, DEVCB_##_devcb);
-/* register constants */
-enum
-{
- TMS34061_HORENDSYNC = 0,
- TMS34061_HORENDBLNK,
- TMS34061_HORSTARTBLNK,
- TMS34061_HORTOTAL,
- TMS34061_VERENDSYNC,
- TMS34061_VERENDBLNK,
- TMS34061_VERSTARTBLNK,
- TMS34061_VERTOTAL,
- TMS34061_DISPUPDATE,
- TMS34061_DISPSTART,
- TMS34061_VERINT,
- TMS34061_CONTROL1,
- TMS34061_CONTROL2,
- TMS34061_STATUS,
- TMS34061_XYOFFSET,
- TMS34061_XYADDRESS,
- TMS34061_DISPADDRESS,
- TMS34061_VERCOUNTER,
- TMS34061_REGCOUNT
-};
-
-/* display state structure */
-struct tms34061_display
-{
- uint8_t blanked; /* true if blanked */
- uint8_t *vram; /* base of VRAM */
- uint8_t *latchram; /* base of latch RAM */
- uint16_t *regs; /* pointer to array of registers */
- offs_t dispstart; /* display start */
-};
-
-
-
// ======================> tms34061_device
-class tms34061_device : public device_t,
- public device_video_interface
+class tms34061_device : public device_t, public device_video_interface
{
public:
+ /* display state structure */
+ struct tms34061_display
+ {
+ uint8_t blanked; /* true if blanked */
+ uint8_t *vram; /* base of VRAM */
+ uint8_t *latchram; /* base of latch RAM */
+ uint16_t *regs; /* pointer to array of registers */
+ offs_t dispstart; /* display start */
+ };
+
// construction/destruction
tms34061_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
static void set_rowshift(device_t &device, uint8_t rowshift) { downcast<tms34061_device &>(device).m_rowshift = rowshift; }
static void set_vram_size(device_t &device, uint32_t vramsize) { downcast<tms34061_device &>(device).m_vramsize = vramsize; }
- template<class _Object> static devcb_base &set_interrupt_callback(device_t &device, _Object object) { return downcast<tms34061_device &>(device).m_interrupt_cb.set_callback(object); }
+ template <class Object> static devcb_base &set_interrupt_callback(device_t &device, Object &&cb) { return downcast<tms34061_device &>(device).m_interrupt_cb.set_callback(std::forward<Object>(cb)); }
/* reads/writes to the 34061 */
uint8_t read(address_space &space, int col, int row, int func);
@@ -85,7 +59,13 @@ public:
/* video update handling */
void get_display_state();
- struct tms34061_display m_display;
+ bool blanked() const { return bool(m_display.blanked); }
+ uint8_t const &vram(unsigned row) const { return m_display.vram[row << m_rowshift]; }
+ uint16_t xyoffset() const { return m_display.regs[TMS34061_XYOFFSET]; }
+ uint16_t xyaddress() const { return m_display.regs[TMS34061_XYADDRESS]; }
+
+ // TODO: encapsulate this properly
+ tms34061_display m_display;
protected:
// device-level overrides
@@ -93,6 +73,30 @@ protected:
virtual void device_reset() override;
private:
+ /* register constants */
+ enum
+ {
+ TMS34061_HORENDSYNC = 0,
+ TMS34061_HORENDBLNK,
+ TMS34061_HORSTARTBLNK,
+ TMS34061_HORTOTAL,
+ TMS34061_VERENDSYNC,
+ TMS34061_VERENDBLNK,
+ TMS34061_VERSTARTBLNK,
+ TMS34061_VERTOTAL,
+ TMS34061_DISPUPDATE,
+ TMS34061_DISPSTART,
+ TMS34061_VERINT,
+ TMS34061_CONTROL1,
+ TMS34061_CONTROL2,
+ TMS34061_STATUS,
+ TMS34061_XYOFFSET,
+ TMS34061_XYADDRESS,
+ TMS34061_DISPADDRESS,
+ TMS34061_VERCOUNTER,
+ TMS34061_REGCOUNT
+ };
+
uint8_t m_rowshift; /* VRAM address is (row << rowshift) | col */
uint32_t m_vramsize; /* size of video RAM */
devcb_write_line m_interrupt_cb; /* interrupt gen callback */
@@ -107,7 +111,7 @@ private:
uint8_t * m_shiftreg;
emu_timer * m_timer;
- void update_interrupts(void);
+ void update_interrupts();
TIMER_CALLBACK_MEMBER( interrupt );
void register_w(address_space &space, offs_t offset, uint8_t data);
uint8_t register_r(address_space &space, offs_t offset);
@@ -117,6 +121,6 @@ private:
};
// device type definition
-extern const device_type TMS34061;
+DECLARE_DEVICE_TYPE(TMS34061, tms34061_device)
-#endif
+#endif // MAME_VIDEO_TMS34061_H
diff --git a/src/devices/video/tms3556.cpp b/src/devices/video/tms3556.cpp
index ff902edd80c..ce110948f3e 100644
--- a/src/devices/video/tms3556.cpp
+++ b/src/devices/video/tms3556.cpp
@@ -18,13 +18,33 @@
#include "screen.h"
+//#define VERBOSE 1
+#include "logmacro.h"
+
//**************************************************************************
// MACROS / CONSTANTS
//**************************************************************************
-#define LOG 0
+#define VDP_POINTER m_control_regs[0]
+#define VDP_COL m_control_regs[1]
+#define VDP_ROW m_control_regs[2]
+#define VDP_STAT m_control_regs[3]
+#define VDP_CM1 m_control_regs[4]
+#define VDP_CM2 m_control_regs[5]
+#define VDP_CM3 m_control_regs[6]
+#define VDP_CM4 m_control_regs[7]
+#define VDP_BAMT m_address_regs[0]
+#define VDP_BAMP m_address_regs[1]
+#define VDP_BAPA m_address_regs[2]
+#define VDP_BAGC0 m_address_regs[3]
+#define VDP_BAGC1 m_address_regs[4]
+#define VDP_BAGC2 m_address_regs[5]
+#define VDP_BAGC3 m_address_regs[6]
+#define VDP_BAMTF m_address_regs[7]
+
+ALLOW_SAVE_TYPE(tms3556_device::dma_mode_tt);
@@ -33,7 +53,7 @@
//**************************************************************************
// devices
-const device_type TMS3556 = device_creator<tms3556_device>;
+DEFINE_DEVICE_TYPE(TMS3556, tms3556_device, "tms3556", "Texas Instruments TMS3556 VDP")
// default address map
@@ -85,9 +105,10 @@ inline void tms3556_device::writebyte(offs_t address, uint8_t data)
//-------------------------------------------------
tms3556_device::tms3556_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, TMS3556, "Texas Instruments VDP TMS3556", tag, owner, clock, "tms3556", __FILE__),
+ : device_t(mconfig, TMS3556, tag, owner, clock),
device_memory_interface(mconfig, *this),
m_space_config("videoram", ENDIANNESS_LITTLE, 8, 17, 0, nullptr, *ADDRESS_MAP_NAME(tms3556)),
+ m_reg(0), m_reg2(0),
m_reg_access_phase(0),
m_row_col_written(0),
m_bamp_written(0),
@@ -118,11 +139,13 @@ void tms3556_device::device_start()
// register for state saving
save_item(NAME(m_control_regs));
save_item(NAME(m_address_regs));
+ save_item(NAME(m_reg));
+ save_item(NAME(m_reg2));
save_item(NAME(m_reg_access_phase));
save_item(NAME(m_row_col_written));
save_item(NAME(m_bamp_written));
save_item(NAME(m_colrow));
-// save_item(NAME(m_vdp_acmpxy_mode)); // FIXME : mame cannot save enum
+ save_item(NAME(m_vdp_acmpxy_mode));
save_item(NAME(m_vdp_acmpxy));
save_item(NAME(m_vdp_acmp));
save_item(NAME(m_scanline));
@@ -223,10 +246,10 @@ WRITE8_MEMBER( tms3556_device::vram_w )
READ8_MEMBER( tms3556_device::reg_r )
{
- if (LOG) logerror("TMS3556 Reg Read: %06x\n", offset);
+ LOG("TMS3556 Reg Read: %06x\n", offset);
int reply = 0; // FIXME : will send internal status (VBL, HBL...)
- m_reg_access_phase=0;
+ m_reg_access_phase = 0;
return reply;
}
@@ -236,74 +259,69 @@ READ8_MEMBER( tms3556_device::reg_r )
WRITE8_MEMBER( tms3556_device::reg_w )
{
- static int reg2=0; // FIXME : this static makes that only one TMS3556 will be present in one system...
- static int reg=0;
-
- if (LOG) logerror("TMS3556 Reg Write: %06x = %02x\n", offset, data);
+ LOG("TMS3556 Reg Write: %06x = %02x\n", offset, data);
switch (m_reg_access_phase) {
case 0:
- reg=data&0x0F;
- reg2=(data&0xF0)>>4;
- if (reg!=0)
+ m_reg=data&0x0F;
+ m_reg2=(data&0xF0)>>4;
+ if (m_reg!=0)
m_reg_access_phase=1;
return;
case 1:
- if (reg<8) {
- m_control_regs[reg]=data;
- // leve un flag si le dernier registre ecrit est row ou col
- if ((reg==2) || (reg==1)) {
- m_colrow=(m_control_regs[2]<<8)|m_control_regs[1];
- m_row_col_written=true;
- }
-
- if (reg2==0) {
- m_reg_access_phase=0;
- return;
- }
- else {
- m_reg_access_phase=1;
- reg=reg2;
- reg2=0;
- return;
- }
+ if (m_reg<8) {
+ m_control_regs[m_reg]=data;
+ // leve un flag si le dernier registre ecrit est row ou col
+ if ((m_reg==2) || (m_reg==1)) {
+ m_colrow=(m_control_regs[2]<<8)|m_control_regs[1];
+ m_row_col_written=true;
+ }
+
+ if (m_reg2==0) {
+ m_reg_access_phase=0;
+ return;
+ } else {
+ m_reg_access_phase=1;
+ m_reg=m_reg2;
+ m_reg2=0;
+ return;
+ }
} else {
- m_address_regs[reg-8]=(m_control_regs[2]<<8)|m_control_regs[1];
- // cas speciaux de decalage pour les generateurs
- if ((reg>=0xB) && (reg<=0xE)) {
- m_address_regs[reg-8]+=2;
- m_address_regs[reg-8]&=0xFFFF;
- } else {
- m_address_regs[reg-8]+=1;
- m_address_regs[reg-8]&=0xFFFF;
- }
- if (reg==9) {
- m_row_col_written=false;
- m_bamp_written=true;
- m_reg_access_phase=0;
- return;
- } else {
- m_row_col_written=0;
- m_bamp_written=false;
- m_reg_access_phase=2;//???
- return;
- }
- logerror("VDP16[%d] = x%x",reg,m_address_regs[reg-8]);
- if (reg2==0) {
- m_reg_access_phase=0;
- return;
- }
- else {
- m_reg_access_phase=1;
- reg=reg2;
- reg2=0;
- return;
- }
+ m_address_regs[m_reg-8]=(m_control_regs[2]<<8)|m_control_regs[1];
+ // cas speciaux de decalage pour les generateurs
+ if ((m_reg>=0xB) && (m_reg<=0xE)) {
+ m_address_regs[m_reg-8]+=2;
+ m_address_regs[m_reg-8]&=0xFFFF;
+ } else {
+ m_address_regs[m_reg-8]+=1;
+ m_address_regs[m_reg-8]&=0xFFFF;
+ }
+ if (m_reg==9) {
+ m_row_col_written=false;
+ m_bamp_written=true;
+ m_reg_access_phase=0;
+ return;
+ } else {
+ m_row_col_written=0;
+ m_bamp_written=false;
+ m_reg_access_phase=2;//???
+ return;
+ }
+ logerror("VDP16[%d] = x%x",m_reg,m_address_regs[m_reg-8]);
+ if (m_reg2==0) {
+ m_reg_access_phase=0;
+ return;
+ } else {
+ m_reg_access_phase=1;
+ m_reg=m_reg2;
+ m_reg2=0;
+ return;
+ }
}
- case 2:
- m_reg_access_phase=0;
- return;
+ case 2:
+ m_reg_access_phase=0;
+ return;
}
}
@@ -332,7 +350,7 @@ void tms3556_device::draw_line_empty(uint16_t *ln)
{
int i;
- for (i = 0; i < TMS3556_TOTAL_WIDTH; i++)
+ for (i = 0; i < TOTAL_WIDTH; i++)
#if TMS3556_DOUBLE_WIDTH
*ln++ = m_bg_color;
#endif
@@ -359,7 +377,7 @@ void tms3556_device::draw_line_text_common(uint16_t *ln)
for (i = 0; i < 4; i++)
patterntbl_base[i] = m_address_regs[i + 3];
- for (xx = 0; xx < TMS3556_LEFT_BORDER; xx++)
+ for (xx = 0; xx < LEFT_BORDER; xx++)
#if TMS3556_DOUBLE_WIDTH
*ln++ = m_bg_color;
#endif
@@ -443,7 +461,7 @@ void tms3556_device::draw_line_text_common(uint16_t *ln)
name_offset += 2;
}
- for (xx = 0; xx < TMS3556_RIGHT_BORDER; xx++)
+ for (xx = 0; xx < RIGHT_BORDER; xx++)
#if TMS3556_DOUBLE_WIDTH
*ln++ = m_bg_color;
#endif
@@ -467,7 +485,7 @@ void tms3556_device::draw_line_bitmap_common(uint16_t *ln)
nametbl_base = m_address_regs[2];
- for (xx = 0; xx < TMS3556_LEFT_BORDER; xx++)
+ for (xx = 0; xx < LEFT_BORDER; xx++)
#if TMS3556_DOUBLE_WIDTH
*ln++ = m_bg_color;
#endif
@@ -492,7 +510,7 @@ void tms3556_device::draw_line_bitmap_common(uint16_t *ln)
m_name_offset += 3;
}
- for (xx = 0; xx < TMS3556_RIGHT_BORDER; xx++)
+ for (xx = 0; xx < RIGHT_BORDER; xx++)
#if TMS3556_DOUBLE_WIDTH
*ln++ = m_bg_color;
#endif
@@ -575,7 +593,7 @@ void tms3556_device::draw_line(bitmap_ind16 &bmp, int line)
double_lines = 1;
}
- if ((line < TMS3556_TOP_BORDER) || (line >= (TMS3556_TOP_BORDER + 250)))
+ if ((line < TOP_BORDER) || (line >= (TOP_BORDER + 250)))
{
/* draw top and bottom borders */
draw_line_empty(ln);
@@ -586,16 +604,16 @@ void tms3556_device::draw_line(bitmap_ind16 &bmp, int line)
/* draw useful area */
switch (m_control_regs[6] >> 6)
{
- case TMS3556_MODE_OFF:
+ case MODE_OFF:
draw_line_empty(ln);
break;
- case TMS3556_MODE_TEXT:
+ case MODE_TEXT:
draw_line_text(ln);
break;
- case TMS3556_MODE_BITMAP:
+ case MODE_BITMAP:
draw_line_bitmap(ln);
break;
- case TMS3556_MODE_MIXED:
+ case MODE_MIXED:
draw_line_mixed(ln);
break;
}
@@ -604,8 +622,8 @@ void tms3556_device::draw_line(bitmap_ind16 &bmp, int line)
if (double_lines)
{
// TODO: this overlaps in exeltel - use memmove for now
- //memcpy(ln2, ln, TMS3556_TOTAL_WIDTH * (TMS3556_DOUBLE_WIDTH ? 2 : 1));
- memmove(ln2, ln, TMS3556_TOTAL_WIDTH * (TMS3556_DOUBLE_WIDTH ? 2 : 1));
+ //memcpy(ln2, ln, TOTAL_WIDTH * (TMS3556_DOUBLE_WIDTH ? 2 : 1));
+ memmove(ln2, ln, TOTAL_WIDTH * (TMS3556_DOUBLE_WIDTH ? 2 : 1));
}
}
@@ -651,7 +669,7 @@ void tms3556_device::interrupt(running_machine &machine)
interrupt_start_vblank();
/* render the current line */
- if ((m_scanline >= 0) && (m_scanline < TMS3556_TOTAL_HEIGHT))
+ if ((m_scanline >= 0) && (m_scanline < TOTAL_HEIGHT))
{
//if (!video_skip_this_frame())
draw_line(m_bitmap, m_scanline);
diff --git a/src/devices/video/tms3556.h b/src/devices/video/tms3556.h
index 7568f6443b9..8788225ec62 100644
--- a/src/devices/video/tms3556.h
+++ b/src/devices/video/tms3556.h
@@ -6,48 +6,19 @@
***************************************************************************/
+#ifndef MAME_VIDEO_TMS3556_H
+#define MAME_VIDEO_TMS3556_H
#pragma once
-#ifndef __TMS3556_H__
-#define __TMS3556_H__
///*************************************************************************
// MACROS / CONSTANTS
///*************************************************************************
-#define TMS3556_TOP_BORDER 1
-#define TMS3556_BOTTOM_BORDER 1
-#define TMS3556_LEFT_BORDER 8
-#define TMS3556_RIGHT_BORDER 8
-#define TMS3556_TOTAL_WIDTH (320 + TMS3556_LEFT_BORDER + TMS3556_RIGHT_BORDER)
-#define TMS3556_TOTAL_HEIGHT (250 + TMS3556_TOP_BORDER + TMS3556_BOTTOM_BORDER)
-
/* if DOUBLE_WIDTH set, the horizontal resolution is doubled */
#define TMS3556_DOUBLE_WIDTH 0
-#define TMS3556_MODE_OFF 0
-#define TMS3556_MODE_TEXT 1
-#define TMS3556_MODE_BITMAP 2
-#define TMS3556_MODE_MIXED 3
-
-#define VDP_POINTER m_control_regs[0]
-#define VDP_COL m_control_regs[1]
-#define VDP_ROW m_control_regs[2]
-#define VDP_STAT m_control_regs[3]
-#define VDP_CM1 m_control_regs[4]
-#define VDP_CM2 m_control_regs[5]
-#define VDP_CM3 m_control_regs[6]
-#define VDP_CM4 m_control_regs[7]
-#define VDP_BAMT m_address_regs[0]
-#define VDP_BAMP m_address_regs[1]
-#define VDP_BAPA m_address_regs[2]
-#define VDP_BAGC0 m_address_regs[3]
-#define VDP_BAGC1 m_address_regs[4]
-#define VDP_BAGC2 m_address_regs[5]
-#define VDP_BAGC3 m_address_regs[6]
-#define VDP_BAMTF m_address_regs[7]
-
///*************************************************************************
// INTERFACE CONFIGURATION MACROS
///*************************************************************************
@@ -59,8 +30,6 @@
// TYPE DEFINITIONS
///*************************************************************************
-typedef enum { dma_read, dma_write } dma_mode_tt;
-
// ======================> tms3556_device
@@ -68,6 +37,13 @@ class tms3556_device : public device_t,
public device_memory_interface
{
public:
+ static constexpr unsigned TOP_BORDER = 1;
+ static constexpr unsigned BOTTOM_BORDER = 1;
+ static constexpr unsigned LEFT_BORDER = 8;
+ static constexpr unsigned RIGHT_BORDER = 8;
+ static constexpr unsigned TOTAL_WIDTH = 320 + LEFT_BORDER + RIGHT_BORDER;
+ static constexpr unsigned TOTAL_HEIGHT = 250 + TOP_BORDER + BOTTOM_BORDER;
+
// construction/destruction
tms3556_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
@@ -86,7 +62,7 @@ protected:
virtual void device_start() override;
// device_config_memory_interface overrides
- virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override;
+ virtual const address_space_config *memory_space_config(address_spacenum spacenum) const override;
// address space configurations
const address_space_config m_space_config;
@@ -104,11 +80,19 @@ protected:
void interrupt_start_vblank(void);
private:
+ enum dma_mode_tt { dma_read, dma_write };
+
+ static constexpr uint8_t MODE_OFF = 0;
+ static constexpr uint8_t MODE_TEXT = 1;
+ static constexpr uint8_t MODE_BITMAP = 2;
+ static constexpr uint8_t MODE_MIXED = 3;
+
// registers
uint8_t m_control_regs[8];
uint16_t m_address_regs[8];
// register interface
+ int m_reg, m_reg2;
int m_reg_access_phase;
int m_row_col_written;
@@ -134,6 +118,6 @@ private:
// device type definition
extern const device_type TMS3556;
+DECLARE_DEVICE_TYPE(TMS3556, tms3556_device)
-
-#endif
+#endif // MAME_VIDEO_TMS3556_H
diff --git a/src/devices/video/tms9927.cpp b/src/devices/video/tms9927.cpp
index c224b0965f4..2908fb01d29 100644
--- a/src/devices/video/tms9927.cpp
+++ b/src/devices/video/tms9927.cpp
@@ -12,8 +12,8 @@
#include "screen.h"
-static const uint8_t chars_per_row_value[8] = { 20, 32, 40, 64, 72, 80, 96, 132 };
-static const uint8_t skew_bits_value[4] = { 0, 1, 2, 2 };
+static constexpr uint8_t chars_per_row_value[8] = { 20, 32, 40, 64, 72, 80, 96, 132 };
+static constexpr uint8_t skew_bits_value[4] = { 0, 1, 2, 2 };
#define HCOUNT (m_reg[0] + 1)
@@ -31,19 +31,18 @@ static const uint8_t skew_bits_value[4] = { 0, 1, 2, 2 };
#define CURSOR_ROW_ADDRESS (m_reg[8] & 0x3f)
-const device_type TMS9927 = device_creator<tms9927_device>;
-const device_type CRT5027 = device_creator<crt5027_device>;
-const device_type CRT5037 = device_creator<crt5037_device>;
-const device_type CRT5057 = device_creator<crt5057_device>;
+DEFINE_DEVICE_TYPE(TMS9927, tms9927_device, "tms9927", "TMS9927 VTC")
+DEFINE_DEVICE_TYPE(CRT5027, crt5027_device, "crt5027", "CRT5027")
+DEFINE_DEVICE_TYPE(CRT5037, crt5037_device, "crt5037", "CRT5037")
+DEFINE_DEVICE_TYPE(CRT5057, crt5057_device, "crt5057", "CRT5057")
tms9927_device::tms9927_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : tms9927_device(mconfig, TMS9927, "TMS9927 VTC", tag, owner, clock, "tms9927", __FILE__)
+ : tms9927_device(mconfig, TMS9927, tag, owner, clock)
{
- memset(m_reg, 0x00, sizeof(m_reg));
}
-tms9927_device::tms9927_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source)
- : device_t(mconfig, type, name, tag, owner, clock, shortname, source)
+tms9927_device::tms9927_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
+ : device_t(mconfig, type, tag, owner, clock)
, device_video_interface(mconfig, *this)
, m_write_vsyn(*this)
, m_hpixels_per_column(0)
@@ -54,21 +53,21 @@ tms9927_device::tms9927_device(const machine_config &mconfig, device_type type,
, m_selfload(*this, finder_base::DUMMY_TAG)
, m_reset(0)
{
- memset(m_reg, 0x00, sizeof(m_reg));
+ std::fill(std::begin(m_reg), std::end(m_reg), 0x00);
}
crt5027_device::crt5027_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : tms9927_device(mconfig, CRT5027, "CRT5027", tag, owner, clock, "crt5027", __FILE__)
+ : tms9927_device(mconfig, CRT5027, tag, owner, clock)
{
}
crt5037_device::crt5037_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : tms9927_device(mconfig, CRT5037, "CRT5037", tag, owner, clock, "crt5037", __FILE__)
+ : tms9927_device(mconfig, CRT5037, tag, owner, clock)
{
}
crt5057_device::crt5057_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : tms9927_device(mconfig, CRT5057, "CRT5057", tag, owner, clock, "crt5057", __FILE__)
+ : tms9927_device(mconfig, CRT5057, tag, owner, clock)
{
}
diff --git a/src/devices/video/tms9927.h b/src/devices/video/tms9927.h
index cd4057d67f9..cc7caaafe6b 100644
--- a/src/devices/video/tms9927.h
+++ b/src/devices/video/tms9927.h
@@ -6,8 +6,8 @@
**********************************************************************/
-#ifndef __TMS9927__
-#define __TMS9927__
+#ifndef MAME_VIDEO_TMS9927_H
+#define MAME_VIDEO_TMS9927_H
#define MCFG_TMS9927_VSYN_CALLBACK(_write) \
@@ -22,24 +22,21 @@
#define MCFG_TMS9927_OVERSCAN(_left, _right, _top, _bottom) \
tms9927_device::set_overscan(*device, _left, _right, _top, _bottom);
-class tms9927_device : public device_t,
- public device_video_interface
+class tms9927_device : public device_t, public device_video_interface
{
public:
tms9927_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- tms9927_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source);
- ~tms9927_device() {}
- template<class _Object> static devcb_base &set_vsyn_wr_callback(device_t &device, _Object object) { return downcast<tms9927_device &>(device).m_write_vsyn.set_callback(object); }
+ template <class Object> static devcb_base &set_vsyn_wr_callback(device_t &device, Object &&cb) { return downcast<tms9927_device &>(device).m_write_vsyn.set_callback(std::forward<Object>(cb)); }
static void set_char_width(device_t &device, int pixels) { downcast<tms9927_device &>(device).m_hpixels_per_column = pixels; }
static void set_region_tag(device_t &device, const char *tag) { downcast<tms9927_device &>(device).m_selfload.set_tag(tag); }
static void set_overscan(device_t &device, int left, int right, int top, int bottom) {
- tms9927_device &dev = downcast<tms9927_device &>(device);
- dev.m_overscan_left = left;
- dev.m_overscan_right = right;
- dev.m_overscan_top = top;
- dev.m_overscan_bottom = bottom;
+ tms9927_device &dev = downcast<tms9927_device &>(device);
+ dev.m_overscan_left = left;
+ dev.m_overscan_right = right;
+ dev.m_overscan_top = top;
+ dev.m_overscan_bottom = bottom;
}
DECLARE_WRITE8_MEMBER(write);
@@ -50,6 +47,8 @@ public:
int cursor_bounds(rectangle &bounds);
protected:
+ tms9927_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
+
// device-level overrides
virtual void device_start() override;
virtual void device_stop() override;
@@ -87,13 +86,11 @@ private:
uint16_t m_total_hpix, m_total_vpix;
uint16_t m_visible_hpix, m_visible_vpix;
-
int m_vsyn;
emu_timer *m_vsync_timer;
};
-extern const device_type TMS9927;
class crt5027_device : public tms9927_device
{
@@ -101,7 +98,6 @@ public:
crt5027_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
};
-extern const device_type CRT5027;
class crt5037_device : public tms9927_device
{
@@ -109,7 +105,6 @@ public:
crt5037_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
};
-extern const device_type CRT5037;
class crt5057_device : public tms9927_device
{
@@ -117,7 +112,10 @@ public:
crt5057_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
};
-extern const device_type CRT5057;
+DECLARE_DEVICE_TYPE(TMS9927, tms9927_device)
+DECLARE_DEVICE_TYPE(CRT5027, crt5027_device)
+DECLARE_DEVICE_TYPE(CRT5037, crt5037_device)
+DECLARE_DEVICE_TYPE(CRT5057, crt5057_device)
-#endif
+#endif // MAME_VIDEO_TMS9927_H
diff --git a/src/devices/video/tms9928a.cpp b/src/devices/video/tms9928a.cpp
index 1c787dbf126..a225d0db181 100644
--- a/src/devices/video/tms9928a.cpp
+++ b/src/devices/video/tms9928a.cpp
@@ -27,14 +27,14 @@
#include "tms9928a.h"
-const device_type TMS9928A = device_creator<tms9928a_device>;
-const device_type TMS9918 = device_creator<tms9918_device>;
-const device_type TMS9918A = device_creator<tms9918a_device>;
-const device_type TMS9118 = device_creator<tms9118_device>;
-const device_type TMS9128 = device_creator<tms9128_device>;
-const device_type TMS9929 = device_creator<tms9929_device>;
-const device_type TMS9929A = device_creator<tms9929a_device>;
-const device_type TMS9129 = device_creator<tms9129_device>;
+DEFINE_DEVICE_TYPE(TMS9928A, tms9928a_device, "tms9928a", "TMS9928A VDP")
+DEFINE_DEVICE_TYPE(TMS9918, tms9918_device, "tms9918", "TMS9918 VDP")
+DEFINE_DEVICE_TYPE(TMS9918A, tms9918a_device, "tms9918a", "TMS9918A VDP")
+DEFINE_DEVICE_TYPE(TMS9118, tms9118_device, "tms9118", "TMS9118 VDP")
+DEFINE_DEVICE_TYPE(TMS9128, tms9128_device, "tms9128", "TMS9128 VDP")
+DEFINE_DEVICE_TYPE(TMS9929, tms9929_device, "tms9929", "TMS9929 VDP")
+DEFINE_DEVICE_TYPE(TMS9929A, tms9929a_device, "tms9929a", "TMS9929A VDP")
+DEFINE_DEVICE_TYPE(TMS9129, tms9129_device, "tms9129", "TMS9129 VDP")
// ======= Debugging =========
@@ -54,63 +54,61 @@ static ADDRESS_MAP_START(memmap, AS_DATA, 8, tms9928a_device)
AM_RANGE(0x0000, 0x3fff) AM_RAM
ADDRESS_MAP_END
-tms9928a_device::tms9928a_device( const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, bool is_50hz, bool is_reva, bool is_99, const char *shortname, const char *source)
- : device_t( mconfig, type, name, tag, owner, clock, shortname, source),
- device_memory_interface(mconfig, *this),
- device_video_interface(mconfig, *this),
- m_out_int_line_cb(*this),
- m_out_gromclk_cb(*this),
- m_space_config("vram",ENDIANNESS_BIG, 8, 14, 0, nullptr, *ADDRESS_MAP_NAME(memmap))
+tms9928a_device::tms9928a_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, bool is_50hz, bool is_reva, bool is_99)
+ : device_t(mconfig, type, tag, owner, clock)
+ , device_memory_interface(mconfig, *this)
+ , device_video_interface(mconfig, *this)
+ , m_vram_size(0)
+ , m_out_int_line_cb(*this)
+ , m_out_gromclk_cb(*this)
+ , m_50hz(is_50hz)
+ , m_reva(is_reva)
+ , m_99(is_99)
+ , m_space_config("vram", ENDIANNESS_BIG, 8, 14, 0, nullptr, *ADDRESS_MAP_NAME(memmap))
{
- m_50hz = is_50hz;
- m_reva = is_reva;
- m_99 = is_99;
// static_set_addrmap(*this, AS_DATA, ADDRESS_MAP_NAME(memmap));
}
tms9928a_device::tms9928a_device( const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock )
- : device_t( mconfig, TMS9928A, "TMS9928A VDP", tag, owner, clock, "tms9928a", __FILE__),
- device_memory_interface(mconfig, *this),
- device_video_interface(mconfig, *this),
- m_vram_size(0),
- m_out_int_line_cb(*this),
- m_out_gromclk_cb(*this),
- m_space_config("vram",ENDIANNESS_BIG, 8, 14, 0, nullptr, *ADDRESS_MAP_NAME(memmap))
+ : tms9928a_device(mconfig, TMS9928A, tag, owner, clock, false, true, true)
{
- m_50hz = false;
- m_reva = true;
- m_99 = true;
-// static_set_addrmap(*this, AS_DATA, ADDRESS_MAP_NAME(memmap));
}
tms9129_device::tms9129_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : tms9928a_device( mconfig, TMS9129, "TMS9129", tag, owner, clock, true, true, false, "tms9129", __FILE__)
-{ }
+ : tms9928a_device(mconfig, TMS9129, tag, owner, clock, true, true, false)
+{
+}
tms9918_device::tms9918_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : tms9928a_device( mconfig, TMS9918, "TMS9918", tag, owner, clock, false, false, true, "tms9918", __FILE__)
-{ }
+ : tms9928a_device(mconfig, TMS9918, tag, owner, clock, false, false, true)
+{
+}
tms9918a_device::tms9918a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : tms9928a_device( mconfig, TMS9918A, "TMS9918A", tag, owner, clock, false, true, true, "tms9918a", __FILE__)
-{ }
+ : tms9928a_device(mconfig, TMS9918A, tag, owner, clock, false, true, true)
+{
+}
tms9118_device::tms9118_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : tms9928a_device( mconfig, TMS9118, "TMS9118 VDP", tag, owner, clock, false, true, false, "tms9118", __FILE__)
-{ }
+ : tms9928a_device(mconfig, TMS9118, tag, owner, clock, false, true, false)
+{
+}
tms9128_device::tms9128_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : tms9928a_device( mconfig, TMS9128, "TMS9128 VDP", tag, owner, clock, false, true, false, "tms9128", __FILE__)
-{ }
+ : tms9928a_device(mconfig, TMS9128, tag, owner, clock, false, true, false)
+{
+}
tms9929_device::tms9929_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : tms9928a_device( mconfig, TMS9929, "TMS9929", tag, owner, clock, true, false, true, "tms9929", __FILE__)
-{ }
+ : tms9928a_device(mconfig, TMS9929, tag, owner, clock, true, false, true)
+{
+}
tms9929a_device::tms9929a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : tms9928a_device( mconfig, TMS9929A, "TMS9929A", tag, owner, clock, true, true, true, "tms9929a", __FILE__)
-{ }
+ : tms9928a_device(mconfig, TMS9929A, tag, owner, clock, true, true, true)
+{
+}
READ8_MEMBER( tms9928a_device::read )
{
@@ -342,7 +340,7 @@ void tms9928a_device::device_timer(emu_timer &timer, device_timer_id id, int par
if ( y < 0 || y >= 192 || ! (m_Regs[1] & 0x40) )
{
/* Draw backdrop colour */
- for ( int i = 0; i < TMS9928A_TOTAL_HORZ; i++ )
+ for ( int i = 0; i < TOTAL_HORZ; i++ )
p[i] = m_palette[BackColour];
/* vblank is set at the last cycle of the first inactive line */
@@ -357,7 +355,7 @@ void tms9928a_device::device_timer(emu_timer &timer, device_timer_id id, int par
/* Draw regular line */
/* Left border */
- for ( int i = 0; i < TMS9928A_HORZ_DISPLAY_START; i++ )
+ for ( int i = 0; i < HORZ_DISPLAY_START; i++ )
p[i] = m_palette[BackColour];
/* Active display */
@@ -369,7 +367,7 @@ void tms9928a_device::device_timer(emu_timer &timer, device_timer_id id, int par
{
uint16_t addr = m_nametbl + ( ( y & 0xF8 ) << 2 );
- for ( int x = TMS9928A_HORZ_DISPLAY_START; x < TMS9928A_HORZ_DISPLAY_START + 256; x+= 8, addr++ )
+ for ( int x = HORZ_DISPLAY_START; x < HORZ_DISPLAY_START + 256; x+= 8, addr++ )
{
uint8_t charcode = m_vram_space->read_byte( addr );
uint8_t pattern = m_vram_space->read_byte( m_pattern + ( charcode << 3 ) + ( y & 7 ) );
@@ -391,10 +389,10 @@ void tms9928a_device::device_timer(emu_timer &timer, device_timer_id id, int par
rgb_t bg = m_palette[BackColour];
/* Extra 6 pixels left border */
- for ( int x = TMS9928A_HORZ_DISPLAY_START; x < TMS9928A_HORZ_DISPLAY_START + 6; x++ )
+ for ( int x = HORZ_DISPLAY_START; x < HORZ_DISPLAY_START + 6; x++ )
p[x] = bg;
- for ( int x = TMS9928A_HORZ_DISPLAY_START + 6; x < TMS9928A_HORZ_DISPLAY_START + 246; x+= 6, addr++ )
+ for ( int x = HORZ_DISPLAY_START + 6; x < HORZ_DISPLAY_START + 246; x+= 6, addr++ )
{
uint16_t charcode = m_vram_space->read_byte( addr );
uint8_t pattern = m_vram_space->read_byte( m_pattern + ( charcode << 3 ) + ( y & 7 ) );
@@ -404,7 +402,7 @@ void tms9928a_device::device_timer(emu_timer &timer, device_timer_id id, int par
}
/* Extra 10 pixels right border */
- for ( int x = TMS9928A_HORZ_DISPLAY_START + 246; x < TMS9928A_HORZ_DISPLAY_START + 256; x++ )
+ for ( int x = HORZ_DISPLAY_START + 246; x < HORZ_DISPLAY_START + 256; x++ )
p[x] = bg;
}
break;
@@ -414,7 +412,7 @@ void tms9928a_device::device_timer(emu_timer &timer, device_timer_id id, int par
{
uint16_t addr = m_nametbl + ( ( y >> 3 ) * 32 );
- for ( int x = TMS9928A_HORZ_DISPLAY_START; x < TMS9928A_HORZ_DISPLAY_START + 256; x+= 8, addr++ )
+ for ( int x = HORZ_DISPLAY_START; x < HORZ_DISPLAY_START + 256; x+= 8, addr++ )
{
uint16_t charcode = m_vram_space->read_byte( addr ) + ( ( y >> 6 ) << 8 );
uint8_t pattern = m_vram_space->read_byte( m_pattern + ( ( charcode & m_patternmask ) << 3 ) + ( y & 7 ) );
@@ -436,10 +434,10 @@ void tms9928a_device::device_timer(emu_timer &timer, device_timer_id id, int par
rgb_t bg = m_palette[BackColour];
/* Extra 6 pixels left border */
- for ( int x = TMS9928A_HORZ_DISPLAY_START; x < TMS9928A_HORZ_DISPLAY_START + 6; x++ )
+ for ( int x = HORZ_DISPLAY_START; x < HORZ_DISPLAY_START + 6; x++ )
p[x] = bg;
- for ( int x = TMS9928A_HORZ_DISPLAY_START + 6; x < TMS9928A_HORZ_DISPLAY_START + 246; x+= 6, addr++ )
+ for ( int x = HORZ_DISPLAY_START + 6; x < HORZ_DISPLAY_START + 246; x+= 6, addr++ )
{
uint16_t charcode = ( m_vram_space->read_byte( addr ) + ( ( y >> 6 ) << 8 ) ) & m_patternmask;
uint8_t pattern = m_vram_space->read_byte( m_pattern + ( charcode << 3 ) + ( y & 7 ) );
@@ -449,7 +447,7 @@ void tms9928a_device::device_timer(emu_timer &timer, device_timer_id id, int par
}
/* Extra 10 pixels right border */
- for ( int x = TMS9928A_HORZ_DISPLAY_START + 246; x < TMS9928A_HORZ_DISPLAY_START + 256; x++ )
+ for ( int x = HORZ_DISPLAY_START + 246; x < HORZ_DISPLAY_START + 256; x++ )
p[x] = bg;
}
break;
@@ -459,7 +457,7 @@ void tms9928a_device::device_timer(emu_timer &timer, device_timer_id id, int par
{
uint16_t addr = m_nametbl + ( ( y >> 3 ) * 32 );
- for ( int x = TMS9928A_HORZ_DISPLAY_START; x < TMS9928A_HORZ_DISPLAY_START + 256; x+= 8, addr++ )
+ for ( int x = HORZ_DISPLAY_START; x < HORZ_DISPLAY_START + 256; x+= 8, addr++ )
{
uint8_t charcode = m_vram_space->read_byte( addr );
uint8_t colour = m_vram_space->read_byte( m_pattern + ( charcode << 3 ) + ( ( y >> 2 ) & 7 ) );
@@ -479,17 +477,17 @@ void tms9928a_device::device_timer(emu_timer &timer, device_timer_id id, int par
rgb_t bg = m_palette[BackColour];
/* Extra 6 pixels left border */
- for ( int x = TMS9928A_HORZ_DISPLAY_START; x < TMS9928A_HORZ_DISPLAY_START + 6; x++ )
+ for ( int x = HORZ_DISPLAY_START; x < HORZ_DISPLAY_START + 6; x++ )
p[x] = bg;
- for ( int x = TMS9928A_HORZ_DISPLAY_START + 6; x < TMS9928A_HORZ_DISPLAY_START + 246; x+= 6 )
+ for ( int x = HORZ_DISPLAY_START + 6; x < HORZ_DISPLAY_START + 246; x+= 6 )
{
p[x+0] = p[x+1] = p[x+2] = p[x+3] = fg;
p[x+4] = p[x+5] = bg;
}
/* Extra 10 pixels right border */
- for ( int x = TMS9928A_HORZ_DISPLAY_START + 246; x < TMS9928A_HORZ_DISPLAY_START + 256; x++ )
+ for ( int x = HORZ_DISPLAY_START + 246; x < HORZ_DISPLAY_START + 256; x++ )
p[x] = bg;
}
break;
@@ -499,7 +497,7 @@ void tms9928a_device::device_timer(emu_timer &timer, device_timer_id id, int par
{
uint16_t addr = m_nametbl + ( ( y >> 3 ) * 32 );
- for ( int x = TMS9928A_HORZ_DISPLAY_START; x < TMS9928A_HORZ_DISPLAY_START + 256; x+= 8, addr++ )
+ for ( int x = HORZ_DISPLAY_START; x < HORZ_DISPLAY_START + 256; x+= 8, addr++ )
{
uint8_t charcode = m_vram_space->read_byte( addr );
uint8_t colour = m_vram_space->read_byte( m_pattern + ( ( ( charcode + ( ( y >> 2 ) & 7 ) + ( ( y >> 6 ) << 8 ) ) & m_patternmask ) << 3 ) );
@@ -597,7 +595,7 @@ void tms9928a_device::device_timer(emu_timer &timer, device_timer_id id, int par
if ( ! ( spr_drawn[ colission_index ] & 0x02 ) )
{
spr_drawn[ colission_index ] |= 0x02;
- p[ TMS9928A_HORZ_DISPLAY_START + colission_index - 32 ] = m_palette[sprcol];
+ p[ HORZ_DISPLAY_START + colission_index - 32 ] = m_palette[sprcol];
}
}
}
@@ -621,12 +619,12 @@ void tms9928a_device::device_timer(emu_timer &timer, device_timer_id id, int par
}
/* Right border */
- for ( int i = TMS9928A_HORZ_DISPLAY_START + 256; i < TMS9928A_TOTAL_HORZ; i++ )
+ for ( int i = HORZ_DISPLAY_START + 256; i < TOTAL_HORZ; i++ )
p[i] = m_palette[BackColour];
}
/* Schedule next callback */
- m_line_timer->adjust( m_screen->time_until_pos( ( raw_vpos + 1 ) % m_screen->height() , TMS9928A_HORZ_DISPLAY_START ) );
+ m_line_timer->adjust( m_screen->time_until_pos( ( raw_vpos + 1 ) % m_screen->height() , HORZ_DISPLAY_START ) );
}
@@ -666,7 +664,7 @@ void tms9928a_device::set_palette()
E Gray 0.80 0.47 0.47 0.80 0.80 0.80 204 204 204
F White 1.00 0.47 0.47 1.00 1.00 1.00 255 255 255
*/
- static const rgb_t tms9928a_palette[TMS9928A_PALETTE_SIZE] =
+ static const rgb_t tms9928a_palette[PALETTE_SIZE] =
{
rgb_t::black(),
rgb_t::black(),
@@ -687,7 +685,7 @@ void tms9928a_device::set_palette()
};
/* copy default palette into working palette */
- for (int i = 0; i < TMS9928A_PALETTE_SIZE; i++)
+ for (int i = 0; i < PALETTE_SIZE; i++)
{
m_palette[i] = tms9928a_palette[i];
}
@@ -695,8 +693,8 @@ void tms9928a_device::set_palette()
void tms9928a_device::device_start()
{
- m_top_border = m_50hz ? TMS9928A_VERT_DISPLAY_START_PAL : TMS9928A_VERT_DISPLAY_START_NTSC;
- m_vertical_size = m_50hz ? TMS9928A_TOTAL_VERT_PAL : TMS9928A_TOTAL_VERT_NTSC;
+ m_top_border = m_50hz ? VERT_DISPLAY_START_PAL : VERT_DISPLAY_START_NTSC;
+ m_vertical_size = m_50hz ? TOTAL_VERT_PAL : TOTAL_VERT_NTSC;
m_out_int_line_cb.resolve();
m_out_gromclk_cb.resolve();
@@ -705,7 +703,7 @@ void tms9928a_device::device_start()
m_vram_space = &space(AS_DATA);
/* back bitmap */
- m_tmpbmp.allocate(TMS9928A_TOTAL_HORZ, TMS9928A_TOTAL_VERT_PAL);
+ m_tmpbmp.allocate(TOTAL_HORZ, TOTAL_VERT_PAL);
m_line_timer = timer_alloc(TIMER_LINE);
m_gromclk_timer = timer_alloc(GROMCLK);
@@ -759,7 +757,7 @@ void tms9928a_device::device_reset()
m_latch = 0;
m_mode = 0;
- m_line_timer->adjust( m_screen->time_until_pos( 0, TMS9928A_HORZ_DISPLAY_START ) );
+ m_line_timer->adjust( m_screen->time_until_pos( 0, HORZ_DISPLAY_START ) );
// TODO: Check clock freq settings in all drivers
if (!m_out_gromclk_cb.isnull() && m_99) m_gromclk_timer->adjust(attotime::zero, 0, attotime::from_hz(clock()/12));
diff --git a/src/devices/video/tms9928a.h b/src/devices/video/tms9928a.h
index 03389ac14ad..7db5991b5a5 100644
--- a/src/devices/video/tms9928a.h
+++ b/src/devices/video/tms9928a.h
@@ -23,26 +23,14 @@
*/
-#ifndef MAME_DEVICES_VIDEO_TMS9928A_H
-#define MAME_DEVICES_VIDEO_TMS9928A_H
+#ifndef MAME_VIDEO_TMS9928A_H
+#define MAME_VIDEO_TMS9928A_H
#pragma once
#include "screen.h"
-#define TMS9928A_PALETTE_SIZE 16
-
-
-/* Some defines used in defining the screens */
-#define TMS9928A_TOTAL_HORZ 342
-#define TMS9928A_TOTAL_VERT_NTSC 262
-#define TMS9928A_TOTAL_VERT_PAL 313
-
-#define TMS9928A_HORZ_DISPLAY_START (2 + 14 + 8 + 13)
-#define TMS9928A_VERT_DISPLAY_START_PAL (13 + 51)
-#define TMS9928A_VERT_DISPLAY_START_NTSC (13 + 27)
-
// MCFG_DEVICE_ADD(_tag, _variant, XTAL_10_738635MHz / 2 )
#define MCFG_TMS9928A_VRAM_SIZE(_size) \
@@ -60,25 +48,25 @@
#define MCFG_TMS9928A_SCREEN_ADD_NTSC(_screen_tag) \
MCFG_VIDEO_SET_SCREEN(_screen_tag) \
MCFG_SCREEN_ADD( _screen_tag, RASTER ) \
- MCFG_SCREEN_RAW_PARAMS( XTAL_10_738635MHz / 2, TMS9928A_TOTAL_HORZ, TMS9928A_HORZ_DISPLAY_START-12, TMS9928A_HORZ_DISPLAY_START + 256 + 12, \
- TMS9928A_TOTAL_VERT_NTSC, TMS9928A_VERT_DISPLAY_START_NTSC - 12, TMS9928A_VERT_DISPLAY_START_NTSC + 192 + 12 )
+ MCFG_SCREEN_RAW_PARAMS( XTAL_10_738635MHz / 2, tms9928a_device::TOTAL_HORZ, tms9928a_device::HORZ_DISPLAY_START-12, tms9928a_device::HORZ_DISPLAY_START + 256 + 12, \
+ tms9928a_device::TOTAL_VERT_NTSC, tms9928a_device::VERT_DISPLAY_START_NTSC - 12, tms9928a_device::VERT_DISPLAY_START_NTSC + 192 + 12 )
#define MCFG_TMS9928A_SCREEN_ADD_PAL(_screen_tag) \
MCFG_VIDEO_SET_SCREEN(_screen_tag) \
MCFG_SCREEN_ADD(_screen_tag, RASTER ) \
- MCFG_SCREEN_RAW_PARAMS( XTAL_10_738635MHz / 2, TMS9928A_TOTAL_HORZ, TMS9928A_HORZ_DISPLAY_START-12, TMS9928A_HORZ_DISPLAY_START + 256 + 12, \
- TMS9928A_TOTAL_VERT_PAL, TMS9928A_VERT_DISPLAY_START_PAL - 12, TMS9928A_VERT_DISPLAY_START_PAL + 192 + 12 )
+ MCFG_SCREEN_RAW_PARAMS( XTAL_10_738635MHz / 2, tms9928a_device::TOTAL_HORZ, tms9928a_device::HORZ_DISPLAY_START-12, tms9928a_device::HORZ_DISPLAY_START + 256 + 12, \
+ tms9928a_device::TOTAL_VERT_PAL, tms9928a_device::VERT_DISPLAY_START_PAL - 12, tms9928a_device::VERT_DISPLAY_START_PAL + 192 + 12 )
-extern const device_type TMS9918;
-extern const device_type TMS9918A;
-extern const device_type TMS9118;
-extern const device_type TMS9928A;
-extern const device_type TMS9128;
-extern const device_type TMS9929;
-extern const device_type TMS9929A;
-extern const device_type TMS9129;
+DECLARE_DEVICE_TYPE(TMS9918, tms9918_device)
+DECLARE_DEVICE_TYPE(TMS9918A, tms9918a_device)
+DECLARE_DEVICE_TYPE(TMS9118, tms9118_device)
+DECLARE_DEVICE_TYPE(TMS9928A, tms9928a_device)
+DECLARE_DEVICE_TYPE(TMS9128, tms9128_device)
+DECLARE_DEVICE_TYPE(TMS9929, tms9929_device)
+DECLARE_DEVICE_TYPE(TMS9929A, tms9929a_device)
+DECLARE_DEVICE_TYPE(TMS9129, tms9129_device)
class tms9928a_device : public device_t,
@@ -86,13 +74,23 @@ class tms9928a_device : public device_t,
public device_video_interface
{
public:
+ static constexpr unsigned PALETTE_SIZE = 16;
+
+ /* Some defines used in defining the screens */
+ static constexpr unsigned TOTAL_HORZ = 342;
+ static constexpr unsigned TOTAL_VERT_NTSC = 262;
+ static constexpr unsigned TOTAL_VERT_PAL = 313;
+
+ static constexpr unsigned HORZ_DISPLAY_START = 2 + 14 + 8 + 13;
+ static constexpr unsigned VERT_DISPLAY_START_PAL = 13 + 51;
+ static constexpr unsigned VERT_DISPLAY_START_NTSC = 13 + 27;
+
// construction/destruction
tms9928a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- tms9928a_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, bool is_50hz, bool is_reva, bool is_99, const char *shortname, const char *source);
static void set_vram_size(device_t &device, int vram_size) { downcast<tms9928a_device &>(device).m_vram_size = vram_size; }
- template<class _Object> static devcb_base &set_out_int_line_callback(device_t &device, _Object object) { return downcast<tms9928a_device &>(device).m_out_int_line_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_out_gromclk_callback(device_t &device, _Object object) { return downcast<tms9928a_device &>(device).m_out_gromclk_cb.set_callback(object); }
+ template <class Object> static devcb_base &set_out_int_line_callback(device_t &device, Object &&cb) { return downcast<tms9928a_device &>(device).m_out_int_line_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_out_gromclk_callback(device_t &device, Object &&cb) { return downcast<tms9928a_device &>(device).m_out_gromclk_cb.set_callback(std::forward<Object>(cb)); }
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
@@ -110,6 +108,8 @@ public:
void reset_line(int state) { if (state==ASSERT_LINE) device_reset(); }
protected:
+ tms9928a_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, bool is_50hz, bool is_reva, bool is_99);
+
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
@@ -147,9 +147,9 @@ private:
uint16_t m_spritepattern;
int m_colourmask;
int m_patternmask;
- bool m_50hz;
- bool m_reva;
- bool m_99;
+ const bool m_50hz;
+ const bool m_reva;
+ const bool m_99;
rgb_t m_palette[16];
/* memory */
@@ -216,4 +216,4 @@ public:
};
-#endif // MAME_DEVICES_VIDEO_TMS9928A_H
+#endif // MAME_VIDEO_TMS9928A_H
diff --git a/src/devices/video/upd3301.cpp b/src/devices/video/upd3301.cpp
index 8b6dce81ffa..424ea81cee8 100644
--- a/src/devices/video/upd3301.cpp
+++ b/src/devices/video/upd3301.cpp
@@ -24,15 +24,15 @@
#include "screen.h"
+//#define VERBOSE 1
+#include "logmacro.h"
+
//**************************************************************************
// MACROS / CONSTANTS
//**************************************************************************
-#define LOG 0
-
-
#define COMMAND_MASK 0xe0
#define COMMAND_RESET 0x00
#define COMMAND_START_DISPLAY 0x20
@@ -65,7 +65,7 @@ enum
// DEVICE DEFINITIONS
//**************************************************************************
-const device_type UPD3301 = device_creator<upd3301_device>;
+DEFINE_DEVICE_TYPE(UPD3301, upd3301_device, "upd3301", "NEC uPD3301")
@@ -78,7 +78,7 @@ const device_type UPD3301 = device_creator<upd3301_device>;
//-------------------------------------------------
upd3301_device::upd3301_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, UPD3301, "UPD3301", tag, owner, clock, "upd3301", __FILE__),
+ device_t(mconfig, UPD3301, tag, owner, clock),
device_video_interface(mconfig, *this),
m_write_int(*this),
m_write_drq(*this),
@@ -192,7 +192,7 @@ void upd3301_device::device_timer(emu_timer &timer, device_timer_id id, int para
switch (id)
{
case TIMER_HRTC:
- if (LOG) logerror("UPD3301 '%s' HRTC: %u\n", tag(), param);
+ LOG("UPD3301 HRTC: %u\n", param);
m_write_hrtc(param);
m_hrtc = param;
@@ -201,7 +201,7 @@ void upd3301_device::device_timer(emu_timer &timer, device_timer_id id, int para
break;
case TIMER_VRTC:
- if (LOG) logerror("UPD3301 '%s' VRTC: %u\n", tag(), param);
+ LOG("UPD3301 VRTC: %u\n", param);
m_write_vrtc(param);
m_vrtc = param;
@@ -261,31 +261,31 @@ WRITE8_MEMBER( upd3301_device::write )
case 0:
m_dma_mode = BIT(data, 7);
m_h = (data & 0x7f) + 2;
- if (LOG) logerror("UPD3301 '%s' DMA Mode: %s\n", tag(), m_dma_mode ? "character" : "burst");
- if (LOG) logerror("UPD3301 '%s' H: %u\n", tag(), m_h);
+ LOG("UPD3301 DMA Mode: %s\n", m_dma_mode ? "character" : "burst");
+ LOG("UPD3301 H: %u\n", m_h);
break;
case 1:
m_b = ((data >> 6) + 1) * 16;
m_l = (data & 0x3f) + 1;
- if (LOG) logerror("UPD3301 '%s' B: %u\n", tag(), m_b);
- if (LOG) logerror("UPD3301 '%s' L: %u\n", tag(), m_l);
+ LOG("UPD3301 B: %u\n", m_b);
+ LOG("UPD3301 L: %u\n", m_l);
break;
case 2:
m_s = BIT(data, 7);
m_c = (data >> 4) & 0x03;
m_r = (data & 0x1f) + 1;
- if (LOG) logerror("UPD3301 '%s' S: %u\n", tag(), m_s);
- if (LOG) logerror("UPD3301 '%s' C: %u\n", tag(), m_c);
- if (LOG) logerror("UPD3301 '%s' R: %u\n", tag(), m_r);
+ LOG("UPD3301 S: %u\n", m_s);
+ LOG("UPD3301 C: %u\n", m_c);
+ LOG("UPD3301 R: %u\n", m_r);
break;
case 3:
m_v = (data >> 5) + 1;
m_z = (data & 0x1f) + 2;
- if (LOG) logerror("UPD3301 '%s' V: %u\n", tag(), m_v);
- if (LOG) logerror("UPD3301 '%s' Z: %u\n", tag(), m_z);
+ LOG("UPD3301 V: %u\n", m_v);
+ LOG("UPD3301 Z: %u\n", m_z);
recompute_parameters();
break;
@@ -294,10 +294,10 @@ WRITE8_MEMBER( upd3301_device::write )
m_at0 = BIT(data, 6);
m_sc = BIT(data, 5);
m_attr = (data & 0x1f) + 1;
- if (LOG) logerror("UPD3301 '%s' AT1: %u\n", tag(), m_at1);
- if (LOG) logerror("UPD3301 '%s' AT0: %u\n", tag(), m_at0);
- if (LOG) logerror("UPD3301 '%s' SC: %u\n", tag(), m_sc);
- if (LOG) logerror("UPD3301 '%s' ATTR: %u\n", tag(), m_attr);
+ LOG("UPD3301 AT1: %u\n", m_at1);
+ LOG("UPD3301 AT0: %u\n", m_at0);
+ LOG("UPD3301 SC: %u\n", m_sc);
+ LOG("UPD3301 ATTR: %u\n", m_attr);
m_mode = MODE_NONE;
break;
@@ -311,12 +311,12 @@ WRITE8_MEMBER( upd3301_device::write )
{
case 0:
m_cx = data & 0x7f;
- if (LOG) logerror("UPD3301 '%s' CX: %u\n", tag(), m_cx);
+ LOG("UPD3301 CX: %u\n", m_cx);
break;
case 1:
m_cy = data & 0x3f;
- if (LOG) logerror("UPD3301 '%s' CY: %u\n", tag(), m_cy);
+ LOG("UPD3301 CY: %u\n", m_cy);
m_mode = MODE_NONE;
break;
@@ -326,7 +326,7 @@ WRITE8_MEMBER( upd3301_device::write )
break;
default:
- if (LOG) logerror("UPD3301 '%s' Invalid Parameter Byte %02x!\n", tag(), data);
+ LOG("UPD3301 Invalid Parameter Byte %02x!\n", data);
}
break;
@@ -337,45 +337,45 @@ WRITE8_MEMBER( upd3301_device::write )
switch (data & 0xe0)
{
case COMMAND_RESET:
- if (LOG) logerror("UPD3301 '%s' Reset\n", tag());
+ LOG("UPD3301 Reset\n");
m_mode = MODE_RESET;
set_display(0);
set_interrupt(0);
break;
case COMMAND_START_DISPLAY:
- if (LOG) logerror("UPD3301 '%s' Start Display\n", tag());
+ LOG("UPD3301 Start Display\n");
set_display(1);
reset_counters();
break;
case COMMAND_SET_INTERRUPT_MASK:
- if (LOG) logerror("UPD3301 '%s' Set Interrupt Mask\n", tag());
+ LOG("UPD3301 Set Interrupt Mask\n");
m_me = BIT(data, 0);
m_mn = BIT(data, 1);
- if (LOG) logerror("UPD3301 '%s' ME: %u\n", tag(), m_me);
- if (LOG) logerror("UPD3301 '%s' MN: %u\n", tag(), m_mn);
+ LOG("UPD3301 ME: %u\n", m_me);
+ LOG("UPD3301 MN: %u\n", m_mn);
break;
case COMMAND_READ_LIGHT_PEN:
- if (LOG) logerror("UPD3301 '%s' Read Light Pen\n", tag());
+ LOG("UPD3301 Read Light Pen\n");
m_mode = MODE_READ_LIGHT_PEN;
break;
case COMMAND_LOAD_CURSOR_POSITION:
- if (LOG) logerror("UPD3301 '%s' Load Cursor Position\n", tag());
+ LOG("UPD3301 Load Cursor Position\n");
m_mode = MODE_LOAD_CURSOR_POSITION;
m_cm = BIT(data, 0);
- if (LOG) logerror("UPD3301 '%s' CM: %u\n", tag(), m_cm);
+ LOG("UPD3301 CM: %u\n", m_cm);
break;
case COMMAND_RESET_INTERRUPT:
- if (LOG) logerror("UPD3301 '%s' Reset Interrupt\n", tag());
+ LOG("UPD3301 Reset Interrupt\n");
set_interrupt(0);
break;
case COMMAND_RESET_COUNTERS:
- if (LOG) logerror("UPD3301 '%s' Reset Counters\n", tag());
+ LOG("UPD3301 Reset Counters\n");
m_mode = MODE_RESET_COUNTERS;
reset_counters();
break;
@@ -528,7 +528,7 @@ uint32_t upd3301_device::screen_update(screen_device &screen, bitmap_rgb32 &bitm
void upd3301_device::set_interrupt(int state)
{
- if (LOG) logerror("UPD3301 '%s' Interrupt: %u\n", tag(), state);
+ LOG("UPD3301 Interrupt: %u\n", state);
m_write_int(state);
@@ -545,7 +545,7 @@ void upd3301_device::set_interrupt(int state)
void upd3301_device::set_drq(int state)
{
- if (LOG) logerror("UPD3301 '%s' DRQ: %u\n", tag(), state);
+ LOG("UPD3301 DRQ: %u\n", state);
m_write_drq(state);
}
@@ -625,11 +625,8 @@ void upd3301_device::recompute_parameters()
visarea.set(0, (m_h * m_width) - 1, 0, (m_l * m_r) - 1);
- if (LOG)
- {
- if (LOG) logerror("UPD3301 '%s' Screen: %u x %u @ %f Hz\n", tag(), horiz_pix_total, vert_pix_total, 1 / ATTOSECONDS_TO_DOUBLE(refresh));
- if (LOG) logerror("UPD3301 '%s' Visible Area: (%u, %u) - (%u, %u)\n", tag(), visarea.min_x, visarea.min_y, visarea.max_x, visarea.max_y);
- }
+ LOG("UPD3301 Screen: %u x %u @ %f Hz\n", horiz_pix_total, vert_pix_total, 1 / ATTOSECONDS_TO_DOUBLE(refresh));
+ LOG("UPD3301 Visible Area: (%u, %u) - (%u, %u)\n", visarea.min_x, visarea.min_y, visarea.max_x, visarea.max_y);
m_screen->configure(horiz_pix_total, vert_pix_total, visarea, refresh);
diff --git a/src/devices/video/upd3301.h b/src/devices/video/upd3301.h
index 5d1c03c7ed1..a8e9b8e8b97 100644
--- a/src/devices/video/upd3301.h
+++ b/src/devices/video/upd3301.h
@@ -29,11 +29,10 @@
**********************************************************************/
-#pragma once
-
-#ifndef __UPD3301__
-#define __UPD3301__
+#ifndef MAME_VIDEO_UPD3301_H
+#define MAME_VIDEO_UPD3301_H
+#pragma once
@@ -48,7 +47,7 @@
upd3301_device::static_set_character_width(*device, _value);
#define MCFG_UPD3301_DRAW_CHARACTER_CALLBACK_OWNER(_class, _method) \
- upd3301_device::static_set_display_callback(*device, upd3301_draw_character_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
+ upd3301_device::static_set_display_callback(*device, upd3301_device::draw_character_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
#define MCFG_UPD3301_DRQ_CALLBACK(_write) \
devcb = &upd3301_device::set_drq_wr_callback(*device, DEVCB_##_write);
@@ -68,8 +67,6 @@
// TYPE DEFINITIONS
//**************************************************************************
-typedef device_delegate<void (bitmap_rgb32 &bitmap, int y, int sx, uint8_t cc, uint8_t lc, int hlgt, int rvv, int vsp, int sl0, int sl12, int csr, int gpa)> upd3301_draw_character_delegate;
-
// ======================> upd3301_device
@@ -77,16 +74,18 @@ class upd3301_device : public device_t,
public device_video_interface
{
public:
+ typedef device_delegate<void (bitmap_rgb32 &bitmap, int y, int sx, uint8_t cc, uint8_t lc, int hlgt, int rvv, int vsp, int sl0, int sl12, int csr, int gpa)> draw_character_delegate;
+
// construction/destruction
upd3301_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
static void static_set_character_width(device_t &device, int value) { downcast<upd3301_device &>(device).m_width = value; }
- static void static_set_display_callback(device_t &device, upd3301_draw_character_delegate callback) { downcast<upd3301_device &>(device).m_display_cb = callback; }
+ static void static_set_display_callback(device_t &device, draw_character_delegate &&cb) { downcast<upd3301_device &>(device).m_display_cb = std::move(cb); }
- template<class _Object> static devcb_base &set_drq_wr_callback(device_t &device, _Object object) { return downcast<upd3301_device &>(device).m_write_drq.set_callback(object); }
- template<class _Object> static devcb_base &set_int_wr_callback(device_t &device, _Object object) { return downcast<upd3301_device &>(device).m_write_int.set_callback(object); }
- template<class _Object> static devcb_base &set_hrtc_wr_callback(device_t &device, _Object object) { return downcast<upd3301_device &>(device).m_write_hrtc.set_callback(object); }
- template<class _Object> static devcb_base &set_vrtc_wr_callback(device_t &device, _Object object) { return downcast<upd3301_device &>(device).m_write_vrtc.set_callback(object); }
+ template <class Object> static devcb_base &set_drq_wr_callback(device_t &device, Object &&cb) { return downcast<upd3301_device &>(device).m_write_drq.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_int_wr_callback(device_t &device, Object &&cb) { return downcast<upd3301_device &>(device).m_write_int.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_hrtc_wr_callback(device_t &device, Object &&cb) { return downcast<upd3301_device &>(device).m_write_hrtc.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_vrtc_wr_callback(device_t &device, Object &&cb) { return downcast<upd3301_device &>(device).m_write_vrtc.set_callback(std::forward<Object>(cb)); }
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
@@ -127,7 +126,7 @@ private:
devcb_write_line m_write_hrtc;
devcb_write_line m_write_vrtc;
- upd3301_draw_character_delegate m_display_cb;
+ draw_character_delegate m_display_cb;
int m_width;
// screen drawing
@@ -186,8 +185,6 @@ private:
// device type definition
-extern const device_type UPD3301;
-
-
+DECLARE_DEVICE_TYPE(UPD3301, upd3301_device)
-#endif
+#endif // MAME_VIDEO_UPD3301_H
diff --git a/src/devices/video/upd7220.cpp b/src/devices/video/upd7220.cpp
index 46e97fab0ba..c4b5650cf76 100644
--- a/src/devices/video/upd7220.cpp
+++ b/src/devices/video/upd7220.cpp
@@ -39,16 +39,16 @@
#include "screen.h"
+//#define VERBOSE 1
+#include "logmacro.h"
+
+
//**************************************************************************
// MACROS / CONSTANTS
//**************************************************************************
-#define VERBOSE 0
-#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
-
-
// todo typedef
enum
{
@@ -136,8 +136,8 @@ enum
#define UPD7220_MODE_INTERLACE_ON 0x09
-static const int x_dir[8] = { 0, 1, 1, 1, 0,-1,-1,-1};
-static const int y_dir[8] = { 1, 1, 0,-1,-1,-1, 0, 1};
+static constexpr int x_dir[8] = { 0, 1, 1, 1, 0,-1,-1,-1};
+static constexpr int y_dir[8] = { 1, 1, 0,-1,-1,-1, 0, 1};
//**************************************************************************
@@ -145,7 +145,7 @@ static const int y_dir[8] = { 1, 1, 0,-1,-1,-1, 0, 1};
//**************************************************************************
// devices
-const device_type UPD7220 = device_creator<upd7220_device>;
+DEFINE_DEVICE_TYPE(UPD7220, upd7220_device, "upd7220", "NEC uPD7220")
// default address map
@@ -412,10 +412,10 @@ inline void upd7220_device::recompute_parameters()
visarea.max_x = m_aw * horiz_mult - 1;//horiz_pix_total - (m_hfp * 8) - 1;
visarea.max_y = m_al * vert_mult + m_vbp - 1;//vert_pix_total - m_vfp - 1;
- LOG(("uPD7220 '%s' Screen: %u x %u @ %f Hz\n", tag(), horiz_pix_total, vert_pix_total, 1 / ATTOSECONDS_TO_DOUBLE(refresh)));
- LOG(("Visible Area: (%u, %u) - (%u, %u)\n", visarea.min_x, visarea.min_y, visarea.max_x, visarea.max_y));
- LOG(("%d %d %d %d %d\n",m_hs,m_hbp,m_aw,m_hfp,m_pitch));
- LOG(("%d %d %d %d\n",m_vs,m_vbp,m_al,m_vfp));
+ LOG("uPD7220 Screen: %u x %u @ %f Hz\n", horiz_pix_total, vert_pix_total, 1 / ATTOSECONDS_TO_DOUBLE(refresh));
+ LOG("Visible Area: (%u, %u) - (%u, %u)\n", visarea.min_x, visarea.min_y, visarea.max_x, visarea.max_y);
+ LOG("%d %d %d %d %d\n",m_hs,m_hbp,m_aw,m_hfp,m_pitch);
+ LOG("%d %d %d %d\n",m_vs,m_vbp,m_al,m_vfp);
if (m_m)
{
@@ -457,12 +457,12 @@ inline void upd7220_device::read_vram(uint8_t type, uint8_t mod)
{
if (type == 1)
{
- LOG (("uPD7220 invalid type 1 RDAT parameter\n"));
+ LOG("uPD7220 invalid type 1 RDAT parameter\n");
return;
}
if (mod)
- LOG (("uPD7220 RDAT used with mod = %02x?\n",mod));
+ LOG("uPD7220 RDAT used with mod = %02x?\n",mod);
while (m_figs.m_dc && m_fifo_ptr < (type ? 15 : 14))
{
@@ -609,7 +609,7 @@ inline void upd7220_device::get_graphics_partition(int index, uint32_t *sad, uin
//-------------------------------------------------
upd7220_device::upd7220_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, UPD7220, "uPD7220", tag, owner, clock, "upd7220", __FILE__),
+ device_t(mconfig, UPD7220, tag, owner, clock),
device_memory_interface(mconfig, *this),
device_video_interface(mconfig, *this),
m_write_drq(*this),
@@ -823,7 +823,7 @@ void upd7220_device::draw_line(int x, int y)
uint16_t pattern = (m_ra[8]) | (m_ra[9]<<8);
const int dot_dir[4] = {1, -1, -1, 1};
- LOG(("uPD7220 line check: %d %d %02x %08x %d %d %d\n",x,y,m_figs.m_dir,m_ead,d1,m_figs.m_dc,m_bitmap_mod));
+ LOG("uPD7220 line check: %d %d %02x %08x %d %d %d\n",x,y,m_figs.m_dir,m_ead,d1,m_figs.m_dc,m_bitmap_mod);
for(yi = xi = 0; yi <= m_figs.m_dc; yi++)
{
@@ -873,7 +873,7 @@ void upd7220_device::draw_arc(int x, int y)
uint16_t pattern = (m_ra[8]) | (m_ra[9]<<8);
const int dot_dir[4] = {1, -1, -1, 1};
- LOG(("uPD7220 arc check: %d %d %02x %08x %d %d %d\n",x,y,m_figs.m_dir,m_ead,m_figs.m_dm,m_figs.m_dc,m_figs.m_d));
+ LOG("uPD7220 arc check: %d %d %02x %08x %d %d %d\n",x,y,m_figs.m_dir,m_ead,m_figs.m_dm,m_figs.m_dc,m_figs.m_d);
for(int yi = 0; yi <= m_figs.m_dc; yi++)
{
@@ -926,7 +926,7 @@ void upd7220_device::draw_rectangle(int x, int y)
uint8_t rect_type,rect_dir;
uint16_t pattern = (m_ra[8]) | (m_ra[9]<<8);
- LOG(("uPD7220 rectangle check: %d %d %02x %08x\n",x,y,m_figs.m_dir,m_ead));
+ LOG("uPD7220 rectangle check: %d %d %02x %08x\n",x,y,m_figs.m_dir,m_ead);
rect_type = (m_figs.m_dir & 1) << 2;
rect_dir = rect_type | (((m_figs.m_dir >> 1) + 0) & 3);
@@ -980,7 +980,7 @@ void upd7220_device::draw_char(int x, int y)
int isize,psize;
uint16_t tile_data;
- LOG(("uPD7220 char check: %d %d %02x %08x %d %d %02x\n",x,y,m_figs.m_dir,m_ead,m_figs.m_d,m_figs.m_dc,m_figs.m_figure_type));
+ LOG("uPD7220 char check: %d %d %02x %08x %d %d %02x\n",x,y,m_figs.m_dir,m_ead,m_figs.m_d,m_figs.m_dc,m_figs.m_figure_type);
/* QX10 may require upper bits for psize, VT240 requires the opposite */
isize = m_figs.m_d;
@@ -1106,19 +1106,19 @@ void upd7220_device::process_fifo()
switch (translate_command(m_cr))
{
case COMMAND_INVALID:
- logerror("uPD7220 '%s' Invalid Command Byte %02x\n", tag(), m_cr);
+ logerror("uPD7220 Invalid Command Byte %02x\n", m_cr);
break;
case COMMAND_5A:
if (m_param_ptr == 4)
- logerror("uPD7220 '%s' Undocumented Command 0x5A Executed %02x %02x %02x\n", tag(),m_pr[1],m_pr[2],m_pr[3] );
+ logerror("uPD7220 Undocumented Command 0x5A Executed %02x %02x %02x\n", m_pr[1],m_pr[2],m_pr[3] );
break;
case COMMAND_RESET: /* reset */
switch (m_param_ptr)
{
case 0:
- LOG(("uPD7220 '%s' RESET\n", tag()));
+ LOG("uPD7220 RESET\n");
m_de = 0;
m_ra[0] = m_ra[1] = m_ra[2] = 0;
@@ -1141,16 +1141,16 @@ void upd7220_device::process_fifo()
m_pitch = m_aw;
- LOG(("uPD7220 '%s' Mode: %02x\n", tag(), m_mode));
- LOG(("uPD7220 '%s' AW: %u\n", tag(), m_aw));
- LOG(("uPD7220 '%s' HS: %u\n", tag(), m_hs));
- LOG(("uPD7220 '%s' VS: %u\n", tag(), m_vs));
- LOG(("uPD7220 '%s' HFP: %u\n", tag(), m_hfp));
- LOG(("uPD7220 '%s' HBP: %u\n", tag(), m_hbp));
- LOG(("uPD7220 '%s' VFP: %u\n", tag(), m_vfp));
- LOG(("uPD7220 '%s' AL: %u\n", tag(), m_al));
- LOG(("uPD7220 '%s' VBP: %u\n", tag(), m_vbp));
- LOG(("uPD7220 '%s' PITCH: %u\n", tag(), m_pitch));
+ LOG("uPD7220 Mode: %02x\n", m_mode);
+ LOG("uPD7220 AW: %u\n", m_aw);
+ LOG("uPD7220 HS: %u\n", m_hs);
+ LOG("uPD7220 VS: %u\n", m_vs);
+ LOG("uPD7220 HFP: %u\n", m_hfp);
+ LOG("uPD7220 HBP: %u\n", m_hbp);
+ LOG("uPD7220 VFP: %u\n", m_vfp);
+ LOG("uPD7220 AL: %u\n", m_al);
+ LOG("uPD7220 VBP: %u\n", m_vbp);
+ LOG("uPD7220 PITCH: %u\n", m_pitch);
recompute_parameters();
break;
@@ -1172,16 +1172,16 @@ void upd7220_device::process_fifo()
m_pitch = m_aw;
- LOG(("uPD7220 '%s' Mode: %02x\n", tag(), m_mode));
- LOG(("uPD7220 '%s' AW: %u\n", tag(), m_aw));
- LOG(("uPD7220 '%s' HS: %u\n", tag(), m_hs));
- LOG(("uPD7220 '%s' VS: %u\n", tag(), m_vs));
- LOG(("uPD7220 '%s' HFP: %u\n", tag(), m_hfp));
- LOG(("uPD7220 '%s' HBP: %u\n", tag(), m_hbp));
- LOG(("uPD7220 '%s' VFP: %u\n", tag(), m_vfp));
- LOG(("uPD7220 '%s' AL: %u\n", tag(), m_al));
- LOG(("uPD7220 '%s' VBP: %u\n", tag(), m_vbp));
- LOG(("uPD7220 '%s' PITCH: %u\n", tag(), m_pitch));
+ LOG("uPD7220 Mode: %02x\n", m_mode);
+ LOG("uPD7220 AW: %u\n", m_aw);
+ LOG("uPD7220 HS: %u\n", m_hs);
+ LOG("uPD7220 VS: %u\n", m_vs);
+ LOG("uPD7220 HFP: %u\n", m_hfp);
+ LOG("uPD7220 HBP: %u\n", m_hbp);
+ LOG("uPD7220 VFP: %u\n", m_vfp);
+ LOG("uPD7220 AL: %u\n", m_al);
+ LOG("uPD7220 VBP: %u\n", m_vbp);
+ LOG("uPD7220 PITCH: %u\n", m_pitch);
recompute_parameters();
}
@@ -1190,7 +1190,7 @@ void upd7220_device::process_fifo()
case COMMAND_VSYNC: /* vertical sync mode */
m_m = m_cr & 0x01;
- LOG(("uPD7220 '%s' M: %u\n", tag(), m_m));
+ LOG("uPD7220 M: %u\n", m_m);
recompute_parameters();
break;
@@ -1201,8 +1201,8 @@ void upd7220_device::process_fifo()
m_lr = (m_pr[1] & 0x1f) + 1;
m_dc = BIT(m_pr[1], 7);
- LOG(("uPD7220 '%s' LR: %u\n", tag(), m_lr));
- LOG(("uPD7220 '%s' DC: %u\n", tag(), m_dc));
+ LOG("uPD7220 LR: %u\n", m_lr);
+ LOG("uPD7220 DC: %u\n", m_dc);
}
if(m_param_ptr == 3)
@@ -1211,8 +1211,8 @@ void upd7220_device::process_fifo()
m_sc = BIT(m_pr[2], 5);
m_br = (m_pr[2] >> 6); /* guess, assume that blink rate clears upper bits (if any) */
- LOG(("uPD7220 '%s' CTOP: %u\n", tag(), m_ctop));
- LOG(("uPD7220 '%s' SC: %u\n", tag(), m_sc));
+ LOG("uPD7220 CTOP: %u\n", m_ctop);
+ LOG("uPD7220 SC: %u\n", m_sc);
}
if(m_param_ptr == 4)
@@ -1220,15 +1220,15 @@ void upd7220_device::process_fifo()
m_br = ((m_pr[3] & 0x07) << 2) | (m_pr[2] >> 6);
m_cbot = m_pr[3] >> 3;
- LOG(("uPD7220 '%s' BR: %u\n", tag(), m_br));
- LOG(("uPD7220 '%s' CBOT: %u\n", tag(), m_cbot));
+ LOG("uPD7220 BR: %u\n", m_br);
+ LOG("uPD7220 CBOT: %u\n", m_cbot);
}
break;
case COMMAND_START: /* start display & end idle mode */
m_de = 1;
- //LOG(("uPD7220 '%s' DE: 1\n", tag()));
+ //LOG("uPD7220 '%s' DE: 1\n");
break;
case COMMAND_05:
@@ -1238,7 +1238,7 @@ void upd7220_device::process_fifo()
case COMMAND_BCTRL: /* display blanking control */
m_de = m_cr & 0x01;
- //LOG(("uPD7220 '%s' DE: %u\n", tag(), m_de));
+ //LOG("uPD7220 DE: %u\n", m_de);
break;
case COMMAND_ZOOM: /* zoom factors specify */
@@ -1247,8 +1247,8 @@ void upd7220_device::process_fifo()
m_gchr = m_pr[1] & 0x0f;
m_disp = m_pr[1] >> 4;
- LOG(("uPD7220 '%s' GCHR: %01x\n", tag(), m_gchr));
- LOG(("uPD7220 '%s' DISP: %01x\n", tag(), m_disp));
+ LOG("uPD7220 GCHR: %01x\n", m_gchr);
+ LOG("uPD7220 DISP: %01x\n", m_disp);
}
break;
@@ -1259,12 +1259,12 @@ void upd7220_device::process_fifo()
m_ead = (upper_addr << 16) | (m_pr[2] << 8) | m_pr[1];
- LOG(("uPD7220 '%s' EAD: %06x\n", tag(), m_ead));
+ LOG("uPD7220 EAD: %06x\n", m_ead);
if(m_param_ptr == 4)
{
m_dad = m_pr[3] >> 4;
- LOG(("uPD7220 '%s' DAD: %01x\n", tag(), m_dad));
+ LOG("uPD7220 DAD: %01x\n", m_dad);
}
}
break;
@@ -1278,7 +1278,7 @@ void upd7220_device::process_fifo()
{
if (m_ra_addr < 16)
{
- LOG(("uPD7220 '%s' RA%u: %02x\n", tag(), m_ra_addr, data));
+ LOG("uPD7220 RA%u: %02x\n", m_ra_addr, data);
m_ra[m_ra_addr] = data;
m_ra_addr++;
@@ -1293,7 +1293,7 @@ void upd7220_device::process_fifo()
{
m_pitch = data;
- LOG(("uPD7220 '%s' PITCH: %u\n", tag(), m_pitch));
+ LOG("uPD7220 PITCH: %u\n", m_pitch);
}
break;
@@ -1302,7 +1302,7 @@ void upd7220_device::process_fifo()
if (m_param_ptr == 3 || (m_param_ptr == 2 && m_cr & 0x10))
{
- LOG(("%02x = %02x %02x (%c) %06x %04x\n",m_cr,m_pr[2],m_pr[1],m_pr[1]?m_pr[1]:' ',m_ead,m_figs.m_dc));
+ LOG("%02x = %02x %02x (%c) %06x %04x\n",m_cr,m_pr[2],m_pr[1],m_pr[1]?m_pr[1]:' ',m_ead,m_figs.m_dc);
fifo_set_direction(FIFO_WRITE);
write_vram((m_cr & 0x18) >> 3,m_cr & 3);
@@ -1316,7 +1316,7 @@ void upd7220_device::process_fifo()
{
m_mask = (m_pr[2] << 8) | m_pr[1];
- LOG(("uPD7220 '%s' MASK: %04x\n", tag(), m_mask));
+ LOG("uPD7220 MASK: %04x\n", m_mask);
}
break;
@@ -1365,7 +1365,7 @@ void upd7220_device::process_fifo()
else if(m_figs.m_figure_type == 8)
draw_rectangle(((m_ead % eff_pitch) << 4) | (m_dad & 0xf),(m_ead / eff_pitch));
else
- logerror("uPD7220 '%s' Unimplemented command FIGD %02x\n", tag(),m_figs.m_figure_type);
+ logerror("uPD7220 Unimplemented command FIGD %02x\n", m_figs.m_figure_type);
reset_figs_param();
m_sr |= UPD7220_SR_DRAWING_IN_PROGRESS;
@@ -1375,7 +1375,7 @@ void upd7220_device::process_fifo()
if((m_figs.m_figure_type & 0xf) == 2)
draw_char(((m_ead % eff_pitch) << 4) | (m_dad & 0xf),(m_ead / eff_pitch));
else
- logerror("uPD7220 '%s' Unimplemented command GCHRD %02x\n", tag(),m_figs.m_figure_type);
+ logerror("uPD7220 Unimplemented command GCHRD %02x\n", m_figs.m_figure_type);
reset_figs_param();
m_sr |= UPD7220_SR_DRAWING_IN_PROGRESS;
@@ -1416,11 +1416,11 @@ void upd7220_device::process_fifo()
break;
case COMMAND_DMAR: /* DMA read request */
- logerror("uPD7220 '%s' Unimplemented command DMAR\n", tag());
+ logerror("uPD7220 Unimplemented command DMAR\n");
break;
case COMMAND_DMAW: /* DMA write request */
- logerror("uPD7220 '%s' Unimplemented command DMAW\n", tag());
+ logerror("uPD7220 Unimplemented command DMAW\n");
break;
}
}
@@ -1520,7 +1520,7 @@ WRITE8_MEMBER( upd7220_device::dack_w )
WRITE_LINE_MEMBER( upd7220_device::ext_sync_w )
{
- //LOG(("uPD7220 '%s' External Synchronization: %u\n", tag(), state));
+ //LOG("uPD7220 External Synchronization: %u\n", state);
if (state)
{
@@ -1684,7 +1684,7 @@ uint32_t upd7220_device::screen_update(screen_device &screen, bitmap_rgb32 &bitm
break;
case UPD7220_MODE_DISPLAY_INVALID:
- LOG(("uPD7220 '%s' Invalid Display Mode!\n", tag()));
+ LOG("uPD7220 Invalid Display Mode!\n");
}
}
return 0;
diff --git a/src/devices/video/upd7220.h b/src/devices/video/upd7220.h
index e55a1892241..df99a7556aa 100644
--- a/src/devices/video/upd7220.h
+++ b/src/devices/video/upd7220.h
@@ -29,11 +29,10 @@
**********************************************************************/
-#pragma once
-
-#ifndef __UPD7220__
-#define __UPD7220__
+#ifndef MAME_VIDEO_UPD7220_H
+#define MAME_VIDEO_UPD7220_H
+#pragma once
@@ -46,10 +45,10 @@
#define MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(_class, _method) \
- upd7220_device::static_set_display_pixels_callback(*device, upd7220_display_pixels_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
+ upd7220_device::static_set_display_pixels_callback(*device, upd7220_device::display_pixels_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
#define MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(_class, _method) \
- upd7220_device::static_set_draw_text_callback(*device, upd7220_draw_text_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
+ upd7220_device::static_set_draw_text_callback(*device, upd7220_device::draw_text_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
#define MCFG_UPD7220_DRQ_CALLBACK(_write) \
devcb = &upd7220_device::set_drq_wr_callback(*device, DEVCB_##_write);
@@ -69,9 +68,6 @@
// TYPE DEFINITIONS
//**************************************************************************
-typedef device_delegate<void (bitmap_rgb32 &bitmap, int y, int x, uint32_t address)> upd7220_display_pixels_delegate;
-typedef device_delegate<void (bitmap_rgb32 &bitmap, uint32_t addr, int y, int wd, int pitch, int lr, int cursor_on, int cursor_addr)> upd7220_draw_text_delegate;
-
// ======================> upd7220_device
@@ -80,16 +76,19 @@ class upd7220_device : public device_t,
public device_video_interface
{
public:
+ typedef device_delegate<void (bitmap_rgb32 &bitmap, int y, int x, uint32_t address)> display_pixels_delegate;
+ typedef device_delegate<void (bitmap_rgb32 &bitmap, uint32_t addr, int y, int wd, int pitch, int lr, int cursor_on, int cursor_addr)> draw_text_delegate;
+
// construction/destruction
upd7220_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- static void static_set_display_pixels_callback(device_t &device, upd7220_display_pixels_delegate callback) { downcast<upd7220_device &>(device).m_display_cb = callback; }
- static void static_set_draw_text_callback(device_t &device, upd7220_draw_text_delegate callback) { downcast<upd7220_device &>(device).m_draw_text_cb = callback; }
+ static void static_set_display_pixels_callback(device_t &device, display_pixels_delegate &&cb) { downcast<upd7220_device &>(device).m_display_cb = std::move(cb); }
+ static void static_set_draw_text_callback(device_t &device, draw_text_delegate &&cb) { downcast<upd7220_device &>(device).m_draw_text_cb = std::move(cb); }
- template<class _Object> static devcb_base &set_drq_wr_callback(device_t &device, _Object object) { return downcast<upd7220_device &>(device).m_write_drq.set_callback(object); }
- template<class _Object> static devcb_base &set_hsync_wr_callback(device_t &device, _Object object) { return downcast<upd7220_device &>(device).m_write_hsync.set_callback(object); }
- template<class _Object> static devcb_base &set_vsync_wr_callback(device_t &device, _Object object) { return downcast<upd7220_device &>(device).m_write_vsync.set_callback(object); }
- template<class _Object> static devcb_base &set_blank_wr_callback(device_t &device, _Object object) { return downcast<upd7220_device &>(device).m_write_blank.set_callback(object); }
+ template <class Object> static devcb_base &set_drq_wr_callback(device_t &device, Object &&cb) { return downcast<upd7220_device &>(device).m_write_drq.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_hsync_wr_callback(device_t &device, Object &&cb) { return downcast<upd7220_device &>(device).m_write_hsync.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_vsync_wr_callback(device_t &device, Object &&cb) { return downcast<upd7220_device &>(device).m_write_vsync.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_blank_wr_callback(device_t &device, Object &&cb) { return downcast<upd7220_device &>(device).m_write_blank.set_callback(std::forward<Object>(cb)); }
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
@@ -102,7 +101,7 @@ public:
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
virtual const tiny_rom_entry *device_rom_region() const override;
- virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override;
+ virtual const address_space_config *memory_space_config(address_spacenum spacenum) const override;
protected:
// device-level overrides
@@ -149,8 +148,8 @@ private:
void draw_graphics_line(bitmap_rgb32 &bitmap, uint32_t addr, int y, int wd, int pitch);
void update_graphics(bitmap_rgb32 &bitmap, const rectangle &cliprect, int force_bitmap);
- upd7220_display_pixels_delegate m_display_cb;
- upd7220_draw_text_delegate m_draw_text_cb;
+ display_pixels_delegate m_display_cb;
+ draw_text_delegate m_draw_text_cb;
devcb_write_line m_write_drq;
devcb_write_line m_write_hsync;
@@ -222,8 +221,6 @@ private:
// device type definition
-extern const device_type UPD7220;
-
-
+DECLARE_DEVICE_TYPE(UPD7220, upd7220_device)
-#endif
+#endif // MAME_VIDEO_UPD7220_H
diff --git a/src/devices/video/upd7227.cpp b/src/devices/video/upd7227.cpp
index 61a415f608a..864d1a23935 100644
--- a/src/devices/video/upd7227.cpp
+++ b/src/devices/video/upd7227.cpp
@@ -9,13 +9,8 @@
#include "emu.h"
#include "upd7227.h"
-
-
-//**************************************************************************
-// MACROS / CONSTANTS
-//**************************************************************************
-
-#define LOG 0
+//#define VERBOSE 1
+#include "logmacro.h"
@@ -23,7 +18,7 @@
// DEVICE DEFINITIONS
//**************************************************************************
-const device_type UPD7227 = device_creator<upd7227_device>;
+DEFINE_DEVICE_TYPE(UPD7227, upd7227_device, "upd7227", "NEC uPD7227")
static ADDRESS_MAP_START( upd7227_map, AS_PROGRAM, 8, upd7227_device )
@@ -42,14 +37,14 @@ ADDRESS_MAP_END
//-------------------------------------------------
upd7227_device::upd7227_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, UPD7227, "uPD7227", tag, owner, clock, "upd7227", __FILE__),
- device_memory_interface(mconfig, *this),
- m_space_config("videoram", ENDIANNESS_BIG, 8, 7, 0, *ADDRESS_MAP_NAME(upd7227_map)),
- m_cs(1),
- m_cd(1),
- m_sck(1),
- m_si(1),
- m_so(1)
+ : device_t(mconfig, UPD7227, tag, owner, clock)
+ , device_memory_interface(mconfig, *this)
+ , m_space_config("videoram", ENDIANNESS_BIG, 8, 7, 0, *ADDRESS_MAP_NAME(upd7227_map))
+ , m_cs(1)
+ , m_cd(1)
+ , m_sck(1)
+ , m_si(1)
+ , m_so(1)
{
}
diff --git a/src/devices/video/upd7227.h b/src/devices/video/upd7227.h
index c38b2fa10e2..725137bc376 100644
--- a/src/devices/video/upd7227.h
+++ b/src/devices/video/upd7227.h
@@ -6,11 +6,10 @@
**********************************************************************/
-#pragma once
-
-#ifndef __UPD7227__
-#define __UPD7227__
+#ifndef MAME_VIDEO_UPD7227_H
+#define MAME_VIDEO_UPD7227_H
+#pragma once
@@ -54,7 +53,7 @@ protected:
virtual void device_reset() override;
// device_memory_interface overrides
- virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override;
+ virtual const address_space_config *memory_space_config(address_spacenum spacenum) const override;
address_space_config m_space_config;
@@ -87,8 +86,6 @@ private:
// device type definition
-extern const device_type UPD7227;
-
-
+DECLARE_DEVICE_TYPE(UPD7227, upd7227_device)
-#endif
+#endif // MAME_VIDEO_UPD7227_H
diff --git a/src/devices/video/v9938.cpp b/src/devices/video/v9938.cpp
index 2401da27494..ac7fd4575dc 100644
--- a/src/devices/video/v9938.cpp
+++ b/src/devices/video/v9938.cpp
@@ -38,8 +38,8 @@ todo:
#include "emu.h"
#include "v9938.h"
-#define VERBOSE 0
-#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
+//#define VERBOSE 1
+#include "logmacro.h"
enum
{
@@ -84,17 +84,17 @@ ADDRESS_MAP_END
// devices
-const device_type V9938 = device_creator<v9938_device>;
-const device_type V9958 = device_creator<v9958_device>;
+DEFINE_DEVICE_TYPE(V9938, v9938_device, "v9938", "Yamaha V9938 VDP")
+DEFINE_DEVICE_TYPE(V9958, v9958_device, "v9958", "Yamaha V9958 VDP")
-v99x8_device::v99x8_device(const machine_config &mconfig, device_type type, const char *name, const char *shortname, const char *tag, device_t *owner, uint32_t clock)
-: device_t(mconfig, type, name, tag, owner, clock, shortname, __FILE__),
+v99x8_device::v99x8_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int model)
+: device_t(mconfig, type, tag, owner, clock),
device_memory_interface(mconfig, *this),
device_palette_interface(mconfig, *this),
device_video_interface(mconfig, *this),
m_space_config("vram", ENDIANNESS_BIG, 8, 18),
- m_model(0),
+ m_model(model),
m_offset_x(0),
m_offset_y(0),
m_visible_y(0),
@@ -123,15 +123,13 @@ v99x8_device::v99x8_device(const machine_config &mconfig, device_type type, cons
}
v9938_device::v9938_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
-: v99x8_device(mconfig, V9938, "V9938 VDP", "v9938", tag, owner, clock)
+: v99x8_device(mconfig, V9938, tag, owner, clock, MODEL_V9938)
{
- m_model = MODEL_V9938;
}
v9958_device::v9958_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
-: v99x8_device(mconfig, V9958, "V9958 VDP", "v9958", tag, owner, clock)
+: v99x8_device(mconfig, V9958, tag, owner, clock, MODEL_V9958)
{
- m_model = MODEL_V9958;
}
@@ -156,7 +154,7 @@ void v99x8_device::device_timer(emu_timer &timer, device_timer_id id, int param,
(((scanline + m_cont_reg[23]) & 255) == m_cont_reg[19]) )
{
m_stat_reg[1] |= 1;
- LOG(("V9938: scanline interrupt (%d)\n", scanline));
+ LOG("V9938: scanline interrupt (%d)\n", scanline);
}
else if (!(m_cont_reg[0] & 0x10))
{
@@ -336,7 +334,7 @@ void v9958_device::palette_init()
fatalerror("V9958: not enough palette, must be 19780");
// set up YJK table
- LOG(("Building YJK table for V9958 screens, may take a while ... \n"));
+ LOG("Building YJK table for V9958 screens, may take a while ... \n");
i = 0;
for (y=0;y<32;y++) for (k=0;k<64;k++) for (j=0;j<64;j++)
{
@@ -378,7 +376,7 @@ void v9958_device::palette_init()
}
if (i != 19268)
- LOG( ("Table creation failed - %d colours out of 19286 created\n", i));
+ LOG("Table creation failed - %d colours out of 19286 created\n", i);
}
uint32_t v99x8_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
@@ -508,7 +506,7 @@ uint8_t v99x8_device::status_r()
break;
}
- LOG(("V9938: Read %02x from S#%d\n", ret, reg));
+ LOG("V9938: Read %02x from S#%d\n", ret, reg);
check_int ();
return ret;
@@ -820,7 +818,7 @@ void v99x8_device::check_int()
if (n != m_int_state)
{
m_int_state = n;
- LOG(("V9938: IRQ line %s\n", n ? "up" : "down"));
+ LOG("V9938: IRQ line %s\n", n ? "up" : "down");
}
/*
@@ -856,7 +854,7 @@ void v99x8_device::register_write (int reg, int data)
if (reg > 46)
{
- LOG(("V9938: Attempted to write to non-existant R#%d\n", reg));
+ LOG("V9938: Attempted to write to non-existant R#%d\n", reg);
return;
}
@@ -869,7 +867,7 @@ void v99x8_device::register_write (int reg, int data)
m_cont_reg[reg] = data;
set_mode();
check_int();
- LOG(("v9938: mode = %s\n", v9938_modes[m_mode]));
+ LOG("v9938: mode = %s\n", v9938_modes[m_mode]);
break;
case 18:
@@ -888,14 +886,14 @@ void v99x8_device::register_write (int reg, int data)
case 20:
case 21:
case 22:
- LOG(("v9938: Write %02xh to R#%d; color burst not emulated\n", data, reg));
+ LOG("v9938: Write %02xh to R#%d; color burst not emulated\n", data, reg);
break;
case 25:
case 26:
case 27:
if (m_model != MODEL_V9958)
{
- LOG(("v9938: Attempting to write %02xh to V9958 R#%d\n", data, reg));
+ LOG("v9938: Attempting to write %02xh to V9958 R#%d\n", data, reg);
data = 0;
}
else
@@ -915,7 +913,7 @@ void v99x8_device::register_write (int reg, int data)
}
if (reg != 15)
- LOG(("v9938: Write %02x to R#%d\n", data, reg));
+ LOG("v9938: Write %02x to R#%d\n", data, reg);
m_cont_reg[reg] = data;
}
@@ -2272,7 +2270,7 @@ inline void v99x8_device::VDPpsetlowlevel(int addr, uint8_t CL, uint8_t M, uint8
case 11: if (CL) val ^= CL; break;
case 12: if (CL) val = (val & M) | ~(CL|M); break;
default:
- LOG(("v9938: invalid operation %d in pset\n", OP));
+ LOG("v9938: invalid operation %d in pset\n", OP);
}
m_vram_space->write_byte(addr, val);
@@ -2899,12 +2897,12 @@ void v99x8_device::report_vdp_command(uint8_t Op)
CM = Op>>4;
LO = Op&0x0F;
- LOG(("V9938: Opcode %02Xh %s-%s (%d,%d)->(%d,%d),%d [%d,%d]%s\n",
+ LOG("V9938: Opcode %02Xh %s-%s (%d,%d)->(%d,%d),%d [%d,%d]%s\n",
Op, Commands[CM], Ops[LO],
SX,SY, DX,DY, CL, m_cont_reg[45]&0x04? -NX:NX,
m_cont_reg[45]&0x08? -NY:NY,
m_cont_reg[45]&0x70? " on ExtVRAM":""
- ));
+ );
}
/** VDPDraw() ************************************************/
@@ -2981,7 +2979,7 @@ uint8_t v99x8_device::command_unit_w(uint8_t Op)
m_vdp_engine=&v99x8_device::hmmc_engine;
break;
default:
- LOG(("V9938: Unrecognized opcode %02Xh\n",Op));
+ LOG("V9938: Unrecognized opcode %02Xh\n",Op);
return(0);
}
diff --git a/src/devices/video/v9938.h b/src/devices/video/v9938.h
index b04bcf08a20..ff8e4d27b28 100644
--- a/src/devices/video/v9938.h
+++ b/src/devices/video/v9938.h
@@ -6,8 +6,8 @@
***************************************************************************/
-#ifndef MAME_DEVICES_VIDEO_V9938_H
-#define MAME_DEVICES_VIDEO_V9938_H
+#ifndef MAME_VIDEO_V9938_H
+#define MAME_VIDEO_V9938_H
#pragma once
@@ -60,8 +60,8 @@
//**************************************************************************
// device type definition
-extern const device_type V9938;
-extern const device_type V9958;
+DECLARE_DEVICE_TYPE(V9938, v9938_device)
+DECLARE_DEVICE_TYPE(V9958, v9958_device)
@@ -76,14 +76,8 @@ class v99x8_device : public device_t,
public device_palette_interface,
public device_video_interface
{
-protected:
- // construction/destruction
- v99x8_device(const machine_config &mconfig, device_type type, const char *name, const char *shortname, const char *tag, device_t *owner, uint32_t clock);
-
public:
- template<class _irq> devcb_base &set_interrupt_callback(_irq irq) {
- return m_int_callback.set_callback(irq);
- }
+ template <class Object> devcb_base &set_interrupt_callback(Object &&irq) { return m_int_callback.set_callback(std::forward<Object>(irq)); }
int get_transpen();
bitmap_ind16 &get_bitmap() { return m_bitmap; }
void update_mouse_state(int mx_delta, int my_delta, int button_state);
@@ -105,26 +99,29 @@ public:
/* RESET pin */
void reset_line(int state) { if (state==ASSERT_LINE) device_reset(); }
- static const int HTOTAL = 684;
- static const int HVISIBLE = 544;
- static const int VTOTAL_NTSC = 262;
- static const int VTOTAL_PAL = 313;
- static const int VVISIBLE_NTSC = 26 + 192 + 25;
- static const int VVISIBLE_PAL = 53 + 192 + 49;
+ static constexpr int HTOTAL = 684;
+ static constexpr int HVISIBLE = 544;
+ static constexpr int VTOTAL_NTSC = 262;
+ static constexpr int VTOTAL_PAL = 313;
+ static constexpr int VVISIBLE_NTSC = 26 + 192 + 25;
+ static constexpr int VVISIBLE_PAL = 53 + 192 + 49;
// Looking at some youtube videos of real units on real monitors
// there appear to be small vertical timing differences. Some (LCD)
// monitors show the full borders, other CRT monitors seem to
// display ~5 lines less at the top and bottom of the screen.
- static const int VERTICAL_ADJUST = 5;
- static const int TOP_ERASE = 13;
- static const int VERTICAL_SYNC = 3;
+ static constexpr int VERTICAL_ADJUST = 5;
+ static constexpr int TOP_ERASE = 13;
+ static constexpr int VERTICAL_SYNC = 3;
protected:
- static const device_timer_id TIMER_LINE = 0;
+ // construction/destruction
+ v99x8_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int model);
+
+ static constexpr device_timer_id TIMER_LINE = 0;
const address_space_config m_space_config;
address_space* m_vram_space;
- int m_model;
+ const int m_model;
// device overrides
virtual void device_start() override;
@@ -132,7 +129,7 @@ protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
// device_memory_interface overrides
- virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_DATA) const override { return (spacenum == AS_DATA) ? &m_space_config : nullptr; }
+ virtual const address_space_config *memory_space_config(address_spacenum spacenum) const override { return (spacenum == AS_DATA) ? &m_space_config : nullptr; }
virtual void palette_init() = 0;
diff --git a/src/devices/video/vector.cpp b/src/devices/video/vector.cpp
index 70fa93f44bb..57f5366aba1 100644
--- a/src/devices/video/vector.cpp
+++ b/src/devices/video/vector.cpp
@@ -65,10 +65,10 @@ void vector_options::init(emu_options& options)
}
// device type definition
-const device_type VECTOR = device_creator<vector_device>;
+DEFINE_DEVICE_TYPE(VECTOR, vector_device, "vector_device", "VECTOR")
vector_device::vector_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, VECTOR, "VECTOR", tag, owner, clock, "vector_device", __FILE__),
+ : device_t(mconfig, VECTOR, tag, owner, clock),
device_video_interface(mconfig, *this),
m_vector_list(nullptr),
m_min_intensity(255),
diff --git a/src/devices/video/vector.h b/src/devices/video/vector.h
index 130cbb6b2fb..dca693133f8 100644
--- a/src/devices/video/vector.h
+++ b/src/devices/video/vector.h
@@ -1,33 +1,13 @@
// license:BSD-3-Clause
// copyright-holders:Brad Oliver,Aaron Giles,Bernd Wiebelt,Allard van der Bas
-#ifndef __VECTOR__
-#define __VECTOR__
+#ifndef MAME_VIDEO_VECTOR_H
+#define MAME_VIDEO_VECTOR_H
-#define VECTOR_COLOR111(c) \
- rgb_t(pal1bit((c) >> 2), pal1bit((c) >> 1), pal1bit((c) >> 0))
+#pragma once
-#define VECTOR_COLOR222(c) \
- rgb_t(pal2bit((c) >> 4), pal2bit((c) >> 2), pal2bit((c) >> 0))
-
-#define VECTOR_COLOR444(c) \
- rgb_t(pal4bit((c) >> 8), pal4bit((c) >> 4), pal4bit((c) >> 0))
class vector_device;
-/* The vertices are buffered here */
-struct point
-{
- point() :
- x(0),
- y(0),
- col(0),
- intensity(0) {}
-
- int x; int y;
- rgb_t col;
- int intensity;
-};
-
class vector_options
{
public:
@@ -45,6 +25,10 @@ protected:
class vector_device : public device_t, public device_video_interface
{
public:
+ template <typename T> static constexpr rgb_t color111(T c) { return rgb_t(pal1bit(c >> 2), pal1bit(c >> 1), pal1bit(c >> 0)); }
+ template <typename T> static constexpr rgb_t color222(T c) { return rgb_t(pal2bit(c >> 4), pal2bit(c >> 2), pal2bit(c >> 0)); }
+ template <typename T> static constexpr rgb_t color444(T c) { return rgb_t(pal4bit(c >> 8), pal4bit(c >> 4), pal4bit(c >> 0)); }
+
// construction/destruction
vector_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
@@ -57,6 +41,16 @@ public:
virtual void device_start() override;
private:
+ /* The vertices are buffered here */
+ struct point
+ {
+ point() : x(0), y(0), col(0), intensity(0) { }
+
+ int x; int y;
+ rgb_t col;
+ int intensity;
+ };
+
std::unique_ptr<point[]> m_vector_list;
int m_vector_index;
int m_min_intensity;
@@ -66,9 +60,9 @@ private:
};
// device type definition
-extern const device_type VECTOR;
+DECLARE_DEVICE_TYPE(VECTOR, vector_device)
#define MCFG_VECTOR_ADD(_tag) \
MCFG_DEVICE_ADD(_tag, VECTOR, 0)
-#endif
+#endif // MAME_VIDEO_VECTOR_H
diff --git a/src/devices/video/vic4567.cpp b/src/devices/video/vic4567.cpp
index cbf7d7ac10a..dceeb94be12 100644
--- a/src/devices/video/vic4567.cpp
+++ b/src/devices/video/vic4567.cpp
@@ -59,8 +59,8 @@
#define VIC6567_Y_BEGIN -6 /* first 6 lines after retrace not for lightpen! */
#define VIC6569_X_BEGIN 38
#define VIC6569_Y_BEGIN -6
-#define VIC2_X_BEGIN ((m_type == VIC4567_PAL) ? VIC6569_X_BEGIN : VIC6567_X_BEGIN)
-#define VIC2_Y_BEGIN ((m_type == VIC4567_PAL) ? VIC6569_Y_BEGIN : VIC6567_Y_BEGIN)
+#define VIC2_X_BEGIN ((m_type == vic3_type::PAL) ? VIC6569_X_BEGIN : VIC6567_X_BEGIN)
+#define VIC2_Y_BEGIN ((m_type == vic3_type::PAL) ? VIC6569_Y_BEGIN : VIC6567_Y_BEGIN)
#define VIC2_X_VALUE ((LIGHTPEN_X_VALUE + VIC2_X_BEGIN + VIC2_MAME_XPOS) / 2)
#define VIC2_Y_VALUE ((LIGHTPEN_Y_VALUE + VIC2_Y_BEGIN + VIC2_MAME_YPOS))
@@ -127,12 +127,12 @@
#define FOREGROUNDCOLOR (m_reg[0x24] & 0x0f)
-#define VIC2_LINES (m_type == VIC4567_PAL ? VIC6569_LINES : VIC6567_LINES)
-#define VIC2_VISIBLELINES (m_type == VIC4567_PAL ? VIC6569_VISIBLELINES : VIC6567_VISIBLELINES)
-#define VIC2_VISIBLECOLUMNS (m_type == VIC4567_PAL ? VIC6569_VISIBLECOLUMNS : VIC6567_VISIBLECOLUMNS)
+#define VIC2_LINES (m_type == vic3_type::PAL ? VIC6569_LINES : VIC6567_LINES)
+#define VIC2_VISIBLELINES (m_type == vic3_type::PAL ? VIC6569_VISIBLELINES : VIC6567_VISIBLELINES)
+#define VIC2_VISIBLECOLUMNS (m_type == vic3_type::PAL ? VIC6569_VISIBLECOLUMNS : VIC6567_VISIBLECOLUMNS)
#define VIC2_STARTVISIBLELINES ((VIC2_LINES - VIC2_VISIBLELINES)/2)
-#define VIC2_FIRSTRASTERLINE (m_type == VIC4567_PAL ? VIC6569_FIRSTRASTERLINE : VIC6567_FIRSTRASTERLINE)
-#define VIC2_COLUMNS (m_type == VIC4567_PAL ? VIC6569_COLUMNS : VIC6567_COLUMNS)
+#define VIC2_FIRSTRASTERLINE (m_type == vic3_type::PAL ? VIC6569_FIRSTRASTERLINE : VIC6567_FIRSTRASTERLINE)
+#define VIC2_COLUMNS (m_type == vic3_type::PAL ? VIC6569_COLUMNS : VIC6567_COLUMNS)
#define VIC2_STARTVISIBLECOLUMNS ((VIC2_COLUMNS - VIC2_VISIBLECOLUMNS)/2)
#define VIC3_BITPLANES_MASK (m_reg[0x32])
@@ -145,22 +145,22 @@
#define VIC3_BITPLANE_IADDR(x) (x & 1 ? VIC3_BITPLANE_IADDR_HELPER(x) + 0x10000 : VIC3_BITPLANE_IADDR_HELPER(x))
-const device_type VIC3 = device_creator<vic3_device>;
+DEFINE_DEVICE_TYPE(VIC3, vic3_device, "vic3", "CSG 4567 VIC-III")
vic3_device::vic3_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, VIC3, "4567 VIC III", tag, owner, clock, "vic3", __FILE__),
- device_video_interface(mconfig, *this),
- m_type(VIC4567_NTSC),
- m_cpu(*this, finder_base::DUMMY_TAG),
- m_dma_read_cb(*this),
- m_dma_read_color_cb(*this),
- m_interrupt_cb(*this),
- m_port_changed_cb(*this),
- m_lightpen_button_cb(*this),
- m_lightpen_x_cb(*this),
- m_lightpen_y_cb(*this),
- m_c64_mem_r_cb(*this),
- m_palette(*this, "palette")
+ : device_t(mconfig, VIC3, tag, owner, clock)
+ , device_video_interface(mconfig, *this)
+ , m_type(vic3_type::NTSC)
+ , m_cpu(*this, finder_base::DUMMY_TAG)
+ , m_dma_read_cb(*this)
+ , m_dma_read_color_cb(*this)
+ , m_interrupt_cb(*this)
+ , m_port_changed_cb(*this)
+ , m_lightpen_button_cb(*this)
+ , m_lightpen_x_cb(*this)
+ , m_lightpen_y_cb(*this)
+ , m_c64_mem_r_cb(*this)
+ , m_palette(*this, "palette")
{
}
@@ -1971,7 +1971,7 @@ void vic3_device::raster_interrupt_gen()
{
m_rows = new_rows;
m_columns = new_columns;
- if (m_type == VIC4567_PAL)
+ if (m_type == vic3_type::PAL)
m_screen->set_visible_area(
VIC2_STARTVISIBLECOLUMNS + 32,
VIC2_STARTVISIBLECOLUMNS + 32 + m_columns + 16 - 1,
@@ -1990,7 +1990,7 @@ void vic3_device::raster_interrupt_gen()
}
else
{
- if (m_type == VIC4567_PAL)
+ if (m_type == vic3_type::PAL)
{
if (m_on)
vic2_drawlines(m_lastline, m_lines, VIC2_STARTVISIBLECOLUMNS + 32, VIC2_STARTVISIBLECOLUMNS + 32 + m_columns + 16 - 1);
@@ -2023,7 +2023,7 @@ void vic3_device::raster_interrupt_gen()
if (m_on)
if ((m_rasterline >= VIC2_FIRSTRASTERLINE) && (m_rasterline < (VIC2_FIRSTRASTERLINE + VIC2_VISIBLELINES)))
{
- if (m_type == VIC4567_PAL)
+ if (m_type == vic3_type::PAL)
{
if (m_on)
vic2_drawlines(m_rasterline - 1, m_rasterline, VIC2_STARTVISIBLECOLUMNS + 32, VIC2_STARTVISIBLECOLUMNS + 32 + m_columns + 16 - 1);
diff --git a/src/devices/video/vic4567.h b/src/devices/video/vic4567.h
index 53320386365..3b787908841 100644
--- a/src/devices/video/vic4567.h
+++ b/src/devices/video/vic4567.h
@@ -6,35 +6,16 @@
*
****************************************************************************/
-#ifndef __VIC4567_H__
-#define __VIC4567_H__
+#ifndef MAME_VIDEO_VIC4567_H
+#define MAME_VIDEO_VIC4567_H
+
+#pragma once
/***************************************************************************
TYPE DEFINITIONS
***************************************************************************/
-enum vic3_type
-{
- VIC4567_NTSC,
- VIC4567_PAL
-};
-
-#define SPRITE_BASE_X_SIZE 24
-#define SPRITE_BASE_Y_SIZE 21
-
-struct vic3_sprite
-{
- int x, y;
-
- int repeat; /* expand, line once drawn */
- int line; /* 0 not painting, else painting */
-
- /* buffer for currently painted line */
- int paintedline[8];
- uint8_t bitmap[8][SPRITE_BASE_X_SIZE * 2 / 8 + 1 /*for simpler sprite collision detection*/];
-};
-
/***************************************************************************
CONSTANTS
@@ -124,19 +105,20 @@ class vic3_device : public device_t,
public device_video_interface
{
public:
+ enum class vic3_type { NTSC, PAL };
+
vic3_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- ~vic3_device() {}
static void static_set_cpu_tag(device_t &device, const char *tag) { downcast<vic3_device &>(device).m_cpu.set_tag(tag); }
static void set_vic3_type(device_t &device, vic3_type type) { downcast<vic3_device &>(device).m_type = type; }
- template<class _Object> static devcb_base &set_dma_read_callback(device_t &device, _Object object) { return downcast<vic3_device &>(device).m_dma_read_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_dma_read_color_callback(device_t &device, _Object object) { return downcast<vic3_device &>(device).m_dma_read_color_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_interrupt_callback(device_t &device, _Object object) { return downcast<vic3_device &>(device).m_interrupt_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_port_changed_callback(device_t &device, _Object object) { return downcast<vic3_device &>(device).m_port_changed_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_lightpen_button_callback(device_t &device, _Object object) { return downcast<vic3_device &>(device).m_lightpen_button_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_lightpen_x_callback(device_t &device, _Object object) { return downcast<vic3_device &>(device).m_lightpen_x_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_lightpen_y_callback(device_t &device, _Object object) { return downcast<vic3_device &>(device).m_lightpen_y_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_c64_mem_r_callback(device_t &device, _Object object) { return downcast<vic3_device &>(device).m_c64_mem_r_cb.set_callback(object); }
+ template <class Object> static devcb_base &set_dma_read_callback(device_t &device, Object &&cb) { return downcast<vic3_device &>(device).m_dma_read_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_dma_read_color_callback(device_t &device, Object &&cb) { return downcast<vic3_device &>(device).m_dma_read_color_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_interrupt_callback(device_t &device, Object &&cb) { return downcast<vic3_device &>(device).m_interrupt_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_port_changed_callback(device_t &device, Object &&cb) { return downcast<vic3_device &>(device).m_port_changed_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_lightpen_button_callback(device_t &device, Object &&cb) { return downcast<vic3_device &>(device).m_lightpen_button_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_lightpen_x_callback(device_t &device, Object &&cb) { return downcast<vic3_device &>(device).m_lightpen_x_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_lightpen_y_callback(device_t &device, Object &&cb) { return downcast<vic3_device &>(device).m_lightpen_y_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_c64_mem_r_callback(device_t &device, Object &&cb) { return downcast<vic3_device &>(device).m_c64_mem_r_cb.set_callback(std::forward<Object>(cb)); }
DECLARE_WRITE8_MEMBER(port_w);
DECLARE_WRITE8_MEMBER(palette_w);
@@ -150,9 +132,24 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual machine_config_constructor device_mconfig_additions() const override;
+
private:
- // internal state
+ static constexpr unsigned SPRITE_BASE_X_SIZE = 24;
+ static constexpr unsigned SPRITE_BASE_Y_SIZE = 21;
+
+ struct vic3_sprite
+ {
+ int x, y;
+ int repeat; /* expand, line once drawn */
+ int line; /* 0 not painting, else painting */
+
+ /* buffer for currently painted line */
+ int paintedline[8];
+ uint8_t bitmap[8][SPRITE_BASE_X_SIZE * 2 / 8 + 1 /*for simpler sprite collision detection*/];
+ };
+
+ // internal state
inline int getforeground(int y, int x);
inline int getforeground16(int y, int x);
void set_interrupt(int mask);
@@ -236,38 +233,37 @@ private:
required_device<palette_device> m_palette;
};
-extern const device_type VIC3;
-
+DECLARE_DEVICE_TYPE(VIC3, vic3_device)
-#define MCFG_VIC3_CPU(_tag) \
- vic3_device::static_set_cpu_tag(*device, "^" _tag);
-#define MCFG_VIC3_TYPE(_type) \
- vic3_device::set_vic3_type(*device, _type);
+#define MCFG_VIC3_CPU(tag) \
+ vic3_device::static_set_cpu_tag(*device, ("^" tag));
-#define MCFG_VIC3_DMA_READ_CB(_devcb) \
- devcb = &vic3_device::set_dma_read_callback(*device, DEVCB_##_devcb);
+#define MCFG_VIC3_TYPE(type) \
+ vic3_device::set_vic3_type(*device, (vic3_device::vic3_type::type));
-#define MCFG_VIC3_DMA_READ_COLOR_CB(_devcb) \
- devcb = &vic3_device::set_dma_read_color_callback(*device, DEVCB_##_devcb);
+#define MCFG_VIC3_DMA_READ_CB(cb) \
+ devcb = &vic3_device::set_dma_read_callback(*device, (DEVCB_##cb));
-#define MCFG_VIC3_INTERRUPT_CB(_devcb) \
- devcb = &vic3_device::set_interrupt_callback(*device, DEVCB_##_devcb);
+#define MCFG_VIC3_DMA_READ_COLOR_CB(cb) \
+ devcb = &vic3_device::set_dma_read_color_callback(*device, (DEVCB_##cb));
-#define MCFG_VIC3_PORT_CHANGED_CB(_devcb) \
- devcb = &vic3_device::set_port_changed_callback(*device, DEVCB_##_devcb);
+#define MCFG_VIC3_INTERRUPT_CB(cb) \
+ devcb = &vic3_device::set_interrupt_callback(*device, (DEVCB_##cb));
-#define MCFG_VIC3_LIGHTPEN_BUTTON_CB(_devcb) \
- devcb = &vic3_device::set_lightpen_button_callback(*device, DEVCB_##_devcb);
+#define MCFG_VIC3_PORT_CHANGED_CB(cb) \
+ devcb = &vic3_device::set_port_changed_callback(*device, (DEVCB_##cb));
-#define MCFG_VIC3_LIGHTPEN_X_CB(_devcb) \
- devcb = &vic3_device::set_lightpen_x_callback(*device, DEVCB_##_devcb);
+#define MCFG_VIC3_LIGHTPEN_BUTTON_CB(cb) \
+ devcb = &vic3_device::set_lightpen_button_callback(*device, (DEVCB_##cb));
-#define MCFG_VIC3_LIGHTPEN_Y_CB(_devcb) \
- devcb = &vic3_device::set_lightpen_y_callback(*device, DEVCB_##_devcb);
+#define MCFG_VIC3_LIGHTPEN_X_CB(cb) \
+ devcb = &vic3_device::set_lightpen_x_callback(*device, (DEVCB_##cb));
-#define MCFG_VIC3_C64_MEM_R_CB(_devcb) \
- devcb = &vic3_device::set_c64_mem_r_callback(*device, DEVCB_##_devcb);
+#define MCFG_VIC3_LIGHTPEN_Y_CB(cb) \
+ devcb = &vic3_device::set_lightpen_y_callback(*device, (DEVCB_##cb));
+#define MCFG_VIC3_C64_MEM_R_CB(cb) \
+ devcb = &vic3_device::set_c64_mem_r_callback(*device, (DEVCB_##cb));
-#endif /* __VIC4567_H__ */
+#endif // MAME_VIDEO_VIC4567_H
diff --git a/src/devices/video/vooddefs.h b/src/devices/video/vooddefs.h
index 810fdc557e1..a9e653dc93d 100644
--- a/src/devices/video/vooddefs.h
+++ b/src/devices/video/vooddefs.h
@@ -8,12 +8,12 @@
***************************************************************************/
-#ifndef MAME_DEVICES_VIDEO_VOODDEFS_H
-#define MAME_DEVICES_VIDEO_VOODDEFS_H
+#ifndef MAME_VIDEO_VOODDEFS_H
+#define MAME_VIDEO_VOODDEFS_H
#pragma once
-#include "video/rgbutil.h"
+#include "voodoo.h"
@@ -23,8 +23,7 @@
*
*************************************/
-struct voodoo_state;
-struct poly_extra_data;
+typedef voodoo_reg rgb_union;
@@ -36,88 +35,53 @@ struct poly_extra_data;
*
*************************************/
-static inline void fifo_reset(fifo_state *f)
+inline void voodoo_device::fifo_state::add(uint32_t data)
{
- f->in = f->out = 0;
-}
-
-
-static inline void fifo_add(fifo_state *f, uint32_t data)
-{
- int32_t next_in;
-
/* compute the value of 'in' after we add this item */
- next_in = f->in + 1;
- if (next_in >= f->size)
+ int32_t next_in = in + 1;
+ if (next_in >= size)
next_in = 0;
/* as long as it's not equal to the output pointer, we can do it */
- if (next_in != f->out)
+ if (next_in != out)
{
- f->base[f->in] = data;
- f->in = next_in;
+ base[in] = data;
+ in = next_in;
}
}
-static inline uint32_t fifo_remove(fifo_state *f)
+inline uint32_t voodoo_device::fifo_state::remove()
{
uint32_t data = 0xffffffff;
/* as long as we have data, we can do it */
- if (f->out != f->in)
+ if (out != in)
{
int32_t next_out;
/* fetch the data */
- data = f->base[f->out];
+ data = base[out];
/* advance the output pointer */
- next_out = f->out + 1;
- if (next_out >= f->size)
+ next_out = out + 1;
+ if (next_out >= size)
next_out = 0;
- f->out = next_out;
+ out = next_out;
}
return data;
}
-static inline uint32_t fifo_peek(fifo_state *f)
-{
- return f->base[f->out];
-}
-
-
-static inline int fifo_empty(fifo_state *f)
-{
- return (f->in == f->out);
-}
-
-
-static inline int fifo_full(fifo_state *f)
-{
- return (f->in + 1 == f->out || (f->in == f->size - 1 && f->out == 0));
-}
-
-
-static inline int32_t fifo_items(fifo_state *f)
+inline int32_t voodoo_device::fifo_state::items() const
{
- int32_t items = f->in - f->out;
+ int32_t items = in - out;
if (items < 0)
- items += f->size;
+ items += size;
return items;
}
-static inline int32_t fifo_space(fifo_state *f)
-{
- int32_t items = f->in - f->out;
- if (items < 0)
- items += f->size;
- return f->size - 1 - items;
-}
-
-
/*************************************
*
@@ -333,24 +297,24 @@ static inline uint32_t normalize_tex_mode(uint32_t eff_tex_mode)
}
-static inline uint32_t compute_raster_hash(const raster_info *info)
+inline uint32_t voodoo_device::raster_info::compute_hash() const
{
- uint32_t hash;
+ uint32_t result;
/* make a hash */
- hash = info->eff_color_path;
- hash = (hash << 1) | (hash >> 31);
- hash ^= info->eff_fbz_mode;
- hash = (hash << 1) | (hash >> 31);
- hash ^= info->eff_alpha_mode;
- hash = (hash << 1) | (hash >> 31);
- hash ^= info->eff_fog_mode;
- hash = (hash << 1) | (hash >> 31);
- hash ^= info->eff_tex_mode_0;
- hash = (hash << 1) | (hash >> 31);
- hash ^= info->eff_tex_mode_1;
-
- return hash % RASTER_HASH_SIZE;
+ result = eff_color_path;
+ result = (result << 1) | (result >> 31);
+ result ^= eff_fbz_mode;
+ result = (result << 1) | (result >> 31);
+ result ^= eff_alpha_mode;
+ result = (result << 1) | (result >> 31);
+ result ^= eff_fog_mode;
+ result = (result << 1) | (result >> 31);
+ result ^= eff_tex_mode_0;
+ result = (result << 1) | (result >> 31);
+ result ^= eff_tex_mode_1;
+
+ return result % RASTER_HASH_SIZE;
}
@@ -637,7 +601,7 @@ do
} \
while (0)
-static inline bool ATTR_FORCE_INLINE chromaKeyTest(voodoo_device *vd, stats_block *stats, uint32_t fbzModeReg, rgbaint_t rgbaIntColor)
+inline bool ATTR_FORCE_INLINE voodoo_device::chromaKeyTest(voodoo_device *vd, stats_block *stats, uint32_t fbzModeReg, rgbaint_t rgbaIntColor)
{
if (FBZMODE_ENABLE_CHROMAKEY(fbzModeReg))
{
@@ -726,7 +690,7 @@ do
} \
while (0)
-static inline bool alphaMaskTest(stats_block *stats, uint32_t fbzModeReg, uint8_t alpha)
+inline bool voodoo_device::alphaMaskTest(stats_block *stats, uint32_t fbzModeReg, uint8_t alpha)
{
if (FBZMODE_ENABLE_ALPHA_MASK(fbzModeReg))
{
@@ -812,7 +776,7 @@ do
} \
while (0)
-static inline bool ATTR_FORCE_INLINE alphaTest(voodoo_device *vd, stats_block *stats, uint32_t alphaModeReg, uint8_t alpha)
+inline bool ATTR_FORCE_INLINE voodoo_device::alphaTest(voodoo_device *vd, stats_block *stats, uint32_t alphaModeReg, uint8_t alpha)
{
if (ALPHAMODE_ALPHATEST(alphaModeReg))
{
@@ -2002,7 +1966,7 @@ do
} \
while (0)
-static inline bool ATTR_FORCE_INLINE depthTest(uint16_t zaColorReg, stats_block *stats, int32_t destDepth, uint32_t fbzModeReg, int32_t biasdepth)
+inline bool ATTR_FORCE_INLINE voodoo_device::depthTest(uint16_t zaColorReg, stats_block *stats, int32_t destDepth, uint32_t fbzModeReg, int32_t biasdepth)
{
/* handle depth buffer testing */
if (FBZMODE_ENABLE_DEPTHBUF(fbzModeReg))
@@ -2413,7 +2377,7 @@ do
} \
while (0)
-static inline bool ATTR_FORCE_INLINE combineColor(voodoo_device *vd, stats_block *STATS, uint32_t FBZCOLORPATH, uint32_t FBZMODE, uint32_t ALPHAMODE,
+inline bool ATTR_FORCE_INLINE voodoo_device::combineColor(voodoo_device *vd, stats_block *STATS, uint32_t FBZCOLORPATH, uint32_t FBZMODE, uint32_t ALPHAMODE,
rgbaint_t TEXELARGB, int32_t ITERZ, int64_t ITERW, rgbaint_t &srcColor)
{
rgbaint_t c_other;
@@ -2767,9 +2731,9 @@ void voodoo_device::raster_##name(void *destbase, int32_t y, const poly_extent *
if (TMUS >= 2 && vd->tmu[1].lodmin < (8 << 8)) { \
int32_t tmp; \
const rgbaint_t texelZero(0); \
- texel = genTexture(&vd->tmu[1], x, dither4, TEXMODE1, vd->tmu[1].lookup, extra->lodbase1, \
+ texel = vd->tmu[1].genTexture(x, dither4, TEXMODE1, vd->tmu[1].lookup, extra->lodbase1, \
iters1, itert1, iterw1, tmp); \
- texel = combineTexture(&vd->tmu[1], TEXMODE1, texel, texelZero, tmp); \
+ texel = vd->tmu[1].combineTexture(TEXMODE1, texel, texelZero, tmp); \
} \
/* run the texture pipeline on TMU0 to produce a final */ \
/* result in texel */ \
@@ -2780,9 +2744,9 @@ void voodoo_device::raster_##name(void *destbase, int32_t y, const poly_extent *
{ \
int32_t lod0; \
rgbaint_t texelT0; \
- texelT0 = genTexture(&vd->tmu[0], x, dither4, TEXMODE0, vd->tmu[0].lookup, extra->lodbase0, \
+ texelT0 = vd->tmu[0].genTexture(x, dither4, TEXMODE0, vd->tmu[0].lookup, extra->lodbase0, \
iters0, itert0, iterw0, lod0); \
- texel = combineTexture(&vd->tmu[0], TEXMODE0, texelT0, texel, lod0); \
+ texel = vd->tmu[0].combineTexture(TEXMODE0, texelT0, texel, lod0); \
} \
else \
{ \
@@ -2853,7 +2817,7 @@ static inline void ATTR_FORCE_INLINE multi_reciplog(int64_t valueA, int64_t valu
}
-static inline rgbaint_t ATTR_FORCE_INLINE genTexture(tmu_state *TT, int32_t x, const uint8_t *dither4, const uint32_t TEXMODE, rgb_t *LOOKUP, int32_t LODBASE, int64_t ITERS, int64_t ITERT, int64_t ITERW, int32_t &lod)
+inline rgbaint_t ATTR_FORCE_INLINE voodoo_device::tmu_state::genTexture(int32_t x, const uint8_t *dither4, const uint32_t TEXMODE, rgb_t *LOOKUP, int32_t LODBASE, int64_t ITERS, int64_t ITERT, int64_t ITERW, int32_t &lod)
{
rgbaint_t result;
int32_t s, t, ilod;
@@ -2885,29 +2849,29 @@ static inline rgbaint_t ATTR_FORCE_INLINE genTexture(tmu_state *TT, int32_t x, c
}
/* clamp the LOD */
- lod += (TT)->lodbias;
+ lod += lodbias;
if (TEXMODE_ENABLE_LOD_DITHER(TEXMODE))
lod += dither4[x&3] << 4;
- if (lod < (TT)->lodmin)
- lod = (TT)->lodmin;
- else if (lod > (TT)->lodmax)
- lod = (TT)->lodmax;
+ if (lod < lodmin)
+ lod = lodmin;
+ else if (lod > lodmax)
+ lod = lodmax;
/* now the LOD is in range; if we don't own this LOD, take the next one */
ilod = lod >> 8;
- if (!(((TT)->lodmask >> ilod) & 1))
+ if (!((lodmask >> ilod) & 1))
ilod++;
/* fetch the texture base */
- uint32_t texbase = (TT)->lodoffset[ilod];
+ uint32_t texbase = lodoffset[ilod];
/* compute the maximum s and t values at this LOD */
- int32_t smax = (TT)->wmask >> ilod;
- int32_t tmax = (TT)->hmask >> ilod;
+ int32_t smax = wmask >> ilod;
+ int32_t tmax = hmask >> ilod;
/* determine whether we are point-sampled or bilinear */
- if ((lod == (TT)->lodmin && !TEXMODE_MAGNIFICATION_FILTER(TEXMODE)) ||
- (lod != (TT)->lodmin && !TEXMODE_MINIFICATION_FILTER(TEXMODE)))
+ if ((lod == lodmin && !TEXMODE_MAGNIFICATION_FILTER(TEXMODE)) ||
+ (lod != lodmin && !TEXMODE_MINIFICATION_FILTER(TEXMODE)))
{
/* point sampled */
@@ -2929,12 +2893,12 @@ static inline rgbaint_t ATTR_FORCE_INLINE genTexture(tmu_state *TT, int32_t x, c
/* fetch texel data */
if (TEXMODE_FORMAT(TEXMODE) < 8)
{
- texel0 = *(uint8_t *)&(TT)->ram[(texbase + t + s) & (TT)->mask];
+ texel0 = *(uint8_t *)&ram[(texbase + t + s) & mask];
result.set((LOOKUP)[texel0]);
}
else
{
- texel0 = *(uint16_t *)&(TT)->ram[(texbase + 2*(t + s)) & (TT)->mask];
+ texel0 = *(uint16_t *)&ram[(texbase + 2*(t + s)) & mask];
if (TEXMODE_FORMAT(TEXMODE) >= 10 && TEXMODE_FORMAT(TEXMODE) <= 12)
result.set((LOOKUP)[texel0]);
else
@@ -2959,8 +2923,8 @@ static inline rgbaint_t ATTR_FORCE_INLINE genTexture(tmu_state *TT, int32_t x, c
t -= 0x80;
/* extract the fractions */
- sfrac = s & (TT)->bilinear_mask;
- tfrac = t & (TT)->bilinear_mask;
+ sfrac = s & bilinear_mask;
+ tfrac = t & bilinear_mask;
/* now toss the rest */
s >>= 8;
@@ -3006,10 +2970,10 @@ static inline rgbaint_t ATTR_FORCE_INLINE genTexture(tmu_state *TT, int32_t x, c
/* fetch texel data */
if (TEXMODE_FORMAT(TEXMODE) < 8)
{
- texel0 = *(uint8_t *)&(TT)->ram[(texbase + t + s)];
- texel1 = *(uint8_t *)&(TT)->ram[(texbase + t + s1)];
- texel2 = *(uint8_t *)&(TT)->ram[(texbase + t1 + s)];
- texel3 = *(uint8_t *)&(TT)->ram[(texbase + t1 + s1)];
+ texel0 = *(uint8_t *)&ram[(texbase + t + s)];
+ texel1 = *(uint8_t *)&ram[(texbase + t + s1)];
+ texel2 = *(uint8_t *)&ram[(texbase + t1 + s)];
+ texel3 = *(uint8_t *)&ram[(texbase + t1 + s1)];
texel0 = (LOOKUP)[texel0];
texel1 = (LOOKUP)[texel1];
texel2 = (LOOKUP)[texel2];
@@ -3017,10 +2981,10 @@ static inline rgbaint_t ATTR_FORCE_INLINE genTexture(tmu_state *TT, int32_t x, c
}
else
{
- texel0 = *(uint16_t *)&(TT)->ram[(texbase + 2*(t + s))];
- texel1 = *(uint16_t *)&(TT)->ram[(texbase + 2*(t + s1))];
- texel2 = *(uint16_t *)&(TT)->ram[(texbase + 2*(t1 + s))];
- texel3 = *(uint16_t *)&(TT)->ram[(texbase + 2*(t1 + s1))];
+ texel0 = *(uint16_t *)&ram[(texbase + 2*(t + s))];
+ texel1 = *(uint16_t *)&ram[(texbase + 2*(t + s1))];
+ texel2 = *(uint16_t *)&ram[(texbase + 2*(t1 + s))];
+ texel3 = *(uint16_t *)&ram[(texbase + 2*(t1 + s1))];
if (TEXMODE_FORMAT(TEXMODE) >= 10 && TEXMODE_FORMAT(TEXMODE) <= 12)
{
texel0 = (LOOKUP)[texel0];
@@ -3044,7 +3008,7 @@ static inline rgbaint_t ATTR_FORCE_INLINE genTexture(tmu_state *TT, int32_t x, c
return result;
}
-static inline rgbaint_t ATTR_FORCE_INLINE combineTexture(tmu_state *TT, const uint32_t TEXMODE, rgbaint_t c_local, rgbaint_t c_other, int32_t lod)
+inline rgbaint_t ATTR_FORCE_INLINE voodoo_device::tmu_state::combineTexture(const uint32_t TEXMODE, rgbaint_t c_local, rgbaint_t c_other, int32_t lod)
{
int32_t a_other = c_other.get_a();
int32_t a_local = c_local.get_a();
@@ -3093,13 +3057,13 @@ static inline rgbaint_t ATTR_FORCE_INLINE combineTexture(tmu_state *TT, const ui
break;
case 4: /* LOD (detail factor) */
- if ((TT)->detailbias <= lod)
+ if (detailbias <= lod)
c_local.and_imm_rgba(-1, 0, 0, 0);
else
{
- tmp = ((((TT)->detailbias - lod) << (TT)->detailscale) >> 8);
- if (tmp > (TT)->detailmax)
- tmp = (TT)->detailmax;
+ tmp = (((detailbias - lod) << detailscale) >> 8);
+ if (tmp > detailmax)
+ tmp = detailmax;
c_local.set(a_local, tmp, tmp, tmp);
}
break;
@@ -3129,13 +3093,13 @@ static inline rgbaint_t ATTR_FORCE_INLINE combineTexture(tmu_state *TT, const ui
break;
case 4: /* LOD (detail factor) */
- if ((TT)->detailbias <= lod)
+ if (detailbias <= lod)
c_local.set_a(0);
else
{
- tmp = ((((TT)->detailbias - lod) << (TT)->detailscale) >> 8);
- if (tmp > (TT)->detailmax)
- tmp = (TT)->detailmax;
+ tmp = (((detailbias - lod) << detailscale) >> 8);
+ if (tmp > detailmax)
+ tmp = detailmax;
c_local.set_a(tmp);
}
break;
@@ -3201,4 +3165,4 @@ static inline rgbaint_t ATTR_FORCE_INLINE combineTexture(tmu_state *TT, const ui
return result;
}
-#endif // MAME_DEVICES_VIDEO_VOODDEFS_H
+#endif // MAME_VIDEO_VOODDEFS_H
diff --git a/src/devices/video/voodoo.cpp b/src/devices/video/voodoo.cpp
index e46dfd15db1..6e031dd71ac 100644
--- a/src/devices/video/voodoo.cpp
+++ b/src/devices/video/voodoo.cpp
@@ -177,6 +177,43 @@ bits(7:4) and bit(24)), X, and Y:
#define EAT_CYCLES (1)
+struct voodoo_device::poly_extra_data
+{
+ voodoo_device * device;
+ raster_info * info; /* pointer to rasterizer information */
+
+ int16_t ax, ay; /* vertex A x,y (12.4) */
+ int32_t startr, startg, startb, starta; /* starting R,G,B,A (12.12) */
+ int32_t startz; /* starting Z (20.12) */
+ int64_t startw; /* starting W (16.32) */
+ int32_t drdx, dgdx, dbdx, dadx; /* delta R,G,B,A per X */
+ int32_t dzdx; /* delta Z per X */
+ int64_t dwdx; /* delta W per X */
+ int32_t drdy, dgdy, dbdy, dady; /* delta R,G,B,A per Y */
+ int32_t dzdy; /* delta Z per Y */
+ int64_t dwdy; /* delta W per Y */
+
+ int64_t starts0, startt0; /* starting S,T (14.18) */
+ int64_t startw0; /* starting W (2.30) */
+ int64_t ds0dx, dt0dx; /* delta S,T per X */
+ int64_t dw0dx; /* delta W per X */
+ int64_t ds0dy, dt0dy; /* delta S,T per Y */
+ int64_t dw0dy; /* delta W per Y */
+ int32_t lodbase0; /* used during rasterization */
+
+ int64_t starts1, startt1; /* starting S,T (14.18) */
+ int64_t startw1; /* starting W (2.30) */
+ int64_t ds1dx, dt1dx; /* delta S,T per X */
+ int64_t dw1dx; /* delta W per X */
+ int64_t ds1dy, dt1dy; /* delta S,T per Y */
+ int64_t dw1dy; /* delta W per Y */
+ int32_t lodbase1; /* used during rasterization */
+
+ uint16_t dither[16]; /* dither matrix, for fastfill */
+};
+
+
+
/*************************************
*
* Statics
@@ -220,7 +257,7 @@ uint32_t voodoo_reciplog[(2 << RECIPLOG_LOOKUP_BITS) + 2];
#define RASTERIZER_ENTRY(fbzcp, alpha, fog, fbz, tex0, tex1) \
{ nullptr, voodoo_device::raster_##fbzcp##_##alpha##_##fog##_##fbz##_##tex0##_##tex1, false, 0, 0, 0, fbzcp, alpha, fog, fbz, tex0, tex1 },
-static const raster_info predef_raster_table[] =
+const voodoo_device::raster_info voodoo_device::predef_raster_table[] =
{
#include "voodoo_rast.hxx"
{ nullptr }
@@ -438,7 +475,7 @@ void voodoo_device::init_fbi(voodoo_device* vd,fbi_state *f, void *memory, int f
}
/* allocate a VBLANK timer */
- f->vblank_timer = vd->device->machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(voodoo_device::vblank_callback),vd), vd);
+ f->vblank_timer = vd->machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(voodoo_device::vblank_callback),vd), vd);
f->vblank = false;
/* initialize the memory FIFO */
@@ -450,47 +487,45 @@ void voodoo_device::init_fbi(voodoo_device* vd,fbi_state *f, void *memory, int f
}
-void voodoo_device::init_tmu_shared(tmu_shared_state *s)
+void voodoo_device::tmu_shared_state::init()
{
- int val;
-
/* build static 8-bit texel tables */
- for (val = 0; val < 256; val++)
+ for (int val = 0; val < 256; val++)
{
int r, g, b, a;
/* 8-bit RGB (3-3-2) */
EXTRACT_332_TO_888(val, r, g, b);
- s->rgb332[val] = rgb_t(0xff, r, g, b);
+ rgb332[val] = rgb_t(0xff, r, g, b);
/* 8-bit alpha */
- s->alpha8[val] = rgb_t(val, val, val, val);
+ alpha8[val] = rgb_t(val, val, val, val);
/* 8-bit intensity */
- s->int8[val] = rgb_t(0xff, val, val, val);
+ int8[val] = rgb_t(0xff, val, val, val);
/* 8-bit alpha, intensity */
a = ((val >> 0) & 0xf0) | ((val >> 4) & 0x0f);
r = ((val << 4) & 0xf0) | ((val << 0) & 0x0f);
- s->ai44[val] = rgb_t(a, r, r, r);
+ ai44[val] = rgb_t(a, r, r, r);
}
/* build static 16-bit texel tables */
- for (val = 0; val < 65536; val++)
+ for (int val = 0; val < 65536; val++)
{
int r, g, b, a;
/* table 10 = 16-bit RGB (5-6-5) */
EXTRACT_565_TO_888(val, r, g, b);
- s->rgb565[val] = rgb_t(0xff, r, g, b);
+ rgb565[val] = rgb_t(0xff, r, g, b);
/* table 11 = 16 ARGB (1-5-5-5) */
EXTRACT_1555_TO_8888(val, a, r, g, b);
- s->argb1555[val] = rgb_t(a, r, g, b);
+ argb1555[val] = rgb_t(a, r, g, b);
/* table 12 = 16-bit ARGB (4-4-4-4) */
EXTRACT_4444_TO_8888(val, a, r, g, b);
- s->argb4444[val] = rgb_t(a, r, g, b);
+ argb4444[val] = rgb_t(a, r, g, b);
}
}
@@ -565,7 +600,7 @@ void voodoo_device::voodoo_postload(voodoo_device *vd)
}
-static void init_save_state(voodoo_device *vd)
+void voodoo_device::init_save_state(voodoo_device *vd)
{
int index, subindex;
@@ -732,42 +767,40 @@ static void init_save_state(voodoo_device *vd)
*
*************************************/
-static void accumulate_statistics(voodoo_device *vd, const stats_block *stats)
+void voodoo_device::accumulate_statistics(const stats_block &block)
{
/* apply internal voodoo statistics */
- vd->reg[fbiPixelsIn].u += stats->pixels_in;
- vd->reg[fbiPixelsOut].u += stats->pixels_out;
- vd->reg[fbiChromaFail].u += stats->chroma_fail;
- vd->reg[fbiZfuncFail].u += stats->zfunc_fail;
- vd->reg[fbiAfuncFail].u += stats->afunc_fail;
+ reg[fbiPixelsIn].u += block.pixels_in;
+ reg[fbiPixelsOut].u += block.pixels_out;
+ reg[fbiChromaFail].u += block.chroma_fail;
+ reg[fbiZfuncFail].u += block.zfunc_fail;
+ reg[fbiAfuncFail].u += block.afunc_fail;
/* apply emulation statistics */
- vd->stats.total_pixels_in += stats->pixels_in;
- vd->stats.total_pixels_out += stats->pixels_out;
- vd->stats.total_chroma_fail += stats->chroma_fail;
- vd->stats.total_zfunc_fail += stats->zfunc_fail;
- vd->stats.total_afunc_fail += stats->afunc_fail;
- vd->stats.total_clipped += stats->clip_fail;
- vd->stats.total_stippled += stats->stipple_count;
+ stats.total_pixels_in += block.pixels_in;
+ stats.total_pixels_out += block.pixels_out;
+ stats.total_chroma_fail += block.chroma_fail;
+ stats.total_zfunc_fail += block.zfunc_fail;
+ stats.total_afunc_fail += block.afunc_fail;
+ stats.total_clipped += block.clip_fail;
+ stats.total_stippled += block.stipple_count;
}
-static void update_statistics(voodoo_device *vd, int accumulate)
+void voodoo_device::update_statistics(bool accumulate)
{
- int threadnum;
-
/* accumulate/reset statistics from all units */
- for (threadnum = 0; threadnum < WORK_MAX_THREADS; threadnum++)
+ for (int threadnum = 0; threadnum < WORK_MAX_THREADS; threadnum++)
{
if (accumulate)
- accumulate_statistics(vd, &vd->thread_stats[threadnum]);
- memset(&vd->thread_stats[threadnum], 0, sizeof(vd->thread_stats[threadnum]));
+ accumulate_statistics(thread_stats[threadnum]);
+ memset(&thread_stats[threadnum], 0, sizeof(thread_stats[threadnum]));
}
/* accumulate/reset statistics from the LFB */
if (accumulate)
- accumulate_statistics(vd, &vd->fbi.lfb_stats);
- memset(&vd->fbi.lfb_stats, 0, sizeof(vd->fbi.lfb_stats));
+ accumulate_statistics(fbi.lfb_stats);
+ memset(&fbi.lfb_stats, 0, sizeof(fbi.lfb_stats));
}
@@ -782,7 +815,7 @@ void voodoo_device::swap_buffers(voodoo_device *vd)
{
int count;
- if (LOG_VBLANK_SWAP) vd->device->logerror("--- swap_buffers @ %d\n", vd->screen->vpos());
+ if (LOG_VBLANK_SWAP) vd->logerror("--- swap_buffers @ %d\n", vd->screen->vpos());
/* force a partial update */
vd->screen->update_partial(vd->screen->vpos());
@@ -823,13 +856,13 @@ void voodoo_device::swap_buffers(voodoo_device *vd)
/* reset the last_op_time to now and start processing the next command */
if (vd->pci.op_pending)
{
- vd->pci.op_end_time = vd->device->machine().time();
+ vd->pci.op_end_time = vd->machine().time();
flush_fifos(vd, vd->pci.op_end_time);
}
/* we may be able to unstall now */
if (vd->pci.stall_state != NOT_STALLED)
- check_stalled_cpu(vd, vd->device->machine().time());
+ check_stalled_cpu(vd, vd->machine().time());
/* periodically log rasterizer info */
vd->stats.swaps++;
@@ -845,7 +878,7 @@ void voodoo_device::swap_buffers(voodoo_device *vd)
int pixelcount;
int i;
- update_statistics(vd, true);
+ vd->update_statistics(true);
pixelcount = vd->stats.total_pixels_out;
statsptr += sprintf(statsptr, "Swap:%6d\n", vd->stats.swaps);
@@ -904,7 +937,7 @@ static void adjust_vblank_timer(voodoo_device *vd)
TIMER_CALLBACK_MEMBER( voodoo_device::vblank_off_callback )
{
- if (LOG_VBLANK_SWAP) device->logerror("--- vblank end\n");
+ if (LOG_VBLANK_SWAP) logerror("--- vblank end\n");
/* set internal state and call the client */
fbi.vblank = false;
@@ -916,15 +949,15 @@ TIMER_CALLBACK_MEMBER( voodoo_device::vblank_off_callback )
{
reg[intrCtrl].u |= 0x200; // VSYNC int (falling) active
- if (!device->m_vblank.isnull())
- device->m_vblank(false);
+ if (!m_vblank.isnull())
+ m_vblank(false);
}
}
else
{
- if (!device->m_vblank.isnull())
- device->m_vblank(false);
+ if (!m_vblank.isnull())
+ m_vblank(false);
}
/* go to the end of the next frame */
@@ -934,24 +967,24 @@ TIMER_CALLBACK_MEMBER( voodoo_device::vblank_off_callback )
TIMER_CALLBACK_MEMBER( voodoo_device::vblank_callback )
{
- if (LOG_VBLANK_SWAP) device->logerror("--- vblank start\n");
+ if (LOG_VBLANK_SWAP) logerror("--- vblank start\n");
/* flush the pipes */
if (pci.op_pending)
{
- if (LOG_VBLANK_SWAP) device->logerror("---- vblank flush begin\n");
+ if (LOG_VBLANK_SWAP) logerror("---- vblank flush begin\n");
flush_fifos(this, machine().time());
- if (LOG_VBLANK_SWAP) device->logerror("---- vblank flush end\n");
+ if (LOG_VBLANK_SWAP) logerror("---- vblank flush end\n");
}
/* increment the count */
fbi.vblank_count++;
if (fbi.vblank_count > 250)
fbi.vblank_count = 250;
- if (LOG_VBLANK_SWAP) device->logerror("---- vblank count = %d", fbi.vblank_count);
+ if (LOG_VBLANK_SWAP) logerror("---- vblank count = %d", fbi.vblank_count);
if (fbi.vblank_swap_pending)
- if (LOG_VBLANK_SWAP) device->logerror(" (target=%d)", fbi.vblank_swap);
- if (LOG_VBLANK_SWAP) device->logerror("\n");
+ if (LOG_VBLANK_SWAP) logerror(" (target=%d)", fbi.vblank_swap);
+ if (LOG_VBLANK_SWAP) logerror("\n");
/* if we're past the swap count, do the swap */
if (fbi.vblank_swap_pending && fbi.vblank_count >= fbi.vblank_swap)
@@ -972,14 +1005,14 @@ TIMER_CALLBACK_MEMBER( voodoo_device::vblank_callback )
{
reg[intrCtrl].u |= 0x100; // VSYNC int (rising) active
- if (!device->m_vblank.isnull())
- device->m_vblank(true);
+ if (!m_vblank.isnull())
+ m_vblank(true);
}
}
else
{
- if (!device->m_vblank.isnull())
- device->m_vblank(true);
+ if (!m_vblank.isnull())
+ m_vblank(true);
}
}
@@ -991,23 +1024,23 @@ TIMER_CALLBACK_MEMBER( voodoo_device::vblank_callback )
*
*************************************/
-static void reset_counters(voodoo_device *vd)
+void voodoo_device::reset_counters()
{
- update_statistics(vd, false);
- vd->reg[fbiPixelsIn].u = 0;
- vd->reg[fbiChromaFail].u = 0;
- vd->reg[fbiZfuncFail].u = 0;
- vd->reg[fbiAfuncFail].u = 0;
- vd->reg[fbiPixelsOut].u = 0;
+ update_statistics(false);
+ reg[fbiPixelsIn].u = 0;
+ reg[fbiChromaFail].u = 0;
+ reg[fbiZfuncFail].u = 0;
+ reg[fbiAfuncFail].u = 0;
+ reg[fbiPixelsOut].u = 0;
}
-void voodoo_device::soft_reset(voodoo_device *vd)
+void voodoo_device::soft_reset()
{
- reset_counters(vd);
- vd->reg[fbiTrianglesOut].u = 0;
- fifo_reset(&vd->fbi.fifo);
- fifo_reset(&vd->pci.fifo);
+ reset_counters();
+ reg[fbiTrianglesOut].u = 0;
+ fbi.fifo.reset();
+ pci.fifo.reset();
}
@@ -1055,7 +1088,7 @@ void voodoo_device::recompute_video_memory(voodoo_device *vd)
switch (memory_config)
{
case 3: /* reserved */
- vd->device->logerror("VOODOO.%d.ERROR:Unexpected memory configuration in recompute_video_memory!\n", vd->index);
+ vd->logerror("VOODOO.%d.ERROR:Unexpected memory configuration in recompute_video_memory!\n", vd->index);
case 0: /* 2 color buffers, 1 aux buffer */
vd->fbi.rgboffs[2] = ~0;
@@ -1106,7 +1139,7 @@ void voodoo_device::recompute_video_memory(voodoo_device *vd)
}
/* reset the FIFO */
- fifo_reset(&vd->fbi.fifo);
+ vd->fbi.fifo.reset();
/* reset our front/back buffers if they are out of range */
if (vd->fbi.rgboffs[2] == ~0)
@@ -1126,24 +1159,24 @@ void voodoo_device::recompute_video_memory(voodoo_device *vd)
*
*************************************/
-static void ncc_table_write(ncc_table *n, offs_t regnum, uint32_t data)
+void voodoo_device::tmu_state::ncc_table::write(offs_t regnum, uint32_t data)
{
/* I/Q entries reference the plaette if the high bit is set */
- if (regnum >= 4 && (data & 0x80000000) && n->palette)
+ if (regnum >= 4 && (data & 0x80000000) && palette)
{
- int index = ((data >> 23) & 0xfe) | (regnum & 1);
+ int const index = ((data >> 23) & 0xfe) | (regnum & 1);
/* set the ARGB for this palette index */
- n->palette[index] = 0xff000000 | data;
+ palette[index] = 0xff000000 | data;
/* if we have an ARGB palette as well, compute its value */
- if (n->palettea)
+ if (palettea)
{
int a = ((data >> 16) & 0xfc) | ((data >> 22) & 0x03);
int r = ((data >> 10) & 0xfc) | ((data >> 16) & 0x03);
int g = ((data >> 4) & 0xfc) | ((data >> 10) & 0x03);
int b = ((data << 2) & 0xfc) | ((data >> 4) & 0x03);
- n->palettea[index] = rgb_t(a, r, g, b);
+ palettea[index] = rgb_t(a, r, g, b);
}
/* this doesn't dirty the table or go to the registers, so bail */
@@ -1151,60 +1184,59 @@ static void ncc_table_write(ncc_table *n, offs_t regnum, uint32_t data)
}
/* if the register matches, don't update */
- if (data == n->reg[regnum].u)
+ if (data == reg[regnum].u)
return;
- n->reg[regnum].u = data;
+ reg[regnum].u = data;
/* first four entries are packed Y values */
if (regnum < 4)
{
regnum *= 4;
- n->y[regnum+0] = (data >> 0) & 0xff;
- n->y[regnum+1] = (data >> 8) & 0xff;
- n->y[regnum+2] = (data >> 16) & 0xff;
- n->y[regnum+3] = (data >> 24) & 0xff;
+ y[regnum+0] = (data >> 0) & 0xff;
+ y[regnum+1] = (data >> 8) & 0xff;
+ y[regnum+2] = (data >> 16) & 0xff;
+ y[regnum+3] = (data >> 24) & 0xff;
}
/* the second four entries are the I RGB values */
else if (regnum < 8)
{
regnum &= 3;
- n->ir[regnum] = (int32_t)(data << 5) >> 23;
- n->ig[regnum] = (int32_t)(data << 14) >> 23;
- n->ib[regnum] = (int32_t)(data << 23) >> 23;
+ ir[regnum] = (int32_t)(data << 5) >> 23;
+ ig[regnum] = (int32_t)(data << 14) >> 23;
+ ib[regnum] = (int32_t)(data << 23) >> 23;
}
/* the final four entries are the Q RGB values */
else
{
regnum &= 3;
- n->qr[regnum] = (int32_t)(data << 5) >> 23;
- n->qg[regnum] = (int32_t)(data << 14) >> 23;
- n->qb[regnum] = (int32_t)(data << 23) >> 23;
+ qr[regnum] = (int32_t)(data << 5) >> 23;
+ qg[regnum] = (int32_t)(data << 14) >> 23;
+ qb[regnum] = (int32_t)(data << 23) >> 23;
}
/* mark the table dirty */
- n->dirty = true;
+ dirty = true;
}
-static void ncc_table_update(ncc_table *n)
+void voodoo_device::tmu_state::ncc_table::update()
{
- int r, g, b, i;
-
/* generte all 256 possibilities */
- for (i = 0; i < 256; i++)
+ for (int i = 0; i < 256; i++)
{
int vi = (i >> 2) & 0x03;
int vq = (i >> 0) & 0x03;
/* start with the intensity */
- r = g = b = n->y[(i >> 4) & 0x0f];
+ int r, g, b;
+ r = g = b = y[(i >> 4) & 0x0f];
/* add the coloring */
- r += n->ir[vi] + n->qr[vq];
- g += n->ig[vi] + n->qg[vq];
- b += n->ib[vi] + n->qb[vq];
+ r += ir[vi] + qr[vq];
+ g += ig[vi] + qg[vq];
+ b += ib[vi] + qb[vq];
/* clamp */
CLAMP(r, 0, 255);
@@ -1212,11 +1244,11 @@ static void ncc_table_update(ncc_table *n)
CLAMP(b, 0, 255);
/* fill in the table */
- n->texel[i] = rgb_t(0xff, r, g, b);
+ texel[i] = rgb_t(0xff, r, g, b);
}
/* no longer dirty */
- n->dirty = false;
+ dirty = false;
}
@@ -1227,13 +1259,13 @@ static void ncc_table_update(ncc_table *n)
*
*************************************/
-static void dacdata_w(dac_state *d, uint8_t regnum, uint8_t data)
+void voodoo_device::dac_state::data_w(uint8_t regnum, uint8_t data)
{
- d->reg[regnum] = data;
+ reg[regnum] = data;
}
-static void dacdata_r(dac_state *d, uint8_t regnum)
+void voodoo_device::dac_state::data_r(uint8_t regnum)
{
uint8_t result = 0xff;
@@ -1242,7 +1274,7 @@ static void dacdata_r(dac_state *d, uint8_t regnum)
{
case 5:
/* this is just to make startup happy */
- switch (d->reg[7])
+ switch (reg[7])
{
case 0x01: result = 0x55; break;
case 0x07: result = 0x71; break;
@@ -1251,12 +1283,12 @@ static void dacdata_r(dac_state *d, uint8_t regnum)
break;
default:
- result = d->reg[regnum];
+ result = reg[regnum];
break;
}
/* remember the read result; it is fetched elsewhere */
- d->read_result = result;
+ read_result = result;
}
@@ -1267,125 +1299,123 @@ static void dacdata_r(dac_state *d, uint8_t regnum)
*
*************************************/
-static void recompute_texture_params(tmu_state *t)
+void voodoo_device::tmu_state::recompute_texture_params()
{
int bppscale;
uint32_t base;
int lod;
/* extract LOD parameters */
- t->lodmin = TEXLOD_LODMIN(t->reg[tLOD].u) << 6;
- t->lodmax = TEXLOD_LODMAX(t->reg[tLOD].u) << 6;
- t->lodbias = (int8_t)(TEXLOD_LODBIAS(t->reg[tLOD].u) << 2) << 4;
+ lodmin = TEXLOD_LODMIN(reg[tLOD].u) << 6;
+ lodmax = TEXLOD_LODMAX(reg[tLOD].u) << 6;
+ lodbias = (int8_t)(TEXLOD_LODBIAS(reg[tLOD].u) << 2) << 4;
/* determine which LODs are present */
- t->lodmask = 0x1ff;
- if (TEXLOD_LOD_TSPLIT(t->reg[tLOD].u))
+ lodmask = 0x1ff;
+ if (TEXLOD_LOD_TSPLIT(reg[tLOD].u))
{
- if (!TEXLOD_LOD_ODD(t->reg[tLOD].u))
- t->lodmask = 0x155;
+ if (!TEXLOD_LOD_ODD(reg[tLOD].u))
+ lodmask = 0x155;
else
- t->lodmask = 0x0aa;
+ lodmask = 0x0aa;
}
/* determine base texture width/height */
- t->wmask = t->hmask = 0xff;
- if (TEXLOD_LOD_S_IS_WIDER(t->reg[tLOD].u))
- t->hmask >>= TEXLOD_LOD_ASPECT(t->reg[tLOD].u);
+ wmask = hmask = 0xff;
+ if (TEXLOD_LOD_S_IS_WIDER(reg[tLOD].u))
+ hmask >>= TEXLOD_LOD_ASPECT(reg[tLOD].u);
else
- t->wmask >>= TEXLOD_LOD_ASPECT(t->reg[tLOD].u);
+ wmask >>= TEXLOD_LOD_ASPECT(reg[tLOD].u);
/* determine the bpp of the texture */
- bppscale = TEXMODE_FORMAT(t->reg[textureMode].u) >> 3;
+ bppscale = TEXMODE_FORMAT(reg[textureMode].u) >> 3;
/* start with the base of LOD 0 */
- if (t->texaddr_shift == 0 && (t->reg[texBaseAddr].u & 1))
+ if (texaddr_shift == 0 && (reg[texBaseAddr].u & 1))
osd_printf_debug("Tiled texture\n");
- base = (t->reg[texBaseAddr].u & t->texaddr_mask) << t->texaddr_shift;
- t->lodoffset[0] = base & t->mask;
+ base = (reg[texBaseAddr].u & texaddr_mask) << texaddr_shift;
+ lodoffset[0] = base & mask;
/* LODs 1-3 are different depending on whether we are in multitex mode */
/* Several Voodoo 2 games leave the upper bits of TLOD == 0xff, meaning we think */
/* they want multitex mode when they really don't -- disable for now */
// Enable for Voodoo 3 or Viper breaks - VL.
// Add check for upper nibble not equal to zero to fix funkball -- TG
- if (TEXLOD_TMULTIBASEADDR(t->reg[tLOD].u) && (t->reg[tLOD].u >> 28) == 0)
+ if (TEXLOD_TMULTIBASEADDR(reg[tLOD].u) && (reg[tLOD].u >> 28) == 0)
{
- base = (t->reg[texBaseAddr_1].u & t->texaddr_mask) << t->texaddr_shift;
- t->lodoffset[1] = base & t->mask;
- base = (t->reg[texBaseAddr_2].u & t->texaddr_mask) << t->texaddr_shift;
- t->lodoffset[2] = base & t->mask;
- base = (t->reg[texBaseAddr_3_8].u & t->texaddr_mask) << t->texaddr_shift;
- t->lodoffset[3] = base & t->mask;
+ base = (reg[texBaseAddr_1].u & texaddr_mask) << texaddr_shift;
+ lodoffset[1] = base & mask;
+ base = (reg[texBaseAddr_2].u & texaddr_mask) << texaddr_shift;
+ lodoffset[2] = base & mask;
+ base = (reg[texBaseAddr_3_8].u & texaddr_mask) << texaddr_shift;
+ lodoffset[3] = base & mask;
}
else
{
- if (t->lodmask & (1 << 0))
- base += (((t->wmask >> 0) + 1) * ((t->hmask >> 0) + 1)) << bppscale;
- t->lodoffset[1] = base & t->mask;
- if (t->lodmask & (1 << 1))
- base += (((t->wmask >> 1) + 1) * ((t->hmask >> 1) + 1)) << bppscale;
- t->lodoffset[2] = base & t->mask;
- if (t->lodmask & (1 << 2))
- base += (((t->wmask >> 2) + 1) * ((t->hmask >> 2) + 1)) << bppscale;
- t->lodoffset[3] = base & t->mask;
+ if (lodmask & (1 << 0))
+ base += (((wmask >> 0) + 1) * ((hmask >> 0) + 1)) << bppscale;
+ lodoffset[1] = base & mask;
+ if (lodmask & (1 << 1))
+ base += (((wmask >> 1) + 1) * ((hmask >> 1) + 1)) << bppscale;
+ lodoffset[2] = base & mask;
+ if (lodmask & (1 << 2))
+ base += (((wmask >> 2) + 1) * ((hmask >> 2) + 1)) << bppscale;
+ lodoffset[3] = base & mask;
}
/* remaining LODs make sense */
for (lod = 4; lod <= 8; lod++)
{
- if (t->lodmask & (1 << (lod - 1)))
+ if (lodmask & (1 << (lod - 1)))
{
- uint32_t size = ((t->wmask >> (lod - 1)) + 1) * ((t->hmask >> (lod - 1)) + 1);
+ uint32_t size = ((wmask >> (lod - 1)) + 1) * ((hmask >> (lod - 1)) + 1);
if (size < 4) size = 4;
base += size << bppscale;
}
- t->lodoffset[lod] = base & t->mask;
+ lodoffset[lod] = base & mask;
}
/* set the NCC lookup appropriately */
- t->texel[1] = t->texel[9] = t->ncc[TEXMODE_NCC_TABLE_SELECT(t->reg[textureMode].u)].texel;
+ texel[1] = texel[9] = ncc[TEXMODE_NCC_TABLE_SELECT(reg[textureMode].u)].texel;
/* pick the lookup table */
- t->lookup = t->texel[TEXMODE_FORMAT(t->reg[textureMode].u)];
+ lookup = texel[TEXMODE_FORMAT(reg[textureMode].u)];
/* compute the detail parameters */
- t->detailmax = TEXDETAIL_DETAIL_MAX(t->reg[tDetail].u);
- t->detailbias = (int8_t)(TEXDETAIL_DETAIL_BIAS(t->reg[tDetail].u) << 2) << 6;
- t->detailscale = TEXDETAIL_DETAIL_SCALE(t->reg[tDetail].u);
+ detailmax = TEXDETAIL_DETAIL_MAX(reg[tDetail].u);
+ detailbias = (int8_t)(TEXDETAIL_DETAIL_BIAS(reg[tDetail].u) << 2) << 6;
+ detailscale = TEXDETAIL_DETAIL_SCALE(reg[tDetail].u);
/* ensure that the NCC tables are up to date */
- if ((TEXMODE_FORMAT(t->reg[textureMode].u) & 7) == 1)
+ if ((TEXMODE_FORMAT(reg[textureMode].u) & 7) == 1)
{
- ncc_table *n = &t->ncc[TEXMODE_NCC_TABLE_SELECT(t->reg[textureMode].u)];
- t->texel[1] = t->texel[9] = n->texel;
- if (n->dirty)
- ncc_table_update(n);
+ ncc_table &n = ncc[TEXMODE_NCC_TABLE_SELECT(reg[textureMode].u)];
+ texel[1] = texel[9] = n.texel;
+ if (n.dirty)
+ n.update();
}
/* no longer dirty */
- t->regdirty = false;
+ regdirty = false;
/* check for separate RGBA filtering */
- if (TEXDETAIL_SEPARATE_RGBA_FILTER(t->reg[tDetail].u))
+ if (TEXDETAIL_SEPARATE_RGBA_FILTER(reg[tDetail].u))
fatalerror("Separate RGBA filters!\n");
}
-static inline int32_t prepare_tmu(tmu_state *t)
+inline int32_t voodoo_device::tmu_state::prepare()
{
int64_t texdx, texdy;
int32_t lodbase;
/* if the texture parameters are dirty, update them */
- if (t->regdirty)
- {
- recompute_texture_params(t);
- }
+ if (regdirty)
+ recompute_texture_params();
/* compute (ds^2 + dt^2) in both X and Y as 28.36 numbers */
- texdx = (int64_t)(t->dsdx >> 14) * (int64_t)(t->dsdx >> 14) + (int64_t)(t->dtdx >> 14) * (int64_t)(t->dtdx >> 14);
- texdy = (int64_t)(t->dsdy >> 14) * (int64_t)(t->dsdy >> 14) + (int64_t)(t->dtdy >> 14) * (int64_t)(t->dtdy >> 14);
+ texdx = int64_t(dsdx >> 14) * int64_t(dsdx >> 14) + int64_t(dtdx >> 14) * int64_t(dtdx >> 14);
+ texdy = int64_t(dsdy >> 14) * int64_t(dsdy >> 14) + int64_t(dtdy >> 14) * int64_t(dtdy >> 14);
/* pick whichever is larger and shift off some high bits -> 28.20 */
if (texdx < texdy)
@@ -1397,14 +1427,14 @@ static inline int32_t prepare_tmu(tmu_state *t)
/* adjust the result: negative to get the log of the original value */
/* plus 12 to account for the extra exponent, and divided by 2 to */
/* get the log of the square root of texdx */
- #if USE_FAST_RECIP == 1
- (void)fast_reciplog(texdx, &lodbase);
- return (-lodbase + (12 << 8)) / 2;
- #else
- double tmpTex = texdx;
- lodbase = new_log2(tmpTex);
- return (lodbase + (12 << 8)) / 2;
- #endif
+#if USE_FAST_RECIP == 1
+ (void)fast_reciplog(texdx, &lodbase);
+ return (-lodbase + (12 << 8)) / 2;
+#else
+ double tmpTex = texdx;
+ lodbase = new_log2(tmpTex);
+ return (lodbase + (12 << 8)) / 2;
+#endif
}
@@ -1415,10 +1445,10 @@ static inline int32_t prepare_tmu(tmu_state *t)
*
*************************************/
-static int cmdfifo_compute_expected_depth(voodoo_device *vd, cmdfifo_info *f)
+int voodoo_device::cmdfifo_compute_expected_depth(cmdfifo_info &f)
{
- uint32_t *fifobase = (uint32_t *)vd->fbi.ram;
- uint32_t readptr = f->rdptr;
+ uint32_t *fifobase = (uint32_t *)fbi.ram;
+ uint32_t readptr = f.rdptr;
uint32_t command = fifobase[readptr / 4];
int i, count = 0;
@@ -1562,7 +1592,7 @@ uint32_t voodoo_device::cmdfifo_execute(voodoo_device *vd, cmdfifo_info *f)
uint32_t *src = &fifobase[readptr / 4];
uint32_t command = *src++;
int count, inc, code, i;
- setup_vertex svert = {0};
+ fbi_state::setup_vertex svert = {0};
offs_t target;
int cycles = 0;
@@ -1588,26 +1618,26 @@ uint32_t voodoo_device::cmdfifo_execute(voodoo_device *vd, cmdfifo_info *f)
switch ((command >> 3) & 7)
{
case 0: /* NOP */
- if (LOG_CMDFIFO) vd->device->logerror(" NOP\n");
+ if (LOG_CMDFIFO) vd->logerror(" NOP\n");
break;
case 1: /* JSR */
- if (LOG_CMDFIFO) vd->device->logerror(" JSR $%06X\n", target);
+ if (LOG_CMDFIFO) vd->logerror(" JSR $%06X\n", target);
osd_printf_debug("JSR in CMDFIFO!\n");
src = &fifobase[target / 4];
break;
case 2: /* RET */
- if (LOG_CMDFIFO) vd->device->logerror(" RET $%06X\n", target);
+ if (LOG_CMDFIFO) vd->logerror(" RET $%06X\n", target);
fatalerror("RET in CMDFIFO!\n");
case 3: /* JMP LOCAL FRAME BUFFER */
- if (LOG_CMDFIFO) vd->device->logerror(" JMP LOCAL FRAMEBUF $%06X\n", target);
+ if (LOG_CMDFIFO) vd->logerror(" JMP LOCAL FRAMEBUF $%06X\n", target);
src = &fifobase[target / 4];
break;
case 4: /* JMP AGP */
- if (LOG_CMDFIFO) vd->device->logerror(" JMP AGP $%06X\n", target);
+ if (LOG_CMDFIFO) vd->logerror(" JMP AGP $%06X\n", target);
fatalerror("JMP AGP in CMDFIFO!\n");
src = &fifobase[target / 4];
break;
@@ -1635,7 +1665,7 @@ uint32_t voodoo_device::cmdfifo_execute(voodoo_device *vd, cmdfifo_info *f)
inc = (command >> 15) & 1;
target = (command >> 3) & 0xfff;
- if (LOG_CMDFIFO) vd->device->logerror(" PACKET TYPE 1: count=%d inc=%d reg=%04X\n", count, inc, target);
+ if (LOG_CMDFIFO) vd->logerror(" PACKET TYPE 1: count=%d inc=%d reg=%04X\n", count, inc, target);
if (vd->vd_type >= TYPE_VOODOO_BANSHEE && (target & 0x800))
{
@@ -1666,7 +1696,7 @@ uint32_t voodoo_device::cmdfifo_execute(voodoo_device *vd, cmdfifo_info *f)
1 31:0 = Data word
*/
case 2:
- if (LOG_CMDFIFO) vd->device->logerror(" PACKET TYPE 2: mask=%X\n", (command >> 3) & 0x1ffffff);
+ if (LOG_CMDFIFO) vd->logerror(" PACKET TYPE 2: mask=%X\n", (command >> 3) & 0x1ffffff);
/* loop over all registers and write them one at a time */
for (i = 3; i <= 31; i++)
@@ -1703,7 +1733,7 @@ uint32_t voodoo_device::cmdfifo_execute(voodoo_device *vd, cmdfifo_info *f)
count = (command >> 6) & 15;
code = (command >> 3) & 7;
- if (LOG_CMDFIFO) vd->device->logerror(" PACKET TYPE 3: count=%d code=%d mask=%03X smode=%02X pc=%d\n", count, code, (command >> 10) & 0xfff, (command >> 22) & 0x3f, (command >> 28) & 1);
+ if (LOG_CMDFIFO) vd->logerror(" PACKET TYPE 3: count=%d code=%d mask=%03X smode=%02X pc=%d\n", count, code, (command >> 10) & 0xfff, (command >> 22) & 0x3f, (command >> 28) & 1);
/* copy relevant bits into the setup mode register */
vd->reg[sSetupMode].u = ((command >> 10) & 0xff) | ((command >> 6) & 0xf0000);
@@ -1813,7 +1843,7 @@ uint32_t voodoo_device::cmdfifo_execute(voodoo_device *vd, cmdfifo_info *f)
/* extract parameters */
target = (command >> 3) & 0xfff;
- if (LOG_CMDFIFO) vd->device->logerror(" PACKET TYPE 4: mask=%X reg=%04X pad=%d\n", (command >> 15) & 0x3fff, target, command >> 29);
+ if (LOG_CMDFIFO) vd->logerror(" PACKET TYPE 4: mask=%X reg=%04X pad=%d\n", (command >> 15) & 0x3fff, target, command >> 29);
if (vd->vd_type >= TYPE_VOODOO_BANSHEE && (target & 0x800))
{
@@ -1867,7 +1897,7 @@ uint32_t voodoo_device::cmdfifo_execute(voodoo_device *vd, cmdfifo_info *f)
{
case 0: // Linear FB
{
- if (LOG_CMDFIFO) vd->device->logerror(" PACKET TYPE 5: FB count=%d dest=%08X bd2=%X bdN=%X\n", count, target, (command >> 26) & 15, (command >> 22) & 15);
+ if (LOG_CMDFIFO) vd->logerror(" PACKET TYPE 5: FB count=%d dest=%08X bd2=%X bdN=%X\n", count, target, (command >> 26) & 15, (command >> 22) & 15);
uint32_t addr = target * 4;
for (i=0; i < count; i++)
@@ -1885,7 +1915,7 @@ uint32_t voodoo_device::cmdfifo_execute(voodoo_device *vd, cmdfifo_info *f)
}
case 2: // 3D LFB
{
- if (LOG_CMDFIFO) vd->device->logerror(" PACKET TYPE 5: 3D LFB count=%d dest=%08X bd2=%X bdN=%X\n", count, target, (command >> 26) & 15, (command >> 22) & 15);
+ if (LOG_CMDFIFO) vd->logerror(" PACKET TYPE 5: 3D LFB count=%d dest=%08X bd2=%X bdN=%X\n", count, target, (command >> 26) & 15, (command >> 22) & 15);
/* loop over words */
for (i = 0; i < count; i++)
@@ -1910,7 +1940,7 @@ uint32_t voodoo_device::cmdfifo_execute(voodoo_device *vd, cmdfifo_info *f)
case 3: // Texture Port
{
- if (LOG_CMDFIFO) vd->device->logerror(" PACKET TYPE 5: textureRAM count=%d dest=%08X bd2=%X bdN=%X\n", count, target, (command >> 26) & 15, (command >> 22) & 15);
+ if (LOG_CMDFIFO) vd->logerror(" PACKET TYPE 5: textureRAM count=%d dest=%08X bd2=%X bdN=%X\n", count, target, (command >> 26) & 15, (command >> 22) & 15);
/* loop over words */
for (i = 0; i < count; i++)
@@ -1940,23 +1970,20 @@ uint32_t voodoo_device::cmdfifo_execute(voodoo_device *vd, cmdfifo_info *f)
*
*************************************/
-int32_t voodoo_device::cmdfifo_execute_if_ready(voodoo_device* vd, cmdfifo_info *f)
+int32_t voodoo_device::cmdfifo_execute_if_ready(cmdfifo_info &f)
{
- int needed_depth;
- int cycles;
-
/* all CMDFIFO commands need at least one word */
- if (f->depth == 0)
+ if (f.depth == 0)
return -1;
/* see if we have enough for the current command */
- needed_depth = cmdfifo_compute_expected_depth(vd, f);
- if (f->depth < needed_depth)
+ int const needed_depth = cmdfifo_compute_expected_depth(f);
+ if (f.depth < needed_depth)
return -1;
/* execute */
- cycles = cmdfifo_execute(vd, f);
- f->depth -= needed_depth;
+ int const cycles = cmdfifo_execute(this, &f);
+ f.depth -= needed_depth;
return cycles;
}
@@ -1973,7 +2000,7 @@ void voodoo_device::cmdfifo_w(voodoo_device *vd, cmdfifo_info *f, offs_t offset,
uint32_t addr = f->base + offset * 4;
uint32_t *fifobase = (uint32_t *)vd->fbi.ram;
- if (LOG_CMDFIFO_VERBOSE) vd->device->logerror("CMDFIFO_w(%04X) = %08X\n", offset, data);
+ if (LOG_CMDFIFO_VERBOSE) vd->logerror("CMDFIFO_w(%04X) = %08X\n", offset, data);
/* write the data */
if (addr < f->end)
@@ -1993,7 +2020,7 @@ void voodoo_device::cmdfifo_w(voodoo_device *vd, cmdfifo_info *f, offs_t offset,
else if (addr < f->amin)
{
if (f->holes != 0)
- vd->device->logerror("Unexpected CMDFIFO: AMin=%08X AMax=%08X Holes=%d WroteTo:%08X\n",
+ vd->logerror("Unexpected CMDFIFO: AMin=%08X AMax=%08X Holes=%d WroteTo:%08X\n",
f->amin, f->amax, f->holes, addr);
//f->amin = f->amax = addr;
f->holes += (addr - f->base) / 4;
@@ -2025,14 +2052,14 @@ void voodoo_device::cmdfifo_w(voodoo_device *vd, cmdfifo_info *f, offs_t offset,
/* execute if we can */
if (!vd->pci.op_pending)
{
- int32_t cycles = cmdfifo_execute_if_ready(vd, f);
+ int32_t cycles = vd->cmdfifo_execute_if_ready(*f);
if (cycles > 0)
{
vd->pci.op_pending = true;
- vd->pci.op_end_time = vd->device->machine().time() + attotime(0, (attoseconds_t)cycles * vd->attoseconds_per_cycle);
+ vd->pci.op_end_time = vd->machine().time() + attotime(0, (attoseconds_t)cycles * vd->attoseconds_per_cycle);
- if (LOG_FIFO_VERBOSE) vd->device->logerror("VOODOO.%d.FIFO:direct write start at %d.%08X%08X end at %d.%08X%08X\n", vd->index,
- vd->device->machine().time().seconds(), (uint32_t)(vd->device->machine().time().attoseconds() >> 32), (uint32_t)vd->device->machine().time().attoseconds(),
+ if (LOG_FIFO_VERBOSE) vd->logerror("VOODOO.%d.FIFO:direct write start at %d.%08X%08X end at %d.%08X%08X\n", vd->index,
+ vd->machine().time().seconds(), (uint32_t)(vd->machine().time().attoseconds() >> 32), (uint32_t)vd->machine().time().attoseconds(),
vd->pci.op_end_time.seconds(), (uint32_t)(vd->pci.op_end_time.attoseconds() >> 32), (uint32_t)vd->pci.op_end_time.attoseconds());
}
}
@@ -2067,10 +2094,10 @@ void voodoo_device::check_stalled_cpu(voodoo_device* vd, attotime current_time)
/* if there's room in the memory FIFO now, we can proceed */
if (FBIINIT0_ENABLE_MEMORY_FIFO(vd->reg[fbiInit0].u))
{
- if (fifo_items(&vd->fbi.fifo) < 2 * 32 * FBIINIT0_MEMORY_FIFO_HWM(vd->reg[fbiInit0].u))
+ if (vd->fbi.fifo.items() < 2 * 32 * FBIINIT0_MEMORY_FIFO_HWM(vd->reg[fbiInit0].u))
resume = true;
}
- else if (fifo_space(&vd->pci.fifo) > 2 * FBIINIT0_PCI_FIFO_LWM(vd->reg[fbiInit0].u))
+ else if (vd->pci.fifo.space() > 2 * FBIINIT0_PCI_FIFO_LWM(vd->reg[fbiInit0].u))
resume = true;
}
@@ -2079,24 +2106,24 @@ void voodoo_device::check_stalled_cpu(voodoo_device* vd, attotime current_time)
{
if (FBIINIT0_ENABLE_MEMORY_FIFO(vd->reg[fbiInit0].u))
{
- if (fifo_empty(&vd->fbi.fifo) && fifo_empty(&vd->pci.fifo))
+ if (vd->fbi.fifo.empty() && vd->pci.fifo.empty())
resume = true;
}
- else if (fifo_empty(&vd->pci.fifo))
+ else if (vd->pci.fifo.empty())
resume = true;
}
/* resume if necessary */
if (resume || !vd->pci.op_pending)
{
- if (LOG_FIFO) vd->device->logerror("VOODOO.%d.FIFO:Stall condition cleared; resuming\n", vd->index);
+ if (LOG_FIFO) vd->logerror("VOODOO.%d.FIFO:Stall condition cleared; resuming\n", vd->index);
vd->pci.stall_state = NOT_STALLED;
/* either call the callback, or trigger the trigger */
- if (!vd->device->m_stall.isnull())
- vd->device->m_stall(false);
+ if (!vd->m_stall.isnull())
+ vd->m_stall(false);
else
- vd->device->machine().scheduler().trigger(vd->trigger);
+ vd->machine().scheduler().trigger(vd->trigger);
}
/* if not, set a timer for the next one */
@@ -2117,8 +2144,8 @@ void voodoo_device::stall_cpu(voodoo_device *vd, int state, attotime current_tim
vd->stats.stalls++;
/* either call the callback, or spin the CPU */
- if (!vd->device->m_stall.isnull())
- vd->device->m_stall(true);
+ if (!vd->m_stall.isnull())
+ vd->m_stall(true);
else
vd->cpu->execute().spin_until_trigger(vd->trigger);
@@ -2160,7 +2187,7 @@ int32_t voodoo_device::register_w(voodoo_device *vd, offs_t offset, uint32_t dat
/* first make sure this register is readable */
if (!(vd->regaccess[regnum] & REGISTER_WRITE))
{
- vd->device->logerror("VOODOO.%d.ERROR:Invalid attempt to write %s\n", vd->index, vd->regnames[regnum]);
+ vd->logerror("VOODOO.%d.ERROR:Invalid attempt to write %s\n", vd->index, vd->regnames[regnum]);
return 0;
}
@@ -2453,7 +2480,7 @@ int32_t voodoo_device::register_w(voodoo_device *vd, offs_t offset, uint32_t dat
case nopCMD:
poly_wait(vd->poly, vd->regnames[regnum]);
if (data & 1)
- reset_counters(vd);
+ vd->reset_counters();
if (data & 2)
vd->reg[fbiTrianglesOut].u = 0;
break;
@@ -2475,8 +2502,8 @@ int32_t voodoo_device::register_w(voodoo_device *vd, offs_t offset, uint32_t dat
vd->reg[intrCtrl].u &= ~0x80000000;
// TODO: rename vblank_client for less confusion?
- if (!vd->device->m_vblank.isnull())
- vd->device->m_vblank(true);
+ if (!vd->m_vblank.isnull())
+ vd->m_vblank(true);
break;
/* gamma table access -- Voodoo/Voodoo2 only */
@@ -2494,7 +2521,7 @@ int32_t voodoo_device::register_w(voodoo_device *vd, offs_t offset, uint32_t dat
}
}
else
- vd->device->logerror("clutData ignored because video timing reset = 1\n");
+ vd->logerror("clutData ignored because video timing reset = 1\n");
}
break;
@@ -2504,9 +2531,9 @@ int32_t voodoo_device::register_w(voodoo_device *vd, offs_t offset, uint32_t dat
{
poly_wait(vd->poly, vd->regnames[regnum]);
if (!(data & 0x800))
- dacdata_w(&vd->dac, (data >> 8) & 7, data & 0xff);
+ vd->dac.data_w((data >> 8) & 7, data & 0xff);
else
- dacdata_r(&vd->dac, (data >> 8) & 7);
+ vd->dac.data_r((data >> 8) & 7);
}
break;
@@ -2611,9 +2638,9 @@ int32_t voodoo_device::register_w(voodoo_device *vd, offs_t offset, uint32_t dat
{
vd->reg[fbiInit0].u = data;
if (FBIINIT0_GRAPHICS_RESET(data))
- soft_reset(vd);
+ vd->soft_reset();
if (FBIINIT0_FIFO_RESET(data))
- fifo_reset(&vd->pci.fifo);
+ vd->pci.fifo.reset();
recompute_video_memory(vd);
}
break;
@@ -2744,8 +2771,8 @@ int32_t voodoo_device::register_w(voodoo_device *vd, offs_t offset, uint32_t dat
case nccTable+10:
case nccTable+11:
poly_wait(vd->poly, vd->regnames[regnum]);
- if (chips & 2) ncc_table_write(&vd->tmu[0].ncc[0], regnum - nccTable, data);
- if (chips & 4) ncc_table_write(&vd->tmu[1].ncc[0], regnum - nccTable, data);
+ if (chips & 2) vd->tmu[0].ncc[0].write(regnum - nccTable, data);
+ if (chips & 4) vd->tmu[1].ncc[0].write(regnum - nccTable, data);
break;
case nccTable+12:
@@ -2761,8 +2788,8 @@ int32_t voodoo_device::register_w(voodoo_device *vd, offs_t offset, uint32_t dat
case nccTable+22:
case nccTable+23:
poly_wait(vd->poly, vd->regnames[regnum]);
- if (chips & 2) ncc_table_write(&vd->tmu[0].ncc[1], regnum - (nccTable+12), data);
- if (chips & 4) ncc_table_write(&vd->tmu[1].ncc[1], regnum - (nccTable+12), data);
+ if (chips & 2) vd->tmu[0].ncc[1].write(regnum - (nccTable+12), data);
+ if (chips & 4) vd->tmu[1].ncc[1].write(regnum - (nccTable+12), data);
break;
/* fogTable entries are processed and expanded immediately */
@@ -2862,9 +2889,9 @@ default_case:
if (LOG_REGISTERS)
{
if (regnum < fvertexAx || regnum > fdWdY)
- vd->device->logerror("VOODOO.%d.REG:%s(%d) write = %08X\n", vd->index, (regnum < 0x384/4) ? vd->regnames[regnum] : "oob", chips, origdata);
+ vd->logerror("VOODOO.%d.REG:%s(%d) write = %08X\n", vd->index, (regnum < 0x384/4) ? vd->regnames[regnum] : "oob", chips, origdata);
else
- vd->device->logerror("VOODOO.%d.REG:%s(%d) write = %f\n", vd->index, (regnum < 0x384/4) ? vd->regnames[regnum] : "oob", chips, (double) u2f(origdata));
+ vd->logerror("VOODOO.%d.REG:%s(%d) write = %f\n", vd->index, (regnum < 0x384/4) ? vd->regnames[regnum] : "oob", chips, (double) u2f(origdata));
}
return cycles;
@@ -2911,14 +2938,14 @@ int32_t voodoo_device::lfb_direct_w(voodoo_device *vd, offs_t offset, uint32_t d
destmax = (vd->fbi.mask + 1 - vd->fbi.lfb_base*4) / 2;
bufoffs = y * vd->fbi.rowpixels + x;
if (bufoffs >= destmax) {
- vd->device->logerror("lfb_direct_w: Buffer offset out of bounds x=%i y=%i offset=%08X bufoffs=%08X data=%08X\n", x, y, offset, (uint32_t) bufoffs, data);
+ vd->logerror("lfb_direct_w: Buffer offset out of bounds x=%i y=%i offset=%08X bufoffs=%08X data=%08X\n", x, y, offset, (uint32_t) bufoffs, data);
return 0;
}
if (ACCESSING_BITS_0_15)
dest[bufoffs + 0] = data&0xffff;
if (ACCESSING_BITS_16_31)
dest[bufoffs + 1] = data>>16;
- if (LOG_LFB) vd->device->logerror("VOODOO.%d.LFB:write direct (%d,%d) = %08X & %08X\n", vd->index, x, y, data, mem_mask);
+ if (LOG_LFB) vd->logerror("VOODOO.%d.LFB:write direct (%d,%d) = %08X & %08X\n", vd->index, x, y, data, mem_mask);
return 0;
}
@@ -3119,7 +3146,7 @@ int32_t voodoo_device::lfb_w(voodoo_device* vd, offs_t offset, uint32_t data, ui
break;
default: /* reserved */
- vd->device->logerror("lfb_w: Unknown format\n");
+ vd->logerror("lfb_w: Unknown format\n");
return 0;
}
@@ -3160,7 +3187,7 @@ int32_t voodoo_device::lfb_w(voodoo_device* vd, offs_t offset, uint32_t data, ui
DECLARE_DITHER_POINTERS_NO_DITHER_VAR;
uint32_t bufoffs;
- if (LOG_LFB) vd->device->logerror("VOODOO.%d.LFB:write raw mode %X (%d,%d) = %08X & %08X\n", vd->index, LFBMODE_WRITE_FORMAT(vd->reg[lfbMode].u), x, y, data, mem_mask);
+ if (LOG_LFB) vd->logerror("VOODOO.%d.LFB:write raw mode %X (%d,%d) = %08X & %08X\n", vd->index, LFBMODE_WRITE_FORMAT(vd->reg[lfbMode].u), x, y, data, mem_mask);
/* determine the screen Y */
scry = y;
@@ -3218,7 +3245,7 @@ int32_t voodoo_device::lfb_w(voodoo_device* vd, offs_t offset, uint32_t data, ui
{
DECLARE_DITHER_POINTERS;
- if (LOG_LFB) vd->device->logerror("VOODOO.%d.LFB:write pipelined mode %X (%d,%d) = %08X & %08X\n", vd->index, LFBMODE_WRITE_FORMAT(vd->reg[lfbMode].u), x, y, data, mem_mask);
+ if (LOG_LFB) vd->logerror("VOODOO.%d.LFB:write pipelined mode %X (%d,%d) = %08X & %08X\n", vd->index, LFBMODE_WRITE_FORMAT(vd->reg[lfbMode].u), x, y, data, mem_mask);
/* determine the screen Y */
scry = y;
@@ -3374,7 +3401,7 @@ int32_t voodoo_device::texture_w(voodoo_device *vd, offs_t offset, uint32_t data
/* update texture info if dirty */
if (t->regdirty)
- recompute_texture_params(t);
+ t->recompute_texture_params();
/* swizzle the data */
if (TEXLOD_TDATA_SWIZZLE(t->reg[tLOD].u))
@@ -3410,13 +3437,13 @@ int32_t voodoo_device::texture_w(voodoo_device *vd, offs_t offset, uint32_t data
tbaseaddr = t->lodoffset[lod];
tbaseaddr += tt * ((t->wmask >> lod) + 1) + ts;
- if (LOG_TEXTURE_RAM) vd->device->logerror("Texture 8-bit w: lod=%d s=%d t=%d data=%08X\n", lod, ts, tt, data);
+ if (LOG_TEXTURE_RAM) vd->logerror("Texture 8-bit w: lod=%d s=%d t=%d data=%08X\n", lod, ts, tt, data);
}
else
{
tbaseaddr = t->lodoffset[0] + offset*4;
- if (LOG_TEXTURE_RAM) vd->device->logerror("Texture 8-bit w: offset=%X data=%08X\n", offset*4, data);
+ if (LOG_TEXTURE_RAM) vd->logerror("Texture 8-bit w: offset=%X data=%08X\n", offset*4, data);
}
/* write the four bytes in little-endian order */
@@ -3450,13 +3477,13 @@ int32_t voodoo_device::texture_w(voodoo_device *vd, offs_t offset, uint32_t data
tbaseaddr = t->lodoffset[lod];
tbaseaddr += 2 * (tt * ((t->wmask >> lod) + 1) + ts);
- if (LOG_TEXTURE_RAM) vd->device->logerror("Texture 16-bit w: lod=%d s=%d t=%d data=%08X\n", lod, ts, tt, data);
+ if (LOG_TEXTURE_RAM) vd->logerror("Texture 16-bit w: lod=%d s=%d t=%d data=%08X\n", lod, ts, tt, data);
}
else
{
tbaseaddr = t->lodoffset[0] + offset*4;
- if (LOG_TEXTURE_RAM) vd->device->logerror("Texture 16-bit w: offset=%X data=%08X\n", offset*4, data);
+ if (LOG_TEXTURE_RAM) vd->logerror("Texture 16-bit w: offset=%X data=%08X\n", offset*4, data);
}
/* write the two words in little-endian order */
@@ -3489,7 +3516,7 @@ void voodoo_device::flush_fifos(voodoo_device *vd, attotime current_time)
if (!vd->pci.op_pending) fatalerror("flush_fifos called with no pending operation\n");
- if (LOG_FIFO_VERBOSE) vd->device->logerror("VOODOO.%d.FIFO:flush_fifos start -- pending=%d.%08X%08X cur=%d.%08X%08X\n", vd->index,
+ if (LOG_FIFO_VERBOSE) vd->logerror("VOODOO.%d.FIFO:flush_fifos start -- pending=%d.%08X%08X cur=%d.%08X%08X\n", vd->index,
vd->pci.op_end_time.seconds(), (uint32_t)(vd->pci.op_end_time.attoseconds() >> 32), (uint32_t)vd->pci.op_end_time.attoseconds(),
current_time.seconds(), (uint32_t)(current_time.attoseconds() >> 32), (uint32_t)current_time.attoseconds());
@@ -3510,24 +3537,24 @@ void voodoo_device::flush_fifos(voodoo_device *vd, attotime current_time)
if (vd->fbi.cmdfifo[0].enable)
{
/* if we don't have anything to execute, we're done for now */
- cycles = cmdfifo_execute_if_ready(vd, &vd->fbi.cmdfifo[0]);
+ cycles = vd->cmdfifo_execute_if_ready(vd->fbi.cmdfifo[0]);
if (cycles == -1)
{
vd->pci.op_pending = false;
in_flush = false;
- if (LOG_FIFO_VERBOSE) vd->device->logerror("VOODOO.%d.FIFO:flush_fifos end -- CMDFIFO empty\n", vd->index);
+ if (LOG_FIFO_VERBOSE) vd->logerror("VOODOO.%d.FIFO:flush_fifos end -- CMDFIFO empty\n", vd->index);
return;
}
}
else if (vd->fbi.cmdfifo[1].enable)
{
/* if we don't have anything to execute, we're done for now */
- cycles = cmdfifo_execute_if_ready(vd, &vd->fbi.cmdfifo[1]);
+ cycles = vd->cmdfifo_execute_if_ready(vd->fbi.cmdfifo[1]);
if (cycles == -1)
{
vd->pci.op_pending = false;
in_flush = false;
- if (LOG_FIFO_VERBOSE) vd->device->logerror("VOODOO.%d.FIFO:flush_fifos end -- CMDFIFO empty\n", vd->index);
+ if (LOG_FIFO_VERBOSE) vd->logerror("VOODOO.%d.FIFO:flush_fifos end -- CMDFIFO empty\n", vd->index);
return;
}
}
@@ -3536,21 +3563,21 @@ void voodoo_device::flush_fifos(voodoo_device *vd, attotime current_time)
else
{
/* choose which FIFO to read from */
- if (!fifo_empty(&vd->fbi.fifo))
+ if (!vd->fbi.fifo.empty())
fifo = &vd->fbi.fifo;
- else if (!fifo_empty(&vd->pci.fifo))
+ else if (!vd->pci.fifo.empty())
fifo = &vd->pci.fifo;
else
{
vd->pci.op_pending = false;
in_flush = false;
- if (LOG_FIFO_VERBOSE) vd->device->logerror("VOODOO.%d.FIFO:flush_fifos end -- FIFOs empty\n", vd->index);
+ if (LOG_FIFO_VERBOSE) vd->logerror("VOODOO.%d.FIFO:flush_fifos end -- FIFOs empty\n", vd->index);
return;
}
/* extract address and data */
- address = fifo_remove(fifo);
- data = fifo_remove(fifo);
+ address = fifo->remove();
+ data = fifo->remove();
/* target the appropriate location */
if ((address & (0xc00000/4)) == 0)
@@ -3587,12 +3614,12 @@ void voodoo_device::flush_fifos(voodoo_device *vd, attotime current_time)
/* account for those cycles */
vd->pci.op_end_time += attotime(0, (attoseconds_t)cycles * vd->attoseconds_per_cycle);
- if (LOG_FIFO_VERBOSE) vd->device->logerror("VOODOO.%d.FIFO:update -- pending=%d.%08X%08X cur=%d.%08X%08X\n", vd->index,
+ if (LOG_FIFO_VERBOSE) vd->logerror("VOODOO.%d.FIFO:update -- pending=%d.%08X%08X cur=%d.%08X%08X\n", vd->index,
vd->pci.op_end_time.seconds(), (uint32_t)(vd->pci.op_end_time.attoseconds() >> 32), (uint32_t)vd->pci.op_end_time.attoseconds(),
current_time.seconds(), (uint32_t)(current_time.attoseconds() >> 32), (uint32_t)current_time.attoseconds());
}
- if (LOG_FIFO_VERBOSE) vd->device->logerror("VOODOO.%d.FIFO:flush_fifos end -- pending command complete at %d.%08X%08X\n", vd->index,
+ if (LOG_FIFO_VERBOSE) vd->logerror("VOODOO.%d.FIFO:flush_fifos end -- pending command complete at %d.%08X%08X\n", vd->index,
vd->pci.op_end_time.seconds(), (uint32_t)(vd->pci.op_end_time.attoseconds() >> 32), (uint32_t)vd->pci.op_end_time.attoseconds());
in_flush = false;
@@ -3723,17 +3750,17 @@ WRITE32_MEMBER( voodoo_device::voodoo_w )
/* if there's room in the PCI FIFO, add there */
if (LOG_FIFO_VERBOSE) logerror("VOODOO.%d.FIFO:voodoo_w adding to PCI FIFO @ %08X=%08X\n", this, offset, data);
- if (!fifo_full(&pci.fifo))
+ if (!pci.fifo.full())
{
- fifo_add(&pci.fifo, offset);
- fifo_add(&pci.fifo, data);
+ pci.fifo.add(offset);
+ pci.fifo.add(data);
}
else
fatalerror("PCI FIFO full\n");
/* handle flushing to the memory FIFO */
if (FBIINIT0_ENABLE_MEMORY_FIFO(reg[fbiInit0].u) &&
- fifo_space(&pci.fifo) <= 2 * FBIINIT4_MEMORY_FIFO_LWM(reg[fbiInit4].u))
+ pci.fifo.space() <= 2 * FBIINIT4_MEMORY_FIFO_LWM(reg[fbiInit4].u))
{
uint8_t valid[4];
@@ -3744,15 +3771,15 @@ WRITE32_MEMBER( voodoo_device::voodoo_w )
/* flush everything we can */
if (LOG_FIFO_VERBOSE) logerror("VOODOO.%d.FIFO:voodoo_w moving PCI FIFO to memory FIFO\n", index);
- while (!fifo_empty(&pci.fifo) && valid[(fifo_peek(&pci.fifo) >> 22) & 3])
+ while (!pci.fifo.empty() && valid[(pci.fifo.peek() >> 22) & 3])
{
- fifo_add(&fbi.fifo, fifo_remove(&pci.fifo));
- fifo_add(&fbi.fifo, fifo_remove(&pci.fifo));
+ fbi.fifo.add(pci.fifo.remove());
+ fbi.fifo.add(pci.fifo.remove());
}
/* if we're above the HWM as a result, stall */
if (FBIINIT0_STALL_PCIE_FOR_HWM(reg[fbiInit0].u) &&
- fifo_items(&fbi.fifo) >= 2 * 32 * FBIINIT0_MEMORY_FIFO_HWM(reg[fbiInit0].u))
+ fbi.fifo.items() >= 2 * 32 * FBIINIT0_MEMORY_FIFO_HWM(reg[fbiInit0].u))
{
if (LOG_FIFO) logerror("VOODOO.%d.FIFO:voodoo_w hit memory FIFO HWM -- stalling\n", index);
stall_cpu(this, STALLED_UNTIL_FIFO_LWM, machine().time());
@@ -3761,7 +3788,7 @@ WRITE32_MEMBER( voodoo_device::voodoo_w )
/* if we're at the LWM for the PCI FIFO, stall */
if (FBIINIT0_STALL_PCIE_FOR_HWM(reg[fbiInit0].u) &&
- fifo_space(&pci.fifo) <= 2 * FBIINIT0_PCI_FIFO_LWM(reg[fbiInit0].u))
+ pci.fifo.space() <= 2 * FBIINIT0_PCI_FIFO_LWM(reg[fbiInit0].u))
{
if (LOG_FIFO) logerror("VOODOO.%d.FIFO:voodoo_w hit PCI FIFO free LWM -- stalling\n", index);
stall_cpu(this, STALLED_UNTIL_FIFO_LWM, machine().time());
@@ -3785,7 +3812,7 @@ WRITE32_MEMBER( voodoo_device::voodoo_w )
*
*************************************/
-static uint32_t register_r(voodoo_device *vd, offs_t offset)
+uint32_t voodoo_device::register_r(voodoo_device *vd, offs_t offset)
{
int regnum = offset & 0xff;
uint32_t result;
@@ -3796,7 +3823,7 @@ static uint32_t register_r(voodoo_device *vd, offs_t offset)
/* first make sure this register is readable */
if (!(vd->regaccess[regnum] & REGISTER_READ))
{
- vd->device->logerror("VOODOO.%d.ERROR:Invalid attempt to read %s\n", vd->index, regnum < 225 ? vd->regnames[regnum] : "unknown register");
+ vd->logerror("VOODOO.%d.ERROR:Invalid attempt to read %s\n", vd->index, regnum < 225 ? vd->regnames[regnum] : "unknown register");
return 0xffffffff;
}
@@ -3812,11 +3839,11 @@ static uint32_t register_r(voodoo_device *vd, offs_t offset)
result = 0;
/* bits 5:0 are the PCI FIFO free space */
- if (fifo_empty(&vd->pci.fifo))
+ if (vd->pci.fifo.empty())
result |= 0x3f << 0;
else
{
- int temp = fifo_space(&vd->pci.fifo)/2;
+ int temp = vd->pci.fifo.space()/2;
if (temp > 0x3f)
temp = 0x3f;
result |= temp << 0;
@@ -3844,11 +3871,11 @@ static uint32_t register_r(voodoo_device *vd, offs_t offset)
result |= vd->fbi.frontbuf << 10;
/* bits 27:12 indicate memory FIFO freespace */
- if (!FBIINIT0_ENABLE_MEMORY_FIFO(vd->reg[fbiInit0].u) || fifo_empty(&vd->fbi.fifo))
+ if (!FBIINIT0_ENABLE_MEMORY_FIFO(vd->reg[fbiInit0].u) || vd->fbi.fifo.empty())
result |= 0xffff << 12;
else
{
- int temp = fifo_space(&vd->fbi.fifo)/2;
+ int temp = vd->fbi.fifo.space()/2;
if (temp > 0xffff)
temp = 0xffff;
result |= temp << 12;
@@ -3929,7 +3956,7 @@ static uint32_t register_r(voodoo_device *vd, offs_t offset)
case fbiZfuncFail:
case fbiAfuncFail:
case fbiPixelsOut:
- update_statistics(vd, true);
+ vd->update_statistics(true);
case fbiTrianglesOut:
result = vd->reg[regnum].u & 0xffffff;
break;
@@ -3952,7 +3979,7 @@ static uint32_t register_r(voodoo_device *vd, offs_t offset)
logit = false;
if (logit)
- vd->device->logerror("VOODOO.%d.REG:%s read = %08X\n", vd->index, vd->regnames[regnum], result);
+ vd->logerror("VOODOO.%d.REG:%s read = %08X\n", vd->index, vd->regnames[regnum], result);
}
return result;
@@ -4023,7 +4050,7 @@ static uint32_t lfb_r(voodoo_device *vd, offs_t offset, bool lfb_3d)
/* advance pointers to the proper row */
bufoffs = scry * vd->fbi.rowpixels + x;
if (bufoffs >= bufmax) {
- vd->device->logerror("LFB_R: Buffer offset out of bounds x=%i y=%i lfb_3d=%i offset=%08X bufoffs=%08X\n", x, y, lfb_3d, offset, (uint32_t) bufoffs);
+ vd->logerror("LFB_R: Buffer offset out of bounds x=%i y=%i lfb_3d=%i offset=%08X bufoffs=%08X\n", x, y, lfb_3d, offset, (uint32_t) bufoffs);
return 0xffffffff;
}
@@ -4041,7 +4068,7 @@ static uint32_t lfb_r(voodoo_device *vd, offs_t offset, bool lfb_3d)
if (LFBMODE_BYTE_SWIZZLE_READS(vd->reg[lfbMode].u))
data = flipendian_int32(data);
- if (LOG_LFB) vd->device->logerror("VOODOO.%d.LFB:read (%d,%d) = %08X\n", vd->index, x, y, data);
+ if (LOG_LFB) vd->logerror("VOODOO.%d.LFB:read (%d,%d) = %08X\n", vd->index, x, y, data);
return data;
}
@@ -4133,7 +4160,7 @@ READ32_MEMBER( voodoo_banshee_device::banshee_agp_r )
}
if (LOG_REGISTERS)
- logerror("%s:banshee_r(AGP:%s)\n", device->machine().describe_context(), banshee_agp_reg_name[offset]);
+ logerror("%s:banshee_r(AGP:%s)\n", machine().describe_context(), banshee_agp_reg_name[offset]);
return result;
}
@@ -4936,14 +4963,12 @@ void voodoo_device::common_start_voodoo(uint8_t type)
assert(m_cputag != nullptr);
assert(m_fbmem > 0);
- /* store a pointer back to the device */
- device = this;
vd_type = type;
/* copy config data */
freq = clock();
- device->m_vblank.resolve();
- device->m_stall.resolve();
+ m_vblank.resolve();
+ m_stall.resolve();
/* create a multiprocessor work queue */
poly = poly_alloc(machine(), 64, sizeof(poly_extra_data), 0);
@@ -5071,7 +5096,7 @@ void voodoo_device::common_start_voodoo(uint8_t type)
init_fbi(this, &fbi, fbmem, m_fbmem << 20);
/* build shared TMU tables */
- init_tmu_shared(&tmushare);
+ tmushare.init();
/* set up the TMUs */
init_tmu(this, &tmu[0], &reg[0x100], tmumem[0], tmumem0 << 20);
@@ -5103,7 +5128,7 @@ void voodoo_device::common_start_voodoo(uint8_t type)
banshee.io[io_tmuGbeInit] = 0x00000bfb;
/* do a soft reset to reset everything else */
- soft_reset(this);
+ soft_reset();
/* register for save states */
init_save_state(this);
@@ -5184,7 +5209,7 @@ int32_t voodoo_device::fastfill(voodoo_device *vd)
poly_extra_data *extra = (poly_extra_data *)poly_get_extra_data(vd->poly);
int count = std::min(ey - y, int(ARRAY_LENGTH(extents)));
- extra->device= vd;
+ extra->device = vd;
memcpy(extra->dither, dithermatrix, sizeof(extra->dither));
pixels += poly_render_triangle_custom(vd->poly, drawbuf, global_cliprect, raster_fastfill, y, count, extents);
@@ -5306,7 +5331,7 @@ int32_t voodoo_device::triangle(voodoo_device *vd)
g_profiler.stop();
/* 1 pixel per clock, plus some setup time */
- if (LOG_REGISTERS) vd->device->logerror("cycles = %d\n", TRIANGLE_SETUP_CLOCKS + pixels);
+ if (LOG_REGISTERS) vd->logerror("cycles = %d\n", TRIANGLE_SETUP_CLOCKS + pixels);
return TRIANGLE_SETUP_CLOCKS + pixels;
}
@@ -5318,7 +5343,7 @@ int32_t voodoo_device::triangle(voodoo_device *vd)
int32_t voodoo_device::begin_triangle(voodoo_device *vd)
{
- setup_vertex *sv = &vd->fbi.svert[2];
+ fbi_state::setup_vertex *sv = &vd->fbi.svert[2];
/* extract all the data from registers */
sv->x = vd->reg[sVx].f;
@@ -5350,7 +5375,7 @@ int32_t voodoo_device::begin_triangle(voodoo_device *vd)
int32_t voodoo_device::draw_triangle(voodoo_device *vd)
{
- setup_vertex *sv = &vd->fbi.svert[2];
+ fbi_state::setup_vertex *sv = &vd->fbi.svert[2];
int cycles = 0;
/* for strip mode, shuffle vertex 1 down to 0 */
@@ -5577,7 +5602,7 @@ int32_t voodoo_device::triangle_create_work_item(voodoo_device* vd, uint16_t *dr
extra->ds0dy = vd->tmu[0].dsdy;
extra->dt0dy = vd->tmu[0].dtdy;
extra->dw0dy = vd->tmu[0].dwdy;
- extra->lodbase0 = prepare_tmu(&vd->tmu[0]);
+ extra->lodbase0 = vd->tmu[0].prepare();
vd->stats.texture_mode[TEXMODE_FORMAT(vd->tmu[0].reg[textureMode].u)]++;
/* fill in texture 1 parameters */
@@ -5592,7 +5617,7 @@ int32_t voodoo_device::triangle_create_work_item(voodoo_device* vd, uint16_t *dr
extra->ds1dy = vd->tmu[1].dsdy;
extra->dt1dy = vd->tmu[1].dtdy;
extra->dw1dy = vd->tmu[1].dwdy;
- extra->lodbase1 = prepare_tmu(&vd->tmu[1]);
+ extra->lodbase1 = vd->tmu[1].prepare();
vd->stats.texture_mode[TEXMODE_FORMAT(vd->tmu[1].reg[textureMode].u)]++;
}
}
@@ -5613,10 +5638,10 @@ int32_t voodoo_device::triangle_create_work_item(voodoo_device* vd, uint16_t *dr
hash table
-------------------------------------------------*/
-raster_info *voodoo_device::add_rasterizer(voodoo_device *vd, const raster_info *cinfo)
+voodoo_device::raster_info *voodoo_device::add_rasterizer(voodoo_device *vd, const raster_info *cinfo)
{
raster_info *info = &vd->rasterizer[vd->next_rasterizer++];
- int hash = compute_raster_hash(cinfo);
+ int hash = cinfo->compute_hash();
assert_always(vd->next_rasterizer <= MAX_RASTERIZERS, "Out of space for new rasterizers!");
@@ -5648,7 +5673,7 @@ raster_info *voodoo_device::add_rasterizer(voodoo_device *vd, const raster_info
it, creating a new one if necessary
-------------------------------------------------*/
-raster_info *voodoo_device::find_rasterizer(voodoo_device *vd, int texcount)
+voodoo_device::raster_info *voodoo_device::find_rasterizer(voodoo_device *vd, int texcount)
{
raster_info *info, *prev = nullptr;
raster_info curinfo;
@@ -5663,7 +5688,7 @@ raster_info *voodoo_device::find_rasterizer(voodoo_device *vd, int texcount)
curinfo.eff_tex_mode_1 = (texcount >= 2) ? normalize_tex_mode(vd->tmu[1].reg[textureMode].u) : 0xffffffff;
/* compute the hash */
- hash = compute_raster_hash(&curinfo);
+ hash = curinfo.compute_hash();
/* find the appropriate hash entry */
for (info = vd->raster_hash[hash]; info; prev = info, info = info->next)
@@ -5746,15 +5771,15 @@ void voodoo_device::dump_rasterizer_stats(voodoo_device *vd)
}
}
-voodoo_device::voodoo_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source)
- : device_t(mconfig, type, name, tag, owner, clock, shortname, source),
- m_fbmem(0),
- m_tmumem0(0),
- m_tmumem1(0),
- m_screen(nullptr),
- m_cputag(nullptr),
- m_vblank(*this),
- m_stall(*this)
+voodoo_device::voodoo_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
+ : device_t(mconfig, type, tag, owner, clock)
+ , m_fbmem(0)
+ , m_tmumem0(0)
+ , m_tmumem1(0)
+ , m_screen(nullptr)
+ , m_cputag(nullptr)
+ , m_vblank(*this)
+ , m_stall(*this)
{
}
@@ -5768,7 +5793,7 @@ voodoo_device::~voodoo_device()
void voodoo_device::device_reset()
{
- soft_reset(this);
+ soft_reset();
}
//-------------------------------------------------
@@ -5783,10 +5808,10 @@ void voodoo_device::device_stop()
}
-const device_type VOODOO_1 = device_creator<voodoo_1_device>;
+DEFINE_DEVICE_TYPE(VOODOO_1, voodoo_1_device, "voodoo_1", "3dfx Voodoo Graphics")
voodoo_1_device::voodoo_1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : voodoo_device(mconfig, VOODOO_1, "3dfx Voodoo Graphics", tag, owner, clock, "voodoo_1", __FILE__)
+ : voodoo_device(mconfig, VOODOO_1, tag, owner, clock)
{
}
@@ -5800,10 +5825,10 @@ void voodoo_1_device::device_start()
}
-const device_type VOODOO_2 = device_creator<voodoo_2_device>;
+DEFINE_DEVICE_TYPE(VOODOO_2, voodoo_2_device, "voodoo_2", "3dfx Voodoo 2")
voodoo_2_device::voodoo_2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : voodoo_device(mconfig, VOODOO_2, "3dfx Voodoo 2", tag, owner, clock, "voodoo_2", __FILE__)
+ : voodoo_device(mconfig, VOODOO_2, tag, owner, clock)
{
}
@@ -5817,15 +5842,15 @@ void voodoo_2_device::device_start()
}
-const device_type VOODOO_BANSHEE = device_creator<voodoo_banshee_device>;
+DEFINE_DEVICE_TYPE(VOODOO_BANSHEE, voodoo_banshee_device, "voodoo_banshee", "3dfx Voodoo Banshee")
voodoo_banshee_device::voodoo_banshee_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : voodoo_device(mconfig, VOODOO_BANSHEE, "3dfx Voodoo Banshee", tag, owner, clock, "voodoo_banshee", __FILE__)
+ : voodoo_banshee_device(mconfig, VOODOO_BANSHEE, tag, owner, clock)
{
}
-voodoo_banshee_device::voodoo_banshee_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source)
- : voodoo_device(mconfig, type, name, tag, owner, clock, shortname, source)
+voodoo_banshee_device::voodoo_banshee_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
+ : voodoo_device(mconfig, type, tag, owner, clock)
{
}
@@ -5839,10 +5864,10 @@ void voodoo_banshee_device::device_start()
}
-const device_type VOODOO_3 = device_creator<voodoo_3_device>;
+DEFINE_DEVICE_TYPE(VOODOO_3, voodoo_3_device, "voodoo_3", "3dfx Voodoo 3")
voodoo_3_device::voodoo_3_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : voodoo_banshee_device(mconfig, VOODOO_3, "3dfx Voodoo 3", tag, owner, clock, "voodoo_3", __FILE__)
+ : voodoo_banshee_device(mconfig, VOODOO_3, tag, owner, clock)
{
}
diff --git a/src/devices/video/voodoo.h b/src/devices/video/voodoo.h
index edce2e21adf..9d26986f4a0 100644
--- a/src/devices/video/voodoo.h
+++ b/src/devices/video/voodoo.h
@@ -8,14 +8,16 @@
***************************************************************************/
-#ifndef __VOODOO_H__
-#define __VOODOO_H__
-
-#include "video/polylgcy.h"
+#ifndef MAME_VIDEO_VOODOO_H
+#define MAME_VIDEO_VOODOO_H
#pragma once
+#include "video/polylgcy.h"
+#include "video/rgbutil.h"
+
+
/*************************************
*
* Misc. constants
@@ -1362,10 +1364,6 @@ static const uint8_t dither_matrix_2x2[16] =
-struct voodoo_state;
-struct poly_extra_data;
-class voodoo_device;
-
struct rgba
{
#ifdef LSB_FIRST
@@ -1386,317 +1384,6 @@ union voodoo_reg
-struct voodoo_stats
-{
- uint8_t lastkey; /* last key state */
- uint8_t display; /* display stats? */
- int32_t swaps; /* total swaps */
- int32_t stalls; /* total stalls */
- int32_t total_triangles; /* total triangles */
- int32_t total_pixels_in; /* total pixels in */
- int32_t total_pixels_out; /* total pixels out */
- int32_t total_chroma_fail; /* total chroma fail */
- int32_t total_zfunc_fail; /* total z func fail */
- int32_t total_afunc_fail; /* total a func fail */
- int32_t total_clipped; /* total clipped */
- int32_t total_stippled; /* total stippled */
- int32_t lfb_writes; /* LFB writes */
- int32_t lfb_reads; /* LFB reads */
- int32_t reg_writes; /* register writes */
- int32_t reg_reads; /* register reads */
- int32_t tex_writes; /* texture writes */
- int32_t texture_mode[16]; /* 16 different texture modes */
- uint8_t render_override; /* render override */
- char buffer[1024]; /* string */
-};
-
-
-/* note that this structure is an even 64 bytes long */
-struct stats_block
-{
- int32_t pixels_in; /* pixels in statistic */
- int32_t pixels_out; /* pixels out statistic */
- int32_t chroma_fail; /* chroma test fail statistic */
- int32_t zfunc_fail; /* z function test fail statistic */
- int32_t afunc_fail; /* alpha function test fail statistic */
- int32_t clip_fail; /* clipping fail statistic */
- int32_t stipple_count; /* stipple statistic */
- int32_t filler[64/4 - 7]; /* pad this structure to 64 bytes */
-};
-
-
-struct fifo_state
-{
- uint32_t * base; /* base of the FIFO */
- int32_t size; /* size of the FIFO */
- int32_t in; /* input pointer */
- int32_t out; /* output pointer */
-};
-
-
-struct cmdfifo_info
-{
- uint8_t enable; /* enabled? */
- uint8_t count_holes; /* count holes? */
- uint32_t base; /* base address in framebuffer RAM */
- uint32_t end; /* end address in framebuffer RAM */
- uint32_t rdptr; /* current read pointer */
- uint32_t amin; /* minimum address */
- uint32_t amax; /* maximum address */
- uint32_t depth; /* current depth */
- uint32_t holes; /* number of holes */
-};
-
-
-struct pci_state
-{
- fifo_state fifo; /* PCI FIFO */
- uint32_t init_enable; /* initEnable value */
- uint8_t stall_state; /* state of the system if we're stalled */
- uint8_t op_pending; /* true if an operation is pending */
- attotime op_end_time; /* time when the pending operation ends */
- emu_timer * continue_timer; /* timer to use to continue processing */
- uint32_t fifo_mem[64*2]; /* memory backing the PCI FIFO */
-};
-
-
-struct ncc_table
-{
- uint8_t dirty; /* is the texel lookup dirty? */
- voodoo_reg * reg; /* pointer to our registers */
- int32_t ir[4], ig[4], ib[4]; /* I values for R,G,B */
- int32_t qr[4], qg[4], qb[4]; /* Q values for R,G,B */
- int32_t y[16]; /* Y values */
- rgb_t * palette; /* pointer to associated RGB palette */
- rgb_t * palettea; /* pointer to associated ARGB palette */
- rgb_t texel[256]; /* texel lookup */
-};
-
-
-struct tmu_state
-{
- uint8_t * ram; /* pointer to our RAM */
- uint32_t mask; /* mask to apply to pointers */
- voodoo_reg * reg; /* pointer to our register base */
- uint32_t regdirty; /* true if the LOD/mode/base registers have changed */
-
- uint32_t texaddr_mask; /* mask for texture address */
- uint8_t texaddr_shift; /* shift for texture address */
-
- int64_t starts, startt; /* starting S,T (14.18) */
- int64_t startw; /* starting W (2.30) */
- int64_t dsdx, dtdx; /* delta S,T per X */
- int64_t dwdx; /* delta W per X */
- int64_t dsdy, dtdy; /* delta S,T per Y */
- int64_t dwdy; /* delta W per Y */
-
- int32_t lodmin, lodmax; /* min, max LOD values */
- int32_t lodbias; /* LOD bias */
- uint32_t lodmask; /* mask of available LODs */
- uint32_t lodoffset[9]; /* offset of texture base for each LOD */
- int32_t detailmax; /* detail clamp */
- int32_t detailbias; /* detail bias */
- uint8_t detailscale; /* detail scale */
-
- uint32_t wmask; /* mask for the current texture width */
- uint32_t hmask; /* mask for the current texture height */
-
- uint32_t bilinear_mask; /* mask for bilinear resolution (0xf0 for V1, 0xff for V2) */
-
- ncc_table ncc[2]; /* two NCC tables */
-
- rgb_t * lookup; /* currently selected lookup */
- rgb_t * texel[16]; /* texel lookups for each format */
-
- rgb_t palette[256]; /* palette lookup table */
- rgb_t palettea[256]; /* palette+alpha lookup table */
-};
-
-
-struct tmu_shared_state
-{
- rgb_t rgb332[256]; /* RGB 3-3-2 lookup table */
- rgb_t alpha8[256]; /* alpha 8-bit lookup table */
- rgb_t int8[256]; /* intensity 8-bit lookup table */
- rgb_t ai44[256]; /* alpha, intensity 4-4 lookup table */
-
- rgb_t rgb565[65536]; /* RGB 5-6-5 lookup table */
- rgb_t argb1555[65536]; /* ARGB 1-5-5-5 lookup table */
- rgb_t argb4444[65536]; /* ARGB 4-4-4-4 lookup table */
-};
-
-
-struct setup_vertex
-{
- float x, y; /* X, Y coordinates */
- float z, wb; /* Z and broadcast W values */
- float r, g, b, a; /* A, R, G, B values */
- float s0, t0, w0; /* W, S, T for TMU 0 */
- float s1, t1, w1; /* W, S, T for TMU 1 */
-};
-
-
-struct fbi_state
-{
- uint8_t * ram; /* pointer to frame buffer RAM */
- uint32_t mask; /* mask to apply to pointers */
- uint32_t rgboffs[3]; /* word offset to 3 RGB buffers */
- uint32_t auxoffs; /* word offset to 1 aux buffer */
-
- uint8_t frontbuf; /* front buffer index */
- uint8_t backbuf; /* back buffer index */
- uint8_t swaps_pending; /* number of pending swaps */
- uint8_t video_changed; /* did the frontbuffer video change? */
-
- uint32_t yorigin; /* Y origin subtract value */
- uint32_t lfb_base; /* base of LFB in memory */
- uint8_t lfb_stride; /* stride of LFB accesses in bits */
-
- uint32_t width; /* width of current frame buffer */
- uint32_t height; /* height of current frame buffer */
- uint32_t xoffs; /* horizontal offset (back porch) */
- uint32_t yoffs; /* vertical offset (back porch) */
- uint32_t vsyncscan; /* vertical sync scanline */
- uint32_t rowpixels; /* pixels per row */
- uint32_t tile_width; /* width of video tiles */
- uint32_t tile_height; /* height of video tiles */
- uint32_t x_tiles; /* number of tiles in the X direction */
-
- emu_timer * vblank_timer; /* VBLANK timer */
- uint8_t vblank; /* VBLANK state */
- uint8_t vblank_count; /* number of VBLANKs since last swap */
- uint8_t vblank_swap_pending; /* a swap is pending, waiting for a vblank */
- uint8_t vblank_swap; /* swap when we hit this count */
- uint8_t vblank_dont_swap; /* don't actually swap when we hit this point */
-
- /* triangle setup info */
- uint8_t cheating_allowed; /* allow cheating? */
- int32_t sign; /* triangle sign */
- int16_t ax, ay; /* vertex A x,y (12.4) */
- int16_t bx, by; /* vertex B x,y (12.4) */
- int16_t cx, cy; /* vertex C x,y (12.4) */
- int32_t startr, startg, startb, starta; /* starting R,G,B,A (12.12) */
- int32_t startz; /* starting Z (20.12) */
- int64_t startw; /* starting W (16.32) */
- int32_t drdx, dgdx, dbdx, dadx; /* delta R,G,B,A per X */
- int32_t dzdx; /* delta Z per X */
- int64_t dwdx; /* delta W per X */
- int32_t drdy, dgdy, dbdy, dady; /* delta R,G,B,A per Y */
- int32_t dzdy; /* delta Z per Y */
- int64_t dwdy; /* delta W per Y */
-
- stats_block lfb_stats; /* LFB-access statistics */
-
- uint8_t sverts; /* number of vertices ready */
- setup_vertex svert[3]; /* 3 setup vertices */
-
- fifo_state fifo; /* framebuffer memory fifo */
- cmdfifo_info cmdfifo[2]; /* command FIFOs */
-
- uint8_t fogblend[64]; /* 64-entry fog table */
- uint8_t fogdelta[64]; /* 64-entry fog table */
- uint8_t fogdelta_mask; /* mask for for delta (0xff for V1, 0xfc for V2) */
-
- rgb_t pen[65536]; /* mapping from pixels to pens */
- rgb_t clut[512]; /* clut gamma data */
- uint8_t clut_dirty; /* do we need to recompute? */
-};
-
-
-struct dac_state
-{
- uint8_t reg[8]; /* 8 registers */
- uint8_t read_result; /* pending read result */
-};
-
-
-struct raster_info
-{
- raster_info * next; /* pointer to next entry with the same hash */
- poly_draw_scanline_func callback; /* callback pointer */
- bool is_generic; /* true if this is one of the generic rasterizers */
- uint8_t display; /* display index */
- uint32_t hits; /* how many hits (pixels) we've used this for */
- uint32_t polys; /* how many polys we've used this for */
- uint32_t eff_color_path; /* effective fbzColorPath value */
- uint32_t eff_alpha_mode; /* effective alphaMode value */
- uint32_t eff_fog_mode; /* effective fogMode value */
- uint32_t eff_fbz_mode; /* effective fbzMode value */
- uint32_t eff_tex_mode_0; /* effective textureMode value for TMU #0 */
- uint32_t eff_tex_mode_1; /* effective textureMode value for TMU #1 */
- uint32_t hash;
-};
-
-
-struct poly_extra_data
-{
- voodoo_device * device;
- raster_info * info; /* pointer to rasterizer information */
-
- int16_t ax, ay; /* vertex A x,y (12.4) */
- int32_t startr, startg, startb, starta; /* starting R,G,B,A (12.12) */
- int32_t startz; /* starting Z (20.12) */
- int64_t startw; /* starting W (16.32) */
- int32_t drdx, dgdx, dbdx, dadx; /* delta R,G,B,A per X */
- int32_t dzdx; /* delta Z per X */
- int64_t dwdx; /* delta W per X */
- int32_t drdy, dgdy, dbdy, dady; /* delta R,G,B,A per Y */
- int32_t dzdy; /* delta Z per Y */
- int64_t dwdy; /* delta W per Y */
-
- int64_t starts0, startt0; /* starting S,T (14.18) */
- int64_t startw0; /* starting W (2.30) */
- int64_t ds0dx, dt0dx; /* delta S,T per X */
- int64_t dw0dx; /* delta W per X */
- int64_t ds0dy, dt0dy; /* delta S,T per Y */
- int64_t dw0dy; /* delta W per Y */
- int32_t lodbase0; /* used during rasterization */
-
- int64_t starts1, startt1; /* starting S,T (14.18) */
- int64_t startw1; /* starting W (2.30) */
- int64_t ds1dx, dt1dx; /* delta S,T per X */
- int64_t dw1dx; /* delta W per X */
- int64_t ds1dy, dt1dy; /* delta S,T per Y */
- int64_t dw1dy; /* delta W per Y */
- int32_t lodbase1; /* used during rasterization */
-
- uint16_t dither[16]; /* dither matrix, for fastfill */
-};
-
-
-struct banshee_info
-{
- uint32_t io[0x40]; /* I/O registers */
- uint32_t agp[0x80]; /* AGP registers */
- uint8_t vga[0x20]; /* VGA registers */
- uint8_t crtc[0x27]; /* VGA CRTC registers */
- uint8_t seq[0x05]; /* VGA sequencer registers */
- uint8_t gc[0x05]; /* VGA graphics controller registers */
- uint8_t att[0x15]; /* VGA attribute registers */
- uint8_t attff; /* VGA attribute flip-flop */
-
- uint32_t blt_regs[0x20]; /* 2D Blitter registers */
- uint32_t blt_dst_base;
- uint32_t blt_dst_x;
- uint32_t blt_dst_y;
- uint32_t blt_dst_width;
- uint32_t blt_dst_height;
- uint32_t blt_dst_stride;
- uint32_t blt_dst_bpp;
- uint32_t blt_cmd;
- uint32_t blt_src_base;
- uint32_t blt_src_x;
- uint32_t blt_src_y;
- uint32_t blt_src_width;
- uint32_t blt_src_height;
- uint32_t blt_src_stride;
- uint32_t blt_src_bpp;
-};
-
-
-typedef voodoo_reg rgb_union;
-
-
@@ -1746,23 +1433,19 @@ enum
FUNCTION PROTOTYPES
***************************************************************************/
-struct stats_block;
-
/* ----- device interface ----- */
class voodoo_device : public device_t
{
public:
- voodoo_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source);
~voodoo_device();
-
static void static_set_fbmem(device_t &device, int value) { downcast<voodoo_device &>(device).m_fbmem = value; }
static void static_set_tmumem(device_t &device, int value1, int value2) { downcast<voodoo_device &>(device).m_tmumem0 = value1; downcast<voodoo_device &>(device).m_tmumem1 = value2; }
static void static_set_screen_tag(device_t &device, const char *tag) { downcast<voodoo_device &>(device).m_screen = tag; }
static void static_set_cpu_tag(device_t &device, const char *tag) { downcast<voodoo_device &>(device).m_cputag = tag; }
- template<class _Object> static devcb_base &static_set_vblank_callback(device_t &device, _Object object) { return downcast<voodoo_device &>(device).m_vblank.set_callback(object); }
- template<class _Object> static devcb_base &static_set_stall_callback(device_t &device, _Object object) { return downcast<voodoo_device &>(device).m_stall.set_callback(object); }
+ template <class Object> static devcb_base &static_set_vblank_callback(device_t &device, Object &&cb) { return downcast<voodoo_device &>(device).m_vblank.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &static_set_stall_callback(device_t &device, Object &&cb) { return downcast<voodoo_device &>(device).m_stall.set_callback(std::forward<Object>(cb)); }
DECLARE_READ32_MEMBER( voodoo_r );
DECLARE_WRITE32_MEMBER( voodoo_w );
@@ -1789,6 +1472,314 @@ public:
int voodoo_is_stalled();
void voodoo_set_init_enable(uint32_t newval);
+protected:
+ voodoo_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
+
+ // device-level overrides
+ virtual void device_stop() override;
+ virtual void device_reset() override;
+
+
+ struct voodoo_stats
+ {
+ uint8_t lastkey; /* last key state */
+ uint8_t display; /* display stats? */
+ int32_t swaps; /* total swaps */
+ int32_t stalls; /* total stalls */
+ int32_t total_triangles; /* total triangles */
+ int32_t total_pixels_in; /* total pixels in */
+ int32_t total_pixels_out; /* total pixels out */
+ int32_t total_chroma_fail; /* total chroma fail */
+ int32_t total_zfunc_fail; /* total z func fail */
+ int32_t total_afunc_fail; /* total a func fail */
+ int32_t total_clipped; /* total clipped */
+ int32_t total_stippled; /* total stippled */
+ int32_t lfb_writes; /* LFB writes */
+ int32_t lfb_reads; /* LFB reads */
+ int32_t reg_writes; /* register writes */
+ int32_t reg_reads; /* register reads */
+ int32_t tex_writes; /* texture writes */
+ int32_t texture_mode[16]; /* 16 different texture modes */
+ uint8_t render_override; /* render override */
+ char buffer[1024]; /* string */
+ };
+
+
+ /* note that this structure is an even 64 bytes long */
+ struct stats_block
+ {
+ int32_t pixels_in; /* pixels in statistic */
+ int32_t pixels_out; /* pixels out statistic */
+ int32_t chroma_fail; /* chroma test fail statistic */
+ int32_t zfunc_fail; /* z function test fail statistic */
+ int32_t afunc_fail; /* alpha function test fail statistic */
+ int32_t clip_fail; /* clipping fail statistic */
+ int32_t stipple_count; /* stipple statistic */
+ int32_t filler[64/4 - 7]; /* pad this structure to 64 bytes */
+ };
+
+
+ struct fifo_state
+ {
+ void reset() { in = out = 0; }
+ void add(uint32_t data);
+ uint32_t remove();
+ uint32_t peek() { return base[out]; }
+ bool empty() const { return in == out; }
+ bool full() const { return ((in + 1) == out) || ((in == (size - 1)) && (out == 0)); }
+ int32_t items() const;
+ int32_t space() const { return size - 1 - items(); }
+
+ uint32_t * base; /* base of the FIFO */
+ int32_t size; /* size of the FIFO */
+ int32_t in; /* input pointer */
+ int32_t out; /* output pointer */
+ };
+
+
+ struct cmdfifo_info
+ {
+ uint8_t enable; /* enabled? */
+ uint8_t count_holes; /* count holes? */
+ uint32_t base; /* base address in framebuffer RAM */
+ uint32_t end; /* end address in framebuffer RAM */
+ uint32_t rdptr; /* current read pointer */
+ uint32_t amin; /* minimum address */
+ uint32_t amax; /* maximum address */
+ uint32_t depth; /* current depth */
+ uint32_t holes; /* number of holes */
+ };
+
+
+ struct pci_state
+ {
+ fifo_state fifo; /* PCI FIFO */
+ uint32_t init_enable; /* initEnable value */
+ uint8_t stall_state; /* state of the system if we're stalled */
+ uint8_t op_pending; /* true if an operation is pending */
+ attotime op_end_time; /* time when the pending operation ends */
+ emu_timer * continue_timer; /* timer to use to continue processing */
+ uint32_t fifo_mem[64*2]; /* memory backing the PCI FIFO */
+ };
+
+
+ struct tmu_state
+ {
+ void recompute_texture_params();
+ int32_t prepare();
+ rgbaint_t genTexture(int32_t x, const uint8_t *dither4, const uint32_t TEXMODE, rgb_t *LOOKUP, int32_t LODBASE, int64_t ITERS, int64_t ITERT, int64_t ITERW, int32_t &lod);
+ rgbaint_t combineTexture(const uint32_t TEXMODE, rgbaint_t c_local, rgbaint_t c_other, int32_t lod);
+
+ struct ncc_table
+ {
+ void write(offs_t regnum, uint32_t data);
+ void update();
+
+ uint8_t dirty; /* is the texel lookup dirty? */
+ voodoo_reg * reg; /* pointer to our registers */
+ int32_t ir[4], ig[4], ib[4]; /* I values for R,G,B */
+ int32_t qr[4], qg[4], qb[4]; /* Q values for R,G,B */
+ int32_t y[16]; /* Y values */
+ rgb_t * palette; /* pointer to associated RGB palette */
+ rgb_t * palettea; /* pointer to associated ARGB palette */
+ rgb_t texel[256]; /* texel lookup */
+ };
+
+ uint8_t * ram; /* pointer to our RAM */
+ uint32_t mask; /* mask to apply to pointers */
+ voodoo_reg * reg; /* pointer to our register base */
+ uint32_t regdirty; /* true if the LOD/mode/base registers have changed */
+
+ uint32_t texaddr_mask; /* mask for texture address */
+ uint8_t texaddr_shift; /* shift for texture address */
+
+ int64_t starts, startt; /* starting S,T (14.18) */
+ int64_t startw; /* starting W (2.30) */
+ int64_t dsdx, dtdx; /* delta S,T per X */
+ int64_t dwdx; /* delta W per X */
+ int64_t dsdy, dtdy; /* delta S,T per Y */
+ int64_t dwdy; /* delta W per Y */
+
+ int32_t lodmin, lodmax; /* min, max LOD values */
+ int32_t lodbias; /* LOD bias */
+ uint32_t lodmask; /* mask of available LODs */
+ uint32_t lodoffset[9]; /* offset of texture base for each LOD */
+ int32_t detailmax; /* detail clamp */
+ int32_t detailbias; /* detail bias */
+ uint8_t detailscale; /* detail scale */
+
+ uint32_t wmask; /* mask for the current texture width */
+ uint32_t hmask; /* mask for the current texture height */
+
+ uint32_t bilinear_mask; /* mask for bilinear resolution (0xf0 for V1, 0xff for V2) */
+
+ ncc_table ncc[2]; /* two NCC tables */
+
+ rgb_t * lookup; /* currently selected lookup */
+ rgb_t * texel[16]; /* texel lookups for each format */
+
+ rgb_t palette[256]; /* palette lookup table */
+ rgb_t palettea[256]; /* palette+alpha lookup table */
+ };
+
+
+ struct tmu_shared_state
+ {
+ void init();
+
+ rgb_t rgb332[256]; /* RGB 3-3-2 lookup table */
+ rgb_t alpha8[256]; /* alpha 8-bit lookup table */
+ rgb_t int8[256]; /* intensity 8-bit lookup table */
+ rgb_t ai44[256]; /* alpha, intensity 4-4 lookup table */
+
+ rgb_t rgb565[65536]; /* RGB 5-6-5 lookup table */
+ rgb_t argb1555[65536]; /* ARGB 1-5-5-5 lookup table */
+ rgb_t argb4444[65536]; /* ARGB 4-4-4-4 lookup table */
+ };
+
+
+ struct fbi_state
+ {
+ struct setup_vertex
+ {
+ float x, y; /* X, Y coordinates */
+ float z, wb; /* Z and broadcast W values */
+ float r, g, b, a; /* A, R, G, B values */
+ float s0, t0, w0; /* W, S, T for TMU 0 */
+ float s1, t1, w1; /* W, S, T for TMU 1 */
+ };
+
+ uint8_t * ram; /* pointer to frame buffer RAM */
+ uint32_t mask; /* mask to apply to pointers */
+ uint32_t rgboffs[3]; /* word offset to 3 RGB buffers */
+ uint32_t auxoffs; /* word offset to 1 aux buffer */
+
+ uint8_t frontbuf; /* front buffer index */
+ uint8_t backbuf; /* back buffer index */
+ uint8_t swaps_pending; /* number of pending swaps */
+ uint8_t video_changed; /* did the frontbuffer video change? */
+
+ uint32_t yorigin; /* Y origin subtract value */
+ uint32_t lfb_base; /* base of LFB in memory */
+ uint8_t lfb_stride; /* stride of LFB accesses in bits */
+
+ uint32_t width; /* width of current frame buffer */
+ uint32_t height; /* height of current frame buffer */
+ uint32_t xoffs; /* horizontal offset (back porch) */
+ uint32_t yoffs; /* vertical offset (back porch) */
+ uint32_t vsyncscan; /* vertical sync scanline */
+ uint32_t rowpixels; /* pixels per row */
+ uint32_t tile_width; /* width of video tiles */
+ uint32_t tile_height; /* height of video tiles */
+ uint32_t x_tiles; /* number of tiles in the X direction */
+
+ emu_timer * vblank_timer; /* VBLANK timer */
+ uint8_t vblank; /* VBLANK state */
+ uint8_t vblank_count; /* number of VBLANKs since last swap */
+ uint8_t vblank_swap_pending; /* a swap is pending, waiting for a vblank */
+ uint8_t vblank_swap; /* swap when we hit this count */
+ uint8_t vblank_dont_swap; /* don't actually swap when we hit this point */
+
+ /* triangle setup info */
+ uint8_t cheating_allowed; /* allow cheating? */
+ int32_t sign; /* triangle sign */
+ int16_t ax, ay; /* vertex A x,y (12.4) */
+ int16_t bx, by; /* vertex B x,y (12.4) */
+ int16_t cx, cy; /* vertex C x,y (12.4) */
+ int32_t startr, startg, startb, starta; /* starting R,G,B,A (12.12) */
+ int32_t startz; /* starting Z (20.12) */
+ int64_t startw; /* starting W (16.32) */
+ int32_t drdx, dgdx, dbdx, dadx; /* delta R,G,B,A per X */
+ int32_t dzdx; /* delta Z per X */
+ int64_t dwdx; /* delta W per X */
+ int32_t drdy, dgdy, dbdy, dady; /* delta R,G,B,A per Y */
+ int32_t dzdy; /* delta Z per Y */
+ int64_t dwdy; /* delta W per Y */
+
+ stats_block lfb_stats; /* LFB-access statistics */
+
+ uint8_t sverts; /* number of vertices ready */
+ setup_vertex svert[3]; /* 3 setup vertices */
+
+ fifo_state fifo; /* framebuffer memory fifo */
+ cmdfifo_info cmdfifo[2]; /* command FIFOs */
+
+ uint8_t fogblend[64]; /* 64-entry fog table */
+ uint8_t fogdelta[64]; /* 64-entry fog table */
+ uint8_t fogdelta_mask; /* mask for for delta (0xff for V1, 0xfc for V2) */
+
+ rgb_t pen[65536]; /* mapping from pixels to pens */
+ rgb_t clut[512]; /* clut gamma data */
+ uint8_t clut_dirty; /* do we need to recompute? */
+ };
+
+
+ struct dac_state
+ {
+ void data_w(uint8_t regum, uint8_t data);
+ void data_r(uint8_t regnum);
+
+ uint8_t reg[8]; /* 8 registers */
+ uint8_t read_result; /* pending read result */
+ };
+
+
+ struct raster_info
+ {
+ uint32_t compute_hash() const;
+
+ raster_info * next; /* pointer to next entry with the same hash */
+ poly_draw_scanline_func callback; /* callback pointer */
+ bool is_generic; /* true if this is one of the generic rasterizers */
+ uint8_t display; /* display index */
+ uint32_t hits; /* how many hits (pixels) we've used this for */
+ uint32_t polys; /* how many polys we've used this for */
+ uint32_t eff_color_path; /* effective fbzColorPath value */
+ uint32_t eff_alpha_mode; /* effective alphaMode value */
+ uint32_t eff_fog_mode; /* effective fogMode value */
+ uint32_t eff_fbz_mode; /* effective fbzMode value */
+ uint32_t eff_tex_mode_0; /* effective textureMode value for TMU #0 */
+ uint32_t eff_tex_mode_1; /* effective textureMode value for TMU #1 */
+ uint32_t hash;
+ };
+
+
+ struct poly_extra_data;
+
+
+ struct banshee_info
+ {
+ uint32_t io[0x40]; /* I/O registers */
+ uint32_t agp[0x80]; /* AGP registers */
+ uint8_t vga[0x20]; /* VGA registers */
+ uint8_t crtc[0x27]; /* VGA CRTC registers */
+ uint8_t seq[0x05]; /* VGA sequencer registers */
+ uint8_t gc[0x05]; /* VGA graphics controller registers */
+ uint8_t att[0x15]; /* VGA attribute registers */
+ uint8_t attff; /* VGA attribute flip-flop */
+
+ uint32_t blt_regs[0x20]; /* 2D Blitter registers */
+ uint32_t blt_dst_base;
+ uint32_t blt_dst_x;
+ uint32_t blt_dst_y;
+ uint32_t blt_dst_width;
+ uint32_t blt_dst_height;
+ uint32_t blt_dst_stride;
+ uint32_t blt_dst_bpp;
+ uint32_t blt_cmd;
+ uint32_t blt_src_base;
+ uint32_t blt_src_x;
+ uint32_t blt_src_y;
+ uint32_t blt_src_width;
+ uint32_t blt_src_height;
+ uint32_t blt_src_stride;
+ uint32_t blt_src_bpp;
+ };
+
+
+ static const raster_info predef_raster_table[];
+
+
// not all of these need to be static, review.
static void check_stalled_cpu(voodoo_device* vd, attotime current_time);
@@ -1802,7 +1793,7 @@ public:
static int32_t lfb_direct_w(voodoo_device *vd, offs_t offset, uint32_t data, uint32_t mem_mask);
static int32_t banshee_2d_w(voodoo_device *vd, offs_t offset, uint32_t data);
static void stall_cpu(voodoo_device *vd, int state, attotime current_time);
- static void soft_reset(voodoo_device *vd);
+ void soft_reset();
static void recompute_video_memory(voodoo_device *vd);
static int32_t fastfill(voodoo_device *vd);
static int32_t triangle(voodoo_device *vd);
@@ -1813,13 +1804,21 @@ public:
static raster_info *add_rasterizer(voodoo_device *vd, const raster_info *cinfo);
static raster_info *find_rasterizer(voodoo_device *vd, int texcount);
static void dump_rasterizer_stats(voodoo_device *vd);
- static void init_tmu_shared(tmu_shared_state *s);
+
+ void accumulate_statistics(const stats_block &block);
+ void update_statistics(bool accumulate);
+ void reset_counters();
+
+ static uint32_t register_r(voodoo_device *vd, offs_t offset);
static void swap_buffers(voodoo_device *vd);
+ int cmdfifo_compute_expected_depth(cmdfifo_info &f);
static uint32_t cmdfifo_execute(voodoo_device *vd, cmdfifo_info *f);
- static int32_t cmdfifo_execute_if_ready(voodoo_device* vd, cmdfifo_info *f);
+ int32_t cmdfifo_execute_if_ready(cmdfifo_info &f);
static void cmdfifo_w(voodoo_device *vd, cmdfifo_info *f, offs_t offset, uint32_t data);
+ static void init_save_state(voodoo_device *vd);
+
static void raster_fastfill(void *dest, int32_t scanline, const poly_extent *extent, const void *extradata, int threadid);
static void raster_generic_0tmu(void *dest, int32_t scanline, const poly_extent *extent, const void *extradata, int threadid);
static void raster_generic_1tmu(void *dest, int32_t scanline, const poly_extent *extent, const void *extradata, int threadid);
@@ -1833,16 +1832,15 @@ public:
#undef RASTERIZER_ENTRY
+ static bool chromaKeyTest(voodoo_device *vd, stats_block *stats, uint32_t fbzModeReg, rgbaint_t rgaIntColor);
+ static bool alphaMaskTest(stats_block *stats, uint32_t fbzModeReg, uint8_t alpha);
+ static bool alphaTest(voodoo_device *vd, stats_block *stats, uint32_t alphaModeReg, uint8_t alpha);
+ static bool depthTest(uint16_t zaColorReg, stats_block *stats, int32_t destDepth, uint32_t fbzModeReg, int32_t biasdepth);
+ static bool combineColor(voodoo_device *vd, stats_block *STATS, uint32_t FBZCOLORPATH, uint32_t FBZMODE, uint32_t ALPHAMODE, rgbaint_t TEXELARGB, int32_t ITERZ, int64_t ITERW, rgbaint_t &srcColor);
-
-protected:
- // device-level overrides
- virtual void device_stop() override;
- virtual void device_reset() override;
+// FIXME: this stuff should not be public
public:
- // voodoo_state
uint8_t index; /* index of board */
- voodoo_device *device; /* pointer to our containing device */
screen_device *screen; /* the screen we are acting on */
device_t *cpu; /* the CPU we interact with */
uint8_t vd_type; /* type of system */
@@ -1886,12 +1884,12 @@ class voodoo_1_device : public voodoo_device
{
public:
voodoo_1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
protected:
// device-level overrides
virtual void device_start() override;
};
-extern const device_type VOODOO_1;
class voodoo_2_device : public voodoo_device
{
@@ -1902,13 +1900,11 @@ protected:
virtual void device_start() override;
};
-extern const device_type VOODOO_2;
class voodoo_banshee_device : public voodoo_device
{
public:
voodoo_banshee_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- voodoo_banshee_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source);
DECLARE_READ32_MEMBER( banshee_r );
DECLARE_WRITE32_MEMBER( banshee_w );
@@ -1921,23 +1917,29 @@ public:
DECLARE_WRITE8_MEMBER(banshee_vga_w);
protected:
+ voodoo_banshee_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
+
// device-level overrides
virtual void device_start() override;
DECLARE_READ32_MEMBER( banshee_agp_r );
DECLARE_WRITE32_MEMBER( banshee_agp_w );
};
-extern const device_type VOODOO_BANSHEE;
class voodoo_3_device : public voodoo_banshee_device
{
public:
voodoo_3_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
protected:
// device-level overrides
virtual void device_start() override;
};
-extern const device_type VOODOO_3;
-#endif
+DECLARE_DEVICE_TYPE(VOODOO_1, voodoo_1_device)
+DECLARE_DEVICE_TYPE(VOODOO_2, voodoo_2_device)
+DECLARE_DEVICE_TYPE(VOODOO_BANSHEE, voodoo_banshee_device)
+DECLARE_DEVICE_TYPE(VOODOO_3, voodoo_3_device)
+
+#endif // MAME_VIDEO_VOODOO_H
diff --git a/src/devices/video/voodoo_pci.cpp b/src/devices/video/voodoo_pci.cpp
index acceeac50e7..883d92995a9 100644
--- a/src/devices/video/voodoo_pci.cpp
+++ b/src/devices/video/voodoo_pci.cpp
@@ -53,7 +53,7 @@ machine_config_constructor voodoo_pci_device::device_mconfig_additions() const
}
}
-const device_type VOODOO_PCI = device_creator<voodoo_pci_device>;
+DEFINE_DEVICE_TYPE(VOODOO_PCI, voodoo_pci_device, "voodoo_pci", "Voodoo PCI")
DEVICE_ADDRESS_MAP_START(config_map, 32, voodoo_pci_device)
AM_RANGE(0x40, 0x5f) AM_READWRITE (pcictrl_r, pcictrl_w)
@@ -78,7 +78,7 @@ DEVICE_ADDRESS_MAP_START(io_map, 32, voodoo_pci_device)
ADDRESS_MAP_END
voodoo_pci_device::voodoo_pci_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : pci_device(mconfig, VOODOO_PCI, "Voodoo PCI", tag, owner, clock, "voodoo_pci", __FILE__),
+ : pci_device(mconfig, VOODOO_PCI, tag, owner, clock),
m_voodoo(*this, "voodoo"), m_fbmem(2), m_tmumem0(0), m_tmumem1(0)
{
}
diff --git a/src/devices/video/voodoo_pci.h b/src/devices/video/voodoo_pci.h
index d7e2add7f1e..4b7a41afe2f 100644
--- a/src/devices/video/voodoo_pci.h
+++ b/src/devices/video/voodoo_pci.h
@@ -2,8 +2,10 @@
// copyright-holders:Ted Green
// 3dfx Voodoo Graphics SST-1/2 emulator.
-#ifndef VOODOO_PCI_H
-#define VOODOO_PCI_H
+#ifndef MAME_VIDEO_VOODOO_PCI_H
+#define MAME_VIDEO_VOODOO_PCI_H
+
+#pragma once
#include "machine/pci.h"
#include "voodoo.h"
@@ -47,7 +49,7 @@ protected:
private:
required_device<voodoo_device> m_voodoo;
- static int m_type;
+ static int m_type; // FIXME: all voodoo have to be the same? really?
int m_fbmem, m_tmumem0, m_tmumem1;
const char *m_cpu_tag;
@@ -58,6 +60,6 @@ private:
DECLARE_ADDRESS_MAP(io_map, 32);
};
-extern const device_type VOODOO_PCI;
+DECLARE_DEVICE_TYPE(VOODOO_PCI, voodoo_pci_device)
-#endif
+#endif // MAME_VIDEO_VOODOO_PCI_H
diff --git a/src/devices/video/zeus2.cpp b/src/devices/video/zeus2.cpp
index 5428e862cc3..1720d98f582 100644
--- a/src/devices/video/zeus2.cpp
+++ b/src/devices/video/zeus2.cpp
@@ -21,11 +21,11 @@ zeus2_renderer::zeus2_renderer(zeus2_device *state)
{
}
-const device_type ZEUS2 = device_creator<zeus2_device>;
+DEFINE_DEVICE_TYPE(ZEUS2, zeus2_device, "zeus2", "Midway Zeus2")
zeus2_device::zeus2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, ZEUS2, "Midway Zeus2", tag, owner, clock, "zeus2", __FILE__),
- m_vblank(*this), m_irq(*this), m_atlantis(0)
+ : device_t(mconfig, ZEUS2, tag, owner, clock)
+ , m_vblank(*this), m_irq(*this), m_atlantis(0)
{
}
diff --git a/src/devices/video/zeus2.h b/src/devices/video/zeus2.h
index 633245fa608..2998d6378d3 100644
--- a/src/devices/video/zeus2.h
+++ b/src/devices/video/zeus2.h
@@ -5,15 +5,15 @@
Midway Zeus2 Video
**************************************************************************/
-#ifndef __ZEUS2_H__
-#define __ZEUS2_H__
+#ifndef MAME_VIDEO_ZEUS2_H
+#define MAME_VIDEO_ZEUS2_H
+
+#pragma once
#include "video/poly.h"
#include "video/rgbutil.h"
#include "cpu/tms32031/tms32031.h"
-#pragma once
-
/*************************************
* Constants
*************************************/
@@ -123,8 +123,8 @@ public:
TIMER_CALLBACK_MEMBER(display_irq_off);
TIMER_CALLBACK_MEMBER(display_irq);
- template<class _Object> static devcb_base &set_vblank_callback(device_t &device, _Object object) { return downcast<zeus2_device &>(device).m_vblank.set_callback(object); }
- template<class _Object> static devcb_base &set_irq_callback(device_t &device, _Object object) { return downcast<zeus2_device &>(device).m_irq.set_callback(object); }
+ template <class Object> static devcb_base &set_vblank_callback(device_t &device, Object &&cb) { return downcast<zeus2_device &>(device).m_vblank.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_irq_callback(device_t &device, Object &&cb) { return downcast<zeus2_device &>(device).m_irq.set_callback(std::forward<Object>(cb)); }
devcb_write_line m_vblank;
devcb_write_line m_irq;
@@ -438,6 +438,6 @@ public:
};
// device type definition
-extern const device_type ZEUS2;
+DECLARE_DEVICE_TYPE(ZEUS2, zeus2_device)
-#endif
+#endif // MAME_VIDEO_ZEUS2