diff options
author | 2014-10-13 05:46:51 +0000 | |
---|---|---|
committer | 2014-10-13 05:46:51 +0000 | |
commit | 76ecd996bf52813353cb49e08c9539ff4a0025dc (patch) | |
tree | 03d25f96c5f4895a4ad4be4cd977fb22621a126a /src/emu/video/fixfreq.h | |
parent | 088936a672d5f1f347a26fc1c4eb485ea71b686b (diff) |
fixfreq: converted to use inline configs. nw.
Diffstat (limited to 'src/emu/video/fixfreq.h')
-rw-r--r-- | src/emu/video/fixfreq.h | 89 |
1 files changed, 68 insertions, 21 deletions
diff --git a/src/emu/video/fixfreq.h b/src/emu/video/fixfreq.h index c636fc2c354..fa9703cd2b4 100644 --- a/src/emu/video/fixfreq.h +++ b/src/emu/video/fixfreq.h @@ -18,42 +18,77 @@ #define FIXFREQ_INTERFACE(name) \ const fixedfreq_interface (name) = -#define MCFG_FIXFREQ_ADD(_tag, _screen_tag, _config) \ +#define MCFG_FIXFREQ_ADD(_tag, _screen_tag) \ MCFG_SCREEN_ADD(_screen_tag, RASTER) \ MCFG_SCREEN_RAW_PARAMS(13500000, 858, 0, 858, 525, 0, 525) \ MCFG_SCREEN_UPDATE_DEVICE(_tag, fixedfreq_device, screen_update) \ MCFG_DEVICE_ADD(_tag, FIXFREQ, 0) \ - MCFG_VIDEO_SET_SCREEN(_screen_tag) \ - MCFG_DEVICE_CONFIG(_config) + MCFG_VIDEO_SET_SCREEN(_screen_tag) -struct fixedfreq_interface { - UINT32 m_monitor_clock; - int m_hvisible; - int m_hfrontporch; - int m_hsync; - int m_hbackporch; - int m_vvisible; - int m_vfrontporch; - int m_vsync; - int m_vbackporch; - int m_fieldcount; - double m_sync_threshold; -}; +#define MCFG_FIXFREQ_MONITOR_CLOCK(_clock) \ + fixedfreq_device::set_minitor_clock(*device, _clock); + +#define MCFG_FIXFREQ_HORZ_PARAMS(_visible, _frontporch, _sync, _backporch) \ + fixedfreq_device::set_horz_params(*device, _visible, _frontporch, _sync, _backporch); + +#define MCFG_FIXFREQ_VERT_PARAMS(_visible, _frontporch, _sync, _backporch) \ + fixedfreq_device::set_vert_params(*device, _visible, _frontporch, _sync, _backporch); + +#define MCFG_FIXFREQ_FIELDCOUNT(_count) \ + fixedfreq_device::set_fieldcount(*device, _count); + +#define MCFG_FIXFREQ_SYNC_THRESHOLD(_threshold) \ + fixedfreq_device::set_threshold(*device, _threshold); + +// pre-defined configurations + +//ModeLine "720x480@30i" 13.5 720 736 799 858 480 486 492 525 interlace -hsync -vsync +#define MCFG_FIXFREQ_MODE_NTSC720 \ + MCFG_FIXFREQ_MONITOR_CLOCK(13500000) \ + MCFG_FIXFREQ_HORZ_PARAMS(720, 736, 799, 858) \ + MCFG_FIXFREQ_VERT_PARAMS(480, 486, 492, 525) \ + MCFG_FIXFREQ_FIELDCOUNT(2) \ + MCFG_FIXFREQ_SYNC_THRESHOLD(0.3) + +//ModeLine "704x480@30i" 13.5 704 728 791 858 480 486 492 525 +#define MCFG_FIXFREQ_MODE_NTSC704 \ + MCFG_FIXFREQ_MONITOR_CLOCK(13500000) \ + MCFG_FIXFREQ_HORZ_PARAMS(704, 728, 791, 858) \ + MCFG_FIXFREQ_VERT_PARAMS(480, 486, 492, 525) \ + MCFG_FIXFREQ_FIELDCOUNT(2) \ + MCFG_FIXFREQ_SYNC_THRESHOLD(0.3) -extern fixedfreq_interface fixedfreq_mode_ntsc704; -extern fixedfreq_interface fixedfreq_mode_ntsc720; // ======================> vga_device class fixedfreq_device : public device_t, - public device_video_interface, - public fixedfreq_interface + public device_video_interface { public: // construction/destruction fixedfreq_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); fixedfreq_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); + // inline configuration helpers + static void set_minitor_clock(device_t &device, UINT32 clock) { downcast<fixedfreq_device &>(device).m_monitor_clock = clock; } + static void set_fieldcount(device_t &device, int count) { downcast<fixedfreq_device &>(device).m_fieldcount = count; } + static void set_threshold(device_t &device, double threshold) { downcast<fixedfreq_device &>(device).m_sync_threshold = threshold; } + static void set_horz_params(device_t &device, int visible, int frontporch, int sync, int backporch) + { + fixedfreq_device &dev = downcast<fixedfreq_device &>(device); + dev.m_hvisible = visible; + dev.m_hfrontporch = frontporch; + dev.m_hsync = sync; + dev.m_hbackporch = backporch; + } + static void set_vert_params(device_t &device, int visible, int frontporch, int sync, int backporch) + { + fixedfreq_device &dev = downcast<fixedfreq_device &>(device); + dev.m_vvisible = visible; + dev.m_vfrontporch = frontporch; + dev.m_vsync = sync; + dev.m_vbackporch = backporch; + } virtual UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); @@ -61,7 +96,6 @@ public: protected: // device-level overrides - virtual void device_config_complete(); virtual void device_start(); virtual void device_reset(); virtual void device_post_load(); @@ -89,6 +123,19 @@ private: bitmap_rgb32 *m_bitmap[2]; int m_cur_bm; + /* adjustable by drivers */ + UINT32 m_monitor_clock; + int m_hvisible; + int m_hfrontporch; + int m_hsync; + int m_hbackporch; + int m_vvisible; + int m_vfrontporch; + int m_vsync; + int m_vbackporch; + int m_fieldcount; + double m_sync_threshold; + /* sync separator */ double m_vint; double m_int_trig; |