Previous 199869 Revisions Next

r24861 Monday 12th August, 2013 at 19:44:37 UTC by Curt Coder
(MESS) mpt02: Fixed CDP1864 background color sequence. [Curt Coder]
[src/emu/machine]rescap.h
[src/emu/sound]cdp1864.c cdp1864.h
[src/mess/video]tmc1800.c

trunk/src/emu/sound/cdp1864.c
r24860r24861
2222
2323*/
2424
25
26#include "emu.h"
2725#include "cdp1864.h"
2826
2927
r24860r24861
3836#define CDP1864_CYCLES_DMA_ACTIVE   8*8
3937#define CDP1864_CYCLES_DMA_WAIT     6*8
4038
41static const int CDP1864_BACKGROUND_COLOR_SEQUENCE[] = { 2, 0, 1, 4 };
39const int cdp1864_device::bckgnd[] = { 2, 0, 4, 1 };
4240
4341
4442
4543//**************************************************************************
46//  GLOBAL VARIABLES
44//  DEVICE DEFINITIONS
4745//**************************************************************************
4846
4947// devices
r24860r24861
5250
5351
5452//**************************************************************************
55//  INLINE HELPERS
56//**************************************************************************
57
58//-------------------------------------------------
59//  initialize_palette -
60//-------------------------------------------------
61
62inline void cdp1864_device::initialize_palette()
63{
64   const int resistances_r[] = { m_chr_r };
65   const int resistances_g[] = { m_chr_g };
66   const int resistances_b[] = { m_chr_b };
67
68   double color_weights_r[1], color_weights_g[1], color_weights_b[1];
69   double color_weights_bkg_r[1], color_weights_bkg_g[1], color_weights_bkg_b[1];
70
71   compute_resistor_weights(0, 0xff, -1.0,
72                        1, resistances_r, color_weights_r, 0, m_chr_bkg,
73                        1, resistances_g, color_weights_g, 0, m_chr_bkg,
74                        1, resistances_b, color_weights_b, 0, m_chr_bkg);
75
76   compute_resistor_weights(0, 0xff, -1.0,
77                        1, resistances_r, color_weights_bkg_r, m_chr_bkg, 0,
78                        1, resistances_g, color_weights_bkg_g, m_chr_bkg, 0,
79                        1, resistances_b, color_weights_bkg_b, m_chr_bkg, 0);
80
81   for (int i = 0; i < 8; i++)
82   {
83      UINT8 r = combine_1_weights(color_weights_r, BIT(i, 0));
84      UINT8 b = combine_1_weights(color_weights_b, BIT(i, 1));
85      UINT8 g = combine_1_weights(color_weights_g, BIT(i, 2));
86
87      m_palette[i] = MAKE_RGB(r, g, b);
88
89      r = combine_1_weights(color_weights_bkg_r, BIT(i, 0));
90      b = combine_1_weights(color_weights_bkg_b, BIT(i, 1));
91      g = combine_1_weights(color_weights_bkg_g, BIT(i, 2));
92
93      m_palette[i + 8] = MAKE_RGB(r, g, b);
94   }
95}
96
97
98
99//**************************************************************************
10053//  LIVE DEVICE
10154//**************************************************************************
10255
r24860r24861
398351
399352   for (int x = 0; x < 8; x++)
400353   {
401      int color = CDP1864_BACKGROUND_COLOR_SEQUENCE[m_bgcolor] + 8;
354      int color = bckgnd[m_bgcolor] + 8;
402355
403356      if (BIT(data, 7))
404357      {
r24860r24861
458411   if (m_disp)
459412   {
460413      copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect);
461      m_bitmap.fill(m_palette[CDP1864_BACKGROUND_COLOR_SEQUENCE[m_bgcolor] + 8], cliprect);
414      m_bitmap.fill(m_palette[bckgnd[m_bgcolor] + 8], cliprect);
462415   }
463416   else
464417   {
465      bitmap.fill(m_palette[0], cliprect);
418      bitmap.fill(RGB_BLACK, cliprect);
466419   }
467420
468421   return 0;
469422}
423
424
425//-------------------------------------------------
426//  initialize_palette -
427//-------------------------------------------------
428
429void cdp1864_device::initialize_palette()
430{
431   const int resistances_r[] = { m_chr_r };
432   const int resistances_g[] = { m_chr_g };
433   const int resistances_b[] = { m_chr_b };
434
435   double color_weights_r[1], color_weights_g[1], color_weights_b[1];
436   double color_weights_bkg_r[1], color_weights_bkg_g[1], color_weights_bkg_b[1];
437
438   compute_resistor_weights(0, 0xff, -1.0,
439                        1, resistances_r, color_weights_r, 0, m_chr_bkg,
440                        1, resistances_g, color_weights_g, 0, m_chr_bkg,
441                        1, resistances_b, color_weights_b, 0, m_chr_bkg);
442
443   compute_resistor_weights(0, 0xff, -1.0,
444                        1, resistances_r, color_weights_bkg_r, m_chr_bkg, 0,
445                        1, resistances_g, color_weights_bkg_g, m_chr_bkg, 0,
446                        1, resistances_b, color_weights_bkg_b, m_chr_bkg, 0);
447
448   for (int i = 0; i < 8; i++)
449   {
450      // foreground colors
451      UINT8 r = 0, g = 0, b = 0;
452
453      if (m_chr_r != RES_INF) r = combine_1_weights(color_weights_r, BIT(i, 0));
454      if (m_chr_b != RES_INF) b = combine_1_weights(color_weights_b, BIT(i, 1));
455      if (m_chr_g != RES_INF) g = combine_1_weights(color_weights_g, BIT(i, 2));
456
457      m_palette[i] = MAKE_RGB(r, g, b);
458
459      // background colors
460      r = 0, g = 0, b = 0;
461
462      if (m_chr_r != RES_INF) r = combine_1_weights(color_weights_bkg_r, BIT(i, 0));
463      if (m_chr_b != RES_INF) b = combine_1_weights(color_weights_bkg_b, BIT(i, 1));
464      if (m_chr_g != RES_INF) g = combine_1_weights(color_weights_bkg_g, BIT(i, 2));
465
466      m_palette[i + 8] = MAKE_RGB(r, g, b);
467   }
468}
trunk/src/emu/sound/cdp1864.h
r24860r24861
3939#define __CDP1864__
4040
4141#include "emu.h"
42#include "machine/rescap.h"
4243#include "video/resnet.h"
4344
4445
r24860r24861
150151   virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
151152
152153private:
153   inline void initialize_palette();
154
155154   enum
156155   {
157156      TIMER_INT,
r24860r24861
159158      TIMER_DMA,
160159      TIMER_HSYNC
161160   };
161   
162   void initialize_palette();
162163
164   static const int bckgnd[];
165
163166   devcb2_read_line        m_read_inlace;
164167   devcb2_read_line        m_read_rdata;
165168   devcb2_read_line        m_read_bdata;
trunk/src/emu/machine/rescap.h
r24860r24861
55#define RES_R(res) ((double)(res))
66#define RES_K(res) ((double)(res) * 1e3)
77#define RES_M(res) ((double)(res) * 1e6)
8#define RES_INF    (-1)
89#define CAP_U(cap) ((double)(cap) * 1e-6)
910#define CAP_N(cap) ((double)(cap) * 1e-9)
1011#define CAP_P(cap) ((double)(cap) * 1e-12)
trunk/src/mess/video/tmc1800.c
r24860r24861
6060
6161   MCFG_SPEAKER_STANDARD_MONO("mono")
6262   MCFG_CDP1864_ADD(CDP1864_TAG, SCREEN_TAG, XTAL_1_75MHz, GND, INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1), NULL, VCC, VCC, VCC)
63   MCFG_CDP1864_CHROMINANCE(RES_K(1.21), 0, 0, 0) // R18 (unconfirmed)
63   MCFG_CDP1864_CHROMINANCE(RES_K(1.21), RES_INF, RES_INF, 0) // R18 (unconfirmed)
6464   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
6565MACHINE_CONFIG_END

Previous 199869 Revisions Next


© 1997-2024 The MAME Team