static WRITE16_HANDLER( video_regs_w ) { pzletime_state *state = space->machine().driver_data<pzletime_state>(); int i; COMBINE_DATA(&state->m_video_regs[offset]); if (offset == 0) { if (state->m_video_regs[0] > 0) { for (i = 0; i < 0x300; i++) { palette_set_pen_contrast(space->machine(), i, (double)0x8000/(double)state->m_video_regs[0]); } } } else if (offset == 1) { if (state->m_video_regs[1] > 0) { for (i = 0x300; i < 32768 + 0x300; i++) { palette_set_pen_contrast(space->machine(), i, (double)0x8000/(double)state->m_video_regs[1]); } } } }
INPUT_PORTS_END //////////////////// // PALETTE INIT // //////////////////// void cybiko_state::palette_init() { // init palette for (int i = 0; i < 4; i++) { palette_set_color(machine(), i, RGB_WHITE); #ifndef HD66421_BRIGHTNESS_DOES_NOT_WORK palette_set_pen_contrast(machine(), i, 1.0 * i / (4 - 1)); #endif } }
UINT32 hd66421_device::update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { pen_t pen[4]; _logerror( 1, ("video_update_hd66421\n")); // update palette for (int i = 0; i < 4; i++) { double bright; int temp; temp = 31 - (m_reg[LCD_REG_COLOR_1 + i] - m_reg[LCD_REG_CONTRAST] + 0x03); if (temp < 0) temp = 0; if (temp > 31) temp = 31; bright = 1.0 * temp / 31; pen[i] = i; #ifdef HD66421_BRIGHTNESS_DOES_NOT_WORK palette_set_color(machine(), pen[i], 255 * bright, 255 * bright, 255 * bright); #else palette_set_pen_contrast(machine(), pen[i], bright); #endif } // draw bitmap (bottom to top) if (m_reg[0] & LCD_R0_DISP) { int x, y; x = 0; y = HD66421_HEIGHT - 1; for (int i = 0; i < HD66421_RAM_SIZE; i++) { plot_pixel(bitmap, x++, y, pen[(readbyte(i) >> 6) & 3]); plot_pixel(bitmap, x++, y, pen[(readbyte(i) >> 4) & 3]); plot_pixel(bitmap, x++, y, pen[(readbyte(i) >> 2) & 3]); plot_pixel(bitmap, x++, y, pen[(readbyte(i) >> 0) & 3]); if (x >= HD66421_WIDTH) { x = 0; y = y - 1; } } }