trunk/src/mess/drivers/tx0.c
| r29451 | r29452 | |
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | |
| 303 | | static 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 | | }; |
| 309 | 303 | |
| 310 | | |
| 311 | 304 | /* |
| 312 | 305 | TX-0 |
| 313 | 306 | * |
| r29451 | r29452 | |
| 316 | 309 | |
| 317 | 310 | |
| 318 | 311 | |
| 319 | | |
| 320 | | |
| 321 | | |
| 322 | | |
| 323 | | |
| 324 | | |
| 325 | | |
| 326 | | |
| 327 | | |
| 328 | | |
| 329 | | |
| 330 | 312 | /* crt display timer */ |
| 331 | 313 | |
| 332 | 314 | |
| r29451 | r29452 | |
| 1579 | 1561 | /* dummy interrupt: handles input */ |
| 1580 | 1562 | MCFG_CPU_VBLANK_INT_DRIVER("screen", tx0_state, tx0_interrupt) |
| 1581 | 1563 | |
| 1582 | | |
| 1583 | 1564 | /* video hardware (includes the control panel and typewriter output) */ |
| 1584 | 1565 | MCFG_SCREEN_ADD("screen", RASTER) |
| 1585 | 1566 | MCFG_SCREEN_REFRESH_RATE(refresh_rate) |
| r29451 | r29452 | |
| 1590 | 1571 | MCFG_SCREEN_VBLANK_DRIVER(tx0_state, screen_eof_tx0) |
| 1591 | 1572 | MCFG_SCREEN_PALETTE("palette") |
| 1592 | 1573 | |
| 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 | |
| 1594 | 1579 | MCFG_DEVICE_ADD("readt", TX0_READTAPE, 0) |
| 1595 | 1580 | MCFG_DEVICE_ADD("punch", TX0_PUNCHTAPE, 0) |
| 1596 | 1581 | MCFG_DEVICE_ADD("typewriter", TX0_PRINTER, 0) |
trunk/src/mess/drivers/pdp1.c
| r29451 | r29452 | |
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | |
| 354 | | static 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 | | |
| 362 | 354 | /* |
| 363 | 355 | pdp1 machine code |
| 364 | 356 | |
| r29451 | r29452 | |
| 1945 | 1937 | MCFG_CPU_PROGRAM_MAP(pdp1_map) |
| 1946 | 1938 | MCFG_CPU_VBLANK_INT_DRIVER("screen", pdp1_state, pdp1_interrupt) /* dummy interrupt: handles input */ |
| 1947 | 1939 | |
| 1948 | | |
| 1949 | 1940 | /* video hardware (includes the control panel and typewriter output) */ |
| 1950 | 1941 | MCFG_SCREEN_ADD("screen", RASTER) |
| 1951 | 1942 | MCFG_SCREEN_REFRESH_RATE(refresh_rate) |
| r29451 | r29452 | |
| 1956 | 1947 | MCFG_SCREEN_VBLANK_DRIVER(pdp1_state, screen_eof_pdp1) |
| 1957 | 1948 | MCFG_SCREEN_PALETTE("palette") |
| 1958 | 1949 | |
| 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 | |
| 1960 | 1955 | MCFG_DEVICE_ADD("readt", PDP1_READTAPE, 0) |
| 1961 | 1956 | MCFG_DEVICE_ADD("punch", PDP1_PUNCHTAPE, 0) |
| 1962 | 1957 | MCFG_DEVICE_ADD("typewriter", PDP1_PRINTER, 0) |
trunk/src/mess/video/crt.c
| r29451 | r29452 | |
| 25 | 25 | Based on earlier work by Chris Salomon |
| 26 | 26 | */ |
| 27 | 27 | |
| 28 | | #include <math.h> |
| 29 | 28 | #include "emu.h" |
| 30 | 29 | #include "video/crt.h" |
| 31 | 30 | |
| r29451 | r29452 | |
| 68 | 67 | |
| 69 | 68 | void crt_device::device_start() |
| 70 | 69 | { |
| 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 | | |
| 82 | 70 | /* 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); |
| 84 | 73 | |
| 85 | | m_list_head = auto_alloc_array(machine(), int, height); |
| 86 | | |
| 87 | 74 | /* 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++) |
| 90 | 76 | m_list[i].intensity = intensity_pixel_not_in_list; |
| 91 | | } |
| 92 | 77 | |
| 93 | | for (i=0; i<height; i++) |
| 78 | for (int i = 0; i < m_window_height; i++) |
| 94 | 79 | m_list_head[i] = -1; |
| 95 | 80 | |
| 96 | 81 | m_decay_counter = 0; |
trunk/src/mess/video/crt.h
| r29451 | r29452 | |
| 6 | 6 | |
| 7 | 7 | *************************************************************************/ |
| 8 | 8 | |
| 9 | | #ifndef CRT_H_ |
| 10 | | #define CRT_H_ |
| 9 | #ifndef __CRT_H__ |
| 10 | #define __CRT_H__ |
| 11 | 11 | |
| 12 | 12 | |
| 13 | 13 | //************************************************************************** |
| 14 | 14 | // INTERFACE CONFIGURATION MACROS |
| 15 | 15 | //************************************************************************** |
| 16 | 16 | |
| 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); |
| 20 | 19 | |
| 20 | #define MCFG_CRT_OFFSETS(_xoffs, _yoffs) \ |
| 21 | crt_device::set_offsets(*device, _xoffs, _yoffs); |
| 21 | 22 | |
| 23 | #define MCFG_CRT_SIZE(_width, _height) \ |
| 24 | crt_device::set_size(*device, _width, _height); |
| 25 | |
| 26 | |
| 22 | 27 | //************************************************************************** |
| 23 | 28 | // TYPE DEFINITIONS |
| 24 | 29 | //************************************************************************** |
| 25 | 30 | |
| 26 | | struct crt_interface |
| 27 | | { |
| 28 | | int num_levels; |
| 29 | | int offset_x, offset_y; |
| 30 | | int width, height; |
| 31 | | }; |
| 32 | | |
| 33 | | |
| 34 | 31 | struct crt_point |
| 35 | 32 | { |
| 36 | 33 | crt_point() : |
| r29451 | r29452 | |
| 50 | 47 | crt_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 51 | 48 | ~crt_device() { } |
| 52 | 49 | |
| 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 | |
| 53 | 68 | protected: |
| 54 | 69 | // device-level overrides |
| 55 | 70 | virtual void device_start(); |
| 56 | 71 | |
| 57 | | public: |
| 58 | | void plot(int x, int y); |
| 59 | | void eof(); |
| 60 | | void update(bitmap_ind16 &bitmap); |
| 61 | | |
| 62 | 72 | private: |
| 63 | 73 | crt_point *m_list; /* array of (crt_window_width*crt_window_height) point */ |
| 64 | 74 | int *m_list_head; /* head of the list of lit pixels (index in the array) */ |