trunk/src/emu/sound/cdp1864.c
r24770 | r24771 | |
61 | 61 | |
62 | 62 | inline void cdp1864_device::initialize_palette() |
63 | 63 | { |
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 }; |
65 | 67 | |
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]; |
70 | 70 | |
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++) |
72 | 82 | { |
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)); |
74 | 86 | |
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); |
79 | 88 | |
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)); |
81 | 92 | |
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); |
87 | 94 | } |
88 | 95 | } |
89 | 96 | |
r24770 | r24771 | |
358 | 365 | m_disp = 1; |
359 | 366 | |
360 | 367 | m_bgcolor++; |
361 | | |
362 | | if (m_bgcolor > 3) |
363 | | { |
364 | | m_bgcolor = 0; |
365 | | } |
| 368 | m_bgcolor &= 0x03; |
366 | 369 | } |
367 | 370 | |
368 | 371 | |
r24770 | r24771 | |
455 | 458 | if (m_disp) |
456 | 459 | { |
457 | 460 | 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); |
459 | 462 | } |
460 | 463 | else |
461 | 464 | { |
462 | | bitmap.fill(get_black_pen(machine()), cliprect); |
| 465 | bitmap.fill(m_palette[0], cliprect); |
463 | 466 | } |
| 467 | |
464 | 468 | return 0; |
465 | 469 | } |
trunk/src/mess/drivers/studio2.c
r24770 | r24771 | |
592 | 592 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
593 | 593 | |
594 | 594 | 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)) |
596 | 596 | |
597 | 597 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
598 | 598 | |
r24770 | r24771 | |
655 | 655 | |
656 | 656 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ |
657 | 657 | CONS( 1977, studio2, 0, 0, studio2, studio2, studio2_state, studio2, "RCA", "Studio II", GAME_SUPPORTS_SAVE ) |
658 | | CONS( 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 ) |
659 | | CONS( 1978, mpt02, studio2,0, mpt02, studio2, studio2_state, studio2, "Soundic", "Victory MPT-02 Home TV Programmer (Austria)", GAME_WRONG_COLORS | GAME_SUPPORTS_SAVE ) |
660 | | CONS( 1978, mpt02h, studio2,0, mpt02, studio2, studio2_state, studio2, "Hanimex", "MPT-02 Jeu TV Programmable (France)", GAME_WRONG_COLORS | GAME_SUPPORTS_SAVE) |
661 | | CONS( 1978, mtc9016, studio2,0, mpt02, studio2, studio2_state, studio2, "Mustang", "9016 Telespiel Computer (Germany)", GAME_WRONG_COLORS | GAME_SUPPORTS_SAVE ) |
662 | | CONS( 1978, shmc1200, studio2,0, mpt02, studio2, studio2_state, studio2, "Sheen", "1200 Micro Computer (Australia)", GAME_WRONG_COLORS | GAME_SUPPORTS_SAVE ) |
663 | | CONS( 1978, cm1200, studio2,0, mpt02, studio2, studio2_state, studio2, "Conic", "M-1200 (?)", GAME_WRONG_COLORS | GAME_SUPPORTS_SAVE ) |
664 | | CONS( 1978, apollo80, studio2,0, mpt02, studio2, studio2_state, studio2, "Academy", "Apollo 80 (Germany)", GAME_WRONG_COLORS | GAME_SUPPORTS_SAVE ) |
| 658 | CONS( 1978, visicom, studio2,0, visicom, studio2, studio2_state, studio2, "Toshiba", "Visicom COM-100 (Japan)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) |
| 659 | CONS( 1978, mpt02, studio2,0, mpt02, studio2, studio2_state, studio2, "Soundic", "Victory MPT-02 Home TV Programmer (Austria)", GAME_SUPPORTS_SAVE ) |
| 660 | CONS( 1978, mpt02h, studio2,0, mpt02, studio2, studio2_state, studio2, "Hanimex", "MPT-02 Jeu TV Programmable (France)", GAME_SUPPORTS_SAVE) |
| 661 | CONS( 1978, mtc9016, studio2,0, mpt02, studio2, studio2_state, studio2, "Mustang", "9016 Telespiel Computer (Germany)", GAME_SUPPORTS_SAVE ) |
| 662 | CONS( 1978, shmc1200, studio2,0, mpt02, studio2, studio2_state, studio2, "Sheen", "1200 Micro Computer (Australia)", GAME_SUPPORTS_SAVE ) |
| 663 | CONS( 1978, cm1200, studio2,0, mpt02, studio2, studio2_state, studio2, "Conic", "M-1200 (?)", GAME_SUPPORTS_SAVE ) |
| 664 | CONS( 1978, apollo80, studio2,0, mpt02, studio2, studio2_state, studio2, "Academy", "Apollo 80 (Germany)", GAME_SUPPORTS_SAVE ) |