summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Fabio Priuli <etabeta78@users.noreply.github.com>2014-04-08 15:22:05 +0000
committer Fabio Priuli <etabeta78@users.noreply.github.com>2014-04-08 15:22:05 +0000
commitd6aaccce9596d7a85c12e5ec0982314a36297e1b (patch)
tree0493a9499302b6e204e6197c00779d48c5a8f756
parent5e385121f2eac0b8ecb1d1918a48101eb8fed711 (diff)
(MESS) updated crt device (used by PDP1 and TX0) to use inline configs. nw.
-rw-r--r--src/mess/drivers/pdp1.c15
-rw-r--r--src/mess/drivers/tx0.c25
-rw-r--r--src/mess/video/crt.c23
-rw-r--r--src/mess/video/crt.h46
4 files changed, 42 insertions, 67 deletions
diff --git a/src/mess/drivers/pdp1.c b/src/mess/drivers/pdp1.c
index cab0e654b44..7678cf67990 100644
--- a/src/mess/drivers/pdp1.c
+++ b/src/mess/drivers/pdp1.c
@@ -351,14 +351,6 @@ PALETTE_INIT_MEMBER(pdp1_state, pdp1)
}
-static const crt_interface pdp1_crt_interface =
-{
- pen_crt_num_levels,
- crt_window_offset_x, crt_window_offset_y,
- crt_window_width, crt_window_height
-};
-
-
/*
pdp1 machine code
@@ -1945,7 +1937,6 @@ static MACHINE_CONFIG_START( pdp1, pdp1_state )
MCFG_CPU_PROGRAM_MAP(pdp1_map)
MCFG_CPU_VBLANK_INT_DRIVER("screen", pdp1_state, pdp1_interrupt) /* dummy interrupt: handles input */
-
/* video hardware (includes the control panel and typewriter output) */
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(refresh_rate)
@@ -1956,7 +1947,11 @@ static MACHINE_CONFIG_START( pdp1, pdp1_state )
MCFG_SCREEN_VBLANK_DRIVER(pdp1_state, screen_eof_pdp1)
MCFG_SCREEN_PALETTE("palette")
- MCFG_CRT_ADD( "crt", pdp1_crt_interface )
+ MCFG_DEVICE_ADD("crt", CRT, 0)
+ MCFG_CRT_NUM_LEVELS(pen_crt_num_levels)
+ MCFG_CRT_OFFSETS(crt_window_offset_x, crt_window_offset_y)
+ MCFG_CRT_SIZE(crt_window_width, crt_window_height)
+
MCFG_DEVICE_ADD("readt", PDP1_READTAPE, 0)
MCFG_DEVICE_ADD("punch", PDP1_PUNCHTAPE, 0)
MCFG_DEVICE_ADD("typewriter", PDP1_PRINTER, 0)
diff --git a/src/mess/drivers/tx0.c b/src/mess/drivers/tx0.c
index 0b667fb93dc..236525897c6 100644
--- a/src/mess/drivers/tx0.c
+++ b/src/mess/drivers/tx0.c
@@ -300,13 +300,6 @@ PALETTE_INIT_MEMBER(tx0_state, tx0)
}
-static const crt_interface tx0_crt_interface =
-{
- pen_crt_num_levels,
- crt_window_offset_x, crt_window_offset_y,
- crt_window_width, crt_window_height
-};
-
/*
TX-0
@@ -316,17 +309,6 @@ static const crt_interface tx0_crt_interface =
-
-
-
-
-
-
-
-
-
-
-
/* crt display timer */
@@ -1579,7 +1561,6 @@ static MACHINE_CONFIG_START( tx0_64kw, tx0_state )
/* dummy interrupt: handles input */
MCFG_CPU_VBLANK_INT_DRIVER("screen", tx0_state, tx0_interrupt)
-
/* video hardware (includes the control panel and typewriter output) */
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(refresh_rate)
@@ -1590,7 +1571,11 @@ static MACHINE_CONFIG_START( tx0_64kw, tx0_state )
MCFG_SCREEN_VBLANK_DRIVER(tx0_state, screen_eof_tx0)
MCFG_SCREEN_PALETTE("palette")
- MCFG_CRT_ADD( "crt", tx0_crt_interface )
+ MCFG_DEVICE_ADD("crt", CRT, 0)
+ MCFG_CRT_NUM_LEVELS(pen_crt_num_levels)
+ MCFG_CRT_OFFSETS(crt_window_offset_x, crt_window_offset_y)
+ MCFG_CRT_SIZE(crt_window_width, crt_window_height)
+
MCFG_DEVICE_ADD("readt", TX0_READTAPE, 0)
MCFG_DEVICE_ADD("punch", TX0_PUNCHTAPE, 0)
MCFG_DEVICE_ADD("typewriter", TX0_PRINTER, 0)
diff --git a/src/mess/video/crt.c b/src/mess/video/crt.c
index 47f0ccf291e..4ab7b609a5a 100644
--- a/src/mess/video/crt.c
+++ b/src/mess/video/crt.c
@@ -25,7 +25,6 @@ Theory of operation:
Based on earlier work by Chris Salomon
*/
-#include <math.h>
#include "emu.h"
#include "video/crt.h"
@@ -68,29 +67,15 @@ crt_device::crt_device(const machine_config &mconfig, const char *tag, device_t
void crt_device::device_start()
{
- const crt_interface *intf = (const crt_interface *)static_config();
- int width = intf->width;
- int height = intf->height;
- int i;
-
- m_num_intensity_levels = intf->num_levels;
- m_window_offset_x = intf->offset_x;
- m_window_offset_y = intf->offset_y;
- m_window_width = width;
- m_window_height = height;
-
/* alloc the arrays */
- m_list = auto_alloc_array(machine(), crt_point, width * height);
-
- m_list_head = auto_alloc_array(machine(), int, height);
+ m_list = auto_alloc_array(machine(), crt_point, m_window_width * m_window_height);
+ m_list_head = auto_alloc_array(machine(), int, m_window_height);
/* fill with black and set up list as empty */
- for (i=0; i<(width * height); i++)
- {
+ for (int i = 0; i < (m_window_width * m_window_height); i++)
m_list[i].intensity = intensity_pixel_not_in_list;
- }
- for (i=0; i<height; i++)
+ for (int i = 0; i < m_window_height; i++)
m_list_head[i] = -1;
m_decay_counter = 0;
diff --git a/src/mess/video/crt.h b/src/mess/video/crt.h
index 22bce59a399..db4e456912d 100644
--- a/src/mess/video/crt.h
+++ b/src/mess/video/crt.h
@@ -6,31 +6,28 @@
*************************************************************************/
-#ifndef CRT_H_
-#define CRT_H_
+#ifndef __CRT_H__
+#define __CRT_H__
//**************************************************************************
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
-#define MCFG_CRT_ADD(_tag, _interface) \
- MCFG_DEVICE_ADD(_tag, CRT, 0) \
- MCFG_DEVICE_CONFIG(_interface)
+#define MCFG_CRT_NUM_LEVELS(_lev) \
+ crt_device::set_num_levels(*device, _lev);
+
+#define MCFG_CRT_OFFSETS(_xoffs, _yoffs) \
+ crt_device::set_offsets(*device, _xoffs, _yoffs);
+
+#define MCFG_CRT_SIZE(_width, _height) \
+ crt_device::set_size(*device, _width, _height);
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
-struct crt_interface
-{
- int num_levels;
- int offset_x, offset_y;
- int width, height;
-};
-
-
struct crt_point
{
crt_point() :
@@ -50,14 +47,27 @@ public:
crt_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~crt_device() { }
-protected:
- // device-level overrides
- virtual void device_start();
-
-public:
+ static void set_num_levels(device_t &device, int levels) { downcast<crt_device &>(device).m_num_intensity_levels = levels; }
+ static void set_offsets(device_t &device, int x_offset, int y_offset)
+ {
+ crt_device &dev = downcast<crt_device &>(device);
+ dev.m_window_offset_x = x_offset;
+ dev.m_window_offset_y = y_offset;
+ }
+ static void set_size(device_t &device, int width, int height)
+ {
+ crt_device &dev = downcast<crt_device &>(device);
+ dev.m_window_width = width;
+ dev.m_window_height = height;
+ }
+
void plot(int x, int y);
void eof();
void update(bitmap_ind16 &bitmap);
+
+protected:
+ // device-level overrides
+ virtual void device_start();
private:
crt_point *m_list; /* array of (crt_window_width*crt_window_height) point */