Previous 199869 Revisions Next

r24771 Tuesday 6th August, 2013 at 14:39:38 UTC by Curt Coder
(MESS) mpt02: Fixed CDP1864 colors. [Curt Coder, Guru]
[src/emu/sound]cdp1864.c cdp1864.h
[src/emu/video]resnet.h
[src/mess/drivers]studio2.c

trunk/src/emu/video/resnet.h
r24770r24771
175175#define combine_4_weights(tab,w0,w1,w2,w3)              ((int)(((tab)[0]*(w0) + (tab)[1]*(w1) + (tab)[2]*(w2) + (tab)[3]*(w3)) + 0.5))
176176#define combine_3_weights(tab,w0,w1,w2)                 ((int)(((tab)[0]*(w0) + (tab)[1]*(w1) + (tab)[2]*(w2)) + 0.5))
177177#define combine_2_weights(tab,w0,w1)                    ((int)(((tab)[0]*(w0) + (tab)[1]*(w1)) + 0.5))
178#define combine_1_weights(tab,w0)                       ((int)(((tab)[0]*(w0) + 0.5)))
178179
179180
180181
trunk/src/emu/sound/cdp1864.c
r24770r24771
6161
6262inline void cdp1864_device::initialize_palette()
6363{
64   double res_total = m_chr_r + m_chr_g + m_chr_b + m_chr_bkg;
64   const int resistances_r[] = { m_chr_r };
65   const int resistances_g[] = { m_chr_g };
66   const int resistances_b[] = { m_chr_b };
6567
66   int weight_r = (m_chr_r / res_total) * 100;
67   int weight_g = (m_chr_g / res_total) * 100;
68   int weight_b = (m_chr_b / res_total) * 100;
69   int weight_bkg = (m_chr_bkg / res_total) * 100;
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];
7070
71   for (int i = 0; i < 16; i++)
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++)
7282   {
73      int luma = 0;
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));
7486
75      luma += (i & 4) ? weight_r : 0;
76      luma += (i & 1) ? weight_g : 0;
77      luma += (i & 2) ? weight_b : 0;
78      luma += (i & 8) ? 0 : weight_bkg;
87      m_palette[i] = MAKE_RGB(r, g, b);
7988
80      luma = (luma * 0xff) / 100;
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));
8192
82      int r = (i & 4) ? luma : 0;
83      int g = (i & 1) ? luma : 0;
84      int b = (i & 2) ? luma : 0;
85
86      m_palette[i] = MAKE_RGB(r, g, b);
93      m_palette[i + 8] = MAKE_RGB(r, g, b);
8794   }
8895}
8996
r24770r24771
358365   m_disp = 1;
359366
360367   m_bgcolor++;
361
362   if (m_bgcolor > 3)
363   {
364      m_bgcolor = 0;
365   }
368   m_bgcolor &= 0x03;
366369}
367370
368371
r24770r24771
455458   if (m_disp)
456459   {
457460      copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect);
458      m_bitmap.fill(CDP1864_BACKGROUND_COLOR_SEQUENCE[m_bgcolor] + 8, cliprect);
461      m_bitmap.fill(m_palette[CDP1864_BACKGROUND_COLOR_SEQUENCE[m_bgcolor] + 8], cliprect);
459462   }
460463   else
461464   {
462      bitmap.fill(get_black_pen(machine()), cliprect);
465      bitmap.fill(m_palette[0], cliprect);
463466   }
467
464468   return 0;
465469}
trunk/src/emu/sound/cdp1864.h
r24770r24771
3939#define __CDP1864__
4040
4141#include "emu.h"
42#include "video/resnet.h"
4243
4344
4445
trunk/src/mess/drivers/studio2.c
r24770r24771
592592   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
593593
594594   MCFG_CDP1864_ADD(CDP1864_TAG, SCREEN_TAG, CDP1864_CLOCK, GND, INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1), NULL, READLINE(mpt02_state, rdata_r), READLINE(mpt02_state, bdata_r), READLINE(mpt02_state, gdata_r))
595   MCFG_CDP1864_CHROMINANCE(RES_K(2.2), RES_K(1), RES_K(5.1), RES_K(4.7)) // unverified
595   MCFG_CDP1864_CHROMINANCE(RES_K(4.7), RES_K(8.2), RES_K(4.7), RES_K(22))
596596
597597   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
598598
r24770r24771
655655
656656/*    YEAR  NAME        PARENT  COMPAT  MACHINE     INPUT       INIT        COMPANY   FULLNAME */
657657CONS( 1977, studio2,    0,      0,      studio2,    studio2, studio2_state, studio2,    "RCA",      "Studio II", GAME_SUPPORTS_SAVE )
658CONS( 1978, visicom,    studio2,0,      visicom,    studio2, studio2_state, studio2,    "Toshiba",  "Visicom COM-100 (Japan)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_WRONG_COLORS | GAME_SUPPORTS_SAVE )
659CONS( 1978, mpt02,      studio2,0,      mpt02,      studio2, studio2_state, studio2,    "Soundic",  "Victory MPT-02 Home TV Programmer (Austria)", GAME_WRONG_COLORS | GAME_SUPPORTS_SAVE )
660CONS( 1978, mpt02h,     studio2,0,      mpt02,      studio2, studio2_state, studio2,    "Hanimex",  "MPT-02 Jeu TV Programmable (France)", GAME_WRONG_COLORS | GAME_SUPPORTS_SAVE)
661CONS( 1978, mtc9016,    studio2,0,      mpt02,      studio2, studio2_state, studio2,    "Mustang",  "9016 Telespiel Computer (Germany)", GAME_WRONG_COLORS | GAME_SUPPORTS_SAVE )
662CONS( 1978, shmc1200,   studio2,0,      mpt02,      studio2, studio2_state, studio2,    "Sheen",    "1200 Micro Computer (Australia)", GAME_WRONG_COLORS | GAME_SUPPORTS_SAVE )
663CONS( 1978, cm1200,     studio2,0,      mpt02,      studio2, studio2_state, studio2,    "Conic",    "M-1200 (?)", GAME_WRONG_COLORS | GAME_SUPPORTS_SAVE )
664CONS( 1978, apollo80,   studio2,0,      mpt02,      studio2, studio2_state, studio2,    "Academy",  "Apollo 80 (Germany)", GAME_WRONG_COLORS | GAME_SUPPORTS_SAVE )
658CONS( 1978, visicom,    studio2,0,      visicom,    studio2, studio2_state, studio2,    "Toshiba",  "Visicom COM-100 (Japan)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
659CONS( 1978, mpt02,      studio2,0,      mpt02,      studio2, studio2_state, studio2,    "Soundic",  "Victory MPT-02 Home TV Programmer (Austria)", GAME_SUPPORTS_SAVE )
660CONS( 1978, mpt02h,     studio2,0,      mpt02,      studio2, studio2_state, studio2,    "Hanimex",  "MPT-02 Jeu TV Programmable (France)", GAME_SUPPORTS_SAVE)
661CONS( 1978, mtc9016,    studio2,0,      mpt02,      studio2, studio2_state, studio2,    "Mustang",  "9016 Telespiel Computer (Germany)", GAME_SUPPORTS_SAVE )
662CONS( 1978, shmc1200,   studio2,0,      mpt02,      studio2, studio2_state, studio2,    "Sheen",    "1200 Micro Computer (Australia)", GAME_SUPPORTS_SAVE )
663CONS( 1978, cm1200,     studio2,0,      mpt02,      studio2, studio2_state, studio2,    "Conic",    "M-1200 (?)", GAME_SUPPORTS_SAVE )
664CONS( 1978, apollo80,   studio2,0,      mpt02,      studio2, studio2_state, studio2,    "Academy",  "Apollo 80 (Germany)", GAME_SUPPORTS_SAVE )

Previous 199869 Revisions Next


© 1997-2024 The MAME Team