Previous 199869 Revisions Next

r29452 Tuesday 8th April, 2014 at 15:22:05 UTC by Fabio Priuli
(MESS) updated crt device (used by PDP1 and TX0) to use inline configs. nw.
[src/mess/drivers]pdp1.c tx0.c
[src/mess/video]crt.c crt.h

trunk/src/mess/drivers/tx0.c
r29451r29452
300300}
301301
302302
303static const crt_interface tx0_crt_interface =
304{
305   pen_crt_num_levels,
306   crt_window_offset_x, crt_window_offset_y,
307   crt_window_width, crt_window_height
308};
309303
310
311304/*
312305    TX-0
313306*
r29451r29452
316309
317310
318311
319
320
321
322
323
324
325
326
327
328
329
330312/* crt display timer */
331313
332314
r29451r29452
15791561   /* dummy interrupt: handles input */
15801562   MCFG_CPU_VBLANK_INT_DRIVER("screen", tx0_state,  tx0_interrupt)
15811563
1582
15831564   /* video hardware (includes the control panel and typewriter output) */
15841565   MCFG_SCREEN_ADD("screen", RASTER)
15851566   MCFG_SCREEN_REFRESH_RATE(refresh_rate)
r29451r29452
15901571   MCFG_SCREEN_VBLANK_DRIVER(tx0_state, screen_eof_tx0)
15911572   MCFG_SCREEN_PALETTE("palette")
15921573
1593   MCFG_CRT_ADD( "crt", tx0_crt_interface )
1574   MCFG_DEVICE_ADD("crt", CRT, 0)
1575   MCFG_CRT_NUM_LEVELS(pen_crt_num_levels)
1576   MCFG_CRT_OFFSETS(crt_window_offset_x, crt_window_offset_y)
1577   MCFG_CRT_SIZE(crt_window_width, crt_window_height)
1578
15941579   MCFG_DEVICE_ADD("readt", TX0_READTAPE, 0)
15951580   MCFG_DEVICE_ADD("punch", TX0_PUNCHTAPE, 0)
15961581   MCFG_DEVICE_ADD("typewriter", TX0_PRINTER, 0)
trunk/src/mess/drivers/pdp1.c
r29451r29452
351351}
352352
353353
354static const crt_interface pdp1_crt_interface =
355{
356   pen_crt_num_levels,
357   crt_window_offset_x, crt_window_offset_y,
358   crt_window_width, crt_window_height
359};
360
361
362354/*
363355    pdp1 machine code
364356
r29451r29452
19451937   MCFG_CPU_PROGRAM_MAP(pdp1_map)
19461938   MCFG_CPU_VBLANK_INT_DRIVER("screen", pdp1_state,  pdp1_interrupt)   /* dummy interrupt: handles input */
19471939
1948
19491940   /* video hardware (includes the control panel and typewriter output) */
19501941   MCFG_SCREEN_ADD("screen", RASTER)
19511942   MCFG_SCREEN_REFRESH_RATE(refresh_rate)
r29451r29452
19561947   MCFG_SCREEN_VBLANK_DRIVER(pdp1_state, screen_eof_pdp1)
19571948   MCFG_SCREEN_PALETTE("palette")
19581949
1959   MCFG_CRT_ADD( "crt", pdp1_crt_interface )
1950   MCFG_DEVICE_ADD("crt", CRT, 0)
1951   MCFG_CRT_NUM_LEVELS(pen_crt_num_levels)
1952   MCFG_CRT_OFFSETS(crt_window_offset_x, crt_window_offset_y)
1953   MCFG_CRT_SIZE(crt_window_width, crt_window_height)
1954
19601955   MCFG_DEVICE_ADD("readt", PDP1_READTAPE, 0)
19611956   MCFG_DEVICE_ADD("punch", PDP1_PUNCHTAPE, 0)
19621957   MCFG_DEVICE_ADD("typewriter", PDP1_PRINTER, 0)
trunk/src/mess/video/crt.c
r29451r29452
2525    Based on earlier work by Chris Salomon
2626*/
2727
28#include <math.h>
2928#include "emu.h"
3029#include "video/crt.h"
3130
r29451r29452
6867
6968void crt_device::device_start()
7069{
71   const crt_interface *intf = (const crt_interface *)static_config();
72   int width = intf->width;
73   int height = intf->height;
74   int i;
75
76   m_num_intensity_levels = intf->num_levels;
77   m_window_offset_x = intf->offset_x;
78   m_window_offset_y = intf->offset_y;
79   m_window_width = width;
80   m_window_height = height;
81
8270   /* alloc the arrays */
83   m_list = auto_alloc_array(machine(), crt_point, width * height);
71   m_list = auto_alloc_array(machine(), crt_point, m_window_width * m_window_height);
72   m_list_head = auto_alloc_array(machine(), int, m_window_height);
8473
85   m_list_head = auto_alloc_array(machine(), int, height);
86
8774   /* fill with black and set up list as empty */
88   for (i=0; i<(width * height); i++)
89   {
75   for (int i = 0; i < (m_window_width * m_window_height); i++)
9076      m_list[i].intensity = intensity_pixel_not_in_list;
91   }
9277
93   for (i=0; i<height; i++)
78   for (int i = 0; i < m_window_height; i++)
9479      m_list_head[i] = -1;
9580
9681   m_decay_counter = 0;
trunk/src/mess/video/crt.h
r29451r29452
66
77*************************************************************************/
88
9#ifndef CRT_H_
10#define CRT_H_
9#ifndef __CRT_H__
10#define __CRT_H__
1111
1212
1313//**************************************************************************
1414//  INTERFACE CONFIGURATION MACROS
1515//**************************************************************************
1616
17#define MCFG_CRT_ADD(_tag, _interface) \
18   MCFG_DEVICE_ADD(_tag, CRT, 0) \
19   MCFG_DEVICE_CONFIG(_interface)
17#define MCFG_CRT_NUM_LEVELS(_lev) \
18   crt_device::set_num_levels(*device, _lev);
2019
20#define MCFG_CRT_OFFSETS(_xoffs, _yoffs) \
21   crt_device::set_offsets(*device, _xoffs, _yoffs);
2122
23#define MCFG_CRT_SIZE(_width, _height) \
24   crt_device::set_size(*device, _width, _height);
25
26
2227//**************************************************************************
2328//  TYPE DEFINITIONS
2429//**************************************************************************
2530
26struct crt_interface
27{
28   int num_levels;
29   int offset_x, offset_y;
30   int width, height;
31};
32
33
3431struct crt_point
3532{
3633   crt_point() :
r29451r29452
5047   crt_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
5148   ~crt_device() { }
5249
50   static void set_num_levels(device_t &device, int levels) { downcast<crt_device &>(device).m_num_intensity_levels = levels; }
51   static void set_offsets(device_t &device, int x_offset, int y_offset)
52   {
53      crt_device &dev = downcast<crt_device &>(device);
54      dev.m_window_offset_x = x_offset;
55      dev.m_window_offset_y = y_offset;
56   }
57   static void set_size(device_t &device, int width, int height)
58   {
59      crt_device &dev = downcast<crt_device &>(device);
60      dev.m_window_width = width;
61      dev.m_window_height = height;
62   }
63   
64   void plot(int x, int y);
65   void eof();
66   void update(bitmap_ind16 &bitmap);
67   
5368protected:
5469   // device-level overrides
5570   virtual void device_start();
5671
57public:
58   void plot(int x, int y);
59   void eof();
60   void update(bitmap_ind16 &bitmap);
61
6272private:
6373   crt_point *m_list; /* array of (crt_window_width*crt_window_height) point */
6474   int *m_list_head;  /* head of the list of lit pixels (index in the array) */

Previous 199869 Revisions Next


© 1997-2024 The MAME Team